Hi, Ralph 2015-02-14 12:43 GMT-03:00 Ralph Schindler <ra...@ralphschindler.com>:
> > 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. > > Ralph, you are right about point 2. I should have been more specific. BTW, I still think it's weird not to have an end token on your suggestion. It makes sense on it's own, but taking PHP as context the proposed syntax on the RFC has more advantages. > 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. Yes, there is a voting option for not having a trailing "\". FYI, if you care enough to read the changelog, the very first draft used the no trailing "\" variant of the syntax. Turns out that many people pointed that there is already a design convention to use a trailing namespace separator before the glob braces on other languages. For instance, Rust language: import a::b::{c, d, e, f} Thanks, Márcio Almada -ralph > > -- > PHP Internals - PHP Runtime Development Mailing List > To unsubscribe, visit: http://www.php.net/unsub.php > >