On 02/01/2014 21:10, Joseph Rushton Wakeling wrote:
On Thursday, 2 January 2014 at 20:23:40 UTC, Stewart Gordon wrote:
<snip>
How would it complicate the implementation?  Removing the undocumented
rule whereby Complex!(Complex!T) folds to Complex!T would be a slight
simplification.

It would involve non-trivial revisions to the internals of Complex.

Please be specific.

<snip>
Maybe the right course of action is to have a parameter to the
template that suppresses the type restriction and the folding rule, so
that people who want to use it on a type that might not work properly
can do so.  This would be a relatively small change.

I do not know how familiar you are with the internals of
std.complex.Complex but I think it would be a good idea to go through
them in some detail before asserting that changes like this would be
"relatively small".

Oh yes, some of the templated functions that take or return a complex would need this extra parameter adding.

Another way it could be done is to have a Complex template that implements these rules and which programmers would normally use, and have this aliasing ComplexImpl which actually provides the implementation and which programmers can use directly if they want to bypass the restrictions. The difficulty is documenting it in a way that would make sense to normal users....

Stewart.

Reply via email to