Pure, Nothrow in Generic Programming
Andrei Alexandrescu
SeeWebsiteForEmail at erdani.org
Fri Nov 27 16:34:55 PST 2009
Walter Bright wrote:
> Andrei Alexandrescu wrote:
>> Let's not confuse undefined with implementation-defined. I am firmly
>> convinced that memcmp never falls in the undefined behavior realm. The
>> behavior is always defined.
>
> Makes sense. But I'd still want to make it not @safe, by using a more
> expansive definition of @safe to include some implementation defined
> behaviors.
It's funny how we are trading places. Til now I was the stickler for safety.
I agree with the noble spirit, but not with the lack of precision. To me
the main attraction of @safe is that it has a very clear definition. For
example, that allows me to sleep at night in spite of ~=.
You want to define @safe more loosely and more judgement-call-ish
depending on how you feel about various particular cases. I don't like
that. First, it means that now safety becomes a subjective matter.
People on the newsgroup can now argue forever about how various idioms
should or shouldn't be @safe. Bartosz is getting the debating equivalent
of a Gatling gun because now he can credibly argue that ~= could be
considered not safe. Finally, if you're in a bad mood because your shoes
are too tight one day, something will not be @safe that should be. All
that I don't like at all. It's not science, not engineering, and not
even design. It's just doing things by ear. We've spent literally the
past few years trying to eliminate such things from D, so we shouldn't
counter that with a completely subjective call.
Andrei
More information about the Digitalmars-d
mailing list