develooper Front page | perl.perl5.porters | Postings from February 2018

Re: [perl #132768] OP_ENTERSUB is not called for constructor of tiedobject

Thread Previous | Thread Next
Dave Mitchell
February 12, 2018 20:13
Re: [perl #132768] OP_ENTERSUB is not called for constructor of tiedobject
Message ID:
On Sun, Jan 28, 2018 at 01:03:57PM +0000, Zefram wrote:
> KES wrote:
> >When we tie scalar to 'MyObj' class the MyObj::TIESCALAR is called
> >but OP_ENTERSUB is not executed before that. 
> Not a bug.  There is no entersub op because the sub call is not being
> made from Perl code.  There are many places in which subs get called by
> means other than explicit calls from Perl code.  Any XS code can make
> a sub call, and we even have a whole documentation file advising XS
> programmers how to do that.  It is not remotely viable to rely on sub
> calls being made only through Perl ops.
> >But still we can see OP_LEAVESUB for it
> The leavesub op isn't part of the call site, it's part of the called sub.
> Of course it only exists for a called Perl sub.  You'll see the opposite
> pattern when calling an XS sub explicitly from Perl code: an entersub
> op at the call site, then no leavesub or any other op until control has
> returned to the call site and moved on to the next thing.

I agree that this ticket should be rejected.

"I do not resent criticism, even when, for the sake of emphasis,
it parts for the time with reality".
    -- Winston Churchill, House of Commons, 22nd Jan 1941.

Thread Previous | Thread Next Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at | Group listing | About