[Pdx-pm] Instance hash ( keyed array )
tex at off.org
Wed Oct 18 21:07:23 PDT 2006
On Wed, Oct 18, 2006 at 04:32:39PM -0700, Roderick A. Anderson wrote:
> Wil Cooley wrote:
> > On Wed, 2006-10-18 at 01:51 -0700, Eric Wilhelm wrote:
> >> I'll also second the comments about the join -- save that for output.
> >> And I'll throw in a cringe regarding the global (hopefully just
> >> package) variables $FldDelim and $RcdDelim (make that 4 cringes: one
> >> for camel casing plus the global per each.)
Since you were intending to create a module, $FldDelim and $RcdDelim
would be package variables. I don't see any cringeworthiness here beyond the
name compression. Camel casing is acceptable for a package variable, according
to the style guide - though it suggests the additional use of underscores
which to my mind are probably optional since the caps change works as a word
ALL CAPS is for globals, but you shouldn't need those because globals
_are_ cringe worthy, as a general rule.
> > How about two more cringes for the compressed 8-character variable
> > naming, instead of something legible like $record_delimiter and
> > $field_delimiter?
> Hey. It looks cooler!
> Who knows?
Therein is the real question. If everyone knows, which we all seem
to, it's probably fine though less readable. If your code has enough comments
easier names are probably not necessary. However, the converse is that if your
variables are easier to discern you don't need as many comments.
There are lots of places where the perl internals look like
idx = st->dest.u.op.pc[i] (no comments) and module code that looks like
$arg=~/^\s*\[\s*$gre\s*(?:,\s*$gre\s*)?\]\s*$/ (no comments) so if your
code isn't perfect(ly readable) remember that ours often isn't either so
don't beat yourself up about it. In this case there is try as well as do
More information about the Pdx-pm-list