On 29/11/14 00:53, Chris Marshall wrote:
> On Fri, Nov 28, 2014 at 11:01 AM, Tom Hacohen <tom.haco...@samsung.com> wrote:
>> On 28/11/14 13:36, Chris Marshall wrote:
>>> On Nov 28, 2014 4:12 AM, "Tom Hacohen" <tom.haco...@samsung.com> wrote:
>>>>
>>>> On 28/11/14 10:05, Tom Hacohen wrote:
>>>>> On 25/11/14 21:58, Chris Marshall wrote:
>>>>>> I would like to support perl5 roles which are also known as traits:
>>>>>>
>>>>>>       http://scg.unibe.ch/archive/papers/Scha03aTraits.pdf
>>>>>>
>>>>>> >From the positive experience with roles in perl5 modern OO
>>>>>> developments, there is reason to believe that their support in
>>>>>> EO might be equally useful and maybe an improvement over
>>>>>> the mixin functionality.
>>>>>>
>>>>>
>>>>> Thanks, will read into that.
>>>>>
>>>>> Will reply to the rest of your emails in a second.
>>>>
>>>> I don't see how they are different from mixins with 0 associated data.
>>>> They just seem like a more restricted version of mixins.
>>>
>>> The main difference is that they get composed into the class as they are
>>> applied so there is no further MRO or inheritance.  This gives the good
>>> parts of multiple inheritance without the pathologies.
>>
>> OK, so they are a way to add methods to a class directly? Interesting.
>> Though I don't see the benefits over mixins. They integrate well into
>> the MRO and let you do a bit more (have data) that we actually use
>> (though could refactor to avoid).
>
> Here are a couple of pages that give some explanation
> of roles in perl5 and the comparison of roles versus
> interfaces, mixins, and traits in some other languages.
>
>    http://search.cpan.org/~ether/Moose-2.1402/lib/Moose/Manual/Roles.pod
>    
> http://radar.oreilly.com/2014/01/horizontal-reuse-an-alternative-to-inheritance.html
>
> For the purposes of the Perl Data Language, the use of
> roles, method modifiers (before, around, after other methods),
> together with the ability to apply roles to objects form the
> basis for the PDL3 JIT support in the works.
>

I skimmed over the links, and I still don't see the benefit. A mixin 
could provide the pull_plough without any issues, and everything will 
work as expected.
Furthermore, in the first link it's explicitly said that "Moose roles 
are similar to mixins or interfaces in other languages.", so even there 
they don't say anything about them being better.

I need an example (preferably a real life use case) of something I can't 
do, or can it's much harder to do, without roles.

--
Tom.

------------------------------------------------------------------------------
Download BIRT iHub F-Type - The Free Enterprise-Grade BIRT Server
from Actuate! Instantly Supercharge Your Business Reports and Dashboards
with Interactivity, Sharing, Native Excel Exports, App Integration & more
Get technology previously reserved for billion-dollar corporations, FREE
http://pubads.g.doubleclick.net/gampad/clk?id=164703151&iu=/4140/ostg.clktrk
_______________________________________________
enlightenment-devel mailing list
enlightenment-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/enlightenment-devel

Reply via email to