Daily Thought - 2024-10-05
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.
Caterpillar is currently using {}
to delineate functions. Here's an example of
that:
{
\ a 0 ->
a
\ a b ->
a b +
}
This is a function with two branches. The first branch is executed, if the
second argument is 0
; the second branch is executed otherwise.
I'm thinking about replacing the braces with new fn
and end
keywords:
fn
\ a 0 ->
a
\ a b ->
a b +
end
In my opinion, this has two advantages:
- It is more obvious to the uninitiated.
fn
makes it relatively clear, that this is a function. - It frees up
{}
for other uses.
But it would also introduce two new keywords, which then would not be available as function names.
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.