diff --git a/README.md b/README.md index 1c616ea9d..e8f01d2b0 100644 --- a/README.md +++ b/README.md @@ -124,6 +124,8 @@ Currently, the `@compat` macro supports the following syntaxes: * `writemime` has been merged into `show` [#16563](https://github.com/JuliaLang/julia/pull/16563). Note that to extend this function requires `@compat`; see the [Supported Syntax](#supported-syntax) section for more information. +* `$` is now `xor` or `⊻` [#18977](https://github.com/JuliaLang/julia/pull/18977). + ## New macros * `@static` has been added [#16219](https://github.com/JuliaLang/julia/pull/16219). diff --git a/src/Compat.jl b/src/Compat.jl index 897d4ce56..453ee979f 100644 --- a/src/Compat.jl +++ b/src/Compat.jl @@ -1679,4 +1679,11 @@ if VERSION < v"0.6.0-dev.848" end end +# julia#18977 +if !isdefined(Base, :xor) + const xor = $ + const ⊻ = xor + export xor, ⊻ +end + end # module diff --git a/test/runtests.jl b/test/runtests.jl index 06c8c283f..86d55f8ed 100644 --- a/test/runtests.jl +++ b/test/runtests.jl @@ -1509,3 +1509,6 @@ for T in types x = @compat Nullable{Array{T}}() @test_throws UndefRefError unsafe_get(x) end + +@test xor(1,5) == 4 +@test 1 ⊻ 5 == 4