caml-list - the Caml user's mailing list
 help / color / mirror / Atom feed
* Coercion of arrays of objects (and some other containers)
@ 2005-04-13  0:14 Martin Jambon
  2005-04-13  0:49 ` [Caml-list] " Olivier Andrieu
  2005-04-13  0:59 ` Jacques Garrigue
  0 siblings, 2 replies; 5+ messages in thread
From: Martin Jambon @ 2005-04-13  0:14 UTC (permalink / raw)
  To: caml-list

Here is my problem:

# let obj =
object
  method a = ()
  method b = ()
end;;
        val obj : < a : unit; b : unit > = <obj>

(* That is nice: *)
# ([ obj ] :> < a : unit > list);;
- : < a : unit > list = [<obj>]

(* But why doesn't it work with arrays? *)
# ([| obj |] :> < a : unit > array);;
Characters 1-10:
  ([| obj |] :> < a : unit > array);;
   ^^^^^^^^^
This expression cannot be coerced to type < a : unit > array; it has type
  < a : unit; b : unit > array
but is here used with type < a : unit > array
Only the first object type has a method b


In practice I have this problem with a hash table of objects, and I
expected it to work since it works fine with lists of the same
type of objects...
Is there any workaround?

Martin

--
Martin Jambon, PhD
http://martin.jambon.free.fr



^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2005-04-13 14:11 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2005-04-13  0:14 Coercion of arrays of objects (and some other containers) Martin Jambon
2005-04-13  0:49 ` [Caml-list] " Olivier Andrieu
2005-04-13  0:59 ` Jacques Garrigue
2005-04-13  6:37   ` Matthieu Dubuget
2005-04-13 14:11     ` Olivier Andrieu

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).