Re: Scalar type hinting

From: Date: Tue, 28 Feb 2012 20:00:24 +0000
Subject: Re: Scalar type hinting
References: 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16  Groups: php.internals 
Request: Send a blank email to internals+get-58268@lists.php.net to get a copy of this message
Thank you. Now I'm going to go work up a detailed RFC for what I posted earlier with some additional clarification as to when errors should and shouldn't be thrown. On Tue, Feb 28, 2012 at 2:53 PM, John Crenshaw <johncrenshaw@priacta.com> wrote: > OK everyone, it seems that some people have forgotten or missed the original agreement that > this thread started with. There is a communication disconnect ("strict typing" means > horribly different things to different people right now). Please read through and understand the > following terminology before continuing to post on this thread. We've agreed to the following > terms: > > - "Strict Typing" means the super strict old C style typing *with no implicit > conversions*. (If you really think this is what you want, you are probably mistaken. Look through > prior discussions on this topic. This fails for numerous reasons, including the fact that almost > every input to PHP is a string.) > - "Weak Typing" means types in the same sense that the PHP documentation uses types > (for example, the docs indicate substr(string, integer), and substr(12345, "2") == > "345".) (If you think you want "strict typing", this is probably what you mean.) > - "No Scalar Typing" should be used to indicate the current system (where there is no > provision for hinting at scalar types.) > > In addition, if someone potentially new expresses support for "Strict Typing", please > assume that they really mean weak typing unless proven otherwise (this is by far the more likely > intent.) Don't get mean, politely clarify terminology so that everyone can be on the same page. > If someone still insists that they want "Strict Typing" (as defined above), point them to > the prior discussions on the topic which explain exactly what the problems with this are. > > John Crenshaw > Priacta, Inc.

« previous php.internals (#58268) next »