Even if allocated const the compiler often won't see that (cross TU, too many layers). Also, often it's not actually desirable to have the value be constant for the whole lifetime. It's just for a region of code. Unless I copy the value I cannot make C[++] recognize that.
Passing a query execution plan by value would be way too expensive. There's a lot of query execution time datastructures that should not be copied, and need to be mutable, but there are sections where we know they can't change.
-
-
And const [references] doesn't do much for my cases (see upthread). I agree that assume seems like a poor fit, it seems more like a type system level issue. But I'd take anything :)
-
I think I understand where you're coming from, but assumptions are not for that. Assumptions are for local things. They are there to trigger certain optimisations in a certain line of code, not to reason about functions across different TUs. I think you need another feature.
- 6 more replies
New conversation -
Loading seems to be taking a while.
Twitter may be over capacity or experiencing a momentary hiccup. Try again or visit Twitter Status for more information.