Skip to content

feat: add iter and iterSync to io/util#843

Merged
lucacasonato merged 3 commits into
denoland:mainfrom
lucacasonato:add-iter-itersync
Apr 11, 2021
Merged

feat: add iter and iterSync to io/util#843
lucacasonato merged 3 commits into
denoland:mainfrom
lucacasonato:add-iter-itersync

Conversation

@lucacasonato

Copy link
Copy Markdown
Contributor

This moves the Deno.iter and Deno.iterSync implementations to std,
so we can deprecate them in Deno 1.9, and remove them in Deno 2.0.

lucacasonato added a commit to lucacasonato/deno that referenced this pull request Apr 5, 2021
This commit marks the `Deno.iter` and `Deno.iterSync` utils as
deprecated, and schedules them for removal in Deno 2.0. These
utilities are implemented in pure JS, so should not be part of the
Deno namespace.

These utilities are now available in std/io/util:
denoland/std#843.
@nayeemrmn

Copy link
Copy Markdown
Contributor

I think the opportunity should be taken to give it a more explicit name, since it's not built-in anyway. Maybe readIter(), being the basis of readLines() and readDelim().

lucacasonato added a commit to denoland/deno that referenced this pull request Apr 5, 2021
This commit marks the `Deno.iter` and `Deno.iterSync` utils as
deprecated, and schedules them for removal in Deno 2.0. These
utilities are implemented in pure JS, so should not be part of the
Deno namespace.

These utilities are now available in std/io/util:
denoland/std#843.
@kt3k

kt3k commented Apr 6, 2021

Copy link
Copy Markdown
Contributor

I think the opportunity should be taken to give it a more explicit name

How about iterableFromReader following the convention of /io/streams.ts?

bartlomieju pushed a commit to bartlomieju/deno that referenced this pull request Apr 6, 2021
This commit marks the `Deno.iter` and `Deno.iterSync` utils as
deprecated, and schedules them for removal in Deno 2.0. These
utilities are implemented in pure JS, so should not be part of the
Deno namespace.

These utilities are now available in std/io/util:
denoland/std#843.
@lowlighter

Copy link
Copy Markdown
Contributor

Seems that denoland/deno_lint#651 (comment) has been prodded recently which introduce the no-deprecated-deno-api rule, but since #843 (this PR) has not been prodded yet, it's making builds from all new PRs failing (example):

 (no-deprecated-deno-api) `iter` is deprecated and scheduled for removal in Deno 2.0
  for await (const chunk of Deno.iter(r)) {
                            ^^^^^^^^^
    at /home/runner/work/deno_std/deno_std/http/_io.ts:178:28

    hint: Use `iter` from https://deno.land/std/io/util.ts instead

(no-deprecated-deno-api) `iter` is deprecated and scheduled for removal in Deno 2.0
    for await (const chunk of Deno.iter(conn)) {
                              ^^^^^^^^^
    at /home/runner/work/deno_std/deno_std/http/file_server_test.ts:107:30

    hint: Use `iter` from https://deno.land/std/io/util.ts instead

It's not blocking per se, but I think it's worth mentioning 🙂

@lucacasonato

Copy link
Copy Markdown
Contributor Author

Thanks for the heads up @lowlighter. I'll address it shortly.

This moves the `Deno.iter` and `Deno.iterSync` implementations to std,
so we can deprecate them in Deno 1.9, and remove them in Deno 2.0.

@ry ry left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@lucacasonato lucacasonato merged commit 564b44f into denoland:main Apr 11, 2021
@lucacasonato lucacasonato deleted the add-iter-itersync branch April 11, 2021 11:53
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants