Closed humhei closed 5 years ago
Just read sourcecodes... Seems this is a breaking change which is hard to implement
Hello @humhei, this is actually a duplicate of Hard to use APIs due to lack of parameter names.
Let me break down why I didn't implement this and why I think it is not a good idea
The technical difficulty is primarily due to the fact that interfaces are erased at compile time on the client side of things because interfaces are used for interop in Fable. This makes it impossible for Remoting.Client
to build a proxy without reflection metadata
Having two ways of doing the same thing, i.e. defining protocols where records already work really well. I don't want people to think too much of whether they use an interface or a record.
Simply use a record for all inputs or use single case unions for names parameters:
type EvalParams = { code: string; input: string }
type IServer =
{ eval : EvalParams -> Async<string>
test : unit -> Async<unit> }
Use single case unions:
type Code = Code of string
type Input = Input of string
type IServer =
{ eval : Code * Input -> Async<string>
test : unit -> Async<unit> }
// build proxy
let server = (* . . . *)
// use proxy
server.eval (Code "() => 5", Input "()")
Hope this helps
Thanks. Good workaround for me Get it 😄
Why? IMO named parameters is important when communicate between server and client
In my use case: ExcelDna can read named parameters functions from interface