A language without namespaces, that's used almost exclusively for iOS apps and nothing else. Nope, that's exactly what I 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.
I know that may not seem like a big deal but many major applications people care about seem to have first appeared on Mac OS / Mac OS X (yes, these are two very different things).
BTW: namespaces?! Not exactly my go to checklist feature for languages.
As little of it as possible. I dump everything I can into C++ both for portability and for sanity-of-code reasons.
I think what people really like about Objective C is not Objective C but Cocoa.
I would seriously consider Obj-C on non-OSX systems if it had a better library available (GNUstep doesn't cut it), but that's a chicken-and-egg problem.
Anything else, not so much, but, yeah.
Does the language have goto? Check. Okay, now let's write a security library! :)
But it's not like "where it's used" matters. That's mostly just a historical accident. If Microsoft had adopted it instead of C++ for example (which is not that outlandish), it would have been used a lot more. There was also NeXT that adopted ObjectiveC (it was developed before it), and OpenStep which also involed Sun and other players etc.
And compared to "being used for iOS apps" (e.g 1 million apps in the most lucrative mobile market", Lisp and Smalltalk are not used even 1/100 that. And Haskell even less (some "success story" here and there, eg an obscure bank, and that's mostly it). Does that make them bad languages?
And the fact that it doesn't have namespaces. Yeah, so like C. So that's important, because?
>Nope, that's exactly what I think it is.
Well, doesn't seem like you do. Or have any extended experience with the language. It's just empty snark to convey "oh, so obsolete".
Instead of this Foundation::Array we get NSArray. Way easier to type out, and looks a million times cleaner to me.
With proper namespaces/modules, such conflicts can be usually sorted out by renaming on import. With C and Objective-C, good luck.
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 (probably the one already in there to be BG1AddressBook or whatever). This is no different than having a library named BGAddressBook in ruby and wanting to use another library with the same namespace. You're going to have to change one or the other's namespace to work with both.
Properties don't matter and can collide with no problem. I can have a BGAddressBook with a name property and a BGSomethingElse with a name property. Doesn't matter. It'd be the same as BGAddressBook::Name and BGSomethingElse::Name.
You can't seriously argue that "NSArray" as a single string is the same thing as (hypothetical) "NS.Array", where both "NS" and "Array" and the thing at "NS.Array" are semantically different things. Don't get me wrong, I love Smalltalk and Erlang - both languages suffering from the same problem - but I can recognize a shortcoming when it bites my arm off.
After looking around halfway through writing this, this looks pretty nice:
http://stackoverflow.com/questions/11091740/is-it-possible-t...
I see what you're saying. Maybe it's Stockholm Syndrome, but I do like knowing associated files in 3rd party libraries easily too. I don't know, I'll experiment with this more in ruby and see how it feels.
#include <coollib.h>
namespace betterns = 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.
There are lots of module systems to choose from, and Objective-C offers none.
Namespaces and modules do not prevent name clashes, at least in any language that I'm aware of. Even with a more sophisticated system like Haskell's, you're still out of luck if you have a package name clash. (And getting to the point where that's the limiting factor requires GHC extensions.)
What namespaces/modules buy you with respect to name clashes is just that they make it possible to stomach longer names that make those clashes less likely.
Are you aware of a programming language that does truly prevent name clashes through a namespace or module system? I'd be interested to hear of it.
Another good thing about the Obj-C de facto way is that you can immediately tell what a class is vs seeing String string
...hate to say it, but nowadays the only big company that seems to care about developers and actually gives them cool tools and languages is Microsoft! C# with all its extensions, F# and the cool research they do in the languages area shows one thing: they care about us!
http://en.wikipedia.org/wiki/Objective_c#Objective-C_2.0 http://en.wikipedia.org/wiki/Objective_c#Automatic_Reference... http://en.wikipedia.org/wiki/Objective_c#Blocks
Objective-C also suffers from C interop considerations that make it more difficult to extend and evolve the language than something like C# or Java.
(None of this is to denigrate the wonderful work MS has done when it comes to language innovation.)