Email list hosting service & mailing list manager

Choose-Your-Own-Ellipsis Allophone Petrofsky (13 Oct 2003 14:43 UTC)
Re: Choose-Your-Own-Ellipsis bear (13 Oct 2003 18:41 UTC)
Re: Choose-Your-Own-Ellipsis Taylor Campbell (14 Oct 2003 21:33 UTC)
Re: Choose-Your-Own-Ellipsis Taylor Campbell (15 Oct 2003 20:31 UTC)
Re: Choose-Your-Own-Ellipsis Alabaster Petrofsky (15 Oct 2003 22:10 UTC)
Re: Choose-Your-Own-Ellipsis Taylor Campbell (17 Oct 2003 21:45 UTC)

Re: Choose-Your-Own-Ellipsis Alabaster Petrofsky 15 Oct 2003 22:07 UTC

> From: Taylor Campbell <xxxxxx@evdev.ath.cx>

> In improving Andre van Tonder's monadic CPS macro stuff, I wrote an
> MSYNTAX-RULES.

> But I found this problem: should the user not specify the ellipsis,
> and let it default to ..., how will MSYNTAX-RULES deal with it?

Your code is too fragmentary for me to understand what you're trying
to do.  You talk about expanding into a SYNTAX-RULES form, but in
r5rs, any macro use must ultimately expand into an expression,
definition, or BEGIN form.  I guess what you're trying to write is
something like this:

  (define-syntax define-msyntax-rules
    (syntax-rules ()
      ((define-msyntax-rules name ?ellipsis ?literals
	 ((?ignored . ?pattern)
	  (?macro . ?args))
	 ...)
       (define-syntax name
	 (syntax-rules ?ellipsis ?literals
	   ((?ignored (k ?ellipsis) . ?pattern)
	    (?macro (k ?ellipsis) . ?args))
	   ...)))))

  I
> Am I missing some macro magic here, is there a problem with choose-
> your-own-ellipsis, or should the implicit ... stuff be thrown away?
> The last option would break lots of macros, and it would look rather
> ugly to me, but I can't think of a better way to solve this.

If we specified that syntax-rules from now on requires an ellipsis
argument, then that would of course break the entire existing body of
syntax-rules macros.

However, if you specify that define-msyntax-rules requires an ellipsis
argument, I don't think there's any body of define-msyntax-rules code
out there to be worried about breaking.

Nevertheless, if you want define-msyntax-rules's ellipsis argument to
be optional, with the implicit (and essentially non-hygienic) choice
of "..." when it is missing, you could do this:

  (define-syntax define-msyntax-rules
    (syntax-rules ::: ()
      ((define-msyntax-rules name (?literal :::)
	 ((?ignored . ?pattern)
	  (?macro . ?args))
	 :::)
       (define-syntax name
	 (syntax-rules (?literal :::)
	   ((?ignored (k ...) . ?pattern)
	    (?macro (k ...) . ?args))
	   :::)))
      ((define-msyntax-rules name ?ellipsis ?literals
	 ((?ignored . ?pattern)
	  (?macro . ?args))
	 :::)
       (define-syntax name
	 (syntax-rules ?ellipsis ?literals
	   ((?ignored (k ?ellipsis) . ?pattern)
	    (?macro (k ?ellipsis) . ?args))
	   :::)))))

> What are some thoughts on non-linear patterns and guards

I think they are probably incompatible with the title of the SRFI,
"Basic SYNTAX-RULES Extensions".

-al