Understanding Julia documentation syntax

I’ve decided to familiarize myself with the documentaion system in Julia.
For that, I am looking through the source Julia code as the source of inspiration.

However, I have encountered a puzzling syntax in one of the source files.
Specifically, in base/abstractarrays.jl:

"""
    AbstractArray{T,N}
Supertype for `N`-dimensional arrays (or array-like types) with elements of type `T`.
[`Array`](@ref) and other types are subtypes of this. See the manual section on the
[`AbstractArray` interface](@ref man-interface-array).
"""
AbstractArray

Here, I see a docstring for abstract type AbstractArray. I expected that it should be followed by the definition of the type

abstract type AbstractArray{T,N} end

Instead, it is followed simply by AbstractArray. Could anyone explain this syntax to me, please?

My guess is that it is there solely for the purpose of documentation.
The actual type is probably defined somewhere else.

Built-ins need a placeholder for the docstrings.

For user-defined types, you don’t need to worry about this.

3 Likes