[squeak-dev] [BUG] Parser does not detect syntax error with double colon
Chris Muller
asqueaker at gmail.com
Thu Mar 5 01:06:58 UTC 2020
Hi Marcel,
> Perhaps I'm getting too old, but I see no reason to use these methods
> when you know the receiver is a stream.
>
> That's right. :-) Both #any: and #take: are generic forms of #anyOne and
> #first: and similar for collections that are not necessarily sequenceable.
> The partial adaptation of the collection protocol for streams is still
> experimental. It is useful in scripting scenarios.
>
> "stream take: 42" does not make any sense.
> "streamOrCollection take: 42" can be quite useful. :-)
>
Hmmm.... There really isn't much other shared API between the two, is
there? Let's see:
Collection methodDictionary keys intersection: Stream methodDictionary
keys
"---> #(#printOn: #gather: #take: #reject: #contents #write:
#any: #collect: #select:thenCollect: #do: #select:)"
Wow, that's actually more than I thought. Still, look at the size of the
mismatch!
(Collection methodDictionary keys difference: Stream
methodDictionary keys ) size "---> 162"
It kinda makes sense since, semantically, they're two *totally different*
things. Even the ones that match, the semantics are not always the same.
For example, #do: -- enumerates all elements in Collection, or *only the
remaining* elements in Stream.
So I'm not so sure going further down the path of encouraging client code
to interchange two such disparate objects was a good idea. Don't they
usually take either/or as input convenience, but then use or convert to
whatever it uses for internal implementation..
Best,
Chris
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.squeakfoundation.org/pipermail/squeak-dev/attachments/20200304/8768acf2/attachment.html>
More information about the Squeak-dev
mailing list
|