Beefy Boxes and Bandwidth Generously Provided by pair Networks
Do you know where your variables are?

Re: Using constant to override (abstract) methods.

by moritz (Cardinal)
on Mar 28, 2011 at 08:40 UTC ( #895866=note: print w/replies, xml ) Need Help??

in reply to Using constant to override (abstract) methods.

Now a colleague claims that I cannot rely on this behaviour because constants become *inline* functions and so the lookup might crash in some (unknown?) cases.

Not true.

The inliner does inline most "normal" calls to these subroutines, but since it can't catch every invocation (like soft references, method style invocations, goto &subname, maybe more...), it keeps the sub itself around.

So it means you can use the use constant-generated subs as methods reliably.

After all the inliner is just an optimization, and shouldn't change user-visible behavior.

Replies are listed 'Best First'.
Re^2: Using constant to override (abstract) methods.
by klekker (Pilgrim) on Mar 28, 2011 at 10:30 UTC
    Thank you for this helpful explanation!


Log In?

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://895866]
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others having an uproarious good time at the Monastery: (5)
As of 2021-11-27 06:30 GMT
Find Nodes?
    Voting Booth?

    No recent polls found