Implementing an Objective-C runtime

Discussions on more advanced topics such as monolithic vs micro-kernels, transactional memory models, and paging vs segmentation should go here. Use this forum to expand and improve the wiki!
Post Reply
User avatar
Primis
Member
Member
Posts: 62
Joined: Fri May 14, 2010 3:46 pm
Libera.chat IRC: Primis
Location: New York, NY
Contact:

Implementing an Objective-C runtime

Post by Primis »

I have an inclination towards objective-c as my language of choice. I see it as an excellent kernel level object oriented language, being a strict superset of C. However I have come across a problem. Since Objective-C is almost entirely dominated by Apple, (gnuStep is kinda there, but not really) there is NO documentation I can find for the runtime spec from the original language specification, hell I can't find a language specification. Any help on that would be nice.

As a secondary thought: what is the aversion to this? Am I missing a red flag of all this?
"On two occasions I have been asked, 'Pray, Mr. Babbage, if you put into the machine wrong figures, will the right answers come out?' I am not able rightly to apprehend the kind of confusion of ideas that could provoke such a question."
Image
User avatar
Combuster
Member
Member
Posts: 9301
Joined: Wed Oct 18, 2006 3:45 am
Libera.chat IRC: [com]buster
Location: On the balcony, where I can actually keep 1½m distance
Contact:

Re: Implementing an Objective-C runtime

Post by Combuster »

The thing to be especially wary about is that Objective-C uses runtime dynamic linking, and that initializing an Objective-C object is likely to depend on a full-blown memory manager before you even get to sending -(id)init.

Other than that, my method for porting runtime is just to drop it into your project, try building it, store the few MB of errors into a file and then go tackling the issues one at a time.

As far as specifications are concerned, there are quite a few bits and pieces hidden across developer.apple.com, but it's sadly for us mostly targeted at users, not implementers.
"Certainly avoid yourself. He is a newbie and might not realize it. You'll hate his code deeply a few years down the road." - Sortie
[ My OS ] [ VDisk/SFS ]
User avatar
Primis
Member
Member
Posts: 62
Joined: Fri May 14, 2010 3:46 pm
Libera.chat IRC: Primis
Location: New York, NY
Contact:

Re: Implementing an Objective-C runtime

Post by Primis »

As it would turn out, the Étolié Runtime from Carnegie Mellon, now shipping under the name "GNUStep-Runtime" which is part of the GNUstep project, is MIT licensed rather than the old GNU Runtime which was in fact GPL =D>
It also has been updated to modern obj-c 2.0 and supports all the things you'd expect from the OS x runtime, but slightly slower.
I guess digging deep helps sometimes. Who knew that GNUStep had MIT licensed code!
"On two occasions I have been asked, 'Pray, Mr. Babbage, if you put into the machine wrong figures, will the right answers come out?' I am not able rightly to apprehend the kind of confusion of ideas that could provoke such a question."
Image
malown
Posts: 1
Joined: Thu Dec 08, 2011 1:43 am

Re: Implementing an Objective-C runtime

Post by malown »

Hey,

Check out this project if you're looking for an alternative open implementation of the runtime https://webkeks.org/objfw/
Post Reply