Skip to content

Refactor idea to simplify interfaces #95

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

Merged
merged 5 commits into from
Jun 11, 2024
Merged

Conversation

ornj
Copy link
Member

@ornj ornj commented Jun 11, 2024

Moves the "register" responsibility to the options types, not 100% on the API, but it's an idea. The interfaces are now single-method which is pretty much as small as it gets. You could implement these interfaces with a single function that calls itself.

A benefit to this is most obvious with the external Lexer I think as now it is not responsible for storing a value for later use that carries state and is not concurrent-safe.

Proposed changes

Describe the use case and detail of the change. If this PR addresses an issue on GitHub, make sure to include a link to that issue using one of the supported keywords here in this description (not in the title of the PR).

Checklist

Before creating a PR, run through this checklist and mark each as complete.

  • I have read the CONTRIBUTING document
  • If applicable, I have added tests that prove my fix is effective or that my feature works
  • If applicable, I have checked that any relevant tests pass after adding my changes
  • I have updated any relevant documentation (README.md)

Moves the "register" responsibility to the options types, not 100% on
the API, but it's an idea. The interfaces are now single-method which
is pretty much as small as it gets. You could implement these interfaces
with a single function that calls itself.

A benefit to this is most obvious with the external Lexer I think as now
it is not responsible for storing a value for later use that carries
state and is not concurrent-safe.
@ornj ornj requested a review from xynicole June 11, 2024 17:43
@xynicole
Copy link
Collaborator

LGTM

ornj added 2 commits June 11, 2024 14:23
Refactored the options so that callers cannot accidentally on purpose
modify other parts of the config struct.
Also removed some commented out code.
@ornj ornj marked this pull request as ready for review June 11, 2024 21:34
@ornj ornj requested a review from a team as a code owner June 11, 2024 21:34
@ornj ornj merged commit bb0d1ab into nginxinc:ext-lua Jun 11, 2024
@ornj ornj deleted the ext-lua-sh branch June 11, 2024 21:34
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