pipe icon indicating copy to clipboard operation
pipe copied to clipboard

Pipes can not be used across lines

Open OldhamMade opened this issue 5 years ago • 1 comments

In other languages that have the pipeline operator, it's common to format call chains as follows:

data
|> clean()
|> format()
|> process()

It would be great if this pipe operator could be used across lines in the same way.

OldhamMade avatar Apr 27 '20 13:04 OldhamMade

Nim handles line continuations via syntax hints - this isn't really something I have any control over. You would basically need to trick the parser into this. One easy solution (that is very ugly) is by putting the operator at the end of the line, like this:

data     |>
clean()  |>
format() |>
process()

But yes, in short, this really isn't up to me, it's an inherent limitation of Nim itself. One way that this could be fixed is if the Nim parser checked for indentation in the next line (which would be fairly quick/easy to do), but that's not really the case right now.

If you want this feature, feel free to open an issue in the Nim issue boards though!

CosmicToast avatar Apr 27 '20 14:04 CosmicToast