discuss-gnustep
[Top][All Lists]
Advanced

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

Re: ObjC additions (Was: Re: PROPOSAL: Objective-C++)


From: Dan Pascu
Subject: Re: ObjC additions (Was: Re: PROPOSAL: Objective-C++)
Date: Tue, 20 Nov 2001 15:45:59 +0200 (EET)

On 20 Nov, Pascal Bourguignon wrote:
>>      array = @(@"Item 1", @"Item 2");
> 
> I don't see the difference with:
> 
>    NSArray* array=[NSArray arrayWithObjects:@"Item 1",@"Item 2",0];
>  
>> or
>>      ConstantNumber *intValue    = @1;
>>      ConstantNumber *doubleValue = @1.0;
> 
> or with:
> 
>    NSNumber* intValue=[NSNumber numberWithInteger:1];
>    NSNumber* doubleValue=[NSNumber numberWithDouble:1.0];
>  
>> And even dictionaries:
>>      ConstantDictionary *dict = @{@"Key" = @"Value"};
> 
> or with:
> 
>    NSDictionary* dict=[NSDictionary dictionaryWithObjectsAndKeys:
>                            @"Key1",@"Value1", 
>                            @"Key2",@"Value2", 
>                            0];

Less typing maybe? Your examples are twice as long (even longer).
Also more compact syntax? Easier to use too?

> You could even add some macros such as:
> 
> #define BD [NSDictionary dictionaryWithObjectsAndKeys:
> #define ED   ,0]
> 
> to be able to write:
> 
>    ConstantDictionary* dict = BD @"Key", @"Value" ED;

Eeek. That's UGLY. I wouldn't do that even in plain C.

>> What do you thing about it?
> 
> I don't think it's needed.

You can live without indeed, but it would be nice to have.

-- 
Dan




reply via email to

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