Perl 6 - the future is here, just unevenly distributed

IRC log for #perl6-toolchain, 2016-07-29

| Channels | #perl6-toolchain index | Today | | Search | Google Search | Plain-Text | summary

All times shown according to UTC.

Time Nick Message
00:57 stmuk_ joined #perl6-toolchain
06:22 domidumont joined #perl6-toolchain
06:22 domidumont joined #perl6-toolchain
07:19 domidumont joined #perl6-toolchain
07:21 domidumont joined #perl6-toolchain
13:58 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 #perl6-toolchain
16:15 FROGGS joined #perl6-toolchain
16:22 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:23 domidumont joined #perl6-toolchain
16:43 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:45 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:46 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␤␤»
16:46 ugexe right
16:50 ugexe normally a role can do that
16:50 ugexe m: role Foo { has $.a; }; class Bar is Foo { }; say Bar.new(:a<1>).a
16:50 camelia rakudo-moar 61725d: OUTPUT«1␤»
16:52 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␤␤»
16:56 nine m: class Foo is Distribution { }; say so Foo.^parents.grep(Distribution);
16:56 camelia rakudo-moar 61725d: OUTPUT«True␤»
17:03 ugexe so maybe apply the previous anonymous class as an anonymous role during BUILDALL if .^parents contains Distribution?
17:04 nine worth a try I guess
17:04 ugexe i guess thats too late for setting the attributes though
17:05 nine Well, we do have the information available as early as in method new
17:08 ugexe yeah, just not sure if using `method` instead of `submethod` is gonna cause other problems
20:45 ribasushi joined #perl6-toolchain

| Channels | #perl6-toolchain index | Today | | Search | Google Search | Plain-Text | summary