Skip to content

Commit 4b790d4

Browse files
authored
[ add ] layout + boilerplate for deprecation warnings (#2529)
* add: layout + boilerplate for deprecation warnings * spellcheck
1 parent 6a1ae77 commit 4b790d4

File tree

1 file changed

+38
-3
lines changed

1 file changed

+38
-3
lines changed

doc/style-guide.md

Lines changed: 38 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -131,7 +131,7 @@ automate most of this.
131131
open SetoidEquality S
132132
```
133133

134-
* If importing a parametrised module, qualified or otherwise, with its
134+
* If importing a parameterised module, qualified or otherwise, with its
135135
parameters instantiated, then such 'instantiated imports' should be placed
136136
*after* the main block of `import`s, and *before* any `variable` declarations.
137137

@@ -314,6 +314,41 @@ line of code, indented by two spaces.
314314
where open ≤-Reasoning
315315
```
316316

317+
#### Layout of deprecation blocks
318+
319+
* There is standard boilerplate text which should go at the end of a
320+
file, separated by two blank lines from the main module body:
321+
```agda
322+
------------------------------------------------------------------------
323+
-- DEPRECATED NAMES
324+
------------------------------------------------------------------------
325+
-- Please use the new names as continuing support for the old names is
326+
-- not guaranteed.
327+
```
328+
329+
* For each (new) version with deprecations, there should be a single
330+
line comment, separated by one blank line from the preceding
331+
deprecation block:
332+
```agda
333+
-- Version X.Y
334+
```
335+
336+
* There is standard boilerplate text for deprecating `old-name` in
337+
favour of a definition in terms of `new-name`: the actual definition
338+
(which need not have a type signature if this is a simple matter of
339+
aliasing, or simple function composition), followed by:
340+
```agda
341+
{-# WARNING_ON_USAGE <old-name>
342+
"Warning: <old-name> was deprecated in vX.Y.
343+
Please use <newname> instead."
344+
#-}
345+
```
346+
where the advice on what to use instead may also contain additional
347+
information regarding eg. location, or usage patterns.
348+
349+
* Each entry in the block should be correlated with a suitable
350+
`CHANGELOG` entry for the associated release version.
351+
317352
#### Mutual and private blocks
318353

319354
* Non-trivial proofs in `private` blocks are generally discouraged. If it is
@@ -399,7 +434,7 @@ line of code, indented by two spaces.
399434
syntax in preference to the Unicode `⦃_⦄` syntax (written using `\{{`/`\}}`),
400435
which moreover requires additional whitespace to parse correctly.
401436
NB. Even for irrelevant instances, such as typically for `NonZero` arguments,
402-
neverthelesss it is necessary to supply an underscore binding `{{_ : NonZero n}}`
437+
nevertheless it is necessary to supply an underscore binding `{{_ : NonZero n}}`
403438
if subsequent terms occurring in the type rely on that argument to be well-formed:
404439
eg in `Data.Nat.DivMod`, in the use of `_/ n` and `_% n`
405440
```agda
@@ -611,7 +646,7 @@ Type formers:
611646

612647
* sum-like `infixr 1 _⊎_`
613648

614-
* binary properties `infix 4 _Absorbs_`
649+
* binary properties `infix 4 _Absorbs_`
615650

616651
#### Functions and relations over specific datatypes
617652

0 commit comments

Comments
 (0)