discuss-gnustep
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Accessing array members without the use of objectAtIndex


From: Andreas Fink
Subject: Re: Accessing array members without the use of objectAtIndex
Date: Sat, 14 Apr 2018 14:39:57 +0200

This is mainly a question of if the compiler is able to do this newer ObjC2.0 syntax.
clang does it nicely. Not sure if gcc can these days. Some older gcc versions where for sure not capable which was the reason for me to switch all to clang, given the new syntaxes saves you a lot of writing.

The syntax 

 id a =  someobject[x] ;

will translate into a call like this

a =[someobject objectForKeyedSubscript:x];

The syntax

someobject[x]  = a;


will translate into a call like this

[someobject setObject:a for keyedSubscript:x]



On 14 Apr 2018, at 01:03, tyler mclean <sonarsoundapplications@gmail.com> wrote:

Greetings developers,

I want to preface this question by saying that this project is
impressive. My question is, is there a way to access members of
NSArray or NSMutableArray like an array with the GNUstep framework or
is that a function that currently only sits with the current Apple
architecture of the language/libraries?

e.g
NSMutableArray *myArray = [[NSMutableArray alloc] init]; //This will
be an array of NSStrings
. . .
NSLog(@"%@", myArray[0]);

instead of

NSLog(@"%@", [myArray objectAtIndex:0]);

while this particular example does not create much bloat, repeated
need to access members can make code substantially larger than that of
it's counterpart on Apple's end. If so, what do I need to do to start
using this feature. Else if not, is there a plan to add this in the
(hopefully near) future?

Thanks,
Tyler McLean

_______________________________________________
Discuss-gnustep mailing list
Discuss-gnustep@gnu.org
https://lists.gnu.org/mailman/listinfo/discuss-gnustep

Andreas Fink
------------------------------------------------------------------
Fink Telecom Services, Paradieshofstrasse 101, 4054 Basel, Switzerland
Mobile: +41-78-6677333
Skype: andreasfink    Jabber/XMPP: andreas@fink.org ICQ: 8239353
------------------------------------------------------------------






reply via email to

[Prev in Thread] Current Thread [Next in Thread]