Le dimanche 03 avril 2016 à 10:34 +0200, Tamas Papp a écrit : > Hi, > > I want to explicitly specify the type of a comprehension (cf #7258). If > I have two values a::T and b::S, how can I compute the type of a/b using > just T and S? > > Currently I am using > > typeof(one(T)/one(S)) > > but surely there is something more elegant (also, it would be nice to > know in general, not just for arithmetic). Unfortunately, I don't think there's a shorter solution.
The unexported promote_op() function could be used, but it's not shorter (maybe it's more natural/explicit though): julia> Base.promote_op(/, Int, Int) Float64 For comprehensions, the long-term solution is clearly to get inference do this automatically for you. My two cents > Best, > > Tamas
