I suggest you ...

Allow optional naming of union fields

It can be hard to keep track of field order, especially when there are several of the same time. For example: type MyUnion = Case1 of string * string * string. It's hard to remember which field is Id, Name, Description, and so on. If the fields could be notated -- type MyUnion = Case1 of Id:string * Name:string * Description:string -- then Intellisense could be provided when entering case constructors.

26 votes
Vote
Sign in
Check!
(thinking…)
Reset
or sign in with
  • facebook
  • google
    Password icon
    I agree to the terms of service
    Signed in as (Sign out)
    You have left! (?) (thinking…)
    Daniel RobinsonDaniel Robinson shared this idea  ·   ·  Flag idea as inappropriate…  ·  Admin →

    6 comments

    Sign in
    Check!
    (thinking…)
    Reset
    or sign in with
    • facebook
    • google
      Password icon
      I agree to the terms of service
      Signed in as (Sign out)
      Submitting...
      • FANG ColinFANG Colin commented  ·   ·  Flag as inappropriate

        Congratz it is introduced in F# 3.1. Weirdly they didn't close this idea... maybe nobody even check it!

      • Jack PappasJack Pappas commented  ·   ·  Flag as inappropriate

        This feature was/is part of the Standard ML language. It seems the F# compiler originally supported this, because if you use VS2010 (F# 2.0) and try to use record syntax to define the type of a union case you'll get a compiler error message about it (saying that the feature is deprecated).

      • David ThayerDavid Thayer commented  ·   ·  Flag as inappropriate

        You really want record definitions as TypeConstructer parameters
        i.e Case1 of {Id:string; Name:string; Description:string }

      Feedback and Knowledge Base