»ö« 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.
00:11 Cabanossi left, nadim left 00:13 Cabanossi joined
BenGoldberg s: (use NativeCall, CArray[Str]), "Array", \(); 00:20
SourceBaby BenGoldberg, Ehhh... I'm too scared to run that code.
BenGoldberg s: (use NativeCall, CArray[Str]), "Array", \()
SourceBaby BenGoldberg, Something's wrong: ␤ERR: ===SORRY!=== Error while compiling -e␤Confused␤at -e:6␤------> put sourcery( (use NativeCall<HERE>, CArray[Str]), "Array", \() )[1];␤
BenGoldberg s: (use NativeCall, CArray[Str]), "Array"
SourceBaby BenGoldberg, Something's wrong: ␤ERR: ===SORRY!=== Error while compiling -e␤Confused␤at -e:6␤------> put sourcery( (use NativeCall<HERE>, CArray[Str]), "Array" )[1];␤
BenGoldberg s: (use NativeCall, CArray), "Array"
SourceBaby BenGoldberg, Something's wrong: ␤ERR: ===SORRY!=== Error while compiling -e␤Confused␤at -e:6␤------> put sourcery( (use NativeCall<HERE>, CArray), "Array" )[1];␤
BenGoldberg s: (use NativeCall, CArray)[1], "Array"
SourceBaby BenGoldberg, Something's wrong: ␤ERR: ===SORRY!=== Error while compiling -e␤Confused␤at -e:6␤------> put sourcery( (use NativeCall<HERE>, CArray)[1], "Array" )[1];␤
BenGoldberg s: ((use NativeCall), CArray)[1], "Array"
SourceBaby BenGoldberg, Something's wrong: ␤ERR: Type check failed in binding to '&code'; expected Callable but got Method+{<anon|72771952>} (Method+{<anon|7277195...)␤ in sub do-sourcery at /home/zoffix/services/lib/CoreHackers-Sourcery/lib/CoreHackers/Sourcery.pm6 (CoreHackers::Sourcery) line 42␤ in sub sourcery at /home/zoffix/services/lib/CoreHackers-Sourcery/lib/CoreHackers/Sourcery.pm6 (CoreHackers::Sourcery) line 33␤ in block <unit> at -
BenGoldberg s: ((use NativeCall), CArray[Str])[1], "Array", () 00:21
SourceBaby BenGoldberg, Something's wrong: ␤ERR: Cannot resolve caller sourcery(NativeCall::Types::CArray[Str], Str, List); 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␤␤
BenGoldberg s: ((use NativeCall), CArray[Str])[1], "Array", \()
SourceBaby BenGoldberg, Sauce is at github.com/rakudo/rakudo/blob/e2db...Any.pm#L67
BenGoldberg huh. 00:22
huggable, pull
huggable BenGoldberg, nothing found
BenGoldberg huggable, pullrequest
huggable BenGoldberg, nothing found
BenGoldberg huggable, pull request
huggable BenGoldberg, nothing found
timotimo huggable: source
huggable timotimo, See github.com/zoffixznet/huggable
00:23 mcmillhj joined
timotimo BenGoldberg: ^ 00:23
BenGoldberg I know Huggable's just an info bot...
I was hoping someone had told him about how someone would make a request
timotimo SourceBaby: source 00:24
SourceBaby timotimo, See: github.com/zoffixznet/perl6-sourceable
BenGoldberg SourceBaby's not wrong about where .Array is defined, I was really just hoping CArray had it's own definition :P 00:25
BenGoldberg would like to do my CArray[Str] $foo = something_from_some_native_api(); my Str @bar = $foo.Array(:NULL-terminated);
00:27 mcmillhj left
SmokeMachine could, please, someone give a opinion? I am writing a dependency injector... github.com/FCO/Injector 00:28
BenGoldberg s: ((use NativeCall), CArray[Str])[1], "new", \()
SourceBaby BenGoldberg, Sauce is at github.com/rakudo/rakudo/blob/e2db...0EFEE885A1 (NativeCall::Types)#L173
00:28 zakharyas left, mcmillhj joined
SmokeMachine Id like to know if its something usable... 00:28
00:28 zakharyas joined
SmokeMachine example www.irccloud.com/pastebin/CwftCbgi/ 00:28
00:33 zakharyas left, mcmillhj left 00:34 travis-ci joined
travis-ci Doc build errored. Brian Duggan 'nbsp in Perl 6' 00:34
travis-ci.org/perl6/doc/builds/208703272 github.com/perl6/doc/compare/180e6...d359d43389
00:34 travis-ci left 00:39 bjz joined 00:40 ZzZombo left 00:42 ZzZombo joined 00:43 ZzZombo left, ZzZombo joined, ZzZombo is now known as Guest12768, Guest12768 is now known as ZzZombo 00:47 aborazmeh joined, aborazmeh left, aborazmeh joined
SmokeMachine Anyone? 00:47
BenGoldberg SmokeMachine, The real question is, would *you* use it? 00:49
And, I should add, would you enjoy using it ;) cause code which is painful is painful. 00:50
SmokeMachine BenGoldberg: I think I would... I just didn't need that yet... but I already needed stuff like that in other languages... 00:51
BenGoldberg: I really liked the way you use it... what did you think? 00:52
00:52 MilkmanDan left
BenGoldberg shrugs. 00:52
Programming is kindof a hobby for me -- a fun hobby, but I don't do it full time. 00:53
00:53 MilkmanDan joined 00:55 Cabanossi left 00:57 Cabanossi joined
IOninja SmokeMachine: I don't get what the point is. 01:00
01:01 lukaramu left
IOninja Well, other than job-security-by-making-your-code-unmaintainable. 01:01
01:01 mcmillhj joined 01:03 kyan joined 01:06 mcmillhj left
IOninja is a bundle of joy for everyone asking for code opinions o/ 01:10
You have a typo in method name: instanciate should be instantiate 01:11
SmokeMachine IOninja: thanks 01:16
IOninja: why do you think it makes the code unmantainable? 01:17
01:18 user___ joined
user___ hi 01:18
IOninja SmokeMachine: because after staring it for over a minute, I'm still not 100% sure wtf it's doing. :) 01:22
user___: \0
01:23 mcmillhj joined
IOninja SmokeMachine: like the bind thing... it affects everything that has `is injected`? That's massive action at a distance that will prove a nightmare to hunt down a bug in :/ 01:23
And I don't really get why havea separate bind thing instead of instantiating a class the way god that doesn't exist intended to? 01:24
user___ could i get some code examples for concurrency 01:26
ugexe lol
IOninja user___: sure. Anything specific?
user___: there's a bunch on : docs.perl6.org/language/concurrency
user___ nothing specific.am just a beginner 01:27
IOninja m: sleep 1 for ^4 .race: :batch; say now - INIT now; # 4 x 1 second sleeps; complete in 1 second.
camelia 1.0057828
user___ i looked through the documentation.could i get any concrete examples
IOninja user___: another decent things are this lighting talk: perl6.party/post/Perl-6-What-Progr...re-Is-Like 01:28
user___: this too: perl6.party/post/IRC-Client-Perl-6...IRC-Module
01:28 mcmillhj left
user___ Thanks much 01:28
IOninja This harness is all concurrent, if you don't mind wading through classes and grammar: github.com/rakudo/rakudo/blob/nom/lib/TAP.pm6 01:29
01:30 mcmillhj joined 01:34 mcmillhj left
SmokeMachine IOninja: that makes it easy to change for tests, for example... 01:39
IOninja fair enough 01:40
01:41 kyan left 01:42 skids joined
IOninja FWIW we also have examples.perl6.org/ never looked at it and unsure if it got any concurrency examples (that aren't bitrotten), but... there you go. 01:45
01:49 kyan joined 01:54 risou_awy is now known as risou, mr-foobar joined
SmokeMachine IOninja: I think the best way to explain whats my goal with the Injector is this: en.wikipedia.org/wiki/Dependency_injection 02:01
02:07 travis-ci joined
travis-ci Doc build errored. Zoffix Znet 'Revert "Make xt/space-after-commma.t report line numbers for failures" 02:07
travis-ci.org/perl6/doc/builds/208704152 github.com/perl6/doc/compare/6434c...15812df4ac
02:07 travis-ci left 02:11 Cabanossi left 02:13 Cabanossi joined 02:27 mr-foobar left 02:39 yqt left 02:45 ilbot3 left 02:46 bjz left 02:48 ilbot3 joined, ChanServ sets mode: +v ilbot3 02:50 travis-ci joined
travis-ci Doc build errored. Brian Duggan 'Spacing, Perl 6 vs Perl 6 (nbsp)' 02:50
travis-ci.org/perl6/doc/builds/208707448 github.com/perl6/doc/compare/11d35...9e364dfdc0
02:50 travis-ci left 03:04 cdg left 03:12 mr-foobar joined, aborazmeh left, noganex_ joined 03:16 noganex left
BenGoldberg m: log( Numeric.new xx 2 ); 03:18
camelia WARNINGS for <tmp>:
Useless use of "log( Numeric.new xx 2 )" in expression "log( Numeric.new xx 2 )" in sink context (line 1)
BenGoldberg m: log( Numeric.new xx 2 ).say;
camelia 0.693147180559945
BenGoldberg m: log( Numeric.new, Numeric.new ).say;
camelia Cannot resolve caller log(Numeric: ); none of these signatures match:
(Numeric:D $: Cool $base, *%_)
(Numeric:D $: Numeric $base, *%_)
in block <unit> at <tmp> line 1
03:23 xtreak joined 03:32 bjz joined
SmokeMachine IOninja: a little more complete example: github.com/FCO/Injector/tree/master/examples 03:37
sammers Hi #perl6 03:43
SmokeMachine BenGoldberg: a little more complete example: github.com/FCO/Injector/tree/master/examples 03:44
03:45 drrho left 03:46 bjz left, drrho joined
sammers is there any way to iterate all params passed to a sub? e.g. sub foo(:$n1, $n2) { params.map: ... } ? 03:49
SmokeMachine m: sub bla($a, :$b) {}; say&bla.signature.params 03:52
camelia 5===SORRY!5=== Error while compiling <tmp>
A list operator such as "say" must have whitespace before its arguments (or use parens)
at <tmp>:1
------> 3sub bla($a, :$b) {}; say7⏏5&bla.signature.params
expecting any of:
argu…
03:52 bjz joined
SmokeMachine m: sub bla($a, :$b) {}; say &bla.signature.params 03:52
camelia ($a :$b)
SmokeMachine m: sub bla($a, :$b) {}; .say for &bla.signature.params 03:53
camelia $a
:$b
SmokeMachine sammers: 👆 03:54
03:54 labster left 03:55 user___ left
naxieAlDle m: sub foo(*@all ($a, $b, $c)) { say $a; say $b; say $c; dd @all }; foo 42, 43, 44 03:56
camelia 42
43
44
[42, 43, 44]
naxieAlDle sammers: what about this? ↑
03:56 Cabanossi left
sammers hmm, I am trying to iterate on all passed named params from inside the sub. I could use a capture, but I want to put type constraints on the named params. 03:57
03:57 labster joined, Cabanossi joined
naxieAlDle m: sub foo(*%all) { dd %all }; foo a => 44, b => 45 03:58
camelia {:a(44), :b(45)}
naxieAlDle ?
ah
m: sub foo(*%all (:$a, :$b)) { dd %all }; foo a => 42, b => 44
camelia {:a(42), :b(44)}
sammers m: sub bla($a, :$b) { say &?BLOCK.signature.params }; bla(123, b => "I am b");
camelia ($a :$b)
03:59 bjz left
sammers I guess I can use &?BLOCK 03:59
03:59 wamba joined
naxieAlDle sammers: so what's wrong with my last solution? 03:59
sammers m: sub foo(*%all (Int :$a, Str :$b)) { dd %all }; foo a => 42, b => 'string' 04:01
camelia {:a(42), :b("string")}
sammers m: sub foo(*%all (Int :$a, Str :$b)) { dd %all }; foo a => 42, b => 123
camelia Type check failed in binding to '$b'; expected Str but got Int (123)
in sub foo at <tmp> line 1
in block <unit> at <tmp> line 1
sammers yeah, that should work
naxieAlDle, that solution is just what I was looking for. thanks. 04:04
04:06 travis-ci joined
travis-ci Doc build errored. Brian Duggan 'added back lexicographically 04:06
travis-ci.org/perl6/doc/builds/208709101 github.com/perl6/doc/compare/379e3...393c3aa801
04:06 travis-ci left 04:12 naxieAlDle left
skids is $*LANG.define_slang supposed to be fully functional, or just a future feature that turns off warnings for now? 04:13
because it doesn't work if I don't use the "old way" nqp::bindkey(%*LANG) 04:14
04:33 perlawhirl joined
TimToady it's supposed to be fully functional, but for now you probably want both the old way and the new way in a try, so that old versions still work 04:34
(as it's currently written in Tuxic)
are you also setting any actions? 04:35
or just grammar?
skids actions. 04:37
module Control::Bail... the new code is committed.
TimToady and what is the failure mode if you just use define_slang? maybe it's getting confused in a subsequent 'use'?
skids I get both the warning, and none of my tokens are recognized. 04:38
TimToady is there a 'use' in your test after you use Control::Bail? 04:39
maybe a subsequent use is setting it back the wrong way...
skids no, there's a use Test above it, nothing after.
TimToady well, have to drive off, but I'll try to glare at it later 04:40
skids Thanks. Also trying to fix tadzik's Grammar::BNF... that's got some additional challenges. 04:41
perlawhirl hi perlers 04:44
does any have a nice idiom to get from ({a => 'foo'}, {a => 'bar'}, {b => 'baz'}) to {a => ['foo', 'bar'], b => ['baz']} 04:45
m: say ({a => 'foo'}, {a => 'bar'}, {b => 'baz'}).classify(*.keys).map({.key => .value».values.flat }
camelia 5===SORRY!5=== Error while compiling <tmp>
Unable to parse expression in argument list; couldn't find final ')'
at <tmp>:1
------> 3keys).map({.key => .value».values.flat }7⏏5<EOL>
expecting any of:
postfix
perlawhirl m: say ({a => 'foo'}, {a => 'bar'}, {b => 'baz'}).classify(*.keys).map({.key => .value».values.flat })
camelia (b => (baz) a => (foo bar))
perlawhirl something like that
04:48 movl left
skids m: my %a; %a.push($_) for ({a => "foo"}, {a => "bar"}, {b => "baz"}); %a.say 04:48
camelia {a => [foo bar], b => baz}
perlawhirl skids: ahh, much nicer. thanks 04:49
MasterDuke what about classify-list?
perlawhirl yeah i haven't played with it much, I know it got some work last year... but i haven't had time to see what i can do with it 04:50
but i was thinking maybe it could help
i really like the classify/categorize stuff
04:54 bjz joined 04:56 Cabanossi left 04:57 Cabanossi joined 05:01 movl joined 05:04 wamba left 05:06 mst left, mst joined 05:21 xtreak left 05:22 bjz left 05:23 astj_ joined, astj left 05:24 xtreak joined, BenGoldberg left 05:32 mcmillhj joined 05:33 bjz joined 05:54 CIAvash joined 05:55 Cabanossi left 05:57 Cabanossi joined, curan joined 06:09 mcmillhj left 06:11 mcmillhj joined, perlawhirl left 06:13 wamba joined 06:16 mcmillhj left 06:20 ZzZombo_ joined 06:21 ZzZombo left 06:33 mcmillhj joined 06:34 ZzZombo_ left 06:38 mcmillhj left 06:41 wamba left 06:49 RabidGravy joined 06:52 domidumont joined 06:55 mcmillhj joined, mr-foobar left 06:59 Todd joined
Todd Hi All, 06:59
07:00 mcmillhj left
Todd Anyone know of a way to use github.com/slobo/Perl6-X11-Xlib-Ra...r/examples 07:00
github.com/slobo/Perl6-X11-Xlib-Raw
to read and write to both of the X11 clipboards ("clipboard" and "primary")?
07:01 mcmillhj joined
Todd I am trying to avoid xclip 07:02
Here is a far easier one. I am trying to print out the name of the sub I am in. 07:07
print &?ROUTINE ~ " " ~ "$*DISTRO $OS found\n";
<unit> rhel linux found 07:08
&?ROUTINE resolves to <unit>, which is not the name of the sub. What am I missing?
07:09 mcmillhj left
Todd This is the reference I am using for the variables: docs.perl6.org/language/variables#...%3FROUTINE 07:09
07:15 mcmillhj joined 07:16 skids left, eroux joined 07:20 mcmillhj left 07:28 ambs left 07:29 ambs joined 07:35 bjz left 07:37 xtreak left 07:38 bjz joined, mcmillhj joined 07:39 xtreak joined 07:43 mcmillhj left 07:51 shmibs left
TimToady m: sub foo { say &?ROUTINE.name }; foo 07:52
camelia foo
07:52 wamba joined 08:00 mcmillhj joined 08:04 jonas1 joined, mcmillhj left
Todd say &?ROUTINE.name still prints out "<unit>". What am I missing? 08:07
moritz Todd: maybe you're calling it from outside a routine? 08:08
Todd double checking: print &?ROUTINE.name ~ " " ~ "$*DISTRO $OS found\n";
It is inside a sub. Is "sub" and "routine" the same thing here?
moritz a "sub" is a kind of "routine"
Todd How does it get "<unit>" from "sub OS_Check () {do something}"? 08:12
moritz Todd: dunno; care to post a short snippet that reproduces the problem?
using a nopaste service 08:13
Todd sure, let me write something up that is shorter 08:14
08:14 eroux left, rindolf joined 08:15 shmibs joined
Todd Just out of curiouslity, is it a good idea to always include "use v6;" as the second line of your code? 08:15
moritz yes
Todd what do you mean by "nopaste service"
?
TimToady skids, you want something like: gist.github.com/TimToady/df87901b8...5240bcf77d 08:16
.tell skids you want something like gist.github.com/TimToady/df87901b8...5240bcf77d
yoleaux TimToady: I'll pass your message to skids.
moritz Todd: something like pastebin.com/ that lets you paste mulitple lines of code, and share the URL here in the channel 08:17
TimToady ^^ that's a no-paste
Todd is three lines to much to paste here?
moritz right, gist.github.com is a very popular service here
TimToady three is usually okayish
Todd and my three liner work, so I will hit my glasses and find my booboo. 08:19
TimToady Todd: notice I used &?Routine. name above
samcv m: sub thingy { say &?Routine }; thingy
camelia 5===SORRY!5=== Error while compiling <tmp>
Undeclared name:
?Routine used at line 1. Did you mean 'Routine'?
TimToady er, &?ROUTINE.name 08:20
samcv m: sub thingy { say &?Routine.name }; thingy
camelia 5===SORRY!5=== Error while compiling <tmp>
Undeclared name:
?Routine used at line 1. Did you mean 'Routine'?
Todd Any feedback of "use v6;"? My first line is "#!/usr/bin/perl6", but I sometimes write for Windows
08:20 eroux joined
TimToady you already got email for that 08:20
samcv Todd, i usually only use `use v6;` for .t files
08:20 movl left
samcv and then use .p6 for scripts and .pm6 for modules 08:21
pl6 is another possible thing you can do but I like .p6 personally
Todd I have been using .pl6 08:22
samcv what editor are you using?
Todd On windows programs, I call the program with "perl6 program_name", so I don't see that there would be confusion. Plus p6 code crashed the dickens out of a Perl5 08:23
samcv heh 08:24
Todd on Linux, I use vi, leafpad, and increadingly "geany". On Windows I use "geany" as it is the most friendly over "ssh -X". On geany, I turn off the tabs function, as it is ANNOYING. 08:25
moritz use v6; helps generating a good error message if you accidentally run it with p5
samcv Todd, theoretically perl 5 is supposed to use perl6 instead if it sees `use v6` but it does not work that consistently for me. and setting `#!/usr/bin/env perl6` as first line *used* to make `prove` use perl6 for the .t files, but now it doesn't
use v6 is only important if the extension is pl or pm I think 08:26
Todd, if you want to try out Atom which is for windows, mac and linux there's a good page on configuring it for perl 6 github.com/perl6/Atom-as-a-Perl6-IDE 08:27
moritz, do you have the power to give me admin privs for that repo? 08:28
moritz samcv: I think so, let me check
Todd How is atom over "ssh -X"?
samcv uh it might be bad
08:29 eroux left
moritz samcv: you should have admin now; please check 08:29
samcv you could maybe try some way to sync files
Todd On another subject, I wrote tons in Modula2 many, many years ago. I am adicted to Top Down. And, I have a piece of code I really want to make into a module.
I am confused as to the name of the module. In perl 5 , it is the first line "package Package_Name; "a 08:30
samcv thanks moritz
Todd how is this doem it perl 6? does it take on the name of the file?
done, not doem 08:31
samcv well you don't have to do that for perl 6 modules, it can just do it by filename
but Todd docs.perl6.org/language/modules#UNIT::EXPORT::* see the `unit module` part
you can do that if you wish
and it only exports subs if you do like `sub foo ($one, $two) is export {…}` 08:32
unless you do more work as that documentation says
08:32 mcmillhj joined
Todd I have been looking at that section for a few days now. I "almost" understand it 08:34
Here is what I am missing. If I name the module "GreatStuff.pm6", how does the importer know to find this module? 08:35
samcv by the file name if it is not an installed module 08:36
you'll use `use GreatStuff`
Todd "use GreatStuff.pm6"?
samcv i believe that also works too Todd
moritz without the .pm6
samcv but i don't include the extension though
but i think `use 'GreatStuff.pm6'` does work with quotes or something
moritz Todd: btw Perl 5 also uses only the file name to locate the module file
Todd: it just then messes up if the file it found doesn't declare the package of the appropriate name 08:37
08:37 mcmillhj left
samcv installed modules on perl 6 use sha1 hashes and this allows you to load modules that are different versions and ones by different authors 08:37
Todd by chance is the default ".pm"? Can this be over ridden?
moritz it looks for both .pm6 and .pm files
samcv whose default?
^
08:38 abraxxa left
Todd "use GreatStuff" implies "use GreatStuff.pm". If I name the module with a weird extension, can the default bve over ridden, or do I need to stick with .pm of .pm6? 08:39
or not of
samcv well if you don't use a default extension, then do `use 'GreatStuff.weirdext';`
Todd Okay, that explains it. 08:40
moritz but don't do that. 08:41
Todd Is "lib" the same in p6 as p5 for my non standard locations?
samcv yep Todd
08:41 abraxxa joined
moritz design.perl6.org/S11.html "When you pass a string, require always assumes the string contains a filename. To specify both a module name and a filename, use a colonpair modifier: require Sense:file("/home/non/Sense.pm") <common @horse>;" 08:41
samcv actually getting error for doing `use 'extthing.pm6'` with quotes. maybe it's require that allows
moritz I don't think use supports it 08:42
samcv yeah i vaguely remember that
Todd Oh no, I will stick with .pm6. the question was just to help me understand it.
samcv no problem Todd
Todd I have a bunch of p5 moduels kicking around and I wanted to keep things separate
08:43 mcmillhj joined
Todd yum is churning away lookig for "atom". And it foudn one at "nux" repo. I will install it. 08:45
samcv Todd, i would just install it from rpm from their site 08:46
Todd I found with geany, that I couldn't use "=pod" like multiline quotes as I lost me colors, but swithing to #`{} multiline quotes filed it goose
samcv the distro ones often don't work well because they don't have the right versions of dependencies
Todd, i am the lead dev for the perl 6 highlighting for atom, and it's really good :) you shouldn't have any of those issues :) 08:47
Todd, you can get an rpm here atom.io/
Todd Thank you!
samcv you're welcome :) 08:48
08:48 mcmillhj left
Todd I spoofed my User Agent and got teh win32 versio too. 08:49
github.com/slobo/Perl6-X11-Xlib-Raw
08:50 abraxxa left, abraxxa joined
Todd Anyone know how to use this to read and write to both of X11's clipboards? 08:50
Hi samcv, have you tried it over "ssh -X"? yet? 08:51
samcv nope
moritz Todd: please don't just repost your questions from earlier; that's rather annoying 08:52
Todd Sorry, it scrolled over my page 08:53
08:54 araujo joined
Todd Samcv! How are you reading and writing to the X11 clipboards in Atom? Do you have a module? 08:54
samcv uh i just copy and press Ctrl + C
err i mean i select and then press ctrl + c
08:54 mcmillhj joined
moritz atom is based on some chromium-based toolkit (electron) which handles copy and pasting 08:55
Todd There goes digging though the source code. Rats!
08:56 wamba left
samcv Todd, you're building something to interact with X11 pastneboard right? 08:58
primary and secondary?
08:59 mcmillhj left 09:00 wamba joined, xtreak left
Todd "clipboard" (ctrl c-v) and "primary" (highlight and center click). No one uses "secondary" (double click, turn blue, paste at cursor) any more. I have code already for this, but is uses a shell call to "xclip". I wanted to get rid of "xclip". Also the OS::Clipboard out on github support the wrong clipboard. 09:00
samcv but secondary is what ctrl + c does 09:01
you say nobody uses it?
you want primary though right? the one usually done with middle click
Todd, I would look at the source of the terminal `st` it supports that function 09:02
and it's not very many lines of code
Todd is "st" the name of a program? 09:03
samcv yep
st.suckless.org/
Todd my ssh is sheading some tears transfering 86 meg of atom code to a remote computer 09:04
I really want to test it under ssh -X 09:05
samcv you could just try it under windows
heh
why not just download it useing curl or wget
instead of transfering the binary over ssh
Todd "suckless" hmmmm. There has to be a jab at WIndows there somewhere, not just xterm
samcv st is the only thing that properly renders unicode to conform to the grid 09:06
i have tried like 10 other terminals and they all have the issue that sometimes a symbol is too big or too wide and it alters the alignment of other text
but i usually use konsole because it's more comfortable than st. st doesn't even have scrolling unless you apply a patch :o 09:07
but i have that patch. but it may be interesting to see how it does pasteboard
Todd I am on git but not finding the source code. It must be getting late. Bet it is written in C, wich I can barely read
samcv it's not on github 09:08
oh i see what you mean
09:09 eroux joined
Todd git clone git://git.suckless.org/st ???? 09:09
samcv git clone git://git.suckless.org/st
try that
ya
i remember checking it out before at least
Todd If it is in C, I am dead
samcv lol. I know C 09:10
at first i thought you were going to want to do something with NativeCall or something
idk maybe there's a C library for clipboard but i'm not sure
Todd C: en.wikipedia.org/wiki/Tic 09:11
Well that is what usually happens to me when I read C
Apparently the X11 clipboards get imporved under Wayland, but Wayland still has the X11 hooks 09:13
I jsut realized one of my confusions on module names. "use OS::Clipboard" is really "...OS/Clipboard.pm". Is P6 converting "::" into "/" when it looks for the modules file? 09:21
09:22 eroux left
Todd Do I presume correctly that the purpose of "::" is to create subcatagories? 09:25
samcv yes Todd 09:26
that is one common use of it
Todd I get it now. I was thinking the "::" had some special function. Thank you!
TimToady .tell skids With 44b60a560d that I just checked in, you should be able to work with just the .define_slang, if you don't care to support old versions. note that you do still have to do the mixins; you can't just pass bare roles to .define_slang, though maybe we could support that...
yoleaux TimToady: I'll pass your message to skids.
Todd I am about to fire up Atom of ssh -X 09:27
over not of 09:28
well, it 55 seconds to make contact with me. Geany only takes about 10 seconds. Atom is still painting too. Atom may be a bit too rich for ssh -X. Rats! Thank you for the tip anyway! I can always use it over xrdp 09:35
it is like watching paint peal waiting for it to paint. I had to go into <ctrl><alt><f2> and kill the ssh process 09:39
09:39 xtreak joined 09:42 dakkar joined 09:45 cibs left 09:47 cibs joined
moritz or just use <return>~. 09:48
(to kill an ssh session)
09:54 cibs left 09:55 cibs joined
Todd question on modules. I want two conditions to be met before my module will work. Both are subs that check for os version and such. 09:55
Do I have to run these each time from the subs "as export" or is the a one time initialization that can be run ? 09:56
moritz there's an INIT phaser for that, I think
Todd there a one time 09:57
searched through docs.perl6.org/language/modules#UNIT::EXPORT::* for INIT and nothing turned up 09:58
moritz because it has nothing to do with exporting 09:59
it runs each time a piece of code is loaded at run time
Todd found docs.perl6.org/syntax/INIT, but I have no clue how to use it in my module
so, in my module, do I need to run the dependancies every time an "as export" sub is called? 10:01
moritz INIT { check your stuff here, die() if they are not fulfilled)
Todd okay, where, at the bottom of my module or up top with the "use xxx" stuff? 10:02
10:02 TEttinger left
Todd something like 10:05
if not INIT { OS_Check or exit 1 };
?
10:06 eroux joined 10:12 shdb joined 10:21 mcmillhj joined
moritz not "if not INIT {... }" 10:23
INIT { unless dependencies-met() { die "you're f'd" } }
Todd beautiful. thank you! I die with "Cowardly exiting. Bummer dude!". Your's gets to the point sooner. Mine is funnier. 10:24
Where do I put the INIT? 10:25
10:26 mcmillhj left
moritz in the mainline of the module 10:26
10:27 bjz left
Todd I am to much of a beginner to understand what that means 10:27
moritz not inside a subroutine
just inside the module itself
Todd so top, bottom or anywhere, just not inside a sub? 10:29
10:30 cyphase left 10:31 cyphase joined 10:32 parv joined 10:33 bjz joined, mcmillhj joined
Todd got to call it a night. Thank you for all the help! 10:36
10:36 Todd left 10:38 mcmillhj left, parv left 10:39 parv joined 10:42 xtreak left
IOninja samcv: what was the atom IDE thing you had? 10:43
samcv github.com/perl6/Atom-as-a-Perl6-IDE 10:44
IOninja Thanks
huggable: atom idea
huggable IOninja, nothing found
IOninja huggable: atom ide
huggable IOninja, nothing found
IOninja huggable: atom ide :is: github.com/perl6/Atom-as-a-Perl6-IDE
huggable IOninja, Added atom ide as github.com/perl6/Atom-as-a-Perl6-IDE
samcv this is one of my favs github.com/perl6/Atom-as-a-Perl6-I...-operators
10:49 skids joined 10:50 astj_ left, risou is now known as risou_awy, astj joined 11:00 salva left 11:01 salva joined, salva left 11:02 salva joined 11:03 astj left, astj joined 11:06 mcmillhj joined 11:07 cibs left 11:08 astj left, cibs joined 11:11 mcmillhj left 11:13 astj joined 11:14 grondilu_ left, grondilu joined 11:15 eroux left 11:16 skids left, bjz left 11:19 xtreak joined 11:20 eroux joined 11:22 bjz joined 11:23 labster left
tbrowder hi #perl6 11:25
DrForr o/
tbrowder IOninja: just to close concern and prev discussion of posix time command... 11:26
hi, DrForr! 11:27
11:27 mcmillhj joined
IOninja posix time command... what? 11:28
tbrowder the man page for time is lengthy, and i kept missing the first few words that state all output goes to stderr! quite unusual to me. anyway, after i started using the :err sdverb, all output was captured using run routine instead of using shell 11:29
11:30 skids joined
tbrowder the discussion centered around why i couldn't capture output from the system time using p6 run or shell 11:31
11:32 mcmillhj left
IOninja No, you said you were capturing `ps apache` 11:32
tbrowder that was something slightly different... 11:33
11:34 lukaramu joined
tbrowder anyway, the p6 run routine seems to work just fine. 11:34
11:35 robertle joined 11:36 eroux left, lizmat joined 11:37 wamba left 11:40 xtreak left 11:45 xinming_ is now known as xinming 11:49 mcmillhj joined
tbrowder question on named params: what is the reliable way inside the sub to test for the presence of the param? a plain if or a defined or something else? 11:52
moritz tbrowder: do you really need to check for presence? 11:53
11:54 mcmillhj left
moritz if so, the only bullet-proof way is sub f(*%named) { if %named<arg>:exist { ... } } 11:56
but typically named arguments have a default anyway, and you only care if it's the default or not
so you do sub f(Bool :$really) { if $really { ... } }
11:59 raschipi joined
jnthn with is often useful here 12:00
tbrowder i'm trying to find the best way to handle my use case. i want the named param to have only certain values (a constraint) but i don't want a default value. the reason is for not confusing the user with a default value he won't understand in the context of the other choices.
jnthn (If it's not passed then it'll be undefined) 12:01
(Provided you don't supply a default)
tbrowder ok, then will an "if $arg" work or use "if $arg.defined"? 12:03
shdb hi 12:05
is there any way to get the source address and port from a received udp packet?
12:06 aborazmeh joined, aborazmeh left, aborazmeh joined
SmokeMachine How can I change/add the default value of a Parameter of the signature of a function? 12:08
shdb i'm using IO::Socket::Async.bind-udp and then whenever $socket.Supply -> $v { .. }
SmokeMachine m: multi trait_mod:<is>(Parameter:D $p, :$injected!) {$p.set_default("12345")}; sub bla($a is injected) {$a.say}; bla # something like this but that works 12:09
camelia 5===SORRY!5=== Error while compiling <tmp>
No such method 'set_default' for invocant of type 'Parameter'
at <tmp>:1
12:10 bjz left, parv left
shdb SmokeMachine: it should be sub bla($a = "lala") { say $a } 12:12
12:12 mxco86 joined 12:14 wamba joined 12:15 parv joined 12:18 parv left 12:20 risou_awy is now known as risou, naxieAlDle joined, eroux joined 12:22 mcmillhj joined
naxieAlDle IOninja++ 12:22
I don't use twitter, but I enjoy your feed
SmokeMachine shdb: yes, but I'd like to change it to inject a default... 12:24
shdb ah ok. my bad 12:26
12:26 lep_ left, araraloren joined
araraloren m: say "".split(';', :skip-empty).perl; say "".split(';').perl; 12:27
camelia ("",).Seq
("",).Seq
12:27 mcmillhj left
araraloren why first split result is not a empty Seq ? 12:28
12:28 lep-delete joined
SmokeMachine shdb: like what I do to Attributes and Variables: github.com/FCO/Injector 12:30
IOninja araraloren: at first glance looks like a bug. Please report it 12:32
huggable, rakudobug
huggable IOninja, Report bugs by emailing to [email@hidden.address]
araraloren hm, ok
DrForr 3 talks for YAPC::NA and ::EU. 12:33
IOninja s: '', 'split', \(';', :skip-empty)
SourceBaby IOninja, Sauce is at github.com/rakudo/rakudo/blob/44b6...r.pm#L1454
IOninja hm 12:34
yeah, I see it. The short-circuit for empty self stuffs self into return after checking for needle chars, but need to also check for skip empty 12:35
12:36 parv joined, parv left, risou is now known as risou_awy 12:39 sena_kun joined 12:41 firestar joined
lizmat please rakudobug and I'll fix it :-) 12:41
SmokeMachine Any way to add a default to a Parameter? 12:43
12:45 eroux left, mcmillhj joined
lizmat I only see a way with using NQP 12:46
araraloren Hm, I send a email to rakudobug, It reply [perl #130955] 12:47
synopsebot6 Link: rt.perl.org/rt3//Public/Bug/Displa...?id=130955
12:50 mcmillhj left
SmokeMachine lizmat: could you show me, please? 12:52
lizmat nqp::bindattr($parameter,Parameter,'$!default_value',42) 12:53
presumably, off the top of my head :-)
SmokeMachine lizmat: thanks! 12:55
lizmat jnthn: any reason why we shouldn't allow Parameter objects to have their default value set in HLL ? 12:56
12:59 mcmillhj joined 13:01 Sound joined
jnthn lizmat: Not really, could add a set_default 13:01
To go with the set_raw, set_rw, etc. 13:02
lizmat araraloren: github.com/rakudo/rakudo/commit/fc86084f06 13:03
13:04 mcmillhj left
araraloren lizmat, wonderful. 13:05
13:07 sena_kun left
Geth ecosystem: araraloren++ created pull request #305:
replace it with a **version** url
13:11
ecosystem: eb110ec77b | loren++ | META.list
replace with a **version** url (#305)
13:13
lizmat SmokeMachine: could you check if github.com/rakudo/rakudo/commit/d6c95ea452 makes life easier for you ? 13:14
13:16 eroux joined 13:20 sena_kun joined 13:21 naxieAlDle left 13:24 aborazmeh left 13:27 skids left 13:32 mcmillhj joined 13:33 lukaramu_ joined 13:34 cibs left 13:36 cibs joined 13:37 mcmillhj left, lukaramu left
rjbs- Camelia++ 13:39
IOninja \o/
13:40 rjbs- is now known as rjbs
DrForr Indeed. 13:43
13:46 Actualeyes left 13:51 mcmillhj joined 13:59 geekosaur left
SmokeMachine lizmat: I think thats perfect! thanks! 13:59
IOninja \o/
14:00 geekosaur joined
IOninja That'll probably make it possible what I long wanted to do, without a slang: assign defaults based on `//=` not on whether they were given by caller 14:00
14:01 risou_awy is now known as risou
IOninja m: multi trait_mod:<is>(Parameter:D $p, :$injected!) {$p.set_default("12345")}; sub bla($a is injected) {$a.say}; bla 14:02
camelia 5===SORRY!5=== Error while compiling <tmp>
Type check failed in binding to '$default'; expected Code but got Str ("12345")
at <tmp>:1
IOninja m: multi trait_mod:<is>(Parameter:D $p, :$injected!) {$p.set_default({"12345"})}; sub bla($a is injected) {$a.say}; bla
camelia 5===SORRY!5=== Error while compiling <tmp>
Calling bla() will never work with declared signature ($a = -> ;; $_? is raw { #`(Block|67516192) ... })
at <tmp>:1
------> 3"})}; sub bla($a is injected) {$a.say}; 7⏏5bla
IOninja mmkay then 14:03
SmokeMachine :( 14:07
not working? :(
m: multi trait_mod:<is>(Parameter:D $p, :$injected!) {$p.set_default({"12345"})}; sub bla($a is injected = "test") {$a.say}; bla 14:08
camelia test
SmokeMachine m: multi trait_mod:<is>(Parameter:D $p, :$injected!) {$p.set_default({"12345"})}; sub bla($a is injected) {$a.say}; bla
camelia 5===SORRY!5=== Error while compiling <tmp>
Calling bla() will never work with declared signature ($a = -> ;; $_? is raw { #`(Block|75761584) ... })
at <tmp>:1
------> 3"})}; sub bla($a is injected) {$a.say}; 7⏏5bla
lucs IOninja: Nice Perl 6 examples you're tweeting there. Any chance you could also link to a gist of them or something for too-lazy-to-retype folks like myself who would like to play with them? 14:13
IOninja makes no promises 14:14
lucs Thanks for considering it :)
IOninja What was the executable pastebin site? Like glot.io but without the ancient perl6 on it 14:15
14:16 wigner joined
IOninja tio.run 14:16
tio.run/#tO2Mv 14:18
(no easy URL to give straight to perl 6 bin :/)
gah, even that URL ain't proper :/ 14:19
Ahhh. that one's v2 alpha. Normal one is tio.run/nexus/perl6
14:22 curan left, eliasr joined 14:24 dj_goku left 14:35 dj_goku joined, dj_goku left, dj_goku joined, cibs left 14:37 cibs joined 14:38 wamba left 14:39 naxieAlDle joined
SmokeMachine m: multi trait_mod:<is>(Parameter:D $p, :$injected!) {$p.set_default({"12345"})}; sub bla($a is injected) {$a.say}; say &bla.arity 14:39
camelia 1
SmokeMachine m: multi trait_mod:<is>(Parameter:D $p, :$injected!) {$p.set_default({"12345"})}; sub bla($a is injected = 1) {$a.say}; say &bla.arity
camelia 0
SmokeMachine lizmat: if think its not updating the function/signature...
lizmat SmokeMachine: that would be the responsibility of the "is injected" trait 14:42
SmokeMachine lizmat: makes sense... thanks!
lizmat as arity is an attribute of the Signature
which is probably going to be tricky 14:43
SmokeMachine yes, I saw... the function's arity just calls the signature's arity...
lizmat as the Parameter object doesn't know to which Signature it belongs :-(
araraloren Is there any document about %?RESOURCES ? 14:46
SmokeMachine lizmat: :( 14:47
lizmat araraloren: S22:375 14:48
synopsebot6 Link: design.perl6.org/S22.html#line_375
14:49 Actualeyes joined, cdg joined
araraloren lizmat, thanks 14:49
SmokeMachine lizmat: shouldn't it know about the signature? 14:50
lizmat SmokeMachine: no, why? I mean, a Signature needs Parameter object, but a Parameter object doesn't need Signature 14:51
also: if a Parameter object would have a reference to a Signature, it couldn't be reused 14:52
Geth whateverable: 7698e6eb7b | (Aleks-Daniel Jakimenko-Aleksejev)++ | t/evalable.t
No hardcoded nickname in tests

Doesn't matter that much, but still.
whateverable: 8281f80d2a | (Aleks-Daniel Jakimenko-Aleksejev)++ | t/evalable.t
Fix tests that pass for no good reason

Because the output is same in each query, the test suite interprets the results incorrectly.
lizmat and finally: if it would have a reference to a Signature, neither of them would even be garbage collected
SmokeMachine lizmat: a Package needs Attribute object, not the opposite, but Attribute has a package Attribute...
14:54 firestar left
SmokeMachine m: Attribute.new.package.say 14:54
camelia Required named parameter 'name' not passed
in block <unit> at <tmp> line 1
lizmat so neither packages or attributes will ever be garbage collected
jnthn: is that assessment correct
?
SmokeMachine m: Attribute.new(:name<bla>).package.say
camelia Required named parameter 'type' not passed
in block <unit> at <tmp> line 1
SmokeMachine m: class C {has $.a}.^attributes[0].package.say 14:55
camelia (C)
15:06 TeamBlast joined 15:11 unicodable6 left, unicodable6 joined, ChanServ sets mode: +v unicodable6
tbrowder jnthn: ref named params, i would like to have a constraint on a named param but i can't seem to do that and not use the named param in the sub call. my test code is at github gist <gist.github.com/tbrowder/62e228377...ef8fe>. what am i doing wrong? thanks. 15:15
timotimo tbrowder: you have to make sure it returns True when $fmt.defined is false 15:17
otherwise it'll reject it, right?
tbrowder hm, let me try that...
15:18 eroux left 15:21 leedo joined
tbrowder timotimo: i have tried various ways to mod the constraint but i get exceptions. can you mod the gist code so it works? 15:21
timotimo i can try 15:22
let's see ...
15:22 leedo left
IOninja Dunno what you're trying to do, but... 15:22
buggable: eco subset::helper
buggable IOninja, Subset::Helper 'create awesome subsets': github.com/zoffixznet/perl6-Subset-Helper
timotimo timo@schmand /tmp> perl6 test-param.p6 15:23
fmt = undefined
is that the output you want?
IOninja should work with in-param whereclauses as well
tbrowder yes! can you show the code, please?
timotimo i literally just put "else { True }" in there
15:25 risou is now known as risou_awy
tbrowder ah! that works..thanks! sounds like a good entry for the docs, no? 15:25
IOninja you've just over-complicated your code... 15:26
tbrowder also, shouldn't rakudo do that by default? 15:27
IOninja { $fmt.defined.not or $fmt ~~ &fmt }
No, it shouldn't. You're returning an Empty from your where clause which is a failed type check
tbrowder IOninja, okay, better but not so obvious to a noob... 15:28
IOninja You just never asked yourself what your where clause is returning... 15:29
Even if you don't know that lone failed `if` returns an Empty, you can see there's "nothing" returnedb :/ 15:30
tbrowder got it, thanks a heap timotimo and IOninja! 15:31
i'll take a closer look at the docs... 15:32
btw, this is a bit shorter: "!$fmt.defined || $fmt ~~ &fmt" 15:37
IOninja $fmt andthen $_ ~~ &fmt 15:38
15:38 bdmatatu joined
IOninja oh nevermind 15:38
15:39 naxieAlDle left
timotimo not quite, no 15:39
maybe "notandthen" ;)
IOninja nope
15:39 mcmillhj left
IOninja `subset-is {$_ ~~ &fmt}` 15:39
shortest :)
timotimo the what now :) 15:40
is that built-in?
IOninja buggable: eco subset::helper
buggable IOninja, Subset::Helper 'create awesome subsets': github.com/zoffixznet/perl6-Subset-Helper
timotimo ah
well, that makes sense :)
IOninja need to add `param-is` so it'd make more sense when used in where clauses on params 15:41
gregf_ tbrowder: i was kinda lost reading that code :|. whats token for please? 15:44
timotimo "token" is like "regex", but it turns on ratchet
IOninja Nurse Ratchet 15:46
gregf_ oh, ok. and ratchet?
ah - nevrmind 15:47
IOninja you know, like the slang :P
We try to stay hip and cool :P
gregf_ :D
IOninja tokens and rules don't backtrack. regexes do
15:47 wamba joined 15:56 rurban joined, bdmatatu left 15:57 eroux joined 15:58 rurban left 16:03 geekosaur left 16:04 geekosaur joined 16:07 cdg left 16:08 cdg joined 16:09 mcmillhj joined 16:15 Sound left 16:16 bwisti_ joined
tbrowder IOninja: subset helper looks cool. i'll have to try it. 16:16
are you addng param-is soon? 16:17
IOninja well, it'd be just a more readable alias for `subset-is` 16:18
16:20 bwisti_ left, bwisti_ joined 16:21 bwisti left, bwisti_ is now known as bwisti 16:30 araraloren left 16:35 wigner left 16:41 pukku joined
pukku Hi! In Perl 5, if you call die() and end your error with a newline ("\n"), it suppresses any line numbers, etc. How do I do the same in Perl 6? 16:45
16:45 itaipu joined
timotimo it really depends on what you want to have happen 16:45
do you want the "die" to let calling code catch it?
pukku I just want the program to die, printing the error message, but not the backtrace.
16:45 domidumont left
pukku Probably not? 16:46
IOninja pukku: note "some error"; exit
timotimo in that case you want note + exit(1) (or some other non-0 number)
pukku How do I choose the non-zero number?
timotimo anything your imagination lets you come up with
IOninja pukku: just use 1 if you're not sure.
timotimo i'm not sure what the maximum number is 16:47
IOninja 254, I'd imagine
pukku Hm.
16:48 st_elmo joined
IOninja pukku: the number is used by the program running your program to figure out why it existed abnormally 16:48
and if you don't want to tell anything other than "this is not a normal exit" then any number will do and may as well use 1 (that's what Perl 5's die returns) 16:49
pukku I understand that, but I guess I'm annoyed because this means I can't just "die() if $x"
jnthn If you're doing it a bunch just define a sub
sub conk($message) { note $message; exit 1 } 16:50
pukku Also, having exit separate from note is going to make the intent a little less obvious.
I guess I can do that. It does mean that every single Perl 6 program I write now has to have another bit of boiler-plate. But I guess there's nothing to do about it.
IOninja pukku: sure you can: "some error".note, exit 1 if 1
timotimo if you want you can 'note "omg" andthen exit 1 if $failure' 16:51
IOninja
.oO( make exit take a string to note()... )
16:54
SmokeMachine lizmat: only change the rarity didn't work... :( www.irccloud.com/pastebin/sky3GWnM/
perlpilot pukku: or ... you could provide a patch to die that implements a :no-backtrace named arg and see if it gets accepted. 16:55
IOninja That's a lot of typing...
pukku I'll look into that -- or maybe the change to exit IOninja suggested... 16:56
IOninja Also, I don't get how that'd work. IIRC die just does X::AdHoc.new("blah").throw
perlpilot pukku: Just remember "I guess there's nothing to do about it" doesn't really apply to Perl 6 ;-) 16:57
jnthn I'd probably not try and overload that behavior onto die
IOninja pukku: FWIW, I'd rather see a separate routine for that. Stuffing a string to note to exit has a bunch of problems, such as what if the user calls `exit <1>`? etc.
Best to keep it separate
perlpilot Has anyone done a carp-a-like for P6 yet?
IOninja carp-a-like? Isn't that the default behaviour for us? 16:58
perlpilot well ... carp, croak, confess, longmess, shortmess ... those are nice "hooks" for people who want custom behavior 16:59
IOninja
.oO( sub cry-and-die (Str $message, Int $exit-code = 1) { $message.note; exit $exit-code; }
)
perlpilot: ah, never used it for more than "Where the hell is the caller that causes this error" :) 17:00
17:05 xtreak joined
xtreak www.reddit.com/r/perl6/comments/5w...es/decbati . Thats 100k lines of Perl6 code. Any idea on the application and links to the code? 17:06
17:06 cdg_ joined 17:07 eroux left
timotimo i expect that might be RabidGravy? 17:09
IOninja xtreak: the person in question is RabidGravy. Maybe they can tell you. For the code, I just cloned github.com/moritz/perl6-all-modules in RabidGravy's author dir: github.com/moritz/perl6-all-module...athanstowe as I know most of the modules they wrote is to use at the radiostation to do something or other.
*and ran `wc` in author's dir 17:10
Lots of yakshaving there...
17:10 cdg left 17:11 cdg_ left, itaipu left, robertle left
xtreak IOninja Thanks. Just googled "Radio station Perl6" and got this perl6advent.wordpress.com/2015/12/16/ :) 17:12
IOninja haha, yeah, the author is RabidGravy 17:13
moritz tries to decide whether github.com/moritz/perl6-all-modules triggering a hilight in my IRC client is a bug or a feature 17:14
IOninja :) 17:15
pukku How do I push a pair onto an array? Or a simple hash? The following code doesn't do what I'm expecting... 17:19
if (%p{'tags'}.elems) { %post{'post_tags'} = { 'tags' => [] }; for %p{'tags'} -> $tag { %post{'post_tags'}{'tags'}.push: 'tag' => $tag; } } note %post{'post_tags'}.gist;
OK, that paste didn't work.
IOninja shudders at that code
pukku: use a proper pastebin like gist.github.com
pukku Basically, I want to wind up with %post = { post_tags => { tags => [ { 'tag' => 'foo'}, { 'tag' => 'bar' } ] } }; 17:20
IOninja pukku: %p{'tags'}.elems should %p{'tags'}:v.elems or ditch the Perl-5-ism and write it properly as %p<tags>:v.elems
moritz or just if %p<tags> { }
IOninja right 17:21
pukku But I wind up with %post = { post_tags => { tags => [ tag => [ 'foo', 'bar' ] ] } };
moritz pukku: there's nothing in your code to generate the inner hashes
pukku I tried "push({'tag' => $tag})", and that did the exact same thing.
I tried "push(:tag<$tag>)", also did the same thing. 17:22
moritz pukku: please post a small, self-contained example using a pastebin
17:23 itaipu joined
IOninja m: my %h; %h<foo><bar>.push: "foo$_" => "meow" for ^2; dd %h 17:24
camelia Hash %h = {:foo(${:bar($[:foo0("meow"), :foo1("meow")])})}
IOninja seems to work fine on small code
m: my %h; %h<foo><bar>.push: "foo" => "meow" for ^2; say %h
camelia {foo => {bar => [foo => meow foo => meow]}}
SmokeMachine m: sub bla($a) {}; &bla.wrap: -> | {}; bla # ←shouldn't it work? 17:25
camelia 5===SORRY!5=== Error while compiling <tmp>
Calling bla() will never work with declared signature ($a)
at <tmp>:1
------> 3sub bla($a) {}; &bla.wrap: -> | {}; 7⏏5bla # ←shouldn't it work?
pukku I'm working on creating a smaller reproducible thing...
moritz m: use soft; sub bla($a) {}; &bla.wrap: -> | {}; bla
camelia 5===SORRY!5=== Error while compiling <tmp>
Calling bla() will never work with declared signature ($a)
at <tmp>:1
------> 3ft; sub bla($a) {}; &bla.wrap: -> | {}; 7⏏5bla
SmokeMachine whats soft? 17:26
moritz SmokeMachine: wrapping happens at run time, but we do some types of dispatch checking at compile time 17:27
SmokeMachine: and I thought "use soft;" disabled those, but it doesn't seem to work
m: use soft *; sub bla($a) {}; &bla.wrap: -> | {}; bla
camelia 5===SORRY!5=== Error while compiling <tmp>
Calling bla() will never work with declared signature ($a)
at <tmp>:1
------> 3 *; sub bla($a) {}; &bla.wrap: -> | {}; 7⏏5bla
moritz m: use soft &bla; sub bla($a) {}; &bla.wrap: -> | {}; bla
camelia 5===SORRY!5=== Error while compiling <tmp>
Calling bla() will never work with declared signature ($a)
at <tmp>:1
------> 3la; sub bla($a) {}; &bla.wrap: -> | {}; 7⏏5bla
jnthn afaik, soft prevents inlining 17:28
17:28 xtreak left
jnthn But doesn't skip signature checks 17:28
IOninja m: sub bla($a) {}; &bla.wrap: -> | {}; EVAL 'bla'
camelia 5===SORRY!5=== Error while compiling EVAL_0
Calling bla() will never work with declared signature ($a)
at EVAL_0:1
------> 3<BOL>7⏏5bla
jnthn Also, .wrap doesn't change the outside signature of the routine 17:29
moritz oh, that's a better explanation :-)
IOninja :)
pukku OK, I figured it out. I apologize for the bother -- apparently I needed the ":v" on the topic of the for loop, in order to unwrap something? 17:30
TimToady m: sub bla($a) {}; &bla.wrap: -> | {}; bla |()
camelia ( no output )
TimToady m: sub bla($a) {}; &bla.wrap: -> | { say "gothere" }; bla |()
camelia gothere
IOninja cheater... 17:31
:)
timotimo is it "got here" or "go there"?
TimToady yes
pukku Is there a different way I should refer to an element in an array to unwrap it?
sorry, an element in a hash
moritz unwrap? 17:32
IOninja pukku: we still haven't seen your code and have no idea what you're even talking about.
17:32 bdmatatu joined
IOninja pukku: %h<non-existent-key>.elems will give you 1 because that lookup gives you Any and all things are 1-elem lists. %h<non-existent-key>:v.elems will give you 0, because that gives you a list of all the values and there ain't no such key, so the list is empty 17:33
Same applies to any other methods like .elems that treat Any things as 1-elem lists
pukku I'm having difficulty turning it into something that I can easily paste, as the data is coming from a JSON source on the internet, and I don't understand enough about how this is turned into a hash in Perl 6 to figure out how to mimic this in a literal.
timotimo you can just .perl it and copy that 17:34
IOninja m: sub bla($, $) {}; &bla.wrap: -> | { say "gothere" }; bla |() 17:35
camelia gothere
IOninja How come this works?
jnthn You never callsame 17:36
TimToady |() delays the arglist construction till runtime
IOninja Ah
jnthn oh, that also :)
moritz wow, TIL
jnthn mis-read :)
moritz these are times when I wonder if I'm the/a right person to write a book about Perl 6 :-) 17:37
IOninja m: sub bla($, $) {}; &bla.wrap: -> | { say "gothere" }; INIT bla |()
camelia Too few positionals passed; expected 2 arguments but got 0
in sub bla at <tmp> line 1
in block <unit> at <tmp> line 1
IOninja m: sub bla($, $) {}; &bla.wrap: -> | { say "gothere" }; LEAVE bla |()
camelia gothere
IOninja m: sub bla($, $) {}; &bla.wrap: -> | { say "gothere" }; END bla |()
camelia gothere
TimToady so you've proven that INIT happens before run time, but LEAVE and END happen after :) 17:38
IOninja :D
TimToady m: sub bla($, $) {}; INIT &bla.wrap: -> | { say "gothere" }; INIT bla |() 17:39
camelia gothere
IOninja Ohh, OK. Now I get it
TimToady m: sub bla($, $) {}; CHECK &bla.wrap: -> | { say "gothere" }; INIT bla |()
camelia gothere
pukku I have to run away for a bit, I'll come back in about an hour and ask for elucidation then. Sorry, but work calls... 17:41
17:43 mcmillhj left
SmokeMachine so, is that a rakudobug? 17:44
17:45 dakkar left
IOninja Nope 17:45
TimToady the absence of a time machine is not a bug
SmokeMachine doesn't that make wrap kind of useless? 17:46
17:47 cibs left
TimToady there are lots of ways to run a .wrap when you need to run it, as shown above, but we also don't support mind-reading 17:48
SmokeMachine ok...
moritz fwiw I've never used wrap in my own code
TimToady it's really in there for AOP and such
moritz maybe my mind isn't wired up to consider it as an option, or maybe I never needed it
17:49 cibs joined
TimToady people who rely on "before" and "after" in Moose tend to find it more in their brainspace 17:49
SmokeMachine I was trying to use that to inject default values into parameters of a function...
moritz just uses default values :-) 17:50
SmokeMachine moritz: Im writing a dependency injector...
TimToady or .assuming
SmokeMachine assuming! thanks TimToady !
moritz .assuming *is* in my tool belt :-) 17:51
SmokeMachine no... it will not "wrap" the function... :( 17:52
TimToady
.oO(never assume...)
17:53
moritz SmokeMachine: do you actually have to wrap it in-place?
SmokeMachine: I mean, you can offer both an "injected" and a "pristine" version of a function, no? 17:54
SmokeMachine moritz: but won't the function must be declared as multi?
17:54 robertle joined
moritz SmokeMachine: it could be a different name 17:55
SmokeMachine: or the "injected" version could live in a hash, or something
17:55 eroux joined
SmokeMachine moritz: I want to do the same I do with Attributes and Variables but with Parameters... github.com/FCO/Injector/blob/master/README.md 17:55
TimToady or you can define your own proto, if it's not in the same scope 17:56
SmokeMachine TimToady: its on the same scope... :( it should work as the original function...
17:57 mcmillhj joined
TimToady then you probably need to override the signature also at BEGIN time, wherever the compiler looks that up 17:58
SmokeMachine it would be perfect if the new Parameter::set_default change the signature...
TimToady doesn't know how to do the equivalent of recomposing the signature, offhand...maybe jnthn++ knows? 17:59
it's also quite possible I still haven't had enough coffee to think of the answer 18:00
It's even more likely that, given my age, there's no amount of coffee that will help me think of it... 18:01
SmokeMachine :) ☕️
18:01 mcmillhj left 18:02 domidumont joined
TimToady of course, I suppose I could deign to read the source code, but then, so could you :) 18:05
18:06 sufrostico left
SmokeMachine TimToady: :) I am! Thanks! 18:06
18:06 sufrosti2o left
IOninja I'd be interested in recomposing signatures too... 18:10
To fix: rt.perl.org/Ticket/Display.html?id=130891
I think if we could transplant signature of first routine onto returning routine, then things would work out.... 18:11
"in theory" :)
18:13 sufrostico joined
TimToady it has to be a modified signature, or the arity/count goes wrong when you add defaults 18:13
well, if you're adding defaults to positionals, I mean
18:13 mcmillhj joined 18:14 domidumont left 18:15 domidumont joined
TimToady or maybe we just need a way to tell the compiler, yes, I'm redefining it, and I know what I'm doing, so shutup 18:15
of course, how to refer to the previous definition when you're overriding its name is...interesting...since it's not OUTER 18:17
18:17 sufrostico left 18:19 kurahaupo__ joined 18:20 mcmillhj left 18:22 agentzh left
IOninja m: my \x = 42; dd &x # lulzwat? 18:22
camelia Nil
18:23 sufrostico joined 18:24 andrzejk_ joined, vendethiel left
raschipi What does x and &x have to do with one another? 18:25
18:25 risou_awy is now known as risou
IOninja What does the &() coercer do? 18:27
m: dd &(e)
camelia 2.71828182845905e0
18:27 mcmillhj joined
pukku Hi! I'm back. Here is some sample code: gist.github.com/remorse/f59c149c52...bf4a39b6ac . My question is, why do I require the ":v" to make this work? And is there a better way to handle this? 18:28
IOninja My eyes!
18:28 vendethiel joined
IOninja pukku: my earlier explanation applies. 18:29
18:29 sena_kun left
IOninja pukku: change `if (%p{'tags'}.elems) {` to `if %p<tags> {` and it'll work 18:29
pukku: this explanation: irclog.perlgeek.de/perl6/2017-03-08#i_14227779 18:30
Wow. I actually managed to fix RT130891.... But the fix is so hackish, I fear it gave me cancer... 18:31
synopsebot6 Link: rt.perl.org/rt3//Public/Bug/Displa...?id=130891
IOninja m: gist.github.com/zoffixznet/b227823...5749c17e18 18:32
18:32 mcmillhj left
camelia 36
46656
46656
2
2
2
2
18:32
pukku That still doesn't solve the problem of the tags being all one thing, instead of multiple elements. I've just updated the gist with the Perl 5 version of what I'm doing. Although now that I'm looking at it, I might be able to do something with map?
IOninja I don't even get how it works... I transplanted the signature so its count/arity are tweaked, but I'm still able to use the `|args` capture inside the transplant-receiving sub? This is some prime black magic sourcery. 18:33
pukku I guess the question I'm really asking is if there is a more explicit cast to array that I should use, instead of the ':v'.
(Also, there's a typo in the perl 5 version; it should be `scalar( $p->{'tags'}->@*)`) 18:34
IOninja pukku: dude, don't use :v; don't use casts. Several examples in the channel already showed you how to avoid both issues.
If you're still having issues provide proper snippet that shows the issue we can run and debug
pukku The examples have gotten rid of the .elems, but not the ':v'. The gist that I linked to is runnable, and shows the issue... 18:35
If I have to have the ':v' on the for loop, that's fine, but I'm confused about why... 18:36
18:36 mcmillhj joined
IOninja OK. Let me have a closer look. 18:37
pukku Also, I guess a question is, why is `%p<tags>` so different from `%p{'tags'}`? 18:38
IOninja pukku: and now it produces desired output? with the :v on the forloop?
pukku: it's (almost) the same thing. it's just much more readable
18:38 sufrosti1o joined
pukku OK, it did do that at one point, but now it doesn't, so I'm still confused. Hang on while I undo furiously... 18:39
IOninja pukku: what's post_tags? Do you control it? Is there a reason it's set to a string at the start? 18:40
pukku It's a string so that the (eventual) templating engine will suppress the tags stuff if there aren't any. 18:41
18:41 mcmillhj left, sufrostico left 18:42 risou is now known as risou_awy
IOninja m: gist.github.com/zoffixznet/f36dce0...30c13d80b6 18:43
camelia {:date-gmt("XXX"), :id("XXX"), :slug("XXX"), :tags($["Galaxy", "Galaxy fan render", "planet"]), :type("photo"), :url("XXX"), :url-with-slug("»">XXX")}
»
pukku OK, I've just figured it out -- the gist should be printing `%post.perl`, not `%p.perl`. Then, look at the 'post_tags' key of '%post'. Without the ':v', you get one tag, with the :v you get three.
IOninja And it should be :post_tags(:tags([{tag => "Gallaxy"}, {tag => "planet"}])) etc, right? 18:44
pukku Yup!
18:45 espadrine joined
pukku And with the ':v' it is; I'm now just trying to understand why... 18:45
18:45 agentzh joined
IOninja Ah, OK, I see it. 18:46
m: gist.github.com/zoffixznet/f1e9788...3f35af35d9
camelia {:_post(${:date-gmt("XXX"), :id("XXX"), :slug("XXX"), :tags($["Galaxy", "Galaxy fan render", "planet"]), :type("photo"), :url("XXX"), :url-with-slug("XXX")}), :_type("photo"), :post_body(""), :post_date("XXX"), :post_id("XXX"), :post_slug("…
pukku In Perl 5, I understand the need to be explicit about running over an array, because Perl 5 doesn't have types. However, in Perl 6, shouldn't the `for` know to iterate over the array? 18:47
IOninja pukku: basically, without the :v (or the .list in my version), `for` just loops over 1-item list: the entire array with all the tags, because it's itemized. So to make it treat it as an iterable and iterate over the items inside, you have to convert it back to de-itemized list with :v or .list or @() coercer 18:48
perlpilot It's too bad we don't have a easy link to the docs where this is explained ... :)
18:49 girafe joined
IOninja m: my $a = [1, 2, 3]; for $a { dd $_ } 18:49
camelia Array $a = $[1, 2, 3]
IOninja m: my $a = [1, 2, 3]; for @$a { dd $_ }
camelia Int <element> = 1
Int <element> = 2
Int <element> = 3
IOninja perlpilot: we don't?
perlpilot I was hoping for someone to prove me wrong
18:50 sufrosti1o left
pukku I'm not sure what you mean by "itemized"? 18:50
perlpilot I mean, I would search for "single arg rule" or "SAR" but that would be fruitless.
IOninja m: my @a = 1, 2, 3; for (@a,) { dd $_ }
camelia Array @a = [1, 2, 3]
pukku (Well, I see what you sent to the bot, and I'm trying to understand it.) 18:51
IOninja perlpilot: but this case right now isn't about single arg rule, is it?
TBH I don't really know why `for` doesn't loop over $a
It'
It's a 1-item thing. What are the chances I want to 1-iteration-loop over it rather than over its items?
perlpilot The question of why he needs :v or .list or @() or | there is explained by the single arg rule. 18:53
IOninja pukku: make it be concidered as 1 item (rather than many items it contains). You can make it with `item` routine $ coercer and some things make stuff itemized automatically, like I think stuffing it into an array or hash.
18:53 mcmillhj joined
perlpilot or .flat I suppose 18:53
IOninja perlpilot: huh?
18:54 lostinfog joined
IOninja Single-arg rule is (1) vs (1,) 18:54
Not about @a vs $@a
Isn't it?
perlpilot design.perl6.org/S07.html#The_sing...ument_rule 18:55
raschipi " for @a { } # List of @a.elems things; @a.elems iterations"
IOninja That smells very outdated: "Flattening is the idea that an @-like thing will, in certain contexts, have its values automatically incorporated into the surrounding list" 18:56
perlpilot sure, it's the closest I could get though
18:56 sufrostico joined
pukku So I guess the answer is that the reason I need to de-itemize the tags is because for some reason the JSON parser, instead of just creating an array, created an item of an array? 18:57
IOninja oh, nm, that's just... says what flattening is.
raschipi Does anyone know why it changed?
perlpilot raschipi: why what changed?
raschipi For @a flatenning to not flatenning in a for loop. 18:58
IOninja pukku: I think `slipping` is a more common term. And you'd do it with `for |%p<tags>` instead of the :v thing
18:58 itaipu left, mcmillhj left
IOninja raschipi: nothing's changed from what's described on that line., 18:58
perlpilot raschipi: er, what?
raschipi m: my @a = 1, 2, 3; for @a { dd $_ } 18:59
camelia Int @a = 1
Int @a = 2
Int @a = 3
raschipi But the same doesn't happen for hashes, is that it?
m: my %a = 1, 2, 3, 4; for %a { dd $_ } 19:00
camelia "1" => 2
"3" => 4
IOninja m: my @a = 1, 2, 3; my %h = foo => @a; for %h<foo> { dd $_ }
camelia Array %h = $[1, 2, 3]
raschipi Oh, I see now
IOninja m: my @a = 1, 2, 3; my %h = foo => @a; for |%h<foo> { dd $_ }
camelia Int @a = 1
Int @a = 2
Int @a = 3
perlpilot pukku: In your code, you had "for %post{'tags'} -> $tag { ... }" %post{'tags'} is a single thing. If you want it to be treated as multiple things, you have to tell Perl
IOninja pukku: it's not about JSON parser. ^ stuffing a thing into array or hash makes it itemized.
raschipi Thanks guys, sorry for the derp
IOninja
.oO( scalarized? )
19:01
19:01 sufrosti1o joined, grumble left
IOninja perlpilot++ thanks. 19:01
19:01 grumble joined
raschipi pukku: I got it for the first time reading this: docs.perl6.org/type/Slip 19:02
pukku OK -- I guess I understand what's going on, sort of. At any rate, using the slip stuff also works, and I'll hope that over time this becomes more natural to me. Thanks for all of the help understanding this -- now I get to find the next thing I don't understand! 19:03
perlpilot pukku: usually I use @() or .list 19:04
19:04 sufrostico left
IOninja pukku: I still don't get this stuff, after a year :) 19:04
19:05 itaipu joined
IOninja m: my @a = ^3; my @b = ^3+5; @a.append: @b; say @a 19:05
camelia [0 1 2 5 6 7]
IOninja m: my @a = ^3; my @b = ^3+5; @a.append: @b,; say @a
camelia [0 1 2 5 6 7]
IOninja Like why does this not make a difference? I did add a comma!
19:06 mcmillhj joined
IOninja m: my @b = ^3+5; dd [ @b ] 19:07
camelia [5, 6, 7]
IOninja m: my @b = ^3+5; dd [ @b, ]
camelia [[5, 6, 7],]
IOninja But it does matter here...
19:07 n1ce joined
IOninja m: my @b = ^3+5; for (@b) { dd $_ } 19:07
camelia Int @b = 5
Int @b = 6
Int @b = 7
IOninja m: my @b = ^3+5; for (@b,) { dd $_ }
camelia Array @b = [5, 6, 7]
IOninja And here....
And the synopses says " rule is implemented consistently throughout the language" ... [email@hidden.address] @b,; # same, trailing comma doesn't make > 1 argument" 19:08
But that's inconsistent with previous examples :S 19:09
raschipi pukku: After a while you start to like it this way, because one doesn't need to dance around with references to pass the list as one thing. The other side of the coin is that you need to explicitly ask for slipping.
19:10 sufrostico joined
raschipi pukku: Things keep their shape by default. 19:11
19:11 mcmillhj left
IOninja m: my @a = ^3; my @b = ^3+5; @a.append: @b, Empty; say @a 19:11
camelia [0 1 2 [5 6 7]]
IOninja m: my @a = ^3; my @b = ^3+5; @a.append: @b, |(); say @a
camelia [0 1 2 5 6 7]
IOninja And I don't get this difference.
19:13 Cabanossi left 19:14 Cabanossi joined
raschipi IOninja: Is that tested in roast? 19:14
SmokeMachine there's no way to, from the Parameter, get the signature/function?
IOninja raschipi: what is? 19:17
19:18 sufrosti1o left, mcmillhj joined
raschipi The "(@a,)" slipping. 19:18
19:18 sufrostico left
IOninja It isn't. 19:18
It isn't slipping.
m: my @b = ^3+5; for (@b) { dd $_ }
camelia Int @b = 5
Int @b = 6
Int @b = 7
IOninja m: my @b = ^3+5; for (@b,) { dd $_ } 19:19
camelia Array @b = [5, 6, 7]
19:19 sufrostico joined 19:20 naxieAlDle joined
raschipi Here: m: my @a = ^3; my @b = ^3+5; @a.append: @b,; say @a 19:20
pukku Out of curiosity, is there a shorter way in Perl 6 to say `if (defined($foo) and ($foo ne '')) { ... }`?
19:20 sufrosti1o joined
IOninja pukku: yes: if $foo 19:20
SmokeMachine m: sub bla(:$a) {say $a}; &bla.signature.params[0].set_default({1234}); bla # why that doesn't work?
camelia (Any)
IOninja raschipi: I think that's just append using +foo signature, so 1-item list with an iterable is used a 1 iterable 19:21
pukku And that doesn't run into any problems if $foo is 0?
(or rather, '0')
IOninja pukku: no, we have sane bool
pukku Yay! That makes me really happy!
IOninja pukku: if ("0") { print "I am a Perl 6 program\n" } else { print "I am a Perl 5 program\n" } 19:22
:)
19:22 Cabanossi left
IOninja prints Perl 6 or Perl 5 depending on whether you run it with p6 or p5 19:22
19:23 Cabanossi joined
[Coke] rjbs: hello en passant 19:24
IOninja I often find myself reaching for a 1-char version of `$_ ~~`
naxieAlDle c: 2015.03 if ("0") { print "I am a Perl 6 program\n" } else { print "I am a Perl 5 program\n" }
committable6 naxieAlDle, ¦2015.03: «I am a Perl 5 program»
naxieAlDle :P
IOninja :)
pukku m: if ("0") { print "I am a Perl 6 program\n" } else { print "I am a Perl 5 program\n" } 19:25
camelia I am a Perl 6 program
pukku Ok, just wanted to double-check...
What does the "c" bot do?
IOninja So you'd write something like $foo andthen ⭐'foo'
or whatever
pukku: executes code on a particular commit.
pukku: there it shows that in 2015.03 release Perl 6 still had weird bool for strings :)
pukku got it 19:26
IOninja That was pre-first-stable-release
naxieAlDle pukku: oh, committable! It's a bot from whateverable family. We have built rakudo on a bunch of commits (more than 3000 builds in total), and there are a couple of bots that do interesting stuff with these builds!
IOninja .grep({!⭐/foo/}) 19:27
etc
naxieAlDle pukku: arguably, the most useful of them is bisectable, which lets you find which commit caused a regression
or… you can use it as a general tool to search for interesting commits :) 19:28
bisect: say 5 ≤ 10
bisectable6 naxieAlDle, Bisecting by exit code (old=2015.12 new=3046d57). Old exit code: 1
naxieAlDle, bisect log: gist.github.com/23ac1920b32435c06b...0ed6d57a11
naxieAlDle, (2017-03-05) github.com/rakudo/rakudo/commit/d2...45de7a6703
naxieAlDle ;)
RabidGravy ^ :) 19:29
IOninja What do :raised_hands: do?
naxieAlDle IOninja: celebrate the addition
IOninja weird
RabidGravy Yes it does seem that I have written a lot of Perl 6 code 19:30
naxieAlDle u: 🙌
unicodable6 naxieAlDle, U+1F64C PERSON RAISING BOTH HANDS IN CELEBRATION [So] (🙌)
naxieAlDle IOninja: it's not just hands, by the way
but it could very well be that it is rendered as just hands :'(
IOninja lol, never seen a human do that.
naxieAlDle \o/ 19:31
IOninja It's more of a "Don't shoot. I surrender" thing
TimToady canadians are so repressed...
and oppressed, apparently...
IOninja That emoji looks more like |o|
naxieAlDle IOninja: irclog.perlgeek.de/perl6/2017-02-27#i_14172874
TimToady touchdown!
naxieAlDle oh
|ₒ| 19:32
IOninja naxieAlDle: i.imgur.com/NbnhLMY.png 19:33
19:33 lostinfog left
naxieAlDle IOninja: BWAHAHAHA. Well, not it makes sense ×D 19:33
now*
SmokeMachine m: sub bla(:$a = 42) {say $a}; my &d = {"12345"}; &bla.signature.params[0].set_default(&d); say &bla.signature.params[0].default === &d; bla 19:34
camelia True
42
SmokeMachine default isn't being used? 19:35
m: sub bla(:$a) {say $a}; my &d = {"12345"}; &bla.signature.params[0].set_default(&d); say &bla.signature.params[0].default === &d; bla
camelia True
(Any)
CIAvash m: say <foo bar>.grep({!/foo/}) # IOninja ? 19:38
camelia (bar)
SmokeMachine m: sub bla(:$a = 42) {say $a}; say &bla.signature.params[0]; &bla.signature.params[0].set_default({1234}); say &bla.signature.params[0]; bla 19:39
camelia :$a = 42
:$a = -> ;; $_? is raw { #`(Block|52153896) ... }
42
IOninja CIAvash: yeah; it's just a bad example because `//` already uses $_ without needing smartmatching 19:41
CIAvash yeah 19:42
SmokeMachine lizmat: ^^ 19:43
lizmat: any idea?
IOninja CIAvash: there are 658 instances of $_ ~~ in our ecosystem
Though some are bogus, like $foo where $_ ~~ ''
pukku Is there documentation of =finish blocks, or whatever is going to replace =data blocks? 19:44
IOninja pukku: don't know, but they might be in the Pod section. 19:45
m: gist.github.com/zoffixznet/18e9756...a5761823e8 19:46
camelia 36
46656
46656
2
2
2
2
SmokeMachine Im trying to find where the default value of a parameter is gotten and passed to the function... anyone know where can I find it?
IOninja Any comments on my ^ fix for rt.perl.org/Ticket/Display.html?id...et-history ?
Looks insane... but it works :/
pukku I looked there, and didn't find either word. All that I have is from the old synopses, and the way they describe =data blocks doesn't work. But the =finish sort of works, so I'll just use that...
CIAvash IOninja: I think there was a time I had the same thought. Like how `when` makes it easy. 19:47
19:48 sufrosti1o left, sufrostico left
IOninja jnthn: you around? Is this a bad idea? Bind signature from one thing to another: gist.github.com/zoffixznet/18e9756...a5761823e8 19:48
19:49 CIAvash left, sufrostico joined 19:50 sufrosti1o joined
moritz IOninja: won't that mess up scoping and such? 19:52
IOninja I've no idea. 19:53
It passes the stresstest... but... that probably doesn't say much.
What's weirder is that the signature becomes ($a, $b), but the routine uses |args capture to refer to args. 19:54
I think I'll just comment a diff on a ticket and won't commit anything. Has a proper evil feel to it :) 19:55
19:56 rurban1 joined 19:58 sufrosti1o left 20:00 sufrosti1o joined, labster joined
IOninja Commented: rt.perl.org/Ticket/Display.html?id...xn-1453120 20:00
And thank you RT for messing up Unicode chars -_- 20:01
20:01 sufrostico left, rindolf left
moritz leanpub also messed up my Unicode chapter :( 20:01
I had to change some examples, and in some cases use some pretty boring scripts to illustrate my points 20:02
IOninja heh
naxieAlDle IOninja: if you put it in the title, it just cuts it right off
20:02 skids joined, vendethiel left 20:03 sufrostico joined
naxieAlDle (e.g. #129259) 20:03
synopsebot6 Link: rt.perl.org/rt3//Public/Bug/Displa...?id=129259
20:03 vendethiel joined
IOninja m: say ‘🦋’.uniname 20:04
camelia BUTTERFLY
IOninja It's a Fly! It's Butter! It's BUTTERFLY!
20:05 cdg joined
moritz m: say '2017-01' .. '2017-05' 20:07
camelia "2017-01".."2017-05"
moritz m: say list '2017-01' .. '2017-05'
camelia (2017-01 2017-02 2017-03 2017-04 2017-05)
moritz m: say list '2016-12' .. '2017-05'
camelia (2016-12 2016-13 2016-14 2016-15 2016-02 2016-03 2016-04 2016-05 2017-12 2017-13 2017-14 2017-15 2017-02 2017-03 2017-04 2017-05)
raschipi Something is fucky... 20:09
20:10 eroux left, cdg left 20:11 cdg joined
IOninja each char goes to its char 20:11
20:11 TEttinger joined
IOninja m: say list '1126-12' .. '2017-11' 20:11
camelia (1126-12 1126-11 1127-12 1127-11 1116-12 1116-11 1117-12 1117-11 1026-12 1026-11 1027-12 1027-11 1016-12 1016-11 1017-12 1017-11 2126-12 2126-11 2127-12 2127-11 2116-12 2116-11 2117-12 2117-11 2026-12 2026-11 2027-12 2027-11 2016-12 2016-11 2017-12 2017-…
20:12 cdg left, cdg joined 20:13 cdg_ joined, cdg_ left
IOninja m: say ["1126-12" .. "2017-11"] eqv ["1126-12" ... "2017-11"] 20:13
camelia True
IOninja
.oO( toss char Ranges; split Range to Int and Non-Int )
20:14 cdg_ joined, cdg left 20:15 rurban2 joined, rurban2 left, naxieAlDle left 20:16 cdg_ left
IOninja m: say ["2126-12" .. "2017-11"] eqv ["2126-12" ... "2017-11"] 20:16
camelia False
20:17 cdg joined, cdg_ joined 20:18 rurban1 left, eroux joined
IOninja m: say "1117-11" ~~ "1126-12" .. "2017-11" 20:18
camelia False
IOninja m: say "1117-11" ∈ "1126-12" .. "2017-11"
camelia True
IOninja Looks like smartmatch is busted.
s: "1126-12" .. "2017-11", 'ACCEPTS', \("1117-11") 20:19
SourceBaby IOninja, Sauce is at github.com/rakudo/rakudo/blob/3046...ge.pm#L419
20:21 cdg left
IOninja m: dd [ (not "1117-11" before "1126-12"), (not "1117-11" after "2017-11") ] 20:21
camelia [Bool::False, Bool::True]
IOninja well there's ya problem!
yar? yo?
moritz awwaiid: I'm trying to trace the origins of the Perl 6 matplotlib example, and so far gist.github.com/awwaiid/ef3f0abcfa96e34977b4 was the earliest I found 20:22
awwaiid: was the your idea? 20:23
DrForr "yer" traditionally :)
IOninja Gonna try to make a module that breaks up Range to Int, Numeric, and... Weird... That forest of ?? and !! will fall
DrForr: thanks.
Gonna try... in summer I mean.
20:26 risou_awy is now known as risou, bwisti left
IOninja Filed: rt.perl.org/Ticket/Display.html?id=130959 20:30
NeuralAnomaly: status
NeuralAnomaly IOninja, [✘] Next release will be in 1 week and 2 days. Since last release, there are 42 new still-open tickets (2 unreviewed and 1 blockers) and 44 unreviewed commits. See perl6.fail/release/stats for details
IOninja 42 tickets \o/
20:30 domidumont left
IOninja m: say WHY 'Life, The Universe and Everything': 20:30
camelia (Any)
IOninja m: say WHY 'Life, the Universe and Everything': 20:31
camelia 42
20:34 wamba left 20:35 vendethiel left, vendethiel- joined
jnthn IOninja: Signatures are used for the binding slow-path in Moar, and interpreted on JVM. So that has potential to get...very "interesting" 20:36
(As in, break explosively) 20:37
IOninja: Safer would be to mix in a role FakesSignature or so 20:38
Which would override the .signature, .count, and .arity methods
IOninja Thanks. 20:39
jnthn Leaving the original $!signature which other things need intact.
But changing it for those things introspecting from the outside 20:40
samcv m: say 'sta' ~~ m:i/st/
camelia 「sta」
IOninja Will try that some time soon.
m: say 'stan' ~~ m:i/st/ 20:41
camelia 「sta」
IOninja the Cursor position gets messed up looks like; due to "st".fc.chars being 2 instead of 1 20:42
samcv m: say "st T" ~~ m:i/T/;
camelia False
samcv well i fixed that one at least
on my own build
IOninja sweet samcv++
samcv it's pretty rough but i am making progress
20:44 firefish5000 joined, risou is now known as risou_awy
samcv m: say "aaaastaaa" ~~ m:i/st/; 20:46
camelia 「s」
samcv bisectable6, say "aaaastaaa" ~~ m:i/st/;
bisectable6 samcv, Bisecting by output (old=2015.12 new=3046d57) because on both starting points the exit code is 0
samcv, bisect log: gist.github.com/1f6c6a843537f7b656...f3f36aa20e
samcv, (2017-03-08) github.com/rakudo/rakudo/commit/f7...56ce639197
samcv weird it shows that commit 20:48
IOninja bisect: old=26e6993bd82 say "aaaastaaa" ~~ m:i/st/; 20:49
bisectable6 IOninja, Bisecting by output (old=26e6993 new=3046d57) because on both starting points the exit code is 0
IOninja, bisect log: gist.github.com/f22f777fee7d1b9c8b...fa7af0f1d0
IOninja, (2017-03-08) github.com/rakudo/rakudo/commit/f7...56ce639197
20:49 lichtkind__ joined
IOninja c: f73d9847382~1 say "aaaastaaa" ~~ m:i/st/; 20:49
committable6 IOninja, ¦f73d9847382~1: «False»
IOninja c: f73d9847382 say "aaaastaaa" ~~ m:i/st/;
committable6 IOninja, ¦f73d984: «「s」»
IOninja Geth: ver github.com/rakudo/rakudo/commit/f73d9847382
Geth IOninja, version bump brought in these changes: github.com/perl6/nqp/compare/2017....5-g4c0f698
samcv m: say "a st" ~~ m:i/st/; 20:50
camelia False
samcv ok i just have to fix this case here
plus there's it incorrectly giving back only one character when you do m:i/st/ but that's a different issue though same cause of the problem
20:51 Cabanossi left 20:53 lichtkind_ left
raschipi Is that an "st" ligature as an Unicode char? Isn't that supposed to be part of the font? Is there a language that treats 'st' different from 'st'? 20:53
u: st
unicodable6 raschipi, U+FB06 LATIN SMALL LIGATURE ST [Ll] (st)
moritz well yes, a German teacher will mark it as an error if you use the ligature in German text :-) 20:54
20:54 Cabanossi joined 20:55 espadrine left 20:57 bdmatatu left 20:58 st_elmo left
lizmat m: sub bla(:$a = 42) {say $a}; BEGIN say &bla.signature.params[0].default; BEGIN &bla.signature.params[0].set_default({1234}); BEGIN say &bla.signature.params[0].default; say &bla.signature.params[0].default; bla # SmokeMachine 20:59
camelia -> ;; $_? is raw { #`(Block|58947920) ... }
-> ;; $_? is raw { #`(Block|58948424) ... }
-> ;; $_? is raw { #`(Block|58948424) ... }
42
lizmat SmokeMachine: so it *does* change the default value correctly if you do it at compile time 21:00
21:00 dct joined
lizmat and that's the value you see at runtime as well 21:00
feels like there's some optimization at work here 21:01
SmokeMachine m: sub bla(:$a = 42) {say $a}; BEGIN say &bla.signature.params[0].default.WHERE; BEGIN &bla.signature.params[0].set_default({1234}); BEGIN say &bla.signature.params[0].default.WHERE; say &bla.signature.params[0].default.WHERE; bla
camelia 140416596895552
140416567823856
140416567823856
42
jnthn If you're going to manipulate a signautre you must do it at compile time. 21:02
SmokeMachine m: sub bla(:$a) {say $a}; BEGIN say &bla.signature.params[0].default.WHERE; BEGIN &bla.signature.params[0].set_default({1234}); BEGIN say &bla.signature.params[0].default.WHERE; say &bla.signature.params[0].default.WHERE; bla
jnthn (If you're doing it to something that exists at compile time)
camelia 41428280
139648216589752
139648216589752
(Any)
21:02 eroux left
jnthn We compile most signatures, not interpret them 21:02
SmokeMachine lizmat: yes, it changes... but I don't receive it on the function...
jnthn So by runtime what's in the Signature object is irrelevant 21:03
That compilation happens at the closing curly of the sub
SmokeMachine jnthn: hum... thats why!
jnthn: any way to change it?
jnthn No.
Well
moritz you could write a trait
jnthn At BEGIN time you can of course
moritz that should run early enough, no?
jnthn Yes, traits run at BEGIN time 21:04
21:04 cdg_ left
jnthn I figured the question is "can I have it always interpret the signature" 21:04
To which the answer is certainl no
*certainly
21:04 cdg joined
jnthn Pretty sure if you put routine traits on the subroutine they have the signature object available, so you've got both parameter traits and routine traits as options 21:05
SmokeMachine jnthn: on the last example I changed the signature at compile time but it didn't change (by it I mean what the function received...)
jnthn You changed it too late 21:06
< jnthn> That compilation happens at the closing curly of the sub
The BEGIN is after the }
Do I want to ask why you're trying to do this? :)
lizmat jnthn: yeah, but I think that's the point: to be able to do it *after* the sub has been compiled :-)
jnthn OK, then "not unless you write a slang" 21:07
But why not just put it into a trait?
raschipi Ele tá muito loco.
jnthn Note that your trait could just install a closure as the default which then grabs the value from somewhere you *can* change at runtime
21:09 ggoebel left
SmokeMachine m: multi trait_mod:<is>(Routine:D $r, :$bla!) {&bla.signature.params[0].set_default({1234})}; sub bla(:$a) is bla {say $a.VAR}; bla # jnthn: something like this? 21:09
camelia Any
jnthn Something like 21:10
Why the .VAR?
SmokeMachine m: multi trait_mod:<is>(Routine:D $r, :$bla!) {&bla.signature.params[0].set_default({1234})}; sub bla(:$a) is bla {say $a}; bla # jnthn: something like this?
camelia (Any)
SmokeMachine jnthn: sorry...
jnthn Oh, and use $r in the trait, not bla
SmokeMachine sure!
jnthn Then you can apply the trait on whatever routine you want 21:11
SmokeMachine m: multi trait_mod:<is>(Routine:D $r, :$bla!) {$r.signature.params[0].set_default({1234})}; sub bla(:$a) is bla {say $a}; bla
camelia (Any)
21:11 itaipu left
SmokeMachine but it isn't working... 21:11
jnthn Hmm
SmokeMachine i am not getting 1234...
jnthn I...wonder if that's thanks to the compiler having its own internal data structure for Parameter as well as the object... 21:12
Ah, yeah, it is 21:13
.oO( 8 years is plenty long enough for a compiler to have legacy code... :P )
21:14 itaipu joined, cdg_ joined
jnthn SmokeMachine: I can fix this case relatively easy 21:14
Though gotta head afk for a bit soon
SmokeMachine jnthn: :) I'd like to read that commit 21:15
21:17 cdg left
jnthn Totally untested patch: gist.github.com/jnthn/9e43772eef65...526418c9b2 21:18
Feel free to try it...I'll bbiab :)
21:21 raschipi left
SmokeMachine compiling... 21:21
21:21 jonas1 left 21:23 ggoebel joined 21:26 sufrosti1o left 21:27 sufrostico left
moritz gist.github.com/moritz/54e2fb94687...53bbd40dcc I can't seem to make Inline::Python return a date object; what's wrong here? 21:31
moritz probably too tired 21:32
21:32 dct left
moritz the weird thing is: if I pass too few arguments to datetime.date, it complains 21:32
but still it returns Any?
robertle do the supplies of IO::Socket::Async (e.g. "listen" or "Supply") have any guarantees around concurrency? e.g. would you only ever get one these called at the same time per socket? or do you need to ensure that yourself (e.g. with "whenever")? 21:34
21:34 bjz joined
lizmat whenever has .act semantics, so that should insure you against any concurrency issues 21:38
but could you elaborate with some code?
robertle understand the whenever beahvior. but for example the simple code at the top of docs.perl6.org/type/IO::Socket::Async, second code block 21:40
that wraps the listen and Supply into a single "react", so serializing everything on that server
that seems to be quite serial to me, I am wondering if e.g. a HTTP server shouldn't allow concurrent stuff to happen on unrelated sockets 21:41
so I am looking at github.com/perl6/perl6-http-server.../Async.pm6
to learn a bit more
this does not use "whenever", but does some other stuff that is moderately nasty 21:42
and quite frankly I am not even sure that this is safe or complete
for example I am wondering if there isn't a concurrent modification race around @!connects
so I am wondering if there are some guarantees already built into IO::Socket::Async 21:43
21:43 sufrostico joined, sufrosti1o joined 21:45 eiro left
pukku I know that I can use Perl 5 and Text::VimColor to get an HTML colorized version of Perl 6 code. But is there an equivalent to Perl::Tidy for reformatting code? I'm looking for something to line up my assignments, regularize whitespace, etc... 21:45
21:47 sufrostico left
SmokeMachine jnthn: www.irccloud.com/pastebin/vvHicvao/ 21:47
21:48 Todd joined, sufrosti1o left
skids Who's a rakudo "braid" internals expert? 21:49
yoleaux 08:16Z <TimToady> skids: you want something like gist.github.com/TimToady/df87901b8...5240bcf77d
09:26Z <TimToady> skids: With 44b60a560d that I just checked in, you should be able to work with just the .define_slang, if you don't care to support old versions. note that you do still have to do the mixins; you can't just pass bare roles to .define_slang, though maybe we could support that...
21:49 sufrostico joined
Todd Hi All, I am trying to learn "use NaticeCall;". Would someone mind translating this call into perl6 (reference "man XDisplayName"): 21:49
char *XDisplayName(char *string);
K am reading docs.perl6.org/language/nativecall, but not understand a lot of it, so an example would be appreciated 21:50
lizmat robertle: jnthn would be the person to really ask this 21:51
robertle currently a HTTP::Server::Async seems to only emit stuff from the "Supply" tap after the previous one has been finished. but I do wonder if that is guaranteed or an accident... 21:53
IOninja pukku: I think DrForr is working on that
robertle for example: gist.github.com/robertlemmen/56ff1...098bc9129e 21:54
pukku Thanks -- that means it probably won't be ready for next week (I'm trying to give a short talk with some Perl 6), so I'll just format it by hand...
robertle you can then connect and send two pieces of data (same socket). they do get handled by diufferent threads, but sequentially
IOninja Todd: know nothing about native call, but a wild guess would be: sub XDisplayName(Str --> Str) is native {}
21:55 andrzejk_ left
IOninja pukku: there's Facebook post that says "Also a Perl6::Tidy comment stripper takes 5 lines of code. Including I/O."... but no links to any code :/ 21:55
skids: TimToady probably. He's been doing all the recent braids work. 21:56
skids IOninja: thanks.
Todd I am not sure how to put "char *XDisplayName(char *string);" into "sub XDisplayName() is native('something') { * };" 21:57
This is inline C, I presume 21:58
moritz Todd: if you're looking for working NativeCall examples, I can recommend looking into the DBIish source code 21:59
21:59 itaipu left
lizmat Todd: supposing the name of the library providing the "XDisplayName" is "libX11", then 'is native("X11")' should do the trick 22:00
22:01 sufrostico left
lizmat provided that library is installed on your system, of course 22:01
Todd I have seen this code. I don't understand it. So I was trying to figure out how do "char *XDisplayName(char *string);", which is somethign I need. DBIsh will be great if I ever need to talk SQL though
IOninja Todd: have you tried my suggestion? 22:02
skids .tell TimToady 44b60a560d did the trick. Not that I'll be yanking the "old way" code just I instinctively tested the "new way". Thanks.
yoleaux skids: I'll pass your message to TimToady.
moritz Todd: you complained about a lack of examples in the docs; I pointed out more examples
Todd: sometimes I think you aren't *really* trying to understand stuff yourself
lizmat robertle: have you tried using .act instead of .tap ?
pukku Thanks to everyone who helped me earlier today, especially IOninja -- have a great night! 22:03
lizmat .act ensures it only gets run by one thread at a time
IOninja You too.
22:03 pukku left
Todd So far I have "sub XDisplayName() is native ('X11') {}" but I still don't know how to inline the C code 22:03
where does the "char *XDisplayName(char *string);" go? 22:04
IOninja Todd: nowhere. You translate that to Perl 6 types and NativeCall's types
22:05 sufrostico joined
IOninja Todd: there's a converstion table here: docs.perl6.org/language/nativecall...ing_Values 22:05
lizmat IOninja: sadly, char * is not in that list ?
IOninja Todd: and I *think* char * is Str
22:05 bjz left
IOninja Or maybe not... "Str (C string)" is char * a C string? 22:06
lizmat sub XDisplayName(Str:D $name) is native ('X11') { * }
if what IOninja said is correct
jnthn SmokeMachine: Hmmm...odd
lizmat timotimo: ^^ comments ?
IOninja & 22:07
Todd mortiz: I am weird in the the way I learn. That is why I am looking for an example of something I need
"sub XDisplayName(Str:D $name) is native ('X11') { * }" what is "*" and what is "Str:D $name"" 22:08
jnthn SmokeMachine: Oh, maybe I should have checked if it's Code rather than Block
lizmat * is Whatever: in this context it means: take whatever is in the mentioned external library and execute that 22:09
22:09 RabidGravy left
lizmat Str:D means: only accept defined Str objects as a parameter 22:10
Todd Okay, so "*" is litterally "*"
looking at "docs.perl6.org/language/nativecall...g_Values". It is going right over my head.
lizmat m: dd *.WHAT 22:11
camelia Whatever
22:11 sufrosti1o joined
Todd I still can't figure out where to put the "char *XDisplayName(char *string);" 22:12
lizmat Todd: you don't
you will not need to write any C code
that's beauty of NativeCall
*the
Todd now I am confused. It can read my mind? How does it know want that particular function from X11? 22:13
lizmat because of the name you gave the sub
it will look for that name in the X11 lib 22:14
*tha* name
*that* *sigh* :-)
Todd I thought that was arbitrary. Now I understand. Thank you!
lizmat if you want, you can use another name with "is symbol"
22:15 lep-delete left
lizmat sub display-name(Str:D $name) is native ('X11') is symbol("XDisplayName" { * } 22:15
sub display-name(Str:D $name) is native ('X11') is symbol("XDisplayName") { * }
22:17 mcmillhj left, lep-delete joined
Todd Ah poop. "sub XDisplayName(Str:D $name) is native ('X11') { * }" gives "Missing block at /home/linuxutil/./X11Display.pl6:14 ------> sub XDisplayName(Str:D $name) is native⏏ ('X11') { * }" 22:17
22:18 lichtkind__ is now known as lichtkind
Todd lizmat: thank yo for the symbol example. Now I understand 22:19
lizmat Todd: can't have a space between native and ("X11") 22:20
Todd Just figured that out. Thank you! 22:21
More errors.
Calling XDisplayName() will never work with declared signature (Str:D $name) in method CALL-ME at /usr/share/perl6/sources/24DD121B5B4774C04A7084827BFAD92199756E03 (NativeCall) line 326 in block <unit> at ./X11Display.pl6 line 16
Now what is wrong? 22:22
lizmat m: sub a(Str:D $a) {}; a() # basically what's happening
camelia Too few positionals passed; expected 1 argument but got 0
in sub a at <tmp> line 1
in block <unit> at <tmp> line 1
lizmat m: multi sub a(Str:D $a) {}; a() # basically what's happening 22:23
camelia 5===SORRY!5=== Error while compiling <tmp>
Calling a() will never work with any of these multi signatures:
(Str:D $a)
at <tmp>:1
------> 3multi sub a(Str:D $a) {}; 7⏏5a() # basically what's happening
22:23 sufrosti1o left
Todd I am calling the sub with "my $Display = XDisplayName();" which is the line16 it is complaining about 22:24
22:24 sufrostico left
lizmat Todd: if you declare a sub to take one Str:D parameter, and then write code that will call it without any parameters, rakudo will tell you that it can nevcer work 22:24
*never
22:24 Ven joined
Todd Short between the headsets. I was thinking it was a return function. "my $Display; XDisplayName( $Display );" fixes it. 22:25
Wow. I feel like I just expereinced two days i a class room environment. Thank you all! Now I am "dangerous!" 22:26
lizmat Todd: with great power comes great responsibility :-) 22:27
22:27 risou_awy is now known as risou
robertle another question around IO::Socket::Async: can I close() a socket from another thread safely? what about events happening on it at the same time? 22:27
lizmat robertle: which thread does what *should* not matter 22:28
robertle: but I'm not 100% sure we're there yet :-)
Todd Hmmm. I am getting "uninitialized value $Display" coming back from the sub. It should be something like ":0.0"
$ echo $DISPLAY
:0.0
Now what am I doing wrong? 22:29
jnthn SmokeMachine: Just checked; if you change Block for Code in my suggested patch it's happy
robertle: Yes, you can close it from any other thread safely, though anything that tries to write to it after close will end up with an broken Promise from the write 22:30
lizmat Todd: looking at interface doc at tronche.com/gui/x/xlib/event-handl...yName.html
robertle lizmat: that sounds promising!
jnthn Though that has to be handled anyway because the client could close the connection.
robertle jnthn: that sounds almost perfect
lizmat it appears to also return a Str 22:31
22:31 mcmillhj joined
jnthn lizmat: In terms of safely for IO::Socket::Async and Proc::Async, we run a signle libuv event loop and dispatch all operations over to it 22:31
lizmat sub XDisplayName(Str:D $name) is native ('X11') returns Str { * }
jnthn lizmat: So we're pretty safe on that front :) 22:32
lizmat Todd: ^^^ could you try that ?
SmokeMachine jnthn: I'll do that when I arrive home
Todd remoed the space after native. Returns and unitialized variable 22:34
no joy
22:34 kurahaupo__ left
jnthn SmokeMachine: OK; I ran a spectest of the patch and it came out OK 22:36
22:36 mcmillhj left
Todd figured it out. Give me a moment 22:36
22:38 mcmillhj joined 22:39 Voldenet left
Todd And it is a bit weird. 22:43
sub XDisplayName(Str:D $name) is native('X11') returns Str { * };
my $Display; my $RtnStr;
$Display = XDisplayName( $RtnStr );
print "\$Display = <$Display> \$RtnStr = <$RtnStr>\n";
22:43 risou is now known as risou_awy 22:44 Voldenet joined, Voldenet left, Voldenet joined
Todd Here is what is wierd. I have to use $RtnStr in the () or it does to work. Nothing gets put in $RtnStr either. How do I get rid of $RtnStr? 22:44
robertle another concurrency question: if I change not an object, but a variable/binding, what does that mean in a concurrent context? 22:45
so if I have a my $var = Foo.new;
and then do $var = Foo.new() on another thread, is that safe? 22:46
22:46 Sound joined
lizmat robertle: make sure that that happens only in one thread at a time 22:46
robertle: ah, in that way
each thread has its own lexical scope
robertle lizmat: youa re saying that modifying a variable/binding is not safe across threads?
lizmat so as long as the $var is local to the thread's scope, you're ok
robertle right
lizmat otherwise, you'll have a race condition 22:47
robertle ok, so looking at github.com/perl6/perl6-http-server.../Async.pm6 again
lizmat start { my $var = Foo.new } # ok
robertle that modifies @!connects from various threads
lizmat my $var; start { $var = Foo.new } # BAD BAD BAD
robertle it creates a new object, so there isn't a concurrent modification of a value, but the binding changes... is that not safe then? 22:48
lizmat robertle: but it does it inside a protect block 22:49
Todd figured it out. from tronche.com/gui/x/xlib/event-handl...Name.html, "If a NULL string is specified, XDisplayName() looks in the environment for the display and returns the display name that XOpenDisplay() would attempt to use" 22:50
So I changed $RtnStr to $NullStr so I could see what I was doing
robertle lizmat: on line 37 yes, but e.g. line 69 accesses the same variable from a different thread, and does not take the lock 22:51
lizmat robertle: I think you just exposed a race condition there
robertle lizmat: great, because that used to confuse the hell out of me! 22:52
22:52 Cabanossi left
lizmat the .tap in line 65 should probably be an .act 22:52
jnthn: ^^^ do you agree?
Todd Thank you guy! Now I am really dangerous!!! Got to go. Bye Bye. 22:53
lizmat Todd: not all of the guys here are guys :-)
El_Che :) 22:54
Todd So I have to watch the swearing?
robertle lizmat: how does turning that into an .act solve the problem? that does not protect against concurrent access by line 37 (right?)
22:54 Cabanossi joined, Sound left
lizmat Todd: depends :-) 22:55
robertle: that would prevent concurrent access to @!connects in listen
22:55 bwisti joined
jnthn lizmat: The stream of incoming connections is actually a serial Supply 22:56
lizmat jnthn: ah, didn't know that, so the .tap is fine
jnthn Yeah. It's kinda presumed that if you are going to have concurrency, per-connection is the valuable place :)
robertle ok, that is what I was wondering about earlier: are IO::Socket::Async events serial even in the absence of act/whenever 22:57
but the problem here, if I understand it, is the concurrent access by line 37, which is not IO::Socket::Async at all, just start+loop 22:58
but using $l.protect around line 69 should do the trick
jnthn Yeah 22:59
robertle man, how I hate concurency 23:00
lizmat jnthn: how would that protect access between !timeout and listen ?
23:00 eliasr left
lizmat that would only be the case if they shared the lock 23:01
jnthn lizmat: I was agreeing that 69 needs the lock too
(I didn't look at 37 before :))
lizmat so the lock needs to become an attribute of the object, right ?
the HTTP::Server::Async object
jnthn Yes 23:02
lizmat robertle: time for a PR I guess :-)
23:03 girafe left
jnthn tbh I'd probably have written the lot in a react block or something though 23:03
lizmat jnthn: I think this predates react / whenever :-)
jnthn Then instead of a thread that sleeps for 1s it'd be whenever Supply.interval(1) { }
Yeah, that's fair enough :)
robertle jnthn: excellent point, because the reason I bring this up is that I can't get my react blocks to work! 23:04
so if I want to write something like this, I need to do timeouts as well
and they don't come from eth same supply
ah forget that, I know how to fix that
but you don't want to do all in the same react block, right? otherwise you loose al concurrency
and then the timeouts become a problem... 23:05
23:05 andrzejku left
jnthn Well, can always `start` the per-connection handler 23:05
23:06 andrzejku joined
jnthn Rest time for me...hopefully I'll sleep a little less awfully tonight 23:07
robertle night!
jnthn 'night o/
23:27 geekosaur left 23:29 geekosaur joined 23:30 mcmillhj left 23:37 unicodable6 left 23:38 Ven left 23:43 mcmillhj joined 23:46 zakharyas joined, unicodable6 joined, ChanServ sets mode: +v unicodable6 23:47 mcmillhj left 23:48 robertle left, geekosaur left 23:49 geekosaur joined 23:53 Cabanossi left 23:55 Cabanossi joined 23:59 mcmillhj joined