Oh how very silly of me. As soon as I pressed enter I figured out the right 
way to do this.

abstract Ring
abstract EuclideanDomain <: Ring
abstract Field <: EuclideanDomain

type Poly{T <: Ring} <: Ring
end

type ZZ <: EuclideanDomain
end

type QQ <: Field
end

PolynomialRing{T <: Ring}(::Type{T}) = Poly{T}

function PolynomialRing{T <: Field}(::Type{T})
   R = Poly{T}
   R.super = EuclideanDomain
   return R
end

So with those definitions, here is the result:

julia> R = PolynomialRing(ZZ)
Poly{ZZ} (constructor with 1 method)

julia> R <: EuclideanDomain
false

julia> S = PolynomialRing(QQ)
Poly{QQ} (constructor with 1 method)

julia> S <: EuclideanDomain
true

julia> ZZ <: EuclideanDomain
true

julia> QQ <: EuclideanDomain
true

julia> type Robert <: EuclideanDomain
       end

julia> Robert <: EuclideanDomain
true

This is so elegant I can actually use it in Nemo. Great!

Bill.


-- 
You received this message because you are subscribed to the Google Groups 
"sage-devel" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to sage-devel+unsubscr...@googlegroups.com.
To post to this group, send email to sage-devel@googlegroups.com.
Visit this group at http://groups.google.com/group/sage-devel.
For more options, visit https://groups.google.com/d/optout.

Reply via email to