RE: Standard Euphoria Library Project
- Posted by Chris Bensler <bensler at mailops.com> Feb 07, 2001
- 409 views
DOH!! Don't think I actually ever TRIED to see if it works or not before!! To me it just seems irrational that it WOULD work.. it's an invalid subscript.. But to my amazement it does!! Foolish me.. Chris {;oP DUH! Chris Bensler wrote: > 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 > > > >