Constant relationships between non-constant objects

Jonathan M Davis via Digitalmars-d digitalmars-d at puremagic.com
Tue Jun 17 23:15:48 PDT 2014


On Tue, 17 Jun 2014 22:58:24 -0700
"H. S. Teoh via Digitalmars-d" <digitalmars-d at puremagic.com> wrote:

> On Wed, Jun 18, 2014 at 05:40:47AM +0000, Sebastian Unger via
> Digitalmars-d wrote:
> > But it is possibly an acceptable hack around a shortcoming in the
> > language.
> > Comming from C++, it's not as though I'm not used to those.
> > Just a shame to have to resort to it when D is so pretty close to
> > getting rid of dirty hacks more or less completely.
> [...]
>
> I don't see it as a hack, much less a dirty one. The language was
> designed precisely to allow implementing this kind of user-defined
> extensions easily. In fact, there has been a recent trend to move
> things *out* of the core language where a library implementation
> suffices.

It's certainly not a hack, and it's a good example of how we can do quite a
bit with the language without having to actually add to the language, but I
think that most of us agree that Rebindable is an undesirable solution, and
we'd welcome it if it could be done cleanly in the language. The problem is
that doing it in the language has proven to be incredibly difficult due to
how the compiler was written.

Head-constness is something that's requested a _lot_ less frequently though
(in fact, I think that this is the first time that I've seen it brought up),
so if head-constness were the only issue, I don't think that many of us would
be all that annoyed at the fact that we couldn't do it in the language itself.

- Jonathan M Davis


More information about the Digitalmars-d mailing list