I tried your example. Really, you can break Julia in this way. Luckily,
it's a syntax error.
However, mine is a semantic error, and harder to detect.
On Wednesday, August 26, 2015 at 8:30:47 PM UTC+2, Yichao Yu wrote:
On Wed, Aug 26, 2015 at 12:44 PM, Sisyphuss zhengw...@gmail.com
Le jeudi 27 août 2015 à 09:13 +0300, Joshua Ballanco a écrit :
On August 26, 2015 at 21:30:47, Yichao Yu (yyc1...@gmail.com(mailto:
yyc1...@gmail.com)) wrote:
On Wed, Aug 26, 2015 at 12:44 PM, Sisyphuss wrote:
Of course, I know how to write the valid code.
But in the interactive
On August 26, 2015 at 21:30:47, Yichao Yu
(yyc1...@gmail.com(mailto:yyc1...@gmail.com)) wrote:
On Wed, Aug 26, 2015 at 12:44 PM, Sisyphuss wrote:
Of course, I know how to write the valid code.
But in the interactive environment, if someone accidentally defines the
promote_rule in the
On Wed, Aug 26, 2015 at 12:44 PM, Sisyphuss zhengwend...@gmail.com wrote:
Of course, I know how to write the valid code.
But in the interactive environment, if someone accidentally defines the
promote_rule in the non-base way, he will find himself in an
incomprehensible situation.
There's
Of course, I know how to write the valid code.
But in the interactive environment, if someone accidentally defines the
promote_rule in the non-base way, he will find himself in an
incomprehensible situation.
On Wednesday, August 26, 2015 at 4:15:59 PM UTC+2, Luthaf wrote:
By doing
By doing
promote_rule() = 1
And then
Base.promote_rule{T}(::Type{A{T}},::Type{C{T}}) = C{T}
You are defining two different functions. Only the second one is used by
the promotion system.
The valid code is
abstract B
type A:B
end
type C:B
end
In other words, it won't fix?
On Wednesday, August 26, 2015 at 6:41:36 AM UTC+2, Stefan Karpinski wrote:
Don't do the first non-base definition.
On Wed, Aug 26, 2015 at 12:27 AM, Sisyphuss zhengw...@gmail.com
javascript: wrote:
This modification works, but it fails sometimes:
abstract
Add `Base.` in front of `promote_rule`.
--Tim
On Tuesday, August 25, 2015 08:23:40 PM Sisyphuss wrote:
abstract B
type A:B
end
type C:B
end
promote_rule(::Type{A},::Type{C}) = C
@assert promote_type(A,C) == B
Whether I define the promotion_rule or not, the promote_type is
abstract B
type A:B
end
type C:B
end
promote_rule(::Type{A},::Type{C}) = C
@assert promote_type(A,C) == B
Whether I define the promotion_rule or not, the promote_type is always B.
This modification works, but it fails sometimes:
abstract B{T}
type A{T}:B{T}
end
type C{T}:B{T}
end
promote_rule() = 1
promote_rule()
@assert promote_type(A{Real},C{Real}) == B{Real}
Base.promote_rule{T}(::Type{A{T}},::Type{C{T}}) = C{T}
@assert promote_type(A{Real},C{Real}) == B{Real}
Don't do the first non-base definition.
On Wed, Aug 26, 2015 at 12:27 AM, Sisyphuss zhengwend...@gmail.com wrote:
This modification works, but it fails sometimes:
abstract B{T}
type A{T}:B{T}
end
type C{T}:B{T}
end
promote_rule() = 1
promote_rule()
@assert
11 matches
Mail list logo