Version française
Home     About     Download     Resources     Contact us    
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, mailto:skaller@ozemail.com.au
snail:10/1 Toxteth Rd, Glebe, NSW 2037, Australia.
voice:61-2-9660-0850




-------------------
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