digitalmars.D.bugs - Slice problem in DMD 0.102
- Lars Ivar Igesund (11/11) Sep 22 2004 void main()
-
Stewart Gordon
(5/7)
Sep 22 2004
- Walter (3/13) Sep 22 2004 It used to compile, but I don't think it ever worked.
- Lars Ivar Igesund (3/24) Sep 22 2004 Fair enough, but should it work? Is it a bug?
- Regan Heath (6/29) Sep 22 2004 What do you think it should do?
- Walter (5/29) Sep 22 2004 No. It has about as much meaning as:
- Lars Ivar Igesund (7/44) Sep 23 2004 I don't agree. arr[] means all the elements in the array (according to
- Ivan Senji (5/49) Sep 24 2004 I would like this to work too but i see it as an array operation and the...
-
Stewart Gordon
(13/23)
Sep 24 2004
In article
, Lars Ivar Igesund - Ivan Senji (4/27) Sep 24 2004 Now i feel stupid for what i wrote in response to Lars Ivar Igesund,
void main() { int [][] arr; arr.length = 5; arr[].length = 5; } produce C:\projects\code\foo>dmd allslice.d allslice.d(5): slice expression arr[] is not a modifiable lvalue I'm not sure about the validity of this, but it used to work. Lars Ivar Igesund
Sep 22 2004
In article <ciropf$2cjt$1 digitaldaemon.com>, Lars Ivar Igesund says... <snip>arr[].length = 5;<snip>I'm not sure about the validity of this, but it used to work.What is the defined behaviour of that statement? Stewart.
Sep 22 2004
"Lars Ivar Igesund" <larsivar igesund.net> wrote in message news:ciropf$2cjt$1 digitaldaemon.com...void main() { int [][] arr; arr.length = 5; arr[].length = 5; } produce C:\projects\code\foo>dmd allslice.d allslice.d(5): slice expression arr[] is not a modifiable lvalue I'm not sure about the validity of this, but it used to work.It used to compile, but I don't think it ever worked.
Sep 22 2004
Walter wrote:"Lars Ivar Igesund" <larsivar igesund.net> wrote in message news:ciropf$2cjt$1 digitaldaemon.com...Fair enough, but should it work? Is it a bug? Lars Ivar Igesundvoid main() { int [][] arr; arr.length = 5; arr[].length = 5; } produce C:\projects\code\foo>dmd allslice.d allslice.d(5): slice expression arr[] is not a modifiable lvalue I'm not sure about the validity of this, but it used to work.It used to compile, but I don't think it ever worked.
Sep 22 2004
On Wed, 22 Sep 2004 20:10:50 +0100, Lars Ivar Igesund <larsivar igesund.net> wrote:Walter wrote:What do you think it should do? Regan -- Using M2, Opera's revolutionary e-mail client: http://www.opera.com/m2/"Lars Ivar Igesund" <larsivar igesund.net> wrote in message news:ciropf$2cjt$1 digitaldaemon.com...Fair enough, but should it work? Is it a bug?void main() { int [][] arr; arr.length = 5; arr[].length = 5; } produce C:\projects\code\foo>dmd allslice.d allslice.d(5): slice expression arr[] is not a modifiable lvalue I'm not sure about the validity of this, but it used to work.It used to compile, but I don't think it ever worked.
Sep 22 2004
"Lars Ivar Igesund" <larsivar igesund.net> wrote in message news:ciserb$2q3b$1 digitaldaemon.com...Walter wrote:No. It has about as much meaning as: &(3 + 4)"Lars Ivar Igesund" <larsivar igesund.net> wrote in message news:ciropf$2cjt$1 digitaldaemon.com...Fair enough, but should it work?void main() { int [][] arr; arr.length = 5; arr[].length = 5; } produce C:\projects\code\foo>dmd allslice.d allslice.d(5): slice expression arr[] is not a modifiable lvalue I'm not sure about the validity of this, but it used to work.It used to compile, but I don't think it ever worked.Is it a bug?In the code, yes. The compiler correctly diagnoses it now.
Sep 22 2004
Walter wrote:"Lars Ivar Igesund" <larsivar igesund.net> wrote in message news:ciserb$2q3b$1 digitaldaemon.com...I don't agree. arr[] means all the elements in the array (according to the spec). Then arr[] should mean all the arrays when arr is two-dimensional, and length is a valid property of these arrays. Since this quite probably won't scale up, I can accept it if it's wrong, but the spec allows it (as it is now). Lars Ivar IgesundWalter wrote:No. It has about as much meaning as: &(3 + 4)"Lars Ivar Igesund" <larsivar igesund.net> wrote in message news:ciropf$2cjt$1 digitaldaemon.com...Fair enough, but should it work?void main() { int [][] arr; arr.length = 5; arr[].length = 5; } produce C:\projects\code\foo>dmd allslice.d allslice.d(5): slice expression arr[] is not a modifiable lvalue I'm not sure about the validity of this, but it used to work.It used to compile, but I don't think it ever worked.
Sep 23 2004
"Lars Ivar Igesund" <larsivar igesund.net> wrote in message news:civ2pc$1r8c$1 digitaldaemon.com...Walter wrote:I would like this to work too but i see it as an array operation and these are not implemented yet, but if Walter said it has no meaning than maybe it wouln't work even when we get array operations."Lars Ivar Igesund" <larsivar igesund.net> wrote in message news:ciserb$2q3b$1 digitaldaemon.com...I don't agree. arr[] means all the elements in the array (according to the spec). Then arr[] should mean all the arrays when arr is two-dimensional, and length is a valid property of these arrays. Since this quite probably won't scale up, I can accept it if it's wrong, but the spec allows it (as it is now).Walter wrote:No. It has about as much meaning as: &(3 + 4)"Lars Ivar Igesund" <larsivar igesund.net> wrote in message news:ciropf$2cjt$1 digitaldaemon.com...Fair enough, but should it work?void main() { int [][] arr; arr.length = 5; arr[].length = 5; } produce C:\projects\code\foo>dmd allslice.d allslice.d(5): slice expression arr[] is not a modifiable lvalue I'm not sure about the validity of this, but it used to work.It used to compile, but I don't think it ever worked.Lars Ivar Igesund
Sep 24 2004
In article <civ2pc$1r8c$1 digitaldaemon.com>, Lars Ivar Igesund says... <snip>It means an array consisting of all the elements in the array.No. It has about as much meaning as: &(3 + 4)I don't agree. arr[] means all the elements in the array (according to the spec).Then arr[] should mean all the arrays when arr is two-dimensional, and length is a valid property of these arrays.That applies to values, not to properties. Only when arr[] is the lvalue is it a slice assignment. But it isn't - arr[].length is. Indeed, if it meant the length of each element, it would create a confusing inconsistency: int[][5] x; x[].length = 10; writef(x[].length);Since this quite probably won't scale up, I can accept it if it's wrong, but the spec allows it (as it is now).Allows what exactly? Stewart.
Sep 24 2004
"Stewart Gordon" <Stewart_member pathlink.com> wrote in message news:cj125g$h1$1 digitaldaemon.com...In article <civ2pc$1r8c$1 digitaldaemon.com>, Lars Ivar Igesund says... <snip>Now i feel stupid for what i wrote in response to Lars Ivar Igesund, i wasn't thinking!It means an array consisting of all the elements in the array.No. It has about as much meaning as: &(3 + 4)I don't agree. arr[] means all the elements in the array (according to the spec).Then arr[] should mean all the arrays when arr is two-dimensional, and length is a valid property of these arrays.That applies to values, not to properties. Only when arr[] is the lvalue is it a slice assignment. But it isn't - arr[].length is. Indeed, if it meant the length of each element, it would create a confusing inconsistency:int[][5] x; x[].length = 10; writef(x[].length);Since this quite probably won't scale up, I can accept it if it's wrong, but the spec allows it (as it is now).Allows what exactly? Stewart.
Sep 24 2004