If bools, indexes and numbers are all the same type under the hood that seals for the defence, I guess.

I was thinking along the lines of a patch that either outputs an identifying string {"number","string","color","array","image",…} according to input in QC terms or tests for a match of two inputs being same type.

Another patch could test for more Cocoa specific types that you see on the tooltips like {"NSCalibratedColorSpace…","RBGColor",…} for debugging.

I'm more interested in the first kind of testing at this stage: images, numbers, bools (hopefully), virtual, string, etc. Note my Javascript Patch wasn't good at picking up strings (seem to come in as Virtual), images nor bools/indexes (for reasons you explained).

Thanks
Alastair

Attachment: typeof testing II.qtz
Description: application/quartzcomposer




On 06/08/2010, at 5:35 AM, Christopher Wright wrote:

I have a need to see if an object has been from a boolean input splitter but they always seem to get coerced to numbers when passed to other patches...

There isn't currently a way to determine the type of a virtual, but after some thinking (incidentally -- not related to this at all) it seems like having a "typeof" patch that took a virtual input in, and set the corresponding output type to true would be handy for making macros that accept virtual inputs (one use would be a Debugging macro that intelligently handles various input types automatically).

Even with that, I still think boolean vs. number will be problematic, because they're both represented identically under the hood so there's not really a way to distinguish what the orginal was. (similarly, number and index will be problematic because every index is a number).

(on NSNumber, there's -objCType, which _might_ actually allow distinguishing the type in some cases, but the documentation says it's not necessarily always going to match...)

--
Christopher Wright
[email protected]




 _______________________________________________
Do not post admin requests to the list. They will be ignored.
Quartzcomposer-dev mailing list      ([email protected])
Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/quartzcomposer-dev/archive%40mail-archive.com

This email sent to [email protected]

Reply via email to