Skip to content

Documentation#16

Open
exacs wants to merge 13 commits into
devfrom
docs
Open

Documentation#16
exacs wants to merge 13 commits into
devfrom
docs

Conversation

@exacs
Copy link
Copy Markdown

@exacs exacs commented Mar 31, 2022

This PR creates some documentation documents about Skog.

It adds documents about concepts, not any exhaustive documentation. Focus is understand Skog and understand why is it designed how it is designed.

Tip for review: Recommended to go to read the docs in the branch instead of the "Files changed" tab

Comment thread docs/02-skog-context.md Outdated
Comment thread docs/02-skog-context.md Outdated
Comment thread docs/02-skog-context.md
Comment thread docs/01-nodejs-context.md Outdated
Comment thread docs/02-skog-context.md Outdated
}
```

Lastly, sometimes there is already a context opened when calling this middleware (e.g., there is another middleware that opnens such context). To support it, we call `getFields` and add the returned object to the fields:
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

opnens -> opens

Perhaps swap "a context opened" for "a context created" and later "accesses such a context". You would open a file but create a context (object).

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

I have replaced the word "open" with "create" but...

Technically is not the same to create a context and to (???) (not sure which verb should be used)

For example in React you have React.createContext to create a context but then you have YourContext.Provider, a component that "???" (what should be the verb here?).

YourContext.Provider has two arguments: value and children.

  • value in React is fields in Skog
  • children in React is fn in Skog

The context is created by Skog. What we export is a function that provides the value to the context. The context is (???) by the user.

Copy link
Copy Markdown
Contributor

@jhsware jhsware Apr 4, 2022

Choose a reason for hiding this comment

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

Good point! Perhaps read or access the context object? Open would imply that you need to close it (file/connection). And create as you say implies that it is instantiated.

Copy link
Copy Markdown
Author

@exacs exacs Apr 4, 2022

Choose a reason for hiding this comment

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

Another option is just to omit the word context at all since it is an implementation detail and instead rename the function runWithSkogContext -> runWithSkog or something...

And in the documentation refer to such function as "context provider" maybe...

Comment thread docs/02-skog-context.md
Comment on lines +67 to +68
...getFields(),
req_id: nanoid(),
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

This opens up to name conflicts (which is the major complaint with the context approach in the first place). Perhaps consider mentioning this or allow a way to handle naming conflicts.

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

True. And returning to the analogy with React Context, it has the same problem. I will try to mention it in some understandable way...

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.

2 participants