First an apology if this doesn't fit this discussion area
In a node I started about tie and DBI giving me trouble, I apparently made a mistake by saying that I thought %h->{foo} was syntatically clearer than $h{a} and was immediately corrected in this node that it was being deprecated and no experienced perl coder would aggree with me.
Naturally, I have to question that.. $h->{foo} is clearly dereferencing the value of foo in a hashref.. %h->{foo} is clearly dereferencing the value of foo in a hash.
$h{foo} just seems like the exception to the rule if the rules are $=scalar/ref, %=hash, @=list. (clear and concise) Grant it, I believe hashes (and lists) are implemented as refs behind the scene and in that sense it makes sense.. It just looks weird to me. Again.. My opinion.
Now.. %h{foo} would be clearer yet.. But I take offense to the statement that experienced perl coders wouldn't use it.. possibly implying that I'm not experienced.. Grant it, I'm no saint.. but I'm no slouch either. Can I be that wrong if %h{foo} is introduced in perl6: Exegesis 2 At least someone thinks it could be written clearer.
I'm not trying to start a flame war here, but I am curious as to why people think %h->{foo}/$h->{foo} is less clear than $h{foo}/$h->{foo}.
What's your opinion? 8)
In reply to %h->{foo} vs. $h{foo}.. by smferris
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |