Open andreasabel opened 8 months ago
This behavior is in line with SML as specified by the Definition. Poly/ML, for example, would give you a similar response. You are not the first to observe this - see this response. Unfortunately compiler extensions lead to non-portable code.
It is of course possible to work around this limitation (by inlining either Clos
or Env
), but it is not super pretty.
But I understand that standards are not easily changed, even if they made suboptimal decisions...
Maybe an extension could be implemented, similar to the -default-ann 'allowSigWithtype true'
, e.g. allowRecursiveWithtype
.
Using an annotation to support the SML/NJ-style elaboration of withtype
would be a reasonable approach. PR welcome.
SML/NJ understands this:
MLton 20210117 (latest on homebrew) gives this error:
So, it seems that the types in
withtype
do not know each other.