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] a design problem requiring downcasting? (long)
[ Home ] [ Index: by date | by threads ]
[ Search: ]

[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
Date: 2002-09-27 (07:20)
From: Francois Pottier <francois.pottier@i...>
Subject: Re: [Caml-list] a design problem requiring downcasting? (long)


> With alternative (1), to do the method call above you would need downcasting
> e.g. in pseudo-ocaml:
>   let obj1 = array.(0) as class1 in
>   let obj2 = array.(1) as class2 in
>   obj1#my_method obj2
> with the cast raising an exception if it fails.  No problem.

There is something you haven't explained here. How, given the array
indices 0 and 1, do you know that the appropriate classes are class1
and class2? How do map from an index back to the expected class? If
we knew this, perhaps we would able to give better advice.

François Pottier
To unsubscribe, mail Archives:
Bug reports: FAQ:
Beginner's list: