Skip to content

Commit

Permalink
reorganize a bit of early library and init code (#23256)
Browse files Browse the repository at this point in the history
Remove base.jl, since it no longer had a clear purpose. Its contents
are moved to various more specific files.

Move docs for Core from helpdb to basedocs.jl.
  • Loading branch information
JeffBezanson committed Aug 15, 2017
1 parent 89b662d commit bdd0e99
Show file tree
Hide file tree
Showing 20 changed files with 522 additions and 526 deletions.
11 changes: 11 additions & 0 deletions base/array.jl
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,17 @@

## array.jl: Dense arrays

"""
DimensionMismatch([msg])
The objects called do not have matching dimensionality. Optional argument `msg` is a
descriptive error string.
"""
mutable struct DimensionMismatch <: Exception
msg::AbstractString
end
DimensionMismatch() = DimensionMismatch("")

## Type aliases for convenience ##
"""
AbstractVector{T}
Expand Down
10 changes: 10 additions & 0 deletions base/associative.jl
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,16 @@

# generic operations on associative collections

"""
KeyError(key)
An indexing operation into an `Associative` (`Dict`) or `Set` like object tried to access or
delete a non-existent element.
"""
mutable struct KeyError <: Exception
key
end

const secret_table_token = :__c782dbf1cf4d6a2e5e3865d7e95634f2e09b5902__

haskey(d::Associative, k) = in(k,keys(d))
Expand Down
153 changes: 0 additions & 153 deletions base/base.jl

This file was deleted.

36 changes: 35 additions & 1 deletion base/boot.jl
Original file line number Diff line number Diff line change
Expand Up @@ -135,7 +135,7 @@ export
ErrorException, BoundsError, DivideError, DomainError, Exception,
InterruptException, InexactError, OutOfMemoryError, ReadOnlyMemoryError,
OverflowError, StackOverflowError, SegmentationFault, UndefRefError, UndefVarError,
TypeError,
TypeError, ArgumentError, MethodError, AssertionError, LoadError, InitError,
# AST representation
Expr, GotoNode, LabelNode, LineNumberNode, QuoteNode,
GlobalRef, NewvarNode, SSAValue, Slot, SlotNumber, TypedSlot,
Expand Down Expand Up @@ -244,6 +244,40 @@ struct OverflowError <: Exception
msg
end

mutable struct ArgumentError <: Exception
msg::AbstractString
end

mutable struct MethodError <: Exception
f
args
world::UInt
MethodError(@nospecialize(f), @nospecialize(args), world::UInt) = new(f, args, world)
end
const typemax_UInt = ccall(:jl_typemax_uint, Any, (Any,), UInt)
MethodError(@nospecialize(f), @nospecialize(args)) = MethodError(f, args, typemax_UInt)

mutable struct AssertionError <: Exception
msg::AbstractString
AssertionError() = new("")
AssertionError(msg) = new(msg)
end

#Generic wrapping of arbitrary exceptions
#Subtypes should put the exception in an 'error' field
abstract type WrappedException <: Exception end

mutable struct LoadError <: WrappedException
file::AbstractString
line::Int
error
end

mutable struct InitError <: WrappedException
mod::Symbol
error
end

abstract type DirectIndexString <: AbstractString end

String(s::String) = s # no constructor yet
Expand Down
Loading

0 comments on commit bdd0e99

Please sign in to comment.