Argumnentation against external function operator overloading is unconvincing

pineapple via Digitalmars-d digitalmars-d at puremagic.com
Sat Sep 24 17:36:58 PDT 2016


On Thursday, 22 September 2016 at 12:51:59 UTC, Andrei 
Alexandrescu wrote:
> On 9/22/16 6:38 AM, pineapple wrote:
>> The greatest offender I've found is how in phobos, arrays do 
>> not behave
>> as ranges without importing the module defining their range 
>> operations.
>
> Would make sense to move those few primitives to object.d. I've 
> been thinking of that a long time ago but back then there was a 
> vague stance that object.d shouldn't contain templates. Since 
> then that has changed. -- Andrei

I strongly disagree - I have been working a library that does not 
treat arrays as ranges, but as a type that a range can be created 
from. This design difference has proven rather elegant and solves 
a lot of problems I've run into using phobos. I think the 
(unlikely but ideal) solution is for phobos to adopt a similar 
approach, and not to warp the core language to accommodate 
phobos' strange design decisions.

Also, auto-decoding is a plague and it need not spread any 
farther than it already has done.

https://github.com/pineapplemachine/mach.d/blob/master/readme.md#arrays-arent-ranges



More information about the Digitalmars-d mailing list