Author |
Message |
RedRogueXIII
![](http://compsci.ca/v3/uploads/user_avatars/431887573481a2d69185a9.png)
|
Posted: Fri Aug 11, 2006 1:50 pm Post subject: Flexible Arrays in Records |
|
|
Is there any way around Turing's disabilty of not being able to declare flexible arrays as a part of a record other than
a) Declaring a flexible array outside the record
b) Creating a very large static array inside in the record
Just wondering, or would I have to learn classes and objects to use flexible arrays but still keep things organized? |
|
|
|
|
![](images/spacer.gif) |
Sponsor Sponsor
![Sponsor Sponsor](templates/subSilver/images/ranks/stars_rank5.gif)
|
|
![](images/spacer.gif) |
Cervantes
![](http://compsci.ca/v3/uploads/user_avatars/1023105758475ab2e040bde.jpg)
|
Posted: Fri Aug 11, 2006 4:21 pm Post subject: (No subject) |
|
|
Yeah, I think the only way to do it is to use objects. |
|
|
|
|
![](images/spacer.gif) |
Clayton
![](http://compsci.ca/v3/uploads/user_avatars/1718239683472e5c8d7e617.jpg)
|
Posted: Fri Aug 11, 2006 4:35 pm Post subject: (No subject) |
|
|
does anyone know why Holtsoft didnt want Turing to have flexy arrays in records? i mean come on... |
|
|
|
|
![](images/spacer.gif) |
Cervantes
![](http://compsci.ca/v3/uploads/user_avatars/1023105758475ab2e040bde.jpg)
|
Posted: Fri Aug 11, 2006 5:45 pm Post subject: (No subject) |
|
|
I think it's less a matter of "want" and more a matter of difficulty of implementing it.
But that might just be a lot of bogus. I'm not actually sure how flexible arrays are stored in memory. |
|
|
|
|
![](images/spacer.gif) |
Clayton
![](http://compsci.ca/v3/uploads/user_avatars/1718239683472e5c8d7e617.jpg)
|
Posted: Fri Aug 11, 2006 6:03 pm Post subject: (No subject) |
|
|
well i cant see how flexy arrays in records could be much more difficult that a regular flexy array... |
|
|
|
|
![](images/spacer.gif) |
Cervantes
![](http://compsci.ca/v3/uploads/user_avatars/1023105758475ab2e040bde.jpg)
|
Posted: Fri Aug 11, 2006 6:37 pm Post subject: (No subject) |
|
|
Consider other things we can't do. We can't make a multi-dimensional flexible array (that works well).
This style of declaring a 2D array produces a syntax error:
code: |
var a : flexible array 1 .. 5 of flexible array 1 .. 3 of int
|
This is essentially the same as:
code: |
var a : flexible array 1 .. 5 of
record
b : flexible array 1 .. 3 of int
end record
|
|
|
|
|
|
![](images/spacer.gif) |
Clayton
![](http://compsci.ca/v3/uploads/user_avatars/1718239683472e5c8d7e617.jpg)
|
Posted: Fri Aug 11, 2006 7:04 pm Post subject: (No subject) |
|
|
well i dont see how you would declare a new upper bounds for the first example there, but for the second one i can see how it works easily:
code: |
var myArray: flexible array 1..0 of
record
another_array: flexible array 1..0 of int
end record
new myArray, upper(myArray)+1 %new upper bounds for the entire thing
new myArray(1).another_array,upper(myArray(1).another_array)+1
%upperbounds for another_array is one now
|
that just looks a lot better and makes sense to me, so i dont see what the big problem would have been ![Confused Confused](http://compsci.ca/v3/images/smiles/icon_confused.gif) |
|
|
|
|
![](images/spacer.gif) |
|