Perl 6 - the future is here, just unevenly distributed

IRC log for #perl6, 2017-05-03

Perl 6 | Reference Documentation | Rakudo

| Channels | #perl6 index | Today | | Search | Google Search | Plain-Text | summary

All times shown according to UTC.

Time Nick Message
00:12 BenGoldberg joined #perl6
00:17 Cabanossi joined #perl6
00:39 pierre_ joined #perl6
00:53 r3m joined #perl6
00:57 Actualeyes left #perl6
01:03 mcmillhj joined #perl6
01:14 mcmillhj joined #perl6
01:24 k-man joined #perl6
01:29 mcmillhj joined #perl6
01:37 Geth ¦ ecosystem: CurtTilmes++ created pull request #336: Add DBI::Async to ecosystem
01:37 Geth ¦ ecosystem: review: https://github.com/perl6/ecosystem/pull/336
01:40 xfix joined #perl6
01:48 ilbot3 joined #perl6
01:48 Topic for #perl6 is now »ö« Welcome to Perl 6! | https://perl6.org/ | evalbot usage: 'p6: say 3;' or rakudo:,  or /msg camelia p6: ... | irclog: http://irc.perl6.org or http://colabti.org/irclogger/irclogger_logs/perl6 | UTF-8 is our friend!
01:52 aborazmeh joined #perl6
01:52 aborazmeh joined #perl6
02:00 labster joined #perl6
02:01 mcmillhj joined #perl6
02:17 mcmillhj joined #perl6
02:17 Cabanossi joined #perl6
02:22 grondilu m: class { has Num method foo { rand } }.new.foo.say
02:22 camelia rakudo-moar 701dab: OUTPUT: «0.157018793505413␤»
02:23 grondilu ^TIL new method syntax apparently
02:30 kurahaupo joined #perl6
02:36 mcmillhj joined #perl6
02:53 mcmillhj joined #perl6
03:00 stmuk joined #perl6
03:02 wamba joined #perl6
03:05 dj_goku joined #perl6
03:09 stmuk_ joined #perl6
03:28 pierre_ joined #perl6
03:32 Cabanossi joined #perl6
03:45 pierre_ joined #perl6
03:53 Actualeyes joined #perl6
03:53 kurahaupo joined #perl6
03:56 kurahaupo_ joined #perl6
03:59 pierre_ joined #perl6
04:01 kurahaupo__ joined #perl6
04:02 Cabanossi joined #perl6
04:04 Resol joined #perl6
04:05 kurahaupo joined #perl6
04:08 kurahaupo joined #perl6
04:35 stmuk joined #perl6
04:41 tharkun joined #perl6
04:52 curan joined #perl6
05:08 kurahaupo_ joined #perl6
05:11 Geth ¦ ecosystem: a88b802059 | (Curt Tilmes)++ | META.list
05:11 Geth ¦ ecosystem: Add DBI::Async to ecosystem
05:11 Geth ¦ ecosystem:
05:11 Geth ¦ ecosystem: See https://github.com/CurtTilmes/perl6-dbi-async
05:11 Geth ¦ ecosystem: review: https://github.com/perl6/ecosystem/commit/a88b802059
05:11 Geth ¦ ecosystem: 33b8477a85 | (Juan Julián Merelo Guervós)++ (committed using GitHub Web editor) | META.list
05:11 Geth ¦ ecosystem: Merge pull request #336 from CurtTilmes/master
05:11 Geth ¦ ecosystem:
05:11 Geth ¦ ecosystem: Add DBI::Async to ecosystem
05:11 Geth ¦ ecosystem: Thanks!
05:11 Geth ¦ ecosystem: review: https://github.com/perl6/ecosystem/commit/33b8477a85
05:12 pierre_ joined #perl6
05:14 xtreak joined #perl6
05:17 wamba joined #perl6
05:31 bioexpress joined #perl6
05:32 bioexpress Hello, how could I remove a module from the ecosystem?
05:32 gfldex bioexpress: you send a PR to the ecosystem with the line in question removed
05:33 bioexpress Thx!
05:34 bioexpress What's a PR?
05:35 gfldex pullrequest
05:35 anton_p joined #perl6
05:37 bioexpress Thx
05:41 samcv wow...
05:41 samcv person on libtommath github issue says that i should fork the project and change the LICENSE file
05:42 samcv and show my lawyers my fork with me having changed the license.
05:42 gfldex please don't feed the troll
05:42 samcv yeah cause... that's how things work in the real world. you can just lie about softwares licenses by editing the LICENSE file
05:42 samcv they are a 'Member' :(
05:43 samcv and they think the WTFPL is better than CC0 because it uses less words
05:43 samcv https://github.com/libtom/libtommath/issues/76#issuecomment-298826328 :\
05:48 samcv wow i'm reading the complaints of the maker of WTFPL about CC0 and they're pretty much what the person just posted
05:49 samcv that how did it take them 1000 words to write that they person could use the software however they want. seems sam hocevar misses the point of licenses
05:51 samcv "Your honor, this license is really short. therefore i can't possibly be infringing on any copyright here. this one sentence obviously cannot be interpreted any other way. if the license fits into a small number of words you must acquit""
05:51 samcv said by nobody ever.
05:51 samcv well acutalyl probably not. but. maybe a few peolpe. but they' probably didn't win their cases
05:51 samcv can't say nobody would say that since sam hocevar obviously seems to say exactly that
05:52 Geth ¦ ecosystem: kuerbis++ created pull request #337: Update META.list
05:52 Geth ¦ ecosystem: review: https://github.com/perl6/ecosystem/pull/337
05:53 CIAvash joined #perl6
06:02 Cabanossi joined #perl6
06:04 ufobat joined #perl6
06:04 xinming joined #perl6
06:05 u-ou what does this mean? Cannot resolve caller Numeric(Player+{Wolf}: ); none of these signatures match:
06:05 Geth ¦ ecosystem: 9c7a681e0a | kuerbis++ (committed using GitHub Web editor) | META.list
06:05 Geth ¦ ecosystem: Update META.list
06:05 Geth ¦ ecosystem:
06:05 Geth ¦ ecosystem: Removed Term-Form-p6
06:05 Geth ¦ ecosystem: review: https://github.com/perl6/ecosystem/commit/9c7a681e0a
06:05 Geth ¦ ecosystem: d4225a208f | (Juan Julián Merelo Guervós)++ (committed using GitHub Web editor) | META.list
06:05 Geth ¦ ecosystem: Merge pull request #337 from kuerbis/master
06:05 Geth ¦ ecosystem:
06:05 Geth ¦ ecosystem: Update META.list
06:05 Geth ¦ ecosystem: Thanks for the submission. Why did you remove it?
06:05 Geth ¦ ecosystem: review: https://github.com/perl6/ecosystem/commit/d4225a208f
06:06 samcv u-ou, can paste full error?
06:06 gfldex u-ou: it means that neither Player nor Wolf got a Numeric method to turn it into a number. You likely used an operator that requires a number.
06:07 u-ou there's only one more line:     (Mu:U \v: *%_)
06:09 domidumont joined #perl6
06:09 u-ou that's weird. it happens when I compare an array of them's .elems with <
06:09 u-ou but that shouldn't try to turn any of them into a number
06:15 domidumont joined #perl6
06:17 xinming joined #perl6
06:19 xtreak joined #perl6
06:21 xtreak joined #perl6
06:22 samcv so it's $wold.elems < 10
06:22 samcv or something like that?
06:22 samcv could always add a Numeric method \-/ shrug
06:23 itaipu joined #perl6
06:26 sammers hi all
06:32 u-ou it happens without that line, too, so it seems to be happening in the background. I will post it on github sometime to show you if I can't work it out.
06:33 xtreak joined #perl6
06:33 u-ou the program is across many files
06:42 lowbro joined #perl6
06:42 lowbro joined #perl6
06:55 lizmat joined #perl6
06:56 wamba joined #perl6
07:00 xtreak joined #perl6
07:14 xtreak joined #perl6
07:19 espadrine_ joined #perl6
07:29 nadim joined #perl6
07:46 pierre_ joined #perl6
07:46 xtreak joined #perl6
07:50 labster joined #perl6
07:53 darutoko joined #perl6
07:55 parv joined #perl6
08:03 wamba joined #perl6
08:07 zakharyas joined #perl6
08:08 nadim joined #perl6
08:09 domidumont joined #perl6
08:11 mcmillhj joined #perl6
08:15 bjz joined #perl6
08:17 Cabanossi joined #perl6
08:20 dakkar joined #perl6
08:27 mcmillhj joined #perl6
08:31 jonas1 joined #perl6
08:47 Cabanossi joined #perl6
08:56 rindolf joined #perl6
09:02 pierre_ joined #perl6
09:13 Ven joined #perl6
09:23 john51_ joined #perl6
09:23 rindolf joined #perl6
09:25 kurahaupo_ joined #perl6
09:39 xtreak joined #perl6
09:45 AlexDani` joined #perl6
09:46 Actualeyes joined #perl6
09:47 Cabanossi joined #perl6
09:52 pierre_ joined #perl6
09:55 Ven joined #perl6
09:57 AlexDani` joined #perl6
10:02 kurahaupo` joined #perl6
10:07 salva joined #perl6
10:11 Ven_ joined #perl6
10:17 bjz_ joined #perl6
10:34 ChoHag joined #perl6
10:37 nadim good morning, a few questions about named arguments. s(:argument) would set argument to True, how is is set to false?  named arguments can be :argument(values), is it possible to write argument:value someway?
10:37 moritz nadim: s(:!argument) sets it to False
10:37 moritz argument:value isn't supported, argument => value is
10:43 nadim moritz: thanks, I always forget about :! . Just  to satisfy my curiosity, apart the fact that we had fat commas in P5, do you know if and why argument:value was a candidate?
10:43 moritz nadim: no, my historic knowledge doesn't stretch that far back
10:45 timotimo speaking from a "right now" standpoint, argument:value doesn't work because there could be a sub named &argument:value
10:45 timotimo m: sub argument:value { say "not what you wanted" }; sub takes-named-argument(*@, :$argument) { say "$argument" }; takes-named-argument(argument:value)
10:45 camelia rakudo-moar 91fb30: OUTPUT: «not what you wanted␤Use of uninitialized value $argument of type Any in string context.␤Methods .^name, .perl, .gist, or .say can be used to stringify it to something meaningful.␤  in sub takes-named-argument at <tmp> line 1␤␤»
11:00 nadim joined #perl6
11:02 Cabanossi joined #perl6
11:11 bjz joined #perl6
11:23 xiaomiao joined #perl6
11:28 xinming joined #perl6
11:47 Cabanossi joined #perl6
11:57 abraxxa joined #perl6
11:59 AlexDaniel freaking pulseaudio… why is everything so clicky
12:00 timotimo it's not getting enough cpu time?
12:00 AlexDaniel it happens whenever something changes
12:00 AlexDaniel e.g. if I change the volume, or I start something else
12:01 timotimo when i play synthesia and have qsynth on, i need to give qsynth and pulseaudio a lower nice value otherwise it'll go into crackly-staticy mode every minute or two
12:01 timotimo (synthesia on wine is a performance trainwreck)
12:01 AlexDaniel while I can ignore these occasional clicks, I can't understand why the hell would I experience this in 2017
12:01 timotimo it's got a little animation in the mode select menu where little circles go 'round a button and it chews through cpu like nobodys business
12:02 AlexDaniel thing is, I can just uninstall pulseaudio and things will go back to normal
12:02 AlexDaniel except that I'd have to find a different web browser
12:02 AlexDaniel fucking hell…
12:05 ChoHag joined #perl6
12:06 daxim joined #perl6
12:06 itaipu joined #perl6
12:11 Ven joined #perl6
12:21 rindolf joined #perl6
12:24 raschipi joined #perl6
12:25 Ulti found a little bug in the docs.perl6.org it doesnt URL encode/decode search strings so you can get something like https://docs.perl6.org/routine/%% as a bad request
12:25 Ulti what repo has that stuff in?
12:26 Ulti is it just perl6/doc
12:26 AlexDaniel Ulti: yes
12:27 Ven_ joined #perl6
12:27 Ulti k k
12:27 Ulti will take a look
12:29 Ven_ joined #perl6
12:34 wamba joined #perl6
12:41 Voldenet I've got some perl5 code, what's the simplest way (modules would be nice) to make it perl6-friendly: http://ix.io/szS
12:41 Voldenet I'm thinking of using HTTP::Server::Async
12:41 timotimo yeah, your code currently looks like a cgi script
12:42 Voldenet Yeah, it's a pretty much a trivial cgi script.
12:42 Voldenet s/a pretty much/pretty much/
12:42 timotimo painful how much boilerplate it has, but other than the boilerplate it uses no modules at all
12:42 Voldenet welp, that's cgi for you :P
12:43 timotimo still better than "use CGI"
12:43 Voldenet Yeah, sadly
12:43 Ulti probably narrowed it down to https://github.com/perl6/doc/blob/eaa4d3ddeb50d5fd44f0803edc6bd7e304d8b7b4/htmlify.p6#L765 needing to replace % with %25 not just the \ to %5c really just put in a full percent encode maybe
12:43 haxmeister joined #perl6
12:45 mcmillhj joined #perl6
12:45 Ulti weird URI escape should be doing all this
12:45 Ulti hmmm
12:45 pierre_ joined #perl6
12:46 Ulti aha! %2525
12:46 Ulti heh
12:46 Voldenet Hm, I guess using perl6 with cgi is a really bad idea, because of script compilation time
12:48 timotimo yeah, there's way better ways to go about this
12:48 Voldenet I could just use fcgi or http
12:48 domidumont joined #perl6
12:48 Voldenet Well, http has less code smell, that's for sure
12:49 Voldenet but I wonder how does HTTP::Server::Async compare to nginx
12:49 timotimo i usually install services behind a mod_proxy-alike
12:51 Voldenet mod_proxy http or mod_proxy fcgi?
12:51 timotimo http
12:52 timotimo we do have SCGI or something, though?
12:55 Voldenet hm, gonna do some ab on the http to compare
12:59 Voldenet hmm nginx: Requests per second:    38372.99 [#/sec] (mean), HTTP::Server::Async: Requests per second:    36.97 [#/sec]
13:00 tyil thats
13:00 Voldenet :(
13:00 tyil a slight difference
13:00 timotimo yup
13:01 moritz in both cases talking to a database likely exceeds the offset from the web server
13:01 Voldenet Unless you're serving static content as well
13:02 moritz right, but you'd configure your web server to do that in any realistic production scenario
13:02 timotimo yeah, always use a proper file server to serve static content
13:02 Cabanossi joined #perl6
13:02 timotimo er
13:02 timotimo web server
13:02 Voldenet Well, it makes sense to proxy only dynamic api requests to the dynamic server.
13:02 moritz that's the advice even if using a rather mature app server, like p5/mojolicious/hypnotoad
13:03 Voldenet but then, nginx + cgi: Requests per second:    261.31 [#/sec] (mean)
13:04 Voldenet hmmm, 40 rq/s on dedicated http server does not sound very realistic
13:06 haxmeister I have a question regarding this statement
13:06 haxmeister By separating identifiers with double colons, the right most name is inserted into existing or automatically created packages.
13:07 haxmeister does that mean if I use the double colon syntax when there are no packages other than the main file.. it will create a namespace/package that matches my identifier?
13:09 Voldenet Okay, I've used HTTP::Server::Tiny and it does 260rq/s - it's better
13:11 Voldenet haxmeister: I think it means that you don't have to create 3 folders and 3 files per folder, just 3 folders and the module when it should be
13:11 Voldenet so A::B::C::D would require only A/B/C/D.pm6
13:11 Voldenet and the A A::B A::B::C would be autogenerated
13:12 haxmeister ugh.. I'm lost in that.. I need to read more, I don't seem to understand the usage and intent of addressing external files/modules this way
13:12 Ulti haxmeister: what language have you come from?
13:13 haxmeister last language I studied was lisp
13:13 eliasr joined #perl6
13:13 Ulti ahh I dont even know how name spacing of things works in lisp :S
13:13 haxmeister before that scheme, object pascal, C++ and C..
13:13 haxmeister but only intermediate skill level.. I just like studying languages, with a particular affinity for perl
13:13 Ulti well C is similar since the include is just / for the same idea less the strict name spacing it also implies
13:14 Voldenet haxmeister: it's similar to what C++ would do
13:14 Voldenet #include <boost/regex.hpp> -> use boost::regex
13:14 haxmeister so the colons are directory markers?
13:15 Voldenet I'm not 100% sure, but they sure are used that way in modules
13:15 haxmeister ok that is helpful
13:15 Ulti haxmeister: doesnt have to be
13:15 timotimo if you have a meta6.info, you can have the files organized in any way you like and only the "provides" hash is used
13:15 haxmeister oh I'm not ready for that timotimo ..lol
13:15 timotimo no problem
13:15 Voldenet Basically "you can arrange that differently, but most people don't" :)
13:16 haxmeister this tut gave the example my Int $Foo::Bar::buzz = 42;
13:16 Ulti haxmeister: you could put it all in a single file if you really wanted to since you have to fully qualify the namespace anyway even with the directory structure
13:16 cdg joined #perl6
13:17 haxmeister in that example we are creating a variable named what in what namespace location?
13:17 yht joined #perl6
13:17 Ven joined #perl6
13:17 Ulti $buzz in Foo::Bar is being set to 42 ?
13:18 Ulti isnt this literally the example from the docs on namespacing that tells you what thats doing...
13:19 Ulti haxmeister: https://docs.perl6.org/language/packages is this what you were reading?
13:20 Ulti haxmeister also unless you know why you are writing something like $Foo::Bar::buzz = 42 its *very* unlikely you want to be
13:35 haxmeister I guess it confused me because the $Foo is on the left, when I thought of Bar::buzz as the package/namespace... seemed like it should be Bar::buzz::$foo
13:36 haxmeister I suppose I need to think of it as "from" instead of "in".. then the phrase kinda reads right
13:36 timotimo you're allowed to put the $ there, too, i believe
13:37 haxmeister so Bar::buzz::$Foo would be the same as $Foo::Bar::buzz ?
13:37 timotimo try it out
13:37 timotimo (not for declaration, though)
13:42 haxmeister Ulti: I'm perusing https://docs.perl6.org/language/syntax right this second.. I've written a small program to recurse through some folders for certain files in perl6 but I need to learn to use more features like understanding the colon syntaxes that are used in several constructs
13:42 anton_p joined #perl6
13:46 titsuki joined #perl6
13:55 moritz haxmeister: http://design.perl6.org/S02.html#Adverbial_Pair_forms has a summary of the diferent colonpair forms
14:03 haxmeister ty moritz
14:03 haxmeister trying to make some functions that have type restraints right this second
14:03 haxmeister my first try must show my ignorance sub SFM(Num $rpm, Num $dia )
14:04 haxmeister perl6 will not upgrade an int to a num..
14:04 Ulti Bar::buzz::$Foo  <--- does that not resolve $Foo for the string value to resolve as the actual symbol?
14:05 timotimo yeah, you'll want "Real" instead of "Num"
14:05 timotimo that'll give you any real number
14:05 timotimo if you also accept complex numbers, use "Numeric"
14:05 haxmeister so to get floating point numbers I'll use Real not Num?
14:06 Voldenet I suggest using `Rat` instead
14:07 Voldenet but welp Real is a role, right?
14:07 haxmeister lol.. that's why it's not clear to me, the documentation for types suffers the same lack of clarity
14:07 timotimo Real is a role that is done by all real numbers. Int, Num, Rat.
14:07 timotimo m: say Int ~~ Real; say Num ~~ Real; say Rat ~~ Real; say Complex ~~ Real;
14:07 camelia rakudo-moar 91fb30: OUTPUT: «True␤True␤True␤False␤»
14:07 Voldenet haxmeister: look at the bottom, there's a type graph https://docs.perl6.org/type/Numeric
14:08 haxmeister ok
14:08 moritz Real is a good type constraint when work with real numbers :-)
14:09 haxmeister that picture is loosing this noob..
14:10 timotimo that shows you what is considered Rational, Real, or Numeric
14:10 timotimo Rational is just Rat and FatRat
14:10 timotimo Real is anything that's Rational, Instant, Duration, Int, or Num
14:10 timotimo and Numeric is anything that's Real, or Complex
14:12 haxmeister ok.. smart way to pass to literal ints 313 and 5 to a sub that only accepts a float.(which is not a type I see in perl6).. and have that upgrade happen
14:12 haxmeister s/pass to/pass two
14:13 timotimo you can 313.Num
14:14 haxmeister sub SFM(Num $rpm, Num $dia )
14:14 haxmeister SFM(318, 3);
14:14 timotimo no, SFM(318.Num, 3.Num)
14:14 haxmeister I misunderstood Num for one thing
14:14 timotimo if they are literals, just write them SFM(318e0, 3e0)
14:15 haxmeister these functions will be part of a program that prompts user input
14:16 haxmeister so need to learn to have the SFM function type protected and user input type checked.. that's my learning goal
14:16 Voldenet I guess 'Numeric' role would work here
14:17 Voldenet but you can use Numeric, Real or Rational roles depending on what you want to achieve
14:17 haxmeister sheesh.. I guess I need understand "role" types a little before I try to do typed math
14:17 MasterDuke_ haxmeister: coercers might also be of interest
14:18 haxmeister lol.. you guys
14:18 Voldenet haxmeister: if you did some C++ (i see you did), then roles in this case are pretty much similar to abstract classes
14:18 MasterDuke_ m:  sub a(Num() $a, Num() $b){say "$a, $b"}(1.Int, 2.Int)
14:18 camelia rakudo-moar 91fb30: OUTPUT: «1, 2␤»
14:18 MasterDuke_ the .Int was just to make it obvious that the Num() coercer was doing something
14:19 haxmeister yah MasterDuke_ I have no idea how to read or use a sub with all that at this point
14:20 Voldenet huh, any docs on coercers?
14:20 MasterDuke_ i think the only thing a little out of the ordinary there are the `Num()`. putting the parens on the end essentially calls .Num on whatever is called
14:21 MasterDuke_ https://docs.perl6.org/syntax/Coercion%20Type has something
14:21 Voldenet m: sub test($x){ "Coerced $x" }; sub test-two(test() $y){ say $y; }; test-two(2);
14:21 camelia rakudo-moar 91fb30: OUTPUT: «5===SORRY!5=== Error while compiling <tmp>␤Invalid typename 'test' in parameter declaration.␤at <tmp>:1␤------> 3t($x){ "Coerced $x" }; sub test-two(test7⏏5() $y){ say $y; }; test-two(2);␤»
14:21 Voldenet figured it's not that magical
14:21 haxmeister I get the coercion.. I don't understand properly what numbers should be typed as Num compared to Rat..etc
14:22 haxmeister it's a lot of number based types...
14:22 Voldenet haxmeister: understanding the type graph is a key... :)
14:22 Voldenet haxmeister: basically, Numeric is Real + Complex
14:22 moritz haxmeister: Num are floating-point numbers
14:22 moritz haxmeister: and Rat are fractions
14:22 Voldenet Real is Rational + Int + Num + Duration + Instant
14:22 moritz haxmeister: in Perl 6, if you write 2.1, that's a Rat
14:22 Voldenet and so on
14:24 haxmeister 2.1 is a fraction?
14:24 haxmeister because it looks like a float to me.. :/
14:25 huf it's 21/10, surely
14:25 haxmeister thank you all for being patient.. I really like perl6 but it's a big package coming in
14:25 moritz haxmeister: only with scientific notation (2.1e0) is it a Num/float in Perl 6
14:25 haxmeister ok
14:25 haxmeister I have to think about that for a minute
14:25 timotimo aye, perl6 is trying to prevent you from shooting yourself in the foot
14:25 Voldenet contrary to perl5
14:25 Voldenet ;-)
14:26 timotimo m: my $num = 0.0; while $num != 1.0 { .say; $num += 0.1 }
14:26 camelia rakudo-moar 91fb30: OUTPUT: «(Any)␤(Any)␤(Any)␤(Any)␤(Any)␤(Any)␤(Any)␤(Any)␤(Any)␤(Any)␤»
14:26 timotimo hah
14:26 timotimo m: my $num = 0.0; while $num != 1.0 { $num.say; $num += 0.1 }
14:26 camelia rakudo-moar 91fb30: OUTPUT: «0␤0.1␤0.2␤0.3␤0.4␤0.5␤0.6␤0.7␤0.8␤0.9␤»
14:26 timotimo m: my $num = 0.0e0; while $num != 1.0e0 { $num.say; $num += 0.1e0 }
14:26 camelia rakudo-moar 91fb30: OUTPUT: «(signal XFSZ)0␤0.1␤0.2␤0.3␤0.4␤0.5␤0.6␤0.7␤0.8␤0.9␤1␤1.1␤1.2␤1.3␤1.4␤1.5␤1.6␤1.7␤1.8␤1.9␤2␤2.1␤2.2␤2.3␤2.4␤2.5␤2.6␤2.7␤2.8␤2.9␤3␤3.1␤3.2␤3.3␤3.4␤3.5␤3.6␤3.7␤3.8␤3.9␤4␤4.1…»
14:27 Voldenet m: my $num = 0.0e0; while $num 1.0e0 ~~ 1.0e0 { $num.say; $num += 0.1e0 }
14:27 camelia rakudo-moar 91fb30: OUTPUT: «5===SORRY!5=== Error while compiling <tmp>␤Missing block␤at <tmp>:1␤------> 3my $num = 0.0e0; while $num7⏏5 1.0e0 ~~ 1.0e0 { $num.say; $num += 0.1e␤    expecting any of:␤        block or pointy block␤        infix␤        infix st…»
14:27 Voldenet m: my $num = 0.0e0; while $num ~~ 1.0e0 { $num.say; $num += 0.1e0 }
14:27 camelia rakudo-moar 91fb30: ( no output )
14:28 Voldenet m: my $num = 0.0e0; while $num !~~ 1.0e0 { $num.say; $num += 0.1e0 }
14:28 timotimo m: my $num = 0.0e0; while $num =~= 1.0e0 { $num.say; $num += 0.1e0 }
14:28 camelia rakudo-moar 91fb30: OUTPUT: «(signal XFSZ)0␤0.1␤0.2␤0.3␤0.4␤0.5␤0.6␤0.7␤0.8␤0.9␤1␤1.1␤1.2␤1.3␤1.4␤1.5␤1.6␤1.7␤1.8␤1.9␤2␤2.1␤2.2␤2.3␤2.4␤2.5␤2.6␤2.7␤2.8␤2.9␤3␤3.1␤3.2␤3.3␤3.4␤3.5␤3.6␤3.7␤3.8␤3.9␤4␤4.1…»
14:28 camelia rakudo-moar 91fb30: ( no output )
14:28 timotimo m: my $num = 0.0e0; while $num !=~= 1.0e0 { $num.say; $num += 0.1e0 }
14:28 camelia rakudo-moar 91fb30: OUTPUT: «0␤0.1␤0.2␤0.3␤0.4␤0.5␤0.6␤0.7␤0.8␤0.9␤»
14:28 Voldenet whoa !=~=
14:28 Voldenet what a nice operator
14:29 Voldenet m: $*TOLERANCE = 1e-30; my $num = 0.0e0; while $num !=~= 1.0e0 { $num.say; $num += 0.1e0 }
14:29 camelia rakudo-moar 91fb30: OUTPUT: «Cannot modify an immutable Num␤  in block <unit> at <tmp> line 1␤␤»
14:29 Voldenet ah ;)
14:29 timotimo you want "my" there
14:29 Voldenet m: my $*TOLERANCE = 1e-30; my $num = 0.0e0; while $num !=~= 1.0e0 { $num.say; $num += 0.1e0 }
14:30 Voldenet So it's still possible to shoot yourself in the foot
14:30 timotimo of course
14:30 Voldenet Nice!
14:30 haxmeister you guys play entirely too much with that chat bot..lol
14:30 camelia rakudo-moar 91fb30: OUTPUT: «(timeout)0␤0.1␤0.2␤0.3␤0.4␤0.5␤0.6␤0.7␤0.8␤0.9␤1␤1.1␤1.2␤1.3␤1.4␤1.5␤1.6␤1.7␤1.8␤1.9␤2␤2.1␤2.2␤2.3␤2.4␤2.5␤2.6␤2.7␤2.8␤2.9␤3␤3.1␤3.2␤3.3␤3.4␤3.5␤3.6␤3.7␤3.8␤3.9␤4␤4.1␤4.2…»
14:31 Voldenet Well, it's nice, because you can actually read some perl6 syntax and features while reading irc
14:32 Voldenet along with all those 'funky features' you wouldn't know that exist
14:34 mcmillhj joined #perl6
14:37 haxmeister so 313.Num is the same as Num(313) ? we have Num as a method of several types including integer and string.. and we have Num a free standing function all available is that what I'm seeing?
14:38 haxmeister 313.Num being a method call on the Int type object.. and Num(313) being a call to a standard free standing function
14:39 timotimo no, not a method call on the int type object
14:39 timotimo it's a method call on an Int instance
14:39 haxmeister oh well. yah
14:39 haxmeister really?
14:39 timotimo 313.Num wouldn't be able to give you 313e0 if it were a call on the type instance
14:39 timotimo because the type instance carries no value
14:40 haxmeister damn timotimo
14:40 haxmeister is 318 and object?
14:40 timotimo of course
14:41 haxmeister and what class is that obect?
14:41 timotimo m: say 318.WHAT.perl
14:41 camelia rakudo-moar 400f4e: OUTPUT: «Int␤»
14:41 moritz m: say 318.^name
14:41 camelia rakudo-moar 400f4e: OUTPUT: «Int␤»
14:41 haxmeister so 318 is an object of the class Int
14:41 timotimo right
14:42 AlexDaniel haxmeister: not just this chat bot. We have many bots here. We play with all of them ( ͡° ͜ʖ ͡°)
14:42 haxmeister therefore 318.Num is calling the method Num() from the Int class object yah?
14:42 timotimo yeah
14:42 haxmeister AlexDaniel: it's ok.. the playfulness makes for a happy environment
14:42 haxmeister so what I said before is true
14:43 timotimo nah, "on" is a wrong word there
14:43 haxmeister lol
14:43 timotimo m: Int.Num
14:43 camelia rakudo-moar 400f4e: OUTPUT: «Invocant of method 'Num' must be an object instance of type 'Int', not a type object of type 'Int'.  Did you forget a '.new'?␤  in block <unit> at <tmp> line 1␤␤»
14:43 timotimo ^- this is a method call on the Int type object
14:44 haxmeister so I've got myself confused with the notation we use a bit and what it means
14:45 timotimo yeah, that's fine
14:45 haxmeister I'm glad your patient
14:45 timotimo patient is easy :)
14:45 timotimo well, mostly
14:46 khw joined #perl6
14:47 haxmeister so if I say 313 literally I am not instantiating an object of the Int class?
14:49 timotimo you are, though it happens at compile time, which could make a difference to you
14:49 pat_js joined #perl6
14:49 haxmeister ah.. ok. that clarifies a bit
14:50 haxmeister an example of explicitly instantiating an Int object with the value 313 would look how?
14:50 AlexDaniel m: say Int.new(‘313’) # maybe this? :|
14:50 camelia rakudo-moar 400f4e: OUTPUT: «313␤»
14:51 AlexDaniel but honestly it doesn't really make sense to do something like this
14:51 AlexDaniel m: say 313 # this is just fine…
14:51 camelia rakudo-moar 400f4e: OUTPUT: «313␤»
14:52 timotimo m: my $try = 0; while $try != 313 { $try++ }; say $try
14:52 camelia rakudo-moar 400f4e: OUTPUT: «313␤»
14:52 haxmeister no it doesn't.. but to understand how perl6 is using dot notation it helps me
14:52 haxmeister because 313.Num is a thing
14:53 haxmeister just like "somestring".say
14:53 timotimo right
14:53 haxmeister using object notation on a literal is a different thing for me
14:54 timotimo what is "object notation" to you?
14:54 haxmeister so that's why I ask about whether it's an object or not.. and then further how to use normal object instantiation method for it
14:54 timotimo you need to know that "method new" is nothing special, either
14:56 haxmeister are all anonymous objects created at compile time?
14:56 * moritz ponders whether his next book should be "Perl 6 Complete: Object Orientation"
14:56 moritz haxmeister: no
14:56 haxmeister moritz: that question makes sense to you?
14:56 moritz my $x = {}; # anonymous hash created at compile time
14:56 moritz erm sorry, at run time
14:56 * moritz confused
14:56 moritz even classes can be created at run time
14:57 haxmeister lol
14:57 haxmeister so much badassery in perl6..lmao
14:57 timotimo i can't actually find the code that makes Num(123) tick
14:57 azawawi joined #perl6
14:58 moritz m: my $class := Metamodel.ClassHOW.new_type(name => 'funny');
14:58 camelia rakudo-moar 400f4e: OUTPUT: «No such method 'ClassHOW' for invocant of type 'Metamodel'␤  in block <unit> at <tmp> line 1␤␤»
14:58 lizmat joined #perl6
14:58 moritz m: my $class := Metamodel::ClassHOW.new_type(name => 'funny');
14:58 camelia rakudo-moar 400f4e: ( no output )
14:59 haxmeister moritz: to be honest.. I think for this language it is almost better to start a tut with the OO stuff and work down
15:00 azawawi hi
15:00 haxmeister since basic typing is connected to OO syntactically and actually
15:00 moritz haxmeister: sure, start simple, then get down to the nitty gritty
15:00 moritz hi azawawi
15:00 jnthn Integer literals are a little bit interesting, because - at least for those that are small enough - the compiler is happy to treat them as both an Int object or a native int. In fact, it compiles them - in the immediate - into both, and lets the surrounding context decide which is wanted.
15:01 azawawi https://github.com/azawawi/perl6-terminal-caca/blob/master/examples/01-hello-world.pl6  # Terminal::Caca method chaining. Feedback is welcomed
15:01 haxmeister damn
15:01 haxmeister that's hardcore
15:01 jnthn So if you say 42.WHAT then you're absolutely talking about the Int because .WHAT is a thing that's done to objects
15:02 jnthn But if writing `my int $answer = 42` then it can see there's no point generating code that takes a Int and then takes the int out from it, it can just generate code with the native 42 integer value right away. :)
15:02 moritz azawawi: nice
15:03 jnthn In general, though, Perl 6 lets you consider everything an object. Even if you have a native integer, and try to use it in an object-y way, it'll box it into an Int for you automatically
15:03 moritz so currently I'm improving my manuscript ("Perl 6 Fundamentals") in response to feedback
15:03 moritz and in the back of my mind, I'm considering what to do next
15:03 moritz and one of my ideas was to explore a Perl 6 topic in more depth
15:04 moritz maybe in the form of a short book
15:04 jnthn Maybe some day I should write "Perl 6 from the bottom up", to steal the "Git from the bottom up" idea. :P
15:04 moritz jnthn: I'd buy that :-)
15:04 moritz and the topics I've come up so far that I could cover are: routines and signatues, OO, Regex and grammars
15:05 MasterDuke_ jnthn: i've mentioned this to timotimo as an idea, but i would love a blog post (or something more substantial) that goes into some detail about exactly what happns when you `perl6 -e 'say "hi"'`
15:05 moritz the other I had was to ask MJD what he thinks about a Perl 6 version of HOP
15:06 MasterDuke_ i.e., what's happening in rakudo, what in nqp, what in moarvm
15:06 jnthn MasterDuke_: omg so much :-)
15:06 moritz or a Friedl if he would like a Perl 6 edition of "Mastering Regular Expressions"
15:06 El_Che moritz: do grammars
15:06 moritz or maybe I should stop writing for a bit, and explore podcasting
15:06 moritz or... dunno
15:06 moritz just floating ideas around
15:07 MasterDuke_ jnthn: heh, you're the one who said "book"
15:07 moritz El_Che: vote registered :-)
15:07 El_Che moritz: als a good (deep and wide) multithreading chapter would be nice
15:07 El_Che also
15:07 MasterDuke_ oops, implied "book" maybe
15:07 moritz El_Che: that would be nice indeed, but I'm the wrong person to write that :-)
15:07 lizmat .
15:07 yoleaux 14:39Z <Zoffix> lizmat: should List.sink actually do things? I would've figured it'd do self.iterator.sink-all, since a List could be made from a Seq, for example. And we do sink-all in Seqs, but not lists: https://irclog.perlgeek.de/perl6-dev/2017-05-03#i_14525429
15:07 yoleaux 14:49Z <Zoffix> lizmat: Never mind. jnthn++ answered
15:08 jnthn Well, a Perl 6 guts-y book would certainly have to go in the queue behind the first one I really want to do :-)
15:08 moritz jnthn: tell me more about the first one :-)
15:08 MasterDuke_ ooo, an async/multi-threading one?
15:09 jnthn MasterDuke_ guessed :)
15:09 MasterDuke_ i would buy that
15:10 * moritz too
15:11 KDr2 joined #perl6
15:11 araraloren joined #perl6
15:12 Ven joined #perl6
15:14 robertle joined #perl6
15:17 haxmeister that is very very insightful jnthn i'm glad my difficulty was understood.. with that information the syntax is far less confusing
15:19 haxmeister having perl6 allow you to use what might be a literal in the context of object notation certainly sets it above many other language.. it is a higher higher level language in that sense
15:20 [Coke] jnthn++ # I'd buy that book
15:21 haxmeister though that does make it difficult to look up documentation when you don't know if you should be looking for a class method of a particular objects type or a built-in function
15:22 skids joined #perl6
15:26 haxmeister so only the interpreter deals with actual literals.. everything is an object and all subs/functions/methods are accepting objects as their arguments
15:27 haxmeister though usually they are anonymous objects
15:29 keix joined #perl6
15:34 mr-foobar joined #perl6
15:35 Sgeo joined #perl6
15:42 [Coke] docs should /wni 8
15:42 [Coke] aha, I fooled the bot.
15:44 haxmeister oh.. block syntax.. very awesome..
15:44 haxmeister could right some outrageous macros type stuff with that
15:45 wamba joined #perl6
15:46 haxmeister can you pass perl6 code to a function or even block for execution?
15:47 domidumont joined #perl6
15:47 Cabanossi joined #perl6
15:47 timotimo functions are objects, you can pass objects as arguments
15:47 haxmeister all arguments are objects.. but didn't think about functions being objects thank you
15:47 timotimo m: my $foo = -> $a, $b { say "$a and $b" }; sub call-it($it) { $it("one", "two") }; call-it($foo)
15:47 camelia rakudo-moar c13d89: OUTPUT: «one and two␤»
15:49 haxmeister interesting.. perl6 can learn and modify itself then
15:49 timotimo that's not it
15:49 timotimo just passing code objects around doesn't give you self-modification yet
15:49 timotimo but you can EVAL stuff and that can do what you want, probably
15:50 itsame joined #perl6
15:50 haxmeister EVAL sounds familiar
15:50 MasterDuke_ and you can modify the grammar at runtime
15:50 haxmeister if I can take a string that is valid perl6 code and then evaluate that string as code.. that's all it takes
15:51 timotimo MasterDuke_: i wouldn't call that runtime, though?
15:52 haxmeister can we create data structures by evaluating strings of perl6 code that create a data structure?
15:52 timotimo yeah, you have to go through EVAL for that
15:52 timotimo because code is code
15:53 MasterDuke_ timotimo: you wouldn't?
15:53 ChoHag joined #perl6
15:53 timotimo MasterDuke_: you pull in changes to the grammar during compile time, no?
15:54 MasterDuke_ m: sub prefix:<!>($n) { [*] 1..$n }; say !5
15:54 camelia rakudo-moar c13d89: OUTPUT: «120␤»
15:55 timotimo at run time, you can no longer change the grammar that was used to parse the code
15:55 jnthn That's a compile time change, not runtime. Otherwise we don't know how to parse the added operators when we encounter them in later code :)
15:55 jnthn postfix:<!> is probably a better example 'cus that doesn't exist in standard Perl 6 :)
15:56 MasterDuke_ ah, right
15:56 jnthn m: sub postfix:<!>($n) { [*] 1..$n }; say 5!
15:56 camelia rakudo-moar c13d89: OUTPUT: «120␤»
15:56 jnthn m: say 5!; sub postfix:<!>($n) { [*] 1..$n }; # also notice order matters
15:56 camelia rakudo-moar c13d89: OUTPUT: «5===SORRY!5=== Error while compiling <tmp>␤Negation metaoperator not followed by valid infix␤at <tmp>:1␤------> 3say 5!7⏏5; sub postfix:<!>($n) { [*] 1..$n }; # a␤    expecting any of:␤        infix␤        infix stopper␤»
15:56 jnthn Can't use the operator before it's defined
15:56 haxmeister but with EVAl though.. have we completely taken the heart of lisp and put it in perl or is it more restrictive?
15:56 jnthn 'cus it's not even in the pare tables
15:56 jnthn *parse
15:56 MasterDuke_ m: say !5; sub prefix:<!>($n) { [*] 1..$n };
15:56 camelia rakudo-moar c13d89: OUTPUT: «120␤»
15:56 timotimo perl6 code isn't isomorphic or what the name is
15:57 MasterDuke_ that's a little confusing
15:58 MasterDuke_ but i guess if you're creating custom operators you should know what's happing there
15:59 haxmeister so eval can't work on perl6 code but it can work on perl5?
15:59 haxmeister it just has the option "perl"
16:00 MasterDuke_ m: EVAL q|say "hi"|
16:00 camelia rakudo-moar c13d89: OUTPUT: «hi␤»
16:00 jnthn The Perl 6 EVAL function assumes code is Perl 6 by default
16:01 jnthn I think if you're using Inline::Perl5 you can use pass :lang<perl5> as an option or something like that
16:01 haxmeister if I my Str $foo = "my $bar =\"hello world\"" now $bar is available to me?
16:01 timotimo no
16:01 haxmeister because I can eval $foo and have $bar available?
16:01 timotimo nope
16:02 haxmeister kk
16:02 timotimo lexical pads are a compile-time thing and are fixed as soon as the compiler's done
16:02 timotimo so you can't put in new lexical variables by calling EVAL at run time
16:02 haxmeister oh I gotcha.. there's the difference
16:04 haxmeister can't access them or can't create them?..
16:04 haxmeister if I EVAL a string of code that includes functions and vars etc.. will it evaluate or say no
16:05 jnthn They will be compiled as if in a nested scope
16:05 jnthn So you can put functions and vars in there and call them inside of the EVAL, they just won't be available outside
16:06 haxmeister awesome
16:06 jnthn If you want that you can either (for one function) return it as the result of the EVAL, or make it escape in some other way (assign it to a lexical outside of the EVAL, stick it in a package, assign it to a dynamic variable...basically anything non-lexical :))
16:06 jnthn m: my &func; EVAL '&func = sub { say 42 }'; func()
16:06 camelia rakudo-moar c13d89: OUTPUT: «42␤»
16:07 jnthn That works for example 'cus &func is declared outside of the EVAL
16:07 haxmeister sheesh I need to back up.. I have fundamentals to get used to in perl6
16:11 haxmeister had to go here https://docs.perl6.org/language/5to6-nutshell to see why the space isn't allowed between a function call and it's parenthesized arguments
16:13 haxmeister that explanation might should be on the doc page about subs/functions..
16:13 haxmeister in addition to this page
16:14 TreyHarris Design opinions sought: for a portable interface to a system resource (in this case, a PID, process ID) better to have a portable MyApp::PID with a has-a that will dispatch to a OS-specific object the user will never see (even if they do a .WHAT), or create a factory method as the entry point so the user gets a MyApp::PID::Linux or MyApp::PID::Darwin, both is-a to an uninstantiable MyApp::PID etc. depending on
16:14 TreyHarris what OS they're on? (Presumably the factory in the latter case would live in MyApp::PID.)
16:17 TreyHarris I should just clone the entire ecosystem so I can ack around for possible conventions already emerg(ed|ing) for things like this. How large is it, I assume the hundreds of megs at most?
16:18 TreyHarris (Anybody already written a CPAN Mirror-style ecosystem downloader? Simple enough to iterate through perl6/ecosystem/META.list, but there might be unusual cases and why reinvent wheels?)
16:19 garas joined #perl6
16:19 MasterDuke_ huggable: all modules
16:19 huggable MasterDuke_, https://github.com/moritz/perl6-all-modules
16:19 MasterDuke_ TreyHarris: ^^^
16:19 TreyHarris MasterDuke_: ty!
16:20 garas what is the perl6 equivalent of perldoc ?
16:20 TreyHarris garas: p6doc or perl --doc depending on usage
16:20 TreyHarris sorry, perl6 --doc
16:22 garas ===> Building: p6doc No such method 'abspath' for invocant of type 'IO::Path'
16:22 TreyHarris garas: with rakudo, you'll need to run 'p6doc-index build' first
16:22 rindolf joined #perl6
16:22 garas I think it is broken
16:22 Geth joined #perl6
16:22 timotimo yeah, it's "absolute" instead of "abspath
16:22 timotimo "
16:23 timotimo but isn't it supposed to just give a deprecation warning?
16:25 mcsnolte joined #perl6
16:25 garas seems easy to fix
16:26 * TreyHarris hemms and haws about whether to clone moritz/perl6-all-modules in ~/src/perl6/ALL-MODULES or something for lower cognitive load and better tabbability, or under ~/src/perl6-all-modules to preserve ~/src/perl6 having only the project modules inside for a 1:1 relationship to the GitHub path
16:28 MasterDuke_ do both, disk is cheap!
16:29 MasterDuke_ and why not ~/src/perl6/modules/all also
16:29 timotimo just symlink it :P
16:29 timotimo one thing that annoys me to almost no end is that i tend to perf record while in my ~, but there's also a "perl6" folder where all my perl6 stuff is in
16:29 timotimo and perf creates "perf.data"
16:31 TreyHarris hah! the size of all modules is 236 MB. I was guessing based on pure gut instinct about a quarter gig.
16:31 timotimo that's not only the size of modules, but also their history
16:31 TreyHarris yeah, just noticed that. modules-only is 171M
16:31 timotimo and there might be a few .so files in there
16:31 garas p6doc has been fixed already on github, but zef downloaded me the broken version..
16:32 TreyHarris timotimo: not according to find
16:32 timotimo OK
16:32 TreyHarris garas: p6doc is distributed with rakudo, not separately, I believe?
16:32 timotimo TreyHarris: it's in rakudo star, not in rakudo itself
16:32 garas using rakudobrew
16:33 TreyHarris timotimo: sorry, I thinko'd
16:34 timotimo :)
16:34 ChoHag joined #perl6
16:34 Zoffix joined #perl6
16:35 Zoffix garas: how come you're using rakudobrew?
16:35 TreyHarris Well, that's useless... not a single class in the ecosystem has "Linux" or "Darwin" in its name, believe it or not. (Actually, one has a "Darwin", but it's referring to the Australian city, not the OS.)
16:35 garas Zoffix: I have no idea..
16:35 Zoffix garas: hah
16:35 garas I use homebrew on the mac, and got used to it
16:35 Zoffix garas: well, it's not really for end users. For example, you need to run `rakudobrew rehash` after installing binaries like `p6doc` or stuff won't work right. Try running that now and see if that fixes your issue
16:36 TreyHarris s/class/namespace/
16:36 garas thanks
16:36 Zoffix timotimo: nope, no deprecation for .abspath
16:36 timotimo OK. in that case i don't know why IO::Path would error out like that for a call to its .abspath
16:36 Zoffix .slurp-rest will be deprecated in 6.d... Don't remember offhand what else
16:37 Zoffix timotimo: oh, no, .abspath just got removed, without any deprecation.
16:37 Zoffix It wasn't part of the language, IIRC
16:37 timotimo oh!
16:37 timotimo that's how you meant it
16:37 Zoffix Yeah
16:38 Zoffix buggable: eco doc
16:38 buggable Zoffix, Found 10 results: Pod::Parser, p6doc, XML::Parser::Tiny, HTML::Parser::XML, PerlStore. See https://modules.perl6.org/#q=doc
16:38 Zoffix buggable: eco p6doc
16:38 buggable Zoffix, p6doc 'Perl 6 documentation (tools and docs)': https://github.com/perl6/doc
16:38 TreyHarris Are there performance-based reasons to prefer the factory-is-a dispatch over the has-a dispatch, which would tend to reduce method dispatch by one for ever operation? Or is that optimized and/or negligible? (I can use 'handles' in some, but not all, cases, if there's an optimization for that.)
16:39 Zoffix garas: oh, I see why. We got dumb version in p6doc
16:39 TreyHarris (that was a misplaced modifier; the fatory is-a would tend to reduce method calls by one per operation, not the has-a)
16:39 Geth ¦ doc: 0893cdcdd5 | (Zoffix Znet)++ (committed using GitHub Web editor) | META6.json
16:39 Geth ¦ doc: User proper version
16:39 Geth ¦ doc:
16:39 Geth ¦ doc: So that modules update stuff when we make new versions
16:39 Geth ¦ doc: review: https://github.com/perl6/doc/commit/0893cdcdd5
16:39 Zoffix garas: zef --force install p6doc; rakudobrew rehash;
16:39 Zoffix That should fix the issue
16:41 Zoffix IMO a META version of "*" should mean "install, always" to a package manager.
16:41 Zoffix m: Version.new(*) before Version.new(*)
16:41 camelia rakudo-moar c776c0: OUTPUT: «WARNINGS for <tmp>:␤Useless use of "before" in expression ".new(*) before Version.new(*)" in sink context (line 1)␤»
16:41 Zoffix m: say Version.new(*) before Version.new(*)
16:41 camelia rakudo-moar c776c0: OUTPUT: «False␤»
16:41 Zoffix hmmm
16:41 * Zoffix shrugs
16:42 Zoffix m: say Version.new(*) after Version.new('1.001001')
16:42 camelia rakudo-moar c776c0: OUTPUT: «False␤»
16:42 Zoffix m: say Version.new(*) before Version.new('1.001001')
16:42 camelia rakudo-moar c776c0: OUTPUT: «True␤»
16:42 Zoffix Good.
16:43 Zoffix garas: also, p6doc is a far cry from perldoc at the moment. Still needs a bunch of work. Easier to just use https://docs.perl6.org
16:43 TreyHarris I'm leaning towards a factory in MyApp::PID returning MyApp::PID::$<OSNAME>. So, last question if anyone has an opinion: should such a factory be invoked on .new since it will just locate the right subclass and re-dispatch, or is it bad hygiene for .new to return anything other than an instance of exactly the class explicitly named and not a subclass?
16:45 garas Zoffix: agreed, I also like the website, but I am curious
16:45 Zoffix garas: did the fix work for you?
16:45 garas it installed it
16:46 garas --force was really important
16:46 garas also
16:46 Zoffix Sweet. Do you still have the .abspath problem?
16:46 TreyHarris Hmm, https://github.com/perl6/modules exists, hasn't been touched since 2009, and has a single module in it, Digest (using old syntax that probably won't work (right) anymore
16:46 garas no abspath problem
16:46 Zoffix Awesome.
16:50 garas It seems to work decently :)
16:51 araraloren TreyHarris, a factory new is a good idea, I prefer that way.
16:52 Zoffix awwaiid: my feedback on your Terminal::Caca fluent interface is it's terrible for errors. For example this chain's death on line 25 is reported to be on line 9, because that's where the statement starts: https://gist.github.com/zoffixznet/2e8bd72c66e37f5804760d0dd6b75192 There's no reason to write that code in Perl 6, since you can use `given $o { .method1; .method2; .method3; }` etc
16:53 TreyHarris araraloren: I agree, but I just didn't know if it violated least surprise to call X.new() and get an instance of Y, even if Y is a X.
16:55 Zoffix awwaiid: though, as far as chains go, I have you beat with my juicy Perl 5 test module: https://metacpan.org/pod/Test::Mojo::Role::ElementCounter#SYNOPSIS :)
16:57 Zoffix left #perl6
16:59 araraloren Em, I have seen that way in some Perl 5 Module. In Perl 6 , new is just a construct method.
17:01 araraloren TreyHarris, Just write a clear document for your module. It's no problem .
17:02 TreyHarris araraloren: well, maybe it should be a role then.
17:02 Cabanossi joined #perl6
17:02 TreyHarris nope, can't be a role, it has behavior ("class methods") I need to call on it even before OS-dispatch.
17:03 araraloren Em, Night ..I gotta sleep ..
17:05 araraloren Or maybe you can make a other name for it. Such as `method from-os(..)`
17:08 TreyHarris m: role Dock { method bark { say "quack!" } }; Dock.bark; class Dog does Dock { }; my $d = Dog.new; $d.bark
17:08 camelia rakudo-moar c776c0: OUTPUT: «quack!␤quack!␤»
17:09 TreyHarris Hmm, guess you can call methods on roles... is that accidental?
17:09 timotimo that's what's called "punnign"
17:09 timotimo "punning"
17:09 timotimo it does the equivalent of class anonymous does TheRole { } and calls the method on that
17:10 TreyHarris ....right!
17:10 TreyHarris forgot about that.
17:13 cdg joined #perl6
17:17 TreyHarris it's a PITA to rewrite .new in this case, because if you do it stupidly (making the role or superclass dispatch to the class's .new) you go into an infinite loop. better to name the factory something else I guess, unless this is a case for using bless, and I think it's not.
17:21 TreyHarris I've always like the Recognizer pattern (where a class looks at its input and returns an object of the appropriate isomorphic type to deal with the input, with the instance classes themselves being polled "can you take this input?" and letting them reply "yes", "no", or "maybe, but come back to me if nobody else says "yes"), and multis make it a lot easier to write them. but they still aren't exactly concise
17:21 TreyHarris in any OO language I've encountered.
17:28 timotimo having roles participate in the build dance is difficult, aye
17:28 timotimo normally you have a submethod BUILD and/or TWEAK, but submethods, like methods, get flattened into the class body that you're applying to
17:31 TreyHarris Easier just to separate out the build function into a factory and putting any recognition logic into "class methods" (is that an official term in Perl 6, or do we say "undefined invocant methods?"), letting the ordinary BUILD & TWEAK process work as normal. This also lets you put the participating methods into a class tree if you so desire, letting slightly-different classes capitalize on one another's
17:31 TreyHarris implementations.
17:33 timotimo hm, i wonder if a submethod BUILD will also invalidate the default values for attributes in roles you merge into the class
17:34 timotimo m: role WithDefault { has $.foo = rand }; class WithBuild does WithDefault { submethod BUILD(:$lol) { say $lol } }; WithBuild.new(:99lol).foo.say
17:34 camelia rakudo-moar c776c0: OUTPUT: «99␤0.977413050909244␤»
17:34 timotimo cool, that works
17:34 alimon joined #perl6
17:36 azawawi joined #perl6
17:36 azawawi hi
17:37 anop joined #perl6
17:37 anop what is "do for" in perl 6
17:38 timotimo it lets you use a for loop in an expression context
17:38 timotimo to get its value
17:38 timotimo well, values
17:39 anop thanks but why we use "do " with for ?
17:40 [Coke] anop: https://docs.perl6.org/syntax/do
17:40 azawawi Zoffix: thx for your feedback to my synonym nickname :)
17:40 TreyHarris timotimo: can you think of any examples where both a TWEAK and a BUILD would be used aside from as an academic exercise? It seems to me like the rule of thumb is, "use TWEAK if you can, BUILD otherwise, and new only if you must" (which I guess kind of blows up the whole CAPS-vs-lowercase thing)
17:41 anop thnks timotimo
17:44 anop " (.=not for @doors[0, $_ ... 100]) for 1..100;" in this code,  could you explan what  is " .=not " ?
17:45 timotimo it's a mutating method call on $_
17:45 timotimo (when an object before the method call is left out, but the . is there, it is a call on $_)
17:46 timotimo .=not is equivalent to $_ = $_.not
17:46 timotimo TreyHarris: i don't think there's a good reason to have both
17:46 anop thnks u so much timotimo.....
17:47 Cabanossi joined #perl6
17:48 cdg_ joined #perl6
17:54 labster joined #perl6
17:54 raschipi joined #perl6
17:56 garas Do you think it would be nice if perl6 had a help() function in the REPL, calling p6doc?
18:01 raschipi garas: Better done with two terminals or terminal tabs.
18:01 alphah m: my $u = $*USER; say $u.perl; say $u[0]
18:01 camelia rakudo-moar c776c0: OUTPUT: «IntStr.new(1012, "camelia")␤camelia␤»
18:02 alphah m: my $u = $*USER; say $u.perl; say $u[1]
18:02 camelia rakudo-moar c776c0: OUTPUT: «IntStr.new(1012, "camelia")␤Index out of range. Is: 1, should be in 0..0␤  in block <unit> at <tmp> line 1␤␤Actually thrown at:␤  in block <unit> at <tmp> line 1␤␤»
18:02 alphah How to get the id number, not the user id?
18:03 MasterDuke_ m: my $u = $*USER; say $u.perl; say +$u
18:03 camelia rakudo-moar c776c0: OUTPUT: «IntStr.new(1012, "camelia")␤1012␤»
18:03 alphah aaah
18:03 alphah Thanks
18:03 MasterDuke_ m: my $u = $*USER; say $u.perl; say ~$u
18:03 camelia rakudo-moar c776c0: OUTPUT: «IntStr.new(1012, "camelia")␤camelia␤»
18:07 raschipi m: my $u = $*USER; say $u ~~ 1012;
18:07 camelia rakudo-moar c776c0: OUTPUT: «True␤»
18:07 raschipi m: my $u = $*USER; say $u ~~ 'camelia';
18:07 camelia rakudo-moar c776c0: OUTPUT: «True␤»
18:11 setty1 joined #perl6
18:17 Cabanossi joined #perl6
18:17 itaylor57 joined #perl6
18:20 Ven joined #perl6
18:20 raschipi m: my $u = $*USER; say $u + 2;
18:20 camelia rakudo-moar c776c0: OUTPUT: «1014␤»
18:20 MasterDuke_ https://docs.perl6.org/language/glossary#Allomorph
18:28 alphah m: say $*USER.Str; say $*USER.Num;
18:28 camelia rakudo-moar c776c0: OUTPUT: «camelia␤1012␤»
18:28 raschipi I'm aware.
18:30 raschipi m: sub f(Numeric $x){say $x}; my $y=<2>; f($y)
18:30 camelia rakudo-moar c776c0: OUTPUT: «2␤»
18:30 raschipi m: my $y=<2>; $y.WHAT
18:30 camelia rakudo-moar c776c0: ( no output )
18:30 raschipi m: my $y=<2>; say $y.WHAT
18:30 camelia rakudo-moar c776c0: OUTPUT: «(IntStr)␤»
18:31 raschipi m: sub f(Numeric $x){say $x.WHAT}; my $y=<2>; f($y)
18:31 camelia rakudo-moar c776c0: OUTPUT: «(IntStr)␤»
18:31 raschipi m: sub f(Int() $x){say $x.WHAT}; my $y=<2>; f($y)
18:31 camelia rakudo-moar c776c0: OUTPUT: «(IntStr)␤»
18:31 raschipi m: sub f(Int $x){say $x.WHAT}; my $y=<2>; f($y)
18:31 camelia rakudo-moar c776c0: OUTPUT: «(IntStr)␤»
18:32 raschipi m: say IntStr ~~ Int;
18:32 camelia rakudo-moar c776c0: OUTPUT: «True␤»
18:35 raschipi m: sub f(Any $x where 2){say $x.WHAT}; my $y=<2>; f($y)
18:35 camelia rakudo-moar c776c0: OUTPUT: «(IntStr)␤»
18:36 raschipi m: sub f($x){say $x.WHAT}; my $y=<+2>; f($y)
18:36 camelia rakudo-moar c776c0: OUTPUT: «(IntStr)␤»
18:37 raschipi m: sub f($x){say $x.WHAT}; my $y=<2+0>; f($y)
18:37 camelia rakudo-moar c776c0: OUTPUT: «(Str)␤»
18:37 raschipi The note in the glossary is confusing.
18:40 Zoffix joined #perl6
18:40 Zoffix raschipi: which part?
18:40 Zoffix The "Note:…"
18:40 Zoffix ?
18:40 raschipi Yes.
18:41 Zoffix How can it be better?
18:41 Zoffix Basically angle brackets are dual-purpose: a list of stuff or a way to make Rat and Complex literals
18:42 Zoffix And which you get depends on whether there's stuff other than the number in the brackets
18:42 raschipi It should say it doesn't work for Ints.
18:42 Zoffix Why Ints specifically?
18:42 raschipi m: say <+2>.WHAT
18:42 camelia rakudo-moar c776c0: OUTPUT: «(IntStr)␤»
18:42 raschipi m: say <2+0>.WHAT
18:42 camelia rakudo-moar c776c0: OUTPUT: «(Str)␤»
18:42 AlexDaniel oh please not <> again…
18:43 Zoffix <> is awesome. You're just not ready to receive all it's got to offer :P
18:43 raschipi I like it, very handy (especially for testing). My problem is with the note.
18:44 AlexDaniel for me it would've been better if there was a distinct syntax for every single thing you can get out of it
18:44 moritz m: say <2+3i>.^name
18:44 camelia rakudo-moar c776c0: OUTPUT: «Complex␤»
18:44 AlexDaniel like I don't know, i<> or ~<> or whatever
18:47 Geth ¦ doc: cc1b62a0ce | (Zoffix Znet)++ (committed using GitHub Web editor) | doc/Language/glossary.pod6
18:47 Geth ¦ doc: Clarify allomorph vs literal numeric note
18:47 Geth ¦ doc: review: https://github.com/perl6/doc/commit/cc1b62a0ce
18:47 Zoffix raschipi: ^ what about now?
18:47 Cabanossi joined #perl6
18:47 Zoffix .oO( that entry is way to big for a Glossary entry )
18:48 raschipi Now I understand how it works.
18:49 Zoffix Sweet.
18:49 Zoffix left #perl6
18:55 jonas1 joined #perl6
19:19 TEttinger joined #perl6
19:32 espadrine_ joined #perl6
19:33 r3m joined #perl6
19:44 itaipu joined #perl6
19:47 Cabanossi joined #perl6
19:50 dct joined #perl6
19:56 labster joined #perl6
19:59 cdg joined #perl6
20:01 skids joined #perl6
20:22 Geth ¦ ecosystem: 941b77ba6a | (David Warring)++ | META.list
20:22 Geth ¦ ecosystem: rename repos
20:22 Geth ¦ ecosystem: review: https://github.com/perl6/ecosystem/commit/941b77ba6a
20:24 azawawi joined #perl6
20:24 TreyHarris I'm confused by this behavior I've made into a short test case. I'm following the documentation example so closely here that I'm sure I'm just making a typo or something, but I retyped this example from scratch and still getting the same thing: https://gist.github.com/treyharris/f26bb1a3a857be53bb8e75cfd970b14b
20:26 azawawi https://github.com/azawawi/perl6-terminal-caca/blob/master/examples/02-kitchen-sink.pl6 # Perl 6 random lines, boxes, circles, ellipses and triangles (also fill-) primitives :)
20:27 timotimo TreyHarris: that example is wrong
20:27 timotimo you're giving the proxy a method and it's trying to access $!x, but it'l installed on the proxy object
20:27 timotimo but Proxy doesn't have a $!x
20:27 TreyHarris timotimo: oh? I'll fix the example if you tell me what's wrong with it
20:27 timotimo please try "sub" instead of "method" in there
20:27 TreyHarris ok
20:28 moritz but if you use sub, you need a placeholder argument for the proxy
20:28 timotimo ah, yes
20:28 timotimo first positional parameter
20:28 moritz so FETCH => sub ($) { $!x * 2 }
20:28 Perl6Noob joined #perl6
20:28 timotimo yup, and add a $ for the STORE sub, too
20:28 timotimo in front
20:28 moritz STORE => sub ($, $new) { $!x = $new / 2 }
20:29 timotimo that makes things work properly
20:29 moritz also, the tests assume that if you assign 3, you get a 6 out
20:29 moritz but you're assinging 3/2 to $!x, and then fetch 3/2 * 2, so 3
20:30 ugexe META version of "*" cant mean install always to a package manager without also adding logic to ignore dependencies and a bunch of other things. Instead, a META version of * is treated just like how rakudo treats it: as version 0
20:30 moritz erm wait, you're storing 3*2, and then retrieving 3*2/2
20:30 TreyHarris huh? the tests pass now and I just changed "method (" to "sub ($,"
20:31 Perl6Noob ugexe, why ignore dependency?
20:31 Perl6Noob Trey
20:31 moritz TreyHarris: oh, because you assign to x, not to double-x
20:31 moritz TreyHarris: never mind my ramblings
20:31 ugexe because dependencies can overlap versions
20:32 Perl6Noob TreyHarrys, because sub closes over $!x, while when it was a method it was trying to get it from elsewhere
20:32 ugexe now you have to introduce special logic for when versions overlap and you only want one or the other and not both
20:32 TreyHarris moritz: oh, yes, I wanted to simplify down to bare bones so I used a name for the proxy that wasn't overloaded at all
20:32 ugexe there are tons of details like this
20:32 ugexe declaring version * in META6.json should just be barred
20:32 TreyHarris Perl6Noob: excuse me? ignore what dependency?
20:32 Perl6Noob ugexe, ok
20:33 Perl6Noob TreyHarris, nah, that was to ugexe
20:35 TreyHarris In the docs there are examples of proxy with "STORE => method" and "FETCH => method" where it's a code snippet, not a runnable example... when (if/ever) is "method" appropriate/
20:35 TreyHarris ?
20:36 TreyHarris There are no examples with FETCH/STORE => sub, so I feel like I should change one of them to that at least so they won't spend 2 hours like I just did trying all sorts of things but never thinking to make that particular change
20:36 Perl6Noob TreyHarris, when it's self-contained or closes over just normal variables. It really just saves you from adding an invocant to parameters list. And it failing the way it does when you closed over $!x may be a bug... Like if you do it in regexes you get a proper error about it
20:38 Perl6Noob IMO a block is the best thing to use there
20:38 Perl6Noob least typing
20:39 TreyHarris Okay, but in what context would you close it over normal variables when creating an "is rw" accessor method? That's what led me to the example in the first place, docs saying to use a Proxy to achieve complex read/write accessor behavior
20:40 TreyHarris Perl6Noob: could you illustrate? I'm not sure what you mean. oh, you mean just "STORE => { $!x * 2 }" and "FETCH => { $!x = $^x / 2 }"?
20:40 timotimo i don't think that is enough, because of what it'll be called as
20:40 TreyHarris the second one wouldn't get $^x as the invocant?
20:41 timotimo oh
20:41 timotimo sorry, that's correct
20:41 timotimo but the STORE one should get two arguments
20:41 ggoebel joined #perl6
20:43 TreyHarris it does, I just tested it as above, except I flipped STORE and FETCH, sorry, thinko
20:43 TreyHarris So how do you make a placeholder that matches the second positional and throws away the first?
20:43 TreyHarris oh, he's gone
20:46 TreyHarris .seen Perl6Noob
20:46 yoleaux I saw Perl6Noob 20:38Z in #perl6: <Perl6Noob> least typing
20:48 TreyHarris duh, I meant before that. :-)
20:49 Perl6Noob joined #perl6
20:50 TreyHarris Perl6Noob: I'm just wondering if you were alluding to some other "shorter way" using blocks, like perhaps avoiding the Proxy constructor completely?
20:51 TreyHarris Because "STORE => { $!x = $^x / 2 }" doesn't work because you need two positionals and that only takes one. (a placeholder-less block will take any arguments and discard them, so FETCH is okay)
20:51 Perl6Noob TreyHarris: just blocks. For second one, I'd use -> $, $v { $!x = ½*$v }, but you can also write as { $!x = ½*@_[1] }
20:52 Geth ¦ perl6.org: b3660e91d0 | (Steve Mynott)++ | source/downloads/index.html
20:52 Geth ¦ perl6.org: Mention current Strawberry Perl dep for MSI
20:52 Geth ¦ perl6.org: review: https://github.com/perl6/perl6.org/commit/b3660e91d0
20:52 Perl6Noob TreyHarris: also, you can shorten bare blocks and write them as :STORE{ $!x = ½*$^x }
20:52 Perl6Noob m: say '_' before 'a'
20:52 camelia rakudo-moar f4cbdb: OUTPUT: «True␤»
20:53 Perl6Noob m: say { $^_; say ½×$^x }(42, 10)
20:53 camelia rakudo-moar f4cbdb: OUTPUT: «5===SORRY!5=== Error while compiling <tmp>␤Redeclaration of symbol '$^_' as a placeholder parameter␤at <tmp>:1␤------> 3say { $^_7⏏5; say ½×$^x }(42, 10)␤»
20:53 Perl6Noob Oh right.
20:53 Perl6Noob Oh huh
20:53 Perl6Noob m: say { $^z; dd $_; say ½×$^x }(42, 10)
20:53 camelia rakudo-moar f4cbdb: OUTPUT: «Any $_ = Any␤21␤True␤»
20:53 Perl6Noob oh ok
20:53 TreyHarris Perl6Noob: how with :STORE? :FETCH{ ... } works, because, again, you don't need the argument
20:53 Perl6Noob m: say { $^a; say ½×$^x }(42, 10)
20:53 camelia rakudo-moar f4cbdb: OUTPUT: «5␤True␤»
20:53 Perl6Noob If you really wanted to do stuff
20:53 Perl6Noob TreyHarris: oh sorry, I meant with :FETCH{}
20:54 TreyHarris I think it looks odd to use two different syntaxes there.
20:56 Perl6Noob :FETCH(* × 2)
20:56 Perl6Noob Never mind :)
20:58 TreyHarris m: say { $^z; dd $_; say ×$^x}(42)
20:58 camelia rakudo-moar f4cbdb: OUTPUT: «5===SORRY!5=== Error while compiling <tmp>␤Preceding context expects a term, but found infix × instead␤at <tmp>:1␤------> 3say { $^z; dd $_; say ×7⏏5$^x}(42)␤»
20:59 Perl6Noob TreyHarris: method double-x { Proxy.new: :FETCH{$!x × 2} :STORE(-> $, $y { $!x = ½×$y }) }
20:59 Perl6Noob That's the shortest I can think of
20:59 TreyHarris I'm not quite sure what was supposed to happen no matter how many args it got
21:00 Perl6Noob TreyHarris: I think your system is missing fonts or something? There supposed to be a ½ before multiplication
21:00 Perl6Noob as in:
21:00 Perl6Noob u: ½
21:00 unicodable6 Perl6Noob, U+00BD VULGAR FRACTION ONE HALF [No] (½)
21:00 Perl6Noob And that code wouldn't compile even if you added it, 'cause the sig is for two args, but you gave only one
21:00 TreyHarris wait, how does "$!x = ×$y" work? What does unary × do?
21:01 TreyHarris Oh, I see
21:01 Perl6Noob Hah
21:01 TreyHarris Yes, I can't read that one half
21:01 Perl6Noob m: say { ½×$^x}(42)
21:01 camelia rakudo-moar f4cbdb: OUTPUT: «21␤»
21:01 TreyHarris I see "...ONE HALF [No] ()"
21:01 Perl6Noob Look! Unary × divides by 2!
21:01 Perl6Noob m: say { ¼×$^x}(42)
21:01 camelia rakudo-moar f4cbdb: OUTPUT: «10.5␤»
21:02 Perl6Noob And now it divides by 4. It's time-sensitive operator :P
21:02 TreyHarris m: say ×6
21:02 camelia rakudo-moar f4cbdb: OUTPUT: «5===SORRY!5=== Error while compiling <tmp>␤Preceding context expects a term, but found infix × instead␤at <tmp>:1␤------> 3say ×7⏏6␤»
21:02 Perl6Noob hah
21:02 TreyHarris m: say(×6)
21:02 camelia rakudo-moar f4cbdb: OUTPUT: «5===SORRY!5=== Error while compiling <tmp>␤Preceding context expects a term, but found infix × instead␤at <tmp>:1␤------> 3say(×7⏏6)␤»
21:02 TreyHarris m: my $x = ×6; $x.say
21:02 camelia rakudo-moar f4cbdb: OUTPUT: «5===SORRY!5=== Error while compiling <tmp>␤Preceding context expects a term, but found infix × instead␤at <tmp>:1␤------> 3my $x = ×7⏏6; $x.say␤»
21:02 TreyHarris hmm
21:03 Perl6Noob m: sub infix:<⁣> { $^a + $^b }; say 2⁣2
21:03 camelia rakudo-moar f4cbdb: OUTPUT: «4␤»
21:03 Perl6Noob ehehe
21:03 bjz joined #perl6
21:04 Perl6Noob TreyHarris: There's no prefix ×. This is how it's all supposed to look like: http://i.imgur.com/fqmr3VT.png
21:04 TreyHarris Sorry, I was looking at how cross-product works on scalars because I couldn't remember the differences between scalar cross-product and multiplication, and so I missed your joke
21:06 Perl6Noob scalar cross-product is for vectors and stuff.
21:06 Perl6Noob I even invented a shorter trick to calculate it than what they teach at school.
21:06 Perl6Noob True Story!
21:06 TreyHarris I know, but I thought maybe somehow promoted to a vector and then de-promoted back to a scalar, somehow you were getting a one-half operation
21:07 itsame joined #perl6
21:08 itsame joined #perl6
21:08 TreyHarris m: (1 + q++).say
21:08 camelia rakudo-moar f4cbdb: OUTPUT: «1␤»
21:09 TreyHarris m: my \q = 0; (1 + q++).say
21:09 camelia rakudo-moar f4cbdb: OUTPUT: «Cannot resolve caller postfix:<++>(Int); the following candidates␤match the type but require mutable arguments:␤    (Mu:D $a is rw)␤    (Int:D $a is rw)␤␤The following do not match for other reasons:␤    (Bool:D $a is rw)␤    (Bool:U $a is …»
21:09 TreyHarris Crazy stuff like that :-P
21:10 timotimo yeah, \q doesn't have a container to it
21:12 timotimo you can add one, though
21:12 timotimo m: my \q := my $ = 0; (1 + q++).say
21:12 camelia rakudo-moar f4cbdb: OUTPUT: «1␤»
21:12 TreyHarris you should probably get at least a warning if you attempt to declare a siggilless variable with the same name as a quoting construct
21:13 timotimo oh, now i get why you brought this up
21:15 TreyHarris m: q++ === ""
21:15 camelia rakudo-moar f4cbdb: OUTPUT: «WARNINGS for <tmp>:␤Useless use of "===" in expression "q++ === \"\"" in sink context (line 1)␤»
21:15 TreyHarris m: say so q++ === ""
21:15 camelia rakudo-moar f4cbdb: OUTPUT: «True␤»
21:15 timotimo that's a hilarious way to trip up people
21:16 TreyHarris "q++" to get the empty string is a stable of obfuscated Perl entrants. :-)
21:16 timotimo q++, qq++, Q++, either of those
21:17 Cabanossi joined #perl6
21:18 perlpilot joined #perl6
21:18 TreyHarris m: my @f = qw;;; @f.say
21:18 camelia rakudo-moar f4cbdb: OUTPUT: «[]␤»
21:19 labster joined #perl6
21:19 timotimo m: say s+++
21:19 camelia rakudo-moar f4cbdb: OUTPUT: «5===SORRY!5=== Error while compiling <tmp>␤Null regex not allowed␤at <tmp>:1␤------> 3say s+7⏏5++␤»
21:19 timotimo m: say s+a++
21:19 camelia rakudo-moar f4cbdb: OUTPUT: «Use of uninitialized value of type Any 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␤Nil␤»
21:19 timotimo m: s+a++
21:19 camelia rakudo-moar f4cbdb: OUTPUT: «Use of uninitialized value of type Any 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␤»
21:20 timotimo bleh %)
21:20 timotimo m: $_ ="waaaaaat"; s+a++; .say
21:20 camelia rakudo-moar f4cbdb: OUTPUT: «waaaaat␤»
21:20 timotimo m: $_ ="at"; s+a++; .say
21:20 camelia rakudo-moar f4cbdb: OUTPUT: «t␤»
21:20 timotimo m: $_ ="wat"; s+a++; .say
21:20 camelia rakudo-moar f4cbdb: OUTPUT: «wt␤»
21:20 TreyHarris ach, you beat me
21:20 timotimo that's wat i meant
21:25 azawawi timotimo: https://github.com/azawawi/perl6-terminal-caca/blob/master/examples/02-kitchen-sink.pl6 # .polyline primitive :)
21:25 TreyHarris now, I just need to remember WHY I wanted a read-write attribute method in the first place 3 hours ago ;-)
21:29 TreyHarris I learned lots of random tidbits along the way, though. Like, putting .resume in a CATCH when clause that can match both resumable and unresumable exceptions can make your program go into an infinite recursion....
21:38 mcmillhj joined #perl6
21:44 mcmillhj joined #perl6
21:47 Cabanossi joined #perl6
22:00 mcmillhj joined #perl6
22:06 ugexe it'll stop eventually... :)
22:10 Sound joined #perl6
22:10 Sound joined #perl6
22:16 mcmillhj joined #perl6
22:23 aindilis` joined #perl6
22:24 kyclark joined #perl6
22:24 Praise- joined #perl6
22:24 Praise- joined #perl6
22:25 sergot_ joined #perl6
22:25 El_Che_ joined #perl6
22:26 integral joined #perl6
22:26 integral joined #perl6
22:26 petercom1and joined #perl6
22:26 rblackwe_ joined #perl6
22:26 haxmeist1r joined #perl6
22:26 tinita_ joined #perl6
22:26 sivoais_ joined #perl6
22:27 Mithaldu joined #perl6
22:28 ggoebel_ joined #perl6
22:30 smash joined #perl6
22:36 mcmillhj joined #perl6
22:47 kyclark I would love to understand Perl 6 Grammars better, so I’ve started off with a simple one to parse commented lines (starting with “#”) from not: http://lpaste.net/355166
22:48 kyclark It does not work, so I would love some help fixing this.
22:56 mcmillhj joined #perl6
22:57 raiph kyclark: looking now. have you used Grammar::Tracer?
22:58 gfldex kyclark: your comments can only have one '#' without anything following it
22:58 kyclark Ah, I remember someone pointing me to this before.  How do I look at the docs for this?  I don’t see it on modules.perl6.org
22:58 skids kyclark: your comment rule doesn't eat anything but the #
22:59 gfldex `zef install Grammar::Debugger`
22:59 gfldex https://github.com/jnthn/grammar-debugger
23:01 raiph kyclark: in a P6 regex matches any character, including a newline
23:01 raiph er, . in a P6 regex
23:02 raiph so <data> gobbles the rest of the file in one go, and (by default) tokens don't backtrack
23:02 skids kyclark: also, your TOP rule asks for at least one "line" (with no newlines needed) then followed by any number of newlines
23:02 raiph so the final \n+ fails
23:03 kyclark I was grasping at straws over how to write TOP.  I found the brackets “[]” somewhere that made me think “many of these” but then there’s also “<line>+” which I think also means “one or more <line>s"
23:04 kyclark What do the “[]” mean?
23:04 raiph kyclark: it just brackets some atoms together
23:04 raiph without capturing (storing what matched)
23:05 raiph so you could, for example, write [ foo \n ]+ to match one or more lines (consisting of just foo and a newline)
23:06 raiph if you wrote ( foo \n )+ you'd do the same matching but you'd also store the result
23:08 raiph m: / < foo \n > / # presumably a compile error?
23:08 camelia rakudo-moar f4cbdb: ( no output )
23:10 raiph m: say / < foo \n > / for "\n", 'foo', 42 ;  # ah?
23:10 camelia rakudo-moar f4cbdb: OUTPUT: «/ < foo \n > /␤/ < foo \n > /␤/ < foo \n > /␤»
23:10 raiph m: say m/ < foo \n > / for "\n", 'foo', 42 ;  # ah?
23:10 camelia rakudo-moar f4cbdb: OUTPUT: «Nil␤「foo」␤Nil␤»
23:10 raiph m: say m/ < foo \n > / for '\n', 'foo', 42 ;  # ah?
23:10 camelia rakudo-moar f4cbdb: OUTPUT: «「\n」␤「foo」␤Nil␤»
23:12 mcmillhj joined #perl6
23:22 kyclark Are there any docs on grammars I should read?
23:22 kyclark E.g., I think I have a grammar that’s working, but how do I get the parsed data out?
23:24 raiph m: grammar g { token TOP { [ '#'? \N+ \n ]+ } }; say g.parse: "foo\n#bar\n"
23:24 camelia rakudo-moar f4cbdb: OUTPUT: «「foo␤#bar␤」␤»
23:24 raiph m: grammar g { token TOP { [ [ <comment> | \N+ ] \n ]+ }; token comment { '#' \N+ } }; say g.parse: "foo\n#bar\n"
23:24 camelia rakudo-moar f4cbdb: OUTPUT: «「foo␤#bar␤」␤ comment => 「#bar」␤»
23:24 raiph m: grammar g { token TOP { [ [ <comment> | \N+ ] \n ]+ }; token comment { '#' \N+ } }; say (g.parse: "foo\n#bar\n")<comment>
23:24 camelia rakudo-moar f4cbdb: OUTPUT: «[「#bar」]␤»
23:25 kyclark What does “^^” mean in a token?
23:25 raiph m: grammar g { token TOP { [ [ <comment> | \N+ ] \n ]+ }; token comment { '#' \N+ } }; say (g.parse: "foo\n#bar\nbaz\n#quux\n")<comment>
23:25 camelia rakudo-moar f4cbdb: OUTPUT: «[「#bar」 「#quux」]␤»
23:25 raiph m: grammar g { token TOP { [ [ <comment> | \N+ ] \n ]+ }; token comment { '#' \N+ } }; say (g.parse: "foo\n#bar\nbaz\n#quux\n")<comment>[1]
23:25 camelia rakudo-moar f4cbdb: OUTPUT: «「#quux」␤»
23:26 raiph kyclark: start of a line; ^ means start of a string (which may contain multiple lines)
23:28 mcmillhj joined #perl6
23:28 raiph kyclark: https://docs.perl6.org/language/regexes#^^,_Start_of_Line_and_$$,_End_of_Line
23:30 timotimo it'd be kinda cool if we could put the url of a gist or other kind of paste and follow it up with some extra code
23:33 kyclark It’s works if I say “token TOP { [ [ <comment> | <data> ] \n ]+ }”
23:33 kyclark But not if I say “token TOP { [ <line> \n ]+ }"
23:33 kyclark Where “token line { <comment> | <data> }"
23:34 kyclark http://lpaste.net/355166
23:35 mcmillhj joined #perl6
23:38 kyclark It fails to match “line” after it’s done parsing all the data, so it ends with a FAIL.
23:40 raiph i'm getting failure in *both* cases
23:40 raiph i think...
23:41 raiph yeah
23:41 BenGoldberg joined #perl6
23:43 raiph token TOP { [ <line> \n ]+ } will fail because the last (empty) line won't match
23:43 raiph token TOP { [ [ <comment> | <data> ] \n ]+ } fails for same reason
23:44 raiph both the comment and the data tokens require at least one character
23:45 raiph (btw, the comment perhaps ought to be '#' \N* rather than '#' \N+)
23:45 timotimo you should check out the % operator, which you can put after a quantifier and it'll mean "and in between the things that are quantified, match this"
23:45 timotimo and %% is "optionally, match the in-between thing at the end once"
23:46 raiph timotimo: do you mention that because of the very specific scenario of lines of two types (comments and not-comments)?
23:46 timotimo well, lines that end in \n, except at the end of the file where it may not have a \n in between
23:47 raiph ah
23:47 kyclark This works: http://lpaste.net/355166
23:48 kyclark Dang, I have to go home now.  Maybe I can call again sometime soon?
23:48 raiph m: grammar g { token TOP { [ <comment> | <data> ]+ %% \n+ } }
23:48 camelia rakudo-moar f4cbdb: ( no output )
23:48 raiph kyclark: hope you do
23:50 raiph m: grammar g { token TOP { [ [ '#' \N* ] | .+ ]+ %% \n+ } }; say g.parse: "a\n#b"
23:50 camelia rakudo-moar f4cbdb: OUTPUT: «「a␤#b」␤»
23:51 raiph m: grammar g { token TOP { [ [ '#' \N* ] | \N+ ] \n ]+ } }; say g.parse: "a\n#b"
23:51 camelia rakudo-moar f4cbdb: OUTPUT: «5===SORRY!5=== Error while compiling <tmp>␤Malformed regex␤at <tmp>:1␤------> 3 { token TOP { [ [ '#' \N* ] | \N+ ] \n 7⏏5]+ } }; say g.parse: "a\n#b"␤»
23:52 raiph m: grammar g { token TOP { [ [ '#' \N* | \N+ ] \n? ]+ } }; say g.parse: "a\n#b"
23:52 camelia rakudo-moar f4cbdb: OUTPUT: «「a␤#b」␤»
23:53 raiph m: grammar g { token TOP { [ [ '#' \N* ] | \N+ ]+ %% \n? } }; say g.parse: "a\n#b"
23:53 camelia rakudo-moar f4cbdb: OUTPUT: «「a␤#b」␤»
23:56 kurahaupo joined #perl6

| Channels | #perl6 index | Today | | Search | Google Search | Plain-Text | summary

Perl 6 | Reference Documentation | Rakudo