Re: [Scheme-reports] What happened to (UNQUOTE <expression> ...) Peter Bex (03 May 2011 07:37 UTC)
Re: [Scheme-reports] What happened to (UNQUOTE <expression> ...) Andre van Tonder (03 May 2011 12:57 UTC)

Re: [Scheme-reports] What happened to (UNQUOTE <expression> ...) Peter Bex 03 May 2011 07:37 UTC

On Tue, May 03, 2011 at 02:56:31PM +0900, Andrzej wrote:
> The question is whether we want to do it at all. Note that e.g.
> ``,,@(list) and ``,@,@(list) both expand into forms that are illegal
> when expanded again. Perhaps that's not a big issue but is not a
> particularly elegant design.

Agreed.  This also bothered me about the design. The whole splicing
thing is inconsistent with the rest of Scheme, as you point out so well
below:

> This could be fixed if  'quasiquote' itself (and for consistency also
> 'quote') were also taking any number of operands and "splice" them
> into a user's form invoking it.
>
> In such case above examples would expand to:
>
> > `,@(list 1 2) => 1 2 (two values inserted in the calling form or the interactive session)
> > `,@(list 1) => 1
> > `(unquote 1) => 1
> > `(unquote) => nil (no value)
> > `(unquote 1 2) => 1 2
>
> > ``,,@(list) => `(unquote)
> > ``,,@(list 1) => `,1
> > ``,,@(list 1 2) => `(unquote 1 2)
>
> > ``,@,@(list) => `(unquote-splicing)
> > ``,@,@(list 1) => `,@1
> > ``,@,@(list 1 2) => `(unquote-splicing 1 2)
>
> and for consistency:
> > (quote 1 2) => 1 2 (two values inserted in the calling form or the interactive session)
> > (quote) => nil (no value)

This is a huge change in how macros behave.  Currently a macro can only
expand into one form.  This is also why the splicing "inside" quasiquote
is so weird.

Cheers,
Peter
--
http://sjamaan.ath.cx
--
"The process of preparing programs for a digital computer
 is especially attractive, not only because it can be economically
 and scientifically rewarding, but also because it can be an aesthetic
 experience much like composing poetry or music."
							-- Donald Knuth

_______________________________________________
Scheme-reports mailing list
Scheme-reports@scheme-reports.org
http://lists.scheme-reports.org/cgi-bin/mailman/listinfo/scheme-reports