sobota, lipca 18, 2009

Apple introduces closures!

MacOS X Snow Leopard będzie miał planistę wątków opracowanego specjalnie dla procesorów wielordzeniowych. Co ciekawe, programista będzie korzystał z Grand Central Dispatch, poprzez closures.

Blocks

Blocks are a simple extension to C (as well as Objective-C and C++) that make it easy
for you to define self-contained units of work. A block in code is denoted by a caret at
the beginning of a function. For example, you could declare a block and assign it to x
by writing:
x = ^{ printf("hello world\n"); }
This turns the variable x into a way of calling the function so
that calling x( ); in the code would print the words hello world.

0 komentarze: