[zeromq-dev] [Zproject] Unclear semantics of polymorphic
Joe McIlvain
joe.eli.mac at gmail.com
Mon Dec 14 22:30:16 CET 2015
The "polymorphic" attribute was added recently. There was some debate
about it, and I'm still not convinced that it's useful. Basically,
polymorphic implies "singleton" with a first argument of type "anything"
(which translates to a void pointer).
I'd be in favor of removing the concept of "polymorphic" in favor of
explicit "singleton" with "anything" as the first argument, unless someone
has a specific reason why this concept is useful as a separate one. I
think it just adds to confusion, as Michal has demonstrated.
On Mon, Dec 14, 2015 at 1:19 PM, Michal Vyskocil <michal.vyskocil at gmail.com>
wrote:
> Hi,
>
> the documentation on zproject API model has been recently updated and
> new polymorphic argument for method appeared. I was looking for use,
> but I fail to see any difference from singleton methods.
>
> Only one hint from documentation is that polymorphic methods takes
> void* as a first argument.
>
> In czmq there are four examples
> * zactor_is is singleton
> * zactor_resolve is singleton
> * zsock_it is sinleton
> * zsock_resolve is singleton, polymorhpic
>
> So question #1 - it sounds there is no way looking at function
> definition to know if it is singleton/polymorphic or both. Am I right?
>
> And question #2 - the only one binding who knows about polymorphic is
> Ruby binding atm. Can anyone explain how this is used there? My Ruby
> skills are too low too understood the code, but the generated code
> looks the same for is and resolve in zsock.rb. So I fail to see the
> purpose of it ...
>
> --
> best regards
> Michal Vyskocil
> _______________________________________________
> zeromq-dev mailing list
> zeromq-dev at lists.zeromq.org
> http://lists.zeromq.org/mailman/listinfo/zeromq-dev
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.zeromq.org/pipermail/zeromq-dev/attachments/20151214/87fdab29/attachment.htm>
More information about the zeromq-dev
mailing list