could PHP benefit from strict typing?
| From: | Rob | Date: | Mon, 16 Sep 2002 00:33:19 +0000 |
| Subject: | could PHP benefit from strict typing? | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-116480@lists.php.net to get a copy of this message | ||
i was just thinking the other day about loosely typed scripting languages, like PHP, and pondering
how much extra work the parser must go through to track, test and convert data types.
this is one of the key appeals of PHP, so i'm not suggesting PHP should be strictly typed,
i'd hate
that too. But if there were an optional method of using strict typing in cases where performance is
an issue, could it create a significant performance improvement?
i was thinking something along the lines of:
string $mystring = 'hello world';
int $myint = 5;
$myint = 70; // ok
$myint = 'blah blah'; // error
int $somevar = $myint + $mystring; // error
bool $mybool = 'some string'; // error
$thisvar = 'any type'; // regular, variant typed variable
it's quite possible i have no clue and this wouldnt help one bit, just a thought
-Rob