I just came across Add `strict` mechanism for opting into stricter subsets of the language · Issue #54903 · JuliaLang/julia · GitHub
For me, this would be an extremely welcome development. If I can just tell my students “put this line into your package” and we solve a lot of the footguns and make the code more readable for the students on follow up projects that’s amazing.
Edit: The immediate intent to remove some foot guns and sources of bugs is well taken, and clearly articulated in the issue.
I am curious about the intended scope long term perspective for this mechanism and how it interacts with other means of backwards compatible language evolution. Maybe this is looking too far ahead, but in principle this proposal allows adding new syntax to Julia that is ignored without strict but introduces new semantics with strict. Is that an idea that people have considered?
E.g. It would be in principle possible to have something like
function f(x, y :| dont-fabulate)
fabulate(x)
fabulate(y) # disallowed in strict mode
end
Where julia version 1.24 and up ignores everything after :|
making, it valid non-strict Julia, but strict Julia has new semantic guarantees.
This would probably necessitate thinking more about the interaction of strict code and non-strict code. E.g. in this completely stupid special case, if my non y fabulating function f2
function f2(x, y :| dont-fabulate, g :| non-fabulating)
fabulate(x)
g(y)
end
is defined in a strict package, but is called with a g
is defined in a non-strict environment, what guarantees could we still get?