class Point {
public float x;
public float y;
public Point(float x, float y) {
this.x = x;
this.y = y;
}
public String toString() {
return "(" + x + ", " + y + ")";
}
}
This hurts. Fortunately, we've already made that pain go away in Ceylon.Well that seems like a laudable goal. Let's take a look at the example code, then, to see what the alternative is:
class Color {
shared Integer rgba;
//default constructor
shared new (Integer rgba) {
assert (0 <= rgba <= #FFFFFFFF);
this.rgba = rgba;
}
...
string => "Color { \
alpha=``hex(alpha)``, \
red=``hex(red)``, \
green=``hex(green)``, \
blue=``hex(blue)`` }";
}
Maybe it's just me but it looks like the pain is still there?