This change simplifies usage of GeneratedRuntimeChecks abstraction by the end user. With this change there is no need to care about matrialization of the checks since they will be lazily created when required. Also this facilitates future development.
Also this facilitates future development.
Could you provide a few more details on this, i.e. what the drawbacks of explicit initialization are? Personally I find the code easier to follow if things happen explicitly. Are you anticipating the need to generate the runtime checks at different points?
Do this need to be moved?
does this need to be moved?
Honestly, I find current API a bit confusing. I see the following drawbacks in priority:
- Current API is a potential source of future errors since it is easy to misplace a call to Create() or miss it completely. There is no easy way to detect the mistake.
- Negatively affects end user experience if the existing API.
- Requires code changes which could be avoided otherwise.
In the end, why should we care about explicit initialization if everything can be done automatically behind the scene?
Personally I find the code easier to follow if things happen explicitly. Are you anticipating the need to generate the runtime checks at different points?
In D75981, you already introducing two new calls to Create() and move one existing call to new place. All these changes could be avoided with lazy approach.