»ö« 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.
thou Is Cat / cat() (lazy Str interface) gone away? 00:47
any replacement I ought to know about? 00:48
Geth_ synopsebot: deec85bc50 | (Zoffix Znet)++ | 4 files
First draft

That doesn't seem to work on my local box :/ Gonna try another one
00:53
Zoffix thou: it's yet to be implemented 00:58
thou Zoffix, OK, thanks. For some reason I imagined using it in the past, but probably it was just a dream.
thou m: dd "nosuchfile".IO.open; # Why isn't this X::IO::DoesNotExist error instead of X::AdHoc? 01:32
camelia Failure.new(exception => X::AdHoc.new(payload => "Failed to open file /home/camelia/nosuchfile: No such file or directory"), backtrace => Backtrace.new)
Zoffix thou: it's yet to be implemented 01:33
^_^
thou :-)
Zoffix thou: there's actually a stale PR for that: github.com/rakudo/rakudo/pull/894
thou Thank you again 01:35
Geth_ Inline-Python: 1c3839e1e8 | (Zoffix Znet)++ (committed using GitHub Web editor) | META6.json
Add missing prereq
04:40
Inline-Python: 0df7fe03de | niner++ (committed using GitHub Web editor) | META6.json
Merge pull request #25 from zoffixznet/patch-2

Add missing prereq
Todd Hi All, I am having a head scratcher on a loop within a loop test. vpaste.net/lkFkN Would one of our intrepid heros mind seeing what I screwed up, this time? 06:27
Todd I changed line 26 to 06:38
say "LineKey = <$LineKey> key = <$key> LineValue = <$LineValue> value = <%x<$key>>";
evalable6 (exit code 1) 04===SORRY!04=== Error while compiling /tmp/FstvIsfEW1
Variabl…
Todd, Full output: gist.github.com/783f10fc72bea08614...4828fc01f9
Todd but the last `say %x` still comes out screwy like before
what is meant by that gist link you sent me? 06:39
Todd actually, thiws one liner does not work 06:55
perl6 -e ' my %x = ( "a" => "A", "b" => "x", "c" => "C" );my $y="b"; %x<[$y]>="BB"; say %x;'
{[$y] => BB, a => A, b => x, c => C}
is added an element to the hash instad of modify %x<b> I think I do not know the proper syntax to put a variable in place of a key 06:56
TEttinger Todd: evalable6 is a bot, it sadly cannot explain the gist, only post the link 07:09
TEttinger m: my %x = ( "a" => "A", "b" => "x", "c" => "C" ); my $y="b"; %x<[$y]>="BB"; say %x 07:10
camelia {[$y] => BB, a => A, b => x, c => C} 07:10
Todd My problem boils down to me not knowing how to access an element in a hash with a variable as the key. %x<$y> is what is messing me up.
TEttinger yeah I don't even know perl 6
but it seems a lot of the channel is asleep, though the european crowd should be active soon 07:11
Todd %x<[$y]>="BB" got added to the hash
TEttinger m: my %x = ( "a" => "A", "b" => "x", "c" => "C" ); my $y="b"; %x<$y>="BB"; say %x
camelia {$y => BB, a => A, b => x, c => C}
Todd $y => BB got added to the hash
TEttinger yep
TEttinger so [] is some other syntax that doesn't seem to apply to changing a hash 07:12
maybe the learn perl 6 in y minutes can help
Todd [] is just me trying everything I can think of
TEttinger m: my %x = ( "a" => "A", "b" => "x", "c" => "C" ); my $y="b"; %x{$y}="BB"; say %x 07:14
camelia {a => A, b => BB, c => C}
TEttinger hooray
m: my %x = "a" => "A", "b" => "x", "c" => "C" ; my $y="b"; %x{$y}="BB"; say %x 07:15
camelia {a => A, b => BB, c => C}
Todd Yippee !!!!
Thank you!
TEttinger so {} is used like [] in C for arrays, or in Lua for stuff like this
m: say "abcd"{3}
camelia Type Str does not support associative indexing.
in block <unit> at <tmp> line 1
TEttinger ha, the tutorial seems to be wrong there 07:16
oh they had declared a thing 07:17
m: sub postcircumfix:<{ }>(Str $s, Int $idx) { $s.substr($idx, 1); } say "abcd"{3}
camelia 5===SORRY!5=== Error while compiling <tmp>
Strange text after block (missing semicolon or comma?)
at <tmp>:1
------> 3tr $s, Int $idx) { $s.substr($idx, 1); }7⏏5 say "abcd"{3}
expecting any of:
infix
infix stoppe…
TEttinger m: sub postcircumfix:<{ }>(Str $s, Int $idx) { $s.substr($idx, 1); }; say "abcd"{3}
camelia d
TEttinger yay 07:18
Todd bye bye and than you again for the help! 07:26
ufobat hi 08:50
ufobat is it zef that causes scripts to be generated such as $HOME/.rakudobrew/moar-2017.09/install/share/perl6/site/bin/bailador? those are wrapper scripts that invoke CompUnit::RepositoryRegistry.run-script("bailador", :dist-name<Bailador>, :$name, :$auth, :$ver) 08:52
github.com/Bailador/Bailador/issues/265
ufobat is this a zef bug? 08:52
or what do i need to do that passing parameters to my binary would work? 08:53
timotimo "don't use --name" :\ 09:06
it's not great that --name, --auth, and --ver are taken by the CUR system 09:07
atroxaper Hello! I have two questions. Firstly I remember github repo 'coke/perl6-roast-data'. As I understand it is not supported now. Is there some replacement?
And second question. Why? 09:09
m: {'3' => 'str', 3.Int => 'int'}.elems
camelia ( no output )
atroxaper m: say {'3' => 'str', 3.Int => 'int'}.elems
camelia 1
timotimo because it's not an object hash 09:12
m: say :{'3' => 'str', 3.Int => 'int'}.elems
camelia 2
ufobat timotimo, but the other parameters in %* and @_ are passed, are they? because i dont see it being passed 09:13
timotimo they should, but name is already taken, isn't it?
ufobat right 09:16
ufobat i am just wondering how are all the other parameters passed? 09:18
timotimo potentially @*ARGS
lancew hi, is anyone here able to do invites for the Bailador slack?
ufobat me 09:19
lancew :-)
atroxaper timotimo: wow. Will go and read about it :) 09:27
And for first question?
timotimo oh, huh, python got a totally new distribution format: wheels 09:47
"Avoids arbitrary code execution for installation. (Avoids setup.py)", nice.
"Installation of a C extension does not require a compiler on Windows or macOS." - i wonder how they do this
teatime is it new? 09:49
timotimo the PEP for it has been created in 2012 it looks like 09:50
Zoffix atroxaper: that sounds like [Coke] might now about it. I've no idea what was in that repo 10:02
yoleaux 04:18Z <nine> Zoffix: added your user to the camelia VM where geth is running
Zoffix \o/ 10:03
atroxaper Zoffix: there was information about night runs of all Perl 6 implementation on roast. For know which implementation has troubles. Or now all implementation (moar and jvm) pass roast all time? 10:05
Zoffix atroxaper: moar does and it's the only one actively developed, so I'm not surprised that repo's gone. jvm is kinda limping along, but it might be failing some newer tests 10:07
Zoffix m: say :{'3' => 'str', 3 => 'int', <3> => 'IntStr'}.elems 10:08
camelia 3
atroxaper Zoffix: even we have 'only' moar, I think, it is useful to know how stable current nom is. Ok. 10:09
leont timotimo: in perl5 we're also considering codeless installation, but ETUITS
atroxaper Zoffix: Yeah. timotimo++ already tell me about 'object hashes'.
Zoffix atroxaper: it passes all tests 10:10
atroxaper Zoffix: glad to hear :)
Zoffix atroxaper: well, the past couple of days it failed a few, but that's a rarity and IMO isn't something that we should be actively be doing as it makes it more difficult for other core devs to figure out if their changes break anything 10:12
Zoffix I think sprintf.t is still failing now 10:12
So the docs say "Threads should be considered, for all intents, largely un-managed and their direct use should be avoided in user code" 10:14
What's a good contruct for stuffing a value into a set and then a few minutes later removing it via a promise? I wrote this, but it's a bit bulky and still has a race in the lookup: github.com/perl6/synopsebot/blob/m...m6#L10-L22 10:15
Seems like 2 locks would be much easier to use
.oO( write a module Set::Timed )
10:19
meh
atroxaper Zoffix: I think some times that we want concurrent collection like in Java (I am a Java programmer). In that case is would prefer to wrap all interaction with %recent under Lock. 10:25
Zoffix That brings me to my first point that docs say Locks are low-level and should be avoided. 10:27
atroxaper Can we have a wrapper under some object to calculate something before and after any of original methods? 10:28
atroxaper Zoffix: yes. I think a Lock is not sooo low-level to avoid it. imo. 10:30
Zoffix You can wrap methods 10:30
m: Str.^lookup("say").wrap: -> |c { put "about to say {c.gist}"; callsame; put "done" }; "meow".say
camelia about to say \("meow")
meow
done
Zoffix atroxaper: um, do you mean in Java or in this language?
atroxaper In Perl 6. 10:30
I imaging some wrapper that can transfigurate any object into Monitor (github.com/jnthn/oo-monitors) 10:33
atroxaper And we can use methods of the object safety. 10:34
Zoffix It's probably as simple as `use OO::Monitors; my %recent := monitor :: is SetHash {}.new` and both the Channel and the Locks won't be needed 10:35
atroxaper Is it works now like that?! 10:36
Or it would be cool?
Zoffix I'd've thought it'd work, but doesn't seem to: 10:41
$ perl6 -e 'use v6.d.PREVIEW; use OO::Monitors; my %recent := monitor :: is Hash {}.new; await ^1000 .map: { slip (start { sleep rand; %recent.AT-KEY("foo")++ }), start { sleep 1+rand; %recent.AT-KEY("foo")-- } }; say %recent'
{foo => 7} 10:42
Oh right
The ++ itself happens outside the monitor
MasterDuke maybe the atomic cas op? 10:45
Zoffix it only works with atomic ints doesn't it? 10:46
atroxaper atomic is not what we want :)
Zoffix it'd work for my current usecase tho
Zoffix m: use v6.d.PREVIEW; my %recent := :{:foo(my atomicint $)}; await ^500 .map: { slip (start { sleep rand; %recent<foo>⚛++ }), start { sleep 2+rand; %recent<foo>⚛++ } }; say %recent 10:49
camelia Type check failed in binding; expected Associative but got Block (-> ;; $_? is raw { #`...)
in block <unit> at <tmp> line 1
MasterDuke is this for keeping count of recently seen RT #s for the new synopsebot?
Zoffix Block? o'cmon
MasterDuke: yeah
atroxaper Zoffix: The 'my %recent := monitor :: is Hash {}.new' and solve problem with concurrent autovivification (docs.perl6.org/language/concurrenc..._Concerns)
Zoffix m: use v6.d.PREVIEW; my atomicint $foo; my %recent := :{:$foo}; await ^500 .map: { slip (start { sleep rand; %recent<foo>⚛++ }), start { sleep 2+rand; %recent<foo>⚛++ } }; say %recent
camelia MoarVM panic: Could not spawn thread: errorcode -11 10:50
Zoffix heh
Actually it won't work for my usecase, since I don't pre-know the RT number 10:51
"Expected a modifiable native int argument for '$target'" but that's what I gave it :/ 10:53
Oh well
Zoffix goes to do @other-things
And yeah, second atomic should be ⚛--
Well, this I'd've thought to work: use v6.d.PREVIEW; use OO::Monitors; my %recent := monitor :: is Hash { method bump ($k) { self{$k}++ }; method debump ($k) { self{$k}-- } }.new; await ^500 .map: { slip (start { sleep rand; %recent.bump: "foo" }), start { sleep 2+rand; %recent.debump: "foo" } }; say %recent 10:58
But dies with ":Invocant of method 'unlock' must be an object instance of type 'Lock', not a type object of type 'Lock'. Did you forget a '.new'?"
Zoffix works: use v6.d.PREVIEW; use OO::Monitors; my $recent := monitor { has %!stuff = {}; method d { %!stuff }; method bump ($k) { %!stuff{$k}++ }; method debump ($k) { %!stuff{$k}-- } }.new; await ^500 .map: { slip (start { sleep rand; $recent.bump: "foo" }), start { sleep 2+rand; $recent.debump: "foo" } }; say $recent.d 11:01
MasterDuke cool 11:02
Zoffix "Unsupported use of C++ constructor syntax; in Perl 6 please use method call syntax" are you kidding me >:O 11:14
I never used C++ in my life.
jnthn Apparently you'd be decent at it :P
Zoffix m: class Foo {}; say new Foo: 11:15
camelia Foo.new
Zoffix m: say new class Foo {}:
camelia 5===SORRY!5=== Error while compiling <tmp>
Unsupported use of C++ constructor syntax; in Perl 6 please use method call syntax
at <tmp>:1
------> 3say new class 7⏏5Foo {}:
Zoffix Oh well
Ended up with this for synbot: github.com/perl6/synopsebot/commit/895a6adf03 11:17
Cleared up the code nicely too 11:18
jnthn Nice use of OO::Monitors :)
And the "send a message to yourself in the future" pattern :)
Zoffix \o/ 11:19
jnthn not $recently.seen: $^rt # cute :) 11:20
Zoffix :D
AlexDaniel squashable6: status 11:28
squashable6 AlexDaniel, Next SQUASHathon in 5 days and ≈22 hours (2017-10-07 UTC-12⌁UTC+14)
atroxaper jnthn: Hello. Can you help me with the Monitor? Why I got that exception? gist.github.com/atroxaper/0f435d29...543f0c550d 13:00
I try to implement Java-style ConcurrentHashMap.
I prefer to inherit a hash instead of aggregate for support map, grep and so on. 13:01
jnthn atroxaper: Probably because Hsah cheats on construction 13:14
atroxaper: Also, inherited methods won't be protected 13:15
atroxaper :(
jnthn Even if they were, grep and map return Seq
Those are lazy
So their working would not be protected anyway
atroxaper Good point.
Then I have to use lock directly when need. 13:16
jnthn ConcurrentHashMap in Java probably is a lot more sophisticated than a hash that auto-locks
atroxaper Agree. 13:17
jnthn Worse, assignment takes place outside of a hash
In the general case
So AT-KEY returns a Scalar, and upon assignment to it it is bound into the Hash
atroxaper Many thanks for describe. I have to change my mind after Java :) 13:19
jnthn I used to teach .Net concurrency stuff, and I spent some time there on the fact that things like Stack/Queue and ConcurentStack/ConcurrentQueue had quite different APIs, because the things that make a convenient non-concurrent API don't usually make a good concurrent one. 13:21
(For example, you can't check if something is empty, and then pop from it, because it might become empty between the two) 13:22
atroxaper jnthn: One more think. In Java reading volatile variable (or enter/exit synchronized block) clears local case and thread can see changes of another thread. What about Perl 6 vision of another thread's changes? Is there some point in code when I can be sure that I load fresh value. Not 'actual', but fresh at least. 13:23
local cache* 13:24
jnthn lock/unlock work out the same as enter/exit synchronized blocks; you can use the atomic fetch/assign operations otherwise to ensure values are published 13:28
Alternatively, to ensure all changes up to that point are, there's a memory barrier
See docs.perl6.org/routine/full-barrier and docs.perl6.org/type/Scalar#Atomic_..._on_Scalar for more info 13:29
There's also operator forms just below the routines 13:30
Which I find make the operators stand out nicely, and look alright if you have a font that doesn't decide to render them with a hot pink background :P
atroxaper Does atomic fetch/assign clear _all_ local cache or just read/write actual data of the Scalar? 13:34
jnthn Just of that Scalar 13:36
full-barrier clears all
ah, hang on 13:38
jnthn actually checks
atroxaper brilliant! Thank you. Gonna implement cache like Guava's CacheLoader (github.com/google/guava/wiki/Cache...d#example) 13:39
jnthn github.com/MoarVM/MoarVM/blob/mast...oar.h#L241 13:40
So they are actually doing full barriers
I'd misremembered that
github.com/ivmai/libatomic_ops/blo..._ops.h#L82 is the relevant bit 13:41
I guess if there's demand that we can use operator adverbs to provide a way to get the weaker forms in the future 13:42
s/that/then/
atroxaper "they are actually doing full barriers" they == scalars' fetch/assign? 13:44
jnthn Yes
atroxaper As Java volatiles, ok. 13:45
jnthn They use the MVM_store/MVM_fetch that I linked to, and the second link is where the things they are #define'd to are defined with a bunch of explanation
atroxaper And they use AO_ 13:46
I see now.
ab5tract_ o/ #perl6 13:57
yoleaux 15 Oct 2016 03:43Z <japhb> ab5tract_: I've got a pile of changes I'd like to make to Terminal::Print (some cleanup, some speedup, some API extensions, etc.). How granular would you like PRs? Or would you rather I just maintained my own fork?
15 Oct 2016 08:08Z <japhb> ab5tract_: I've sent you a PR with my first 11 commits (they're all very small, just minor cleanups/tuneups/fixes). After that I'm probably going to have to expand the API for further improvements.
15 Oct 2016 08:41Z <japhb_> ab5tract_: What exactly is examples/clock.p6 trying to draw? It looks overcomplicated to be just a circle, and it appears to be halfway through a rewrite. I'd fix it but I don't know what it's trying to do.
16 Oct 2016 18:57Z <japhb> ab5tract_: Thank you for the Terminal::Print PR merge. :-)
7 Nov 2016 14:56Z <viki> ab5tract_: I had to revert your PR #911 as it broke 6.c-errata. See github.com/rakudo/rakudo/pull/911#...-258854543
ab5tract_ been a long time since i've had a nick tail, apparently! 13:58
is it currently possible to disable buffering for stdout ? 13:59
tbrowder \o #perl6 14:09
MasterDuke ab5tract_: can you reopen it with :!buffering? 14:10
tbrowder Is there any way to use Test* modules to give an alternate description string for failures? 14:11
ab5tract_ hmm, interesting thought. I'll give that a try, MasterDuke 14:16
though I can't seem to find much about buffering in the docs 14:18
just this tantalizing bit here: "Using getc to get a single keypress from a terminal will only work properly if you've set the terminal to "unbuffered"." 14:19
MasterDuke jnthn: recently made some changes to the default buffering behavior 14:20
ab5tract_ I'm asking because I've made some changes to Terminal::Print that I expected to have a larger impact on FPS 14:21
removing a lot of introspection and objects along the way
MasterDuke i think the tldr is that output attached to a tty is now buffered by default 14:23
ab5tract_ but the performance runs about as well as the previous version.
jnthn MasterDuke: Nope, buffering is explcitly not enabled for TTYs 14:25
*explicitly
It's for non-TTYs only
So for output to one of those, there was no change
MasterDuke whoops, i got it backwards. ab5tract_ ^^^ 14:26
ab5tract_ jnthn: interesting.. i guess we've gotten the costs of object instantation and instrospection way down! 14:27
jnthn lizmat++ recently did some changes to speed up instantiation 14:28
ab5tract_ jnthn: so if tty is no longer buffered, would that make setting stdout to makeraw via termios redundant? 15:47
jnthn It never was buffered 15:48
jnthn So if you had to before, then you'll still have to 15:48
I don't know what setting stdout to makeraw does/means, so no idea on that part :) 15:49
timotimo nadim: i wonder why Terminal::Print isn't in the dependencies of Data::Dump::Tree? 15:55
sjn o7 15:59
sjn is playing around with perl6-docs today o/
ab5tract_ jnthn: it means that "all output processing is disabled" 16:04
whatever that means ;)
something about carriage returns and baudrates, if I understand the manpage correctly 16:05
chakli hey, can someone try this and tell me if something is wrong here, in HTTP::UserAgent if i do say $response.content i get just the content but if i do say "$response.content" i get the header too 16:34
ugexe "$response.content" isn't calling .content is it? 16:36
it'd have to be "$response.content()" or "{$response.content}" 16:37
otherwise you are getting `my $str = $response.Str ~ ".content"`
chakli ok, thanks got it 16:40
HoboWithAShotgun so i used zef locate to see where a module file is, but after i changed it, i don't see my changes when i run it 17:04
HoboWithAShotgun is there a precompiled cache or somethng i need to clear? 17:04
timotimo you're not supposed to change files in the compunitrepo 17:07
they ought to be immutable
HoboWithAShotgun you're not supposed to call private methodes either :) i just want to check if a variable contains what i think it does 17:08
timotimo the safest way is to grab the source of the distro you're looking at, modify it, and either install it or use -I for it 17:12
Geth whateverable: 62953b6285 | (Aleks-Daniel Jakimenko-Aleksejev)++ | services/whateverable@.service
Add missing .precomp

Otherwise the bot won't start if Whateverable.pm6 was changed.
17:47
whateverable: 6b1507476f | (Aleks-Daniel Jakimenko-Aleksejev)++ | services/whateverable@.service
Be a bit more forgiving about starting new processes

Otherwise IRC::Client module does not seem to work… not that this usage is intended, but sometimes it is useful.
whateverable: 45e09f4827 | (Aleks-Daniel Jakimenko-Aleksejev)++ | sandbox/answer
Add sandbox folder

It will take more work to get stuff chdir-ed there, but this is good enough for now.
HoboWithAShotgun tx timotimo i will do as told 18:02
mst github.com/nikomatsakis/rayon#rayon is interesting 18:12
Zoffix A while back I was asking how to disable part/join notifications in weechat's "hotlist" bar... Finally figured out. /set weechat.look.buffer_notify_default message weechat.org/files/doc/devel/weecha...fy_default 18:48
Zoffix .ask teatime how's the regex range thing going? 18:53
yoleaux Zoffix: I'll pass your message to teatime.
HoboWithAShotgun m: $*SPEC.join("foo/bar").say; 19:05
camelia Too few positionals passed; expected 4 arguments but got 2
in block <unit> at <tmp> line 1
HoboWithAShotgun m: $*SPEC.join("foo", "bar").say;
camelia Too few positionals passed; expected 4 arguments but got 3
in block <unit> at <tmp> line 1
HoboWithAShotgun m: $*SPEC.join($, "foo", "bar").say;
camelia foo/bar
Zoffix HoboWithAShotgun: don't use $*SPEC
m: say 'foo'.add: 'bar'
camelia No such method 'add' for invocant of type 'Str'
in block <unit> at <tmp> line 1
Zoffix m: say 'foo'.IO.add: 'bar' 19:06
camelia "foo/bar".IO
Zoffix docs.perl6.org/language/io-guide#L...SPEC_Alone 19:06
HoboWithAShotgun i see
Geth doc: a917d93624 | (Zoffix Znet)++ (committed using GitHub Web editor) | doc/Language/io-guide.pod6
De-villify $*SPEC a bit

Since some methods don't got an alternative in IO::Path
19:18
synopsebot Link: doc.perl6.org/language/io-guide
Geth doc: d152a22fc9 | (Zoffix Znet)++ (committed using GitHub Web editor) | doc/Language/io-guide.pod6
Link to devnull from all IO::SPECs
19:19
synopsebot Link: doc.perl6.org/language/io-guide
teatime Zoffix: to answer your question: i0.kym-cdn.com/photos/images/facebo...65/b7e.jpg 20:19
yoleaux 18:53Z <Zoffix> teatime: how's the regex range thing going?
Zoffix teatime: does it mean I am free to fix it or do you still want to fix it? :) 20:20
teatime help yourself. 20:21
I will be interested to see the right answer. 20:22
Zoffix \o/
Zoffix Some time tomorrow. I think I'm done coding for today :) 20:22
teatime it would be easy enough to duplicate the logic from elsewhere, but that can't be the right thing 20:23
teatime also do note this doesn't error but doesn't actually work either 20:26
m: 'xx' ~~ / 'x' ** 0.9..2 /
camelia ( no output )
teatime m: say 'xx' ~~ / 'x' ** 0.9..2 / 20:27
camelia Nil
geekosaur teatime, that one is known/expected, there are parse ambiguities. use braces around the range 20:30
teatime hmm 20:31
HoboWithAShotgun is there a method to dump out the interface (methods etc) of $something ? 20:52
geekosaur that lives in the MOP
m: dd Int.^methods 20:53
camelia (method new (Int $: | is raw) { #`(Method|30631008) ... }, method Int (Int $: *%_) { #`(Method|30631160) ... }, method Num (Int:D $: *%_) { #`(Method|30631312) ... }, method Rat (Int:D $: $?, *%_) { #`(Method|30631464) ... }, method FatRat (Int:D $: $?, …
Zoffix m: dd Int.^methods».name 20:54
camelia ("new", "Int", "Num", "Rat", "FatRat", "abs", "Bridge", "chr", "sqrt", "base", "polymod", "expmod", "is-prime", "floor", "ceiling", "round", "lsb", "msb", "narrow", "Range", "atanh", "sign", "asech", "sin", "tan", "atan2", "acosech", "truncate", "asinh",…
Zoffix m: dd Int.^methods(:all)».name 20:54
camelia ("new", "Int", "Num", "Rat", "FatRat", "abs", "Bridge", "chr", "sqrt", "base", "polymod", "expmod", "is-prime", "floor", "ceiling", "round", "lsb", "msb", "narrow", "Range", "atanh", "sign", "asech", "sin", "tan", "atan2", "acosech", "truncate", "asinh",…
Zoffix (:all includes those from Any and Mu as well)( 20:55
HoboWithAShotgun how do i instantiate a class whichs name i have in $classname? 21:15
timotimo you grab the type object from your lexical environment using ::($classname) and call your favourite constructor method on it, for example .new 21:16
Zoffix m: class Meows { method mew { say "\c[CAT]" } }; my $what = "Meows"; my $do = "mew"; ::($what)."$do"() 21:22
camelia 🐈
HoboWithAShotgun ok, this works: hastebin.com/uvoqiyufez.pl 21:42
any red flags?
HoboWithAShotgun with all these flexibility, does it even make sense to speak about idiomatic perl6? 21:44
gfldex HoboWithAShotgun: The idioms might actually be build in. 21:45
gfldex HoboWithAShotgun: you may want to be careful with `.pl`. That will bite you on Windows. 21:47
HoboWithAShotgun that's just the paste site doing that 21:48
the actual file is called Vision.pm6 :)
gfldex HoboWithAShotgun: you may want to give gist-paste a try manpages.org/gist-paste 21:50
grondilu m: say { a => pi } (+) { a => -pi } 21:53
camelia Bag(a(3))
grondilu is that how (+) is supposed to behave with hashes?
m: say { a => pi } (+) { a => "foo" }
camelia Cannot convert string to number: base-10 number must begin with valid digits or '.' in '3⏏5foo' (indicated by ⏏)
in block <unit> at <tmp> line 1
grondilu m: say { a => 2 } (+) { a => 1 } 21:54
camelia Bag(a(3))
grondilu m: say { a => pi } (+) { a => -1 } 21:54
camelia Bag(a(3))
grondilu m: say { a => pi }.Mix (+) { a => -1 }.Mix
camelia Mix(a(2.14159265358979))
grondilu m: say { a => pi }.Mix (+) { a => -pi }.Mix 21:55
camelia Mix()
Zoffix grondilu: yup 22:02
Bags don't have negative weights, so the -pi one is like zero, and Bags have integer weights, so the pi gets coerced into Int, hence Bag(a(3)) 22:04
grondilu but why should Bags prevail other Mixes?
I mean shouldn't { a => -pi } be cast into a Mix instead of a Bag?
Zoffix grondilu: unsure. You should ask lizmat. She hammered down all of these semantics a few months ago 22:05
HoboWithAShotgun can i have lazy attributes? say class f { has $x; has $o = Some::Thing.new($x); } now x might not be known when the object is constructed 22:52
HoboWithAShotgun can i make that lazy so the the S::T.new gets called when o get accessed ? 22:53
HoboWithAShotgun and not when the object is constructed 22:53
grondilu HoboWithAShotgun: do it in the BUILD submethod 22:55
or rather the TWEAK
grondilu oh wait, you mean when accessed 22:56
not constructed, my bad
samcv how do you get a module's version number from inside the module's code? 23:00