News for hackers. Stuff that matters.
Re:Object-oriented Programming with ANSI-C (1993) [pdf] by gjvc on Wednesday June 21, 2023 @03:40PM (#36423309)
* * *
Re:Object-oriented Programming with ANSI-C (1993) [pdf] by omgmajk on Wednesday June 21, 2023 @06:10PM (#36425381)
Would be interesting if it was actually. Kinda feel like playing with this for fun.
Re:Object-oriented Programming with ANSI-C (1993) [pdf] by wtetzner on Wednesday June 21, 2023 @06:48PM (#36425763)
Here's a new library that provides OOP in C: https://github.com/gyrovorbis/libgimbal
Re:Object-oriented Programming with ANSI-C (1993) [pdf] by omgmajk on Thursday June 22, 2023 @06:48AM (#36430230)
Cool, will look at it for inspiration :)
Re:Object-oriented Programming with ANSI-C (1993) [pdf] by gyrovorbis on Friday June 23, 2023 @01:43AM (#36443241)
I'm the author of the libGimbal project linked to there. It's a massive object-oriented C codebase with an entire cross-language type system that was inspired by GTk's GObject, Microsoft COM, and the Objective-C language.

I've studied everything out there on achieving OOP in C, and actually the OP's book reference was my original inspiration. There's a fine art to doing it and a few good codebases are out there that do it well... The entire GNOME stack is based on this kind of stuff.

Anyway let me know if you have any questions. lol.

Re:Object-oriented Programming with ANSI-C (1993) [pdf] by omgmajk on Saturday June 24, 2023 @02:55PM (#36461627)
Hey dude, awesome work and thanks! I'm mostly interested in a curious kind of way, I really enjoy programming procedurally mostly but sometimes being able to utilize OOP for certain things is very nice.

Really in the end I should just make my own language but who has the time right.

In any case, fascinating stuff and thanks again!

Re:Object-oriented Programming with ANSI-C (1993) [pdf] by JohnFen on Wednesday June 21, 2023 @06:45PM (#36425731)
I'm doing OOP in C right now in my work. I'm porting a C++ program to a new platform and, for reasons, the most feasible language to use for it is C.

Re-engineering the code to be not object oriented is not practical, so we're keeping its OO nature.

Re:Object-oriented Programming with ANSI-C (1993) [pdf] by proxyon on Wednesday June 21, 2023 @10:10PM (#36427226)
What's the point of refactoring C++ to C? That sounds weird and regressive.
Re:Object-oriented Programming with ANSI-C (1993) [pdf] by acuozzo on Thursday June 22, 2023 @02:23AM (#36428603)
No C++ compiler for the target architecture?
Re:Object-oriented Programming with ANSI-C (1993) [pdf] by JohnFen on Thursday June 22, 2023 @11:01AM (#36433185)
For subtle technical reasons relating to the toolchain, it's not possible to use C++ for this platform.

Well, it is possible, but it would easily take four times the amount of time it would take to port the C++ code to C. So porting makes the most sense.

Re:Object-oriented Programming with ANSI-C (1993) [pdf] by gyrovorbis on Friday June 23, 2023 @01:41AM (#36443225)
There are a few niche reasons. The entire GNOME/GTk stack benefits greatly in the realm of language interop from being C at its core. This is why it easily has bindings to every language ever.
Re:Object-oriented Programming with ANSI-C (1993) [pdf] by j1elo on Wednesday June 21, 2023 @07:24PM (#36426134)
You'll do object-oriented programming with C in 2023 if you want to use the main official API of the GStreamer multimedia framework [1], which is C-based and heavily using GObject object model [2], which itself is part of GLib (the underlying library of GTK)

[1]: https://gstreamer.freedesktop.org/documentation/gstreamer/gs...

[2]: https://docs.gtk.org/gobject/

Re:Object-oriented Programming with ANSI-C (1993) [pdf] by gyrovorbis on Friday June 23, 2023 @01:47AM (#36443257)
This. The entire GNOME stack is based on a steroided-out C-based OO type system in the same vein as the OP's PDF... and it's actually how it gets bindings to every language ever so easily...

Anyway, I was sent down a rabbit hole of wanting to do object-oriented C for a language independent core as well, starting off with buying the physical copy of this PDF, because I liked it so much...

I have to say GStreamer is probably the absolute best, most ambitious, shining example of such a type system, as it's already built upon GObject, fixes a lot of its shortcomings, and just really takes the whole thing to the next level with a complex, highly OO architecture. Fantastic reference and inspiration for this kind of stuff.