www.digitalmars.com         C & C++   DMDScript  

digitalmars.D - Re: Escape analysis

reply bearophile <bearophileHUGS lycos.com> writes:
I think C++ designers are fully mad, this shows how to use C++ lambdas:

http://blogs.msdn.com/vcblog/archive/2008/10/28/lambdas-auto-and-static-assert-c-0x-features-in-vc10-part-1.aspx

If D2 lambdas (and closures) become *half* complex as that I'm going to stop
using D on the spot :-)

Bye,
bearophile
Oct 29 2008
next sibling parent reply Sergey Gromov <snake.scaly gmail.com> writes:
Wed, 29 Oct 2008 09:46:22 -0400, bearophile wrote:

 I think C++ designers are fully mad, this shows how to use C++
 lambdas: 
 
 http://blogs.msdn.com/vcblog/archive/2008/10/28/lambdas-auto-and-static-assert-c-0x-features-in-vc10-part-1.aspx
 
 If D2 lambdas (and closures) become *half* complex as that I'm going
 to stop using D on the spot :-) 

Well, they're somewhat limited, and a bit manual, and actually just a syntactic sugar, but otherwise they're quite close to D's stack delegates, even in syntax. I couldn't see what scared you that much.
Oct 29 2008
next sibling parent Sergey Gromov <snake.scaly gmail.com> writes:
Thu, 30 Oct 2008 04:06:52 +0900, Bill Baxter wrote:

 On Thu, Oct 30, 2008 at 12:49 AM, Sergey Gromov <snake.scaly gmail.com> wrote:
 Wed, 29 Oct 2008 09:46:22 -0400, bearophile wrote:

 I think C++ designers are fully mad, this shows how to use C++
 lambdas:

 http://blogs.msdn.com/vcblog/archive/2008/10/28/lambdas-auto-and-static-assert-c-0x-features-in-vc10-part-1.aspx


Anyway, I'm impressed that MS is getting these things into the compiler so quickly. I had expected to see another C99 foot-dragging extravaganza. Guess it just goes to show how little they care about C.

The discussed features are really a significant improvement for C++ productivity. I think a lot of C++ code is still being written by MS so improving productivity here should be a priority for them. I wonder if there are any chances for typeof() in C++.
Oct 29 2008
prev sibling parent Robert Fraser <fraserofthenight gmail.com> writes:
Bill Baxter wrote:
 Anyway, I'm impressed that MS is getting these things into the
 compiler so quickly.  I had expected to see another C99 foot-dragging
 extravaganza.  Guess it just goes to show how little they care about
 C.

C++ is a .NET language now ;-P
Oct 29 2008
prev sibling next sibling parent "Bill Baxter" <wbaxter gmail.com> writes:
On Thu, Oct 30, 2008 at 12:49 AM, Sergey Gromov <snake.scaly gmail.com> wrote:
 Wed, 29 Oct 2008 09:46:22 -0400, bearophile wrote:

 I think C++ designers are fully mad, this shows how to use C++
 lambdas:

 http://blogs.msdn.com/vcblog/archive/2008/10/28/lambdas-auto-and-static-assert-c-0x-features-in-vc10-part-1.aspx

 If D2 lambdas (and closures) become *half* complex as that I'm going
 to stop using D on the spot :-)

Well, they're somewhat limited, and a bit manual, and actually just a syntactic sugar, but otherwise they're quite close to D's stack delegates, even in syntax. I couldn't see what scared you that much.

I think it's mostly the capture mode [] stuff that's a bit ugly. I think this is a legal lambda: [=,this,&x,&y](int& r) mutable { ... } Anyway, I'm impressed that MS is getting these things into the compiler so quickly. I had expected to see another C99 foot-dragging extravaganza. Guess it just goes to show how little they care about C. --bb
Oct 29 2008
prev sibling parent "Jarrett Billingsley" <jarrett.billingsley gmail.com> writes:
On Wed, Oct 29, 2008 at 5:30 PM, Sergey Gromov <snake.scaly gmail.com> wrote:
 I wonder if there are any chances for typeof() in C++.

It's called decltype().
Oct 29 2008