Skip to content

Instantly share code, notes, and snippets.

@KristofferC
Created February 3, 2017 09:22
Show Gist options
  • Save KristofferC/b73561725c74501c4ebf06ec400a3907 to your computer and use it in GitHub Desktop.
Save KristofferC/b73561725c74501c4ebf06ec400a3907 to your computer and use it in GitHub Desktop.
diff --git a/base/LineEdit.jl b/base/LineEdit.jl
index 3a952c4..8d973b1 100644
--- a/base/LineEdit.jl
+++ b/base/LineEdit.jl
@@ -14,11 +14,11 @@ abstract ModeState
export run_interface, Prompt, ModalInterface, transition, reset_state, edit_insert, keymap
-immutable ModalInterface <: TextInterface
+struct ModalInterface <: TextInterface
modes
end
-type MIState
+mutable struct MIState
interface::ModalInterface
current_mode
aborted::Bool
@@ -33,7 +33,7 @@ function show(io::IO, s::MIState)
print(io, "MI State (", s.current_mode, " active)")
end
-type Prompt <: TextInterface
+mutable struct Prompt <: TextInterface
prompt
# A string or function to be printed before the prompt. May not change the length of the prompt.
# This may be used for changing the color, issuing other terminal escape codes, etc.
@@ -51,12 +51,12 @@ end
show(io::IO, x::Prompt) = show(io, string("Prompt(\"", x.prompt, "\",...)"))
-immutable InputAreaState
+struct InputAreaState
num_rows::Int64
curs_row::Int64
end
-type PromptState <: ModeState
+mutable struct PromptState <: ModeState
terminal
p::Prompt
input_buffer::IOBuffer
@@ -77,10 +77,10 @@ end
abstract HistoryProvider
abstract CompletionProvider
-type EmptyCompletionProvider <: CompletionProvider
+mutable struct EmptyCompletionProvider <: CompletionProvider
end
-type EmptyHistoryProvider <: HistoryProvider
+mutable struct EmptyHistoryProvider <: HistoryProvider
end
reset_state(::EmptyHistoryProvider) = nothing
@@ -712,7 +712,7 @@ end
# Redirect a key as if `seq` had been the keysequence instead in a lazy fashion.
# This is different from the default eager redirect, which only looks at the current and lower
# layers of the stack.
-immutable KeyAlias
+struct KeyAlias
seq::String
KeyAlias(seq) = new(normalize_key(seq))
end
@@ -966,7 +966,7 @@ function write_response_buffer(s::PromptState, data)
refresh_line(s)
end
-type SearchState <: ModeState
+mutable struct SearchState <: ModeState
terminal
histprompt
#rsearch (true) or ssearch (false)
@@ -1010,7 +1010,7 @@ function reset_state(s::SearchState)
reset_state(s.histprompt.hp)
end
-type HistoryPrompt{T<:HistoryProvider} <: TextInterface
+mutable struct HistoryPrompt{T<:HistoryProvider} <: TextInterface
hp::T
complete
keymap_dict::Dict{Char,Any}
@@ -1020,7 +1020,7 @@ end
HistoryPrompt{T<:HistoryProvider}(hp::T) = HistoryPrompt{T}(hp)
init_state(terminal, p::HistoryPrompt) = SearchState(terminal, p, true, IOBuffer(), IOBuffer())
-type PrefixSearchState <: ModeState
+mutable struct PrefixSearchState <: ModeState
terminal
histprompt
prefix::String
@@ -1049,7 +1049,7 @@ input_string(s::PrefixSearchState) = String(s.response_buffer)
# a meta-prompt that presents itself as parent_prompt, but which has an independent keymap
# for prefix searching
-type PrefixHistoryPrompt{T<:HistoryProvider} <: TextInterface
+mutable struct PrefixHistoryPrompt{T<:HistoryProvider} <: TextInterface
hp::T
parent_prompt::Prompt
complete
diff --git a/base/REPL.jl b/base/REPL.jl
index 21cfb94..25dea89 100644
--- a/base/REPL.jl
+++ b/base/REPL.jl
@@ -38,7 +38,7 @@ answer_color(::AbstractREPL) = ""
const JULIA_PROMPT = "julia> "
-type REPLBackend
+mutable struct REPLBackend
"channel for AST"
repl_channel::Channel
"channel for results: (value, nothing) or (error, backtrace)"
@@ -110,7 +110,7 @@ function ip_matches_func(ip, func::Symbol)
return false
end
-immutable REPLDisplay{R<:AbstractREPL} <: Display
+struct REPLDisplay{R<:AbstractREPL} <: Display
repl::R
end
@@ -167,7 +167,7 @@ function print_response(errio::IO, val::ANY, bt, show_value::Bool, have_color::B
end
# A reference to a backend
-immutable REPLBackendRef
+struct REPLBackendRef
repl_channel::Channel
response_channel::Channel
end
@@ -183,7 +183,7 @@ end
## BasicREPL ##
-type BasicREPL <: AbstractREPL
+mutable struct BasicREPL <: AbstractREPL
terminal::TextTerminal
waserror::Bool
BasicREPL(t) = new(t,false)
@@ -241,7 +241,7 @@ end
## LineEditREPL ##
-type LineEditREPL <: AbstractREPL
+mutable struct LineEditREPL <: AbstractREPL
t::TextTerminal
hascolor::Bool
prompt_color::String
@@ -275,15 +275,15 @@ LineEditREPL(t::TextTerminal, envcolors = false) = LineEditREPL(t,
Base.text_colors[:yellow],
false, false, false, envcolors)
-type REPLCompletionProvider <: CompletionProvider
+mutable struct REPLCompletionProvider <: CompletionProvider
r::LineEditREPL
end
-type ShellCompletionProvider <: CompletionProvider
+mutable struct ShellCompletionProvider <: CompletionProvider
r::LineEditREPL
end
-immutable LatexCompletions <: CompletionProvider; end
+struct LatexCompletions <: CompletionProvider; end
beforecursor(buf::IOBuffer) = String(buf.data[1:buf.ptr-1])
@@ -310,7 +310,7 @@ function complete_line(c::LatexCompletions, s)
end
-type REPLHistoryProvider <: HistoryProvider
+mutable struct REPLHistoryProvider <: HistoryProvider
history::Array{String,1}
history_file
start_idx::Int
@@ -949,7 +949,7 @@ end
## StreamREPL ##
-type StreamREPL <: AbstractREPL
+mutable struct StreamREPL <: AbstractREPL
stream::IO
prompt_color::String
input_color::String
diff --git a/base/Terminals.jl b/base/Terminals.jl
index d0c1ac1..9cecdbf 100644
--- a/base/Terminals.jl
+++ b/base/Terminals.jl
@@ -94,11 +94,11 @@ abstract UnixTerminal <: TextTerminal
pipe_reader(t::UnixTerminal) = t.in_stream
pipe_writer(t::UnixTerminal) = t.out_stream
-type TerminalBuffer <: UnixTerminal
+mutable struct TerminalBuffer <: UnixTerminal
out_stream::Base.IO
end
-type TTYTerminal <: UnixTerminal
+mutable struct TTYTerminal <: UnixTerminal
term_type::String
in_stream::Base.TTY
out_stream::Base.TTY
diff --git a/base/abstractarray.jl b/base/abstractarray.jl
index d767e92..10d1c16e 100644
--- a/base/abstractarray.jl
+++ b/base/abstractarray.jl
@@ -246,8 +246,8 @@ end
## Traits for array types ##
abstract LinearIndexing
-immutable LinearFast <: LinearIndexing end
-immutable LinearSlow <: LinearIndexing end
+struct LinearFast <: LinearIndexing end
+struct LinearSlow <: LinearIndexing end
"""
Base.linearindexing(A)
diff --git a/base/associative.jl b/base/associative.jl
index 876b960..40ee1e2 100644
--- a/base/associative.jl
+++ b/base/associative.jl
@@ -25,10 +25,10 @@ function summary(t::Associative)
return string(typeof(t), " with ", n, (n==1 ? " entry" : " entries"))
end
-immutable KeyIterator{T<:Associative}
+struct KeyIterator{T<:Associative}
dict::T
end
-immutable ValueIterator{T<:Associative}
+struct ValueIterator{T<:Associative}
dict::T
end
@@ -290,7 +290,7 @@ and value type and thus its `eltype` is always `Pair{Any,Any}`.
See [`Dict`](@ref) for further help.
"""
-type ObjectIdDict <: Associative{Any,Any}
+mutable struct ObjectIdDict <: Associative{Any,Any}
ht::Vector{Any}
ndel::Int
ObjectIdDict() = new(Vector{Any}(32), 0)
diff --git a/base/asyncmap.jl b/base/asyncmap.jl
index 6179278..f8a789a 100644
--- a/base/asyncmap.jl
+++ b/base/asyncmap.jl
@@ -267,7 +267,7 @@ function asyncmap(f, s::AbstractSparseArray...; kwargs...)
return sparse(asyncmap(f, sa...; kwargs...))
end
-type AsyncCollector
+mutable struct AsyncCollector
f
results
enumerator::Enumerate
@@ -302,7 +302,7 @@ function AsyncCollector(f, results, c...; ntasks=0, batch_size=nothing)
AsyncCollector(f, results, enumerate(zip(c...)), ntasks, batch_size)
end
-type AsyncCollectorState
+mutable struct AsyncCollectorState
chnl::Channel
worker_tasks::Array{Task,1}
enum_state # enumerator state
@@ -367,7 +367,7 @@ be a function which operates on an array of argument tuples.
`collect(AsyncGenerator(f, c...; ntasks=1))` is equivalent to
`map(f, c...)`.
"""
-type AsyncGenerator
+mutable struct AsyncGenerator
collector::AsyncCollector
end
@@ -375,7 +375,7 @@ function AsyncGenerator(f, c...; ntasks=0)
AsyncGenerator(AsyncCollector(f, Dict{Int,Any}(), c...; ntasks=ntasks))
end
-type AsyncGeneratorState
+mutable struct AsyncGeneratorState
i::Int
collector_state::AsyncCollectorState
end
diff --git a/base/atomics.jl b/base/atomics.jl
index f2cd218..2372f2a 100644
--- a/base/atomics.jl
+++ b/base/atomics.jl
@@ -56,7 +56,7 @@ val = x[]
Atomic operations use an `atomic_` prefix, such as `atomic_add!`,
`atomic_xchg!`, etc.
"""
-type Atomic{T<:AtomicTypes}
+mutable struct Atomic{T<:AtomicTypes}
value::T
Atomic() = new(zero(T))
Atomic(value) = new(value)
diff --git a/base/base.jl b/base/base.jl
index 45d8de1..876a1e3 100644
--- a/base/base.jl
+++ b/base/base.jl
@@ -5,7 +5,7 @@
A system call failed with an error code (in the `errno` global variable).
"""
-type SystemError <: Exception
+mutable struct SystemError <: Exception
prefix::AbstractString
errnum::Int32
extrainfo
@@ -20,7 +20,7 @@ end
The expression passed to the `parse` function could not be interpreted as a valid Julia
expression.
"""
-type ParseError <: Exception
+mutable struct ParseError <: Exception
msg::AbstractString
end
@@ -30,7 +30,7 @@ end
The parameters to a function call do not match a valid signature. Argument `msg` is a
descriptive error string.
"""
-type ArgumentError <: Exception
+mutable struct ArgumentError <: Exception
msg::AbstractString
end
@@ -44,7 +44,7 @@ end
An indexing operation into an `Associative` (`Dict`) or `Set` like object tried to access or
delete a non-existent element.
"""
-type KeyError <: Exception
+mutable struct KeyError <: Exception
key
end
@@ -54,7 +54,7 @@ end
A method with the required type signature does not exist in the given generic function.
Alternatively, there is no unique most-specific method.
"""
-type MethodError <: Exception
+mutable struct MethodError <: Exception
f
args
world::UInt
@@ -67,7 +67,7 @@ MethodError(f::ANY, args::ANY) = MethodError(f, args, typemax(UInt))
No more data was available to read from a file or stream.
"""
-type EOFError <: Exception end
+mutable struct EOFError <: Exception end
"""
DimensionMismatch([msg])
@@ -75,7 +75,7 @@ type EOFError <: Exception end
The objects called do not have matching dimensionality. Optional argument `msg` is a
descriptive error string.
"""
-type DimensionMismatch <: Exception
+mutable struct DimensionMismatch <: Exception
msg::AbstractString
end
DimensionMismatch() = DimensionMismatch("")
@@ -86,7 +86,7 @@ DimensionMismatch() = DimensionMismatch("")
The asserted condition did not evaluate to `true`.
Optional argument `msg` is a descriptive error string.
"""
-type AssertionError <: Exception
+mutable struct AssertionError <: Exception
msg::AbstractString
AssertionError() = new("")
AssertionError(msg) = new(msg)
@@ -102,7 +102,7 @@ abstract WrappedException <: Exception
An error occurred while `include`ing, `require`ing, or `using` a file. The error specifics
should be available in the `.error` field.
"""
-type LoadError <: WrappedException
+mutable struct LoadError <: WrappedException
file::AbstractString
line::Int
error
@@ -114,7 +114,7 @@ end
An error occurred when running a module's `__init__` function. The actual error thrown is
available in the `.error` field.
"""
-type InitError <: WrappedException
+mutable struct InitError <: WrappedException
mod::Symbol
error
end
@@ -148,7 +148,7 @@ finalize(o::ANY) = ccall(:jl_finalize_th, Void, (Ptr{Void}, Any,),
gc(full::Bool=true) = ccall(:jl_gc_collect, Void, (Int32,), full)
gc_enable(on::Bool) = ccall(:jl_gc_enable, Int32, (Int32,), on) != 0
-immutable Nullable{T}
+struct Nullable{T}
hasvalue::Bool
value::T
diff --git a/base/base64.jl b/base/base64.jl
index 2c42ef2..9290a8b 100644
--- a/base/base64.jl
+++ b/base/base64.jl
@@ -22,7 +22,7 @@ base64-encoded ASCII bytes written to `ostream`.
Calling [`close`](@ref) on the `Base64EncodePipe` stream
is necessary to complete the encoding (but does not close `ostream`).
"""
-type Base64EncodePipe <: IO
+mutable struct Base64EncodePipe <: IO
io::IO
# writing works in groups of 3, so we need to cache last two bytes written
b0::UInt8
@@ -188,7 +188,7 @@ base64encode(x...) = base64encode(write, x...)
Returns a new read-only I/O stream, which decodes base64-encoded data read from `istream`.
"""
-type Base64DecodePipe <: IO
+mutable struct Base64DecodePipe <: IO
io::IO
# reading works in blocks of 4 characters that are decoded into 3 bytes and 2 of them cached
cache::Vector{UInt8}
diff --git a/base/bitarray.jl b/base/bitarray.jl
index e3f71da..69cca52 100644
--- a/base/bitarray.jl
+++ b/base/bitarray.jl
@@ -4,7 +4,7 @@
# notes: bits are stored in contiguous chunks
# unused bits must always be set to 0
-type BitArray{N} <: DenseArray{Bool, N}
+mutable struct BitArray{N} <: DenseArray{Bool, N}
chunks::Vector{UInt64}
len::Int
dims::NTuple{N,Int}
diff --git a/base/boot.jl b/base/boot.jl
index 20f786d..5a86a34 100644
--- a/base/boot.jl
+++ b/base/boot.jl
@@ -185,7 +185,7 @@ function Typeof end
(f::typeof(Typeof))(x::ANY) = isa(x,Type) ? Type{x} : typeof(x)
abstract Exception
-type ErrorException <: Exception
+mutable struct ErrorException <: Exception
msg::AbstractString
ErrorException(msg::AbstractString) = new(msg)
end
@@ -196,27 +196,27 @@ macro _noinline_meta()
Expr(:meta, :noinline)
end
-immutable BoundsError <: Exception
+struct BoundsError <: Exception
a::Any
i::Any
BoundsError() = new()
BoundsError(a::ANY) = (@_noinline_meta; new(a))
BoundsError(a::ANY, i) = (@_noinline_meta; new(a,i))
end
-immutable DivideError <: Exception end
-immutable DomainError <: Exception end
-immutable OverflowError <: Exception end
-immutable InexactError <: Exception end
-immutable OutOfMemoryError <: Exception end
-immutable ReadOnlyMemoryError<: Exception end
-immutable SegmentationFault <: Exception end
-immutable StackOverflowError <: Exception end
-immutable UndefRefError <: Exception end
-immutable UndefVarError <: Exception
+struct DivideError <: Exception end
+struct DomainError <: Exception end
+struct OverflowError <: Exception end
+struct InexactError <: Exception end
+struct OutOfMemoryError <: Exception end
+struct ReadOnlyMemoryError<: Exception end
+struct SegmentationFault <: Exception end
+struct StackOverflowError <: Exception end
+struct UndefRefError <: Exception end
+struct UndefVarError <: Exception
var::Symbol
end
-immutable InterruptException <: Exception end
-type TypeError <: Exception
+struct InterruptException <: Exception end
+mutable struct TypeError <: Exception
func::Symbol
context::AbstractString
expected::Type
@@ -239,7 +239,7 @@ kwfunc(f::ANY) = ccall(:jl_get_keyword_sorter, Any, (Any,), f)
kwftype(t::ANY) = typeof(ccall(:jl_get_kwsorter, Any, (Any,), t.name))
-type Box
+mutable struct Box
contents::Any
Box(x::ANY) = new(x)
Box() = new()
@@ -247,7 +247,7 @@ end
# constructors for built-in types
-type WeakRef
+mutable struct WeakRef
value
WeakRef() = WeakRef(nothing)
WeakRef(v::ANY) = ccall(:jl_gc_new_weakref_th, Ref{WeakRef},
@@ -267,7 +267,7 @@ Void() = nothing
(::Type{Tuple{}})() = ()
-immutable VecElement{T}
+struct VecElement{T}
value::T
VecElement(value::T) = new(value) # disable converting constructor in Core
end
@@ -351,8 +351,8 @@ atdoc!(λ) = global atdoc = λ
# simple stand-alone print definitions for debugging
abstract IO
-type CoreSTDOUT <: IO end
-type CoreSTDERR <: IO end
+mutable struct CoreSTDOUT <: IO end
+mutable struct CoreSTDERR <: IO end
const STDOUT = CoreSTDOUT()
const STDERR = CoreSTDERR()
io_pointer(::CoreSTDOUT) = Intrinsics.pointerref(Intrinsics.cglobal(:jl_uv_stdout, Ptr{Void}), 1, 1)
diff --git a/base/cartesian.jl b/base/cartesian.jl
index b8b96b5..256844d 100644
--- a/base/cartesian.jl
+++ b/base/cartesian.jl
@@ -266,7 +266,7 @@ inlineanonymous(base::Symbol, ext) = Symbol(base,'_',ext)
# lreplace(:i_d, :d, 3) -> :i_3
# lreplace(:i_{d-1}, :d, 3) -> :i_2
# This follows LaTeX notation.
-immutable LReplace{S<:AbstractString}
+struct LReplace{S<:AbstractString}
pat_sym::Symbol
pat_str::S
val::Int
diff --git a/base/channels.jl b/base/channels.jl
index 61cdf75..0a32b4d 100644
--- a/base/channels.jl
+++ b/base/channels.jl
@@ -17,7 +17,7 @@ Other constructors:
* `Channel(Inf)`: equivalent to `Channel{Any}(typemax(Int))`
* `Channel(sz)`: equivalent to `Channel{Any}(sz)`
"""
-type Channel{T} <: AbstractChannel
+mutable struct Channel{T} <: AbstractChannel
cond_take::Condition # waiting for data to become available
cond_put::Condition # waiting for a writeable slot
state::Symbol
@@ -239,7 +239,7 @@ function close_chnl_on_taskdone(t::Task, ref::WeakRef)
end
end
-type InvalidStateException <: Exception
+mutable struct InvalidStateException <: Exception
msg::AbstractString
state::Symbol
end
@@ -361,7 +361,7 @@ eltype{T}(::Type{Channel{T}}) = T
show(io::IO, c::Channel) = print(io, "$(typeof(c))(sz_max:$(c.sz_max),sz_curr:$(n_avail(c)))")
-type ChannelIterState{T}
+mutable struct ChannelIterState{T}
hasval::Bool
val::T
ChannelIterState(x) = new(x)
diff --git a/base/clusterserialize.jl b/base/clusterserialize.jl
index 93d2e2e..9a9cc21 100644
--- a/base/clusterserialize.jl
+++ b/base/clusterserialize.jl
@@ -4,7 +4,7 @@ import .Serializer: known_object_data, object_number, serialize_cycle, deseriali
__deserialized_types__, serialize_typename, deserialize_typename,
TYPENAME_TAG, object_numbers
-type ClusterSerializer{I<:IO} <: AbstractSerializer
+mutable struct ClusterSerializer{I<:IO} <: AbstractSerializer
io::I
counter::Int
table::ObjectIdDict
diff --git a/base/complex.jl b/base/complex.jl
index 9838f21..7c61cf4 100644
--- a/base/complex.jl
+++ b/base/complex.jl
@@ -1,6 +1,6 @@
# This file is a part of Julia. License is MIT: http://julialang.org/license
-immutable Complex{T<:Real} <: Number
+struct Complex{T<:Real} <: Number
re::T
im::T
end
diff --git a/base/coreio.jl b/base/coreio.jl
index 8e89c7f..2035aae 100644
--- a/base/coreio.jl
+++ b/base/coreio.jl
@@ -5,7 +5,7 @@ print(xs...) = print(STDOUT::IO, xs...)
println(xs...) = println(STDOUT::IO, xs...)
println(io::IO) = print(io, '\n')
-immutable DevNullStream <: IO end
+struct DevNullStream <: IO end
const DevNull = DevNullStream()
isreadable(::DevNullStream) = false
iswritable(::DevNullStream) = true
diff --git a/base/dSFMT.jl b/base/dSFMT.jl
index 5236c8d..77c7d95 100644
--- a/base/dSFMT.jl
+++ b/base/dSFMT.jl
@@ -21,7 +21,7 @@ const JN32 = (N+1)*4+1+1
"Jump polynomial for 10^20 steps for dSFMT with exponent 19937"
const JPOLY1e21 = "e172e20c5d2de26b567c0cace9e7c6cc4407bd5ffcd22ca59d37b73d54fdbd937cd3abc6f502e8c186dbd4f1a06b9e2b894f31be77424f94dddfd5a45888a84ca66eeeb242eefe6764ed859dafccae7a6a635b3a63fe9dfbbd5f2d3f2610d39388f53060e84edae75be4f4f2272c0f1f26d1231836ad040ab091550f8a3a5423fb3ab83e068fe2684057f15691c4dc757a3aee4bca8595bf1ad03500d9620a5dbe3b2d64380694895d2f379ca928238293ea267ce14236d5be816a61f018fe4f6bc3c9865f5d4d4186e320ab653d1f3c035ae83e2ad725648a67d3480331e763a1dcdfb5711b56796170b124f5febd723a664a2deefbfa9999d922a108b0e683582ae8d3baacb5bb56683405ea9e6e0d71ddb24b2229c72bb9d07061f2d1fa097ade823b607a2029d6e121ae09d93de01a154199e8e6a6e77c970bda72ba8079b2b3a15dd494a3188b1d94a25ae108a8a5bd0b050e6ce64a365a21420e07fdeebecae02eb68a4304b59283055d22c27d680ea35952834d828c9b9b9dd1a886b4f7fe82fe8f2a962e1e5390e563dc281c799aee2a441b7a813facb6ff5e94c059710dcfe7e6b1635e21ae0dc878dd5f7cc0e1101a74452495a67d23a2672c939f32c81d4a2611073990e92a084cc3a62fd42ee566f29d963a9cc5100ccd0a200f49ce0a74fa891efa1b974d342b7fedf9269e40d9b34e3c59c3d37201aecd5a04f4ae3d0c9a68c7ab78c662390e4cf36cb63ea3539c442efd0bf4aace4b8c8bde93c3d84b4d6290adfae1c5e3fcd457b6f3159e501f17b72ff6bc13d6bf61fbdafabefd16ac1dae0bca667e4e16a2b800732f1d0a9274c8a4c6cccd2db62fc275dc308c31c11cd6fda78de2f81f0e542b76b42b2cc09ed8f965d94c714c9918064f53af5379cfbbc31edf9cbce694f63a75f122048de6e57b094908f749661456813a908027f5d8397ab7962bf75ac779a3e1b7ae3fbc93397a67b486bb849befff1de6162ef2819715a88f41881e366ace692a900796a2806393898dd1750ac2b4ca3d34ca48942322fb6375f0c9a00c9701048ee8d7d7a17e11739177a7ad5027556e85835daf8594d84a97fe6621c0fce1495ae6ab8676cdc992d247acf5a4e5ec8c4755fde28117228d2c3ecf89edb91e93d949e2174924572265e36d176d082ed1be884e51d885ba3cda175c51edcee5042eaf519d292aa05aa4185b03858d710a9d0880b3d4e5111f858a52fe352cbe0a24f06a3d977ae2eb85e2a03a68131d0ab91dac4941067cf90ecd0fce156bcd40b8968cd4aa11e0b4353b14508d79d13ac00af4a4d452496b7f2393699889aa1e508427dbf0be3db91d955feb51e559af57640c6b3f9d5f95609852c28f9462a9869dd93acbdb1aafb2381ebb886a0b3fcec278f8bb0f62c23e157e49b89245b0881268ce594acbddd3605b9eaa77c9ff513e0dbad514914136d96fe2843fe2b4e886a0b718a9b8d1132132110618d0d3595da284cd2a4c9d09386199e4f4d7723983d3a374b51cf20dac5cabb4ff7e7197c2ebd9318463409baa583d6a6115c1b768282ff37b0fe152c97671e400d5ccba7d6875df0bf95c5d91257fedb124de393f31908d0e36251326aa29dd5be86291c80b4bf78f419ec151eeaeff643a58b48ab35ad2cd2c0b77b1965966ef3db6b6373cb2c4b590cef2f16f4d6f62f13a6cbf1a481565b5935edd4e76f7b6a8fd0d74bc336b40a803aec38125c006c877dfdcdb9ba2b7aecab5cafe6076e024c73e3567adf97f607a71d180402c22a20a8388f517484cc4198f97c2fe4f3407e0dc577e61f0f71354aa601cf4e3e42e1edd8722d50f5af3441f68caa568cc1c3a19956c1233f265bb47236afab24ee42b27b0042b90693d77c1923147360ae6503f6ba6abbc9dd52a7b4c36a3b6b55f6a80cfa7f101dd9f1bfc7d7eaf09a5d636b510228f245bfb37b4625025d2c911435cdf6f878113753e0804ab8ecab870ad733b9728d7636b17578b41239393e7de47cbce871137d2b61729dda67b2b84cd3363aad64c5dd5bd172f1f091305b1ff78982abe7dab1588036d097cf497e300e6c78a926048febd1b9462c07f5868928357b74297c87f503056b89f786d22a538b6702e290bca04639a0f1d0939b67f409e5e58e472a6a07fa543e2531c2567ec73c41f6769b6ba94c5aa0a030d006f5b6b1c5fb218b86a8f63a48bc867466f20f699859e87956f48a182d26ed451861dd21201ecc7239037ada67319bdf0849c387c73a110af798b4c5f9018bc97993e060ea2a2937fa2eb095d65ec07009fc407a350f1d6fb3c98a0a5f204be985b0cb6962f0eb7844a179c4598a92ea32d2d706c800034d2e960ded5b476d77073316b933fb3e6ba2f4f24a3b73a1e4d8ed1491d757ecf56fd72465dac0000736744d28d29073091587c8bccad302f7054e8a32bb8724974d9f3e449fc70b2a41f0008b548f717ac0a2c3a6580bfb50774933a578ad6acdcb89940bb406ea540893f097d8a88d1609ed605f25499de939083a0c8a7c6db462df5dfa06c298dd233e249433a54267d5cdc22e5524705b7d6b16b96bb2cb83e00cef62e21d91528a74cf95bfd1d391590c93f4058e9bb02656fd087a5b63d738d1c3b5cf533fd59c81cf9136bfcd3e955c19daf9906ef175791fde6a1d98155d7881e241c3522551cf9fcae42e1e46929ea39fd00943446823f9755085ccc8456a3090b73a3031a201d9c704a4ad4868dd9b6d06205560013973f60d637de2f18354bf4523d9d81dc2a7e78cd42c586364bbe0ed86fde0f081f801c1a4abb830839b7796d9a01f141bec8bd93144104c6dc59170162c0a5a639eb63a0a164970de50eb2e04f027394b26ed48d341f7851994df79d7cd663672a556f25e5e16a3adbe1003d631de938fabfed234df12b5ff3027f4a2da823834cb098e0f977a4eb9614579d5c7a1d400a1a933a657aef8ea1a66743d73b0cf37a7d64e9a63e4c7b09945f0db750b311b39783fb5ea216616751967d480a630d3da7c89d1c7beae20369137e96734a4cfedca56a7887f076fe4fe97534ad3e4f74d1a81750581a5ea214b440c7f30331ab86c257534c71175d1e731303a48b01c589fda4fb0d4368b4dd63d91204cb6fc389b2202aa94391907bfb72902a4031f5589ed5f391c2ce92aa998c200ba3c77d8bd747b9d0a29fa85cda3949a6d2bd0c3402e68f98fd451aa27b6c2dfd170e004577cbdb25e3a1b9852e9f66a370789c47bfce722446dade1b32ceae71ee0e1d96edf7ed08a93e3690056f46c3d8e63f88e53673ee71d72cfedbeba493ee91333120e09e9ce9f9c9a7a400f814ea618b1de48f9805e092f4e20f301fbb65caa83735a2a5c89befe4bce4116dca3688e1e14c6f09a945671dedbb5c0ba526842b6cae31d8b5ff978bae928a17a75c134630dd9de988f6ad3d89a071b33775a9660a40b48ec61ad3f93ac81cb1c65d8b0bab5c214786abd13cc10a8ea2e2a370e86e2fa1a372d83c9697b5e37b281e51507685f714fdaebe49ffc93a5582e1936eaee8e4140a4b72"
-type DSFMT_state
+mutable struct DSFMT_state
val::Vector{Int32}
DSFMT_state(val::Vector{Int32} = zeros(Int32, JN32)) =
diff --git a/base/datafmt.jl b/base/datafmt.jl
index 79d7a6f..6253a87 100644
--- a/base/datafmt.jl
+++ b/base/datafmt.jl
@@ -143,7 +143,7 @@ end
# DLMStore: Store values directly into a result store (when result dimensions are known)
abstract DLMHandler
-type DLMOffsets <: DLMHandler
+mutable struct DLMOffsets <: DLMHandler
oarr::Vector{Vector{Int}}
offidx::Int
thresh::Int
@@ -194,7 +194,7 @@ function result(dlmoffsets::DLMOffsets)
dlmoffsets.oarr
end
-type DLMStore{T} <: DLMHandler
+mutable struct DLMStore{T} <: DLMHandler
hdr::Array{AbstractString, 2}
data::Array{T, 2}
diff --git a/base/dates/adjusters.jl b/base/dates/adjusters.jl
index ddc4471..eebc68b 100644
--- a/base/dates/adjusters.jl
+++ b/base/dates/adjusters.jl
@@ -124,7 +124,7 @@ end
lastdayofquarter(dt::DateTime) = DateTime(lastdayofquarter(Date(dt)))
# Temporal Adjusters
-immutable DateFunction
+struct DateFunction
f::Function
# validate boolean, single-arg inner constructor
function DateFunction(f::ANY, dt::TimeType)
diff --git a/base/dates/io.jl b/base/dates/io.jl
index a1ba3c4..9a6858b 100644
--- a/base/dates/io.jl
+++ b/base/dates/io.jl
@@ -59,14 +59,14 @@ Base.show(io::IO, x::Time) = print(io, string(x))
end
# Information for parsing and formatting date time values.
-immutable DateFormat{S, T<:Tuple}
+struct DateFormat{S, T<:Tuple}
tokens::T
locale::DateLocale
end
### Token types ###
-immutable DatePart{letter} <: AbstractDateToken
+struct DatePart{letter} <: AbstractDateToken
width::Int
fixed::Bool
end
@@ -167,7 +167,7 @@ end
### Delimiters
-immutable Delim{T, length} <: AbstractDateToken
+struct Delim{T, length} <: AbstractDateToken
d::T
end
diff --git a/base/dates/periods.jl b/base/dates/periods.jl
index b1074e6..75eef13 100644
--- a/base/dates/periods.jl
+++ b/base/dates/periods.jl
@@ -156,7 +156,7 @@ be expressed using a `CompoundPeriod`. In fact, a `CompoundPeriod` is automatica
generated by addition of different period types, e.g. `Year(1) + Day(1)` produces a
`CompoundPeriod` result.
"""
-type CompoundPeriod <: AbstractTime
+mutable struct CompoundPeriod <: AbstractTime
periods::Array{Period, 1}
function CompoundPeriod(p::Vector{Period})
n = length(p)
diff --git a/base/dates/query.jl b/base/dates/query.jl
index 64ae360..71072b8 100644
--- a/base/dates/query.jl
+++ b/base/dates/query.jl
@@ -2,7 +2,7 @@
# Date Locales
-immutable DateLocale
+struct DateLocale
months::Vector{String}
months_abbr::Vector{String}
days_of_week::Vector{String}
diff --git a/base/dates/types.jl b/base/dates/types.jl
index 605b795..fe5038b 100644
--- a/base/dates/types.jl
+++ b/base/dates/types.jl
@@ -22,13 +22,13 @@ abstract DatePeriod <: Period
abstract TimePeriod <: Period
for T in (:Year, :Month, :Week, :Day)
- @eval immutable $T <: DatePeriod
+ @eval struct $T <: DatePeriod
value::Int64
$T(v::Number) = new(v)
end
end
for T in (:Hour, :Minute, :Second, :Millisecond, :Microsecond, :Nanosecond)
- @eval immutable $T <: TimePeriod
+ @eval struct $T <: TimePeriod
value::Int64
$T(v::Number) = new(v)
end
@@ -66,7 +66,7 @@ The `UTInstant` represents a machine timeline based on UT time (1 day = one revo
the earth). The `T` is a `Period` parameter that indicates the resolution or precision of
the instant.
"""
-immutable UTInstant{P<:Period} <: Instant
+struct UTInstant{P<:Period} <: Instant
periods::P
end
@@ -81,10 +81,10 @@ abstract Calendar <: AbstractTime
# ISOCalendar implements the ISO 8601 standard (en.wikipedia.org/wiki/ISO_8601)
# Notably based on the proleptic Gregorian calendar
# ISOCalendar provides interpretation rules for UTInstants to civil date and time parts
-immutable ISOCalendar <: Calendar end
+struct ISOCalendar <: Calendar end
abstract TimeZone
-immutable UTC <: TimeZone end
+struct UTC <: TimeZone end
"""
TimeType
@@ -100,7 +100,7 @@ abstract TimeType <: AbstractTime
`DateTime` wraps a `UTInstant{Millisecond}` and interprets it according to the proleptic
Gregorian calendar.
"""
-immutable DateTime <: TimeType
+struct DateTime <: TimeType
instant::UTInstant{Millisecond}
DateTime(instant::UTInstant{Millisecond}) = new(instant)
end
@@ -110,7 +110,7 @@ end
`Date` wraps a `UTInstant{Day}` and interprets it according to the proleptic Gregorian calendar.
"""
-immutable Date <: TimeType
+struct Date <: TimeType
instant::UTInstant{Day}
Date(instant::UTInstant{Day}) = new(instant)
end
@@ -120,7 +120,7 @@ end
`Time` wraps a `Nanosecond` and represents a specific moment in a 24-hour day.
"""
-immutable Time <: TimeType
+struct Time <: TimeType
instant::Nanosecond
Time(instant::Nanosecond) = new(instant)
end
diff --git a/base/dft.jl b/base/dft.jl
index 5ffeeaa..404371b 100644
--- a/base/dft.jl
+++ b/base/dft.jl
@@ -237,7 +237,7 @@ A_ldiv_B!(y::AbstractArray, p::Plan, x::AbstractArray) = A_mul_B!(y, inv(p), x)
# implementations only need to provide the unnormalized backwards FFT,
# similar to FFTW, and we do the scaling generically to get the ifft:
-type ScaledPlan{T,P,N} <: Plan{T}
+mutable struct ScaledPlan{T,P,N} <: Plan{T}
p::P
scale::N # not T, to avoid unnecessary promotion to Complex
pinv::Plan
diff --git a/base/dict.jl b/base/dict.jl
index 4138fe7..bd71edb 100644
--- a/base/dict.jl
+++ b/base/dict.jl
@@ -89,7 +89,7 @@ Dict{String,Int64} with 2 entries:
"A" => 1
```
"""
-type Dict{K,V} <: Associative{K,V}
+mutable struct Dict{K,V} <: Associative{K,V}
slots::Array{UInt8,1}
keys::Array{K,1}
vals::Array{V,1}
@@ -595,7 +595,7 @@ function filter!(f, d::Union{ObjectIdDict,Dict})
return d
end
-immutable ImmutableDict{K, V} <: Associative{K,V}
+struct ImmutableDict{K, V} <: Associative{K,V}
parent::ImmutableDict{K, V}
key::K
value::V
diff --git a/base/docs/Docs.jl b/base/docs/Docs.jl
index 76db2ee..0f6f31c 100644
--- a/base/docs/Docs.jl
+++ b/base/docs/Docs.jl
@@ -127,7 +127,7 @@ which helps to reduce total precompiled image size.
The `.data` fields stores several values related to the docstring, such as: path,
linenumber, source code, and fielddocs.
"""
-type DocStr
+mutable struct DocStr
text :: Core.SimpleVector
object :: Nullable
data :: Dict{Symbol, Any}
@@ -199,7 +199,7 @@ is stored as `Union{Tuple{T}, Tuple{T, Any}}`.
Note: The `Function`/`DataType` object's signature is always `Union{}`.
"""
-type MultiDoc
+mutable struct MultiDoc
"Ordered (via definition order) vector of object signatures."
order::Vector{Type}
"Documentation for each object. Keys are signatures."
@@ -441,7 +441,7 @@ function nameof(x::Expr, ismacro)
if isexpr(x, :.)
ismacro ? macroname(x) : x
else
- n = isexpr(x, [:module, :type, :bitstype]) ? 2 : 1
+ n = isexpr(x, [:module, :mutable struct, :bitstype]) ? 2 : 1
nameof(x.args[n], ismacro)
end
end
@@ -479,7 +479,7 @@ function metadata(expr)
# Module in which the docstring is defined.
push!(args, :($(Pair)(:module, $(current_module)())))
# Field docs for concrete types.
- if isexpr(expr, :type)
+ if isexpr(expr, :mutable struct)
fields = []
tmp = nothing
for each in expr.args[3].args
diff --git a/base/docs/basedocs.jl b/base/docs/basedocs.jl
index cc75293..e0e09a6 100644
--- a/base/docs/basedocs.jl
+++ b/base/docs/basedocs.jl
@@ -2,7 +2,7 @@
module BaseDocs
-immutable Keyword
+struct Keyword
name :: Symbol
end
macro kw_str(text) Keyword(Symbol(text)) end
diff --git a/base/docs/bindings.jl b/base/docs/bindings.jl
index 045b62b..40ca52c 100644
--- a/base/docs/bindings.jl
+++ b/base/docs/bindings.jl
@@ -2,7 +2,7 @@
export @var
-immutable Binding
+struct Binding
mod::Module
var::Symbol
diff --git a/base/docs/utils.jl b/base/docs/utils.jl
index 173a22f..f99eb57 100644
--- a/base/docs/utils.jl
+++ b/base/docs/utils.jl
@@ -19,7 +19,7 @@ You can also use a stream for large amounts of data:
println(io, "<div>foo</div>")
end
"""
-type HTML{T}
+mutable struct HTML{T}
content::T
end
@@ -64,7 +64,7 @@ You can also use a stream for large amounts of data:
println(io, "foo")
end
"""
-type Text{T}
+mutable struct Text{T}
content::T
end
diff --git a/base/env.jl b/base/env.jl
index cca1831..e4bc18e 100644
--- a/base/env.jl
+++ b/base/env.jl
@@ -63,7 +63,7 @@ end # os test
A singleton of this type provides a hash table interface to environment variables.
"""
-type EnvHash <: Associative{String,String}; end
+mutable struct EnvHash <: Associative{String,String}; end
"""
ENV
diff --git a/base/error.jl b/base/error.jl
index e05d0ec..e5d1cb3 100644
--- a/base/error.jl
+++ b/base/error.jl
@@ -82,7 +82,7 @@ macro assert(ex, msgs...)
return :($(esc(ex)) ? $(nothing) : throw(Main.Base.AssertionError($msg)))
end
-immutable ExponentialBackOff
+struct ExponentialBackOff
n::Int
first_delay::Float64
max_delay::Float64
diff --git a/base/essentials.jl b/base/essentials.jl
index 30d5fea..a55936c 100644
--- a/base/essentials.jl
+++ b/base/essentials.jl
@@ -286,12 +286,12 @@ Very few operations are defined on Colons directly; instead they are converted
by `to_indices` to an internal vector type (`Base.Slice`) to represent the
collection of indices they span before being used.
"""
-immutable Colon
+struct Colon
end
const (:) = Colon()
# For passing constants through type inference
-immutable Val{T}
+struct Val{T}
end
# used by interpolating quote and some other things in the front end
diff --git a/base/event.jl b/base/event.jl
index 2b671aa..0d455eb 100644
--- a/base/event.jl
+++ b/base/event.jl
@@ -12,7 +12,7 @@ called can be woken up. For level-triggered notifications, you must keep extra s
track of whether a notification has happened. The [`Channel`](@ref) type does
this, and so can be used for level-triggered events.
"""
-type Condition
+mutable struct Condition
waitq::Vector{Any}
Condition() = new([])
@@ -235,7 +235,7 @@ when notified from C by a call to `uv_async_send`.
Waiting tasks are woken with an error when the object is closed (by [`close`](@ref).
Use [`isopen`](@ref) to check whether it is still active.
"""
-type AsyncCondition
+mutable struct AsyncCondition
handle::Ptr{Void}
cond::Condition
@@ -308,7 +308,7 @@ Create a timer that wakes up tasks waiting for it (by calling [`wait`](@ref) on
a specified interval. Times are in seconds. Waiting tasks are woken with an error when the
timer is closed (by [`close`](@ref). Use [`isopen`](@ref) to check whether a timer is still active.
"""
-type Timer
+mutable struct Timer
handle::Ptr{Void}
cond::Condition
isopen::Bool
diff --git a/base/fft/FFTW.jl b/base/fft/FFTW.jl
index c33fe02..b4ec31d 100644
--- a/base/fft/FFTW.jl
+++ b/base/fft/FFTW.jl
@@ -73,7 +73,7 @@ typealias fftwTypeSingle Union{Type{Float32},Type{Complex64}}
# since it is not written to. Hence, it is convenient to create an
# array-like type that carries a size and a stride like a "real" array
# but which is converted to C_NULL as a pointer.
-immutable FakeArray{T, N} <: DenseArray{T, N}
+struct FakeArray{T, N} <: DenseArray{T, N}
sz::NTuple{N, Int}
st::NTuple{N, Int}
end
@@ -154,7 +154,7 @@ end
# pointer type for fftw_plan (opaque pointer)
-immutable fftw_plan_struct end
+struct fftw_plan_struct end
typealias PlanPtr Ptr{fftw_plan_struct}
# Planner timelimits
@@ -200,7 +200,7 @@ end
abstract FFTWPlan{T<:fftwNumber,K,inplace} <: Plan{T}
for P in (:cFFTWPlan, :rFFTWPlan, :r2rFFTWPlan) # complex, r2c/c2r, and r2r
@eval begin
- type $P{T<:fftwNumber,K,inplace,N} <: FFTWPlan{T,K,inplace}
+ mutable struct $P{T<:fftwNumber,K,inplace,N} <: FFTWPlan{T,K,inplace}
plan::PlanPtr
sz::NTuple{N, Int} # size of array on which plan operates (Int tuple)
osz::NTuple{N, Int} # size of output array (Int tuple)
diff --git a/base/fft/dct.jl b/base/fft/dct.jl
index 00e8675..3d3a661 100644
--- a/base/fft/dct.jl
+++ b/base/fft/dct.jl
@@ -9,7 +9,7 @@ export dct, idct, dct!, idct!, plan_dct, plan_idct, plan_dct!, plan_idct!
# Unlike Matlab we compute the multidimensional transform by default,
# similar to the Julia fft functions.
-type DCTPlan{T<:fftwNumber,K,inplace} <: Plan{T}
+mutable struct DCTPlan{T<:fftwNumber,K,inplace} <: Plan{T}
plan::r2rFFTWPlan{T}
r::Array{UnitRange{Int}} # array of indices for rescaling
nrm::Float64 # normalization factor
diff --git a/base/file.jl b/base/file.jl
index 1cc1829..30eb969 100644
--- a/base/file.jl
+++ b/base/file.jl
@@ -389,7 +389,7 @@ function mktempdir(fn::Function, parent=tempdir())
end
end
-immutable uv_dirent_t
+struct uv_dirent_t
name::Ptr{UInt8}
typ::Cint
end
diff --git a/base/filesystem.jl b/base/filesystem.jl
index e90a1b8..5a54d0a 100644
--- a/base/filesystem.jl
+++ b/base/filesystem.jl
@@ -59,7 +59,7 @@ include(string(length(Core.ARGS)>=2?Core.ARGS[2]:"","file_constants.jl")) # inc
abstract AbstractFile <: IO
-type File <: AbstractFile
+mutable struct File <: AbstractFile
open::Bool
handle::RawFD
File(fd::RawFD) = new(true, fd)
diff --git a/base/generator.jl b/base/generator.jl
index 4fd4588..50c40b0 100644
--- a/base/generator.jl
+++ b/base/generator.jl
@@ -9,7 +9,7 @@ The syntax `f(x) [if cond(x)::Bool] for x in iter` is syntax for constructing an
type. The `[if cond(x)::Bool]` expression is optional and acts as a "guard", effectively
filtering out values where the condition is false.
"""
-immutable Generator{I,F}
+struct Generator{I,F}
f::F
iter::I
end
@@ -30,10 +30,10 @@ end
## iterator traits
abstract IteratorSize
-immutable SizeUnknown <: IteratorSize end
-immutable HasLength <: IteratorSize end
-immutable HasShape <: IteratorSize end
-immutable IsInfinite <: IteratorSize end
+struct SizeUnknown <: IteratorSize end
+struct HasLength <: IteratorSize end
+struct HasShape <: IteratorSize end
+struct IsInfinite <: IteratorSize end
"""
iteratorsize(itertype::Type) -> IteratorSize
@@ -64,8 +64,8 @@ iteratorsize(x) = iteratorsize(typeof(x))
iteratorsize(::Type) = HasLength() # HasLength is the default
abstract IteratorEltype
-immutable EltypeUnknown <: IteratorEltype end
-immutable HasEltype <: IteratorEltype end
+struct EltypeUnknown <: IteratorEltype end
+struct HasEltype <: IteratorEltype end
"""
iteratoreltype(itertype::Type) -> IteratorEltype
diff --git a/base/gmp.jl b/base/gmp.jl
index 3cdf65b..03a61e3 100644
--- a/base/gmp.jl
+++ b/base/gmp.jl
@@ -38,7 +38,7 @@ else
end
-type BigInt <: Integer
+mutable struct BigInt <: Integer
alloc::Cint
size::Cint
d::Ptr{Limb}
diff --git a/base/grisu/bignums.jl b/base/grisu/bignums.jl
index 6dfb917..db65740 100644
--- a/base/grisu/bignums.jl
+++ b/base/grisu/bignums.jl
@@ -49,7 +49,7 @@ const kBigitMask = Chunk((1 << kBigitSize) - 1)
# grow. There are no checks if the stack-allocated space is sufficient.
const kBigitCapacity = div(kMaxSignificantBits,kBigitSize)
-type Bignum
+mutable struct Bignum
bigits::Array{UInt32,1}
used_digits::Int32
exponent::Int32
diff --git a/base/grisu/float.jl b/base/grisu/float.jl
index 70de682..c545b8c 100644
--- a/base/grisu/float.jl
+++ b/base/grisu/float.jl
@@ -28,7 +28,7 @@
# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-immutable Float
+struct Float
s::UInt64
e::Int32
de::Int32
diff --git a/base/inference.jl b/base/inference.jl
index c38693a..52bd783 100644
--- a/base/inference.jl
+++ b/base/inference.jl
@@ -6,7 +6,7 @@ import Core: _apply, svec, apply_type, Builtin, IntrinsicFunction, MethodInstanc
const MAX_TYPEUNION_LEN = 3
const MAX_TYPE_DEPTH = 8
-immutable InferenceParams
+struct InferenceParams
world::UInt
# optimization
@@ -47,20 +47,20 @@ const Slot_UsedUndef = 32
#### inference state types ####
-immutable NotFound end
+struct NotFound end
const NF = NotFound()
typealias LineNum Int
typealias VarTable Array{Any,1}
# The type of a variable load is either a value or an UndefVarError
-type VarState
+mutable struct VarState
typ
undef::Bool
VarState(typ::ANY, undef::Bool) = new(typ, undef)
end
# The type of a value might be constant
-immutable Const
+struct Const
val
Const(v::ANY) = new(v)
end
@@ -70,7 +70,7 @@ end
# limit the type of some other variable
# The Conditional type tracks the set of branches on variable type info
# that was used to create the boolean condition
-type Conditional
+mutable struct Conditional
var::Union{Slot,SSAValue}
vtype
elsetype
@@ -82,7 +82,7 @@ type Conditional
end
end
-immutable PartialTypeVar
+struct PartialTypeVar
tv::TypeVar
# N.B.: Currently unused, but would allow turning something back
# into Const, if the bounds are pulled out of this TypeVar
@@ -97,7 +97,7 @@ function rewrap(t::ANY, u::ANY)
return rewrap_unionall(t, u)
end
-type InferenceState
+mutable struct InferenceState
sp::SimpleVector # static parameters
label_counter::Int # index of the current highest label for this function
mod::Module
@@ -1929,7 +1929,7 @@ end
#### handling for statement-position expressions ####
-type StateUpdate
+mutable struct StateUpdate
var::Union{Slot,SSAValue}
vtype
state::VarTable
@@ -3309,7 +3309,7 @@ end
#### post-inference optimizations ####
-immutable InvokeData
+struct InvokeData
mt::MethodTable
entry::TypeMapEntry
types0
diff --git a/base/intset.jl b/base/intset.jl
index 2200c73..c133a14 100644
--- a/base/intset.jl
+++ b/base/intset.jl
@@ -1,6 +1,6 @@
# This file is a part of Julia. License is MIT: http://julialang.org/license
-type IntSet <: AbstractSet{Int}
+mutable struct IntSet <: AbstractSet{Int}
bits::Array{UInt32,1}
limit::Int
fill1s::Bool
diff --git a/base/io.jl b/base/io.jl
index 7db13a6..6b206ad 100644
--- a/base/io.jl
+++ b/base/io.jl
@@ -538,7 +538,7 @@ readstring(filename::AbstractString) = open(readstring, filename)
## high-level iterator interfaces ##
-type EachLine
+mutable struct EachLine
stream::IO
ondone::Function
chomp::Bool
diff --git a/base/iobuffer.jl b/base/iobuffer.jl
index a77c2f8..fd1afc0 100644
--- a/base/iobuffer.jl
+++ b/base/iobuffer.jl
@@ -3,7 +3,7 @@
## work with AbstractVector{UInt8} via I/O primitives ##
# Stateful string
-type AbstractIOBuffer{T<:AbstractVector{UInt8}} <: IO
+mutable struct AbstractIOBuffer{T<:AbstractVector{UInt8}} <: IO
data::T # T should support: getindex, setindex!, length, copy!, resize!, and T()
readable::Bool
writable::Bool
diff --git a/base/iostream.jl b/base/iostream.jl
index a205011..dc0b0ac 100644
--- a/base/iostream.jl
+++ b/base/iostream.jl
@@ -4,7 +4,7 @@
const sizeof_ios_t = Int(ccall(:jl_sizeof_ios_t, Cint, ()))
-type IOStream <: IO
+mutable struct IOStream <: IO
handle::Ptr{Void}
ios::Array{UInt8,1}
name::AbstractString
diff --git a/base/irrationals.jl b/base/irrationals.jl
index d17111f..ae8f4d4 100644
--- a/base/irrationals.jl
+++ b/base/irrationals.jl
@@ -2,7 +2,7 @@
## general machinery for irrational mathematical constants
-immutable Irrational{sym} <: Real end
+struct Irrational{sym} <: Real end
show{sym}(io::IO, x::Irrational{sym}) = print(io, "$sym = $(string(float(x))[1:15])...")
diff --git a/base/iterators.jl b/base/iterators.jl
index 9f759ad..44cc8a3 100644
--- a/base/iterators.jl
+++ b/base/iterators.jl
@@ -28,7 +28,7 @@ and_iteratoreltype(a, b) = EltypeUnknown()
# enumerate
-immutable Enumerate{I}
+struct Enumerate{I}
itr::I
end
@@ -80,7 +80,7 @@ zip_iteratorsize(a::IsInfinite, b) = zip_iteratorsize(b,a)
zip_iteratorsize(a::IsInfinite, b::IsInfinite) = IsInfinite()
-immutable Zip1{I} <: AbstractZipIterator
+struct Zip1{I} <: AbstractZipIterator
a::I
end
zip(a) = Zip1(a)
@@ -98,7 +98,7 @@ end
iteratorsize{I}(::Type{Zip1{I}}) = iteratorsize(I)
iteratoreltype{I}(::Type{Zip1{I}}) = iteratoreltype(I)
-immutable Zip2{I1, I2} <: AbstractZipIterator
+struct Zip2{I1, I2} <: AbstractZipIterator
a::I1
b::I2
end
@@ -118,7 +118,7 @@ end
iteratorsize{I1,I2}(::Type{Zip2{I1,I2}}) = zip_iteratorsize(iteratorsize(I1),iteratorsize(I2))
iteratoreltype{I1,I2}(::Type{Zip2{I1,I2}}) = and_iteratoreltype(iteratoreltype(I1),iteratoreltype(I2))
-immutable Zip{I, Z<:AbstractZipIterator} <: AbstractZipIterator
+struct Zip{I, Z<:AbstractZipIterator} <: AbstractZipIterator
a::I
z::Z
end
@@ -171,7 +171,7 @@ iteratoreltype{I1,I2}(::Type{Zip{I1,I2}}) = and_iteratoreltype(iteratoreltype(I1
# filter
-immutable Filter{F,I}
+struct Filter{F,I}
flt::F
itr::I
end
@@ -212,7 +212,7 @@ iteratorsize{T<:Filter}(::Type{T}) = SizeUnknown()
# Rest -- iterate starting at the given state
-immutable Rest{I,S}
+struct Rest{I,S}
itr::I
st::S
end
@@ -237,7 +237,7 @@ iteratorsize{I,S}(::Type{Rest{I,S}}) = rest_iteratorsize(iteratorsize(I))
# Count -- infinite counting
-immutable Count{S<:Number}
+struct Count{S<:Number}
start::S
step::S
end
@@ -261,7 +261,7 @@ iteratorsize{S}(::Type{Count{S}}) = IsInfinite()
# Take -- iterate through the first n elements
-immutable Take{I}
+struct Take{I}
xs::I
n::Int
end
@@ -316,7 +316,7 @@ end
# Drop -- iterator through all but the first n elements
-immutable Drop{I}
+struct Drop{I}
xs::I
n::Int
end
@@ -374,7 +374,7 @@ done(it::Drop, state) = done(it.xs, state)
# Cycle an iterator forever
-immutable Cycle{I}
+struct Cycle{I}
xs::I
end
@@ -408,7 +408,7 @@ done(it::Cycle, state) = state[2]
# Repeated - repeat an object infinitely many times
-immutable Repeated{O}
+struct Repeated{O}
x::O
end
repeated(x) = Repeated(x)
@@ -476,7 +476,7 @@ _prod_indices(a, b, A, B) =
throw(ArgumentError("Cannot construct indices for objects of types $(typeof(a)) and $(typeof(b))"))
# one iterator
-immutable Prod1{I} <: AbstractProdIterator
+struct Prod1{I} <: AbstractProdIterator
a::I
end
product(a) = Prod1(a)
@@ -496,7 +496,7 @@ iteratoreltype{I}(::Type{Prod1{I}}) = iteratoreltype(I)
iteratorsize{I}(::Type{Prod1{I}}) = iteratorsize(I)
# two iterators
-immutable Prod2{I1, I2} <: AbstractProdIterator
+struct Prod2{I1, I2} <: AbstractProdIterator
a::I1
b::I2
end
@@ -548,7 +548,7 @@ end
@inline done(p::AbstractProdIterator, st) = st[4]
# n iterators
-immutable Prod{I1, I2<:AbstractProdIterator} <: AbstractProdIterator
+struct Prod{I1, I2<:AbstractProdIterator} <: AbstractProdIterator
a::I1
b::I2
end
@@ -574,7 +574,7 @@ prod_iteratorsize(a, b) = SizeUnknown()
# flatten an iterator of iterators
-immutable Flatten{I}
+struct Flatten{I}
it::I
end
@@ -649,7 +649,7 @@ julia> collect(Iterators.partition([1,2,3,4,5], 2))
partition{T}(c::T, n::Integer) = PartitionIterator{T}(c, Int(n))
-type PartitionIterator{T}
+mutable struct PartitionIterator{T}
c::T
n::Int
end
diff --git a/base/libc.jl b/base/libc.jl
index ea0e4b3..d811c79 100644
--- a/base/libc.jl
+++ b/base/libc.jl
@@ -15,7 +15,7 @@ include(string(length(Core.ARGS)>=2?Core.ARGS[2]:"","errno_h.jl")) # include($B
## RawFD ##
# Wrapper for an OS file descriptor (on both Unix and Windows)
-immutable RawFD
+struct RawFD
fd::Int32
RawFD(fd::Integer) = new(fd)
RawFD(fd::RawFD) = fd
@@ -30,7 +30,7 @@ dup(src::RawFD, target::RawFD) = systemerror("dup", -1 ==
# Wrapper for an OS file descriptor (for Windows)
if is_windows()
- immutable WindowsRawSocket
+ struct WindowsRawSocket
handle::Ptr{Void} # On Windows file descriptors are HANDLE's and 64-bit on 64-bit Windows
end
Base.cconvert(::Type{Ptr{Void}}, fd::WindowsRawSocket) = fd.handle
@@ -42,7 +42,7 @@ end
## FILE (not auto-finalized) ##
-immutable FILE
+struct FILE
ptr::Ptr{Void}
end
@@ -96,7 +96,7 @@ else
error("systemsleep undefined for this OS")
end
-immutable TimeVal
+struct TimeVal
sec::Int64
usec::Int64
end
@@ -114,7 +114,7 @@ end
Convert a number of seconds since the epoch to broken-down format, with fields `sec`, `min`,
`hour`, `mday`, `month`, `year`, `wday`, `yday`, and `isdst`.
"""
-type TmStruct
+mutable struct TmStruct
sec::Int32
min::Int32
hour::Int32
diff --git a/base/libdl.jl b/base/libdl.jl
index 5f2b696..a9e6568 100644
--- a/base/libdl.jl
+++ b/base/libdl.jl
@@ -180,7 +180,7 @@ File extension for dynamic libraries (e.g. dll, dylib, so) on the current platfo
dlext
if is_linux()
- immutable dl_phdr_info
+ struct dl_phdr_info
# Base address of object
addr::Cuint
diff --git a/base/libgit2/error.jl b/base/libgit2/error.jl
index 1d6c904..8e91bec 100644
--- a/base/libgit2/error.jl
+++ b/base/libgit2/error.jl
@@ -58,12 +58,12 @@ export GitError
Describe,
Rebase)
-immutable ErrorStruct
+struct ErrorStruct
message::Ptr{UInt8}
class::Cint
end
-immutable GitError <: Exception
+struct GitError <: Exception
class::Class
code::Code
msg::AbstractString
diff --git a/base/libgit2/libgit2.jl b/base/libgit2/libgit2.jl
index fba4695..e9906a1 100644
--- a/base/libgit2/libgit2.jl
+++ b/base/libgit2/libgit2.jl
@@ -36,7 +36,7 @@ include("callbacks.jl")
using .Error
-immutable State
+struct State
head::GitHash
index::GitHash
work::GitHash
diff --git a/base/libgit2/types.jl b/base/libgit2/types.jl
index ecc4a85..e5315c6 100644
--- a/base/libgit2/types.jl
+++ b/base/libgit2/types.jl
@@ -14,7 +14,7 @@ abstract AbstractGitHash
A git object identifier, based on the sha-1 hash. It is a $OID_RAWSZ byte string
($OID_HEXSZ hex digits) used to identify a `GitObject` in a repository.
"""
-immutable GitHash <: AbstractGitHash
+struct GitHash <: AbstractGitHash
val::NTuple{OID_RAWSZ, UInt8}
GitHash(val::NTuple{OID_RAWSZ, UInt8}) = new(val)
end
@@ -29,7 +29,7 @@ is unique.
Internally it is stored as two fields: a full-size `GitHash` (`hash`) and a length
(`len`). Only the initial `len` hex digits of `hash` are used.
"""
-immutable GitShortHash <: AbstractGitHash
+struct GitShortHash <: AbstractGitHash
hash::GitHash # underlying hash: unused digits are ignored
len::Csize_t # length in hex digits
end
@@ -41,7 +41,7 @@ end
Time in a signature.
Matches the [`git_time`](https://libgit2.github.com/libgit2/#HEAD/type/git_time) struct.
"""
-immutable TimeStruct
+struct TimeStruct
time::Int64 # time in seconds from epoch
offset::Cint # timezone offset in minutes
end
@@ -52,7 +52,7 @@ end
An action signature (e.g. for committers, taggers, etc).
Matches the [`git_signature`](https://libgit2.github.com/libgit2/#HEAD/type/git_signature) struct.
"""
-immutable SignatureStruct
+struct SignatureStruct
name::Ptr{UInt8} # full name of the author
email::Ptr{UInt8} # email of the author
when::TimeStruct # time when the action happened
@@ -81,7 +81,7 @@ strs = String[...]
```
Note that no call to `free` is required as the data is allocated by Julia.
"""
-immutable StrArrayStruct
+struct StrArrayStruct
strings::Ptr{Cstring}
count::Csize_t
end
@@ -107,7 +107,7 @@ free(buf_ref)
In particular, note that `LibGit2.free` should be called afterward on the `Ref` object.
"""
-immutable Buffer
+struct Buffer
ptr::Ptr{Cchar}
asize::Csize_t
size::Csize_t
@@ -132,7 +132,7 @@ reset!(p::AbstractCredentials, cnt::Int=3) = nothing
Matches the [`git_checkout_options`](https://libgit2.github.com/libgit2/#HEAD/type/git_checkout_options) struct.
"""
-@kwdef immutable CheckoutOptions
+@kwdef struct CheckoutOptions
version::Cuint = 1
checkout_strategy::Cuint = Consts.CHECKOUT_SAFE
@@ -169,7 +169,7 @@ end
Callback settings.
Matches the [`git_remote_callbacks`](https://libgit2.github.com/libgit2/#HEAD/type/git_remote_callbacks) struct.
"""
-@kwdef immutable RemoteCallbacks
+@kwdef struct RemoteCallbacks
version::Cuint = 1
sideband_progress::Ptr{Void}
completion::Ptr{Void}
@@ -196,7 +196,7 @@ Options for connecting through a proxy.
Matches the [`git_proxy_options`](https://libgit2.github.com/libgit2/#HEAD/type/git_proxy_options) struct.
"""
-@kwdef immutable ProxyOptions
+@kwdef struct ProxyOptions
version::Cuint = 1
proxytype::Cint
url::Cstring
@@ -211,7 +211,7 @@ end
Matches the [`git_fetch_options`](https://libgit2.github.com/libgit2/#HEAD/type/git_fetch_options) struct.
"""
-@kwdef immutable FetchOptions
+@kwdef struct FetchOptions
version::Cuint = 1
callbacks::RemoteCallbacks
prune::Cint = Consts.FETCH_PRUNE_UNSPECIFIED
@@ -230,7 +230,7 @@ end
Matches the [`git_clone_options`](https://libgit2.github.com/libgit2/#HEAD/type/git_clone_options) struct.
"""
-@kwdef immutable CloneOptions
+@kwdef struct CloneOptions
version::Cuint = 1
checkout_opts::CheckoutOptions
fetch_opts::FetchOptions
@@ -248,7 +248,7 @@ end
Matches the [`git_diff_options`](https://libgit2.github.com/libgit2/#HEAD/type/git_diff_options) struct.
"""
-@kwdef immutable DiffOptionsStruct
+@kwdef struct DiffOptionsStruct
version::Cuint = Consts.DIFF_OPTIONS_VERSION
flags::UInt32 = Consts.DIFF_NORMAL
@@ -276,7 +276,7 @@ end
Description of one side of a delta.
Matches the [`git_diff_file`](https://libgit2.github.com/libgit2/#HEAD/type/git_diff_file) struct.
"""
-immutable DiffFile
+struct DiffFile
id::GitHash
path::Cstring
size::Int64
@@ -293,7 +293,7 @@ end
Description of changes to one entry.
Matches the [`git_diff_file`](https://libgit2.github.com/libgit2/#HEAD/type/git_diff_file) struct.
"""
-immutable DiffDelta
+struct DiffDelta
status::Cint
flags::UInt32
similarity::UInt16
@@ -307,7 +307,7 @@ end
Matches the [`git_merge_options`](https://libgit2.github.com/libgit2/#HEAD/type/git_merge_options) struct.
"""
-@kwdef immutable MergeOptions
+@kwdef struct MergeOptions
version::Cuint = 1
flags::Cint
rename_threshold::Cuint = 50
@@ -328,7 +328,7 @@ end
Matches the [`git_push_options`](https://libgit2.github.com/libgit2/#HEAD/type/git_push_options) struct.
"""
-@kwdef immutable PushOptions
+@kwdef struct PushOptions
version::Cuint = 1
parallelism::Cint = 1
callbacks::RemoteCallbacks
@@ -345,7 +345,7 @@ end
Matches the [`git_index_time`](https://libgit2.github.com/libgit2/#HEAD/type/git_index_time) struct.
"""
-immutable IndexTime
+struct IndexTime
seconds::Int64
nanoseconds::Cuint
end
@@ -356,7 +356,7 @@ end
In-memory representation of a file entry in the index.
Matches the [`git_index_entry`](https://libgit2.github.com/libgit2/#HEAD/type/git_index_entry) struct.
"""
-immutable IndexEntry
+struct IndexEntry
ctime::IndexTime
mtime::IndexTime
@@ -381,7 +381,7 @@ Base.show(io::IO, ie::IndexEntry) = print(io, "IndexEntry($(string(ie.id)))")
Matches the `git_rebase_options` struct.
"""
-@kwdef immutable RebaseOptions
+@kwdef struct RebaseOptions
version::Cuint = 1
quiet::Cint = 1
@static if LibGit2.VERSION >= v"0.24.0"
@@ -400,7 +400,7 @@ end
Describes a single instruction/operation to be performed during the rebase.
Matches the [`git_rebase_operation`](https://libgit2.github.com/libgit2/#HEAD/type/git_rebase_operation_t) struct.
"""
-immutable RebaseOperation
+struct RebaseOperation
optype::Cint
id::GitHash
exec::Cstring
@@ -413,7 +413,7 @@ Base.show(io::IO, rbo::RebaseOperation) = print(io, "RebaseOperation($(string(rb
Options to control how `git_status_foreach_ext()` will issue callbacks.
Matches the [`git_status_opt_t`](https://libgit2.github.com/libgit2/#HEAD/type/git_status_opt_t) struct.
"""
-@kwdef immutable StatusOptions
+@kwdef struct StatusOptions
version::Cuint = 1
show::Cint = Consts.STATUS_SHOW_INDEX_AND_WORKDIR
flags::Cuint = Consts.STATUS_OPT_INCLUDE_UNTRACKED |
@@ -430,7 +430,7 @@ Providing the differences between the file as it exists in HEAD and the index, a
providing the differences between the index and the working directory.
Matches the `git_status_entry` struct.
"""
-immutable StatusEntry
+struct StatusEntry
status::Cuint
head_to_index::Ptr{DiffDelta}
index_to_workdir::Ptr{DiffDelta}
@@ -443,7 +443,7 @@ Contains the information about HEAD during a fetch, including the name and URL
of the branch fetched from, the oid of the HEAD, and whether the fetched HEAD
has been merged locally.
"""
-immutable FetchHead
+struct FetchHead
name::String
url::String
oid::GitHash
@@ -476,7 +476,7 @@ for (typ, reporef, sup, cname) in [
(:GitTag, :GitRepo, :GitObject, :git_tag)]
if reporef === nothing
- @eval type $typ <: $sup
+ @eval mutable struct $typ <: $sup
ptr::Ptr{Void}
function $typ(ptr::Ptr{Void},fin=true)
# fin=false should only be used when the pointer should not be free'd
@@ -491,7 +491,7 @@ for (typ, reporef, sup, cname) in [
end
end
elseif reporef == :Nullable
- @eval type $typ <: $sup
+ @eval mutable struct $typ <: $sup
nrepo::Nullable{GitRepo}
ptr::Ptr{Void}
function $typ(repo::GitRepo, ptr::Ptr{Void})
@@ -510,7 +510,7 @@ for (typ, reporef, sup, cname) in [
end
end
elseif reporef == :GitRepo
- @eval type $typ <: $sup
+ @eval mutable struct $typ <: $sup
repo::GitRepo
ptr::Ptr{Void}
function $typ(repo::GitRepo, ptr::Ptr{Void})
@@ -546,7 +546,7 @@ end
This is a Julia wrapper around a pointer to a
[`git_signature`](https://libgit2.github.com/libgit2/#HEAD/type/git_signature) object.
"""
-type GitSignature <: AbstractGitObject
+mutable struct GitSignature <: AbstractGitObject
ptr::Ptr{SignatureStruct}
function GitSignature(ptr::Ptr{SignatureStruct})
@assert ptr != C_NULL
@@ -563,7 +563,7 @@ function Base.close(obj::GitSignature)
end
# Structure has the same layout as SignatureStruct
-type Signature
+mutable struct Signature
name::String
email::String
time::Int64
@@ -627,7 +627,7 @@ end
import Base.securezero!
"Credentials that support only `user` and `password` parameters"
-type UserPasswordCredentials <: AbstractCredentials
+mutable struct UserPasswordCredentials <: AbstractCredentials
user::String
pass::String
prompt_if_incorrect::Bool # Whether to allow interactive prompting if the credentials are incorrect
@@ -648,7 +648,7 @@ function securezero!(cred::UserPasswordCredentials)
end
"SSH credentials type"
-type SSHCredentials <: AbstractCredentials
+mutable struct SSHCredentials <: AbstractCredentials
user::String
pass::String
pubkey::String
@@ -674,7 +674,7 @@ function securezero!(cred::SSHCredentials)
end
"Credentials that support caching"
-type CachedCredentials <: AbstractCredentials
+mutable struct CachedCredentials <: AbstractCredentials
cred::Dict{String,AbstractCredentials}
count::Int # authentication failure protection count
CachedCredentials() = new(Dict{String,AbstractCredentials}(),3)
diff --git a/base/libuv.jl b/base/libuv.jl
index 27e2d2c..1037e7c 100644
--- a/base/libuv.jl
+++ b/base/libuv.jl
@@ -54,7 +54,7 @@ unpreserve_handle(x) = (v = uvhandles[x]::Int; v == 1 ? pop!(uvhandles,x) : (uvh
## Libuv error handling ##
-type UVError <: Exception
+mutable struct UVError <: Exception
prefix::AbstractString
code::Int32
UVError(p::AbstractString,code::Integer)=new(p,code)
diff --git a/base/linalg/arnoldi.jl b/base/linalg/arnoldi.jl
index d6df493..1cf7d51 100644
--- a/base/linalg/arnoldi.jl
+++ b/base/linalg/arnoldi.jl
@@ -284,7 +284,7 @@ end
## svds
### Restrict operator to BlasFloat because ARPACK only supports that. Loosen restriction
### when we switch to our own implementation
-type SVDOperator{T<:BlasFloat,S} <: AbstractArray{T, 2}
+mutable struct SVDOperator{T<:BlasFloat,S} <: AbstractArray{T, 2}
X::S
m::Int
n::Int
diff --git a/base/linalg/bidiag.jl b/base/linalg/bidiag.jl
index f040cd1..abc86a9 100644
--- a/base/linalg/bidiag.jl
+++ b/base/linalg/bidiag.jl
@@ -1,7 +1,7 @@
# This file is a part of Julia. License is MIT: http://julialang.org/license
# Bidiagonal matrices
-type Bidiagonal{T} <: AbstractMatrix{T}
+mutable struct Bidiagonal{T} <: AbstractMatrix{T}
dv::Vector{T} # diagonal
ev::Vector{T} # sub/super diagonal
isupper::Bool # is upper bidiagonal (true) or lower (false)
diff --git a/base/linalg/bunchkaufman.jl b/base/linalg/bunchkaufman.jl
index ac155f1..8bc0985 100644
--- a/base/linalg/bunchkaufman.jl
+++ b/base/linalg/bunchkaufman.jl
@@ -4,7 +4,7 @@
## LD for BunchKaufman, UL for CholeskyDense, LU for LUDense and
## define size methods for Factorization types using it.
-immutable BunchKaufman{T,S<:AbstractMatrix} <: Factorization{T}
+struct BunchKaufman{T,S<:AbstractMatrix} <: Factorization{T}
LD::S
ipiv::Vector{BlasInt}
uplo::Char
diff --git a/base/linalg/cholesky.jl b/base/linalg/cholesky.jl
index f01d07d..fa435ff 100644
--- a/base/linalg/cholesky.jl
+++ b/base/linalg/cholesky.jl
@@ -27,14 +27,14 @@
# checks of those fields before calls to LAPACK to check which version of the Cholesky
# factorization the type represents.
-immutable Cholesky{T,S<:AbstractMatrix} <: Factorization{T}
+struct Cholesky{T,S<:AbstractMatrix} <: Factorization{T}
factors::S
uplo::Char
end
Cholesky{T}(A::AbstractMatrix{T}, uplo::Symbol) = Cholesky{T,typeof(A)}(A, char_uplo(uplo))
Cholesky{T}(A::AbstractMatrix{T}, uplo::Char) = Cholesky{T,typeof(A)}(A, uplo)
-immutable CholeskyPivoted{T,S<:AbstractMatrix} <: Factorization{T}
+struct CholeskyPivoted{T,S<:AbstractMatrix} <: Factorization{T}
factors::S
uplo::Char
piv::Vector{BlasInt}
diff --git a/base/linalg/diagonal.jl b/base/linalg/diagonal.jl
index 12d9826..65a0092 100644
--- a/base/linalg/diagonal.jl
+++ b/base/linalg/diagonal.jl
@@ -2,7 +2,7 @@
## Diagonal matrices
-immutable Diagonal{T} <: AbstractMatrix{T}
+struct Diagonal{T} <: AbstractMatrix{T}
diag::Vector{T}
end
"""
diff --git a/base/linalg/eigen.jl b/base/linalg/eigen.jl
index 9386a7f..6cebc1f 100644
--- a/base/linalg/eigen.jl
+++ b/base/linalg/eigen.jl
@@ -1,7 +1,7 @@
# This file is a part of Julia. License is MIT: http://julialang.org/license
# Eigendecomposition
-immutable Eigen{T,V,S<:AbstractMatrix,U<:AbstractVector} <: Factorization{T}
+struct Eigen{T,V,S<:AbstractMatrix,U<:AbstractVector} <: Factorization{T}
values::U
vectors::S
Eigen(values::AbstractVector{V}, vectors::AbstractMatrix{T}) = new(values, vectors)
@@ -9,7 +9,7 @@ end
Eigen{T,V}(values::AbstractVector{V}, vectors::AbstractMatrix{T}) = Eigen{T,V,typeof(vectors),typeof(values)}(values, vectors)
# Generalized eigenvalue problem.
-immutable GeneralizedEigen{T,V,S<:AbstractMatrix,U<:AbstractVector} <: Factorization{T}
+struct GeneralizedEigen{T,V,S<:AbstractMatrix,U<:AbstractVector} <: Factorization{T}
values::U
vectors::S
GeneralizedEigen(values::AbstractVector{V}, vectors::AbstractMatrix{T}) = new(values, vectors)
diff --git a/base/linalg/exceptions.jl b/base/linalg/exceptions.jl
index 89dfee2..4032024 100644
--- a/base/linalg/exceptions.jl
+++ b/base/linalg/exceptions.jl
@@ -6,11 +6,11 @@ export LAPACKException,
PosDefException,
RankDeficientException
-type LAPACKException <: Exception
+mutable struct LAPACKException <: Exception
info::BlasInt
end
-type ARPACKException <: Exception
+mutable struct ARPACKException <: Exception
info::String
end
@@ -25,14 +25,14 @@ function ARPACKException(i::Integer)
return ARPACKException("unspecified ARPACK error: $i")
end
-type SingularException <: Exception
+mutable struct SingularException <: Exception
info::BlasInt
end
-type PosDefException <: Exception
+mutable struct PosDefException <: Exception
info::BlasInt
end
-type RankDeficientException <: Exception
+mutable struct RankDeficientException <: Exception
info::BlasInt
end
diff --git a/base/linalg/givens.jl b/base/linalg/givens.jl
index 8096347..398fdf7 100644
--- a/base/linalg/givens.jl
+++ b/base/linalg/givens.jl
@@ -24,13 +24,13 @@ therefore be multiplied with matrices of arbitrary size as long as `i2<=size(A,2
See also: [`givens`](@ref)
"""
-immutable Givens{T} <: AbstractRotation{T}
+struct Givens{T} <: AbstractRotation{T}
i1::Int
i2::Int
c::T
s::T
end
-type Rotation{T} <: AbstractRotation{T}
+mutable struct Rotation{T} <: AbstractRotation{T}
rotations::Vector{Givens{T}}
end
diff --git a/base/linalg/hessenberg.jl b/base/linalg/hessenberg.jl
index faa7c48..eeea393 100644
--- a/base/linalg/hessenberg.jl
+++ b/base/linalg/hessenberg.jl
@@ -1,6 +1,6 @@
# This file is a part of Julia. License is MIT: http://julialang.org/license
-immutable Hessenberg{T,S<:AbstractMatrix} <: Factorization{T}
+struct Hessenberg{T,S<:AbstractMatrix} <: Factorization{T}
factors::S
τ::Vector{T}
Hessenberg(factors::AbstractMatrix{T}, τ::Vector{T}) = new(factors, τ)
@@ -52,7 +52,7 @@ function hessfact{T}(A::StridedMatrix{T})
return hessfact!(copy_oftype(A, S))
end
-immutable HessenbergQ{T,S<:AbstractMatrix} <: AbstractMatrix{T}
+struct HessenbergQ{T,S<:AbstractMatrix} <: AbstractMatrix{T}
factors::S
τ::Vector{T}
HessenbergQ(factors::AbstractMatrix{T}, τ::Vector{T}) = new(factors, τ)
diff --git a/base/linalg/ldlt.jl b/base/linalg/ldlt.jl
index 27989ef..55260cc 100644
--- a/base/linalg/ldlt.jl
+++ b/base/linalg/ldlt.jl
@@ -1,6 +1,6 @@
# This file is a part of Julia. License is MIT: http://julialang.org/license
-immutable LDLt{T,S<:AbstractMatrix} <: Factorization{T}
+struct LDLt{T,S<:AbstractMatrix} <: Factorization{T}
data::S
end
diff --git a/base/linalg/lq.jl b/base/linalg/lq.jl
index 81d06d2..657e37f 100644
--- a/base/linalg/lq.jl
+++ b/base/linalg/lq.jl
@@ -2,13 +2,13 @@
# LQ Factorizations
-immutable LQ{T,S<:AbstractMatrix} <: Factorization{T}
+struct LQ{T,S<:AbstractMatrix} <: Factorization{T}
factors::S
τ::Vector{T}
LQ(factors::AbstractMatrix{T}, τ::Vector{T}) = new(factors, τ)
end
-immutable LQPackedQ{T,S<:AbstractMatrix} <: AbstractMatrix{T}
+struct LQPackedQ{T,S<:AbstractMatrix} <: AbstractMatrix{T}
factors::Matrix{T}
τ::Vector{T}
LQPackedQ(factors::AbstractMatrix{T}, τ::Vector{T}) = new(factors, τ)
diff --git a/base/linalg/lu.jl b/base/linalg/lu.jl
index 501d154..df6f02d 100644
--- a/base/linalg/lu.jl
+++ b/base/linalg/lu.jl
@@ -3,7 +3,7 @@
####################
# LU Factorization #
####################
-immutable LU{T,S<:AbstractMatrix} <: Factorization{T}
+struct LU{T,S<:AbstractMatrix} <: Factorization{T}
factors::S
ipiv::Vector{BlasInt}
info::BlasInt
diff --git a/base/linalg/qr.jl b/base/linalg/qr.jl
index c27e852..9929f7b 100644
--- a/base/linalg/qr.jl
+++ b/base/linalg/qr.jl
@@ -2,21 +2,21 @@
# QR and Hessenberg Factorizations
-immutable QR{T,S<:AbstractMatrix} <: Factorization{T}
+struct QR{T,S<:AbstractMatrix} <: Factorization{T}
factors::S
τ::Vector{T}
QR(factors::AbstractMatrix{T}, τ::Vector{T}) = new(factors, τ)
end
QR{T}(factors::AbstractMatrix{T}, τ::Vector{T}) = QR{T,typeof(factors)}(factors, τ)
# Note. For QRCompactWY factorization without pivoting, the WY representation based method introduced in LAPACK 3.4
-immutable QRCompactWY{S,M<:AbstractMatrix} <: Factorization{S}
+struct QRCompactWY{S,M<:AbstractMatrix} <: Factorization{S}
factors::M
T::Matrix{S}
QRCompactWY(factors::AbstractMatrix{S}, T::AbstractMatrix{S}) = new(factors, T)
end
QRCompactWY{S}(factors::AbstractMatrix{S}, T::AbstractMatrix{S}) = QRCompactWY{S,typeof(factors)}(factors, T)
-immutable QRPivoted{T,S<:AbstractMatrix} <: Factorization{T}
+struct QRPivoted{T,S<:AbstractMatrix} <: Factorization{T}
factors::S
τ::Vector{T}
jpvt::Vector{BlasInt}
@@ -339,14 +339,14 @@ end
getq(A::QRCompactWY) = QRCompactWYQ(A.factors,A.T)
getq(A::Union{QR, QRPivoted}) = QRPackedQ(A.factors,A.τ)
-immutable QRPackedQ{T,S<:AbstractMatrix} <: AbstractMatrix{T}
+struct QRPackedQ{T,S<:AbstractMatrix} <: AbstractMatrix{T}
factors::S
τ::Vector{T}
QRPackedQ(factors::AbstractMatrix{T}, τ::Vector{T}) = new(factors, τ)
end
QRPackedQ{T}(factors::AbstractMatrix{T}, τ::Vector{T}) = QRPackedQ{T,typeof(factors)}(factors, τ)
-immutable QRCompactWYQ{S, M<:AbstractMatrix} <: AbstractMatrix{S}
+struct QRCompactWYQ{S, M<:AbstractMatrix} <: AbstractMatrix{S}
factors::M
T::Matrix{S}
QRCompactWYQ(factors::AbstractMatrix{S}, T::Matrix{S}) = new(factors, T)
diff --git a/base/linalg/rowvector.jl b/base/linalg/rowvector.jl
index c5d2839..1722712 100644
--- a/base/linalg/rowvector.jl
+++ b/base/linalg/rowvector.jl
@@ -13,7 +13,7 @@ whereas a row vector can be multiplied by a matrix on its right (such that
its transpose returns a vector and the inner product `v1.' * v2` returns a
scalar, but will otherwise behave similarly.
"""
-immutable RowVector{T,V<:AbstractVector} <: AbstractMatrix{T}
+struct RowVector{T,V<:AbstractVector} <: AbstractMatrix{T}
vec::V
function RowVector(v::V)
check_types(T,v)
diff --git a/base/linalg/schur.jl b/base/linalg/schur.jl
index cfd75d2..4f91457 100644
--- a/base/linalg/schur.jl
+++ b/base/linalg/schur.jl
@@ -1,7 +1,7 @@
# This file is a part of Julia. License is MIT: http://julialang.org/license
# Schur decomposition
-immutable Schur{Ty,S<:AbstractMatrix} <: Factorization{Ty}
+struct Schur{Ty,S<:AbstractMatrix} <: Factorization{Ty}
T::S
Z::S
values::Vector
@@ -144,7 +144,7 @@ either both included or both excluded via `select`.
ordschur{Ty<:BlasFloat}(T::StridedMatrix{Ty}, Z::StridedMatrix{Ty}, select::Union{Vector{Bool},BitVector}) =
ordschur!(copy(T), copy(Z), select)
-immutable GeneralizedSchur{Ty,M<:AbstractMatrix} <: Factorization{Ty}
+struct GeneralizedSchur{Ty,M<:AbstractMatrix} <: Factorization{Ty}
S::M
T::M
alpha::Vector
diff --git a/base/linalg/svd.jl b/base/linalg/svd.jl
index f0ee0d3..8658f0e 100644
--- a/base/linalg/svd.jl
+++ b/base/linalg/svd.jl
@@ -1,7 +1,7 @@
# This file is a part of Julia. License is MIT: http://julialang.org/license
# Singular Value Decomposition
-immutable SVD{T,Tr,M<:AbstractArray} <: Factorization{T}
+struct SVD{T,Tr,M<:AbstractArray} <: Factorization{T}
U::M
S::Vector{Tr}
Vt::M
@@ -173,7 +173,7 @@ function A_ldiv_B!{Ta,Tb}(A::SVD{Ta}, B::StridedVecOrMat{Tb})
end
# Generalized svd
-immutable GeneralizedSVD{T,S} <: Factorization{T}
+struct GeneralizedSVD{T,S} <: Factorization{T}
U::S
V::S
Q::S
diff --git a/base/linalg/symmetric.jl b/base/linalg/symmetric.jl
index 51edfa0..1b7b7c6 100644
--- a/base/linalg/symmetric.jl
+++ b/base/linalg/symmetric.jl
@@ -1,7 +1,7 @@
# This file is a part of Julia. License is MIT: http://julialang.org/license
#Symmetric and Hermitian matrices
-immutable Symmetric{T,S<:AbstractMatrix} <: AbstractMatrix{T}
+struct Symmetric{T,S<:AbstractMatrix} <: AbstractMatrix{T}
data::S
uplo::Char
end
@@ -41,7 +41,7 @@ julia> Slower = Symmetric(A, :L)
Note that `Supper` will not be equal to `Slower` unless `A` is itself symmetric (e.g. if `A == A.'`).
"""
Symmetric(A::AbstractMatrix, uplo::Symbol=:U) = (checksquare(A);Symmetric{eltype(A),typeof(A)}(A, char_uplo(uplo)))
-immutable Hermitian{T,S<:AbstractMatrix} <: AbstractMatrix{T}
+struct Hermitian{T,S<:AbstractMatrix} <: AbstractMatrix{T}
data::S
uplo::Char
end
diff --git a/base/linalg/triangular.jl b/base/linalg/triangular.jl
index 61c8ffe..9b2ac72 100644
--- a/base/linalg/triangular.jl
+++ b/base/linalg/triangular.jl
@@ -9,7 +9,7 @@ abstract AbstractTriangular{T,S<:AbstractMatrix} <: AbstractMatrix{T}
for t in (:LowerTriangular, :UnitLowerTriangular, :UpperTriangular,
:UnitUpperTriangular)
@eval begin
- immutable $t{T,S<:AbstractMatrix} <: AbstractTriangular{T,S}
+ struct $t{T,S<:AbstractMatrix} <: AbstractTriangular{T,S}
data::S
end
$t(A::$t) = A
diff --git a/base/linalg/tridiag.jl b/base/linalg/tridiag.jl
index 26c2e7f..4ce8144 100644
--- a/base/linalg/tridiag.jl
+++ b/base/linalg/tridiag.jl
@@ -3,7 +3,7 @@
#### Specialized matrix types ####
## (complex) symmetric tridiagonal matrices
-immutable SymTridiagonal{T} <: AbstractMatrix{T}
+struct SymTridiagonal{T} <: AbstractMatrix{T}
dv::Vector{T} # diagonal
ev::Vector{T} # subdiagonal
function SymTridiagonal(dv::Vector{T}, ev::Vector{T})
@@ -294,7 +294,7 @@ end
###################
#Needed for inv_usmani()
-type ZeroOffsetVector
+mutable struct ZeroOffsetVector
data::Vector
end
getindex( a::ZeroOffsetVector, i) = a.data[i+1]
@@ -385,7 +385,7 @@ function setindex!(A::SymTridiagonal, x, i::Integer, j::Integer)
end
## Tridiagonal matrices ##
-immutable Tridiagonal{T} <: AbstractMatrix{T}
+struct Tridiagonal{T} <: AbstractMatrix{T}
dl::Vector{T} # sub-diagonal
d::Vector{T} # diagonal
du::Vector{T} # sup-diagonal
diff --git a/base/linalg/uniformscaling.jl b/base/linalg/uniformscaling.jl
index 583ec94..89cb031 100644
--- a/base/linalg/uniformscaling.jl
+++ b/base/linalg/uniformscaling.jl
@@ -4,7 +4,7 @@ import Base: copy, ctranspose, getindex, show, transpose, one, zero, inv,
@_pure_meta, hcat, vcat, hvcat
import Base.LinAlg: SingularException
-immutable UniformScaling{T<:Number}
+struct UniformScaling{T<:Number}
λ::T
end
diff --git a/base/loading.jl b/base/loading.jl
index 0e62463..aa746cd 100644
--- a/base/loading.jl
+++ b/base/loading.jl
@@ -277,7 +277,7 @@ end
# We throw PrecompilableError(true) when a module wants to be precompiled but isn't,
# and PrecompilableError(false) when a module doesn't want to be precompiled but is
-immutable PrecompilableError <: Exception
+struct PrecompilableError <: Exception
isprecompilable::Bool
end
function show(io::IO, ex::PrecompilableError)
diff --git a/base/lock.jl b/base/lock.jl
index e0bd86d..00d0fb9 100644
--- a/base/lock.jl
+++ b/base/lock.jl
@@ -10,7 +10,7 @@ Each `lock` must be matched with an `unlock`.
This lock is NOT threadsafe. See `Threads.Mutex` for a threadsafe lock.
"""
-type ReentrantLock
+mutable struct ReentrantLock
locked_by::Nullable{Task}
cond_wait::Condition
reentrancy_cnt::Int
@@ -124,7 +124,7 @@ Each acquire must be mached with a release.
This construct is NOT threadsafe.
"""
-type Semaphore
+mutable struct Semaphore
sem_size::Int
curr_cnt::Int
cond_wait::Condition
diff --git a/base/locks.jl b/base/locks.jl
index 5f699c3..09dd591 100644
--- a/base/locks.jl
+++ b/base/locks.jl
@@ -27,7 +27,7 @@ abstract AbstractLock
See SpinLock.
"""
-immutable TatasLock <: AbstractLock
+struct TatasLock <: AbstractLock
handle::Atomic{Int}
TatasLock() = new(Atomic{Int}(0))
end
@@ -86,7 +86,7 @@ end
See RecursiveSpinLock.
"""
-immutable RecursiveTatasLock <: AbstractLock
+struct RecursiveTatasLock <: AbstractLock
ownertid::Atomic{Int16}
handle::Atomic{Int}
RecursiveTatasLock() = new(Atomic{Int16}(0), Atomic{Int}(0))
@@ -179,7 +179,7 @@ on pthreads, this is a `pthread_mutex_t`.
See also SpinLock for a lighter-weight lock.
"""
-type Mutex <: AbstractLock
+mutable struct Mutex <: AbstractLock
ownertid::Int16
handle::Ptr{Void}
function Mutex()
diff --git a/base/managers.jl b/base/managers.jl
index c270183..f06d3fa 100644
--- a/base/managers.jl
+++ b/base/managers.jl
@@ -2,7 +2,7 @@
# Built-in SSH and Local Managers
-immutable SSHManager <: ClusterManager
+struct SSHManager <: ClusterManager
machines::Dict
function SSHManager(machines)
@@ -282,7 +282,7 @@ end
# LocalManager
-immutable LocalManager <: ClusterManager
+struct LocalManager <: ClusterManager
np::Integer
restrict::Bool # Restrict binding to 127.0.0.1 only
end
@@ -365,7 +365,7 @@ manage
# DefaultClusterManager for the default TCP transport - used by both SSHManager and LocalManager
-immutable DefaultClusterManager <: ClusterManager
+struct DefaultClusterManager <: ClusterManager
end
const tunnel_hosts_map = Dict{AbstractString, Semaphore}()
diff --git a/base/markdown/Common/block.jl b/base/markdown/Common/block.jl
index 9a8aed8..0594ffe 100644
--- a/base/markdown/Common/block.jl
+++ b/base/markdown/Common/block.jl
@@ -4,7 +4,7 @@
# Paragraphs
# ––––––––––
-type Paragraph
+mutable struct Paragraph
content
end
@@ -40,7 +40,7 @@ end
# Headers
# –––––––
-type Header{level}
+mutable struct Header{level}
text
end
@@ -96,7 +96,7 @@ end
# Code
# ––––
-type Code
+mutable struct Code
language::String
code::String
end
@@ -125,7 +125,7 @@ end
# Footnote
# --------
-type Footnote
+mutable struct Footnote
id::String
text
end
@@ -160,7 +160,7 @@ end
# Quotes
# ––––––
-type BlockQuote
+mutable struct BlockQuote
content
end
@@ -189,7 +189,7 @@ end
# Admonitions
# -----------
-type Admonition
+mutable struct Admonition
category::String
title::String
content::Vector
@@ -247,7 +247,7 @@ end
# Lists
# –––––
-type List
+mutable struct List
items::Vector{Any}
ordered::Int # `-1` is unordered, `>= 0` is ordered.
@@ -332,7 +332,7 @@ pushitem!(list, buffer) = push!(list.items, parse(String(take!(buffer))).content
# HorizontalRule
# ––––––––––––––
-type HorizontalRule
+mutable struct HorizontalRule
end
function horizontalrule(stream::IO, block::MD)
diff --git a/base/markdown/Common/inline.jl b/base/markdown/Common/inline.jl
index 46f9426..1ef1171 100644
--- a/base/markdown/Common/inline.jl
+++ b/base/markdown/Common/inline.jl
@@ -4,7 +4,7 @@
# Emphasis
# ––––––––
-type Italic
+mutable struct Italic
text
end
@@ -14,7 +14,7 @@ function asterisk_italic(stream::IO, md::MD)
return result === nothing ? nothing : Italic(parseinline(result, md))
end
-type Bold
+mutable struct Bold
text
end
@@ -54,7 +54,7 @@ end
# Images & Links
# ––––––––––––––
-type Image
+mutable struct Image
url::String
alt::String
end
@@ -73,7 +73,7 @@ function image(stream::IO, md::MD)
end
end
-type Link
+mutable struct Link
text
url::String
end
@@ -147,7 +147,7 @@ end
# Punctuation
# –––––––––––
-type LineBreak end
+mutable struct LineBreak end
@trigger '\\' ->
function linebreak(stream::IO, md::MD)
diff --git a/base/markdown/GitHub/table.jl b/base/markdown/GitHub/table.jl
index 0448566..dc31fad 100644
--- a/base/markdown/GitHub/table.jl
+++ b/base/markdown/GitHub/table.jl
@@ -1,6 +1,6 @@
# This file is a part of Julia. License is MIT: http://julialang.org/license
-type Table
+mutable struct Table
rows::Vector{Vector{Any}}
align::Vector{Symbol}
end
diff --git a/base/markdown/IPython/IPython.jl b/base/markdown/IPython/IPython.jl
index 47d564b..1cceb3e 100644
--- a/base/markdown/IPython/IPython.jl
+++ b/base/markdown/IPython/IPython.jl
@@ -1,6 +1,6 @@
# This file is a part of Julia. License is MIT: http://julialang.org/license
-type LaTeX
+mutable struct LaTeX
formula::String
end
diff --git a/base/markdown/parse/config.jl b/base/markdown/parse/config.jl
index d004a82..eba4128 100644
--- a/base/markdown/parse/config.jl
+++ b/base/markdown/parse/config.jl
@@ -2,7 +2,7 @@
typealias InnerConfig Dict{Char, Vector{Function}}
-type Config
+mutable struct Config
breaking::Vector{Function}
regular::Vector{Function}
inner::InnerConfig
diff --git a/base/markdown/parse/parse.jl b/base/markdown/parse/parse.jl
index 0b22c83..c061ee6 100644
--- a/base/markdown/parse/parse.jl
+++ b/base/markdown/parse/parse.jl
@@ -1,6 +1,6 @@
# This file is a part of Julia. License is MIT: http://julialang.org/license
-type MD
+mutable struct MD
content::Vector{Any}
meta::Dict{Any, Any}
diff --git a/base/mmap.jl b/base/mmap.jl
index 96ba008..e9402b3 100644
--- a/base/mmap.jl
+++ b/base/mmap.jl
@@ -5,7 +5,7 @@ module Mmap
const PAGESIZE = Int(is_unix() ? ccall(:jl_getpagesize, Clong, ()) : ccall(:jl_getallocationgranularity, Clong, ()))
# for mmaps not backed by files
-type Anonymous <: IO
+mutable struct Anonymous <: IO
name::AbstractString
readonly::Bool
create::Bool
diff --git a/base/mpfr.jl b/base/mpfr.jl
index 024860e..214367a 100644
--- a/base/mpfr.jl
+++ b/base/mpfr.jl
@@ -61,7 +61,7 @@ julia> big"2.1"
2.099999999999999999999999999999999999999999999999999999999999999999999999999986
```
"""
-type BigFloat <: AbstractFloat
+mutable struct BigFloat <: AbstractFloat
prec::Clong
sign::Cint
exp::Clong
diff --git a/base/multi.jl b/base/multi.jl
index 2f4d676..3211b05 100644
--- a/base/multi.jl
+++ b/base/multi.jl
@@ -27,7 +27,7 @@ let REF_ID::Int = 1
next_ref_id() = (id = REF_ID; REF_ID += 1; id)
end
-immutable RRID
+struct RRID
whence::Int
id::Int
@@ -46,7 +46,7 @@ hash(r::RRID, h::UInt) = hash(r.whence, hash(r.id, h))
# Message header stored separately from body to be able to send back errors if
# a deserialization error occurs when reading the message body.
-immutable MsgHeader
+struct MsgHeader
response_oid::RRID
notify_oid::RRID
MsgHeader(respond_oid=RRID(0,0), notify_oid=RRID(0,0)) =
@@ -57,41 +57,41 @@ end
# Used instead of Nullable to decrease wire size of header.
null_id(id) = id == RRID(0, 0)
-immutable CallMsg{Mode} <: AbstractMsg
+struct CallMsg{Mode} <: AbstractMsg
f::Function
args::Tuple
kwargs::Array
end
-immutable CallWaitMsg <: AbstractMsg
+struct CallWaitMsg <: AbstractMsg
f::Function
args::Tuple
kwargs::Array
end
-immutable RemoteDoMsg <: AbstractMsg
+struct RemoteDoMsg <: AbstractMsg
f::Function
args::Tuple
kwargs::Array
end
-immutable ResultMsg <: AbstractMsg
+struct ResultMsg <: AbstractMsg
value::Any
end
# Worker initialization messages
-immutable IdentifySocketMsg <: AbstractMsg
+struct IdentifySocketMsg <: AbstractMsg
from_pid::Int
end
-immutable IdentifySocketAckMsg <: AbstractMsg
+struct IdentifySocketAckMsg <: AbstractMsg
end
-immutable JoinPGRPMsg <: AbstractMsg
+struct JoinPGRPMsg <: AbstractMsg
self_pid::Int
other_workers::Array
topology::Symbol
enable_threaded_blas::Bool
end
-immutable JoinCompleteMsg <: AbstractMsg
+struct JoinCompleteMsg <: AbstractMsg
cpu_cores::Int
ospid::Int
end
@@ -152,7 +152,7 @@ end
abstract ClusterManager
-type WorkerConfig
+mutable struct WorkerConfig
# Common fields relevant to all cluster managers
io::Nullable{IO}
host::Nullable{AbstractString}
@@ -201,7 +201,7 @@ type WorkerConfig
end
@enum WorkerState W_CREATED W_CONNECTED W_TERMINATING W_TERMINATED
-type Worker
+mutable struct Worker
id::Int
del_msgs::Array{Any,1}
add_msgs::Array{Any,1}
@@ -359,7 +359,7 @@ end
## process group creation ##
-type LocalProcess
+mutable struct LocalProcess
id::Int
bind_addr::AbstractString
bind_port::UInt16
@@ -408,7 +408,7 @@ let next_pid = 2 # 1 is reserved for the client (always)
end
end
-type ProcessGroup
+mutable struct ProcessGroup
name::AbstractString
workers::Array{Any,1}
refs::Dict # global references
@@ -578,7 +578,7 @@ After a client Julia process has exited, further attempts to reference the dead
throw this exception.
"""
ProcessExitedException()
-type ProcessExitedException <: Exception end
+mutable struct ProcessExitedException <: Exception end
worker_from_id(i) = worker_from_id(PGRP, i)
function worker_from_id(pg::ProcessGroup, i)
@@ -695,7 +695,7 @@ const client_refs = WeakKeyDict{Any, Void}() # used as a WeakKeySet
abstract AbstractRemoteRef
-type Future <: AbstractRemoteRef
+mutable struct Future <: AbstractRemoteRef
where::Int
whence::Int
id::Int
@@ -705,7 +705,7 @@ type Future <: AbstractRemoteRef
Future(w::Int, rrid::RRID, v) = (r = new(w,rrid.whence,rrid.id,v); return test_existing_ref(r))
end
-type RemoteChannel{T<:AbstractChannel} <: AbstractRemoteRef
+mutable struct RemoteChannel{T<:AbstractChannel} <: AbstractRemoteRef
where::Int
whence::Int
id::Int
@@ -986,7 +986,7 @@ end
# data stored by the owner of a remote reference
def_rv_channel() = Channel(1)
-type RemoteValue
+mutable struct RemoteValue
c::AbstractChannel
clientset::IntSet # Set of workerids that have a reference to this channel.
# Keeping ids instead of a count aids in cleaning up upon
@@ -1000,7 +1000,7 @@ end
wait(rv::RemoteValue) = wait(rv.c)
## core messages: do, call, fetch, wait, ref, put! ##
-type RemoteException <: Exception
+mutable struct RemoteException <: Exception
pid::Int
captured::CapturedException
end
diff --git a/base/multidimensional.jl b/base/multidimensional.jl
index ffe1b10..c2d2421 100644
--- a/base/multidimensional.jl
+++ b/base/multidimensional.jl
@@ -13,7 +13,7 @@ module IteratorsMD
export CartesianIndex, CartesianRange
# CartesianIndex
- immutable CartesianIndex{N} <: AbstractCartesianIndex{N}
+ struct CartesianIndex{N} <: AbstractCartesianIndex{N}
I::NTuple{N,Int}
CartesianIndex(index::NTuple{N,Integer}) = new(index)
end
@@ -77,7 +77,7 @@ module IteratorsMD
icmp(a, b) = ifelse(isless(a,b), 1, ifelse(a==b, 0, -1))
# Iteration
- immutable CartesianRange{I<:CartesianIndex}
+ struct CartesianRange{I<:CartesianIndex}
start::I
stop::I
end
@@ -273,7 +273,7 @@ where `mask[I]` is true. This specialized type does not support indexing
directly as doing so would require O(n) lookup time. `AbstractArray{Bool}` are
wrapped with `LogicalIndex` upon calling `to_indices`.
"""
-immutable LogicalIndex{T, A<:AbstractArray{Bool}} <: AbstractVector{T}
+struct LogicalIndex{T, A<:AbstractArray{Bool}} <: AbstractVector{T}
mask::A
sum::Int
LogicalIndex(mask::A) = new(mask, countnz(mask))
@@ -1160,7 +1160,7 @@ end
# TODO: this doesn't fit into the new hashing scheme in any obvious way
-immutable Prehashed
+struct Prehashed
hash::UInt
end
hash(x::Prehashed) = x.hash
diff --git a/base/multimedia.jl b/base/multimedia.jl
index 54b1101..cbf496a 100644
--- a/base/multimedia.jl
+++ b/base/multimedia.jl
@@ -145,7 +145,7 @@ Returns a `TextDisplay <: Display`, which displays any object as the text/plain
(by default), writing the text representation to the given I/O stream. (This is how
objects are printed in the Julia REPL.)
"""
-immutable TextDisplay <: Display
+struct TextDisplay <: Display
io::IO
end
display(d::TextDisplay, M::MIME"text/plain", x) = show(d.io, M, x)
diff --git a/base/multinverses.jl b/base/multinverses.jl
index c358b36..17f59bc 100644
--- a/base/multinverses.jl
+++ b/base/multinverses.jl
@@ -43,7 +43,7 @@ abstract MultiplicativeInverse{T}
#
# Further details can be found in Hacker's Delight, Chapter 10.
-immutable SignedMultiplicativeInverse{T<:Signed} <: MultiplicativeInverse{T}
+struct SignedMultiplicativeInverse{T<:Signed} <: MultiplicativeInverse{T}
divisor::T
multiplier::T
addmul::Int8
@@ -88,7 +88,7 @@ immutable SignedMultiplicativeInverse{T<:Signed} <: MultiplicativeInverse{T}
end
SignedMultiplicativeInverse(x::Signed) = SignedMultiplicativeInverse{typeof(x)}(x)
-immutable UnsignedMultiplicativeInverse{T<:Unsigned} <: MultiplicativeInverse{T}
+struct UnsignedMultiplicativeInverse{T<:Unsigned} <: MultiplicativeInverse{T}
divisor::T
multiplier::T
add::Bool
diff --git a/base/nullable.jl b/base/nullable.jl
index f249d1a..1b301f7 100644
--- a/base/nullable.jl
+++ b/base/nullable.jl
@@ -1,6 +1,6 @@
# This file is a part of Julia. License is MIT: http://julialang.org/license
-immutable NullException <: Exception
+struct NullException <: Exception
end
"""
diff --git a/base/operators.jl b/base/operators.jl
index 8ff256c..9ed0a61 100644
--- a/base/operators.jl
+++ b/base/operators.jl
@@ -930,7 +930,7 @@ ranges with the same indices as those they wrap. This means that indexing into
Slice objects with an integer always returns that exact integer, and they
iterate over all the wrapped indices, even supporting offset indices.
"""
-immutable Slice{T<:AbstractUnitRange} <: AbstractUnitRange{Int}
+struct Slice{T<:AbstractUnitRange} <: AbstractUnitRange{Int}
indices::T
end
indices(S::Slice) = (S.indices,)
@@ -983,7 +983,7 @@ end
# Pair
-immutable Pair{A,B}
+struct Pair{A,B}
first::A
second::B
end
diff --git a/base/options.jl b/base/options.jl
index 815c04c..c34364a 100644
--- a/base/options.jl
+++ b/base/options.jl
@@ -1,7 +1,7 @@
# This file is a part of Julia. License is MIT: http://julialang.org/license
# NOTE: This type needs to be kept in sync with jl_options in src/julia.h
-immutable JLOptions
+struct JLOptions
quiet::Int8
julia_home::Ptr{UInt8}
julia_bin::Ptr{UInt8}
diff --git a/base/ordering.jl b/base/ordering.jl
index c3015f7..5edcc45 100644
--- a/base/ordering.jl
+++ b/base/ordering.jl
@@ -13,8 +13,8 @@ export # not exported by Base
abstract Ordering
-immutable ForwardOrdering <: Ordering end
-immutable ReverseOrdering{Fwd<:Ordering} <: Ordering
+struct ForwardOrdering <: Ordering end
+struct ReverseOrdering{Fwd<:Ordering} <: Ordering
fwd::Fwd
end
@@ -26,18 +26,18 @@ typealias DirectOrdering Union{ForwardOrdering,ReverseOrdering{ForwardOrdering}}
const Forward = ForwardOrdering()
const Reverse = ReverseOrdering(Forward)
-immutable LexicographicOrdering <: Ordering end
+struct LexicographicOrdering <: Ordering end
const Lexicographic = LexicographicOrdering()
-immutable By{T} <: Ordering
+struct By{T} <: Ordering
by::T
end
-immutable Lt{T} <: Ordering
+struct Lt{T} <: Ordering
lt::T
end
-immutable Perm{O<:Ordering,V<:AbstractVector} <: Ordering
+struct Perm{O<:Ordering,V<:AbstractVector} <: Ordering
order::O
data::V
end
diff --git a/base/permuteddimsarray.jl b/base/permuteddimsarray.jl
index 9e36b30..73df37f 100644
--- a/base/permuteddimsarray.jl
+++ b/base/permuteddimsarray.jl
@@ -5,7 +5,7 @@ module PermutedDimsArrays
export permutedims, PermutedDimsArray
# Some day we will want storage-order-aware iteration, so put perm in the parameters
-immutable PermutedDimsArray{T,N,perm,iperm,AA<:AbstractArray} <: AbstractArray{T,N}
+struct PermutedDimsArray{T,N,perm,iperm,AA<:AbstractArray} <: AbstractArray{T,N}
parent::AA
function PermutedDimsArray(data::AA)
diff --git a/base/pkg/entry.jl b/base/pkg/entry.jl
index b8c1987..68c153a 100644
--- a/base/pkg/entry.jl
+++ b/base/pkg/entry.jl
@@ -732,7 +732,7 @@ function test!(pkg::AbstractString,
isfile(reqs_path) && resolve()
end
-type PkgTestError <: Exception
+mutable struct PkgTestError <: Exception
msg::String
end
diff --git a/base/pkg/pkg.jl b/base/pkg/pkg.jl
index edb3a03..c5d9836 100644
--- a/base/pkg/pkg.jl
+++ b/base/pkg/pkg.jl
@@ -9,7 +9,7 @@ export dir, init, rm, add, available, installed, status, clone, checkout,
const DEFAULT_META = "https://github.com/JuliaLang/METADATA.jl"
const META_BRANCH = "metadata-v2"
-type PkgError <: Exception
+mutable struct PkgError <: Exception
msg::AbstractString
ex::Nullable{Exception}
end
diff --git a/base/pkg/reqs.jl b/base/pkg/reqs.jl
index 003b824..bf0342a 100644
--- a/base/pkg/reqs.jl
+++ b/base/pkg/reqs.jl
@@ -9,10 +9,10 @@ using ..Types
# representing lines of REQUIRE files
abstract Line
-immutable Comment <: Line
+struct Comment <: Line
content::AbstractString
end
-immutable Requirement <: Line
+struct Requirement <: Line
content::AbstractString
package::AbstractString
versions::VersionSet
diff --git a/base/pkg/resolve/interface.jl b/base/pkg/resolve/interface.jl
index dd23cca..891d3b3 100644
--- a/base/pkg/resolve/interface.jl
+++ b/base/pkg/resolve/interface.jl
@@ -9,7 +9,7 @@ export Interface, compute_output_dict, greedysolver,
# A collection of objects which allow interfacing external (Pkg) and
# internal (MaxSum) representation
-type Interface
+mutable struct Interface
# requirements and dependencies, in external representation
reqs::Requires
deps::Dict{String,Dict{VersionNumber,Available}}
diff --git a/base/pkg/resolve/maxsum.jl b/base/pkg/resolve/maxsum.jl
index 70d1c5f..fdd8af6 100644
--- a/base/pkg/resolve/maxsum.jl
+++ b/base/pkg/resolve/maxsum.jl
@@ -10,12 +10,12 @@ export UnsatError, Graph, Messages, maxsum
# An exception type used internally to signal that an unsatisfiable
# constraint was detected
-type UnsatError <: Exception
+mutable struct UnsatError <: Exception
info
end
# Some parameters to drive the decimation process
-type MaxSumParams
+mutable struct MaxSumParams
nondec_iterations # number of initial iterations before starting
# decimation
dec_interval # number of iterations between decimations
@@ -36,7 +36,7 @@ end
# Graph holds the graph structure onto which max-sum is run, in
# sparse format
-type Graph
+mutable struct Graph
# adjacency matrix:
# for each package, has the list of neighbors
# indices (both dependencies and dependants)
@@ -158,7 +158,7 @@ end
# Messages has the cavity messages and the total fields, and
# gets updated iteratively (and occasionally decimated) until
# convergence
-type Messages
+mutable struct Messages
# cavity incoming messages: for each package p0,
# for each neighbor p1 of p0,
# msg[p0][p1] is a vector of length spp[p0]
diff --git a/base/pkg/resolve/versionweight.jl b/base/pkg/resolve/versionweight.jl
index 83500d9..d549700 100644
--- a/base/pkg/resolve/versionweight.jl
+++ b/base/pkg/resolve/versionweight.jl
@@ -6,7 +6,7 @@ importall ....Base.Operators
export VersionWeight
-immutable HierarchicalValue{T}
+struct HierarchicalValue{T}
v::Vector{T}
rest::T
end
@@ -68,7 +68,7 @@ Base.isless{T}(a::HierarchicalValue{T}, b::HierarchicalValue{T}) = cmp(a,b) < 0
Base.abs{T}(a::HierarchicalValue{T}) = HierarchicalValue(T[abs(x) for x in a.v], abs(a.rest))
-immutable VWPreBuildItem
+struct VWPreBuildItem
nonempty::Int
s::HierarchicalValue{Int}
i::Int
@@ -96,7 +96,7 @@ Base.isless(a::VWPreBuildItem, b::VWPreBuildItem) = cmp(a,b) < 0
Base.abs(a::VWPreBuildItem) = VWPreBuildItem(abs(a.nonempty), abs(a.s), abs(a.i))
-immutable VWPreBuild
+struct VWPreBuild
nonempty::Int
w::HierarchicalValue{VWPreBuildItem}
end
@@ -153,7 +153,7 @@ end
# The numeric type used to determine how the different
# versions of a package should be weighed
-immutable VersionWeight
+struct VersionWeight
major::Int
minor::Int
patch::Int
diff --git a/base/pkg/types.jl b/base/pkg/types.jl
index 90bbc0f..5f0df3b 100644
--- a/base/pkg/types.jl
+++ b/base/pkg/types.jl
@@ -5,7 +5,7 @@ module Types
export VersionInterval, VersionSet, Requires, Available, Fixed, merge_requires!, satisfies
import Base: show, isempty, in, intersect, ==, hash, copy, deepcopy_internal
-immutable VersionInterval
+struct VersionInterval
lower::VersionNumber
upper::VersionNumber
end
@@ -19,7 +19,7 @@ intersect(a::VersionInterval, b::VersionInterval) = VersionInterval(max(a.lower,
==(a::VersionInterval, b::VersionInterval) = a.lower == b.lower && a.upper == b.upper
hash(i::VersionInterval, h::UInt) = hash((i.lower, i.upper), h + (0x0f870a92db508386 % UInt))
-immutable VersionSet
+struct VersionSet
intervals::Vector{VersionInterval}
end
function VersionSet(versions::Vector{VersionNumber})
@@ -62,7 +62,7 @@ end
satisfies(pkg::AbstractString, ver::VersionNumber, reqs::Requires) =
!haskey(reqs, pkg) || in(ver, reqs[pkg])
-immutable Available
+struct Available
sha1::String
requires::Requires
end
@@ -75,7 +75,7 @@ show(io::IO, a::Available) = isempty(a.requires) ?
print(io, "Available(", repr(a.sha1), ")") :
print(io, "Available(", repr(a.sha1), ",", a.requires, ")")
-immutable Fixed
+struct Fixed
version::VersionNumber
requires::Requires
end
diff --git a/base/pmap.jl b/base/pmap.jl
index 926f4f7..9e8c653 100644
--- a/base/pmap.jl
+++ b/base/pmap.jl
@@ -1,6 +1,6 @@
# This file is a part of Julia. License is MIT: http://julialang.org/license
-type BatchProcessingError <: Exception
+mutable struct BatchProcessingError <: Exception
data
ex
end
diff --git a/base/poll.jl b/base/poll.jl
index f5415bd..d2e723d 100644
--- a/base/poll.jl
+++ b/base/poll.jl
@@ -20,7 +20,7 @@ end
# libuv file watching event flags
const UV_RENAME = 1
const UV_CHANGE = 2
-immutable FileEvent
+struct FileEvent
renamed::Bool
changed::Bool
timedout::Bool
@@ -31,7 +31,7 @@ FileEvent(flags::Integer) = FileEvent((flags & UV_RENAME) != 0,
(flags & FD_TIMEDOUT) != 0)
fetimeout() = FileEvent(false, false, true)
-immutable FDEvent
+struct FDEvent
readable::Bool
writable::Bool
disconnect::Bool
@@ -57,7 +57,7 @@ fdtimeout() = FDEvent(false, false, false, true)
a.disconnect | b.disconnect,
a.timedout | b.timedout)
-type FileMonitor
+mutable struct FileMonitor
handle::Ptr{Void}
file::String
notify::Condition
@@ -76,7 +76,7 @@ type FileMonitor
end
end
-type PollingFileWatcher
+mutable struct PollingFileWatcher
handle::Ptr{Void}
file::String
interval::UInt32
@@ -96,7 +96,7 @@ type PollingFileWatcher
end
end
-type _FDWatcher
+mutable struct _FDWatcher
handle::Ptr{Void}
fdnum::Int # this is NOT the file descriptor
refcount::Tuple{Int, Int}
@@ -195,7 +195,7 @@ type _FDWatcher
end
end
-type FDWatcher
+mutable struct FDWatcher
watcher::_FDWatcher
readable::Bool
writable::Bool
diff --git a/base/process.jl b/base/process.jl
index cb8859c..c478d25 100644
--- a/base/process.jl
+++ b/base/process.jl
@@ -7,7 +7,7 @@ const UV_PROCESS_WINDOWS_VERBATIM_ARGUMENTS = UInt8(1 << 2)
const UV_PROCESS_DETACHED = UInt8(1 << 3)
const UV_PROCESS_WINDOWS_HIDE = UInt8(1 << 4)
-immutable Cmd <: AbstractCmd
+struct Cmd <: AbstractCmd
exec::Vector{String}
ignorestatus::Bool
flags::UInt32 # libuv process flags
@@ -76,19 +76,19 @@ hash(x::Cmd, h::UInt) = hash(x.exec, hash(x.env, hash(x.ignorestatus, hash(x.dir
==(x::Cmd, y::Cmd) = x.exec == y.exec && x.env == y.env && x.ignorestatus == y.ignorestatus &&
x.dir == y.dir && isequal(x.flags, y.flags)
-immutable OrCmds <: AbstractCmd
+struct OrCmds <: AbstractCmd
a::AbstractCmd
b::AbstractCmd
OrCmds(a::AbstractCmd, b::AbstractCmd) = new(a, b)
end
-immutable ErrOrCmds <: AbstractCmd
+struct ErrOrCmds <: AbstractCmd
a::AbstractCmd
b::AbstractCmd
ErrOrCmds(a::AbstractCmd, b::AbstractCmd) = new(a, b)
end
-immutable AndCmds <: AbstractCmd
+struct AndCmds <: AbstractCmd
a::AbstractCmd
b::AbstractCmd
AndCmds(a::AbstractCmd, b::AbstractCmd) = new(a, b)
@@ -137,7 +137,7 @@ const STDIN_NO = 0
const STDOUT_NO = 1
const STDERR_NO = 2
-immutable FileRedirect
+struct FileRedirect
filename::AbstractString
append::Bool
function FileRedirect(filename, append)
@@ -161,7 +161,7 @@ uvtype(x::RawFD) = UV_RAW_FD
typealias Redirectable Union{IO, FileRedirect, RawFD}
typealias StdIOSet NTuple{3, Union{Redirectable, Ptr{Void}}} # XXX: remove Ptr{Void} once libuv is refactored to use upstream release
-immutable CmdRedirect <: AbstractCmd
+struct CmdRedirect <: AbstractCmd
cmd::AbstractCmd
handle::Redirectable
stream_no::Int
@@ -305,7 +305,7 @@ run(pipeline("out.txt", `grep xyz`))
"""
pipeline(a, b, c, d...) = pipeline(pipeline(a,b), c, d...)
-type Process <: AbstractPipe
+mutable struct Process <: AbstractPipe
cmd::Cmd
handle::Ptr{Void}
in::IO
@@ -339,7 +339,7 @@ end
pipe_reader(p::Process) = p.out
pipe_writer(p::Process) = p.in
-immutable ProcessChain <: AbstractPipe
+struct ProcessChain <: AbstractPipe
processes::Vector{Process}
in::Redirectable
out::Redirectable
diff --git a/base/profile.jl b/base/profile.jl
index bda1c76..325d869 100644
--- a/base/profile.jl
+++ b/base/profile.jl
@@ -76,7 +76,7 @@ clear() = ccall(:jl_profile_clear_data, Void, ())
typealias LineInfoDict Dict{UInt64, Vector{StackFrame}}
typealias LineInfoFlatDict Dict{UInt64, StackFrame}
-immutable ProfileFormat
+struct ProfileFormat
maxdepth::Int
mincount::Int
noisefloor::Float64
diff --git a/base/random.jl b/base/random.jl
index 1e38a43..8473aa7 100644
--- a/base/random.jl
+++ b/base/random.jl
@@ -22,15 +22,15 @@ export srand,
abstract AbstractRNG
abstract FloatInterval
-type CloseOpen <: FloatInterval end
-type Close1Open2 <: FloatInterval end
+mutable struct CloseOpen <: FloatInterval end
+mutable struct Close1Open2 <: FloatInterval end
## RandomDevice
if is_windows()
- immutable RandomDevice <: AbstractRNG
+ struct RandomDevice <: AbstractRNG
buffer::Vector{UInt128}
RandomDevice() = new(Array{UInt128}(1))
@@ -43,7 +43,7 @@ if is_windows()
rand!{T<:Union{Bool, Base.BitInteger}}(rd::RandomDevice, A::Array{T}) = (win32_SystemFunction036!(A); A)
else # !windows
- immutable RandomDevice <: AbstractRNG
+ struct RandomDevice <: AbstractRNG
file::IOStream
unlimited::Bool
@@ -73,7 +73,7 @@ rand(rng::RandomDevice, ::Type{CloseOpen}) = rand(rng, Close1Open2) - 1.0
const MTCacheLength = dsfmt_get_min_array_size()
-type MersenneTwister <: AbstractRNG
+mutable struct MersenneTwister <: AbstractRNG
seed::Vector{UInt32}
state::DSFMT_state
vals::Vector{Float64}
@@ -530,7 +530,7 @@ maxmultiplemix(k::UInt64) = if k >> 32 != 0; maxmultiple(k); else (div(0x0000000
abstract RangeGenerator
-immutable RangeGeneratorInt{T<:Integer, U<:Unsigned} <: RangeGenerator
+struct RangeGeneratorInt{T<:Integer, U<:Unsigned} <: RangeGenerator
a::T # first element of the range
k::U # range length or zero for full range
u::U # rejection threshold
@@ -561,7 +561,7 @@ for (T, U) in [(UInt8, UInt32), (UInt16, UInt32),
end
if GMP_VERSION.major >= 6
- immutable RangeGeneratorBigInt <: RangeGenerator
+ struct RangeGeneratorBigInt <: RangeGenerator
a::BigInt # first
m::BigInt # range length - 1
nlimbs::Int # number of limbs in generated BigInt's
@@ -569,7 +569,7 @@ if GMP_VERSION.major >= 6
end
else
- immutable RangeGeneratorBigInt <: RangeGenerator
+ struct RangeGeneratorBigInt <: RangeGenerator
a::BigInt # first
m::BigInt # range length - 1
limbs::Vector{Limb} # buffer to be copied into generated BigInt's
@@ -1302,7 +1302,7 @@ end
## random UUID generation
-immutable UUID
+struct UUID
value::UInt128
UUID(u::UInt128) = new(u)
diff --git a/base/range.jl b/base/range.jl
index 6bd7b50..c969e54 100644
--- a/base/range.jl
+++ b/base/range.jl
@@ -65,7 +65,7 @@ abstract Range{T} <: AbstractArray{T,1}
abstract OrdinalRange{T,S} <: Range{T}
abstract AbstractUnitRange{T} <: OrdinalRange{T,Int}
-immutable StepRange{T,S} <: OrdinalRange{T,S}
+struct StepRange{T,S} <: OrdinalRange{T,S}
start::T
step::S
stop::T
@@ -125,7 +125,7 @@ steprem(start,stop,step) = (stop-start) % step
StepRange(start::T, step::S, stop::T) where (T,S) = StepRange{T,S}(start, step, stop)
-immutable UnitRange{T<:Real} <: AbstractUnitRange{T}
+struct UnitRange{T<:Real} <: AbstractUnitRange{T}
start::T
stop::T
UnitRange{T}(start, stop) where T<:Real = new(start, unitrange_last(start,stop))
@@ -146,7 +146,7 @@ Define an `AbstractUnitRange` that behaves like `1:n`, with the added
distinction that the lower limit is guaranteed (by the type system) to
be 1.
"""
-immutable OneTo{T<:Integer} <: AbstractUnitRange{T}
+struct OneTo{T<:Integer} <: AbstractUnitRange{T}
stop::T
OneTo{T}(stop) where T<:Integer = new(max(zero(T), stop))
end
@@ -164,7 +164,7 @@ value of `r[offset]` for some other index `1 <= offset <= len`. In
conjunction with `TwicePrecision` this can be used to implement ranges
that are free of roundoff error.
"""
-immutable StepRangeLen{T,R,S} <: Range{T}
+struct StepRangeLen{T,R,S} <: Range{T}
ref::R # reference value (might be smallest-magnitude value in the range)
step::S # step value
len::Int # length of the range
@@ -182,7 +182,7 @@ StepRangeLen(ref::R, step::S, len::Integer, offset::Integer = 1) where (R,S) =
## linspace and logspace
-immutable LinSpace{T} <: Range{T}
+struct LinSpace{T} <: Range{T}
start::T
stop::T
len::Int
diff --git a/base/rational.jl b/base/rational.jl
index def20fa..fe8385f 100644
--- a/base/rational.jl
+++ b/base/rational.jl
@@ -1,6 +1,6 @@
# This file is a part of Julia. License is MIT: http://julialang.org/license
-immutable Rational{T<:Integer} <: Real
+struct Rational{T<:Integer} <: Real
num::T
den::T
diff --git a/base/reflection.jl b/base/reflection.jl
index 9c791c9..949f057 100644
--- a/base/reflection.jl
+++ b/base/reflection.jl
@@ -172,7 +172,7 @@ isconst(m::Module, s::Symbol) =
# return an integer such that object_id(x)==object_id(y) if x===y
object_id(x::ANY) = ccall(:jl_object_id, UInt, (Any,), x)
-immutable DataTypeLayout
+struct DataTypeLayout
nfields::UInt32
alignment::UInt32
# alignment : 28;
@@ -484,7 +484,7 @@ end
# high-level, more convenient method lookup functions
# type for reflecting and pretty-printing a subset of methods
-type MethodList
+mutable struct MethodList
ms::Array{Method,1}
mt::MethodTable
end
@@ -583,7 +583,7 @@ function uncompressed_ast(m::Method, s::CodeInfo)
end
# this type mirrors jl_cghooks_t (documented in julia.h)
-immutable CodegenHooks
+struct CodegenHooks
module_setup::Ptr{Void}
module_activation::Ptr{Void}
raise_exception::Ptr{Void}
@@ -595,7 +595,7 @@ immutable CodegenHooks
end
# this type mirrors jl_cgparams_t (documented in julia.h)
-immutable CodegenParams
+struct CodegenParams
cached::Cint
runtime::Cint
diff --git a/base/refpointer.jl b/base/refpointer.jl
index 45f7575..8a31902 100644
--- a/base/refpointer.jl
+++ b/base/refpointer.jl
@@ -35,7 +35,7 @@ unsafe_convert{T}(::Type{Ref{T}}, x) = unsafe_convert(Ptr{T}, x)
### Methods for a Ref object that can store a single value of any type
-type RefValue{T} <: Ref{T}
+mutable struct RefValue{T} <: Ref{T}
x::T
RefValue() = new()
RefValue(x) = new(x)
@@ -64,7 +64,7 @@ end
unsafe_convert{T}(::Type{Ptr{Void}}, b::RefValue{T}) = convert(Ptr{Void}, unsafe_convert(Ptr{T}, b))
### Methods for a Ref object that is backed by an array at index i
-immutable RefArray{T, A<:AbstractArray, R} <: Ref{T}
+struct RefArray{T, A<:AbstractArray, R} <: Ref{T}
x::A
i::Int
roots::R # should be either ::Void or ::Any
diff --git a/base/regex.jl b/base/regex.jl
index 1692672..e2161c9 100644
--- a/base/regex.jl
+++ b/base/regex.jl
@@ -7,7 +7,7 @@ include("pcre.jl")
const DEFAULT_COMPILER_OPTS = PCRE.UTF | PCRE.NO_UTF_CHECK | PCRE.ALT_BSUX
const DEFAULT_MATCH_OPTS = PCRE.NO_UTF_CHECK
-type Regex
+mutable struct Regex
pattern::String
compile_options::UInt32
match_options::UInt32
@@ -104,7 +104,7 @@ end
# TODO: map offsets into strings in other encodings back to original indices.
# or maybe it's better to just fail since that would be quite slow
-immutable RegexMatch
+struct RegexMatch
match::SubString{String}
captures::Vector{Union{Void,SubString{String}}}
offset::Int
@@ -226,7 +226,7 @@ search(s::AbstractString, r::Regex, idx::Integer) = throw(ArgumentError(
))
search(s::AbstractString, r::Regex) = search(s,r,start(s))
-immutable SubstitutionString{T<:AbstractString} <: AbstractString
+struct SubstitutionString{T<:AbstractString} <: AbstractString
string::T
end
@@ -309,7 +309,7 @@ function _replace(io, repl_s::SubstitutionString, str, r, re)
end
end
-immutable RegexMatchIterator
+struct RegexMatchIterator
regex::Regex
string::String
overlap::Bool
diff --git a/base/reshapedarray.jl b/base/reshapedarray.jl
index 7f1308a..1f94977 100644
--- a/base/reshapedarray.jl
+++ b/base/reshapedarray.jl
@@ -2,7 +2,7 @@
using Base.MultiplicativeInverses: SignedMultiplicativeInverse
-immutable ReshapedArray{T,N,P<:AbstractArray,MI<:Tuple{Vararg{SignedMultiplicativeInverse{Int}}}} <: AbstractArray{T,N}
+struct ReshapedArray{T,N,P<:AbstractArray,MI<:Tuple{Vararg{SignedMultiplicativeInverse{Int}}}} <: AbstractArray{T,N}
parent::P
dims::NTuple{N,Int}
mi::MI
@@ -13,7 +13,7 @@ ReshapedArray{T,N}(parent::AbstractArray{T}, dims::NTuple{N,Int}, mi) = Reshaped
typealias ReshapedArrayLF{T,N,P<:AbstractArray} ReshapedArray{T,N,P,Tuple{}}
# Fast iteration on ReshapedArrays: use the parent iterator
-immutable ReshapedArrayIterator{I,M}
+struct ReshapedArrayIterator{I,M}
iter::I
mi::NTuple{M,SignedMultiplicativeInverse{Int}}
end
@@ -23,7 +23,7 @@ function _rs_iterator{M}(P, mi::NTuple{M})
ReshapedArrayIterator{typeof(iter),M}(iter, mi)
end
-immutable ReshapedIndex{T}
+struct ReshapedIndex{T}
parentindex::T
end
diff --git a/base/rounding.jl b/base/rounding.jl
index 3e9342a..96bad34 100644
--- a/base/rounding.jl
+++ b/base/rounding.jl
@@ -41,7 +41,7 @@ Currently supported rounding modes are:
- [`RoundUp`](@ref)
- [`RoundDown`](@ref)
"""
-immutable RoundingMode{T} end
+struct RoundingMode{T} end
"""
RoundNearest
diff --git a/base/serialize.jl b/base/serialize.jl
index 2defd0c..3c412fa 100644
--- a/base/serialize.jl
+++ b/base/serialize.jl
@@ -8,7 +8,7 @@ using Base: ViewIndex, Slice, index_lengths, unwrap_unionall
export serialize, deserialize, SerializationState
-type SerializationState{I<:IO} <: AbstractSerializer
+mutable struct SerializationState{I<:IO} <: AbstractSerializer
io::I
counter::Int
table::ObjectIdDict
diff --git a/base/set.jl b/base/set.jl
index 2e6fc6d..567533e 100644
--- a/base/set.jl
+++ b/base/set.jl
@@ -1,6 +1,6 @@
# This file is a part of Julia. License is MIT: http://julialang.org/license
-type Set{T} <: AbstractSet{T}
+mutable struct Set{T} <: AbstractSet{T}
dict::Dict{T,Void}
Set() = new(Dict{T,Void}())
diff --git a/base/sharedarray.jl b/base/sharedarray.jl
index e0a0f94..97e0f28 100644
--- a/base/sharedarray.jl
+++ b/base/sharedarray.jl
@@ -2,7 +2,7 @@
import .Serializer: serialize_cycle_header, serialize_type, writetag, UNDEFREF_TAG
-type SharedArray{T,N} <: DenseArray{T,N}
+mutable struct SharedArray{T,N} <: DenseArray{T,N}
dims::NTuple{N,Int}
pids::Vector{Int}
refs::Vector
diff --git a/base/show.jl b/base/show.jl
index febd1b5..84c0999 100644
--- a/base/show.jl
+++ b/base/show.jl
@@ -10,7 +10,7 @@ print(io::IO, s::Symbol) = (write(io,s); nothing)
In short, it is an immutable dictionary that is a subclass of `IO`. It supports standard
dictionary operations such as [`getindex`](@ref), and can also be used as an I/O stream.
"""
-immutable IOContext{IO_t <: IO} <: AbstractPipe
+struct IOContext{IO_t <: IO} <: AbstractPipe
io::IO_t
dict::ImmutableDict{Symbol, Any}
function IOContext(io::IO_t, dict::ImmutableDict{Symbol, Any})
@@ -856,8 +856,8 @@ function show_unquoted(io::IO, ex::Expr, indent::Int, prec::Int)
print(io, "end")
# type declaration
- elseif head === :type && nargs==3
- show_block(io, args[1] ? :type : :immutable, args[2], args[3], indent)
+ elseif head === :mutable struct && nargs==3
+ show_block(io, args[1] ? :mutable struct : :struct, args[2], args[3], indent)
print(io, "end")
elseif head === :bitstype && nargs == 2
diff --git a/base/simdloop.jl b/base/simdloop.jl
index e20fe75..9f1946e 100644
--- a/base/simdloop.jl
+++ b/base/simdloop.jl
@@ -7,7 +7,7 @@ module SimdLoop
export @simd, simd_outer_range, simd_inner_length, simd_index
# Error thrown from ill-formed uses of @simd
-type SimdError <: Exception
+mutable struct SimdError <: Exception
msg::String
end
diff --git a/base/socket.jl b/base/socket.jl
index b4598ef..d43d85a 100644
--- a/base/socket.jl
+++ b/base/socket.jl
@@ -6,7 +6,7 @@ abstract IPAddr
Base.isless{T<:IPAddr}(a::T, b::T) = isless(a.host, b.host)
Base.convert{T<:Integer}(dt::Type{T}, ip::IPAddr) = dt(ip.host)
-immutable IPv4 <: IPAddr
+struct IPv4 <: IPAddr
host::UInt32
IPv4(host::UInt32) = new(host)
IPv4(a::UInt8,b::UInt8,c::UInt8,d::UInt8) = new(UInt32(a)<<24|
@@ -45,7 +45,7 @@ print(io::IO,ip::IPv4) = print(io,dec((ip.host&(0xFF000000))>>24),".",
dec((ip.host&(0xFF00))>>8),".",
dec(ip.host&0xFF))
-immutable IPv6 <: IPAddr
+struct IPv6 <: IPAddr
host::UInt128
IPv6(host::UInt128) = new(host)
IPv6(a::UInt16,b::UInt16,c::UInt16,d::UInt16,
@@ -236,7 +236,7 @@ macro ip_str(str)
return parse(IPAddr, str)
end
-immutable InetAddr{T<:IPAddr}
+struct InetAddr{T<:IPAddr}
host::T
port::UInt16
end
@@ -245,7 +245,7 @@ InetAddr(ip::IPAddr, port) = InetAddr{typeof(ip)}(ip, port)
## SOCKETS ##
-type TCPSocket <: LibuvStream
+mutable struct TCPSocket <: LibuvStream
handle::Ptr{Void}
status::Int
buffer::IOBuffer
@@ -281,7 +281,7 @@ function TCPSocket()
return tcp
end
-type TCPServer <: LibuvServer
+mutable struct TCPServer <: LibuvServer
handle::Ptr{Void}
status::Int
connectnotify::Condition
@@ -329,7 +329,7 @@ accept(server::PipeServer) = accept(server, init_pipe!(PipeEndpoint();
# UDP
-type UDPSocket <: LibuvStream
+mutable struct UDPSocket <: LibuvStream
handle::Ptr{Void}
status::Int
recvnotify::Condition
@@ -561,7 +561,7 @@ end
##
-type DNSError <: Exception
+mutable struct DNSError <: Exception
host::AbstractString
code::Int32
end
diff --git a/base/sort.jl b/base/sort.jl
index 1929381..1022c07 100644
--- a/base/sort.jl
+++ b/base/sort.jl
@@ -208,11 +208,11 @@ end
abstract Algorithm
-immutable InsertionSortAlg <: Algorithm end
-immutable QuickSortAlg <: Algorithm end
-immutable MergeSortAlg <: Algorithm end
+struct InsertionSortAlg <: Algorithm end
+struct QuickSortAlg <: Algorithm end
+struct MergeSortAlg <: Algorithm end
-immutable PartialQuickSort{T <: Union{Int,OrdinalRange}} <: Algorithm
+struct PartialQuickSort{T <: Union{Int,OrdinalRange}} <: Algorithm
k::T
end
@@ -690,8 +690,8 @@ import ...Order: lt, DirectOrdering
typealias Floats Union{Float32,Float64}
-immutable Left <: Ordering end
-immutable Right <: Ordering end
+struct Left <: Ordering end
+struct Right <: Ordering end
left(::DirectOrdering) = Left()
right(::DirectOrdering) = Right()
diff --git a/base/sparse/cholmod.jl b/base/sparse/cholmod.jl
index cec3776..387cc5a 100644
--- a/base/sparse/cholmod.jl
+++ b/base/sparse/cholmod.jl
@@ -183,7 +183,7 @@ abstract SuiteSparseStruct
# time a pointer is returned from CHOLMOD.
# Dense
-immutable C_Dense{T<:VTypes} <: SuiteSparseStruct
+struct C_Dense{T<:VTypes} <: SuiteSparseStruct
nrow::Csize_t
ncol::Csize_t
nzmax::Csize_t
@@ -194,12 +194,12 @@ immutable C_Dense{T<:VTypes} <: SuiteSparseStruct
dtype::Cint
end
-type Dense{T<:VTypes} <: DenseMatrix{T}
+mutable struct Dense{T<:VTypes} <: DenseMatrix{T}
p::Ptr{C_Dense{T}}
end
# Sparse
-immutable C_Sparse{Tv<:VTypes} <: SuiteSparseStruct
+struct C_Sparse{Tv<:VTypes} <: SuiteSparseStruct
nrow::Csize_t
ncol::Csize_t
nzmax::Csize_t
@@ -219,7 +219,7 @@ end
# Corresponds to the exact definition of cholmod_sparse_struct in the library.
# Useful when reading matrices of unknown type from files as in
# cholmod_read_sparse
-immutable C_SparseVoid <: SuiteSparseStruct
+struct C_SparseVoid <: SuiteSparseStruct
nrow::Csize_t
ncol::Csize_t
nzmax::Csize_t
@@ -236,7 +236,7 @@ immutable C_SparseVoid <: SuiteSparseStruct
packed::Cint
end
-type Sparse{Tv<:VTypes} <: AbstractSparseMatrix{Tv,SuiteSparse_long}
+mutable struct Sparse{Tv<:VTypes} <: AbstractSparseMatrix{Tv,SuiteSparse_long}
p::Ptr{C_Sparse{Tv}}
function Sparse(p::Ptr{C_Sparse{Tv}})
if p == C_NULL
@@ -251,7 +251,7 @@ Sparse{Tv<:VTypes}(p::Ptr{C_Sparse{Tv}}) = Sparse{Tv}(p)
# Factor
if build_version >= v"2.1.0" # CHOLMOD version 2.1.0 or later
- immutable C_Factor{Tv<:VTypes} <: SuiteSparseStruct
+ struct C_Factor{Tv<:VTypes} <: SuiteSparseStruct
n::Csize_t
minor::Csize_t
Perm::Ptr{SuiteSparse_long}
@@ -283,7 +283,7 @@ if build_version >= v"2.1.0" # CHOLMOD version 2.1.0 or later
dtype::Cint
end
else
- immutable C_Factor{Tv<:VTypes} <: SuiteSparseStruct
+ struct C_Factor{Tv<:VTypes} <: SuiteSparseStruct
n::Csize_t
minor::Csize_t
Perm::Ptr{SuiteSparse_long}
@@ -315,7 +315,7 @@ else
end
end
-type Factor{Tv} <: Factorization{Tv}
+mutable struct Factor{Tv} <: Factorization{Tv}
p::Ptr{C_Factor{Tv}}
function Factor(p::Ptr{C_Factor{Tv}})
if p == C_NULL
@@ -341,7 +341,7 @@ function get{T<:SuiteSparseStruct}(p::Ptr{T})
end
# FactorComponent, for encoding particular factors from a factorization
-type FactorComponent{Tv,S} <: AbstractMatrix{Tv}
+mutable struct FactorComponent{Tv,S} <: AbstractMatrix{Tv}
F::Factor{Tv}
function FactorComponent(F::Factor{Tv})
diff --git a/base/sparse/cholmod_h.jl b/base/sparse/cholmod_h.jl
index 922b3b7..7be23f7 100644
--- a/base/sparse/cholmod_h.jl
+++ b/base/sparse/cholmod_h.jl
@@ -70,7 +70,7 @@ end
typealias VTypes Union{Complex128, Float64}
typealias VRealTypes Union{Float64}
-type CHOLMODException <: Exception
+mutable struct CHOLMODException <: Exception
msg::AbstractString
end
diff --git a/base/sparse/higherorderfns.jl b/base/sparse/higherorderfns.jl
index acffdd0..4ebca13 100644
--- a/base/sparse/higherorderfns.jl
+++ b/base/sparse/higherorderfns.jl
@@ -1002,7 +1002,7 @@ broadcast{Tf,T}(f::Tf, A::SparseMatrixCSC, ::Type{T}) = broadcast(x -> f(x, T),
# first (Broadcast containertype) dispatch layer's promotion logic
-immutable PromoteToSparse end
+struct PromoteToSparse end
# broadcast containertype definitions for structured matrices
StructuredMatrix = Union{Diagonal,Bidiagonal,Tridiagonal,SymTridiagonal}
diff --git a/base/sparse/sparsematrix.jl b/base/sparse/sparsematrix.jl
index 8732875..b38f9b5 100644
--- a/base/sparse/sparsematrix.jl
+++ b/base/sparse/sparsematrix.jl
@@ -5,7 +5,7 @@
# Assumes that row values in rowval for each column are sorted
# issorted(rowval[colptr[i]:(colptr[i+1]-1)]) == true
-immutable SparseMatrixCSC{Tv,Ti<:Integer} <: AbstractSparseMatrix{Tv,Ti}
+struct SparseMatrixCSC{Tv,Ti<:Integer} <: AbstractSparseMatrix{Tv,Ti}
m::Int # Number of rows
n::Int # Number of columns
colptr::Vector{Ti} # Column i is in colptr[i]:(colptr[i+1]-1)
@@ -3176,7 +3176,7 @@ end
## diag and related using an iterator
-type SpDiagIterator{Tv,Ti}
+mutable struct SpDiagIterator{Tv,Ti}
A::SparseMatrixCSC{Tv,Ti}
n::Int
end
diff --git a/base/sparse/sparsevector.jl b/base/sparse/sparsevector.jl
index ef94ec7..6f476fc 100644
--- a/base/sparse/sparsevector.jl
+++ b/base/sparse/sparsevector.jl
@@ -9,7 +9,7 @@ import Base.LinAlg: promote_to_array_type, promote_to_arrays_
### Types
-immutable SparseVector{Tv,Ti<:Integer} <: AbstractSparseVector{Tv,Ti}
+struct SparseVector{Tv,Ti<:Integer} <: AbstractSparseVector{Tv,Ti}
n::Int # the number of elements
nzind::Vector{Ti} # the indices of nonzeros
nzval::Vector{Tv} # the values of nonzeros
diff --git a/base/sparse/spqr.jl b/base/sparse/spqr.jl
index 6f93e20..dee0c25 100644
--- a/base/sparse/spqr.jl
+++ b/base/sparse/spqr.jl
@@ -45,12 +45,12 @@ import Base: size
import Base.LinAlg: qrfact
import ..SparseArrays.CHOLMOD: convert, free!
-immutable C_Factorization{Tv<:VTypes} <: SuiteSparseStruct
+struct C_Factorization{Tv<:VTypes} <: SuiteSparseStruct
xtype::Cint
factors::Ptr{Tv}
end
-type Factorization{Tv<:VTypes} <: Base.LinAlg.Factorization{Tv}
+mutable struct Factorization{Tv<:VTypes} <: Base.LinAlg.Factorization{Tv}
m::Int
n::Int
p::Ptr{C_Factorization{Tv}}
diff --git a/base/sparse/umfpack.jl b/base/sparse/umfpack.jl
index 496faf5..f4cc9b4 100644
--- a/base/sparse/umfpack.jl
+++ b/base/sparse/umfpack.jl
@@ -11,7 +11,7 @@ importall ..SparseArrays
import ..SparseArrays: increment, increment!, decrement, decrement!, nnz
include("umfpack_h.jl")
-type MatrixIllConditionedException <: Exception
+mutable struct MatrixIllConditionedException <: Exception
message::AbstractString
end
@@ -91,7 +91,7 @@ function show_umf_info(level::Real = 2.0)
end
## Should this type be immutable?
-type UmfpackLU{Tv<:UMFVTypes,Ti<:UMFITypes} <: Factorization{Tv}
+mutable struct UmfpackLU{Tv<:UMFVTypes,Ti<:UMFITypes} <: Factorization{Tv}
symbolic::Ptr{Void}
numeric::Ptr{Void}
m::Int
diff --git a/base/special/bessel.jl b/base/special/bessel.jl
index 17e9b90..1c3636f 100644
--- a/base/special/bessel.jl
+++ b/base/special/bessel.jl
@@ -1,6 +1,6 @@
# This file is a part of Julia. License is MIT: http://julialang.org/license
-type AmosException <: Exception
+mutable struct AmosException <: Exception
info::Int32
end
diff --git a/base/special/trig.jl b/base/special/trig.jl
index 291503a..80a0d90 100644
--- a/base/special/trig.jl
+++ b/base/special/trig.jl
@@ -1,11 +1,11 @@
# This file is a part of Julia. Except for the *_kernel functions (see below),
# license is MIT: http://julialang.org/license
-immutable DoubleFloat64
+struct DoubleFloat64
hi::Float64
lo::Float64
end
-immutable DoubleFloat32
+struct DoubleFloat32
hi::Float64
end
diff --git a/base/stacktraces.jl b/base/stacktraces.jl
index a599886..9ed4005 100644
--- a/base/stacktraces.jl
+++ b/base/stacktraces.jl
@@ -42,7 +42,7 @@ Stack information representing execution context, with the following fields:
Representation of the pointer to the execution context as returned by `backtrace`.
"""
-immutable StackFrame # this type should be kept platform-agnostic so that profiles can be dumped on one machine and read on another
+struct StackFrame # this type should be kept platform-agnostic so that profiles can be dumped on one machine and read on another
"the name of the function containing the execution context"
func::Symbol
"the path to the file containing the execution context"
diff --git a/base/stat.jl b/base/stat.jl
index 7e102c5..d6922fc 100644
--- a/base/stat.jl
+++ b/base/stat.jl
@@ -25,7 +25,7 @@ export
stat,
uperm
-immutable StatStruct
+struct StatStruct
device :: UInt
inode :: UInt
mode :: UInt
diff --git a/base/stream.jl b/base/stream.jl
index 80514c3..657a5e0 100644
--- a/base/stream.jl
+++ b/base/stream.jl
@@ -99,7 +99,7 @@ function uv_status_string(x)
return "invalid status"
end
-type PipeEndpoint <: LibuvStream
+mutable struct PipeEndpoint <: LibuvStream
handle::Ptr{Void}
status::Int
buffer::IOBuffer
@@ -127,7 +127,7 @@ type PipeEndpoint <: LibuvStream
end
end
-type PipeServer <: LibuvServer
+mutable struct PipeServer <: LibuvServer
handle::Ptr{Void}
status::Int
connectnotify::Condition
@@ -150,7 +150,7 @@ function PipeServer()
return init_pipe!(p; readable=true)
end
-type TTY <: LibuvStream
+mutable struct TTY <: LibuvStream
handle::Ptr{Void}
status::Int
buffer::IOBuffer
@@ -529,7 +529,7 @@ end
# (composed of two half-pipes: .in and .out)
##########################################
-type Pipe <: AbstractPipe
+mutable struct Pipe <: AbstractPipe
in::PipeEndpoint # writable
out::PipeEndpoint # readable
end
@@ -1103,7 +1103,7 @@ reset(x::LibuvStream) = reset(x.buffer)
ismarked(x::LibuvStream) = ismarked(x.buffer)
# BufferStream's are non-OS streams, backed by a regular IOBuffer
-type BufferStream <: LibuvStream
+mutable struct BufferStream <: LibuvStream
buffer::IOBuffer
r_c::Condition
close_c::Condition
diff --git a/base/strings/basic.jl b/base/strings/basic.jl
index a523c67..ba31c6c 100644
--- a/base/strings/basic.jl
+++ b/base/strings/basic.jl
@@ -308,7 +308,7 @@ function chr2ind(s::AbstractString, i::Integer)
end
end
-immutable EachStringIndex{T<:AbstractString}
+struct EachStringIndex{T<:AbstractString}
s::T
end
eachindex(s::AbstractString) = EachStringIndex(s)
diff --git a/base/strings/errors.jl b/base/strings/errors.jl
index c0ca38f..8f80e5b 100644
--- a/base/strings/errors.jl
+++ b/base/strings/errors.jl
@@ -5,7 +5,7 @@
const UTF_ERR_SHORT = "invalid UTF-8 sequence starting at index <<1>> (0x<<2>> missing one or more continuation bytes)"
const UTF_ERR_INVALID_INDEX = "invalid character index"
-type UnicodeError <: Exception
+mutable struct UnicodeError <: Exception
errmsg::AbstractString ##< A UTF_ERR_ message
errpos::Int32 ##< Position of invalid character
errchr::UInt32 ##< Invalid character
diff --git a/base/strings/types.jl b/base/strings/types.jl
index 5442d14..d3f56d7 100644
--- a/base/strings/types.jl
+++ b/base/strings/types.jl
@@ -4,7 +4,7 @@
## substrings reference original strings ##
-immutable SubString{T<:AbstractString} <: AbstractString
+struct SubString{T<:AbstractString} <: AbstractString
string::T
offset::Int
endof::Int
@@ -100,7 +100,7 @@ end
## reversed strings without data movement ##
-immutable RevString{T<:AbstractString} <: AbstractString
+struct RevString{T<:AbstractString} <: AbstractString
string::T
end
diff --git a/base/strings/utf8proc.jl b/base/strings/utf8proc.jl
index 27683d1..591d0b5 100644
--- a/base/strings/utf8proc.jl
+++ b/base/strings/utf8proc.jl
@@ -338,7 +338,7 @@ isgraphemebreak(c1::Char, c2::Char) =
isgraphemebreak!(state::Ref{Int32}, c1::Char, c2::Char) =
ccall(:utf8proc_grapheme_break_stateful, Bool, (UInt32, UInt32, Ref{Int32}), c1, c2, state)
-immutable GraphemeIterator{S<:AbstractString}
+struct GraphemeIterator{S<:AbstractString}
s::S # original string (for generation of SubStrings)
end
diff --git a/base/subarray.jl b/base/subarray.jl
index a8cf520..412b7ff 100644
--- a/base/subarray.jl
+++ b/base/subarray.jl
@@ -5,7 +5,7 @@ typealias ViewIndex Union{Real, AbstractArray}
typealias ScalarIndex Real
# L is true if the view itself supports fast linear indexing
-immutable SubArray{T,N,P,I,L} <: AbstractArray{T,N}
+struct SubArray{T,N,P,I,L} <: AbstractArray{T,N}
parent::P
indexes::I
offset1::Int # for linear indexing and pointer, only valid when L==true
diff --git a/base/summarysize.jl b/base/summarysize.jl
index 25b7679..174f18f 100644
--- a/base/summarysize.jl
+++ b/base/summarysize.jl
@@ -1,4 +1,4 @@
-immutable SummarySize
+struct SummarySize
seen::ObjectIdDict
frontier_x::Vector{Any}
frontier_i::Vector{Int}
diff --git a/base/sysimg.jl b/base/sysimg.jl
index 7c875a6..710ba3f 100644
--- a/base/sysimg.jl
+++ b/base/sysimg.jl
@@ -112,7 +112,7 @@ include("abstractarraymath.jl")
include("arraymath.jl")
# define MIME"foo/bar" early so that we can overload 3-arg show
-immutable MIME{mime} end
+struct MIME{mime} end
macro MIME_str(s)
:(MIME{$(Expr(:quote, Symbol(s)))})
end
diff --git a/base/sysinfo.jl b/base/sysinfo.jl
index d96af33..d23f709 100644
--- a/base/sysinfo.jl
+++ b/base/sysinfo.jl
@@ -67,7 +67,7 @@ function __init__()
global JIT = ccall(:jl_get_JIT, Ref{String}, ())
end
-type UV_cpu_info_t
+mutable struct UV_cpu_info_t
model::Ptr{UInt8}
speed::Int32
cpu_times!user::UInt64
@@ -76,7 +76,7 @@ type UV_cpu_info_t
cpu_times!idle::UInt64
cpu_times!irq::UInt64
end
-type CPUinfo
+mutable struct CPUinfo
model::String
speed::Int32
cpu_times!user::UInt64
diff --git a/base/task.jl b/base/task.jl
index 753f808..d9ef189 100644
--- a/base/task.jl
+++ b/base/task.jl
@@ -3,7 +3,7 @@
## basic task functions and TLS
# Container for a captured exception and its backtrace. Can be serialized.
-type CapturedException <: Exception
+mutable struct CapturedException <: Exception
ex::Any
processed_bt::Vector{Any}
@@ -26,7 +26,7 @@ function showerror(io::IO, ce::CapturedException)
showerror(io, ce.ex, ce.processed_bt, backtrace=true)
end
-type CompositeException <: Exception
+mutable struct CompositeException <: Exception
exceptions::Vector{Any}
CompositeException() = new(Any[])
CompositeException(exceptions) = new(exceptions)
diff --git a/base/test.jl b/base/test.jl
index f21b8a0..b900982 100644
--- a/base/test.jl
+++ b/base/test.jl
@@ -60,7 +60,7 @@ abstract Result
The test condition was true, i.e. the expression evaluated to true or
the correct exception was thrown.
"""
-immutable Pass <: Result
+struct Pass <: Result
test_type::Symbol
orig_expr
data
@@ -87,7 +87,7 @@ end
The test condition was false, i.e. the expression evaluated to false or
the correct exception was not thrown.
"""
-type Fail <: Result
+mutable struct Fail <: Result
test_type::Symbol
orig_expr
data
@@ -119,7 +119,7 @@ it evaluated to something other than a `Bool`.
In the case of `@test_broken` it is used to indicate that an
unexpected `Pass` `Result` occurred.
"""
-type Error <: Result
+mutable struct Error <: Result
test_type::Symbol
orig_expr
value
@@ -159,7 +159,7 @@ end
The test condition is the expected (failed) result of a broken test,
or was explicitly skipped with `@test_skip`.
"""
-type Broken <: Result
+mutable struct Broken <: Result
test_type::Symbol
orig_expr
end
@@ -176,12 +176,12 @@ end
abstract ExecutionResult
-immutable Returned <: ExecutionResult
+struct Returned <: ExecutionResult
value
data
end
-immutable Threw <: ExecutionResult
+struct Threw <: ExecutionResult
exception
backtrace
end
@@ -482,7 +482,7 @@ function finish end
Thrown when a test set finishes and not all tests passed.
"""
-type TestSetException <: Exception
+mutable struct TestSetException <: Exception
pass::Int
fail::Int
error::Int
@@ -509,11 +509,11 @@ end
A simple fallback test set that throws immediately on a failure.
"""
-immutable FallbackTestSet <: AbstractTestSet
+struct FallbackTestSet <: AbstractTestSet
end
fallback_testset = FallbackTestSet()
-type FallbackTestSetException <: Exception
+mutable struct FallbackTestSetException <: Exception
msg::String
end
@@ -540,7 +540,7 @@ If using the DefaultTestSet, the test results will be recorded. If there
are any `Fail`s or `Error`s, an exception will be thrown only at the end,
along with a summary of the test results.
"""
-type DefaultTestSet <: AbstractTestSet
+mutable struct DefaultTestSet <: AbstractTestSet
description::AbstractString
results::Vector
n_passed::Int
@@ -1162,7 +1162,7 @@ The `GenericString` can be used to test generic string APIs that program to
the `AbstractString` interface, in order to ensure that functions can work
with string types besides the standard `String` type.
"""
-immutable GenericString <: AbstractString
+struct GenericString <: AbstractString
string::AbstractString
end
Base.convert(::Type{GenericString}, s::AbstractString) = GenericString(s)
diff --git a/base/traits.jl b/base/traits.jl
index 62bc9ec..614f3d6 100644
--- a/base/traits.jl
+++ b/base/traits.jl
@@ -3,8 +3,8 @@
## numeric/object traits
# trait for objects that have an ordering
abstract TypeOrder
-immutable HasOrder <: TypeOrder end
-immutable Unordered <: TypeOrder end
+struct HasOrder <: TypeOrder end
+struct Unordered <: TypeOrder end
(::Type{TypeOrder})(instance) = TypeOrder(typeof(instance))
(::Type{TypeOrder}){T<:Real}(::Type{T}) = HasOrder()
@@ -12,9 +12,9 @@ immutable Unordered <: TypeOrder end
# trait for objects that support arithmetic
abstract TypeArithmetic
-immutable ArithmeticRounds <: TypeArithmetic end # least significant bits can be lost
-immutable ArithmeticOverflows <: TypeArithmetic end # most significant bits can be lost
-immutable ArithmeticUnknown <: TypeArithmetic end
+struct ArithmeticRounds <: TypeArithmetic end # least significant bits can be lost
+struct ArithmeticOverflows <: TypeArithmetic end # most significant bits can be lost
+struct ArithmeticUnknown <: TypeArithmetic end
(::Type{TypeArithmetic})(instance) = TypeArithmetic(typeof(instance))
(::Type{TypeArithmetic}){T<:AbstractFloat}(::Type{T}) = ArithmeticRounds()
diff --git a/base/twiceprecision.jl b/base/twiceprecision.jl
index 80d1917..83651ac 100644
--- a/base/twiceprecision.jl
+++ b/base/twiceprecision.jl
@@ -30,7 +30,7 @@ roundoff error). If `step` has an exact rational representation
where `nb` is the number of trailing zero bits of `step.hi`. For
ranges, you can set `nb = ceil(Int, log2(len-1))`.
"""
-immutable TwicePrecision{T}
+struct TwicePrecision{T}
hi::T # most significant bits
lo::T # least significant bits
end
diff --git a/base/util.jl b/base/util.jl
index 7617229..7ce343b 100644
--- a/base/util.jl
+++ b/base/util.jl
@@ -14,7 +14,7 @@ Get the time in nanoseconds. The time corresponding to 0 is undefined, and wraps
time_ns() = ccall(:jl_hrtime, UInt64, ())
# This type must be kept in sync with the C struct in src/gc.h
-immutable GC_Num
+struct GC_Num
allocd ::Int64 # GC internal
deferred_alloc::Int64 # GC internal
freed ::Int64 # GC internal
@@ -34,7 +34,7 @@ end
gc_num() = ccall(:jl_gc_num, GC_Num, ())
# This type is to represent differences in the counters, so fields may be negative
-immutable GC_Diff
+struct GC_Diff
allocd ::Int64 # Bytes allocated
malloc ::Int64 # Number of GC aware malloc()
realloc ::Int64 # Number of GC aware realloc()
@@ -575,7 +575,7 @@ end
# Windows authentication prompt
if is_windows()
- immutable CREDUI_INFO
+ struct CREDUI_INFO
cbSize::UInt32
parent::Ptr{Void}
pszMessageText::Ptr{UInt16}
diff --git a/base/version.jl b/base/version.jl
index 9d7bf3a..956763c 100644
--- a/base/version.jl
+++ b/base/version.jl
@@ -2,7 +2,7 @@
## semantic version numbers (http://semver.org)
-immutable VersionNumber
+struct VersionNumber
major::Int
minor::Int
patch::Int
diff --git a/base/weakkeydict.jl b/base/weakkeydict.jl
index cd6128d..a15889d 100644
--- a/base/weakkeydict.jl
+++ b/base/weakkeydict.jl
@@ -9,7 +9,7 @@ referenced in a hash table.
See [`Dict`](@ref) for further help.
"""
-type WeakKeyDict{K,V} <: Associative{K,V}
+mutable struct WeakKeyDict{K,V} <: Associative{K,V}
ht::Dict{WeakRef,V}
lock::Threads.RecursiveSpinLock
finalizer::Function
diff --git a/base/workerpool.jl b/base/workerpool.jl
index c6ffe3f..7a90019 100644
--- a/base/workerpool.jl
+++ b/base/workerpool.jl
@@ -15,7 +15,7 @@ abstract AbstractWorkerPool
# workers::Set{Int}
#
-type WorkerPool <: AbstractWorkerPool
+mutable struct WorkerPool <: AbstractWorkerPool
channel::Channel{Int}
workers::Set{Int}
ref::RemoteChannel
@@ -214,7 +214,7 @@ using [`remotecall_fetch`](@ref).
remote(f) = (args...; kwargs...)->remotecall_fetch(f, default_worker_pool(), args...; kwargs...)
remote(p::AbstractWorkerPool, f) = (args...; kwargs...)->remotecall_fetch(f, p, args...; kwargs...)
-type CachingPool <: AbstractWorkerPool
+mutable struct CachingPool <: AbstractWorkerPool
channel::Channel{Int}
workers::Set{Int}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment