Skip to content

Stroustrup lines #2277

@Thorium

Description

@Thorium

I think the current fsharp_experimental_stroustrup_style=true is having an issue. I have a code like this:

let bannedEmailServersBackup = [|
    "0-mail.com";"027168.com";"0815.ru";"0815.ry";"0815.su";"0845.ru";"0box.eu";"0clickemail.com";"0n0ff.net";"0nelce.com";"0v.ro";"0w.ro";"0wnd.net";"0wnd.org";"0x207.info";"1-8.biz";"1-tm.com";"10-minute-mail.com";"1000rebates.stream";"100likers.com";"105kg.ru";"10mail.com";"10mail.org";"10minut.com.pl";"10minut.xyz";"10minutemail.be";"10minutemail.cf";"10minutemail.co.uk";"10minutemail.co.za";"10minutemail.com";"10minutemail.de";"10minutemail.ga";"10minutemail.gq";"10minutemail.ml";"10minutemail.net";"10minutemail.nl";"10minutemail.pro";"10minutemail.us";"10minutemailbox.com";"10minutemails.in";"10minutenemail.de";"10minutesmail.com";"10minutesmail.fr";"10minutmail.pl";"10x9.com";"11163.com";"123-m.com";"12hosting.net";"12houremail.com";"12minutemail.com";
    "12minutemail.net";"12storage.com";"140unichars.com";     // 3000+ more items here
   |]

Initially I would just like to say:

(* Fantomas ignore this *)
let bannedEmailServersBackup = ...
(*/Fantomas ignore this *)

...because this is data, and not structure. That could be thought of extension of the F# style-guide, e.g.:

String literals and interpolated strings can just be left on a single line, regardless of how long the line is.

Single line is for important code, but as this is just a static list, we don't need to maintain the data line-by-line.
But now if Fantomas is used, it likes to create a megabyte-source-code file out of that, each single line with a lot of space-characters.
fsharp_experimental_stroustrup_style=true yields:

let bannedEmailServersBackup = [| "0-mail.com"
                                  "027168.com"
                                  "0815.ru"
                                  "0815.ry"
                                  "0815.su"
                                  "0845.ru"
                                  "0box.eu"
                                  "0clickemail.com"
                                  //...

But as far as I understand, the intention of Stroustrup is to keep the opening bracket on the same line, and it should do this instead:

let bannedEmailServersBackup = [| 
    "0-mail.com"
    "027168.com"
    "0815.ru"
    "0815.ry"
    "0815.su"
    "0845.ru"
    "0box.eu"
    "0clickemail.com"
    //...

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions