-
Notifications
You must be signed in to change notification settings - Fork 7.8k
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
RFC: Anonymous Class Lexical Scope #1874
Conversation
|
||
EG(scope) = Z_OBJCE_P(object); | ||
|
||
val_ptr = Z_OBJ_HT_P(object)->get_property_ptr_ptr(object, &name, type, NULL); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm pretty sure that this can never return anything other than a valid container now, since properties are always declared.
Hello, how about the comments from former PR #1871? Have you considered those suggestions? |
The technical issues have been mostly addressed, the patch is still pending final review, so may have missed something nikita said.
I have considered it, since there is already a way for you to change the default private visibility to something else, that part of the idea isn't necessary. I'm not totally convinced of the utility of being able to change the properties name, I can't think of a scenario where it would be required; You should normally write use() before you write the class, I would suppose.
use($this) is missing, but it's also missing from anonymous functions. I tend to think that it may be better to leave this alone for now, come up with a solution that is acceptable for anonymous functions and try to use as close to the same syntax/rules as possible for anonymous classes. Another possible solution is that it may not be necessary to give $this another name, it may be possible to bind the anonymous class to it's super class and just use($this), so that $this in the anonymous class and it's super class are the the same. Another possible solution is the ability to rebind an anonymous class at runtime, just as closures are able to be rebound. The use of $this doesn't feel like a problem we ought to try and [only] solve here. Edit: I quite like the idea of use($this as $thing) for both anonymous classes and functions, I may attempt to do that for both and RFC it, although it's too late for 7.1 now. |
Comment on behalf of kalle at php.net: Closing due to no activity, please re-open if you still intend on working on it |
That was awesome (info) mark and write down (done) |
RFC
Rewritten patch, so that it actually makes some sense.