Re: Re: Flexible type hinting

From: Date: Thu, 02 Jul 2009 14:25:39 +0000
Subject: Re: Re: Flexible type hinting
References: 1 2 3 4 5 6  Groups: php.internals 
Request: Send a blank email to internals+get-44656@lists.php.net to get a copy of this message
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. > To me, strict as default doesn't seem appropriate in php. But if it does, this syntax > could be interesting: > > function($quantity) > function(int $quantity)  STRICT type > function(~int $quantity) paul's (S) casting This is also a nice, internally-consistent syntax. If you had something for (H) in your suggestions, I'd be happier. We need to cast there too. Thanks, Paul -- Paul Biggar paul.biggar@gmail.com

« previous php.internals (#44656) next »