caml-list - the Caml user's mailing list
 help / color / mirror / Atom feed
* pattern match on class?
@ 2005-11-23 19:52 skaller
  2005-11-25  6:13 ` [Caml-list] " brogoff
  0 siblings, 1 reply; 3+ messages in thread
From: skaller @ 2005-11-23 19:52 UTC (permalink / raw)
  To: caml-list

We have anonymous objects now .. but can one pattern
match on a class as one can on a record?

-- 
John Skaller <skaller at users dot sf dot net>
Felix, successor to C++: http://felix.sf.net


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

* Re: [Caml-list] pattern match on class?
  2005-11-23 19:52 pattern match on class? skaller
@ 2005-11-25  6:13 ` brogoff
  0 siblings, 0 replies; 3+ messages in thread
From: brogoff @ 2005-11-25  6:13 UTC (permalink / raw)
  To: skaller; +Cc: caml-list

On Thu, 24 Nov 2005, skaller wrote:
> We have anonymous objects now .. but can one pattern
> match on a class as one can on a record?

No. But pattern matching is the enemy of data abstraction, and
we did get private row types, which allow polymorphic variants
and classes to play a bit more nicely with OCaml's data abstraction
facilities.

I'm not sure why you thought that there was a relationship between
anonymous objects and pattern matching. The question which pops into
my mind is, "Now that we have anonymous objects, when will we have
delegation?" but even more than that I wonder about the many other
features that have been discussed that could be used in place of
objects and classes.

-- Brian


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

* Re: [Caml-list] pattern match on class?
@ 2005-11-25  5:31 Keiko Nakata
  0 siblings, 0 replies; 3+ messages in thread
From: Keiko Nakata @ 2005-11-25  5:31 UTC (permalink / raw)
  To: caml-list

From: skaller <skaller@users.sourceforge.net>

>We have anonymous objects now .. but can one pattern
>match on a class as one can on a record?

I might not understand you correctly,
but I think it is impossible 
if you want something like "instance of" in Java.

Because the run-time does not carry type information of values,
it has no way to know the exact type of an object,
nor whether an object is an instance of a particular class.


Keiko NAKATA


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

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

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2005-11-23 19:52 pattern match on class? skaller
2005-11-25  6:13 ` [Caml-list] " brogoff
2005-11-25  5:31 Keiko Nakata

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