Open MangelMaxime opened 2 weeks ago
We probably also want to checks how it behaves with inheritance. TypeScript allows inheritance for class
at minimal, not sure about interface
.
So we need to check what happens with the method extensions or if we need to re-declare them on the inheriting
type.
Did some testing and F# 9 allows extension methods with the same name as the underlying object's property. Both can be random
instead of random & Random
This is an idea to avoid having to use
Invoke
from the user POV, I am not sure if this path we want to take or not.Context
When converting
FunctionType
we generates adelegate
in order to keep the named arguments, but this means the user needs toInvoke
the delegate as they can't be called like a normalmember
in F#.Proposition
An idea was proposed to create a
member
as an alias to the delegate to offer the standard F# member call API:Impact
But this solution has 2 impacts:
It means we need to change the casing of the added member (
random
->Ramdom
) in order to access it. We can't really suffix the low level member because we need it for the setter too.Here the example above works as is, but sometimes type are defined in nested modules. In this case, the extension method would not be visible until the user
open
the correct modulesThis can be workaround by adding a new
Extensions
module decorated with[<AutoOpen>]
.Note: Make sure to check #143 for all the ideas