Computer Science Canada

arrays of a type

Author:  zhiyuan_wu [ Thu Jun 03, 2004 7:17 pm ]
Post subject:  arrays of a type

This is strange how turing cannot recongize an array in a situation like this:

[/code]
proc L (abj : array 1 .. * of int)
end L
type abc :
record
letters :int
end record
var hay : array 1..3 of abc
L (hay.letters)
[code]
Here, turing would give a message: hay cannot be followed by a "."

But in this situation, it is perfectly legal:
[code]
proc L (abj : array 1 .. * of int)
end L
type abc :
record
letters : array 1..3 of int
end record
var hay : abc
L (hay.letters)

Is there a special syntax for it? Or the only way to send in an array like this is to dump the array into another newly made array? Question
[/code]

Author:  Andy [ Thu Jun 03, 2004 8:09 pm ]
Post subject: 

in the first example, hays is declared as an array of type which means you cant access the member variables of the structure as an array. just create a temporary array and dump the stuff you need into that then use it for the parameter

Author:  Delos [ Fri Jun 04, 2004 11:13 am ]
Post subject: 

I.e.

In case 1:
L (hay(#ElementRef).letters)

is what you are missing.

Author:  Delta [ Fri Jun 04, 2004 1:27 pm ]
Post subject: 

ya for sure 1st example your missing the (#) after hay

code:
hay(1).letters


Next your 2nd example shouldn't work either... are you sure it does?

It should be something like this when being called

code:
L(hay.letters(1))



unless somehow it really does work :S or I just missed something :S


: