-
Notifications
You must be signed in to change notification settings - Fork 212
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
dir()
for current environment?
#479
Comments
Currently, you can't. There is an open proposal at bazelbuild/starlark#218 to support a predeclared What problem are you trying to solve? |
@adonovan For the scenarios that ships with REPL mode as playground for newcomer. e.g. use Starlark as script language but also with preset variables and functions, so a robust REPL with helper methods like |
It's easy enough to implement, though it's much harder to specify, and the behavior it exhibits in CPython requires a particular implementation strategy to represent the environment (happily, the same one used by the Go and Java implementations, but that's just luck). The question is: what exactly counts as in scope? For example, in Python, this call to dir returns
It seems like more of an expedient feature of a REPL than a serious feature one would ever use in a program. In any case, proposals to change the language should go through bazelbuild/starlark. |
@adonovan easy enough to implement? So will you add it? It's okay to access it on the first level only, and ignore nested defs |
I think you missed the point of the paragraph in which I used those words. We don't add features until we've agreed on their specification, and the specification for this function is not trivial. |
In Python,
dir()
without args can list all available funcs and vars in current environment, like this:So how I can do this with Starlark?
The text was updated successfully, but these errors were encountered: