guile-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: pending branch: lexical-literals


From: Ludovic Courtès
Subject: Re: pending branch: lexical-literals
Date: Fri, 06 May 2011 14:17:22 +0200
User-agent: Gnus/5.110017 (No Gnus v0.17) Emacs/24.0.50 (gnu/linux)

Hi Andy,

Sorry for the late reply.

Andy Wingo <address@hidden> writes:

> I have a branch that fixes literal matching to actually compare toplevel
> bindings, as the RNRS suggest, rather than simply assuming that a
> literal that is not lexically bound can be compared symbolically.
>
> (Recall that literals are things like `else' and `=>' in `cond'.)

I think I don’t fully understand the implications yet, partly because it
goes against my idea of what a “literal” is: to me, a literal in
‘syntax-rules’ and ‘syntax-case’ is a symbol, not a binding.

I read the R7RS thread and André Van Tonder does seem to have compelling
arguments, but again, that’s still a bit too disruptive to me.  :-)

> I send this note because this change increases the coupling between a
> macro's definition and the definition of the literals that it
> references.
>
> For example, in the past:
>
>     scheme@(guile-user)> (cond (else #t))
>     $1 = #t
>
> Here the `else' is unbound both in the definition of `cond' and at the
> use-site, so the literal should match in any case.
>
>     scheme@(guile-user)> (define else #f)
>     scheme@(guile-user)> (cond (else #t))
>     $2 = #t
>
> Here the `else' is bound at the site of use, but the comparison still
> succeeded, because `else' was matched by name (symbolically), not by
> binding (lexically).
>
> But now, with this change:
>
>     scheme@(guile-user)> (cond (else #t))
>     $1 = #t
>     scheme@(guile-user)> (define else #f)
>     scheme@(guile-user)> (cond (else #t))
>     scheme@(guile-user)> 
>
> `else' did not match, because it was a different binding.
>
> This case has not changed, however:
>
>     scheme@(guile-user)> (let ((else #f)) (cond (else #t)))
>     scheme@(guile-user)>
>
> So whereas before, including something in a literals list did not
> specify anything about the toplevel binding, now it does; which
> increases the coupling between your macro and your literals.

OK.

So, with this change, no top-level binding of ‘else’ is /required/, but
/when/ there is one, it prevails over the literal, correct?

But then I don’t understand how the story that you could import/rename
‘else’ fits into this.

Thanks,
Ludo’.




reply via email to

[Prev in Thread] Current Thread [Next in Thread]