You can't really do it, but you can workaround that limitation with code like the following:

1
2
3
4
5
6
7
8
9
10
11
12
#light

namespace NS

module Goo =
    let k = 42
    //let z = typeof<NS.Goo>  // does not work
    let z = System.Reflection.Assembly.GetExecutingAssembly().GetType("NS.Goo")

module Bar =
    printfn "%A" Goo.z

Make sense?

I am curious what you are up to that you want to get this typeof<>?

By on 2/11/2009 3:55 PM ()

We have a test framework, Pex, that supports targeted testing, i.e. you specify the type under test in an attribute:

1
2
3
4
[PexClass(typeof(Foo))]

class FooTest {...}

I am trying to express this in F#.

By on 2/11/2009 5:51 PM ()

I see, yes I don't think there is a way to do this; you can author a class instead of a module, or a class that 'wraps' the functionality of the module, as a workaround.

By on 2/11/2009 6:32 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