Closed pblasucci closed 1 year ago
For (1a) my advice is really to move to module rec
or namespace rec
. I don't think we should format as single line.
For (1b), the existing advice is really the advice we want, the single line addiction in F# is too strong :) So my preferred decision is not to change the advice here.
In reviewing the style guide, I notice the advice on attributes is... incomplete? inaccurate? In any event, there are cases not covered. And I think the advice which is present is overly general (though this only becomes obvious when you also consider the missing use cases).
TL;DR -- I propose the following changes:
The guide effectively partitions all uses of Attributes into two buckets:
I've no qualms about the first bucket. The advice on attributing parameters is solid. :+1:
However, the vastness of "anything other than a parameter" is problematic. The recommendations are very awkward for mutually-referential type definitions.
Example 1a: Attributing mutually-referential type definitions
Really, in these cases, the recommendation should be the same as for parameters (i.e. a single set of brackets containing a list of attributes separated by semicolons).
Example 1b: Attributing mutually-referential type definitions
Additionally, the current recommendations lead to extra verbosity on constants and units of measure. There is quite a lot of code "in the wild" which places
LiteralAttribute
orMeasureAttribute
after thelet
ortype
keyword (n.b. this is specific to putting the attribute after the keyword; the general advice of having the attribute on its own line is, for other instances, very solid).Example 2: Attributing constants and units of measure
In conclusion, I know there's no template here, but let me just add:
However, contributing to Fantomas is probably impractical given my available bandwidth (hopefully, this is immaterial to the validity of the suggestion -- otherwise the cart is pulling the horse :wink:).