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
#2427 mentions benefit of scanning only the first keyword in the line to find all variable declarations, which would be against this.
I'm not sold on making into a normal function, because we want into to be a special keyword, because it cannot be used somewhere in the middle of a pipeline (or a function call tree):
let a =(
from x
into b
)
This feels very wrong.
To get the proposed results, we could just add additional syntax that would allow top-level expression to have | into x appended so that would count as variable declaration.
I would be -0 on this compromise.
It feels like the best solution here would be to just provide good errors when the into keyword is used where it shouldn't be.
My main point here is that saying "within a pipeline, a pipe character is the same as a newline — except in the case of into" seems complicated, and we get a much simpler result by avoiding that exception.
In almost all situations, a line break acts as a pipe. [though we go on:] But there are a few exceptions where a line break doesn’t create a pipeline:
A level down:
let a =(
from x
into b
)
This feels very wrong.
Yes fair! Though:
this could be an error because there's no value being assigned to a
or even into could return nothing, a bit like let foo = {let x = 5;} returns nothing in rust, and so let a get assigned null (not saying this is necessary or even good, just that it's not obviously a compiler error)
Thanks to @broneill — full details at #4277 (reply in thread)
I had been thinking of
into
as a transform — so following a pipe (either a|
or new line).Currently, quoting from the discussion linked above
valid, correctly so
valid, but incorrectly so — I think should be invalid
invalid, but incorrectly so — I think should be valid
The text was updated successfully, but these errors were encountered: