Objective-C标准文件 [英] Objective-C standards document

查看:98
本文介绍了Objective-C标准文件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我是一名C和C ++程序员,试图开始使用Objective-C.但是,由于语言和标准库的标准文件的出现,我真的很困惑.我能理解没有ISO标准,但是根本没有参考文件?并且,似乎没有人担心这种情况怎么办? (不可否认,Google很难做到这一点,因为引用",文档"和标准"都是超载的术语.因此,我可能错过了一些关键的内容.)

I'm a C and C++ programmer trying to get started with Objective-C. I'm really bewildered, though, by the apparent total absence of a standards document for the language and standard library. I can understand that there's no ISO standard, but is there no reference document at all? And how is it that nobody seems very concerned about this state of affairs? (Admittedly, it's hard to Google for such a thing, because "reference", "document", and "standard" are all overloaded terms. So it's possible that I've just missed something critical.)

这个问题几乎要问同样的事情:

This question gets close to asking the same thing: Where can i find a document explaining how Objective-C is implemented and the only answer provided was "read this source code published by Apple which is pretty close to what their implementation did a few years ago, maybe".

此页面: http://clang.llvm.org/docs/ObjectiveCLiterals.html 包含一个用于Objective-C的正式语法的片段,但具有讽刺意味的是,它是在描述Clang刚刚退出并自己添加且没有其他人支持的功能的上下文中.这里还有另一种语法: http://www.omnigroup .com/mailman/archive/macosx-dev/2001-March/022979.html ,但已有10多年的历史了.

This page: http://clang.llvm.org/docs/ObjectiveCLiterals.html includes a snippet of a formal grammar for Objective-C, but ironically it's in the context of describing a feature that Clang just went off and added on their own and that nobody else supports. There's another grammar here: http://www.omnigroup.com/mailman/archive/macosx-dev/2001-March/022979.html but it's more than 10 years old.

将问题缩小到最低限度:我想知道对象"将保证提供哪些方法,以及每种方法的行为是什么.对于其他语言,此类信息通常由类似以下的内容提供: http://docs.oracle.com/javase/1.5.0/docs/api/java/lang/Object.html

To narrow the question down to the barest minimum: I'd like to know what methods are guaranteed to be provided by "Object", and what the behavior of each method is. For other languages, this type of information is usually provided by something like this: http://docs.oracle.com/javase/1.5.0/docs/api/java/lang/Object.html

推荐答案

不幸的是,没有针对ObjC的标准,就像针对C ++或C一样.Apple是该语言的主要用户和驱动程序,它们是编译器的实现(ObjC位) Clang)是事实上的标准.他们的旧文档(断开的链接)" "Objective-C编程语言" 与散文版本差不多,并且与其他任何一种语言的标准的精度都相差甚远(并且往往落后于编译器).

Unfortunately there is no Standard for ObjC as there is for C++ or C. Apple being the main user and driver behind the language, their compiler implementation (the ObjC bits of Clang) is the de facto Standard. Their old document (broken link) "The Objective-C Programming Language" was about as close as you got to a prose version, and it was nowhere near the precision of either of those other languages' Standards (and it tends to lag behind the compiler).

它可能仍然漂浮在网上的某个地方,但是不再是最新的. 使用Objective-C编程" 似乎是他们的预期替代品(但同样,它没有像标准).

It may still be floating around on the web somewhere, but it is no longer up-to-date. "Programming with Objective-C" seems to be their intended replacement (but again, it's nothing like a standard).

关于Tim删除的答案下的您的评论(仅10k链接),可可根类为NSObject,其接口为已记录,但其来源不可用.请注意, NSObject协议也是可可对象功能中极为重要的一部分. Apple的运行时是开源 *,并且有一个名为Object的根类,出于演示目的.可可编程中没有使用它.

Regarding your comment (10k link only) under Tim's deleted answer, the Cocoa root class is NSObject, and its interface is documented, but its source is not available. Note that the NSObject protocol is also an extremely important part of a Cocoa object's functionality. Apple's runtime is open-source,* and has a root class called Object, I assume for purposes of demonstration. It's not used in Cocoa programming.

当然,您已经了解了所有这一切.您问题的直接答案是没有一个".不过,正如bbum指出的那样,大多数语法与C相同:对的权威描述是ObjectiveC字符串文字吗? (是的,我从此处将注释复制粘贴到了此答案的开头).

You already know about all of this, of course. The direct answer to your question is, "there isn't one". Most of the syntax is the same as C, though, as bbum points out: Authoritative description of ObjectiveC string literals? (yes, I copy-pasted my comment from there into the beginning of this answer).

*请注意,与您在问题中所说的相反,这是实际最新的运行时.

*Note that contrary to what you say in your question, this is the actual, up-to-date, runtime.

这篇关于Objective-C标准文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆