RE: [PHP-DEV] [PHP-DEV [RFC] Property Accessors v1.2 : Typehints / Accessor Syntax
| From: | Clint Priest | Date: | Tue, 16 Oct 2012 10:37:34 +0000 |
| Subject: | RE: [PHP-DEV] [PHP-DEV [RFC] Property Accessors v1.2 : Typehints / Accessor Syntax | ||
| References: | 1 2 3 4 5 | Groups: | php.internals |
| Request: | Send a blank email to internals+get-63449@lists.php.net to get a copy of this message | ||
I would have to agree with Stas, the type hints that are presently implemented are failed code
waiting to be found. Good luck if you're not monitoring your error logs. I can agree with the
concept of wanting to avoid having to do all kinds of simple verification of input parameters but
thankfully type hinting is optional.
I think if it had been done differently, at least when possible, such that errors occurring during
compile time and thus could be -linted it would have been much more useful, re: the concept of fail
early.
-Clint
> -----Original Message-----
> From: Stas Malyshev [mailto:smalyshev@sugarcrm.com]
> Sent: Tuesday, October 16, 2012 4:58 AM
> To: Amaury Bouchard
> Cc: Levi Morrison; Clint Priest; internals@lists.php.net; Nikita Popov (nikita.ppv@gmail.com)
> Subject: Re: [PHP-DEV] [PHP-DEV [RFC] Property Accessors v1.2 : Typehints / Accessor Syntax
>
> Hi!
>
> > Not necessarily strongly typed. (sorry to land on this topic
> > afterwards) As I see PHP, it's a language that can be used as an
> > informal scripting language, but also as a rock-solid modern tool.
>
> I have no idea what "rock-solid modern tool" means, though PHP is trivially a modern
> tool by being a tool and existing right now ;)
>
> > Type hinting in parameters is a really good thing, and it doesn't
> > transformed PHP in a strongly typed language.
>
> It however gave a permission to people to try sneak in strong-typedness through various
> backdoors arguing exactly that: "but we
> have strong typing for parameters, why not for other things?" I think it is not the right
> approach. Also, the fact is that other dynamic
> languages do not have strong typing. It may be they just aren't smart enough to recognize
> everybody needs it - or there may be a
> reason why it doesn't happen. I think there is a reason, which again was outlined some
> 9000 times here on the list.
>
> > Doing the same for object properties (always optional) could be very useful.
>
> Not really, since PHP is not a compiled language and as such does not have static type
> controls. Now not only every foo($bar) can
> blow up but also every $foo->bar = $baz. Not very useful.
> --
> Stanislav Malyshev, Software Architect
> SugarCRM: http://www.sugarcrm.com/
> (408)454-6900 ext. 227