distinctBase overload for values #13746
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.
the overload for values (instead of types) is the one that's needed most often, and writing it inline everywhere or define their own helper for that everywhere needed is pointless and encourages the worse alternative
getFoo(args).Bar
out of laziness, see below.example 1
example 2
when
$
for a distinct type is not defined in scope, you can do:this provides a more flexible alternative to the ones discussed in nim-lang/RFCs#203 since we have fine grained control over which distinct fields get shown
note
a lot of time has passed since #8531 (comment) and my experience shows this overload is indeed needed. There is no bloat since that symbol is already defined anyways.