On Monday, 23 May 2016 at 20:01:08 UTC, Andrei Alexandrescu wrote:
...

I wish to make a different point which is more general regarding ideas like these. I see a lot of proposals to add this or that to the standard library and a lot of debate pursues. One point I've never seen mentioned though is that these ideas would probably have limited usage in the real world. I think a good rule of thumb to consider is that the standard library should be *general purpose* and mostly contain common functionality, with some exceptions of course. We should consider whether these things will actually see common usage or just add bloat to the standard library. Also consider that once it's incorporated into Phobos, the responsibility of maintaining that code falls on the community rather than those few individuals who actually desire that functionality.

I'm sure this feature has some useful application in some specific domain but I question it's value in the community at large. I personally see no value in having a swap which can rotate three or more arguments to the left, or however we may choose to incorporate this functionality. On the other hand, I use swap() with two arguments all the time; it's very common functionality that most of us has likely used at least a few times.



BTW, Phobos already has a function called bringToFront which can rotate/roll ranges but the interface is a bit different compared to other languages.

https://dlang.org/phobos/std_algorithm_mutation.html#.bringToFront

Reply via email to