> -----Ursprüngliche Nachricht-----
> Von: Rowan Collins [mailto:rowan.coll...@gmail.com]
> Gesendet: Mittwoch, 17. September 2014 18:01
> An: internals@lists.php.net
> Betreff: Re: AW: [PHP-DEV] Renaming type-hints to something else?
> 
> Robert Stoll wrote (on 16/09/2014):
> > I would argue "type declaration" is wrong as well since it is not a
> > type declaration as it is known in other languages where the type
> > declaration is binding. IMO it is more a "type check". Consider the
> > following
> >
> > function foo(Bar $b){
> >    $b = 1; //$b is not a Bar at all
> > }
> 
> I tend to think of them as "type assertions", since this:
> 
> function foo(Bar $b){
>      // do stuff
> }
> 
> is kind of equivalent to this:
> 
> function foo($b){
>      assert($b instanceOf Bar);
>      // do stuff
> }
> 
> i.e. it's a runtime-enforced check
> 

I would prefer "type assertions" over "type check". Yet, I agree that changing 
the naming might cause more confusion
than it is helpful. Nevertheless, if we think the naming will cause harm in the 
future then we should consider to slowly
change it. Make "type hint" somewhat deprecated and change it in the doc but 
leave a notice. Something like "type
assertion (in older days called type hint)". And at some point we can remove 
the notices.


--
PHP Internals - PHP Runtime Development Mailing List
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to