• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: Cocoa runtime VM?
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Cocoa runtime VM?


  • Subject: Re: Cocoa runtime VM?
  • From: ObjM2 <email@hidden>
  • Date: Fri, 29 Jul 2005 17:37:23 +0900


On Jul 29, 2005, at 6:45 AM, Damien Bobillot wrote:

There are langages using a garbage collector with compliers able to create native code. I often use a langage called ocaml (it's a functionnal langage like lisp) with. There also exists garbage collectors for C/C++ programms.

Keep in mind that strictly speaking Objective-C itself doesn't come with built-in memory management. Both the reference counting and autorelease pool based schemes are available through methods of the root class, which means we have a choice to use either of them or even to supply our own alternative.


There is nothing that stops you from implementing a garbage collector and then use it in pretty much the same way as we now use autorelease pools, for example ...

SomeClass *garbageCollectedInstance = [[[SomeClass alloc] init] gc];

where gc is a method that works analogous to autorelease, marking its receiver garbage collectable for the garbage collector to manage it in a garbage collected memory pool.

This would not require any changes to the language itself which shows the flexibility of the Objective-C design. Also interesting to note that you can choose which memory management scheme you want to use for every object you instantiate. You don't usually get this choice with languages that have garbage collectors built into the language, like Java.

I'd like to comment that in our discussion about creating a new dialect of Modula2, Objective-M2 we have discussed adding a garbage collector that would be used in the way I described in the above example code. So, if we get this project off the ground, participants and resources permitting we may well implement such a garbage collector at some point and since we aim for object and binary compatibility with Objective-C, this would then also be available from Objective-C.


(many virtual machines are used for high level langages or recent langages like java or C#, so VM => GC is generaly true ;))

The mother of all byte-code compiled languages is quite UCSD Pascal and it's p-code compilers, which is where Java borrowed the idea from in the first place. UCSD Pascal didn't have garbage collection, so one might as well use this precedent to argue the opposite and say that garbage collection is clearly an unrelated add-on to byte-code compiled designs.



Currently, there's no VM/bytecode for Obj-C (the gcc and CW compilers compile to native code, and I've never heard of other Obj- C compilers).

And this is quite intentional. Remember that Objective-C was meant to marry Smalltalk message passing with a mainstream language that produced fast native code and could be used for system programming.


Smalltalk performance wasn't quite considered adequate and while both hardware and compiler technology have significantly improved in performance, one cannot possibly claim that byte-code compiled languages are suitable for system level development.

However, for those who'd like an interactive Objective-C like environment there is F-Script.

rgds
ObjM2




___________________________________________________________ Yahoo! Messenger - NEW crystal clear PC to PC calling worldwide with voicemail http://uk.messenger.yahoo.com
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Cocoa-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:

This email sent to email@hidden
References: 
 >Cocoa runtime VM? (From: Robert MacGregor <email@hidden>)
 >Re: Cocoa runtime VM? (From: John Stiles <email@hidden>)
 >Re: Cocoa runtime VM? (From: Damien Bobillot <email@hidden>)

  • Prev by Date: Re: NSBrowser bug?
  • Next by Date: Re: Cocoa and Apple Event
  • Previous by thread: Re: Cocoa runtime VM?
  • Next by thread: Re: Cocoa runtime VM?
  • Index(es):
    • Date
    • Thread