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

Multiline literal description confusing #75

Open
abellgithub opened this issue Jul 26, 2023 · 3 comments
Open

Multiline literal description confusing #75

abellgithub opened this issue Jul 26, 2023 · 3 comments

Comments

@abellgithub
Copy link

The text describing a multiline string is confusing. An example that shows how various multiline strings are manifest would be helpful. Or perhaps a link to a reference document?

Is

  let text = """
  foo
  bar
  """

different from

  let text = """
  foo
  bar
    """

etc.

@kyouko-taiga
Copy link
Contributor

Multi-line strings are described in the specification: https://github.com/val-lang/specification/blob/main/spec.md#string-literals

I'll add a link in the tour.

Your two examples are different. The second one is illegal.

@kyouko-taiga
Copy link
Contributor

Actually, the text in the tour is the same as in the specification. I'll leave this issue open to remind me to add more examples.

@abellgithub
Copy link
Author

abellgithub commented Jul 27, 2023

I thought that some syntax might be illegal, but the text doesn't make it clear. Even the language reference is a bit unclear, partly because it's hard to count spaces. Perhaps the text could be written differently. Maybe:

The number of spaces preceding the closing delimiter indicate the indentation count. Each line after the opening delimiter will have indentation count spaces removed from the front of the line. If each line does not contain at least indentation count spaces at the beginning of the line, the multiline string is malformed.

Does the BNF in the language ref capture this? I'm not sure that it does.

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