Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Token categories rely on global state #1056

Closed
bd82 opened this issue Oct 15, 2019 · 5 comments
Closed

Token categories rely on global state #1056

bd82 opened this issue Oct 15, 2019 · 5 comments
Labels

Comments

@bd82
Copy link
Member

bd82 commented Oct 15, 2019

Specifically this:

This can cause issues when there are multiple Chevrotain packages in existence.
E.g when the Lexer and Parser are in separate npm packages.

This could also cause issues in splitting up Chevrotain into multiple smaller packages.

@bd82 bd82 added the Bug 🪲 label Oct 15, 2019
@Sciumo
Copy link

Sciumo commented Oct 15, 2019

A good use case of Chevrotain is to execute parse tasks in web workers, possibly with many different parsers handling parse events.

@bd82
Copy link
Member Author

bd82 commented Oct 15, 2019

I am not sure if web workers are relevant to this issue. Optimization for web-workers may be around
reducing initialization time, e.g via serialization, particularly if a new web-worker is created for each parsing task.

I have started some guides/feature related to initialization performance here:

@Sciumo
Copy link

Sciumo commented Oct 16, 2019

Web workers do not share state with the UI thread or other workers. All state must be serialized and transferred by a message; no shared global state. There is a use case for serializing state between lexing and parsing workers. Admittedly probably a corner case from your POV.

@bd82
Copy link
Member Author

bd82 commented Oct 16, 2019

It seems less likely that separate web workers would be used for the lexer and the parser which would be needed to re-produce this issue.

But yeah its the same issue 😄

@bd82
Copy link
Member Author

bd82 commented Jul 5, 2023

Fixing this (e.g via state on lexer/parser) is likely to cause too many API changes for too little benefit
as I've only encountered an edge case with this state once...

Closing unless this edge case starts causing "real" problems.

@bd82 bd82 closed this as completed Jul 5, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants