Thanks!

By on 4/17/2015 1:04 PM ()

Actually this is an old issue that comes from a deficit in the F# compiler. Modules have static constructors don't have their reflected definition included in the assembly even when the ReflectedDefinition (or JavaScript alias) is present on the module.

There is a hack in WebSharper to initialize let bindings (module fields), but execution order is not guaranteed between let bindings not calling each other.

We will fix this documentation (switch do to let someName =) and prepare a new documentation page about semantic differences between .NET and WebSharper translation.

Also we will look into if latest F# 3.1 or 4.0 compiler have addressed this issue since, so that WebSharper could translate it properly now.

By on 4/17/2015 11:40 AM ()

That bit of the documentation is too eager (happy to expand on that later), so instead of module-level do blocks please use top-level value bindings. So instead of

1
2
3
let Main () = ...

do Main () |> fun res -> res.AppendTo "entrypoint"

use

1
let Main = ....
By on 4/17/2015 11:26 AM ()

Fixed this part of the documentation by adding another alternate form:

1
let _ = Main () |> fun res -> res.AppendTo "entrypoint"
By on 4/22/2015 2:49 PM ()
IntelliFactory Offices Copyright (c) 2011-2012 IntelliFactory. All rights reserved.
Home | Products | Consulting | Trainings | Blogs | Jobs | Contact Us | Terms of Use | Privacy Policy | Cookie Policy
Built with WebSharper