"Implicit" Attribute for generic parameters #1103
Replies: 4 comments
-
I think implicit generic parameters are being prototyped in the concepts fork. |
Beta Was this translation helpful? Give feedback.
-
@orthoxerox Sadly only for concept parameters. Having it work for normal type parameters would be a logical extension and make the concepts version feel more orthogonal and less weird, but I genuinely don’t know how much would this be useful outside of concepts as I haven’t looked into it. |
Beta Was this translation helpful? Give feedback.
-
@agocke is investigating extending type inference to take constraints into account. |
Beta Was this translation helpful? Give feedback.
-
What is the scope of this feature? would we be able to consider other improvements for type inference? for instance: #92, #877, #281, etc |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
-
Here is the lightbulb! no new syntax, no breaking change. no compiler option.
introduce "Implicit" attribute for generic parameters so that compiler will automatically infer generic type arguments when method is called.
this will let compiler know that we intend to infer
T
implicitly. because its already some where hidden in input! (in this caseIList<T>
) so as an example, following call becomes validThis special attribute must also cause compile time error if marked generic parameter is not found anywhere in input, for example
Beta Was this translation helpful? Give feedback.
All reactions