LLVM 4.0 带来的Objective-C新特性,代码又可以简洁一些了!

2012-02-17 00:55:03 +08:00
 lldong
LLVM 4.0 Compiler

• Default @synthesize: automatically synthesizes an @property when unimplemented

• Objective-C literals: create literals for NSArray, NSDictionary, and NSNumber, just the same as the literals for NSString

• Objective-C container subscripting: use '[]' syntax to access containers such as NSArray and NSDictionary
4804 次点击
所在节点    iDev
5 条回复
snx
2012-02-17 14:29:14 +08:00
看似省了 [dict objectForKey: @"a"] 為 dict[@"a"]
levey
2012-02-17 14:36:50 +08:00
llvm.org上没这新闻,你是哪里看到的。。。
ant_sz
2012-02-17 14:54:19 +08:00
变得越来越像CPP了。。。

看来CPP还是很经典的么。。。

不过cpp貌似不允许在[]里填字符串,恩恩,应该说转变的更像python
lldong
2012-02-17 16:05:51 +08:00
@snx 还有创建NSArray和NSDictionary,NSNumber也能像创建NSString那样方便了
@levey Xcode 4.4 Release Note
@ant_sz 我觉得越来越像Ruby
elden
2012-02-17 16:22:39 +08:00

这是一个专为移动设备优化的页面(即为了让你能够在 Google 搜索结果里秒开这个页面),如果你希望参与 V2EX 社区的讨论,你可以继续到 V2EX 上打开本讨论主题的完整版本。

https://www.v2ex.com/t/27528

V2EX 是创意工作者们的社区,是一个分享自己正在做的有趣事物、交流想法,可以遇见新朋友甚至新机会的地方。

V2EX is a community of developers, designers and creative people.

© 2021 V2EX