»ö« 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.
brrt yeah, unbreaked it 00:00
timotimo good
brrt :-)
MasterDuke m: my @a = ^9; my $b = 3; say @a[*-$b..*] 00:01
camelia rakudo-moar 345f6a: OUTPUT«(6 7 8)␤»
TimToady samcv: I believe it's just a hardwired list in nqp/src/HLL/Grammar.nqp currently
samcv okay thanks
MasterDuke vcv_: my examples looks like *-n..* works 00:02
samcv yeah. i made a script that goes through all codepoints, and tries the codepoints above/below 5 codepoints. and then uses a mix to record the ones that share the most words
and then print out the matching ones
will look at that code, thanks :)
tbrowder ref docs: modules and terminology. questions:
1. given this statement "use Foo :ALL", what is the proper name for the ":ALL" portion? 00:03
brrt goes to sleep
timotimo brrt: why do we start arguments at $1? because $0 has the op's ame in it? :P 00:04
With the ‘&’ syntax, any C macro can be referenced, and with that any runtime expression evaluated. - wants to read "compiletime expression"? 00:05
samcv also my script also runs test, and uses eval to test all the things and see which ones we are not using. and there were like 5 of the 82 pairs that it wasn't able to pair up to another codepoint. will have to see either they coorasponding one is more than +/- 5 codepoints away or maybe doesn't have any matching ones
timotimo brrt: ^
00:05 pierre__ joined
tbrowder 2. given this fragment of a sub definition: "sub foo() is export {", what is the proper name for the "is export" portion? 00:05
MasterDuke tbrowder: 2. "trait" i believe 00:06
00:06 cpage_ left
tbrowder 3. given this fragment of a sub definition" "sub bar() is export(:other) {", what is the proper name for the ":other" portion? 00:06
timotimo for 1., we call that an "export tag" or maybe an "import tag" 00:07
tbrowder The reason I ask is that the docs are a little hazy and use names like "tags" a bit loosely i think. 00:08
timotimo mhm 00:09
00:10 cognominal joined
tbrowder So "tag" then really fits both situations 1 and 3 and we add the "import" or "export" according to context. That sounds good. And "trait" for situation 2 also sounds good. Thanks. 00:11
babydrop samcv: it's this giant string: github.com/perl6/nqp/blob/master/s...mar.nqp#L4 00:13
samcv yeah looking at it now :)
is it okay if I make it span multiple lines or no?
kind of horrible as one line. unless there's a good reason not to 00:14
babydrop samcv: no idea, but I found it a pain to be a single line last time I added stuff to it 00:15
samcv yeah
00:16 espadrine left
vcv_ MasterDuke: yep, that does. thanks! 00:17
Technaton Dear p6 world, I still don't understand what is the difference between a HashSet and a simple hash. I've read p6 advent calendar for day 7, but why HashSet instead of Hash? Or: Since HashSet exists, when is a single Hash apropriate? 00:18
babydrop Technaton: wtf is a HashSet? 00:19
m: HashSet
camelia rakudo-moar 345f6a: OUTPUT«5===SORRY!5=== Error while compiling <tmp>␤Undeclared name:␤ HashSet used at line 1␤␤»
timotimo a long as you make sure it doesn't end up with newline characters in the middle, it should be fine to make it multi-line
tbrowder I was off base: the module pod looks pretty good after my questions were answered. 00:20
Thanks.
Technaton SetHash, sorry.
babydrop Technaton: Sets are single-level and hashes can be nested 00:21
With corresponding optimizations that can be done of them.
I mean, they don't even inherit from a Hash or Map is how different they are
00:21 sortiz joined 00:22 rindolf left
Technaton Sorry if I am being overly persistent: The day 7 article starts with a 'traditional' code snipped for plain old hashes. Then, the article introduces Bags, Sets, etc. The syntactic sugar is really nice, but why SetHash vs. Hash? When is it appropriate to choose one against the other? Is there a performance gain, or is it simply the syntactic sugar? I am very sorry if this is just another newbie question; 00:25
it is simply not clear to me when to choose one over the other. :-/
00:26 firstdayonthejob left
babydrop The code in the article counts the thing by itself while in the "traditional" snippet you have to do it yourself. 00:27
geekosaur a SetHash is a mutable Set. (I'm not fond of that name) a Set is, well, you could think of it as just the keys from a Hash, no values 00:28
Technaton I.e., those classes are syntactic sugar on top of a hash? Again: Sorry, I might sound like an advocatus diaboli, but this isn't my intention.
geekosaur ...what? 00:29
you could make a Set on top of a Hash but I would only do so in the absence of an actual set type
00:30 cpage_ joined
babydrop Technaton: a SetHash contains unique objects. A Hash contains nest structures of object that (by default) are references by string labels. 00:30
*nested
*objects bah
*referenced
babydrop gives up :)
Technaton Again, I am just new to Perl 6, and I haven't read any of the underlying proposals. I am just reading the documentation, so there might be silly questions coming from my side. I simple do not understand why there is the SetHash type. I can understand the necessity for an immutable Set (or Bag), but - well, immutability might as well apply to any object in a language.
What's bad about nested structures? Or even: What is the difference? Considering a hash-of-hashes, the keys in one layer are still unique - aren't they? 00:32
I am profoundly confused, I fear. :-(
geekosaur it sounds like you are missing basic data structures as well
00:32 aborazmeh joined, aborazmeh left, aborazmeh joined
geekosaur a set is made of unique keys 00:32
the only value associated with the key is the key itself.
Technaton Hum. 00:33
Juerd To me, the whole set/bag/sethash/baghash/mix/mixhash/hash thing feels like a hard-to-learn permutation resulting in way too many types that do very similar things. 00:34
geekosaur so a Hash gives you keys and associated values; the default key type is immutable strings. a SetHash is just the keys, but the keys are mutable (this has effects on how it is implemented and in turn on how fast operations on it are, which is why it's distinct from Set); this is most useful when the keys themselves are mutable objects instead of just Strings
Technaton Going back to the day 7 perl 6 advent calendar, I am having a hard time spotting the difference between the first and the second code example - except for the syntactic sugar that allows for smalller code.
Okay. 00:35
00:35 pyrimidine joined
geekosaur basically you need to know data structures to pick the right one (regardless of language; this is not something specific to Perl 6, but it is something Perl 5 didn't have because it didn't really do data types), and to pick the right data type you need some basic algorithms. 00:36
profan is there anything like koans for perl 6?
babydrop profan: nope 00:37
geekosaur in perl 5 you regularly abuse various things like hashes because there's no actual support for anything else. in perl 6 we support using real types, but to do that you have to know about data types in general
babydrop profan: well volunteered? :)
geekosaur or just fall back to being perl5-ish and use Hash
Juerd geekosaur: That is entirely true, but given the complexity of types that Perl 6 provides here, I think that for most programmers reinventing the wheel with regular hashes will be faster than learning and discovering which type to use.
geekosaur but I think teaching an algorithms and data structures course might be a bit beyond the scope of perl 6
Juerd geekosaur: No, since these types are part of the language, it is very much within the scope of Perl 6. 00:38
profan babydrop: haha, i'm just looking for a nice way into looking at some perl 6 constructs and learning bit by bit, haven't done that much perl 6 yet
babydrop Technaton: err.. but what about all the set and baggy operators?
Juerd (And that's the problem, in my opinion. It could have been the scope of some module.)
profan i'll think about it later once i've used it for more things :)
geekosaur ...what?
Technaton I am sorry, I still don't get it. I mean, I've optimzed C++ code for ANNs and for power flow analysis (which requires fast matrix code), so I guess I know my Knuth. But I still don't see the difference between a plain old hash and the new Bag/Set types in perl 6. Is there a general rule for, e.g., optimization?
babydrop: So, again, syntactic sugar? 00:39
geekosaur if you've done fast matrix code, you have only explored a corner of the algorithms and data structures space
Technaton I mean, I can live with that: 'Here are your set operations, they're fast and optimized, but you have to use this class.'
geekosaur but I guess someone has to build a full college course now in order to teach perl 6, because it made the mistake of including such things in core. never mind how many other languages include them in core and don't bundle the college course. 00:40
Technaton geekosaur: Yep. For sure.
00:40 pyrimidine left
babydrop Technaton: it's an entirely different semantic meaning and that comes with more than a dozen of specialized operators. If you think that's just "syntactic sugar" then well... no one's stopping you from using hashes for everything. I mean, you can view a string as just an array of characters, right? And all the string methods are "syntactic sugar" 00:41
Juerd Technaton: It must be syntactic sugar, because these classes are implemented using a hash (%!elems, as declared in src/core/Setty.pm line 2)
Technaton geekosaur: My question still stands: What is the difference between the Bag/Set/etc datatypes and plain old hash/array? Is there a (simple?) rule to choose one over the other?
geekosaur ...
I doube there is a simple one 00:42
*doubt
Juerd Technaton: I think it's syntactic sugar and self-documenting code, but not much more than that.
00:43 skids joined
Technaton Or is it simply: "If you want set operations, and you want them fast, use the Set datatype, because it is optimized for that, way faster than anything you could implement ontop of a p6 hash"? If it is so, I would be happy to know that an anwer like this exactly is the difference. 00:43
babydrop I disagree with that entirely.
Juerd babydrop: Which "that"? IRC is prone to race conditions :)
Technaton "Simply". Forgive me, please. :)
babydrop Juerd: your statement that Sets, Bags, and Mixes are just sugar for Hashes
Juerd babydrop: I'm reading the implementation. They are. 00:44
babydrop To my mind they have an entirely different semantic meaning.
geekosaur likewise
but that seems to be an unacceptable answer
Juerd It having a different semantic meaning isn't mutually exclusive with it being syntactic sugar, is it? 00:45
Technaton Juerd, babydrop, geekosaur: Please, I do not want to start a flame war. I am just a p6 novice, albeit one who has written optimized code in quite some languages. I am happy if someone tells me 'believe me, if you want a set operation, the Set type is exactly optmized for this.' I have simply failed to spot an answer like this in the documentation, that's why I ask. 00:46
MasterDuke there's some truth that all data structures are just sugar for hashes, because every other data structure can be implemented with hashes
but sugar is nice
vcv_ is it possible to create a subset type of bool with the Str method overridden? 00:47
geekosaur it's just a less than ideal way to do it. and I suspect if it's being done with a hash underneath, it's a target for future optimization, not a statement that it's "syntactic sugar"
babydrop A hash contains objects you look up with a label. It's about being able to access an object simply. Sets, Bags, and Mixes are all about objects themselves.
Technaton MasterDuke: Yeah, I guess that anything can be fast with malloc()ing a chunk of memory and an endless amount of bit fiddling. But that is not why I am asking the question.
Juerd Technaton: You may want to use the specific types for their semantics, for syntactic sugar, or just to have the right types for type constraints (think multi methods), but I think optimization is not (yet?) a good reason.
00:47 canopus left
babydrop m: put True but "False"; 00:48
camelia rakudo-moar 345f6a: OUTPUT«False␤»
babydrop vcv_: ^ that's one way
m: put True but role { method Str { "meows" } };
camelia rakudo-moar 345f6a: OUTPUT«meows␤»
babydrop A bit clearer example
m: class MeowBool is Bool { method Str { "meows" } }; my $m = MeowBool.new; put $m 00:49
camelia rakudo-moar 345f6a: OUTPUT«5===SORRY!5=== Error while compiling <tmp>␤Bool does not support inheritance, so MeowBool cannot inherit from it␤at <tmp>:1␤»
babydrop riight
vcv_: more information would give a better answer
Technaton: my suggestion would be simply to ignore those types for now. 00:50
Technaton 'For now' means 'until you've gained more knowledge in p6'? (I am completeley content with such a suggestion.) 00:51
babydrop Technaton: yeah 00:52
Technaton: these types aren't a must-know feature. 00:53
Technaton That's all well and good. So, behind «%counts{$_}++ for 'AGTCAGTCAGTCTTTCCCAAAAT'.comb;» vs. «'AGTCAGTCAGTCTTTCCCAAAAT'.comb.Bag<A T G C>» is a deeper reason beyond syntactic sugar on top of plain old hashes?
Juerd babydrop: I think the question is: can you have a user-defined data type that's like a boolean, but stringifies differently (e.g. "on"/"off" or "enabled"/"disabled")?
Technaton (If you answer with 'yes', I will be content, and strive to learn until the day comes when I grasp the difference.) 00:54
samcv u: SINGLE HIGH-REVERSED-9 QUOTATION MARK
unicodable6 samcv, U+0049 LATIN CAPITAL LETTER I [Lu] (I)
samcv, U+0053 LATIN CAPITAL LETTER S [Lu] (S)
samcv, U+004E LATIN CAPITAL LETTER N [Lu] (N)
samcv, gist.github.com/6ebe74943a567e3ba7...eb83f40630
00:54 cpage_ left
babydrop Technaton: for me, yes. The first method just abuses the hash. The second one has actual semantic meaning behind it that represent the operation I'm performing. I have stuff and I care about its identity. 00:54
Technaton: but there's no point in beating your head against that if it's not making any sense right now :)
Juerd babydrop: I think it uses the hash, doesn't abuse it.
Technaton If 'right now, it is semantic, and in the future there will be an explicit performance gain in using it so' is the answer, I'll stick to it. :) 00:55
And thanks for your patience. :-) 00:56
babydrop Juerd: it just uses a label to reference an object it's manually manipulating to record relevant information. When Bag is an option, that's abuse. 00:57
00:57 canopus joined
Juerd babydrop: The problem that I have with that word is that it comes across as very unfriendly towards people who use only the more primitive aspects of the language. 00:58
vcv_ babydrop: creating an array of bools, say my @foo = True xx 5; I want '#####' if i do say @foo.join; or say [~] @foo;
Juerd If you're going to insist that this is not a must-know feature, don't accuse people for not yet knowing it. 00:59
01:00 wamba left
babydrop m: y @foo = (True but 'X') xx 5; say @foo.join 01:00
camelia rakudo-moar 345f6a: OUTPUT«5===SORRY!5=== Error while compiling <tmp>␤Unsupported use of y///; in Perl 6 please use tr///␤at <tmp>:1␤------> 3y7⏏5 @foo = (True but 'X') xx 5; say @foo.jo␤»
babydrop m: my @foo = (True but 'X') xx 5; say @foo.join
camelia rakudo-moar 345f6a: OUTPUT«XXXXX␤»
babydrop m: my @foo = (True but '#') xx 5; say @foo.join
camelia rakudo-moar 345f6a: OUTPUT«#####␤»
babydrop vcv_: like that?
Juerd babydrop: Could this be done in a type, such that after ?expr or !expr, it still stringifies to "#" if the value is true? 01:01
vcv_ good enough. thanks!
babydrop m: my \SBool = Bool but "#"; my $b = SBool.new: 1; say so $b 01:02
camelia rakudo-moar 345f6a: OUTPUT«True␤»
babydrop m: my \SBool = Bool but "#"; my $b = SBool.new: 0; say so $b
camelia rakudo-moar 345f6a: OUTPUT«False␤»
babydrop m: my \SBool = Bool but "#"; my $b = SBool.new: 0; print $b
camelia rakudo-moar 345f6a: OUTPUT«0»
babydrop hm
Juerd A use case that comes to mind is something I have to do all the time: provide user-friendly descriptions of boolean configuration options. Usually "enabled" and "disabled". 01:03
Of course, this could easily be solved with a simple helper function. But vcv_'s question made me wonder if it could be done with types. 01:04
babydrop No idea. 01:05
Juerd It'd be easy if you could inherit from Bool, but that's not possible.
01:06 pierre__ left
Juerd Oh, of course. Enums. Bool's just an enum... 01:06
Hm, no, because your own enum doesn't accept Bool :| 01:08
Is it even possible to create an enum from, say, an Int? :) 01:11
Ah, by calling the enum as a function 01:13
01:14 pierre__ joined
Juerd m: enum Switch <off on>; my Switch $foo = Switch(True.value); put $foo 01:14
camelia rakudo-moar 345f6a: OUTPUT«on␤»
Juerd Seems overly repetative :)
01:18 cibs left, pierre__ left 01:19 cibs joined
timotimo m: enum Switch <off on>; my Switch $foo = Switch(True); put $foo 01:20
camelia rakudo-moar 345f6a: OUTPUT«Use of uninitialized value $foo of type Switch in string context.␤Methods .^name, .perl, .gist, or .say can be used to stringify it to something meaningful.␤ in block <unit> at <tmp> line 1␤␤»
timotimo ah, yes, of course 01:21
01:22 pierre__ joined 01:30 b7j0c joined 01:34 b7j0c left 01:38 pyrimidine joined 01:43 pyrimidine left
Juerd timotimo: Is that a bug? I'd think that unsupported values shouldn't be silently discarded 01:45
timotimo dunno 01:46
01:55 mohae_ left 01:56 mohae joined 02:01 Celelibi left 02:03 Celelibi joined 02:04 BenGoldberg joined 02:07 matiaslina left 02:09 kalkin-_ joined, kalkin- left 02:20 cdg_ left
TimToady There are lots of good reasons to have Sets/Bags as separate types from Hashes: 02:25
1) they respond correctly to set and bag operators, while hashes will wrongly listify to a list of pairs and operate on those
2) they allow the corresponding SetHash and BagHash types to autodelete when the associated value goes to False or 0
3) they default to using objects for keys, rather than strings
4) because they constrain the return values of lookups to True or Int, they can have other implementations
5) yes, you can declare my Int %hash{Any} to get something with (some of) the contract of a Bag, but "Bag" is a lot easier to type
6) in their natural state, Sets and Bags are immutable, which Hash doesn't get you (the SetHash and BagHash types can be thought of as containers for various sets and bags)
7) mathematicians already know what sets and bags are, but have little clue about the peculiarities of hashes
8) they are just very, very convenient, both syntactically and semantically, for histograms and such
02:26 pyrimidine joined
TimToady 9) set theory is very basic, and should not be upsetting reductionist curmudgeons :P 02:26
02:31 pyrimidine left 02:34 cpage_ joined 02:45 ilbot3 left 02:48 ilbot3 joined
tbrowder .tell [Coke] i'm going to sleep. please leave any suggestions for the blog in a gist or email or some other place i can find them. thanks. 03:01
yoleaux tbrowder: I'll pass your message to [Coke].
03:05 xtreak joined 03:10 seatek joined 03:16 noganex_ joined 03:18 noganex left
[Coke] .tell tbrowder I will do the review over coffee in the morning! 03:19
yoleaux 03:01Z <tbrowder> [Coke]: i'm going to sleep. please leave any suggestions for the blog in a gist or email or some other place i can find them. thanks.
[Coke]: I'll pass your message to tbrowder.
03:20 bjz joined
dalek c: cabe811 | coke++ | doc/Type/List.pod6:
fix typo
03:21
synopsebot6 Link: doc.perl6.org/type/List
03:26 rburkholder left 03:28 pierre__ left 03:36 pierre__ joined 03:41 sydney_falk joined, pierre__ left, sydney_falk left 03:42 bjz left 03:59 pyrimidine joined 04:00 bjz joined 04:03 pierre__ joined 04:07 BenGoldberg left, Ben_Goldberg joined, Ben_Goldberg is now known as BenGoldberg 04:08 BenGoldberg left 04:10 pierre__ left 04:14 xtreak left 04:15 xtreak joined 04:17 pierre__ joined
samcv ok so the spec for perl 6 is basically starting + ending OR initial + final quote right? as far as unicode properties 04:19
I see an issue right now
m: say '﴿'.uniname ~ '﴿'.uniprop
camelia rakudo-moar 345f6a: OUTPUT«ORNATE RIGHT PARENTHESISPs␤»
samcv #not ok 22 - Ps U+FD3F Pe U+FD3E ﴿ ﴾ ORNATE RIGHT PARENTHESIS | ORNATE LEFT PARENTHESIS 04:20
so unicode says that the ornate right parenthesis is the starting one and the left parenthesis is the closing one
m: say q ﴾test﴿
camelia rakudo-moar 345f6a: OUTPUT«test␤»
samcv so idk if that should work or not, or that is going to be an exception? 04:21
04:21 pierre__ left 04:24 sortiz left
samcv it is meant for right to left languages since it's in the Arabic block. ﴿ ﴾ 04:29
skids heh. Maybe it should .flip... in a module :-) 04:31
04:33 cdg joined
samcv hmm 04:34
04:38 cdg left 04:39 cdg joined
samcv m: ﴿ليمان، إتفاقية بين ما, يذكر الحدود أي بعد, معاملة بولندا، الإطلاق عل إيو﴾sayq 04:42
camelia rakudo-moar 345f6a: OUTPUT«5===SORRY!5=== Error while compiling <tmp>␤Bogus statement␤at <tmp>:1␤------> 3<BOL>7⏏5﴿ليمان، إتفاقية بين ما, يذكر الحدود أي ب␤ expecting any of:␤ prefix␤ term␤»
samcv dammit
m: say q﴿ليمان، إتفاقية بين ما, يذكر الحدود أي بعد, معاملة بولندا، الإطلاق عل إيو﴾ 04:45
camelia rakudo-moar 345f6a: OUTPUT«5===SORRY!5=== Error while compiling <tmp>␤Use of a closing delimiter for an opener is reserved␤at <tmp>:1␤------> 3say q7⏏5﴿ليمان، إتفاقية بين ما, يذكر الحدود أي ب␤»
samcv bad bad perl 6
i think i typed that properly 04:46
ah. when i typed my text it looked incorrect like the () were reversed, but in the error message
you can see that it is the correct direction
at the end
m: say q ﴿ليمان، إتفاقية بين ما, يذكر الحدود أي بعد, معاملة بولندا، الإطلاق عل إيو﴾ 04:55
camelia rakudo-moar 345f6a: OUTPUT«5===SORRY!5=== Error while compiling <tmp>␤Use of a closing delimiter for an opener is reserved␤at <tmp>:1␤------> 3say q7⏏5 ﴿ليمان، إتفاقية بين ما, يذكر الحدود أي ␤»
samcv ﴿ليمان، إتفاقية بين ما, يذكر الحدود أي بعد, معاملة بولندا، الإطلاق عل إيو﴾say q 04:56
m: ﴿ليمان، إتفاقية بين ما, يذكر الحدود أي بعد, معاملة بولندا، الإطلاق عل إيو﴾say q
camelia rakudo-moar 345f6a: OUTPUT«5===SORRY!5=== Error while compiling <tmp>␤Bogus statement␤at <tmp>:1␤------> 3<BOL>7⏏5﴿ليمان، إتفاقية بين ما, يذكر الحدود أي ب␤ expecting any of:␤ prefix␤ term␤»
05:04 mawkish joined, pierre__ joined 05:05 khw left 05:07 jespoting joined, jespoting left 05:08 raiph joined
samcv here is the string cry.nu/arabic.txt 05:11
if you copy and paste it into anywhere in chromium at least it will show properly, apparently unicode says that many characters flip depending on RTL or LTR, but 'hard' characters like these arabic quotes do not reverse 05:13
i'm make a PR for nqp tonight with a RFC about this 05:15
once I get my test script passing for 100% of the brackety things 05:16
05:22 aborazmeh left 05:30 xinming left 05:32 xinming joined, bjz left 05:35 skrshn joined
skrshn For multi-dispatch, when there are multiple methods that satisfy arguments, which one gets called ? gist.github.com/skrisna/50ec2b89a8...212e5975f2 05:36
05:36 skids left
skrshn For instance, if I call it with 31337 both SmallPrime and BigPrime are satisfied 05:37
TimToady if the are both constrained, it calls them in order 05:42
05:42 Sgeo left
TimToady if they're nominally equivalent, it's an ambiguous dispatch, and illegal 05:43
05:44 Sgeo joined 05:46 raiph left, raiph joined 05:50 Cabanossi left 05:54 Cabanossi joined, cdg_ joined 05:56 cdg left, brillenfux joined 06:00 rurban joined, rurban left
samcv what's the easiest way to combine an array of mixes into one mix? 06:05
into the same mix with the weights added together etc 06:06
06:07 cibs left
samcv or even just having one mix and then adding thinks afterward to it, i can't figure out how to do that 06:08
i know i can add them individually with (+) 06:09
06:09 cibs joined
samcv and that's working fine but combining it for every item i add is slow 06:09
06:15 pierre__ left 06:23 darutoko joined, pierre__ joined 06:26 pierre__ left, pierre__ joined 06:40 FROGGS joined 06:41 HoboWithAShotgun left
brrt timotimo: good catch, fixed it 06:42
06:42 perlawhirl left
skrshn TimToady: thanks 06:44
samcv: can you give an example? finding it hard to follow 06:46
samcv ok so you have a MixHash, and you want to add things to it 06:47
06:47 domidumont joined
skrshn I plan to teach my 5.5 year old programming and start with perl 6 (and learn it myself along the way) 06:48
:-)
and good general programming references for kids ?
samcv m: my $mix = MixHash.new-from-pairs: 'one' => 1, 'two' => 2; my $mix2 = MixHash.new-from-pairs: 'one' => 1, 'three' => 3; my $mix3 = $mix ∩ $mix2; say $mix3
camelia rakudo-moar 345f6a: OUTPUT«mix(one)␤»
samcv m: my $mix = MixHash.new-from-pairs: 'one' => 1, 'two' => 2; my $mix2 = MixHash.new-from-pairs: 'one' => 1, 'three' => 3; my $mix3 = $mix ∩ $mix2; say $mix3.perl 06:49
camelia rakudo-moar 345f6a: OUTPUT«("one"=>1).Mix␤»
samcv uh don't know why that didn't combine them. oh oops
used the intersection one by accident
m: my $mix = MixHash.new-from-pairs: 'one' => 1, 'two' => 2; my $mix2 = MixHash.new-from-pairs: 'one' => 1, 'three' => 3; my $mix3 = $mix (+) $mix2; say $mix3.perl
camelia rakudo-moar 345f6a: OUTPUT«("two"=>2,"three"=>3,"one"=>2).Mix␤»
samcv but MixHash's are mutable so. would like to be able to add to it
skrshn samcv: ah.. i see 06:50
samcv m: MixHash.^methods.gist.say 06:51
camelia rakudo-moar 345f6a: OUTPUT«(Mix MixHash Bag BagHash elems pick list fmt categorize-list Set of classify-list Int Num Real Bool hash grabpairs pickpairs Numeric default grab kxxv roll SetHash new-from-pairs total WHICH Method+{<anon|41302672>}.new perl gist Method+{<anon|41302672>}.n…»
brrt sksrhn: well, there are books in development, i'm not sure what we have that is kid-friendly
samcv there should be some way right? i mean. they are mutable so what good is being mutable if i don't know how to add them?
06:52 RabidGravy joined
samcv not sure about that skrshn i mean there's some good adult tutorials but for a 5.5 year old idk 06:52
skrshn brrt: I am not looking for perl6 specific books. Just some suggestions for teaching programming to young kids. I can tailor them for perl6
06:52 domidumont left
skrshn I am looking for motivating examples and such 06:52
TEttinger well, on the plus side, they will learn the names of all the punctuation on and off the keyboard before the rest of their kindergarten class knows which is 'q' and which is 'p' 06:53
06:53 domidumont joined
skrshn TEttinger: :-) 06:53
TEttinger "teacher what's the texas for that multiplication sign?" 06:54
(something I wish they could answer in some college classes...)
double-struck R is all real numbers, but how would you write that in, say, an email without necessarily requiring the reader to have a font that supports that? 06:55
samcv using unicode? 06:56
brrt hmmmm 06:57
06:57 wamba joined
samcv u: ℝ 06:57
unicodable6 samcv, U+211D DOUBLE-STRUCK CAPITAL R [Lu] (ℝ)
brrt dunno, wouldn't logo do?
samcv just say {DOUBLE-STRUCK CAPITAL R}
brrt perl6 would seem to me to be a very hard first language (sorry camelia)
samcv lol.
hard why? 06:58
06:58 xtreak left
brrt very many concepts, funky punctuation and sigils... 06:58
on the other hand, that *can* help with disambiguations 06:59
samcv yeah
06:59 rurban joined
brrt but i'm recently leaning to 'BASIC was actually quite good for beginners' :-) 06:59
basic, of course, does have some sigils 07:00
07:01 xtreak joined
skrshn brrt: but we don't have to teach everything at once 07:03
brrt that ist true as well 07:04
skrshn BASIC with the goto statements -- no thanks 07:05
python may be a good start too
still trying to make up my mind 07:06
but most importantly, trying to get some interesting things to do with programming -- don't want to start with -- "now, we learn about for loops"
what I am worried with perl 6 is that I probably need to know perl6 well to teach it in a simple way using verbs/nouns/ english like sentences 07:09
TimToady we shouldn't start kids with English either :P
skrshn :-) 07:10
samcv m: sub postfix:< ½ >($left) { $left + ½ }; say 10½ 07:11
camelia rakudo-moar 345f6a: OUTPUT«10.5␤»
samcv has anybody thought about letting that work?
i mean shouldn't have issues with using it as a number by itself
would be neat
TimToady yes, it's been thought of, and not thought much of :) 07:12
samcv haha
the most pressing problem facing perl 6 today!
ha
TEttinger TimToady: there's about 1.5 million Nahuatl speakers today, though it's changed quite a bit from when the Aztecs used it 07:16
apparently Quechua is a beautifully regular natural language, almost a formal language in how few ambiguities are in its conjugations and such
skrshn I heard similar things bout Sanskrit 07:17
TimToady I'm sure it pays for that elsewhere :)
TEttinger except sanskrit is hard as all hell to write in the actual devanagari script on a computer
they may be getting to "moderately acceptable" now 07:18
it needs serious font support
I mean the script is absolutely beautiful, especially when hand-written 07:19
samcv wow Kate actually has sane ability to to right to left text. Like in Libreoffice, pressing right on the arrow key would move left
TEttinger nice.
07:19 firstdayonthejob joined
samcv yeah and it didn't realize the arabic parenthesis were RTL text. but at least chrome and kate know that and put it the proper way 07:20
TEttinger hebrew, arabic, not too many other scripts use RTL
samcv yeah
m: say q﴿ليمان، إتفاقية بين ما, يذكر الحدود أي بعد, معاملة بولندا، الإطلاق عل إيو﴾
camelia rakudo-moar 345f6a: OUTPUT«5===SORRY!5=== Error while compiling <tmp>␤Use of a closing delimiter for an opener is reserved␤at <tmp>:1␤------> 3say q7⏏5﴿ليمان، إتفاقية بين ما, يذكر الحدود أي ب␤»
samcv and this should actually work when I make a PR for nqp with the changes
TEttinger u: ﴾ 07:21
unicodable6 TEttinger, U+FD3E ORNATE LEFT PARENTHESIS [Pe] (﴾)
TEttinger Pe is ending 07:22
skrshn My reasons for going with Perl6 as the first programming language is that it lets the kids think at a higher plain most of the time 07:23
07:24 Actualeyes left
samcv it's a left parenthesis but left != opening as i figured out today 07:24
TEttinger m: say q﴾ل#﴿يمان، إتفاقية بين ما, يذكر الحدود أي بعد, معاملة بولندا، الإطلاق عل إيو 07:25
camelia rakudo-moar 345f6a: OUTPUT«5===SORRY!5=== Error while compiling <tmp>␤Two terms in a row␤at <tmp>:1␤------> 3say q﴾ل#﴿7⏏5يمان، إتفاقية بين ما, يذكر الحدود أي بعد␤ expecting any of:␤ infix␤ infix stopper␤ …»
samcv only figured it out because i decided to go through every unicode Ps/Pe and Pi/Pf and test if they worked in rakudo.
TEttinger it doesn't work in WPF in this IRC client
I can't delete the last char without messing up everything
samcv TEttinger, what i did is get the string, then slurp it and then add the text i wanted hah 07:26
or uh
TEttinger, cry.nu/arabic.txt
type: say q<then paste the string>
that will do it
but yeah i slurped the string i knew was correct, then I added 'say q' in there, and then EVAL'd it just to make 100% sure 07:27
it's annoying when text editors don't display things properly
TEttinger uh hang on, "knew was correct" 07:28
is that the shahaddah?
samcv i'm not sure what it says
maybe nothing
TEttinger ok
samcv oh no it does say something 07:29
TEttinger that's a really friggin bad idea to post that in a logged channel
samcv )laman, An agreement between what, little border after, the treatment of Poland, all Al Aao(
also interestingly typing right to left, a ) will print a (
because it reverses ones that are not RTL specified ones 07:30
﴿ليمان، إتفاقية بين ما, يذكر الحدود أي بعد, معاملة بولندا، الإطلاق عل إيو﴾
does that show up correct?
TEttinger the shahada is a statement that, by some interpretations of Islam, means you are converting to Islam by saying it. reasonable interpretations require you to actually mean it. there are always non-reasonable interpretations of religions. 07:31
07:31 firstdayonthejob left
TEttinger it does seem to show up right 07:32
but you have left on right
samcv yeah. if you only type RTL characters it correctly uses those parenthesis as RTL
but if you add any other text they often get confused on something
putting them on opposite sites of where they actually are 07:33
moritz RabidGravy: re 12th advent spot, I don't really want it. But if it's a burden to you, I can try to write up something
samcv well they seem to work fine if you type RTL and then after it type LTR text 07:34
but if you type LTR text then type LTR text then it messed up
﴿ليمان، إتفاقية بين ما, يذكر الحدود أي بعد, معاملة بولندا، الإطلاق عل إيو﴾ say q
in some alternate reality this maybe would work idk hahaha
but the say q actually comes after the LTR text 07:35
(if that shows up correctly, it does for me)
m: ﴿ليمان، إتفاقية بين ما, يذكر الحدود أي بعد, معاملة بولندا، الإطلاق عل إيو﴾ say q
camelia rakudo-moar 345f6a: OUTPUT«5===SORRY!5=== Error while compiling <tmp>␤Bogus statement␤at <tmp>:1␤------> 3<BOL>7⏏5﴿ليمان، إتفاقية بين ما, يذكر الحدود أي ب␤ expecting any of:␤ prefix␤ term␤»
samcv this is what it looks like if i add any LTR chars before it 07:36
TEttinger m: say q﴾ليمان، إتفاقية بين ما, يذكر الحدود أي بعد, معاملة بولندا، الإطلاق عل إيو﴿
camelia rakudo-moar 345f6a: OUTPUT«ليمان، إتفاقية بين ما, يذكر الحدود أي بعد, معاملة بولندا، الإطلاق عل إيو␤»
TEttinger you have the parens wrong I think 07:37
left doesn't mean opening here, it means left, so in RTL that's the end
samcv hmm maybe i do?
TEttinger left is Pe, right is Ps
samcv yea i understand that
TEttinger u: ﴾﴿ 07:38
unicodable6 TEttinger, U+FD3E ORNATE LEFT PARENTHESIS [Pe] (﴾)
TEttinger, U+FD3F ORNATE RIGHT PARENTHESIS [Ps] (﴿)
TEttinger the weird bit is that once you hit that block of LTR text, it goes q, then visually to the end of the line at the ornate right parenthesis, then goes right to left 07:39
samcv well TEttinger you just typed the closing one before the ending one
TEttinger right to left?
I may have entered it wrong
samcv i mean it showed up fine
TEttinger here it displayed with the right paren on the right
samcv but you typed the closing one before the ending one 07:40
TEttinger and the left at left
samcv but maybe that's what we want?
ugh you made me more confused
TEttinger closing is left
samcv yes i know
you typed the closing one before the opening one
regardless of what they look like.
TEttinger in this line?
m: say q﴾ليمان، إتفاقية بين ما, يذكر الحدود أي بعد, معاملة بولندا، الإطلاق عل إيو﴿ 07:41
camelia rakudo-moar 345f6a: OUTPUT«ليمان، إتفاقية بين ما, يذكر الحدود أي بعد, معاملة بولندا، الإطلاق عل إيو␤»
samcv yes
TEttinger well, no
it's in a RTL block
samcv well. the closing comes before the ending. so
maybe that is what we want
TEttinger wat
samcv otherwise it wouldn't work
moritz brrt++ # advent post
TEttinger ok I am going to attempt to write some perl 6 here, despite not knowing a lick of it 07:42
07:42 Actualeyes joined
samcv m: say Q/﴿ليمان، إتفاقية بين ما, يذكر الحدود أي بعد, معاملة بولندا، الإطلاق عل إيو﴾/.comb 07:42
camelia rakudo-moar 345f6a: OUTPUT«(﴿ ل ي م ا ن ، إ ت ف ا ق ي ة ب ي ن م ا , ي ذ ك ر ا ل ح د و د أ ي ب ع د , م ع ا م ل ة ب و ل ن د ا ، ا ل إ ط ل ا ق ع ل إ ي و ﴾)␤»
samcv ok so with that, it looks like ) on the left and ( on the right. but reading the bytes down the file, the closing one comes first 07:43
that's what i'm trying to get at
so what i was saying is maybe that is what we want, for RTL text that would be fine.
i should add a comment to the source file maybe. since every other bracket conforms to the unicode open first close last 07:44
TEttinger m: say q﴾لو﴿.comb
camelia rakudo-moar 345f6a: OUTPUT«(ل و)␤»
TEttinger samcv: can you find some usage examples of ornate parentheses in arabic text? I think we may be looking at this wrong 07:45
samcv yeah
i mean... it works fine if it's only RTL text
but as soon as you add ascii text then it reverses the paren locations so 07:46
07:47 andrzeju_ left, mawkish left
TEttinger yeah you had them backwards 07:47
software.sil.org/scheherazade/wp-co...eGen11.png
first line
samcv books.google.com/books?id=wn5sXG8b...mp;f=false 07:48
maybe this will be helpful
TEttinger you saw the image link right? 07:49
is that how the error-causing lines rendered on your end?
the lines that evaluated without error that I sent looked like that image
(on my side, using unifont which is pretty bad at this to be fair) 07:50
moritz brrt: I've fixed some small issues (capitalization of programming language names, a small typo) in your post; hope you're OK with the changes 07:51
brrt sure, np, thanks :-) 07:54
samcv TEttinger, well also confusing is that normal ( ) reverse in RTL text but the ornate ones are not supposed to 07:55
so i am not sure if they are reversing when they shouldn't or not
or if it's placing them on the wrong side
when you combine LTR + RTR
TEttinger oh ok
samcv yeah
brrt sksrhn: BASIC with goto statement, yes, because that drives home the point that computers are procedural really, really well 07:56
TEttinger well for me they're somehow ... I'm not sure of the parens are fully considered RTL
brrt any attempt to ignore that fact is likely to confuse
samcv they are supposed to not flip
TEttinger m: say q﴾abc﴿.comb 07:57
camelia rakudo-moar 345f6a: OUTPUT«(a b c)␤»
brrt and as for python... the weakness of python from a learners perspective is that their is a *lot* of magic under the hood
samcv m: say say q{﴿}.uniname
camelia rakudo-moar 345f6a: OUTPUT«ORNATE RIGHT PARENTHESIS␤True␤»
brrt magic isn't good for learning; learning to program is all about how computers are *not* magical, imho
TEttinger m: say q﴾لو﴿.comb
camelia rakudo-moar 345f6a: OUTPUT«(ل و)␤»
TEttinger ah, weird, that doesn't print the insides in RTL order 07:58
brrt and as for fun... I'm not sure if you can entertain kids with logo anymore, these days
I certainly enjoyed it, but I didn't have a smartphone, so there is that
samcv TEttinger, www.branah.com/arabic 07:59
paste the string at cry.nu/arabic.txt in there
08:02 pierre__ left
samcv cry.nu/arabic2.txt 08:02
ok both these text files the parenthesis are reversed inside the string
TEttinger hm, well it's doing some weird mapping to my ornate parentheses and turning them into ascii parens 08:03
also, try clicking shift on their soft keyboad
samcv well they often render the same
TEttinger shift 9 is ), shift 0 is ) , which is opposite of a QWERTY US keyboard
08:03 mawkish joined
TEttinger err 08:03
shift 0 is (
samcv well those are just normal parenthesis 08:04
they're just reversed because they are in RTL text
TEttinger uh
samcv yeah
TEttinger it wouldn't do that no
on the keys themselves 08:05
samcv yes it would
﴿ليمان، إتفاقية بين ما, يذكر الحدود أي بعد, معاملة بولندا، الإطلاق عل إ(((((((((
all those parens are left parens^ left normal ones
TEttinger which are one char, ( would be rendered at position 0, it wouldn't change the ASCII value of ( to the value of )
samcv i just typed now
uhm. the ascii value is a left paren but shows as right paren
because RTL text 08:06
08:06 andrzejku joined
TEttinger where does that happen? is it specified in unicode? 08:06
samcv yeah
08:07 domidumont left
TEttinger I'm guessing it's swapping a Ps for a Pe, except there's no way to do that universally since there are more of one than the other IIRC 08:07
samcv no it doesn't swap
it just flips it
08:07 pierre__ joined, domidumont joined
TEttinger ...this sounds sketchy 08:08
samcv well
paste in cry.nu/arabic3.txt into anything and type left ( or right )
it will display differently
TEttinger no no
can you find documentation on how unicode specifies this, as opposed to their site's keyboard's specification? 08:09
(which could be wrong in any number of ways)
samcv m: say Q/ليما)))، إتفاقية بين ما, يذكر الحدود أي بعد, معاملة بولندا، الإطلاق عل إيو/.comb
camelia rakudo-moar 345f6a: OUTPUT«(ل ي م ا ) ) ) ، إ ت ف ا ق ي ة ب ي ن م ا , ي ذ ك ر ا ل ح د و د أ ي ب ع د , م ع ا م ل ة ب و ل ن د ا ، ا ل إ ط ل ا ق ع ل إ ي و)␤»
samcv hmm or maybe i'm wrong hm
this is very confusing 08:10
TEttinger it is.
I think the main thing to remember is left is always left
and right is always right
but you don't always start at one or the other
samcv well 08:11
ornate ﴾ right parenthesis goes on the left side of the page
TEttinger that's the left paren
samcv u: ﴾
unicodable6 samcv, U+FD3E ORNATE LEFT PARENTHESIS [Pe] (﴾)
08:12 pierre__ left
samcv err. 08:12
ok you're right
TEttinger :)
I'm... left
samcv it goes at the end
of the text. not of the file... so confusing
TEttinger yep
samcv well at least we figured it out 08:13
TEttinger I18N is a brainslayer
samcv i'll make sure to comment on that one in the file that stores all the parens that these two are the only non matching ones
i mean. as far as things are concerned
so yeah, ( ) normal parens go at the start and end of the text 08:14
but are reversed graphically. so that Pe Ps are both retained 08:15
well.
not really
i mean they're reversed. uh
visually they appear to be the same as their coorasponding Pe/Ps symbol
TEttinger I think that depends on how the RTL part starts and ends
and that I am very unclear on
if you're in an RTL area of code, which may or may not end as soon as you type a LTR char (not sure at all), then you have your Ps starters at the right and Pe enders at the left 08:16
but if the RTL stuff is limited to arabic or hebrew or other RTL script!
then '(' is LTR, the RTL goes inside that (after), and I think the ')' goes back to LTR and goes after the display of the RTL text I think 08:17
which also explains why .comb is showing things in LTR order 08:18
it has spaces interposed
each RTL char only is drawn for one char, so the ordering is irrelevant inside that one char, before it goes back to LTR
(where space is LTR) 08:19
08:20 pierre__ joined
samcv cry.nu/arabic.p6 if you want to play around with it 08:22
i constructed this file using perl 6, well reading that string from the file, then adding perl 6 code around it
so i know it is correct :P since I don't trust how things present things to me anymore
but printing out a normal left paren + that string + right paren 08:25
shows correct
well. i mean it shows a left paren on the left right paren on the right 08:26
u: )
unicodable6 samcv, U+0029 RIGHT PARENTHESIS [Pe] ())
samcv and to confuse matters more: cry.nu/test.txt TEttinger 08:29
those are inserted exactly the same
TEttinger oh jeez 08:30
the fonts I use in the browser render those really badly
08:30 ufobat joined
TEttinger notably, they use different parens, but none are ornate 08:30
(?????? ??????? ??? ??, ???? ?????? ?? ???, ?????? ??????? ??????? ?? ???) 08:31
oops sorry
08:31 bjz joined
samcv err actually my text there is incorrect 08:33
normal left normal right, and ornate left ornate right
though they look the same direction the end/start in unicode is different and both are displayed like that. the biggest question is... what should they correctly be. lol 08:34
08:34 wamba left
samcv In the next phase, neutral and isolate formatting (i.e. NI) characters are resolved one isolating run sequence at a time. Its results are that all NIs become either R or L. Generally, NIs take on the direction of the surrounding text. In case of a conflict, they take on the embedding direction. At isolating run sequence boundaries where the type of the character on the other side of the boundary is required, the type assigned to sos or eos is used. 08:34
TEttinger head asplode 08:35
08:35 bjz left
samcv yeah basically 08:36
m: say "(ليمان، إتفاقية بين ما, يذكر الحدود أي بعد, معاملة بولندا، الإطلاق عل إيو)".ord 08:37
camelia rakudo-moar 345f6a: OUTPUT«40␤»
samcv u: '('.ord.say
unicodable6 samcv, U+0027 APOSTROPHE [Po] (')
samcv, U+0028 LEFT PARENTHESIS [Ps] (()
samcv, U+0027 APOSTROPHE [Po] (')
samcv, gist.github.com/2fa2cc1ea4b9ce54c2...b9aa7281d4
samcv errr oops
m: '('.ord.say
camelia rakudo-moar 345f6a: OUTPUT«40␤»
08:38 pecastro left 08:43 rurban left 08:46 zakharyas joined
dalek osystem: 5a7e479 | (Sam Gillespie)++ | META.list:
Adding Algorithm::Genetic to ecosystem
08:50
08:51 cibs left 08:52 cibs joined 08:57 powerjuce joined
powerjuce Hi all, quick question about this code: my @lines = 'huge-csv'.IO.lines; 08:58
It is in the section: Line by line
If I use that code and then later run a for loop like this: for @lines -> $line { $line.say } will that still lazy load the file line by line? 08:59
(i.e. create a generator)
Or will it slurp the whole file in
09:03 xtreak left
seatek i'd think it would read the whole thing into @lines eventually, if you kept reading line by line. i don't believe it discards what is already read into @lines 09:04
09:04 rindolf joined
powerjuce seatek: I guess I mean more, does it slurp the full line in when I do @lines = 'huge-csv'.IO.lines? 09:07
full file**
09:08 pierre__ left 09:09 pierre__ joined 09:12 mawkish left 09:13 skrshn left 09:14 pierre__ left
seatek powerjuce: i honestly don't know if it would if you used an array. you could try it out. but if you're worried you can just keep it as a scalar 09:15
powerjuce cool will do
thanks!
09:19 powerjuce left 09:23 wamba joined, xinming_ joined 09:26 xinming left 09:27 cdg_ left
seatek an HOUR lost because of an overlooked semicolon in a long arg list. i don't deserve to live. 09:29
ah but such relief now. second-guessing that. 09:30
09:31 Xliff left
seatek oo! candy canes. never mind. :) 09:32
09:33 xtreak joined
babydrop m: my @lines = 1…∞; say @lines[^10] 09:37
camelia rakudo-moar 345f6a: OUTPUT«(1 2 3 4 5 6 7 8 9 10)␤»
09:38 aaa_ joined, aaa_ is now known as Guest17583 09:40 xtreak left
seatek he left! but i didn't even think of it being just like that ;) 09:40
babydrop TimToady++ # set explanations 09:41
jnthn say "README.md".IO.lines.is-lazy
False
babydrop At least now I'm not losing my marbles
09:41 xinming_ left
jnthn So, it's not marked as lazy, meaning that an assignment into an array will proceed eagerly 09:42
babydrop jnthn: so it'll put all of it into the array?
jnthn Correct
babydrop Ah, cool
Totally forgot about is-lazy
jnthn my @a = lazy 'foo'.IO.lines; # one way to force laziness
If you put it in a Scalar you're storing the Seq
Which means you can then build a pipeline off it.
That will only do work when needed, and pull them one at a time
But a Scalar will be a pain in that for $a { } doesn't iterate over $a 09:43
So normally when doing pipeline construction of lazy things, sigilless vars are the way to go
moritz if you do my @a := foo.IO.lines.list that should preserve laziness too, right? 09:44
at the cost of keeping old elements
09:44 xinming joined
seatek i knew it couldn't be that cut and dried. ;) 09:45
jnthn moritz: This is true, but most people doing file I/O, when saying "I want laziness", normally mean they don't want to keep the stuff around in memory. :-)
my @a = lazy ... ; is thus vulnerable to the same thing 09:46
seatek keeps filling
09:47 xtreak joined
jnthn Yup. The lines are read in one at a time, but hang around 09:49
09:49 xinming left
jnthn Which is sometimes what you want 09:49
09:49 xinming joined
babydrop Man, I thought DBIish #77 was a pretty obvious quick-fix. Apparently we need reams of discussion and blaming the user for destroying their system by doing such a stupid action as installing a Perl 6 module. 09:49
babydrop clicks "Unsubscribe" button while eyerolling 09:50
seatek yeah i would rather it was an option to run tests against other stuff on your network. 09:54
personally, i use a NET_TESTS environment variable and no tests that rely on network will run without seeing it. 09:58
(includes sockets) 10:00
babydrop uses Test::When
well... I would if I were writing any Perl 6 code....
seatek that makes me crazy to think about 10:02
10:04 bjz joined
babydrop which part? :) 10:04
seatek you not writing perl 6 code 10:05
Ulti m: getc
camelia rakudo-moar 345f6a: OUTPUT«read string requires an object with REPR MVMOSHandle␤ in block <unit> at <tmp> line 1␤␤»
babydrop I got nothing to make. Not writing other code either.
Ulti ^ bit of a weird error
babydrop Well, other than rakudo. But I mean code that makes stuff, not code to make code. 10:06
s: &getc
SourceBaby babydrop, Sauce is at github.com/rakudo/rakudo/blob/345f...rs.pm#L130
seatek but how do you know what you need unless you use it?
you could be making all kinds of things that are just insance 10:07
insane
babydrop seatek: I don't need to. Plenty of bugs to fix: perl6.fail
s: $*ARGFILES, 'getc', \()
SourceBaby babydrop, Sauce is at github.com/rakudo/rakudo/blob/345f...le.pm#L150
seatek wow ok. so constrained by the structure that already exists at least ;) 10:08
jnthn For quite a few years most of the Perl 6 code I wrote was implementing Rakudo built-ins and Rakudo itself. :-)
10:09 csquared joined
babydrop Ulti: seems that needs to be added as a method in github.com/rakudo/rakudo/blob/nom/...rgFiles.pm 10:09
jnthn During the last month or so, that's actually in the minority, which has been nice.
seatek it's so weird to think about. becuase in a way you've already written every program i'm writing 10:10
10:10 sena_kun joined
babydrop Ulti: 'cause it ends up going into IO::Handle's method that just reads from $!PIO but I see other methods in Argfiles have magicks to get proper handle: github.com/rakudo/rakudo/blob/nom/...pm#L62-L63 10:11
10:20 pierre__ joined 10:22 captain-adequate left 10:23 csquared left 10:25 xtreak left 10:29 pierre__ left 10:35 captain-adequate joined
jnthn just discovered Test::Mock wouldn't let you make mocks of classes that happened to have required attributes, and fixed it :) 10:38
babydrop \o/
jnthn (By trying to write a test for such a class and discovering it didn't work... :)) 10:39
Yay, now my tests...fail, in the right way :)
10:49 labster left 10:51 pyrimidine left 10:52 cyphase_eviltwin joined
babydrop brrt++ good article :) 10:54
10:54 xtreak joined 10:55 bjz left, japhb joined 10:57 Guest17583 left 10:59 bjz joined 11:00 gregf_ joined 11:01 kurahaupo__ joined 11:05 cyphase_eviltwin is now known as cyphase 11:11 kurahaupo__ left 11:12 kurahaupo__ joined 11:15 pmurias joined
pmurias update on rakudo.js: blogs.perl.org/users/pawel_murias/2...ate-1.html 11:16
11:16 TEttinger left 11:18 ufobat left, brillenfux_ joined 11:19 kurahaupo__ left, brillenfux__ joined 11:20 japhb left 11:21 brillenfux left, japhb joined 11:23 brillenfux_ left, brillenfux_ joined 11:26 brillenfux__ left 11:27 brillenfux_ left 11:30 pmurias left 11:31 ufobat joined
moritz pmurias++ 11:32
11:34 pmurias joined 11:37 rurban joined 11:41 rurban left, perlawhirl joined, xtreak left
babydrop "rakudo.js finally compiled the full setting" 11:41
pmurias++
11:48 AlexDaniel joined 11:52 tbrowder joined, kurahaupo__ joined
babydrop AlexDaniel: I'm regretting ever awesomifying X::Syntax::Number::InvalidCharacter 11:53
AlexDaniel what happened now? :)
m: grammar G { proto token foo($bar?) { * } }; grammar G2 is G { token TOP { <foo(42)> }; token foo:sym<bleh>($bar?) { {say ‘BAR: ’, $bar} <?> } }; say G2.parse(‘z’)
camelia rakudo-moar 8e3cbc: OUTPUT«BAR: (Any)␤Nil␤»
AlexDaniel why is it Any?
m: grammar G { proto token foo($bar) { * } }; grammar G2 is G { token TOP { <foo(42)> }; token foo:sym<bleh>($bar) { {say ‘BAR: ’, $bar} <?> } }; say G2.parse(‘z’)
camelia rakudo-moar 8e3cbc: OUTPUT«Too few positionals passed; expected 2 arguments but got 1␤ in regex foo:sym<bleh> at <tmp> line 1␤ in regex foo at <tmp> line 1␤ in regex TOP at <tmp> line 1␤ in block <unit> at <tmp> line 1␤␤»
AlexDaniel or in other words, why the argument is not passed? 11:54
babydrop AlexDaniel: Most of the code in .parse-base is error handling, and the bug about "1___x" reporting is still there. The error stuff already had at least 3 tickets.
It's just not worth it.
When "Could not parse that number" is sufficient in most cases.
moritz we should go the python route and simply say "syntax error"
jnthn AlexDaniel: protoregexes simply don't do that 11:55
babydrop m: :10<1.x> 11:56
camelia rakudo-moar 8e3cbc: OUTPUT«5===SORRY!5=== Error while compiling <tmp>␤Invalid base-10 character 'x': 031.7⏏5x. Please use one of 0..9␤at <tmp>:1␤------> 3:10<1.x>7⏏5<EOL>␤»
jnthn AlexDaniel: It may be possible to make it happen; feel free to file a feature request
AlexDaniel jnthn: hmmm, so are you saying that there is no way to pass an argument in this case?
jnthn AlexDaniel: But the easy solution is to store it in a dynamic in the signature of the proto and access it that way
AlexDaniel yea… I guess
jnthn: wait, how would that look like? 11:58
proto regex cannot have a body, right?
babydrop committable6: 2016.04 :10<1.x>
committable6 babydrop, ¦«2016.04»: ===SORRY!=== Error while compiling /tmp/ErYfwSI6HC␤Couldn't process entire number: 1/1 int chars, -1/1 fractional chars␤at /tmp/ErYfwSI6HC:1␤------> :10<1.x><HERE><EOL> «exit code = 1»
babydrop oh, right. Now I remember why we added a better error there :}
AlexDaniel babydrop: I think that ↑ was worse than what we have now
m: grammar G { has $.hack; proto token foo($!hack) { * } }; grammar G2 is G { token TOP { <foo(42)> }; token foo:sym<bleh> { {say ‘BAR: ’, $.hack} <?> } }; say G2.parse(‘z’) 12:02
camelia rakudo-moar 8e3cbc: OUTPUT«BAR: 42␤Nil␤»
AlexDaniel alright… that works, I guess?
babydrop: don't worry, we will remove all error handling after robot uprising 12:03
babydrop m: grammar G { proto token foo($*not-hack) { * } }; grammar G2 is G { token TOP { <foo(42)> }; token foo:sym<bleh> { {say ‘BAR: ’, $*not-hack} <?> } }; say G2.parse(‘z’)
camelia rakudo-moar 8e3cbc: OUTPUT«BAR: 42␤Nil␤»
babydrop AlexDaniel: can't wait!
AlexDaniel ohhh… alright 12:04
kinda LTA but good enough, thanks!
jnthn ended up giving Test::Mock a way to do more interesting things (like throwing exceptions) when stubbing methods also. :) 12:11
12:12 lichtkind joined
jnthn lunch & 12:12
FROGGS pmurias++ 12:13
arnsholt Ooooh, fresh 6guts-post 12:18
timotimo samcv: did anybody tell you to use [(+)] for your array of Mixes? 12:20
pmurias babydrop: complex offset calculations don't work without proper tests ;) 12:21
babydrop: I'll get round to fixing X::Syntax::Number::InvalidCharacter soon 12:22
12:31 bjz_ joined
babydrop pmurias, ohhhh 12:31
pmurias, it didn't hit me yesterday what InvalidCharacter you meant 12:32
pmurias babydrop: are you fixing it up too?
babydrop pmurias, well, yeah, I fixed it this morning. Only the 1____x ticket remains, which I'll do after work 12:33
12:33 bjz left, wamba left
babydrop I figured I'd fix my own mess... 12:35
pmurias babydrop: ok, I'm working on the test
12:36 lucasb joined
babydrop it's tested as part of S32-str/parse-base.t 12:37
which I plan to improve too, after work: half it and use a loop to test the method/sub forms 12:38
jesus.... you know you're half asleep when you realize your belt is unbuckled and zipped on the pants isn't closed..... and you're on your second bus stop, halfway to work :o 12:41
lucasb christ... get yourself together 12:42
babydrop :)
pmurias, but if you have bright ideas on fixing the 1__x bug feel free. I can't think of solutions I like 12:45
m: 1____x
camelia rakudo-moar c4a601: OUTPUT«5===SORRY!5=== Error while compiling <tmp>␤Confused␤at <tmp>:1␤------> 0317⏏5____x␤ expecting any of:␤ whitespace␤»
babydrop m: 1____
camelia rakudo-moar c4a601: OUTPUT«5===SORRY!5=== Error while compiling <tmp>␤Confused␤at <tmp>:1␤------> 0317⏏5____␤ expecting any of:␤ whitespace␤»
babydrop cause trailing _ aren't meant to be valid
timotimo x__X 12:46
babydrop and you need to check for that case along with adjusting ofsets if they're not trailing.
a PITA
which is why I said I regret that exception
12:48 pyrimidine joined
babydrop maybe dialing it down a bit to "could not parse base-blah number. Only blah blah chars are valid" is a more valid solution to this 12:49
12:52 canopus left
AlexDaniel babydrop: but that's LTA :PP 12:52
12:53 pyrimidine left, japhb left
babydrop pmurias, ^ what are your thoughts. I'm feeling good about doing that when I get home, but you said you want to write tests..... 12:54
12:55 perlawhirl left, japhb joined 12:57 eliasr joined 12:59 canopus joined 13:01 isacloud joined
babydrop AlexDaniel, not really. It's not hard to spot an offcolour digit when told which ones are valid. When the code for the tiny extra hint makes a 5-line method 75-lines long you're no longer "torturing the developer on behalf of the user" you're making your codebase dense and a bug-prone to stratch some abstract itch hiding behind a vague acronym 13:01
"12345XFA".parse-base: 16; -> "Invalid character in base-16 number. Only 0..9, A..F, optionally preceeded by a sign and separated by underscores are valid" 13:04
m: 'f.f.f.f'.parse-base: 16 13:06
camelia rakudo-moar c4a601: OUTPUT«Invalid base-16 character '.': 3f.f7⏏5.f.f. Please use one of 0..9, A..F␤ in block <unit> at <tmp> line 1␤␤Actually thrown at:␤ in block <unit> at <tmp> line 1␤␤»
babydrop Boom. Another bug in that error reporting ^
Yeah, it's trying to do too much. 13:07
babydrop will gut it
lucasb I didn't fully backlog; What was said about doing something with rakudo.org website? 13:16
13:16 parisba left, parisba joined
lucasb I was wondering, what's the point about maintaing both rakudo.org and perl6.org? (they are on the same webserver, right?) Maybe back in the past, rakudo was just another attempt, but now it is THE implementation. you even need a TPF CLA to commit to it. So, why not merge the contents/objectives of both sites into just one? 13:18
tbrowder .tell gfldex yr module Typesafe::XHTML::Writer is failing tests with latest rakudo nom branch, i haven't figured out how to fix it
yoleaux 03:19Z <[Coke]> tbrowder: I will do the review over coffee in the morning!
lucasb maybe drop the wordpress thing from rakudo.org and go with static pages? keep a simple front page pointing to perl6.org
babydrop lucasb: no, they're on different servers. It's not THE implementation, it's just the most complete implementation. Perl6.org is the website for the language, while rakudo.org is the website for a compiler 13:19
lizmat babydrop: agree
yoleaux 7 Dec 2016 23:44Z <babydrop> lizmat: would you be able to test whether 2**10000000000 throws on OSX on HEAD rakudo? pmurias++ fixed RT#125938 we just need someone with OSX to verify the fix works.
synopsebot6 Link: rt.perl.org/rt3//Public/Bug/Displa...?id=125938
yoleaux 8 Dec 2016 15:29Z <babydrop> lizmat: disregard RE 125938. someone else helpfully tested that.
timotimo yes, rakudo.org lives on pmichaud's private server
while perl6.org lives on the p6c server
babydrop I don't see anything said about rakudo.org in recent backlog
lucasb ok, then, I accept
babydrop lizmat: about the .parse-base error? 13:20
13:20 japhb left
lizmat babydrop: no, about the difference between perl6.org and rakudo.org :-) 13:20
babydrop oh heh :)
13:22 japhb joined
lucasb oh, sorry, has been a while since I visited those sites. they have been updated :) 13:22
tbrowder fwiw, i think doing our own thing with advent blog would be a good thing (static is okay). without babydrop's code, using wordpress for a blog would be too much pain for me. with our own process we could use p6 pod, too!
lucasb and, as was said, yeah, Rakudo Star is monthly. so it is the recommended way for a newcommer to use, right?
babydrop lucasb: right 13:23
tbrowder: well volunteered? 13:24
I think dealing with the domain name and transfering old posts is the hard part in that endeavour. Unless we just have two advent places? vOv 13:25
moritz if we run in www.p6c.org, we could use a perl6.org subdomain 13:26
advent.perl6.org
lucasb no need to port the post. keep it there, as a historical archive. next year, we do like the Perl 5 folks, have a static site
timotimo tbrowder: i wouldn't want to give up the stats that wordpress gives us
tbrowder mebbe, could just ref old stuff on new site?
babydrop is reminded of xkcd.com/1319/ 13:27
moritz timotimo: google analytics would work on a static site too
timotimo good point
moritz the real problem is finding somebody who creates the site in the first place, and maintains it for a few years 13:28
timotimo yes.
13:28 pyrimidine joined, rindolf left 13:29 mrsolo left
babydrop is happy with his script method 13:29
13:29 mrsolo joined
babydrop Could use improvement so you wouldn't have to deal with GitHub Gists but that's minor for something done 24 times a year 13:30
timotimo that's twice per month!
babydrop Or 1/15th time each day! :o 13:32
timotimo %)
moritz writes only 1..3 advent posts per year
13:33 pyrimidine left 13:35 AlexDaniel left, AlexDaniel joined
dogbert17 o/ 13:37
lucasb perl6.github.io/blog or advent <-- use github pages as a place to host markdown pages? :) 13:39
dogbert17 does this error msg look familiar to anyone: Unhandled exception in code scheduled on thread 6
No such method 'consume-all-chars' for invocant of type 'Any'
in method throw at ./CORE.setting.moarvm line 1
in any at ./CORE.setting.moarvm line 1
happened when I ran perl6-valgrind-m on t/spec/S17-procasync/no-runaway-file-limit.t 13:40
lizmat dogbert17: feels like the type of error you get with HARNESS_TYPE=6
and running "make spectest"
dogbert17 hmm, output of make spectest is: /usr/bin/perl t/harness5 --fudge --moar --keep-exit-code --tests-from-file=t/spectest.data 13:42
s/is/was/
lucasb ok, next idea is about the faqs. last edit in the faq repo was in Oct 17, 2015. what's your opinion of merging them with the doc repo, inside a subdirectory? 13:44
perl5 separates the core docs from the faqs. I think they thought the faqs was going to be edited much more frequently than the docs. but with P6, it's the other way around, the docs are updated, and the faqs never touched.
pmurias babydrop: gutting it seems sane
babydrop OK. Will do it after work.
lucasb: IIRC FAQ was already merged into doc 13:45
13:45 jnap_ joined
babydrop lucasb: I think it's now this page github.com/perl6/doc/blob/master/d...e/faq.pod6 13:45
And the old repo is just historical remains
lucasb lol, you are right, sorry, I just saw the repo name and remembered about it, didn't check its content this time. 13:47
13:47 mp joined
babydrop no problem 13:47
dogbert17 m: say 1 + (3, 5...1001).map(-> $i { ($i*$i, {$_-($i-1)}...*)[^4]}).flat.sum # port attempt of lucasb's nifty solution to Project Euler problem 28
camelia rakudo-moar c4a601: OUTPUT«669171001␤»
lucasb (I was browsing the list of repos at github.com/perl6)
13:48 AlexDaniel left, mp left, bjz_ left
dogbert17 lizmat: does running './perl6 /spec/S17-procasync/no-runaway-file-limit.t' imply HARNESS_TYPE=6 ? 13:49
lucasb wow, nice dogbert17++
lizmat dogbert17: no
13:49 perlawhirl joined
babydrop dogbert17: no 13:49
dogbert17 lizmat babydrop, running it like that gives the strange error on my 32 bit system 13:50
the one I posted above
lizmat I get that 13:51
it's just the type of message: complaining about a method not existing on code that clearly managed to find the object's methods before
but: fwiw, it looks like HARNESS_TYPE=6 is now clean 13:52
at least on my 64bit MacOS
dogbert17 cool, how do you like the new machine?
babydrop dogbert17: that error reminds me of this commit from yesterday: github.com/rakudo/rakudo/commit/58...0f449f8a9e
lizmat dogbert17: it's nice, :-) 👍 13:53
the 👍 I touched on the touchbar :-)
babydrop dogbert17: and here's what the comment on that `with` used to say: github.com/rakudo/rakudo/commit/75...c3317eae2c
dogbert17: so maybe the bug that required that `with` isn't fully fixed or you're not running on latest moarvm?
dogbert17 babydrop: This is Rakudo version 2016.11-167-gdb9ae22b0 built on MoarVM version 2016.11-41-gd2139b52 13:54
lizmat: so you have warmed up to the touchbar then :-) 13:55
lizmat yup...
biggest thing I had to get used to is that I can no longer have a finger "resting" on the ESC key 13:56
dogbert17 are you an emacs person?
lizmat nope, vim
all the way back to using Wordstar on an Osborne-1 :-)
babydrop dogbert17: that should have the fix in it, so perhaps that bug isn't fully fixed then 13:57
dogbert17 babydrop: I'll try without that fix
babydrop Sounds like a plan
dogbert17 babydrop: do you happen to be close to you 32 bit dev machine by any chance?
13:58 girafe joined
dogbert17 oh, Wordstar, Osborne-1, sounds a bit like early/mid eighties 13:59
babydrop dogbert17: yeah, why?
pmurias m: ".123".parse-base(10)
camelia rakudo-moar c4a601: OUTPUT«Invalid base-10 character '.': 7⏏5.123. Please use one of 0..9␤ in block <unit> at <tmp> line 1␤␤Actually thrown at:␤ in block <unit> at <tmp> line 1␤␤»
babydrop pmurias: and that case I was planning on just making work
dogbert17 babydrop: just to check if you have the same problem
lizmat argh, no 14:00
===Unhandled exception in code scheduled on thread 9
No such method 'made' for invocant of type 'TAP::Runner::State'
in method close-data at /Users/liz/Github/rakudo.moar/lib/TAP.pm6
dogbert17 uh oh
lizmat so we still have some instability there, but it was only after the 5th run
before, only 1 in 10 would succeeed
babydrop dogbert17: how do I check? 14:01
dogbert17 babydrop: ./perl6 /spec/S17-procasync/no-runaway-file-limit.t
babydrop That test file flops on my 24-core box 14:02
dogbert17 ok, I'll try without the commit then
14:02 prammer joined
babydrop But yeah, it uses Proc::Async and that commit made the change in that code path 14:02
14:03 prammer left
dalek c: 9f2d7fe | samcv++ | doc/Language/quoting.pod6:
Document that identifiers like `'` and `-` can't be used after Q…

q, or qq
14:04
synopsebot6 Link: doc.perl6.org/language/quoting
c: fa6a04a | samcv++ | doc/Language/quoting.pod6:
Correct typo from last commit
synopsebot6 Link: doc.perl6.org/language/quoting
c: 6c2b8b8 | samcv++ | doc/Language/quoting.pod6:
Mention that Q(…) won't work either.
synopsebot6 Link: doc.perl6.org/language/quoting
c: de06d83 | samcv++ | doc/Language/quoting.pod6:
Change Q'…' example so it doesn'nt have a `'` in the text
synopsebot6 Link: doc.perl6.org/language/quoting
c: 65833a3 | samcv++ | doc/Language/quoting.pod6:
Make it more clear
synopsebot6 Link: doc.perl6.org/language/quoting
c: 269c47b | (Zoffix Znet)++ | doc/Language/quoting.pod6:
Merge pull request #1038 from samcv/signal

Document that identifiers like `'` and `-` can't be used after Q q, or qq quoting constructs
synopsebot6 Link: doc.perl6.org/language/quoting
dogbert17 babydrop: will start with 0089a5514be39c 14:05
14:06 cdg joined 14:11 pyrimidine joined 14:12 TimToady left
dalek c: f977dd5 | (Zoffix Znet)++ | doc/Language/quoting.pod6:
Add more to Q-delim-as-identifier quirk
14:13
synopsebot6 Link: doc.perl6.org/language/quoting
14:13 TimToady joined 14:16 perlawhirl left
sena_kun Hmm... There are no obvious way to "patch" some part of a regex on the fly based on previous input and I need a hand-written parser? 14:16
babydrop .tell samcv I sent you an invite to perl6 org. So you should be able to commit to docs and some other repos directly.
yoleaux babydrop: I'll pass your message to samcv.
14:16 pyrimidine left 14:17 rindolf joined
babydrop sena_kun: patch in what way? 14:17
mspo sena_kun: you mean lik a conditional part of the regex?
sena_kun mspo, something like this. My goal is to parse "Q $char any-but-not-$char $char". I doubt it is possible with usual regexes, but it's p6 after all. 14:19
babydrop m: say "foo bar" ~~ /$<bar-type>=\S+ \s+ <.before "bar"> [ <?{$<bar-type> eq "booze"}> {die "eww"} || "bar" ]/
camelia rakudo-moar c4a601: OUTPUT«「foo bar」␤ bar-type => 「foo」␤»
babydrop m: say "booze bar" ~~ /$<bar-type>=\S+ \s+ <.before "bar"> [ <?{$<bar-type> eq "booze"}> {die "eww"} || "bar" ]/ 14:20
camelia rakudo-moar c4a601: OUTPUT«eww␤ in block <unit> at <tmp> line 1␤␤»
babydrop sena_kun: that doesn't sound overly complex :)P
sena_kun babydrop, thanks for the example, I'll try to imitate it in my code. (: 14:22
babydrop nah that example is not for your thing...
It's just what I thought you meant originally :)
sena_kun Aaah.
babydrop m: say "Q |meow|" ~~ /Q \s+ $<char>=. $<stuff>=[[<!before $<char>> .]+ .] $<char>/
camelia rakudo-moar c4a601: OUTPUT«「Q |meow|」␤ char => 「|」␤ stuff => 「meow」␤»
14:23 PotatoGim left
babydrop Something like that. There's probably a much simpler way to write that 14:23
14:23 PotatoGim joined, cygx joined
cygx first draft: perl6advent.wordpress.com/?p=5746&...eview=true 14:23
babydrop hm, actually that version fails when stuff is one or no chars 14:26
sena_kun m: say "Q_meow_" ~~ /'Q' $<char>=. $<stuff>=[<!before $<char>> .]+ $<char>/; 14:27
camelia rakudo-moar c4a601: OUTPUT«「Q_meow_」␤ char => 「_」␤ stuff => 「meow」␤»
sena_kun m: say "Q_meow_" ~~ /'Q' $<char>=. $<stuff>=[<!before $<char>> .]* $<char>/;
camelia rakudo-moar c4a601: OUTPUT«「Q_meow_」␤ char => 「_」␤ stuff => 「meow」␤»
sena_kun m: say "Q__" ~~ /'Q' $<char>=. $<stuff>=[<!before $<char>> .]* $<char>/;
camelia rakudo-moar c4a601: OUTPUT«「Q__」␤ char => 「_」␤ stuff => 「」␤»
Juerd Does the difference in dashes (Day $n -) bother anyone else or is it just me? :) 14:28
babydrop m: say "Q |x|" ~~ /Q \s+ $<stuff>=[ $<char>=. ~ $<char> .+? ]/
camelia rakudo-moar c4a601: OUTPUT«「Q |x|」␤ char => 「|」␤ stuff => 「|x|」␤»
perlpilot Juerd: I didn't even notice it.
babydrop I noticed because one of them fails to be handled by reddit's autotitler but it doesn't bother me 14:29
m: say "Q |x|" ~~ /Q \s+ [ $<char>=. ~ $<char> $<stuff>=.+? ]/
camelia rakudo-moar c4a601: OUTPUT«「Q |x|」␤ char => 「|」␤ stuff => 「x」␤»
Juerd Okay, I'll assume it doesn't matter then :)
babydrop sena_kun: weee?
m: say "Q ♥meows♥" ~~ /Q \s+ [ $<char>=. ~ $<char> $<stuff>=.+? ]/ 14:30
camelia rakudo-moar c4a601: OUTPUT«「Q ♥meows♥」␤ char => 「♥」␤ stuff => 「meows」␤»
14:30 prammer joined
babydrop m: say "Q ♥meows♥" ~~ /Q \s+ $<char>=. ~ $<char> $<stuff>=.+?/ 14:31
camelia rakudo-moar c4a601: OUTPUT«「Q ♥meows♥」␤ char => 「♥」␤ stuff => 「meows」␤»
sena_kun babydrop, something lie this, I think. But I didn't find any presence of using "~" in regex in our docs.
s/lie/like/
mspo I was thinking like: ^Q\s(\w)\s<-[$0]>\s$0 but it doesn't seem to work
sena_kun It doesn't seem to me like concatenation.
babydrop Nope 14:33
It's START_DELIM ~ END_DELIM STUFF_BETWEEN_DELIMS 14:34
With the caveat that you need to account for greedy matching, as it won't stop at the first END_DELIM it can
m: say "Q ♥meows♥" ~~ /Q \s+ $<char>=. $<stuff>=.+? $<char>/
camelia rakudo-moar c4a601: OUTPUT«「Q ♥meows♥」␤ char => 「♥」␤ stuff => 「meows」␤»
babydrop this works too, I guess 14:35
sena_kun Great! babydrop++, it's time for a new doc ticket...
babydrop m: say '10$#' ~~ m:g/<-[$0]>/
camelia rakudo-moar c4a601: OUTPUT«(「1」 「#」)␤»
babydrop sena_kun: the course I learned that from says the ~ version gives better error reporting but I never understood or saw it. 14:36
It's used all over the place in Rakudo tho
mspo why isn't mine working?
can I not sure a capture in the character class? 14:37
babydrop mspo: see my eval ebove. It's treating the dollar and zero literally, because it's in char class
sena_kun But non-greedy version is slightly more useful for me, so I'll stick with it.
babydrop You can write that as <!$0>+, but that'll likely hang because that matches "nothing" too
maybe <!$0<?[.]>> or something 14:38
mspo you lost me on that one :)
babydrop .tell dogbert17 I get same No such method 'consume-all-chars' for invocant of type 'Any' on my 32-bit box after 3 tries
yoleaux babydrop: I'll pass your message to dogbert17.
babydrop mspo: `<!` (not) `$0` (the capture) `<?[.]>` (look ahead, looking for a dot... and yeah, that was wrong, I guess it should be a lookahead for a "char" and not a dot, but then again, I don't know how that would work with the `<!` not at the start) 14:39
babydrop &
mspo <!before> 14:40
I was initially thinking of lookarounds but idk
it's early
14:41 khw joined
babydrop m: say "Q |x|" ~~ /Q \s+ (.) <!$0 <before .> > $0/' 14:41
camelia rakudo-moar c4a601: OUTPUT«5===SORRY!5=== Error while compiling <tmp>␤Unable to parse expression in metachar:sym<assert>; couldn't find final '>' ␤at <tmp>:1␤------> 3say "Q |x|" ~~ /Q \s+ (.) <!$07⏏5 <before .> > $0/'␤»
dogbert17 babydrop: 99% certain that it is 58cdfd80b30444 which breaks t/spec/S17-procasync/no-runaway-file-limit.t
yoleaux 14:38Z <babydrop> dogbert17: I get same No such method 'consume-all-chars' for invocant of type 'Any' on my 32-bit box after 3 tries
babydrop well, alrighty then...
dogbert17: check with jnthn++ about it, 'cause he fixed the bug that allowed that commit. 14:42
m: say "Q |x|" ~~ /Q \s+ (.) [<!$0> <before .>]+ $0/
dogbert17 babydrop: ok
camelia rakudo-moar c4a601: OUTPUT«(timeout)» 14:43
babydrop oh wait, that won't work, cause "nothing before something" still matches nothing without moving forward :}
babydrop &
lucasb what's the explanation for not allowing single quotes as delimiter in Q'...' ?
moritz m: say Q'a' 14:44
camelia rakudo-moar c4a601: OUTPUT«5===SORRY!5=== Error while compiling <tmp>␤Two terms in a row␤at <tmp>:1␤------> 3say Q'a7⏏5'␤ expecting any of:␤ infix␤ infix stopper␤ postfix␤ statement end␤ statement modifier␤ s…»
moritz lucasb: oh, it's ambiguous with identifier syntax
Q'a is a valid identifier
lucasb ah, right
I forgot about that
14:45 sena_kun left
babydrop lucasb: they are allowed. 14:47
m: say Q 'weeee'
camelia rakudo-moar c4a601: OUTPUT«weeee␤»
lucasb q-foo- # Missing required term after infix 14:48
q'foo' # Two terms in a row
babydrop You just need to disambiguate that you're not writing an identifier by adding the space
lucasb ^^ interesting, I would say the 2 are of the same kind of identifier error, but they give differents error
babydrop nope
lucasb: $<identifier>=q-foo $<infix>='-' .... -> missing term after infix 14:49
as for ttr, dunno, maybe it's parsing the second quote as start of a quoted string 14:50
m: q'foo'123'
camelia rakudo-moar c4a601: OUTPUT«5===SORRY!5=== Error while compiling <tmp>␤Two terms in a row␤at <tmp>:1␤------> 3q'foo7⏏5'123'␤ expecting any of:␤ infix␤ infix stopper␤ statement end␤ statement modifier␤ statement modifie…»
babydrop m: sub q'foo ($) { }; q'foo'123' 14:51
camelia rakudo-moar c4a601: OUTPUT«5===SORRY!5=== Error while compiling <tmp>␤Two terms in a row␤at <tmp>:1␤------> 3sub q'foo ($) { }; q'foo7⏏5'123'␤ expecting any of:␤ infix␤ infix stopper␤ statement end␤ statement modifier␤ …»
babydrop m: sub q'foo ($) { }; q'foo '123'
camelia ( no output )
babydrop seems to
damn
Perl 6 is way more interesting than my job :P
babydrop leaves again, in an attempt to do Actual Work™ for a change
lucasb: the ' and - are not allowed to be at the end of the identifier, so the second ones don't parse as part of the identifier, hence the different error messages. 14:54
lucasb token identifier { <.ident> [ <.apostrophe> <.ident> ]* } 14:55
It would arguably be a good idea to give a warning if the production matches <apostrophe> at the end of the identifier token?
I think Haskell people expects function' to work 14:56
babydrop m: sub function' {}
camelia rakudo-moar c4a601: OUTPUT«5===SORRY!5=== Error while compiling <tmp>␤Missing block␤at <tmp>:1␤------> 3sub function7⏏5' {}␤ expecting any of:␤ new name to be defined␤»
babydrop m: constant function' = 42 14:57
camelia rakudo-moar c4a601: OUTPUT«5===SORRY!5=== Error while compiling <tmp>␤Missing initializer on constant declaration␤at <tmp>:1␤------> 3constant function7⏏5' = 42␤»
lucasb m: sub ::("foo'") { 42 }; say ::("&foo'")()
camelia rakudo-moar c4a601: OUTPUT«42␤»
babydrop :o 14:58
m: sub term:<''''''''''> { 42 }; say '''''''''' 14:59
lucasb obviously, calling it like foo'() doesn't work :)
camelia rakudo-moar c4a601: OUTPUT«42␤»
babydrop m: sub term:<''''''''''> { * + 42 }; say '''''''''(4) 15:00
camelia rakudo-moar c4a601: OUTPUT«5===SORRY!5=== Error while compiling <tmp>␤Two terms in a row␤at <tmp>:1␤------> 3sub term:<''''''''''> { * + 42 }; say ''7⏏5'''''''(4)␤ expecting any of:␤ infix␤ infix stopper␤ postfix␤ statement en…»
babydrop m: sub term:<''''''''''> { * + 42 }; say '''''''''.(4) 15:01
camelia rakudo-moar c4a601: OUTPUT«5===SORRY!5=== Error while compiling <tmp>␤Two terms in a row␤at <tmp>:1␤------> 3sub term:<''''''''''> { * + 42 }; say ''7⏏5'''''''.(4)␤ expecting any of:␤ infix␤ infix stopper␤ postfix␤ statement e…»
babydrop ewird
m: sub term:<''''''''''> { * + 42 }; say ''''''''''(4)
camelia rakudo-moar c4a601: OUTPUT«46␤»
15:02 pyrimidine joined
babydrop m: sub term:<foo'> { *.is-prime }; say foo'(31337) 15:02
camelia rakudo-moar c4a601: OUTPUT«True␤»
15:02 Xliff joined
babydrop \o/ 15:02
lucasb oh! bind a term to a subroutine! 15:03
babydrop++
15:06 pyrimidine left 15:07 pyrimidine joined 15:08 prammer left 15:09 pyrimidine left, pyrimidine joined
lucasb m: say sub { $^a }.('ok') 15:10
camelia rakudo-moar c4a601: OUTPUT«ok␤»
15:10 prammer joined
lucasb m: say -> { $^a }.('ok') 15:10
camelia rakudo-moar c4a601: OUTPUT«5===SORRY!5=== Error while compiling <tmp>␤Placeholder variable '$^a' cannot override existing signature␤at <tmp>:1␤------> 3say 7⏏5-> { $^a }.('ok')␤»
lucasb -> {} auto declares some signature? 15:11
babydrop empty one. same as sub () { }
lucasb can't it has a "blank" signature like sub {} ?
babydrop yes, that's just {}
without the arrow thing
m: say { $^a }('ok')
camelia rakudo-moar c4a601: OUTPUT«ok␤»
15:11 cygx left
lucasb sometimes you want a subroutine that returns a callable 15:13
you could just write sub foo { { $^a + $^b } }, but this doesn't work, it's ok, understandable
now, you could just write sub foo { -> { $^a + $^b } }, but this doesn't work too 15:14
sub foo { sub { $^a + $^b } }, works alright
the second case is the one I'm complaing about. can't ->{...} be made to work the as sub {...} ? 15:15
babydrop m: sub gimme { return { $^a } }; my $callable = gimme; say $callable(42)
camelia rakudo-moar c4a601: OUTPUT«42␤»
lucasb oh, right, using return does the trick. thanks babydrop++, I didn't think about that 15:16
15:17 cdg_ joined
[Coke] pmurias++ # 15:17
15:18 skids joined 15:19 cdg left
lucasb one more question, sorry 15:21
how can I create an alias of a sub or method?
like P5 '*foo = \&bar'
babydrop m: my &shout-loudly = &say; shout-sloudly 'meow'
camelia rakudo-moar c4a601: OUTPUT«5===SORRY!5=== Error while compiling <tmp>␤Undeclared routine:␤ shout-sloudly used at line 1. Did you mean 'shout-loudly'?␤␤»
babydrop :(
oh
m: my &shout-loudly = &say; shout-loudly 'meow' 15:22
camelia rakudo-moar c4a601: OUTPUT«meow␤»
babydrop \o/
lucasb easy! I should have thought more before asking. thanks again babydrop
babydrop any time.
lucasb class C { method foo { 42 }; my &bar = &foo }; say C.bar # nope, this doesn't work. will need a little more tweaking 15:25
jnthn BEGIN C.^add_method('bar', C.^lookup('foo')); 15:27
Or similar 15:28
lucasb jnthn: I'll try, thanks! 15:29
ruby has an 'alias' instruction 15:30
perlpilot Is there a way to do something like multi sub foo(%h where %h<foo> eq 'bar') { } but without the where clause?
babydrop m: class C { method foo { 42 }; BEGIN ::?CLASS.^add_method("bar", ::?CLASS.^lookup("foo")); }; say C.bar
camelia rakudo-moar c4a601: OUTPUT«42␤»
babydrop \o/
perlpilot: nope
lucasb I remember lizmat once wrote a trait named "aka" to use with methods, but it was removed from core
babydrop perlpilot: well, you can define a subset, but that'd still have a where clause
perlpilot: you can also use .<foo> instead of %h<foo> to avoid variable duplication 15:31
perlpilot yeah, I thought so.
babydrop perlpilot: oh
perlpilot: maybe there's a way with unpacking? I don't know anything about that
perlpilot I was hoping for something like multi sub foo(%h ( :foo<bar> )) { }
lucasb anyway, I'll just leave here my wish that aliasing methods could be easier and builtin into the language with a little sugar 15:32
15:32 g4 left
jnthn Well, tbh it's shorter just to write method bar(|c) { self.foo(|c) } if you've just one of them :) 15:32
15:32 prammer left
jnthn Alternatively, look into FALLBACK 15:33
lucasb jnthn: I agree, but sometimes it could be desiredable to avoid the extra call
(maybe there's some optimization with regard to this that this difference wouldn't matter)
15:33 ufobat left
babydrop
.oO( premature optimization is the root..... )
15:35
jnthn What's the use case for aliasing the same functionality with two names, ooc? 15:36
lucasb the possibility to create inconsitent named codebases :)
just kidding, idk, personal preference 15:37
perlpilot building a DSL where either name makes sense?
lucasb ruby has size/length aliased for most compound things
perlpilot I've occasionally wished that grep was named filter, but that's only when explaining grep to someone else 15:38
lucasb and yet, someone else prefered grep to be named 'where'
15:38 andrzejku left
lucasb both of you would be happy with just alias &grep, 'filter'; alias &grep, 'where' :) 15:39
babydrop Clearly we need configurable method names!!! :D
done during installation
lucasb alias($target, $linkname) or alias($linkname, $target) or some other funky syntax
pmurias jnthn: any idea why this test for repossesion fails: paste.scsys.co.uk/540142 ?
perlpilot don't some JS frameworks have a thing called "select" that works like grep? 15:40
pmurias jnthn: by fail I mean why doesn't the object get a new value 15:41
perlpilot Use all the names :)
pmurias perlpilot: ruby does use select 15:42
15:45 gregf_ left
jnthn pmurias: I suspect because the SC name is singificant for such tests 15:45
And 'TEST_SC_1_OUT' ne 'TEST_SC_1_IN'
pmurias jnthn: thank you, fixed the problem 15:47
babydrop samcv: fun glitch of perl6fe highlighter. The 'regex' gets interpreted as a regex method-thing, I guess? Messes up 30 lines: github.com/rakudo/rakudo/blob/c4a6....nqp#L7676 15:50
15:50 prammer joined
pmurias jnthn: nqp::deserialize doesn't set the conflicts array on the jvm, is that a problem? 15:52
15:54 committable6 left
babydrop ooops 15:54
lucasb glitch in syntax highlighter? I found one in vim perl6 syntax
babydrop m: say 'foo'.match: :g, /x/
camelia rakudo-moar c4a601: OUTPUT«()␤»
lucasb is literal maintainig it?
babydrop for some reason that code killed commitable
lucasb can someone confirm? '$a <= $b and foo
after, "<=" everything turns into quoting color :) 15:55
babydrop .ask AlexDaniel did you say you gave anyone who wanted access to server with the bots? Any way for me to get it and to be taught to restart the bots after I murder them?
yoleaux babydrop: I'll pass your message to AlexDaniel.
psch m: sub f(@a [4, *@rest]) { }; say f [1, 2] 16:00
camelia rakudo-moar c4a601: OUTPUT«Constraint type check failed for parameter '<anon>' in sub-signature of parameter @a␤ in sub f at <tmp> line 1␤ in block <unit> at <tmp> line 1␤␤»
psch m: sub f(%h {:foo<bar>}) { }
camelia rakudo-moar c4a601: OUTPUT«5===SORRY!5=== Error while compiling <tmp>␤Missing block␤at <tmp>:1␤------> 3sub f(%h 7⏏5{:foo<bar>}) { }␤»
psch m: sub f(%h (:foo<bar>)) { }
camelia rakudo-moar c4a601: OUTPUT«5===SORRY!5=== Error while compiling <tmp>␤Malformed parameter␤at <tmp>:1␤------> 3sub f(%h (:7⏏5foo<bar>)) { }␤»
psch feels like that should work, for consistency if nothing else
perlpilot psch: I agree :) 16:01
psch hm, not sure on the unpack with { } though
s/on/about/
gfldex tbrowder: i will have a look at the failing tests 16:02
psch well, i've gotta go get groceries, bbl o/
tbrowder gfldex: thanks! 16:03
jnthn pmurias: I *think* it's an NYI 16:06
[Coke] (rakudo star isn't necessarily monthly) 16:19
16:20 dwarring left
lucasb I only said that because I felt the need for having direct hyperlinks to moarvm/nqp/rakudo monthly tarballs right in the front page of either rakudo.org or p6.org 16:20
but then, if R star is *almost* monthly, there's no need to publicize the 3 tarballs packages (I assume) 16:21
babydrop We restrict the announcement of other deliverables to perl6-compiler only, to avoid confusion in general public 16:22
lucasb I understand
babydrop *perl6-compiler@perl.org mailing list I meant 16:23
lucasb I thought one argument for the method aliases. P6 already has named params aliases like 'sub f(:a(:b(:$c)))'. I think the purpose of them is "interface convenience". method aliases would also help in this aspect. 16:26
did TimToady explicit rejected this idea before? sure it has been proposed before 16:27
[Coke] sees no context on "method aliases" 16:28
link to previous convo?
lucasb [Coke]: start on the backlog in: 16:29
13:21 < lucasb> how can I create an alias of a sub or method?
babydrop [Coke]: irclog.perlgeek.de/perl6/2016-12-09#i_13710972
babydrop is happy with the current way to do it
Especially if there was already an `aka` trait which was rejected from core... 16:30
[Coke] could easily write 'alias' in userspace.
lucasb [Coke]: is needs to run at BEGIN time 16:31
[Coke] you can write BEGIN in userspace :)
lucasb I mean, it's possible, but won't pretty having to type 'BEGIN' in the middle of the class
jnthn So put it in a trait? 16:32
lucasb ah, right
jnthn Then you can method bard() is aliased<bar ba b> { } or so 16:33
lucasb jnthn: thanks. I'll search how to do it
jnthn afk for a bit
16:36 lucasb left
babydrop star: "foo" ~~ S:2nd/o/x/; dd $/ 16:38
camelia star-m 2016.10: OUTPUT«Potential difficulties:␤ Smartmatch with S/// is not useful. You can use given instead: S/// given $foo␤ at <tmp>:1␤ ------> 3"foo" ~~ 7⏏5S:2nd/o/x/; dd $/␤Str $/ = "fox"␤»
babydrop notices that warning is kinda bogus, since $/ contains the result... 16:39
psch star: say "foo" ~~ S:2nd/o/x/; dd $/
camelia star-m 2016.10: OUTPUT«Potential difficulties:␤ Smartmatch with S/// is not useful. You can use given instead: S/// given $foo␤ at <tmp>:1␤ ------> 3say "foo" ~~ 7⏏5S:2nd/o/x/; dd $/␤False␤Str $/ = "fox"␤»
psch babydrop: i think the warning is about what the smart match returns 16:40
babydrop star: say "foo" ~~ S:2nd/o/x/ andthen $/ 16:41
camelia star-m 2016.10: OUTPUT«Potential difficulties:␤ Smartmatch with S/// is not useful. You can use given instead: S/// given $foo␤ at <tmp>:1␤ ------> 3say "foo" ~~ 7⏏5S:2nd/o/x/ andthen $/␤WARNINGS for <tmp>:␤Useless use of $/ in sink context (line 1)␤False␤»
babydrop Yeah... I was just idly noticing stuff :)
psch m: say S:2nd/o/x/ given "foo" 16:42
camelia rakudo-moar c4a601: OUTPUT«fox␤»
babydrop m: say S:2nd/o/x/ with "foo"
camelia rakudo-moar c4a601: OUTPUT«fox␤»
babydrop likes .subst: anyway
psch m: "foo".subst: anyway
camelia rakudo-moar c4a601: OUTPUT«5===SORRY!5=== Error while compiling <tmp>␤Undeclared routine:␤ anyway used at line 1␤␤»
psch :P
babydrop heh 16:43
psch m: class A { has $.x }; sub f(A.new(:4x)) { }
camelia rakudo-moar c4a601: OUTPUT«5===SORRY!5=== Error while compiling <tmp>␤Malformed parameter␤at <tmp>:1␤------> 3class A { has $.x }; sub f(A7⏏5.new(:4x)) { }␤ expecting any of:␤ constraint␤ formal parameter␤»
psch are literal Pairs special enough to not fall into that ^^^ kind of "doesn't work"?
'cause that's what occured to me while walking to the store 16:44
16:44 user9 left
psch i think probably constant folding is involved there somewhere and i'm not sure we do that -- or want to, either 16:44
16:45 seatek left
gfldex tbrowder: can reproduce and believe to know where it comes from 16:49
16:52 lichtkind_ joined 16:54 kalkin-_ left 16:56 lichtkind left
nine Perl 6 is so lovely :) 17:00
Organizing my pictures by date: perl6 -e 'use Image::EXIF:from<Perl5>; my $source = "/run/media/nine/NO_NAME/DCIM/102NIKON"; for $source.IO.dir -> $file { next unless $file.extension ~~ rx:i/jpg/; my $exif = Image::EXIF.new($file); my ($y, $m, $d) = split /<[\:\ ]>/, $exif.get_image_info{"Image Created"}; my $date = "$y-$m-$d"; mkdir $date unless $date.IO.e; $file.copy("$date/" ~ $file.basename) }'
babydrop :) 17:01
nine Then I just look through the pictures and add some description of the event to the folder's name and be done with it.
I think, this is actually the first time, I've used Inline::Perl5 for my own purpose *g*
17:01 wamba joined
babydrop lol 17:01
gfldex tbrowder: fixed, version bumped 17:12
17:12 domidumont left
gfldex nine: i agree on the loveliness. I just fixex a module of mine by spotting a line that should have use a certain idiom (inplace change of a List) but didn't. I didn't have to understand what that line actually does. Just using the right idiom fixed the problem. 17:23
tbrowder gfldex: thanks! i look forward to using it. 17:31
17:36 RubioTerra joined 17:41 zacts left
RubioTerra Hi, I was working on a grammar and found that matching against an array of alternatives is way slower than to use a normal alternation. Is this expected? Let me explain. 17:42
This is slow: my @options = <one two>; token mytoken { $<name>=@options } 17:43
This is about 10x faster: token mytoken { $<name>=[ 'one' | 'two' ] }
17:44 xinming_ joined
babydrop RubioTerra: not sure about "expected". It's just grammars aren't yet optimized 17:44
And I guess you get the impact from variable interpolation too, which I know is slow ATM 17:45
psch there's also a bug hiding in array interpolation in regex
babydrop yeah
17:46 xinming left 17:48 xinming_ left 17:49 domidumont joined
jnthn The alternation syntax with | matches the longest option 17:50
Quite aside from the indirection of the array, for the literal case it can compile it into an automata that is used to quickly figure out which, if any, option matches 17:51
whereas for the array case it needs to consider the lot
(OK, it can sort by length, but that's still considering everything in the array) 17:52
If getting the longest alternative isn't important, $<name>=[|| @options] may come out faster
17:54 xinming joined
jnthn pmurias++ # rakudo.js update 17:55
And for rakudo.js too :)
psch hm, i'm actually just now getting confused again about #126713 17:59
synopsebot6 Link: rt.perl.org/rt3//Public/Bug/Displa...?id=126713
psch m: say "abcd" ~~ /^(a | b | bc | cd)*?$/;
camelia rakudo-moar c4a601: OUTPUT«「abcd」␤ 0 => 「a」␤ 0 => 「b」␤ 0 => 「cd」␤»
psch that matches 'a', then 'bc', then can't match 'd' anymore, backtracks out of 'bc' to 'b' and then matches 'cd', right?
if that's true then the buggy array interpolation isn't necessarily about array interpolation but about "when do we backtrack" i think..? 18:01
m: my @a = < a b bc cd >; say "abcd" ~~ /^(@a)+$/
camelia rakudo-moar c4a601: OUTPUT«Nil␤»
jnthn I suspect the interpolation thing isn't be smart enough to backtrack 18:04
18:05 labster joined 18:07 RubioTerra left 18:08 RubioTerra joined
RubioTerra Let me try Jonathan's suggestion: '$<name>=[|| @options]' 18:08
It doesn't make much difference... 18:10
18:13 lukaramu joined
babydrop woo... sticking QAST::Op.new( :op('say'), .... ) with a curse word fixes the bug! 18:15
The fact that ends up on screen is just a minor side effect... 18:18
git commit; git push;
psch missing a '-m fix it'
:P
...well, plus quotes -- or minus 'it' i guess
18:23 lucasb joined 18:26 AlexDaniel joined 18:27 skrshn joined
lucasb m: use v6.b 18:30
camelia rakudo-moar c4a601: OUTPUT«5===SORRY!5=== Error while compiling <tmp>␤No compiler available for Perl v6.b␤at <tmp>:1␤------> 3use v6.b7⏏5<EOL>␤»
lucasb ^^ did this ever worked in the pre-xmas era?
psch would've asked commitable 18:31
lucasb when v6.d gets released, all 'use v6.c' programs will die like this?
psch but well :S
lucasb yes, I looked for commitable too
psch lucasb: hopefully not, but i don't know how far along efforts are to keep versioned compiler instances version-compliant
lucasb he was nowhere to be found
psch i'd speculate that 'use v6.c' would only die on 6.d features used in a scope where it's active 18:32
lucasb psch: ah, ok. I am not updated with regard compiler-vs-language version plans
psch lucasb: well, "only support the latest language version" is the easy solution, but we're kind of in the habit of tormenting implementors... :) 18:33
18:34 committable6 joined, ChanServ sets mode: +v committable6, labster left, benchable6 joined
babydrop yey 18:34
lucasb yay, thanks
psch committable6: 2015.11 use v6.b
committable6 psch, ¦«2015.11»:
lucasb right, it worked before
psch isn't gonna volunteer for multiple language version inside one compiler 18:35
lucasb committable6: 2015.09 use v6.a
committable6 lucasb, ¦«2015.09»: ===SORRY!=== Error while compiling /tmp/uMi_iB7Ma_␤Confused␤at /tmp/uMi_iB7Ma_:1␤------> use v6.⏏a «exit code = 1»
lucasb committable6: 2015.11 use v6.a
committable6 lucasb, ¦«2015.11»: ===SORRY!=== Error while compiling /tmp/5Cm7KC45Ss␤No compiler available for Perl v6.a␤at /tmp/5Cm7KC45Ss:1␤------> use v6.a⏏<EOL> «exit code = 1»
psch lucasb: 6.b was 6.beta
lucasb 6.a was advent :)
AlexDaniel psch: in these situations perhaps you can try asking bisectable :D
yoleaux 15:55Z <babydrop> AlexDaniel: did you say you gave anyone who wanted access to server with the bots? Any way for me to get it and to be taught to restart the bots after I murder them?
psch but only as a language i think?
lucasb ah, ok
AlexDaniel babydrop: yes, I need your public key
psch AlexDaniel: yeah, didn't occur to me. i mean, i knew which rakudo version i wanted, soo... :) 18:36
AlexDaniel: as in, not a case of "dear bot, please find where it worked"
AlexDaniel bisectable6: old=2015.09 new=2015.09 say ‘woohooo, committable!’
bisectable6 AlexDaniel, On both starting points (old=2015.09 new=2015.09) the exit code is 0 and the output is identical as well
AlexDaniel, Output on both points: woohooo, committable!
psch ...that feels wrong somehow :P
18:36 labster joined
psch lucasb: in any case, we definitely need a way to internally designate parts of the language as "belongs to this version" 18:37
babydrop AlexDaniel: last one in the list: github.com/zoffixznet.keys
psch lucasb: that's probably kinda hard though, and idk if we have anyone already thinking about it
18:37 Von_Cheam joined
lucasb AlexDaniel: can you make it accept a parameter 'bisectable6: exact=2015.09' that means the same as 'old=* new=*' for the same release ? :) 18:37
AlexDaniel lucasb: what would that mean? 18:38
exact=2015.09 would mean old=2015.09 new=2015.10 ?
lucasb exact=2015.09 would mean the same as 'old=2015.09 new=2015.09', just that
AlexDaniel but that's just one commit
18:39 mohae_ joined 18:40 mohae left
Von_Cheam Hey, all. Is there any chance anybody give me a simple example of code which uses the Perl6 NCurses wrapper module to read user-input strings? (I can output to the terminal just fine using the examples here [github.com/azawawi/perl6-ncurses/t...examples], but can't figure out how to read anything in from the terminal..) 18:42
18:44 leedo_ joined 18:45 wamba left
lucasb aww, perl 5 doesn't understand the version syntax :( 18:45
$ perl v6.pl # Perl v6.0.0 required--this is only v5.24.0
$ perl v6c.pl # syntax error at v6c.pl line 1, near "use v6."
babydrop Von_Cheam: never heard of that module, but this line suggests getch would return a code for a key pressed maybe? github.com/azawawi/perl6-ncurses/b...ld.pl6#L15
AlexDaniel committable6: all use v6.b 18:46
committable6 AlexDaniel, gist.github.com/574d3e47202e39513d...1c15242c9c
lucasb (I should have showed the command line was: perl -e 'use v6.c' )
AlexDaniel committable6: 6b use v6.b 18:47
committable6 AlexDaniel, ¦«6b»: Cannot find this revision
AlexDaniel committable6: v6.b use v6.b
committable6 AlexDaniel, ¦«v6.b»:
AlexDaniel there's v6.b tag? :o
lucasb right, when 2015.12 was released, the version was just incremented
psch committable6: v6.a 1 18:48
committable6 psch, ¦«v6.a»: Cannot find this revision
lucasb the was no nested version scope in place
*there was no...
babydrop Von_Cheam: umm.... I've no idea how to switch to 11th window in WeeChat, so I've no idea what you're trying to /msg me 18:49
psch babydrop: /w doesn't work?
babydrop: or /window for that matter 18:50
babydrop nope
"end of WHO list"
psch babydrop: how bout ^N or ^P until you're there..?
psch never even saw WeeChat
Von_Cheam babydrop: Sorry - meant to reply to you, but am new to IRC (and Perl 6..) 18:51
babydrop Well, this was a waste of time....
Von_Cheam: just type a couple of chars of the nick and hit TAB key that should nick-complete and you can respond in channel 18:52
Von_Cheam: and yeah, an Int from getch makes sense to me. It's a key code.
It's probably some ASCII stuff innit?
m: say 'A'.ord
camelia rakudo-moar c4a601: OUTPUT«65␤»
lucasb didn't know ^N ^P switched windows in irssi. he used alt-left alt-right
Von_Cheam babydrop: I figured as much; that means I'll have to figure out the encoding in use, etc. etc., right? 18:53
babydrop: Was hoping not to have to do that, given that GNU ncurses can return strings, etc..!
babydrop No idea, I've never used ncurses 18:54
lucasb Von_Cheam: you don't want the function getstr? 18:55
AlexDaniel m: say ‘l’.ord 18:56
camelia rakudo-moar c4a601: OUTPUT«108␤»
psch getstr takes a char** from the caller where it stuffs the result into
and, well, it's a getch() loop until KEY_RETURN
AlexDaniel
.oO( sometimes such stupid things give a good laugh after a good stressful day )
18:57
Von_Cheam lucasb: using getstr gives me this: Calling getstr() will never work with declared signature (Str --> int32)
18:57 zakharyas left
Von_Cheam I figure the best thing for me to do would be try to coerce getch() output to string, probably.. 18:58
lucasb int getstr(char *str);
sub getstr(Str) returns int32
well, it's C vs Perl 6 interface 18:59
C expects a string pointer to put the result there, right?
Von_Cheam lucasb: Ah, I see! 19:00
lucasb if I call P6 getstr($str), will the string be put into $str ?
psch i think that works with 'is rw'? i'm really not that fluid in NC... 19:01
Von_Cheam lucasb: Trying that causes a segfault.. 19:02
lucasb /o\
Von_Cheam lucasb: using getch() and coercing with $var.Str() works (sort of!) so I'll go with that for now; thanks anyhow! 19:05
19:08 pyrimidine left 19:09 pyrimidine joined 19:13 pyrimidine left 19:14 espadrine joined 19:19 eliasr left 19:20 darutoko left
lucasb hmm, interesting 19:21
m: my (42,) = 21
camelia ( no output )
lucasb m: (42,) = 21
camelia rakudo-moar 524368: OUTPUT«Cannot modify an immutable Int␤ in block <unit> at <tmp> line 1␤␤»
babydrop my () is buggy
19:21 Von_Cheam left
lucasb they should make my lists and signature lists distinct things 19:22
babydrop m: my ($x where {$_ ~~ Int and $_ == 42}) = "lulz nope";
camelia ( no output )
babydrop is hoping to crack that one on the weekend 19:23
19:25 Actualeyes left
psch actually, i think we should make my-lists and signature-lists more alike :P 19:26
m: sub f(@a ($h, *@t)) { say "head $h and tail @t[]"; [$h, @t] }; my (@a [$h, *@t]) = f [1, 2, 3]; say $h # this should totally work 19:27
camelia rakudo-moar 524368: OUTPUT«head 1 and tail 2 3␤(Mu)␤»
babydrop Well, the my () is already parsed with <signature> token :)
psch right, but there's probably something with $*IN_DECL or so that makes it different 19:28
babydrop will take a look.
psch orrr maybe my favorite doodad EXPR :P
babydrop There's a ticket for where broken but I'll check the unpacking too
lucasb psch: I agree that most features should work in both contexts, but somethings just doesn't make sense in 'my' lists 19:30
m: my (1,2,3)
camelia ( no output )
psch that could get a "useless use ... in sink context" warning i guess
lucasb m: my @a = my (1,2,3); say @a 19:31
camelia rakudo-moar 524368: OUTPUT«[(Any) (Any) (Any)]␤»
psch although 'my (1, $x, *@rest) = ...' seems okay for "only allow assigning arrays that have 1 as 0th element"
lucasb that's a lot of magic what you are asking :) 19:32
psch nah, it's just consistency
with signatures, specifically
lucasb sub f(Int); f(@a) doesn't work
psch m: sub f(Int(Cool) $x) { say $x }; f [1, 2 ,3]
camelia rakudo-moar 524368: OUTPUT«3␤»
psch oh really :P 19:33
m: sub f(Int $x) { say $x }; f [1, 2 ,3]
camelia rakudo-moar 524368: OUTPUT«Type check failed in binding to $x; expected Int but got Array ($[1, 2, 3])␤ in sub f at <tmp> line 1␤ in block <unit> at <tmp> line 1␤␤»
psch stops snarking
lucasb: you are actually right. the actual syntax for the feature i was thinking of above would be different
lucasb: it would have to be 'my @ (1, *@rest) = ...' to get the unpack going in the first place 19:34
lucasb: so, yes, it's not a my-list in the same sense -- i'd have to bind to get that
i.e. 'my (1, @a) := [1, [2, 3]]', and that actually is something completely different
lucasb: so yes, you're right, that is the wrong kind of magic
as in, it doesn't really follow the same consistency rules 19:35
19:38 pyrimidine joined 19:42 pyrimidine left 19:43 girafe left 19:51 kyclark joined
jnthn I think much of the confusion would be avoided if the thing that produces a list and declarations for list assignment to work on would complain reliably if you used things that are too complex for that 19:53
Unpacking is a binding thing, not a list-assignment thing.
psch so we need more clarity around both types of infix:<=>? 19:54
RabidGravy moritz, no not a burden :)
19:54 zakharyas joined
jnthn my ($a, $b) = @c; # really sugar for: my $a; my $b; ($a, $b) = @c 19:55
Anything that is too complex to transform into declarations and a list assignment should be rejected outright
RabidGravy but the 12th slot was something I picked up because no-one else wanted it 19:56
jnthn my ($a where Int|Num, Str $b) = @c; # OK, because you can turn it into my $a where Int|Num; my Str $b; ($a, $b) = @c
But things with named parameters or sub-signatures or slurpies are no-go
(You need binding to do that) 19:57
psch jnthn: so we only know after finding (or not) the ':' whether the LHS is legal?
that is, the ':' in ':='
kyclark Is it possible to get the values of my enum e.g., enum Rank <NA Recruit Private PSC PFC Specialist>; 19:59
psch m: enum Rank <NA Recruit Private PSC PFC Specialist>; say Rank::.values
camelia rakudo-moar 524368: OUTPUT«(PFC Specialist Private Recruit NA PSC)␤»
kyclark When I try this in my code: 20:01
put "--rank must be one of: ", Rank::values.join(', ')
I get “Could not find symbol '&values’”
lucasb note the dot
kyclark Oh! Sorry.
babydrop m: enum Rank <NA Recruit Private PSC PFC Specialist>; say Rank.enums 20:02
camelia rakudo-moar 524368: OUTPUT«Map.new((:NA(0),:PFC(4),:PSC(3),:Private(2),:Recruit(1),:Specialist(5)))␤»
babydrop also that
jnthn psch: Correct; we actually decide what to do with it after seeing whether it's a = or a := 20:03
bbiab
kyclark Thanks, babydrop, I like that better. To keep them in order, I’m doing this: 20:04
m: enum Rank <NA Recruit Private PSC PFC Specialist>; put Rank.enums.sort(*.value)>>.key 20:05
camelia rakudo-moar 524368: OUTPUT«NA Recruit Private PSC PFC Specialist␤»
kyclark (NA Recruit Private PSC PFC Specialist)
RabidGravy jnthn, btw github.com/jonathanstowe/Manifesto...e/schedule was closer to what I hat in mind when I made Manifesto but I don't want to show my complete hand ;-)
kyclark Is that the bestest way?
20:05 rurban joined
babydrop kyclark: I think so. There's some other method that has them in order already, but it has an internalish smell to it 20:05
m: enum Rank <NA Recruit Private PSC PFC Specialist>; Rank.HOW.^methods».name.say 20:06
camelia rakudo-moar 524368: OUTPUT«(archetypes new new_type add_parent add_enum_value set_export_callback enum_values elems enum_from_value enum_value_list compose compose_values set_composalizer composalize is_composed role_typecheck_list submethod_table add_role can does generate_mixin rw…»
babydrop m: enum Rank <NA Recruit Private PSC PFC Specialist>; say Rank.^enum_values
camelia rakudo-moar 524368: OUTPUT«{NA => 0, PFC => 4, PSC => 3, Private => 2, Recruit => 1, Specialist => 5}␤»
babydrop m: enum Rank <NA Recruit Private PSC PFC Specialist>; say Rank.^enum_value_list
camelia rakudo-moar 524368: OUTPUT«(NA Recruit Private PSC PFC Specialist)␤»
kyclark I’m still getting used to >>, but it’s conceptually the same as map, no?
psch i mean, it depends on how you want to use it i guess?
babydrop m: enum Rank <NA Recruit Private PSC PFC Specialist>; say Rank.^enum_value_list.map: *.^name
camelia rakudo-moar 524368: OUTPUT«(Rank Rank Rank Rank Rank Rank)␤»
20:06 rurban left
RabidGravy yeah, I've got something out there that has some stringy enums 20:06
psch kyclark: .map is in order, >> isn't -- by design at least, impl might not agree yet 20:07
kyclark: that only matters for sideeffect though, both return in-order
+s
babydrop kyclark: sort-of. It's autothreaded, so execution order isn't guaranteed and it also descends into nodal things, which I don't think map does...
kyclark Thanks.
babydrop or does it...
psch oh, right, the nodal thing
psch never quite grok'd that 20:08
20:08 AlexDaniel left
psch m: enum Rank <NA Recruit Private PSC PFC Specialist>; say Rank($_) for ^+Rank.enums 20:08
camelia rakudo-moar 524368: OUTPUT«NA␤Recruit␤Private␤PSC␤PFC␤Specialist␤»
20:08 prammer left
psch ^^^ if you just want to do something with each in order 20:08
no sorting or anything needed :P
babydrop \o/
psch mind, i wouldn't bet on "it's faster" :) 20:09
kyclark That’s nice!
I’m writing a post on MAIN, and was thinking I could use Rank to constrain input, but it does not appear so.
babydrop m: [("a", "b", ("c", "d", ("e", "f", "g")))]».uc.say
camelia rakudo-moar 524368: OUTPUT«[A B (C D (E F G))]␤»
babydrop m: [("a", "b", ("c", "d", ("e", "f", "g")))].map(*.uc).say
camelia rakudo-moar 524368: OUTPUT«(A B C D E F G)␤»
babydrop This is the nodal difference 20:10
psch kyclark: enums in MAIN are weird
kyclark: we had a patch recently but i think it got reverted because it mucked up Bool arguments
kyclark OK, I’ll find another way.
babydrop m: [("a", "b", ("c", "d", ("e", "f", "g")))]».&{"|$_.uc()|"}.say
camelia rakudo-moar 524368: OUTPUT«[|A| |B| (|C| |D| (|E| |F| |G|))]␤»
babydrop m: [("a", "b", ("c", "d", ("e", "f", "g")))].map({"|$_.uc()|"}).say
camelia rakudo-moar 524368: OUTPUT«(|A| |B| |C D E F G|)␤»
babydrop Better image of what .map is doing
psch that probably should go into the docs for 'is nodal' 20:11
kyclark This doesn’t seem to work either:
subset Rank of Str where * eq any(<NA Recruit Private PSC PFC Specialist>);
babydrop prolly
psch if the nodal trait works in userspace
20:11 prammer joined
babydrop kyclark: work in where? 20:11
kyclark No, wait, just a sec...
psch m: BEGIN @*ARGS = "Private"; subset Rank of Str where * eq any(<NA Recruit Private PSC PFC Specialist>); sub MAIN(Rank $x) { }
camelia ( no output )
psch m: BEGIN @*ARGS = "Private"; subset Rank of Str where * eq any(<NA Recruit Private PSC PFC Specialist>); sub MAIN(Rank $x) { say $ank }
camelia rakudo-moar 5476d6: OUTPUT«5===SORRY!5=== Error while compiling <tmp>␤Variable '$ank' is not declared. Did you mean 'Rank'?␤at <tmp>:1␤------> 3C Specialist>); sub MAIN(Rank $x) { say 7⏏5$ank }␤»
psch m: BEGIN @*ARGS = "Private"; subset Rank of Str where * eq any(<NA Recruit Private PSC PFC Specialist>); sub MAIN(Rank $x) { say $x } 20:12
camelia rakudo-moar 5476d6: OUTPUT«Private␤»
psch m: BEGIN @*ARGS = "Noodle"; subset Rank of Str where * eq any(<NA Recruit Private PSC PFC Specialist>); sub MAIN(Rank $x) { say $x }
camelia rakudo-moar 5476d6: OUTPUT«Usage:␤ <tmp> <x> ␤»
psch looks fine :)
babydrop Um, this reminds me, we need to come up with the MAIN Enum solution for release
(or are we doing the same thing as last time and popping it out for release?)
kyclark: you're not using your enums in MAIN are you?
kyclark I was going to try. 20:13
psch babydrop: i have no idea. i'm not sure how to solve it considering there's some semantic overlap between enum and IntStr
it's minor overlap, but it's there
babydrop What about an EnumStr, but make it just be constrained for MAIN parsing? You can only get it there, not in <....> quoters
psch babydrop: does that solve True and False? 20:14
kyclark Yeah, all good now.
babydrop Oh, you can't subclass enums tho
psch m: BEGIN @*ARGS = "True"; multi MAIN(Bool $x) { say "Bool" }; multi MAIN(Str $x) { say "Str" } 20:15
camelia rakudo-moar 5476d6: OUTPUT«Bool␤»
psch we'd need 'is default' again for anything that parses enums in MAIN 20:16
well, at least with the EnumStr solution, however it fits with liskov
babydrop it's that quaks like a duck guy?
psch substitution principle 20:17
any type fits for any parent type
+"of its" maybe
not sure in how far that relates to duck typing
anyway, that's probably stunted because EnumHOW doesn't inherit 20:18
20:18 mr_ron left
babydrop kyclark: well, if you're using a release rakudo, you're fine. But current blead contains experimental MAIN enum handling that has a bug in it and will change.... Was just making sure you weren't showing that feature to your students :) 20:19
kyclark OK, I’m close to having an article I can publish about MAIN. With permission, I stole the idea and title “The MAIN Thing” from brian d foy. Looks like the Advent calendar is full, so I’ll put on blogs.perl.org.
babydrop nice
kyclark I’m done teaching for the semester! \o/
20:20 mr_ron joined, FROGGS left
tadzik nice :) Good for you 20:20
kyclark But my boss says that my book should be able to count for my master’s thesis. Doubleplusgood! I will keep working on it.
psch hm
m: enum Foo <bar baz>; sub f(Foo $) { }; say f 1
camelia rakudo-moar 5476d6: OUTPUT«Type check failed in binding to <anon>; expected Foo but got Int (1)␤ in sub f at <tmp> line 1␤ in block <unit> at <tmp> line 1␤␤»
psch m: enum Foo <bar baz>; sub f(Foo() $) { }; say f 1 20:21
camelia rakudo-moar 5476d6: OUTPUT«No such method 'Foo' for invocant of type 'Int'␤ in sub f at <tmp> line 1␤ in block <unit> at <tmp> line 1␤␤»
psch coercers..! *shakes fist*
[Coke] regarding use v6.d - the first compiler that supports that will also support use v6.c
20:21 pyrimidine joined
babydrop [Coke]: would { use v6.d; say "foo".comb; { use v6.c; say "foo".comb; } } work and potentially give different results if the workings of the method was changed? 20:22
20:22 Tonik joined 20:25 girafe joined
[Coke] That's the plan, yes. 20:26
babydrop :o
psch assumed so
hence the whole "i'm not sure anyone is thinking about this yet" line of thought earlier :)
lucasb imagine the amount of work...
20:27 domidumont left
babydrop wonder what would { use v6.d; my $x = "foo"; { use v6.c; say $x.comb; } } would work like... 20:27
psch the interesting one would be 'my TypeIn6dButNot6c $x = ...; { use v6.c; $x.doTheThing }'
babydrop you're calling a 6.d method from within 6.c language :i 20:28
But on a 6.d object.
That'll be interesting...
psch yes, that's what i'm saying :)
lucasb imagine doing all that inside a block in 6.e 20:29
inside a method in 6.f
inside a class in 6.g
babydrop Perlception...
lucasb is a stack of languages
stack of contexts, I mean 20:30
since things that didn't change in 6.(n+1) are expected to work exactly how it worked on 6.n, right? 20:31
psch honestly, i think it should just work
i mean...
j: use java::lang::System:from<JavaRuntime>; System.get_out.println("foo")
camelia rakudo-jvm 8ca367: OUTPUT«foo␤»
psch so yeah, we're in Perl 6, calling a method on an object from who-cares-where, and it works 20:32
the object is responsible for resolving its methods
babydrop neat
psch in turn, a 6.d 'sub comb(Promise $, Regex $pat)' would fail in 6.c 20:33
lucasb From within class C { method foo {} }, I can call method foo like $.foo, @.foo, %.foo, &.foo
samcv babydrop, I had thought about doing that, using [(+)], but was also wondering if there was a way to do edit mixhashes after they had been created 20:34
yoleaux 14:16Z <babydrop> samcv: I sent you an invite to perl6 org. So you should be able to commit to docs and some other repos directly.
lucasb If I have a private 'method !foo {}', I can't call $!foo, @!foo, etc. because that conflicts with private attrs
samcv nice thanks :)
lucasb can this be made to work? I mean, calling $!foo and expecting the result of a method
babydrop samcv: you can edit mixhashes after they have been created.
psch lucasb: explicitly not. calling private methods is with 'self!method-name" 20:35
babydrop samcv: just use the object as key and adjust the weight or set weight to zero to purge the object..
psch -(bad quote alignment)
lucasb: $.foo is a shortcut for self.foo
lucasb: there is no such shortcut for private methods
lucasb $!foo would be symmetrically convenient, but ok, I understand if that's not possible 20:36
psch m: class A { method m { 1, 2, 3, 4 }; method n { say $.m.WHAT; say @.m.WHAT } }; A.n # the shortcuts don't even do different things yet
camelia rakudo-moar 5476d6: OUTPUT«(List)␤(List)␤»
psch lucasb: consider that $.foo is always the accessor
lucasb: but $!foo is always the Attribute
lucasb: so, yes, i see the symetry you're suggesting, but it's coming from the wrong end. we only have $.foo because we shortcut it. otherwise it'd always be $!foo or self.foo 20:37
lucasb psch: $. @. %. do different things
pmurias calling private method as $!foo would be just confusing
* methods
babydrop samcv: also, I've no idea what you mean by that [(+)] line so I think.... you responded to the wrong person?
:)
samcv xoh
psch lucasb: they don't wrt method table shortcut, that was my example just then 20:38
20:38 skrshn left
samcv i just unresumed my laptop read some lines and then it reconnected and i lost it 20:38
psch lucasb: they only do different things if you have autogenerated accessors
samcv since it's been asleep all night
pmurias m: class Foo {has $!foo; method !foo {say "hi ", $!foo()};method foo {$!foo = -> {"world"};self!foo }}; Foo.new.foo
camelia rakudo-moar 5476d6: OUTPUT«hi world␤»
samcv oh it was timo that said it
lucasb m: class C { method foo { a=>1 }; method m { $.foo, @.foo, %.foo } }; say C.m.perl 20:39
camelia rakudo-moar 5476d6: OUTPUT«(:a(1), (:a(1),), {:a(1)})␤»
pmurias lucasb: ^^ you can have both a !foo method and a $!foo attribute
babydrop :o
psch is definitely bad at Perl 6 :P
or lucasb++ is just better 20:40
dunno
those things are hard to decide
so, right, there's a coercive aspect there
lucasb psch++
babydrop lucasb++ I've no idea you could use any sigil you wanted like that.
psch (i mean, if this goes to three in my current waking cycle, i'll... demand patches from lucasb..?)
lucasb the only oddball is of course the contextualizer &(...) that doesn't do anything
psch lucasb: yeah, there's at least one spot where & means the same as $ in Perl6::Grammar 20:41
babydrop m: class C { method foo { <a b c d> }; method m { $.foo, @.foo, %.foo } }; C.new.m.say
camelia rakudo-moar 5476d6: OUTPUT«((a b c d) (a b c d) {a => b, c => d})␤»
psch which is kind of weird
lucasb we should ask TimToady what he wants &(...) to do
psch i think there was a shortlived discussion about that, but heck if i remember the result... :)
lucasb pmurias: thanks for the snippet. it confirmed for me that all 3 are different $!foo, method foo and method !foo 20:42
psch seriously though, all this magic /o\ 20:43
luckily it's consistent..? >_>
babydrop m: class C { method foo { <a b c d> }; method m { %$.foo, %@.foo, $@%.foo } }; C.new.m.say 20:44
camelia rakudo-moar 5476d6: OUTPUT«({a => b, c => d} {a => b, c => d} (a => b c => d))␤»
babydrop ehehe
psch m: say 4 [&({ $^a ~ " foo " ~ $^b })] 5
camelia rakudo-moar 5476d6: OUTPUT«4 foo 5␤»
psch m: say [[&({ $^a ~ " foo " ~ $^b })]] 4, 5
camelia rakudo-moar 5476d6: OUTPUT«5===SORRY!5=== Error while compiling <tmp>␤Two terms in a row␤at <tmp>:1␤------> 3say [[&({ $^a ~ " foo " ~ $^b })]]7⏏5 4, 5␤ expecting any of:␤ infix␤ infix stopper␤ postfix␤ statement end␤ …»
psch not consistent, can't syntax-reduce with inline-infix /o\
woe is me :P 20:45
lucasb first time I see &(...) make some difference is here: $x [&(...)] $y 20:47
without it, it doesn't work
psch lucasb: that's the parser there. it needs the & mostly 20:48
20:49 prammer left
psch m: sub f($,$) { say "called!" }; say 2 [&f] 2 # like this 20:49
camelia rakudo-moar 5476d6: OUTPUT«called!␤True␤»
psch lucasb: but that gives us the backdoor of stuffing a Block in there
note, i'm not 100% that's an intented use :P
lucasb interesting trick
psch +convinced
masak m: say [&{ $^a + 2 * $^b }] 1..10 20:52
camelia rakudo-moar 5476d6: OUTPUT«5===SORRY!5=== Error while compiling <tmp>␤Two terms in a row␤at <tmp>:1␤------> 3say [&{ $^a + 2 * $^b }]7⏏5 1..10␤ expecting any of:␤ infix␤ infix stopper␤ postfix␤ statement end␤ statemen…»
psch m: sub f($,$) { say "called!" }; [[&f]] 2, 2
camelia rakudo-moar 5476d6: OUTPUT«called!␤»
psch so, yeah, there's a difference
i suspect the syntax reduce form only takes '[' ~ ']' <ident> or so, while the infix form takes statement or something 20:53
or maybe EXPR, no idea without digging and it's a little late for that :) 20:54
masak m: say [[&{ $^a + 2 * $^b }]] 1..10
camelia rakudo-moar 5476d6: OUTPUT«5===SORRY!5=== Error while compiling <tmp>␤Two terms in a row␤at <tmp>:1␤------> 3say [[&{ $^a + 2 * $^b }]]7⏏5 1..10␤ expecting any of:␤ infix␤ infix stopper␤ postfix␤ statement end␤ statem…»
masak m: say [[&{ $^a + 2 * $^b }]](1..10)
camelia rakudo-moar 5476d6: OUTPUT«Invocant requires a type object of type List, but an object instance was passed. Did you forget a 'multi'?␤ in block <unit> at <tmp> line 1␤␤»
psch masak++
that is pretty great :)
lucasb m: say [[&({$^a+$^b})]] 2,3 20:56
camelia rakudo-moar 5476d6: OUTPUT«5␤»
jnthn RabidGravy: Looking at that, I wonder if we shouldn't have a Promise.at to go with Promise.in... :-)
lucasb m: [[&()]]
camelia rakudo-moar 5476d6: OUTPUT«Use of Nil in numeric context␤ in block <unit> at <tmp> line 1␤Cannot find method 'Nil' on object of type List␤ in block <unit> at <tmp> line 1␤␤»
lucasb m: [[ &() ]]
camelia ( no output )
lucasb I wonder how '[[&()]]' is being parsed
20:57 sufrostico left, sufrosti1o left
jnthn m: [[ &() ]] () 20:58
camelia rakudo-moar 5476d6: OUTPUT«5===SORRY!5=== Error while compiling <tmp>␤Two terms in a row␤at <tmp>:1␤------> 3[[ &() ]]7⏏5 ()␤ expecting any of:␤ infix␤ infix stopper␤ statement end␤ statement modifier␤ statement modif…»
jnthn m: dd [[ &() ]]
camelia rakudo-moar 5476d6: OUTPUT«[Any]␤»
jnthn As an array composer
psch m: dd [[&min]] 20:59
camelia rakudo-moar 5476d6: OUTPUT«Inf␤»
jnthn m: dd [[&()]]
camelia rakudo-moar 5476d6: OUTPUT«Use of Nil in numeric context␤ in block <unit> at <tmp> line 1␤Cannot find method 'Nil' on object of type List␤ in block <unit> at <tmp> line 1␤␤»
jnthn The shitespace is makes a difference
*whitespace
lucasb shitspace? O.o
jnthn lol
psch snickers
jnthn That's what typing too fast gets me :P 21:00
I *think* &() may be an...um...well
psch m: say &()
camelia rakudo-moar 5476d6: OUTPUT«Nil␤»
masak "shitespace" is the kind of designspace you don't want to make vital decisions in... :P
lucasb it is calling the sub! why? funny that
jnthn m: 'a' ~~ /foo { make 'bar' }/; say &() 21:01
camelia rakudo-moar 5476d6: OUTPUT«Nil␤»
lucasb ahhh, because it is a reducer!
jnthn m: 'a' ~~ /foo { make 'bar' }/; say $()
camelia rakudo-moar 5476d6: OUTPUT«Use of Nil in string context␤ in block <unit> at <tmp> line 1␤␤»
21:01 setty1 left
psch m: 'a' ~~ /(a) { make 'bar' }/; say $() 21:01
camelia rakudo-moar 5476d6: OUTPUT«bar␤»
psch m: 'a' ~~ /(a) { make 'bar' }/; say &()
camelia rakudo-moar 5476d6: OUTPUT«「a」␤ 0 => 「a」␤»
21:01 mohae joined
jnthn oh, damn 21:02
I needed a regex that matched
But yes, that's exactly what I was looking for. Thanks, psch
I guess there's probably a bit of code somewhere that says "is it @? is it %? OK, neither, it must be $ then" :)
And so &() just comes along for the ride 21:03
21:03 pyrimidine left, brahian joined, pyrimidine joined
brahian hi guys 21:04
psch doesn't quite clear up why we allow [&({ ... })] as infix but not as reduce
jnthn psch: That...does seem a bit inconsistent.
psch but yes, i did see that bit with 'if $<sigil> eq "@"' in Perl6::Actions somewhere
21:04 mohae_ left
lucasb psch: what? [[&({$^a+$^b})]] 2,3 <-- this works 21:04
psch lucasb: ahh, so it's about no whitespace! nice
m: say [[&({$^a+$^b})]] 2,3 21:05
camelia rakudo-moar 5476d6: OUTPUT«5␤»
lucasb no, it's about double squares [[...]]
psch m: say [[&({$^a +$^b})]] 2,3
camelia rakudo-moar 5476d6: OUTPUT«5===SORRY!5=== Error while compiling <tmp>␤Two terms in a row␤at <tmp>:1␤------> 3say [[&({$^a +$^b})]]7⏏5 2,3␤ expecting any of:␤ infix␤ infix stopper␤ postfix␤ statement end␤ statement mod…»
psch nope
it's about "no white space" :)
lucasb ah, right, also, no white space :)
jnthn I was gonna say, I was sure that the reduce rule just delegates to parsing an infixish
But yeah, it also does a lookahead
Reduce meta-ops are one of the very small number of places in the Perl 6 grammar that we do that.
21:06 xinming_ joined
psch doesn't dare having a opinion about that :P 21:06
brahian How to validate if a variable exists?
21:07 kurahaupo__ left, kurahaupo__ joined
psch m: if (try ::('$x')).VAR { say "hi" }; my $x; if (try ::('$x')).VAR { say "hi" } 21:07
camelia rakudo-moar 5476d6: OUTPUT«hi␤hi␤»
psch aw shucks 21:08
skids m: my $a; ::.hash<$a>:exists.say
camelia rakudo-moar 5476d6: OUTPUT«True␤»
psch m: { if (try ::('$x')).VAR { say "hi" } else { say "not hi" } }; { my $x; if (try ::('$x')).VAR { say "hi" } }
camelia rakudo-moar 5476d6: OUTPUT«not hi␤hi␤»
jnthn $x is late-bound enough that it's in scope by then... :)
uh, ::('$x') that is
psch jnthn: right, that's what i figured, hence the added scopes :)
21:08 pyrimidine left
lucasb m: if try EVAL '$x' { say "hi" }; my $x; if try EVAL '$x' { say "hi" } 21:08
camelia ( no output )
skids m: ::.hash<$a>:exists.say
camelia rakudo-moar 5476d6: OUTPUT«False␤»
21:09 xinming left
jnthn m: ::<$a>:exists.say 21:09
camelia rakudo-moar 5476d6: OUTPUT«False␤»
jnthn Stashes are already hashes so you don't need to coerce to hash first :)
lucasb (I forgot to assign some true value to $x)
psch lucasb: that's why i .VAR'd :)
lucasb ah
jnthn The EVAL way probably wins award for "most expensive means to check" :)
psch ...although i'm not actually sure .VAR does the right truthiness i want 21:10
brahian Thank you
psch ...heck, it still worked :)
oh, nvm, it's a Scalar instance
that should be truthy i suppose
m: my $x; say so $x.VAR 21:11
jnthn psch: It might be you in bother if you're looking up a symbol with something directly bound to it, rather than there being a Scalar there
camelia rakudo-moar 5476d6: OUTPUT«False␤»
psch jnthn: oh! yes, that's a good point
brahian How to validate if a variable is empty? 21:15
21:16 r joined
r hi 21:16
21:16 r is now known as Guest47841
Guest47841 i need extract metadata from files with extension .tiff, but i don't now how this 21:16
gfldex brahian: You are likely asking the wrong question. 21:18
m: my $a = Empty; say so $a ~~ Empty; 21:19
camelia rakudo-moar 5476d6: OUTPUT«True␤»
brahian if $a = empty{ say "hola"}; 21:20
gfldex We do have Empty but it doesn't indicate a uninitialised variable
jnthn Probably !$a.defined
skids Yeah, we have quite a full assortment of ways to be empty.
gfldex docs.perl6.org/language/typesystem...efinedness
Guest47841 if $a eq Any 21:21
gfldex m: my $a; without $a { say ‚hola‘ }
camelia rakudo-moar 5476d6: OUTPUT«hola␤»
brahian thank you :D 21:23
21:24 kurahaupo__ left 21:26 labster left 21:30 lukaramu left
masak .oO( who needs $a anyway... ) 21:37
21:37 zakharyas left 21:40 PapaChub joined, lukaramu joined
PapaChub p6: (^10000).pick 21:40
camelia ( no output )
PapaChub p6: say (^10000).pick 21:41
camelia rakudo-moar 5476d6: OUTPUT«5122␤»
PapaChub p6: say (^1e5).pick
camelia rakudo-moar 5476d6: OUTPUT«39329␤»
PapaChub I was astonished by how much slower the latter was...
psch m: say (0..1e5).pick; say now - INIT now 21:42
camelia rakudo-moar 5476d6: OUTPUT«56654␤6.3638192␤»
psch m: say (0e0..1e5).pick; say now - INIT now
camelia rakudo-moar 5476d6: OUTPUT«16176␤0.27731498␤»
jnthn Probably because 1e5 is a floating point number
PapaChub strokes beard...
psch PapaChub: ^ has an implicit 0.Int as starting point, and mixing types is slow with infix:<..>
gfldex m: if .defined { say ‚hola‘ }
camelia ( no output )
psch m: say (0..100000).pick; say now - INIT now
camelia rakudo-moar 5476d6: OUTPUT«2140␤0.0022122␤»
psch though pure Int is still notably faster... 21:43
jnthn I think .pick on Range only has the special case for integer endpoints too
psch PapaChub: we have that recording as a PERF ticket, fwiw
s/ing/ed/
PapaChub psch++
lizmat yes, int ranges are optimized
jnthn Meaning it's actually genreating the the list in memory
*generating
And then picking out of it
It's still astoundingly slow even for doing those two suboptimal things
PapaChub m: say (^1e5.Int).pick; say now - INIT now 21:44
camelia rakudo-moar 5476d6: OUTPUT«98086␤0.00309961␤»
psch jnthn: i mean, it's generating, coercing, unbox, comparing, boxing again
PapaChub ?lightbulb?
jnthn psch: Presumably :)
psch jnthn: i'm not sure that's not enough to justify the slowdown, but it surely sounds a lot
jnthn I *think* it also uses cmp
psch s:2nd/not//
21:44 Tonik left
jnthn And cmp on Numeric types that aren't the same then probably coerces them both to Num 21:45
psch PapaChub: .Int binds to 1e5 there, so yeah, you get the fastest path
jnthn Well, we could always stop guesing and feed it to the profiler :P
psch jnthn: proobably just points at &SEQUENCE :)
oh, actually all that inclusive and all stuff... 21:46
i think the profiler is probably smarter than that
m-profile: ^1e5.pick
jnthn It actually doesn't
psch forgets if that actually works like that
jnthn (use sequence)
psch ah shucks, is that infix:<...>..?
jnthn Oh wow 21:47
It actually hits a multi-dispatch slow path too
psch ah, okay
jnthn Thus missing the cache
And so a ton of time goes on that
psch that's probably the bit that isn't explained by boxing and so on
i'd even assume it's more significant than boxing stuff
'cause 0e0..1e5 probably hits some boxing too, no?
jnthn Yeah, it is, it's hugely costly 21:48
On === apparently
21:48 rburkholder joined
psch huh 21:48
jnthn Oh... 21:49
Found it
multi sub infix:<===>(NaN, NaN) { True;
}
That's syntax sugar for
multi sub infix:<===>($ where NaN, $ where NaN) { True; }
psch ohh
jnthn And for any Num case - which is what we have - it will always have to check that this candidate doesn't apply before hitting the normal one 21:50
Meaning the result is uncacheable
Which is why it's so costly
21:51 pyrimidine joined
psch hm, moving that into the proto might help i suppose? 21:52
babydrop oh-ohs
psch the NaN, NaN check that is
nine use v6.c; will always work and will give you 6.c semantics.
oops...stale backlog
babydrop I only recently realized the literals get translated to wheres
psch but i don't think that's a great optimization technique... :)
babydrop And I stuck a bunch of those in core over the past couple of months
I guess I know what I'm doing this weekend 21:53
psch ...drink and cry? :P
babydrop even that NaN may be mine
Nah, fix all my crap :)
jnthn psch: I'd just move it into the multi candidates for (Num,Num) and (num,num)
psch jnthn: right, that's probably more sensible
jnthn: depending on whether we could potentially figure out a way to cache this dispatch case 21:54
(which, well, *i* am not going to do :) )
jnthn m: my num $a = NaN; my num $b = NaN; say $a === $b
camelia rakudo-moar 5476d6: OUTPUT«False␤»
jnthn m: my Num $a = NaN; my Num $b = NaN; say $a === $b
camelia rakudo-moar 5476d6: OUTPUT«True␤»
jnthn We also have that bug
babydrop :o
psch oh geez
jnthn Because num is tighter than Num
babydrop clicks the invisible Take button
jnthn :) 21:55
Feel free, I've just about got the energy to look at profiler output, but not sure twiddling the code :-)
PapaChub m: sub xyz { 42 }; say xyz; 21:59
camelia rakudo-moar 5476d6: OUTPUT«42␤»
PapaChub m: sub Foo::xyz { 42 }; say Foo::xyz;
camelia rakudo-moar 5476d6: OUTPUT«Could not find symbol '&xyz'␤ in block <unit> at <tmp> line 1␤␤Actually thrown at:␤ in block <unit> at <tmp> line 1␤␤»
PapaChub Is there a simple way to DWIM, there?
babydrop DWIM being what? Define a sub in some other package? 22:00
psch m: sub Foo::xyz { 42 }; say MY::.keys
camelia rakudo-moar 5476d6: OUTPUT«($=pod !UNIT_MARKER &Foo::xyz EXPORT $_ $! ::?PACKAGE GLOBALish $¢ $=finish $/ $?PACKAGE)␤»
psch well, it gets installed correctly
not sure how you can reach it though
babydrop add an our
psch m: sub Foo::xyz { 42 }; say ::<Foo::xyz>()
camelia rakudo-moar 5476d6: OUTPUT«Cannot find method 'Nil' on object of type List␤ in block <unit> at <tmp> line 1␤␤»
psch m: sub Foo::xyz { 42 }; say ::<Foo::xyz>[0]()
camelia rakudo-moar 5476d6: OUTPUT«Cannot find method 'Nil' on object of type List␤ in block <unit> at <tmp> line 1␤␤»
babydrop before the the sub 22:01
psch m: sub Foo::xyz { 42 }; say ::('Foo::xyz')()
camelia rakudo-moar 5476d6: OUTPUT«No such symbol 'Foo::xyz'␤ in block <unit> at <tmp> line 1␤␤Actually thrown at:␤ in block <unit> at <tmp> line 1␤␤»
psch m: our sub Foo::xyz { 42 }; say ::('Foo::xyz')()
camelia rakudo-moar 5476d6: OUTPUT«No such symbol 'Foo::xyz'␤ in block <unit> at <tmp> line 1␤␤Actually thrown at:␤ in block <unit> at <tmp> line 1␤␤»
psch babydrop: it's in MY::
babydrop Oh, I thought you meant it installed into another package correctly
psch m: module Foo { our sub xyz { 42 } }; say MY::.keys
camelia rakudo-moar 5476d6: OUTPUT«($=pod !UNIT_MARKER EXPORT $_ $! Foo ::?PACKAGE GLOBALish $¢ $=finish $/ $?PACKAGE)␤»
psch m: module Foo { our sub is export xyz { 42 } }; import Foo say MY::.keys
camelia rakudo-moar 5476d6: OUTPUT«5===SORRY!5=== Error while compiling <tmp>␤Missing block␤at <tmp>:1␤------> 3module Foo { our sub is7⏏5 export xyz { 42 } }; import Foo say MY:␤ expecting any of:␤ new name to be defined␤»
psch m: module Foo { our sub is export xyz { 42 } }; import Foo; say MY::.keys
camelia rakudo-moar 5476d6: OUTPUT«5===SORRY!5=== Error while compiling <tmp>␤Missing block␤at <tmp>:1␤------> 3module Foo { our sub is7⏏5 export xyz { 42 } }; import Foo; say MY␤ expecting any of:␤ new name to be defined␤»
jnthn m: our sub Foo::xyz { 42 }; say Foo::xyz; # curious if this works 22:02
camelia rakudo-moar 5476d6: OUTPUT«Could not find symbol '&xyz'␤ in block <unit> at <tmp> line 1␤␤Actually thrown at:␤ in block <unit> at <tmp> line 1␤␤»
babydrop
.oO( I guess there's different WIM in here....)
psch isn't sure either what's meant
i mean
intuitively i'd want the declaration to failparse
Guest47841 rakudo
psch m: module Foo { our sub xyz is export { 42 } }; import Foo; say MY::.keys
camelia rakudo-moar 5476d6: OUTPUT«($=pod !UNIT_MARKER EXPORT $_ $! Foo ::?PACKAGE GLOBALish $¢ &xyz $=finish $/ $?PACKAGE)␤»
psch anyway, the import puts it as &xyz 22:03
m: module Foo { our sub xyz { 42 } }; say MY::.keys
camelia rakudo-moar 5476d6: OUTPUT«($=pod !UNIT_MARKER EXPORT $_ $! Foo ::?PACKAGE GLOBALish $¢ $=finish $/ $?PACKAGE)␤»
PapaChub m:package Foo { our sub xyz { 42 } }; say Foo::xyz;
psch not importing it doesn't put it in MY::
PapaChub m: package Foo { our sub xyz { 42 } }; say Foo::xyz;
camelia rakudo-moar 5476d6: OUTPUT«42␤»
brahian I need to pass code from php to perl 6, I want to know if there is an equivalent to $ this?
$this?
psch brahian: probably 'self'
PapaChub That's what *I* mean, anyway... I just thought the "package {}" wrapper was a little superfluous 22:04
22:04 bjz joined
psch PapaChub: no, it's not, but it probably should complain if you put a longname behind a declarator 22:04
22:04 domidumont joined, skids left
psch m: my $Foo::bar = 1; 22:04
camelia ( no output )
psch ...i think?
jnthn It should complain, I think 22:05
Unless you wrote "our sub ..." and then it could go and stuff it in a package, vivifying it for you
psch huggable: rakudobug
huggable psch, [email@hidden.address] or use perl6 query on rt.perl.org ; see github.com/rakudo/rakudo/#reporting-bugs
jnthn our-scoped subs are not so common in Perl 6 generally, though
psch PapaChub: ^^^ if you're willing, please report this, with the caveat added by jnthn++
jnthn (And since the default is my, then a my-scoped sub with a package name makes no sense)
(Unless we make the my mean "and create a lexical package", but that's a tad odd too :)) 22:06
22:10 domidumont left
brahian psch: Thanks if it worked 22:12
PapaChub I'm probably just bringing old [bad] habits and assumptions along... If I have a Foo.pm with "class Foo::Noun { has $.value }", then Foo::Noun "shows up" in my MAIN, but "our sub Foo::verb { ... }" does not. 22:15
babydrop Guest47841: have you checked the ecosystem yet for a module? modules.perl6.org
Guest47841: what kind of information?
psch PapaChub: i can't make sense of that, i'd like a full code sample in a pastebin somewhere please :) 22:16
22:17 setty1 joined
babydrop Guest47841: you can also use modules from metacpan.org/ via Inline::Perl5 ( github.com/niner/Inline-Perl5 ) 22:18
dalek c: 37d0646 | samcv++ | doc/Type/Cool.pod6:
Add `uniprop` documentation
synopsebot6 Link: doc.perl6.org/type/Cool
22:19 TEttinger joined 22:20 zacts joined 22:23 lucasb left
samcv hmm regarding uniprop. the raw unicode property uses 0/1 for false/true. would it make more sense for perl6 to return true/false for true false values? 22:25
don't see anything in roast testing that it returns an into or anything or testing the type returned by uniprop
m: say 'a'.uniprop('Alphabetic')
camelia rakudo-moar 5476d6: OUTPUT«1␤»
samcv m: say 'a'.uniprop('Alphabetic').Bool
camelia rakudo-moar 5476d6: OUTPUT«True␤»
psch i suppose that could box, yes
samcv yeah not all the returns are 1/0, a lot of them are strings 22:26
psch well, then it can't
jnthn There's also numeric properties that have a wider range of integers
psch if there's properties that don't return 0/1 it cannot box to Bool
*"0 or 1"
jnthn I think (don't remember the code exactly) it is able to figure out if the prop is int based of str based 22:27
So it can return an Int or a Str
samcv userguide.icu-project.org/strings/properties well this has a list on which is binary
jnthn *or
psch ah, yes
jnthn Right, if we're going to do it, we'd have to have such a list to consult
psch switches on S, I, B
samcv: those could box to Str, Int, Bool respectively 22:28
not sure about the default case there though :)
jnthn Oh, we already switch on Bool?
Curious
psch jnthn: well, there's nqp::getuniprop_{int,str,bool}
jnthn yeah, just found them :) 22:29
samcv ah so we already have something that will return an int, str or bool?
most of the returns are bool. and only like 2 or 3 return numbers that aren't bools and the rest strings 22:30
jnthn Oddly, I don't see us ever poking a B into that table
Anyway, I'm good with binary props returning Bool 22:31
m: say Bool ~~ Int
camelia rakudo-moar 5476d6: OUTPUT«True␤»
jnthn And thanks to that, we won't break any existing code that has type constraints around the result
But I think it'll need us to keep a list 22:33
(of which props are binary)
22:33 RabidGravy left
samcv is it better to keep a list of which are binary, or a list of ones that are integers. or would that not work 22:33
since all but 3 are either strings or bool 22:34
and only 3 are actual numbers
about 3 maybe a few more, but not that many of them
jnthn I fear keeping a list on which ones are non-binary and assuming the rest are binary will come back to bite us if new props are introduced 22:35
(Which new versions of Unicode are free to do)
22:35 labster joined
jnthn state %prefs; # could prepopulate this with various prefs 22:35
I'd go the path of pre-poulating it with the ones we know
samcv yeah
MasterDuke jnthn: a while ago i asked about where clause performance and you mentioned methods with wheres weren't cached (and pointed me to where that could be implemented). would implementing that have helped the "multi sub infix:<===>(NaN, NaN)" performance? 22:36
22:36 travis-ci joined
travis-ci Doc build failed. Samantha McVey 'Add `uniprop` documentation' 22:36
travis-ci.org/perl6/doc/builds/182733730 github.com/perl6/doc/compare/f977d...d0646eb4f3
22:36 travis-ci left
jnthn MasterDuke: It would have made things less bad, but only somewhat 22:36
MasterDuke: So yes, it'd help, but not to the degree the suggested fix would
samcv uhm why did that build fail? 22:37
jnthn samcv: One other issue with the state var there is that it could cause us thread safety headaches
samcv: So we may just want to have a my constant %prefs = <put a table here>;
samcv for which type they should be? 22:38
jnthn And then for the ones we don't have in the table, just do the thing in default
samcv ah k
jnthn But don't update a prefs
MasterDuke jnthn: of course, your mention of wheres and caches just triggered my memory
jnthn Yeah, that's still worth doing
samcv should I make a list of all of them?
jnthn Yes, I think that'd be the best option. 22:39
samcv ok i'll do that
jnthn Nice, thanks.
22:39 cdg_ left
MasterDuke psch: i took a look at the method cache code jnthn pointed me to, but it never clicked for me, but you might have better luck 22:40
PapaChub Poor man's pastebin: dabe.com/misc/perl6-class_method.html
jnthn From the comments in that bit of code, I get the impression it was written with the intention of being improved.
psch PapaChub: sub is 'my' scoped by default
PapaChub "our" doesn't help
psch PapaChub: also you're still doing that "put a long-name behind the declarator" thing 22:41
jnthn PapaChub: Just to check: you know that you can write "our sub x P { }" inside of the class body too?
PapaChub My point is probably more that I was just "astonished" that it didn't Do What I Meant
jnthn (subs can live in classes too, not only methods)
psch PapaChub: right, which is we i asked you to submit a ticket that declarators erroneously allow longnames :) 22:42
s/we//
PapaChub :)
psch PapaChub: the general suggestion is to start a module file with the file-scope declarator 22:44
PapaChub: i.e. 'unit package Foo;' afair
samcv also i don't think that travis build failure was my fault? or maybe it was, but it properly processed the Cool doc file 22:47
psch samcv: fwiw, docs travis seems flakey from where i'm standing
samcv: i think there's something async-y in there that doesn't always work? maybe sockets..?
samcv: don't take my word for it though, i hardly ever push docs :) 22:48
samcv hah k
PapaChub In my case, it's more like a module made up of a handful of component classes (think Foo::Person, Foo::Company). Basically I just wanted to add a "Foo::start" function to orchestrate them. 22:49
psch PapaChub: right, so do 'module Foo; class Person { ... }; class Company { ... }; sub start(...) is export { ... }' 22:50
PapaChub: or, instead of 'is export' do 'our sub start ...' 22:51
PapaChub (AND I didn't want to pollute my caller's namespace with the start)
psch PapaChub: just don't do 'declarator longname', i.e. 'sub Foo::start'
PapaChub: because that wrongly doesn't die
PapaChub So is there an argument why "sub A::B {...}" SHOULDN'T be the same as "&A::B = sub {...}" 22:52
psch PapaChub: it's a bug that it parses in the first place, it doesn't make sense
jnthn Because sub in Perl 6 really means "my sub" not "our sub"
psch PapaChub: the latter makes more sense
and 'our sub $longname' working is just asking for spooky action at a distance 22:53
jnthn psch: I think I could cope woth "our sub $longname" working, fwiw
psch jnthn: well, i'll readily defer to you, but it feels really spooky to me :)
PapaChub "&A::B" is just as spooky, no? 22:54
jnthn Well, yeah. Culturally, we just don't really put subs in packages much in Perl 6
PapaChub: fwiw you don't actually have a namespace pollution issue with subs in the mainline of your module, because unless you write "our sub" then it's lexically scoped.
m: { sub foo() { }; }; foo() # won't work
camelia rakudo-moar 5476d6: OUTPUT«5===SORRY!5=== Error while compiling <tmp>␤Undeclared routine:␤ foo used at line 1␤␤»
samcv cry.nu/uniprops.txt here are all the unicode props in json. how do you want them formatted psch. also we only seem to recognize the long name of the unicode properties atm 22:55
jnthn m: { sub foo() { }; }; GLOBAL::foo() # still won't work
camelia rakudo-moar 5476d6: OUTPUT«Could not find symbol 'foo'␤ in block <unit> at <tmp> line 1␤␤Actually thrown at:␤ in block <unit> at <tmp> line 1␤␤»
jnthn The more typical way to deal with subs and modules in Perl 6 is to mark them with "is export", and then a "use" will import them lexically.
psch samcv: i'd suggest at what nqp::getuniprop_{str,int,bool} expect
+looking
PapaChub I wanted to explictly qualify "Foo::start"
BTW ??I'm not saying what I *WANT* is at all justified... It's just what a typical switcher is likely to stub their toe on. :-} 22:56
psch m: module Foo { class Bar { }; our sub baz { say $?PACKAGE } }; say Foo::baz
camelia rakudo-moar 5476d6: OUTPUT«(Foo)␤True␤»
jnthn OK, well the `module Foo; class Bar { }; our sub start() { }` appraoch psch suggested would be neater, I think?
psch i mean, it *is* qualified 22:57
and you have to call it qualified
m: module Foo { class Bar { }; our sub baz { say $?PACKAGE } }; Foo::baz; Foo::Bar.new.perl.say
camelia rakudo-moar 5476d6: OUTPUT«(Foo)␤Foo::Bar.new␤»
jnthn But yes, I agree it silently doing nothing sensible with the fully qualified name *and* not giving an error is just asking for people to stub their toe on it and not have a clue what's going on. 22:58
22:58 Guest47841 left
psch the issue, as i see it, is that Perl 5 allows arbitrary additions to any given namespace, which we don't 22:58
*also* we have a bug with longnames after a declarator
jnthn psch: We do with package ;-)
psch m: package Foo { class A { } }; say Foo::A.perl; package Foo { class Bar {} }; say Foo::.keys
camelia rakudo-moar 5476d6: OUTPUT«Foo::A␤(A Bar)␤»
psch ...we do
i actually *am* bad at Perl 6 :P
m: module Foo { class A { } }; say Foo::A.perl; module Foo { class Bar {} }; say Foo::.keys 22:59
camelia rakudo-moar 5476d6: OUTPUT«5===SORRY!5=== Error while compiling <tmp>␤Redeclaration of symbol 'Foo'␤at <tmp>:1␤------> 3ass A { } }; say Foo::A.perl; module Foo7⏏5 { class Bar {} }; say Foo::.keys␤ expecting any of:␤ generic role␤»
psch resists making the post hoc excuse obvious
jnthn :) 23:00
23:01 labster left
PapaChub Thanks, all, for the lively and enlightening discussion! 23:02
23:02 PapaChub left 23:03 pyrimidine left, pyrimidine joined
tailgate m: gist.github.com/ahalbert/748b49d69...3b30bf7396 23:05
camelia rakudo-moar 5476d6: OUTPUT«5===SORRY!5=== Error while compiling <tmp>␤Two terms in a row across lines (missing semicolon or comma?)␤at <tmp>:8␤------> 3say $test.comb ~~ DirectionList7⏏5<EOL>␤ expecting any of:␤ infix␤ infix stopper␤ p…»
tailgate m: gist.github.com/ahalbert/748b49d69...3b30bf7396
camelia rakudo-moar 5476d6: OUTPUT«False␤Internal error: inconsistent bind result␤ in sub dl at <tmp> line 8␤ in block <unit> at <tmp> line 13␤␤»
tailgate how do I properly iterate over a subset of list? 23:06
samcv psch, i'll work on something for rakudo. looks like there's already a %hash that isn't used for doing this exact thing
psch ++samcv :) 23:07
23:08 pyrimidine left 23:13 brahian left 23:14 DarthGandalf joined 23:16 AlexDaniel joined, pmurias left 23:20 DarthGandalf left 23:23 DarthGandalf joined
samcv is there a way for 'Test' to only show incorrect answers? 23:23
before I do this i'm going to make sure nqp has unicode property codes for both short and long names
23:23 rindolf left
samcv err i can just redirect stdout rigth? 23:23
yes :) cool 23:24
23:25 bjz left 23:30 DarthGandalf left
jnthn 'night, #perl6 23:35
samcv looks like ther's some problems in Moar's data on unicode types.
{"jt",25} {"jt",23} are both in the same data structure. no wonder it's causing problems for the tests 23:36
AlexDaniel samcv: what is that you are talking about exactly? 23:38
samcv uniprop 'jt' returns something different than 'Joining_Type'
in perl 6
23:38 DarthGandalf joined
samcv it has two different values in the same datastructure in moar 23:39
{"JT",23},{"jt",23},{"JV",23},{"jv",23} 23:40
so it returns the result for JV instead of JT
timotimo oh, is it time for another advent post? 23:42
is there a review-preview already?
timotimo found it 23:44
23:44 cdg joined
timotimo god damn it, i'm too tired to think straight 23:45
samcv also {"Sc",21},{"sc",21},{"Currency_Symbol",21}, the sc property is the short name for 'Script' 23:46
so there's a few conflicting ones in the same data structure. and unicode property names != unicode general group names 23:47
sc means the Script property, and 23:48
# Sc means the General_Category property value Currency_Symbol (Sc)
yeah ok i think what happened is it was put in in both cases
even though each case means something different
23:54 kyclark left 23:55 DarthGandalf left, bjz joined 23:56 pyrimidine joined 23:57 DarthGandalf joined