-
Notifications
You must be signed in to change notification settings - Fork 7.9k
[RFC] Add support for dynamic variable names in function scope #1927
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
Is there an RFC coming for this? I don't think this can go through as a "bug fix"... If we're going to support this here, there's a bunch of other places that currently only support simple variables, in particular |
Well, I believe we can expose our arguments better in a RFC. However, I'll need to get karma for that. I've mailed internals mail list last year and got no answer. Could you check it, please? |
Do you have a link to your mail handy? |
Do you mean my e-mail? marcelocamargo@linuxmail.org. My user on |
You mentioned that you mailed internals last year for RFC karma, but I couldn't find the mail. In any case I can't give out karma anyway, maybe @Tyrael can look into it? |
No update on this yet? |
/pings @Tyrael again 😄 |
@haskellcamargo It seems your request got lost in the pipelines (this happened to my first attempt). How about asking for RFC karma again on internals? Or try the IRC channel, it's faster there. |
Sadly, no reponse yet, i'd love to see at least some feedback on this one. |
I sent a ping on list http://news.php.net/php.internals/98604 In the mean time, how about a gist based RFC? It'll get the conversation started. |
heh. I don't know what happened to all the wiki admins. |
@haskellcamargo Are you still interested in this feature? If so, please start the RFC process (I can confirm that the Wiki user haskellcamargo has RFC karma). |
@haskellcamargo ping! |
Since there has been no progress for quite some time, I'm closing this PR. Please re-open, if an RFC is available. |
This pull-requests adds the support for dynamic variable names using strings on the scope of functions without the necessity of using
global
.This would fail with a syntactic error before:
The name
${'+'}
wouldn't be be accessible without declaring it using theglobal
keyword or using an alias.The support for dynamic items has been added only for literal strings
T_CONSTANT_ENCAPSED_STRING
because we would have to evaluate the expression and then import the name without having a direct reference to the variable for variable variables, such asuse ($$test)
. Well, I'll try to open a RFC to solve this a posteriori. I'm also planning to open a RFC to support aliases in functionuse
, such asfunction () use (${'+'} as $plus) {}
in order to preserve scope.I have also implemented support for references to these variables: