Skip to content

Enhance documentation of subject scopes #152

@banchan86

Description

@banchan86

The section on visibility scopes for subjects could be improved, as I think this might be a stumbling block, but it's important for people to understand.

Several possible solutions

  • I believe we should change the node for NewScope to a higher-order observable that does create a new scope, like CreateObservable. CreateObservable is a good candidate for this, as it has been covered in the previous article on higher-order observables, and I think it is a bit more intuitive for people to understand a possible situation where a new scope is being declared.
  • Another alternative is to have in the screenshot examples of several nested operators that share the same scope as the outer workflow (I believe only IncludeWorkflow and GroupWorkflow operators) and other operators like CreateObservable, Defer, and SelectMany.

Another point is that the example screenshot does not illustrate how scopes work, and the text is a little hard to understand for a beginner.

  • We could build out a more complete working example. For instance, by using the same example from the beginning of the article (a PublishSubject from a CameraCapture) and comparing how it works in a GroupWorkflow and a Defer.

Another common question that people ask is also how to share a subject that is in an inner scope with the outer scope, and it might be nice to add that one can declare the subject in the outer scope first (with a source subject) and cast to it in the inner scope. See https://github.com/orgs/bonsai-rx/discussions/1676. However, this might be out of "scope" for this revision (haha).

Some additional comments here that I have yet to digest, but which might be nice to add.

Metadata

Metadata

Assignees

Labels

documentationImprovements or additions to documentation

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions