On Wed, February 29, 2012 7:16 pm, John Crenshaw wrote:
> I'm beginning to think that the type hinting question is too closely
> related to the dirty secrets of type juggling to resolve them
> separately. You may have to either discard consistency, or else fix
> the problem of silent bizarre conversions at the same time ('foo'==0,
> '123abc'=123). Fixing the conversions is a BC break though.

[short version]
One man's "fixing" is another man's "feature" :-)

Old hands can now hit delete while I wax philosophical.

[long version]

PHP does the type juggling because HTTP data is all string. It's a
feature, because PHP's main purpose was to process HTTP input.
[Yes, I know you did not dispute this. It's just foreshadowing...]

Once one accepts the premise that automatic type-juggling is "good",
the idea that (int) "123 abc" turns into 123 may seem incredibly
"wrong" or "right" depending on how useful one has found it.

I have found it useful, and others have as well, to the point that we
don't consider it something to "fix" but a "feature"

Obviously, others disagree.  And that's okay. We "get" that some
disagree, and even why some disagree. We've all coded in C, C++, C#,
Forth, Modula 2, Lisp, PL/1, and many more, collectively.

We choose PHP, at times, because it is the way it is, as "broken" as
it may seem to others. And they are legion. One only needs to review
blogs and mailing lists of fans of other strictly-typed languages to
see this.

But Breaking Compatibility with something so deeply ingrained in the
culture and language, which goes back consistently at least to PHP3,
and probably PHP/FI, is a non-starter.

There are probably literally millions of scripts that will break "out
there." That's simply unacceptable, and I trust you understand why
that is so.

You might consider those scripts poor programming practice. We all do.
But PHP is the language of the unwashed masses, and that was, and is,
part of why it is hugely popular. Somebody who barely understands
programming can pound away at the keyboard and write a bloody useful
web application, breaking 10,000 Computer Science rules along the way.

It's duct tape and bailing wire. And we love it for that.

If the app is useful enough, it might even get cleaned up.  Or just
more duct tape and bailing wire is applied, more likely. :-)

Even at a major release, PHP has, by and large, strived to remain
Backwards Compatible, unless a VERY compelling reason was presented.

A vocal minority, or even a majority, of developers does not qualify.
That's pretty much why the Core Devs' "veto" power exists.

Some of the proposals and ideas lately have adhered to that concept of
not breaking Backwards Compatibility. Others have not, and those are
just non-starters.

But PHP core has always had the mantra "Keep It Simple, Stupid"

If one wants a complex language, PHP is simply not going to be it, and
virtually all of these proposals do not fit the KISS principle, at a
fundamental level of "Any idiot can read halfway decent code and
puzzle out what it does in less than a day."

This is a Religious Issue, a personal preference, a philosophical
ideal, etc. Right or wrong, it is what it is, by choice, by the core
developers who have put years worth of effort into it.

Please don't read this as "go away" or a restatement of the arguments
that have been labeled as circular before.  I am merely trying to
explain why PHP is the way it is, at a 10,000 foot level, and why so
many core devs are resistant to the changes being proposed.

I highly respect all the efforts and the alternative philosophical
differences, and even the guiding principles of Computer Science
driving them. PHP is just not the language for Computer Science types,
for the most part. It's for the masses.

Some CS types like it in certain situations, which is all to the good,
or it would be a total mess :-) We embrace its "flaws" and ugly hacks
because, like it or not, "it works" for what it's designed to do.

-- 
brain cancer update:
http://richardlynch.blogspot.com/search/label/brain%20tumor
Donate:
https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=FS9NLTNEEKWBE



-- 
PHP Internals - PHP Runtime Development Mailing List
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to