Does slicing have an effect?

XavierAP n3minis-git at yahoo.es
Mon May 27 09:47:23 UTC 2019


On Tuesday, 21 May 2019 at 20:44:49 UTC, rikki cattermole wrote:
> On 22/05/2019 8:31 AM, Dennis wrote:
>> 
>> Does slicing have an effect I'm not aware of, or is this a bug?
>
> It could have an effect if a was a struct/class via operator 
> overloads. But in this case it should probably be a bug.

It doesn't look right, even for custom types; because D (and in 
particular Walter) is against changing the meaning of operators 
when overloading (e.g. << in C++). At least unofficially, 
although I may recall it is enforced at a few places elsewhere.

Going back to the original question, it may be a bug (for 
arrays). And if so and if D wants to enforce consistent operator 
semantics when possible, it may be considered a bug for any type.


More information about the Digitalmars-d-learn mailing list