refactor: Improve returning
and with
.
#551
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 addresses and fixes #547 to some extend. The goal was to allow compilation of
without aliasing the
person
node withas
.This could be achieved by allowing
IdentifiableElement
on thereturning
methods the same way this PR does with thewith
methods. However, in contrast towith
,return
does allow non-aliased expressions, so the overload taking inExpression
must continue to exists. That will rule out to add another overload with aCollection<SomethingElse>
, as they will have the same type erasure as existing methods. Adding a varg ofIdentifiableElement
will break a gazillion lines of code, even in our tests, as the method will then be ambiguous.I think the original sin was having
Node
andRelationship
indirectly implementNamed
throughPropertyContainer
. If that wasn't the case,Named
could become an expression and things will resolve nicely without additional overloads.That change however would take several engineering weeks and turn the DSL inside out and can't be part of this change.
We created #550 for the next major release after
2023.0.0
to track this issue.This change here will require some changes to calling code of
with
, but getting rid of about 250 LoC is worth the change, in addition,with
will actually be nicer.