Daily Thought - 2024-06-28
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.
When you create new bindings in Caterpillar (or "variables", as they are often called in other languages), you modify the current scope. I'm intrigued by the thought of not allowing that, and instead creating a new scope every time you create a binding. (This is how functional languages tend to do it.)
Here's an idea for how that could look:
a b + => x
{ x x * }
We have an expression, a b +
, we bind the result of that expression to the
name x
, and then we can use that x
in a new scope that the binding operation
creates (the code between {}
).
If there was much more code within that block, we wouldn't need to read all of
it to understand the x x *
expression, because none of that other code could
change what x
is. I have little practical experience with languages that work
like that, but it seems like this could contribute to making code easier to
understand.
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.