Re: Re: Re: "use strict;" woes
by hardburn (Abbot) on Oct 14, 2003 at 18:15 UTC
|
If I'm guilty of it, then so is Larry Wall (yes, perlstyle specifically addresses this point).
---- I wanted to explore how Perl's closures can be manipulated, and ended up creating an object system by accident.
-- Schemer
Note: All code is untested, unless otherwise stated
| [reply] |
|
|
- You didn't say: Larry's preference, you said "generally"
- Larry does not explicitly address that in perlstyle. (note, LW's
style notes are only the first portion of that doc, the latter portion
is other's (largely Tom Christiansen).
- One part of that document *does* explicitly address using case to
indicate scope, and it suggests all caps for *constants*, and mixed
case for package globals (the case at hand).
- As many people in the community use MixedCase as use underscores to
separate "words" in identifiers.
Your way is in no way the general way, or even the recommended perlstyle
way.
| [reply] |
|
|
This is from perlstyle:
While short identifiers like $gotit are probably ok, use underscores to separate words. It is generally easier to read $var_names_like_this than $VarNamesLikeThis, especially for non-native speakers of English. It's also a simple rule that works consistently with VAR_NAMES_LIKE_THIS.
hardburn's advice is solid, helpful, and appreciated.
Your advice is ... what is the point of your
advice? That even though hardburn's advice was good,
it is opinionated? So what? It's ALL opinion! At least i know who hardburn is. Who are you? Generally speaking,
of course.
| [reply] |
|
|
|
|
|
Re: Re: Re: "use strict;" woes
by perrin (Chancellor) on Oct 14, 2003 at 19:08 UTC
|
My experience is that if you look at a lot of CPAN code you will find that underscores are more popular than studly caps, package globals are usually Mixed_Case, and constants are usually ALL_CAPS. This is backed up by most of the writings on Perl style. You are of course free to do whatever you like in your code, but I don't think it's a stretch to call this a general preference. | [reply] |
|
|
My experience is that if you look at a lot of code whether on CPAN or elsewhere you'll find all sorts of different styles. I couldn't care less whether someone uses variables_like_this or variablesLikeThis, they're both equally readable to me and equally functional. What I do care about is the style police telling me what I should and should not do. Thankfully, perl itself ignores the style police, so I can too.
| [reply] |
|
|
No one is telling you what to do. Someone tried to offer a formatting tip (in a friendly way even) to a person who appears to be a newbie, and someone else jumped all over him for daring to express an opinion about readable style, and I pointed out that there is such a thing as a most common opinion about Perl style (even though the common opinion in this case is actually different from what hardburn suggested). You can feel free to write your variables as totally random strings of characters. Since I don't have to maintain your code, I don't care.
| [reply] |