typedlua icon indicating copy to clipboard operation
typedlua copied to clipboard

Making more use of the new filter system

Open mascarenhas opened this issue 8 years ago • 0 comments

New filter/projection system in place. Now it is a matter of adding filtering to the right side of boolean expressions based on the filters on the left side, plus a filter for assert. We can probably be more aggressive when narrowing types via assignment, and do it everytime instead of just if the right hand of the assignment is an or:

-- foo is declared as string|number|nil
foo = tostring(foo) -- foo now is a string
foo = tonumber(foo) -- foo now is a number (reverts to string|number|nil, then narrow again)
foo = f() -- f: () -> number|string, foo now is number|string
foo = g() -- g: () -> number|string|nil, foo reverts to its original type

This is technically easy to do, and sound if the standard limitations of filters are respected, but I worry it might be too confusing.

mascarenhas avatar Jul 16 '16 00:07 mascarenhas