Whats wrong with the $ sign? |
Tell us another coding language that uses something like this... |
Okay, Tell me a REAL (no scripting) programing language that uses something like this |
Marcus – what's wrong with it is that it's annoying to type (Shift + 4 on my keyboard), especially as you type it so often. Other languages write interpreters/ compilers that don't need it, so it's just redundant! |
From http://www.zend.com/zend/week/week171.php?article=week171&kind=wc&id=4195&open=1&anc=0&view=1
Michael Hawley suggested removing the dollar sign for variables in PHP. “The language would be less cumbersome”, he stated. He, however, saw that a “some string $foo bar” situation would require a dollar sign indeed. Andrei Zmievski noted that the decision for the dollar sign was made around nine years ago and that Michael was a little too late to bring this up. Also, an ambiguity with define()d constants would arise (Ken Tossell).
A little discussion about the various ways to output variables inside strings arose and several people expressed their favourite way of doing things. Their arguments include performance reasons. With Sterling’s note on compiler caches fixing this problem, another useless thread died. Welcome to another week of PHP development. |
To your example Java: System.out.print(“some string " + foo + " bar”);
ASP/VB: “some string " & foo & " bar”
JavaScript (I know, it is scripting): var myString = “some string " + foo + " bar”;
For Philipp: Change to swiss keyboard layout. the $ is an own key right to [ä] [$] [ENTER]
|
They could still allow "somethig $something" for strings (but just for strings). And for downwards compatibility, they could simply allow developers to include a setting on top of programs, something like silly_dollar_off(); |