Hi,
OK, this is a matter of agreement. I think both ways have its pros and cons but I'm not opposing to change the standard and define that the left-most dimension relates to the outer-most value list in the value notation (simply not this is the way suggested by the standard TODAY).
Gyorgy
>
Original Message
> From: active_ttcn3 : mts stf133 ttcn version 3 - active members only
> [This email address is being protected from spambots. You need JavaScript enabled to view it.]On Behalf Of Stephan Tobies
> Sent: Thursday, June 17, 2004 1:00 PM
> To: This email address is being protected from spambots. You need JavaScript enabled to view it.
> Subject: Re: Value notation for multi-dimensional arrays
>
>
> ext György Réthy (IJ/ETH) wrote:
>
> >Hi,
> >
> >exactly this is what I'm saying too. It shall be clarified that
> >
> >var integer MyArray [5][2] := {{1,11}, {2,12}, {3,13},
> {4,14}, {5,15}};
> >
> >is incorrect.
> >
>
> But that is the _correct_ notation for C. Quoting from K&R (German
> edition, page 107):
>
> static char daytab[2][13] = { {0, 31, 28, 31, 30, 31, 30, 31, 31, 30,
> 31, 30, 31}, {0, 31, 29, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31} };
>
> >But not due to row~ or column major interpretation but
> because inner value lists shall be related to the first array
> dimension. Once this is clarified, row or column is
> unimportant from the language point of view and you can
> simply draw your matrix as you like.
> >
> >
>
> The row and column thing is indeed irrelvant. But we do need
> to fix the
> order in which the dimension are interpreted. My proposal would be to
> read from left to right, i.e., the left-most dimension is the
> outer-most
> dimension of the array, and so on.
>
> So, to illustrate this with an example:
>
> var integer MayArr[5][3][2] :=
> { /* 5 elements in this level */
> { /* 3 on this */
> { /* 2 on this */ 1,2},
> {1,2},
> {1,2}
> },
> {
> {1,2},
> {1,2},
> {1,2}
> },
> {
> {1,2},
> {1,2},
> {1,2}
> },
> {
> {1,2},
> {1,2},
> {1,2}
> },
> {
> {1,2},
> {1,2},
> {1,2}
> }
> };
>
> This is _not_ what you propose below, but it is the way that
> C and Java do things, which is why I would propose this also
> for TTCN-3.
>
>
> >In a more complex example
> >var integer MyArray [5][3][2] :=
> > { { {1,2,3,4,5}, {11,12,13,14,15}, {21,22,23,24,25} },
> >// ^ ^ ^ ^ these inner lists shall
> relate to the first dimension
> >// ^
relates to the second dimension
^
> > { {101,102,103,104,105}, {111,112,113,114,115},
> {121,122,123,124,125} } };
> >// ^
relates to the second
> dimension
^
> >//^
relates to the third
> dimension
^
> >
> >
> >
> Yes, the C and Java way is to a certain extent
> counter-intuitive. An array definition
>
> var integer x[2][3]
>
> cannot be read like this
>
> var (integer x[2])[3]
>
> which would somehow be the natural way to read such a
> definition. But C and Java do things differently - and since
> I would expect TTCN-3 users to have more background in these
> languages, I guess we should not confuse them unecessarily.
>
> BR
>
> Stephan
>
> --
> Stephan Tobies Sr. Research Engineer, Nokia Research Center
> ~ Mobile Networks Lab, Protocol Engineering Group
> E-Mail: This email address is being protected from spambots. You need JavaScript enabled to view it.
> Work Phone: +49-234-9842262
> Mobile: +49-163-9842405
> Fax: +49-234-9843491
> Address: NRC Bochum, Meesmannstr. 103, 44807 Bochum, Germany
>