Add yield
to collection for
#4024
Labels
feature
Proposed language feature that solves one or more problems
yield
to collection for
#4024
I constantly feel that
collection for
is almost there, but not there. It allows some cool syntax for simple cases, but constantly I need to add just a few more steps, like getting data from an async call, then deciding if I should add it to the list or not.With the current syntax, we can use
{}
, so we are restricted to simple 1 line cases.This made me think that we might (I am not aware of the complexity) combine generators and
collection if
(at least in the syntax, merging their functionality might make the code more complex or with worse performance), to allow us something like:With the
yield
keyword we could leveragecollection if
to spread across several lines.I apologize in advance if I am missing something, I bet I am, as language features are always tricky.
The text was updated successfully, but these errors were encountered: