Re: Q on Primitives
| From: | Robin Burchell | Date: | Fri, 19 Dec 2008 14:50:40 +0000 |
| Subject: | Re: Q on Primitives | ||
| References: | 1 2 3 4 5 6 7 8 9 10 | Groups: | php.internals |
| Request: | Send a blank email to internals+get-42350@lists.php.net to get a copy of this message | ||
On Fri, Dec 19, 2008 at 2:40 PM, troels knak-nielsen <troelskn@gmail.com> wrote:
> PHP is loosely typed. Adding typehints to primitives would change
> this. The only reason that it is working with object types, is because
> you can't automatically coerce object types anyway.
>
> --
> troels
I'm not sure what you are getting at here, really: the suggested
functionality is optional, and a new addition mean that it indeed will
not have an effect on backwards compatibility. What was the purpose of
your mail?
I cannot furthermore see why providing the choice for people to
strong-type when it suits their purposes as well as allowing weak
typing when useful is such a bad thing. Indeed, I'd quite love for
this mixture :)
I agree that typing *can* be accomplished in other ways, e.g.
instanceof and various other hacks, but they are then not enforcing it
in a uniform and controlled manner as type hinting does, plus they are
less elegant than providing it as an optional first class language
feature.