Adding CL:TAGBODY for SERIES support

Philipp Marek philipp at marek.priv.at
Sat May 21 08:58:57 UTC 2022


Hi Andrew,

first of all -- how about registering on gitlab.common-lisp.net,
so that you can become a developer for [1] and work with a branch
using a Merge Request?
It would be much easier to track your progress (and individual changes)
that way.

> I have started to implement TAGBODY for PARENSCRIPT
> [A,B,C].  The general idea is to imitate a jump table
> by looping over a switch-case.  A GO (C-terminology:
> jump) then sets the switch-variable to the next jump
> destination.  The loop subsequently causes the switch
> to branch to the jump target in the switch-variable.
> Leaving the tagbody means leaving the loop.

Hmmm, okay.
My first thought would've been to use a function for each
part and just do tail recursion... but it seems that
this isn't really supported in Javascript?!



> There are complications.  Common Lisp allows nested
> tagbody-forms.  Common Lisp allows go-tags to be
> referenced within the lexical scope *and* the dynamic
> extent of a tagbody form.  This means that a LAMBDA
> can close over a go-tag and jump there, see an
> example in [B], of how inconvenient this can become
> for compilation to JavaScript.

Yeah... that would be a good reason for simple function
calls and tail recursion.


> 1. I need a code review of the algorithm.
>    The implementation in [B] seems to be
>    satisfactory.  There are some test cases and
>    examples.  Most there is the most hairy example I
>    could find up to now.  I may have missed crucial
>    details.

I'll take a look - but please let's try to get it into
the git repo first, so that any discussions have some
common state to refer to.


> 2. My understanding of the CL:TAGBODY definition in
>    the CLHS [4] may be wrong.  Which alternate
>    interpretations does anybody here know of?

What are your questions, or points of confusion?



Ad 1: https://gitlab.common-lisp.net/parenscript/parenscript



More information about the parenscript-devel mailing list