mauro3 / SimpleTraits.jl

Simple Traits for Julia
MIT License
158 stars 14 forks source link

Trait inheritance #11

Open mauro3 opened 8 years ago

mauro3 commented 8 years ago

Trait inheritance can be implemented with generated functions as described in https://github.com/mauro3/SimpleTraits.jl#advanced-features . This could be added to the @traitdef macro. One thing to ponder would be the effect of @traitimpl: should it do checking that subtraits are defined (trickier) or should it just force it (this would be as is).

JeffreySarnoff commented 8 years ago

Do the easier first, with examples of proper use -- your package is of much wider applicability if stuff that is in the land of @generated is done behind the scene.

mauro3 commented 8 years ago

Some initial work on this branch: https://github.com/mauro3/SimpleTraits.jl/tree/m3/subtraits

JeffreySarnoff commented 8 years ago

Thanks for the subtrait effort.

Why did Not need to become concrete?

fyi, re line 114, to distinguish CleanCode from cleanCode ... title case LooksLikeThis because of title page typograpy and camel case looksLikeThis because the camel's hump is in the middle of its body (someone was watching a camel while it was drinking).

On Wed, Oct 19, 2016 at 11:07 AM, Mauro notifications@github.com wrote:

Some initial work on this branch: https://github.com/mauro3/ SimpleTraits.jl/tree/m3/subtraits

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/mauro3/SimpleTraits.jl/issues/11#issuecomment-254841687, or mute the thread https://github.com/notifications/unsubscribe-auth/ABmqxnizPGC8bX6gKCcX41YEf-FyYe2aks5q1jIkgaJpZM4KUGaU .

mauro3 commented 8 years ago

I added a test that all trait parameters need to be specified for it to be a valid trait: https://github.com/mauro3/SimpleTraits.jl/blob/2d5112b3d50ec9d67eec7c9a5a06073fb079ff87/src/SimpleTraits.jl#L94 But that test only works if Not is not abstract. I'm not sure what the original reason was to make it abstract. The test pass, so I just changed it.

I'm kinda aware of camelCase but no true camel case is used in Julia so I feel its clear enough.

JeffreySarnoff commented 8 years ago

I'll try it out.

On Wed, Oct 19, 2016 at 3:20 PM, Mauro notifications@github.com wrote:

I added a test that all trait parameters need to be specified for it to be a valid trait: https://github.com/mauro3/SimpleTraits.jl/blob/ 2d5112b3d50ec9d67eec7c9a5a06073fb079ff87/src/SimpleTraits.jl#L94 But that test only works if Not is not abstract. I'm not sure what the original reason was to make it abstract. The test pass, so I just changed it.

I'm kinda aware of camelCase but no true camel case is used in Julia so I feel its clear enough.

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/mauro3/SimpleTraits.jl/issues/11#issuecomment-254913809, or mute the thread https://github.com/notifications/unsubscribe-auth/ABmqxkRaJYRCK3X7VqsXZxejUWxbfoAzks5q1m10gaJpZM4KUGaU .