Re: sequence length allocation
	
	
	
	
Alan Tu wrote:
> I run the following simple program:
> sequence s
> s = "hell"
> s[5] = 'o'
>
> Most of you will immediately recognize that there
> is an error here, because I allegedly assigned a
> fifth value to a length 4 sequence.  Well, I plead
> guilty, but I appeal because this should not be illegal.
I agree here. One caveat tho, it should only be allowed
for 1 index past length(s).
> Also, I still have a initialize every sequence and specify at
> least an initial length.  This is not complete dynamic storage
> allocation, to me.
On this note, I disagree. Assigning s={} does not necessarily
give "an initial length". Nor do you even need to do that.
ex:
sequence name
puts(SCR,"what is your name?")
name = gets(KB)
if name[1] = GET_SUCCESS then
   name = name[2]
end if
In this example, name is neither initialized NOR given
an initial length... looks pretty dynamic to me... shrug
> 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.
errrrrr.... see above?
> 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] = new record
> I feel this is a more direct approach than append
> could ever be.
Now here I agree. With of course, the caveat mentioned
above. Just like you can slice S[3..2] and come up
{}, you should be able to do the above. Certain routines
could be heavily optimized, simplified and easier to read.
tnx for listening, --Hawke'
	
	
		| 
			 
									Not Categorized, Please Help
						 
		 | 
		
					 |