From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Original-To: caml-list@yquem.inria.fr Delivered-To: caml-list@yquem.inria.fr Received: from nez-perce.inria.fr (nez-perce.inria.fr [192.93.2.78]) by yquem.inria.fr (Postfix) with ESMTP id 8528BBBBB for ; Fri, 17 Mar 2006 15:13:54 +0100 (CET) Received: from pauillac.inria.fr (pauillac.inria.fr [128.93.11.35]) by nez-perce.inria.fr (8.13.0/8.13.0) with ESMTP id k2HEDsBO001722 for ; Fri, 17 Mar 2006 15:13:54 +0100 Received: from concorde.inria.fr (concorde.inria.fr [192.93.2.39]) by pauillac.inria.fr (8.7.6/8.7.3) with ESMTP id PAA23968 for ; Fri, 17 Mar 2006 15:13:53 +0100 (MET) Received: from smtp2.mathworks.com (smtp2.mathworks.com [144.212.95.218]) by concorde.inria.fr (8.13.0/8.13.0) with ESMTP id k2HEDqd7002291 for ; Fri, 17 Mar 2006 15:13:53 +0100 Received: from mail-vif.mathworks.com (fred-ce0.mathworks.com [144.212.95.18]) by smtp2.mathworks.com (8.12.11/8.12.11) with ESMTP id k2HEDoHX009506 for ; Fri, 17 Mar 2006 09:13:51 -0500 (EST) Received: from MESSAGE-AH.ad.mathworks.com (ex-01-ah.mathworks.com [144.212.95.156]) by mail-vif.mathworks.com (8.11.7/8.11.7) with ESMTP id k2HEDoA23332 for ; Fri, 17 Mar 2006 09:13:50 -0500 (EST) X-MimeOLE: Produced By Microsoft Exchange V6.5.7226.0 Content-class: urn:content-classes:message MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable Subject: RE: [Caml-list] Stroustrup et al. propose to introduce "lambdaclosures" in C++ Date: Fri, 17 Mar 2006 09:12:50 -0500 Message-ID: Thread-Topic: [Caml-list] Stroustrup et al. propose to introduce "lambdaclosures" in C++ thread-index: AcZJq0qjcjm8x90+TWiNHtrkl4+uLgAIA3Og From: "Alexander Bottema" To: "Caml List" X-Miltered: at nez-perce with ID 441AC422.000 by Joe's j-chkmail (http://j-chkmail.ensmp.fr)! X-Miltered: at concorde with ID 441AC420.000 by Joe's j-chkmail (http://j-chkmail.ensmp.fr)! X-Spam: no; 0.00; garbage:01 garbage:01 high-level:01 semantics:01 pointers:01 generational:01 boehm:01 compile-time:01 eijiro:01 sumii:01 eijiro:01 sumii:01 lambda:01 lambda:01 semantics:01 X-Spam-Checker-Version: SpamAssassin 3.0.3 (2005-04-27) on yquem.inria.fr X-Spam-Level: X-Spam-Status: No, score=0.0 required=5.0 tests=none autolearn=disabled version=3.0.3 It is interesting to see that they are trying to implement closures in C++, something I wanted for a long time. Unfortunately, I don't think it is useful without having a proper garbage collector. If you read the specification (5.2) you can see it is something they struggle with. I think it is time that they added garbage collection to C++ as the default memory allocation strategy like all other high-level languages. If we could restrict the semantics of C++ on how we use pointers then we might be able to implement an efficient generational garbage collector (e.g. a three generation based collector as in Microsoft .NET). An alternative would be to use a conservative collector (such as Boehm), but then there are less chances to do garbage collection optimizations at compile-time. Alexander -----Original Message----- From: caml-list-bounces@yquem.inria.fr [mailto:caml-list-bounces@yquem.inria.fr] On Behalf Of Eijiro Sumii Sent: Friday, March 17, 2006 5:08 AM To: Caml List Cc: Eijiro Sumii Subject: [Caml-list] Stroustrup et al. propose to introduce "lambdaclosures" in C++ Hi, A friend of mine informed me of this report Lambda expressions and closures for C++ Jeremiah Willcock, Jaakko Jarvi, Doug Gregor, Bjarne Stroustrup, Andrew Lumsdaine 2006-02-26 http://public.research.att.com/~bs/N1968-lambda-expressions.pdf and I thought you might be interested. (I searched a little and didn't find any discussion on this report in this list.) A few highlights: ---------------------------------------------------------------------- We propose to extend the C++ language with lambda expressions, and define the semantics of these unnamed local functions via translation to closures: function objects implemented using local classes. ... void f() { int sum =3D 0; for each(a.begin(), a.end(), <>(int x) -> int extern(sum) {return sum +=3D x;}); } ... 2.1 Omitting the return type The return type of a lambda expression can be omitted if the body of the lambda function contains at most one return statement. ---------------------------------------------------------------------- Enjoy:-), Eijiro _______________________________________________ Caml-list mailing list. Subscription management: http://yquem.inria.fr/cgi-bin/mailman/listinfo/caml-list Archives: http://caml.inria.fr Beginner's list: http://groups.yahoo.com/group/ocaml_beginners Bug reports: http://caml.inria.fr/bin/caml-bugs