Thanks for the report! I have created GH issue: https://github.com/intellifactory/websharper/issues/753

The problem seems to stand only if the static let is a pure value (no side effect) and not used. Fix coming soon. Workarounds: use the HIGH value or remove it.

By on 9/1/2017 1:37 AM ()

It seems a little more troubling than that: This produces the same error:

1
2
3
4
5
    type AlertLevel() = // zzz zafir beta10 has a problem with "static let"
        static let DefaultMsg() = "mooo"
        member __.SayWhat() = DefaultMsg()

    let Alerter = new AlertLevel()

Also, there were other variations that produced "interesting" code. This:

1
2
3
4
5
    type AlertLevel() = // zzz zafir beta10 has a problem with "static let"
        static let HIGH = "moooh"
        static let LOW = "meh"
        static let DefaultMsg() = "mooo"+HIGH+LOW
        member __.SayWhat() = DefaultMsg()

Produces a $cctor() that appears to be (among other issues) infinitely recursive...

1
2
3
4
5
6
7
8
 AlertLevel.$cctor=Runtime.Cctor(function()
 {
  AlertLevel.$cctor();
  AlertLevel.HIGH="moooh";
  AlertLevel.$cctor();
  AlertLevel.LOW="meh";
  AlertLevel.$cctor=Global.ignore;
 });
By on 9/1/2017 1:20 PM ()

Thanks, this does not really cause a runtime problem, and is not actually recursive because of the Runtime.Cctor creates a unique guard around it. But it is sure not optimal, extra calls should be dropped. Created a ticket: https://github.com/intellifactory/websharper/issues/755

By on 9/4/2017 1:07 AM ()
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