Re: [RFC] Scalar Type Hinting With Casts (re-opening)

From: Date: Tue, 15 Jul 2014 17:39:09 +0000
Subject: Re: [RFC] Scalar Type Hinting With Casts (re-opening)
References: 1 2 3 4 5 6  Groups: php.internals 
Request: Send a blank email to internals+get-75555@lists.php.net to get a copy of this message
Ford, Mike wrote (on 15/07/2014):
Oh, goodness, deary me -- this sounded so familiar I just had to do some delving and hey presto! I refer you to:http://marc.info/?l=php-internals&m=124655821522388 (...which, interestingly, even predates Zeev's 2010 claim, and I believe may have taken inspiration from yet earlier suggestions back around 2006!!)
Ooh, skimming that, I see suggestions for prefixes and suffixes to represent types of cast (or hint). That fits nicely with my thoughts on making "strict cast" a first-class citizen of the language, rather than isolating it to function signatures, e.g.: $foo = 'abc'; $foo = (int)$foo; // OK, evaluates to int(0) $foo = 'abc'; $foo = (int!)$foo; // ERROR $foo = '42'; $foo = (int!)$foo; // OK, evaluates to int(42)

« previous php.internals (#75555) next »