Todd Olson wrote:
At 14:54 -0500 2009-12-17, Jon Lang wrote:
And really, my whole point is that the implementation details are
(conceptually) the only thing that distinguishes Complex::Polar from
All though both e^(i ¼) and e^(i 3 ¼) evaluate to -1 + 0i
it is often useful to be able to distinguish them.
So perhaps the question is do we really want Perl6 to automatically
convert e^(i 3 ¼) to e^(i ¼) internally. If not, then
we really do want some sort of access to the implementation details.
If I was implementing Complex::Polar I'd probably use an Int64 to
represent the phase internally: we can scale it by pi/2**63 in the
accessor. That way it automatically collapses onto one cycle.
These internal details are why I don't really like the idea of exposing
.^attr as the mechanism by which users serialize the object. It would be
fine to use it as the default implementation of a generic serialization
method, but users of the object shouldn't know that.