00:39
<jschoi>

It’s been a long time, and yet I’m realizing now that nobody seems to have proposed .. as the topic reference.

x = grunt.config('uglify.all.files') |> Object.keys(..)[0];
x = pkgs[0] |> npa(..).escapedName |> await npmFetch.json(.., opts);
x = cb(predicate) |> _.negate(..) |> _.filter(obj, .., context);
Object.keys(envars)
  .map(envar => `${envar}=${envars[envar]}`)
  .join(' ')
  |> `$ ${..}`
  |> chalk.dim(.., 'node', args.join(' '))
  |> console.log(..);
context
  |> (.. && (..).nodeType ? (..).ownerDocument || .. : document)
  |> jQuery.parseHTML(match[1], .., true)
  |> jQuery.merge(..);

.. as the topic doesn’t seem bad. It only really clashes with property accesses—which are already postfix, so you would rarely use pipe on them anyway. And spread syntax, I guess, but doing that on the topic would probably be even rarer.

.. is even more visually lightweight than ^^, and it’s easier to type than ^^ and %%.
Plus, .. usually gets its own typographic ligatures in fancy code fonts, for those who are into those.

00:48
<ljharb>
why would it be rare to have an iterable topic?
00:52
<jschoi>

I don’t think having an iterable topic would be rare, but I do think that spreading an iterable topic into a function call or array/object literal within a pipe would be pretty rare.

// How often would you need to spread a topic
// into a variadic function?
x |> fnThatReturnsIter(..) |> variadicFn(...(..)) |> g(.., 0)
// Maybe "appending" a value into an array copy is more common:
x |> fnThatReturnsIter(..) |> [ ...(..), 0 ]

Though, even when it does happen, f(...(..)) or [ ...(..) ] wouldn't be the end of the world either. I think that they might be worth the tradeoff versus the disadvantages of %% or ^^. And my intuition is that .. would be significantly easier to parse than %% or ^^, too.

05:00
<ljharb>
arrayOfNumbers |> Math.max(...(..))?
05:01
<rkirsling>
^ this seems like a nice syntactic "test case" for evaluating the various options
06:09
<jschoi>

Yeah, I’ll acquiesce that flattening into Math.max and min does happen. Though I’d be a bit surprised if such calls exceeded 0.1%, let alone 1%, of all JS function calls that would benefit from piping.
And just a space separating ... and .. should work, without parentheses, right? x |> [... ..] rather than x |> [...(..)].

arr |> Math.min(0, ... ..) |> console.log(`Max is {..}`);
arr |> Math.min(0, ...^^) |> console.log(`Max is {^^}`);
arr |> Math.min(0, ...%%) |> console.log(`Max is {%%}`);
arr |> Math.min(0, ...#_) |> console.log(`Max is {#_}`);

I’m actually kind of excited about .. as another candidate topic token. It’s so “lightweight” compared to the other choices left.

06:37
<rbuckton>
I can't say I'm thrilled with how ...x looks for property access.
06:42
<rbuckton>
I'm still of the opinion that F#-style pipes would have been better. arr |> (x) => Math.min(0, ...x) means no special topic is needed, PFA or no PFA.
07:05
<ljharb>
that's a nonstarter tho based on browser feedback
07:05
<ljharb>
personally i think .. is way worse than ^^ or &&
07:22
<rkirsling>
I mostly like .. except that I think there are so many cases where parens would be needed (at least from a lint perspective) that one would almost need to consider it a four-character thing (..), which might in itself rule it out
07:26
<rkirsling>
I hate %% but I think this discussion actually makes me come around to ^^ a bit
08:12
<Ashley Claymore>
the main thing I like about ^^ is the shape resemblance with |>
08:27
<rkirsling>
interesting
08:27
<rkirsling>
I don't know about that, but in this context, I was appreciating how ^^ can sit next to . and ... nicely
08:30
<rkirsling>
if we could type dots above like ˙˙ then that'd be cool but we can't so ^^ stands as a typable alternative
09:05
<Nic>
that's a nonstarter tho based on browser feedback
F# was stalled due to browser feedback about too many closures? Couldn't we define something that looks 100% like an arrow but doesn't actually introduce a function, it just binds some local variable (the "parameters") and evaluates its body? Since it's an iife anyway 
09:09
<Nic>
Maybe even syntactically limiting it to 1 parameter, like we do for setters
09:48
<Ashley Claymore>
Something that looks exactly like a function but isn't a function sounds not great 
10:00
<Ashley Claymore>

the main advantage for the reader of f# is that it probably wouldn't be arrow functions, and would instead be curried functions - so looks almost like method calls. If every f# pipe was an arrow that sounds verbose

getData() |> _ => Object.entries(_) |> _ => handleEntries(_) |> _ => Object.fromEntries(_);

vs

getData() |> Object.entries(^^) |> handleEntries(^^) |> Object.fromEntries(^^);
10:01
<Ashley Claymore>
if we can't find a token, then maybe the pseudo arrow is a good compromise
10:03
<Nic>
I mean, either an arrow-like thing to give a name, or an expression that just gets called, with a cover grammar 
10:04
<Nic>
If it starts with `( identifier ) =>` it's one, otherwise its the other
10:05
<Nic>
Something that looks exactly like a function but isn't a function sounds not great 
You wouldn't really be able to observe that other than the restriction in the parameters, because you can't get a reference to it (since it's basically an iife)
15:16
<Richard Gibson>
there have been suggestions to embed an identifier inside the pipe syntax like e.g. getData() ~x> Object.entries(x) ~a> handleEntries(a) ~a> Object.fromEntries(a) (although I think they were |identifier>, which wouldn't work because getData() |x> Object.entries(x) |a> handleEntries(a) |a> Object.fromEntries(a) already has a valid parse)
15:29
<rkirsling>
thanks I hate it
15:30
<rkirsling>
(I mean l do find |x> amusing à la bra-ket notation...but also that's not what this is)
15:32
<jschoi>
I can't say I'm thrilled with how ...x looks for property access.
For what it’s worth, ...x would always tokenize as spread-x and never topic-member-x, and a |> ...x would always be a syntax error (no topic in pipe body).
And you would nearly always want to do a.x instead of a |> .. .x anyway…
15:33
<jschoi>
there have been suggestions to embed an identifier inside the pipe syntax like e.g. getData() ~x> Object.entries(x) ~a> handleEntries(a) ~a> Object.fromEntries(a) (although I think they were |identifier>, which wouldn't work because getData() |x> Object.entries(x) |a> handleEntries(a) |a> Object.fromEntries(a) already has a valid parse)
Speaking of ~, I don’t think ~~ as topic has been proposed either. It’s not bad either, maybe more of a pain to type.
15:34
<jschoi>
Though it may be a problem with XOR in ~~~…
15:35
<nicolo-ribaudo>
ASI in ``` x |> ~~ f() ``` is bad though
15:47
<rkirsling>
took me a sec to decipher what you meant but oof yeah that's a non-starter
17:46
<TabAtkins>
yeah i think that makes the syntax a non-starter, fwiw
17:48
<TabAtkins>
We've avoided unary operators for the ASI reasons Nicolo just brought up. If we're using an existing operator it has to be binary, so them being adjacent is impossible.
18:23
<jschoi>
The committee temperature for .. seems quite cold, alas. I suppose it’s understandable. I’ll add .. and ~~ to the wiki table of rejected topic tokens later with reasons.
I also need to post an update in #232 saying basically that the champions have been busy proposing lower-hanging fruit over the past two years.
18:29
<jschoi>
There was some talk at the last plenary’s TG5 about maybe doing another pipe usability study, sparked by a suggestion from Michael Ficarra. At the time, there was some surprising new positive enthusiasm about Hack pipe from Mark Miller, too.
If a new TG5 study demonstrates usability benefits from the pipe operator, when compared to deeply nested expressions or temporary variables, then other committee members may become more amenable to pipe. The study could also evaluate the usability of the remaining candidate topic tokens.
(The TG5 meeting notes aren’t up yet. If anyone knows how best to contact Mikbar Barash, I’d like to ask him to let me look at the meeting notes before he posts them.)
18:37
<Ashley Claymore>
@mikbar-uib:matrix.org ?
23:50
<rkirsling>
note that it's Mikhail Barash, abbreviated to mikbar 😅