News for hackers. Stuff that matters.
Re:Object oriented programming with ANSI-C (1993) by Roboprog on Saturday January 04, 2014 @12:45PM (#7011992)
I had to make an application framework something like this with ANSI C in the 90s. Make a structure (or two) full of function pointers as an "interface", pass it (them) as the first parameter to all the relevant functions as "this"/"self". (wait, that kinda looks like what "Go" does - hmmmm)

Of course, some in the company tried to pad their resumes with actual (gahd-awwwful) C++. Lovely jewels like this:

    if ( output_format == A) {
        a.write_pg_header();
    } else {
        b.write_pg_header();
    }
Guess they never heard of a virtual method. Then there's the fun of all the memory leaks from copy constructors and other silly C++ pitfalls.

Simulated OOP in C is an interesting exercise. I suppose if I had not learned an OOP language other than C++ first, I would have thought C++ is just how (hard) it's supposed to be :-)

Re:Object oriented programming with ANSI-C (1993) by Roboprog on Saturday January 04, 2014 @12:49PM (#7012020)
Also did an OOP emulation a few years earlier than this using Clipper 5, of all things. No structs, but you could make constants for array indices, and assign a closure/block to each array element, using the array as a virtual method table.
Re:Object oriented programming with ANSI-C (1993) by coldcode on Saturday January 04, 2014 @01:23PM (#7012196)
I did as well in 1988, but mine was missing a lot of things as I didn't have any good examples to base it on. All I had ever read was the Smalltalk issue of Byte.