Call to immutable method during immutable construction
Jonathan M Davis
jmdavisProg at gmx.com
Wed Nov 10 13:37:11 PST 2010
On Wednesday 10 November 2010 13:01:55 Jens Mueller wrote:
> You mean alter A's state. It could change something outside of A, couldn't
> it?
I suppose that it could. I forgot about that. It's certainly not something that
I'd ever think of doing. It would be bizarre to alter global state from a const
or immutable function.
> > So, while I don't necessarily see anything wrong with calling fun() in
> > this situation being legal, I don't see the point.
>
> My main point is that I'd like to know what is implemented as in
> mentioned TDPL and what isn't.
I suspect that someone like Don or Walter would have to answer in this case.
They're the most likely to know what the compiler is actually doing vs what they
intend it to do. A bug report on it should likely be opened though, since it
doesn't match TDPL. Either it needs to be fixed to match TDPL (which is likely in
this case), or it needs to be made clear what behavior it's supposed to have, at
which point the TDPL errata should be updated.
- Jonathan M Davis
More information about the Digitalmars-d
mailing list