You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I propose we improve the pattern matching for IsLikeZip operation in CE. Currently, it does support some kinds of pattern matching, but in a very limited way. It can only do pattern matching on one level tuple, and the parentheses cannot be omitted. This is very stange to me, because I cannot find anything in a similar situation in the other parts of the F# language.
As there is very little information about IsLikeZip, eg. what is the behaviors, how to use them, etc., I am not sure if the other structures of pattern matching share the same limations in the old F# version, but only IsLikeZip is forgotten to be upgraded as the language evolving, or it is by design, or it is a bug.
openSystemtypeParamTag<'T>=| ParamTag
typeC()=[<CustomOperation("ziplike", MaintainsVariableSpaceUsingBind =true, IsLikeZip =true)>]member inline__.ZipLike((),_:ParamTag<'Params>,[<InlineIfLambda>]f:unit ->'Params ->'Returns)=fun(param: 'Params)-> f () param
member inline__.For([<InlineIfLambda>]g,[<InlineIfLambda>]f)=fun param -> f (g param)member inline__.Return(x)= x
member inline__.Yield(())=()letc= C()letparam<'Params>():ParamTag<'Params>= ParamTag
letz= c {
ziplike a in param<int>()// okreturn a
}letz1= c {
ziplike (a,b)in param<int*int>()// okreturn a
}letz2= c {
ziplike (a,b)in param<(int*string)*int>()// okreturn a
}letz3= c {
ziplike ((a,b),c)in param<(int*string)*int>()// errorreturn a
}letz4= c {
ziplike a,b in param<int*int>()// errorreturn a
}
The existing way of approaching this problem in F# is using a let in the next line for pattern matching
Pros and Cons
The advantages of making this adjustment to F# are making the language more consistent, making IsLikeZip easier to use.
The disadvantages of making this adjustment to F# are requiring some developments.
Extra information
Estimated cost (XS, S, M, L, XL, XXL): S
Related suggestions: (put links to related suggestions here)
Affidavit (please submit!)
Please tick these items by placing a cross in the box:
This is not a question (e.g. like one you might ask on StackOverflow) and I have searched StackOverflow for discussions of this issue
This is a language change and not purely a tooling change (e.g. compiler bug, editor support, warning/error messages, new warning, non-breaking optimisation) belonging to the compiler and tooling repository
This is not something which has obviously "already been decided" in previous versions of F#. If you're questioning a fundamental design decision that has obviously already been taken (e.g. "Make F# untyped") then please don't submit it
This is not a breaking change to the F# language design
I or my company would be willing to help implement and/or test this
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:
I propose we improve the pattern matching for
IsLikeZip
operation in CE. Currently, it does support some kinds of pattern matching, but in a very limited way. It can only do pattern matching on one level tuple, and the parentheses cannot be omitted. This is very stange to me, because I cannot find anything in a similar situation in the other parts of the F# language.As there is very little information about
IsLikeZip
, eg. what is the behaviors, how to use them, etc., I am not sure if the other structures of pattern matching share the same limations in the old F# version, but onlyIsLikeZip
is forgotten to be upgraded as the language evolving, or it is by design, or it is a bug.sharplab
The existing way of approaching this problem in F# is using a
let
in the next line for pattern matchingPros and Cons
The advantages of making this adjustment to F# are making the language more consistent, making
IsLikeZip
easier to use.The disadvantages of making this adjustment to F# are requiring some developments.
Extra information
Estimated cost (XS, S, M, L, XL, XXL): S
Related suggestions: (put links to related suggestions here)
Affidavit (please submit!)
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: