Skip to content

Commit

Permalink
Document what public API means (#35715)
Browse files Browse the repository at this point in the history
Provides some guidelines, in addition to those added recently by #40533 to the style-guide, per #7561.
  • Loading branch information
tkf authored Apr 20, 2021
1 parent 1131876 commit bb5b98e
Show file tree
Hide file tree
Showing 2 changed files with 32 additions and 0 deletions.
5 changes: 5 additions & 0 deletions doc/src/base/base.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,11 @@ Some general notes:
* By convention, function names ending with an exclamation point (`!`) modify their arguments.
Some functions have both modifying (e.g., `sort!`) and non-modifying (`sort`) versions.

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

## Getting Around

```@docs
Expand Down
27 changes: 27 additions & 0 deletions doc/src/manual/faq.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,33 @@ For similar reasons, automated translation to Julia would also typically generat

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.

## [Public API](@id man-api)

### How does Julia define its public API?

The only interfaces that are stable with respect to [SemVer](https://semver.org/) of `julia`
version are the Julia `Base` and standard libraries interfaces described in
[the documentation](https://docs.julialang.org/) and not marked as unstable (e.g.,
experimental and internal). Functions, types, and constants are not part of the public
API if they are not included in the documentation, _even if they have docstrings_.

### There is a useful undocumented function/type/constant. Can I use it?

Updating Julia may break your code if you use non-public API. If the code is
self-contained, it may be a good idea to copy it into your project. If you want to rely on
a complex non-public API, especially when using it from a stable package, it is a good idea
to open an [issue](https://github.com/JuliaLang/julia/issues) or
[pull request](https://github.com/JuliaLang/julia/pulls) to start a discussion for turning it
into a public API. However, we do not discourage the attempt to create packages that expose
stable public interfaces while relying on non-public implementation details of `julia` and
buffering the differences across different `julia` versions.

### The documentation is not accurate enough. Can I rely on the existing behavior?

Please open an [issue](https://github.com/JuliaLang/julia/issues) or
[pull request](https://github.com/JuliaLang/julia/pulls) to start a discussion for turning the
existing behavior into a public API.

## Sessions and the REPL

### How do I delete an object in memory?
Expand Down

9 comments on commit bb5b98e

@nanosoldier
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Executing the daily package evaluation, I will reply here when finished:

@nanosoldier runtests(ALL, isdaily = true)

@nanosoldier
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Your package evaluation job has completed - possible new issues were detected. A full report can be found here. cc @maleadt

@maleadt
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm deploying a new version of PkgEval.jl, and I'll be using this commit to test the Nanosoldier integration:

@nanosoldier runtests(["JSON", "Crayons"])

@nanosoldier
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Your package evaluation job has completed - possible issues were detected. A full report can be found here. cc @maleadt

@maleadt
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@nanosoldier runtests(["JSON", "Crayons"], vs = ":release-1.6")

@nanosoldier
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Your package evaluation job has completed - no new issues were detected. A full report can be found here. cc @maleadt

@maleadt
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@nanosoldier runtests(ALL, vs = "@2435f96f92ebe8635fd3c43efc93c94cc0ed291a")

@nanosoldier
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Your package evaluation job has completed - possible new issues were detected. A full report can be found here. cc @maleadt

@maleadt
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks similar enough! 🎉

Please sign in to comment.