note 48467 deleted from language.variables by nlopess
| From: | nlopess@php.net | Date: | Fri, 24 Dec 2004 20:31:55 +0000 |
| Subject: | note 48467 deleted from language.variables by nlopess | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-82269@lists.php.net to get a copy of this message | ||
Note Submitter: me at example dot com
----
The above poster who suggested that php has a bug because it doesn't let one have a scalar and
an array exist with the same name is on drugs.
In what language can you ever do this? Who, in their right mind would EVER want to have two
different variables with the same name. That's absolutely terrible style. If you must have
the same name for the two variables because you just can't possibly think of a different name
to use, then try how about you name them my_var_scalar and my_var_array.
For future notice, a feature of a language is not a bug just because you don't like it.
It's a bug if it violates the spec of the language. This particular feature is not only not a
bug, it's also very important in a language like PHP that uses type inference.
If you think this is a bug, I chalenge you to write a language that relies on type inference and
allows the programmer to have a different variable with the same name for each type.
Good Luck