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

signature @dynamicMemberLookup #106

Closed
tanner0101 opened this issue Apr 25, 2019 · 0 comments · Fixed by #110
Closed

signature @dynamicMemberLookup #106

tanner0101 opened this issue Apr 25, 2019 · 0 comments · Fixed by #110
Assignees
Labels
enhancement New feature or request

Comments

@tanner0101
Copy link
Member

Now that SE-0252 has been accepted, we should try to adopt @dynamicMemberLookup in ConsoleKit:

let foo = try context.option(\.foo)
// could become
let foo = context.options.foo

Conformance to @dynamicMemberLookup should be fairly straightforward except for one issue: throwing. Since @dynamicMemberLookup will result in a subscript / computed-property for the given key path, we will not be able to throw. To remedy this, we can insert an "input validation" step before the command actually runs. In this step, we would ensure any supplied arguments / options have been converted to their desired types and store them. Then the member lookup could be done once the command runs without throwing. (Even if we don't decide to adopt @dynamicMemberLookup, this early validation step could be a nice addition)

This issue was closed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants