Welcome to the MacNN Forums.

If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

You are here: MacNN Forums > Software - Troubleshooting and Discussion > Developer Center > Objective-C 2.0

Objective-C 2.0
Thread Tools
Fresh-Faced Recruit
Join Date: May 2003
Status: Offline
Reply With Quote
Aug 9, 2006, 12:15 PM
 
Does anyone have any info on the additions to Obj-C in xcode 2.4? Or were there is any documentation on it?

Thanks
I am now going to tell the computer what he can do with a life-times supply of chocolate.
     
Clinically Insane
Join Date: Oct 2001
Location: San Diego, CA, USA
Status: Offline
Reply With Quote
Aug 9, 2006, 12:57 PM
 
The only "documentation" I've seen of Obj-C 2 is on Apple's Leopard preview:
So compelling, Apple wrote Xcode 3.0 itself using it. Enjoy modern garbage collection, syntax enhancements, runtime performance improvements, and 64-bit support. At your own pace, since it’s backwards compatible with existing Objective-C source. Write applications more quickly with fewer bugs using Objective-C in Xcode 3.0.
I don't believe it's supported outside of Leopard and Xcode 3, though.
Chuck
___
"Instead of either 'multi-talented' or 'multitalented' use 'bisexual'."
     
KEL9000  (op)
Fresh-Faced Recruit
Join Date: May 2003
Status: Offline
Reply With Quote
Aug 9, 2006, 03:27 PM
 
i was just interested in the improvements that are included. stinks there is no documentation.
I am now going to tell the computer what he can do with a life-times supply of chocolate.
     
Clinically Insane
Join Date: Oct 2001
Location: San Diego, CA, USA
Status: Offline
Reply With Quote
Aug 9, 2006, 03:47 PM
 
I'm betting there is documentation in the Leopard dev release, but it's not public. Few people have it now and they're mostly under NDA anyway, so the info has not been leaked yet. Give it a few weeks, I think.
Chuck
___
"Instead of either 'multi-talented' or 'multitalented' use 'bisexual'."
     
oni
Forum Regular
Join Date: Oct 2002
Location: Palmy North, New Zealand
Status: Offline
Reply With Quote
Aug 9, 2006, 08:34 PM
 
one thing i have read is automatic garbage collection! This may make me get into some obj-c cocoa programming (java dev here)
     
Fresh-Faced Recruit
Join Date: Jan 2001
Location: Provo, Utah, USA
Status: Offline
Reply With Quote
Aug 14, 2006, 05:52 PM
 
Originally Posted by KEL9000
Does anyone have any info on the additions to Obj-C in xcode 2.4? Or were there is any documentation on it?
Yeah, I'm guessing the Objective 2.0 spec is still under NDA. From what I've read, it's probably not even fully finalized yet. But there is some discussion of the "publically available" parts of it over on the Apple mailing lists... stuff culled from open source code, public announcements, etc. Quite interesting. I, too, am very much looking forward to this release!
     
Clinically Insane
Join Date: Oct 2001
Location: San Diego, CA, USA
Status: Offline
Reply With Quote
Aug 14, 2006, 07:15 PM
 
I was hoping Obj-C 2 would implement a more Smalltalk-like "everything's an object" syntax and all that, personally.
Chuck
___
"Instead of either 'multi-talented' or 'multitalented' use 'bisexual'."
     
Clinically Insane
Join Date: Nov 1999
Status: Offline
Reply With Quote
Aug 14, 2006, 09:19 PM
 
Originally Posted by Chuckit
I was hoping Obj-C 2 would implement a more Smalltalk-like "everything's an object" syntax and all that, personally.
That's not necessarily out of the question.

Frankly, though, Apple is being too tight-lipped about this, and tying Objective-C 2.0 to Leopard is just plain stupid. Apple should be trying to get these language features -or at least documentation for them- into the hands of developers as soon as possible, if it wants developers to be at all familiar with them before Leopard's release. Tying Objective-C's release to the release of another product, namely Leopard, is not a good way of doing that.
You are in Soviet Russia. It is dark. Grue is likely to be eaten by YOU!
     
Clinically Insane
Join Date: Oct 2001
Location: San Diego, CA, USA
Status: Offline
Reply With Quote
Aug 14, 2006, 09:25 PM
 
Originally Posted by Millennium
That's not necessarily out of the question.
Given what people have found out from the GCC source, it looks pretty definite that Apple is moving more in the Cocoa Bindings/Core Data direction of working common patterns into the language and tools than improving the syntax or semantics in any other way.
Chuck
___
"Instead of either 'multi-talented' or 'multitalented' use 'bisexual'."
     
Clinically Insane
Join Date: Nov 1999
Status: Offline
Reply With Quote
Aug 15, 2006, 10:45 AM
 
Originally Posted by Chuckit
Given what people have found out from the GCC source, it looks pretty definite that Apple is moving more in the Cocoa Bindings/Core Data direction of working common patterns into the language and tools than improving the syntax or semantics in any other way.
True, but everything's-an-object presents a unique problem for Objective-C: it would stand a very real chance of breaking backward-compatibility with C. Apple relies very heavily on that compatibility, and so breaking it isn't something they can afford to do lightly.

As it currently stands, what is currently missing from Objective-C's object system? NSNumber covers most scalars, NSDictionary and NSArray (and their mutable versions) cover most sequences, NSString covers strings, and NSObject underlies them all. Am I right that functions-as-objects are the major missing piece of this puzzle?
(Last edited by Millennium; Aug 15, 2006 at 10:52 AM. )
You are in Soviet Russia. It is dark. Grue is likely to be eaten by YOU!
     
KEL9000  (op)
Fresh-Faced Recruit
Join Date: May 2003
Status: Offline
Reply With Quote
Aug 17, 2006, 01:38 PM
 
to sum up the mailing list discussion: Garbage Control, Reflection, foreach, faster method calling and more are instore for Obj-C. It will be pretty sweet to have a native language that does stuff like this. I agree that Apple should be openly publishing documentation on this.
I am now going to tell the computer what he can do with a life-times supply of chocolate.
     
Grizzled Veteran
Join Date: Jan 2002
Location: Melbourne, Australia
Status: Offline
Reply With Quote
Aug 20, 2006, 07:35 AM
 
I imagine there will be plenty more documentation when it's released to the general public.
     
Clinically Insane
Join Date: Nov 1999
Status: Offline
Reply With Quote
Aug 20, 2006, 08:23 AM
 
Originally Posted by KEL9000
to sum up the mailing list discussion: Garbage Control, Reflection, foreach, faster method calling and more are instore for Obj-C.
Well, yeah, but that's actually surprisingly little information. What's the syntax: how can developers use it in their code? Does it track similar changes that GNUStep has been implementing (hopefully at least API-compatible), or does it go its own way?
You are in Soviet Russia. It is dark. Grue is likely to be eaten by YOU!
     
Clinically Insane
Join Date: Oct 2001
Location: San Diego, CA, USA
Status: Offline
Reply With Quote
Aug 20, 2006, 01:11 PM
 
From the mailing list:

- We have the syntax for properties, in both classes and protocols:
@interface MyClass : NSObject
@property int foo;
@property(getter=_getBaz,setter=_setBaz) float baz;
@end

@implementation MyClass
- (int)_getBaz { return baz; }
- (void)_setBaz: (float)newBaz { baz = abs(newBaz); }
@end

@protocol MyProtocol
@property(copies,readonly) NSString *bar;
@end

int main(void) {
MyClass *m = [MyClass new];
m.baz = -5.0;
printf("%f\n", m.baz); /* -> 5.0000 */
}

- Protocols can list required or optional methods:
@protocol MyProtocol
@optional
- (int)foo;
@required
- (void)bar: (int)arg;
@end


- The syntax for foreach is pretty obvious, but here it is anyhow:
NSArray *arr = randomListOfStrings();
for (NSString *s in arr) {
printf("%@\n", s);
}

It looks like there may be a facility for enumeration of user- defined types...

- To accomodate GC, fields can be weak:
@interface MyClass
{
__weak id some_var;
}
@end
Chuck
___
"Instead of either 'multi-talented' or 'multitalented' use 'bisexual'."
     
Fresh-Faced Recruit
Join Date: Aug 2006
Status: Offline
Reply With Quote
Aug 22, 2006, 04:41 PM
 
First up: can we put the interfaces in the .m files and ditch the .h? I mean, how 20th century...

- (void)_setBaz: (float)newBaz { baz = abs(newBaz); }

Nice!

for (NSString *s in arr) {

Nice!

m.baz = -5.0;

Very nice!

MyClass *m = [MyClass new];

Uhhh, not so nice. Or maybe it's just incomplete, can we:

MyClass *m = MyClass.new;

__weak id some_var;

*barf*
     
Clinically Insane
Join Date: Oct 2001
Location: San Diego, CA, USA
Status: Offline
Reply With Quote
Aug 22, 2006, 04:55 PM
 
Originally Posted by Maury Markowitz
First up: can we put the interfaces in the .m files and ditch the .h? I mean, how 20th century...
That would be a bigger problem with C compatibility than allowing methods on primitives.

Originally Posted by Maury Markowitz
MyClass *m = [MyClass new];

Uhhh, not so nice.
I fail to see the problem.
Chuck
___
"Instead of either 'multi-talented' or 'multitalented' use 'bisexual'."
     
Mac Elite
Join Date: Aug 2001
Status: Offline
Reply With Quote
Aug 23, 2006, 02:12 AM
 
Originally Posted by Maury Markowitz
First up: can we put the interfaces in the .m files and ditch the .h? I mean, how 20th century...
wtF? I would go INSANE without .h files.


for (NSString *s in arr) {

Nice!

m.baz = -5.0;

Very nice!
Agreed.

MyClass *m = [MyClass new];

Uhhh, not so nice. Or maybe it's just incomplete, can we:

MyClass *m = MyClass.new;

__weak id some_var;

*barf*
Let's not go overloading syntax too much. Apple is clearly making . for properties, not for methods. I'm of the opinion that having a language level distinction between the two concepts makes a good deal of sense (at least until methods become first class objects ).
     
Dedicated MacNNer
Join Date: Oct 2003
Location: Round Rock, TX
Status: Offline
Reply With Quote
Aug 24, 2006, 11:55 AM
 
Header files suck once you've tried a good IDE with say Java. Let the IDE show you the methods; who needs to edit two files? Why should I have to edit two files to create one method? Headers are so 1980s :-)

Going back to C++ from Java was, for me, a complete step back into the dark ages of programming. Header files and IDE weaknesses were a large part of that.

Is there anything like Eclipse's refactoring as a plugin for Xcode? Anything like their Quick Fixes? Xcode offers some syntax completion but that's all I've found so far. How about a simple "add method" and it adds to the .h & the .m for me, instead of me adding to one file and manually having to copy/paste to the other?

Anything like Intellij's Resharper (a C# refactoring IDE plugin)?

Refactoring, code-completion, and Quick Fix *massively* helps productivity, and it seems the C++/Obj-C world is really missing out.
     
KEL9000  (op)
Fresh-Faced Recruit
Join Date: May 2003
Status: Offline
Reply With Quote
Aug 24, 2006, 12:26 PM
 
I think organize imports is up there with refactoring and code completion in Eclipse.
I am now going to tell the computer what he can do with a life-times supply of chocolate.
     
Mac Elite
Join Date: Sep 2000
Location: Norfolk, Va
Status: Offline
Reply With Quote
Aug 24, 2006, 03:28 PM
 
Yeah tell me about it. Isn't the whole cocoa philosophy to make automatic all the things programmers use over and over again, so we can stop reinventing the wheel and focus on "the things that make our programs unique" or something to that effect? Because if that's the case, why I have to worry about missing brackets, semicolons, etc is beyond me. The actual, physical structure of the header files and the implementation should be totally hidden, presenting me only with the unique aspects of my code.

Anybody used Quartz Composer? It's in the Developer apps folder, and man, if only XCode took a few hints programming would be like more like architecture and less like robotic poetry.
you are not your signature
     
Clinically Insane
Join Date: Oct 2001
Location: San Diego, CA, USA
Status: Offline
Reply With Quote
Aug 24, 2006, 04:14 PM
 
Checked out CoreData and Cocoa Bindings? They're pretty close to the Quartz Composer-like techniques it sounds like you're describing.
Chuck
___
"Instead of either 'multi-talented' or 'multitalented' use 'bisexual'."
     
KEL9000  (op)
Fresh-Faced Recruit
Join Date: May 2003
Status: Offline
Reply With Quote
Aug 24, 2006, 05:34 PM
 
maybe they included some features in xcode3. isn't there a new interface builder also?
I am now going to tell the computer what he can do with a life-times supply of chocolate.
     
Dedicated MacNNer
Join Date: Oct 2003
Location: Round Rock, TX
Status: Offline
Reply With Quote
Aug 25, 2006, 10:08 AM
 
CoreData and Bindings are great - really good. CoreData & its IB integration has saved me hours and hours. Apple is doing a really great job at this level letting me get on with my application's value-add. Core Animation sounds like more goodness in this regard.

However, when you get to working on that level - your not UI-related application logic - Xcode doesn't offer much for that raw coding.

QuickFixes: Eclipse figures I am missing a semicolon. It'll add it for me at a keystroke. I'm not catching an exception - it'll add the code to catch it. I'm calling a method that doesn't exist? It'll create the method, correctly typed arguments, comment boilerplate and all. I forgot to declare a variable? It can add the declaration without me having to jump to the top of the method and them get back into the flow where I was typing. Once you actually come to compile in Eclipse, the chances of a compile error are very low. It assists you every step of the way.

The refactoring lets you chop and change your class hierarchy at will, pull methods up to superclasses, move this method to this other class, create an interface (protocol) from these methods, ... . Rename-anything will let you globally rename a class or method and have all references to it be updated.

I wish Xcode offered something similar for Objective-C.
     
Mac Elite
Join Date: Jul 2002
Status: Offline
Reply With Quote
Aug 26, 2006, 03:07 AM
 
Except many of those features are impossible (or quite difficult) for Objective-C, due to the large amount of dynamism inherent in it.
     
Clinically Insane
Join Date: Oct 2001
Location: San Diego, CA, USA
Status: Offline
Reply With Quote
Aug 26, 2006, 12:23 PM
 
Smalltalk was more dynamic than Objective-C and had similar abilities, if I recall.
Chuck
___
"Instead of either 'multi-talented' or 'multitalented' use 'bisexual'."
     
Dedicated MacNNer
Join Date: Oct 2003
Location: Round Rock, TX
Status: Offline
Reply With Quote
Aug 27, 2006, 10:08 PM
 
Thinine, Obj-C is dynamic: however I don't think asking Xcode to offer suggestions to QuickFix common compile errors is impossible with Obj C. Forgetting to nest a []; missing a semi-colon; misspelling a method invocation; forgetting to declare a variable: these are all things Xcode could offer fixes for - it's suggestions might not always be right, but 90% of the time they will save me time.
     
   
Thread Tools
Forum Links
Forum Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On
Top
Privacy Policy
All times are GMT -5. The time now is 10:56 PM.
All contents of these forums © 1995-2011 MacNN. All rights reserved.
Branding + Design: www.gesamtbild.com
vBulletin v.3.8.7 © 2000-2011, Jelsoft Enterprises Ltd., Content Relevant URLs by vBSEO 3.3.2