GaijinEntertainment / daScript

daslang - high-performance statically strong typed scripting language
https://daslang.io
BSD 3-Clause "New" or "Revised" License
907 stars 101 forks source link

Do away with python-style ident? #1159

Open arjunmenon opened 4 months ago

arjunmenon commented 4 months ago

Hi, I just discovered this project. Congratulations on achieving such high performance over luajit.

One suggestion, not sure how it will ring but just putting it out. Possible to do away with python-style ident? Whitespace like that make it, to some extent, less approachable without IDE. Simple statements on newlines does the job and make it easier to script without worrying too much about visual alignment.

Curly braces are a nice addition for anyone used to a c-style lang.

Thoughts?

borisbat commented 4 months ago

can already use curly bracers. i.e. block can be open on the same line, and from that point on nested blocks are that of C style. and ; is required. we are currently discussing explicit C-style syntax via option \ code of policies.

hasanyasin commented 2 weeks ago

If the argument for curly braces is to have the same block of code with lines at different indentation levels, please don't! Please don't ever write code like that, ever!

One needs to use a proper text editor to code, not necessarily an IDE as suggested, but something that can at least keep the indentation the same as the previous line.

Whatever editor/IDE/tools one uses to edit code, code blocks should be properly indented with every indentation level marking the block beginning and end. Whether there are curly braces or not, if a block is not indented properly, it's simply a mistake that should be fixed.

I code equally in languages with both curly-braced (Go, JavaScript, C) and indented (Nim, Python) syntaxes. I prefer indentation for a very simple reason: We are engineers and I believe we would all agree on what redundant means. Curly braces are simply redundant like the semicolon at the end of each line. (Semicolons may be useful for multiple statements on a single line, which itself is bad usually, but otherwise just a waste of eyesight). When typing, there is not much difference, but when reading, all those redundant characters makes the code less clear than it could have been.