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
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: 2005-11-25 (06:13)
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

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