_From @gusty on November 5, 2015 12:47_
By adding a few attributes we add the possibility to use some methods from C# and F#.
However in order to use them:
Another issue is than when the containing namespace is opened you see many methods, some of them will not work in C# but it displays everything. I think that's really annoying but an alternative is to remove the extension attribute of the generic methods.
Perhaps extension methods belong to a different project, F# extension methods are already being defined in F#+ so for C# we can create a C#+ project and put them there, adapting the function arguments, there will be a lot of boilerplate code in that project but to the outside world will be clean.
_Copied from original issue: gmpl/FsControl#55_
Extensions method didn't prove to be useful, at least to me.
In any case if this library will be used or eventually merged with FSharpPlus, there will be extensions in the individual modules (Seq, List, etc).
Here are some thoughts:
- From F# the method should not have dummy arguments, though this is not a technical limitation, they can be used but add lot of noise.
Now with F# 4.1 optional arguments are recognized, so this is no longer an issue.
Another issue is than when the containing namespace is opened you see many methods, some of them will not work in C# but it displays everything. I think that's really annoying but an alternative is to remove the extension attribute of the generic methods.
It might be worth removing the extension attribute from the generic (static constrained) methods, since in any case they don't type check. I think the rule should be that extension methods should not be statically constrained. This will also address the first sentence of the following issue:
- From C# the method should not be generic. Also there is a problem if the method accepts an f# function, it will be tedious to use it.
Regarding the usability in C# in presence of F# FastFuncs instead of Delegates, there's nothing we can do here but we can suggest and expect that in a near future a new version of C# will interoperate with F# FastFuncs nicely.
Most helpful comment
Here are some thoughts:
Now with F# 4.1 optional arguments are recognized, so this is no longer an issue.
It might be worth removing the extension attribute from the generic (static constrained) methods, since in any case they don't type check. I think the rule should be that extension methods should not be statically constrained. This will also address the first sentence of the following issue:
Regarding the usability in C# in presence of F# FastFuncs instead of Delegates, there's nothing we can do here but we can suggest and expect that in a near future a new version of C# will interoperate with F# FastFuncs nicely.