Hi Patrick,

 

We already plan a similar mechanism by raising an E_DEPRECATED on conversions 
that would have succeded in PHP 5 and will fail using the proposed new ‘PHP 7’ 
ZPP ruleset.

 

Then, it is technically possible to raise a notice on non-strict conversion but 
it must be discussed in depth because it can be very confusing, as E_NOTICE or, 
even, E_STRICT, are typically associated with ‘bad practice’, and that’s not 
the case here. So, a lot of people would assume these as something ‘clean’ code 
should avoid. Maybe another error type could be needed, but I don’t see the 
need as so important.

 

Regards

 

François

 

De : Patrick ALLAERT [mailto:patrickalla...@php.net] 
Envoyé : jeudi 19 février 2015 11:07
À : franc...@php.net; Sara Golemon
Cc : PHP internals
Objet : Re: [PHP-DEV] Scalar Type Hints v0.4

 

Le Thu Feb 19 2015 at 00:38:25, François Laupretre <franc...@php.net> a écrit :

> Why can't strictness follow that path?

Because strictness is not the overall objective the PHP language is aiming to.

 

I cannot agree more with that.

 

If it was the case, your mechanism would be fine, but deprecating ZPP 
conversion would be simpler and fine too.

 

I'm not so sure about the "simpler".

 

This is definitely not the same case as generating a notice on array to string.

 

Sure, I just wanted to pinpoint that "because strictness is not the overall 
objective of the PHP language", we may consider a weak approach accompanied by 
an activable (configurable?) mechanism that would notices us of bad types, bad 
coercion, conversion with loss,...

 

That's what I hate in this 'weak' vs 'strict' terminology. It makes implicit 
that 'strict' is the natural future and improvement of 'weak'. That's 
absolutely not the case as 'weak' mode is not as negative as name suggests, and 
'strict' is not so positive either. So, you may stop considering that the 
natural path for 'weak'-typed software is to migrate to strict types.

 

I never implied something like this, quite the opposite since I feel I am 
completely aligned with you! 

 

When we decide encouraging migrating to strict mode with a deprecation on ZPP 
conversion, I hope I'll be far away...

 

+1

 

> PS: your feedback makes me feel it would be; even more; a viable option :)

Fine. But may I remind you the so-called great benefit you underlined in your 
post is totally wrong and shows total ignorance of the difference between 
casting and ZPP conversion rules which, IMO, is a fundamental pre-requisite 
before laughing at people working on this.

 

I never laughed at any one here. Sorry if someone felt that way by the simple 
use of a smiley.

Reply via email to