Is anyone hacking on druntime in a widespread fashion at themoment?
James Miller
james at aatch.net
Wed Apr 11 17:17:30 PDT 2012
* Nick Sabalausky <SeeWebsiteToContactMe at semitwist.com> [2012-04-11 16:08:05 -0400]:
> "Kevin Cox" <kevincox.ca at gmail.com> wrote in message
> news:mailman.1599.1334099575.4860.digitalmars-d at puremagic.com...
> >
> >I was wondering why they could not be implied from the code itself.
>
> That question comes up a lot. The thing is, that would completely defeat the
> point. The point is that you want the compiler to *guarantee* that certain
> specific functions are pure/@safe/const/nothrow, etc.
>
> If you make a change that prevents a function from being
> pure/@safe/const/nothrow, and the compiler just simply accepted it and
> internally considered it non-pure/non-whatever, then you haven't gained
> anything at all. It'd be no different from not even having any
> pure/@safe/const/nothrow system in the first place. At *best* it would just
> be a few optimizations here and there.
>
> But if the compiler tells you, "Hey, you said you wanted this function to be
> pure/whatever, but you're doing X which prevents that", then you can
> actually *fix* the problem and go make it pure/whatever.
>
>
At any rate, inference would probably end up being more trouble than its
worth, or as you said, useless.
Me: "I know this function can throw"
Compiler: "But I don't think so, so I'm gonna mark it nothrow"
Me: "No! You idiot!"
Compiler: "Herp-Derp, code-breaking optimization based on incorrect
assumptions"
Me: "FUUUUUUUUUU...."
I don't trust computers, I've spent too long programming to think that
they can get anything right.
--
James Miller
More information about the Digitalmars-d
mailing list