|Newbie questions about Pliant
I would like to have a way to implement a nameless method
that will be executed by default, so as to handle all the
messages sent to the object that are not caught. This is
equivalent to perl AUTOLOAD facility. I need this method
to be a meta level code, because it must handle a variable
amount of arguments.
|Message posted by reitman on 2004/06/03 09:57:32
|I want to use such facility in order to convert the last line in,
var PerlScalar obj := perl_new T
perl obj say_hello arg1 arg2 ...
obj say_hello arg1 arg2 ...
Right now "perl" is a meta. The object, being of type PerlScalar, will
figure out that it must make a perl method call. This way the user of the object
need not know that the implementation is via perl.
It would be easy if there was an autoload facility (could have a different,
more suitable name), but it must be a meta level facility, because
it must handle a variable number of arguments.
Is it possible to do this with pliant ?
|Message posted by hubert.tonneau on 2004/06/03 14:05:22
meta '. say_hello' e
|Message posted by reitman on 2004/06/03 16:27:09
|Sorry, this is not what I need because I need to know the name 'say_hello'.
If I could do something like this,
meta '. *' e
such that I could match all method names, that would be what I need.
Basically, I need to convert,
obj X y1 y2 ...
perl obj X y1 y2 ...
for all X.
Can I do this somehow ?
|Message posted by hubert.tonneau on 2004/06/03 16:30:51