Skip to content

Commit 89a885a

Browse files
authored
Update formatting.md
1 parent 6415eee commit 89a885a

File tree

1 file changed

+19
-9
lines changed

1 file changed

+19
-9
lines changed

docs/fsharp/style-guide/formatting.md

Lines changed: 19 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -162,25 +162,35 @@ someFunction1 x.IngredientName
162162
someFunction1(x.IngredientName)
163163
```
164164

165-
By convention, space is added when applying functions to tupled arguments:
165+
In default formatting conventions, a space is added when applying lower-case functions to tupled or parenthesized arguments:
166+
166167
```fsharp
167168
// OK
168-
someFunction1 (x.IngredientName, x.Quantity)
169+
someFunction2 ()
170+
171+
// OK
172+
someFunction3 (x.Quantity1 + x.Quantity2)
169173
170-
// OK, but formatting tools will add the extra space by default
171-
someFunction1(x.IngredientName, x.Quantity)
174+
// Not OK, formatting tools will add the extra space by default
175+
someFunction2()
176+
177+
// Not OK, formatting tools will add the extra space by default
178+
someFunction3(x.IngredientName, x.Quantity)
172179
```
173180

174-
For capitalized methods accepting tupled arguments, no space is added. This is because these are often used with fluent programming:
181+
In default formatting conventions, no space is added when applying capitalized methods to tupled arguments. This is because these are often used with fluent programming:
175182

176183
```fsharp
177-
// OK - Methods accepting tuples are applied without a space:
184+
// OK - Methods accepting parenthesize arguments are applied without a space
185+
SomeClass.Invoke()
186+
187+
// OK - Methods accepting tuples are applied without a space
178188
String.Format(x.IngredientName, x.Quantity)
179189
180-
// OK - it's important not to use a space if using fluent programming with chained '.' invocations
181-
String.Format(x.IngredientName, x.Quantity).Length
190+
// Not OK, formatting tools will remove the extra space by default
191+
SomeClass.Invoke ()
182192
183-
// OK, but formatting tools will remove the extra space by default
193+
// Not OK, formatting tools will remove the extra space by default
184194
String.Format (x.IngredientName, x.Quantity)
185195
```
186196

0 commit comments

Comments
 (0)