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 > macOS > Objective-C 2

Objective-C 2
Thread Tools
Horsepoo!!!
Banned
Join Date: Jun 2003
Status: Offline
Reply With Quote
Jun 27, 2006, 10:26 PM
 
From the WebKit change logs:
Switch to the new ObjC 2 API, ifdefed the old code around OBJC_API_VERSION so it still works on Tiger.
Speculations beyond this line
---------------------------------------------------------------------------
     
Chuckit
Clinically Insane
Join Date: Oct 2001
Location: San Diego, CA, USA
Status: Offline
Reply With Quote
Jun 27, 2006, 11:03 PM
 
From a cursory glance, looks like it has specifically to do with JavaScriptCore's C++->ObjC bridge.
Chuck
___
"Instead of either 'multi-talented' or 'multitalented' use 'bisexual'."
     
Thinine
Mac Elite
Join Date: Jul 2002
Status: Offline
Reply With Quote
Jun 28, 2006, 12:28 AM
 
That's where they implemented it, but it definitely sounds like a major change for Objective-C. Garbage collection and some other features are probably the reason for the version bump. Might even be some unknown features announced at WWDC.�
     
CharlesS
Posting Junkie
Join Date: Dec 2000
Status: Offline
Reply With Quote
Jun 28, 2006, 04:12 AM
 
Hoo boy, I can hear the bitching right now if they put a garbage collector in Objective-C...

Ticking sound coming from a .pkg package? Don't let the .bom go off! Inspect it first with Pacifist. Macworld - five mice!
     
Big Mac
Clinically Insane
Join Date: Oct 2000
Location: Los Angeles
Status: Offline
Reply With Quote
Jun 28, 2006, 04:27 AM
 
Isn't garbage collection a good thing? Isn't that what makes Java comparatively friendly?

"The natural progress of things is for liberty to yield and government to gain ground." TJ
     
Chuckit
Clinically Insane
Join Date: Oct 2001
Location: San Diego, CA, USA
Status: Offline
Reply With Quote
Jun 28, 2006, 04:59 AM
 
Originally Posted by Thinine
That's where they implemented it, but it definitely sounds like a major change for Objective-C.
What about the note in the changelog sounds like a major change for Objective-C?

For those interested, here is the full text of the entry in question:
Deprecated ObjC language API used in JavaScriptCore, WebCore, WebKit and WebBrowser

Switch to the new ObjC 2 API, ifdefed the old code around OBJC_API_VERSION so it still works on Tiger.
Removed the use of the old stringWithCString, switched to the new Tiger version that accepts an encoding.
Lots of code style cleanup.
JavaScriptCore.xcodeproj/project.pbxproj:
bindings/objc/objc_class.h:
bindings/objc/objc_class.mm: (KJS::Bindings::ObjcClass::~ObjcClass): (KJS::Bindings::_createClassesByIsAIfNecessary): (KJS::Bindings::ObjcClass::classForIsA): (KJS::Bindings::ObjcClass::name): (KJS::Bindings::ObjcClass::methodsNamed): (KJS::Bindings::ObjcClass::fieldNamed): (KJS::Bindings::ObjcClass::fallbackObject):
bindings/objc/objc_header.h:
bindings/objc/objc_instance.h:
bindings/objc/objc_instance.mm: (ObjcInstance::ObjcInstance): (ObjcInstance::~ObjcInstance): (ObjcInstance::operator=): (ObjcInstance::begin): (ObjcInstance::end): (ObjcInstance::getClass): (ObjcInstance::invokeMethod): (ObjcInstance::invokeDefaultMethod): (ObjcInstance::setValueOfField): (ObjcInstance::supportsSetValueOfUndefinedField): (ObjcInstance::setValueOfUndefinedField): (ObjcInstance::getValueOfField): (ObjcInstance::getValueOfUndefinedField): (ObjcInstance::defaultValue): (ObjcInstance::stringValue): (ObjcInstance::numberValue): (ObjcInstance::booleanValue): (ObjcInstance::valueOf):
bindings/objc/objc_runtime.h:
bindings/objc/objc_runtime.mm: (ObjcMethod::ObjcMethod): (ObjcMethod::name): (ObjcMethod::getMethodSignature): (ObjcMethod::setJavaScriptName): (ObjcField::name): (ObjcField::type): (ObjcField::valueFromInstance): (convertValueToObjcObject): (ObjcField::setValueToInstance): (ObjcArray::operator=): (ObjcArray::setValueAt): (ObjcArray::valueAt): (ObjcFallbackObjectImp::ObjcFallbackObjectImp): (ObjcFallbackObjectImp::callAsFunction): (ObjcFallbackObjectImp::defaultValue):
I could see it being related to a big change in Objective-C (and in fact it's been pretty obvious Obj-C is getting revamped for a while now), but the note itself says nothing to that effect as far as I can tell.
Chuck
___
"Instead of either 'multi-talented' or 'multitalented' use 'bisexual'."
     
Catfish_Man
Mac Elite
Join Date: Aug 2001
Status: Offline
Reply With Quote
Jun 28, 2006, 06:10 AM
 
Originally Posted by CharlesS
Hoo boy, I can hear the bitching right now if they put a garbage collector in Objective-C...
You mean "when", not "if". They mentioned it a while ago on the GNUStep list, and it's been mentioned in the GCC and NSObject docs.

<edit>
It could be related to http://www.tikirobot.net/wp/2006/04/...t-apple-likes/, which is just amazingly cool. I've played with it a little bit, but haven't really explored the possibilities.
</edit>
     
Millennium
Clinically Insane
Join Date: Nov 1999
Status: Offline
Reply With Quote
Jun 28, 2006, 09:16 AM
 
Originally Posted by Big Mac
Isn't garbage collection a good thing? Isn't that what makes Java comparatively friendly?
Generally speaking, yes. However, there are some holdouts who still think they can eke out a bit more performance by managing memory manually. Truth be told, garbage collectors have gotten good enough over the years that while this could theoretically be done by some kind of uberhacker, it's almost impossible to beat GC in practice.
You are in Soviet Russia. It is dark. Grue is likely to be eaten by YOU!
     
Mithras
Professional Poster
Join Date: Oct 1999
Location: :ИOITAↃO⅃
Status: Offline
Reply With Quote
Jun 28, 2006, 09:27 AM
 
I'd say this is a change in *WebKit*'s ObjC API (as opposed to its C++ API). Catfish, thanks for that link, that is really cool.
     
Millennium
Clinically Insane
Join Date: Nov 1999
Status: Offline
Reply With Quote
Jun 28, 2006, 09:32 AM
 
Originally Posted by Big Mac
Isn't garbage collection a good thing? Isn't that what makes Java comparatively friendly?
Yes. However, there are some holdouts who believe they can tweak out a bit more performance by managing memory manually. Although this is theoretically possible for some kind of uber-programmer, garbage collectors have gotten good enough over the years that it's almost impossible to beat a modern GC in practice.
You are in Soviet Russia. It is dark. Grue is likely to be eaten by YOU!
     
slugslugslug
Mac Elite
Join Date: Jan 2002
Location: Durham, NC
Status: Offline
Reply With Quote
Jun 28, 2006, 09:37 AM
 
Originally Posted by Big Mac
Isn't garbage collection a good thing? Isn't that what makes Java comparatively friendly?
I think a lot of programmers from some schools of thought believe that someone who can't handle keeping track of their own memory allocation doesn't deserve to write code. And further, that if you can handle memory allocation, you shouldn't want the compiler to do it for you.

Of course, I imagine if gc does get added to Objective-C, you can still opt not to use it. And then the macho coders who do their own memory management can try and use that as a selling point for their superior products. (prediction: users won't care)

[Edit: Since I didn't refresh before replying, didn't notice Millenium answering far more eloquently than I did.]
     
Chuckit
Clinically Insane
Join Date: Oct 2001
Location: San Diego, CA, USA
Status: Offline
Reply With Quote
Jun 28, 2006, 10:47 AM
 
Looking through the code in WebKit, I take back what I said. WebKit's API appears essentially unchanged. The changes referred to as the "ObjC 2 API" seem relatively minor too, though — no hints of major new uberfeatures. I can't figure out the meaning behind all of them, but it looks like the Objective-C runtime will be getting a more abstract C API for manipulating things rather than directly fiddling with pointers.
Chuck
___
"Instead of either 'multi-talented' or 'multitalented' use 'bisexual'."
     
saddino
Mac Enthusiast
Join Date: Nov 2003
Status: Offline
Reply With Quote
Jun 28, 2006, 10:55 AM
 
Originally Posted by Millennium
some kind of uber-programmer
Originally Posted by slugslugslug
macho coders
Did I miss the managing-your-own-memory-is-lame meme sometime in the last ten years?

The reason I prefer to manage my owm memory is that 20 years of coding in C and C++ will do that to you. There's nothing "uber" or "macho" about it; it's just a habit. So, in Objective-C, I do the same.

And even though I'm old school, I use autorelease pools, and I guess I'd use GC if (and when) it becomes available.

But if I don't, then it won't be because I'm "too cool" for it; it's just that old habits break hard.
     
P
Moderator
Join Date: Apr 2000
Location: Gothenburg, Sweden
Status: Offline
Reply With Quote
Jun 28, 2006, 11:45 AM
 
GC is a bit like parsing text in Perl. Since Perl is interpreted, one could theoretically achieve even higher performance by writing the code in C. The point is that even though it's possible to achieve better performance in C, most programmers can't, because the Perl code is pretty d a m n good.
     
slugslugslug
Mac Elite
Join Date: Jan 2002
Location: Durham, NC
Status: Offline
Reply With Quote
Jun 28, 2006, 04:08 PM
 
Originally Posted by saddino
Did I miss the managing-your-own-memory-is-lame meme sometime in the last ten years?

The reason I prefer to manage my owm memory is that 20 years of coding in C and C++ will do that to you. There's nothing "uber" or "macho" about it; it's just a habit. So, in Objective-C, I do the same.

And even though I'm old school, I use autorelease pools, and I guess I'd use GC if (and when) it becomes available.

But if I don't, then it won't be because I'm "too cool" for it; it's just that old habits break hard.
But that's you. You can admit that you do things because of habit, whereas some people have to insist that what they've become accustomed to is what's right, so rationalize with the suffering-for-good-code idea.
     
   
 
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
Top
Privacy Policy
All times are GMT -4. The time now is 06:27 PM.
All contents of these forums © 1995-2017 MacNN. All rights reserved.
Branding + Design: www.gesamtbild.com
vBulletin v.3.8.8 © 2000-2017, Jelsoft Enterprises Ltd.,