Hi, I'm not a big expert in this topic, but I think that the problem is following. I believe that there is some "minimal amount" of information about the type that you need to keep visible, which (in case of class "t") includes its base class. I would think that this is caused by the fact that .NET doesn't allow hiding the base class. This means that you'll need also add class "s" to the public interface and similarly, it is also required to publish all the "abstract" members of the class.

After adding these things, you get the following code, which works fine:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
 

module M : sig 
  type s = class 
    abstract callMe: unit -> int
  end
  type t = class inherit s end
end = struct
  type s = class
    new () = {}
    abstract callMe: unit -> int
  end
  type t = class
    inherit s
    new () = {}
    override x.callMe () = 0
  end
end

BTW: If you want to hide the base class (to keep the public interface simple) than I would suggest creating a "wrapper" wrapping the real "t" class as a field.

Hope this helps!
Tomas

By on 11/5/2007 7:18 AM ()

Thank you for the explanation.

It would be nice if I can find some documentation on what is

the "minimal amount" and the rational behind (perhaps compatibility

with .NET?). The only place I found is in the comparison with OCaml.

Best regards,

Keiko

By on 11/6/2007 12:27 AM ()

Quoted from the manual on module signature:

"... Any type which is revealed to be an interface, or a type which is a class or struct with one or more constructors (see class definitions) may not hide its inheritance declarations, abstract dispatch slot declarations or abstract interface declarations..."

HTH.

By on 11/6/2007 6:44 AM ()

This is indeed very helpful.

I should have found it by myself; Thank you!

Best,

Keiko

By on 11/6/2007 7:03 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