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

Allow single-quoted strings for PRAGMA #52

Open
notmgsk opened this issue Nov 23, 2021 · 4 comments
Open

Allow single-quoted strings for PRAGMA #52

notmgsk opened this issue Nov 23, 2021 · 4 comments
Assignees
Labels
2024.1 Changes for the 2024.1 specification.

Comments

@notmgsk
Copy link
Member

notmgsk commented Nov 23, 2021

In Quil-T we make use of PRAGMA FILTER-NODE which expects a json-like string object. For example

PRAGMA FILTER-NODE raw "{'key': 'value', ...}"

The problem is, however, single-quoted strings are not valid JSON, so the above would have to be written

PRAGMA FILTER-NODE raw "{\"key\": \"value\", ...}"

which is awkward and error-prone when writing by-hand.

If we supported using single quotes for the pragma freeform string then the above would become

PRAGMA FILTER-NODE raw '{"key": "value", ...}'

@stylewarning WDYT?

@stylewarning
Copy link
Member

stylewarning commented Jan 6, 2022

Discussion from Quil call:

  • Robert: Is \ enough of a nuisance? Mark: Yes, it has been.
  • Robert: ' would be nice to reserve for future use;
  • Erik: could possibly use """ or heredoc or so instead
  • Robert, Erik: Multi-line pragmas might be useful

@notmgsk
Copy link
Member Author

notmgsk commented Jan 6, 2022

can we use """ for docstrings too? 👼🏽

@caldwellshane
Copy link

Bumping this issue. We'd also like to write JSON into DEFFRAME HARDWARE-OBJECT and have it look nice. The backslashes are a bit of a bummer in that case.

@caldwellshane
Copy link

In fact, would it unreasonable for Quil to have a designator for a JSON string? I feel like we're bumping into genuine contention between Quil and JSON (and potentially other formats) over the " character. Given the description,

HARDWARE-OBJECT is a string indicating the (implementation-specific) hardware object that the frame is associated with.

it seems reasonable to support structured strings describing objects here.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
2024.1 Changes for the 2024.1 specification.
Projects
None yet
Development

No branches or pull requests

4 participants