News for hackers. Stuff that matters.
Re:The C Object System: Using C as a High-Level Object-Orien... by jfager on Monday March 15, 2010 @09:31AM (#1192860)
I know arxiv is where all the cool kids hang out, but here's the site and the code:

http://ldeniau.web.cern.ch/ldeniau/cos.html http://sourceforge.net/projects/cos/

Re:The C Object System: Using C as a High-Level Object-Orien... by mahmud on Tuesday March 16, 2010 @05:13AM (#1195320)
arxiv is where all non peer reviewed paper authors hangout. Most tolerant bullshit filter, evar.
Re:The C Object System: Using C as a High-Level Object-Orien... by SandB0x on Monday March 15, 2010 @09:40AM (#1192872)
There's an interesting book called Object Oriented Programming with ANSI C, which is on various websites as a PDF. As someone who didn't do computer science at undergraduate, it explained a lot about how other languages work - for example why Python passes self (well, self by convention) automatically to every method.

Edit: It's reference [40] on the paper.

Re:The C Object System: Using C as a High-Level Object-Orien... by kqr2 on Monday March 15, 2010 @12:17PM (#1193276)
Re:The C Object System: Using C as a High-Level Object-Orien... by blasdel on Monday March 15, 2010 @04:57PM (#1194102)
If you want to know how other languages could work, in the sense of an OO version of the lambda-cube, read Cardelli and Abadi's Theory of Objects: http://www.amazon.com/dp/0387947752
Re:The C Object System: Using C as a High-Level Object-Orien... by andrewcooke on Monday March 15, 2010 @10:07AM (#1192931)
wow. this looks very interesting. the web site says that it's beta. does anyone have experience / anecdotes about how solid it is? seems like it would be very useful.

also, what approach does it take to memory management and / or deciding who owns what? i'm just glancing at the paper now (should really be working) and the lack of emphasis on that seems worrying - suspect i am missing something?

[edit: replying to myself, the key phrase is "ownership"; see section 2.1: Ownership The management of object life cycles requires a clear policy of ownership and scope rules. In languages like C and C ++ where semantic by value prevails, the burden is put on the programmer’s shoulders. In languages like JAVA, C # and D where semantic by reference prevails, the burden is put on the garbage collector. In this domain, COS lets the developer choose between garbage collection (e.g. Boehm GC [25]) and manual reference counting with rich semantic (section 3.5).]

Re:The C Object System: Using C as a High-Level Object-Orien... by kraemate on Monday March 15, 2010 @09:13AM (#1192832)
How is this different or superior to languages like Objective-C and C++ ? Both provide C like syntax and have similar features as the system described here.
Re:The C Object System: Using C as a High-Level Object-Orien... by dfox on Monday March 15, 2010 @09:29AM (#1192857)
1) Objective C certainly does not provide generic functions and I doubt that Objective C++ does (C++'s static overloading is something completely different, although it might look similar).

2) And this is different exactly in that it is not a complete language, but a library of CPP macros and some supporting infrastructure.

Re:The C Object System: Using C as a High-Level Object-Orien... by m_eiman on Monday March 15, 2010 @09:44AM (#1192877)
C macros, surely.
Re:The C Object System: Using C as a High-Level Object-Orien... by dfox on Monday March 15, 2010 @09:53AM (#1192905)
CPP is "C PreProcessor", so your "C macros" are simply some subset of uses of "CPP macros". CPP can be (ab)used to preprocess other things than C source.
Re:The C Object System: Using C as a High-Level Object-Orien... by m_eiman on Monday March 15, 2010 @10:54AM (#1193078)
slaps forehead

I blame my confusion on the .cpp extensions!

Re:The C Object System: Using C as a High-Level Object-Orien... by dfox on Monday March 15, 2010 @05:04PM (#1194116)
and this confusion is exactly why I tend to use .cxx for C++ sources
Re:The C Object System: Using C as a High-Level Object-Orien... by ragh on Monday March 15, 2010 @09:53AM (#1192903)
CPP is the C Preprocessor, not to be confused with C++.
Re:The C Object System: Using C as a High-Level Object-Orien... by jedbrown on Monday March 15, 2010 @09:23AM (#1192846)
This compiles with a standard C compiler, so it's more appropriate to compare to something like GLib. Cos has faster single dispatch than Objective-C and has extensible multiple dispatch with significantly better performance than C++ (as implemented using Visitor, which is only extensible in one argument).
Re:The C Object System: Using C as a High-Level Object-Orien... by plesn on Monday March 15, 2010 @10:13AM (#1192948)
So ok, I just peeked at the paper and it seems great, but the disadvantage of being in C is that you end up with a lot of macros (like e.g. `defclass`): what with debugging?
Re:The C Object System: Using C as a High-Level Object-Orien... by jedbrown on Monday March 15, 2010 @11:18AM (#1193129)
This is a very good point and is the fatal flaw of most metaprogramming. It does seem easy to generate quite confusing error messages by making minor typos. Clang does a much better job with macro expansion errors than gcc, but it's still not great. As for actually using debuggers, it looks like you're on your own to understand the implementation enough to be useful. I don't know if it would be feasible to write a gdb plugin to improve the experience.

OTOH, Cos offers more compile-time type safety than GLib, so you might hope that you'd need to spend less time in the debugger.

Re:The C Object System: Using C as a High-Level Object-Orien... by malkia on Monday March 15, 2010 @01:43PM (#1193519)
The C preprocessor would emit #line <number> to preserver the original line numbers, this way the debugger won't get problems understanding it. This off course if the macro does not expand multiple-lines (if it does, you'll just skip all over that).
Re:The C Object System: Using C as a High-Level Object-Orien... by huhtenberg on Monday March 15, 2010 @01:29PM (#1193475)
> Objective-C

As a friend of mine likes to put it - "Objective-C is C raped by Smalltalk without proper understanding of the language anatomy". Not exactly accurate, but fairly close still :)

Re:The C Object System: Using C as a High-Level Object-Orien... by arethuza on Monday March 15, 2010 @11:34AM (#1193167)
Wow - I was ready to rant about Xt Intrinsics or something then I had a look at the article and it actually looks pretty cool.

CLOS features in C - interesting!

Re:The C Object System: Using C as a High-Level Object-Orien... by houseabsolute on Monday March 15, 2010 @04:31PM (#1194020)
My first question about this thing is how "leaky" the abstraction is. If you frequently have to make allowances for how C is not _actually_ a language with an object system, that's going to be a problem. But it seems like it should be possible (with liberal macro use) to make a relatively leak-free abstraction, and if this is it, that's pretty cool.
Re:The C Object System: Using C as a High-Level Object-Orien... by stcredzero on Monday March 15, 2010 @12:35PM (#1193336)
So, why is this (C as OO lang) a better idea now, as opposed to when it vas tried in the 80s with X windows?
Re:The C Object System: Using C as a High-Level Object-Orien... by nddrylliog on Monday March 15, 2010 @09:56PM (#1194694)
Interesting =) I'm glad such a project exists. A different approach than http://ooc-lang.org/ for sure!
Re:The C Object System: Using C as a High-Level Object-Orien... by dca on Monday March 15, 2010 @06:14PM (#1194288)
Sigh... another golden opportunity to name something the C Object Oriented Language (cool) squandered.
Re:The C Object System: Using C as a High-Level Object-Orien... by swah on Monday March 15, 2010 @11:54AM (#1193210)
There are also slides packed with the source download on Sourceforge (/doc).