[Top][All Lists]

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

Re: Feature request: Expose `ellipsis?' from

From: Mark H Weaver
Subject: Re: Feature request: Expose `ellipsis?' from
Date: Fri, 23 Nov 2018 02:55:41 -0500
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/26.1 (gnu/linux)

Hi Marc,

Marc Nieper-Wißkirchen <address@hidden> writes:

> Am Mi., 21. Nov. 2018 um 04:38 Uhr schrieb Mark H Weaver <address@hidden>:
>  >  Ellipsis identifiers are a bit more tricky, because unlike other
>  >  bindings, the user-visible ellipsis identifiers are not actually
>  >  substituted.  We can't do that because ellipsis identifiers can be used
>  >  for other purposes, e.g. bound to ordinary variables or macros, and
>  >  these two ways of binding ellipsis identifiers should not shadow each
>  >  other.

Sorry, this was a weak argument.  I've since remembered the _actual_
reason that it needs to be done this way:

In general, for any sensible binding form, bindings with different names
should not shadow each other.  For example, a binding for 'E' should not
shadow a binding for 'F'.

If you try to model (with-ellipsis E BODY) as binding 'E', then it is
not a sensible binding form in this sense.  Unlike any sensible binding
form, (with-ellipsis E BODY) should not only shadow outer bindings of
'E', but *any* outer ellipsis binding, whether '...' or 'F' or something
else.  In other words, in this model, there can be only one binding of
this kind in a given lexical context.

Therefore, I think this is a bad model for 'with-ellipsis'.

I think it makes more sense to model (with-ellipsis E BODY) as
introducing a new lexical binding with a fixed name.  CURRENT-ELLIPSIS
would be a good name if we wanted to make it part of the public API.  In
this model, 'E' becomes the _value_ of the binding, instead of the
binding's name.

Does that make sense?

Note that in this later model, it's not natural for (with-ellipsis E
BODY) to shadow a binding for 'E' or vice versa, because 'E' is not
actually the thing being bound by 'with-ellipsis'.

In theory, we could introduce additional mechanisms to force
(with-ellipsis E BODY) to shadow bindings for 'E' and vice versa.  This
would entail changing *every* binding form to check if the identifier
being bound matches the current binding of CURRENT-ELLIPSIS, and if so,
somehow invalidating the ellipsis binding.  It's not obvious what should
be done in this case.

We could do something like this, but in my view, it would be an ad-hoc
addition to the semantics in order to support the inadequate mental
model where (with-ellipsis E BODY) is thought of as binding 'E'.

What do you think?


reply via email to

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