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

Allow default nil values for optional properties #480

Merged
merged 4 commits into from Aug 31, 2022

Commits on Aug 30, 2022

  1. Allow default nil values for optional properties

    This adds underscored initializers that let library users add `= nil` to
    declarations of optional `@Option` and `@Argument` properties. Previously,
    default values have been available for properties of non-optional types
    only.
    
    These new initializers use `_OptionalNilComparisonType` as the wrapped
    value parameter, so only a `nil` literal is acceptable in the default
    value position. This avoids the problem of declaring an optional property
    with a non-`nil` default, which ends up negating the purpose of an optional.
    natecook1000 committed Aug 30, 2022
    Copy the full SHA
    efbd18d View commit details
    Browse the repository at this point in the history
  2. Copy the full SHA
    7425be3 View commit details
    Browse the repository at this point in the history
  3. Update docs to include = nil examples

    These are sprinkled in where they seem natural, to illustrate how
    types can be initialized.
    natecook1000 committed Aug 30, 2022
    Copy the full SHA
    37b8889 View commit details
    Browse the repository at this point in the history
  4. Copy the full SHA
    ffc1c21 View commit details
    Browse the repository at this point in the history