Think about Loose Coupling | |
PerlMonks |
Re^5: No garbage collection for my-variablesby BrowserUk (Patriarch) |
on Sep 17, 2008 at 00:06 UTC ( [id://711837]=note: print w/replies, xml ) | Need Help?? |
If that function is called in a non-void context, it is returning the result of the "debug statement", which seems more than a little artificial. If the function is ever called in a non-void context, it will be because it returns something useful. If the return statement (or the fall-off-the-end expression) is omitted, then the function isn't going to work the way it is intended anyway, so any other error is academic. Just another justifiction I'm afraid. Plenty of languages use pass-by-reference, and thousands of programmers and millions of programs use it every day without dire consequences. Designing interfaces around performance optimizations and memory management oddities just doesn't seem right to me. You seem to be saying: Oh, I mustn't use this language feature, because that would make my code more efficient and that would be an optimisation and it might be premature! Why does Text::CSV_XS exist? Or the XS version of List::Util? Or ... It's changing your transatlantic flight path to take full advantage of (or avoid) the gulf stream. It's shutting off the fuel supply to the injectors when the engine is on overrun. Removing your roof rack when you aren't using it. Perl is a context sensitive language, it is a uniquie and powerful defining feature. Perl programmers need to be aware of it, understand it and use it. Pretending it doesn't exists, or running scared of it you might as well use VB. It drives me nuts. I use Perl, because I like the language. But there are people around here won't use map or grep; or statement modifiers; or unless or until. They eshew aliasing; context sensitivity; autovivification; the implicit variables: it and these. They want everything OO; will jump through hoops creating singleton classes, "to avoid globals" and end up with nothing more than lexically-scoped globals (eg. our). Use ReadOnly variables as constants instead of constants. Why bother using Perl? Examine what is said, not who speaks -- Silence betokens consent -- Love the truth but pardon error.
"Science is about questioning the status quo. Questioning authority".
In the absence of evidence, opinion is indistinguishable from prejudice.
In Section
Meditations
|
|