Requiring weak purity for opAssign, postblit
Jonathan M Davis
jmdavisProg at gmx.com
Sat Dec 25 15:05:42 PST 2010
On Saturday 25 December 2010 08:50:19 dsimcha wrote:
> == Quote from bearophile (bearophileHUGS at lycos.com)'s article
>
> > dsimcha:
> > > Does anyone see a problem with requiring opAssign and postblits to be
> > > weakly pure to solve this problem?
> >
> > Time ago I have even suggested contracts (pre/post/invariants) to be pure
> > (as
>
> Design by Contract asks), or at least class invariants to be const on
> default.
>
> > Bye,
> > bearophile
>
> Yeah, this is a good idea iff we fix the template pure issue.
You can mark them as pure already. They're just not forced to be pure.
pure invariant()
{
//This invariant is pure.
}
What would be really nice though is a version of writeln intended only for debug
purposes which worked in pure functions. As I understand it, the main reason
that invariants weren't pure in the first place was to allow for debug output,
which can be extremely useful.
- Jonathan M Davis
More information about the Digitalmars-d
mailing list