--- Luke Palmer <[EMAIL PROTECTED]>
wrote:
> TOGoS writes:
> > I0  Prototyped return?
> > I1  Number of overflow return values
> > I2  Number of return values in PMC registers
> > P3  Overflow return values in an array PMC
> > 
> > so as to make call/return symmetrical
> > (this would also allow me to use the same
> > Params class in my compiler for both
> > calls and returns ;-)
> 
> This is brilliant!  And it's not because you can
> re-use your Params
> class.  It's because call context falls right out of
> the calling
> conventions.
> 
> Provided that we have a way to attach signature
> information to a PMC
> (which would be pretty nice, I suspect), then the
> signature of P1 is the
> context of the call.  And now we don't have to pass
> in context
> information seperately.
> 
> And if you feel like fooling with continuations;
> i.e. putting somebody
> else's return continuation in P1, the context will
> work out correctly
> there, too.
> 
> Actually, attaching dynamic signature information to
> various kinds of
> .Subs seems to have a lot of advantages.  It makes
> cross-language
> calling easier, because the caller has an idea about
> what the callee
> wants. 

Tee-hee! I didn't even think of that, but yes,
that's very clever. I'll throw my thoughts about
how signatures could work on the table...

Every PMC has a 'get_signature' method.
You can use this to get the signature of the object
so that you can make a prototyped call on it.
Now, there are at least 2 special signatures that I
can think of:

* Uhh... I don't really have a signature. Just
  pass in whatever you want (basically an
  unprototyped call)
* Go away! I'm not invokable! Please don't
  invoke me!

The caller can feel free to ignore the signature,
however, and simply call the sub in the
unprototyped fasion. The callee could then
(if it felt like it) call a make_params_prototyped
op, which would change the un-prototyped parameters
into prototyped parameters using the callee's
signature. It could also raise an exception
if it had the wrong number of parameters or
something.

BTW,
If there is no way to get a sub's signature, then
how would you implement named parameters on an
unprototyped sub?

__________________________________
Do you Yahoo!?
Yahoo! SiteBuilder - Free, easy-to-use web site design software
http://sitebuilder.yahoo.com

Reply via email to