Skip to content

Commit bb5b98e

Browse files
authored
Document what public API means (#35715)
Provides some guidelines, in addition to those added recently by #40533 to the style-guide, per #7561.
1 parent 1131876 commit bb5b98e

File tree

2 files changed

+32
-0
lines changed

2 files changed

+32
-0
lines changed

doc/src/base/base.md

+5
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,11 @@ Some general notes:
1515
* By convention, function names ending with an exclamation point (`!`) modify their arguments.
1616
Some functions have both modifying (e.g., `sort!`) and non-modifying (`sort`) versions.
1717

18+
The behaviors of `Base` and standard libraries are stable as defined in
19+
[SemVer](https://semver.org/) only if they are documented; i.e., included in the
20+
[Julia documentation](https://docs.julialang.org/) and not marked as unstable.
21+
See [API FAQ](@ref man-api) for more information.
22+
1823
## Getting Around
1924

2025
```@docs

doc/src/manual/faq.md

+27
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,33 @@ For similar reasons, automated translation to Julia would also typically generat
1818

1919
On the other hand, language *interoperability* is extremely useful: we want to exploit existing high-quality code in other languages from Julia (and vice versa)! The best way to enable this is not a transpiler, but rather via easy inter-language calling facilities. We have worked hard on this, from the built-in `ccall` intrinsic (to call C and Fortran libraries) to [JuliaInterop](https://github.com/JuliaInterop) packages that connect Julia to Python, Matlab, C++, and more.
2020

21+
## [Public API](@id man-api)
22+
23+
### How does Julia define its public API?
24+
25+
The only interfaces that are stable with respect to [SemVer](https://semver.org/) of `julia`
26+
version are the Julia `Base` and standard libraries interfaces described in
27+
[the documentation](https://docs.julialang.org/) and not marked as unstable (e.g.,
28+
experimental and internal). Functions, types, and constants are not part of the public
29+
API if they are not included in the documentation, _even if they have docstrings_.
30+
31+
### There is a useful undocumented function/type/constant. Can I use it?
32+
33+
Updating Julia may break your code if you use non-public API. If the code is
34+
self-contained, it may be a good idea to copy it into your project. If you want to rely on
35+
a complex non-public API, especially when using it from a stable package, it is a good idea
36+
to open an [issue](https://github.com/JuliaLang/julia/issues) or
37+
[pull request](https://github.com/JuliaLang/julia/pulls) to start a discussion for turning it
38+
into a public API. However, we do not discourage the attempt to create packages that expose
39+
stable public interfaces while relying on non-public implementation details of `julia` and
40+
buffering the differences across different `julia` versions.
41+
42+
### The documentation is not accurate enough. Can I rely on the existing behavior?
43+
44+
Please open an [issue](https://github.com/JuliaLang/julia/issues) or
45+
[pull request](https://github.com/JuliaLang/julia/pulls) to start a discussion for turning the
46+
existing behavior into a public API.
47+
2148
## Sessions and the REPL
2249

2350
### How do I delete an object in memory?

0 commit comments

Comments
 (0)