Re: Re: Flexible type hinting
| From: | Lewis Wright | Date: | Thu, 02 Jul 2009 14:54:36 +0000 |
| Subject: | Re: Re: Flexible type hinting | ||
| References: | 1 2 3 4 5 6 7 | Groups: | php.internals |
| Request: | Send a blank email to internals+get-44659@lists.php.net to get a copy of this message | ||
2009/7/2 Paul Biggar <paul.biggar@gmail.com>
> On Thu, Jul 2, 2009 at 3:17 PM, Jonathan Bond-Caron<jbondc@openmv.com>
> wrote:
> > From userland, I'm a big fan of this proposal / agree to the principle
> although I'm not convinced that
> >
> > function($quantity)
> > function(int $quantity)
> > function(+int $quantity)
> > function(-int $quantity)
> >
> > looks appropriate...
> >
> > Userland Note: The "-int" semantics confuses me, I realize it would cast
> null's etc... but is it really a requirement? Can it be dropped?
>
> Yes, it looks off, doesnt it. I quite like ~int, which you suggested
> below, for the casting. It makes me think "this is kinda an int".
>
>
> > function($quantity)
> > function(int $quantity) paul's (S) casting
> > function(int! $quantity) STRICT type --- seems appropriate for php,
> follows CSS/web style '!important'
>
> Yes, I like that too.
>
But the exclamation mark has previous use in conditionals, so it may be
confused with "anything but an int"
Lewis.