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
So I created a record type for a simple 2d vector:
type Vector =
{
x : double;
y : double;
}
static member FromPolar r theta = {x = r * cos(theta); y = r * sin(theta)}
member x.Length = x.x*x.x+x.y*x.y |> sqrt
member x.Scale l =
let mylen = x.Length
let scale = l / mylen
{x=x.x*scale;y=x.y*scale}
When this is in the same file as where it is used, everything is fine.
I then copied the same code into a separate file to tidy up the code.
At this point I got lots of errors like this:
WebSharper error FS9001: Unrecognized member of F# record type:
This could be fixed by adding [<JavaScript>] annotations to the members, but the error message should really be improved for this case
The text was updated successfully, but these errors were encountered:
F# record, union and exception types are treated specially by WebSharper, because the F# compiler itself generates extra members (not visible from F#, but they are from C# also some TPs might call them), so an extra code path handles translating their members after standard class member lookup fails.
But I do agree that some error handling standardization would be nice, for example falling back to the standard "Method name not found in JavaScript compilation" error here.
So I created a record type for a simple 2d vector:
When this is in the same file as where it is used, everything is fine.
I then copied the same code into a separate file to tidy up the code.
At this point I got lots of errors like this:
This could be fixed by adding
[<JavaScript>]
annotations to the members, but the error message should really be improved for this caseThe text was updated successfully, but these errors were encountered: