M2-T01: full ECMAScript value model (closes #27) - #106
Merged
Conversation
…unction/External)
- Value::Undefined (keyword literal; typeof 'undefined')
- Value::BigInt(i64) (bounded; BigInt() conversion from number/bool; 0n
falsy; display 42n)
- Value::Symbol { id, key } (identity-distinct; Symbol(key) builtin)
- Value::Object (Rc<RefCell<Map>>): dynamic prop bag — Object() builtin,
member get/set, index access, missing prop -> undefined
- Value::Function { params, body }: first-class — Closure eval now yields
a real Function value (was Null); call_value invokes with param binding
(missing arg -> undefined)
- Value::External(u64): opaque; truthy; typeof 'external'
- ECMA ToBoolean + ToNumber (undefined->NaN, null->0, bool->0|1, string
parse) + typeof builtin; 1 + undefined now NaN (was 'non-number operand')
- 'undefined' keyword lowers to a literal (not an unbound var)
7 tests in tests/value_model.rs; suite 170 green; clippy/fmt/audit clean.
Records: M2 in progress 1/15, 55/106 overall.
Closes#27Uh oh!
There was an error while loading. Please reload this page.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for freeto join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What
Closes#27. The Level-2 foundation: the complete ECMAScript value vocabulary with observable behavior (not just enum arms):
BigInt()conversion), Symbol (id+key; identity-distinct), Object (shared mutable bag — member get/set/index; missing prop → undefined), Function (first-class:JsExpr::Closurenow evaluates to a real Function value — it was Null;call_valueinvokes with param binding, missing arg → undefined), External (opaque).typeofbuiltin, ECMA display.1 + undefinedwas "non-number operand", now NaN (ECMA parity).Verification
7 tests in
tests/value_model.rs: undefined keyword + falsiness, full truthiness matrix, BigInt semantics, symbol identity, object dynamic bags, first-class functions, external/opaque invariants. Suite 170 green; clippy-D warningsclean; fmt clean; audit green. Records: M2 1/15 in progress, overall 55/106.