Version française
Home     About     Download     Resources     Contact us    
Browse thread
[Caml-list] Allow declaring classes "final" so self type has no type variables?
[ Home ] [ Index: by date | by threads ]
[ Search: ]

[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
Date: -- (:)
From: james woodyatt <jhw@w...>
Subject: Re: [Caml-list] Allow declaring classes "final" so self type has no type variables?
On Friday, Sep 6, 2002, at 12:12 US/Pacific, Tim Freeman wrote:
>
> Any comments on whether this is a good idea?

Hide the class with a module signature.  Publish only the class type 
and one or more functions for constructing objects.

In other words, don't put your "class node" in the module type.  
Instead just define a function:

	val create_node: parent:nodetype option -> nodetype

The way to prevent programmers from using your class in an "inherit" 
clause is to not give them the class in the first place.  Just give 
them the class type and a collection of functions.


-- 
j h woodyatt <jhw@wetware.com>
markets are only free to the people who own them.

-------------------
To unsubscribe, mail caml-list-request@inria.fr Archives: http://caml.inria.fr
Bug reports: http://caml.inria.fr/bin/caml-bugs FAQ: http://caml.inria.fr/FAQ/
Beginner's list: http://groups.yahoo.com/group/ocaml_beginners