Coder Social home page Coder Social logo

Comments (24)

feross avatar feross commented on April 28, 2024

+1 I'm hugely in favor of this.

from node.

rvagg avatar rvagg commented on April 28, 2024

@feross be warned, you'd be on my list of people to pull in to a maintainer team if this goes ahead

from node.

jonathanong avatar jonathanong commented on April 28, 2024

+1

from node.

isaacs avatar isaacs commented on April 28, 2024

+1. @rvagg do you need me to do the switch?

from node.

fengmk2 avatar fengmk2 commented on April 28, 2024

+1

from node.

rvagg avatar rvagg commented on April 28, 2024

@isaacs at this stage I'm more looking for agreement from TC to reverse the flow of code so that all the work is done in readable-stream rather than core, but there's no harm in moving readable-stream over to the org in the meantime.

from node.

isaacs avatar isaacs commented on April 28, 2024

Oh, I see, so the plan would be to have the module be the "upstream" and then iojs consumes it?

If so, that makes a lot of sense, and moving it to the org also seems sensible. I think this should be the exception rather than the norm, however. Stuff like util-debuglog should probably still remain as-is for now.

from node.

ahdinosaur avatar ahdinosaur commented on April 28, 2024

👍

from node.

tellnes avatar tellnes commented on April 28, 2024

+1

from node.

indutny avatar indutny commented on April 28, 2024

Finally, +1

from node.

missinglink avatar missinglink commented on April 28, 2024

+1 happy to help

from node.

bnoordhuis avatar bnoordhuis commented on April 28, 2024

+1 as long as I don't have to triage bugs. :-)

from node.

chrisdickinson avatar chrisdickinson commented on April 28, 2024

I'm a little worried about making readable-stream (the package) the authoritative source for streams in Node/iojs -- though at the moment I'm having difficulty putting the "why" down into words. I'll revisit this later today and see if I can't explain better, in the meantime I'm "-0" for that change (it could just turn out that I'm being silly about this, though.) I'm totally +1 putting the package under the iojs org, though!

from node.

chrisdickinson avatar chrisdickinson commented on April 28, 2024

Okay, here goes:

Issues with and PRs against streams will be opened against this repository. The latter can be solved with a big ole' disclaimer comment at the top of the vendored file, but the former splits issues between "those who know where readable-stream is" and "those who don't." Additionally, It could have the side effect of making stream issues less visible to streams maintainers, who would have to look in two places to track current problems (and, due to the gravity-like effect of interest on attention, will likely end up following the readable-stream tracker way more closely than the iojs tracker).

maybe the tight integration with core can be loosened (and perhaps broken completely) over time

As one of node's core primitives, I'm not sure loosening or breaking streams the integration of streams with core is feasible; even if it is feasible, I am not sure that it would be a good thing. Streams are one of the few things that packages must agree on. Anecdotally, js-git is a good example of what a world without standard stream primitives would look like -- where the stream primitive is a local agreement between cooperating packages.

In order to have my streams1-based git packages work with js-git, I rewrote them into min-streams and added translation modules. The min-streams only depended on other min-streams), and exposed streams1 to other consumers on the side. This took a lot of time, and while it made the module usable from min-streams or streams1, it still wouldn't necessarily work with pull-streams, or RxJS; and it only worked in a single package because I had a verbal agreement with the consumers (all two of us) of these packages -- I knew that the min-stream version would be available at <package>/min.js. Were this not the case, there would likely be a streams-package-A and a min-package-A, which is the sort of lock-in effect that streams effectively combatted.

One of the really lovely things about streams as a primitive is that modules are casually pluggable. There's not so much specification as to get in the way of the problems being solved, or so little specification that more time is spent providing shim modules at edges between ecosystems, but just enough agreement to foster cooperation and enable the community to do some truly cool things. My experience integrating streams1 with min-streams for js-git led me to believe that local, ecosystem-based agreements for the stream primitive are far less effective than global agreement. Min-streams aren't bad -- they're really neat, and for the constraints js-git works within they make total sense -- but both streams1 and min-streams lost a lot of effectiveness by not being the globally agreed-upon standard interface.

(And, given all that, it follows that I believe that the readable-stream module and this repo would have to be upgraded in lockstep for most changes to readable-stream, which would create more work, and thus more potential for human error than currently exists.)

I'm willing to bet that even now, nobody understands the code better than @isaacs because it's grown so complex.

Oof, I definitely agree with this. I have a tiny stack of hand drawn state machine diagrams with a lot of frustrated scribbles in the margins that I consult regularly. We need to decrease the bus factor, and forming an impromptu team of people that can field issues with streams is a great idea.
That said, I don't think moving streams out of core is a precondition to forming that team.

I'm a little concerned about having the option to "solely" work in streams. Having streams in core provides JS developers who are aspiring contributors a nice "ladder" to climb up into different subsystems (and C++). The design of streams, on the other hand, benefits from informed use in core -- and I think there are still gains to be made there (uniting resource/handle-backed streams under a common subclass, or otherwise addressing pain points with the existing integrations).

Also of note: stream documentation -- due to the complexity of streams, they hit a lot of pain points with the way documentation is currently done in Node (is it a guide? is it reference material? who is the audience?) Moving the symptom out of Node proper makes it less likely that the underlying problem will get addressed satisfactorily -- when docs are revisited, they should be revisited with the pain of streams docs fresh in mind, and with solutions in hand.

Sorry for the unstructured stream of concerns. To recap, in numbered list form:

  1. Moving streams into a repo doesn't move the issues out of this repo.
    1. But it does make stream maintainers have to look in two repos for pertinent issues.
    2. It adds a step in PR'ing streams changes.
    3. It divides the audience into folks who know where to look and folks who don't.
  2. I do not think that decoupling streams from core will be to either core or stream's benefit.
    1. Streams work best as global agreements between all packages.
    2. Changes to a readable-stream repo will likely have to happen in lock-step with changes to this repo.
      1. This adds manual steps, which increases the potential for human error.
  3. Streams are complex enough to deserve their own repo
    1. I think that having to work with streams in-situ improves the design of streams.
    2. Having streams in core gives new contributors who are familiar with JS a good place to start.
    3. Removing the onus of documenting streams from this repo means that updates to the docs subsystem are less likely to keep the pain points of streams in mind.

from node.

mjackson avatar mjackson commented on April 28, 2024

I'm willing to bet that even now, nobody understands the code better than @isaacs because it's grown so complex.

This is my main concern with using readable-stream. The code is far, far more complex than it needs to be. As one of the core primitives, the code should be as simple and portable as possible.

I have a tiny stack of hand drawn state machine diagrams with a lot of frustrated scribbles in the margins that I consult regularly.

I'm willing to bet that everyone here has spent countless hours digging through that code, searching for obscure bugs and trying to fix them.

Can we please, please simplify? I'm more than happy to help with the effort. I wrote BufferedStream in the days of node 0.4 to normalize behavior of the different "streams" that existed at that time, and I'm familiar with the complexity of this particular problem.

from node.

mikeal avatar mikeal commented on April 28, 2024

As one of the core primitives, the code should be as simple and portable as possible.

This sounds like something obvious but it turns out not to be true. Streams has to straddle old-style and new-style support in one object and be as performant as possible.

It is very common in Node that code is obfuscated in crazy looking ways for performance reasons. Simplicity and clarity is certainly the top priority for API design but I'm afraid it falls below performance and compatibility in the actual implementation.

from node.

mjackson avatar mjackson commented on April 28, 2024

Simplicity and clarity is certainly the top priority for API design but I'm afraid it falls below performance and compatibility in the actual implementation.

I don't see any evidence to suggest that performance must suffer for the sake of clarity and brevity. For some reason node has always assumed that the inverse is true though, and it's an opinion that has severely hampered its usability. You can have good performance and a clean implementation.

from node.

mikeal avatar mikeal commented on April 28, 2024

@mjackson there is a long history of patches from @trevnorris that are designed to hit v8 performance paths and are much less readable than they would be if performance was not a consideration.

from node.

chrisdickinson avatar chrisdickinson commented on April 28, 2024

Can we please, please simplify? I'm be more than happy to help with the effort.

I'm +1 on simplifying streams where possible, but it might be best to open up that point up as a separate issue so the conversations don't get intermingled too much.

It is very common in Node that code is obfuscated in crazy looking ways for performance reasons.

Compatibility is a big reason things streams are complex, but performance is not a prerequisite contributor to their complexity. At a micro level, there's all sorts of deoptimizations in streams; at a slightly larger level, some of the backing data structures can be swapped out to improve performance for common cases, like logging.

In any case I'm getting ahead of myself -- it would be good to discuss this in a separate issue where we can discuss concrete pain points with streams at present before putting out solutions.

from node.

mikeal avatar mikeal commented on April 28, 2024

I should have been clearer. I think there is a lot of room for streams to get faster, and that the work that goes in to making them faster may not make them less complex.

from node.

DamonOehlman avatar DamonOehlman commented on April 28, 2024

+1 for bringing it in, +1 for @feross as a potential maintainer

from node.

rvagg avatar rvagg commented on April 28, 2024

TC today agreed to make this happen, at least as an experiment for now, @rvagg and @chrisdickinson to take responsibility for the mechanics of making this happen.

Need to consider the flow of:

  • code
  • docs
  • issues

between the two repos

TC meeting notes available in #144

from node.

Raynos avatar Raynos commented on April 28, 2024

Note that if readable-stream is in iojs we need to most important artifact.

The reason readable-stream exists is that you can require('readable-stream').

I wouldn't mind require('iojs/stream') but depending on all of iojs might be a large dependency.

Where the code lives is not important, the fact that readable-stream gets published to npm is important

from node.

Fishrock123 avatar Fishrock123 commented on April 28, 2024

readable-stream has long been moved to https://github.com/iojs/readable-stream

They also have (almost?) finalized their working group: nodejs/readable-stream#97

Deferring to there, we can cycle back to discussions on whether or not to make it authoritative in the future.

from node.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.