Version française
Home     About     Download     Resources     Contact us    
Browse thread
local type within class
[ Home ] [ Index: by date | by threads ]
[ Search: ]

[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
Date: -- (:)
From: Xavier Leroy <Xavier.Leroy@i...>
Subject: Re: local type within class
> I would like to define "types" that are in the namescope of classes, is
> it possibles in ocaml ? (just like local types in C++)

Namespace control in Caml is performed by the module system.  Your
type belongs to a module (either the current compilation unit or some
sub-structure).  To hide this type, just add an interface to this module
that does not specify this type.

Objective Caml classes are only intended as a mechanism to group sets
of methods, attach them to objects, and perform inheritance.  Unlike
in C++ or Java, classes in Objective Caml do not double as a
general-purpose namespace control structure.

- Xavier Leroy