Version française
Home     About     Download     Resources     Contact us    
Browse thread
[Caml-list] Allow declaring classes "final" so self type has no type variables?
[ Home ] [ Index: by date | by threads ]
[ Search: ]

[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
Date: -- (:)
From: tim@f...
Subject: Re: [Caml-list] Allow declaring classes "final" so self type has no type variables?
On Friday, Sep 6, 2002, at 13:38 US/Pacific, Alessandro Baretta wrote:
> I don't think this is what he meant. 

I agree.

> I think he would like to 
> "finalize" a class for efficiency purposes as opposed to "safety" 
> purposes. 

Well, I actually wanted the class to be final so its "self" didn't
have to be polymorphic while it was being defined.  It's harder to get
the types to work out when some of the type variables running around
are useless.  No big deal, though.

> He is asking for some compiler magic.

I agree.

From: james woodyatt <jhw@wetware.com>
>The opportunity to optimize method dispatch simply isn't there.

I agree.  I had the idea because the documentation for Java says that
methods on finalized objects are faster.  The difference is that in
Java two objects are the same type if they have the same declaration,
so it's practical to find *the* declaration for the class of an
object and thus find out if the class is final.  In OCAML two
objects are the same type if they have the same bag of methods, more
or less, so there is no unique class declaration that can be
discovered to be final or not.

-- 
Tim Freeman       
tim@fungible.com
GPG public key fingerprint ECDF 46F8 3B80 BB9E 575D  7180 76DF FE00 34B1 5C78 
-------------------
To unsubscribe, mail caml-list-request@inria.fr Archives: http://caml.inria.fr
Bug reports: http://caml.inria.fr/bin/caml-bugs FAQ: http://caml.inria.fr/FAQ/
Beginner's list: http://groups.yahoo.com/group/ocaml_beginners