1. We aimed for maximum readability. The block syntax delimited with
bracket `{` ... `}` pairs is definitely easier to keep track in
comparison with a colon and semicolon `:`...`;`

2. A block delimited by a double colon and a semicolon `:`  `;` is NOT
yet part of any structure from the PHP. Introducing a brand new element
on the syntax, when bracket delimited blocks `{` ... `}` are already a
pervasive structure on the language, seems unnecessary, specially
considering the previous analysis on loss of readability.

Almost all the most used control structures have an alternative way of being delimited with a colon/semicolon blocking:

http://php.net/manual/en/control-structures.alternative-syntax.php

The difference is that what I proposed did not have an end-token, like endforeach, endwhile, etc.

I think what you mean though is that the alternative syntax is not pervasive in _declaration_ structures, which is true.


3. This idea also implies a distinct syntax for namespace fragments:
"PhpParser\Node\Stmt:" while least effort approach, that offers the
least cognitive effort to the user land, is to simply have namespace
fragments with a trailing "\" as in "PhpParser\Node\Stmt\".

4. The paired brakets `{` ... `}` proposal stays on the comfort zone
from users already used to C-syntax language family. Introducing a colon
and semicolon to delimit a list in PHP would be new bits. I'd prefer to
build such a feature upon conservation of current PHP style.

These are the my thoughts around your suggestion in comparison with the
proposed syntax on the RFC. Perhaps you have something else to add? :)

The cognitive switch is going to have different impacts on different people. While a nit-pick, I see \{ as an escape sequence (yes, I know this was an argument with namespaces, but at least those always follow with a letter) and causes a slight deficiency in readability for me, but I realize it has been proposed to not have a \ at the end of the used name.

-ralph

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

Reply via email to