Log in

No account? Create an account
I've started work on a mod of Lua. Seems that everyone who uses Lua… - “Nightwatch” [entries|archive|friends|userinfo]
"Praxeology rests on the fundamental axiom that human beings engage in conscious actions toward chosen blah blah blah blah blah teh market!"

[ website | Pictures and Stuff ]
[ userinfo | livejournal userinfo ]
[ archive | journal archive ]

[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?

[User Picture]From: draggor
2008-06-28 06:45 am (UTC)
(Reply) (Thread)
[User Picture]From: night_watch
2008-06-28 07:15 am (UTC)
What about it? :)
(Reply) (Parent) (Thread)
[User Picture]From: ralesk
2008-06-28 06:51 am (UTC)
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.
(Reply) (Thread)