Fire is step THREE! | github.com/perl6/toolchain-bikeshed | Channel logs: irclog.perlgeek.de/perl6-toolchain/today | useful prior art: metacpan.org/pod/CPAN::Meta::Spec
Set by moderator on 20 July 2016.
00:57 stmuk_ joined 06:22 domidumont joined 07:19 domidumont joined 07:21 domidumont joined
ugexe m: role Distribution2[$v where * < v2016.07 = $*VM.version] { method ident { "old" }; }; role Distribution2[$v where * >= v2016.07 = $*VM.version] { method ident { "new" }; }; say Distribution2.new.ident; # One weird trick for backwards compat discovered by soccer mom 13:58
camelia rakudo-moar 61725d: OUTPUT«new␤»
15:35 domidumont joined 16:15 FROGGS joined
nine ugexe: just looking at the gist you sent me. Looks crazy enough that it might work ;) So....does it? Is it compatible with both old and new versions of zef and panda? 16:22
16:23 domidumont joined
ugexe Not exactly. Distribution.new(:name<xxx>) works still, but class :: Foo is Distribution {}.new(:name<xxx>).name (subclassing) still does not. What it *does* fix is how it acts in role context; currently if Distribution is composed into a class after everything else it's meta/content methods shadow what the class may already implement (which then calls die) 16:43
nine So...what's missing is detecting in method new that we're creating a subclass of Distribution, not something that consumes the role? 16:45
ugexe m: m: role Bar { method meta {1}; method content {1}; }; class Foo does Bar { }; my $foo = Foo.new but Distribution; $foo.meta # fixes this while retaining the `Distribution.new()` of panda 16:46
camelia rakudo-moar 61725d: OUTPUT«Method 'meta' must be implemented by Foo+{Distribution} because it is required by role Distribution␤ in block <unit> at <tmp> line 1␤␤»
ugexe right
normally a role can do that 16:50
m: role Foo { has $.a; }; class Bar is Foo { }; say Bar.new(:a<1>).a
camelia rakudo-moar 61725d: OUTPUT«1␤»
ugexe m: class Bar is Distribution { }; say Bar.new(:name<1>).name 16:52
camelia rakudo-moar 61725d: OUTPUT«Method 'name' not found for invocant of class 'Bar'␤ in block <unit> at <tmp> line 1␤␤»
nine m: class Foo is Distribution { }; say so Foo.^parents.grep(Distribution); 16:56
camelia rakudo-moar 61725d: OUTPUT«True␤»
ugexe so maybe apply the previous anonymous class as an anonymous role during BUILDALL if .^parents contains Distribution? 17:03
nine worth a try I guess 17:04
ugexe i guess thats too late for setting the attributes though
nine Well, we do have the information available as early as in method new 17:05
ugexe yeah, just not sure if using `method` instead of `submethod` is gonna cause other problems 17:08
20:45 ribasushi joined