std.array.array seems to return flatten copy of input

Olivier Grant against.the at evil.bots.com
Fri Apr 4 17:51:51 PDT 2014


Sorry Steven,

I hadn't seen your answer.

Thanks for the extra information.

O.

On Friday, 4 April 2014 at 20:42:32 UTC, Steven Schveighoffer 
wrote:
> On Fri, 04 Apr 2014 16:35:57 -0400, Olivier Grant 
> <against.the at evil.bots.com> wrote:
>
>> That is one responsive D community :) Thank you to all three 
>> of you for these quick answers.
>>
>> I was really scratching my head on that one. This shows that 
>> UFCS can be quite dangerous. Is there any way to hide 
>> Splicer.array to the outside world? It just seems that it 
>> would be very easy to break client code by updating your 
>> implementation if you end up using a name that is already used 
>> elsewhere and accessed using UFCS.
>
> I advise to call it _array to prevent such issues.
>
> Note, you can make the field private, but that is a 
> module-level directive. In order for it to apply, main would 
> have to be in a separate module.
>
> In that case, the code would simply fail to compile. As a rule, 
> members ALWAYS have precedence over UFCS functions.
>
> -Steve



More information about the Digitalmars-d-learn mailing list