lua-users home
lua-l archive

[Date Prev][Date Next][Thread Prev][Thread Next] [Date Index] [Thread Index]


On Fri, May 12, 2023, at 18:10, Mouse wrote:

> I think it's a bad idea to have type information that isn't enforced.
> Eventually it will drift out of sync with reality.  "If the code and
> the comments disagree, both are probably wrong."

The idea is not not to enforce them. The idea is that you can have
a dynamic language with statically checked types.

That is basically what Python 3 does, for instance (*). There is a typing
module that can be used to annotate the code but annotations are
not checked at runtime, they are supposed to be checked during
development and/or CI with tools such as mypy, pyright or pyre.

Initially it was pure syntax with undefined semantics, but they quickly
figured out it would result in a mess and defined  *some* semantics
in PEP 484 (let's say it is "blessed semantics" in the Lua community
lingo...)

I think this approach could make sense for Lua if we want to go
follow this path. Teal is a good playground for this, and it could also
have the advantage of turning most Pallene code into valid Lua
code, which means you could run a .pln file with the Lua interpreter.

(*) For those who know Python, please assume we live in a world
where PEP 563 is the default. It is worth reading by the way:
https://peps.python.org/pep-0563/

-- 
Pierre Chapuis