ilya.gorbunov
09/05/2018, 11:41 AMbuildSequence
and buildIterator
functions. Please share your thoughts regarding the names proposed in the attached post, especially if you find something confusing about any of them.robin
09/05/2018, 3:07 PMdefineSequence
name. I think the lazy nature of Sequence should be enough to convey that, and the other two names are more easy to find via auto-complete without remembering the exact word that comes before "sequence", which is something that always annoys me with the current names, especially having a buildSequence
and a generateSequence
and having to remember which prefix it was for which use case.
I don't have a clear preference for either of the other two names, sequence
is nice and DSL-like, but I see the name overload issue, and sequenceFrom
has a nice duality to sequenceOf
, where the latter creates a sequence of some values, and the former creates a sequence from a lambda you give it.gaetan
09/05/2018, 9:39 PMsequence
and defineSequence
names too static for such a function.
I really like the sequenceFrom
which gives a good idea of what is going to happen: the values of the sequence are going to come from the given suspending lambda.nkiesel
09/06/2018, 1:13 AMsequenceFrom
kingsley
09/06/2018, 7:57 AMsequenceFrom
as well.
In addition to the comments, I think it has a familiar connotation to it.
For instance, it could be a clear differentiator between mapOf
, listOf
, etc, which are eager and sequenceFrom
, etc which would be lazyvoddan
09/06/2018, 1:14 PMSequence {}
and buildSequence {}
do almost the same thing, but have to have different names. Could we somehow capitalize on the analogy with asyncSequence
or suspendSequence
?ilya.gorbunov
09/06/2018, 1:22 PMSequence { }
and buildSequence { }
are inherently different, the former is a SAM-constructor for the single abstract method interface Sequence
.voddan
09/06/2018, 1:25 PMilya.gorbunov
09/06/2018, 1:45 PMvoddan
09/06/2018, 2:23 PMrobin
09/06/2018, 2:24 PMvoddan
09/06/2018, 2:31 PMiterator: () -> Iterator<T>
produces an iterator. That is unfortunate. Must agree with @ilya.gorbunov then. Sorry for the confusionCzar
09/07/2018, 9:10 PMsequence
or sequenceFrom
ilya.gorbunov
09/12/2018, 2:36 PMsequence
and `iterator`: https://github.com/JetBrains/kotlin/compare/93b1620708e0a5339bd3fe13f51f76cde2f65958~2...93b1620708e0a5339bd3fe13f51f76cde2f65958