<br><br><div class="gmail_quote">2009/11/27 Diego Gomez Deck <span dir="ltr"><<a href="mailto:DiegoGomezDeck@consultar.com">DiegoGomezDeck@consultar.com</a>></span><br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;">
> Nicolas> The path to a cleaner/faster stream library is longer than just this<br>
> Nicolas> little step. Beside testing, we'd have to refactor the hierarchy,<br>
> Nicolas> insulate all instance variables, and delegate as much as possible as<br>
> Nicolas> Igor suggested. We'd better continue on the cleaning path and not<br>
> Nicolas> just add another FileStream subclass complexifying a bit more an<br>
> Nicolas> unecessarily complex library.<br>
><br>
> Michael Lucas-Smith gave a nice talk on Xtreams at the Portland Linux Users<br>
> Group. The most interesting thing out of this is the notion that #atEnd is<br>
> just plain wrong. For some streams, computing #atEnd is impossible. For most<br>
> streams, it's just expensive. Instead, Xtreams takes the approach that #do:<br>
> suffices for most people, and for those that can't, an exception when you read<br>
> past end-of-stream can provide the proper exit from your loop. Then, your<br>
> loop can concentrate on what happens most of the time, instead of what happens<br>
> rarely.<br>
<br>
I think we need a common superclass for Streams and Collection named<br>
Iterable where #do: is abstract and #select:, #collect:, #reject:,<br>
#count:, #detect:, etc (and quiet a lot of the messages in enumerating<br>
category of Collection) are implemented based on #do:<br></blockquote><div><br></div><div>Maybe I'm wrong but I think traits are a good (better) solution for that kind of problem. #do can be a required method and you can implement remaining methods with #do </div>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;">
<br>
Of course Stream can refine the #select:/#reject methods to answer a<br>
FilteredStream that decorates the receiver and apply the filtering on<br>
the fly. In the same way #collect: can return a TransformedStream that<br>
decorates the receiver, etc.<br>
<br>
Just my 2 cents.<br>
<br>
Cheers,<br>
<font color="#888888"><br>
-- Diego<br>
<br>
<br>
<br>
</font></blockquote></div><br>