Re: [PHP-DEV] [PHP-DEV [RFC] Property Accessors v1.2 : Typehints / Accessor Syntax

2012-10-17 Thread Stas Malyshev
Hi! It is foolish to think that these two bits of code are behaviorally different: class Entity { DateTime $last_modified; } The are different because this one looks like a strongly typed variable which brings with it a lot of connotations which aren't immediately obvious, and in fact

Re: [PHP-DEV] [PHP-DEV [RFC] Property Accessors v1.2 : Typehints / Accessor Syntax

2012-10-17 Thread Nikita Popov
On Tue, Oct 16, 2012 at 11:58 AM, Stas Malyshev smalys...@sugarcrm.com wrote: 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

Re: [PHP-DEV] [PHP-DEV [RFC] Property Accessors v1.2 : Typehints / Accessor Syntax

2012-10-17 Thread Nikita Popov
On Mon, Oct 15, 2012 at 2:11 PM, Clint Priest cpri...@zerocue.com wrote: So the above would actually introduce an get/set accessor rather than a property, correct? Preferably it would a faster C based implementation for the check, but in principle it could also use accessors to achieve the goal.

Re: [PHP-DEV] [PHP-DEV [RFC] Property Accessors v1.2 : Typehints / Accessor Syntax

2012-10-17 Thread Nikita Popov
On Tue, Oct 16, 2012 at 12:55 PM, Stas Malyshev smalys...@sugarcrm.com wrote: Last thing: I agree with Clint and you. If it was early checked, it would be better. But the current type hinting is far better than nothing at all. Yes, we can't lint it, but it was pretty useful a big number No,

Re: [PHP-DEV] [PHP-DEV [RFC] Property Accessors v1.2 : Typehints / Accessor Syntax

2012-10-17 Thread Stas Malyshev
Hi! I see this argument crop up with every typehint discussion and just don't understand it at all. Why would you want to check the variable type everywhere? You just assign it and if it doesn't work, then you get an error. Just like it should be. I mean, do you seriously check No, you don't

Re: [PHP-DEV] [PHP-DEV [RFC] Property Accessors v1.2 : Typehints / Accessor Syntax

2012-10-17 Thread Nikita Popov
On Wed, Oct 17, 2012 at 1:07 PM, Stas Malyshev smalys...@sugarcrm.com wrote: I see this argument crop up with every typehint discussion and just don't understand it at all. Why would you want to check the variable type everywhere? You just assign it and if it doesn't work, then you get an

Re: [PHP-DEV] [PHP-DEV [RFC] Property Accessors v1.2 : Typehints / Accessor Syntax

2012-10-17 Thread Amaury Bouchard
2012/10/17 Stas Malyshev smalys...@sugarcrm.com No, you don't get an error. You'd get an error in compiled language. In dynamic language, your client gets an error when his site is launched and instead of happy launch his users get white screens. To avoid that, you'd need to add checks - or

Re: [PHP-DEV] [PHP-DEV [RFC] Property Accessors v1.2 : Typehints / Accessor Syntax

2012-10-16 Thread Stas Malyshev
Hi! public DateTime $date; This is *real* progress, even if under the hood all it does is wrap I think it's a movement in wrong direction. Again, it is an attempt to make PHP a strongly typed language, which would not work well in a dynamic language like PHP, for reasons that were amply

Re: [PHP-DEV] [PHP-DEV [RFC] Property Accessors v1.2 : Typehints / Accessor Syntax

2012-10-16 Thread Amaury Bouchard
2012/10/16 Stas Malyshev smalys...@sugarcrm.com public DateTime $date; This is *real* progress, even if under the hood all it does is wrap I think it's a movement in wrong direction. Again, it is an attempt to make PHP a strongly typed language, which would not work well in a dynamic

Re: [PHP-DEV] [PHP-DEV [RFC] Property Accessors v1.2 : Typehints / Accessor Syntax

2012-10-16 Thread Stas Malyshev
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

Re: [PHP-DEV] [PHP-DEV [RFC] Property Accessors v1.2 : Typehints / Accessor Syntax

2012-10-16 Thread Stas Malyshev
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

RE: [PHP-DEV] [PHP-DEV [RFC] Property Accessors v1.2 : Typehints / Accessor Syntax

2012-10-16 Thread Clint Priest
[mailto:smalys...@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@gmail.com) Subject: Re: [PHP-DEV] [PHP-DEV [RFC] Property Accessors v1.2 : Typehints / Accessor Syntax Hi

Re: [PHP-DEV] [PHP-DEV [RFC] Property Accessors v1.2 : Typehints / Accessor Syntax

2012-10-16 Thread Amaury Bouchard
2012/10/16 Stas Malyshev smalys...@sugarcrm.com 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 Doing the same for

Re: [PHP-DEV] [PHP-DEV [RFC] Property Accessors v1.2 : Typehints / Accessor Syntax

2012-10-16 Thread Stas Malyshev
Hi! If the first could be useful, the second could be useful too. Or you are saying that parameters type hinting was a bad idea? Given how it is understood now - as a first step to make PHP a strongly typed language - yes, I'm starting to think it was. If it was understood as it was intended -

Re: [PHP-DEV] [PHP-DEV [RFC] Property Accessors v1.2 : Typehints / Accessor Syntax

2012-10-16 Thread Rasmus Lerdorf
On 10/16/2012 02:51 AM, Amaury Bouchard wrote: 2012/10/16 Stas Malyshev smalys...@sugarcrm.com public DateTime $date; This is *real* progress, even if under the hood all it does is wrap I think it's a movement in wrong direction. Again, it is an attempt to make PHP a strongly typed

Re: [PHP-DEV] [PHP-DEV [RFC] Property Accessors v1.2 : Typehints / Accessor Syntax

2012-10-16 Thread Amaury Bouchard
2012/10/16 Rasmus Lerdorf ras...@lerdorf.com The rule in PHP for any sort of type hinting is that it is only done for non-coercable types. In cases where there is simply no way to recover from passing the wrong type, it is good to catch it as early as possible. Extending this to also cover

Re: [PHP-DEV] [PHP-DEV [RFC] Property Accessors v1.2 : Typehints / Accessor Syntax

2012-10-16 Thread Levi Morrison
On Tue, Oct 16, 2012 at 10:31 AM, Amaury Bouchard ama...@amaury.net wrote: 2012/10/16 Rasmus Lerdorf ras...@lerdorf.com The rule in PHP for any sort of type hinting is that it is only done for non-coercable types. In cases where there is simply no way to recover from passing the wrong type,

Re: [PHP-DEV] [PHP-DEV [RFC] Property Accessors v1.2 : Typehints / Accessor Syntax

2012-10-15 Thread Levi Morrison
public DateTime $date; This is *real* progress, even if under the hood all it does is wrap functions and use function type-hints. This piece of code is SO much shorter and cleaner. Will it be a bit confusing to new developers? Maybe, but I don't care. It is not aimed at making the lives of new