-
-
Notifications
You must be signed in to change notification settings - Fork 36
Formatting: Don't remove unresolved options from the map passed to the function #545
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
Conversation
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.
This seems reasonable, but I had one comment.
@@ -217,8 +217,8 @@ the following steps are taken: | |||
bind the _identifier_ of the _option_ to the resolved value in the mapping. | |||
- Otherwise, bind the _identifier_ of the _option_ to an unresolved value in the mapping. | |||
(Note that an Unresolved Variable error will have been emitted.) | |||
4. Remove from the resolved mapping of _options_ any binding for which the value is an unresolved value. |
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.
This seems reasonable, but perhaps we should explicitly allow implementations to remove the value later (to prevent the local equivalent of NPE):
4. Remove from the resolved mapping of _options_ any binding for which the value is an unresolved value. | |
Implementations MAY later remove this value before calling the _function_. |
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 like this suggestion, thanks @aphillips.
I think delegating the decision about whether to remove or not to implementations is the right choice. In some implementations it's going to be natural to use a sentinel value to represent unresolved option values; other implementations may not have such possibility and they can instead choose to completely remove unresolved options from the map before it's passed to the function.
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 wasn't able to apply this suggestion via GitHub's UI. I pushed 006e60d instead.
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 not convinced that it's valuable to allow an implementation to see that an option was provided but has no associated value, especially because the "value" in such a case must be distinct from anything that can be specified. How do you anticipate the information being used?
In implementations that don't remove unresolved option values, custom functions may provide better error reporting experience by being able to differentiate between a missing option and an unresolved option. Consider a function which expected an option called
If |
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.
Works for me; thanks!
A follow-up to #524 (comment):
@stasm:
@eemeli:
Perhaps I'm missing something, but my reading of the current step 3 is that both errors would be emitted. I don't really see how step 4, which I remove in this PR, helps.