Silent Types
| From: | Fwentish Aelondes | Date: | Wed, 04 Sep 2019 03:52:03 +0000 |
| Subject: | Silent Types | ||
| Groups: | php.internals | ||
| Request: | Send a blank email to internals+get-106840@lists.php.net to get a copy of this message | ||
Hello internals,
Zeev's idea to bring peace to the galaxy seems like a good idea, but
impossible to implement in practice.
But it got me thinking about how one might introduce static typing
into a dynamically typed language w/out breaking BC.
And then I had this crazy idea:
//int
$i = 0;
//string
$c = 'c';
//float
$pi = 3.14;
If static typing in php was *only* an opt-in kind-of-thing, would this
work? Could the parser be built to identify 3 or 4 different keywords
in comments and give warnings or fatal errors for type conversions of
variables that have the type specified in the immediately preceding
comment?
Just a (crazy) idea.
---- Fwentish