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

Add constraint to extension methods #1

Open
propensive opened this issue Dec 20, 2023 · 1 comment
Open

Add constraint to extension methods #1

propensive opened this issue Dec 20, 2023 · 1 comment
Assignees
Labels
code quality Concerns the standard of code rather than functionality core Describes core required functionality question Looking for an answer

Comments

@propensive
Copy link
Owner

The extension method might benefit from a signature like,

extension[V, W](value: V)(using V <:< Optional[W], Unset.type <:< V)

in order to prevent it being applied to values which are not optional.

@propensive propensive self-assigned this Dec 20, 2023
@propensive propensive added question Looking for an answer code quality Concerns the standard of code rather than functionality core Describes core required functionality labels Dec 20, 2023
@propensive
Copy link
Owner Author

A better type constraint may be NotGiven[Unset.type <:< V].

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
code quality Concerns the standard of code rather than functionality core Describes core required functionality question Looking for an answer
Projects
Status: Todo
Development

No branches or pull requests

1 participant