Hi,

Going to Strict tying it's really a major paradign shift.

To clarify my talk, When I say "strict typing", I'm talking about strict
scalar check, variable definition or return type check.
I'm ok with weak scalar type hinting.


We have type hinting, yes, but it's a kind of syntaxtic sugar for :
if(! arg1 instanceof MyClass){
      throw new exception("How are you using my work ?!!");
}
Any check we make slow our execution time.
Before type hinting exists, we performed manualy this check, and it was
verbose and slower than same check done by PHP native code.


PHP is a script language. No compilation pass.
In all cases, because someone made a bad use of a function, it will break
at execution time.
So type hinting and strict typing will not make our code safer or faster.

We don't have to be ashamed of using a script language.
Thanks to this, we can do metaprogramming.
for instance, __call() allow us to do really awesome things
If we look at other script languages, Python, Ruby, Perl or Javascript
doesn't have srtict typing nor type hinting.

I love static languages.
I write code in C, C++, Java, As3 and C#.
They have good performance, stric typing, static checks at compilation time.
But it's a different technology, and their philosophy is allowed only
because there's a compilation phase.

That's why when facebook, with HHVM, tryied to make a faster PHP, it can
only work with a subset of what is realy PHP.
For this reason, it's really really difficult to make javascript a fast
language (v8 and sipermonkey are very complex).
For the same reason, now Adobe decide to give up with the dynamic part of
ActionScript (wich was limited compared to PHP) to speed up their VM.

So I think going to scrict typing only make sense if we want a static
language, with compilation phase and performances gains due.
But it would be more than a major compatibility.
A lot of things will be not only be broken, but will be impossible.

Finally, it would be a so big engine change that it would be better to
restart the engine from scratch.
And if we start from scratch without backward compatibility, is this still
PHP ?

And is there a language which already works as expected? Java ?

Just my 0.02$

-- 
Samuel DEAL
samuel.d...@gmail.com

Reply via email to