3 ms·
Thank you for such a thoughtful answer! I did ask the question on Twitter. :) Not entireley convinced but I’m certainly looking forward to using it. One more
by mucholove 5y ago
Thank you for such a thoughtful answer!
I did ask the question on Twitter. :)
Not entireley convinced but I’m certainly looking forward to using it.
One more thing—how would you do error handling?
Thinking out loud here: it would be nice if NSObject had a method `isError` that went something like `self isKindOfClass:[NSError class]` so that you could return error in a more clean way. Wonder, what would mpw do?
Another question—how to MPW multiple return items? (My guess is that the return items would be mutable? Like a mutable string. Could work with numbers if you had such a thing as NSMutableNumber.)
- 0x10c0fe11ce 5y agoWrite that method in a category of NSObject and you’ll have it now. Objetive-C is a very extensible language with lots of syntactic sugar to help us out. Also, meta programming is lots of fun, but impossible without diving into the runtime guts which is part of the fun.
- mucholove 5y agoThe only thing that stops me from doing it that there is a well established pattern of passing `&error` which tells me that the function can error and that I could handle it. I’m sort of looking for what 2nd order and systemics effects `mpw` might expect. To me, Swift is a bit more annoying with `if let`. Seems like it might provide a benefit, but it’s not so compelling to me. The compile times are so much slower so as to turn me off completely.