RE: Standard Euphoria Library Project

new topic     » goto parent     » topic index » view thread      » older message » newer message

You shouldn't be allowed to try and access an out of bounds subscript..
It may not crash, but why would you want it to do that? IMHO, it should 
crash.. that's what error checking is for..

Chris

Fam. Nieuwenhuijsen wrote:
> > David Cuny wrote:
> >
> >   <SNIP>
> > > function remove( integer i, sequence s)
> > > -- remove ith element from s
> > >     return s[1..i-1] & s[i+1..length(s)]
> > > end function
> >    <SNIP>
> >
> > What if the user tries to remove the first or last item?
> > i would end up being 0 or greater than the length of >the sequence..
> 
> Yes, *but* Euphoria won't crash. When you slice from one above the 
> length of
> the sequence or when you slice to zero it will return an empty seq 
> rather
> than crash.
> 
> Come on people. This is trivial beginners stuff.
> 
> Ralf N.
> nieuwen at xs4all.nl
> 
>

new topic     » goto parent     » topic index » view thread      » older message » newer message

Search



Quick Links

User menu

Not signed in.

Misc Menu