Why is to(T) pure but roundTo(T) impure?
Jonathan M Davis
jmdavisProg at gmx.com
Sat Jun 9 20:58:20 PDT 2012
On Sunday, June 10, 2012 04:06:03 Chris Saunders wrote:
> Thanks Jonathan. Sounds like a practical issue rather than some
> theoretical problem -- good to know.
The vast majority of purity issues with Phobos are purely an implementation
issue and not any kind of limit in the language. Obviously some stuff can never
be pure (e.g. Clock.currTime or writeln), but for conversions and the like,
it's virtually a guarantee that it's an issue with not all of the lower level
stuff or C stuff being pure like it needs to be. That's slowly getting fixed, but
we still have quite a ways to go. Probably the biggest problem with that from
the users perspective is format and to!string, because that makes it almost
impossible to make toString pure or to have formatted error messages in
assertions in pure functions. We'll get there though.
- Jonathan M Davis
More information about the Digitalmars-d-learn
mailing list