This page is part of the web mail archives of SRFI 101 from before July 7th, 2015. The new archives for SRFI 101 contain all messages, not just those from before July 7th, 2015.
Alexey Radul wrote:
On Fri, Sep 18, 2009 at 4:48 PM, David Van Horn <dvanhorn@xxxxxxxxxxxxxxx> wrote:It is not possible to define a correct implementation of `quote' which produces random-access pairs as a library formThis may be a stupid question: why not define random-access-quote to use the standard quote and convert the result into a random-access list? (This may involve recurring inside the elements of literal vectors, but so be it).
It's not stupid at all. The issue is that quoted a constant must always be `eq?' to itself. So for example:
(define (f) '(x)) (eq? (f) (f)) => #t Compared to: (define (f) (cons 'x '()) (eq? (f) (f)) => #fIf you look at the formal semantics of R6RS, you'll notice the metafunctions that lift quoted constants to the top so they are evaluated only once before they are expanded to constructors. You can't do that lifting with a macro. It's my understanding that with single-instantiation library semantics, you could achieve the right behavior by making a table, but that since implementations are not required to use single instantiation, this approach is not portable.
Perhaps a macro wizard can prove me wrong. I would like that. But I'm pretty sure you just can't make a quote-like macro in a portable way, which is too bad.