How do we want beta reduction to treat Quats? Typically the right answer is when any variable x type X
is reduced to t type T we check that T is a subtype of X and replace it e.g:
x.foo reduce v:V -> t:T where V is CC(foo:V) and T is CC(foo:V, bar:V)
(NOTE: see the notes on Quat Shorthand Syntax in Quats.scala if unfamiliar with the syntax above)
However if T is not a subtype of X, then we need to throw an error. The exception to this is
in the case where we are substutiting a real type for a Quat.Null or Quat.Generic (roughly speaking, a 'Bottom Type').
In that case, just do the substitution.
This general behavior we call SubstituteSubtypes, it is also considered the default.
The behavior with variable-renaming in PropagateRenames is and ReifyLiftings slightly different.
In these cases, it is a carte-blanche replacement of properties that is necessary. In this case
we are either plugging in a Generic type that is being specialized (e.g. X is Quat.Generic) or
reducing some type CC(foo:V) to the corresponding renamed type CC(foo:V)[foo->renameFoo].
This general behavior we call ReplaceWithReduction i.e. Quat types are replaced with whatever
varaibles are being beta-reduced irregardless of subtyping.
How do we want beta reduction to treat Quats? Typically the right answer is when any variable x type X is reduced to t type T we check that T is a subtype of X and replace it e.g:
(NOTE: see the notes on Quat Shorthand Syntax in Quats.scala if unfamiliar with the syntax above) However if T is not a subtype of X, then we need to throw an error. The exception to this is in the case where we are substutiting a real type for a Quat.Null or Quat.Generic (roughly speaking, a 'Bottom Type'). In that case, just do the substitution. This general behavior we callSubstituteSubtypes
, it is also considered the default.The behavior with variable-renaming in
PropagateRenames
is andReifyLiftings
slightly different. In these cases, it is a carte-blanche replacement of properties that is necessary. In this case we are either plugging in a Generic type that is being specialized (e.g. X is Quat.Generic) or reducing some type CC(foo:V) to the corresponding renamed type CC(foo:V)[foo->renameFoo]. This general behavior we callReplaceWithReduction
i.e. Quat types are replaced with whatever varaibles are being beta-reduced irregardless of subtyping.