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 the right slash. Fixes #853 #857

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open

Conversation

tabatkins
Copy link
Member

@tabatkins tabatkins commented Jan 14, 2025

Fixes #853.


Preview | Diff

@@ -2698,7 +2698,7 @@ dimensions of a [=client window=].

browser.SetClientWindowStateParameters = {
clientWindow: browser.ClientWindow,
browser.ClientWindowNamedState // browser.ClientWindowRectState
browser.ClientWindowNamedState / browser.ClientWindowRectState
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
browser.ClientWindowNamedState / browser.ClientWindowRectState
(browser.ClientWindowNamedState // browser.ClientWindowRectState)

(seeing the failing tests) should not it be the following? since / for choosing between types and // for choosing between groups?

Copy link
Member Author

Choose a reason for hiding this comment

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

Hm. I could be misreading the RFC, but as far as I can tell the only difference between / and // is the early- vs late-binding behavior; otherwise groups are types, right? Like, you'd only use // specifically to deal with groups, to avoid having to use / with parens around the groups.

I see the parse failure, but I'm not certain that's not a bug in the parser you're using. (But I might be wrong.)

Copy link
Member

Choose a reason for hiding this comment

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

The CDDL parser I wrote currently accepts the construct with a /. The grammar allows that and, as @tabatkins, I didn't see what prevented it in the RFC. Re-reading the RFC, I see that the Operator precedence section says:

Type operators (such as "/" for type choice) operate on types, while group operators (such as "//" for group choice) operate on groups.Types can simply be used in groups, but groups need to be bracketed (as arrays or maps) to become types.

I don't really understand why that's needed, but that seems to say that browser.ClientWindowNamedState and browser.ClientWindowRectState, defined as groups, cannot be used directly in a "/" construct.

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.

Syntax error in browser.SetClientWindowStateParameters definition?
3 participants