The disadvantage of purity
berni44
dlang at d-ecke.de
Sun Dec 29 12:03:05 UTC 2019
On Sunday, 29 December 2019 at 10:46:07 UTC, Dominikus Dittes
Scherkl wrote:
> This should indeed be NOT the same parameters. There should be
> a hidden additional parameter (lets name it "called_internal"),
> that be false in the original call and true in a recursion.
> With this it's perfectly pure while returning something
> different if called by itself.
Thanks for your ideas, but unfortunately I think these cannot be
used here. The reason is, that I have no control over the
intermediate steps, so I cannot pass that additional parameter
(ref State s in sarn's code). These intermediate steps consist of
calls to toString, which then do, whatever the user want's them
to do, and eventually call format again and format calls
formatObject with identical parameters. I can't change the
signature of toString, nor make the users implement that...
More information about the Digitalmars-d
mailing list