[haiku-development] Re: Interesting feature of Snow Leopard

From: Zenja Solaja <solaja@xxxxxxxxx>

To: haiku-development@xxxxxxxxxxxxx

Date: Thu, 3 Sep 2009 18:32:46 +1000

On Thu, Sep 3, 2009 at 5:28 PM, Ryan Leavengood <leavengood@xxxxxxxxx>wrote:
>
> Some other Snow Leopard features that I find quite interesting:
>
> - BLOCKS in C!!! As a Ruby enthusiast this is huge to me, even if the
> syntax is a bit ugly (of course as a Rubyist most of C and C++ is ugly
> to me, so the block syntax doesn't seem that bad.) I don't know what
> the plans are for blocks, but I think Apple wants it to be a standard
> outside of their world. If it gains traction (and maybe even if not),
> I'd love to see some consideration made for this in our R2 API
> designs.
>
C++0x (when it finally comes) includes Lambdas, which is what the rest of
world will use instead of Blocks. Apple jumped the gun prematurely by
rolling out Blocks, but I guess it has it reasons (eg. need to ship, plus
they can use BLocks with Obj-C and vanilla C, while Lambdas are only
available in C++). Have you seen the coding convention? __BLOCK__ Yuck :(
> - Grand Central Dispatch: a fancy name for a thread pool and message
> queues, it's real use, power and convenience comes from the use of the
> C blocks mentioned above. I would also be curious to hear some of the
> reactions to John's premise that BeOS programming was too hard
> (http://arstechnica.com/apple/reviews/2009/08/mac-os-x-10-6.ars/11).
> It seems to me that plenty of people figured it out. Be's demise was
> more for market reasons than technical IMO. They were too ahead of
> their time. But of course Haiku could still improve in this area and
> expose similar APIs as GCD.
>
We have all created Thread / Job pools before, but Apple have done the right
thing of implementing a common design pattern into a system library (hence
you're guaranteed to have a decent implementation instead of rolling your
own). Apple have also implemented process control mechanisms with the
Thread pool ie. you can suspend and resume threads. However, Grand Central
will not help you with concurrency issues - far from it. I also dont like
the way they signal job completion.
> - LLVM: this just seems cool and well designed, and breaks away from
> all the GCC cruft. I also like how it can be more easily used from
> IDEs and the error messages sure are better!
>
I'm positive that a lot of open source systems will end up using LLVM and
Clang. Maybe even Haiku when it gets decent C++ support.
Regards, Zenja