From: Adam Richardson [mailto:simples...@gmail.com]

On Tue, Feb 28, 2012 at 2:53 PM, John Crenshaw 
<johncrens...@priacta.com<mailto:johncrens...@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.)

Where is the term "strict typing" coming from? I've not seen this used to 
describe any type system (doesn't mean it's not been used, but I'd really like 
to see the usage so I can understand the label.)

Adam, When you say you want "Strict" or "Strong" typing, this (case 1) is what 
the opponents of stronger typing think you are asking for, which is why I've 
defined it this way. There have been a tiny handful of individuals that really 
are asking for this, but most people don't really want this level of 
strictness. Also, this level of strictness is fundamentally at odds with the 
nature of PHP, and it's just never going to happen. The level of typing in this 
first case is littered with problems. I won't get into it all, but you can read 
prior discussions in the archives to see it. Look for the passionate arguments 
made by typing opponents that talk about "massive changes", "destroying the 
language", and "Go use JSP". Scattered in there are some occasional 
explanations of the actual core issues, all of which refer to this level of 
typing. (Incidentally, even C++ is not this strict, so this really isn't what 
you want, I'm sure of it. If this is what you want, then this isn't the thread 
for you, because this is *not* what will be advocated or discussed here.)

- "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.)

Doesn't weak typing mean that the language implicitly converts types for use 
according to a set of rules? The opposite of this being strong typing, which 
means the language does not perform implicit conversions.

"Weak" here really means weaker than the "Strong" above, but stronger than 
"none". Right now PHP has no typing whatsoever. "weak typing" WOULD be typing, 
but it is flexible, optional, and aggressively uses implicit conversions. For 
comparison, by these definitions C++ is halfway between "weak typing" and 
"strong typing" (by virtue of operator overloads, overloaded functions, and 
cast operators.)

This "Weak typing" will give you what you want, and it can work. Most 
importantly, it is *not* the thing that goes bump in the night for most strong 
typing opponents, which means it is probably possible to gather sufficient 
support for this. This discussion is focused on developing a rock solid 
proposal for "weak typing".

- "No Scalar Typing" should be used to indicate the current system (where there 
is no provision for hinting at scalar types.)

And, curious about the "No Scalar Typing"?

This is PHP right now. The language has no provision whatsoever for scalar 
types. Function parameters can be hinted as an array or as a specific 
class/interface, but otherwise they are assumed to be absolutely anything. I 
know that for people with a lot of experience in a strongly typed language this 
sounds like what they would normally call "Weak Typing", but it's a 3rd level. 
"Weak Typing" under these definitions is a lot stronger than what you would 
call "weak", but it's much weaker than what strong typing opponents would call 
"strong".

It's going to take some time to get used to the semantics, but if you want any 
typing enhancements you're going to have to speak the language of the people 
you want to convince. The communication disconnect here has been sinking this 
proposal for a decade.

John Crenshaw
Priacta, Inc.

Reply via email to