On Sun, Feb 8, 2015 at 3:38 AM, Rasmus Lerdorf <ras...@lerdorf.com> wrote:

> On 02/07/2015 05:03 PM, Pavel KouĊ™il wrote:
> > I'm wishing more and more that the RFC doesn't pass (even though I'd
> > LOVE to have typehints in PHP as a userland developer) and someone
> > else will make a better version of typehints RFC for  PHP 7, because
> > this one feels really like you took an ok-ish RFC (one that would be
> > good for PHP) and slapped a strict typing on it without enough
> > research about strong typing in other languages. And as I said myself
> > multiple times in the past, the declare syntax IS just ugly (and
> > changing how code works by writing one line is an ugly principle as
> > well, IMHO). :(
>
> I am not sure I would go that far. Andrea did plenty of research and has
> tons of experience in other languages, I just think this approach is
> misguided. I also wonder just how many people of those who voted even
> bothered to download and try the patch. I tried it a while back on some
> existing code and it was a nightmare. Does everyone realize that these
> simple things break?
>
>  tan(1);
>  echo strstr("test", "est", 1);
>

Seems like a case where one mans bug is another mans feature. While
int->float conversions are debatable (and the answer may not be obvious if
you consider bigints) I would definitely want the latter call to error.
Seeing strstr("test", "est", 1) I would obviously assume that 1 is an
offset parameter, like it is the case with many other str* family
functions. strstr("test", "est", true) is a lot more obvious and I'll be
happy if PHP yells at me if I'm sacrificing three keystrokes for a lot of
readability.


> Basically declare() does not respect function scope, but it doesn't let
> you know that. There is a reason we haven't used declare() for anything
> real.
>

This sounds like a bug more than anything else. It can be easily fixed.

Nikita

Reply via email to