On 1 July 2013 14:01, Camille Teruel <camille.teruel@gmail.com> wrote:
On 1 juil. 2013, at 12:19, Igor Stasenko wrote:
On 30 June 2013 15:48, Damien Cassou <damien.cassou@gmail.com> wrote:
On Sun, Jun 30, 2013 at 2:54 PM, Camillo Bruni <camillobruni@gmail.com> wrote:
But you know that you can do this right now?
I think these examples only show that some verifications are missing. I don't know any source code using that. To me it's more a bug than a feature. I would keep things simple: applying a trait to a class applies the classTrait to the metaclass.
but that's far less simpler than: - applying trait to behavior (object), applies it only to that object and nothing else (no meta-mess).
Yet the current trait model is based on trait and class trait, and that's consistent with the class model. If you want trait to be applied only on one side: - we have to refactor a lot of stuff, because a lot of our current code rely on this model. - you have to provide a new way for managing instance/class-side dependancies: For example, if one the class side you have: "self class blah" how can you ensure that the class side has the implementation you expect?
it is not responsibility of trait to reason whether "self class" gives right/wrong object to work with. #class is just a message sent to receiver.. you may think it is special, but there's nothing special in it comparing to any other message you sending to object(s). in any case, when developer applies trait on class side, he knows what he doing, isn't?
On the other hand if you want a trait to be applied only on the instance side: provide only instance-side methods. And if you want a trait to be applied only on the class-side: provides only class-side methods.
So everything's fine with this regard IMO. Don't change it, just ensure the missing verification in the class builder.
Fine? Ok, how to apply trait which has single method, to make this method appear on both class and instance sides? (Copy/pasting same method twice is not an answer). I am not asking for changing things. But i think that implementation would be simpler, if Trait do not have to support class/metaclass duality. -- Best regards, Igor Stasenko.