00:01
<jschoi>
If I were to change the PFA placeholder to a different token, how much traction would `?` have as the topic? I've been considering swapping the placeholder to `~` to match the proposed `f~()` syntax.
We have considered ? in the past, and perhaps we should consider it again. Although a reason why we discarded it was because of visual confusion with binary ??, optional chaining ?., and ternary ? :—these three forms probably would not occur very often inside pipe bodies. For example, x |> f(?, 0). And perhaps we could be okay with requiring parentheses where tokenization would be ambiguous (e.g., x |> (?).y may be okay…since they should be writing x.y anyway).
00:03
<jschoi>
With regards to using pipes for unnesting anything other than function calls, I would say that there is a gray zone between “function calls only” and “function calls with other syntax forms”. For example, it is quite common to use an array to supply a single value to a function that expects an iterable, e.g., f([g(x)]). x |> f(#) |> g([#]) would arguably fall under this gray zone.
00:05
<jschoi>
If you wouldn’t object to it, Ron (and others), I would like to add ? back to the list for consideration. I’ve come around to it again, especially after #’s recently dimming prospects.
00:09
<jschoi>
(See also https://github.com/tc39/proposal-hack-pipes/issues/2 for previous discussion. What I didn’t realize back then is that ? is a tokenization problem only with ., and x |> (?).y |> f(?) should nearly always be x.y |> f(?) anyway.)
00:36
<ljharb>
I think ? has a much higher risk of conceptual conflict; i think ternary and optionality and nullish coalescing will occur quite frequently in a pipeline step.
01:57
<jschoi>
At the very least, ternary conditionals and nullishness coalescing usually separate operands with spaces (? ? x : y and ? ?? x rather than (?)?x:y and (?)??x). But, yes, if they are expected to be common, then ? is quite suboptimal. 😔