On Wednesday, 24 December 2014 at 09:46:11 UTC, Kagamin wrote:
On Wednesday, 24 December 2014 at 09:18:43 UTC, Ola Fosheim
Grøstad wrote:
Validation does not belong to the implementation, so "the
right way" is to put it in a wrapper before you call the
function that does the actual work.
Unlikely to be done. Sanitization is usually done in place.
You could improve this by having "parameterless light weight
lambdas":
immutable i = { ...mutable computation...; return x+n; }
Doing things "in place" is kind of pointless if the SSA form in
the back-end turns it into immutable anyway. If it is done
"proper in place" you no longer have a value type, but a
reference type...