Discuss module structure for 6.0
See original GitHub issueIssue
Currently users need to import operators and observable creation method methods from a variety of places and it’s not always consistent or ergonomic.
import { merge } from 'rxjs/observable/merge';
import { concat } from 'rxjs/observable/concat';
import { timer } from 'rxjs/observable/timer';
import { map, filter, scan } from 'rxjs/operators';
Questions
What is the most ergonomic?
Do we want to try to shoot for an import process like import { map, filter, Observable, Subject, asyncScheduler } from 'rxjs'
?
Do we want to keep things mostly the same for now?
How will this affect bundling?
What about node and Electron folks?
Options
- Import everything from
rxjs
.- pro: Convenient and ergonomic.
- con: We’d need to differentiate between static creation functions and operators of the same name (
merge
andmerge
might need to bemergeStatic
orfromMerge
andmerge
)
import { merge, fromMerge, map, filter, Observable, Subject } from 'rxjs';
- Import all static creation methods and observable types from
rxjs
, import operators fromrxjs/operators
.- pro:
merge
andmerge
can keep their names. - pro: We don’t have to move the
operators
. - con: two different locations to import from
- pro:
- Import observable types from
rxjs
observable creation methods fromrxjs/observable
and operators fromrxjs/operators
- pro: We don’t have to move the
operators
- con: three different locations to import from
- pro: We don’t have to move the
… in all cases we should probably still provide the ability to “deep import” operators and the like, as some bundlers still stink at tree-shaking re-export modules.
Issue Analytics
- State:
- Created 6 years ago
- Comments:8 (7 by maintainers)
Top Results From Across the Web
Maybe it's time to rethink our project structure with .NET 6
The structure of a module. The benefit of this approach makes that every module becomes self-contained. Simple modules can have a simple setup, ......
Read more >Modules, Structures, and Classes - ThoughtCo
There are just three coding structures for objects that you can use in VB.NET projects: modules, structures, and classes.
Read more >Structural Mechanics Module Updates - COMSOL
COMSOL Multiphysics® version 6.0 brings many updates and new features to the Structural Mechanics Module. See what's new.
Read more >Module structure - 1C:DN
A resource library on 1C:Enterprise how to start the development on 1C:Enterprise, a business applications platform.
Read more >6.0 Structures, Materials, and Mechanisms - NASA
The following subsections contain examples of modular CubeSat frame designs. Table 6-1 lists commercially available CubeSat structures.
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
My preference would be to do away with the lettable forms of operators which have a static equivalent. I imagine this would be quite controversial though… (many of you probably prefer the other form)
I used to use the prototype-based forms (e.g.
first.concat(second)
) but recently I’ve settled on always using the static forms as I’ve found them more far self-explanatory for others reading my code later who may not be as familiar with Rx.This would reduce the API surface and likely remove a confusion point for some. But it comes at the obvious cost of being less flexible, and perhaps more importantly deviating from some of the other Rx implementations in other languages…though not all of them have the instance variant, and RxJava/RxGroovy call it
concatWith
. We could call it that, but that doesn’t solve the other static operators and I don’t personally like it because it has a type signature mismatch with the other -With operator,startWith
, which accepts a scalar not an Observable.Alternatively, there could be two buckets,
rxjs/observables
andrxjs/operators
and when there is a naming conflict the dev has to choose what alias they want to call them.In practice I don’t think this will happen often–why would someone want to use both forms of them? I’m guessing the answer is “because sometimes it feels better to use one or the other”
This is done.