Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Trait inheritance #11

Open
mauro3 opened this issue Oct 11, 2016 · 5 comments
Open

Trait inheritance #11

mauro3 opened this issue Oct 11, 2016 · 5 comments

Comments

@mauro3
Copy link
Owner

mauro3 commented Oct 11, 2016

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
Copy link

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
Copy link
Owner Author

mauro3 commented Oct 19, 2016

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

@JeffreySarnoff
Copy link

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 [email protected] 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
#11 (comment),
or mute the thread
https://github.com/notifications/unsubscribe-auth/ABmqxnizPGC8bX6gKCcX41YEf-FyYe2aks5q1jIkgaJpZM4KUGaU
.

@mauro3
Copy link
Owner Author

mauro3 commented Oct 19, 2016

I added a test that all trait parameters need to be specified for it to be a valid trait:

!isleaftype(tr) && error("Not all parameters of $tr are specified, thus not a valid trait.")

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
Copy link

I'll try it out.

On Wed, Oct 19, 2016 at 3:20 PM, Mauro [email protected] 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/
2d5112b/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
#11 (comment),
or mute the thread
https://github.com/notifications/unsubscribe-auth/ABmqxkRaJYRCK3X7VqsXZxejUWxbfoAzks5q1m10gaJpZM4KUGaU
.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants