[zeromq-dev] [Zproject] Unclear semantics of polymorphic

Pieter Hintjens ph at imatix.com
Tue Dec 15 11:57:07 CET 2015

I can see the goal with polymorphic (it's to describe methods in e.g.
zsock that take an untyped reference, and then determine its type at
runtime from its signature).

It doesn't add anything to the zproject model afaics.

On Mon, Dec 14, 2015 at 10:30 PM, Joe McIlvain <joe.eli.mac at gmail.com> wrote:
> 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
> _______________________________________________
> zeromq-dev mailing list
> zeromq-dev at lists.zeromq.org
> http://lists.zeromq.org/mailman/listinfo/zeromq-dev

More information about the zeromq-dev mailing list