Arc Forumnew | comments | leaders | submitlogin
1 point by fallintothis 5631 days ago | link | parent

Scheme handles nested quasiquoting differently than Common Lisp - expands the unquotes in a different order or some such.

Well, if we're to believe a single statement in an Alan Bawden paper from 1999: "I am not aware of the existence of a correct optimizing quasiquotation expander for Scheme. (None of the Scheme implementations that I tested implement nested splicing correctly.)" -- http://repository.readscheme.org/ftp/papers/pepm99/bawden.pd...

The entire semantic reasoning is what I'm hung up on: does it seem right that ,,@(...) isn't supposed to work? Not that I'm necessarily advocating one rationale over another, just that I've simply not heard any such rationale. (My Google-fu is upsettingly weak here.)

Arc doesn't report an error because the second argument to unquote gets tossed out during compilation

Ah, duh. Makes sense. I had tried combing through the compiler, but was rather aimless. Thanks.

This is actually a fairly common "bug" in arc's compiler.

I'd probably call it a bug in the case of 'coerce, since the arguments (being passed directly to a Scheme function) all get evaluated -- if the third argument was truly ignored (in the "compiled away" sense), then it shouldn't even do anything. Plus, this behavior also reaches functions like 'outfile and (to an extent) 'writec.

Granted, maybe it's wise to go against "protecting" the programmer and assume that they know what they're doing; maybe I'd happen to want to assign a variable in the same statement as an 'outfile, I don't know.



2 points by CatDancer 5631 days ago | link

does it seem right that ,,@(...) isn't supposed to work?

Doing some googling, I see that this bug was reported against plt scheme in 2002: http://www.cs.brown.edu/pipermail/plt-scheme/2002-June/00004...

R6RS takes the approach of allowing (unquote 1 2 3). Section 11.17 of the standard has this example:

  (let ((name 'foo))
    `((unquote name name name)))
          => (foo foo foo)

-----

1 point by fallintothis 5631 days ago | link

Good find, thanks. Now it at least makes sense to call this a bug (well, others have at any rate), though not specifically in Arc.

-----