Re:What I Like About PHP
by chc on Tuesday December 09, 2014 @08:12PM
(#8727055)
Remarking on the fact that variables are local by default makes me wonder exactly how many programming languages you're familiar with. That's an extremely low bar, not really something to love.
[ Parent
| on HN ]
Low bar or not, if you do anything web-facing, there is no way around javascript. And you will do a lot of stuff in a language that makes variables global by default.
A car metaphor for this conversation:
"I love my skoda! It has four wheels, and a roof, and a passenger seat!"
"That's a pretty low bar for things to love about a car. Pretty much all other cars also have those features, and they do them better."
"Yeah, well I also ride a bicycle, and my bicycle doesn't have those features."
Re:What I Like About PHP
by arenaninja on Tuesday December 09, 2014 @08:19PM
(#8727101)
Conversely, there's a long list of languages where variables would not be local by default
Insofar as there is a ridiculously long list of languages nobody has ever heard of, I guess this is true. But it's not true if you're comparing it to languages that are actually used in modern programming. Even if you're considering languages as obscure as, say, Standard ML, you'll still not find many that have a default global scope for variables inside functions. There's pretty much JavaScript, Perl, Fortran and Cobol. I can't think of any others that are even worth mentioning nowadays.