
-----------------------------------
Justin_
Wed Jan 18, 2006 6:43 pm

record syntax.
-----------------------------------
Hi, is there anything wrong with this code: 


type webData : 
        record     %struct equivelant
            list_urls   : flexible array 1 .. 2 of string
            searchTerm  : string
            url_count   : int    %To determine how many links there are.
            lines       : string
            url         : string
            file_stream : flexible array 1 .. 2 of int
        end record 


it says syntax error at "flexible"

-----------------------------------
Cervantes
Wed Jan 18, 2006 6:54 pm


-----------------------------------
Sadly, Turing can't handle flexible arrays within records.  It's one of Turing's biggest problems, in my opinion.

The best you can do is declare a big hoinking static array ( ;) ) and use an index variable to keep track of the "upper" of it.

-----------------------------------
Justin_
Wed Jan 18, 2006 8:31 pm


-----------------------------------
how unfortunate  :cry:  yeah the static array will have to do.

-----------------------------------
Tony
Thu Jan 19, 2006 12:01 pm


-----------------------------------
Sadly, Turing can't handle flexible arrays within records.  It's one of Turing's biggest problems, in my opinion.
How would you go about implementing it? Suddenly you'll have a record type of arbitrary length. There will be a whole bunch of problems with reserving a correct amount of space and then adjusting it on per-record basis.

If you are dealing with a lot of data and do want to have it stored in a flexible array, you could declear it outside of the record definition, and point to it from within the record.

-----------------------------------
MysticVegeta
Thu Jan 19, 2006 12:41 pm


-----------------------------------
Well what you could have is a record inside a record.

-----------------------------------
codemage
Thu Jan 19, 2006 1:41 pm


-----------------------------------
Why jump through so many hoops to use a special Turing shortcut?

Flexible arrays are just a Turing-specific training-wheels-enabled version of dynamic lists.
