Version française
Home     About     Download     Resources     Contact us    

This site is updated infrequently. For up-to-date information, please visit the new OCaml website at

Browse thread
[Caml-list] Problem with parametric classes
[ Home ] [ Index: by date | by threads ]
[ Search: ]

[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
Date: -- (:)
From: John Max Skaller <skaller@o...>
Subject: Re: [Caml-list] Problem with parametric classes
Frederic Tronel wrote:

>>That seems suspicious .. countingObjects is generic
>>here .. this is at global scope .. the initialiser
>>which fixes the type is inside a class ..
>>this has to be wrong ..
>Why not ?
>This code has worked for a long time, before I decided to add some
>features (synchroAccounting class).
Because the type of a global is being fixed by an implementation
detail of a class .. classes are supposed to encapsulate things.
If it worked before, it might be considered a bug in the ocaml
type checker: type inference shouldn't cross class boundaries like that.

In any case .. you have a global, and that is bad enough.
It should be passed as an argument to methods that use it,
including the initialiser.

John Max Skaller,
snail:10/1 Toxteth Rd, Glebe, NSW 2037, Australia.

To unsubscribe, mail Archives:
Bug reports: FAQ:
Beginner's list: