List Info

Thread: "ocaml_beginners"::[] Seperating class interfaces from implementations




"ocaml_beginners"::[] Seperating class interfaces from implementations
user name
2006-10-16 23:06:30

On Oct 16, 2006, at 4:33 PM, mikedebo_ca wrote:

> My makefile essentially does 'ocamlc -c *.mli *.ml'. burp.mli and
> burp.ml compile without
> any problem, but compilation of run.ml fails with:
>;
> File "run.ml", line 4, characters 10-22:
> Unbound class Burp.foo

The problem here is that you are confusing class types with class
signatures. They are two different things. What you need in
burp.mli is

class foo : int -> object
method bar : int
end

You can tell this yourself if you use the -i option with burp.ml:

[328] 4:57PM% ocamlc -i burp.ml
class foo : int -> object method bar : int end

And to see the difference, you can add the class type foo (sort of...
you need to change the name, or else the compiler complains. I used
foo_type) to burp.ml and see what the signature becomes:

[334] 5:01PM% ocamlc -i burp.ml
class foo : int -> object method bar : int end
class type foo_type = object method bar : int end

William D. Neumann

"I eat T-bone steaks, I lift barbell plates, I'm sweeter than a
German chocolate cake. I'm the reflection of perfection, the number
one selection. I'm the man of the hour, the man with the power, too
sweet to be sour. The ladies' pet, the men's regret, where what you
see is what you get, and what you don't see, is better yet."

--Superstar Billy Graham

__._,_.___
.

__,_._,___
[1]

about | contact  Other archives ( Real Estate discussion Medical topics )