fubark / cyber

Fast and concurrent scripting.
https://cyberscript.dev
MIT License
1.16k stars 38 forks source link

Indentation rules overlap with ":" #52

Closed Frozen1084 closed 1 year ago

Frozen1084 commented 1 year ago

I'm very confused why we still need to use ":" to define new blocks of code even though we are using indentation rules. Isn't this already defined by indentation?

It's a waste if it's just to support one-line patterns as well. if true: print 123

Another comment, can the "func" keyword be replaced with the more concise "fn"? My preference would be: fn > fnunc > function

Sometimes, when someone is particularly fond of using concise variable names. e.g. st pt li, then when he uses a language with very long keywords, the code becomes particularly stupid.

fubark commented 1 year ago

In both cases, the reason is for readability.

A colon after each block is a consistent pattern that indicates you are beginning a new block rather than continuing an expr on the next line. This is actually very important since Cyber is very structural in it's syntax.

"func" is preferred because it's not too short and not too long to convey what it is. Shorter doesn't automatically make something "better" or less wasteful. If the goal was to come up with the shortest acronym, this would be a different language. (Probably not a very well designed one)