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

caddyfile: Support backticks as quotes #3242

Merged
merged 1 commit into from May 5, 2020
Merged

caddyfile: Support backticks as quotes #3242

merged 1 commit into from May 5, 2020

Conversation

mholt
Copy link
Member

@mholt mholt commented Apr 8, 2020

Slated to land just after 2.0 release.

Closes #2591

@mholt mholt added the under review label Apr 8, 2020
@mholt mholt added this to the 2.1 milestone Apr 8, 2020
Copy link
Member

@francislavoie francislavoie left a comment

Nice and simple! 👍

@Conan-Kudo
Copy link
Member

@Conan-Kudo Conan-Kudo commented Apr 18, 2020

@mholt Why use backticks instead of """? That would align similarly with other languages that do this (like Python, Ruby, et al)?

@francislavoie
Copy link
Member

@francislavoie francislavoie commented Apr 18, 2020

Since the primary usecase for this is JSON strings, backticks make more sense here I think. Easier to read, and JS has support for backticks as "template literals", i.e. interpolated strings, and Go does as well, "string literals".

Compare:

respond `{"some": "JSON", "content": ["1", "2", "3"]}`

vs...

respond """{"some": "JSON", "content": ["1", "2", "3"]}"""

And it's easier to implement in the lexer because otherwise we'd need to special case finding three consecutive ". Not that big of a difference, but simpler is better.

elcore
elcore approved these changes Apr 18, 2020
Copy link
Collaborator

@elcore elcore left a comment

LGTM 👍

@mholt mholt removed the under review label May 5, 2020
@mholt mholt merged commit 5230561 into master May 5, 2020
6 checks passed
@mholt mholt deleted the backtick-strings branch May 5, 2020
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.

4 participants