-
Notifications
You must be signed in to change notification settings - Fork 21
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
non symmetricity between fun
and function
for tuple forces usage of parens
#1336
Comments
|
Actually, I think the use of |
No-no from me on discouraging the use of function. They are brilliant for multiple step transformations starting with a regular match to transform something and then doing another match on that result without having to think up a name to bind the intermediate result(s) to. Basically, anywhere that an expression result needs to be the 'function' of some singular input value that can have multiple shapes. Without having to come up with a name and use it twice, redundantly, both times. |
No-no from me on discouraging the use of function. They are brilliant for multiple step transformations starting with a regular match to transform something and then doing another match on that output without having to think up a name to bind the intermediate result(s) to. Basically anywhere that an expression result needs to be the 'function' of some input value that can have multiple shapes. |
to me also the tuple between |
Could you explain? To the best of my knowledge, the second line is invalid. |
@LyndonGingerich in such case: let data = [1,"1";2,"2"]
data |> List.map (function a,b -> a * 2)
data |> List.map (fun (a,b) -> a * 2) |
those are allegedly similar semantically:
but for tuple, it doesn't work
I wonder if this can be fixed without ambiguity, because it would be an incomplete lambda in current version of the language and it would reestablish fuller symmetry with
function
construct.The existing way of approaching this problem in F# is to use
function
or wrap with parens.Maybe a code fix for putting the parens, or turning into
function
would make sense if we can't make this suggestion work / it is rejected on some grounds.Pros and Cons
The advantages of making this adjustment to F# are semantically more consistent.
The disadvantages of making this adjustment to F# are may prevent other constructs in the future.
Extra information
Estimated cost (XS, S, M, L, XL, XXL): M
Related suggestions: (put links to related suggestions here)
Affidavit
Please tick these items by placing a cross in the box:
Please tick all that apply:
For Readers
If you would like to see this issue implemented, please click the 👍 emoji on this issue. These counts are used to generally order the suggestions by engagement.
The text was updated successfully, but these errors were encountered: