From: "Alexander Bottema" <Alexander.Bottema@mathworks.com>
To: "Caml List" <caml-list@inria.fr>
Subject: RE: [Caml-list] Stroustrup et al. propose to introduce "lambdaclosures" in C++
Date: Fri, 17 Mar 2006 09:12:50 -0500 [thread overview]
Message-ID: <DB873318D1A41648BEAC4B5AAB63B3E10D030839@MESSAGE-AH.ad.mathworks.com> (raw)
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 = 0;
for each(a.begin(), a.end(),
<>(int x) -> int extern(sum) {return sum += 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
next reply other threads:[~2006-03-17 14:13 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2006-03-17 14:12 Alexander Bottema [this message]
2006-03-17 17:32 ` skaller
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=DB873318D1A41648BEAC4B5AAB63B3E10D030839@MESSAGE-AH.ad.mathworks.com \
--to=alexander.bottema@mathworks.com \
--cc=caml-list@inria.fr \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox