mauro3 / Traits.jl

Exploration of traits in Julia
Other
39 stars 6 forks source link

Inheritance in terms of traits #17

Open hayd opened 9 years ago

hayd commented 9 years ago

Just as a proof of concept, could a macro be used in place of inheritance. e.g. if we had

type Int <: Integer

could we replace this as a trait

@traittype type Int <: Integer
# to be the same as (I think)
type Int
@traitdef Integer{X}
@traitimpl Integer{Int}

so that any defined types on traits could dispatch off Integer.

Perhaps this should be on SimpleTraits ?` This is "syntax that could work for base"... and then be extended to MI :).