Hi Stas, It seems the actual problem is that we have too many compiler / code analysis experts in the community ;)
(don't get me wrong, I am not saying that for you, I just admire your patience explaining the same again and again to people who never read one line from PHP core source). Regards François > -----Message d'origine----- > De : Stanislav Malyshev [mailto:smalys...@gmail.com] > Envoyé : dimanche 22 février 2015 21:39 > À : Jefferson Gonzalez; Etienne Kneuss; Anthony Ferrara; Zeev Suraski > Cc : PHP internals > Objet : Re: [PHP-DEV] Coercive Scalar Type Hints RFC > > Hi! > > > A JIT or AOT machine code generator IMHO will never have a decent use of > > system resources without some sort of strong/strict typed rules, > > somebody explain if thats not the case. > > Yes, that's not the case, at least nobody ever showed that to be the > case. In general, as JS example (among many others) shows, it is > completely possible to have JIT without strict typing. In particular, > coercive typing provides as much information as strict typing about > variable type after passing the function boundary - the only difference > is what happens _at_ the boundary and how the engine behaves when the > types do not match, but I do not see where big performance difference > would come from - the only possibility for different behavior would be > if your app requires constant type juggling (checks are needed in strict > mode anyway, since variables are not typed) - but in this case in strict > mode you'd have to do manual type conversions, which aren't in any way > faster than engine type conversions. > So the case for JIT being somehow better with strict typing so far > remains a myth without any substantiation. > > > while on strict mode the generated code could be: > > > > int calc(int val1, int val2) { > > return val1 + val2; > > } > > No, it can't be (at least it can't be the _entire_ code of this > function), since the user still can pass non-int into this function - > nothing introducing strict typing in functions, as it is proposed now, > prevents it. What strict typing does is to ensure the error in this > case, but to generate the error you still need the checks! > BTW, your weak mode code is wrong too - there's no need to generate > Variants if you typed the variables as int. You know once coercion is > done they are ints. At least in the model that was now proposed. > > > If my example is right it means strict would be better to achieve good > > Unfortunately, your example is not right. > > > to another level of integration with PHP and performance. IMHO is harder > > and more resource hungry to implement a JIT/AOT using weak mode. With > > Please provide a substantiation for this opinion. So far what was > provided was not correct. > > > Thats all that comes to mind now, and while many people doesn't care for > > performance, IMHO a programming language mainly targeted for the web > > should have some caring on this department. > > Please do not strawman. A lot of people here care about performance, and > you have not yet made case that strict typing has any benefit on > performance, so implying that opponents of strict typing somehow don't > care about performance while you champion it does not match the real > situation. > -- > Stas Malyshev > smalys...@gmail.com > > -- > PHP Internals - PHP Runtime Development Mailing List > To unsubscribe, visit: http://www.php.net/unsub.php -- PHP Internals - PHP Runtime Development Mailing List To unsubscribe, visit: http://www.php.net/unsub.php