On Nov 23, 2005, at 19:08, Chip Salzenberg wrote:

On Wed, Nov 23, 2005 at 03:14:40PM -0000, [EMAIL PROTECTED] wrote:
implement Sub.get_caller() method; test

You keep confusing static and dynamic call information.

Not confusing actually, maybe abusing the static sub structure by adding a dynamic field 'ctx' - yes.

Like I've said (repeatedly :-)), rule #1 of call info is:

  Subs don't have callers.
  Call frames have callers.

And callframes aren't PMCs (because we don't have weak pointers) therefore an introspection of :outer can only return the 'Sub' of outer but not actually the real call frame aka the context ...

The introspection $frame.get_lexpad (pdd20) can't be implemented w/o that currently.

outer_sub - (the static sub PMC info) can't refer to :outer because the :outer can be a closure too. There are many incarnations of the :outer then. Therefore the implementation needs sub->ctx (currently and IMHO).

Therefore, this code is not OK, because the Parrot_sub structure has
information it can't have:

+    METHOD PMC* get_caller() {

It returns the sub PMC of the caller, which is rather useless for the one case of recursive subs - yes. There is still the interpreter based interface, so I can just remove this code - np.

Parrot_sub must not have a ctx member.

Ack all, but how do I implement this then:

   me = interpinfo .INTERPINFO_CURRENT_SUB
   outer = me."get_outer"()
   pad = outer."get_lexpad"()

leo

Reply via email to