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 shorthand for generic type restrictions by non-generic interfaces #14477

Closed
Lanayx opened this issue Dec 16, 2022 · 1 comment
Closed

Add shorthand for generic type restrictions by non-generic interfaces #14477

Lanayx opened this issue Dec 16, 2022 · 1 comment

Comments

@Lanayx
Copy link
Contributor

Lanayx commented Dec 16, 2022

Is your feature request related to a problem? Please describe.

Since the F# 7 release there is a discrepancy between generic and non-generic restrictions, ie

allowed: env: 'T when ILogger<'T>
not allowed env: 'T when ILogger

Describe the solution you'd like

I propose to add support for non-generic case as well.

Describe alternatives you've considered

We can live with the old syntax env: 'T when 'T:> ILogger
Another possible syntax (covering multiple cases) could be env: #ILogger1 and #ILogger2

Additional context

This will allow to be more concise when dealing with a long list of restrictions, for example when implementing dependency injection based on the article https://bartoszsypytkowski.com/dealing-with-complex-dependency-injection-in-f/

@0101
Copy link
Contributor

0101 commented Mar 27, 2023

Please create a language suggestion.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Archived in project
Development

No branches or pull requests

2 participants