3 ms·
FWIW this is specifically why Objective-C has been able to get by without generics for a while. You don't get solid type-checking like you do with generics in o
by andlabs 12y ago
FWIW this is specifically why Objective-C has been able to get by without generics for a while. You don't get solid type-checking like you do with generics in other languages (except C++), but that has never really been an issue because the above statement works even with [...] statements (sure, the compiler will warn you, but).
The only real issue is that the things you shove into Objective-C containers must themselves be Objective-C types, which means using NSNumber and NSValue everywhere for raw C types. The new Objective-C @literal and @(expression) syntax, however, should make such code cleaner in the future...