Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

Already on GitHub? Sign in to your account

Revert passive RECV to 2-tuple #12

Merged
merged 1 commit into from Jun 10, 2011

Conversation

Projects
None yet
2 participants
Owner

ianbarber commented Jun 10, 2011

OK, I think I am pretty much convinced by Gar1ts points in the other thread, some of which are cut and pasted below. This basically means the API change would just be to active, but I think that is consistent as active is fundamentally a bit different. Anyway, I'll leave the merge up to you guys - I am in favour of having passive recv in this way, but this isn't my playground :) Tests also updated.

============ C+P From Gar1t below =============

Ian, in your discussions on the flags, what was the gist of the argument that swayed the debate (in the context of recv, not in the 'zmq' messages sent in active mode)?

Looking over the examples I'm filling in (https://github.com/gar1t/zguide/tree/master/examples/Erlang), I'm not sure that API change has much value. Of the 34 calls to recv, there are three checks for rcvmore.

Even that was used more often, it doesn't really clean much up. Here are the different uses (as you well know, just getting them on paper):

    {ok, Msg, Flags} = erlzmq:recv(Socket),
    case proplist:get_bool(rcvmore, Flags) of
        true -> handle_more();
        false -> nomore()
    end

    {ok, Msg} = erlzmq:recv(Socket),
    case erlzmq:getsockopt(Socket, rcvmore) of
        {ok, 1} -> handle_more();
        {ok, 0} -> nomore()
    end

I'm not seeing the payoff here that would justify these costs:

* Big break in the API, which (at least based on what I'm seeing in the examples) would go unused most of the time
* Cost of looking up that flag on every call - this might be small, but it's there (and forced, ick)
* Potential source of fugliness and bugs (if you're tempted to match directly on the list)

evax added a commit that referenced this pull request Jun 10, 2011

Merge pull request #12 from ianbarber/master
Revert passive RECV to 2-tuple

@evax evax merged commit 5442d91 into zeromq:master Jun 10, 2011

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment