-
Notifications
You must be signed in to change notification settings - Fork 110
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Tweaking the Hack (placeholder) Syntax #234
Comments
Copying my comment here. I will also mark our convo on the other thread as off-topic. (Edit: I see you deleted your original comment. I can delete our comments on that thread as well to keep it clean.) @aadamsx I believe that's effectively Smart Mix. I will mention that Smart Mix only allowed no parens in "bare style", e.g. |
Fair enough, so in that case
But what about the first example:
Can't we compromise on this (optional) syntax? |
You’re suggesting pipe always be in “Hack mode”, placeholder required, unless the thing in the pipeline is a bare identifier, without a placeholder (when it would be in “F# mode”)? |
Yeah, this is Smart Mix. My issues with it were as follows:
|
@ljharb @mAAdhaTTah Seems like a reasonable compromise to me. |
“unary” isn’t a characteristic that can be known at parse time or statically. |
Think of it in reverse, the compiler will assume |
Yeah, this is precisely the Smart Mix syntax that failed to gain traction, and got a good amount of unofficial but strong pushback from committee members. Committee members were really against the syntax having multiple interpretation modes, complaining that it was a source of confusion and likely bugs. (Several comments in this thread already provide details/context on this.) I originally supported Smart Mix as well, but it turns out that a large amount of the code samples people have provided of So, unless things significantly change in the greater committee (outside of the champion group reading this repo), which doesn't seem likely, this direction is already closed down as an option. I'm going to go ahead and close this issue. |
No
What a shame. It's too bad we can't be trusted with nice things.
Good to know, but beside the point I think.
Glad to hear, this is a reasonable approach after all.
I'll try to find the details, thanks. |
@js-choi @tabatkins @mAAdhaTTah is it possible to tweak the unary function call syntax a bit, so that we don't actually need the placeholder?
For example:
value |> foo(^)
// unary function calls could be written this wayvalue |> foo
// or for unary function calls (and only unary function calls) without^
placeholder, the compiler will assume placeholder positionvalue |> ^.foo()
// method callsvalue |> ^.foo
// instead the()
are not requiredvalue |> foo |> ^.bar()
// another exampleetc.
The text was updated successfully, but these errors were encountered: