No, not currently - indeed as of 1.9.2 types may not have static data at all, though modules can. This does create a few minor niggles, and we expect to address it sooner or later.

The code as you've written it also leads to a warning about "the type x has escaped its scope" because x_current is inferred to have type "x", a forward reference. You can work around this as follows:

1
2
3
4
5
6
7
8
9
10
 

[<System.ThreadStatic>]
let mutable x_current = None

type X() as n =
    do  x_current <- Some (box<X>(n))
    static member current = unbox<X>(x_current.Value)

regards

don

By on 7/31/2007 7:45 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