lua-users home
lua-l archive

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


Gunnar Zötl wrote:
If I understand correctly, you do not want the type restrictions for
variables to be available at runtime, this is to be a compile-time
thing only?

Yes.

> But then if you also do not intend to explicitly specify
which type a given variable has, the compiler would somehow have to
guess the type of a variable (what you call "by example", i.e. from
the first assignment or somesuch). Is that about it?

Yes. I assume that the compiler already does type analysis. If not, a simple typing pass should be added.

It is a fairly simple pass: You propagate the types up from the leaves of the syntax tree to higher levels. When you arrive at the top, you know all your type by the type annotation and the structure of the tree.

See any compiler text book for the details.

Regards,
Asger Ottar Alstrup