Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

> instead of, for example, inextricably tying its design to classes and namespaces

Considering it's Apple-designed and Apple works mostly with C (and Obj-C), it's not really surprising that they designed it for C and working with C++ rather than design it for C++.



Apple uses C++, even on mobile. The iBooks acknowledgements lists Boost and Google Protobufs.


That Apple uses C++ (you could also have mentioned LLVM) does not change their production and API being mostly C or Obj-C, and thus their proposals are usually for C. A previous examples was blocks, they created those for C and Obj-C, they can be used from C++ but are completely incompatible with C++11 lambdas as far as I know.


You can now implicitly cast lambdas to blocks, although they're otherwise completely separate (and must be - C++'s approach wouldn't easily translate to C).


They can be cast the other way, too. No?


Casting to a C++11 lambda doesn't really make any sense; each lambda function is a unique anonymous type. There's also no need to do any casting to use an Obj-C block anywhere that you can use a C++11 lambda, since they obviously already implement the Callable concept.


Also webkit. Can't they just treat lambdas as types(class/struct) with operator() methods?


Probably in other areas, but a major one is in IO-Kit (their device driver framework) which is written in and uses a specialized subset of C++ called Embedded-C++, though the userspace API for it has a C wrapper.


A lot of Apple's userland C APIs are also wrappers for C++ implementations, but it varies by project.


And also like... the XNU kernel?




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: