为什么Objective-C没有名称空间? [英] Why doesn’t Objective-C have namespaces?

查看:64
本文介绍了为什么Objective-C没有名称空间?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

为什么Objective-C没有名称空间?似乎是一个简单的功能,它将使某些类名称更易读(AVMutableVideoCompositionLayerInstruction有人吗?),并在类名称上加上一些傻字母前缀.这主要是因为向后兼容吗?实现名称空间比看起来难吗?

Why doesn’t Objective-C have namespaces? It seems like a simple feature that would make some class names more readable (AVMutableVideoCompositionLayerInstruction anyone?) and axe the silly letter prefixes on class names. Is this mainly because of backwards compatibility? Is it harder to implement namespaces than it seems?

推荐答案

我不知道答案,但我怀疑它比看起来更难".您必须以不破坏现有软件的方式在编译器和链接器中引入支持.尽管这显然是可能的(C ++已经做到了),但据推测,工具链团队的工作重心更高.例如在最近的过去,我们出现了垃圾回收,GCD,块和Objective-C 2.0,所以我们不能说它们什么也没做.

I don't know the answer but I suspect "it's harder than it looks" is probably it. You would have to introduce support in the compiler and linker in a way that doesn't break existing software. And while this is obviously possible (C++ has already done it) presumably the tool chain team have had higher priorities on their plate. e.g. in the recent past we have had garbage collection, GCD, blocks and Objective-C 2.0 appear so we can't say they have been doing nothing.

命名空间支持是我非常希望看到的引入Objective-C的一件事.

Namespace support is the one thing that I would dearly love to see introduced to Objective-C.

这篇关于为什么Objective-C没有名称空间?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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