-
Notifications
You must be signed in to change notification settings - Fork 33
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
`self' undefined inside functions, except if used in the calling SLiMEidosBlock scope #60
Comments
Ah, you have found a little quirk of the scoping policy. First of all, user-defined functions are an Eidos thing, not a SLiM thing, so they are not officially So, yes, a bug. I'm not sure what exactly I would want to do to fix it; the Eidos/SLiM scoping rules are all a little bit ad hoc and really I'd like to eventually fix them to be more coherent. In any case, although this is technically a bug I don't imagine it is really getting in your way, is it? Is this causing any difficulties for you? If you need it fixed I can figure out a fix, but otherwise I'll probably just ignore this issue until such time as I revisit the scoping rules in SLiM 4.0 or whatever. :-> |
Thanks @bhaller. Yes, you should absolutely close this as "won't fix". Out of curiosity though, are there other global variables with the same behaviour? |
All callback pseudo-parameters, I think. They're listed in chapter 24. I'll keep the issue open for now; there is a bug here, and it's a good reminder to think more about scoping some day. |
The above code produces this error with SLiM 3.3:
But strangely, when the
//self;
line is uncommented, the code runs fine. I could understand ifself
were never available in the function scope, or if it were always available there, but being dependent on usage in the script block scope seems wrong.The text was updated successfully, but these errors were encountered: