Thread overview | |||||||||
---|---|---|---|---|---|---|---|---|---|
|
April 21, 2004 [BUG?] cannot subscript an array by uint | ||||
---|---|---|---|---|
| ||||
value_type[] e = new value_type[length]; "list.d(519): cannot implicitly convert uint() to int" value_type[] e = new value_type[cast(int)(length)]; compiles ok Surely this is wrong? |
April 21, 2004 Re: [BUG?] cannot subscript an array by uint | ||||
---|---|---|---|---|
| ||||
Posted in reply to Matthew | Matthew wrote: > value_type[] e = new value_type[length]; > > "list.d(519): cannot implicitly convert uint() to int" <snip> That suggests to me the bug (?) whereby addressing a property without () doesn't work in all situations. Does value_type[] e = new value_type[length()]; work in your case? Stewart. -- My e-mail is valid but not my primary mailbox, aside from its being the unfortunate victim of intensive mail-bombing at the moment. Please keep replies on the 'group where everyone may benefit. |
April 21, 2004 Re: [BUG?] cannot subscript an array by uint | ||||
---|---|---|---|---|
| ||||
Posted in reply to Matthew | Matthew wrote: > value_type[] e = new value_type[length]; > >"list.d(519): cannot implicitly convert uint() to int" > > value_type[] e = new value_type[cast(int)(length)]; > >compiles ok > >Surely this is wrong? > > > > Shouldn't opApply use an uint. Or at-least provide the overload? Why use negative numbers for arrays anyway? -- -Anderson: http://badmama.com.au/~anderson/ |
April 21, 2004 Re: [BUG?] cannot subscript an array by uint | ||||
---|---|---|---|---|
| ||||
Posted in reply to J Anderson | Sorry dude, I don't follow your response. As shown, the code doesn't have anything to do with opApply(), it's just talking about an array. As for -ves with arrays, that is useful, because one might pass a pointer to somewhere in the middle of an array, in which case a -ve index is eminently meaningful. "J Anderson" <REMOVEanderson@badmama.com.au> wrote in message news:c65k0v$92k$3@digitaldaemon.com... > Matthew wrote: > > > value_type[] e = new value_type[length]; > > > >"list.d(519): cannot implicitly convert uint() to int" > > > > value_type[] e = new value_type[cast(int)(length)]; > > > >compiles ok > > > >Surely this is wrong? > > > > > > > > > Shouldn't opApply use an uint. Or at-least provide the overload? Why use negative numbers for arrays anyway? > > -- > -Anderson: http://badmama.com.au/~anderson/ |
April 21, 2004 Re: [BUG?] cannot subscript an array by uint | ||||
---|---|---|---|---|
| ||||
Posted in reply to Matthew | Matthew wrote: >Sorry dude, I don't follow your response. As shown, the code doesn't have >anything to do with opApply(), it's just talking about an array. > > Sorry, your right. Didn't read the code properly <g> >As for -ves with arrays, that is useful, because one might pass a pointer to >somewhere in the middle of an array, in which case a -ve index is eminently >meaningful. > > Sorry I don't follow. Negatives with opApply you should use int if you want negatives. Negatives with arrays... the coder should be explicit. -- -Anderson: http://badmama.com.au/~anderson/ |
April 22, 2004 Re: [BUG?] cannot subscript an array by uint | ||||
---|---|---|---|---|
| ||||
Posted in reply to J Anderson | "J Anderson" <REMOVEanderson@badmama.com.au> wrote in message news:c6614u$vr7$1@digitaldaemon.com... > Matthew wrote: > > >Sorry dude, I don't follow your response. As shown, the code doesn't have anything to do with opApply(), it's just talking about an array. > > > > > > Sorry, your right. Didn't read the code properly <g> > > >As for -ves with arrays, that is useful, because one might pass a pointer to somewhere in the middle of an array, in which case a -ve index is eminently meaningful. > > > > > Sorry I don't follow. Negatives with opApply you should use int if you want negatives. Negatives with arrays... the coder should be explicit. Sorry mate, I'm lost. I was illustrating how subscripting should support (but not require; hence my post) signed types. I didn't mention opApply at all. For the record, I have objected several times to Walter about opApply() using an int. I believe it should use an enum which contains only one publicly known value - "ok" (or "complete" or some such). All the author of an opApply() should be able to do is test whether the delegate return is == / != "ok". As it currently stands, the author of opApply() is able to write all kinds of unknown bad code by returning one of the magic numbers that the freach mechanism uses to indicate break, complete, whatever. |
April 22, 2004 Re: [BUG?] cannot subscript an array by uint | ||||
---|---|---|---|---|
| ||||
Posted in reply to Stewart Gordon | You were right. It's the failure to convert the property. "Stewart Gordon" <smjg_1998@yahoo.com> wrote in message news:c65jc2$8b4$1@digitaldaemon.com... > Matthew wrote: > > > value_type[] e = new value_type[length]; > > > > "list.d(519): cannot implicitly convert uint() to int" > <snip> > > That suggests to me the bug (?) whereby addressing a property without () > doesn't work in all situations. > > Does > > value_type[] e = new value_type[length()]; > > work in your case? > > Stewart. > > -- > My e-mail is valid but not my primary mailbox, aside from its being the unfortunate victim of intensive mail-bombing at the moment. Please keep replies on the 'group where everyone may benefit. |
Copyright © 1999-2021 by the D Language Foundation