You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Multiple parse errors:
should be ']'
/home/sitischu/.elvish/lib/github.com/mojurasu/riku/test.elv, line 8:
# comment
unexpected rune ']'
/home/sitischu/.elvish/lib/github.com/mojurasu/riku/test.elv, line 10:
]
~> put [x #y ]
parse error: 7-8 in [interactive]: should be ']'
parse error: should be ']'
[tty], line 1: put [x #y ]
That illustrates why such syntax is problematic. It's not enough to support comments on lines without any other expression of syntactically significant tokens. Note that even without the trailing ] in that example it fails using current parsing behavior. Which is another road block to changing the behavior since doing so is something that can only be done in a major release.
@krader1961 I am not sure what's the problem with put [x #y ]. In this case, it is the same as put [x; the closing bracket needs to appear on a second line.
Currently having # inside lists is a syntax error. Making an invalid program valid does not break backward compatibility.
@xiaq, Yes, you're right regarding backward compatibility. I was mislead by the failure of the put [x #y ] example. I expected it to be equivalent to put ['x' '#y'] since I expected # to not be special inside a list.
I widened the scope of the issue a bit. There are in fact more places where comments should be allowed but currently aren't, such as argument lists (in a lambda) and braced lists.
Activity
krader1961 commentedon Feb 24, 2020
A variation on the above example:
That illustrates why such syntax is problematic. It's not enough to support comments on lines without any other expression of syntactically significant tokens. Note that even without the trailing
]
in that example it fails using current parsing behavior. Which is another road block to changing the behavior since doing so is something that can only be done in a major release.[-]Support comments inside lists[/-][+]Support comments inside multiline lists[/+][-]Support comments inside multiline lists[/-][+]Support comments inside lists and maps[/+]SitiSchu commentedon Feb 24, 2020
Breaking changes should be fine since we're still below 1.0. Interestingly enough it behaves as expected with lambdas:
xiaq commentedon Apr 4, 2020
@krader1961 I am not sure what's the problem with
put [x #y ]
. In this case, it is the same asput [x
; the closing bracket needs to appear on a second line.Currently having
#
inside lists is a syntax error. Making an invalid program valid does not break backward compatibility.krader1961 commentedon Apr 10, 2020
@xiaq, Yes, you're right regarding backward compatibility. I was mislead by the failure of the
put [x #y ]
example. I expected it to be equivalent toput ['x' '#y']
since I expected#
to not be special inside a list.[-]Support comments inside lists and maps[/-][+]Support comments everywhere newline is treated as whitespace[/+]xiaq commentedon May 2, 2020
I widened the scope of the issue a bit. There are in fact more places where comments should be allowed but currently aren't, such as argument lists (in a lambda) and braced lists.