Crosscut

Daily Thought - 2024-10-07

Hey, I'm Hanno! These are my daily thoughts on Crosscut, the programming language I'm creating. If you have any questions, comments, or feedback, please get in touch!

This thought was published before Crosscut was called Crosscut! If it refers to "Caterpillar", that is the old name, just so you know.

< back to list

The hypothetical syntax that I presented yesterday does not have any delimiters, like commas (,), to demarcate between different elements in a list, tuple, or map. This has precedence in the current syntax. Branch parameters are not delimited either.

I like the clean look this results in, but there are subtleties to consider. Thanks to postfix operators and stack-based evaluation, it's possible to even have more complex elements without ambiguity. Consider a list like [ a b 1 + ]. This is semantically unambiguous when evaluating it left to right (add a; add b; add 1; then take b and 1, add their sum).

But that doesn't mean it's a good idea. For one, it might be unambiguous, but that doesn't mean it's clear. Without delimiters, this must be formatted using whitespace to become readable. The other issue is syntactical ambiguity. The compiler can't make sense of this just by parsing it. It needs to run type-checking, at least.

<< previous thoughtnext thought >>

Hey, you! Want to subscribe to my daily thoughts? Just let me know (maybe include a nice message, if you're up for it), and I'll send you an email whenever I post a new one.