Version française
Home     About     Download     Resources     Contact us    
Browse thread
pattern match on class?
[ Home ] [ Index: by date | by threads ]
[ Search: ]

[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
Date: -- (:)
From: brogoff <brogoff@s...>
Subject: Re: [Caml-list] pattern match on class?
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