Skip to content

F# code formatting guidelines: Space before DU constructor arguments? #22664

Closed

Description

@cmeeren

In the F# code formatting guidelines, I can find no descriptions of whether DU cases should have a space before a parenthesized argument:

let opt1 = Some ()
let opt2 = Some (1, 2)

or:

let opt1 = Some()
let opt2 = Some(1, 2)

Could this be clarified and added? I can add a PR, but let's find out what it should be first.

Activity

  1. cmeeren commented on Feb 14, 2021

    @cmeeren
    ContributorAuthor
  2. cartermp commented on Mar 3, 2021

    @cartermp
    Contributor

    I think it's somewhat finnicky, since it's not a function application nor is it a method call.

    Let's have it be a space:

    let opt1 = Some ()
    let opt2 = Some (1, 2)

    This is the most common style used in the F# compiler source code and several codebases I've interacted with, so that's as canonical as it gets, I suppose.

    Will happily accept a PR that adds this.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions