On Monday, 17 November 2025 at 15:20:22 UTC, Serg Gini wrote:
On Monday, 17 November 2025 at 14:46:06 UTC, Brother Bill wrote:
Also, would you agree that not mutating parameters to have
"true" purity would be preferred?
no
In D, they are allowed to mutate parameters which seems to
violate purity. Why did D make this choice and when to best
exploit this architectural decision.
https://klickverbot.at/blog/2012/05/purity-in-d/
That post answers the why but still doesn't mean the decision
makes sense. A different name should have been chosen. The whole
"manually make your parameters immutable" is something you can do
with or without adding pure to the function definition. Someone
not wanting immutable function arguments is not looking for a
pure function. This is really bad for those of us that prefer
functional programming, given that there's no way to mark a
function actually pure - making it pure by the common use of the
term is something you have to do manually on every function, and
it's so much unnecessary boilerplate that I can't imagine someone
doing it.