-
Notifications
You must be signed in to change notification settings - Fork 53
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Runtime error-on-nil for tables #89
Comments
We decided to not change the semantics of existing Lua operations, to avoid creating confusion. Something like this is should come back in the form of new syntax for asserting that a value is not nil. |
I completely agree. On second thoughts I realise it's better not to change the way the language runs, since programmers will not expect this from a stronger-typing pre-compiler. For the time being I have been using a function I'm no language designer, but just "throwing it out there", I'd be interested in a EDIT: i.e. |
At the moment this would probably be the most helpful addition to the language for me |
I want to wait until the changes in the code generator being done in the GSoC branch are merged back in master, as this requires not only changes to the typechecker, but a little bit of runtime library also (wrapping the expression in a call to Sorry for the inconvenience. With the latest commit you can alias
|
Don't worry, I'm not using typedlua for anything important at the moment, I'm just giving feedback for the sake of the project. Yeah the alias of assert is a good idea for now, thanks. |
From Typed Lua: An Optional Type System for Lua, pp4-5:
In current Typed Lua, all such tables now default to the optional form, e.g.
{string: number}
becomes{string: number?}
.So I want to know:
I would personally find the language runtime-checked table types very useful, and even the paper agrees with me that having to type-safe discard
nil
for all table accesses: "[makes] using the elements more inconvenient".The text was updated successfully, but these errors were encountered: