scope as template struct
Christian Kamm
kamm-incasoftware at removethis.de
Tue Jan 13 23:00:31 PST 2009
Christian Kamm wrote:
>> Unless there's a major difference to 'scope' I missed, I think that with
>> the addition of a few generic features it should be possible to move it
>> into a library entirely.
Robert Fraser wrote:
> Yes this would be possible. But what's the advantage of doing it this
> way and is it worth sacrificing syntax sugar and backwards compatibility
> for? And would this even work right with RAII?
For the same reason that std.typecons.Rebindable isn't in the language but
in a library: if you can build it out of other features, it's not worth
making the language more complicated by adding it explicitly. I agree that
there's a fine line where ease of use conflicts with orthogonality, but in
this case not much sugar seems to be lost.
About RAII: The wrapped classes' constructor and destructor are called just
fine at the right time. There is a bug that the destructor will probably
segfault if construct() wasn't called, but that should be avoidable either
by having a flag set on construction or somehow forcing construction during
initialization.
More information about the Digitalmars-d
mailing list