»ö« 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.
Geth perl6.org: 37d234bffb | (Zoffix Znet)++ (committed using GitHub Web editor) | source/downloads/index.html
List linux packages in side panel

This somewhat violates our original principle of advertising Rakudo Star only, but I'll take confusion over Start vs. Compiler-Only than users using[^1] 2016.01 rakudo or thinking we don't have packages at all.
  [1] www.facebook.com/groups/perl6/perm...465264002/
00:22
skids gist.github.com/skids/0745bfc48eac...fd81bf50ed 02:26
MasterDuke skids: i'd recommend linking that over in #perl6-dev also 02:49
skids good idea.
MasterDuke and i'd also suggest giving at least a one sentence explanation of what it is. without any context someone might assume it was just an errant miss-click or accidental copy/paste 02:51
Zoffix skids: wouldn't it make more sense for dynamic optimizer to figure stuff like this out? The optimize stage already chews up 10% of compilation. If you're doing fancy analysis to save 2% off runtime in tight loops at the cost of extra 5% compile time, you're effectively slowing down development time of the programmer. 02:53
skids: unless I'm misremembering, I may even seen jnthn++ say something that we shouldn't overcomplicate static optimizer to do things that that spesh can do 02:54
Zoffix One immediate thing that comes to mind is doing reverse constant folding of op chains, so stuff like `"long line" ~ "long line" ~ "long line" ~ $bar` becomes `"long line long line long line" ~ $bar` (currently it isn't). Same can be done with some math ops. But I just left it alone, because it wasn't 100% trivial, and I thought we weren't doing fancy analysis in the static optimizer 02:56
MasterDuke what i'm definitely not sure of is the limitations of each (MoarVM optimizations vs Rakudo optimizations) 02:57
skids A) I doubt an opt like that would add 5% B) Obviously spesh isn't C) runtime is much more important than compiler time given 95% of your code ends up in libraries if you are doing it right and D) Non-VM-specific optimization has it's merits and E) it's much easier to work on. 02:58
Zoffix I don't know anything about spesh, but static optimizer's limitations is basically "you can only use what's known at compile time and can't change during runtime"
MasterDuke it might make sense to have some additional optimization levels in Rakudo that e.g., are used to precompile stuff when modules are install by zef 03:00
MasterDuke but perhaps aren't the default 03:01
Zoffix skids: (A) it was a generalization. If you're optimizing for some special case I'm not using I'm paying for the analysis without getting anything in return. (B) Because few people are working on it. (C) That's not true. In 99% of my programs I couldn't give two shits if my program finishes in 5.7s vs 5.9s, while in 100% of my program I care about lag I have to suffer each time I make a change in my program. 03:06
Try developing a Cro web app and tell me compile time isn't that important. (D) Sure, but reading your article, you seem to be proposing an analysis of call chains done within `while` to see whether a dynamic variable can be eliminated. (E) it's also easy to do it wrong.
Zoffix In fact, there were two bugs made in the static optimizer just in the past month, one by me and one by jnthn++. jnthn's was caught by Toasting. Mine, it just occured to me that I may have messed it up and when I checked I did... It involved type-only Junctions in where clauses on Mu params. Quite specific hole that may not have been covered by tests. 03:08
Zoffix .ask jnthn is there any rule of thumb of what sort of things/complexity are fine to analyse in the static optimizer and what is best left for spesh? RE: irclog.perlgeek.de/perl6/2018-02-24#i_15852630 03:10
yoleaux Zoffix: I'll pass your message to jnthn.
MasterDuke skids: are you just sort of generally wondering why more optimization isn't done at the Rakudo level? or do you have some stuff in mind you'd like to work on? if the former, Zoffix has some good points, but if the latter, i'd certainly be interested in seeing PRs 03:11
skids Well, I don't share your experience of valuing compile time over runtime... if I find myself in that situation I start to suspect the project is not well strictured.
I'm just documenting my explorations, really.
Zoffix It's not valuing compile time over runtime. It's saying that compile time isn't irrelevant. 03:14
skids (I'm also slightly annoyed that the core is becoming more unreadable)
Zoffix skids: I think your (E) point has some responsibility there 03:16
(it's easier to write nqp ops than make static/dynamic optimizer work)
skids: OTOH, I recall brrt say nqp-fied code isn't just for humans, but JIT can work better on it or something 03:17
MasterDuke skids: well please keep exploring and documenting, documentation and measurements are great 03:18
skids On E) I think I can agree with that assessment... and the brrt counterpoint is valid too. I think there is a balance to be struck, and asking whether we should be using nqp::while as much seems to me to be a good place to at least start figuring out where that balance point is... it does't seem to be all that hard to statically optimize and it bears a lot of the blame for disrupting the look and feel of Perl6 control flow. 03:22
Zoffix I also think we could be more methodological with optimizations. Grepping my own modules, I have 4 instances of `while` (all in same module) and 15 instances of `loop`. A monster project could be making Toaster generate SQL profile of the entire ecosystem and then optimize the most used routines :P 03:24
skids And as I said in the gist, I'm not even sure if those $_ binds are even supposed to be there... are we treating immediate blocks and inlined stuff too similarly? 03:25
Anyway I have way more reading of Opntimizer.nqp to do before I can really mount a more informed argment. 03:26
Zoffix skids: it looks kinda broken to me. $_ is a dynamic var, isn't it? But there's it's made lexical to preserve outer $_, which make it fail to preseve stuff if the dynamic $_ is accessed 03:31
m: $_.VAR.dynamic.say; { $_.VAR.dynamic.say }; while $++ < 2 { $_.VAR.dynamic.say } 03:32
camelia True
True
True
True
Zoffix interesting...
m: class Foo { method bar { CALLER::<$_> = 42; } }; say $_; { Foo.bar; $_ = 55}; .say
camelia (Any)
55
Zoffix m: class Foo { method bar { CALLER::<$_> = 42; } }; say $_; while $++ < 1 { Foo.bar; $_ = 55}; .say
camelia (Any)
55
Zoffix m: while $++ < 5 { $_ = 55 }; .say 03:35
camelia 55
Zoffix This one has those two binds and the comments for them say "# Hand back the statements, but be sure to preserve $_ around them if the block uses it." and I do use it and it's presevering nothing....
skids m: class Foo { method bar { CALLER::<$_> = 42; } }; say $_; while $++ < 1 { $_ = 55; Foo.bar }; .say 03:36
camelia (Any)
42
Zoffix I don't get why not though. 03:37
Zoffix Oh, 'cause it's just binding, isn't it? So the change that's done to $_ is done to `pres_topic__1` too 03:37
Zoffix m: $_ = 42; my $pres_topic := $_; while $++ < 5 { $_ = 55 }; $pres_topic.say 03:39
camelia 55
Zoffix yup
m: $_ = 42; my $pres_topic = $_; while $++ < 5 { $_ = 55 }; $pres_topic.say
camelia 42
Zoffix m: $_ = 42; my $pres_topic = $_; while $++ < 5 { my $_ = 55 }; $pres_topic.say 03:40
camelia Potential difficulties:
Redeclaration of symbol '$_'
at <tmp>:1
------> 3 $pres_topic = $_; while $++ < 5 { my $_7⏏5 = 55 }; $pres_topic.say
42
Zoffix m: $_ = 42; my $pres_topic := $_; while $++ < 5 { my $_ = 55 }; $pres_topic.say
camelia Potential difficulties:
Redeclaration of symbol '$_'
at <tmp>:1
------> 3$pres_topic := $_; while $++ < 5 { my $_7⏏5 = 55 }; $pres_topic.say
55
Zoffix So really, it's worse :) It's not that the binding can be eliminated, but that it's buggy and it needs to use the more expensive nqp::p6store :P 03:41
Zoffix m: class Foo { method bar { CALLER::<$_> = 42; } }; say $_; while $++ < 2; { my $x; Foo.bar; $_ = 55}; .say 03:44
camelia 5===SORRY!5=== Error while compiling <tmp>
Missing block
at <tmp>:1
------> 3R::<$_> = 42; } }; say $_; while $++ < 27⏏5; { my $x; Foo.bar; $_ = 55}; .say
expecting any of:
block or pointy block
Zoffix m: class Foo { method bar { CALLER::<$_> = 42; } }; say $_; while $++ < 2 { my $x; Foo.bar; $_ = 55}; .say
camelia (Any)
55
Zoffix m: class Foo { method bar { CALLER::<$_> = 42; } }; say $_; $_ = 42; while $++ < 2 { my $x; Foo.bar; $_ = 55}; .say 03:45
camelia (Any)
55
Zoffix m: class Foo { method bar { CALLER::<$_> = 42; } }; say $_; $_ = 42; while $++ < 2 { my $x; Foo.bar;}; .say
camelia (Any)
42
Zoffix m: class Foo { method bar { CALLER::<$_> = 42; } }; say $_; $_ = 43; while $++ < 2 { my $x; Foo.bar;}; .say
camelia (Any)
42
skids Is a while or immediate block *supposed* to establish a local topic? 03:46
Geth doc: 3c5b34b8e4 | (Alex Chen)++ (committed using GitHub Web editor) | lib/Perl6/TypeGraph.pm
Update TypeGraph.pm

Co perl6/6.d-prep#5
03:46
Zoffix skids: I think all blocks have the $_, don't they? 03:47
In the ASTs for the last few above, I see there is a lexical $_ declared for the block (but it's bound to the outer $_)... which makes me wonder what's the point of those two binds that supposed to preserve something
Zoffix skids: they're present in `if 1 { say 42 }`. I think they're useless there as well. 03:52
I mean `if 1 {}` period. Regardless of what's inside (other than implied params) 03:53
skids: are you gonna look more into this? I'm really sleepy right now, but right now to me those binds look entirely useless.
If not, I'll set myself a reminder to look 03:54
skids I was just about to say, I'm getting pretty bleary and will probably start making less and less sense.
:-)
I do have nothing to do tomorrow, though, so I'll probably at least try to get some questions answered by trolling throug code/docs/roast. 03:55
Zoffix |30d was anything done about the possibly useless `pres_topic` stuff in opt that removes blocks on `if`/`while`, etc. irclog.perlgeek.de/perl6/2018-02-24#i_15852854
ZofBot Zoffix, Will remind you on 2018-03-25T22:55:17.706197-05:00 about was anything done about the possibly useless `pres_topic` stuff in opt that removes blocks on `if`/`while`, etc. irclog.perlgeek.de/perl6/2018-02-24#i_15852854
Zoffix OK :)
Zoffix drops to hbed.
\o
skids gnight
masak o hai, #perl6 06:14
yoleaux 9 Feb 2018 00:13Z <Zoffix> masak: RE RT#124226 Yes, you can resolve types at compile time, but can you resolve methods? If the idea in the ticket is implemented, this, for example, would begin to crash, no? `class Foo { has $!foo; method foo { $!foo } }; INIT Foo.^lookup("foo").wrap: -> | { "not an error".say }; Foo.foo`
synopsebot RT#124226 [open]: rt.perl.org/Ticket/Display.html?id=124226 [BUG] Opportunity to catch syntactically detectable calls to attribute-accessing methods on type objects in Rakudo
masak Zoffix: ...yes. I think you've convinced me. 06:18
masak .oO( hoist by its own dynamism )
shinobi-cl hi all: how can i check if a variable is a hash or an array? 06:39
m: my Sa = (1,2,3); say ?(Sa ~~ Positional); say ?(Sa ~~ Associative); 06:40
camelia 5===SORRY!5=== Error while compiling <tmp>
Malformed my (did you mean to declare a sigilless \Sa or $Sa?)
at <tmp>:1
------> 3my Sa7⏏5 = (1,2,3); say ?(Sa ~~ Positional); sa
AlexDaniel m: my $Sa = (1,2,3); say ?(Sa ~~ Positional); say ?(Sa ~~ Associative); 06:42
camelia 5===SORRY!5=== Error while compiling <tmp>
Expected a term, but found either infix ~~ or redundant prefix ~
(to suppress this message, please use a space like ~ ~)
at <tmp>:1
------> 3my $Sa = (1,2,3); say ?(Sa ~~7⏏5 Positional); s…
AlexDaniel m: my $Sa = (1,2,3); say ?($Sa ~~ Positional); say ?($Sa ~~ Associative); 06:42
camelia True
False
shinobi-cl m: my $a = (1,2,3); say ?($a ~~ Positional); say ?($a ~~ Associative); 06:43
camelia True
False
shinobi-cl mm
m: my $a = {a => 1, b =>2 , c => 3}; say ?($a ~~ Positional); say ?($a ~~ Associative) 06:44
camelia False
True
shinobi-cl m: my $a = (a => 1, b =>2 , c => 3); say ?($a ~~ Positional); say ?($a ~~ Associative)
camelia True
False
shinobi-cl m: my $a = (a => 1, b =>2 , c => 3); say ?($a[0] ~~ Positional); say ?($a[0] ~~ Associative) 06:45
camelia False
True
shinobi-cl m: my $a = {a => 1, b =>2 , c => 3}; say ?($a[0] ~~ Positional); say ?($a[0] ~~ Associative) 06:46
camelia False
True
AlexDaniel shinobi-cl: you can also check against Hash or Array if you want to be that precise
shinobi-cl thanks AlexDaniel++, i will try that! 06:47
shinobi-cl I just wonder if there is any case where both are true.. associative AND positional at the same time 06:48
AlexDaniel m: my $x = ((42 does Associative) does Positional); say $x ~~ Associative; say $x ~~ Positional 06:50
camelia True
True
AlexDaniel m: my $x = (42 does Associative) does Positional; say $x ~~ Associative; say $x ~~ Positional
camelia True
True
AlexDaniel m: my $x = (42 does Associative) does Positional; say $x ~~ Associative; say $x ~~ Positional; say $x
camelia True
True
42
AlexDaniel xD
shinobi-cl m: my $x = (42 does Associative) does Positional; say $x ~~ Associative; say $x ~~ Positional; say $x.perl; 06:51
camelia True
True
42
shinobi-cl m: my $x = (42 does Associative) does Positional; say $x.kv.perl;
camelia (0, 42).Seq
shinobi-cl i see... thanks! :) 06:52
Diddi I'm trying to wrap my head around live supplies and while I got it sort of working I'm not quite sure it's the right way to do it :) What I'm curious about is if I do a start {} in the live supply and it dies, my react/whenever block never exits unless I explicitly CATCH the die and call .quit in the supply 07:55
example: pastebin.com/cKkYLCdn is that the way it's supposed to work or am I going at it the wrong way here? 07:56
timotimo Diddi: using an explicit Supplier will not give you any automatic handling of exceptions and other things; a supply block would do that, for example. if you want to hook it up in a simpler way, you can also $promise.then({ if .status ~~ PromiseStatus::Broken { $supplier.break(.cause) } }); 11:56
timotimo huggable: bump 12:00
huggable timotimo, nothing found
timotimo what were people using to make the pretty bump messages?
timotimo oh, it looks like geth puts those in the channel 12:02
AlexDaniel timotimo: pretty bump commits are generated by z script 12:04
huggable: z 12:05
huggable AlexDaniel, Helper script for Rakudo Perl 6 core development: github.com/zoffixznet/z
AlexDaniel Geth: ver github.com/rakudo/rakudo/commit/70...8b479e19d1
Geth AlexDaniel, version bump brought in these changes: github.com/perl6/nqp/compare/2018....9-g5132d42
AlexDaniel and Geth just generates a link 12:06
timotimo oh, right
no problem, though. my little description should suffice
Diddi timotimo: ah, that makes sense and is consistent with what I'm seeing. the .then() is a nice take on it it aswell, thanks :)
timotimo YW
AlexDaniel
.oO( and I generate multiple sentences using the same words )
Diddi given this code pastebin.com/xu1PVEL3 , why does print-vlan-id(Nil) give an error saying it expects Int, while print-vlan-id(9999) says it's expecting VLAN? 14:04
Diddi I'd expect in both cases getting an error saying it expects VLAN, not Int :P 14:05
timotimo the subset thing is made up of two parts 14:06
first it checks the type, then it checks the constraint
Diddi ah, that's actually the first part of the error.. I see that now
timotimo Nil already fails the check against Int so it doesn't even have to try to check the "where" clause 14:07
Diddi fair enough
timotimo though maybe we want to change the output to still refer to the subset name there
Diddi in the end I suppose that's what the user is interested in, as trying to "fix" it by passing an Int only yields another error (as I'm doing with 9999) 14:08
El_Che good point
Diddi: raise an issue
Diddi cool, what where? :) 14:09
timotimo we might have spec tests that ask for the resulting error to be something particular, but in that case we can make a new exception that derives from the expected one and has a better error message
though given you can make subsets of subsets, that could be a bit complicated
El_Che Diddi: github.com/rakudo/rakudo/issues
Diddi El_Che: thanks I'll open an issue for it 14:10
timotimo might also be interesting to look at the interplay of different placements of :D there; VLAN:D vs VLAN being a subset of Int:D instead of just Int
Zoffix masak: I just realized the same argumentation can be applied to some of the optimizations we already do.... 14:28
m: &postfix:<++>.wrap: -> | { "meow".say }; my int $x; $x++
camelia ( no output )
Zoffix ^ wrap isn't called, because postfix ++ is getting optimized into an nqp call
timotimo if you don't mark it "soft" you'll get what's coming to you, no? 14:30
Zoffix m: use soft; &postfix:<++>.wrap: -> | { "meow".say }; my int $x; $x++ 14:31
camelia ( no output )
timotimo that's NYI :D
hm, actually
does that just refer to things you're declaring in that scope perhaps?
Zoffix m: use soft; &postfix:<++>.wrap: -> | { "meow".say }; dd &postfix:<++>.soft 14:32
camelia Bool::True
Zoffix timotimo: so the opts just needs to check if the thing is soft and not optimize if it is? 14:33
timotimo i believe so
Zoffix Actually no need for `use soft`; looks like the .wrap mixes in that method already
timotimo but that wrapping still happens at run time, though
m: use soft; sub test { }; say &test.soft
camelia True
Zoffix oh crap yeah 14:34
m: use soft; &postfix:<++>.wrap: -> | { "meow".say }; BEGIN dd &postfix:<++>.soft
camelia Nil
Zoffix m: &infix:<|>.wrap: -> | { "meow".say }; -> $ where {$_ ~~ Int|Num} { say "foo" }(42) 14:36
camelia foo
Zoffix m: &infix:<|>.wrap: -> | { "meow".say }; -> $ where Int|Num { say "foo" }(42)
camelia foo
Geth doc: titsuki++ created pull request #1797:
Add Shifting and scaling intervals section
14:42
doc: c964ce0e32 | (Itsuki Toyota)++ | doc/Type/Range.pod6
Add Shifting and scaling intervals section
doc: f739bcb618 | (Itsuki Toyota)++ (committed using GitHub Web editor) | doc/Type/Range.pod6
Merge pull request #1797 from titsuki/add-range-example

Add Shifting and scaling intervals section
synopsebot Link: doc.perl6.org/type/Range
Zoffix Filed as R#1561 14:47
synopsebot R#1561 [open]: github.com/rakudo/rakudo/issues/1561 Multiple static optimizations break .wrap() feature
jnthn I think to be wrappable, then either the declaration of the routine must be in the scope of a "use soft" or be explicitly marked "is soft", *or* the wrap should take place at compile time. 14:54
yoleaux 03:10Z <Zoffix> jnthn: is there any rule of thumb of what sort of things/complexity are fine to analyse in the static optimizer and what is best left for spesh? RE: irclog.perlgeek.de/perl6/2018-02-24#i_15852630
jnthn CORE.setting has no `use soft` nor is anything in it marked `is soft` 14:55
So I'd not expect to be able to wrap anything from there
As for the static analyzer, obviously anything that involves virtual or late-bound behavior can't be done there, so it's mostly things we can determine from lexically available information. 14:59
Some things make a lot of sense to do in the static optimizer because they involve things that are far easier to spot with a Perl 6 AST than at bytecode level 15:00
timotimo the pres_topic using binding and then not allocating a new Scalar is a bug, right? annoyingly, we won't be able to take advantage of the "$_ will be lazily allocated only if it's used" feature this way
so once we "fix" that, we'll be allocating *so* many scalars 15:01
jnthn Not aware of a bug in that area. Got an example where it changes observable behavior?
Zoffix timotimo: the later discussion there arrived to the conclusion that pres_topic binding stuff is useless 15:02
timotimo yeah, zoffix ran a few lines against camelia earlier today
if you assign to $_ inside a block that gets inlined the value will be visible outside of it, too
Zoffix Because the block is removed and without the binding the $_ is used from parent block and that's what'd normally happen *with* a block (which declares a lexical $_ but it's bound to outer $_) 15:03
jnthn Things like this are why I ripped all routine inlining except for native operators out of the static optimizer 15:04
timotimo iiuc we stash the $_ away to "preserve" it, but since we just bind, we just end up referencing the same scalar and nothing happens
jnthn That sort of thing just is easier to get right in spesh
As for $_, probably we need some more careful analysis there 15:05
Zoffix jnthn: I guess yesterday's discussion's question largely centered on how to decide what is OK to put in static optimizer; especially given that many more devs are able to write static optimizer code but don't know much about spesh. If it's possible to do, then it could be done? Is that an acceptable answer? For example, I can think of optimizing things like `42 + 50 + 40 + $var` but I left that alone because I 15:08
thought we weren't doing "fancy" analysis in the static optimizer and that stuff is for spesh. But I've no idea how spesh works and what's good for spesh
jnthn I think the static optimizer already does that constant-folding case? 15:09
Constant-folding does make sense to do in the static optimizer, though, because "is pure" is a Perl 6 level thing that we don't push down any further - at least, not at the moment
Zoffix No, it sees the last $var and gives up on the whole chain, without constant folding the constant bits because it's a nested chain. But for this particular op, the order doesn't matter, so it could fold the "top" of the chain, leaving just one op unfolded to deal with the non-compiletime-known $var 15:10
jnthn As to "many more devs are able to write static optimizer code" - maybe, but can they account for all the things needed to do it correctly? :) 15:11
jnthn (Because spesh is dealing at the bytecode level, it's actually *easier* to reason about correctness at that level.) 15:12
Zoffix Ah, I had $var in wrong place, it's when it's at the start I meant.
m: for ^1000_000 { my $ = rand + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 }; say now - INIT now
camelia 1.9165407
Zoffix m: for ^1000_000 { my $ = 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + rand }; say now - INIT now
camelia 0.44049105
Zoffix and with opt, the two would come out to run for the same time 15:13
jnthn *nod*
That'd seem sensible enough
mst jnthn: it wouldn't surprise me that spesh is easier to reason about once you grok it in fullness but has a sharper learning curve to being able to reason about at all
many things in technology seem to involve that trade-off
jnthn Well, plus it's written in C, not Perl 6 15:14
So yes, certainly steeper learning curve
mst wonders if eventually you could extract the components of a DSL from the so-far-written spesh optimisations 15:15
Zoffix .tell skids some continuation for yesterday's discussion on what is OK to put into static optimizer: irclog.perlgeek.de/perl6/2018-02-24#i_15854047 15:17
yoleaux Zoffix: I'll pass your message to skids.
pmurias Zoffix: the big problem with the static optimizer in Rakudo that it works in a very adhoc "here are a bunch of ifs" way 15:34
yoleaux 14:02Z <tbrowder> pmurias: any debugging ideas about situation where nqp tests on jvm pass on my local host but fail on travis-ci?
Zoffix pmurias: what's a better way? 15:35
pmurias Zoffix: I don't have a ready solution that objectively better, but other more powerfull optimizers work in more complex ways 15:42
Zoffix Not sure what you mean by that.
pmurias Zoffix: like turning the AST into a intermediate more easily optimizable form where info can be easily attached
Zoffix pmurias: but you can already easily attach info with annotations. And push-pull/method-call to mutate the QAST 15:43
*push-pop
positional access for positional kids and method calls for nameds 15:44
The only easier thing I can think of is having a .replace method on QAST::Node
(that replaces the node itself in its place [somehow] so you don't have to keep track of what the parent is and where in the parent the node is at) 15:45
pmurias searches for links to how other interesting optimizers work 15:48
Zoffix & 15:49
timotimo pmurias: maybe check out what luajit can do :) 16:42
pmurias timotimo: isn't luajit fast because of how simplistic lua is instead of the JIT being super smart 16:47
timotimo it also has lots of clever things on top of that 16:51
timotimo jimmyz has pointed out a few techniques it does that we should try stealing; i remember at least "allocation sinking" 16:52
pmurias github.com/v8/v8/wiki/TurboFan - has a bunch of iteresting stuff 16:54
pmurias and in terms of optimizing stuff hoopl offers an interesting approach: www.microsoft.com/en-us/research/w...kell10.pdf 16:56
timotimo i believe many optimizations depend on loops being a first-class datastructure? 16:57
pmurias timotimo: what do you mean by first-class datastructure? 17:18
timotimo having an explicit class to hold all information we need
currently if you want to figure out if something's a loop you have to go through the BBs and do some loop detection algorithm; i'm told they are rather tricky 17:19
skids .tell Zoffix gist.github.com/skids/21eaaad37969...c48be35274 research so far on that pres_topic issue 17:23
yoleaux 15:17Z <Zoffix> skids: some continuation for yesterday's discussion on what is OK to put into static optimizer: irclog.perlgeek.de/perl6/2018-02-24#i_15854047
skids: I'll pass your message to Zoffix.
pmurias timotimo: you mean in the JIT optimizer? 17:25
tbrowder pmurias: thanks! 17:27
skids I'm just starting to read the optimizer so I'm balefully ill equipped to make intelligent comments, but one thing I noted is a few opts like changing for ^6 to a while just return after completing, with no chance to further optimize now that you have a "while" 17:30
tbrowder hm, could be slight diff in debian vs trusty...trying the last ditch “install travis env on local host” method... 17:31
timotimo pmurias: i'd say we ought to have that in spesh already 17:52
the jit doesn't cross BB boundaries by itself yet, i think 17:53
timotimo m: subset VLAN of Int where 1..4095; say 0 ~~ VLAN; say 1 ~~ VLAN; say 1095 ~~ VLAN; say 1096 ~~ VLAN; 17:57
camelia False
True
True
True
timotimo m: subset VLAN of Int where 1..4095; say 0 ~~ VLAN; say 1 ~~ VLAN; say 1095 ~~ VLAN; say 4096 ~~ VLAN;
camelia False
True
True
False
timotimo m: subset VLAN of Int where 1..4095; say 0 ~~ VLAN; say 1 ~~ VLAN; say 4095 ~~ VLAN; say 4096 ~~ VLAN;
camelia False
True
True
False
timotimo Diddi: you can write your subset more succintly this way
timotimo also, 0 < $_ < 4096 is also shorter than 0 < $_ && $_ < 4096 18:00
also, writing "also" twice per line is also not very good also 18:01
TimToady that would be more like 0 ^..^ 4096 18:02
timotimo well, that's why i spelled it 1..4095, though of course that has the same result
TimToady if you can get non-integers as input 18:03
timotimo in this example we're starting out with "subset ... of Int" :)
Diddi timotimo: thanks, I do feel I'm unnecessarily expressive when I write some code and I know there are a lot of shortcuts so I appreciate such tips :)
timotimo \o/
Kaiepi does anyon have the link to that guide on getting into perl 6 dev that included information on how nqp and moarvm work? 18:06
s/anyon/anyone
should've bookmarked it last time
timotimo that's probably the nqp and rakudo internals workshop? 18:08
rakudo and nqp internals workshop 18:09
Kaiepi yeah that
timotimo github.com/edumentab/rakudo-and-nq...als-course
Kaiepi thanks
timotimo do we have a feature to ask huggable if it has some key that points at a given value? i.e. if it knows this link already?
huggable: source
huggable timotimo, Install latest version of Rakudo from source: github.com/zoffixznet/r#table-of-contents
timotimo haha, not that 18:10
buggable: source
buggable timotimo, See: github.com/zoffixznet/perl6-buggable
timotimo it doesn't have that feature, maybe i'll send a feature request 18:12
Xliff What am I doing wrong, here?
m: "use Parser::SQL::Tokens;" ~~ m:g/'use' \s+ $<word>=\w+ [ '::' $<word>=\w+ ]* ';'/; dd $/<word>;
camelia &CORE::infix:<orelse>(Failure.new(exception => X::AdHoc.new(payload => "Type List does not support associative indexing."), backtrace => Backtrace.new), *.self)
shinobi-cl Hi all :) 18:13
m: my %h = 'A' => 20, 'B' => 10, 'C' => 20, 'D' => 40; say %h.perl
camelia {:A(20), :B(10), :C(20), :D(40)}
Xliff m: my token word { \w+ }; say "use Parser::SQL::Tokens;" ~~ m:g/'use' \s+ <word> [ '::' <word> ]* ';'/; 18:14
camelia (「use Parser::SQL::Tokens;」
word => 「Parser」
word => 「SQL」
word => 「Tokens」)
timotimo in your code $/ is a list, not a match object
shinobi-cl So i have this array. I want to get the Keys sorted by: 1st: value, and for the same value, alfabetically. How should i do this? 18:14
Xliff timotimo: Why would $/ not be a match object? 18:15
timotimo Xliff: because of :g
Xliff \/o\
timotimo m: "abcde" ~~ m:g/./; say $/.^name; say $/.perl
Xliff Right.
camelia List
$(Match.new(list => (), made => Any, pos => 1, hash => Map.new(()), orig => "abcde", from => 0), Match.new(list => (), made => Any, pos => 2, hash => Map.new(()), orig => "abcde", from => 1), Match.new(list => (), made => Any, pos => 3, hash =>…
Xliff m: "use Parser::SQL::Tokens;" ~~ m:g/'use' \s+ $<word>=\w+ [ '::' $<word>=\w+ ]* ';'/; dd $/[0]<word>; 18:16
timotimo shinobi-cl: you mean if the value is the same, use the key alphabetically?
camelia [Match.new(list => (), made => Any, pos => 10, hash => Map.new(()), orig => "use Parser::SQL::Tokens;", from => 4), Match.new(list => (), made => Any, pos => 15, hash => Map.new(()), orig => "use Parser::SQL::Tokens;", from => 12), Match.new(list => (…
shinobi-cl timotimo, yes
Xliff m: "use Parser::SQL::Tokens;" ~~ m:g/'use' \s+ $<word>=\w+ [ '::' $<word>=\w+ ]* ';'/; dd $/[0]<word>[*-1].Str;
camelia "Tokens"
timotimo in that case i believe you can .sort({ .value, .key })
shinobi-cl :o
timotimo m: my %h = 'A' => 20, 'B' => 10, 'C' => 20, 'D' => 40; %h.sort({ .value, .key }).perl.say 18:17
camelia (:B(10), :A(20), :C(20), :D(40)).Seq
moritz m: "use Parser::SQL::Tokens;" ~~ m:g/'use' \s+ [$<word>=\w+]+ % '::' /
camelia ( no output )
timotimo m: my %h = 'A' => 20, 'B' => 10, 'C' => 20, 'D' => 40; %h.sort({ -.value, .key }).perl.say
camelia (:D(40), :A(20), :C(20), :B(10)).Seq
moritz m: say "use Parser::SQL::Tokens;" ~~ m:g/'use' \s+ [$<word>=\w+]+ % '::' /
camelia (「use Parser::SQL::Tokens
word => 「Parser」
word => 「SQL」
word => 「Tokens」)
shinobi-cl :O :O
pmurias timotimo: I haven't looked into spesh at all yet
shinobi-cl thanks timotimo++ !! damn ... i love perl6 18:18
timotimo <3
timotimo pmurias: if you got any questions i'm here for you :) 18:18
shinobi-cl m: sub sub1($x) { return ($x, $x); }; my $v = sub1(100); my @a = sub1(100); say $v.perl; say @a.perl; 18:49
camelia $(100, 100)
[100, 100]
shinobi-cl ok, so, how should i make it so $v is the scalar 100 only? 18:50
TimToady m: sub sub1($x) { return ($x, $x); }; my ($v) = sub1(100); my @a = sub1(100); say $v.perl; say @a.perl; 18:51
camelia 100
[100, 100]
TimToady if you're asking for an equivalent to wantarray, we don't try to predict the future in p6 18:53
shinobi-cl hmmm, i see. Well the idea is: i have a method that can reject some data passed to it, i want to return only the useful info, but if the user wants it, i can give it back the discarded data.
TimToady then "wants" needs to be passed in as a parameter, or you need the user to throw away the extra info as above 18:54
or return an object and let the user pull out what they want
shinobi-cl yes, that makes sense, i will put the option to pass a named parameter with a ref to return the discarded data there. Thanks! 18:56
TimToady but we can't really have both wantarray and multiple dispatch, and in p6 the latter is much more important
timotimo m: sub split-it(@incoming, :$discarded is rw) { @$discarded = @incoming.grep(Str); return @incomint.grep(none(Str)) }; my @out; say split-it((1, 2, "hi", 3, 4, "foo"), discarded => @out); say @out.perl 18:58
camelia 5===SORRY!5=== Error while compiling <tmp>
Cannot use 'is rw' on optional parameter '$discarded'.
at <tmp>:1
timotimo m: sub split-it(@incoming, :$discarded is raw) { @$discarded = @incoming.grep(Str); return @incomint.grep(none(Str)) }; my @out; say split-it((1, 2, "hi", 3, 4, "foo"), discarded => @out); say @out.perl
camelia 5===SORRY!5=== Error while compiling <tmp>
Variable '@incomint' is not declared. Did you mean '@incoming'?
at <tmp>:1
------> 3discarded = @incoming.grep(Str); return 7⏏5@incomint.grep(none(Str)) }; my @out; sa
timotimo m: sub split-it(@incoming, :$discarded is raw) { @$discarded = @incoming.grep(Str); return @incoming.grep(none(Str)) }; my @out; say split-it((1, 2, "hi", 3, 4, "foo"), discarded => @out); say @out.perl 18:58
camelia (1 2 3 4)
["hi", "foo"]
timotimo shinobi-cl: ^
of course you want to check if $discarded is actually present first 18:59
jstuder hey 6ers i have a question 19:27
should Str words method split on a non-breaking space? 19:28
the sub in nqp for the same task does not split on nbsp
the sub used for quotewords and such
Str words does not
jstuder So one of them has to be wrong? 19:28
I didn't see anything in the spec docs about it 19:29
timotimo are you refering to method split_words in Grammar.nqp?
jstuder yes
MasterDuke you said both did *not*, was that a typo and one actually does? 19:30
jstuder split_words in the grammar does not split
Str words in rakudo does
a typo
MasterDuke ah
jstuder a test in S32-str/words.t has is splitting on nbsp. I'm not sure if that is right or a mistake 19:31
I kind of feel like it shouldn't split 19:32
especially since it doesn't in the grammar
jstuder m: say "a\c[NO-BREAK SPACE]bc d".words; 19:36
camelia (a bc d)
jstuder m: say "a\c[NO-BREAK SPACE]bc d".words.elems;
camelia 3
MasterDuke m: say <<a\c[NO-BREAK SPACE]bc d>>.perl 19:42
camelia ("a bc", "d")
MasterDuke m: say "a\c[NO-BREAK SPACE]bc d".words.perl
camelia ("a", "bc", "d").Seq
jstuder yeah the behavior is different. which doesn't seem right to me 19:45
Zoffix m: say .comb(/\S+/).List eqv .split(/\s+/, :skip-empty).List eqv .words.List with "a\c[NO-BREAK SPACE]b\c[narrow no-break space]c\c[zero width no-break space]d" 20:24
yoleaux 17:23Z <skids> Zoffix: gist.github.com/skids/21eaaad37969...c48be35274 research so far on that pres_topic issue
camelia True
Zoffix This is what'd I'd expect, so I'd say it's the quotewords that are wrong 20:25
And .comb not always returning Seq :/
m: say "".comb.^name; say "".comb(/./).^name
camelia Seq
List
jstuder so should we change the split_words behavior in nqp to match? 20:28
so that it will also split on nbsp?
although I still feel like it shouldn't split on a nbsp. though it's not my call to make 20:29
Zoffix jstuder: why not? It's has Zs property 20:30
jstuder that's true. I don't know why, just that no-break behavior seems like it should behave differently. BUt it's just a gut feeling and not rooted in anything more. 20:32
TimToady it depends on how the definition of break breaks 20:34
jstuder TimToady: I'm afraid I don't understand 20:36
Zoffix .ask samcv does Unicode have some sort of "non-break" property? In .words and with \S/\s we split on \x00A0\x2007\x202F chars because they're Zs and don't split on \xFEFF because it ain't. But when parsing quotewords we have code explitly not splitting on "\x00A0\x2007\x202F\xFEFF" and I don't know why these 4 chars were chosen to be special exactly (other than having "non-break" in the name)
yoleaux Zoffix: I'll pass your message to samcv.
TimToady if someone's intent in putting a no-break in is to prevent treatment as multiple words, it seems a bit antisocial for .words to treat them as multiple words 20:38
just because something doesn't have a particular unicode category doesn't mean it isn't a unique character with unique semantics 20:39
that's why we have separate characters, after all :)
jstuder I guess that is the way I saw it too. That the use of the no-break is odd enough that it would signify a clear intent.
that the user intends not to split/break on this character 20:40
TimToady to me, it falls a bit into the category of "torment the implementer" to handles it the way the user expects
Zoffix Yeah, but if someone used &nbsp; as a spacer in HTML markup, and you try to work with as just text, now you got broken code. And "splits on whitespace" is easier to understand and remember than "splits on whitespace unless it's a whitespace character that has "no-break" in its name"
TimToady arguable &nbsp; as a spacer is a misuse of the character, but I understand that it happens with some frequency 20:41
Zoffix .tell samcv context: irclog.perlgeek.de/perl6/2018-02-24#i_15854900 20:44
yoleaux Zoffix: I'll pass your message to samcv.
jstuder So if we were to implement a CCLASS_NBSP, would that be appropriate? Are CCLASSes more about the unicode standard or about groupings that help the implementer? seems more like the latter to me, from looking at the code. 20:46
TimToady I just know I get really ticked off when a program thinks it knows better than me whether to split up "Perl 6"
jstuder That's a really good point
Zoffix It's a no-break, not a no-split :P 20:47
TimToady and if you're splitting HTML up using .words, &nbsp; is the least of your worries
Zoffix No, splitting text given from HTML parser
samcv Zoffix: well no break is really no split
yoleaux 20:44Z <Zoffix> samcv: context: irclog.perlgeek.de/perl6/2018-02-24#i_15854900
samcv since it splits across lines 20:48
TimToady when ah splits a hunk o' wood, it breaks
samcv though there is line break property and word break property
that are separate, though mostly they are the same
Zoffix samcv: what about space-break or something? Basically, so we'd quiery by some property rather than hardcoding specific codepoints. 20:50
samcv well we would use the word break property 20:51
samcv not sure when word break is different than line break though i know it exists 20:51
samcv like nbsp it doesn't break on lines, but it breaks on words 20:52
Zoffix gah, I DOM::Tiny auto-converts &nbsp; to regular spaces. 20:53
mst *DOM* *DOM* *DOM* *DOMMMMM* 20:54
Zoffix I filed R#1562 so we don't forget about it. 20:59
synopsebot R#1562 [open]: github.com/rakudo/rakudo/issues/1562 [RFC] Inconsistent handling between Str.words and «....» quoters 21:00
Zoffix robot! do my bidding!
Zoffix R#1562 21:01
synopsebot R#1562 [open]: github.com/rakudo/rakudo/issues/1562 [RFC] Inconsistent handling between Str.words and «....» quoters
jstuder en.wikipedia.org/wiki/Whitespace_character 21:01
What if we have a CCLASS_NBSP and include the 5 chars listed as not Wrappable in this doc? 21:02
jstuder and don't split on those? 21:02
Zoffix I don't see a difference between that and hardcoding the codepoints next to split_words in HLL::Grammar. 21:06
samcv: how to quiery word break property? 21:07
TEttinger we need break break properties so we know if breaks will break correctly or if they will break
Zoffix m: "\x[A0]".uniprop('Word_Break').say
camelia Other
Zoffix m: " ".uniprop('Word_Break').say
camelia Other
samcv Zoffix: unicode.org/reports/tr29/#Default_...Boundaries well it's complicated 21:08
err meant to link this section unicode.org/reports/tr29/#Word_Boundary_Rules
but there's rules regarding the Word_Break property similar to Grapheme_Cluster_Break property 21:09
jstuder Did I open a huge can of worms? :P 21:10
TEttinger zero-width no-break space 21:12
samcv i don't have time to get into it at this exact second but I will read into it later today 21:13
Zoffix Well, my vote is to keep .words as is. "Breaks on whitespace characters" is easy to understand and if someone wants to be fancy and not break on non-breakables the burden of remembering all the codepoints on is on them (e.g. doing "a\x[A0]b c".split(/<[\s]-[\x[A0]]>+/)). The words given by .words aren't quite "words" as is it, so KISS is my thought on it.
Don't care as much about «...». Would be nice for it to be consistent, but I can live with it doing special things.
jstuder: not that huge :) 21:14
There've been bigger cans... like D#1428
synopsebot D#1428 [closed]: github.com/perl6/doc/issues/1428 [docs][update] List method flatmap is inappropriately discouraged
Zoffix 21:15
TEttinger bucket of worms 21:15
bathtub of worms
moritz bitbucket of bits 21:16
TEttinger bitbucket is still around right?
TEttinger gitlab is pretty darn stiff competition 21:17
moritz I think bitbucket's main selling point is that it's well integrated with Atlassian's other stuff, like Jira 21:19
TEttinger haha 21:20
"I think chewing tobacco's main selling point is that it's well integrated with throat cancer" 21:21
jstuder What if we implemented a CCLASS_NBSP with the few hard-coded values, tell .words not to split on it, and refine as necessary in the future depending on samcv's research. That seems like a good option to me. 21:22
moritz each change to .words is a backwards-incompatible change, and we shouldn't make those lightly 21:23
jstuder i see 21:24
Xliff W8 WAT?!? 21:33
<moritz> m: say "use Parser::SQL::Tokens;" ~~ m:g/'use' \s+ [$<word>=\w+]+ % '::' /
I missed that.
\o/ 21:35
Xliff I must now rewrite several rules 21:35
moritz++
moritz Xliff: please /msg me your email address 21:36
Xliff m: say "a, b" ~~ /. % [ ',' \s* ] 21:38
camelia 5===SORRY!5=== Error while compiling <tmp>
Missing quantifier on the left argument of %
at <tmp>:1
------> 3say "a, b" ~~ /. %7⏏5 [ ',' \s* ]
Xliff m: say "a, b" ~~ /. % [ ',' \s* ]/
camelia 5===SORRY!5=== Error while compiling <tmp>
Missing quantifier on the left argument of %
at <tmp>:1
------> 3say "a, b" ~~ /. %7⏏5 [ ',' \s* ]/
Xliff m: say "a, b" ~~ / [ . ] % [ ',' \s* ]/ 21:39
camelia 5===SORRY!5=== Error while compiling <tmp>
Missing quantifier on the left argument of %
at <tmp>:1
------> 3say "a, b" ~~ / [ . ] %7⏏5 [ ',' \s* ]/
Xliff m: say "a, b" ~~ / [ . ] % ',' /
camelia 5===SORRY!5=== Error while compiling <tmp>
Missing quantifier on the left argument of %
at <tmp>:1
------> 3say "a, b" ~~ / [ . ] %7⏏5 ',' /
Xliff m: say "a, b" ~~ / . % ',' /
camelia 5===SORRY!5=== Error while compiling <tmp>
Missing quantifier on the left argument of %
at <tmp>:1
------> 3say "a, b" ~~ / . %7⏏5 ',' /
moritz % is a modifier on a quantifier
Xliff Oh
moritz so the patter is always <atom><quantifier> % <separator> 21:40
Xliff m: say "a, b" ~~ / .* % [ ',' \s* ]/
moritz *pattern
camelia 「a, b」
Xliff m: say "a,b" ~~ / .* % [ ',' \s* ]/
camelia 「a,b」
Xliff m: say "a," ~~ / .* % [ ',' \s* ]/
camelia 「a」
moritz you can use %% if you want to allow trailing separators
Xliff OK, but I was just curious as to whether <separator> could be an <atom>
And looks like the answer is yes.
jstuder exit 22:26
Geth doc: 8b05b467b4 | (Brad Gilbert)++ | 4 files
.Bool on allomorphs return False when numerically 0
23:06
von_cheam Hullo! Can I just ask, what's the syntax for constraining a subroutine's return type to a list-type obj? 23:18
Specifically, I want to return an array of strings, but both --> @Str and --> Array[Str] fail.
Geth doc: 8a070b2f75 | (Will "Coke" Coleda)++ | doc/Type/Hash.pod6
remove trailing whitespace
23:19
doc: f50db4372f | (Will "Coke" Coleda)++ | xt/code.pws
note recently added code snippets
synopsebot Link: doc.perl6.org/type/Hash
jnthn m: sub foo(--> Array[Str]) { my Str @a = 'x', 'y'; return @a; }; say foo 23:20
camelia [x y]
jnthn von_cheam: Array[Str] should be fine, but make sure the thing being returned is a declared Array of Str, not just an Array that happens to contain Str objects 23:21
von_cheam Okay, thanks. I thought I had, but --> Array[Str] fails with something along the liunes of expected Array[Str] but got Array[Str].new("examplestring") 23:22
I'll go back and check my code!
[Coke] was too slow. 23:23