Getting current context (from C)

G

gga

I have a C function that I would like it to either be allowed to
receive a proc, method or a symbol.
In case a symbol is received, I would like that symbol to be converted
to a proc (by calling method() in the context of the *caller* to my
method).

In pseudo-ruby code:

# the idea here is to have:
# myfunc( :hello )
# be the same as doing:
# myfunc( method( :hello ) )

def hello
p 'callback'
end

def myfunc( proc )
proc = stacktrace[-2].class.method( proc ) if proc.is_a? Symbol
# .... etc ...
end

myfunc( :hello ) # instead of myfunc( method( :hello ) )

Can anyone point me a way to do the above in C (or even ruby)? I'm
basically stumped on how can I call the method() function in the
context of the caller to my function, so as to properly resolve the
binding.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
474,222
Messages
2,571,138
Members
47,755
Latest member
Grazynkaa

Latest Threads

Top