Does Objective-C have a Standard Library?

纵然是瞬间 提交于 2019-11-28 00:25:02

问题


Most somewhat modern programming languages have a standard library? It is my impression is that there isn't a decent sized standard library for Obj-C , rather that it relies mostly/all on Cocoa and that (plus people not wanting to use GNUstep) is why Obj-C is only used on macs)?

Is this true/to what extent? Are there any standard obj-c collections?

(note I haven't done any Obj-C programming and am not to likely to try it in the near future, I'm just curious). P.S. are there a any decent non-Cocoa/Gnustep Libraries? are they non-apple, are they open source, well documented?


回答1:


Contrary to Outis's answer, Objective-C was not originally developed at NeXT. NeXT adopted Objective-C as the language of choice in the mid to late '80s. Objective-C was created by Brad Cox and Tom Love at Stepstone in the early '80s.

Of relevance to the question, when Cox and Love created Objective-C, one of their primary goals was to build a language that could support fully componented software models. That is, you would be able to buy a software component from somewhere and plug it into your application to add functionality.

Out of this was developed ICPak 101 and, IIRC, 102 (or 201, I don't honestly remember), which was a bit of a standard library for Objective-C. It never really caught on.

Clearly NeXT and Apple have been the primary motivating forces behind Objective-C and, thus, today Cocoa's Foundation is the most popular standard library for Objective-C. It isn't the only one; there are still versions of the ICPak in active use and there are non-NeXT/non-Apple Objective-C projects that are actually quite large. As well, Objective-C continues to be used by a handful of projects on Linux, mostly via GNUStep.

In general, Objective-C is intended to be a simple and small language. Out of that comes relatively simple and small libraries (compare the size of, say, STL or Boost to Foundation).

If you search for "stes portable object compiler", you'll find David Stes's continuation of all that Stepstone did, including an ICPak implementation (again IIRC -- I haven't looked into this stuff in a long time).




回答2:


Since Objective-C is an extension of C (and a rather small one, at that), the C standard library is available. Other than that, the main library is whatever the platform provides, which basically means the original NeXTSTEP library and its descendents: OPENSTEP, Cocoa, GNUstep, the defunct Coconut. This is because Objective-C was originally developed at NeXT and was taken over by Apple. There isn't even an official standard these days, just Apple's documentation.

In my opinion, the lack of other libraries isn't the reason Objective-C is mostly used in Mac development, it's an effect of the latter.




回答3:


I think this section (philosophical differences between Objective-C and C++) of the Wikipedia entry covers this issue pretty well.



来源:https://stackoverflow.com/questions/2833756/does-objective-c-have-a-standard-library

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!