Is it likely to become a part of the public API in the future? Or is this strictly for internal use, and package developers are discouraged from using it?
This often helps with type inference, so it would be great to have the possibility of using it in packages, with some stability guarantee.
help?> Base.@constprop
@constprop setting ex
@constprop controls the mode of interprocedural constant propagation for the annotated function. Two settings are
supported:
• @constprop :aggressive ex: apply constant propagation aggressively. For a method where the return type
depends on the value of the arguments, this can yield improved inference results at the cost of
additional compile time.
• @constprop :none ex: disable constant propagation. This can reduce compile times for functions that
Julia might otherwise deem worthy of constant-propagation. Common cases are for functions with Bool- or
Symbol-valued arguments or keyword arguments.
I think the answer here is that for unexported functions like this, we aren’t willing to make as strong guarantees as we do for exported and documented ones, but if something like this becomes widely used in the ecosystem, we aren’t just going to break everything without consideration for the consequences. But if you write code that uses things like Base.@pure and Base.@constprop then you should be prepared that at some point, with due warning, you might have to change your code.