You can now do this and have it spit out this. You can see the builtin implementations here. In that example, object interpolation in strings is done by accessing the class' asString string member, but if your class has a function named toString() with a return type of string, then it also just magically works (as seen here).
The only big problem remaining (as noted in BUGS) is that we need readonly or private class members (so you can't assign directly to a color's r/g/b values).
Oh, the big benefit of this batch of changes is that you can now do:
set bgcolor = "#ff0000";
and bgcolor is of type Color, not string. so the resultant backend code looks like:
register_set(1,"bgcolor",["#FF0000", sub {
my $_ctx = shift;
return LJ::S2::Builtin::Color__Color($_ctx, "#FF0000");
}]);
Anyway ... have fun. I think the S2 language stuff is done... new work will all be on the web interface while mart finishes up the core.s2 file.