News for hackers. Stuff that matters.
Re:Java Was Strongly Influenced by Objective-C by nikster on Wednesday December 26, 2012 @09:11PM (#4971999)
I can't help but think that ARC has pretty much killed garbage collection. Why use garbage collection at all when you have a static equivalent that works just as well?
Re:Java Was Strongly Influenced by Objective-C by rayiner on Wednesday December 26, 2012 @09:16PM (#4972020)
ARC doesn't work just as well. At least theoretically, ARC retains a lot more garbage because the compiler has to be much more conservative about reachability than the garbage collector. ARC has theoretical failure modes that can cause huge amounts of retained garbage, and that's less well-understood than the failure modes of GC. Doing reference count updates is also generally slower in terms of CPU cycles than doing garbage collections. Oh, and ARC doesn't handle cycles.

That said, I think reference counting warrants more attention than it has gotten in memory management research. If you're willing to punt on the leaking cycles issue, you can get a lot of mileage out of using a reference counting collector as a tenured generation with a copying nursery.

Re:Java Was Strongly Influenced by Objective-C by stcredzero on Wednesday December 26, 2012 @11:19PM (#4972318)
> you can get a lot of mileage out of using a reference counting collector as a tenured generation with a copying nursery.

Are there implementations one can play with?

Re:Java Was Strongly Influenced by Objective-C by rayiner on Thursday December 27, 2012 @10:41AM (#4973626)
I think MMtk might have an implementation of the technique. There are some papers on it: http://www.cs.technion.ac.il/~erez/Papers/AzatchiPetrankCCPE...
Re:Java Was Strongly Influenced by Objective-C by aaronbrethorst on Wednesday December 26, 2012 @09:25PM (#4972048)
ARC has absolutely killed garbage collection.

    Important: Garbage collection is deprecated in OS X v10.8. You should use ARC
    instead—see Transitioning to ARC Release Notes.
https://developer.apple.com/library/mac/#documentation/Cocoa...

Whether ARC is better or worse than GC overall is immaterial. Apple has moved away from garbage collected Objective C.

Re:Java Was Strongly Influenced by Objective-C by jonknee on Wednesday December 26, 2012 @09:51PM (#4972117)
> ARC has absolutely killed garbage collection

... In Apple's Sandbox. Apple has also killed ethernet and other very not-dead in the real world things.

Re:Java Was Strongly Influenced by Objective-C by i386 on Wednesday December 26, 2012 @10:13PM (#4972174)
Killed ethernet? Thats a somewhat ill-informed statement to make. The latest iMac still has an ethernet port.

They did remove it from their line of portables as most people use wireless with their laptops (and they scored some valuable real-estate on the main board!) but you can get a Thunderbolt network card if you really want to be tethered to your desk.

Re:Java Was Strongly Influenced by Objective-C by jonknee on Wednesday December 26, 2012 @10:51PM (#4972267)
Ah, the iMac that you still can't buy (end of the year is a really strange time to have no inventory of your new flagship desktop)... But that's another rant.

Apple's computers (desktops included, save for the Mac Pro which is essentially EOL) no longer have an optical drive, maybe I should have used that instead. I saw a coworker hunting for his MacBook's ethernet port today, so it was was fresh in my mind.

Re:Java Was Strongly Influenced by Objective-C by jcromartie on Thursday December 27, 2012 @09:11AM (#4973342)
I honestly can't remember the last time I used an optical drive (and I have one in my MBP). Alternatives are superior in virtually every way.
Re:Java Was Strongly Influenced by Objective-C by jonknee on Thursday December 27, 2012 @11:31AM (#4973811)
If you have an always on, reasonably fast and unmetered broadband connection perhaps. I understand it on the laptops, but desktops have plenty of available space so they're removing them simply for the sake of removing them.

I don't use the optical drive on my iMac much, but the times I have had to were not times I would have been able to avoid. I don't want yet another accessory/dongle or one less USB port. There's tons of room, just include the drive.

This came up recently with trying to install Windows inside Parallels on my girlfriend's laptop. Their IT people had a DVD and of course her laptop has no DVD drive, so I looked up how to use Remote Disc and found out that it works great except explicitly not for installing an OS and oddly almost all the other common uses of an optical disc.

http://support.apple.com/kb/HT5287

These types of discs are not supported by DVD or CD sharing: These types of discs are not supported by DVD or CD sharing: DVD movies, Audio CDs, Copy protected discs such as game discs, Install discs for an operating system such as Microsoft Windows (for use with Boot Camp), or Mac OS X.

Re:Java Was Strongly Influenced by Objective-C by gurkendoktor on Wednesday December 26, 2012 @10:15PM (#4972180)
If Apple does not take care that its frameworks behave well with a GC app, you are likely in for a masochistic rollercoaster ride.

Apple also hasn't killed Ethernet, the desktops still have it.

Re:Java Was Strongly Influenced by Objective-C by mpweiher on Thursday December 27, 2012 @05:19AM (#4972946)
It's easy to get into a world of hurt even when Apple does its best to make their frameworks well-behaved with GC.

Retrofitting a conservative GC onto C is really hard, and they were never able to fully make it work. If you look at the Boehm collector's page, you see a lot of potential issues that can and do arise. Having these issues in an optional add-on that you adopt (or not) after weighing the issues is one thing, having them in a system-component that is declared to (a) be the future and (b) "Just Work™" is another.

http://www.hpl.hp.com/personal/Hans_Boehm/gc/issues.html

Re:Java Was Strongly Influenced by Objective-C by bronxbomber92 on Thursday December 27, 2012 @12:21AM (#4972454)
I think he meant more generally. ARC, as a general algorithm, has killed the need for garbage collection, as a general algorithm [I]anywhere[/I]. As supposed to what you're saying: ARC, Apple's implementation of ARC, has persuaded Apple to abandon their GC implementation. These are two very different meanings (but yes, in Apple's case ARC has killed GC because of particular characteristics and needs of Apple's developer toolchain and environment).
Re:Java Was Strongly Influenced by Objective-C by mikeash on Wednesday December 26, 2012 @09:14PM (#4972005)
It doesn't work nearly as well. ARC doesn't handle cycles at all, which makes it substantially more painful to use than a garbage collector. Don't get me wrong. ARC is great compared to the previous situation, but it's simply not a substitute for a real GC.

Automatic reference counting dates back to probably the 1950s. If it "works just as well" as garbage collection, don't you think it would have won by now?

Re:Java Was Strongly Influenced by Objective-C by seanmcdirmid on Wednesday December 26, 2012 @10:12PM (#4972169)
One day a student came to Moon and said, "I understand how to make a better garbage collector. We must keep a reference count of the pointers to each cons." Moon patiently told the student the following story - "One day a student came to Moon and said, "I understand how to make a better garbage collector...

http://www.csd.uwo.ca/staff/magi/personal/humour/Computer_Fo...

Re:Java Was Strongly Influenced by Objective-C by mikeash on Wednesday December 26, 2012 @10:12PM (#4972172)
This makes me paranoid that you can read my thoughts.
Re:Java Was Strongly Influenced by Objective-C by seanmcdirmid on Wednesday December 26, 2012 @10:21PM (#4972202)
Why? The garbage collection koan is common knowledge among compiler and PL people, I just took some initiative.
Re:Java Was Strongly Influenced by Objective-C by mikeash on Wednesday December 26, 2012 @10:23PM (#4972211)
It's a joking way to indicate that this is exactly what I was thinking of when I wrote my comment.
Re:Java Was Strongly Influenced by Objective-C by krichman on Wednesday December 26, 2012 @11:26PM (#4972332)
ARC is terrible, I've had far more errors with it than I ever did without.
Re:Java Was Strongly Influenced by Objective-C by Apocryphon on Wednesday December 26, 2012 @11:47PM (#4972377)
Do tell, please.
Re:Java Was Strongly Influenced by Objective-C by jcromartie on Thursday December 27, 2012 @09:15AM (#4973351)
Curious... I've never had a problem with it.
Re:Java Was Strongly Influenced by Objective-C by darknoon on Thursday December 27, 2012 @03:21AM (#4972783)
rdar? I'm calling BS on this.
Re:Java Was Strongly Influenced by Objective-C by ynniv on Wednesday December 26, 2012 @09:17PM (#4972026)
Besides memory fragmentation?