3 ms·
There is no reason why it could not continue to use the exact representation and operations if it wished (and that's what FatRat does). It's just an ill-concei
by moonchild 3y ago
There is no reason why it could not continue to use the exact representation and operations if it wished (and that's what FatRat does). It's just an ill-conceived concession to performance.
- librasteve 3y agoand yet, raku is the first serious attempt to unify Int-Rat-Num-Complex types into a cooperative Numeric space --- which I think is a good design given its untyped default approach
- moonchild 3y agoCommon lisp and scheme have had proper numeric towers without this problem for decades.
- librasteve 3y agook - but raku has a reinvention of Numeric that is less esoteric, and more practical ... what you mention is that an Int isa Rat isa Real isa Complex isa Numeric ... and thus in Scheme or Lisp, then the Number Tower class model is one of subsetting features as you go down to an Int which is counter to the reality in your computer than an Int is just a 64-bit register in raku, for example, an Int is not an isa (grand)child of Complex (and so doesn't carry that overload) ... but yes it is a Real so raku separates Real from Complex and Int from Rat and you can go eg. my $x = 1 ~~ Rat; #False and this is aligned with literals - 1 vs 1.1 and then you play nice if things overflow see https://docs.raku.org/assets/typegraphs/Numeric.svg https://docs.raku.org/assets/typegraphs/Numeric.svg