lua-users home
lua-l archive

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


> I thought about a compiler extension. An optional type name before the
> parameter name.  Like:
> 
>   function(typename varname, ...)

I'd prefer varname : typename, both because it's easier to read, and 
because it doesn't use up syntactic concatenation, but otherwise, yes, I 
like this idea, and that it could work on assignments and declarations.

I hadn't been thinking about methods which involved changing the compiler.

> PS: I think, one needs another syntax to specify optional typed
> arguments (may be nil or of that type).  I.e. append an '?':
> function(FooType x?)

Another problem is how to keep the type of a value which is set to nil so 
that it can't be then be set to another type (assuming that you want to 
enforce types on names rather than just values).

-- 
http://www.mupsych.org/~rrt/
My dark path darkens; rise over the mountain, distant moon (Murasaki)