Skip to content

Commit

Permalink
adjust indentation in doc/manual/types.rst
Browse files Browse the repository at this point in the history
  • Loading branch information
tkelman committed Jul 12, 2016
1 parent f693323 commit 0054026
Showing 1 changed file with 22 additions and 22 deletions.
44 changes: 22 additions & 22 deletions doc/manual/types.rst
Original file line number Diff line number Diff line change
Expand Up @@ -123,8 +123,8 @@ using :func:`convert`:
.. doctest:: foo-func

julia> function foo()
x::Int8 = 100
x
x::Int8 = 100
x
end
foo (generic function with 1 method)

Expand Down Expand Up @@ -251,7 +251,7 @@ An important use of abstract types is to provide default implementations for
concrete types. To give a simple example, consider::

function myplus(x,y)
x+y
x+y
end

The first thing to note is that the above argument declarations are equivalent
Expand All @@ -266,7 +266,7 @@ arguments based on the generic function given above, i.e., it implicitly
defines and compiles::

function myplus(x::Int,y::Int)
x+y
x+y
end

and finally, it invokes this specific method.
Expand Down Expand Up @@ -378,9 +378,9 @@ operator:
.. doctest::

julia> type Foo
bar
baz::Int
qux::Float64
bar
baz::Int
qux::Float64
end

Fields with no type annotation default to :obj:`Any`, and can accordingly
Expand Down Expand Up @@ -477,8 +477,8 @@ It is also possible to define *immutable* composite types by using
the keyword ``immutable`` instead of ``type``::

immutable Complex
real::Float64
imag::Float64
real::Float64
imag::Float64
end

Such types behave much like other composite types, except that instances
Expand Down Expand Up @@ -620,16 +620,16 @@ Parametric Composite Types

abstract Pointy{T}
type Point{T} <: Pointy{T}
x::T
y::T
x::T
y::T
end

Type parameters are introduced immediately after the type name,
surrounded by curly braces::

type Point{T}
x::T
y::T
x::T
y::T
end

This declaration defines a new parametric type, ``Point{T}``, holding
Expand Down Expand Up @@ -853,8 +853,8 @@ example, have declared ``Point{T}`` to be a subtype of ``Pointy{T}`` as
follows::

type Point{T} <: Pointy{T}
x::T
y::T
x::T
y::T
end

Given such a declaration, for each choice of ``T``, we have ``Point{T}``
Expand Down Expand Up @@ -883,7 +883,7 @@ Consider if we create a point-like implementation that only requires a
single coordinate because the point is on the diagonal line *x = y*::

type DiagPoint{T} <: Pointy{T}
x::T
x::T
end

Now both ``Point{Float64}`` and ``DiagPoint{Float64}`` are
Expand Down Expand Up @@ -928,8 +928,8 @@ Type parameters for parametric composite types can be restricted in the
same manner::

type Point{T<:Real} <: Pointy{T}
x::T
y::T
x::T
y::T
end

To give a real-world example of how all this parametric type
Expand All @@ -938,8 +938,8 @@ machinery can be useful, here is the actual definition of Julia's
for simplicity), representing an exact ratio of integers::

immutable Rational{T<:Integer} <: Real
num::T
den::T
num::T
den::T
end

It only makes sense to take ratios of integer values, so the parameter
Expand All @@ -958,8 +958,8 @@ of one field. For example, a 2-element tuple type resembles the following
immutable type::

immutable Tuple2{A,B}
a::A
b::B
a::A
b::B
end

However, there are three key differences:
Expand Down

0 comments on commit 0054026

Please sign in to comment.