You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Even worse: What is ResizeArray<float> in F#, is actually float during runtime -- which means functions of ResizeArray will fail at runtime or produce unexpected results:
call (fun args -> printfn "Length=%i" args.Count)// Length=0
call (fun args ->for arg in args do printfn "* %f" arg)// Uncaught TypeError: xs[Symbol.iterator] is not a function
-> only first argument -> iterating over characters of first string
Probably even more confusing with ...args: any[] instead of a fixed type.
I'm not sure what the correct code would be.
... in TS/JS is [<ParamArray>] in F# -- but Attributes aren't allowed here.
Currently the best option is probably to create an overload for each expected call by hand. But for that one must know with how many arguments the function gets called. (And it isn't auto-generated)
The text was updated successfully, but these errors were encountered:
A function with a variable number of arguments, passed as argument to another function, gets converted into a function with just a single argument:
gets converted to
I think the idea is for
ResizeArray
to contain all passed arguments. But it's actually just the first argument:(Fable repl)
Output:
Even worse: What is
ResizeArray<float>
in F#, is actuallyfloat
during runtime -- which means functions ofResizeArray
will fail at runtime or produce unexpected results:(Fable repl)
Especially confusing when
args
is a type compatible to array during runtime likestring
:(Fable repl)
Output:
-> only first argument -> iterating over characters of first string
Probably even more confusing with
...args: any[]
instead of a fixed type.I'm not sure what the correct code would be.
...
in TS/JS is[<ParamArray>]
in F# -- but Attributes aren't allowed here.Currently the best option is probably to create an overload for each expected call by hand. But for that one must know with how many arguments the function gets called. (And it isn't auto-generated)
The text was updated successfully, but these errors were encountered: