I see thank you very much for your answer! :D

El martes, 25 de octubre de 2016, 13:20:50 (UTC-5), Tim Holy escribió:
>
> > Why not use dispatch instead?
>
> Because subtyping isn't powerful enough for all needs. For example:
>
>
> julia> using Unitful
>
> julia> const mm = u"mm"
> mm
>
> julia> isa(3.2mm, AbstractFloat)
> false
>
>
> You'd probably like to use the fancy logic of `FloatRange` if you're 
> constructing a range `3.2mm:0.1mm:4.8mm`, so the solution is to dispatch on 
> a trait that indicates that arithmetic isn't exact (which is what really is 
> going on inside that code anyway---who cares what kind of number type it 
> is).
>
> Best,
> --Tim
>
> On Tue, Oct 25, 2016 at 12:55 PM, Ismael Venegas Castelló <
> ismael...@gmail.com <javascript:>> wrote:
>
>> Why not use dispatch instead?
>>
>> isexact(::Integer) = true
>> isexact(::Rational) = true
>> isexact(x::Complex) = isexact(x.re)
>> isexact(::Any) = false
>
>
>

Reply via email to