Array Copying syntax

Jonathan M Davis via Digitalmars-d-learn digitalmars-d-learn at puremagic.com
Fri Sep 16 10:55:59 PDT 2016


On Friday, September 16, 2016 17:22:41 Antonio Corbi via Digitalmars-d-learn 
wrote:
> Shouldn't it be mentioned then in the docs that this works for
> statically sized arrays and that in that case it copies contents?

Well, I confess that I don't know why you would ever have thought that

s = t;

wouldn't work. The only mutable types that can't be assigned to like this
are the ones that have disabled assignment or copying (which would only be
certain structs).

And I thought that the spec made it clear that static arrays were value
types, in which case the behavior of

s = t;

should be obvious. So, I would have thought that it would be clear enough
as-is, but clearly, it wasn't for you. So, I don't know. We do want the spec
to be clear, but it would also be bad to add a bunch of redundant
information in an attempt to be clearer. I'd have to go digging through the
spec though to give any concrete suggestions on how to improve this though.

- Jonathan M Davis



More information about the Digitalmars-d-learn mailing list