»ö« Welcome to Perl 6! | perl6.org/ | evalbot usage: 'p6: say 3;' or /msg camelia p6: ... | irclog: irc.perl6.org or colabti.org/irclogger/irclogger_log/perl6 | UTF-8 is our friend! 🦋
Set by Zoffix on 25 July 2018.
guifa <AlexDaniel timotimo Aearnus>.map(*++) I had just remembered in the docs saying the optimizer had freedom to not do it but wasn’t sure how strong that optimization was. Definitely not worth it then for counting the number of digits in a number :-) 00:14
MasterDuke guifa: .chars wouldn't work? 00:17
guifa Negative. -12.3.Str.chars gets you 5 00:17
But I need it to be 3
MasterDuke ah 00:18
then maybe .comb(/\d/).elems ? 00:20
ugexe m: say ord(42); say ord(420); 00:38
evalable6 52
52
ugexe maybe that should fail/throw? 00:39
i.e. fail if more than 1 char 00:40
Xliff m: my $a; $a = $/[0] if "aaa" ~~ /('a' 00:43
evalable6 (exit code 1) 04===SORRY!04===
Regex not terminated.
at /tmp/HNc9PnYa6u:1
--…
Xliff, Full output: gist.github.com/2d04790482094e4be4...627e2bc193
Xliff m: my $a; $a = $/[0] if "aaa" ~~ /('a') aa/; say $a
evalable6 「a」
Xliff m: my $a; $a = $/[0] if "aaa" ~~ /.aa/; say $a
evalable6 (Any)
Xliff m: my $a; $a = $/[0] if "zaa" ~~ /(.)aa/; say $a 00:44
evalable6 「z」
AlexDaniel ugexe: if that starts to throw, then .uniname should too
ugexe: it *feels* like they both do .foos[0]
so in that sense the behavior is consistent and easy to understand 00:45
although it makes me wonder why these shortcuts exist at all :)
like: .ord vs .ords[0], that's quite a bit shorter but are we really designing the language for golfing? :) 00:46
note that the second one explicitly tells you what it means and how it's going to behave in edge cases
guifa MasterDuke: I went with .comb.map(* ne ‘.’ | ‘-‘).elems, I figure avoiding regex will be a bit faster, but maybe if there’s overhead with junctions I should be wary of and use .map({ $^a ne ‘.’ && $^ ne ‘-‘ }). Although important thing is to get it working first and the junction is clearer to me anyways 00:47
MasterDuke a junction will almost certainly be slower than using && or || 00:48
AlexDaniel ugexe: then there's also .chr which does something completely useless on actual lists
MasterDuke but yeah, a regex is probably also slow 00:49
AlexDaniel and .chrs works fine on single values
AlexDaniel so, why? 00:49
ugexe: ah also, .uniprop goes into the same list with .ord and .uniname 00:50
AlexDaniel I'm fond of throwing things away from the language, so maybe don't listen to me :) 00:53
but I do thing that if somebody proposed `.chr` today we wouldn't add it because we already have .chrs which just works 00:54
think*
ugexe i agree the non-plural variants seem a bit pointless 01:00
probably just brought over from perl 5 01:01
Xliff m: sub a { return 1; LEAVE { 'I LIVE!' } }; say a
evalable6 WARNINGS for /tmp/nzezyCh0Js:
1
Useless use of constant string "I LIVE!" in sink context (line 1)
Xliff m: sub a { return 1; LEAVE { say 'I LIVE!' } }; say a 01:01
evalable6 I LIVE!
1
Xliff I love phasers! =)
AlexDaniel Xliff: I loved them too github.com/perl6/whateverable/comm...59d760d803 01:05
ugexe: consider filing a ticket here github.com/perl6/problem-solving/issues 01:06
ugexe: it's unlikely that non-plural variants will go away, but we can have some very soft deprecation on them
“not recommended in new designs” :)
Xliff m: sub a { return 1; LEAVE say 'I LIVE!' }; say a # Ooh! Statements 01:09
evalable6 I LIVE!
1
Xliff m: sub a { return 1; LAST say 'I LIVE!' }; say a # *shrug* 01:10
evalable6 1
Xliff m: sub ab ($a, $b) { ($a, $b).say }; my %h = ( a => 5, b => -1 ); ab( |%h<a b> ); 01:15
evalable6 (5 -1)
Xliff m: class A { method a { 1 }; method b { 2 }; }; my $meth = 'a'; A."$meth"() 01:51
evalable6
Xliff m: class A { method a { 1 }; method b { 2 }; }; my $meth = 'a'; A."$meth"().say
evalable6 1
Xliff m: class A { method a { 1 }; method b { 2 }; }; my $meth = 'b'; A."$meth"().say
evalable6 2
Xliff m: class A { method a { 1 }; method b { 2 }; }; my $meth = 'b'; A.\$meth().say
evalable6 (exit code 1) 04===SORRY!04=== Error while compiling /tmp/pZ03ih6WF4
Malformed postfix call
at /tmp/pZ03ih6WF4:1
------> 03}; method b { 2 }; }; my $meth = 'b'; A.08⏏04\$meth().say
Xliff m: class A { method a { 1 }; method b { 2 }; }; my $meth = 'b'; A.$meth().say
evalable6 (exit code 1) No such method 'CALL-ME' for invocant of type 'Str'
in block <unit> at /tmp/H_wzrRzsfR line 1
Elronnd anyone use p6 for web? Should I use cro or bailador? (Or something else?) 06:21
discord6 <Tyler (Aearnus)> I have the same question 06:37
Elronnd I found this www.nntp.perl.org/group/perl.perl6...g5203.html (also the reply). Also cro has fancy stuff like http/2 and websockets 06:38
I think I'm gonna go with cro
Elronnd I got a failing test building rakudo in freebsd 06:39
in LWP::Simple, get-w3-redirect.t
ah, looks like the w3 website it relies on is broken - jigsaw.w3.org/HTTP/300/301.html 06:41
jmerelo Elronnd: you will probably get going faster with Bailador, but in the long run Cro is the best option 06:57
Elronnd: please raise an issue there github.com/perl6/perl6-lwp-simple 06:58
Elronnd: it's working now? jigsaw.w3.org/HTTP/300/Overview.html
Elronnd hum, must have been temporarily down. When I visited it before in my browser it spat out some weird json-formatted error about unimplemented GET or something like that 07:01
alright, I'll do cro then 07:02
jmerelo Elronnd: hum. Might be somethign else. If you've still got that in your terminal, copy/and paste it to an issue.
Elronnd 0nah, wiped that screen 07:03
is probably fine though
I'll run a make test and see what happens
jmerelo Elronnd: thanks!
Elronnd yep, tests for lwp simple pass now 07:08
(maybe shouldn't depend on a third-party website for that test, though?)
Elronnd hmmm, when I run the 'cro' command, it just hangs forever, no matter what I give it 07:13
xq definitely should not depend on something as fragile as network for tests 07:15
would be more reliable to make a temporary http server listen on 127.0.0.1 and test using that 07:16
Elronnd well maybe, but then you have to test the server too
so it's unclear if what's being tested is client or server
xq on a bright side this setup theoretically should fail in a reproducible way 07:17
Elronnd true
lizmat weekly: theperlfisher.blogspot.com/2019/04/...g-out.html 07:20
notable6 lizmat, Noted!
holyghost I'm a week away with my kids, I return the week after 07:23
Geth doc: 8a35386261 | (JJ Merelo)++ | doc/Type/Metamodel/CurriedRoleHOW.pod6
Adds M::CurriedRoleHow

Mainly for the sake of illustration. Text copied from @jnthn comment at the beginning of the source code. Refs #1306
07:26
synopsebot Link: doc.perl6.org/type/Metamodel::CurriedRoleHOW
doc: e911e2e132 | (JJ Merelo)++ | doc/Type/Metamodel/CurriedRoleHOW.pod6
Adds an example of direct use refs #1306
07:35
synopsebot Link: doc.perl6.org/type/Metamodel::CurriedRoleHOW
Geth doc: a96b45966c | (JJ Merelo)++ | doc/Type/Metamodel/CurriedRoleHOW.pod6
Got it right this time

Curried roles are simply roles that have been provided with a parameter, but before they have been fully instantiated by punning or being mixed in a class. [Synopse](design.perl6.org/S14.html), for once, was useful.
Refs #1306
08:07
synopsebot Link: doc.perl6.org/type/Metamodel::CurriedRoleHOW
Elronnd Is cro awesome enough to be exposed directly to the open internet, or should I still reverse-proxy it behind nginx? 08:13
jmerelo Elronnd: there are many sites in production, including Edument's 08:23
Elronnd but do they run nginx in front of it, or do they let cro handle everything itself? 08:28
jmerelo Elronnd: not sure. I think not, but you can ask sena_kun or jnthn when they are around. 08:28
Elronnd I guess the question is, does the increased speed from the static file-serving outweight the increased latency added by the second http connection you need for reverse proxy? 08:29
ok
Xliff m: class A { method a { ... } }; A.new 08:42
evalable6
Xliff m: class A { method a { ... } }; A.a.new
evalable6 (exit code 1) Stub code executed
in method a at /tmp/z7Zs2GeFy0 line 1
in block <unit> at /tmp/z7Zs2GeFy0 line 1
08:43
Xliff m: class A { method a { ... } }; class B does A { }; 08:43
evalable6 (exit code 1) 04===SORRY!04=== Error while compiling /tmp/nJYjFG9cJ7
A is not composable, so B cannot compose it
at /tmp/nJYjFG9cJ7:1
Xliff m: class A { method a { ... } }; class B does A { method a { 1 } };
evalable6 (exit code 1) 04===SORRY!04=== Error while compiling /tmp/e6FZdzIFT_
A is not composable, so B cannot compose it
at /tmp/e6FZdzIFT_:1
Xliff m: class A { method a { } }; class B does A { method a { 1 } }; 08:43
evalable6 (exit code 1) 04===SORRY!04=== Error while compiling /tmp/C45Nhdvkp9
A is not composable, so B cannot compose it
at /tmp/C45Nhdvkp9:1
Xliff m: class A { method a { '' } }; class B does A { method a { 1 } }; 08:44
evalable6 (exit code 1) 04===SORRY!04=== Error while compiling /tmp/KmLdT3d1J6
A is not composable, so B cannot compose it
at /tmp/KmLdT3d1J6:1
Xliff m: class A { method a { }; }; class B does A { method a { 1 } };
evalable6 (exit code 1) 04===SORRY!04=== Error while compiling /tmp/fK4YF_uQd_
A is not composable, so B cannot compose it
at /tmp/fK4YF_uQd_:1
Xliff m: class A { method a { ... } }; class B is A { };
evalable6
Xliff m: role A { method a { ... } }; class B does A { }; 08:46
evalable6 (exit code 1) 04===SORRY!04=== Error while compiling /tmp/Wdn2yDF_iU
Method 'a' must be implemented by B because it is required by roles: A.
at /tmp/Wdn2yDF_iU:1
Xliff m: role A { method a { ... } }; role B { method a { 1 } }; class BB does A { also does B }; 08:47
evalable6
Xliff m: role A { method a { ... } }; role B { method a { 1 } }; class BB does A { method a { 'a' }; };
evalable6
Xliff m: use NativeCall; class A is repr('CPointer') { submethod DESTROY { say "BOO!" } }; A.new 08:49
evalable6 WARNING: unhandled Failure detected in DESTROY. If you meant to ignore it, you can mark it…
Xliff, Full output: gist.github.com/a26383346eb9d2f1a2...c3ba0c1823
jnthn Elronnd: All of the Cro things I've got in production have a reverse proxy in front of them (some Apache, some nginx) 11:58
moritz the social class of people who write Cro applications is called croletariat, right? :D 12:02
jnthn It is now :P 12:03
sena_kun .oO ( crolean's prayer )
El_Che moritz: croletes 12:05
Cro-Magnons 12:09
moritz Cro-ssants :D
El_Che hehe
hahainternet Web 2.Cro 12:10
jnthn And of course, when we need a break for writing Cro applications, we go to the cro bar... :) 12:11
El_Che Hoed u voor al te gretige koopjesjagers op tweedehandssites die meer bieden dan de vraagprijs. De politie van Mechelen-Willebroek jaagt op dieven die via die sites toegang proberen te krijgen tot de rekening van de verkoper. Dat meldt VRT. 12:12
oops
ignore :)
El_Che If you raise cros, they'll peck out your eyes 12:13
araraloren Can't read that :D 12:13
Nycatelos tyil: desu 12:48
guifa Is there a cleaner way to conditionally pass a named parameter based on its definedness? (I know theoretically I could use a capture slip, but then I lose some of the self-docmenting that goes from explicitly mentioning it) 15:23
Right now I’m using foo( |(:$bar if $bar) ) but it just feels… ugly 15:24
If I pass directly, the second method gets an Any type and that prevents the default value from being loaded 15:27
gabc Hi, let's say I have a string "~/dir" and I want to expand the ~ to be a absolute path, is there a method for that already? 16:52
Right now I have this, $file.subst: /^.*\~/, $*HOME; which seems to work but feels clunky
MasterDuke gabc: docs.perl6.org/routine/resolve#cla...%3A%3APath seems like it might do what you want 16:53
lizmat MasterDuke: that doesn't do ~ expansion 16:54
gabc It doesn't seem to work, maybe it's an osx thing
lizmat my "solution": my $file = "~/ten"; $file = $*HOME ~ $file.substr(1) if $file.starts-with("~/"); 16:56
gabc Looks good too thanks :) 16:59
I tried to see if something already did the ~ expansion and couldn't find anything
MasterDuke oh, .absolute works
m: say "~/".IO.absolute 17:00
evalable6 /home/bisectable/git/whateverable/~
gabc In my case it doesnt:
> "~/".IO.absolute
/Users/g/Music/~
(my cwd is ~/Music)
gabc And even then, /home/bisectable/git/whateverable/~ <- this isn't right is it? 17:01
lizmat MasterDuke: I don't think anything does ~/ expansion, as it is an shell / OS specific thing 17:02
MasterDuke hm 17:04
gabc anyway, thanks for the help again :) 17:12
SmokeMachine guifa: |(:bar($_) with $bar) 17:16
guifa SmokeMachine it’s not exactly prettier haha 17:17
I was hoping for something like :?$bar
:-)
SmokeMachine But this one tests definedness and not truthness... 17:18
guifa ah fair
in my case the two may as well be the same, that’s probably why it’s been working 17:19
SmokeMachine guifa: maybe a slang for that? 17:22
://$bar ?
Definedness 17:23
And :||$bar for truthness?
guifa I like the idea. I’ve never written a slang before. 17:24
SmokeMachine m: my $bla =True; say :!$bla 17:28
evalable6 (exit code 1) 04===SORRY!04=== Error while compiling /tmp/RypFO4HrNd
Malformed False pair; expected identifier
at /tmp/RypFO4HrNd:1
------> 03my $bla =True; say :!08⏏04$bla
SmokeMachine could be bla => False
SmokeMachine m: given 42 { dd [ :.is-prime ] } 17:30
evalable6 (exit code 1) 04===SORRY!04=== Error while compiling /tmp/Zj19zqcydb
Bogus statement
at /tmp/Zj19zqcydb:1
------> 03given 42 { dd [ :08⏏04.is-prime ] }
expecting any of:
colon pair
SmokeMachine Could be :!is-prime
guifa: ^^
Elronnd jnthn: alright 17:54
antoniogamiz I'm back :D \o/ 18:04
if someone is near Granada and wants to participate: github.com/antoniogamiz/devroom-perl-eslibre 18:05
guifa antoniogami: I’ll be near there this summer 18:24
Ah but it’s in June. I don’t get there until July
antoniogamiz guifa: almost :( 18:33
cpan-p6 New module released to CPAN! AttrX::Mooish (0.6.2) by 03VRURG 18:41
guifa AND DONE! 19:02
Intl::CLDR now has a fully featured decimal number formatter
guifa say format-number(12348596, :language<ar>, :scientific) —> ١٫٢٣٤٨٥٩٦اس٧ 19:34
say format-number(532812, :language<de>, :long) —> 5,3 Tausend
say format-number(384921923, :language<ja>, :short) —> 3.8億 19:35
masak is pleased to confirm that `enum E does R <...>` Just Works 22:09
timotimo DrForr: did you know about "<comment> +"? 22:28
DrForr: also, the paragraph near the end about "the csv test suites" sounds like you're referring to tux's test-t, but that uses stuff other than regexes to become fast 22:31
guifa So say I have a grammar Foo. It can get instantiated with special settings and has associated actions that are basically obligatory for it to be usefull. What’s the best way to use that instantiated grammar in another grammar? Or is the only way to make the new grammar a subclass of Foo? 22:39
guifa thinks it would be awesome to actually be able to request a reusable regex/grammar that detects numbers — based on locale — even when percentages/exponential/etc, and then can provide the value 22:45
jnthn guifa: Dunno if it helps, but it's possible to put tokens/rules/regexes in a role also 22:48
guifa: Which means you can make composable pieces that are then put together 22:49
timotimo if the actions are so inextricably linked to the grammar itself, it may not be the worst idea to actually put them inside the tokens/rules/regexes 22:51
guifa Ah! That would be much more agreeable than a grammar (and make more sense, “grammar DocumentParser does LocalizedNumberParser” sounds much better than “grammar DP is LNP”) 22:52
With the NumberFormatter grammar already made it shouldn’t be too hard to make a new one that does lenient parsing 22:54
timotimo or even "also does ParseLocalizedNumbers" 23:00
"also does That-Thing-With-The-Numbers" 23:05
guifa will worry more about naming after he makes it work :-) 23:12
cpan-p6 New module released to CPAN! Pygments (0.0.1) by 03MATIASL 23:24
MasterDuke anyone have an email address for Skarsnik? 23:35
Kaiepi ping 23:59
\o