[r6rs-discuss] [Formal] quasiquote freshness

From: AndrevanTonder <andre>
Date: Tue Mar 6 10:53:52 2007

On Mon, 5 Mar 2007, R. Kent Dybvig wrote:

> According to the description of quasiquote, when no unquote or
> unquote-splicing forms appear in a <qq template>, (quasiquote <qq template>)
> is equivalent to (quote <qq template>). In this case, the value is
> a literal. Thus, it is not freshly allocated and is not mutable.

Are literals necessarily immutable? The language of section 4.8 seems to
require this, but then sections 6.3 and 9.5.1 both say (emphasis mine)

   ... the value of a literal expression /may/ be immutable

and section 9.12 says (regarding symbol->string)

   The returned string /may/ be immutable

in apparent violation of the language of 4.8.

> (B) quasiquote may return either fresh, mutable objects or literal
> structure for any list and vector structure that must be constructed
> under an assumption that the quantities within unquote and
> unquote-splicing forms are evaluated at run time. Portions that do
> not need to be rebuilt according to this provision are literal.

This could be weakened by changing the last line to

    Portions that do not need to be rebuilt according to this provision
    may be literal.

This would allow the simplest naive implementations to also be
conformant, yet at the same time it makes clear the responsibility of the
programmer not to rely on mutability of these objects in portable code.
I guess this is related to the question of the general philosophy of the
report as has been previously discussed on this list in a thread
started by Will Clinger.

Cheers
Andre
Received on Tue Mar 06 2007 - 10:53:04 UTC

This archive was generated by hypermail 2.3.0 : Wed Oct 23 2024 - 09:15:01 UTC