-
Notifications
You must be signed in to change notification settings - Fork 484
Remove Int.Ref and the %incr, %decr and %refget builtins #8616
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
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -252,8 +252,6 @@ let erased_builtins : (string * Lambda.builtin) array = | |
| ("%identity", Eliminated Identity); | ||
| ("%component_identity", Eliminated Identity); | ||
| ("%ignore", Eliminated Ignore); | ||
| ("%incr", Offset_ref 1); | ||
| ("%decr", Offset_ref (-1)); | ||
| ("%null", Constant Const_js_null); | ||
| ("%undefined", Constant (Const_js_undefined {is_unit = false})); | ||
| (* FIXME: Core compatibility *) | ||
|
|
@@ -268,7 +266,6 @@ let primitive_builtins : (string * Lambda.builtin) array = | |
| (* BEGIN Triples for ref data type *) | ||
| ("%makeref", Pmakeblock Lambda.ref_tag_info); | ||
| ("%refset", Psetfield (0, Lambda.ref_field_set_info)); | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
When AGENTS.md reference: AGENTS.md:L41-L43 Useful? React with 👍 / 👎.
Collaborator
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Removed those three declarations in the same commit — thanks, they were stale and nothing else in the repo declares them. One correction on the predicted failure, so the same finding doesn't get raised at P1 again: type ref<'a> = {mutable contents: 'a}
external incr: ref<int> => unit = "%incr"
// compiles; adding `let f = r => incr(r)` is what errorsThe neighbouring |
||
| ("%refget", Pfield (0, Lambda.ref_field_info)); | ||
| (* Finish Triples for ref data type *) | ||
| ("%field0", Pfield (0, Fld_tuple)); | ||
| ("%field1", Pfield (1, Fld_tuple)); | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,7 +1,7 @@ | ||
| let v = ref(0) | ||
|
|
||
| let f = (x, x) => { | ||
| Int.Ref.increment(v) | ||
| v.contents = v.contents + 1 | ||
| x + x | ||
| } | ||
|
|
||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
When the argument is not already a variable—such as the deleted regression case
Int.Ref.increment(mkRef())—the advertised substitution becomesmkRef().contents = mkRef().contents + 1, which invokesmkRef()twice and can read from and write to different references. Document that expression receivers must first be bound once, and retain an end-to-end regression test for this migration pattern.AGENTS.md reference: AGENTS.md:L41-L41
Useful? React with 👍 / 👎.