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




--
PHP Internals - PHP Runtime Development Mailing List
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to