Re: Range on Subsets

2020-01-28 Thread Tobias Boege
On Tue, 28 Jan 2020, Simon Proctor wrote: > So some recent conversations covered the Range method on numeric types like > Int > > So Int.Range gives the range of valid values -Inf^..^Inf which is neat. > > Then I thought I'd try UInt.Range and got 0..^Inf > > Ah Ha! Thinks I. I have a plan.

Re: Range on Subsets

2020-01-28 Thread Vadim Belman
UInt is just being handled individually by the core. You can override method Range by either mixin a role into your subset base type: constant MyInt = Int but role { method Range { 1...10 } }; subset OneToTen of MyInt where ...; Or by subclassing Int: class MyInt is Int { method Range { ... }

Range on Subsets

2020-01-28 Thread Simon Proctor
So some recent conversations covered the Range method on numeric types like Int So Int.Range gives the range of valid values -Inf^..^Inf which is neat. Then I thought I'd try UInt.Range and got 0..^Inf Ah Ha! Thinks I. I have a plan. What if I try this? my subset OneToTen of Int where { not