RE: [PHP-DEV] Re: Flexible type hinting

From: Date: Thu, 02 Jul 2009 14:17:31 +0000
Subject: RE: [PHP-DEV] Re: Flexible type hinting
References: 1 2 3 4 5  Groups: php.internals 
Request: Send a blank email to internals+get-44655@lists.php.net to get a copy of this message
On Thu Jul 2 08:53 AM, Paul Biggar wrote: > On Thu, Jul 2, 2009 at 1:43 PM, Ilia Alshanetsky<ilia@ilia.ws> wrote: > > > > On 2-Jul-09, at 4:45 AM, Paul Biggar wrote: > >> I think you might not have read what I suggested (it is different > >> than the one I emailed to you privately). What you want is fully > supported. > >> If you must be passed an int, use the +int hint. > > > > I'd rather use -int, then +int and make people who want loose typing > > do the extra bit, because native typing should be strict. > > I think everyone wants their favourite to be default. I was eager to > have the typing that's currently in the manual be the default, since > that's what people are used to seeing. I suggested that strong type > checks use +int exactly because that's different to what's in the > manual, so there would be no confusion. > > I'm really looking to get people to agree to the principle that we > would like to be able to hint every signature without large changes to > the manual, since we've been looking at it for years. > 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? function($quantity) function(int $quantity) paul's (S) casting function(int! $quantity) STRICT type --- seems appropriate for php, follows CSS/web style '!important' 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 Btw, really interesting discussions

« previous php.internals (#44655) next »