»ö« 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.
Xliff Can objects have state attributes? 00:09
timotimo you mean attributes that are shared between all instances of the class?
Xliff Yes
timotimo i think putting a "my" scoped variable in there does that for you
plus probably an accessor method you'd write yourself 00:10
Xliff OK, thanks.
timotimo method sharedThing is rw { $shared-var }
geekosaur irc my is private to the instance, our is shared between instances
iirc
timotimo i'd say it more like "my is private to the scope", and i don't think classes are closures, so you get one shared by every instance of the class
more specifically, all methods (and other things with curlies) in the classes curly-braces-block should share the same closure with the variable in it 00:11
let me quickly verify
m: sub test-it { sub gimme-class($val) { class TestClass { my $shared-val = 99; method set($oval) { $shared-val = $oval }; method get { $shared-val } } }; my $i1 = gimme-class(99); say $i1.get; my $i2 = gimme-class(1000); say $i1.get; say $i2.get; }; test-it; test-it; 00:13
camelia 99
99
99
99
99
99
timotimo oh, i don't even use $val 00:13
m: sub test-it { sub gimme-class($val) { class TestClass { my $shared-val = 99; method set($oval) { $shared-val = $oval }; method get { $shared-val } } }; my $i1 = gimme-class(99); say $i1.get; my $i2 = gimme-class(1000); say $i1.get; say $i2.get; $i1.set("changed on i1"); say $i1.get; say $i2.get; }; test-it; say "next test"; test-it;
camelia 99
99
99
changed on i1
changed on i1
next test
99
99
99
changed on i1
changed on i1
timotimo looks like i was wrong, and classes actually are closures? 00:14
so you'll have to be careful not to get the class closure-cloned. just having it at the outermost level should be enough for that
Xliff Noted. 00:15
timotimo++
timotimo not 100% sure how modules will interact with that. i don't think use-ing a module a second time would give you a different closure 00:17
but it'd surely be prudent to check it out
Xliff Will do. 00:29
Xliff m: 1.does(Int).sayu 01:19
camelia No such method 'sayu' for invocant of type 'Bool'. Did you mean 'say'?
in block <unit> at <tmp> line 1
Xliff m: 1.does(Int).say
camelia True
Xliff m: package A { sub a {}; }; class B { method b {}; }; say A ~~ B 01:23
camelia False
Xliff m: package A { sub a {}; }; class B { method b {}; }; say A.^name
camelia A
Xliff m: package A { sub a {}; }; class B { method b {}; }; say A.WHAT
camelia (A)
Xliff m: package A { sub a {}; }; class B { method b {}; }; say A ~~ Class
camelia 5===SORRY!5=== Error while compiling <tmp>
Undeclared name:
Class used at line 1
Xliff m: package A { sub a {}; }; class B { method b {}; }; say A ~~ class
camelia 5===SORRY!5=== Error while compiling <tmp>
Whitespace required after keyword 'class'
at <tmp>:1
------> 3class B { method b {}; }; say A ~~ class7⏏5<EOL>
tbrowder___ .ask [Coke] are the dates for TPC::NA 2019 decided yet? 01:24
yoleaux tbrowder___: I'll pass your message to [Coke].
Xliff m: package A { sub a {}; }; class B { method b {}; }; say A.HOW 01:30
camelia Perl6::Metamodel::PackageHOW.new
Xliff m: package A { sub a {}; }; class B { method b {}; }; say A.HOW; say B.HOW
camelia Perl6::Metamodel::PackageHOW.new
Perl6::Metamodel::ClassHOW.new
01:31
Xliff m: package A { sub a {}; }; class B { method b {}; }; say A.HOW ~~ PackageHOW
camelia 5===SORRY!5=== Error while compiling <tmp>
Undeclared name:
PackageHOW used at line 1
Xliff m: package A { sub a {}; }; class B { method b {}; }; say A.HOW ~~ Perl6::Metamodel::PackageHOW
camelia Could not find symbol '&PackageHOW'
in block <unit> at <tmp> line 1
Xliff m: package A { sub a {}; }; class B { method b {}; }; say A.HOW ~~ /'PackageHOW'/
camelia 「PackageHOW」
timotimo m: use Perl6::Metamodel:from<NQP>; say Int.HOW ~~ Perl6::Metamodel::ClassHOW 01:32
camelia True
Xliff timotimo++ # Thanks, again. 01:41
timotimo merely passing on what took me $amount-of-time to figure out the first time around :) 01:45
i think i just came up with a most exquisite footgun for y'all to recklessly play with 01:47
timotimo just need to find a good example of sillyness to use it with 01:49
m: BEGIN $*W does role { method compile_time_evaluate($/, $ast, :$mark-wanted) { die "no CTE allowed" } }; constant hello = 99 + 5; 01:50
camelia 5===SORRY!5=== Error while compiling <tmp>
An exception occurred while evaluating a BEGIN
at <tmp>:1
Exception details:
No such method 'BUILD_LEAST_DERIVED' for invocant of type 'Perl6::World+{<anon|1>}'
in code at <tmp> line 1
timotimo whoops, hah 01:51
timotimo well, that's not so easy :D 01:52
timotimo m: BEGIN $*W does role { method compile_time_evaluate($/, $ast, :$mark-wanted) { die "no CTE allowed" }; method BUILD_LEAST_DERIVED(|c) {} }; constant hello = 99 + 5; 01:52
camelia ( no output )
timotimo hmm
m: BEGIN $*W does role { method compile_in_context($past, $code-type) { die "no CTE allowed" }; method BUILD_LEAST_DERIVED(|c) {} }; constant hello = 99 + 5; BEGIN say "hi" 01:53
camelia 5===SORRY!5=== Error while compiling <tmp>
An exception occurred while evaluating a constant
at <tmp>:1
Exception details:
Type check failed in binding to parameter '$past'; expected Any but got QAST::Block (?)
in method compile_in…
timotimo m: BEGIN $*W does role { method compile_in_context(Mu \past, Mu \code-type) { die "no CTE allowed" }; method BUILD_LEAST_DERIVED(|c) {} }; constant hello = 99 + 5; BEGIN say "hi"
camelia 5===SORRY!5=== Error while compiling <tmp>
An exception occurred while evaluating a constant
at <tmp>:1
Exception details:
no CTE allowed
in method compile_in_context at <tmp> line 1
timotimo m: BEGIN $*W does role { method compile_in_context(Mu \past, Mu \code-type) { exit note "no CTE allowed" }; method BUILD_LEAST_DERIVED(|c) {} }; constant hello = 99 + 5; BEGIN say "hi"
camelia no CTE allowed
timotimo gnite! 01:54
Zoffix m: say Int.HOW ~~ Metamodel::ClassHOW 02:07
camelia True
holyghost hello, I'm going to try to extend Game::Markov 03:13
I need to read up first
This week I mean 03:15
buggable New CPAN upload: App-Tasks-0.0.10.tar.gz by JMASLAK modules.perl6.org/dist/App::Tasks:cpan:JMASLAK 03:22
buggable New CPAN upload: Mathx-Stat-0.1.6.tar.gz by HOLYGHOST modules.perl6.org/dist/Mathx::Stat:...:HOLYGHOST 04:22
holyghost eco: Game::Markov 04:28
buggable holyghost, Game::Markov 'Markov Strategy kit for games': modules.perl6.org/dist/Game::Markov...:HOLYGHOST
New CPAN upload: Game-Markov-0.1.7.tar.gz by HOLYGHOST modules.perl6.org/dist/Game::Markov...:HOLYGHOST 04:32
holyghost ok, beer time 04:40
I'd better release under the beerware license, I just knocked my head off on the Rao-Blackwell algorithm 04:41
:-)
for iterator's sake we can have a for @indices -> $x,$x.index or something 04:45
it's and old programming paradigm but it's come clean :-)
for is Ken's loop word, but never mind 04:47
loop comes from Lisp 04:48
index is from python 04:52
Juerd An element of an array does not know it belongs to the array, so .index can't work like that. The same variable can be an element of multiple arrays, even. 05:07
Instead, if you have an array of indices @indices of the array @array, then just iterate over the indices and the corresponding elements in parallel: for @indices Z @array -> ($index, $element) { ... } 05:09
Errr 05:10
Nope.
I meant for @indices Z @array[@indices] -> (...) { ... } of course
I should go to bed :) 05:11
afk
geekosaur m: my @a = <a b c d>; for @a.kv -> $index, $element { say "$index is $element" } 05:16
camelia 0 is a
1 is b
2 is c
3 is d
geekosaur the element doesn't know, but the array does — so make the array do the lifting 05:17
holyghost geekosaur: thx 05:41
so kv on a list instead of a hashmap
buggable New CPAN upload: Mathx-Stat-0.1.7.tar.gz by HOLYGHOST modules.perl6.org/dist/Mathx::Stat:...:HOLYGHOST 05:42
holyghost ^-- I programmed in the long awaited iterative conditional probability method :-) 05:43
Now I need to extend Bayes::Learn with a second system in it with the above
buggable New CPAN upload: Mathx-Stat-0.1.8.tar.gz by HOLYGHOST modules.perl6.org/dist/Mathx::Stat:...:HOLYGHOST 06:02
New CPAN upload: Mathx-Stat-0.1.9.tar.gz by HOLYGHOST modules.perl6.org/dist/Mathx::Stat:...:HOLYGHOST
buggable New CPAN upload: Game-Markov-0.1.8.tar.gz by HOLYGHOST modules.perl6.org/dist/Game::Markov...:HOLYGHOST 06:32
buggable New CPAN upload: AI-Agent-0.1.21.tar.gz by HOLYGHOST modules.perl6.org/dist/AI::Agent:cpan:HOLYGHOST 06:52
holyghost ^-- done for today, now some BSD wine :-) 06:53
man, I feel better after some coding :-) 06:56
jmerelo holyghost: great job :-) 06:57
holyghost thx :-) There's still bugs left but I'll refactor/debug after everything is finished 06:58
I'm burning ozon in the ecosystem :-) 06:59
jmerelo holyghost: not by the least. You're adding another ecological niche, which is good. Lots of good stuff can be done with that 07:00
holyghost it's open source in the download directory 07:00
So anyone can debug indeed
I have my niche and I am happy about that, did 20 years of linux coding while I caught up with perl 5 07:01
jmerelo holyghost: anyway, a great addition. Will check it out. 07:02
holyghost thx, enjoy
Geth doc/master: 5 commits pushed by (Christian Sánchez)++, (Juan Julián Merelo Guervós)++ 08:26
ufobat___ what am i doing wrong? 08:37
nopaste.xyz/?31baf62bf499a213#+fyW...IBV2da8DA=
my basic authentiactoin is not called at all, the say in line 7 is never called 08:38
timotimo you're never asking for a user to be passed to your route, maybe that's it? 08:40
ufobat what do you mean? 08:42
isnt this question the "before MyBasicAuth.new"?
timotimo none of your routes takes a session parameter
ufobat true, but there is no session, is there any? i just wanna check if they pass the authentication 08:43
timotimo let me check the sauce 08:44
aha 08:45
Cro::HTTP::Auth::Basic requires an Authorization header to be set in the request
only then will it call self.authenticate
ufobat that means i cant protect my routes ;D 08:46
timotimo how do you mean?
ufobat the route should only be available if youre sending the authentication header
if net, you're not allowed to see it
timotimo then you need to tell cro that the routes are for authenticated users only 08:47
ufobat how?
geekosaur do consider that http doesn't provide a way to do that
timotimo -> LoggedInUser $user, 'foo' { ... }
have LoggedInUser be a subset type that identifies whether a MyUser object is logged in or not
geekosaur the client doesn't know to send auth until it has requested a page and the servr has resnded with an auth-required eror
timotimo iirc it will then always send that authorization header, right? 08:48
ufobat geekosaur, that is true. the client is my curl. what i wanted to archive is that my request gets rejected
ufobat I find the cro documentation hard to understand :( 08:53
timotimo your input is probably appreciated!
ufobat i dont know how to improve it, yet. still thinking 08:54
i started a project with a friend of mine, he was a java backend guy, i convinced him learning perl6, i am learning vuejs and typescript
after 20 minutes the called me and told me he doesnt get it at all 08:55
ufobat he started with cro.services/docs/http-auth-and-sessions and didnt understand how to apply the "middlewares" i think it is called 08:55
ufobat after a while you realize that there is a tiny little link that points to cro.services/docs/reference/cro-http-router that has tha information for you 08:56
you realize that there is a before for that
but the next thought was, hm is before correct, because what if i am not logged in, i actually wanna reject it or say "please log in first" in http manner 08:57
so he decides to better understand middlewares first. we started to read cro.services/docs/reference/cro-http-middleware
the idea was that you actually need to "send"/ajust the response if the login fails or is missing so you need to do a "conditional" middleware like cro.services/docs/reference/cro-ht...iddleware# 08:58
wich looks like a perfect firt at a first glance 08:59
timotimo yeah that looks like it'd work 09:00
ufobat after a while when you read the http-router documentation again in the last part "Applying_middleware_in_a_route_block" you see that the before introduces a after as well 09:00
so you realize hey it might still be much simpler
timotimo right, an "after" middleware could replace the response body with some custom html if the status is 401 09:02
ufobat i am not complaining or wining or something, that was just what happend to us, we're jumping around serveral pages and dont know nothing afterwards
timotimo you're winning :)
ufobat wineing :)
wine?
:D
moritz pining, for the fjords :D 09:03
timotimo Wine Ingenieur: WinIng
sjn whining, schmining :)
ufobat and after you said -> LoggedInUser i was at the http-router documentation to really understand `get` and i am not decided if `-> LoggedInUser $user, '/foo/` means that the URL is /username/foo or not 09:04
shortguy Where are the language flow control structures declared, such as if and while? I'm having zero luck so far. And in a related question, where are some of the built in methods declared, such as "require" ? I've looked at the rakudo source and the nqp source but I'm not having much luck with either. 09:05
ufobat in fact it is just me reading the documentation "wrong" but tell me, how could we improve it that you dont get missleaded like i did?
timotimo the section "router support" explains that part 09:08
"Such a parameter will not be treated as the first route segment, but instead will be populated with the contents of the auth property of the Cro::HTTP::Request being processed." 09:09
ufobat ah :-) 09:09
timotimo shortguy: docs.perl6.org/language/control - not sure if that's enough to answer your first question
geekosaur shortguy, docs.perl6.org/language/control which is linked as "Control Flow" from docs.perl6.org/language.html
ufobat feels like he did a rant ;) 09:10
timotimo docs.perl6.org/routine.html - this lists all routines - including operators - that are doced in the docs
geekosaur "require" is docs.perl6.org/language/modules likewise linked as "Modules" from the language page
holyghost for hashed methods in a hash, I suppose @!dependencies is a class variable 09:11
shortguy timotimo: I'm looking for the implementation though, I'm guessing the control flow bits are implemented in a grammar file defining perl6, but I'm having trouble finding it 09:12
buggable New CPAN upload: AI-Agent-0.1.22.tar.gz by HOLYGHOST modules.perl6.org/dist/AI::Agent:cpan:HOLYGHOST
timotimo oooh
yes, i can help that
shortguy Fantastic
timotimo it's the series of statement_control:sym<blah> rules in the Grammar.nqp 09:13
there's more than just "if" and "else", as import/use/no/... are also among those 09:14
huh, i should really have been able to tell from your question that you were looking for source, not documentation 09:15
shortguy No worries 09:16
holyghost I'm just doing things documentation wise 09:17
shortguy I've been spending some time looking at how hard it would be to implement an "as" qualifier to the use statement, so I could do use Long::Namespace::Qualifier::Class as Class
I tried adding a shortname in the %EXPORT hash in module declaration, but that clashes if you have two modules with the same short name 09:18
holyghost shortguy: same as Class is export
timotimo holyghost: no, used on the "use" side, not the declaration side 09:19
geekosaur I thik the main problem is that currently any extra stuff in use is passed to the importer
shortguy I also tried adding an if switch in the export statement so I could do use Long::Namespace::Qualifier::Class "Class", which kinda worked but it still involved lots of boiler plate writing the switches because idk how to dynamically figure out the current class in the EXPORT statement, because that is seperate from the class definition
holyghost timotimo: I'm, from @ISA world
geekosaur so 'as' would need a special case
shortguy Well I mean, I got it working using some grep & eval magic on the debug backtrace but it felt pretty dirty 09:20
timotimo "current class" isn't always a thing
holyghost Maybe you could re-export the hash
timotimo if you have a "unit class", that makes sense, but a package/module can have as many classes as you want, including none
holyghost true
re-export at runtime
shortguy Yeah I know, that's why my solution was never going to work, but it was cool doing a spot of metaprogramming 09:21
timotimo if you're feeling especially fancy, you could offer a slang
geekosaur isn't the usual way to do this a module constant?
timotimo you mean like "constant MyModule = do { need FooModule; FooModule }; or something?
i guess inside a "constant" it'd be enough to "require" 09:22
geekosaur constant Foo = My::Long::Foo::Thingy; or some such
timotimo that doesn't help if a module is spewing symbols all across the user's namespace thanks to "is export"
holyghost and unit module 09:23
shortguy This Grammar.nqp file is pretty intimidating 09:26
holyghost NQP is the way to go, AFAIK 09:27
timotimo oh yeah, it's huge
how do you mean, holyghost?
holyghost OOP wise with perl6 in mind
timotimo i don't think i understand 09:28
holyghost I wrote a nqp class for an SDL2::Raw game that's where I know from
It's in PaganVisions2 at github.com/theholyghost
timotimo NQP has a major shortcoming for things like simulations and such, it often converts between int and float without a good reason
holyghost I don't remember 09:29
shortguy So Grammar.nqp just describes how stuff is parsed and then the actual implementation is in another file 09:31
I think I'll spend some time hacking on this
timotimo i'm not sure what you mean by "actual implementation" 09:35
but Actions.nqp is directly coupled to the Grammar.nqp; whenever a rule/token/regex is successfully parsed, a method of the same name is called on the Actions class and the match object is passed as first argument 09:36
shortguy Grammar.nqp has a rule statement_control:sym<use> and Actions.nqp has a method statement_control:sym<use>, so I'm guessing once it gets parsed/matched in Grammar.nqp the rule is called from Actions.nqp? 09:37
well there we go, should've just waited a few seconds for you to explain it
timotimo haha 09:38
shortguy The rule matches "<sym> <name>" which I'm lazily going to assume matches "use packagename", this in turn calls a method load_module, which is then loaded from whatever backend I'm using, right? 09:50
timotimo <sym> is short for "match what is part of the rule name" 09:52
so rule foo:sym<hello> { <sym> } would match the string "hello" 09:53
lizmat . 09:54
holyghost I guess it's meta-circular eval
I didn't know 09:55
lizmat clickbaits p6weekly.wordpress.com/2018/10/29/...proaching/
Altreus oh good 09:58
I was about to scroll up looking for this 09:59
:)
holyghost lol
Altreus lizmat++ # clairvoyant
holyghost I'm in SSL 0.96. though :-)
s/0.96/0.9.6 10:00
lizmat Altreus: p6weekly.wordpress.com will always give you the most recent
Altreus well that's just cheating :P 10:01
lizmat I mention the specific ones for the logs, really
Altreus also to remind me to check ;)
do we know who owns perl11.org? the cert is invalid 10:03
holyghost Just recalculate ;-) 10:04
dump the packets and calculate :-) 10:06
ufobat timotimo, sill doesnt work :( nopaste.xyz/?0bcaf75dbe253266#r96D...Xg6nV6MrQ= 10:07
holyghost Altreus: maybe just use Bayes::Learn
shortguy <+timotimo> if you're feeling especially fancy, you could offer a slang 10:11
timotimo: what did you mean by this?
timotimo invent a whole new keyword to replace "use"
that would allow parsing an "as" parameter 10:12
maybe have it be like "use-as Foo The::Actual::Module"
lizmat timotimo: or we could just implement "use longname as shortname" for 6.e ?
ufobat sounds like pyhton :) 10:13
shortguy I feel like adding "as" to the existing "use" would lower complexity, so you don't have to look at a bunch of different operators in the top of the file
jnthn I think there's already a proposed syntax for that renaming, using an adverb 10:14
shortguy Not one that I could find, though perl6 discussions are pretty sprawled out
timotimo worst case, have a module that does the "renamed" importation for you 10:15
a bit like the "if" module
use LoadThisForMe "The::Original::Module:ver<1.9>" => "ShortName"; 10:16
BBL
jnthn use
oops
lizmat jnthn: the proposal was "use alias:name<longname>" I think
jnthn Glancing S11, I think it's `use ShortName:name<The::Really::Long::Name>`
Yup
lizmat m: use Foo:name<Test> 10:17
camelia ===SORRY!===
Could not find Foo at line 1 in:
/home/camelia/.perl6
/home/camelia/rakudo-m-inst-2/share/perl6/site
/home/camelia/rakudo-m-inst-2/share/perl6/vendor
/home/camelia/rakudo-m-inst-2/share/perl6
CompUnit::Repo
lizmat fwiw, that still is a bit counter-intuitive for me
m: use Benchmark:from<Perl5> 10:18
camelia ===SORRY!===
Please install Inline::Perl5 for Perl 5 support.
shortguy the order of arguments to that seems weird to me
But what do I know
jnthn: Where do I find this proposal?
lizmat S11
actually as part of: 10:19
m: use Foo:from<Perl5>:name<Benchmark>
camelia ===SORRY!===
Please install Inline::Perl5 for Perl 5 support.
lizmat ===SORRY!=== 10:20
Can't locate Foo.pm in @INC
if you do have Inline::Perl5 installed
Altreus shortname:name<longname> looks backwards to me 10:25
Is that what you meant?
use Module:as<M> looks forwards
shortguy yeah 10:26
jnthn The :name approach is logical, when considered together with :auth and :ver
Since it's just specifying the name of the thing to load 10:27
And so leaves the name immediately after the `use` as consistently being the one that's introduced
Whereas if you start doing it the other way around, you have to read ahead to know what names you're introducing into the scope
So the design proposal probably has it right 10:28
shortguy But this isn't implemented currently? 10:29
lizmat indeed
Altreus But it's only logical if you know the logic behind it, whereas one of the nice things about Perl5 is you could make your code look like it was written in sentences 10:30
So rather than having logical consistency one layer down, we'd have grammatical consistency at the top layer
less thinking
I suppose the other way of looking at it is simply that I don't think "name" means the right thing grammatically
"from" would make more sense
or something like that
lag? In 2018?
jnthn :from is already used
Altreus use Foo:actually<FooBar> 10:31
:bywhichimean
jnthn But the point is that there's already a `name` property and you've probably already used it in META6.json :)
Altreus I can see the logic but for some reason it doesn't fit 10:32
Not like I wouldn't get used to it after a while, but if there's time left to make it perfect then let's 10:33
shortguy "As" is what makes sense to me, but that might be because it's what I'm used to, but it makes intuitive sense to say "use Project::Admin::User as Adminuser; use Project::RegularSchmoe::User as Regularuser"
jnthn shortguy: There's very, very little chance of us introducing such an arbitrary syntax. 10:34
Altreus I think the reason I don't like :name is simply that whenever I'm linking A to B, I would use a property of A, not of B, as the key
Foo:name<Bar> is using the property of Bar (name) as a property of Foo, which is illogical 10:35
jnthn So you think :ver and :auth are illogical too?
Altreus In fact you're setting the *source* of Foo
no, because then you're setting the version and auth of Foo
Foo is the name of Foo, but it comes from Bar
For :name to be consistent with :ver and :auth like that, you'd have to *end up* with those properties 10:36
jnthn Not really; the adverbs are lookup keys that indicate how to find the thing to import.
Altreus Foo:ver<1>:auth<meow>:name<Bar> should end up with something at version 1, authed by meow, and called Bar
But you actually end up with the name being Foo 10:37
Altreus hmm the more I stare at that the more I flick between one side and the other 10:39
lizmat Altreus: that feeling is very well known to me 10:40
Altreus it's probably those government mind rays
lizmat the ones responsible for the contrails ?
Altreus I did wonder what they were! that makes sense
But yeah now I think about it, it's like you're constructing an object out of :name :ver :auth, and putting it in Foo 10:41
mind you, if I were constructing an object like this, I'd use a different parameter for :name so it's not confusing ;)
jnthn The already *is* such an object in the API behind `use`, and it has precisely those properties :) 10:42
buggable New CPAN upload: AI-Agent-0.1.23.tar.gz by HOLYGHOST modules.perl6.org/dist/AI::Agent:cpan:HOLYGHOST 11:12
melezhik Hi! I have a date in format "2018-10-30T08:10:42-06:00" I'd like to convert it into "x time ago" ( "5 minutes ago, 1 hour ago and so on ") .. any ready Perl6 modules for that? 14:12
Zoffix eco: Number::Denominal 14:21
buggable Zoffix, Nothing found
Zoffix eco: Number::Denominate
buggable Zoffix, Number::Denominate 'Break up numbers into preset or arbitrary denominations': modules.perl6.org/dist/Number::Deno...fix%20Znet
Zoffix melezhik: try that one. IIRC it can take a number of seconds and convert to "5 weeks, 4 days, ..." formatted string 14:22
melezhik sounds good, Zoffix: , thanks
Zoffix $ perl6 -MNumber::Denominate -e 'say denominate(DateTime.now - DateTime.new("2018-10-30T08:10:42-06:00")) ~ " ago"' 14:24
13 minutes and 38 seconds ago
$ perl6 -MNumber::Denominate -e 'say denominate(DateTime.now - DateTime.new("2015-12-25T08:10:42-06:00")) ~ " ago"'
148 weeks, 4 days, 13 minutes, and 59 seconds ago
It only goes up to `weeks` but you can define your own units
melezhik thanks, Zoffix: 14:27
will give it a try
melezhik does Perl6 has sort construction, like Perl5 does? 15:31
I need to sort array of hashes by one hash key
timotimo i don't know what "sort construction" means, but you can just .sort(*.<thekey>) 15:32
melezhik like this one? - say 'bca'.comb.sort({$^b cmp $^a}).join;
timotimo i would not recommend using a two-argument function as the argument to sort 15:33
only if you really need it
melezhik .sort(*.<thekey>) would be ok too, thanks
how to do the same in reverse order? 15:34
! *.<thekey> ?
moritz .sort(*.<thekey).reverse 15:36
.sort({ $^b<thekey> cmp $^a<thekey>))
melezhik thanks
lizmat melezhik: using a 2 arg sorter prohibits the sorter to do a Schwartzian transform under the hood, which may have performance implications 15:38
melezhik ok, thanks, i decided to choose 1 arg sorting , it works for me 15:41
lizmat also: .reverse on an array is almost a noop, as it will just use an iterator that goes from end to beginning
so no data is hurt during the .reverse :-) 15:42
rindolf Hi all! I am using github.com/shlomif/rakudo-git-master-install and zef stopped getting installed 15:52
moritz rindolf: maybe you should open an issue in that repo :-)
rindolf moritz: heh
El_Che rindolf: your block brackets are all wrong, that's why! /o\ 15:54
rindolf www.shlomifish.org/Files/files/tex...do-log.txt - log 15:55
El_Che: where?
El_Che: wrong how?
El_Che wrong as a discussion between tabs and spaces 15:56
KR and not
rindolf El_Che: what?
El_Che: is this bikeshedding?
El_Che en.wikipedia.org/wiki/Indentation_...mp;R_style
it's rather playful trolling :)
moritz rindolf: it looks like zef is already installed
rindolf moritz: ah 15:57
moritz: it is not in the path
moritz rindolf: you might need to adjust your PATH
rindolf moritz: ah 15:58
moony_ p6: say «moo 1 2 3>[0] 15:59
camelia 5===SORRY!5=== Error while compiling <tmp>
Unable to parse expression in shell-quote words; couldn't find final '»' (corresponding starter was at line 1)
at <tmp>:1
------> 3say «moo 1 2 3>[0]7⏏5<EOL>
expecting any of:
moony_ p6: say «moo 1 2 3»[0] 16:00
camelia moo
moony_ p6: say «moo 1 2 3»[0] × «oom»
camelia Cannot convert string to number: base-10 number must begin with valid digits or '.' in '3⏏5moo' (indicated by ⏏)
in block <unit> at <tmp> line 1
rindolf moony_: i cannot find it anywhere
moony_ ?
rindolf moritz: : i cannot find it anywhere 16:01
moony_: sorry
moritz rindolf: for me, it's installed to $PREFX/share/perl6/site/bin/zef 16:02
rindolf moritz: ah
moritz in case of doubt, find -name zef 16:04
rindolf moritz: yes
moony_ y u ping 16:06
rindolf moritz: thanks, had to tweak the path 16:12
moony_: ping? 16:13
ugexe for the purist you can use zef without tweaking the path even -- `perl6 -MZef::CLI -e '' install Cro::HTTP -v`
El_Che could be useful as an alias for switch between the local and the global zef install 16:16
rindolf moritz: next question - why does this work locally even after a complete reinstall - travis-ci.org/shlomif/ci-gen-frame.../448310042 ? 16:17
leont: any idea? 16:18
SmokeMachine `use RealNameModule:as<Foo>`looks good imo 16:19
ugexe :as<> isn't consistent with anything else 16:20
:name is already in the meta data. we already have Foo.^name Foo.^ver Foo.^auth 16:22
jkramer I just had P6 segfault on after running for ~2 weeks :( 16:25
timotimo oh crap. do you happen to have a core dump? 16:30
moony_ timotimo: *eats apple* core dumped. I have no idea how to actually use core dumps, which bugs me. Mind telling me how to debug with them? 16:31
jkramer timotimo: Nope. I also don't know when exactly happened, I just saw it in a tmux session. 16:32
timotimo OK
moony_: have you played nethack? it's basically just like that :P
jkramer timotimo: Actually nevermind, I updated perl6 today, I'm pretty sure replacing the binary/libs was what caused the crash
moony_ uh, i pulled that joke straight out of nethack. Course i have.
timotimo oh 16:33
moony_ goes back to playing nethack, like he was just a few seconds ago 16:34
timotimo yeah, rebuilding moar or rakudo or something while one is running causes other moar processes to either crash immediately, or very soon after
moony_: i tried to make an additional bad joke on top, but it didn't land
debugging with a core dump is a lot like debugging with a program, except you can't do any "continue" or "step" or things
and i'm not sure if you can "call" either?
leont rindolf: I may have broken your code, sorry about that. That constructor wasn't intended for public consumption (but until recently it didn't have documentation) 16:36
rindolf leont: ah 16:37
leont: what is the latest version in the pkg repo?
leont: i am getting v0.0.1
rindolf leont: github.com/Leont/getopt-long6 - no tags here 16:38
perlbot Anonymous pasted a new file at f.perl.bot/p/4kf482 - 16:38
Geth doc: 101be5ac5c | Coke++ | doc/Language/module-packages.pod6
run more tests
17:06
synopsebot Link: doc.perl6.org/language/module-packages
rindolf leont: ping 17:17
leont I've made a 0.0.2 now 17:19
Previous really should have been 0.0.0 or something
moritz version numbers are just smoke and mirror 17:34
El_Che moritz: but which smoke and which mirror 17:49
xinming How can i profile memory usage for the code? I found for a long run, the memory will take up over 3G 17:55
El_Che Fedora 29 is out! Adding support for in rakudo-pkg. Probably with the hour in a repo close to you :) 18:01
timotimo there's the heap snapshot profiler, xinming
lizmat short answer: run with --profile ?
long answer: listen to timotimo
timotimo the --profile will give you info on what gets created, the heap snapshot profiler will give you info on what gets kept around
the heap snapshot profiler will currently take one heap snapshot per GC run, which can lead to extremely big files rather quickly 18:02
i've tried to make it only run on major GC runs in the past, but somehow that caused crashes and misbehaviour, and since then i've focused mainly on the instrumented profiler 18:03
do you want any specific help? 18:05
rindolf hi all 18:13
leont: here?
leont Yeah 18:13
rindolf leont: hi 18:14
leont: what is the latest release of getopt::long? 18:15
leont NOw 0.0.2. You probably want to be using the get-options function 18:16
rindolf leont: ok 18:17
rindolf leont: with a custom array? 18:17
leont get-options-from
xinming timotimo: yes. 18:18
timotimo: how do I use heap snapshot profiler?
rindolf leont: thanks 18:20
timotimo all you need to do™ is to pass --profile=heap to your perl6 commandline
be sure to watch the resulting file (it will be a file called something like heapsnapshot-123233411234.08354 in the current working directory
if you ctrl-c the program before it gets the opportunity to "end the profile", it will not be able to be read yet 18:21
so you may want to either have a signal handler or some other means of stopping the program early that goes through a proper shutdown sequence
xinming timotimo: Got it, thanks 18:22
timotimo when you've generated the file, you need the moarvm heapsnapshot analyzer, it's a tool written in perl6 18:24
buggable: eco Heap
buggable timotimo, Heap 'Simple Heap implementation': github.com/FCO/Heap 4 other matching results: modules.perl6.org/s/Heap
timotimo buggable: eco Heapanalyzer
buggable timotimo, App::MoarVM::HeapAnalyzer 'MoarVM heap snapshot analysis tool': modules.perl6.org/dist/App::MoarVM:...thn.net%3E
timotimo github.com/jnthn/p6-app-moarvm-heapanalyzer
timotimo the readme links to two blogposts on jnthn's blog that ought to help you get started 18:25
xinming Thanks
Geth doc: d73aad759a | (Zoffix Znet)++ (committed using GitHub Web editor) | doc/Language/grammars.pod6
Try to fix rogue `>` on the page
synopsebot Link: doc.perl6.org/language/grammars
rindolf leont: thanks, seems to work now 18:27
xinming Cannot unbox 66 bit wide bigint into native integer 18:28
I got this kind of errory
error* 18:29
when I run moar-ha head-snapshot...
timotimo oh? that's certainly not right :D
can you run moar-ha like "perl6 --ll-exception bin/moar-ha heap-snapshot-... ?
"
Geth doc: c118f9498b | (Zoffix Znet)++ (committed using GitHub Web editor) | doc/Language/grammars.pod6
Simplify example

Per colabti.org/irclogger/irclogger_lo...10-30#l379
18:31
synopsebot Link: doc.perl6.org/language/grammars
xinming timotimo: I just got this 18:36
Considering the snapshot...oops!
then, that error, can't unbox blabla
timotimo oh, i wonder if you require my fork for it to work
xinming I can try. 18:37
But I'll go to sleep soon. :-)
timotimo github.com/timo/p6-app-moarvm-heapanalyzer
xinming timotimo: Your version still has the error 18:42
I'm using the 2018.10 version anyway
timotimo how big is the resulting heapsnapshot file? 18:44
jmerelo releasable6: status 18:47
releasable6 jmerelo, Next release in ≈18 days and ≈0 hours. 0 blockers. 0 out of 29 commits logged
jmerelo, Details: gist.github.com/3171cb9c8daf5148c7...6b87702025
jmerelo So there was a release and I didn't know...
lizmat jmerelo: it *was* mentioned in the P6W :-) 18:50
xinming 75M 18:50
101M actually.
jmerelo lizmat: didn't have time to read it either... 18:51
Busy last two days.
OK, will check it out.
timotimo damn, that should totally be doable 18:57
jmerelo BTW, is there going to be a Perl 6 Advent this year? I'm already seeing PRs for the Perl 5's one. 19:00
lizmat hopes so 19:01
jmerelo OK, I see it's already launched, albeit quietly: github.com/perl6/mu/blob/master/mi...8/schedule 19:03
So please add yourself to the schedule on whatever day you choose
lizmat weekly: github.com/perl6/mu/blob/master/mi...8/schedule
notable6 lizmat, Noted!
Zoffix jmerelo: I saw it being started when it did, but "traditionally" it was launched on Nov 1st, so I kept quiet about it :) 19:04
jmerelo Zoffix: it's almost November 1st in some far away island in the middle of the Pacific... So we could as well release it. 19:05
lizmat weekly: uzluisf.gitlab.io/piensaperl6/ # Think Perl 6 in Spanish, comments / Spanish proofreading welcome! 19:06
notable6 lizmat, Noted!
Zoffix jmerelo: sure, why not
moritz I don't think earlier planning / announcement hurts
tweeted about it 19:07
Zoffix moritz++
Geth mu: 69d030933c | (JJ Merelo)++ | misc/perl6advent-2018/schedule
Adds my stuff for Dec 2nd, cna be moved
jmerelo Zoffix: are you still the only person who has the privs to add to the Wordpress blog if they aren't already?
moritz no, I've always had that priv too :-) 19:08
Zoffix jmerelo: doubt it.
moritz so, what could I write about this year? 19:09
jmerelo I don't think I have them. However, I just noted I do have permission for moderating comments, and there were 5 to be approved.
moritz I dont feel I've done muhc Perl 6 stuff this year...
AlexDaniel squashable6: status
squashable6 AlexDaniel, ⚠🍕 Next SQUASHathon in 2 days and ≈14 hours (2018-11-03 UTC-12⌁UTC+14). See github.com/rakudo/rakudo/wiki/Mont...Squash-Day
AlexDaniel :o 19:10
jmerelo: ↑ :o
jmerelo AlexDaniel:
Right
Bad weekend, also
lizmat argh
jmerelo All Saints' long weekend here in Spain and in many other places in Europe. 19:11
Will try to do our best
lizmat forgot to say something about the Squashathon in the P6W :-(
Zoffix jmerelo: masak colomon jnthn lizmat Ulti moritz perlpilot timotimo and couple others no-longer-regulars have admin privs.
AlexDaniel lizmat: yeah I also forgot, was too focused on the release I guess…
jmerelo Zoffix: OK, no problem. Just didn't want to leave all the grunt work for you.
Will try to prepare something tomorrow in the morning. 19:12
I've launched TuPR.club here
Zoffix moritz: dunno, something about grammars? Its our most popular feature, if I recall survey results correctl.y
jmerelo That's a tupper (ware) for your PR (tu PR in Spanish)
Means I will offer food in a container for anyone whose PR is accepted. Payable here in Granada, Spain. So I was going to launch the thing offering free food for anyone whose PR in perl6/doc is accepted. 19:13
Zoffix :) 19:14
Do people get to keep the container? :)
jmerelo Because tees are great, but a good old container with homemade food is even greater.
Zoffix: I actually went to Ikea and bought el cheapo containers just in case they don't give it back.
Zoffix I wish they'd offer something other than tees. I'm getting my 5th one this year… 19:15
jmerelo Zoffix: yep, I thought about stickers initially. But then, a sleepless night (jetlag) got in the way...
AlexDaniel jmerelo: that's during the squashathon? :O 19:16
Zoffix Yeah, food's good.
jmerelo AlexDaniel: yep, I'm going to start with the Squashathon 19:17
AlexDaniel :O that's awesome
jmerelo Then go ahead, open it to anyone...
El_Che Travis is busy pushing packages to github and repo. Added Fedore 29 packages (just out), EOL'ed Fedora 26 19:18
jmerelo El_Che++ 19:20
El_Che We go for same day delivery. Better than Amazon :) 19:21
jmerelo El_Che: great :-) 19:22
El_Che new Fedora 29 repo up 20:08
SmokeMachine should write something about Red on Perl 6 Advent... 20:49
but im not sure if it will be published until there... 20:50
El_Che SmokeMachine: I think a lot of people are looking forward to it 20:51
SmokeMachine El_Che: really?
El_Che SmokeMachine: yes, dbish has its issues 20:52
(looking at the github issues, I am not claiming it does not work :) ) 20:53
SmokeMachine El_Che: but Red isn't a substitute for dbiish... its just an ORM (for SQLite it uses DBIish (but not for Pg)) 20:54
El_Che We've some people asking about ORMs here in the channe 20:55
l 20:56
SmokeMachine :)
ufobat does anyone still has an idea regarding stackoverflow.com/questions/530621...6-with-cro because it just doesn't work on my box :( 20:58
sena_kun tries to look into it, but cannot promise things on rest day 20:59
ufobat :) 21:01
CIAvash ufobat (IRC): not an answer to your question, but I think `$success` is always going to be defined, so `without $success` should be `unless $success` 21:25
koto ufobat, ping? 21:25
ufobat ja?
CIAvash, okay thanks :-) 21:26
ufobat koto? 21:27
koto one thing I know for sure: there are necessary fixes in master(not related to your question), that are not sliced as a version, so to "truly" update it you need git clone && zef install . thing. At least not unless jnthn will make a release, which he is planning to do for sure, I think.
with this "authentication called" message is emitted.
ufobat thats easy to test 21:28
ufobat wondering which version curt was using 21:28
koto I have `curl 7.61.1` and used exact commands as Curl wrote. 21:29
using `unless $success { forbidden };` I can see an exception. Which is better than nothing, I think. :) 21:30
ufobat its sufficient to clone cro and invoke perl6 -Icro/lib example.pl right? 21:31
koto you need to clone `cro-http`.
github.com/croservices/cro-http <- ufobat 21:32
ufobat ty! 21:32
koto np. now looking at how what you want to do can be done(403 repsonse). 21:33
ufobat YEAH! 21:34
nopaste.xyz/?2e7f33044c06cd6c#dxL0...e3K8wW7qs=
^ much better, but still meh ;) 21:35
sena_kun "Cannot unbox a type object (Nil) to int." is pretty unexpected and I am not sure about its cause. :) Personally, I get "Can only use 'content' inside of a request handler", which is reasonable here.
ufobat, what code did you cahnge from what's in SO question? 21:36
ufobat but thats pretty anoying if the stable release of cro is buggy in a way that basic authentication is not working :-(
let met check 21:37
SO is currently not working? :-(
sena_kun but, well, if you fix that, you'll get an exception that I posted, about `request handler`. 21:38
this one must be fixed inside of cro, I know how to do that, but I'll discuss it with jnthn tomorrow to be sure it won't break anything design-wise, though I bet it's likely not. 21:39
ufobat sena_kun, i think i am using 100% Curts example not mine
sena_kun afk for 15 minutes&
ufobat sena_kun, i think the exception that i am running into is because my curl does Content-Type: application/x-www-form-urlencoded 21:48
sena_kun reproduced it this way. 21:49
ufobat curl -v -X POST admin:secret@localhost:10000/api -H 'Content-Type: application/json' -d '{}' <- works
curl -v -X POST admin:secret@localhost:10000/api -d '{}' <- doesn't
sena_kun and with json one you'll get one I mentioned, so there are two. 21:50
sena_kun ufobat, I'll write those down into todo list and fix it after sleep, thanks for raising it. 21:52
ufobat i dont get thet content thingy 21:52
sena_kun .o0 ( and hopefully try to help with the release to make it as effortless as possible, we need one )
ufobat that works for me?
sena_kun ufobat, no, it can't be, I think. You have `forbidden unless $user eq 'admin' && $pass eq 'secret';` line in your code? 21:53
ufobat no i am using curts code not my example, right now
no forbidden here
sena_kun if not, I have it. I thought one of your conditions was to return forbidden on incorrect creds, so I added that.
try to add it. :) 21:54
ufobat yeah 21:55
there it is
sena_kun yup. are you in a hurry for those to be fixed? I can do a quickfix, to avoid waiting for tomorrow. 21:56
ufobat so that means maybe, after the release its possible to make a 403 for failed log ins :)
not at all :)
sena_kun it for sure will be possible. ok.
ufobat :-)
i'll wait for the release :-) i think there enough things that are fixed 21:57
thanks a lot!
sena_kun you are welcome!