> On 05 Jan 2016, at 17:51, Geoffrey Broadwell (via RT) > <perl6-bugs-follo...@perl.org> wrote: > > # New Ticket Created by Geoffrey Broadwell > # Please include the string: [perl #127170] > # in the subject line of all future correspondence about this issue. > # <URL: https://rt.perl.org/Ticket/Display.html?id=127170 > > > > Mixing a role into a subclass of Date loses defaults for the role's > attributes: > > 08:44 < japhb> m: role Foo { has $.s = 42; has @.a = 7, 8, 9; }; class > Bar does Foo { }; class BarDate is Date does Foo { }; dd Bar.new.a; dd > BarDate.today.a; > 08:44 <+camelia> rakudo-moar 75c6b9: OUTPUT«Array @!a = [7, 8, > 9]Array @!a = []» > > This worked fine as of a couple weeks ago ... I'm guessing one of the > Temporal refactorings/optimizations broke this case? > > FWIW, I noticed this because I created a "BusinessDateish" role for > keeping track of business quarters, holidays, etc., and then created > BusinessDate and BusinessDateTime as subclasses of Date and DateTime > with BusinessDateish mixed in.
I think this is happening because I gave Date/DateTime their own new / BUILD combo, so it’s not going through the default new process, thereby bypassing the automatic default handling for mixed in attributes. Which is a large part of the speedup of Date/DateTime. Looking at ways to create a different code path for Date only, and subclassed Date, thereby restoring the above behaviour, while keeping most of the speed increase for the most common cases. Liz