Beefy Boxes and Bandwidth Generously Provided by pair Networks
The stupid question is the question not asked
 
PerlMonks  

Re^4: Perl Best Practices for naming variables (sv, av, hv)

by tye (Sage)
on Nov 08, 2012 at 15:27 UTC ( #1002926=note: print w/replies, xml ) Need Help??


in reply to Re^3: Perl Best Practices for naming variables
in thread Perl Best Practices for naming variables

In Perl, the prefixes of sv, av, and hv might be more recognizable. Well, at least for people who have seen discussions that touched on internals that used the standard (and ubiquitous) abbreviations that are used internally.

At least, I have sometimes used names like $sv_xml when I saw a value in calling out "this is a reference (of this type)" in the variable name.

- tye        

Replies are listed 'Best First'.
Re^5: Perl Best Practices for naming variables (sv, av, hv)
by Anonymous Monk on Nov 09, 2012 at 04:49 UTC
    Maybe, though array-value/hash-value/scalar-value don't sound as good as array-ref/hash-ref/scalar-ref -- but definitely better than ref-array/ref-hash/ref-scalar

      But ar, hr, and sr aren't any more recognizable than ra, rh, and rs (probably worse because, especially hr and sr, they are too recognizable as something else). I think aref, href, and sref would work fine. But if I want a prefix half that long, I'm going with av, hv, and sv. :)

      - tye        

        they are too recognizable as something else

        :) I don't have much in the way of cultural bias, but I am biased against calling a reference a value -- sure its a value, sure its common in perlapi/perlxs , but not in the perldata...

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://1002926]
help
Chatterbox?
[ambrus]: Something you can have at home and your corner print shop, without a whole printing press's worth of equipment.
[ambrus]: As for TeX, I'm not trying to discourage anyone from writing carefully beautifully typeset documents, in maths or outside. But most people aren't willing to do that, and will spend only little time about the formatting,
[ambrus]: and try to leave everything else to automated systems without checking how what they write came out format-wise, and for those people, discounting the part about journals with a specific format above,
[ambrus]: just blindly recommending to use LaTeX is a bad idea now.

How do I use this? | Other CB clients
Other Users?
Others contemplating the Monastery: (9)
As of 2017-09-26 11:20 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    During the recent solar eclipse, I:









    Results (293 votes). Check out past polls.

    Notices?