r/iOSProgramming • NSModerator • Mar 30 '17

Objc generics would be really nice right about now

Post image
0 Upvotes

12 comments sorted by

9

u/quellish Mar 31 '17

Huh? Objective-c supports generics.

1

u/ThePantsThief NSModerator Mar 31 '17

It supports object generics. And only on a per-class basis, not on a per-method basis.

The code for that wouldn't be any prettier than this since BOOL isn't an object and I'd have to @(wrap it) all over the place.

3

u/quellish Mar 31 '17

I did not realize your issue was that your code was not "pretty". I also did not realize the "problem" was the use of BOOL. I can't say I see what that has to do with generics.

As far as "pretty", I would suggest reading some of the blocks best practices.

2

u/ThePantsThief NSModerator Mar 31 '17

Real generics (and inferred return types) in this case would remove the need to return nil and wrap BOOL in NSNumber. That's all I'm concerned about. I would be writing this in Swift if it were an option

0

u/[deleted] Mar 31 '17

[removed] — view removed comment

1

u/ThePantsThief NSModerator Apr 02 '17 edited Apr 02 '17

Say something like that to anyone on this subreddit again, and it'll get you banned.

Anyway, maybe take a look at my github page before you judge my talents so quickly. I'm no senior developer but I'm not new to this either.

The code in my post is for a debugging tool that will let you hook any method and override it's arguments or return value.

Edit: after reviewing your history, this isn't the first time you've said something like this to someone. I assume this is your throwaway. Consider it banned.

1

u/[deleted] Apr 02 '17

Unrelated could you explain what this code is doing?

1

u/ThePantsThief NSModerator Apr 02 '17

It's for a debugging tool that will allow you to override the parameters or return value of any method at runtime and toggle said overrides on and off. Search for a class, choose a method, replace values.

2

u/MrSloppyPants Mar 31 '17

How are you a mod?

3

u/ThePantsThief NSModerator Mar 31 '17

I'm aware of the limited compile-time generics Objc offers. I should have made my title more clear. I was trying to say that they're not enough to be truly useful.

2

u/[deleted] Mar 31 '17

He researches stuff. He probably knows more obscure things than you do.