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

From: Date: Sun, 13 Jul 2014 15:12:06 +0000
Subject: Re: [RFC] Scalar Type Hinting With Casts (re-opening)
References: 1 2 3 4 5 6 7 8  Groups: php.internals 
Request: Send a blank email to internals+get-75413@lists.php.net to get a copy of this message

Le 13/07/2014 17:01, Andrea Faulds a écrit :
On 13 Jul 2014, at 15:59, Jocelyn Fournier <jocelyn.fournier@gmail.com> wrote:
From my point of view, if the type annotations are doing implicit cast (with or without E_NOTICE/E_STRICT warning), they should behave exactly the same than an explicit cast. If it behaves differently, I'll be really difficult for a developer to guess what will be the PHP behaviour with this new syntax.
Well, they do. The results of implicit scalar type hint casts are, so far as I know, the same as explicit casts, but some cases lead to errors which don’t in an explicit casts.
So they are not exactly the same :) If type annotations are used, they should either not do any cast at all (which is not the behaviour chosen so far), or do exactly the same than an explicit cast (same error message than explicit cast, etc...). I think a different approach would be misleading. Jocelyn

Thread (250 messages)

« previous php.internals (#75413) next »