Closed netaisllc closed 9 years ago
As a note for code owners, adding whitespace just before if powerLevel > 9000..
worked for me (same elm version on Mac)
I wonder if this is specific to Windows 10, though I guess it was observed on a mac too. @netaisllc, did you install with the installer or through npm
?
@evancz For me, root cause was pilot-error. But to answer your question: both. (I am evaluating Elm on Windows 7 and 10, and Ubuntu desktop 1404LTS [via npm].)
On all my platforms the REPL works as expected using "\" to continue a line.
However, on all my platforms, I can cause a parse error in the REPL by using "\ " as the line continuance "character". It seems the extra space is offensive, but the REPL's error message "carot" points to the equal sign in the func def (why not, right? what else is there to point to in this case.)
This falls into the category of Too Much Punishment per Scale of Error, but honestly, you have much more important work to focus on. Maybe this is a docs fix at best.
Regards,
I don't fully get the error. Is the issue is that there is a space after the backslash?
If so, Python has the same behavior.
>>> 123 + 412 \
File "<stdin>", line 1
123 + 412 \
^
SyntaxError: unexpected character after line continuation character
>>>
Are you saying we should just give a better error message here?
I'm gonna say that a better error message can be done and open an issue specifically about that. We can continue here if there's more to discuss.
Nothing more to discuss; you understand the issue. It is a small one.
Cool :) You can follow along at #81
I also ran into this while running through the getting started section around using the line continuation character here .. https://guide.elm-lang.org/core_language.html. Requiring a little whitespace at the line continuation isn't unreasonable, but it would be helpful if this was noted in that section of the getting started guide.
It would probably be a lot less effort than modifying the code (it's not a bug if the "feature" is documented :-) ) I'd open a specific documentation ticket, but there doesn't seem to be an obvious place for that.
over9000 powerLevel = \ | if powerLevel > 9000 then "It's over 9000!!!" else "meh"
In the example above taken from https://guide.elm-lang.org/core_language.html page there is a space between the = and the \ then why should it be necessary to have a space before the if? After all \ is a continuation character. Effectively the \ seems to be gobbling up the preceding space; and that is non-intuitive.
In case any one is still interested:
There should be one space between the powerLevel and the equal sign "=" and one space between the equal sign and the backslash; but no space after the backslash. . . just press enter after inputing the \
The next line will begin with a | [] and it looks like there is a space between the | and the [] (cursor) but apparently there is not. So press the space (once) before inputing the if.
over9000 powerLevel = \ | if powerLevel > 9000 then . . . etc.
So the word if must begin with the i aligned below the v in over9000.
Re #67, which was closed: this issue is not addressed by the suggested solution. That is, 'adding whitespace' isn't the answer nor workaround.
I experienced the same issues as reported on #67.
Windows (10) Elm Platform 0.15.1 elm-repl -v 0.4.2