Idea: swap with multiple arguments

H. S. Teoh via Digitalmars-d digitalmars-d at puremagic.com
Tue May 24 05:22:01 PDT 2016


On Tue, May 24, 2016 at 09:21:07AM +0000, ixid via Digitalmars-d wrote:
> On Tuesday, 24 May 2016 at 01:18:05 UTC, Jonathan M Davis wrote:
> > Hmmm. And I would have assumed that it rotated in the other
> > direction.  This is really going to need a very specific name like
> > rotateLeft or rotateRight in order for it not to be error-prone.
> > 
> > - Jonathan M Davis
> 
> Why would you assume it would rotate left? As a general rule to avoid
> verbosity we could have a default assumption of things moving in one
> direction and the inverse gets named. So we would have rotate and
> rotateLeft.

And why would you assume that it would rotate right? The default
assumption, unless stated clearly and widely followed everywhere, is
unclear and leads to misunderstandings. I'd rather unambiguously name
them rotateRight and rotateLeft than the asymmetric rotate / rotateLeft.


T

-- 
What is Matter, what is Mind? Never Mind, it doesn't Matter.


More information about the Digitalmars-d mailing list