994
994
export axes
995
995
end
996
996
997
+ # 0.7.0-DEV.3137
998
+ @static if ! isdefined (Base, :Nothing )
999
+ const Nothing = Void
1000
+ const Cvoid = Void
1001
+ export Nothing, Cvoid
1002
+ end
1003
+
997
1004
@static if ! isdefined (Base, :Some )
998
1005
import Base: promote_rule, convert
999
1006
if VERSION >= v " 0.6.0"
@@ -1002,35 +1009,35 @@ end
1002
1009
value::T
1003
1010
end
1004
1011
promote_rule(::Type{Some{S}}, ::Type{Some{T}}) where {S,T} = Some{promote_type(S, T)}
1005
- promote_rule(::Type{Some{T}}, ::Type{Void }) where {T} = Union{Some{T}, Void }
1012
+ promote_rule(::Type{Some{T}}, ::Type{Nothing }) where {T} = Union{Some{T}, Nothing }
1006
1013
convert(::Type{Some{T}}, x::Some) where {T} = Some{T}(convert(T, x.value))
1007
- convert(::Type{Union{Some{T}, Void }}, x::Some) where {T} = convert(Some{T}, x)
1008
- convert(::Type{Union{T, Void }}, x::Any) where {T} = convert(T, x)
1014
+ convert(::Type{Union{Some{T}, Nothing }}, x::Some) where {T} = convert(Some{T}, x)
1015
+ convert(::Type{Union{T, Nothing }}, x::Any) where {T} = convert(T, x)
1009
1016
""" )
1010
1017
else
1011
1018
include_string (@__MODULE__ , """
1012
1019
immutable Some{T}
1013
1020
value::T
1014
1021
end
1015
1022
promote_rule{S,T}(::Type{Some{S}}, ::Type{Some{T}}) = Some{promote_type(S, T)}
1016
- promote_rule{T}(::Type{Some{T}}, ::Type{Void }) = Union{Some{T}, Void }
1023
+ promote_rule{T}(::Type{Some{T}}, ::Type{Nothing }) = Union{Some{T}, Nothing }
1017
1024
convert{T}(::Type{Some{T}}, x::Some) = Some{T}(convert(T, x.value))
1018
- convert{T}(::Type{Union{Some{T}, Void }}, x::Some) = convert(Some{T}, x)
1019
- convert{T}(::Type{Union{T, Void }}, x::Any) = convert(T, x)
1025
+ convert{T}(::Type{Union{Some{T}, Nothing }}, x::Some) = convert(Some{T}, x)
1026
+ convert{T}(::Type{Union{T, Nothing }}, x::Any) = convert(T, x)
1020
1027
""" )
1021
1028
end
1022
- convert (:: Type{Void } , x:: Any ) = throw (MethodError (convert, (Void , x)))
1023
- convert (:: Type{Void } , x:: Void ) = nothing
1029
+ convert (:: Type{Nothing } , x:: Any ) = throw (MethodError (convert, (Nothing , x)))
1030
+ convert (:: Type{Nothing } , x:: Nothing ) = nothing
1024
1031
coalesce (x:: Any ) = x
1025
1032
coalesce (x:: Some ) = x. value
1026
- coalesce (x:: Void ) = nothing
1033
+ coalesce (x:: Nothing ) = nothing
1027
1034
# coalesce(x::Missing) = missing
1028
1035
coalesce (x:: Any , y... ) = x
1029
1036
coalesce (x:: Some , y... ) = x. value
1030
- coalesce (x:: Void , y... ) = coalesce (y... )
1031
- # coalesce(x::Union{Void , Missing}, y...) = coalesce(y...)
1037
+ coalesce (x:: Nothing , y... ) = coalesce (y... )
1038
+ # coalesce(x::Union{Nothing , Missing}, y...) = coalesce(y...)
1032
1039
notnothing (x:: Any ) = x
1033
- notnothing (:: Void ) = throw (ArgumentError (" nothing passed to notnothing" ))
1040
+ notnothing (:: Nothing ) = throw (ArgumentError (" nothing passed to notnothing" ))
1034
1041
export Some, coalesce
1035
1042
else
1036
1043
import Base: notnothing
0 commit comments