Hacker Newsnew | comments | show | ask | jobs | submit login

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).



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?

-----


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.

-----


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).

-----




Applications are open for YC Winter 2016

Guidelines | FAQ | Support | API | Security | Lists | Bookmarklet | DMCA | Apply to YC | Contact

Search: