sequence length allocation
- Posted by Alan Tu <ATU5713 at COMPUSERVE.COM> Aug 05, 1998
- 612 views
I run the following simple program: sequence s s =3D "hell" s[5] =3D 'o' Most of you will immediately recognize that there is an error here, becau= se I allegedly assigned a fifth value to a length 4 sequence. Well, I plead= guilty, but I appeal because this should not be illegal. Sure, I can use= append, but the above syntax seems a lot more straightforward. What woul= d we loose? Also, I still have a initialize every sequence and specify at least an initial length. This is not complete dynamic storage allocation= , to me. At least, I feel there should be a sequence initialized as an indefinite length. In Euphoria, I still have to initialize the sequence, and tell Euphoria what length it should be initially. There are tools to append and prepen= d, but that only masks the truth that we still have to tell Euphoria what th= e length of the sequence is. It seems that if I have a database, with one sequence with each sub-sequence being a record, I could just simply do something like this: s[length(s)+1] =3D new record I feel this is a more direct approach, than append could ever be. = Although, it is possible that C, which Euphoria is written in, forces Euphoria to be like this. Just a thought. Alan =