Beefy Boxes and Bandwidth Generously Provided by pair Networks
We don't bite newbies here... much

Inlining functions

by mirod (Canon)
on Dec 27, 2000 at 20:52 UTC ( #48443=note: print w/replies, xml ) Need Help??

in reply to Re: Re: When do you function?
in thread When do you function?

I add my voice to this: the should be a way to inline functions and method calls.

Granted you can use the pre-processor (perl -P) to inline functions but this does not work for method calls. This is really bad when designing OO Perl, where I find myself using straight hash access ($o->{field}) instead of accessors ($o->field) for some often-called methods (or writing painfull and risky kludges), which makes maintenance much harder

I am actually very surprised this is not even a Perl 6 RFC, I would think that this is a simple (I would think it is quite easy to implement) way to enhance speed or maintainability of OO Perl programs.

Replies are listed 'Best First'.
Re: Inlining functions
by merlyn (Sage) on Dec 27, 2000 at 21:43 UTC
    Well, since it'd probably be just an attribute on a subroutine, and we already have those, there's nothing really to RFC. {grin}

    Ideally, the Perl compiler would just recognize when a subroutine qualifies as an open-coded version, and "do the right thing". I'd prefer that. Just like how certain subroutines are recognized as "constant" now, and pre-evaluated.

    -- Randal L. Schwartz, Perl hacker

Log In?

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://48443]
and all is quiet...

How do I use this? | Other CB clients
Other Users?
Others making s'mores by the fire in the courtyard of the Monastery: (12)
As of 2017-01-17 13:57 GMT
Find Nodes?
    Voting Booth?
    Do you watch meteor showers?

    Results (156 votes). Check out past polls.