-
-
Notifications
You must be signed in to change notification settings - Fork 1k
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
[Feature Request] default value from function (or closure) #1453
Comments
I thought it's already possible to generate a value from a function and use it as default value for an argument:
The problem is:
|
Another problem of |
Does anybody really need this? I doubt this calculations can ever be complex. |
@CreepySkeleton The calculations could be non-complex, but they may involve some remote resource fetching or file reading, which you would prefer to avoid. |
I think this can be done with the hook feature that was described in #1634 (comment). Do you guys agree? |
Yes, indeed. Closing in favor of #1634 (comment) |
It would be great if I can make default values from functions, not literals.
For example, if I want to get some options from args, but if not exists, I want to fallback to environment variables, and if not exists either, I want to panic. Like this:
If this is possible, I can make the 'environment variable part' lazily evaluated!
The text was updated successfully, but these errors were encountered: