You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository has been archived by the owner on Jun 14, 2022. It is now read-only.
.\love.lua.kailua:35:17: 35:21 [Error] Expected a name, got a keyword `open`
35 | --# assume File.open: method() --> boolean
| ^^^^
Similarly to open being a rather popular name, map is a widely-used function with entirely idiomatic semantics (see Underscore.lua, Penlight, Moses, Lua Functional, Lume...), and given that you'd need to use --# assume on it on nearly any invocation (similarly to #18), kailua's inability to stomach any annotation that mentions map as an identifier severely limits its usefulness.
vector also systematically occurs as an identifier name in certain subject domains.
The text was updated successfully, but these errors were encountered:
Every name can be escaped with backquotes (`) in the Kailua context, so this is merely an inconvenience. The different set of reserved words in the Kailua context had been also useful for future-proofing reserved word additions (e.g. an unescaped goto is a hard error in the Kailua context even when you are using it in Lua 5.1).
That said, we can probably make several keywords usable as identifiers when they will never occur as a keyword at that position even in the future. Are only open, map and vector problematic? map and vector as keywords were also a kind of transitionary syntaxes (in place of generic types) so they can be possibly removed from a set of keywords, without breaking any existing code.
I also plan to expand the documentation (instead of the current sorta ad-hoc overview :-) to describe such things in more detail in the future.
Escaping with ` works great, thanks! In my limited experience, I only ran into trouble with open, map and vector, but I can imagine method tripping up someone trying to implement yet another OOP system in Lua.
Sign up for freeto subscribe to this conversation on GitHub.
Already have an account?
Sign in.
A seemingly innocuous
leads to
Similarly to
open
being a rather popular name,map
is a widely-used function with entirely idiomatic semantics (see Underscore.lua, Penlight, Moses, Lua Functional, Lume...), and given that you'd need to use--# assume
on it on nearly any invocation (similarly to #18), kailua's inability to stomach any annotation that mentionsmap
as an identifier severely limits its usefulness.vector
also systematically occurs as an identifier name in certain subject domains.The text was updated successfully, but these errors were encountered: