From mboxrd@z Thu Jan 1 00:00:00 1970 Received: (from weis@localhost) by pauillac.inria.fr (8.7.6/8.7.3) id JAA20023 for caml-redistribution; Fri, 19 Feb 1999 09:27:38 +0100 (MET) Received: from nez-perce.inria.fr (nez-perce.inria.fr [192.93.2.78]) by pauillac.inria.fr (8.7.6/8.7.3) with ESMTP id UAA04634 for ; Thu, 18 Feb 1999 20:40:29 +0100 (MET) Received: from mail12.svr.pol.co.uk (mail12.svr.pol.co.uk [195.92.193.215]) by nez-perce.inria.fr (8.8.7/8.8.7) with ESMTP id UAA11958 for ; Thu, 18 Feb 1999 20:40:26 +0100 (MET) Received: from modem-96.amantadine.dialup.pol.co.uk ([62.136.49.224] helo=toy.william.bogus ident=williamc) by mail12.svr.pol.co.uk with esmtp (Exim 2.10 #1) id 10DZJB-0008FW-00 for caml-list@inria.fr; Thu, 18 Feb 1999 19:40:25 +0000 Received: (from williamc@localhost) by toy.william.bogus (8.8.7/8.8.7) id TAA09359; Thu, 18 Feb 1999 19:12:55 GMT Date: Thu, 18 Feb 1999 19:12:55 GMT Message-Id: <199902181912.TAA09359@toy.william.bogus> From: William Chesters To: caml-list@inria.fr Subject: Anonymous classes Sender: weis Could we have anonymous classes, as a natural counterpart to anonymous functions? let x = object method foo = 17 end in ... They would sometimes be useful for specifying the little bits of `glue' one needs to interface a library routine with one's current problem. On the other hand maybe this kind of sugar isn't strictly necessary, since I found this pretty easy to add with camlp4 :-), using a dummy local module. expr: LEVEL "simple" [ [ "object"; cspo = OPT class_self_patt; cf = class_structure; "end" -> <:expr< let module Dummy__ = struct class c () = object $cspo$ $list:cf$ end ; end in new Dummy__.c () >> ] ] ; (except that the definitions of class_structure and class_self_patt need to be copied from pa_o.ml)