17cupsofcoffee / seventeencups.net

🌐 Source code for SeventeenCups.net
https://www.seventeencups.net
MIT License
3 stars 3 forks source link

https://www.seventeencups.net/posts/how-lua-avoids-semicolons/ #2

Open utterances-bot opened 5 years ago

utterances-bot commented 5 years ago

How Lua Banished the Semicolons - Joe Clay

My current pet project outside of work is developing a little programming language called Ein. I decided fairly early on in development that I didn't want Ein to have semicolons, so I've spent a fair chunk of the past week investigating how other language…

https://www.seventeencups.net/posts/how-lua-banished-the-semicolons/

Tachytaenius commented 5 years ago

I don't understand, what would a statement saying "-1" ever mean?

17cupsofcoffee commented 5 years ago

@wolfboyft It wouldn't mean anything useful, but it's still perfectly valid code in most langauges, because they allow you to use an expression anywhere where a statement would be valid.

Tachytaenius commented 5 years ago

@17cupsofcoffee If expression-statements don't do anything but, as Lua has proven, there's no reason to have semicolons without them... are they not just pointlessly forcing you to use semicolons?

17cupsofcoffee commented 5 years ago

@wolfboyft It's not entirely pointless - the main arguments I can think of in favor of allowing expression statements are:

Whether you think those arguments outweigh the benefits is up to you :) I've since switched my language back to using semicolons, but that's more because I personally find they make the code more readable - I'm still not totally convinced that expression statements are entirely necessary.

pes18fan commented 1 year ago

This was super useful, thank you!

17cupsofcoffee commented 1 year ago

@pes18fan No problem, I'm glad people are still finding it useful 5 years (?!) later 😄