Daily Thought - 2024-09-22
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've been doing a bit of light reading on other languages. Just snooping through documentation and code samples. That inspired me to make a change to Caterpillar's syntax.
Here's how function literals looked like, as of yesterday:
{
|a 0|
a
|a b|
a b +
}
The parameters of each branch were delimited by |
. This was directly inspired
by Rust (which might have gotten it from Ruby).
As of last night, the same code looks like this:
{
\ a 0 ->
a
\ a b ->
a b +
}
Each branch now starts with a \
, while a ->
introduces the branch body. This
is directly inspired by Roc, but I've also seen it in Elm and Futhark. I
guess it's an ML-family thing.
I never quite liked how the same token was used on both ends of the parameter list. Now the start of that and the start of the body each look unique.
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.