Umm... that’s not how Objective-C works... (or Swift, for that matter - same runtime). “Named arguments” are a feature provided by the compiler’s parser stage; what’s actually going on is the argument name is part of the method name. So, for example, in the call [foo doSomethingWithThisInt:5 anotherInt:7]; to a method declared -(void)doSomethingWithThisInt:(int)a anotherInt:(int)b; the entire method name (it’s selector, in Objective-C terminology) is doSomethingWithThisInt:anotherInt: and it’s C function signature is void f(id self, int a, int b). The arguments are passed according to standard platform C ABI rules. The only thing objc_msgSend() does is find the C function that corresponds to the selector value passed to it, and jump to that function. P.s. - I *think* the selector is passed to the C function as well, but it’s been a while since I read the relevant sections of the Runtime Reference... 🤔
I tried to reproduce code samples without boost::hana, but after adding apply(auto &f) compiler started generating foo and stopped optimizing it into returning 42 (on clang(trunk) and gcc(8.2); gcc(trunk) and some experimental clangs did succeed). I wonder what trick hana did that makes it work... godbolt.org/z/hQtwqg
calling something that takes 3 matrices and 2 floats is probably one of the most compelling use cases, but something like insertSorted(1, myArray) probably doesn't need it.
i wish i could just include and link any c++ library by a simple click like it is done here.
Making and using libraries is probably one of the most frustrating part of C and C++ for me
I have high hopes for vcpkg in this regard.
Umm... that’s not how Objective-C works... (or Swift, for that matter - same runtime). “Named arguments” are a feature provided by the compiler’s parser stage; what’s actually going on is the argument name is part of the method name. So, for example, in the call [foo doSomethingWithThisInt:5 anotherInt:7]; to a method declared -(void)doSomethingWithThisInt:(int)a anotherInt:(int)b; the entire method name (it’s selector, in Objective-C terminology) is doSomethingWithThisInt:anotherInt: and it’s C function signature is void f(id self, int a, int b). The arguments are passed according to standard platform C ABI rules. The only thing objc_msgSend() does is find the C function that corresponds to the selector value passed to it, and jump to that function.
P.s. - I *think* the selector is passed to the C function as well, but it’s been a while since I read the relevant sections of the Runtime Reference... 🤔
😱 stop this non-sense, C++!
I tried to reproduce code samples without boost::hana, but after adding apply(auto &f) compiler started generating foo and stopped optimizing it into returning 42 (on clang(trunk) and gcc(8.2); gcc(trunk) and some experimental clangs did succeed).
I wonder what trick hana did that makes it work... godbolt.org/z/hQtwqg
Can you determine the name of Arguments in C++ (without meta classes)?
no
Works well in Matlab: makes the intent of each argument clear without having to check the API.
But that's not the point here. See 52:49.
calling something that takes 3 matrices and 2 floats is probably one of the most compelling use cases, but something like insertSorted(1, myArray) probably doesn't need it.
Great Talk!!