[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: Re: Any plans regarding static typing in core Lua?
- From: Dirk Laurie <dirk.laurie@...>
- Date: Tue, 8 Mar 2016 08:15:52 +0200
2016-03-08 2:08 GMT+02:00 Mateusz Czaplinski <czapkofan@gmail.com>:
> Those being external unofficial tools/projects has a whole lot of
> disadvantages vs. if it was an official part of the language. That's
> why I'm interested in them being part of the core, and that's
> specifically what I'm asking about.
This argument is a standard one from supporters of new features.
The standard answer is that Lua is a less-is-more language. Its
appeal and power comes from having a small number of
versatile but conceptually simple constructions.
> And also the existence of those projects (esp. Typed Lua, given
> its PUC roots) is why I'm even having any hopes for that and dare
> ask at all.
Roberto is not only the chief architect of Lua, he is also a professor
of computer science. Typed Lua was a thesis project. A good thesis
project is one that sits well with the student, rather than being just an
episode in the mainstream of the professor's research.
To get an idea of who did what when, just clone the repository and
read the output of `git log`. Then draw your own conclusions as to
whether this project is still being worked on.
> Also, as to the "non-goal" support voices: I explicitly mentioned an
> *optional* type system, which I'd imagine could hopefully be made
> perfectly backwards-compatible with the current approach? (as
> seems to be the case with e.g. the Typed Lua project, no?)
Typed Lua is an optional type system that does not add one line
of code to the Lua core. You can't get more optional than that.
> (So I genuinely don't really understand what's a problem here
> one would feel a need to "hope against"?
The moment that something is in the core, documented in the
Lua manual, it is no longer truly optional. For example, 'pairs'
is not necessary. `for k,v in pairs(tbl) do` can be coded in two
fewer characters as `for k,v in next,tbl do` and there is only
a difference if you have supplied a `__pairs` metamethod. Yet
people consider `pairs(tbl)` to be the standard way of doing it
and `next,tbl` to be a hard-to-read alternative.
The moment that "optional" typing is in the core, little snippets
of code posted on this list will start having these "optional"
annotations and Lua code will start looking like Julia code.
<http://docs.julialang.org/en/release-0.4/manual/types>