Generic code: @autoconst, @autopure, @autonothrow
Rainer Deyke
rainerd at eldwood.com
Sat Aug 28 21:25:05 PDT 2010
On 8/28/2010 19:29, dsimcha wrote:
> Looks pretty good. Won't work with BigInt because opBinary!"*" isn't pure and
> can't practically be made pure. A solution I propose is to allow the
> annotations @autoconst, @autopure and @autonothrow for template functions.
> These would mean "everything I do is const/pure/nothrow as long as all of the
> functions I call are const/pure/nothrow". As far as I can tell, this would be
> reasonably implementable because the compiler always has the source code to
> template functions, unlike non-template functions.
On one hand, this addresses a real need. On the other hand, D is
already has a serious case featuritis.
Is there any real reason why we can't apply these modifiers
automatically to all functions? (And by "real" I don't mean "it would
be hard to do" or "it is incompatible with the archaic compilation model
chosen by one D implementation".)
Failing that, are the arguments for the inclusion of pure/nothrow/const
really strong enough to justify all this extra cruft in the language?
--
Rainer Deyke - rainerd at eldwood.com
More information about the Digitalmars-d
mailing list