So, you can also get code_typed of a Method of a Function. I have a PR to make code_typed walk the methods of a Function (and also accept a Method object), rather than requiring you to write the signature. Would either of those work for you?
-- Leah On Sun, Jun 29, 2014 at 4:03 PM, Elliot Saba <staticfl...@gmail.com> wrote: > Just in case someone else is interested in this kind of stuff, here's my > simple > test case <https://gist.github.com/staticfloat/680881ed3d061c4c6600>. I > create a dynamic library that has a function that expects a callback in the > form of a block, and calls it. My motivation for this is that I am calling > a private Apple framework that uses blocks extensively for callbacks, and > I've been spoiled by Julia, so I didn't want to do everything in C. Of > course, this will probably generate even more problems along the way, but > at least they'll be fun problems. :) > -E > > > On Sun, Jun 29, 2014 at 1:21 PM, Elliot Saba <staticfl...@gmail.com> > wrote: > >> I'm having trouble figuring out how to get a function's argument types >> from a macro. >> >> Specifically, I'm playing around with calling functions that expect >> blocks as arguments from Julia. I've got a simple case working, (which is >> awesome) but it hard-codes knowledge of the block's signature, and I'd like >> to dynamically generate that. Ideally, I'd be able to do something like: >> >> block_struct = @block function( arg1::Float64 ) >> ... >> return foo::Int64 >> end >> >> And the @block macro would be able to figure out the types of arg1 and >> foo. Is such a thing possible? I need these types so that I can construct >> a description of this function to pass off to the objective-c runtime, >> allowing for objective-c code (And modern apple C++ code) to callback to >> julia. :) >> -E >> > >