Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

various fixes for 0.6 #12

Merged
merged 4 commits into from
Apr 6, 2017
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions REQUIRE
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
julia 0.4
Compat 0.7.15
julia 0.5
Compat 0.19.0
2 changes: 1 addition & 1 deletion src/Measures.jl
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ export Measure, Length, AbsoluteLength, BoundingBox, AbsoluteBox, Absolute2DBox,
Absolute3DBox, Vec, Vec2, Vec3, AbsoluteVec, AbsoluteVec2, AbsoluteVec3,
resolve, mm, cm, inch, pt, width, height

abstract Measure
@compat abstract type Measure end

include("operations.jl")
include("length.jl")
Expand Down
6 changes: 3 additions & 3 deletions src/boundingbox.jl
Original file line number Diff line number Diff line change
Expand Up @@ -26,11 +26,11 @@ BoundingBox(width, height, depth) = BoundingBox(0mm, 0mm, 0mm, width, height, de

isabsolute{P1, P2}(b::BoundingBox{P1, P2}) = isabsolute(b.x0) && isabsolute(b.a)

typealias AbsoluteBox{N} BoundingBox{NTuple{N, Length{:mm, Float64}},
const AbsoluteBox{N} = BoundingBox{NTuple{N, Length{:mm, Float64}},
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This needs a @compat to work on 0.5 right?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah, working on it rn

NTuple{N, Length{:mm, Float64}}}
typealias Absolute2DBox BoundingBox{Tuple{AbsoluteLength, AbsoluteLength},
const Absolute2DBox = BoundingBox{Tuple{AbsoluteLength, AbsoluteLength},
Tuple{AbsoluteLength, AbsoluteLength}}
typealias Absolute3DBox BoundingBox{
const Absolute3DBox = BoundingBox{
Tuple{
AbsoluteLength,
AbsoluteLength,
Expand Down
2 changes: 1 addition & 1 deletion src/length.jl
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ immutable Length{U, T} <: Measure
end
Length{T}(unit::Symbol, x::T) = Length{unit, T}(x)

typealias AbsoluteLength Length{:mm, Float64}
const AbsoluteLength = Length{:mm, Float64}

Base.convert{u, T1 <: Number, T2 <: Number}(::Type{Length{u, T1}}, x::Length{u, T2}) =
Length{u, T1}(x.value)
Expand Down
9 changes: 4 additions & 5 deletions src/operations.jl
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@

abstract MeasureOp{n} <: Measure
abstract UnaryOp{A} <: MeasureOp{1}
abstract ScalarOp{A} <: MeasureOp{2}
abstract BinaryOp{A, B} <: MeasureOp{2}
@compat abstract type MeasureOp{n} <: Measure end
@compat abstract type UnaryOp{A} <: MeasureOp{1} end
@compat abstract type ScalarOp{A} <: MeasureOp{2} end
@compat abstract type BinaryOp{A, B} <: MeasureOp{2} end

immutable Neg{A <: Measure} <: UnaryOp{A}
a::A
Expand Down Expand Up @@ -48,4 +48,3 @@ iszero(x::Measure) = false
@compat Base.:*(a::Number, b::Measure) = Mul(b, a)
Base.min(a::Measure, b::Measure) = Min(a, b)
Base.max(a::Measure, b::Measure) = Max(a, b)

18 changes: 6 additions & 12 deletions src/point.jl
Original file line number Diff line number Diff line change
@@ -1,14 +1,9 @@

# Higher-order measures


#typealias Point Tuple{Vararg{Measure}}
#typealias Point2D Tuple{Measure, Measure}
#typealias Point3D Tuple{Measure, Measure, Measure}

typealias Vec{N} NTuple{N, Measure}
typealias Vec2 Vec{2}
typealias Vec3 Vec{3}
const Vec{N} = NTuple{N, Measure}
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same here

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

i think an @compat is needed when both sides are parameterized

const Vec2 = Vec{2}
const Vec3 = Vec{3}

isabsolute(p::Vec) = false
isabsolute{N}(p::NTuple{N, AbsoluteLength}) = true
Expand All @@ -17,9 +12,9 @@ isabsolute{N}(p::NTuple{N, AbsoluteLength}) = true
#Vec(x::Measure, y::Measure) = Vec{2, Measure}((x, y))
#Vec() = Vec(0mm, 0mm)

typealias AbsoluteVec{N} NTuple{N, Length{:mm, Float64}}
typealias AbsoluteVec2 AbsoluteVec{2}
typealias AbsoluteVec3 AbsoluteVec{3}
const AbsoluteVec{N} = NTuple{N, Length{:mm, Float64}}
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

And here

const AbsoluteVec2 = AbsoluteVec{2}
const AbsoluteVec3 = AbsoluteVec{3}

#Base.zero(::Type{Vec}) = Vec()

Expand All @@ -33,4 +28,3 @@ typealias AbsoluteVec3 AbsoluteVec{3}
@compat @generated function Base.:+{N}(a::Vec{N}, b::Vec{N})
Expr(:tuple, [:(a[$i] + b[$i]) for i=1:N]...)
end