subset Integer < Number { .is_int }
subset MyIntLimit < Integer { . ~~ (1 .. 10) }
class MyInt(value < MyIntLimit) {
method to_s { value.to_s }
method get_value { value.get_value }
method ==(Number x) { value == x }
method ==(MyInt x) { value == x.value }
method AUTOLOAD(_, name, *args) {
var results = [value.(name)(args.map {|n| Number(n) }...)]
results.map{|r| r.kind_of(Number) ? MyInt(r.int) : r}...
}
}
var a = MyInt(2)
a += 7
say a
say a/2
var b = (a - 3)
say b
say a.as_hex.dump
a -= 6
var c = (a + b)
say c
say c.class
a *= 2
say a+b