I was somewhat wondering who might actually have suggested this, probably not anyone who has made a serious use of Perl.
When I first used Perl, I found the $%@ symbols confusing as all heck, and wished it was more like PHP.
Now that I've used a lot of Perl, I wish PHP would make more use of the $%@ symbols for clarity sakes. Actually, it would be a lot nicer in many languages to use symbol-defined clarifiers, I certainly get tired of "Dim Somevar as sometype" and "sometype somevar" when somebody makes an extremely ambiguous name which doesn't differentiate an array from a scalar or reference variable.
Ignorant people keep educated people employed! - phorm
Some of us would say that you should choose variable names to mean what they say, so it's reasonably obvious what the type is. Plural in particular is a big help, and hash/list distinctions can often be made obvious. In dynamic languages, this is usually sufficient.
But while I believe in that, what I *really* want to see in perl is the sigil labelling the named object, not the final value of the expression, i.e., %hashvar{THING_IN_HASH} instead of $hashvar{THING_IN_HASH}. Fortunately, Perl 6 is supposed to do it this way.
Of course, that's the idea.
The problem comes when I am working on other people's code, and they haven't commented correctly. In Perl, you've still got that little @ sign to indicate something was supposed to be an array,etc.
Of course, it would be nice if this applied to the variable when assigning individual values, instead of just when assigned to the overall object as an array (as mentioned in another comment, this is supposed to be dealt with in Perl 6?).
Hmm... I learned C, C++, Perl, and PHP in that order. (Actually, before that, I learned BASIC, FORTRAN, RPG, and COBOL, but I don't like to think about that.)
My first impression on learning Perl was wondering why the heck Larry hadn't bothered to learn how to use lex, yacc, and maintain a proper symbol table. Then, of course, I realized Larry does know all that and had reasons of his own. But I still disagree with them.
When I learned PHP, I thought it was wonderful to A) only have one generic variable 'sigil', and B) to have real multidimensional arrays that didn't require Perl's horrid reference syntax. (I know they're not really multidimensional arrays behind the curtain in either language, but that's beside the point.)
For the record, I think Perl is a much more powerful language than PHP, but that PHP makes building web interfaces (usually to Perl and C backends in my case) than mod_perl or (God help me) Mason.
In the end, I still wish Larry would reconsider the type sigils on the grounds that they violated the TMTOWTDI principle and force the programmer into what may be, for any given developer or development team, a suboptimal notational system. It's as if Microsoft's Hungarian Notation were enforced by the compiler. Thanks, but if I need to include type information in my variable names, I'll put it there myself.
I certainly get tired of "Dim Somevar as sometype" and "sometype somevar" when somebody makes an extremely ambiguous name which doesn't differentiate an array from a scalar or reference variable.
This is why good coding styles arise.
And no, I'm not talking about Hungarian Notation.
I'm talking about variable names that are meaningful and method names that are meaningful. Some people take pride in Obfuscating their code. Me, I take pride in knowing that I can come back to a set of code a year later and still know what it does either by documentation (rarely) or good coding style and good variable names (less rarely:-) ).
I have the simplest tastes. I am always satisfied with the best.
-- Oscar Wilde
Removing the % $ and @ (Score:4, Interesting)
When I first used Perl, I found the $%@ symbols confusing as all heck, and wished it was more like PHP.
Now that I've used a lot of Perl, I wish PHP would make more use of the $%@ symbols for clarity sakes. Actually, it would be a lot nicer in many languages to use symbol-defined clarifiers, I certainly get tired of "Dim Somevar as sometype" and "sometype somevar" when somebody makes an extremely ambiguous name which doesn't differentiate an array from a scalar or reference variable.
Ignorant people keep educated people employed! - phorm
Re:Removing the % $ and @ (Score:1)
I guess that a lot of people agree with you, then. This change is being implimented in Perl6.
Re:Removing the % $ and @ (Score:1)
Re:Removing the % $ and @ (Score:1, Insightful)
I find that
$foo{"xyz"} = "moose";
Is more eloquent than foo.setHashKey("xyz","moose");
because I can comprehend it without translating to English first. Same way with Calculus. Formulas read better than word problems.
Hmm, how's that for linguistics!
Re:Removing the % $ and @ (Score:2)
But while I believe in that, what I *really* want to see in perl is the sigil labelling the named object, not the final value of the expression, i.e., %hashvar{THING_IN_HASH} instead of $hashvar{THING_IN_HASH}. Fortunately, Perl 6 is supposed to do it this way.
Re:Removing the % $ and @ (Score:1)
for example:
i32_myNumber
u32_counter
etc
Re:Removing the % $ and @ (Score:1)
The problem comes when I am working on other people's code, and they haven't commented correctly. In Perl, you've still got that little @ sign to indicate something was supposed to be an array,etc.
Of course, it would be nice if this applied to the variable when assigning individual values, instead of just when assigned to the overall object as an array (as mentioned in another comment, this is supposed to be dealt with in Perl 6?).
Re:Removing the % $ and @ (Score:2)
My first impression on learning Perl was wondering why the heck Larry hadn't bothered to learn how to use lex, yacc, and maintain a proper symbol table. Then, of course, I realized Larry does know all that and had reasons of his own. But I still disagree with them.
When I learned PHP, I thought it was wonderful to A) only have one generic variable 'sigil', and B) to have real multidimensional arrays that didn't require Perl's horrid reference syntax. (I know they're not really multidimensional arrays behind the curtain in either language, but that's beside the point.)
For the record, I think Perl is a much more powerful language than PHP, but that PHP makes building web interfaces (usually to Perl and C backends in my case) than mod_perl or (God help me) Mason.
In the end, I still wish Larry would reconsider the type sigils on the grounds that they violated the TMTOWTDI principle and force the programmer into what may be, for any given developer or development team, a suboptimal notational system. It's as if Microsoft's Hungarian Notation were enforced by the compiler. Thanks, but if I need to include type information in my variable names, I'll put it there myself.
Re:Removing the % $ and @ (Score:1)
sigil Pronunciation Key (sjl, sgl)
n.
1. A seal; a signet.
2. A sign or an image considered magical.
darn linguists
Re:Removing the % $ and @ (Score:2)
This is why good coding styles arise.
And no, I'm not talking about Hungarian Notation.
I'm talking about variable names that are meaningful and method names that are meaningful. Some people take pride in Obfuscating their code. Me, I take pride in knowing that I can come back to a set of code a year later and still know what it does either by documentation (rarely) or good coding style and good variable names (less rarely