I'm experimenting with the J array language, a dynamically-typed array language with mutable assignment, subtyping, and function overloading (just like traditional APL). It is unclear to me whether statically typing the J language (without subtyping) without need for type annotation is possible.
Given that J's types are well-bounded not considering array dimensions (only arrays of simple types such as string, int, box, etc.), do the options below allow sound and decidable inference?:
Mutable assignment: Is giving a mutable value a union type to derive multiple ASTs and choose the appropriate AST at runtime correct? Are there better alternatives?
Polymorphism and overloading: Since J simple types are well bounded (which apparently makes Hindley-Milner compatible with function overloading), can I essentially forget about the array part i.e. type
Arrayof Int becomes
Int, leaving array dimension checks to the runtime?