»ö« Welcome to Perl 6! | perl6.org/ | evalbot usage: 'p6: say 3;' or /msg camelia p6: ... | irclog: irc.perl6.org or colabti.org/irclogger/irclogger_log/perl6 | UTF-8 is our friend! 🦋
Set by Zoffix on 25 July 2018.
00:12 atweiden-air left 00:16 w_richard_w joined 00:17 p6bannerbot sets mode: +v w_richard_w 00:19 Sound left 00:22 w_richard_w left 00:42 pecastro left 00:52 kerframil joined, p6bannerbot sets mode: +v kerframil 01:14 ryn1x joined, Sgeo joined 01:15 p6bannerbot sets mode: +v Sgeo, p6bannerbot sets mode: +v ryn1x 01:16 Sgeo_ left 01:20 hankache joined 01:21 p6bannerbot sets mode: +v hankache
hankache hello #perl6 01:21
lookatme_q hi hankache 01:22
hankache hi :)
.seen stmuk 01:23
yoleaux I saw stmuk 8 Nov 2018 22:20Z in #perl6: <stmuk> I think the meaning of "refrains" has been overloaded!
01:26 MasterDuke joined, p6bannerbot sets mode: +v MasterDuke, MasterDuke left, MasterDuke joined, herbert.freenode.net sets mode: +v MasterDuke, p6bannerbot sets mode: +v MasterDuke 01:44 beeman left 01:56 silug joined 01:57 p6bannerbot sets mode: +v silug 02:07 MasterDuke left 02:12 ryn1x left
AlexDaniel heh, debian unstable is in a very interesting state right now 02:13
blender segfaults on start, python3-opencv can't even be installed because python is too new or something… 02:14
02:20 ZzZombo joined, p6bannerbot sets mode: +v ZzZombo 02:44 leont left 02:47 kurahaupo joined, p6bannerbot sets mode: +v kurahaupo 02:53 kurahaupo left 02:58 ryn1x joined 02:59 p6bannerbot sets mode: +v ryn1x 03:02 silug left 03:13 silug joined 03:14 p6bannerbot sets mode: +v silug 03:33 ryn1x left 03:47 kurahaupo joined 03:48 p6bannerbot sets mode: +v kurahaupo 03:49 ryn1x joined 03:50 p6bannerbot sets mode: +v ryn1x 03:53 kurahaupo left
AlexDaniel what's the right way to use react/whenever with $*IN ? 04:03
Woodi AlexDaniel: unstable is allowed to have packages without deps. just get blender from testing 04:10
AlexDaniel Woodi: not exactly, no… blender installs fine, but segfaults when you attempt to start it 04:11
IIRC downgrading blender to the version in testing didn't help, it's some dependency that is at fault
there's a “resolved” ticket in debian but I have no idea what it means because it's not resolved
Woodi AlexDaniel: give them few days :) 04:12
AlexDaniel now, if we're talking about python3-opencv, then I cannot get that from testing also
because I already have python 3.7 installed 04:13
so I'd need to downgrade that somehow
(it can't be installed because it depends on python ≤3.6)
04:14 Xliff joined
AlexDaniel I mean, I'm on *unstable*, I understand that, I'm not complaining :) 04:14
04:14 p6bannerbot sets mode: +v Xliff
Xliff \o 04:14
Woodi AlexDaniel: you can 'pin' some version in /etc/apt/preferences
AlexDaniel yes but I already have it installed… 04:15
Xliff Is there a blog write-up on how to do optional tests?
Woodi Xliff: 'optional test' ? 04:16
04:17 sisar joined, p6bannerbot sets mode: +v sisar
Xliff Yes. I'd like to run extra tests if a specific module is present. 04:17
m: say (try require ::('Color')) ~~ Failure 04:21
camelia False
Xliff m: say (try require ::('XXX')) ~~ Failure
camelia False
Xliff m: say (try require ::('XXX')) ~~ Failure)
camelia 5===SORRY!5=== Error while compiling <tmp>
Unexpected closing bracket
at <tmp>:1
------> 3say (try require ::('XXX')) ~~ Failure7⏏5)
Xliff m: require ::('Color')); say ::('Color') ~~ Failure 04:22
camelia 5===SORRY!5=== Error while compiling <tmp>
Unexpected closing bracket
at <tmp>:1
------> 3require ::('Color')7⏏5); say ::('Color') ~~ Failure
Xliff m: require ::('Color'); say ::('Color') ~~ Failure
camelia Could not find Color at line 0 in:
/home/camelia/.perl6
/home/camelia/rakudo-m-inst-2/share/perl6/site
/home/camelia/rakudo-m-inst-2/share/perl6/vendor
/home/camelia/rakudo-m-inst-2/share/perl6
CompUnit::Repository::Absol
Xliff m: tru require ::('Color'); say ::('Color') ~~ Failure
camelia 5===SORRY!5=== Error while compiling <tmp>
Undeclared routines:
require used at line 1
tru used at line 1
Xliff m: try require ::('Color'); say ::('Color') ~~ Failure
camelia True
Woodi .t files are in Perl... but you guessed probably... 04:23
yoleaux Woodi: Sorry, I don't know what timezone that is. If in doubt, see en.wikipedia.org/wiki/List_of_tz_d...time_zones for a list of options.
Woodi m: (try require Foo) === Nil and say "Failed to load Foo!";
camelia Failed to load Foo!
Woodi from : docs.perl6.org/language/modules 04:24
Geth ecosystem: 33f7dc477f | Xliff++ | META.list
Add RandomColor to ecosystem

See github.com/Xliff/p6-RandomColor
04:29
04:34 kurahaupo joined 04:35 p6bannerbot sets mode: +v kurahaupo
holyghost I have a WAV file parser for 16,24 and 32 bits, tomorrow I'll start on the WAV player IIRC 04:36
It needs to be debugged though 04:37
04:38 hankache left
Xliff holyghost++ 04:43
04:46 kerframil left 04:48 kurahaupo left 04:49 kurahaupo joined 04:50 p6bannerbot sets mode: +v kurahaupo, abraxxa joined 04:51 p6bannerbot sets mode: +v abraxxa 04:54 Cabanoss- joined, abraxxa left, p6bannerbot sets mode: +v Cabanoss- 04:55 abraxxa joined, abraxxa left 04:56 abraxxa joined 04:57 p6bannerbot sets mode: +v abraxxa 04:59 kurahaupo left, kurahaupo joined 05:00 p6bannerbot sets mode: +v kurahaupo 05:01 abraxxa left 05:09 kurahaupo left, kurahaupo joined 05:10 p6bannerbot sets mode: +v kurahaupo 05:12 ryn1x left 05:16 abraxxa joined 05:17 p6bannerbot sets mode: +v abraxxa 05:20 kurahaupo left, kurahaupo joined 05:21 p6bannerbot sets mode: +v kurahaupo 05:22 molaf joined, p6bannerbot sets mode: +v molaf 05:31 kurahaupo left 05:36 kurahaupo joined 05:37 p6bannerbot sets mode: +v kurahaupo 05:41 kurahaupo left 05:55 nightfrog joined 05:56 p6bannerbot sets mode: +v nightfrog 06:05 lizmat left 06:08 avar left 06:22 molaf left 06:33 sauvin joined, p6bannerbot sets mode: +v sauvin
Geth perl6-lwp-simple: f5699dcba0 | (JJ Merelo)++ | README.md
Extends README.md

Also closes #12 since it does not seem to be reproducible now.
06:36
perl6-lwp-simple: 8cd50e71e5 | (JJ Merelo)++ | t/get-w3-redirect.t
Eliminates comment

And tests that test page. w3 has been eliminated everywhere, and this page keeps working. There's going to be the same problem with any other page like eu.httpbin.org, which is used elsewhere, so this closes #26
06:36 x08 joined 06:37 x08 left
Geth perl6-lwp-simple: a6e0906f72 | (JJ Merelo)++ | t/socket-sanity.t
Removes unneeded test closes #6
06:38
06:47 w_richard_w joined 06:48 p6bannerbot sets mode: +v w_richard_w, w_richard_w left 06:59 jc__ joined 07:00 p6bannerbot sets mode: +v jc__, kurahaupo joined 07:01 p6bannerbot sets mode: +v kurahaupo
Geth perl6-lwp-simple/master: 4 commits pushed by (JJ Merelo)++ 07:02
07:06 Kaiepi joined, p6bannerbot sets mode: +v Kaiepi 07:07 Bucciarati joined, avar joined, avar left, avar joined, p6bannerbot sets mode: +v avar 07:08 p6bannerbot sets mode: +v Bucciarati, p6bannerbot sets mode: +v avar
Geth perl6-lwp-simple: 566761a157 | (JJ Merelo)++ | t/getstore.t
Revises #13

The code has drifted away, so it's impossible to know what exactly caused the problem. It might have been some combination of testing website and Rakudo changes, but this problem no longer exists, so this closes #6.
Also, now http redirects to https, so eliminates a few tests that actually do the same.
07:10
perl6-lwp-simple: 5a57b49cfa | (JJ Merelo)++ | t/getstore.t
Clarifies tests closes #13
07:11
07:18 klapperl_ left 07:27 abraxxa left 07:28 abraxxa joined 07:29 p6bannerbot sets mode: +v abraxxa 07:33 Sound joined, p6bannerbot sets mode: +v Sound 07:35 klapperl joined 07:36 p6bannerbot sets mode: +v klapperl 07:49 robertle joined 07:50 domidumont joined, p6bannerbot sets mode: +v robertle 07:51 p6bannerbot sets mode: +v domidumont 07:58 domidumont1 joined, abraxxa left 07:59 p6bannerbot sets mode: +v domidumont1, abraxxa joined 08:00 p6bannerbot sets mode: +v abraxxa 08:01 domidumont left 08:08 jeek joined 08:09 p6bannerbot sets mode: +v jeek 08:15 sisar left 08:17 abraxxa left 08:18 robertle left 08:19 abraxxa joined, robertle joined 08:20 p6bannerbot sets mode: +v abraxxa, p6bannerbot sets mode: +v robertle 08:23 abraxxa left 08:25 abraxxa joined 08:26 p6bannerbot sets mode: +v abraxxa 08:30 abraxxa left, Sound left 08:31 abraxxa joined 08:32 p6bannerbot sets mode: +v abraxxa 08:34 kensanata joined, p6bannerbot sets mode: +v kensanata 08:36 abraxxa left 08:41 |oLa| joined
Geth doc: albertferrico++ created pull request #2478:
Fix for issue #2476
08:41
08:41 p6bannerbot sets mode: +v |oLa| 08:51 abraxxa joined 08:52 p6bannerbot sets mode: +v abraxxa, |oLa| left 08:53 Sound joined, p6bannerbot sets mode: +v Sound 08:54 daxim joined 08:55 p6bannerbot sets mode: +v daxim
andrzejku .seen araraloren 08:57
yoleaux I saw araraloren 21 Nov 2018 13:25Z in #perl6: <araraloren> not araraloren; just clearing the bot
lookatme_q :)
andrzejku, what's up ?
andrzejku oh shit you are here :D
I thought I miss you
that's fine
lookatme_q haha
I am off work soon 08:58
andrzejku I just was looking for you, haven't see you for the long long time
lookatme_q oh, I was a little busy
andrzejku well me too :D
lookatme_q Ley 08:59
Let's talk when I am home :)
andrzejku Ok :)
keep working
lookatme_q About 1 hours later
andrzejku I will 2 hours later 09:00
for 1 hour I am going for lunch
lookatme_q okay 09:01
09:02 domidumont1 left 09:04 domidumont joined, p6bannerbot sets mode: +v domidumont 09:10 coet[work] joined, p6bannerbot sets mode: +v coet[work], ferreira joined 09:11 p6bannerbot sets mode: +v ferreira, zakharyas joined 09:12 p6bannerbot sets mode: +v zakharyas 09:17 sftp left 09:18 sftp joined, p6bannerbot sets mode: +v sftp
mornfall hm... regex syntax has changed from p5? :\ i guess there's no equivalent of man perlre either? 09:22
(how do i do a lookahead?)
jnthn <?before foo> 09:24
09:24 dakkar joined
masak m: say so "lookahead" ~~ / "look" <?before "ahead"> /; say so "look, a three-headed monkey!" ~~ / "look" <?before "ahead"> / 09:24
camelia True
False
09:25 p6bannerbot sets mode: +v dakkar
mornfall yeah, took me a while to figure out it's literally '?before' 09:25
09:26 samcv joined, p6bannerbot sets mode: +v samcv
Altreus I have code along the lines of $some-supply.emit(some-function()) and I *think* some-function is dying, but the error is being swallowed 09:26
I'm not quite sure how to figure out what's happening
I do seem to keep accidentally losing errors when dealing with async
but normally it's because I don't resolve a promise properly
mornfall is there a way to get offline docs for p6 (man pages), like it was with p5? i really don't like going to the browser for basic stuff :(
jnthn Altreus: Are you using supply/react/whenever? Becuase "don't lose errors" is one of the many things they help with :) 09:27
09:27 coet[work] left
Altreus I am using react and whenever, but I create a supply object rather than using supply 09:27
sec
github.com/shuppet/p6-api-discord/...d.pm6#L173 09:28
I'm pretty sure I broke inflate-message (specifically, Message::from-json), based on print-debugging
but it just sort of does nothing
mornfall okay this is going to take a while... how is m,stuff, not a regex :( 09:29
Altreus not in this commit, I might add - in my working dir
yes I definitely broke it because when I got the syntax right it worked 09:30
jnthn m: say 'blah stuff blah' ~~ m,stuff, 09:31
camelia 「stuff」
jnthn Looks like one to me. But note that m is *immediate* evaluation of the regex against $_
09:31 rindolf joined
mornfall jnthn: i tried passing m,..., to split and it told me 'Use of uninitialized value of type Any in string context.' (nothing much else) 09:32
09:32 p6bannerbot sets mode: +v rindolf
Altreus > immediate 09:32
methinks you passed the result of m
mornfall Altreus: oh, so ~~ changes $_ locally? 09:33
(before the immediate bit hits, anyway)
jnthn Yes
mornfall anyway, rx,..., does what i want 09:34
jnthn YOu'd just pass /stuff/ to `split`
Or rx if you want adverbs :)
Or a non-/ separator
uh, quoter
09:34 robertle left
mornfall jnthn: i hate / as quotes because it makes matching paths really awkward :p 09:35
09:36 ferreira left, Ven`` joined, robertle joined, p6bannerbot sets mode: +v Ven``
jnthn Ah, yes, if matching paths it does indeed 09:37
Altreus hmm OK I've got an understanding gap
09:37 p6bannerbot sets mode: +v robertle
jnthn Though at least in Perl 6 regex you can quote them like '/' which looks a bit nicer the the backslash :) 09:37
Altreus [].map(anything) returns ()
And then I pass that into a constructor where the object expects an array and I get [()] 09:38
09:39 robertle left
Altreus github.com/shuppet/p6-api-discord/...e.pm6#L176 09:39
09:40 kurahaupo left, Ven`` left, kurahaupo joined 09:41 p6bannerbot sets mode: +v kurahaupo 09:43 Ven`` joined, p6bannerbot sets mode: +v Ven``
Altreus Right, I get a Seq even if the JSON had stuff in it 09:45
so say the docs 09:46
What's the right way of making this another array?
09:47 Ven`` left, Bucciarati left, avar left 09:50 Mithaldu joined, robertle joined 09:51 p6bannerbot sets mode: +v Mithaldu, ChoHag joined, p6bannerbot sets mode: +v robertle 09:52 p6bannerbot sets mode: +v ChoHag 09:56 Ven`` joined 09:57 p6bannerbot sets mode: +v Ven`` 10:05 Bucciarati joined, avar joined, avar left, avar joined, p6bannerbot sets mode: +v avar, p6bannerbot sets mode: +v Bucciarati, p6bannerbot sets mode: +v avar
moritz add a .Array after the .map call 10:09
it's the map returns a Seq
m: say ([].map({}).^name
camelia 5===SORRY!5=== Error while compiling <tmp>
Unable to parse expression in parenthesized expression; couldn't find final ')' (corresponding starter was at line 1)
at <tmp>:1
------> 3say ([].map({}).^name7⏏5<EOL>
expecting any of:…
moritz m: say ([].map({})).^name
camelia Cannot map a Array to a Hash.
Did you mean to add a stub ({...}) or did you mean to .classify?
in block <unit> at <tmp> line 1
moritz m: say ([].map({;})).^name
camelia Seq
10:12 holyghost joined, Ven`` left 10:13 p6bannerbot sets mode: +v holyghost
moritz m: say ([].map({;}).Array).^name 10:13
camelia Array
10:13 tobs` joined 10:14 p6bannerbot sets mode: +v tobs`, ferreira joined 10:15 p6bannerbot sets mode: +v ferreira
mornfall okay stupid question... how do i get length of an array? tried scalar, length, size, len in various combinations without success :( 10:15
or rather, length of a Seq
also can anyone point me to some form of downloadable/offline docs? because my internet connection often isn't the best and looking stuff up is really painful on docs.perl6.org 10:16
Altreus lemme try 10:17
mornfall 5to6 just says that 'scalar' is "very" gone
10:17 rindolf left
Altreus now I have an array with an array in it :s 10:18
10:18 someuser left
Altreus not quite sure why 10:19
jnthn notable6: .elems 10:20
notable6 jnthn, I cannot recognize this command. See wiki for some examples: github.com/perl6/whateverable/wiki/Notable
jnthn oops
mornfall: .elems
I think one can install p6doc
Altreus so when I do this, if %constructor<mentions> contains an array, that array becomes the first element of @.mentions, instead of becoming @.mentions github.com/shuppet/p6-api-discord/...e.pm6#L182 10:21
not sure I understand why
m: class A { @.arr } my $a = A.new(arr => [ 'array' ]); say $a.arr; 10:23
camelia 5===SORRY!5=== Error while compiling <tmp>
Variable @.arr used where no 'self' is available
at <tmp>:1
------> 3class A { @.arr7⏏5 } my $a = A.new(arr => [ 'array' ]); sa
expecting any of:
term
Altreus oops
m: class A { has @.arr } my $a = A.new(arr => [ 'array' ]); say $a.arr;
camelia 5===SORRY!5=== Error while compiling <tmp>
Strange text after block (missing semicolon or comma?)
at <tmp>:1
------> 3class A { has @.arr }7⏏5 my $a = A.new(arr => [ 'array' ]); say
expecting any of:
infix
in…
Altreus m: class A { has @.arr }; my $a = A.new(arr => [ 'array' ]); say $a.arr;
camelia [array]
Altreus m: class A { has @.arr }; my %c = arr => ['adfsdfasdf']; my $a = A.new(|%c); say $a.arr;
camelia [[adfsdfasdf]]
Altreus excuse me 10:24
this was not expected
10:25 rindolf joined 10:26 p6bannerbot sets mode: +v rindolf 10:28 Ven`` joined 10:29 p6bannerbot sets mode: +v Ven``, scimon joined 10:30 p6bannerbot sets mode: +v scimon
scimon Two things. Has anyone used the Redis module recently who can help out on Stackoverflow? stackoverflow.com/questions/534953...for-output I'm stuck and don't have time to get Redis up and running to test it. 10:35
And I think I might have a topic for at least 1 advent calendar entry. rotor just looks fun... :) 10:36
10:38 ferreira left
Altreus hey we're also failing to use the redis module :D 10:46
I'll share
mornfall jnthn: thanks 10:48
10:48 ChoHag_ joined, p6bannerbot sets mode: +v ChoHag_
scimon I took a look a noticed it's a wee bit stale. Might just be it needs a going over. 10:49
10:49 ChoHag left
Geth doc: 1cbbed17fb | Alberto++ (committed by Lucas Buchala) | htmlify.p6
Update htmlfy.p6 (#2478)

Making changes suggested in the following issue:
  github.com/perl6/doc/issues/2476
10:49
Altreus scimon: apparently we can't run it because we don't have a liberedis.so 10:51
But I can't figure out what that is
mornfall what's the opposite of slurp? 10:52
El_Che spurt 10:53
mornfall oh, spurt perhaps 10:54
\o/
jnthn Altreus: There's also a Redis::Async module, and the stuff by its author tends to work nicely, so might also be worth trying instead
10:55 Ven`` left
Altreus ah! 10:57
righto
oh wait
that is what we're using!
jnthn: since you're nearby could you cast an eye over my evals in scrollback? 10:58
10:58 leont joined
Altreus not sure if it's me or perl doing it wrong 10:58
10:59 p6bannerbot sets mode: +v leont
scimon jnthn: I'll mention Redis::Async on the SO page. 10:59
jnthn Altreus: It's you. The values of a hash are scalar containers (that is, items) 11:01
Altreus: Bind instead of assign, or just do |%a.Map when calling .new 11:02
Altreus righto! I still have to fully grok this container concept :) 11:04
11:22 lizmat joined, p6bannerbot sets mode: +v lizmat
Altreus worked perfectly :o 11:24
My "first" impressions of Perl6 are that once you know what's happening it's pretty sweet, but there are *way* more traps and pitfalls caused by internal functional decisions that make it to the surface 11:25
Than perl5
this container-vs-value thing tends to bite me, as does the where-did-my-error-go async problem
lizmat Altreus: care to elaborate on the container-vs-value thing that's biting you ? 11:27
Altreus there's an example above courtesy of the bot
A.new(x => [...]) vs A.new(|%hash) 11:28
You have to do |%hash.Map to get the equivalent
I can manage the 5-to-6 transition of %hash to |%hash, but in fact there are two levels of knowledge required to get this right 11:29
So although I *can* just forget containers exist, I can't do semi-advanced things without them showing up
lizmat Feels to me you're more getting bitten by flattening behaviour... but yeah: that's one of the things you have to get used to when coming from Perl 5 where everything is always flattened 11:34
m: { our sub foo() { "bar" } }; say foo; 11:49
camelia 5===SORRY!5=== Error while compiling <tmp>
Undeclared routine:
foo used at line 1
lizmat moritz masak jnthn TimToady_ ^^^ is it intentional that this doesn't work or not ?
m: { our $foo = 42 }; say $foo # similarly 11:52
camelia 5===SORRY!5=== Error while compiling <tmp>
Variable '$foo' is not declared
at <tmp>:1
------> 3{ our $foo = 42 }; say 7⏏5$foo # similarly
11:55 kurahaupo left
Geth doc: c743f2614f | (JJ Merelo)++ | META6.json
Eliminates LWP::Simple and IO::Socket::SSL which are not used here. Closes #2472
12:07
lucasb In '{ our $foo = 42 }', isn't "our $foo" a lexical declaration of a package variable? (In P5 terms :) 12:10
if it's lexical, I expect it not to be available outside its scope, the block 12:11
Altreus hmm
m: class A { has @.arr }; my $array = ['sfasdadf']; my $a = A.new(arr => $array); say $a.arr 12:12
camelia [[sfasdadf]]
Altreus ^ this is what I was getting bitten by
12:12 ChoHag_ left
Altreus m: class A { has @.arr }; my @array = 'sfasdadf'; my $a = A.new(arr => @array); say $a.arr 12:12
camelia [sfasdadf]
Altreus it's not so much flattening behaviour as what was being stored in the first place
🤔 what about ...
m: class A { has @.arr }; my @array = 'sfasdadf'; my %c = arr => @array; my $a = A.new(|%c); say $a.arr 12:13
camelia [[sfasdadf]]
Altreus hum
12:14 ZzZombo left
lizmat lucasb: the docs on "our" are not very clear on that 12:15
lucasb I just assumed the behavior was similar to P5
lizmat in any case, it is unexpected behaviour to me
lucasb I was just thinking about the scalar variable "{ our $foo }" 12:16
lizmat but it is not ?
lucasb but the our sub, indeed, is a interesting question :-)
lizmat { our $a = 42 }; say $a # 42 in Perl 5
lucasb change $a to something else? :-)
{ our $A = 42 }; say $A 12:17
Variable "$A" is not imported at - line 5.
moritz lizmat: re our foo, I think that's intentional, yes
lizmat argh
12:18 ChoHag joined
lizmat { our $foo = 42 }; say $foo # gives 42 for me with Perl 5 lucasb 12:18
12:18 p6bannerbot sets mode: +v ChoHag
lucasb ah, under use strict 12:19
it gives an error :-)
lizmat { use strict; our $foo = 42 }; say $foo # Global symbol "$foo" requires explicit package name
yeah, funny
so at compile time it can't find it, and at runtime it could 12:20
moritz: what's the rationale ?
12:22 Ven`` joined, p6bannerbot sets mode: +v Ven``
andrzejku lookatme_q ping 12:23
.ping
yoleaux There is no ping command; nor can this be construed as a response.
andrzejku .ping lookatme_q
yoleaux There is no ping command; nor can this be construed as a response.
12:26 kurahaupo joined 12:27 p6bannerbot sets mode: +v kurahaupo 12:36 sena_kun joined 12:37 p6bannerbot sets mode: +v sena_kun 12:42 zakharyas left
moritz lizmat: our installs into the lexical and into the package scope simultaneously 12:44
lizmat: so that non-qualified accesses like $foo and &foo only have to look into the lexical scope
lizmat: and since lexical scopes are immutable at runtime, this allows use to catch missing symbols at compiel time 12:45
lizmat ah, ok, yeah, makes sense # moritz++
sena_kun
jnthn lizmat: Yes, intentional. Lookup of subs, unless they are explicitly qualified of course, is always lexical. 12:52
ah, I see moritz++ answered too, with more detail :)
jnthn was still in backlog :)
Altreus is there a shorter way of saying await x, that looks more chainable? 13:01
(await (await x).y).z is ... um
lizmat Altreus: maybe Object::Delayed's "catchup" is something for you :-) 13:02
jnthn x.&await.y.&await.z
Altreus ketchup? Is that like sugar?
lizmat modules.perl6.org/dist/Object::Delayed
jnthn But also consider putting a method on `x` that does those 13:03
OO designs that involve digging deep into things are a refactoring nuisance
lizmat "The catchup subroutine allows you to transparently run code asynchronously that creates a result value. If the value is used in any and the asychronous code has not finished yet, then it will wait until it is ready so that it can return the result."
Altreus I can use apostrophes can't I
So I could have x and x'
lizmat spots a typo in the pod 13:04
13:04 Ven`` left
Altreus oh slack for lazy properties is nice 13:04
that's got to be the third or fourth alternative to that I've seen
lizmat Altreus: in Perl 6 ? If so, which one? 13:06
Altreus it's been a while since I looked but um 13:07
I have commented out 'will lazy ...' on one of my properties
And that wasn't the first one I came across to do that 13:08
but I forgot what I found when I looked
lizmat fwiw, "has $.foo = slack { ... }" works as intended
and hopefully expected :-) 13:09
Altreus The reason I forgot is I'm not in a position to bother with lazy stuff yet :) 13:13
13:13 Ven`` joined
Altreus But this seems like a version that Just Works so I'll try it when I do 13:14
ah looks like I can't end a method name with an apostrophe
13:14 p6bannerbot sets mode: +v Ven``
Altreus shame, I thought I could use it as prime 13:14
although... 13:17
nah, I can't come up with a convention I'm happy with, except to just add more words 13:19
I really want to use punctuation :P
oh
I can!
I made it $message.channel(:now) 13:24
I couldn't see a way of doing anything like $message.channel! or $message.channel` 13:27
lizmat there's a slang that allows ! at the end of identifiers 13:28
modules.perl6.org/dist/Slang::Pier...hub:FROGGS
afk for a few hours& 13:29
13:31 kurahaupo left, kurahaupo joined 13:32 p6bannerbot sets mode: +v kurahaupo 13:57 Xliff left 14:02 clarkema joined 14:03 p6bannerbot sets mode: +v clarkema
Altreus that's amazing and I love it 14:04
not convinced it covers my use case so I'd have to test 14:05
I just realised why I prefer that 14:07
It's because the methods no longer return Promise
they return It Depends
14:08 Ven`` left
Altreus :O it works 14:12
When I tried before it got confused by « !. » in « self.channel!.etc() » but it doesn't now
14:12 ChoHag left
Altreus Slang::Piersing breaks boolean adverbs 14:15
method pinned-messages($force?) → Variable '$force' is not declared. Did you mean '$force?'? 14:16
I suppose I don't *need* that ?
14:16 Ven`` joined
timotimo oh whoops 14:16
well, you can always make parameters optional by supplying a default value instead
Altreus I just realised that was supposed to be :$force anyway 14:17
14:17 p6bannerbot sets mode: +v Ven``, xinming joined, ChoHag joined 14:18 p6bannerbot sets mode: +v xinming, p6bannerbot sets mode: +v ChoHag 14:19 Xliff joined, p6bannerbot sets mode: +v Xliff 14:20 xinming_ left
Altreus Secondarily, you have to use it in consuming code too 14:20
Makes sense but I was hoping it would bleed over
timotimo not absolutely necessary 14:21
you can call the method with quotes 14:22
$foobar.'hello!'()
14:25 someuser joined 14:26 p6bannerbot sets mode: +v someuser 14:52 ferreira joined 14:53 p6bannerbot sets mode: +v ferreira
Geth doc: 0852a84ab4 | Coke++ | xt/braces.t
angle brackets is also a thing
15:01
doc: d201389198 | Coke++ | 3 files
prefer non-hyphenated
doc: 5f93731c5b | Coke++ | xt/braces.t
Find some bracket variants
15:02 ferreira left
Altreus seems worse :P 15:02
15:05 ChoHag_ joined 15:06 p6bannerbot sets mode: +v ChoHag_ 15:07 ferreira joined, p6bannerbot sets mode: +v ferreira 15:08 ChoHag left 15:09 Ven`` left 15:11 beeman joined, p6bannerbot sets mode: +v beeman 15:14 graphene left 15:15 graphene joined, lizmat left 15:16 p6bannerbot sets mode: +v graphene 15:18 Ven`` joined 15:19 ufobat joined, p6bannerbot sets mode: +v Ven``, p6bannerbot sets mode: +v ufobat
ufobat p6: say 1 15:20
camelia 1
ufobat p6: my %h = gather { take "foo" => 1; take "bar" => 2}; say %h
camelia {bar => 2, foo => 1}
ufobat this is intentional, right?
because docs.perl6.org/syntax/gather%20take just talked about arrays
moritz it's the %h = that turns it into a hash 15:21
the return value from gather/take is still a Seq
ufobat ah okay
i am still unhappy with the documentation because i almost discarded my idea of using gather/take for a hash 15:22
15:28 coet[work] joined, p6bannerbot sets mode: +v coet[work]
Kaiepi m: my %foo is Map = {a => 1}; say %foo 15:30
camelia Map.new((a => 1))
Kaiepi i had no idea is could be used like that
15:35 alpha joined 15:36 Ven`` left, p6bannerbot sets mode: +v alpha, Ven`` joined 15:37 p6bannerbot sets mode: +v Ven`` 15:39 zakharyas joined 15:40 p6bannerbot sets mode: +v zakharyas 15:43 ferreira left 15:48 kurahaupo left 15:50 Ven`` left 15:52 titsuki joined, p6bannerbot sets mode: +v titsuki
Geth doc/master: 5 commits pushed by Coke++ 15:57
16:03 b2gills joined 16:04 p6bannerbot sets mode: +v b2gills 16:06 b2gills left 16:09 kurahaupo joined 16:10 p6bannerbot sets mode: +v kurahaupo 16:14 jc__ left 16:18 xinming_ joined 16:19 b2gills joined, p6bannerbot sets mode: +v xinming_ 16:20 p6bannerbot sets mode: +v b2gills 16:21 xinming left, jmerelo joined 16:22 ChoHag_ left, p6bannerbot sets mode: +v jmerelo 16:23 robertle left
jmerelo squashable6: status 16:24
squashable6 jmerelo, ⚠🍕 Next SQUASHathon in 3 days and ≈17 hours (2018-12-03 UTC-12⌁UTC+14). See github.com/rakudo/rakudo/wiki/Mont...Squash-Day
jmerelo Almost there!
TreyHarris I'm confused... if I open a handle like `my $h = $f.open;` in a routine, if I include the line `LEAVE try $h.close;` anywhere after that point, then attempts to read the file fail with `Cannot do 'get' on a handle in binary mode`, but if I leave the LEAVE out, everything works fine (except the file doesn't get closed). 16:32
moritz TreyHarris: are you trying to read in the same scope as the LEAVE statement? 16:33
TreyHarris moritz: Yes 16:34
jnthn And you're completing the read in that scope (e.g. not returning .lines, which is lazy)?
TreyHarris it's `return $h.lines; LEAVE try $h.close;`
moritz TreyHarris: ah, that explains a lot
TreyHarris: $h.lines is lazy 16:35
so, you return a lazy list, currently empty
then you close the file handle
and then the caller tries to consume the lazy list, and finds the file handle broken
s/broken/closed/
TreyHarris moritz: but why binary? If I got an file closed exception, I would have immediately known this was this issue
moritz TreyHarris: that does look weird 16:36
there are two possible solutions
one is to return an eager list
the other is to explictly close after it has been consume, for example
sub my-lines($filename) { my $f = open $filename; return gather { take $_ for $f.lines(); $f.close } } 16:37
Xliff TreyHarris: "return $h.lines.Array; LEAVE try $h.close;"
But it's better to listen to moritz. He knows more. ;) 16:38
moritz TreyHarris: IMHO the misleading error message warrants a bug report though
Xliff: not at all. What you wrote was my option one, return an eager list
TreyHarris to do that, though (explicitly close after consume), I must assign to a global or return the handle, right? Or in the above gather { } case, it will only close if I read the last line, correct? If I never read the last line, even if the return goes out of scope, the close won't happen? 16:39
16:40 domidumont left
TreyHarris hm, the docs mention a "will leave trait", but rakudo says "leave not implemented yet, sorry" 16:40
moritz well, if the caller discards the reference to the lazy list, and the GC eventually gets the file handle, it closes it
TreyHarris (Not sure that would be any different than the LEAVE try $h.close though)
16:40 sena_kun left
TreyHarris Xliff: I know how to make it eager, but I was under the misimpression that if you returned a lazy, LEAVE didn't phase in until the lazy was exhausted 16:41
Xliff Ah! 16:42
moritz TreyHarris: would not be different, no
TreyHarris hm, Trait::IO has a 'does auto-close' trait that... is all in NQP land, so I guess I need to try it to see what its behavior is
Looks to me it would be identical to the gather one though, if I'm reading these nested levels right? github.com/zoffixznet/perl6-Trait-...ait/IO.pm6 16:43
16:44 sena_kun joined 16:45 p6bannerbot sets mode: +v sena_kun
TreyHarris Is this exception a rakudo bug or a perl6 bug? 16:46
ufobat I've got a yml configuration file which i read with YAMLish, but I am wondering if there is a module that helps me to ensure that all required configuration parameres are actually provided
ther is no such thing as "ypath", similar to xpath for xml? 16:48
jnthn ufobat: No, but you can use JSON::Schema if the YAML deserializes into just hashes and arrays 16:49
ufobat: We're doing that on a $dayjob project for validating YAMLs
TreyHarris: the bad close error would be a Rakudo bug 16:50
ufobat ah thank you jnthn 16:51
TreyHarris jnthn: Okay, thanks. On another note, is it a bug that rakudo-star latest says "v6.c"? I thought I saw an announcement that it was v6.d
moritz the Star that defaults to v6.d hasn't been released yet, I believe 16:52
jnthn TreyHarris: No, the 6.d language spec has been released, but a compiler supporting it not yet (though probably will be today, but then a Rakudo Star supporting it will be a bit longer)
moritz we're still looking for a release manager for that
TreyHarris jnthn: ah-hah, yes... looks like the release notes I saw it in was a PDF for some reason, and my email doesn't search inside PDF's. 16:53
jnthn moritz: I think a couple of folks volunteered :) 16:54
clarkema Speaking of which, I was one of them 16:57
What's the process?
TreyHarris Hmm, is the final example in docs.perl6.org/routine/dir that is introduced with, "A lazy way to..." actually supposed to be lazy? It doesn't appear to be in rakudo-star 2018.10 at least. 16:58
(Or maybe "a lazy way" was meant metaphorically, in which case the word should probably be changed?)
sena_kun jmerelo, ping? 16:59
17:01 robertle joined, p6bannerbot sets mode: +v robertle
jmerelo sena_kun: pong? 17:03
sena_kun jmerelo, \o/
jmerelo sena_kun: hi :-)
moritz clarkema: on github.com/rakudo/star/issues/124 stmuk posted a link to the release guide
clarkema: I've also sent you some invitations to github organisations which you should accept, and commented something about SSH public keys 17:04
clarkema moritz: got it -- I'll start having a play around with the process to get famililar with it and get an environment set up
sena_kun jmerelo, I have two questions, first is about Advent, second one about academia with Perl 6, I think I can, probably, make you a bit happier and ask for some advices, though I wonder if I can PM you now || if it will be comfortable.
b2gills TreyHarris: use `return $h.lines( :close )` rather than `LEAVE $h.close; return $h.lines()`
moritz clarkema: if you need shell access to a Linux box for the generic .tar.gz, I can also help you
sena_kun: if they are general question about p6 Advent, I can also try to answer 17:05
clarkema moritz: thanks -- I should be ok unless I it's something that requires a particular environment or keys etc
I've got a pretty hefty linux workstation here
moritz clarkema: no, just a bog-standard Debian box :)
sena_kun moritz, well, I think I need to create an account at wordpress to get an ID out of it, then post it. 17:06
>all my usual nicknames are already taken, no posts at those accounts 17:07
heh
moritz sena_kun: /msg me your email address (or wordpress.com account name), and I'll send you an invitation
ufobat jnthn, with JSON::Schema i can write my json-schema in yaml, right? thats funny. like JSON::Schema.new(schema => load-yml($yaml-string))
sena_kun moritz, ok, thanks!
jnthn ufobat: Heh, yeah, I guess you can :) 17:09
jmerelo sena_kun: please do that 17:10
moritz ufobat: we use that at $work
mostly because YAML can be much more concise, and adding comments is so much easier
ufobat exactly! 17:11
jnthn There's also a JSON::Path module
moritz sena_kun: oh, maybe by email is easier (moritz.lenz@gmail.com), privmsg get lost on freenode due to anti-spam measures
jmerelo Just a reminder that there are still a few slots open: github.com/perl6/advent/blob/maste...8/schedule 17:12
(and that the page has moved to a new repo) 17:13
(I'll keep track of both anyway)
(Oh, the previous one has disappeared...)
17:13 abraxxa left 17:14 alpha left
sena_kun moritz, sent one. 17:16
ufobat p6: with $*DOESNOTEXIST { .say }
camelia ( no output )
ufobat p6: with $DOESNOTEXIST { .say }
camelia 5===SORRY!5=== Error while compiling <tmp>
Variable '$DOESNOTEXIST' is not declared
at <tmp>:1
------> 3with 7⏏5$DOESNOTEXIST { .say }
ufobat p6: say $*DOESNOTEXIST
camelia Dynamic variable $*DOESNOTEXIST not found
in block <unit> at <tmp> line 1
ufobat is the first one a bug? 17:17
moritz sena_kun: invitation sent
17:24 Sound left
jnthn ufobat: I don't see any bug; $*DOESNOTEXIST evaluates to a Failure, which is not .defined 17:29
ufobat ah a failure
17:30 Sound joined, p6bannerbot sets mode: +v Sound
ufobat because accidently used the wrong sigil like $*ENV, and with 'with' it's harder to spot my mistake 17:30
17:30 Kaiepi left, scimon left 17:31 Kaiepi joined, p6bannerbot sets mode: +v Kaiepi 17:34 tobs` left
sena_kun moritz, an invitation letter was in spam for some reason, but accepted the invitation! Thanks. 17:43
17:44 kensanata left
moritz ufobat: you might want to 'use fatal;' 17:44
ufobat moritz, oh cool. thank you 17:46
17:48 graphene left 17:49 graphene joined 17:50 p6bannerbot sets mode: +v graphene 17:52 Sound left
tyil I'm trying to use Proc::Async, and the big example block of code at the top says I should be able to use .exitcode, but that method doesnt appear in the list of methods in the docs 17:52
it also doesnt seem to appear in Proc::Async.^methods
timotimo i think it is in the Proc object that you get returned at the end? 17:53
tyil also, can I place a tap on the stdout and get it per-line
timotimo the stdout supply spits out characters (or bytes) but you can just use .lines on the supply to get a supply that emits lines individually
moritz timotimo++ 17:54
tyil ah, there's a Proc returned by the promise from .start
I can work with that
and $async-proc.out.lines.tap?
stdout*
timotimo yeah, but i'd always recommend trying to work with react or supply blocks 17:55
jnthn `whenever $async-proc.start { if .exitcode > 0 { note "oh noes" } } 17:57
tyil thanks, I should be able to continue again
:>
timotimo thumbs up
18:00 jmerelo left 18:04 dakkar left
loops Why does p6 think this is an error: sub x() {}; with x { } and require it to be written as: sub x() {}; with x() { } 18:08
shouldn't the sub x() ... definition with empty parameter list indicate that no block is expected as a parameter?
18:09 ChoHag joined 18:10 p6bannerbot sets mode: +v ChoHag
jnthn loops: No, the signature of the sub has no impact on how its arguments are parsed. 18:10
loops jnthn: interesting, thanks. 18:11
18:14 kurahaupo left, kurahaupo_ joined 18:15 p6bannerbot sets mode: +v kurahaupo_ 18:18 coet[work] left 18:27 rfold joined 18:28 p6bannerbot sets mode: +v rfold
timotimo (since subs can be post-declared) 18:31
(alternatively: in order for subs to be post-declarable)
18:43 haukex joined 18:44 p6bannerbot sets mode: +v haukex
mornfall what is the preferred way to run programs? 18:44
El_Che mornfall: can you give some context? 18:45
mornfall well, one thing would be running a program and capturing its output... possibly set a timeout; along the lines of p5 IPC::Run 18:46
cono Proc::Async
El_Che ok, from within your program
yes, Proc::Async because of the timeout. For simpler cases there is 'run' and 'shell' 18:48
18:48 lizmat joined, p6bannerbot sets mode: +v lizmat, haukex left 18:50 Kaypie joined, Kaiepi left
mornfall i'll look, thanks (gotta get off train, bbiab) 18:50
El_Che see you!
18:50 p6bannerbot sets mode: +v Kaypie 18:52 kurahaupo_ left, kurahaupo joined 18:53 p6bannerbot sets mode: +v kurahaupo 18:55 graphene left 18:56 graphene joined 18:57 p6bannerbot sets mode: +v graphene
mornfall so... http client and a json parser? O:-) i guess i'll have to go to CPAN for those 19:04
19:04 ufobat left
tobs eco: WWW 19:06
buggable tobs, WWW 'No-nonsense, simple HTTPS client with JSON decoder': github.com/zoffixznet/perl6-WWW 5 other matching results: modules.perl6.org/s/WWW
tobs mornfall: all-in-one
mornfall can i somehow fetch docs with zef? 19:09
(or build) 19:10
mornfall tries zef install p6doc 19:11
but man, zef is super slow :( 19:12
19 seconds to 'zef info p6doc' 19:13
can i ask zef to install p6doc into ~/.perl6? died with Failed to create directory '/usr/local/share/perl6/site/doc' (i installed other things and those worked?) 19:16
moritz you can ask it lots of things... :D 19:20
19:21 pecastro joined, xinming_ left, p6bannerbot sets mode: +v pecastro 19:22 xinming joined 19:23 kurahaupo left, kurahaupo joined, p6bannerbot sets mode: +v xinming, p6bannerbot sets mode: +v kurahaupo 19:24 sauvin left
mornfall moritz: any hint on why? googling didn't bring up anything :( 19:26
or rather, how
maybe i need newer rakudo
moritz don't know 19:27
mornfall well, it did something if i zef install --force p6doc... i have a binary now, but p6doc -l gives me a backtrace :\ 19:29
let's try fetching rakudo star instead, something is obviously wrong with this late-2017 rakudo from ports 19:35
lizmat mornfall: yeah, you want a more recent rakudo for sure! 19:39
mornfall well, i vaguely remember startup time getting a lot better, and there's a noticeable delay now between running a script and something actually happening... that's a little annoying :p 19:40
btw. is pugs still a thing?
19:42 zakharyas left
sena_kun no 19:43
mornfall p6doc \o/ it's doing stuff 20:00
20:03 Ven`` joined, p6bannerbot sets mode: +v Ven``
mornfall but neither JSON::Path nor WWW have any documentation? :\ 20:07
moritz there's documentation in the README: github.com/jnthn/json-path#readme 20:08
mornfall so zef look?
20:12 Ven`` left
lizmat
.oO( that's what I like about App::Mi6: it creates a README from the pod )
20:15
20:20 beeman left 20:41 zakharyas joined, p6bannerbot sets mode: +v zakharyas 20:49 beeman joined, p6bannerbot sets mode: +v beeman 20:52 loops left 20:57 molaf joined 20:58 p6bannerbot sets mode: +v molaf, lichtkind joined, ryn1x joined 20:59 p6bannerbot sets mode: +v lichtkind, p6bannerbot sets mode: +v ryn1x 21:04 Ven`` joined 21:05 p6bannerbot sets mode: +v Ven`` 21:08 Ven`` left 21:10 ryn1x left 21:18 ChoHag left, kurahaupo_ joined 21:19 kurahaupo left, p6bannerbot sets mode: +v kurahaupo_ 21:27 robertle left, graphene left 21:28 graphene joined 21:29 p6bannerbot sets mode: +v graphene 21:38 graphene left 21:39 graphene joined 21:40 p6bannerbot sets mode: +v graphene
[Coke] m: #` 21:46
camelia ( no output )
21:47 Kaypie left, Kaypie joined 21:48 p6bannerbot sets mode: +v Kaypie 21:49 Merfont joined, Kaypie left 21:50 p6bannerbot sets mode: +v Merfont 21:54 kurahaupo_ left 21:57 zakharyas left
SmokeMachine is there already defined any default to create modules that will run on browser and interact with js? 22:10
I am thinking of writing one... I am testing on 6pad... 22:11
Im trying to write a "inline dom"...
here is my poc: perl6.github.io/6pad/#3d9c7dd4834c...9011ab6420
22:13 Cabanoss- left, Cabanossi joined 22:14 p6bannerbot sets mode: +v Cabanossi 22:16 loops joined 22:17 p6bannerbot sets mode: +v loops 22:18 skav joined, p6bannerbot sets mode: +v skav 22:22 vrurg joined 22:23 p6bannerbot sets mode: +v vrurg 22:26 skav left 22:27 skav joined, p6bannerbot sets mode: +v skav, rindolf left 22:28 lichtkind left 22:31 skav left
Geth advent: 0b42e35fb0 | (Tom Browder)++ (committed using GitHub Web editor) | perl6advent-2018/schedule
update title
22:44
22:48 rfold left
AlexDaniel huggable: advent 22:51
huggable AlexDaniel, Sign up to write an Advent blog post: github.com/perl6/mu/blob/master/mi...8/schedule
22:53 kurahaupo joined 22:54 p6bannerbot sets mode: +v kurahaupo 23:00 kurahaupo left
loops Is there any way to arrange for an object a callback when it falls out of scope? DESTROY only gets called on garbage collection. 23:07
jnthn loops: No, but you can write a scope exit handler with LEAVE
loops Or what is the idiomatic way to release some external resource acquired inside an object when it is created? 23:08
jnthn, yeah, was coming to the conclusion that it has to be left in the hands of the caller to manually release the object rather than expecting it to happen automatically. 23:10
gfldex m: my class C { die "I'm still alive!" }; my $c = C.new; { my $d := $c; LEAVE $d.die }; 23:11
camelia I'm still alive!
in block <unit> at <tmp> line 1
loops gfldex: i'm not sure what that is demonstrating. 23:13
(sorry, pretty new to P6)
gfldex loops: objects can't keep track where and how often they are referenced (here with binding via := ). 23:14
loops: they can't know if they are still needed
loops gfldex, how is anything garbage collected ever then? 23:15
gfldex because the runtime knows 23:16
loops: what recource do you want to free? 23:17
loops glfdex, well in this particular case, it's not a big deal, I am just arranging to make sure the terminal is restored to cooked mode from raw 23:18
23:18 Sound joined, p6bannerbot sets mode: +v Sound
gfldex loops: then an ENTER/LEAVE pair seams fitting 23:18
loops glfdex, yeah for sure. I was just thinking it could be arranged by the class itself to clean things up when the scope died 23:19
rather than having to put a LEAVE term.clean
but it's not a big deal, was just a curiosity. 23:20
Xliff gfldex: Isn't that die a compile time drop? 23:22
gfldex Xliff: it is :)
Xliff o_O
OK! ;)
Geth advent: 47b106ab16 | (Jonathan Worthington)++ (committed using GitHub Web editor) | perl6advent-2018/schedule
Claim a spot
23:23
gfldex Xliff: I already stashed it away in my riddles.p6 file :-> 23:24
Xliff gfldex: What were you expecting to happen? :)
It looks like when class C is compiled, you die. You don't go any further. 23:25
Compare that, to this:
m: my class C { say "OOP!"; method die { say "ERP!" }; }; say "erp!"; my $c = C.new; { say "Hi"; my $d := $c; LEAVE $d.die };
camelia OOP!
erp!
Hi
ERP!
gfldex Xliff: I was surpries to output anything. My guess was a big NOP. 23:26
Xliff m: my class C { say "OOP!"; method die { say "ERP!" }; }; INIT { say "erp!" }; my $c = C.new; { say "Hi"; my $d := $c; LEAVE $d.die }; 23:27
camelia erp!
OOP!
Hi
ERP!
gfldex There are quite a few BEGIN-phasers in Perl 6 that are hard to spot. :)
Xliff m: my class C { say "OOP!"; method die { say "ERP!" }; }; CHECK { say "erp!" }; my $c = C.new; { say "Hi"; my $d := $c; LEAVE $d.die };
camelia erp!
OOP!
Hi
ERP!
Xliff m: my class C { die "ERP!" }; CHECK { say "erp!" }; my $c = C.new; { say "Hi"; my $d := $c; LEAVE $d.die }; 23:28
camelia erp!
ERP!
in block <unit> at <tmp> line 1
jnthn Class bodies run just where they are in the code. Role bodies run when the role is composed.
m: say 1; class C { say 2 }; say 3
camelia 1
2
3
gfldex Is that doced? 23:29
Xliff jnthn: Assuming they aren't pre-empted by a phaser. ;)
gfldex Looks like this is a ENODOC. 23:30
gfldex files issue
Xliff Heh! .oO( ENODOC... LOL! ) 23:32
23:33 pecastro left
jnthn No idea; role is the only exception to the rule, though. All other packages work as with `class` 23:34
(Which is because a role is generic) 23:35
23:39 Sound left 23:40 kurahaupo joined 23:41 p6bannerbot sets mode: +v kurahaupo
Xliff jnthn: What would be the best way to implement a generic List? 23:41
I've always understood generics as being tied to the object? The way Perl6 does Generics it almost sounds like I'd need to implement all of the List functions in the role and use that. 23:42
timotimo roles can supply methods for you, too
Xliff I know. 23:43
My problem is that the information I want is tied to the class, not the role.
So how can role methods apply to a type attribute?
timotimo the role can access stuff from the class, though
a type attribute?
Xliff s/type/class/
timotimo not sure what "apply to" means in this context? 23:44
Xliff Say I haved a CStruct with a pointer in it. I want to be able to extract that as a native type, but I won't know what that is until run-time. How would that work?
And yes... there are GLib applications to this. :) 23:45
23:45 kurahaupo left
timotimo you mean you want to have like a MyStruct[int] that will have a few attributes and then a native int attribute? 23:45
Xliff Yeah. 23:47
23:47 sena_kun left
timotimo you'd put that attribute in the role, though i can see why you'd have a problem with that, since attribute order actually matters there 23:47
so, you can put all attributes in the role
Xliff For a repr('CStruct') ? 23:48
timotimo i don't think roles have reprs
Xliff Right, but in this case, MyStruct is currently CStruct
Just with a generic Pointer as one of the attributes that can be any native type. 23:49
Makes getting to the data a little problematic.
timotimo you can give MyStruct a parameterize method that applies the role for you
Xliff Got an example? 23:50
Currently I'm doing this: github.com/Xliff/p6-GtkPlus/blob/m...st.pm6#L37 23:52
But would really like it if I could do this using a parameterized role.
timotimo m: class MyStruct is repr<CStruct> { method ^parameterize(|c) { say "parameterizing with arguments ", c.perl; } }; MyStruct[int]; MyStruct[uint16]; 23:53
camelia 5===SORRY!5=== Error while compiling <tmp>
Class MyStruct has no attributes, which is illegal with the CStruct representation.
at <tmp>:1
Xliff Native type object is specified in new
timotimo m: class MyStruct is repr<CStruct> { has int $.foo; method ^parameterize(|c) { say "parameterizing with arguments ", c.perl; } }; MyStruct[int]; MyStruct[uint16];
camelia parameterizing with arguments \(MyStruct, int)
WARNINGS for <tmp>:
parameterizing with arguments \(MyStruct, uint16)
Useless use of constant integer MyStruct[uint16] in sink context (line 1)
Useless use of constant integer MyStruct[int] in sin…
timotimo where in the struct is the attribute that can have different native types?
Xliff $.data 23:54
23:54 clarkema left
timotimo i don't see a $.data there 23:54
Xliff Yeah. Here's the def: github.com/Xliff/p6-GtkPlus/blob/m...s.pm6#L112 23:55
timotimo so what you want is actually a GList[int] or GList[num] or something like that?
Xliff Yeah.
timotimo that's going to be a bit more difficult, hmm. 23:56
Xliff Heh. Yeah. Tell me about it! :)
timotimo however, since you're already accessing it via accessors anyway, you can only mix in the accessor via the role 23:57
Xliff Right. That was my initial thought. I ended up just passing the type object in new
timotimo so mix in something like "role DataOfType[Type] { method data(--> Type) { return nativecast($!data, Pointer[Type]) } }
"
Xliff .... 23:58
/o\
That makes sense. Thanks!
timotimo YW :)
Xliff $.data would then need to be $!data, then. 23:59
Or can role methods override class methods?
timotimo they can