remove nil/null: absence is an error, empty object is the only no-value
- delete the nil type; catscript has no nil and no null - add the empty object (Object with no members), exposed as the global 'empty'; it is a shared immutable singleton - 'nil' is no longer a keyword: it is an undefined global, which raises - undefined global -> error (consistent with a missing attribute) - only 'false' is falsy (numbers/objects are truthy); booleans kept - OP_NIL -> OP_EMPTY; compiler, VM, stdlib, toml, ffi, generator, file, list, selector, value all migrated - rename the table type to Object - std/ front-end and examples/tests migrated to 'empty' - 84/84 tests
This commit is contained in:
1 parent
e0bf102f2a
commit
d29b0706c9
36 files changed
+257
-244
No files matched your search
+1
-2
@@ -31,7 +31,6 @@ static const struct kw g_keywords[] = {
|
||||
{ "if", CAT_LEXER_TOK_IF },
|
||||
{ "in", CAT_LEXER_TOK_IN },
|
||||
{ "local", CAT_LEXER_TOK_LOCAL },
|
||||
{ "nil", CAT_LEXER_TOK_NIL },
|
||||
{ "not", CAT_LEXER_TOK_NOT },
|
||||
{ "or", CAT_LEXER_TOK_OR },
|
||||
{ "repeat", CAT_LEXER_TOK_REPEAT },
|
||||
@@ -259,7 +258,7 @@ const char *cat_lexer_kind_name(int kind)
|
||||
static const char *names[] = {
|
||||
"EOF", "NAME", "INT", "FLOAT", "STRING",
|
||||
"and", "break", "do", "else", "elseif", "end", "false", "for",
|
||||
"function", "if", "in", "local", "nil", "not", "or", "repeat",
|
||||
"function", "if", "in", "local", "not", "or", "repeat",
|
||||
"return", "then", "true", "until", "while",
|
||||
"yield", "try", "except", "raise",
|
||||
"+", "-", "*", "/", "%", "^", "#", "==", "~=", "<=", ">=", "<",
|
||||
|
||||
Reference in new issue
Block a user