Skip to content
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.

Commit 31c56fd

Browse files
committedJun 30, 2015
Compat for #11922 (MathConst -> Irrational)
Fixes #108
1 parent 3ecf55d commit 31c56fd

File tree

3 files changed

+18
-0
lines changed

3 files changed

+18
-0
lines changed
 

Diff for: ‎README.md

+4
Original file line numberDiff line numberDiff line change
@@ -63,6 +63,8 @@ Currently, the `@compat` macro supports the following syntaxes:
6363
Julia 0.4, using these types also checks whether the string has embedded
6464
NUL characters [#10994](https://github.com/JuliaLang/julia/pull/10994).)
6565

66+
* `typealias Irrational MathConst` - `MathConst` has been renamed to `Irrational` [#11922](https://github.com/JuliaLang/julia/pull/11922)
67+
6668
## New functions
6769

6870
* `eachindex`, as in `for i in eachindex(A)`, can be used in julia 0.3. This is the recommended way to iterate over each index in an `AbstractArray`. On julia 0.3 `eachindex` just returns `1:length(A)`, but in julia 0.4 it can return a more sophisticated iterator.
@@ -111,6 +113,8 @@ Currently, the `@compat` macro supports the following syntaxes:
111113

112114
* `zero(Ptr{T})` is now `Ptr{T}(0)` [#8909](https://github.com/JuliaLang/julia/pull/8909)
113115

116+
* The unexported macro `Base.@math_const` was renamed to `Base.@irrational`, accessible as `Compat.@irrational` on either 0.3 or 0.4 [#11922](https://github.com/JuliaLang/julia/pull/11922)
117+
114118
## New types
115119

116120
* [`Nullable` types](http://julia.readthedocs.org/en/latest/manual/types/?highlight=nullable#nullable-types-representing-missing-values) and their associated operations.

Diff for: ‎src/Compat.jl

+8
Original file line numberDiff line numberDiff line change
@@ -459,4 +459,12 @@ if VERSION < v"0.4.0-dev+5322"
459459
include("timer.jl")
460460
end
461461

462+
if VERSION < v"0.4.0-dev+5688"
463+
typealias Irrational MathConst
464+
@eval const $(symbol("@irrational")) = getfield(Base, symbol("@math_const"))
465+
export Irrational
466+
else
467+
import Base.@irrational
468+
end
469+
462470
end # module

Diff for: ‎test/runtests.jl

+6
Original file line numberDiff line numberDiff line change
@@ -357,3 +357,9 @@ let c = 0, f, t
357357
sleep(0.1)
358358
@test val == c
359359
end
360+
361+
# MathConst -> Irrational
362+
f(::Irrational) = true
363+
@test f(π)
364+
Compat.@irrational mathconst_one 1.0 big(1.)
365+
@test f(mathconst_one)

0 commit comments

Comments
 (0)
Please sign in to comment.