3 ms·
> I wish someone would make optional typing for Lua... I've wondered about this, as well. Adding it would probably greatly increase the size of the language/co
by silentbicycle 17y ago
> I wish someone would make optional typing for Lua...
I've wondered about this, as well. Adding it would probably greatly increase the size of the language/compiler, though (which goes against its major strength of being easily embeddable), and its not clear to me how it would fit with the underlying VM's design[1]. Just having a runtime-checked type system is quite a bit simpler, until programs get to a certain size.
I like inferred statically typed languages, but I think it may work better to leave Lua as-is, and instead focus on making an equally clean-but-pragmatic ML-styled language. H-M type inference, Haskell-style typeclasses, and pattern matching in the core language, but with the same tastefully minimalistic design that Lua has. Lua is (IMHO) an excellent scripting language, but it's still stateful/imperative by default. While OCaml and SML aren't purely functional, their design encourages going that way more than Lua's does, and it changes the semantics of the language considerably. (FWIW, I'm studying Prolog, unification, type systems, etc., and would love to work on such after I get a few more immediate projects finished...)
[1]: http://luaforge.net/docman/view.php/83/98/ANoFrillsIntroToLua51VMInstructions.pdf http://luaforge.net/docman/view.php/83/98/ANoFrillsIntroToLu...
- stcredzero 17y agoI'm thinking of doing something with adding optional typing to Smalltalk by just adding it to the compiler. Maybe add H-M type inference as well. One could do the same for Lua. Actually, I'm thinking of implementing a Smalltalk VM on top of LuaJIT and Javascript by JIT to the host language's source code.