>>>>> "DS" == Dan Sugalski <[EMAIL PROTECTED]> writes:

  DS> At 10:32 AM 9/4/2001 +0100, Piers Cawley wrote:

  >> Will the subroutine know how it was called? (ie: Through method
  >> dispatch or through straightforward symbol table lookup. I'm really
  >> hoping the answer to this is 'yes'.) Or will methods and subroutines
  >> be distinct now?

  DS> I suppose we could, and I don't know.

damian's new want (RFC 21) will be able to tell the difference. there is
a method context that is returned if called via a method.

  DS> Can you see any use of a sub knowing it was called via a method
  DS> call?

for sure. one case i saw recently in c.l.p.m was someone who wanted to
chain method calls together like this:

        $obj->meth1()->meth2() ;

this is easy assuming you return the object in each method call. but he
ALSO wanted:

        $bar = $obj->meth1() ;

to return something other than $obj.

so it would be easy to check that with want and return the desired
thing.


i am sure damian will be able to come up with more examples. in any case
it is specified in his want RFC and i will bet it will be in the
language. the whole want thingie is very cool.

uri

-- 
Uri Guttman  ---------  [EMAIL PROTECTED]  ----------  http://www.sysarch.com
SYStems ARCHitecture and Stem Development ------ http://www.stemsystems.com
Search or Offer Perl Jobs  --------------------------  http://jobs.perl.org

Reply via email to