RE: match()
- Posted by Al Getz <Xaxo at aol.com> May 27, 2003
- 409 views
Christian.CUVIER at agriculture.gouv.fr wrote: > > > Since match() is meant to look into a sequence for another sequence, it > > looks for "something" in "something", as Juergen said. > So calling match(.,.) with one or both arguments empty is an invalid > condition. Returning -1 (just like routine_id on an unknown routine > name) seems much more flexible and adequate than throwing out an error, > so I'd push for this change. > > CChris > > Hello there, That's a very logical way of looking at it, i forgot about routine_id() and it's silent failure mode. You cant, however, allow match to return -1 because it would break far too much existing code. On the other hand, returning a zero when one or both args are null wouldnt break any code. This means match("",s) match(s,"") match("","") all should return zero, without regard for what is (or isnt) contained within the sequence s. Side note: The only reason routine_id returns a -1 and not a zero is because zero is an allowed routine id. Take care, Al