Daily Note - 2024-05-09
Hey, I'm Hanno! These are my daily notes on Crosscut, the programming language I'm creating. If you have any questions, comments, or feedback, please get in touch!
This note was published before Crosscut was called Crosscut! If it refers to "Caterpillar", that is the old name, just so you know.
There's one thing prefix operators do, that postfix operators typically don't: clearly delimit which arguments belong to an operation, using parentheses. This is more verbose, but also more readable. If we had an IDE though, that shows us where arguments belong, we could re-gain that readability.
But there's one disadvantage to not having delimiters,
that an IDE can't save us from: It restricts how we can
overload functions. Let's say we have a function
f
that takes an argument of type B
. We can't create an overloaded variant that
takes two arguments of type A
and B
without introducing ambiguity at the call
site.
So here's a thought experiment: What if functions can
have only one argument (which could be a tuple)? Then
there would be a clear difference between a b
f
(we need the B
variant) and ( a b )
f
(we need the A
and B
variant). The more I think about that, the
more I like it!