Hi,
After a period of research along with part of the PHP community I'd
like to present this RFC which aims to improve PHP namespaces.
The RFC: https://wiki.php.net/rfc/group_use_declarations
Along with its pull request: https://github.com/php/php-src/pull/1005
Needless to say, I'm open to suggestions that could improve the proposal.
Thanks!
Marcio Almada
https://github.com/marcioAlmada
Hi,
After a period of research along with part of the PHP community I'd
like to present this RFC which aims to improve PHP namespaces.The RFC: https://wiki.php.net/rfc/group_use_declarations
Along with its pull request: https://github.com/php/php-src/pull/1005Needless to say, I'm open to suggestions that could improve the proposal.
Thanks!
Feels a lot like Rust
http://doc.rust-lang.org/reference.html#use-declarations
I'm not opposed to the suggestion, we really should have a shorthand
for condensing use declarations, I just wonder if it could feel more
"PHP". Maybe I'm just nitpicking and it will grow on me :)
Hi, Leigh
Feels a lot like Rust
Yes, indeed Rust language is cited on the references section.
I'm not opposed to the suggestion, we really should have a shorthand
for condensing use declarations
That's good to know, During the research phase it became obvious that a
majority part of the user base would like to have a shorthand syntax for
use declarations.
I just wonder if it could feel more "PHP".
We tried other syntaxes and this one seemed the most appropriate because:
a) Looks a lot like the already implemented traits conflict resolution
b) Doesn't require to reserve new keywords
c) It requires a minimal implementation and is easy to read and parse
Maybe I'm just nitpicking and it will grow on me :)
FYI, suggestions for alternatives are still welcome. But I really hope you
end up liking the current proposal even more.
Thanks.
After a period of research along with part of the PHP community I'd
like to present this RFC which aims to improve PHP namespaces.The RFC: https://wiki.php.net/rfc/group_use_declarations
Along with its pull request: https://github.com/php/php-src/pull/1005Needless to say, I'm open to suggestions that could improve the proposal.
The RFC says:
"Group use statements makes it easier to identify that multiple imported
entities are from the same module."
IMHO that's too subjective. What "is hard" with the current state of
affairs?
Btw, here's a CON you can add to the RFC (and, btw., it doesn't contain
any):
- Prevents searching sources literally for used namespaces
Another observation thing from my side: with proper tooling I almost
can't remember when I wrote the statements by hand; they usually a) get
automatically managed b) thus alphabetically sorted and c) folded away
in general.
What is the real benefit of using groups it and who's the group
benefiting from that change? Maybe you can expand on that in the RFC.
sincerely,
- Markus
-----Ursprüngliche Nachricht-----
Von: Markus Fischer [mailto:markus@fischer.name]
Gesendet: Samstag, 31. Januar 2015 16:11
An: internals@lists.php.net
Betreff: Re: [PHP-DEV][RFC][DISCUSSION] Group Use DeclarationsAfter a period of research along with part of the PHP community I'd
like to present this RFC which aims to improve PHP namespaces.The RFC: https://wiki.php.net/rfc/group_use_declarations
Along with its pull request: https://github.com/php/php-src/pull/1005Needless to say, I'm open to suggestions that could improve the proposal.
The RFC says:
"Group use statements makes it easier to identify that multiple imported entities are from the same module."IMHO that's too subjective. What "is hard" with the current state of affairs?
Btw, here's a CON you can add to the RFC (and, btw., it doesn't contain
any):
- Prevents searching sources literally for used namespaces
Another observation thing from my side: with proper tooling I almost can't remember when I wrote the statements by
hand; they usually a) get automatically managed b) thus alphabetically sorted and c) folded away in general.What is the real benefit of using groups it and who's the group benefiting from that change? Maybe you can expand on
that in the RFC.sincerely,
- Markus
--
[Robert Stoll]
I agree with Markus, the benefits for users which are using IDEs is marginal. But I suppose all other users could actually benefit from it. Yet, with the drawback described by Markus - searching for use statements without a clever IDE will be more difficult. Anyway, thinking in terms of scripting it seems to be a nice feature. Therefore +1
Hi, Robert
I agree with Markus, the benefits for users which are using IDEs is
marginal. But I suppose all other users could actually benefit from it.
Yet, with the drawback described by Markus - searching for use statements
without a clever IDE will be more difficult.
No syntax will be perfect from all POVs, but it's still very handy to use
shorthands whenever they become advantageous. The RFC has a lot of examples
regarding this.
Anyway, thinking in terms of scripting it seems to be a nice feature.
Therefore +1
That's very good to know. Thanks you for your support.
Hi,
FYI, the RFC was simplified and updated with opinions gathered during
discussion phase:
RFC: https://wiki.php.net/rfc/group_use_declarations
Along with its pull request: https://github.com/php/php-src/pull/1005
I'll start the voting phase on Wednesday (February 11, 2015) if no new
points that could lead to changes on the RFC arise. So be sure to share
your opinion or suggestion, before that period, if you feel it's necessary.
Thanks,
Márcio Almada
https://github.com/marcioAlmada
Hi,
FYI, the RFC was simplified and updated with opinions gathered during
discussion phase:RFC: https://wiki.php.net/rfc/group_use_declarations
Along with its pull request: https://github.com/php/php-src/pull/1005I'll start the voting phase on Wednesday (February 11, 2015) if no new
points that could lead to changes on the RFC arise. So be sure to share
your opinion or suggestion, before that period, if you feel it's necessary.
Please create a new thread to be sure everyone sees it.
--
Pierre
@pierrejoye | http://www.libgd.org
Please create a new thread to be sure everyone sees it.
Oh, thanks for the warning. I also noticed that a good amount of people
replied to me without without CC the mailing list. Hope this won't be an
issue.
Regards.
Hi,
FYI, the RFC was simplified and updated with opinions gathered during
discussion phase:
RFC: https://wiki.php.net/rfc/group_use_declarations
Along with its pull request: https://github.com/php/php-src/pull/1005
I'll start the voting phase on Wednesday (February 11, 2015) if no new
points that could lead to changes on the RFC arise. So be sure to share
your opinion or suggestion, before that period, if you feel it's necessary.
PS: I noticed that a good amount of people replied to me without without CC
the mailing list, please remember to "replly all".
Thanks,
Márcio Almada
https://github.com/marcioAlmada
Hi, Markus
[...] with proper tooling I almost
can't remember when I wrote the statements by hand; they usually a) get
automatically managed b) thus alphabetically sorted and c) folded away
in general.
You're basically stating we don't need to improve language syntax because
your
IDE already handle the laborious parts for you. I invite you to think about
a big part
of the user base that would like to have a shorthand syntax and don't like
to have
namespaces "folded away" (hidden) by an IDE.
Anyway, the "proper tooling" you reffered would quickly be updated to handle
syntax additions and you won't loose anything with that. The point is that
not
all PHP user base should be obligated to use whatever ones define as
"proper tooling"
to have a pleasant experience with the language, this should come by design
:)
Other languages like Rust, Python, Scala, etc, have analogous features and
I'm sure
IDEs have good support for it. Same will/would happen to PHP.
The RFC says:
"Group use statements makes it easier to identify that multiple imported:
entities are from the same module."IMHO that's too subjective. What "is hard" with the current state of
affairs?
Readability is not that subject. Current syntax is obviously harder to read:
`use function foo\math\sin, foo\math\cos, foo\math\cosh, foo\math\tan,
foo\math\atan;`
When compared to the proposed:
`use function foo\math\{ sin, cos, cosh, tan, atan };`
Btw, here's a CON you can add to the RFC (and, btw., it doesn't contain
any):
- Prevents searching sources literally for used namespaces
What is the real benefit of using groups it and who's the group
benefiting from that change? Maybe you can expand on that in the RFC.
That's sounds reasonable to me, I'll soon update the RFC with your point
and expand the benefits part.
Thank you!