Beefy Boxes and Bandwidth Generously Provided by pair Networks
"be consistent"
 
PerlMonks  

Inlining functions

by mirod (Canon)
on Dec 27, 2000 at 20:52 UTC ( [id://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?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others having a coffee break in the Monastery: (9)
As of 2024-03-28 18:48 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found