Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Clarify constructors #1217

Closed
5 of 6 tasks
nojaf opened this issue Nov 6, 2020 · 1 comment
Closed
5 of 6 tasks

Clarify constructors #1217

nojaf opened this issue Nov 6, 2020 · 1 comment

Comments

@nojaf
Copy link
Contributor

nojaf commented Nov 6, 2020

I propose we align the way constructors (SynExpr.New) are formatted with both the Microsoft and G-Research style guides.

The existing way of Fantomas deals with this problem is not really aligned with either guide.

Pros and Cons

The advantages of making this adjustment to Fantomas are ensuring correctness of what the style guides dictate.

No disadvantages come to mind.

Examples

let thing = new Foobar(a, b)

let otherThing =
    new Foobar(
        longname1,
        longname2
    )

let m = new Meh(a)

let otherThing =
    new Foobar(
        longname1,
        longname2,
        longname3,
        longname4,
        longname5,
        longname6,
        longname7
    )

new ParquetWriter(
    file.FullName,
    Column.Thing
    WriteProperties.make columns,
    dict metadata |> Dictionary
)

Things to consider:

  • The constructor can be short in terms of characters but still have a lot of parameters.
  • A single argument can still be quite long.
  • The style guides might have a different opinion on the closing ).

Extra information

Estimated cost: S or M.

Related suggestions: #1189

Affidavit (please submit!)

Please tick this by placing a cross in the box:

Please tick all that apply:

@knocte
Copy link
Contributor

knocte commented Nov 10, 2020

How about doing the same for invoking functions that receive tuples? essentially, they look the same except for the new keyword (which is even not required unless you're dealing with IDisposable).

@nojaf nojaf mentioned this issue Nov 15, 2020
4 tasks
@nojaf nojaf closed this as completed Nov 20, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants