Hi,

Starting making the strict mode weaker is nonsense. It is not just Rasmus' 
example. Which exception do you authorize then ? Would you define a third 
'pseudo-strict' mode ? And about static analyzers, will they be 'pseudo-strict' 
too ?

No, if you want strict, it can only remain purely strict. I can understand the 
'strict' position, but not the desire to make it weaker. Do you understand 
that, starting from the purely-strict position, I can give you use cases which 
will cause you to define additional exceptions, until you get the same 
conversion rules as I am currently defining ! The only difference is that I 
don't claim it being 'strict'.

And 'numeric' is either a new ZPP type, or an alias for a future union type. 
Nothing to do with pure strict mode.

These are all hacks trying to solve specific use cases.

Regards

François

> -----Message d'origine-----
> De : Jordi Boggiano [mailto:j.boggi...@seld.be]
> Envoyé : mardi 17 février 2015 17:26
> À : internals@lists.php.net
> Objet : Re: [PHP-DEV] Reviving scalar type hints
> 
> On 17/02/2015 15:47, Anthony Ferrara wrote:
> > If we want to add a "numeric" type as a virtual union of int and
> > float, that's one way to solve the concern. If we don't, we could also
> > allow widening primitive conversion (int -> float). That wouldn't work
> > well with bigints, but would be fine in other cases. But there are
> > plenty of languages that always require explicit type conversion. So
> > even if we choose that, we're in good company.
> 
> As far as I understand, allowing int -> float would help fix a few of
> Rasmus' (or was it Benjamin?) concerns about things like sin() requiring
> floats in strict mode. It would make strict mode a lot more usable with
> C code as well. +1 on keeping the strictness benefits and remove some of
> the drawbacks.
> 
> Having numeric in addition might be nice mostly for return values I
> guess, but it seems a bit redundant to me if int -> float is allowed.
> 
> As for the straw poll, I also think declare() is the clearest syntax,
> especially if it's enforced to appear at most once and on top of the
> file to remove any potential misuses.
> 
> Cheers
> 
> --
> Jordi Boggiano
> @seldaek - http://nelm.io/jordi
> 
> --
> 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

Reply via email to