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

Make default syntaxes public #605

Open
matthew-carroll opened this issue Apr 9, 2024 · 2 comments
Open

Make default syntaxes public #605

matthew-carroll opened this issue Apr 9, 2024 · 2 comments

Comments

@matthew-carroll
Copy link

Is there a reason that the default inline syntaxes are private?

static final List<InlineSyntax> _defaultSyntaxes =

Imagine that I want the defaults, but I want to add my own syntax either as top priority, or bottom priority. With public defaults, that's as easy as:

inlineSyntaxes: [
  myTopPrioritySyntax,
  ...defaultInlineSyntaxes,
  myBottomPrioritySyntax,
]

But if the defaults are private then the developer has to dig through the source code to fine them, and then has to copy them over. There will be cases where that's still necessary, because sometimes a new syntax needs to be placed at a specific location in the priority list, but the most common case probably doesn't require that level of intervention.

@chenzhiguang
Copy link
Contributor

Because the order matters, for example, if you put SoftLineBreakSyntax() before LineBreakSyntax(), some syntax might not work as expected, or it might lower the performance if you move them around freely.

But perhaps that shouldn't be the reason for making it private

@matthew-carroll
Copy link
Author

I understand order matters - that's why I describe three cases in my original post:

  1. Add a syntax as top priority
  2. Add a syntax as bottom priority
  3. Add a syntax somewhere in the middle

Situation 3 will always require copying the list. But situation 1 and 2 wouldn't, and I would guess those two are the average.

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

No branches or pull requests

2 participants