xxxInPlace or xxxCopy?

spir denis.spir at gmail.com
Fri Jan 21 16:21:35 PST 2011


On 01/21/2011 10:03 PM, Jonathan M Davis wrote:
> I really don't find having functions returning results without altering their
> arguments as the normal case to be odd at all, let alone misleading, since
> that's what most functions actually do.

Same for me. I don't find having this version as the normal case odd at 
all, neither.
I just find using action-verbs to denote that misleading; eg sort(array) 
so-to-say "naturally" means "_sort_ this array", not "gimme a new 
_sorted_ array". Many programmers name function which (main) purpose is 
to construct a new element according to said element (not only me, I 
copied this practice from others). They are right on this, it's highly 
informative and never misleading (except for issues inherent to english).
Then, using action-verbs for action-functions is, in constrast, also 
sensible:
	writeReport(reportData);

Denis
_________________
vita es estrany
spir.wikidot.com



More information about the Digitalmars-d mailing list