Daily Thought - 2024-05-06
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.
I explained why I like postfix operators, and why I think infix operators aren't an option for Caterpillar. But if I want to restrict Caterpillar to one kind of operator, I could use prefix operators, right? They are just as universal as postfix operators, and much more common. All true, but I think in a direct comparison, postfix operators win.
My main gripe with prefix operators, is that they cause a mismatch between the
order of operations as they are written down, and as they actually happen.
Consider something like work_with_thing(configure_thing(construct_thing()))
.
When reading this, you have to mentally evaluate it from the inside out.
And yes, you could use variables to store intermediate results, splitting this confusing expression over multiple lines, thereby fixing the mismatch. But you can also use variables with postfix operators, where they make things more clear. In cases where variables don't make things more clear, prefix operators end up more verbose.
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.