[BUG] PositionableStream>>match:
Bijan Parsia
bparsia at email.unc.edu
Wed Aug 11 05:45:09 UTC 1999
Hello folks:
It seems that PositionableStream>>match: returns 'false' no matter what,
contrary to the method comment:
"Set the access position of the receiver to be past the next occurrence
of the subCollection. Answer whether subCollection is found. No wildcards,
and case does matter."
Maybe I'm misreading that, but it sure *seems* to say that if there's a
match, I should get "true". But, the last line of the method is:
^self atEnd
Now if I find a match, I'm typically *not* going to be at the end. So this
will typically return "false". Of course, it will return false if I get all
the way to the end without finding anything (do to a return in a block).
Worse, it *will* return "true" in the case where the matched subcollection
*happens* to occur at the end of the stream. Boo!
I *think* it will work if the last line just returns "true".
But wouldn't it be more useful, oh, to return the starting index of the
match (since the method moves the position past the end)? If there's no
match, it could return nil.
Oh, and it seems like it won't work on non-read streams. Like TextStream
(grr). If so, shouldn't it be shouldNotImplemented?
Cheers,
Bijan Parsia.
More information about the Squeak-dev
mailing list
|