Removed the internal builder::builder type #112
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This is a major change to the internals of BuildIt's dyn_var type and part of the user facing API. Traditionally, for second stage expressions, BuildIt used two main types - dyn_var and builder. While dyn_var is what users declared variables with, builder was the result type for all operators (binary, unary, function call, sq bkt etc). This had a couple of issues -
We now changed this design to entirely rid of the builder type. dyn_var now can hold intermediate expressions along side standalone variables. They always had this mode for the (cast) operator, but that is the default now for all intermediates.
This however messes with operators returns a little since RVO could erroneously merge declarations with their initialization and we have no control over that. We could do something like dyn_var_mimic (old solution) but that will have the auto problem again. So we use a clever trick of returning dyn_var& instead. This disables RVO and everything works. However to return a lvalue-ref, the returning object needs to be live after the return, so we move the allocation to a separate arena. This arena minimizes the overheads of allocation while avoiding leaks. The operators like binary ops and unary ops refer to the return type of the operators on the stripped type to determine the return type.
Finally, we take this opportunity to remove support for deprecated features like inheriting from dyn_var or my_dyn_var etc. dyn_var is the ONLY way to use dyn_var now. We should probably make it final, but reserving that for later.
A lot of samples have been moved around because of removing deprecated features.