www.digitalmars.com         C & C++   DMDScript  

digitalmars.D - [again] opSliceAssign

reply Ivan Senji <ivan.senji_REMOVE_ _THIS__gmail.com> writes:
I forgot why there isn't one yet? It's no more than a days work for 
Walter probably. :)
Feb 20 2006
parent reply "Jarrett Billingsley" <kb3ctd2 yahoo.com> writes:
"Ivan Senji" <ivan.senji_REMOVE_ _THIS__gmail.com> wrote in message 
news:dtc6jm$1fhm$1 digitaldaemon.com...
I forgot why there isn't one yet? It's no more than a days work for Walter 
probably. :)
I don't think he's ever actually commented on the issue. But the general consensus was that it's supposedly unclear whether the statement a[0 .. 10] = 5; Means "Get a slice of a, and assign 5 to all the elements in the returned array" or "call opSliceAssign with the range 0..10 and the value 5." My thought is that the compiler can already figure out that a[3] = 5; Means "use opIndexAssign;" I don't know why opSliceAssign would be any different. Maybe it's somehow incompatible with array operations (vectorization).
Feb 20 2006
parent Ivan Senji <ivan.senji_REMOVE_ _THIS__gmail.com> writes:
Jarrett Billingsley wrote:
 "Ivan Senji" <ivan.senji_REMOVE_ _THIS__gmail.com> wrote in message 
 news:dtc6jm$1fhm$1 digitaldaemon.com...
 
I forgot why there isn't one yet? It's no more than a days work for Walter 
probably. :)
I don't think he's ever actually commented on the issue. But the general consensus was that it's supposedly unclear whether the statement a[0 .. 10] = 5; Means "Get a slice of a, and assign 5 to all the elements in the returned array" or "call opSliceAssign with the range 0..10 and the value 5." My thought is that the compiler can already figure out that
I think compiler knows enough for it to work. Well in the above case it would definitly be opSliceAssign or if it was missing an error like opSlice cannot be an lvalue, use opSliceAssign.
 
 a[3] = 5;
 
 Means "use opIndexAssign;" I don't know why opSliceAssign would be any 
 different.  Maybe it's somehow incompatible with array operations 
 (vectorization). 
 
Don't know about that. But feels like it shouldn't be a problem.
Feb 20 2006