Author |
Message |
RedRogueXIII
|
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? |
|
|
|
|
|
Sponsor Sponsor
|
|
|
Cervantes
|
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. |
|
|
|
|
|
Clayton
|
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... |
|
|
|
|
|
Cervantes
|
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. |
|
|
|
|
|
Clayton
|
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... |
|
|
|
|
|
Cervantes
|
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
|
|
|
|
|
|
|
Clayton
|
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 |
|
|
|
|
|
|