Closed bakkot closed 1 year ago
The committee decided today to not go through with the rename of take
and/or drop
. Closing.
Just adding my thoughts here as I write a library for ReScript. take
is not clear - didn't realize it until I thought about it and looked at other libraries. Is it takeAtLeast
, takeExactly
, or takeAtMost
? F# calls it truncate
which is more accurate unless you plan to throw exceptions if there aren't enough items. They have a take
that throws exceptions.
@jmagaram yeah the committee isn't great at making amendments and taking feedback once a proposal is past stage 2 unless "political force" is applied and that's expensive.
From my perspective - the fact it's confusing and a (clear IMO) mistake isn't enough reason to do anything that will block this proposal since I need/want the 99% other stuff in it.
Per discussion in this thread, some users infer/want that you can
take
multiple times from the iterator to get multiple chunks. But because exhausting thetake
subiterator closes the underlying iterator, you can't actually do that. That may be confusing if you're used to e.g. rust iterators.We should probably rename it. My preference is to use
limit
, which is what Java calls it.(And while we're at it we will probably want to rename
drop
toskip
, sincetake
is always paired withdrop
andlimit
withskip
.)Do read the discussion in the original thread. I wanted to open a separate issue so we could track it properly. cc @benjamingr