Skip to content

Commit 456c9a5

Browse files
authored
Merge pull request #439 from stan-dev/deprecation-policy-update
Update deprecation sections to reflect new policy
2 parents e0564d3 + 9323c3e commit 456c9a5

8 files changed

Lines changed: 133 additions & 58 deletions

File tree

src/functions-reference/_bookdown.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ rmd_files: [
1515
"compound_arithmetic_and_assignment.Rmd",
1616
"higher-order_functions.Rmd",
1717
"deprecated_functions.Rmd",
18+
"removed_functions.Rmd",
1819
"conventions_for_probability_functions.Rmd",
1920
"discrete_distributions.Rmd",
2021
"binary_distributions.Rmd",

src/functions-reference/deprecated_functions.Rmd

Lines changed: 54 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,55 @@
11
# Deprecated Functions
22

33
This appendix lists currently deprecated functionality along with how to
4-
replace it. These deprecated features are likely to be removed in the future.
4+
replace it.
55

6-
```{r results='asis', echo=FALSE}
7-
if (knitr::is_html_output()) {
8-
cat(' * <a href="functions-old-ode-solver.html">integrate_ode_rk45, integrate_ode_adams, integrate_ode_bdf ODE Integrators</a>\n')
9-
}
10-
```
6+
Starting in Stan 2.29, deprecated functions with drop in replacements (such as
7+
the renaming of `get_lp` or `multiply_log`) will be removed 3 versions later
8+
e.g., functions deprecated in Stan 2.20 will be removed in Stan 2.23 and placed
9+
in [Removed Functions]. The Stan compiler can
10+
[automatically update](https://mc-stan.org/docs/stan-users-guide/stanc-pretty-printing.html)
11+
these on the behalf of the user.
12+
13+
14+
15+
## `multiply_log` and `binomial_coefficient_log` functions
16+
17+
*Deprecated*: Currently two non-conforming functions ending in suffix
18+
`_log`.
19+
20+
*Replacement*: Replace `multiply_log(...)` with `lmultiply(...)`.
21+
Replace `binomial_coefficient_log(...)` with `lchoose(...)`.
22+
23+
*Scheduled Removal*: Stan 2.32
24+
25+
26+
## `get_lp()` function
27+
28+
*Deprecated*: The built-in no-argument function `get_lp()` is deprecated.
29+
30+
*Replacement*: Use the no-argument function `target()` instead.
31+
32+
*Scheduled Removal*: Stan 2.32
33+
34+
## `abs(real x)` function
35+
36+
*Deprecated*: Use of the `abs` function with real-valued arguments
37+
is deprecated; use functions `fabs` instead.
38+
39+
40+
## Integer division with `operator/`
41+
42+
*Deprecated*: Using `/` with two integer arguments is interpreted as integer
43+
floor division, such that
44+
45+
$$ 1 / 2 = 0 $$
46+
47+
This is deprecated due to its confusion with real-valued division, where
48+
49+
$$ 1.0 / 2.0 = 0.5 $$
50+
51+
*Replacement*: Use the integer division operator `operator%/%` instead.
1152

12-
```{r results='asis', echo=FALSE}
13-
if (knitr::is_html_output()) {
14-
cat(' * <a href="cov_exp_quad.html">cov_exp_quad</a>\n')
15-
}
16-
```
1753

1854
## integrate_ode_rk45, integrate_ode_adams, integrate_ode_bdf ODE Integrators {#functions-old-ode-solver}
1955

@@ -166,7 +202,7 @@ with values consisting of solutions at the specified times.
166202
The sizes must match, and in particular, the following groups are of
167203
the same size:
168204

169-
* state variables passed into the system function, derivatives
205+
* state variables passed into the system function, derivatives
170206
returned by the system function, initial state passed into the
171207
solver, and rows of the return value of the solver,
172208

@@ -198,42 +234,42 @@ $$
198234

199235
`matrix` **`cov_exp_quad`**`(row_vectors x, real alpha, real rho)`<br>\newline
200236
The covariance matrix with an exponentiated quadratic kernel of x.
201-
`r since("2.16")`
237+
`r since("2.16, deprecated since 2.20, scheduled for removal in 2.32")`
202238

203239
<!-- matrix; cov_exp_quad; (vectors x, real alpha, real rho); -->
204240
\index{{\tt \bfseries cov\_exp\_quad }!{\tt (vectors x, real alpha, real rho): matrix}|hyperpage}
205241

206242
`matrix` **`cov_exp_quad`**`(vectors x, real alpha, real rho)`<br>\newline
207243
The covariance matrix with an exponentiated quadratic kernel of x.
208-
`r since("2.16")`
244+
`r since("2.16, deprecated since 2.20, scheduled for removal in 2.32")`
209245

210246
<!-- matrix; cov_exp_quad; (array[] real x, real alpha, real rho); -->
211247
\index{{\tt \bfseries cov\_exp\_quad }!{\tt (array[] real x, real alpha, real rho): matrix}|hyperpage}
212248

213249
`matrix` **`cov_exp_quad`**`(array[] real x, real alpha, real rho)`<br>\newline
214250
The covariance matrix with an exponentiated quadratic kernel of x.
215-
`r since("2.16")`
251+
`r since("2.16, deprecated since 2.20, scheduled for removal in 2.32")`
216252

217253
<!-- matrix; cov_exp_quad; (row_vectors x1, row_vectors x2, real alpha, real rho); -->
218254
\index{{\tt \bfseries cov\_exp\_quad }!{\tt (row\_vectors x1, row\_vectors x2, real alpha, real rho): matrix}|hyperpage}
219255

220256
`matrix` **`cov_exp_quad`**`(row_vectors x1, row_vectors x2, real alpha, real rho)`<br>\newline
221257
The covariance matrix with an exponentiated quadratic kernel of x1 and
222258
x2.
223-
`r since("2.18")`
259+
`r since("2.18, deprecated since 2.20, scheduled for removal in 2.32")`
224260

225261
<!-- matrix; cov_exp_quad; (vectors x1, vectors x2, real alpha, real rho); -->
226262
\index{{\tt \bfseries cov\_exp\_quad }!{\tt (vectors x1, vectors x2, real alpha, real rho): matrix}|hyperpage}
227263

228264
`matrix` **`cov_exp_quad`**`(vectors x1, vectors x2, real alpha, real rho)`<br>\newline
229265
The covariance matrix with an exponentiated quadratic kernel of x1 and
230266
x2.
231-
`r since("2.18")`
267+
`r since("2.18, deprecated since 2.20, scheduled for removal in 2.32")`
232268

233269
<!-- matrix; cov_exp_quad; (array[] real x1, array[] real x2, real alpha, real rho); -->
234270
\index{{\tt \bfseries cov\_exp\_quad }!{\tt (array[] real x1, array[] real x2, real alpha, real rho): matrix}|hyperpage}
235271

236272
`matrix` **`cov_exp_quad`**`(array[] real x1, array[] real x2, real alpha, real rho)`<br>\newline
237273
The covariance matrix with an exponentiated quadratic kernel of x1 and
238274
x2.
239-
`r since("2.18")`
275+
`r since("2.18, deprecated since 2.20, scheduled for removal in 2.32")`

src/functions-reference/real-valued_basic_functions.Rmd

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -386,8 +386,8 @@ display the log probability accumulator at various stages of execution
386386
to see where it becomes ill defined.
387387

388388
[^fn_lp]: This function used to be called `get_lp()`, but that name
389-
has been deprecated; using it will print a warning. The function
390-
`get_lp()` will be removed in a future release.
389+
has been deprecated; using it will print a warning. The function
390+
`get_lp()` will be removed in Stan 2.32.0.
391391

392392
<!-- real; target; (); -->
393393
\index{{\tt \bfseries target }!{\tt (): real}|hyperpage}
@@ -402,7 +402,7 @@ Return the current value of the log probability accumulator.
402402
`real` **`get_lp`**`()`<br>\newline
403403
Return the current value of the log probability accumulator;
404404
**deprecated;** - use `target()` instead.
405-
`r since("2.5")`
405+
`r since("2.5, scheduled for removal in 2.32.0")`
406406

407407
Both `target` and the deprecated `get_lp` act like other functions
408408
ending in `_lp`, meaning that they may only may only be used in the
@@ -1275,7 +1275,7 @@ function is written as $\binom{x}{y}$ and pronounced "x choose y."
12751275
This function generalizes to real numbers using the gamma function.
12761276
For $0 \leq y \leq x$, \[ \mathrm{binomial\_coefficient\_log}(x,y) =
12771277
\log\Gamma(x+1) - \log\Gamma(y+1) - \log\Gamma(x-y+1). \]
1278-
`r since("2.0, deprecated since 2.10")`
1278+
`r since("2.0, deprecated since 2.10, scheduled for removal in 2.32")`
12791279

12801280
<!-- R; binomial_coefficient_log; (T1 x, T2 y); -->
12811281
\index{{\tt \bfseries binomial\_coefficient\_log }!{\tt (T1 x, T2 y): R}|hyperpage}
@@ -1502,7 +1502,7 @@ _**Warning:**_ This function is deprecated and should be replaced with
15021502
\[ \mathrm{multiply\_log}(x,y) = \begin{cases} 0 & \text{if } x = y =
15031503
0 \\ x \log y & \text{if } x, y \neq 0 \\ \text{NaN} &
15041504
\text{otherwise} \end{cases} \]
1505-
`r since("2.0, deprecated in 2.10")`
1505+
`r since("2.0, deprecated since 2.10, scheduled for removal in 2.32")`
15061506

15071507
<!-- R; multiply_log; (T1 x, T2 y); -->
15081508
\index{{\tt \bfseries multiply\_log }!{\tt (T1 x, T2 y): R}|hyperpage}
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
# Removed Functions
2+
3+
Functions which once existed in the Stan language and have since been replaced
4+
or removed will be listed here.
5+
6+
As of the current version of Stan, there are no such functions.

src/reference-manual/deprecations.Rmd

Lines changed: 52 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,16 @@
1-
# Deprecated Features {#deprecated-features.appendix}
1+
# Deprecated Features
22

33
This appendix lists currently deprecated functionality along with how
4-
to replace it. These deprecated features are likely to be removed in
5-
the next major release.
4+
to replace it.
5+
6+
Starting with Stan 2.29, minor (syntax-level) deprecations can be removed 3
7+
versions after release; e.g., syntax deprecated in Stan 2.20 will be removed in
8+
Stan 2.23 and placed in [Removed Features]. The Stan compiler can
9+
[automatically update](https://mc-stan.org/docs/stan-users-guide/stanc-pretty-printing.html)
10+
many of these on the behalf of the user.
11+
12+
Any feature which changes semantic meaning (such as the upgraded ODE solver
13+
interface) will not be removed until a major version change (e.g., Stan 3.0).
614

715

816
## Assignment with `<-`
@@ -21,6 +29,7 @@ a <- b;
2129
a = b;
2230
```
2331

32+
*Scheduled Removal*: Stan 2.32
2433

2534
## `increment_log_prob` statement
2635

@@ -42,15 +51,18 @@ underlying log density is incremented with each element.
4251
target += u;
4352
```
4453

54+
*Scheduled Removal*: Stan 2.32
4555

4656
## `get_lp()` function
4757

4858

49-
*Deprecated*: The no-argument function `get_lp()` is deprecated.
59+
*Deprecated*: The built-in no-argument function `get_lp()` is deprecated.
5060

5161
*Replacement*: Use the no-argument function `target()` instead.
5262

5363

64+
*Scheduled Removal*: Stan 2.32
65+
5466
## `_log` density and mass functions
5567

5668

@@ -83,10 +95,10 @@ with the log probability mass function
8395
foo_lpmf(y | ...).
8496
```
8597

98+
*Scheduled Removal*: Stan 2.32
8699

87100
## `cdf_log` and `ccdf_log` cumulative distribution functions
88101

89-
90102
*Deprecated*: The log cumulative distribution and complementary
91103
cumulative distribution functions for a distribution `foo` are
92104
currently written as `foo_cdf_log` and `foo_ccdf_log`.
@@ -95,15 +107,6 @@ currently written as `foo_cdf_log` and `foo_ccdf_log`.
95107
Replace `foo_ccdf_log(y, ...)` with `foo_lccdf(y | ...)`.
96108

97109

98-
## `multiply_log` and `binomial_coefficient_log` functions
99-
100-
*Deprecated*: Currently two non-conforming functions ending in suffix
101-
`_log`.
102-
103-
*Replacement*: Replace `multiply_log(...)` with `lmultiply(...)`.
104-
Replace `binomial_coefficient_log(...)` with `lchoose(...)`.
105-
106-
107110
## User-defined function with `_log` suffix
108111

109112
*Deprecated*: A user-defined function ending in `_log` can
@@ -123,6 +126,11 @@ target += foo_log(y, ...);
123126
functions or `_lpmf` for mass functions in the user-defined function.
124127

125128

129+
*Scheduled Removal*: Stan 2.32
130+
131+
Note: Following Stan 2.32, users can stil define a function ending in `_log`,
132+
it will just no longer have a special meaning or support the `~` syntax.
133+
126134
## `lkj_cov` distribution
127135

128136
*Deprecated*:The distribution `lkj_cov` is deprecated.
@@ -155,6 +163,8 @@ block or as a transformed parameter. An even more efficient transform
155163
would use Cholesky factors rather than full correlation matrix types.
156164

157165

166+
*Scheduled Removal*: Stan 3.0 or later.
167+
158168
## `if_else` function
159169

160170
*Deprecated*:The function `if_else` is deprecated. This function
@@ -176,14 +186,10 @@ with
176186
x = a ? b : c;
177187
```
178188

179-
## `abs(real x)` function
180-
181-
*Deprecated*: Use of the `abs` function with real-valued arguments
182-
is deprecated; use functions `fabs` instead.
189+
*Scheduled Removal*: Stan 2.32
183190

184191
## Character `#` as comment prefix
185192

186-
187193
*Deprecated*: The use of `#` for line-based comments is
188194
deprecated. From the first occurrence of `#` onward, the rest
189195
of the line is ignored. This happens after includes are resolved
@@ -192,6 +198,7 @@ x = a ? b : c;
192198
*Replacement*: Use a pair of forward slashes, `//`, for line
193199
comments.
194200

201+
*Scheduled Removal*: Stan 2.32
195202

196203
## Brackets array syntax
197204

@@ -219,3 +226,29 @@ array[3] vector[7] mu;
219226
array[15, 12] matrix[7, 2] mu;
220227
array[2, 3, 4] cholesky_factor_cov[5, 6] mu;
221228
```
229+
230+
*Scheduled Removal*: Stan 2.32
231+
232+
233+
## New Keywords
234+
235+
*Deprecated*: The following identifiers will become
236+
[reserved](#reserved-names)
237+
in the language in the specified version.
238+
239+
*Replacement*: Rename any variables or functions with these names.
240+
241+
| Identifier | Version |
242+
|------------|---------|
243+
| array | 2.32 |
244+
| lower | 2.32 |
245+
| upper | 2.32 |
246+
| offset | 2.32 |
247+
| multiplier | 2.32 |
248+
249+
250+
## Deprecated Functions
251+
252+
Several built-in Stan functions have been deprecated. Consult the
253+
[functions reference](https://mc-stan.org/docs/functions-reference/deprecated-functions.html)
254+
for more information.

src/reference-manual/index.Rmd

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,9 +26,9 @@ for evaluating the results. This manual applies to all Stan
2626
interfaces.
2727

2828
There are two additional interface-neutral manuals, the
29-
[*Stan Functions Reference*]((https://mc-stan.org/docs/functions-reference/index.html)
29+
[*Stan Functions Reference*](https://mc-stan.org/docs/functions-reference/index.html)
3030
listing all the built-in functions and their signatures,
31-
and the [*Stan User's Guide*]((https://mc-stan.org/docs/stan-users-guide/index.html)
31+
and the [*Stan User's Guide*](https://mc-stan.org/docs/stan-users-guide/index.html)
3232
providing examples and programming techniques.
3333
There is also a separate installation and getting started guide for
3434
each interface.

src/reference-manual/types.Rmd

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -75,8 +75,7 @@ and declares `z` to be a $12 \times 8 \times 15$ array of complex numbers.
7575

7676
Prior to 2.26 Stan models used a different syntax.
7777
The old syntax has been deprecated and is described
78-
in [the deprecated features
79-
chapter]{#deprecated-features.appendix}.
78+
in the [Deprecated Features] chapter.
8079

8180

8281
### Constrained data types {-}
@@ -1345,7 +1344,7 @@ variables; containers of any sizes may be assigned to function
13451344
arguments. The constrained matrix types `cov_matrix[K]`,
13461345
`corr_matrix[K]`, `cholesky_factor_cov[K]`, and
13471346
`cholesky_factor_corr[K]` are only assignable to matrices of
1348-
dimensions `matrix[K, K]` types.
1347+
dimensions `matrix[K, K]` types.
13491348

13501349
+-------------------+----------------------+----------------------------------------------+
13511350
| Function Argument | Local | Block |
@@ -1462,12 +1461,12 @@ dimensions `matrix[K, K]` types.
14621461
<a name="id:constrained-types.figure"></a>
14631462

14641463
Additional array types follow the same basic template as the final
1465-
example in the table and can contain any of the previous types.
1464+
example in the table and can contain any of the previous types.
14661465
The unsized version of arrays with more than one dimension is
14671466
specified by using commas, e.g. `array[ , ]` is a 2-D array.
14681467

14691468
For more on how function arguments and return types are declared,
1470-
consult the [User's Guide chapter on
1469+
consult the [User's Guide chapter on
14711470
functions](https://mc-stan.org/docs/stan-users-guide/basic-functions-section.html#type-declarations-for-functions).
14721471

14731472
## Compound variable declaration and definition
@@ -1585,4 +1584,4 @@ together, so long as the constraint for each variable is the same:
15851584

15861585
```stan
15871586
real<lower=0> x, y;
1588-
```
1587+
```

0 commit comments

Comments
 (0)