Re: Array Symbol Suggestion
| From: | Joshua Kehn | Date: | Wed, 12 Jan 2011 20:28:03 +0000 |
| Subject: | Re: Array Symbol Suggestion | ||
| References: | 1 2 3 4 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-310710@lists.php.net to get a copy of this message | ||
On Jan 12, 2011, at 3:23 PM, sono-io@fannullone.us wrote:
> Thanks for all the responses to my suggestion. I realize this would be a major change, so
> that's why I also mentioned it as an addition to the language.
>
> I'm sure it's just what you're used to, but still being new to all this, it just
> makes sense (to me anyway) to have different symbols for different variable types:
> $scalar
> @array
> #hash
>
> Since the @ sign is already reserved, maybe there's another symbol that would work better?
> I don't know. These are just ideas that I came up with while reading and I thought I'd
> throw it out there to see what others thought.
>
> I like the idea of a naming convention, so that's what I'll do in my scripts. I also
> appreciate the heads up on is_string(), is_array(), and var_dump().
>
> Thanks again,
> Marc
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
This would make sense to me for a compiled or strongly typed language, but no other language (that
I've know of) uses this format. I haven't used Perl.
In a dynamically typed language you normally have duck typed variables.
# Python
a = "Hello"
b = 12
// JavaScript
a = "Hello";
b = 12;
c = [1, 2, 3];
// PHP
$a = "Hello";
$b = 12;
$c = array(1, 2, 3);
Unless I'm misunderstanding the question?
Regards,
-Josh
____________________________________
Joshua Kehn | Josh.Kehn@gmail.com
http://joshuakehn.com