Skip to content
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: Change type of Env.root to AmbientAuth #3557

Closed
Theodus opened this issue May 12, 2020 · 1 comment · Fixed by #3962
Closed

RFC: Change type of Env.root to AmbientAuth #3557

Theodus opened this issue May 12, 2020 · 1 comment · Fixed by #3962

Comments

@Theodus
Copy link
Contributor

Theodus commented May 12, 2020

Env.root currently has type (AmbientAuth | None) to allow for creation of artificial Env instances without AmbientAuth. Yet, there is no observable usage of this feature. As it is requires extra work to make use of, as one always needs a pattern match or an as expression with a surrounding try, this RFC wants to change its type to AmbientAuth and make AmbientAuth required when constructing an artificial Env instance, until a better solution is found.

https://github.com/ponylang/rfcs/blob/master/text/0065-env-root-not-optional.md

@dckc
Copy link
Contributor

dckc commented May 25, 2020

Yay! I have been hoping for this change since May 2016. #301 (comment)

Env and AmbientAuth are about static properties of the code; allowing the possibility that Env ever doesn't have AmbientAuth only results in useless checks to satisfy the type checker. AmbientAuth means "whatever ambient authority main() was called with". Attempts to use that authority may fail at runtime, of course. But to put into the type the possibility that there may be no such datum introduces only cost and no gain.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
3 participants