Mailing Lists: Apple Mailing Lists
Image of Mac OS face in stamp
Re: Objective-C literal constants (was: ObjC and the dual runtime issue(s))
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Objective-C literal constants (was: ObjC and the dual runtime issue(s))



On 31.12.2003, at 09:35, Oleg Svirgstin wrote:
Subscription operator (objectAtIndex:zzz or objectForKey:zzz

Another CRAZY idea would be to provide a way to address items of NSArray,
NSDictionary and probably NSSet by a syntactic shortcut (subscription
operator). I don't know exactly, it seems that meaning of [] in this case is
quite distinct:

Well, this isn't too crazy, IMHO. Indeed Python works this way and I personally like it a lot. Enumerators are also in that category (for access like "for i in obj").

But I guess one should first think about how much one would like to modify the basic C constructs. If I'm not mistaken any current Objective-C construct doesn't overload a C expression in some way but rather uses something completely new/different.

To use "[]" for index based access you would need to attach special meaning to "id" and any other Objective-C type. Currently those are just plain and regular C structures.
Maybe someone has a better suggestion for an operator to be used for that? Like:
array@10 = @"hello world";
?

This more or less is in the same category like Marcel's suggestion for SmallIntegers. Nice addition but quite a major change in the C semantics.
The more I think about all this the more I get the impression that for most of the mentioned features one probably should not tweak the Objective-C language but rather use something completely new with a similiar syntax, working on the same runtime but without the need to stay C compatible. Like FScript or WebScript. Don't know.

Greets
Helge
--
OpenGroupware.org http://www.opengroupware.org/
_______________________________________________
objc-language mailing list | email@hidden
Help/Unsubscribe/Archives: http://www.lists.apple.com/mailman/listinfo/objc-language
Do not post admin requests to the list. They will be ignored.

References: 
 >Re: Objective-C literal constants (was: ObjC and the dual runtime issue(s)) (From: Oleg Svirgstin <email@hidden>)



Visit the Apple Store online or at retail locations.
1-800-MY-APPLE

Contact Apple | Terms of Use | Privacy Policy

Copyright © 2011 Apple Inc. All rights reserved.