[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: Upvalues and static typing
- From: Dibyendu Majumdar <mobile@...>
- Date: Sat, 11 Apr 2015 03:45:08 +0100
Hi,
While working on the core API the realization dawned that up-values
can subvert static typing of local variables :-(
> function x() local i: integer; return function(j) i = j; end; end
> f=x()
> f(5)
> f('hello')
Haven't thought yet how to fix this:
a) Probably easiest to disallow referencing typed values in up-values
b) Alternatively up-values need to be typed ... not sure if that is
possible to enforce at compile time
Regards
Dibyendu