On Sat, February 25, 2012 7:58 pm, Kris Craig wrote:
> On Sat, Feb 25, 2012 at 4:54 PM, Stas Malyshev
> <smalys...@sugarcrm.com>wrote:
>
>> Hi!
>>
>>
>>  I'm well aware that this has been discussed before, Stas.  However,
>>> you're mischaracterizing those previous conversations.  It has
>>> never
>>> been proven that optional strict typing doesn't work.  You've made
>>> the
>>> same arguments against it, but those arguments have
>>> counter-arguments
>>> that are also viable.
>>>
>>
>> I'm not sure what you mean by "proven". You expect rigorous
>> mathematical
>> proof? You're not getting one. If you have something new to say with
>> regard
>> to the arguments that were brought up 10 times already - ok, go
>> ahead. But
>> please read them first.
>
>
> Another logical fallacy.  Cognitive dissonance.  Either there is
> "rigorous
> mathematical proof" or a statement is completely unproven (and/or
> cannot be
> proven).

Are you going to completely dismiss statistical probability somewhere
in the middle of the two?

People a whole lot smarter than I, and, forgive me, but *some* of them
probably smarter than you, have tried this again and again and again.

They all failed.

They failed exactly for the reasons Stas pointed out:

You can't change just one thing.

The changes have repercussions, and in this particular instance, those
repercussions dig into the heart and soul of PHP, to the point where
you would, quite literally, have to change PHP *INTO* JSP or similar.

> In fact, you haven't proven your point by any standard, rigorous or
> otherwise.  There is no basis for suggesting that it cannot be done.
>  You've clearly stated that you don't think it *should* be done, but
> you
> haven't viably demonstrated that it *can't* be done, or that it would
> "break" PHP as we know it.

The problem is probably NP-incomplete, though I have no proof for even
that statement, other than my "gut" telling me it is so.

I certainly have not the time nor inclination to "prove" the
completeness or lack thereof for adding static typing to PHP.

Perhaps a trained mathematician (like me) who has kept his skills up
(unlike me) would take a "go" at it. :-)

>>  people keep asking for it.  It keeps coming up because, despite
>>> belittling and dismissive comments made by yourself and a few
>>> others,
>>> people continue to see that there is, in fact, a valid argument for
>>> implementing this.  It shows that you have never been able to
>>> convince
>>> those who don't already agree with you that this is impossible.
>>>
>>
>> Or it's coming up because people don't bother to read past
>> discussions and
>> think they are first who thought "let's put strict typing in PHP"
>> and only
>> reason why it's not there because nobody was smart enough to think
>> about
>> it. It's not so. It was repeatedly discussed and rediscussed. If you
>> have
>> new argument - fine, we'd all be happy to hear it. So far I didn't
>> hear one
>> though. Please let us hear it.
>
>
> No, it's coming up because people have read these past discussions and
> still think it's a reasonable goal that deserves further
> consideration.

In the abstract ideal, it's quite reasonable.

The devil is in the details. It can't be done, without completely
re-writing PHP into something akin to a different language.

This conclusion has been reached multiple times, with multiple
proposals and attempts, including a lot of patches, some that went
very far down the path before they failed, and were abandoned.

> On the
> contrary, it looks to me more like it either fizzled or was punted
> each
> time, but no consensus was ever reached.  Therefore, further
> discussion is
> warranted.  The fact that this was discussed previously does not make
> this
> topic any less legitimate.

They all fizzled or punted because the enormity of the problem space
turned out to be insurmountable.

This is not to say you CANNOT succeed: Only that every attempt before,
and they are legion, has failed.

>> It doesn't work that way. Language is a complex construct, with all
>> parts
>> influencing each other, thinking you can just add strict typing
>> somewhere
>> in the corner and nothing changes is a dangerous illusion. It would
>> not
>> work. If you type function arguments, you should also type all the
>> variables that could end up as the function arguments, all the
>> functions
>> returning into those arguments and all the operators and functions
>> that do
>> any transformations over those things. Otherwise it is guaranteed to
>> blow
>> up in runtime. After doing that, you've got yourself a strictly
>> typed
>> language. Absent compiler, though, such language would be quite hard
>> to
>> operate - how do you know your code correctly uses all the types
>> some
>> library wants? How do you know next version doesn't change any types
>> without you noticing? etc., etc.
>
>
> You're operating on a number of unfounded assumptions here (a "house
> of
> cards" if you will).  First, nobody is saying that this wouldn't be a
> significant undertaking at the core development level.  We all agree
> that
> it would be.  However, you're once again introducing cognitive
> dissonance
> into this.  The same logic you're using could be used to say that
> solid OO
> classes shouldn't be implemented because it would then render
> procedural
> scripting impossible.  After all, "all parts influence each other," as
> you
> put it.  However, everything didn't blow up when PHP 5 was released.
>  People can still write purely procedural code just like they did
> before.

That was actually a quite different set of circumstances altogether.

It was a very heated topic, but few people who actually hacked core
claimed it was "impossible."  They may not have liked the idea, nor
some of the decision along the way, but few claimed it was
"impossible"

Stas, who has probably hacked core almost as much as anybody, is
telling you that it's impossible.  You really should consider that
opinion.  (Mine, of course, carries zero weight. I still haven't
submitted the trivial patch Rasmus asked for ~15 years ago.)

You could create a whole new language, completely "independent" of
PHP, and merge it with the PHP language, and essentially have two
languages in one, and get what you want, I suppose...

They'd have to have totally separate and non-interchangeable
base-types, functions etc.

With a great deal of effort, you might even be able to add
type-juggling operators that could "auto-convert" between PHP and your
strict PHP, though I should think that would sort of defeat the
purpose of strict PHP to a large extent...

But to attempt to make variables / functions / parameters totally
strict, or even partially strict, simply implies changing core PHP to
the extent that you've re-written the whole language.

> Don't get me wrong; there are plenty of fine details that would need
> to be
> figured out.  But again, complexity != impossibility.  It can be done,
> and
> it can be done in a way that won't cause the world to come to an end.

Feel free to continue to try.

That would be the best way to prove your assertions, and show Stas wrong.

Or, you must admit, if he is right, you'd eventually find that out as
well.

For your first efforts, I'd suggest that examining the historical
record of previous attempts, and where they hit the brick wall, would
be good background research.

It's easy to START the race to add strict typing.  And it's moderately
difficult but do-able to make a lot of progress.  Nobody who has tried
has finished yet.  Ignoring past attempts with major patches that
simply failed would be... unwise. :-)

-- 
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