It's great to see you again! Sometimes I've wondered about the status of Semi-Arc. Looks like you've been working on a number of other Lisp implementations in the meantime! Pretty exciting. Thanks for sharing this update with us.
case ContOp.ApplyFun: // exp2 is a function.
[exp, env] = applyFunction(exp2, args, k, env);
if (exp instanceof Promise)
exp = await exp;
This means the web page is still interactive during the evaluation effectively.
Here is an example: https://nukata.github.io/little-scheme-in-typescript/example.
Click the "Load" button twice and you will see two "yin-yang puzzle" threads run on the page.
Click the "Stop at Writing" button twice to stop them.
$ java -jar semi_arc.jar
arc> (let ((o x 2)) nil x)
arc> (let (a (o b 2)) '(1) b)
arc> (let default 2 ((fn ((o x default)) x)))
arc> (let default 2 (let ((o x default)) nil x))
arc> (let default 2 (let (a (o b default)) '(1) b))
arc> (let (x y) '(a b c) y)
*** 2 args expected for #<fn:2::(#((a b c)))>: (a b c)
0: (#<done> #<fn:2::(#((a b c)))> a b c)
arc> (let (x y z nothing) '(a b c) nothing)
*** 4 args expected for #<fn:4::(#((a b c)))>: (a b c)
0: (#<done> #<fn:4::(#((a b c)))> a b c)
I upvoted you 'cause Semi-Arc's doing what you want it to do (which is what really matters), but I'd like to mention that I actually kinda appreciate the way Arc accepts mismatched destructuring lengths.
I've seen other people's code use a (let (a b c) nil ...) idiom as a shortcut for (with (a nil b nil c nil) ...). As for me, I like being able to design multiple types so that they can be used in an ad-hoc polymorphic way like this:
Both these techniques could still be used in an Arc implementation with a stricter treatment of destructuring: The first could be done by defining a 'w/nil macro, and the second could be expressed as (let (x y . rest) rep.point ...). In your favor, the strict treatment makes it easier to write functions that do complain if the length is incorrect, encouraging fail-fast code. However, as far as portability is concerned, the "N args expected" errors are a quirk of Semi-Arc.
I'm going to try out Semi-Arc right now. ^_^ I'm sure I'll have some error reports for you in a moment. Hopefully not too many! :-p
Nice. Have you played around with multiple arc implementations in the process of making semi-arc? I'd love to read about your experience writing semi-arc, and the design decisions you made. (email in profile if you want to chat further)