Jump to page: 1 2 3
Thread overview
Apple Blocks added to C++?
Sep 02, 2009
S.
Sep 02, 2009
Rainer Deyke
Sep 02, 2009
Walter Bright
Sep 02, 2009
Tim M
Sep 02, 2009
Walter Bright
Sep 02, 2009
grauzone
Sep 02, 2009
Walter Bright
Sep 02, 2009
Walter Bright
Sep 02, 2009
Martin Franhaufer
Sep 02, 2009
Walter Bright
Sep 02, 2009
Leandro Lucarella
Sep 02, 2009
Mattias Holm
Sep 02, 2009
Leandro Lucarella
Sep 02, 2009
Mattias Holm
Sep 02, 2009
Walter Bright
Sep 03, 2009
Reimer Behrends
Sep 03, 2009
Walter Bright
Sep 03, 2009
Reimer Behrends
Sep 03, 2009
Walter Bright
Sep 03, 2009
Sean Kelly
Sep 03, 2009
Mattias Holm
Sep 03, 2009
Michel Fortin
Sep 03, 2009
Sean Kelly
Sep 03, 2009
Mattias Holm
Sep 02, 2009
Tim M
Sep 02, 2009
Michel Fortin
September 02, 2009
Been awhile since I posted.

I was wondering what other people thought about this addition to C++ by Apple.   Heh.

http://arstechnica.com/apple/reviews/2009/08/mac-os-x-10-6.ars/10

September 02, 2009
S. wrote:
> Been awhile since I posted.
> 
> I was wondering what other people thought about this addition to C++ by Apple.   Heh.

It doesn't solve any major problem and the syntax is ugly.  If it was standard C++, I'd use it anyway.  Since it isn't, I'll stick with Boost.Lambda (which is more limited and much uglier, but portable).


-- 
Rainer Deyke - rainerd@eldwood.com
September 02, 2009
S. wrote:
> I was wondering what other people thought about this addition to C++ by Apple.   Heh.
> 
> http://arstechnica.com/apple/reviews/2009/08/mac-os-x-10-6.ars/10


I find it strange that people are continuing to reinvent nested functions in ugly ways.
September 02, 2009
S. Wrote:

> Been awhile since I posted.
> 
> I was wondering what other people thought about this addition to C++ by Apple.   Heh.
> 
> http://arstechnica.com/apple/reviews/2009/08/mac-os-x-10-6.ars/10
> 

It is actually intended to be added to C which is kinda weird and against C's road map. C has decided that is a minimal abstraction over hardware to allow cross platform and not much else. C1X will probably feature barely any new features unless apple coughs up a lot of money.

I don't want this in C, but it is better suited to C++ if they didn't already have this planned http://en.wikipedia.org/wiki/C%2B%2B0x#Lambda_functions_and_expressions
September 02, 2009
Nick Sabalausky Wrote:

> "Walter Bright" <newshound1@digitalmars.com> wrote in message news:h7l32i$ev$1@digitalmars.com...
> > S. wrote:
> >> I was wondering what other people thought about this addition to C++ by Apple.   Heh.
> >>
> >> http://arstechnica.com/apple/reviews/2009/08/mac-os-x-10-6.ars/10
> >
> >
> > I find it strange that people are continuing to reinvent nested functions in ugly ways.
> 
> No offense, but Ruby and Python users would probably get a good chuckle at hearing the D creator saying that ;)
> 
> But in the case of C/C++, I consider it a minor miracle that they were able to pull it off without making it 10x uglier than what they actually ended up with.
> 
> 

Walter: may I ask with this, reddit posts and dobb's code post, why the interest in this particular topic right now? Didn't you implement this a long time ago?



September 02, 2009
Nick Sabalausky wrote:
> "Walter Bright" <newshound1@digitalmars.com> wrote in message news:h7l32i$ev$1@digitalmars.com...
>> S. wrote:
>>> I was wondering what other people thought about this addition to C++ by Apple.   Heh.
>>>
>>> http://arstechnica.com/apple/reviews/2009/08/mac-os-x-10-6.ars/10
>>
>> I find it strange that people are continuing to reinvent nested functions in ugly ways.
> 
> No offense, but Ruby and Python users would probably get a good chuckle at hearing the D creator saying that ;)

Perhaps they would, but I think they would agree that a nested function should follow the same syntax as a regular function.


> But in the case of C/C++, I consider it a minor miracle that they were able to pull it off without making it 10x uglier than what they actually ended up with.

For C++0x it's unnecessarily complicated - and they still don't have just plain old nested functions. C has no nested functions.
September 02, 2009
Tim M wrote:
> Walter: may I ask with this, reddit posts and dobb's code post, why
> the interest in this particular topic right now? Didn't you implement
> this a long time ago?

It was one of the first things implemented in D.

But I was thinking about it lately as I prepare the materials for the Compiler Construction seminar in a few weeks. Everyone tells me they are simple and obvious, yet in language after language they get added in bizarre ways that suggest that *somebody*, me or them, is just not getting it.

So I thought it was time for an article.

I mean, how can one miss the most stunningly obvious syntax:

   int foo(int a)
   {
         int bar(int i) { return a + 3; }

         return bar(3);
   }

and that nested functions are useful for many more things than passing around pointers to them. For example, as helper functions.
September 02, 2009
On 2009-09-02 00:27:46 -0400, S. <S@S.com> said:

> Been awhile since I posted.
> 
> I was wondering what other people thought about this addition to C++ by Apple.   Heh.
> 
> http://arstechnica.com/apple/reviews/2009/08/mac-os-x-10-6.ars/10

I don't find the syntax that ugly. And I'd say the feature is at its best when used with Grand Central Dispatch. As page 13 of this same review says, it enables developer to transform synchronous operations such as this:

 NSDictionary *stats = [myDoc analyze];
 [myModel setDict:stats];
 [myStatsView setNeedsDisplay:YES];
 [stats release];

into asynchrnous with minimal effort:

 dispatch_async(dispatch_get_global_queue(0, 0), ^{
   NSDictionary *stats = [myDoc analyze];
   dispatch_async(dispatch_get_main_queue(), ^{
     [myModel setDict:stats];
     [myStatsView setNeedsDisplay:YES];
     [stats release];
   });
 });

Without it, you'd have to create a bunch of different functions, probably accompanied by a context struct, to make this work, complexifying the conde and making it harder to follow. It's just syntaxic sugar when you think about it, but it's that syntaxic sugar that makes it practical to express operations in a way they can run asynchrnously.

-- 
Michel Fortin
michel.fortin@michelf.com
http://michelf.com/

September 02, 2009
Walter Bright Wrote:

> Nick Sabalausky wrote:
> > "Walter Bright" <newshound1@digitalmars.com> wrote in message news:h7l32i$ev$1@digitalmars.com...
> >> S. wrote:
> >>> I was wondering what other people thought about this addition to C++ by Apple.   Heh.
> >>>
> >>> http://arstechnica.com/apple/reviews/2009/08/mac-os-x-10-6.ars/10
> >>
> >> I find it strange that people are continuing to reinvent nested functions in ugly ways.
> > 
> > No offense, but Ruby and Python users would probably get a good chuckle at hearing the D creator saying that ;)
> 
> Perhaps they would, but I think they would agree that a nested function should follow the same syntax as a regular function.
> 
> 


Yes - Pascal has been doing that for years :-)


> > But in the case of C/C++, I consider it a minor miracle that they were able to pull it off without making it 10x uglier than what they actually ended up with.
> 
> For C++0x it's unnecessarily complicated - and they still don't have just plain old nested functions. C has no nested functions.

September 02, 2009
Martin Franhaufer wrote:
> Yes - Pascal has been doing that for years :-)

I know, I learned it from Pascal.
« First   ‹ Prev
1 2 3