I think the Julian way to handle this will be a macro. Note that julia compiles the code at runtime when you first call it. But I doubt you’re looking for a “runtime” error in the middle of testing your code, you’re probably hoping for something that errors out as soon as you’re done inputting the code, and that’s parse time.
I’m not sure exactly what such macros would look like, but they would really vary from one developer group to another. Another way to go would be the Jet route. Though I’m not familiar with Jet, I probably need to get familiar with it.
I’m guessing you want something like:
@enforce_rules function foo!(a,b!)
...
a[1] = 2
end
The @enforce_rules macro would walk through the code and see if there were any instances of you doing things you shouldn’t do according to whatever your own rules are for what you want to enforce.