Thread overview | ||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
February 15, 2003 DMD 0.54 release | ||||
---|---|---|---|---|
| ||||
Some long overdue syntax changes. Will break some existing code, but it's easy to fix. www.digitalmars.com/d/changelog.html |
February 15, 2003 Re: DMD 0.54 release | ||||
---|---|---|---|---|
| ||||
Posted in reply to Walter | "Walter" <walter@digitalmars.com> wrote in message news:b2l2oh$1o27$1@digitaldaemon.com... > Some long overdue syntax changes. Will break some existing code, but it's easy to fix. > > www.digitalmars.com/d/changelog.html > > > a.. Reversed order of array declarations when they appear to the left of the identifier being declared. Postfix array declaration syntax remains the same (and equivalent to C). int[3][4] a; // a is 4 arrays of 3 arrays of ints int b[4][3]; // b is 4 arrays of 3 arrays of ints I did a quick search on earlier postings on this topic, but found none. In my humble opinion this feature confuses more than it resolves. I would suggest to choose one (I prefer the first) |
February 15, 2003 Re: DMD 0.54 release | ||||
---|---|---|---|---|
| ||||
Posted in reply to Jeroen van Bemmel | Jeroen van Bemmel wrote: > "Walter" <walter@digitalmars.com> wrote in message > news:b2l2oh$1o27$1@digitaldaemon.com... > >>Some long overdue syntax changes. Will break some existing code, but it's >>easy to fix. >> Thanks!!!!! Now you can tell the novices to use... real and int. But OTOH real,... then i'd expect imaginary and complex, but get ireal and creal. at least it's consistent with integer naming though. but having both float and real in one language is confusing. why not single instead of float? single<=double<=real. :) or sreal, dreal, real? then isreal, idreal, ireal, csreal, cdreal, creal :) no, obfucadion. > > a.. Reversed order of array declarations when they appear to the left of the > identifier being declared. Postfix array declaration syntax remains the same > (and equivalent to C). > int[3][4] a; // a is 4 arrays of 3 arrays of ints > int b[4][3]; // b is 4 arrays of 3 arrays of ints > I did a quick search on earlier postings on this topic, but found none. In > my humble opinion this feature confuses more than it resolves. I would > suggest to choose one (I prefer the first) > There's a slight problem. after you've declared: int [x][y] array; //natural order! like in math and most libraries. you still have to acess it this way: el = array[y][x]; //stoopid C order! which becomes once more confusing. especially for people changing from Wirth languages or Sather or anything else more sane than C. Even in C, it has been a source of confusion. I quote from some matrix handling tutorial for beginning 3D enthusiasts: " If something goes wrong try: - reversing the matrix multiplication order - transposing the final matrix - you can't imagine how often this helps! " The first one refers to some people who don't know math :) but the second is a sign of technical problem, since OpenGL and DirectX expect matrices in an oppsite order compared to that usual in C, because of these swapped dimensions! access like: el = array[x,y] would really be good. And with that, also declarations in the same style. How about a possibility for multi-dimensional dynamic continuous arrays? Then array structure would be the following: 0: pointer to array data; 4: 1st array dimension; 8: 2nd array dimension; 12: 3st array dimension; ... ... 4*n: nth array dimension. -i. |
February 15, 2003 Re: DMD 0.54 release | ||||
---|---|---|---|---|
| ||||
Posted in reply to Jeroen van Bemmel | "Jeroen van Bemmel" <anonymous@somewhere.com> wrote in message news:b2ldol$20m9$1@digitaldaemon.com... [cut] > int[3][4] a; // a is 4 arrays of 3 arrays of ints > int b[4][3]; // b is 4 arrays of 3 arrays of ints > I did a quick search on earlier postings on this topic, but found none. In > my humble opinion this feature confuses more than it resolves. I would > suggest to choose one (I prefer the first) I think too that there should be only one way how to define array. I prefer the first one too. One way how to do it should be a rule for everything at the language level. Certainly at the higher levels you have (and should have) a lot of options. My reasoning is again the same: searching and easier writting of higher level tools (smart editors etc). |
February 15, 2003 Re: DMD 0.54 release | ||||
---|---|---|---|---|
| ||||
Posted in reply to Jeroen van Bemmel | Jeroen van Bemmel wrote:
> "Walter" <walter@digitalmars.com> wrote in message
> news:b2l2oh$1o27$1@digitaldaemon.com...
>
>>Some long overdue syntax changes. Will break some existing code, but it's
>>easy to fix.
>>
>>www.digitalmars.com/d/changelog.html
>
> a.. Reversed order of array declarations when they appear to the left of the
> identifier being declared. Postfix array declaration syntax remains the same
> (and equivalent to C).
> int[3][4] a; // a is 4 arrays of 3 arrays of ints
> int b[4][3]; // b is 4 arrays of 3 arrays of ints
> I did a quick search on earlier postings on this topic, but found none. In
> my humble opinion this feature confuses more than it resolves. I would
> suggest to choose one (I prefer the first)
The "C-style array declarations" thread; I lobbied for the swap in array order privately, and also lobbied for removing the C-style; won the former, lost the latter.
Walter's position is that this is a necessary fig leaf to C programmers.
|
February 15, 2003 Re: DMD 0.54 release | ||||
---|---|---|---|---|
| ||||
Posted in reply to Jeroen van Bemmel | "Jeroen van Bemmel" <anonymous@somewhere.com> wrote in message news:b2ldol$20m9$1@digitaldaemon.com... > a.. Reversed order of array declarations when they appear to the left of the > identifier being declared. Postfix array declaration syntax remains the same > (and equivalent to C). > int[3][4] a; // a is 4 arrays of 3 arrays of ints > int b[4][3]; // b is 4 arrays of 3 arrays of ints > I did a quick search on earlier postings on this topic, but found none. In > my humble opinion this feature confuses more than it resolves. I would > suggest to choose one (I prefer the first) While the spec necessarilly goes into both syntaxes, you can choose to stick with the prefix notation which is consistent and easy to explain. The C version is there to make an easier migration path for C programmers, etc., and the mixed declarations fall out of that syntax, but can be entirely avoided, and I suggest that they be avoided. |
February 15, 2003 Re: DMD 0.54 release | ||||
---|---|---|---|---|
| ||||
Posted in reply to Walter | int [char []] ext; void main () { ext ["foo"] = 1; delete ext; } This compiles, and is proper of course, but fails on execution with an Access Violation. |
February 16, 2003 Re: DMD 0.54 release | ||||
---|---|---|---|---|
| ||||
Posted in reply to Walter | "new" should be changed: char [] [] foo; foo = new char [] [45]; /* Doesn't work. */ foo = new char [45] []; /* Old order does work, but no longer makes sense. */ |
February 16, 2003 Re: DMD 0.54 release | ||||
---|---|---|---|---|
| ||||
Posted in reply to Burton Radons | I overlooked that. Thanks. -Walter "Burton Radons" <loth@users.sourceforge.net> wrote in message news:b2mnbr$2mt$1@digitaldaemon.com... > "new" should be changed: > > char [] [] foo; > > foo = new char [] [45]; /* Doesn't work. */ > foo = new char [45] []; /* Old order does work, but no longer makes > sense. */ > |
February 16, 2003 Re: DMD 0.54 release | ||||
---|---|---|---|---|
| ||||
Posted in reply to Walter | found one internal error and one seggy (all due to crap code) Digital Mars D Compiler Beta v0.54 dmd -c with ..... alias bit delegate ( int ) MyFoo; class wrong { MyFoo foo; bit func( int a ) { return MyFoo( a ); } } causes bit delegate(int) Internal error: e2ir.c 1870 and int a = [ 6, 7, 9 }; crashes the compiler "Walter" <walter@digitalmars.com> wrote in message news:b2l2oh$1o27$1@digitaldaemon.com... > Some long overdue syntax changes. Will break some existing code, but it's easy to fix. > > www.digitalmars.com/d/changelog.html > > > |
Copyright © 1999-2021 by the D Language Foundation