Type system revision (#18457)


At JuliaCon this summer, I’d brought up an issue I’d found, where the expressions for the types of the members were evaluated when type is first created, which isn’t correct if the expressions depend on any of the TypeVars from the parameters to the type. At that time, Jeff said that yes, it could be fixed, and I’d been hoping that it would be done as part of the type system rewrite PR. However, testing it tonight, that doesn’t seem to be the case yet.

Fixing this issue can make many types a lot cleaner, where they have need to have values that are dependent on one or more parameters. For example, calculating the number of limbs needs to store a number.
(currently, this problem is worked around by adding a bunch of extra parameters, that are calculated in the constructor, but that’s not a very clean or intuitive way of handling it.

Other than that issue still being present, the type system rewrite seems very nice!


As far as I know that’s still on the roadmap. It is orthogonal to the type system rewrite however, because it has no effect on subtyping or method definitions, only on the member types of fields.


Has there been any progress on this issue?


Yes, the type system is fully revised in 0.6:

The majority of packages are updated for these changes.


I think @ScottPJones is talking about something along the lines of https://github.com/JuliaLang/julia/issues/18466

Recently the milestone of this was changed from 1.0 to 2.0+. So while the type system revision is awesome, for this specific feature we will have to wait a little longer.


Yes, that’s precisely what I’m talking about.
I wish this were given a bit more priority, because it can make a big difference when creating types,
and not forcing internal information to become part of the type signature (for example, the number of limbs needed to store a number of a particular precision)


I was basing my answer on the title of the thread and PR number – that feature was never slated as part of the type system revision. It still could happen in the future, but it would likely be a post-1.0 feature.