5 ms·
The Hack proposal is horrible imo because it doesn’t look like JS anymore. The F# proposal is 99% of the benefit whilst being actually approachable.
by pharmakom 4y ago
The Hack proposal is horrible imo because it doesn’t look like JS anymore. The F# proposal is 99% of the benefit whilst being actually approachable.
- galaxyLogic 4y agoI think we should have BOTH. Use |> for the Hack proposal and -> for F# -style.
- hajile 4y agoI'd far rather save that for an alternative switch expression with pattern matching. const slowSum = (lst: {x: number}[]) => switch(list) { [{x}, ...y] -> x + slowSum(y) //not tail recursive [{x}, {x: y}] -> x + y //alias second x to y [{x}] -> x //handle length 1 [] -> 0 //handle length 0 }
- tracker1 4y agoHaving been watching, and a couple times playing with Rust... would definitely like a similar pattern matching system in JS. I still feel the C# syntax for this feels a bit alien `varname switch {...}`.
- pharmakom 4y agoAs an F# developer who also does some JS and Java this would confuse the hell out of me! |> is the best operator
- grumpyprole 4y agoThere's no need. The % placeholder can be used for a consise lambda syntax and would work with a F# application operator.
- masklinn 4y ago> The Hack proposal is horrible imo because it doesn’t look like JS anymore. I mean it looks exactly like JS with an additional % placeholder.
- mkl 4y agoAnd a lot more like JS than the F# proposal.
- pharmakom 4y agoHow so? JS already has operators, but placeholders is a totally new concept
- mkl 4y agoIs there another JavaScript feature that looks like a list of function names but which causes actions to be performed? Or operators that operate on both functions and values? The placeholders are very similar to variables, so do what they look like they do, and it's only the implicit definition that is new. The explicit placeholders feel much more like JavaScript to me than the implicit function calling of the F# proposal.
- pharmakom 4y ago- functions and lambdas are already first-class values in JS - we already have operators on values, such as + - |> is just another operator on values
- epolanski 4y agoIt absolutely is, but time and time again TC39 has followed few champions over the waves of people favoring F# pipes. It's incredible to me TC39 would rather have this monstruosity over F# pipes which are actually pretty similar to how most pipes work and read in most functional languages including unix `|` one.
- WorldMaker 4y agoOn the flipside, I think that this is still such an ongoing debate is part of why the pipeline operator is still stuck in Stage 2 and having trouble getting into Stage 3, despite being listed as a "priority" multiple times on and before 2020. TC-39 isn't blindly following anyone here, they seem to be dragging their heels hoping that someone comes along with an even better compromise between the styles.
- xigoi 4y agoBefore ES6: “The arrow function proposal is horrible imo because it doesn’t look like JS anymore.”
- pharmakom 4y agoIt’s a balance. I actually support the addition of the F# proposal, minus the await parts.
- antipurist 4y ago"Why did it take so long?" and "Pointless bloat!" reactions were much more common: https://news.ycombinator.com/item?id=3780367 https://news.ycombinator.com/item?id=3780367 https://news.ycombinator.com/item?id=6418337 https://news.ycombinator.com/item?id=6418337