Re: [RFC] Scalar Type Hints v0.2

From: Date: Thu, 05 Feb 2015 00:02:48 +0000
Subject: Re: [RFC] Scalar Type Hints v0.2
References: 1  Groups: php.internals 
Request: Send a blank email to internals+get-81847@lists.php.net to get a copy of this message
Le 14/01/2015 01:16, Andrea Faulds a écrit :
Good evening, I’ve made some quite significant changes to my Scalar T ype Hints RFC, and bumped its version to 0.2. Here: https://wiki.php.net/rfc/scalar_type_hints This is a new thread because I’ve made a significant revision to the RFC, so it’d be sensible to separate discussion of the updated RFC from the v0.1 RFC. Please tell me your thoughts. Thanks!
Hi Andrea, I am probably going to ask a stupid question, but do we really need the =1 part in declare? declare(strict_types=1) couldn't be declare(strict_types)? Or does it mean that there would be cases when strict typing would be deactivated after being activated with declare(strict_types=0)? To be honest, I don't like declare() because it looks like a function call, not a setting for the file like a namespace declaration would be. Also, in the case of declare(ticks=1), 1 is not a boolean but an interval so I find it a bit confusing that strict_types=1 would be a boolean in that case. Or maybe declare(strict_types=true) then? Personnally I would prefer a syntax like: declare strict; which is just shorter and more readable in my opinion. I know it is mostly cosmetic but I don't really understand why declare uses parenthesis if it is a language construct and not a function (and yes, I think that declare(ticks=1) also looks silly ;) ); So basically instead of that at the top of my files: <?php namespace Foo; use Bar; declare(strict_types=1); I would prefer having that: <?php namespace Foo; use Bar; declare strict; It's probably a detail in the whole discussion, but for some weird psychological reason, it matters to me :), Cheers, Pascal

« previous php.internals (#81847) next »