Skip to content

Commit

Permalink
Decay ~end~ isotopes to ~null~ isotopes
Browse files Browse the repository at this point in the history
This pushes forward an evaluator concept that frame execution
can fill slots with ~end~ on a first pass, and then turn them
into nulls when the frame actually executes.

(It's similar to how unsets are turned into nulls.)
  • Loading branch information
hostilefork committed Jun 30, 2023
1 parent 427d295 commit 0428bc1
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 5 deletions.
1 change: 1 addition & 0 deletions src/core/evaluator/c-action.c
Original file line number Diff line number Diff line change
Expand Up @@ -901,6 +901,7 @@ Bounce Action_Executor(Frame(*) f)
if (Is_Word_Isotope_With_Id(ARG, SYM_END)) {
if (NOT_PARAM_FLAG(PARAM, ENDABLE))
fail (Error_No_Arg(f->label, KEY_SYMBOL(KEY)));
Init_Nulled(ARG); // more convenient, use ^META for nuance
continue;
}

Expand Down
2 changes: 1 addition & 1 deletion tests/functions/function.test.reb
Original file line number Diff line number Diff line change
Expand Up @@ -484,6 +484,6 @@
(the '1020) = (foo 1020)
nihil' = (foo comment "HI")
null' = (foo any [1 > 2, 3 > 4])
'~end~ = meta (foo)
null? (foo)
]
)
8 changes: 4 additions & 4 deletions tests/functions/invisible.test.reb
Original file line number Diff line number Diff line change
Expand Up @@ -200,10 +200,10 @@

~no-arg~ !! (right-normal ||)
(null? do [right-normal* ||])
('~end~ = ^ do [right-normal*])
(null? do [right-normal*])

~no-arg~ !! (|| left-normal)
('~end~ = ^ do [|| left-normal*])
(null? ^ do [|| left-normal*])
(null? do [left-normal*])

~no-arg~ !! (|| left-defer)
Expand All @@ -212,7 +212,7 @@

('|| = do [right-soft ||])
('|| = do [right-soft* ||])
('~end~ = ^ do [right-soft*])
(null? ^ do [right-soft*])

; !!! This was legal at one point, but the special treatment of left
; quotes when there is nothing to their right means you now get errors.
Expand All @@ -224,7 +224,7 @@

('|| = do [right-hard ||])
('|| = do [right-hard* ||])
('~end~ = ^ do [right-hard*])
(null? do [right-hard*])

; !!! See notes above.
;
Expand Down

0 comments on commit 0428bc1

Please sign in to comment.