good chemistry is complicated, and a little bit messy -LW |
|
PerlMonks |
Re^3: Named Subroutine Parameters: Compile-time errors vs. Run-time warningsby shmem (Chancellor) |
on May 29, 2009 at 18:31 UTC ( [id://766912]=note: print w/replies, xml ) | Need Help?? |
Still, at least it's not the worst mistake I made in PBP. ;-) Uh-oh. Whats next? Have a list? ;-) I stand by the overall recommendation though. Error messages that point users to the right place are definitely worth the (tiny) overhead of passing named args in a hash. Definitely. The recommendation of passing named args in a hash is fine, the one of the MTOW you promote TDI is, if not wrong, then sub-optimal.
In the above examples, both of the costly structures for %hash and $hashref are allocated at the pad of the current scope and populated at run time. In the last example, that structures are set up and teared down at every call to frobnitz() :
Some of the above pointer being equal is just an artefact of the subsequent call of the same sub (I guess here).
In Section
Seekers of Perl Wisdom
|
|