|
[Jun. 27th, 2008|08:47 pm] |
I've started work on a mod of Lua. Seems that everyone who uses Lua does this eventually... it's interesting how its internal simplicity leads to fragmentation.
Anyhow, here's what I have planned: - Curly brace syntax instead of paired keywords. Sorry, but "if then else end" is pretty baroque at this point. Braces are nicely Huffman coded. - Mandatory semicolons. - Arrays index from 0. Dijkstra is completely right on this one. - fn as an abbreviation for function. Also, fn(x) : foo should be accepted as shorthand for function(x) { return foo; } - No tuples. Tuples are lists instead. a, b, c is shorthand for [ a, b, c ]. - On that note, tables are initialized as { key: value }, allowing native JSON compatibility. - A unit type like OCaml, written as (). - All functions take one argument and return one argument, just like OCaml. Zero argument functions are invoked like f(); i.e. applying f to unit. Multiple argument functions are passed a liist. - Method invocation with ->, just like Perl and C++. - Maybe some form of pattern matching? Not sure how to do this correctly without bloating the language.
Suggestions, comments? |
|
|
| Comments: |
I don’t know much Lua — because, as I mentioned, it seems to make my stomach rather uneasy —, but reading this, you might just be fixing good part of the fugliness of that language. | |