SRFI 212: Aliases Arthur A. Gleckler (22 Sep 2020 19:00 UTC)
Re: SRFI 212: Aliases Per Bothner (22 Sep 2020 19:53 UTC)
Re: SRFI 212: Aliases Marc Nieper-Wißkirchen (22 Sep 2020 20:26 UTC)
Re: SRFI 212: Aliases Jim Rees (23 Sep 2020 13:15 UTC)
Re: SRFI 212: Aliases Jim Rees (23 Sep 2020 13:16 UTC)
Re: SRFI 212: Aliases Marc Nieper-Wißkirchen (23 Sep 2020 13:23 UTC)
Re: SRFI 212: Aliases Jim Rees (23 Sep 2020 13:53 UTC)
Re: SRFI 212: Aliases Marc Nieper-Wißkirchen (23 Sep 2020 14:03 UTC)
Re: SRFI 212: Aliases Jim Rees (25 Sep 2020 02:38 UTC)
Re: SRFI 212: Aliases Marc Nieper-Wißkirchen (25 Sep 2020 05:58 UTC)
Re: SRFI 212: Aliases Jim Rees (25 Sep 2020 18:10 UTC)

Re: SRFI 212: Aliases Marc Nieper-Wißkirchen 23 Sep 2020 13:23 UTC

Good questions!

> The 'unbound' case is interesting, and leads me to ask the question -- what's supposed to happen here?
>
> (let ((x 0))
>   (alias x y)
>   x)

This is an error (assume that `y' was unbound.

> Does an alias to an unbound identifier "hide" a surrounding binding?
>
> If not, then (alias x y) is a no-op.    If so, it makes for an interesting new tool for locally turning-off identifiers.

Exactly. If you want to make sure that a block of your code doesn't
use a specific identifier, you can define

(define-syntax forget
  (syntax-rules ()
    ((forget id) (alias id unbound-identifier))))

in a module, in which `unbound-identifier' is unbound.

And then you can say

(forget x)

to make sure `x' is unbound.

> And 2nd question -- w.r.t. to free-identifier=?, what's the name of an alias to an unbound identifier?   It's own name, or the name of the original source id?

The name of an identifier is a property of the identifier, not of its
binding. In particular, syntax->datum won't return the name of the
other identifier.

> ;; pre-conditions: x and y are not bound
>
> (define (is-x?  id) (free-identifier=? id #'x))
>
> (let ()
>    (alias x y)
>    (is-x? x))

This should return `#f' (after adding (syntax ...) as you wrote in
your next email).