Hi,
I’m posting this in a new thread since people might (reasonably) be ignoring
further responses to the [VOTE] thread.
I’m considering a small change to the Scalar Type Hints RFC, specifically about
syntax. Quite a few people have said they don’t like the declare() syntax, and
it’s easy to see why. It’s rather verbose, it has all the quirks of declare()
(such as block syntax, not respecting scope), and it’s rather ugly.
Instead, I’m wondering if the following might be better:
<?php strict
Which would be used like so:
<?php strict
function foobar(): int {
return 1.0; // error!
}
It’d be a per-file directive, so there’d be zero mixing of modes within one
file, and you’d avoid the quirks of declare().
It’s also a lot shorter, and it resembles Hack’s syntax:
<?hh // strict
Of course, changing this would mean restarting the vote, but it’s only been
three days, we’re less than a quarter of the way through voting.
Thoughts? Thanks!
(By the way, I’d appreciate it if this thread didn’t turn into yet another
discussion of how and whether scalar type hints are a bad/good idea. We already
have at least four threads on that subject. I’m just considering a specific
change of syntax.)
--
Andrea Faulds
http://ajf.me/
--
PHP Internals - PHP Runtime Development Mailing List
To unsubscribe, visit: http://www.php.net/unsub.php