Type domain (static) integers

Type domain integers are the motivation. Types are great:

  • they can be dispatched on
  • you get type safety automatically, instead of having to implement various run time checks
  • they allow elegant compile time computation

Really don’t see where you’re coming from. Julia’s powerful type system is one of the best things about Julia.

Already addressed this in the above reply, improvements to constant propagation are independent of and complementary to type domain integers.

Not sure what you mean.

There’s @nospecialize and @nospecializeinfer when necessary.

  1. This is like asking, “why write Julia when there’s assembly language”. It’s ugly and you’re giving up on generic code. It also AFAIK puts more pressure on Julia’s compiler than my design, and results in failures sooner (for less recursion depth). And the inference is worse.
  2. As noted above, my design is more expressive than that. E.g., there are types such as NegativeInteger, NonnegativeInteger, PositiveInteger, etc. These all subtype TypeDomainInteger and it’s possible to express other types, such as GreaterThanOne, etc. Positives also subtype nonnegatives, of course.

This is addressed above. TypeDomainFloats may perhaps a good idea, but they’re less fundamental than type domain integers. TBH I don’t think I’d ever use type domain floats, but type domain rationals would certainly be nice. Will probably make a package for type domain rationals. In any case this tangent isn’t very relevant.

Don’t understand this. Underlying problems of what?

Yeah, and I’m quite proud of the type safety.

1 Like