Live data from Hacker News

Objective-C isn't what you think it is

news.rapgenius.com

61–70 of 101 posts

Re: Objective-C isn't what you think it is

#61
post #51
post #15

> Objective-C isn't what you think it is A language without namespaces, that's used almost exclusively for iOS apps and nothing else. Nope, that's exactly what I think it is.

Yep. And the fact that Apple did absolutely nothing to evolve the language into something better shows that they just don't give a fuck about tools and most importantly about their developers! Maybe it's better than C++ or other alternative, maybe XCode is quite good, but this just show that since the days of NeXT (the 80s!), they just don't give a fuck! ...hate to say it, but nowadays the only big company that seems…

This is crazy talk. While I'm certainly not saying that Objective-C is perfect, or that Apple shouldn't do more, to say they've done absolutely nothing to evolve the language since the 80s is flat out incorrect. Look at blocks, ARC, object-literals, etc.

Re: Objective-C isn't what you think it is

#63
post #45
post #34

Earlier quoted context omitted.

Until some other cool library you really want to use happens to also have a NSArray. With proper namespaces/modules, such conflicts can be usually sorted out by renaming on import. With C and Objective-C, good luck.

Then there must be some other cool library you really want to use happens to also have the namespace "std" and a "vector" class inside...

    #include 

    namespace betterns = std;

Re: Objective-C isn't what you think it is

#64
post #43
post #34

Earlier quoted context omitted.

Until some other cool library you really want to use happens to also have a NSArray. With proper namespaces/modules, such conflicts can be usually sorted out by renaming on import. With C and Objective-C, good luck.

If a cool library you want also has a class named NSArray, then you just refactor it by renaming on import like you just mentioned. It's literally the exact same thing as what you're saying. Say I have one library in my project already - we'll call it BGAddressBook. And then I find another library that I really want to add that also happens to be named the exact same - BGAddressBook. So, I would refactor one of them…

How do you refactor third party libraries delivered as binary?

Re: Objective-C isn't what you think it is

#65
post #3

Yes. Using objc_msgSend and NSSelectorFromString, you can call functions, dynamically by name in Objective C. Yes, it's dangerous. Clever, and not quite as easy as your favorite dynamic scripting language, but Obj-C supports it. My favorite personal use case so far is an Objective-C state machine, where state names are strings, and state callback functions can be added to the code & called without declaration. It's n…

You can even do it in POSIX C with dlsym.

Heh, true, though it requires that the function you want to call be in a dynamic library.

Re: Objective-C isn't what you think it is

#66
post #15

> Objective-C isn't what you think it is A language without namespaces, that's used almost exclusively for iOS apps and nothing else. Nope, that's exactly what I think it is.

How do namespaces come to be the feature to specifically call out? Is there something deeper to namespaces than a lexical (i.e. surface) convention around identifiers?

Re: Objective-C isn't what you think it is

#67
post #64
post #43

Earlier quoted context omitted.

If a cool library you want also has a class named NSArray, then you just refactor it by renaming on import like you just mentioned. It's literally the exact same thing as what you're saying. Say I have one library in my project already - we'll call it BGAddressBook. And then I find another library that I really want to add that also happens to be named the exact same - BGAddressBook. So, I would refactor one of them…

How do you refactor third party libraries delivered as binary?

How would you refactor a third party library delivered as a binary in a language with namespaces?

Re: Objective-C isn't what you think it is

#68
post #63
post #45

Earlier quoted context omitted.

Then there must be some other cool library you really want to use happens to also have the namespace "std" and a "vector" class inside...

#include namespace betterns = std;

The whole problem is that namespaces are open, and you can add to them from anywhere. This means a namespace alias is useless in this situation. There's no distinction between things put in namespace std by library A and things put there by library B - they are all equally valid members of namespace std.

All that has been accomplished by the namespace alias is that before, both libraries were accessible through "std", and now, both libraries are accessible through both "std" and "betterns".

Namespaces gives you the tools to make name clashes less likely, but they don't make them impossible. Generally to avoid clashes totally you need a central arbiter of name ownership like, say, the DNS registry, which is why naming your packages using inverted domain names was advocated by some people in the Java community.

Re: Objective-C isn't what you think it is

#69
post #32

i enjoyed this b/c i recently made the jump from ruby to obj-C and, though scary at first, i now feel incredibly comfortable working in obj-C and think i even prefer it. so, that's cool. i do see at the bottom that this post is one of those "inbound marketing for job candidates" things. that's cool, too... but, i gotta say, as soon as i read the sign off, "If you want to work somewhere where..." i thought to myself,…

Isn't Rap Genius basically an online Talmud meant for anything?

Not yet.

Re: Objective-C isn't what you think it is

#70
post #10

AFAIK Objective-C does indeed have dynamic features. It's also static & weak. So I already have a problem with the first line of the article: > Ruby and Objective-C look like opposites: one is dynamic, the other's static; EDIT: Just read that the author basically denies those claims in the next paragraph.

I think the key words here are "look like". This is an article written for people without much knowledge of Objective-C.
Post reply on HN