I suggest we ...

Use the default keyword instead of the [<DefaultValue>] attribute

Use the default keyword instead of the [<DefaultValue>] attribute

Programming is a human activity. I think F# code has to be more elegant and readable for human programmers.
So, instead of coding:
type MyType() =
let mutable myInt1 = 10
[<DefaultValue>] val mutable myInt2 : int
[<DefaultValue>] val mutable myString : string
member this.SetValsAndPrint( i: int, str: string) =
... member body ...
it would be better and more elegant to write:
type MyType() =
let mutable myInt1 = 10
val mutable default myInt2 : int
val mutable default myString : string
member this.SetValsAndPrint( i: int, str: string) =
... member body ...
Please declare the [<DefaultValue>] attribute as an obsolete (unrecommeded to use in new code) feature in the F# language specification, but remain it in the language for compatibility with the existing codebase.

1 vote
Vote
Sign in
Check!
(thinking…)
Reset
or sign in with
  • facebook
  • google
    Password icon
    Signed in as (Sign out)
    You have left! (?) (thinking…)
    Alexei Odeychuk shared this idea  ·   ·  Flag idea as inappropriate…  ·  Admin →

    2 comments

    Sign in
    Check!
    (thinking…)
    Reset
    or sign in with
    • facebook
    • google
      Password icon
      Signed in as (Sign out)
      Submitting...

      F# Language

      Feedback and Knowledge Base