-
Notifications
You must be signed in to change notification settings - Fork 15
Spec: Specify Feature NP (N-ary Pipelines) #16
Comments
See #16. Current problem: ResolveTopicBinding is probably redundant with CreateRestTopicIteratorRecord.
…hm to use EvaluateCall and return lists See #16.
…arguments and squashed expression See #16.
…yle steps to include a topic reference See #16.
… Correct IDs They are static, not runtime, semantic rules. See #16.
The augmentations that Feature NP would apply to Feature BP have not yet been added. This issue is therefore not resolved and is blocked by #17. |
Thought I'd point out a couple areas of potential syntactic ambiguity in this:
By any chance, could this be better specified just in terms of an unpacked array input? Engines and transpilers could trivially eliminate the array allocation (or destructure it if they couldn't eliminate it), and it'd also make the pipeline a little less complicated to visually and programmatically parse. [a, b, c]
|> ...f(#, x, ...)
|> ...g
// Desugaring
g(...f(a, x, b, c)) (My reason of interest in NP in general is because this would make n-ary lifting in my proposal much simpler to implement, and I've already found uses for that in many areas.) |
@isiahmeadows: Thanks for commenting on these—they are excellent points. As far as I can tell, N-ary pipeline heads are not actually grammatically ambiguous with the current syntactic grammar for Feature NP. I’m working on #18 and #17 right now, but this is indeed a problem and I’ll have to think more about this. I don’t want to lose consistency between the syntax for pipeline heads and intermediate pipeline steps, losing which would be its own sort of complexity. But maybe there’s no alternative, and maybe it’s not as important to pipeline’s use cases like partial application… The most likely solution is what you already have mentioned: requiring parentheses for both n-ary pipeline heads and n-ary pipeline steps and getting rid of the I’ll follow up when I finish As a parenthetical follow-up to tc39/proposal-pipeline-operator#106 (comment), I am very interested in your own proposal. I think there’s a lot of potential there. I’m still chewing over it as I work out the formal specifications of the remaining additional features, because it’s a big problem. I’ll reply in your new issue #24 when I can. I’m happy you’re interested in mine too. |
I probably should've said "unpacked arguments list". The trick is that instead of specifying the pipeline itself to be n-ary, you could just choose to consider individual calls n-ary. // 1.
array
|> ...foo(...)
|> bar(#)
// Desugars to:
bar(foo(...array))
// 2.
array
|> foo(#)
|> ...bar(...)
// Desugars to:
bar(...foo(array)) This makes the syntax a little more flexible on this front without complicating it too much. There's one added caveat that probably needs addressed: you could potentially define a pipeline like this: // Is this legal?
array |> ... ... I suspect it shouldn't be, since you can't destructure into nothingness. It's morally equivalent to array |> ...[...]
// Desugars to
[...array] |
No description provided.
The text was updated successfully, but these errors were encountered: