Gentleman, I stumbled onto this one in my code, and despite trying all the 
possible combinations I could think of, no dice. 

I have this simple type hierarchy: 

abstract Model
type Package <: Model
type Repo <: Model

The Model type is an ORM and it defines a series of methods that operate on 
Model subtypes. 

ex: 
function save{T<:Model}(m::T)

So far so good. 

Now, according to ORM architecture and design patterns, an instance of a 
subtype represents a table row, while the class itself represents the 
table. And of course there are plenty of such methods. 
For instance, the find_one_by function, which takes the type itself (the 
table). 

function find_one_by(m, column_name::SQLColumn, value::SQLInput) # this 
works, with m::Any

The question is, how can I define this method so that it accepts all the 
types of the subtypes of Model? 

I tried multiple combinations, such as: 
function find_one_by{T<:Type{Model}}(m::T, column_name::SQLColumn, 
value::SQLInput)

none was good. :( Any ideas? 

Reply via email to