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

Use of Natlink's window-specific rule activation feature #370

Closed
drmfinlay opened this issue Sep 4, 2022 · 4 comments
Closed

Use of Natlink's window-specific rule activation feature #370

drmfinlay opened this issue Sep 4, 2022 · 4 comments
Assignees
Labels
Feature Request Feature requests not plan to be implemented by OP NatLink Issues related to NatLink

Comments

@drmfinlay
Copy link
Member

I have been requested to use this Natlink/DNS feature in Dragonfly. It may be used to mark grammar rules as high priority, meaning that they override global DNS rules, or commands.

I have had some trouble getting this to work reliably. But, even if that were not the case, enabling this by default would deviate from behaviour that users have come to expect. So it will be added as off-by-default.

Since this is a Natlink-only feature, it will be enabled via the Natlink engine class:

# Define a Dragonfly grammar.
grammar = Grammar("My grammar")

# ... (add rules) ...

# Load the grammar.
grammar.load()

# Set each rule as high-priority.
engine = grammar.engine
assert engine.name == "natlink"
for rule in grammar.rules:
    engine.set_high_priority_rule(grammar, rule, True)

I'll add a less fiddly example, under dragonfly\examples, demonstrating use of this feature.

@drmfinlay drmfinlay added the Feature Request Feature requests not plan to be implemented by OP label Sep 4, 2022
@drmfinlay drmfinlay self-assigned this Sep 4, 2022
@drmfinlay drmfinlay added the NatLink Issues related to NatLink label Sep 4, 2022
@LexiconCode
Copy link
Member

This is great! I'll try to test this soon. In terms of reliability, can you expand on that some?

@drmfinlay
Copy link
Member Author

I haven't got this working yet, actually. I just realised there wasn't a GitHub issue for it. It is partly implemented on the master branch. I will finish it there soon.

As to reliability, I think my code calls some Natlink functions in a way that causes problems. Vocola uses this feature by default and, though it has been a while, I don't remember having trouble.

drmfinlay added a commit that referenced this issue Sep 5, 2022
Re: #370.

The Natlink window-specific rule activation works now.
@drmfinlay
Copy link
Member Author

This feature is now implemented, and currently enabled by default, on the master branch version. Or, at least I think it is...

I'll be honest, I cannot discern any difference between normal and "high-priority" rules. My information is from Mark Lillibridge, who wrote about this in the Dragonfly Gitter channel in June/July.

Perhaps this only makes a difference on other versions of DNS? I'm on DNS 15. Let me know if you notice a difference, @LexiconCode.

@drmfinlay
Copy link
Member Author

I haven't run into any problems with this, so it will be on by default in the next version. If users report problems related to this, I'll consider adding an option.

drmfinlay added a commit that referenced this issue Oct 8, 2023
Related to issue #370 and rule contexts.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Feature Request Feature requests not plan to be implemented by OP NatLink Issues related to NatLink
Projects
None yet
Development

No branches or pull requests

2 participants