Objectively: OO framework for GNU C
Moderator: InsideQC Admins
5 posts
• Page 1 of 1
Objectively: OO framework for GNU C
Recently I had the idea of building an MVC framework atop SDL2 and OpenGL for (primarily) games. I'm fond of Apple's Foundation and UIKit frameworks, and thought modeling mine after those might be wise. To do that faithfully, retaining most of the idioms that make those frameworks sing, I needed OO, but I'm not a fan of C++.
So I started hacking on an OO implementation in C:
https://github.com/jdolan/objectively
Features:
API Documentation:
http://jaydolan.com/projects/objectively/hierarchy.html
With Foundation mostly implemented, I'll be starting on UIKit soon. It should get really fun from there on in. So that's that. Questions, feedback, etc.. very welcome.
So I started hacking on an OO implementation in C:
https://github.com/jdolan/objectively
Features:
- Single-parent inheritance through starts-with structure composition
Class and instance methods with strongly typed interfaces
Automatic class loading and lifecycle management
Automatic memory management with reference counting
Object primitives for Boolean, Date, Null, Number, String
Mutable and immutable collections variants such as Array and MutableDictionary
JSON parsing, marshaling and introspection with JSONSerialization and JSONPath
Low-level concurrency constructs such as Lock, Condition, and Thread
High-level concurrency with Operation and OperationQueue
Resource loading via Internet protocols with URLSession and URLSessionTask
API Documentation:
http://jaydolan.com/projects/objectively/hierarchy.html
With Foundation mostly implemented, I'll be starting on UIKit soon. It should get really fun from there on in. So that's that. Questions, feedback, etc.. very welcome.
-

Jay Dolan - Posts: 59
- Joined: Tue Jan 22, 2008 7:16 pm
- Location: Naples, FL
Re: Objectively: OO framework for GNU C
Plain C with OO and a nice collection lib ? Woah.
Still reading the documentation, but so far I like what I see.
I'll download and play a bit with this later.
Impressive work. Thanks for sharing.
Still reading the documentation, but so far I like what I see.
I'll download and play a bit with this later.
Impressive work. Thanks for sharing.
I know FrikaC made a cgi-bin version of the quakec interpreter once and wrote part of his website in QuakeC
(LordHavoc)
-

frag.machine - Posts: 2090
- Joined: Sat Nov 25, 2006 1:49 pm
Re: Objectively: OO framework for GNU C
Personally I'd just use C++, picking and choosing the bits of it I like, or that make sense to use, or that don't have a syntax that makes Brainfuck look sensible. There seems a huge element of "Not Invented Here" involved in designing your own OO framework on top of C.
We had the power, we had the space, we had a sense of time and place
We knew the words, we knew the score, we knew what we were fighting for
We knew the words, we knew the score, we knew what we were fighting for
-

mh - Posts: 2292
- Joined: Sat Jan 12, 2008 1:38 am
Re: Objectively: OO framework for GNU C
frag.machine wrote:Plain C with OO and a nice collection lib ? Woah.
Still reading the documentation, but so far I like what I see.
I'll download and play a bit with this later.
Impressive work. Thanks for sharing.
Right on! Looking forward to your feedback. I'm on a Mac, but I've been compiling it on Debian periodically to make sure that it's Linux-friendly. Hopefully it Just Works for you.
-

Jay Dolan - Posts: 59
- Joined: Tue Jan 22, 2008 7:16 pm
- Location: Naples, FL
Re: Objectively: OO framework for GNU C
mh wrote:Personally I'd just use C++, picking and choosing the bits of it I like, or that make sense to use, or that don't have a syntax that makes Brainfuck look sensible. There seems a huge element of "Not Invented Here" involved in designing your own OO framework on top of C.
No, it's not like that. I'm the first programmer to use libraries where appropriate. For example, Quake2World is one of the most stripped-down Quake engines out there, leaning heavily on glib and SDL. But in order to write OO code in C, I really wasn't very impressed with the options:
GObject? Huge, awkward and gross. And at the end of the day, even after you jump through all of its hoops, you don't get OO semantics. You just get a really longwinded C API to manipulate an object-centric data model. GObject becomes useful if you bind to it from, or wrap it with, a higher-level language (Vala), but I wanted to stay in C.
Mowgli? Small and not gross, but again, no OO semantics even after you complete all of the [runtime!] boilerplate to build your Object model.
Objectively is different. It's strongly typed with compile-time checking of all method invocations, because the interfaces are structs. It's concise, there's no boilerplate to initialize types at runtime, and it offers real OO semantics.
Did you take a peek at the test cases? They do a decent job of showing off the syntax and API.
https://github.com/jdolan/objectively/t ... bjectively
Anyway, people who like C++ will generally not like this project.. so there's that.
-

Jay Dolan - Posts: 59
- Joined: Tue Jan 22, 2008 7:16 pm
- Location: Naples, FL
5 posts
• Page 1 of 1
Who is online
Users browsing this forum: No registered users and 1 guest