Don Syme
Don Syme
> Property to method conversions should be rare because properties They are common enough, e.g. when moving a property `.Foo` to a method `.GetFoo()` because `Foo` is expensive to compute....
@En3Tho Thanks, I can see where you're coming. Writing separate active patterns for every .NET property is indeed a PITA So let's discuss property/field matching specifically, putting aside the other...
@Happypig375 If it's ok I'll change the title of this just to deal with property/field matching.
Yes, interesting. With syntaxes proposed above this would be ```fsharp match typeof with | _.BaseType (_.BaseType null) -> printfn "A" | _.BaseType (_.BaseType ty) when ty = typeof -> printfn...
> Is the _ just for aligning with #506? It seems to be wasting space. Are you suggesting ```fsharp match typeof with | .BaseType (.BaseType null) -> printfn "A" |...
> Could the syntax just be inline with pattern matching on fields? For example, I actually really dislike the use of `{ ... }` in patterns, I think it's always...
> Would the goal be to prefer the new syntax in the case of records/fields as well? Yes, because symmetry with #506 would mean `_.Ident` will work for field, properties....
I added two more syntax suggestsions to the summary above. First `_.(bindings)`: ```fsharp match x with | _.(Length=0) -> .... let f (r: R) = match r with | _.(X=3)...
Marking approved. I guess I don't really mind how many of those are special-cased.
> SRTPs are only a workaround feature after all. I don't really view them as a workaround, more as a pragmatic solution that doesn't give everyone what the want 1....