Re: Toll-free bridge type at runtime
Re: Toll-free bridge type at runtime
- Subject: Re: Toll-free bridge type at runtime
- From: Ryan Joseph <email@hidden>
- Date: Sun, 5 Apr 2009 19:09:29 +0700
I think you misunderstand, this check can't be made at compile time.
Also the moderator said:
this thread has passed it's usefulness. It certainly isn't appropriate
for cocoa-dev anyways.
so I think that means it has been banned. ;) What you said sparks some
ideas anyway that I will keep in mind. Thanks.
On Apr 5, 2009, at 4:22 PM, Uli Kusterer wrote:
On 03.04.2009, at 09:22, Ryan Joseph wrote:
The Pascal compiler I'm using would need some extra runtime support
(like telling me if a pointer is an object) to accomplish what you
are talking about, but yes that is the way it should work. I think
the Ruby and Python bridges made changes to the actual compiler
also that I'm not able to do so I need to look into other more
creative solutions.
Maybe I'm misunderstanding you, but can't you instead just do a
compile-time switch on the pointer's type? If someone declares an
ObjC pointer type (or CF pointer type) as a parameter type, you can
tell *at compile time* that passing a regular array will need to be
converted to that type. So you insert the conversion code. That is
where you should IMHO be trying to solve that problem.
Alternatively, I'm not too familiar with the Object Pascal runtime,
but aren't there classes used for the built-in types that you could
possibly redefine? Either just make them thin wrappers around
CFArrays etc., or create several subclasses (a class cluster if you
wish) that are regular Pascal arrays and CFArrays, and have
functions to convert from one to the other.
Then you could generate a stub library using the BridgeSupport files
that automatically wraps CFTypes in appropriate Pascal objects. Of
course, that still wouldn't solve the issues of directly
manipulating structs that contain CFTypes, but I presume those would
need to be handled specially anyway.
But finally, keep in mind that even Objective C makes no effort to
bridge the plain C types to CFTypes. So I think it would be
perfectly OK to just not do that wrapping, but rather provide
conversion functions for those cases where you need it, and let
people deal directly with the CFTypes (Maybe aided by simple helper
classes they can add to their projects).
Cheers,
-- Uli Kusterer
"The Witnesses of TeachText are everywhere..."
http://www.zathras.de
Regards,
Josef
_______________________________________________
Cocoa-dev mailing list (email@hidden)
Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden