960
960
export axes
961
961
end
962
962
963
+ # 0.7.0-DEV.3137
964
+ @static if ! isdefined (Base, :Nothing )
965
+ const Nothing = Void
966
+ const Cvoid = Void
967
+ export Nothing, Cvoid
968
+ end
969
+
963
970
@static if ! isdefined (Base, :Some )
964
971
import Base: promote_rule, convert
965
972
if VERSION >= v " 0.6.0"
@@ -968,35 +975,35 @@ end
968
975
value::T
969
976
end
970
977
promote_rule(::Type{Some{S}}, ::Type{Some{T}}) where {S,T} = Some{promote_type(S, T)}
971
- promote_rule(::Type{Some{T}}, ::Type{Void }) where {T} = Union{Some{T}, Void }
978
+ promote_rule(::Type{Some{T}}, ::Type{Nothing }) where {T} = Union{Some{T}, Nothing }
972
979
convert(::Type{Some{T}}, x::Some) where {T} = Some{T}(convert(T, x.value))
973
- convert(::Type{Union{Some{T}, Void }}, x::Some) where {T} = convert(Some{T}, x)
974
- convert(::Type{Union{T, Void }}, x::Any) where {T} = convert(T, x)
980
+ convert(::Type{Union{Some{T}, Nothing }}, x::Some) where {T} = convert(Some{T}, x)
981
+ convert(::Type{Union{T, Nothing }}, x::Any) where {T} = convert(T, x)
975
982
""" )
976
983
else
977
984
include_string (@__MODULE__ , """
978
985
immutable Some{T}
979
986
value::T
980
987
end
981
988
promote_rule{S,T}(::Type{Some{S}}, ::Type{Some{T}}) = Some{promote_type(S, T)}
982
- promote_rule{T}(::Type{Some{T}}, ::Type{Void }) = Union{Some{T}, Void }
989
+ promote_rule{T}(::Type{Some{T}}, ::Type{Nothing }) = Union{Some{T}, Nothing }
983
990
convert{T}(::Type{Some{T}}, x::Some) = Some{T}(convert(T, x.value))
984
- convert{T}(::Type{Union{Some{T}, Void }}, x::Some) = convert(Some{T}, x)
985
- convert{T}(::Type{Union{T, Void }}, x::Any) = convert(T, x)
991
+ convert{T}(::Type{Union{Some{T}, Nothing }}, x::Some) = convert(Some{T}, x)
992
+ convert{T}(::Type{Union{T, Nothing }}, x::Any) = convert(T, x)
986
993
""" )
987
994
end
988
- convert (:: Type{Void } , x:: Any ) = throw (MethodError (convert, (Void , x)))
989
- convert (:: Type{Void } , x:: Void ) = nothing
995
+ convert (:: Type{Nothing } , x:: Any ) = throw (MethodError (convert, (Nothing , x)))
996
+ convert (:: Type{Nothing } , x:: Nothing ) = nothing
990
997
coalesce (x:: Any ) = x
991
998
coalesce (x:: Some ) = x. value
992
- coalesce (x:: Void ) = nothing
999
+ coalesce (x:: Nothing ) = nothing
993
1000
# coalesce(x::Missing) = missing
994
1001
coalesce (x:: Any , y... ) = x
995
1002
coalesce (x:: Some , y... ) = x. value
996
- coalesce (x:: Void , y... ) = coalesce (y... )
997
- # coalesce(x::Union{Void , Missing}, y...) = coalesce(y...)
1003
+ coalesce (x:: Nothing , y... ) = coalesce (y... )
1004
+ # coalesce(x::Union{Nothing , Missing}, y...) = coalesce(y...)
998
1005
notnothing (x:: Any ) = x
999
- notnothing (:: Void ) = throw (ArgumentError (" nothing passed to notnothing" ))
1006
+ notnothing (:: Nothing ) = throw (ArgumentError (" nothing passed to notnothing" ))
1000
1007
export Some, coalesce
1001
1008
else
1002
1009
import Base: notnothing
0 commit comments