[Grace-core] Typing of Number

Michael Homer mwh at ecs.vuw.ac.nz
Tue Jun 21 15:02:05 PDT 2011


On Wed, Jun 22, 2011 at 9:32 AM, James Noble <kjx at ecs.vuw.ac.nz> wrote:
> For Numbers I'm kind of leaning towards the   "type Number { method +(other : selftype) : selftype }
> route but I'm not sure if that would actually work.
I don't think it does:
  type Rational {
    +(other: Rational) -> Rational
  }
  var a : Number = 3
  var b : Number = 2.b64
  a + b // OK, Number.+(Number) -> Number
That will fail at runtime in a supposedly type-safe place. It's
dynamic typing with false security.
-Michael


More information about the Grace-core mailing list