With respect to Jamii’s suggestion to catch occurrences of 15276 with static compile-time checking, what do you propose to do if a potential instance of 15276 is observed in the code? As I mentioned in an earlier post, the core developers have previously expressed opposition to compile-time warnings for legal code (see: Cannot use size(::Array{Int, 2}): ERROR: LoadError: UndefRefError: access to undefined reference - #25 by Stephen_Vavasis).
With regard to Jeff Bezanson’s explanation of why my proposed language restriction won’t solve the problem, how about the following. Introduce a new operator ::: which means that a variable occurring in an expression (presumably inside a closure) has a promised type, something like this:
function t(s)
a = s / 9
x = Set((a:::typeof(s))^2 + a * i for i = 1 : 10)
return x
end
Would introduction of this operator make the problem go away?