»ö« Welcome to Perl 6! | perl6.org/ | evalbot usage: 'p6: say 3;' or rakudo:, or /msg camelia p6: ... | irclog: irc.perl6.org or colabti.org/irclogger/irclogger_logs/perl6 | UTF-8 is our friend!
Set by moritz on 22 December 2015.
SmokeMachine m: my $x = 3; my @a = $x xx 3; my $b = $x xx 3; $x = 5; say @a; say $b 00:00
camelia [3 3 3]
(5 5 5)
thundergnat IOninja: Yep, that's what I ended up with.
IOninja m: say ($y xx 10).^name 00:00
camelia 5===SORRY!5=== Error while compiling <tmp>
Variable '$y' is not declared
at <tmp>:1
------> 3say (7⏏5$y xx 10).^name
IOninja m: say ('x' xx 10).^name
camelia List
naxieAlDle ahhh… this is what bothers me
IOninja c: 2015.10 say ('x' xx 10).^name
committable6 IOninja, ¦2015.10: «List»
naxieAlDle c: d192f1c29a^,d192f1c29a my $y = <y>; my @y; @y[0] = $y xx 10; say @y; @y[0][4] = <o>; say @y;
committable6 naxieAlDle, ¦d192f1c29a^: «[(y y y y y y y y y y)]␤Cannot assign to a readonly variable or a value␤ in block <unit> at /tmp/U4RgS3eglu:1␤ «exit code = 1»» ¦d192f1c: «[(y y y y y y y y y y)]␤[(o o o o o o o o o o)]»
naxieAlDle github.com/rakudo/rakudo/commit/d1...be4ad5771c
“Make xx quite a bit faster” 00:01
thundergnat But It surprised me at first and I needed to ponder what was going on
IOninja naxieAlDle: what bothers you? That you got faster xx?
naxieAlDle IOninja: that we got this behavior unintentionally
IOninja That's not the part you quoted. 00:02
A developer can't think of all the edge cases something may affect. We have tests for that job and in this case they didn't catch the issue.
naxieAlDle I'm just pointing out that this was unintentional 00:03
IOninja Saying "'Make xx quite a bit faster'....this bothers me" will just make that developer contribute elsewhere I think...
naxieAlDle that's not what I meant, sorry
IOninja m: my $x = 42; my $a = $x, $x, $x; say $a; $x = 72; say $a
camelia 42
42
IOninja m: my $x = 42; my $a = ($x, $x, $x); say $a; $x = 72; say $a 00:04
camelia (42 42 42)
(72 72 72)
IOninja star: my $x = 42; my $a = ($x, $x, $x); say $a; $x = 72; say $a
camelia (42 42 42)
(72 72 72)
naxieAlDle c: d192f1c29a^,d192f1c29a my $y = 25; say ($y xx 10).WHAT 00:04
committable6 naxieAlDle, ¦d192f1c29a^: «(Seq)» ¦d192f1c: «(List)»
naxieAlDle ah-ha
but still…
IOninja The Seq probably still had that problem, hidden behind reification 00:05
IOninja c: d192f1c29a^,d192f1c29a my $y = 25; my @a = ($y xx 10).cache; say @a; say @a 00:05
committable6 IOninja, ¦d192f1c29a^,d192f1c: «[25 25 25 25 25 25 25 25 25 25]␤[25 25 25 25 25 25 25 25 25 25]»
IOninja risou: your incessant nick-change away feature is kinda spammy. It's common courtesy not to have that enabled. 00:07
thundergnat The only reason I brought it up is that there were some changes to make xx thunk the left hand side at one point to make things like rand xx 4 work like most people expect. 00:09
I rashly thought that it would "thunk" containers too... To the extent that I thought at all. 00:10
IOninja Yeah, that's been that way for a while.
m: sub x { $ = rand }; my @a = x() xx 2; say @a; say @a
camelia [0.185815223569128 0.452429042720225]
[0.185815223569128 0.452429042720225]
IOninja m: sub x { $/ = rand }; my @a = x() xx 2; say @a; say @a 00:11
camelia [0.514069592865973 0.394482647460151]
[0.514069592865973 0.394482647460151]
IOninja m: my @a = ($/ = rand) xx 2; say @a; say @a
camelia [0.124562822271418 0.124562822271418]
[0.124562822271418 0.124562822271418]
thundergnat Anyway, not a big deal. Mostly just mumbling about my own misunderstanding.
IOninja thundergnat: it *is* pretty surprising. 00:12
thundergnat Something else I was wondering. I there any way in Perl 6 to open STDIN non blocking? 00:13
*Is
IOninja ATM only a hackish way 00:14
thundergnat Is that something that is just NYI? Or something that should be in module space?
IOninja Something like keep retrying to use it (e.g. if you're using prompt()) until it stops throwing, so it ends up using the thread that opened it 00:15
thundergnat: NYI. It's something to do with with libuv being paranoid about who's reading stuff.
thundergnat Ah.
IOninja m: my @a = ($,) xx 10; @a[0][0] = 42; say @a 00:17
camelia [(42) (42) (42) (42) (42) (42) (42) (42) (42) (42)]
IOninja heh
thundergnat I've used Term::termios to do immediate reads of key-presses (no need to hit enter) but it still blocks if there isn't a character ready and I couldn't find any obvious way to O_NONBLOCK $*IN. 00:18
IOninja Oh, THAT's what you mean./..
I thought you meant via threads. 00:19
IOninja like, do `start prompt "blah"`; cause that fails ATM 00:19
Well... the obvious way to do what you want is to read via a channel and poll the channel, but that uses threads, so you're hit with the issue I originally mentioned :( 00:20
IOninja thundergnat: tried .readchars? 00:23
The docs say "up to.." so maybe it doesn't block...
.readchars(1)
m: $*IN.slurp.chars.say
camelia No such method 'slurp' for invocant of type 'IO::Handle'
in block <unit> at <tmp> line 1
thundergnat Hmm. I don't remember trying that. 00:24
IOninja m: $*IN.readchars(1000000000000000000000000000); say "hi"
camelia Cannot unbox 90 bit wide bigint into native integer
in block <unit> at <tmp> line 1
IOninja m: $*IN.readchars(100000000000000000); say "hi"
camelia hi
IOninja Seems to do the trick in the bot...
thundergnat That looks like it might work. 00:25
\o/
IOninja \o/
IOninja c: d192f1c29a^,d192f1c29a my $y = 25; my @a; @a[0] = $y xx 10; say @a; $y = '♥'; say @a; say @a 00:28
committable6 IOninja, ¦d192f1c29a^: «[(25 25 25 25 25 25 25 25 25 25)]␤[(25 25 25 25 25 25 25 25 25 25)]␤[(25 25 25 25 25 25 25 25 25 25)]» ¦d192f1c: «[(25 25 25 25 25 25 25 25 25 25)]␤[(♥ ♥ ♥ ♥ ♥ ♥ ♥ ♥ ♥ ♥)]␤[(♥ ♥ ♥ ♥ ♥ ♥ ♥ ♥ ♥ ♥)]»
IOninja thundergnat: filed your container thing: rt.perl.org/Ticket/Display.html?id...xn-1452835 00:34
IMO there's no DWIM in that case... just a WAT
naxieAlDle IOninja++ 00:37
thundergnat I vaguely remember Timtoady doing some special casing during the GLR where assigning a list to an array would decontainerize since that is what most people would expect. 00:40
The problem is that for multi dim arrays, there is no way to be able to tell if the nth level wants to be an item or array, so you need to explicitly assign it. 00:41
(as an array if you want it to be one.)
IOninja m: my $y = 25; my @a[1;10]; @a = $y xx 10,; say @a; $y = '♥'; say @a 00:44
camelia [[25 25 25 25 25 25 25 25 25 25]]
[[25 25 25 25 25 25 25 25 25 25]]
IOninja probably can be fixed with a new nqp::decont() 00:46
IOninja is too tired to do it right now... 00:47
samcv I have my grant about ready to submit. if somebody could read through and proofread it for me that would be great gist.github.com/samcv/121351d79e4b...fa3a7980b3 01:58
naxieAlDle
.oO( ≈½ instead of ~1/2 :) )
02:00
travis-ci Doc build errored. Tom Browder 'declare $string so xt test passes' 02:08
travis-ci.org/perl6/doc/builds/208405299 github.com/perl6/doc/compare/2321b...0eb45b6c1b
samcv eww github's pod renderer renders it as At the current time ~½ 02:11
tfw perl 5 unicode
samcv just gonna use the word `half` instead 02:12
naxieAlDle haha 02:14
astj Hi. with recent rakudo's change, requiring different modules under same namespace like `require Foo; require Foo::Bar;` seems broken? 02:24
It say "Lexical 'Foo' already declared". github.com/astj/p6-Require-Bug-Demo
samcv kk submitted the proposal \o/ 07:09
RabidGravy Boom! 07:22
El_Che lizmat: Do you have the paper book of "Perl: The Complete Reference. Second Edition", Osborne, 2001? If not (not likely), I found one here at work. 07:40
lizmat: this is the cover: claudio.ulyssis.be/var/tmp/cover_ptcr2nd.pdf 07:43
samcv SourceBaby, help 08:19
SourceBaby samcv, Use s: trigger with args to give to sourcery sub. e.g. s: Int, 'base'. See modules.perl6.org/dist/CoreHackers::Sourcery
samcv Scalar 08:20
SourceBaby, Scalar
lizmat El_Che: looks familiar... but not easy to check for me at the moment, as the library is currently residing in our other house :-) 08:20
El_Che lizmat: there is no urgency what so ever. I'll set it aside. I have seen that on your shelf, but it may have been the 1ste edition. Hence the question. 08:55
lizmat oki, thanks for thinking about it :-)
samcv s: Scalar 08:56
SourceBaby samcv, Something's wrong: ␤ERR: Cannot resolve caller sourcery(Scalar); none of these signatures match:␤ ($thing, Str:D $method, Capture $c)␤ ($thing, Str:D $method)␤ (&code)␤ (&code, Capture $c)␤ in block <unit> at -e line 6␤␤
lizmat clickbaits p6weekly.wordpress.com/2017/03/06/...elative-≥/ 08:59
samcv lizmat, how do you feel about nested if else's github.com/rakudo/rakudo/blob/nom/...7441-L7450 09:01
personally they are super distracting to me, would it be okay to change them all to be standard convention? or no 09:02
lizmat they're not my favourite, but I can live with them :-)
*if* you change them, make sure it is only cosmetics that you change and note that in the commit message
samcv kk 09:03
lizmat jnthn prefers fewer lines of code over more lines of code, so he can see better what is going on
samcv does he like nested? 09:04
lizmat he likes fewer lines of code 09:06
samcv i dislike them because it distracts me when I'm scanning a file visually, eyes linger on that line which doesn't have that much content. kk
lizmat I dislike them when I'm editing and moving blocks of code around 09:07
but other than that I don't care too much 09:08
El_Che: woolfy just confirms to me that we have the book already
smls Is is possible for a unit-test script to replace an imported function as seen by the module it's testing? 09:10
My situation is like this:
1) Module A exports a subroutine which connects to the Internet and returns something.
2) Module B `use`s module A, and calls this function.
3) When unit-testing module B, I'd like it to use a mock version of this function, that doesn't connect to the Internet (and instead is controlled by the test file).
lizmat smls: maybe wrap the sub exported by A, and not calling the original code ? 09:13
smls How can the test file control what it returns? 09:14
lizmat m: module A { our sub foo() is export { "foo" } }; import A; &A::foo.wrap(-> { "bar" }); say A::foo; say foo # seems that wrapping doesn't change the imported 09:18
camelia bar
foo
lizmat m: module A { our sub foo() is export { "foo" } }; import A; BEGIN &A::foo.wrap(-> { "bar" }); say A::foo; say foo 09:19
camelia bar
bar
lizmat ah, needs to be wrapped at compile time
smls: that could work, no ? 09:20
smls The .wrap would have to happen inside module B though, right? 09:21
How can the test file control what it is wrapped with?
lizmat smls: don't think so: the wrap in my code didn't happen in the scope of A either
you need to have the subroutine be "our" though 09:22
smls lizmat: It happened in the scope that `use` A, which would be module B in my scenario
smls m: module A { our sub foo() is export { "foo" } }; module B { import A; our sub call-foo() { foo } }; use Test; import B; &B::foo.wrap(-> { "bar" }); is B::call-foo, "bar"; 09:31
camelia No such method 'wrap' for invocant of type 'Any'
in block <unit> at <tmp> line 1
smls ^^ this is more like the situation at hand 09:32
lizmat m: module A { our sub foo() is export { "foo" } }; module B { import A; our sub call-foo() { foo } }; use Test; import B; BEGIN &B::foo.wrap(-> { "bar" }); is B::call-foo, "bar";
camelia 5===SORRY!5=== Error while compiling <tmp>
An exception occurred while evaluating a BEGIN
at <tmp>:1
Exception details:
No such method 'wrap' for invocant of type 'Any'
in code at <tmp> line 1
smls B::call-foo is what I want to unit test 09:33
lizmat smls: must be afk for a few hours, will check when back
smls ok
smls In Perl 5, symbol table mangling (or Sub::Override or Test::MockModule) should do the trick. 09:46
But in Perl 6, lexical scopes can't be modified once compiled (correct me if I'm wrong), so that approach doesn't work...
smls let's take this to SO: stackoverflow.com/questions/4264580...g-a-module 10:29
samcv smls, let me know if you find the answer 10:39
El_Che smls: is inhereting from that class and overwritting the method and option? That's something I often do 10:41
s/overwriting/overriding/g 10:42
smls El_Che: There are no classes here, only modules that export subroutines. 10:45
But yeah, refactoring it to be more "OO" would be a last-resort solution, though it seems LTA that this should be neseccary in order to make unit tests possible.
jnthn I'd probably provide a way for the module to be configured with an alternative 10:46
Even if that's just an optional export of a set-internet-fetching-thingy(&foo)
El_Che smls: I see.
jnthn Or just make it an optional argument to the subroutine under test, and have it pick the one from the module as the default 10:47
El_Che smls: I guess "everything is a package" in perl5 is a nice thing :)
jnthn That way the code becomes more extensible as well as more testable
El_Che jnthn: test code in the regular sub? Not very nice
jnthn I'm sure there's ways to do clever stuff with CompUnit repos, by sticking something at the head of the chain that will intercept and mess with imported symbols
El_Che: That ain't what I said
El_Che rereads 10:48
jnthn use BlahWithBar; sub do-some-thing($foo) { ... bar() ... } 10:49
Could instead me
*be
use BlahWithBar; sub do-some-thing($foo, :&bar-strategy = &bar) { ... bar-strategy() ... }
With appropriate naming
That way not only do you get a way to test it, but you get a way for people so supply an alternative implementation to the default chosen, if they should need to 10:50
smls jnthn: Hm, that's actually not a bad idea in the case I'm working on. 10:51
Still, sometimes that's not something one wants. 10:52
jnthn Sometimes, in which case I suspect some clever module that lets you fake up imports at a distance would be needed 10:53
smls Is there a module wishlist somewhere, so I can add "Test::MockImport based on CompUnit magic" ? :P
jnthn I think so
perl6-most-wanted or whatever it's called
If you were doing OO stuff I'd point at Test::Mock :)
I think import mocking wants to be a separate module, though 10:54
smls jnthn: What the &bar weren't imported but defined in the same module as &do-some-thing, would there be any way to override that when loading the module from the test script? 10:56
*What if 10:57
smls I.e. disable pre-compilation, and do something to the module while it is compiled & loaded by the use statement. 10:59
jnthn smls: Possibly; I'm not immediately sure how I'd arrange that, though an evil way would be to slurp in the source and append a CHECK block before compiling it that does .wrap on the sub in question, and never defers to the original but instead calls the thing we want to test 11:02
Uh, thing we want to mock it with, I meant
smls That doesn't sound much more evil than the Perl 5 solutions (glob assignment etc.)... :) 11:04
IOninja Is Bart Weigmans here? 11:17
mscha m: say eⁱ 11:19
camelia 5===SORRY!5=== Error while compiling <tmp>
Undeclared routine:
eⁱ used at line 1
mscha m: say e**i
camelia 0.54030230586814+0.841470984807897i
IOninja ⁱ is not a power operator 11:20
mscha I know. :-)
Too bad there's not a superscript π in Unicode. I want an all-Unicode version of ... 11:21
m: e**(π×i) + 1 ≅ 0
camelia ( no output )
mscha m: say e**(π×i) + 1 ≅ 0
camelia True
araraloren write a module for it 11:22
mscha m: sub postfix:<ⁱ>(Numeric $x) { $x**i }; say eⁱ; 11:24
camelia 5===SORRY!5=== Error while compiling <tmp>
Undeclared routine:
eⁱ used at line 1
mscha m: sub postfix:<ⁱ>(Numeric $x) { $x**i }; say 2.71828182845905ⁱ;
camelia 0.540302305868138+0.841470984807898i
IOninja ha-ha
jnthn IOninja: He's brrt and on #moarvm 11:25
Geth perl6-most-wanted: d6062de102 | smls++ | most-wanted/modules.md
Add module ideas to help with mocking non-OO code in unit tests
11:27
doc: d5bff8fabe | (Zoffix Znet)++ | README.md
Trigger rebuild

To see if there are Pod parsing issues with latest Rakudo
11:29
mscha m: sub postfix:<ⁱ>(Numeric $x) { $x**i }; say (e)ⁱ; 11:32
camelia 0.54030230586814+0.841470984807897i
mscha m: say ³⁄₄₇; 11:33
camelia 5===SORRY!5=== Error while compiling <tmp>
Bogus postfix
at <tmp>:1
------> 3say ³7⏏5⁄₄₇;
expecting any of:
infix
infix stopper
postfix
statement end
statement modifier
tbrowder mscha: ref unicode super- and subscripts, do you know if there is a set of font data ( as in Font::AFM) for the unicode font you use (font matrics is the term for that data)? 11:40
mscha tbrowder: no, sorry, I don't know much about fonts, just using the default browser font. 11:43
tbrowder never mind, i'm thinking of printed matter, not on-line browser stuff 11:45
although the bright folks here could create the css and wrapper stuff to present the sub- and superscripts 11:46
IOninja That already comes with browsers in the form of <sup> and <sub> elements 11:49
travis-ci Doc build passed. Zoffix Znet 'Trigger rebuild 12:24
travis-ci.org/perl6/doc/builds/208553583 github.com/perl6/doc/compare/4c0eb...bff8fabe70
[Coke] (yay, doc xtest clean) 13:19
[Coke] IOninja: (d5bff8fabe) there is a file -specifically- in the repo for those shenanigans 13:35
IOninja Which one is it? 13:37
[Coke] util/trigger-rebuild.txt
[Coke] because samcv was adding trailing whitespace to things and causing 'make xtest' to fail. 13:37
IOninja Well, I didn't add any whitespace 13:38
Don't know why there's a special file for this at all TBH
Geth doc: 272259097d | (Will "Coke" Coleda)++ | doc/Type/Str.pod6
remove trailing whitespace
[Coke] because we shouldn't be making irrelevant changes to trigger rebuilds.
making random changes for that sort of thing gums up blame, history, sometimes tests... 13:39
[Coke] for her, we depend on a specific version of a 3rd party lib; we should actual depend on it and declare the dependency, and have that trigger the rebuild; yours could have been a dep on a specific version of rakudo 13:40
she created the file as a compromise, so at least all the commits of that type would be in one place. 13:41
[Coke] (I realize this lies more towards "theoretically" than "practically") 13:45
smls m: my %hash = a => {b => 42}; dd %hash{"a"}{"b"}; 14:39
camelia Int % = 42
smls m: my %hash = a => {b => 42}; dd %hash{"a";"b"};
camelia (42,)
smls ^^ Why does a multi-dimensional Hash index return a List, even if a single leaf node was selected? 14:40
m: my @array = 0, [0, 42]; dd @array[1;1] 14:41
camelia Int <element> = 42
smls ^^ In case of Arrays, this doesn't happen.
lizmat smls: feels rakudobuggable 14:42
smls will do
[Coke] which way is the bug? (slices should always return lists, no?) 14:58
m: my @array = 0, [0, 42]; dd @array[1;1][0]; 14:59
camelia 42
[Coke] Or, I suppose, it doesn't matter, because you can treat an element like a list.
naxieAlDle mscha: you can mention your unicode ideas here: gist.github.com/AlexDaniel/c89bd2786f9b63f31e4c 15:00
but that's just a list of all ideas, not a list of something we actually want to add to Perl 6… 15:01
IOninja Not always. @parameters and @.attributes will reject it 15:03
m: sub (@){}( (@)[1;1] ) 15:04
camelia Type check failed in binding to '<anon>'; expected Positional but got Any (Any)
in sub at <tmp> line 1
in block <unit> at <tmp> line 1
IOninja m: class { has @.x }.new: x => (@)[1;1] 15:05
camelia ( no output )
IOninja Just params I guess
m: class { has @.x; method foo { dd @.x } }.new(x => (@)[1;1]).foo 15:06
camelia Array @!x = [Any]
IOninja m: class { has @.x; submethod BUILD (:@!x) {} }.new: x => (@)[1;1]
camelia Type check failed in binding to '@!x'; expected Positional but got Any (Any)
in submethod BUILD at <tmp> line 1
in block <unit> at <tmp> line 1
poska hey guys 15:08
how do you use variables inside rule definitions in a grammar? 15:09
e.g. rule foo { \d+ {$!my-special-variable} } 15:10
this doesn't seem to work
smls [Coke]: .[1; 2] is not a slice, it indexes a singular element. No reasoin to expect .{"a"; "b"} to be different. 15:10
[Coke]: .[1, 2] would be a slice, as would .[1; 2,] - i.e. when the subscript for at least one dimension is an Iterable. 15:11
IOninja poska: what are you trying to accomplish? 15:13
IOninja private attributes won't work, since ever rule is a separate instance of Cursor or something like that 15:13
poska i have a rule which must repeat a fixed amount of times
and with each parse call, this amount differs 15:14
IOninja OK
Well, you can use dynamic variables to pass that information
poska could you share a working snippet of this?
IOninja m: my $*FOO = 3; say grammar { token TOP { $<foo>=.**{$*FOO} .+ } }.parse: 'abcdefghij' 15:15
camelia 「abcdefghij」
foo => 「abc」
IOninja m: my $*FOO = 10; say grammar { token TOP { $<foo>=.**{$*FOO} .+ } }.parse: 'abcdefghij'
camelia Nil
IOninja m: my $*FOO = 10; say grammar { token TOP { $<foo>=.**{$*FOO} .+ } }.parse: 'abcdefghijddassdadas'
camelia 「abcdefghijddassdadas」
foo => 「abcdefghij」
poska nice! thank you 15:16
IOninja m: say grammar { token TOP { $<n>=\d+ {my $*FOO = +$<n>} <bar> .+ }; token bar { .**{$*FOO} } }.parse: '3abcdefg'
camelia Dynamic variable $*FOO not found
in regex bar at <tmp> line 1
in regex TOP at <tmp> line 1
in block <unit> at <tmp> line 1

Actually thrown at:
in regex bar at <tmp> line 1
in regex TOP at <tmp> line 1
in block <unit> at <tmp>…
IOninja m: say grammar { token TOP { $<n>=\d+ :my $*FOO = +$<n>; <bar> .+ }; token bar { .**{$*FOO} } }.parse: '3abcdefg'
camelia Use of Nil in numeric context
in regex TOP at <tmp> line 1
「3abcdefg」
n => 「3」
bar => 「」
IOninja m: say grammar { token TOP { $<n>=\d+ {} :my $*FOO = +$<n>; <bar> .+ }; token bar { .**{$*FOO} } }.parse: '3abcdefg'
camelia 「3abcdefg」
n => 「3」
bar => 「abc」
IOninja m: say grammar { token TOP { $<n>=\d+ {} :my $*FOO = +$<n>; <bar> .+ }; token bar { .**{$*FOO} } }.parse: '5abcdefg'
camelia 「5abcdefg」
n => 「5」
bar => 「abcde」
IOninja It's also available in Actions 15:17
naxieAlDle m: my $x = ‘hello’; say ‘hello’ ~~ /<{$x}>/
camelia 「hello」
IOninja (and the empty block {} is there to update the $/ variable so that $<n> capture would be in it)
smls poska: You could maybe also pass it down as a parameter: rule n-times ($n) { . ** {$n} };
Call it like <n-times(5)> 15:18
poska i didn't know you can pass parameters to rules
naxieAlDle there are some limitations to this, if I recall correctly
namely you cannot have parameterized protos or something
poska are dynamic variables accessed globally? 15:19
IOninja poska: they're accessed in dynamic scope
poska is it possible to pass a parameter to the grammar on construction and then expose it as a dynamic variable? 15:20
moritz yes, you could override the parse method in the grammar to set the dynamic variable when parsing beings 15:21
*begins
IOninja you can use dynamic variables in token parameters: e.g. token foo ($*FOO) {... } and then it'll be available
poska okay, still need to wrap this in my head :D i'm quite new to p6 15:22
IOninja You can use :$args name param, can't you? No need to override anything
m: say grammar { token TOP ($*FOO) { $<foo>=.**{$*FOO} .+ } }.parse: 'abcdefghij', :args[3]
camelia 「abcdefghij」
foo => 「abc」
IOninja yup
smls m: grammar A { token TOP ($n) { <foo($n)> .* }; token foo ($n) { . ** {$n} } }; say A.parse("Hello world", args => \(4)) 15:31
camelia 「Hello world」
foo => 「Hell」
smls poska: This ^^ is what I meant, with passing it down as a parameter.
poska can you explain what does args => \(4) do? 15:32
smls 'args' is a named argument accepted by the .parse method
it takes a Capture of arguments to pass to rule TOP 15:33
[Coke] m: say (\(4)).perl
camelia \(4)
smls \( ) constructs a Capture, which is a collection of positional and/or named arguments that can be passed to a function or method
poska so it's sort of a function signature? 15:34
smls it's something that can be *passed* to a signature
a.k.a. an "argument list" 15:35
poska ok, this integrates perfectly! thanks 15:37
in the python world i imagine this as foo(*(1, 2, 3)), when the function naturally accepts foo(1, 2, 3)
IOninja There's no need to make it a capture 15:40
smls poska: In Perl6, | takes the role of Python's * in that case
m: sub a ($x, $y, :$foo) { say $x; say $y; say $foo }; my $args = \(1, 2, foo => 42); a |$args
camelia 1
2
42
IOninja m: grammar A { token TOP ($n) { <foo($n)> .* }; token foo ($n) { . ** {$n} } }; say A.parse("Hello world", :args[4]) 15:41
camelia 「Hello world」
foo => 「Hell」
IOninja m: 4.Capture
camelia ( no output )
IOninja m: |4.Capture
camelia ( no output )
IOninja Wonder why it complains about :4args ...
m: dd 4.Capture
camelia \()
IOninja m: dd |4.Capture
camelia block <unit>
IOninja m: dd [|4.Capture]
camelia []
IOninja That's why :(
IOninja Well, never mind. Seems .Capture is kinda busted, so makes sense to pass Capture to :args 15:46
IOninja Oh, wait, it's the slipping of a capture that's busted... 15:49
m: dd [ [:42x].Capture ]
camelia [\(:x(42))]
IOninja m: dd [ |[:42x].Capture ]
camelia []
IOninja m: grammar A { token TOP (:$n) { <foo($n)> .* }; token foo ($n) { . ** {$n} } }; say A.parse("Hello world", args => \(:42n) ) 15:50
camelia Nil
IOninja m: grammar A { token TOP (:$n) { <foo($n)> .* }; token foo ($n) { . ** {$n} } }; say A.parse("Hello world", args => \(:2n) )
camelia 「Hello world」
foo => 「He」
IOninja moves this to #perl6-dev
IOninja nevermind, .Capture isn't busted :) 15:56
moritz it's just creative! :-)
IOninja :)
smls dd 4.List; dd 4.Capture; 15:58
IOninja: Is that ^^ also correct? 15:59
smls m: dd 4.List; dd 4.Capture; 15:59
camelia (4,)
\()
15:59
IOninja smls: no, but there's a ticket for that. 15:59
smls ok
IOninja Well, not IMO 16:00
It calls a Mu candidate that rakes for attributes and perhaps value types should provide their own Capture
m: dd class { has $.x = 42 }.new.Capture;
camelia \(:x(42))
IOninja Mu.Capture doesn't really makes sense to me. 16:04
m: dd now.Capture
camelia \(:tai(<2936116123547/1972>))
IOninja I'd just do it as { self.list.Capture }
timotimo turns any object into a capture by exposing its attributes
it's for doing stuff like for @pairs -> (:$key, :$value) { } 16:05
IOninja That stuff uses .Capture?
timotimo i thought so?
IOninja m: dd :42a.Capture
camelia \(:key("a"), :value(42))
araraloren I make a binding for a library ftplib, which name should be good ? Net::Ftplib or Net::ftplib or other ? 16:06
IOninja Net::FTPlib
FTPlib
araraloren IOninja, Hm, thanks.
timotimo you can call it "Al" 16:07
IOninja m: for :42a -> (:$key, :$value, :$uc) { dd [$key, $value, $uc]} 16:07
camelia ["a", 42, Mu]
timotimo yeah, the "call method" semantics for pairs is just when you smartmatch 16:08
IOninja m: use MONKEY; augment class Pair { has $.uc = 'foo' }; for :42a -> (:$key, :$value, :$uc) { dd [$key, $value, $uc]}
camelia P6opaque: no such attribute '$!uc' in type Pair when trying to get a value
in block <unit> at <tmp> line 1
IOninja augmentation failurage? 16:09
timotimo interesting
does Pair have a custom .Capture? i'd assume it does
but actually ... huh?
that's not what that'd be
s: Pair, "Capture", \()
SourceBaby timotimo, Sauce is at github.com/rakudo/rakudo/blob/76a5...Mu.pm#L680 16:10
timotimo m: use MONKEY; augment class Pair { has $.uc = "foo" }; .say for Pair.new.^attributes.flat
camelia Mu $!key
Mu $!value
Mu $!uc
IOninja m: for (4,) -> ($z) { dd [$z]}
camelia Too few positionals passed; expected 1 argument but got 0 in sub-signature
in block <unit> at <tmp> line 1
IOninja So I guess if 4.Capture gives \(4), the above will start to work...
smls I've always considered the -> (:$key, :$value) feature somewhat of a hack, and hope it'll me made unnecessary by a future -> ($key => $value) syntax... :) 16:11
timotimo m: use MONKEY; augment class Pair { has $.uc = "foo" }; Pair.new."$_"() for Pair.new.^attributes.flat 16:11
camelia No such method '$!key' for invocant of type 'Pair'
in block <unit> at <tmp> line 1
[Coke] smls: what if you have more than 2?
timotimo m: use MONKEY; augment class Pair { has $.uc = "foo" }; Pair.new.key
camelia ( no output )
timotimo what the hay?
smls [Coke]: I meant specifically for destructuring keys.
[Coke] smls: ok
timotimo m: use MONKEY; augment class Pair { has $.uc = "foo" }; Pair.new."key"()
camelia ( no output )
timotimo oh, i had to substr the name, sure 16:12
smls [Coke]: Have you actually used the syntax for any other methods than .key. and .value?
IOninja I have
[Coke] timotimo: also you're not printing anything?
smls: doubtful
timotimo m: use MONKEY; augment class Pair { has $.uc = "foo" }; say Pair.new."$_.substr(2)"() for Pair.new.^attributes.flat
camelia No such method 'substr' for invocant of type 'Attribute'
in block <unit> at <tmp> line 1
timotimo m: use MONKEY; augment class Pair { has $.uc = "foo" }; say Pair.new."$_.name.substr(2)"() for Pair.new.^attributes.flat
camelia (Mu)
(Mu)
P6opaque: no such attribute '$!uc' in type Pair when trying to get a value
in block <unit> at <tmp> line 1
IOninja smls: github.com/perl6/routine-map/blob/...wer.p6#L11
timotimo m: use MONKEY; augment class Pair { has $.uc = "foo" }; say Pair.new."uc"() for Pair.new.^attributes.flat
camelia P6opaque: no such attribute '$!uc' in type Pair when trying to get a value
in block <unit> at <tmp> line 1
timotimo m: use MONKEY; augment class Pair { has $.uc = "foo" }; say Pair.new.uc() for Pair.new.^attributes.flat 16:12
camelia P6opaque: no such attribute '$!uc' in type Pair when trying to get a value
in block <unit> at <tmp> line 1
16:13
timotimo so how come that explodes that way?
timotimo m: use MONKEY; class Test { has $.a = "one", has $.b = "two" }; augment class Test { has $.uc = "foo" }; Test.new.uc() 16:13
camelia P6opaque: no such attribute '$!uc' in type Test when trying to check if it's initialized
in block <unit> at <tmp> line 1
smls IOninja: Is PATH_INFO a method, or a Hash entry in that case?
IOninja smls: hash key 16:14
SmokeMachine m: multi trait_mod:<is>(Variable $v, :$injected) {say $v.willdo}; my $a is injected # ← what's this willdo?
camelia 5===SORRY!5=== Error while compiling <tmp>
Too few positionals passed; expected 2 or 3 arguments but got 1
at <tmp>:1
IOninja m: class Pair { has $.uc = "foo" }; say Pair.new.uc 16:15
camelia foo
IOninja m: use MONKEY; augment class Pair { has $.uc = "foo" }; say Pair.new.uc
camelia P6opaque: no such attribute '$!uc' in type Pair when trying to get a value
in block <unit> at <tmp> line 1
IOninja m: use MONKEY; augment class Pair { has $.uc = "foo" }; 'say Pair.new.uc'.EVAL
smls IOninja: Then it would work with the suggested alternae syntax too: -> % (PATH_INFO => $_, *%)
camelia P6opaque: no such attribute '$!uc' in type Pair when trying to get a value
in block <unit> at EVAL_0 line 1
in block <unit> at <tmp> line 1
SmokeMachine ok, its for trait_mod:<will> 16:16
IOninja smls: that would make it inconsistent with the rest of the language.
moritz SmokeMachine: some voodoo used for installing phasers
IOninja If :PATH_INFO($_) stops working in that particular instance.
IOninja & 16:17
smls IOninja: It's mostly the fact that it translates into a method call in same cases, that I find weird.
IOninja smls: it doesn't tho
smls: as timotimo++ showed above, it uses the .Capture method on the given object and passes the capture to the subcapture.
smls The how does -> (:key($foo)) work when passing a Pair?
oh
IOninja Pair.Capture rakes the key/value attributes
m: dd :42a.Capture
camelia \(:key("a"), :value(42)) 16:18
IOninja and ^ that gets passed
mscha naxieAlDle: thanks, I'll have a look, and if I have any that aren't yet mentioned - it looks pretty complete at first glance - I'll add them, if they're not too ridiculous. (I won't bother with eⁱ for instance. :-) 16:19
smls IOninja: Still weird tho :P 16:20
smls IOninja, timotimo: Any idea why Mu.Capture doesn't simply do method Capture { \( |self ) } ? 16:24
Would be much less surprising IMO.
timotimo huh? 16:25
smls 4 --> \(4)
timotimo why would it do that, though?
smls :4a --> \(:4a)
(1, 2) --> \(1, 2)
timotimo m: dd $*KERNEL.Capture 16:25
camelia \(:auth("unknown"), :desc(Str), :name("linux"), :release("#1 SMP Fri Dec 9 16:18:38 UTC 2016 (3ec5648)"), :signature(Blob), :version(v4.4.36.8.default))
smls (a => 2) --> \(:a(2))
jnthn Because otherwise it'd be useless for destructuring objects 16:27
IOninja m: dd bag(<a b c c>).Capture
camelia \()
jnthn The deafult in Mu is fine, though it's apparent that various built-in types could have a more useful .Capture method
IOninja jnthn: would you agree that .Capture method can be added to some core types, e.g. on Int and Bag .Capture produces an empty list 16:28
OK.
jnthn But be careful about Pair, because there's likely code out there that destructures it into a key and a value
Yeah, .Capture on Bag producing an empty capture isn't too helpful
smls jnthn: Why does it need to destructure objects though?
IOninja m: dd (|bag(<a b c c>)).Capture
camelia \(:a(1), :b(1), :c(2))
IOninja addss it to todo list
jnthn smls: huh?
timotimo it needs to do that because that's a feature of the language 16:29
smls I mean, .Map / .Hash doesn't do that either...
timotimo: But is it a sensible feature...? 16:30
jnthn No, I'd not expect them to
Yes, it is.
And it's done this way so that objects can implement Capture to decide who they can be destructured using signatures 16:31
*how
smls Well, I've never seen it used in practice outside of the :key($a), :value($b) which could be much nicer with a dedicted syntax for destructuring pairs. 16:32
jnthn m: sub foo(Complex $c (:$re, :$im)) { say $re; say $im; }; foo(2 + 3i) 16:33
camelia 2
3
jnthn Also can be useful in multi-dispatch for pattern-matching inside of objects 16:34
smls jnthn: But don't you think it's strange that a torning a lone Pair into a Capture behaves so differently from other data structures containing Pairs: 16:41
m: say {a => 1, b => 2}.Capture; say (a => 1, b => 2).Capture; say (b => 2).Capture;
camelia \(:a(1), :b(2))
\(:a(1), :b(2))
\(:key("b"), :value(2))
jnthn smls: Arguably, though it'd be a breaking change to make it do so. 16:43
jnthn And arguably the way it is now is consistent with Rat, Complex, and Range 16:44
So it comes down to "pick which consistent you want to be"
smls As for destructuring objects, that too could be supported with a dedicated syntax without making Mu.Capture pretend that objects are hashes. 16:45
E.g....
($key => $value) -- subsignature that destructures a Pair
(:$key($value)) -- possible alternate syntax
(.$im, .$re) -- subsignature that destructures an object
(.im($IM), .re($RE)) -- with custom variable names
or something
jnthn It's not about pretending objects are hashes. An argument capture, represented by Capture, is well-defined as something with a positional part and a named part. A signature is something that processes a Capture. The .Capture coercer says "tell me how you'd like to look as an argument list" - and given captures exist almost exclusively to be processed by signatures it's pretty clear the resulting Capture should be useful for unpacking with a Signat 16:59
$key => $value in a signature is actually reasonable syntax for destructuring something passed as a Pair. The matter two are asking for changes to entire nature of signatures/captures and how we process them. 17:00
jnthn *latter two 17:01
smls Hm, ok 17:02
[Coke] jnthn: first long send ended at "with a Signat" 17:04
smls I guess if all value tyes were to get a .Capture that contains the value as a single positional arguemt, and all Associative types (Pair, Bag...) get a Hash-like .Capture, it would be servicable... :) 17:05
Except that as you said, the unfortunate Pair.Capture is already used in practice and thus can't be changed in 6.c
jnthn [Coke]: That was nearly the end: "...with a Signature."
smls: Yeah, it's also rather hard to change generally because it's a method, so what happens if the callee is 6.c and the caller is 6.d and so forth... 17:06
We might decide the breakage is worth it, though I don't have a good feel for that
Giving Bag and so on a Hash-like .Capture would make sense since they're Associative 17:08
[Coke] for masak et al: fibonacci convention this year promises to be as big as the last two, combined! 17:14
moritz [Coke]++ # autopun 17:21
jeek [Coke]++ 17:22
moritz just read on twitter: don't use "fortnight" as your password, it's two week 17:25
arnsholt *groan* 17:29
alphah Hello perl 6, I'm following Grammar example from perlgeek.de/blog-en/perl-6/2017-00...mmar.html, I'm trying to make token header matches only specific words but not able to. 17:41
here is a link for my code gist.github.com/anonymous/2192a932...f5e5badfbc
IOninja there's no token header in your code? 17:42
alphah token object replaced header 17:43
there is a config template file as well in the pstepin link, the config file uses slightly different syntax than INI file showed in example 17:44
IOninja alphah: I don't fully understand the question. The included text file gets successfully parsed by that grammar... What's the isseu? 17:45
Geth perl6-most-wanted: 183886b829 | (Itsuki Toyota)++ | most-wanted/bindings.md
Add a WIP module for Charting
17:46
alphah my question is how to limit "object" token to match specidif words,for example <main>and <dev> match,,, but <other_word> should not match
IOninja m: gist.github.com/zoffixznet/be2ca6f...132a4f4525 17:47
camelia Don't know what main category is
in regex object at <tmp> line 17
in regex realm at <tmp> line 22
in regex TOP at <tmp> line 23
in block <unit> at <tmp> line 33
IOninja m: gist.github.com/zoffixznet/1e35289...17b4a68513 17:48
camelia 「<dev>
key value

realm => 「<dev>
key value

object => 「<dev>

0 => 「dev」
block => 「key value

law => 「key value

key => 「key」
space => 「 」
value => 「value」
IOninja That's one way...
The <?{...}> thing executes a piece of code and match succeeds if code's last statement's value is truthy
and || { die... } will only trigger when the previous chunk failed to parse 17:49
alphah hmm, is there a way to do it with proto token object {*}
?
IOninja Not at the moment.
But you can just use another token... token object-prep { <object> || {die... } } for example 17:50
or token object { .... <section-name> .... }; token section-name { [main|dev|whatever] || {die "Don't know the section"} } 17:53
alphah I think that's good enough, I will use last one 17:54
alphah Thanks IOninja 17:54
IOninja A thought occurs... 18:11
my @a; @a[^3]»++ <-- that's not thread-safe, is it? 18:12
or my BagHash $b .= new; $b<a b c>»++
timotimo yeah, that'll grow the array in steps
that's bad news
IOninja Man 18:13
naxieAlDle ouch…
IOninja We should really come up with another op for autothreading. And leave » unthreaded
moritz I'm not really convinced with need actual autothreading 18:14
most operators are rather cheap, so doing them in parallel typically doesn't make much sense
IOninja Yeah 18:15
moritz is the author/owner of www.0racle.info/ in here? and if yes, under what nickname?
naxieAlDle .seen 0racle 18:15
yoleaux I haven't seen 0racle around.
moritz ah, perlawhirl, it seems 18:16
naxieAlDle yes
IOninja: I've also always disliked how » is different from map 18:17
or deepmap, or whatever it actually is
IOninja heh
naxieAlDle I still can't predict what it does
naxieAlDle but it's too short, I can't get myself not to use it… 18:18
Geth doc: bduggan++ created pull request #1240:
Add "Perl 6 from Python -- Nutshell" page
18:18
IOninja Sounds like you want a 1-character map... 18:19
buggable: eco 1-character map
buggable IOninja, M 'M, the 1-character Map: non-nodal, non-autothreading .map(*.some-method)': github.com/zoffixznet/perl6-M
Geth doc/master: 13 commits pushed by (Brian Duggan)++, (Zoffix Znet)++
review: github.com/perl6/doc/compare/27225...c597301713
18:20
doc/py-nutshell: 2df66cc4ac | (Brian Duggan)++ | doc/Language/py-nutshell.pod6
various pod and punctiation fixes and rewording
IOninja I'll fix xtest
[Coke] glares at IOninja. :)
danke. :)
IOninja I'm just very excited to have a Python-* doc
[Coke] 'sfine, it's 'x' for a reason. 18:21
wow, it fails a LOT of xtest. 18:22
note that some of the xtest test let you do "perl6 xt/foo.t path/to/file.t"
(should make it faster to rule out the probably one file he edited.
IOninja "# & uares 79 14: uar es, uar-es," ... what are 79 14 numbers? I don't see where there's an "uares"... only \squares and squares 18:24
IOninja Also gives "# & is's 50 48:" but searching for "is's" gives me nothing 18:26
oh it's in code block nevermind 18:27
class :: is Foo is Bar {} <-- is `is` in there an operator or a trait? 18:28
IOninja s: &infix:<is> 18:28
SourceBaby IOninja, Something's wrong: ␤ERR: ===SORRY!=== Error while compiling -e␤Undeclared routine:␤ infix:<is> used at line 6. Did you mean 'infix:<+|>', 'infix:<∖>', 'infix:<ne>', 'infix:<o>', 'infix:<**>'?␤␤
IOninja Trait it is...
[Coke] aye, trait.
m: is π 18:29
camelia 5===SORRY!5=== Error while compiling <tmp>
Undeclared routine:
is used at line 1
IOninja how come xt/aspell.pws is ignore? I need to a word into it (lexicographically) 18:32
in .gitignore I mean 18:33
hm, it gets updated fromsomewhere... /me looks 18:34
ah, found it. xt/words.pws
IOninja what to do with `uares` thing? gist.github.com/zoffixznet/4ef748e...f9e5f969e5 18:37
Oh, it's this line that causes it: "my \squares = [];" what do I do
IOninja guess I'll just add uares to code.pws 18:39
Geth doc: 652347dcd8 | (Zoffix Znet)++ | 3 files
Fix aspell tests failures
Geth doc: 449c88dc95 | (Zoffix Znet)++ | doc/Language/py-nutshell.pod6
Fix nbsp tests
18:42
IOninja Is perl6 xt/examples-compilation.t supposed to take ages without producing any output? 18:46
IOninja realises "I'll fix xtest" really mean, I'll spam #perl6 with questions on how to fix it :P
Oh, sure, NOW it produces output -_- 18:47
timotimo it checks on IRC if you've complained yet
IOninja :)
Geth doc: 3417c13cf9 | (Zoffix Znet)++ | xt/space-after-commma.t
Make xt/space-after-commma.t report line numbers for failures
18:58
IOninja :o TIL you can use `&` instead of `|` in regexes: [ <!before ' '> & <!before $> ] 19:00
moritz or just <?before <-[ characters here]> > 19:02
Geth doc/py-nutshell-more: 6 commits pushed by (Brian Duggan)++
[Coke] ^^ that compare is bad. 19:04
Geth doc: 6434cce19d | (Zoffix Znet)++ | xt/examples-compilation.t
Whitelist python docs from compilation tests
doc: 2715812df4 | (Zoffix Znet)++ | xt/space-after-commma.t
Revert "Make xt/space-after-commma.t report line numbers for failures"

This reverts commit 3417c13cf941009e10183a8d9dea683c676d56d0.
It reports lines for processed doc, not original
19:05
IOninja Well... I now feel sufficiently useless.
[Coke] IOninja: note that you can :skip-test for individual pod blocks in the cases where 2/3 of them are python (it's a PITA, so this is fine to get the tests clean, thanks.)
IOninja++ 19:06
does python allow commas after spaces? 19:09
[Coke] if not, we can blacklist doc/Language/py-nutshell.pod6 in the comma test. 19:10
Geth doc: 17ef6722cd | (Brian Duggan)++ | doc/Language/py-nutshell.pod6
move comma for xtest
19:11
[Coke] If that was the failure, we should rewrite the test. 19:13
[Coke] that doesn't pass the test. 19:14
Geth doc/py-nutshell-more: 379e364dfd | (Brian Duggan)++ | doc/Language/py-nutshell.pod6
Spacing, Perl 6 vs Perl 6 (nbsp)
19:15
[Coke] 17ef6722cd ^Hcan be reverted. 19:16
IOninja mhm, yeah, I think there's a confusion with the comma test. For me it reported just two lines. I think Brian is changing all the commas or something
Geth doc: 74c08b984f | (Zoffix Znet)++ | doc/Language/py-nutshell.pod6
Revert "move comma for xtest"

This reverts commit 17ef6722cdd2dde019a24b74a0e38130cfc8f083.
19:17
IOninja OK. I'll run xtest from scratch and fix anything that pops up.
Geth doc: 9bd2c0113c | (Zoffix Znet)++ | doc/Language/py-nutshell.pod6
Fix all the comma xtest failures
19:19
doc/py-nutshell-more: 7a393c3aa8 | (Brian Duggan)++ | doc/Language/py-nutshell.pod6
added back lexicographically

  (since it's now in our dictionary)
Geth doc: bduggan++ created pull request #1241:
Perl 6 -> Python in a nutshell, fixes
19:21
Geth doc: 6c687324fa | (Zoffix Znet)++ | xt/space-after-commma.t
Make xt/space-after-commma.t diag() the line with the issue
19:25
[Coke] why is bd working on this on the branch while you're in mastere? 19:26
IOninja Because I jumped in to fix the issues, like a kid on sugar rush... And I guess Brian is not on IRC, so they only thing they saw is your comment on the branch I merged that it fails xtests. 19:27
[Coke] I commented on his second-PR in progress. 19:28
IOninja Well, my bad. 19:32
IOninja wonder what's the significance of my latest comments highlighted in light blue... 19:34
unread or something?
IOninja i.imgur.com/Px95wM1.png 19:35
bdmatatu: \o 19:36
Sorry for jumping it like that. I guess I was too excited about pythong docs :)
bdmatatu Howdy!
No problem, sorry for the conflcts
bdmatatu I'll see if pr 1241 passes xtest before I push the commits to master. 19:40
TimToady bisect: my $x = 1,$_
bisectable6 TimToady, On both starting points (old=2015.12 new=e2db7b8) the exit code is 0 and the output is identical as well
TimToady, Output on both points: «»
TimToady I guess that never warned, for some reason
TimToady m: 1,$_ 19:40
camelia WARNINGS for <tmp>:
Useless use of constant integer 1 in sink context (lines 1, 1)
TimToady m: 1,42 19:41
camelia WARNINGS for <tmp>:
Useless use of constant integer 1 in sink context (lines 1, 1)
Useless use of constant integer 42 in sink context (lines 1, 1)
TimToady m: $_
camelia WARNINGS for <tmp>:
Useless use of $_ in sink context (line 1)
TimToady odd
IOninja m: dd 4.Capture
camelia \()
IOninja TimToady: would you say it'd be OK for ^ that and non-Associative Cools to do method Capture { self.list.Capture } do they don't end up empty like that? 19:41
TimToady well, the current behavior is certainly a WAT 19:42
IOninja OK
m: -> ($x) {}( 4 )
camelia Too few positionals passed; expected 1 argument but got 0 in sub-signature
in block <unit> at <tmp> line 1
IOninja ^ that would start to work.
If 4.Capture gives \(4)
TimToady that may, of course, produce other WATs if you fix it :) 19:43
IOninja hehe
TimToady maybe it should blow up instead? 19:44
IOninja Dunno. It becoming \(4) kinda follows the "anything is a 1-item list" thing. 19:45
TimToady otherwise we'll end up with a bunch of code with superstitious ()
and it'll be working for the wrong reason
IOninja Ahhh
OK. I'll give the "blow-up" approach a try first.
TimToady m: -> [$x] {}( 4 ) 19:46
camelia Type check failed in binding to '<anon>'; expected Positional but got Int (4)
in block <unit> at <tmp> line 1
TimToady m: -> [$x] {}( [:4ty] ) 19:46
camelia Too few positionals passed; expected 1 argument but got 0 in sub-signature
in block <unit> at <tmp> line 1
IOninja m: my $a but Real, Numeric;
camelia ( no output )
TimToady we were thinking about fixing that one to not turn into a Capture, too 19:47
IOninja ^ there's a ticket for that not producing a warning: rt.perl.org/Ticket/Display.html?id...et-history
TimToady I think that might be in my todo list already 19:47
naxieAlDle c: 2015.10,2015.11,2015.12 my $x = 1,$_ 19:50
committable6 naxieAlDle, ¦2015.10,2015.11: «WARNINGS:␤Useless use of variable $_ in sink context (line 1)» ¦2015.12: «»
naxieAlDle bisect: old=2015.10 my $x = 1,$_ 19:51
bisectable6 naxieAlDle, Bisecting by output (old=2015.10 new=e2db7b8) because on both starting points the exit code is 0
Geth doc: fe20283f23 | (Brian Duggan)++ | doc/Language/py-nutshell.pod6
indentation in py-nutshell
bisectable6 naxieAlDle, bisect log: gist.github.com/de8bef3c557d7a6317...56950c3078
naxieAlDle, (2015-12-12) github.com/rakudo/rakudo/commit/f9...d9fb452cf1
naxieAlDle TimToady: not sure if that's helpful, but still: ↑
IOninja bdmatatu: typo: s/Perl 6/Python/; "Decorators in Perl 6 are a way of wrapping a function in another one." 19:52
bdmatatu oops, thanks
Geth doc: 773b08a674 | (Brian Duggan)++ | doc/Language/py-nutshell.pod6
typo about decorators
19:53
El_Che bdmatatu: I don't know what you did in Spain in the past, but I had 3 spaniards that told me they loved your talk [on cfgmgt camp, monday an tuesday after fosdem] 19:55
bdmatatu thanks! Have never been there actually 19:56
El_Che bdmatatu: I found it curious that they were all from Spain and not from the same group at fosdem :) 19:57
DrForr We had the group from Portugal and Granada, IIRC. 19:58
TimToady IOninja: btw, thanks, it was your 'my $a = $x, $x, $x;' that alerted me to the fact that it wasn't warning on $x there
El_Che DrForr: one of the guys that spoke to me was indeed from granada. On other from Capside (Perl 5) so I guess Barcelona or Madrid. The other I don't know where is was from 20:00
DrForr Barcelona probaby. 20:01
*probably
El_Che I know nothing
DrForr n/ick JonSnow
IOninja :)
Woodi_ hi #perl6 :) 20:23
Woodi_ found in open(2) manual: openat() can be used for per-thread "current working directory": first fd for dir is opened and than used to open file in that dir: int openat(int dirfd, const char *pathname, int flags); 20:26
geekosaur good luck with portability 20:28
Woodi_ there is also int openat(int dirfd, const char *pathname, int flags, mode_t mode); but how they do that in C ??
geekosaur it's a syscall
you're passing a context to the kernel's namei() for path resolution
Woodi_ geekosaur: it's _POSIX_C_SOURCE >= 200809L :)
geekosaur pretty sure it's *optional* in POSIX 20:29
Woodi_ geekosaur: not so bad with portability, IMO stackoverflow.com/questions/1670135...ort-openat 20:33
geekosaur ...and how bout windows? 20:34
Woodi_ here is some "way" stackoverflow.com/questions/3213852...-of-openat 20:38
Woodi_ geekosaur: above I asked how they make two functions with same name but different params count... you probably answered about something else... 20:40
geekosaur oh, you mean mode_t? it's always passed to the kernel but only used if you are creating a file, so they're cheating 20:41
it passes "garbage" (either the frame pointer or part of a local variable --- but the ABI ensures there's always *something* there so it can't trap) if you leave it off 20:42
Woodi_ I was hoping it's just macro :) 20:43
geekosaur this would be considered bad form but it's how the open*() functions in C have always worked so they just accept the poor design as something too embedded to change
varargs macros are even worse... 20:45
IOninja wooooooooooooo fancy pants: perl6.vip/ 20:49
[Coke] has concerns about new perl 6 branding 20:53
looks shiny, though!
lesse, 4/15, I'll be safely in my new job and maybe able to perl6 again. :) 20:54
moritz looks forward to it
IOninja [Coke]: what concerns? 20:57
geekosaur oh also C compilers in pedantic mode will warn if you leave off the parameter. (see also fcntl() which has the same behavior, get operations ignore the 3rd parameter but set-s require it) 20:58
(C compiler developers *hate* this ancient-C-ism...)
[Coke] IOninja: well, not knowing anything about what it is, is it really a "rakudo" thing, etc. 20:59
I know you're good about that sort of thing, so am not as worried as I could be. :)
geekosaur apologizes for delays, 2 CL games on here :p
(plus it means I get to play nanny for a soccer-related irc channel) 21:00
IOninja [Coke]: yeah, it'a really a rakudo thing. But no one knows what Rakudo is so I deliberately violating the distinction 21:02
moritz should I be seeing more than a logo and a date on that site? 21:03
IOninja nope
moritz ok 21:04
[Coke] IOninja: If you know you're deliberately not labelling something rakudo that is rakudo, you might want to get buyin first. 21:10
[Coke] because I am sure you're going to have to have that conversation after the fact with some folks. 21:10
IOninja [Coke], what's a buyin? 21:12
moritz buy-in?
IOninja what's a buy-in?
[Coke] agreement.
"I buy in to your argument."
[Coke] sorry for the amerenglish. 21:12
IOninja What sort of agreement? I do not intend to break amy licensing requirements. 21:13
[Coke] IOninja: well, since I have no idea what you're doing, I can't really argue against it effectively. :) 21:14
but the community has tried hard to keep the distinction between the rakudo compiler and the language, as you know. If this confuses that, there will no doubt be disagreements to be had. That's all. I'm not suggesting you're violating any licenses. (because I don't know what you're doing. :) 21:15
anyway, shiny logo. 21:16
IOninja I mentioned it a few days ago. I'm making a decent Perl 6 release. 21:17
Rakudo Star that doesn't suck.
[Coke] -1 from me if it's not got Rakudo in the name.
(FWIW)
IOninja The community seems to be deadlocked to me about what the proper release should look like, so I'm doing my own thing. If people wanna use it, great, if not fine with me. 21:18
moritz IOninja: what's your vision for it? 21:18
IOninja 2017.04.15 21:21
IOninja &
moritz has long been toying with the idea of a more minimalistic distribution, something like rakudo + zef + maybe some docs
moritz but so far I haven't found the motivation/tuits/whatever to actually do it 21:21
jnthn IMO, so long as a distribution calls itself "X Perl 6" or "Perl 6 X" and it's not being obviously gratuitous with that (like "Official Perl 6" :P) then there's enough room to keep the compiler/langauge distinction clear. Especially if it's got some kinda description like "Includes the Rakudo Perl 6 compiler, docs, and a module installer" or whatever. 21:26
El_Che moritz: that's what I do for my debs/rpms (which I use in docker and on my machines) 21:28
[Coke] jnthn++ yup, that seems reasonable.
[Coke] IOninja++ # getting stuff done 21:38
gfldex AMD made us a CPU: „At 44 cores and 1866MHz, the Naples machine has twice as much memory bandwidth as the Xeon,“ 21:39
jnthn wonders how fast that'll spectest :) 21:40
gfldex will take another 3 month to find out, sadly 21:41
jnthn And then it's probably pretty costly 21:41
gfldex they can't be as costly as a Xeon 21:45
moritz are there even 44 core xeons? 21:48
gfldex no
TEttinger xeon phi, though 21:54
moritz TEttinger: is that like a mixture between a CPU and a GPU? 21:56
ingy Greetings...
moritz \o ingy 21:57
ingy Is this expected: gist.github.com/97279bfa8a3dfc44bf...7265ff229e
TEttinger moritz: the first iteration of it was, yes. the second came out june 2016, and is I believe a normal processor (CPU) 21:57
ingy Works fine when the say line is A) not broken B) broken after 2nd heredoc 21:57
moritz ingy: looks pretty much expected to me 21:58
TEttinger "Initially in the form of PCIe-based add-on cards, a second generation product, codenamed Knights Landing was announced in June 2013. These second generation chips could be used as a standalone CPU, not just as an add-in card."
gfldex ingy: what happens if you flip the order of the markers?
moritz ingy: heredocs start in the line after the q:to, so the second q:to is part of the heredoc contents 21:59
jnthn Won't the q:to"...", "Hi", 4; be quoted as part of the first heredoc?
Right, they're about line end, not statement end
ingy I read somewhere that the content parsing starts after a newline is found 22:00
oic now
ingy I didn't have a second statement 22:01
so no ; required
sorry my eyes were playing tricks on me
Geth doc: c9cce414a1 | (Wenzel P. P. Peppmeyer)++ | doc/Language/quoting.pod6
heredoc parsing is picky
22:02
perlpilot wonders what the P5 docs say about this 22:03
perlpilot not much apparently 22:04
"...and all lines following the current line down to the terminating string are the value of the item."
ingy when I broke after the 2nd marker, it ran, and I saw Hi and 4 printed and thought I could split the line there
but now I see what happened. sorry for the bother 22:05
as_ rakudo: say 4.roots; 22:06
camelia Too few positionals passed; expected 2 arguments but got 1
in block <unit> at <tmp> line 1
as_ rakudo: say 4.roots(2);
camelia (2+0i -2+2.44929359829471e-16i)
as_ I with Complex numbers use Rats :) 22:07
IOninja m: class RatComplex is Complex { has Rat $.im; has Rat $.re; }; dd RatComplex.new(4, 0).roots: 2 22:28
camelia (<2+0i>, <-2+2.44929359829471e-16i>).Seq
IOninja Close enough :P
naxieAlDle m: say -2.5e+99-2.8e+16i 22:29
camelia -2.5e+99-2.8e+16i
IOninja m: dd 4.0.atan2: 0.0 22:31
camelia 1.5707963267949e0
IOninja we'd need a ratty atan2
naxieAlDle huggable: Life, the Universe and Everything :is: -1.2e+34-5.6e+78i 22:33
huggable naxieAlDle, Added Life, the Universe and Everything as -1.2e+34-5.6e+78i
naxieAlDle oh… 22:34
huggable: Life, the Universe, and Everything :is: -1.2e+34-5.6e+78i
huggable naxieAlDle, Added Life, the Universe, and Everything as -1.2e+34-5.6e+78i
SmokeMachine can I bind a Proxy inside a Variable?
IOninja m: (42+0i).roots.say 22:35
camelia Too few positionals passed; expected 2 arguments but got 1
in block <unit> at <tmp> line 1
SmokeMachine m: my $v = Variable.new; $v.var := Proxy.new: FETCH => {42}, STORE => -> $value {}
camelia 5===SORRY!5=== Error while compiling <tmp>
Cannot use bind operator with this left-hand side
at <tmp>:1
------> 3ew: FETCH => {42}, STORE => -> $value {}7⏏5<EOL>
expecting any of:
postfix
22:35
IOninja naxieAlDle: what's it about?
naxieAlDle IOninja: nothing, just a number that scares the shit out of me 22:36
SmokeMachine better question: how can I, at compile time, set a variable to run a block and get its return as value at run time?
SmokeMachine m: our $val; ENTER {$val = 42}; multi trait_mod:<is>(Variable $a, :$qqq!) {$a.block.add_phaser("ENTER", {$a.var = $val})}; my $ext is qqq; say $ext # some thing like this (←) but the $val will be setted after ENTER... 22:45
camelia 42
SmokeMachine m: our $val = 42; multi trait_mod:<is>(Variable $a, :$qqq!) {$a.block.add_phaser("ENTER", {$a.var = $val})}; my $ext is qqq; say $ext # like this ← 22:47
camelia (Any)
ingy moritz, jnthn: were you aware that a heredoc terminator could have a newline in it? gist.github.com/5220054601da6323b4...e7900ce059 23:18
ingy wonders how that would play out on Win32 :) 23:19
IOninja works fine 23:23
IOninja ingy: I'll raise ya 23:25
m: say q:to/my $x = 42;␤say $x/␤Some␤ thing␤my $x = 42;␤say $x
camelia Some
thing
IOninja (bot changes ␤ to proper newline)
IOninja m: say q:to/␤say q:to「␤say q:to'␤heh␤'␤」/␤Hello, World!␤␤say q:to「␤say q:to'␤heh␤'␤」␤ 23:29
camelia Hello, World!
IOninja m: say q:to/z␤say q:to「␤say q:to'␤heh␤'␤」; my $x = 'AlexDaniel';␤say "Hi", $x.comb.pick(*);␤say ":D";␤my @a = "naxialeDile".comb.shift.pop.shuffle.squish.rand.say;␤say @a[*-$**];/␤Hi, naxieAlDle!␤z␤say q:to「␤say q:to'␤heh␤'␤」; my $x = 'AlexDaniel';␤say "Hi", $x.comb.pick(*);␤say ":D";␤my @a = "naxialeDile".comb.shift.pop.shuffle.squish.rand.say;␤say @a[*-$**];␤ 23:33
camelia Hi, naxieAlDle!
cschwenz so i have a variable, $info, and (via the magic of $info.perl) i have found it contains <anon|123456789098765>.new(key=>"value", ...) 23:36
how do i access the key/value pairs inside $info?
(as $info{"key"} does not work) 23:37
IOninja cschwenz: they're not keys. That's a class and those are attributes. Try `say $info.key` 23:38
m: class { has $.key = 'value' }.new.perl.say
camelia <anon|78142480>.new(key => "value")
cschwenz :facepalm: thanks! 23:39
IOninja m: class { has $.key = 'value' }.new.key.say
camelia value
IOninja Yesh, the `.perl` on those sucks ATM.
cschwenz i should go to bed and tackle this in the morning. :-P
IOninja m: class { has $.key = 'value' }.new.Capture{"key"}.say 23:40
camelia value
IOninja Magic :P 23:40