Stream, SharedQueue2, 39Deprecated, #flush

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

Stream, SharedQueue2, 39Deprecated, #flush

marcel.taeumel
Hi, there.

In SharedQueue2, which is a Stream, the message #flush is deprecated. 

Why?

All streams understand #flush. SharedQueue2 is a Stream. Consequently, it should answer to #flush.

Anybody remember why the #removeAll message got introduced to SharedQueue2 and why it should replace #flush?

Even SharedQueue has #flush.

Best,
Marcel


Reply | Threaded
Open this post in threaded view
|

Re: Stream, SharedQueue2, 39Deprecated, #flush

Levente Uzonyi
IIRC the idea was that the name #flush (and #flushAllSuchThat:) doesn't
describe well what the method actually does, and #removeAll and
#removeAllSuchThat: are better. The best solution here is to move the
deprecated methods back to the package and "undeprecate" them, because
#flush and #flushAllSuchThat: can only be changed once the migration from
SharedQueue to SharedQueue2 happens.

SharedQueue2 should not be a Stream. It somewhat understands the Stream
protocol and behaves a bit like a stream, but it doesn't implement the
full API (#atEnd, #contents). Also, it doesn't gain anything from
being a subclass. The inherited methods don't have the guarantees its own
methods have.

I was investigating the migration from SharedQueue -> SharedQueue2, and it
didn't seem to be an easy thing to do. There are two options:

1) remove SharedQueue and rename SharedQueue2 to SharedQueue
This is very likely to break the image as there are actively used
SharedQueue instances.

2) reshape SharedQueue in a few steps to have the same layout and methods
as SharedQueue2. The problem with this is that there may be processes
waiting on the semaphore of SharedQueue, which would need to wait on the
monitor instead. Perhaps it's enough to just restart their last frame, but
I didn't try that.

Both methods probably break (de)serializers.

Levente

On Wed, 23 Jan 2019, Marcel Taeumel wrote:

> Hi, there.
>
> In SharedQueue2, which is a Stream, the message #flush is deprecated. 
>
> Why?
>
> All streams understand #flush. SharedQueue2 is a Stream. Consequently, it should answer to #flush.
>
> Anybody remember why the #removeAll message got introduced to SharedQueue2 and why it should replace #flush?
>
> Even SharedQueue has #flush.
>
> Best,
> Marcel
>
>