On 03/21/2013 21:22, IOhannes m zmölnig wrote:
> On 03/21/2013 21:02, IOhannes m zmölnig wrote:
>> "inlet: expected 'pointer' but got 'pointer'"
>
> so having a short go into m_class.c, it seems indeed that the
> c_pointermethod is called from within the list-method.
i tried again to understand what is going on here, and it seems that:
- there is NO explicit selector for pointers (there is "float" for
numbers, and "symbol" for symbols; there's also "pointer", but it is NOT
used as the type-selector for pointer messages).
at least, pd_typedmess() does not handle "pointer" messages.
the only way to invoke the pointermethod of an object via a generic
message is by using a "list" with a single pointer-valued atom.
i *guess* that this is a security measure, to prevent people from
passing pointers around.
the "ordinary" way to pass a pointer to the pointermethod, is by using
outlet_pointer() which simply bypasses the whole selector business.
thus there are basically two ways to output pointers in [trigger]:
- either generate a single-atom list with a ptr atom.
- or use outlet_pointer()
the first solution (which is the one i posted yesterday), is definitely
much simpler to implement.
otoh it is less efficient (needs to call the method dispatcher via
typedmess) and it modifies the message as it came in (the
pointermethodcall is transformed to a message that should trigger the
pointermethodcall).
note that the original [trigger] also performed this transformation.
the 2nd solution would be to add an exception to the "anything" outlet
of [trigger], that would use outlet_pointer() for incoming pointers.
this would probably generate more consistent pointercalls.
otoh, it is totally inconsistent with the way other messages are handles
in the "anything" output. all of them are sent via typedmess.
having said all this, i think i personally favour the "list <ptr>"
approach (solution#1 as implemented).
i particularily like it, as i am a strong believer that float and number
messages should actually also become "list <flt>" resp. "list <sym>",
and the selectors should not be abused as type identifiers.
dfmase
IOhannes