Stream: ideas

Topic: Roc fmt should add double space before comment


view this post on Zulip Aurélien Geron (Sep 03 2026 at 09:38):

The formatter only leaves one space before a comment. I find this visually hard to parse, for example:

mass = Tons(50) # this is the mass of the thing
mass_in_kilograms =
    match mass {
        Kilos(kilos) => kilos # just plain kilos
        Tons(tons) => tons * 1000 # oh wow we have tons now
        Kilotons(kilotons) => kilotons * 1_000_000 # and kilotons, that's nuts
    }

Contrast that with double-space:

mass = Tons(50)  # this is the mass of the thing
mass_in_kilograms =
    match mass {
        Kilos(kilos) => kilos  # just plain kilos
        Tons(tons) => tons * 1000  # oh wow we have tons now
        Kilotons(kilotons) => kilotons * 1_000_000  # and kilotons, that's nuts
    }

view this post on Zulip Aurélien Geron (Sep 03 2026 at 10:24):

For what it's worth, several other languages use double spaces before comments after code:


Last updated: Sep 03 2026 at 15:16 UTC