I think what you're looking for are traits. There's discussion about making them part of the core language eventually, but in the meantime, check out https://github.com/mauro3/Traits.jl
On Thu, Sep 17, 2015 at 2:16 PM, Josh Langsfeld <[email protected]> wrote: > Essentially, it would really cool to be able to do something like 'type > SubString{T<: AbstractString} <:T ...' for dispatch purposes. > 'SubString{ASCIIString} <: ASCIIString' would still return false in general. > > On Thursday, September 17, 2015 at 1:47:24 PM UTC-4, Josh Langsfeld wrote: >> >> I recently was stumped when I wanted to write a function that dispatched >> on 'ASCIIString' versus 'UTF8String' but then had to deal with a >> 'SubString{ASCIIString}'. It made me think that given Julia's prolific use >> of wrapper types, it would be very nice to be able to dispatch on a type T >> and also any wrapper with a single type parameter of T that acts just like >> a regular T. >> >> As far as I'm aware, that's only possible with a UnionType, but that's >> quite cumbersome to code, especially if you don't know the names of all the >> wrappers you might see beforehand. Any thoughts on the feasibility of >> something like this? >> >
