Perl 6 - the future is here, just unevenly distributed

IRC log for #perl6, 2016-08-13

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:10 BenGoldberg joined #perl6
00:10 wbill joined #perl6
00:14 skids m: use NativeCall; class C is repr("CStruct") { has int32 $.a }; class D is repr("CStruct") { has C $.b; method set_b ($v) { $!b := $v }}; my C $c .= new; my D $d .= new; $d.b.perl.say; $d.set_b($c); # :-/  I guess the docs are a bit ahead of the implementation?
00:14 camelia rakudo-moar be7ce0: OUTPUT«C␤Can only store CStruct attribute in CStruct slot in CStruct␤  in method set_b at <tmp> line 1␤  in block <unit> at <tmp> line 1␤␤»
00:20 MasterDuke unmatched}: thanks for the PRs, i didn't know trailing commas aren't valid JSON
00:24 adu joined #perl6
00:24 timotimo yeah, json kind of sucks that way ;(
00:25 dj_goku joined #perl6
00:25 dj_goku joined #perl6
00:27 zacts joined #perl6
00:32 unmatched} MasterDuke: I frequently find them in META files (and myself fall to the same issue)
00:32 unmatched} And this doesn't sound like a bad idea: https://twitter.com/jnthnwrthn​gtn/status/764240079841787904
00:47 canopus joined #perl6
00:49 aries_liuxueyang joined #perl6
00:49 dalek doc: 5a41939 | Altai-man++ | doc/Type/ (6 files):
00:49 dalek doc: Make examples compile
00:49 dalek doc: review: https://github.com/perl6/doc/commit/5a419392f0
00:52 dalek doc: 3ef4a0c | Altai-man++ | doc/Type/IO.pod6:
00:52 dalek doc: Fix example identation
00:52 dalek doc: review: https://github.com/perl6/doc/commit/3ef4a0c55d
01:03 rpburkholder joined #perl6
01:38 bob778 joined #perl6
01:47 ilbot3 joined #perl6
01:47 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:57 pierre_ joined #perl6
02:13 dj_goku joined #perl6
02:13 dj_goku joined #perl6
02:21 noganex joined #perl6
02:39 labster joined #perl6
02:48 pierre_ joined #perl6
02:51 ovibos left #perl6
02:54 Actualeyes joined #perl6
03:05 nightfrog joined #perl6
03:22 pierre_ joined #perl6
03:27 dalek doc: 38a6482 | (Wenzel P. P. Peppmeyer)++ | doc/Type/Callable.pod6:
03:27 dalek doc: better example for .assuming
03:27 dalek doc: review: https://github.com/perl6/doc/commit/38a6482ee8
03:27 dalek doc: 410a848 | (Wenzel P. P. Peppmeyer)++ | doc/Language/typesystem.pod6:
03:27 dalek doc: classes are packages (kind of)
03:27 dalek doc: review: https://github.com/perl6/doc/commit/410a848d60
03:28 perl69 joined #perl6
04:01 dj_goku joined #perl6
04:10 MilkmanDan joined #perl6
04:17 mtj_ joined #perl6
04:23 pierre_ joined #perl6
04:27 Cabanossi joined #perl6
04:55 pduh joined #perl6
04:55 pduh left #perl6
04:55 bob777 joined #perl6
04:55 pduh joined #perl6
05:10 andrzejku joined #perl6
05:12 andrzejku hi
05:12 andrzejku :)
05:12 andrzejku joined #perl6
05:14 andrzejku hi :)
05:36 CIAvash joined #perl6
05:43 sammers ola
05:45 andrzejku I am looking for Perl friend
05:49 dj_goku joined #perl6
06:01 titsuki Hi #perl6. I have a question. Does anyone know how to handle void* in the context of using NativeCall ? Just using "Pointer is rw" as an argument seems insufficient, because it needs a conversion such as P6 Str to C void* internally.
06:06 titsuki I'm creating the Perl 6 interface of this line: https://github.com/jtsiomb/kdt​ree/blob/master/kdtree.c#L211
06:24 trnh joined #perl6
06:24 trnh joined #perl6
06:32 trnh joined #perl6
06:34 setty2 joined #perl6
06:42 AlexDaniel joined #perl6
06:42 holyghost joined #perl6
06:42 holyghost gm, have a nice weekend, we have a holiday on monday :-)
06:43 AlexDaniel joined #perl6
06:48 andrzejku joined #perl6
06:53 rindolf joined #perl6
07:06 Woodi titsuki: OpaquePointer ?  https://perl6advent.wordpress.com/2015/12​/21/day-21-nativecall-backs-and-beyond-c/
07:08 titsuki Woodi: Thanks. However OpaquePointer is deprecated and same as Pointer functionally.
07:11 jluis joined #perl6
07:14 TheLemonMan joined #perl6
07:17 darutoko joined #perl6
07:26 titsuki Perl 6 has a cast subroutine for converting a C stuff to a P6 stuff, but I'm not sure how to dot it in the case of converting P6 to C stuff.
07:26 titsuki m: use NativeCall; my $a = Pointer.new; nativecast(Str, $a).WHAT.say
07:26 camelia rakudo-moar baeabb: OUTPUT«(Str)␤»
07:27 titsuki *do it
07:35 pierre_ joined #perl6
07:36 andrzejku joined #perl6
07:36 pierre_ joined #perl6
07:38 dj_goku joined #perl6
07:46 labster joined #perl6
07:46 wbill joined #perl6
07:58 jluis joined #perl6
07:58 firstdayonthejob joined #perl6
08:03 ab5tract skids: regarding nativecall, I believe that limitation is only for repr('CStruct'), not repr('CPonter')
08:05 kaare_ joined #perl6
08:05 andrzejku joined #perl6
08:06 cyphase joined #perl6
08:12 ab5tract ah, nevermind. you can't add attributes there wither
08:12 ab5tract *either
08:15 hankache joined #perl6
08:15 wamba joined #perl6
08:17 dalek Inline-Perl5: ca3950f | niner++ | META.info:
08:17 dalek Inline-Perl5: Version 0.10
08:17 dalek Inline-Perl5: review: https://github.com/niner/Inl​ine-Perl5/commit/ca3950fa32
08:18 dalek doc: 338a351 | (Wenzel P. P. Peppmeyer)++ | util/list-missing-methods.p6:
08:18 dalek doc: allow comments in util/ignored-methods.txt
08:18 dalek doc: review: https://github.com/perl6/doc/commit/338a351305
08:18 dalek doc: e24b596 | (Wenzel P. P. Peppmeyer)++ | util/ignored-methods.txt:
08:18 dalek doc: ignore some methods in Str
08:18 dalek doc: review: https://github.com/perl6/doc/commit/e24b596a96
08:18 dalek doc: 70d3629 | (Wenzel P. P. Peppmeyer)++ | util/list-missing-methods.p6:
08:18 dalek doc: comment on comments
08:18 dalek doc: review: https://github.com/perl6/doc/commit/70d3629b31
08:18 dalek doc: 67306ab | (Wenzel P. P. Peppmeyer)++ | doc/Type/Str.pod6:
08:18 dalek doc: make file parseable
08:18 dalek doc: review: https://github.com/perl6/doc/commit/67306aba53
08:20 dalek doc: 9441261 | (Wenzel P. P. Peppmeyer)++ | util/ignored-methods.txt:
08:20 dalek doc: forgot one method to ignore
08:20 dalek doc: review: https://github.com/perl6/doc/commit/94412613fd
08:26 spider-mario joined #perl6
08:26 jluis joined #perl6
08:28 RabidGravy joined #perl6
08:44 yqt joined #perl6
08:51 gfldex m: my $l = List; dd $l(1,2,3);
08:51 camelia rakudo-moar baeabb: OUTPUT«(1, 2, 3)␤»
08:58 hankache m: my $a = 1,2,3; say $a.WHAT;
08:58 camelia rakudo-moar baeabb: OUTPUT«WARNINGS for <tmp>:␤Useless use of constant integer 2 in sink context (lines 1, 1)␤Useless use of constant integer 3 in sink context (lines 1, 1)␤(Int)␤»
09:00 hankache m: my @a = 1,2,3; say @a.WHAT;
09:00 camelia rakudo-moar baeabb: OUTPUT«(Array)␤»
09:00 hankache any idea why ^^ ?
09:01 ab5tract hankache: this is a bit shocking to me.. I don't remember a scalar context there, in the first case
09:02 hankache why does = have higher precedence over the comma when it comes to scalars but not arrays?
09:02 dalek doc: 24cce0f | (Wenzel P. P. Peppmeyer)++ | util/list-missing-methods.p6:
09:02 dalek doc: split returns empty strings that are defined
09:02 dalek doc: review: https://github.com/perl6/doc/commit/24cce0f919
09:02 dalek doc: 64080eb | (Wenzel P. P. Peppmeyer)++ | util/ignored-methods.txt:
09:02 dalek doc: add to be ignored methods for Array
09:02 ab5tract but perhaps it's an evolution of the first-arg rules
09:02 dalek doc: review: https://github.com/perl6/doc/commit/64080ebacd
09:02 dalek doc: 0dc31df | (Wenzel P. P. Peppmeyer)++ | CONTRIBUTING.md:
09:02 dalek doc: tell contributors about list-missing-methods.p6
09:02 dalek doc: review: https://github.com/perl6/doc/commit/0dc31dfd40
09:02 gfldex because the compiler knows what a @-sigil is for
09:02 quester joined #perl6
09:02 gfldex that's one of the many reasons to have the @-sigiled container
09:03 hankache ab5tract yeah I thought it would take the whole list
09:03 ab5tract hankache: it is similar to what happens in p5: @a on the LHS of '=' puts the RHS in list context
09:03 ab5tract in p5 you get the length of the list in scalar, but here it looks like we pull the first one
09:04 huf (you totally dont get the length of a list in scalar context in p5)
09:04 hankache gfldex so this is normal?
09:04 gfldex it's intentional and works the same way as in signatures
09:04 ab5tract elements of array
09:05 gfldex m: my ($i, @a) = 1,2,3; dd @a;
09:05 camelia rakudo-moar baeabb: OUTPUT«Array @a = [2, 3]␤»
09:06 gfldex m: my ($i, $j) = 1,2,3; dd $i, $j;
09:06 camelia rakudo-moar baeabb: OUTPUT«Int $i = 1␤Int $j = 2␤»
09:06 hankache ok thanks
09:06 gfldex the @-sigiled behaviour is the odd one out acutally (as it is magical)
09:09 ab5tract huf: yes, that's a good point. if it is an actual "list" on the RHS, you do not get the length of that.
09:10 ab5tract gfldex: now that you point it out, it's quite familiar indeed
09:10 kurahaupo joined #perl6
09:10 ab5tract I got it mixed up with never really needing parens on the RHS when assigning into an @
09:13 nine Turns out, mapping a runtime construct like Perl 5 subroutine attributes to a compile time thing like Perl 6 traits is not easy at all.
09:18 nadim joined #perl6
09:19 nadim Good Morning all, good to be back after 2 months away.
09:21 hankache welcome back nadim
09:21 nadim is panda still the favorit installer? and why isn't it copied to /home/.../rakudo/install/share/perl6/site/bin after boostrapping?
09:21 nadim hankache++
09:21 gfldex zef works better and understand META6
09:21 jluis joined #perl6
09:21 nadim zef it is then
09:21 gfldex both wont tell you what $PATH to set
09:23 nadim panda does but there is nothing in that path
09:23 hankache I think the REPL is a bit broken: my $a = 1,2,3; returns (1,2,3)
09:23 gfldex do you got $HOME/.perl6 ?
09:24 ab5tract hankache: the return value of the expression is the list itself. if you check $a, it should only be 1 still
09:24 gfldex the REPL is incomplete
09:25 hankache ab5tract yes $a is still 1
09:25 nadim gfldex: yes there's a .perl6 but empty after panda bootstrap
09:26 dj_goku joined #perl6
09:26 dj_goku joined #perl6
09:26 ab5tract this is a pretty interesting case though:
09:26 ab5tract m: my ($a,$b) = my $c = (1,2,3); dd $a, $b, $c
09:26 camelia rakudo-moar baeabb: OUTPUT«Int $a = 1␤Int $b = 2␤List $c = $(1, 2, 3)␤»
09:27 hankache in addition if you write my $a = 1; [hit enter] and then write say $a; it says variable $a not recognized. I remember this working before, no?
09:27 ab5tract hankache: yeah, strict mode is on everywhere now.
09:29 nadim bleah! seg fault for the first thing I want to do, well second, installing zef.
09:31 labster joined #perl6
09:34 AlexDaniel ab5tract: so what is interesting about it?
09:42 pmurias joined #perl6
09:56 nine nadim: sounds decidedly odd. Did panda's bootstrap complete successfully?
09:58 kurahaupo joined #perl6
10:32 mvorg joined #perl6
10:32 stmuk_ is there anyway of passing a "no pragma" from the command line?
10:35 geekosaur -X and prefix with No, usually
10:35 geekosaur whoops
10:35 geekosaur wrong channel :/
10:35 stmuk_ 5to6-nutshell suggests not
10:36 geekosaur no, I don't think there's a way to do it currently
10:40 wamba joined #perl6
10:47 kurahaupo joined #perl6
10:48 nadim nine:  no it didnät. it seemed to succeed, tells me to add some path in my $PATH but that one is empty after running bootstrap
10:53 yqt joined #perl6
11:09 quester left #perl6
11:14 dj_goku joined #perl6
12:02 canopus joined #perl6
12:06 skarn left #perl6
12:12 masak TimToady: long-term, how many of the S02/Grammatical Categories would you expect to be definable as subs?
12:13 dalek doc: fb86f5e | gfldex++ | doc/Language/typesystem.pod6:
12:13 dalek doc: link to Submethod
12:13 dalek doc: review: https://github.com/perl6/doc/commit/fb86f5ec86
12:13 masak (currently we have normal operators (but not metaoperators) and terms in Rakudo, I believe)
12:14 dj_goku joined #perl6
12:14 masak oh, and trait_mods
12:15 masak I ask because probably many of these could be definable as macros, as long as we figure out decent parameters for them.
12:19 kid51 joined #perl6
12:21 pierre_ joined #perl6
12:24 dalek whateverable: d1d936c | (Daniel Green)++ | Bisectable.p6:
12:24 dalek whateverable: We shouldn't provide any stdin when we test the starting points
12:24 dalek whateverable: review: https://github.com/perl6/wha​teverable/commit/d1d936c76b
12:25 gfldex m: dd (my method {});
12:25 camelia rakudo-moar 32902f: OUTPUT«Method <anon> = method <anon> (Mu $: *%_) { #`(Method|47560688) ... }␤»
12:26 pmurias masak: re having 007 target js, maybe it would be interesting if I made 007 also target QAST (so it would support js, moarvm and jvm)
12:26 masak pmurias: most certainly. let me know what I can do to help.
12:27 telex joined #perl6
12:27 masak pmurias: offhand, I'm thinking it might be easier for you if I write the JS backend first -- extending it a second time will be way simpler.
12:28 pmurias write any backend would make subsequent ones easier as that would help define the line between backend and interpreter
12:28 masak right
12:29 masak pmurias: I just created https://github.com/masak/007/issues/169 to track this
12:34 dj_goku joined #perl6
12:35 RabidGravy oh I half typed something last night in reply to something, forgot to press enter then got distracted
12:35 RabidGravy oh well
12:41 ambs joined #perl6
12:42 pmurias masak: I'll look it it more closely once I do the current nqp-js cleanup/hack removal
12:46 masak cool.
12:46 masak I'll bump up the priority of the JS backend, then.
12:47 masak as I hint at in that issue -- https://github.com/masak/007/issues/166 -- the task feels like 90% straightforward and 10% real tough work
12:47 titsuki joined #perl6
12:47 masak so I might be able to code up something Mostly Working quite rapidly
12:48 masak enough to be useful
13:04 skids joined #perl6
13:22 andrzejku joined #perl6
13:31 pierre_ joined #perl6
13:32 stmuk_
13:47 masak stmuk_:
13:47 masak (hope this invisible ink works)
13:48 stmuk_ I can't find Acme::Bleach for p6! :(
13:51 grondilu joined #perl6
13:55 andrzejku joined #perl6
13:59 TRUMP-PENCE joined #perl6
14:04 pecastro joined #perl6
14:13 TRUMP-PENCE joined #perl6
14:27 nowan joined #perl6
14:31 timotimo https://github.com/thundergnat/Acme-Scrub
14:31 timotimo stmuk_: -^
14:32 nowan_ joined #perl6
14:37 nightfrog joined #perl6
14:39 nightfrog joined #perl6
14:40 BenGoldberg joined #perl6
14:46 kurahaupo joined #perl6
14:48 khw joined #perl6
14:51 zacts joined #perl6
14:54 ARM9 joined #perl6
14:54 n1lp7r joined #perl6
14:56 giraffe joined #perl6
15:01 timotimo yo mst, would you like to throw out Guest_84847? they're doing the "X is not doing allah is doing" routine
15:01 timotimo over in #krita
15:02 lucs Is something like this for example implementable?: 「q:c<>'a<$b>c'」, the idea being to have something other than curly brackets to do closure interpolation?
15:04 * lucs likes to build up LaTeX strings, but having to escape all the ordinary curlies is quite annoying.
15:16 mst timotimo: seems to've gone already. it helps if you use 'mst:' to hilight me so I actually see the request
15:17 timotimo ah! i'll try to remember that the next time
15:17 timotimo and yes, an op in #krita has appeared in the mean time
15:48 ugexe gfldex: nadim: zef will tell you where it installed bin files (what $PATH to set), and what bin files it installed to that path
15:50 Wiertek joined #perl6
15:55 ugexe if you give it multiple install locations it will give you *all* the paths it installed bin files to even: https://gist.github.com/ugexe/b​0bf45798d3b97e22c15127fa4b3620d
15:56 AlexDaniel TIL brotli is a great general purpose compression algorithm: https://github.com/perl6/whateverab​le/issues/23#issuecomment-239627248
16:03 andrzejku joined #perl6
16:09 prussian joined #perl6
16:10 ab5tract AlexDaniel: The interesting bit is that in that expression, the scalar $c does end up with the list
16:11 ab5tract When I golfed that, I was trying to verify that the RHS List really was the return value of the expression
16:13 ab5tract Putting another '=' to the left puts the 'my $ = List' into RHS which gives the usual scalar-LHS-list-RHS semantics but leaves the return value of the original expression in $c as it is evaluated
16:13 ab5tract Which feels nicely Perlish to me :)
16:17 ab5tract Gar, how did those RHS parens slip in.. Nevermind, my reasoning was based on a grave misunderstanding
16:18 zacts joined #perl6
16:25 MilkmanDan joined #perl6
16:35 TimToady .tell hankache the original motivation for making $ assignment tighter than @ assignment was actually so that things like loop ($i = 100, $j = 0; $i; --$i, ++$j) {} would work the way C/P5 people expect, while not requiring parens on @foo = 1,2,3
16:35 yoleaux TimToady: I'll pass your message to hankache.
16:35 firstdayonthejob joined #perl6
16:43 nadim ugexe: there is nothing in the path
16:43 TimToady masak: well, macros and methods are subs too, they're just using funny dispatchers to call them at funny times with funny arguments
16:44 TimToady after all, on some level it's all functions in the FP view of reality
16:44 mst timotimo: yeah, some people hilight on their nick anywhere but, er, that results in my scrollback being full of people talking about cpan modules I worked on ;)
16:48 TimToady masak: that's not to say that some grammatical categories can't benefit greatly from regex/macro sugar in terms of readability
16:48 AlexDaniel m: my $c = (1,2,3); dd $c
16:48 camelia rakudo-moar e89721: OUTPUT«List $c = $(1, 2, 3)␤»
16:49 mst TimToady: this is why I really enjoy fexpr based lisps
16:49 mst an fexpr gets handed its arguments plus an environment, so you can control what's evaluated then
16:49 AlexDaniel ab5tract: :)
16:50 mst generalises macros and functions at the cost of being hilariously difficult to optimise
16:54 telex joined #perl6
16:55 TimToady in our case, we parse everything with a Cursor that contains (in theory) everything you need to know about the current language and parse state, and it's just the action routines you fire off at reduction time that decide how to bake in various abstraction policies
16:55 TimToady I say "in theory" because we still pass a few things down through dynamic variables that really ought to attach to the Cursor, like %*LANG
17:05 MilkmanDan joined #perl6
17:08 BenGoldberg m: dd %*LANG
17:08 camelia rakudo-moar e89721: OUTPUT«Failure.new(exception => X::Dynamic::NotFound.new(name => "\%*LANG"), backtrace => Backtrace.new)␤»
17:08 pierre_ joined #perl6
17:13 TimToady it's in the compiler, not your code
17:15 TimToady m: BEGIN %*LANG<Regex>.^name.say
17:15 camelia rakudo-moar e89721: OUTPUT«Perl6::RegexGrammar␤»
17:17 TimToady arguably BEGIN should not be able to poke up into the compiler like that, at least without some kind of MONKEY
17:22 TimToady m: BEGIN %*LANG<Regex> := grammar Oops { token unbalanced($x) { $x { say "haha" } } }; /foo/
17:22 camelia rakudo-moar e89721: OUTPUT«===SORRY!===␤P6opaque: no such attribute '$!from' in type NQPCursor when trying to get a value␤»
17:22 TimToady m: BEGIN %*LANG<Regex> := grammar Oops { method unbalanced($x) { die "haha" } }; /foo/
17:22 camelia rakudo-moar e89721: OUTPUT«===SORRY!===␤haha␤»
17:23 TimToady and you shouldn't be able to change the language your parents think they're parsing like that
17:24 TimToady currently it's just "with great power comes great responsibility" :)
17:25 * TimToady suspects we rely on that power currently to get as far with slangs as we do...
17:28 ugexe nadim: it sounds like your rakudo environment is borked if neither zef or panda are giving you bin/ files
17:29 ugexe infact zef and panda have nothing to do with the actual files in bin/; rakudo itself installs wrappers to that location that point to the actual scripts
17:31 ugexe https://github.com/rakudo/rakudo/blob/nom/src/​core/CompUnit/Repository/Installation.pm#L268
17:35 TakinOver joined #perl6
17:36 japhb joined #perl6
17:38 Nex6 joined #perl6
17:40 xfix joined #perl6
17:43 TakinOver joined #perl6
17:49 BenGoldberg m: my @fib := (1, 1, *+* ...^ *).cache; say @fib[^10];
17:49 camelia rakudo-moar e89721: OUTPUT«(1 1 2 3 5 8 13 21 34 55)␤»
17:50 BenGoldberg m: my @fib := (1, 1, *+* ...^ *);
17:50 camelia rakudo-moar e89721: OUTPUT«Type check failed in binding; expected Positional but got Seq (?)␤  in block <unit> at <tmp> line 1␤␤»
17:51 BenGoldberg m: my $fib := (1, 1, *+* ...^ *); say $fib[^10];
17:51 camelia rakudo-moar e89721: OUTPUT«(1 1 2 3 5 8 13 21 34 55)␤»
17:51 BenGoldberg m: my $fib := (1, 1, *+* ...^ *); say $fib[^5] for 1..2;
17:51 camelia rakudo-moar e89721: OUTPUT«(1 1 2 3 5)␤(1 1 2 3 5)␤»
17:52 BenGoldberg m: my $fib := (1, 1, *+* ...^ *); say $fib.WHAT
17:52 camelia rakudo-moar e89721: OUTPUT«(Seq)␤»
17:54 BenGoldberg m: my $fib := (1, 1, *+* ...^ *); for $fib { .say; last if ++ $ > 5 }; for $fib { .say; last if ++ $ > 5 };
17:54 camelia rakudo-moar e89721: OUTPUT«1␤1␤2␤3␤5␤8␤This Seq has already been iterated, and its values consumed␤(you might solve this by adding .cache on usages of the Seq, or␤by assigning the Seq into an array)␤  in block <unit> at <tmp> line 1␤␤»
17:55 BenGoldberg m: my $fib := (1, 1, *+* ...^ *); dd $fib
17:55 camelia rakudo-moar e89721: OUTPUT«(1, 1, 2, 3, 5, 8, 13, 21, 34, 55... (lazy list)␤»
17:55 BenGoldberg m: my $fib := 1, 1, *+* ...^ *; dd $fib
17:55 camelia rakudo-moar e89721: OUTPUT«(1, 1, 2, 3, 5, 8, 13, 21, 34, 55... (lazy list)␤»
17:55 * BenGoldberg wonders why he could print out $fib[^5] twice.
17:57 sena_kun joined #perl6
18:04 TakinOver joined #perl6
18:07 harovali joined #perl6
18:20 dataangel joined #perl6
18:22 dataangel I noticed that Perl six will detect some things at compile time, but not something obvious like this: my $test = 3 + "hello"; # why not? Doesn't seem to rely on anything dynamic.
18:24 TakinOver joined #perl6
18:24 raiph dataangel: Most Perl 6 string and numeric types implicitly coerce between string and numeric interpretations by default; you have to be explicit if you don't want that
18:26 dataangel raiph: that code produces an error at runtime though
18:27 dataangel raiph: I'm just wondering if it could be compile time instead
18:29 Wiertek joined #perl6
18:30 TimToady we could probably do better there
18:30 TimToady we do know the exact candidate list at compile time
18:31 TimToady but currently the checks are only on nominal type, and Cool is cool with both numbers and strings
18:32 dataangel Interesting
18:32 trnh joined #perl6
18:32 trnh joined #perl6
18:32 TimToady BenGoldberg: I believe .[^5] implies a .cache
18:33 dataangel Why does the syntax for hashes have the values in quotes but not the keys? e.g.: my %capitals = (UK => 'London', Germany => 'Berlin');
18:33 * dataangel is working his way through the introduction
18:33 TimToady => autoquotes an identifier on the left
18:34 dataangel Interesting feature but if you're going to have it why only the left?
18:34 dataangel Do hashes usually only have string keys?
18:35 pierre_ joined #perl6
18:35 TimToady because keys are much more likely to be identifiers than values are, and because we also use them for named arguments in many situations
18:35 TimToady in the :foo(1) form it's enforced to be an identifier too, you'll note
18:36 TimToady you have to use the => form if you want 'United States' => 'Washington', or 42 => 43
18:36 dataangel Not sure what you mean when you say they are more likely to be identifiers, you mean they are more likely to be strings? I would usually consider the word "identifier" to mean something like local variable
18:37 TimToady identifiers are a subset of strings, but we only autoquote identifiers
18:37 TimToady because, well, otherwise you'd have quotes anyway...
18:38 TimToady for similar reasons, normal hashes default to string keys, and you have to work a little harder to use objects as keys
18:38 TimToady it's merely that people often use them that way, so it's a reasonable default
18:39 dataangel hmm I see
18:44 dataangel p6: my @a; say @a.WHAT; my @b[5]; say @b.WHAT; my @c[5;3]; say @c.WHAT; # all of these are the same type?
18:44 camelia rakudo-moar e89721: OUTPUT«(Array)␤(Array)␤(Array)␤»
18:48 TimToady m: my @a; say @a.shape; my @b[5]; say @b.shape; my @c[5;3]; say @c.shape;
18:48 camelia rakudo-moar e89721: OUTPUT«(*)␤(5)␤(5 3)␤»
18:48 TimToady depends on how you define "type"
18:48 heatsink joined #perl6
18:48 TimToady nominally, they're the same type
18:49 TakinOver joined #perl6
18:50 MilkmanDan joined #perl6
18:50 labster joined #perl6
18:59 dalek whateverable: 700cb30 | (Daniel Green)++ | Benchable.p6:
18:59 dalek whateverable: Add the ability to benchmark different snippets of code to each other at HEAD
18:59 dalek whateverable: review: https://github.com/perl6/wha​teverable/commit/700cb30ade
19:26 noganex joined #perl6
19:29 timotimo ooooh!
19:47 dataangel p6: sub my-test (Int:D $x) { say $x; }; my Int $y; my-test $y; # why is the error complaining about receiving a type object, instead of violating the defined constraint?
19:47 camelia rakudo-moar fe90be: OUTPUT«Parameter '$x' requires an instance of type Int, but a type object was passed.  Did you forget a .new?␤  in sub my-test at <tmp> line 1␤  in block <unit> at <tmp> line 1␤␤»
19:48 timotimo that's exactly what violating a definedness constraint means
19:50 dataangel timotimo: but I didn't pass a type object did I?
19:50 dataangel I don't see how a type object comes into it
19:50 timotimo m: my Int $y; say $y.perl
19:50 camelia rakudo-moar fe90be: OUTPUT«Int␤»
19:50 dataangel Assuming that a type object is an object that represents a type, like what I assume is being returned by WHAT
19:50 timotimo a scalar variable starts out with the type object in it as the default value
19:50 geekosaur no, a type object is a typed "undefined"
19:51 TimToady it's like a gluon that just carries color charge without being a "real" particle
19:52 dataangel geekosaur: I see, and (T) is the string representation for a type object for a type T?
19:52 geekosaur in general, yes
19:52 TimToady it's the gist
19:52 TimToady if you actually try to convert to string, it carps
19:53 TimToady m: print Any
19:53 camelia rakudo-moar fe90be: 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␤»
19:53 TimToady m: print Any.gist
19:53 camelia rakudo-moar fe90be: OUTPUT«(Any)»
19:55 dataangel Coming from python, it's not surprising to me that you can do print Any.gist, but that you can write it that way suggests to me that the type object is an object that represents a type like I said before, even if it also doubles as the initial value for unassigned variables. But maybe I misunderstand?
19:56 dataangel Is there something like dir(foo) in python, that lists all of the methods on an object?
19:56 TimToady m: say Int.^methods
19:56 camelia rakudo-moar fe90be: OUTPUT«(Int Num Rat FatRat abs Bridge chr sqrt base polymod expmod is-prime floor ceiling round lsb msb narrow Range sign sin tan cotan acosech conj atan2 cosec pred asec acotan cosh acos acosec sech unpolar log10 atanh log exp acosh truncate sinh tanh acotanh Re…»
19:56 TimToady m: say 42.^methods
19:56 camelia rakudo-moar fe90be: OUTPUT«(Int Num Rat FatRat abs Bridge chr sqrt base polymod expmod is-prime floor ceiling round lsb msb narrow Range sign sin tan cotan acosech conj atan2 cosec pred asec acotan cosh acos acosec sech unpolar log10 atanh log exp acosh truncate sinh tanh acotanh Re…»
19:57 TimToady m: say Int.^mro
19:57 camelia rakudo-moar fe90be: OUTPUT«((Int) (Cool) (Any) (Mu))␤»
19:57 dataangel huh, wouldn't have expected those to be the same
19:57 timotimo those meaning Int.^methods vs 42.^methods?
19:57 dataangel Yes
19:57 TimToady yes, Int is an undefined 42
19:58 TimToady m: say Int ~~ Cool
19:58 camelia rakudo-moar fe90be: OUTPUT«True␤»
19:58 TimToady this is just like asking 'Is Socrates a man?'
19:58 TimToady well, Socrates is more like 42 there
19:58 dataangel Yeah that output is consistent with that, interesting. So separately is there a notion of objects that represent types, like what you would get back in python from calling type(foo), or writing foo.__type__?
19:58 TimToady m: say 42 ~~ Cool
19:58 camelia rakudo-moar fe90be: OUTPUT«True␤»
19:59 TimToady but we can reason about classes without having an instance of it
20:00 TimToady .^ gets you to the metaobject, and you can also go really deep to get the representation, which is orthogonal to the other kinds of type
20:00 TimToady m: say 42.REPR
20:00 camelia rakudo-moar fe90be: OUTPUT«P6opaque␤»
20:01 TimToady note that the representation is largely invisible even to the class definition itself
20:01 TimToady our object system is agnostic about whether the underlying object is represented like a C++ object or a Python object
20:02 TimToady s/object/class/
20:02 TimToady "representational polymorphism", to use the 50¢ phrase
20:03 dataangel p6: my $x = Int.^ # can I get a reference to the meta-object itself?
20:03 camelia rakudo-moar fe90be: OUTPUT«5===SORRY!5=== Error while compiling <tmp>␤Malformed postfix call␤at <tmp>:1␤------> 3my $x = Int.^7⏏5 # can I get a reference to the meta-obj␤»
20:03 TimToady m: say Int.HOW
20:03 camelia rakudo-moar fe90be: OUTPUT«Perl6::Metamodel::ClassHOW.new␤»
20:04 dataangel Why in the word HOW?
20:04 TimToady $x.^foo($y) is short for $x.HOW($x, $y)
20:04 TimToady it's how it works!
20:05 dataangel Although I guess it is consistent with the capitalized question words, e.g. WHAT
20:05 TimToady but if you want an acronym, it's Higher Order Workings
20:05 TimToady that too
20:05 TimToady almost nothing in p6 is done for a single reason
20:05 dataangel Pretty cool so far
20:05 timotimo everything also has the additional reason of "larry wall is simply bonkers"
20:05 andrzejku joined #perl6
20:06 dataangel lol
20:06 timotimo i mean that in a loving manner
20:07 dataangel Does Perl six have a GIL? Like if I create multiple threads will they really run at the same time, or will they end up running lockstep like in python?
20:08 timotimo no GIL to speak of
20:08 timotimo which also means you have to be a bit careful, or suffer data loss
20:08 timotimo at the moment, arrays being resized by multiple threads at the same time can cause a segfault, but we're very close to landing a little redesign of the internals for arrays that makes that "only" lose data, not crash
20:08 dataangel timotimo: just the usual threading race condition sort of stuff, or can I actually crash the VM?
20:09 dataangel Beat me to it ;)
20:09 timotimo other than that, we have excellent data structures and mechanisms to go with "nothing shared" style of coding
20:09 timotimo promises, channels (a little bit like Go), supplies (like observables or "reactive" streams or what have you), stuff like that
20:09 timotimo a fair bit of asynchronous I/O, like with sockets and processes
20:10 AlexDaniel dataangel: well, if your goal is to crash it then you will ;)
20:10 timotimo yes, you'll definitely be able to crash the VM by trying.
20:10 timotimo m: use NativeCall; my Pointer $foo .= new(0); say $foo; say $foo[0]
20:10 camelia rakudo-moar fe90be: OUTPUT«NativeCall::Types::Pointer<NUL​L>␤NativeCall::Types::Pointer<NULL>␤»
20:10 timotimo hmm
20:10 timotimo m: use NativeCall; my Pointer $foo .= new(12345); say $foo; say $foo[0]
20:10 camelia rakudo-moar fe90be: OUTPUT«NativeCall::Types::Pointer<0x303​9>␤NativeCall::Types::Pointer<0x3039>␤»
20:11 timotimo how do i ...
20:11 TimToady you're incompetent at being incompetent
20:11 timotimo i can't even get that wrong ;(
20:11 dataangel What I mean is, with python if you managed to crash the interpreter without using FFI/ctypes, that would be considered a bug to eventually be fixed, is that also the case for Perl 6?
20:12 TimToady yes
20:12 timotimo we're striving to make the VM uncrashable, but it's still possible in this current state
20:12 timotimo in more ways than we find acceptable, but that's just a matter of not having enough programmers bang their heads against it
20:12 dataangel understood, which is totally reasonable
20:12 trnh joined #perl6
20:13 timotimo many improvements we want to have fall into the SMOP category
20:13 TEttinger joined #perl6
20:14 timotimo there's also enough opportunities for internal redesigns to gain more performance; for example NativeCall has much more overhead than it needs to have
20:14 dataangel I prototyped yet another build system in python and the single threaded version was beautiful, but there was no efficient way to do the multithreaded version (in this system a lot of work would actually be done directly in python code rather than an external programs, so being able to have two threads run python code at the same time was actually essential). Finally gave me the motivation to look into Perl 6 ;)
20:16 wamba joined #perl6
20:19 timotimo cool :)
20:30 zakharyas joined #perl6
20:33 TEttinger joined #perl6
20:37 chkn joined #perl6
20:40 harovali joined #perl6
20:42 cdg joined #perl6
20:43 nightfrog joined #perl6
20:43 TEttinger joined #perl6
20:48 smls joined #perl6
20:56 masak dataangel: that sounds like quite a nice use case :)
20:57 masak TimToady: re http://irclog.perlgeek.de/p​erl6/2016-08-13#i_13018211 -- I was more wondering what categories you envision being available as sugar
20:57 masak TimToady: in other good news, the `is parsed` picture is finally coming into focus (in 007)
20:58 * TimToady still kinda hates 'is parsed' insofar as it's an inside-out interface from the viewpoint of the grammar
20:59 TimToady I suppose metaops are an obvious HOP candidate for functionalization
20:59 masak it is inside-out, but it's still on the grammar's terms, IIUC
21:00 masak in that it can only happen at the "cutpoints" created by the grammatical categories
21:01 MilkmanDan joined #perl6
21:01 masak what concerns me more is that many people will probably naïvely write `is parsed` regexes that handle the happy path, but fail to gracefully handle parse failures
21:01 masak aka "writing parsers is hard"
21:02 nightfrog joined #perl6
21:03 TimToady part of the reason I'd like people to get into it via 'slang token {...}' to at least get ratcheting on by default
21:03 TimToady then what we think of as the macro body is really just the action routine
21:04 TimToady being able to write those action routines in a better AST is of course a goal
21:06 masak from the point of view of the macro, it will want to get Q nodes as parameters
21:07 masak it'll be interesting to see how that works out in 007 -- whether there needs to be something between the `is parsed` regex and the macro itself that builds those Q nodes
21:07 masak I feel I have a clearer picture of it than a week ago, so it's heading in the right direction
21:07 torbjorn joined #perl6
21:08 MasterDuke .seen moritz
21:08 yoleaux I saw moritz 11 Aug 2016 18:18Z in #perl6: <moritz> ctrl+c = exit that program, unless you have a *very* good reason not to
21:09 masak famous last words :P
21:10 mvorg joined #perl6
21:14 masak still not sure how the parts of the `is parsed` regex end up turning into macro parameters. but I guess we'll find out by experimenting.
21:17 brrt joined #perl6
21:18 brrt hey masak
21:19 brrt on an earlier moment in these days, i had an awesome idea about macros
21:19 brrt i kind of forgot
21:20 brrt but it revolved around having nicer/subtler/perlisher interaces to make code, between quasis and directly manipulating ASTs
21:23 MasterDuke .tell moritz i'm trying to use SVG::Plot, but even the example doesn't produce an SVG with data, just the header with the width and height set. i see a merged PR that looked like it was for the same issue, but i'm still seeing it
21:23 yoleaux MasterDuke: I'll pass your message to moritz.
21:28 torbjorn joined #perl6
21:31 masak brrt: hey hey
21:31 masak brrt: let me know if you remember more :>
21:32 brrt :-)
21:32 masak brrt: and keep in mind that I react really well to concrete examples and actual use cases
21:32 brrt oh yes
21:32 brrt my basic idea is that raw template macros are on the lower end of interesting
21:33 masak I can agree to that
21:33 masak have you seen my "three kinds of macros" gist?
21:33 brrt the problem with use cases is that... i'm kind of wondering myself what i'd want it for
21:33 brrt i think i have but i don't hink i completely recall its contents
21:33 brrt link?
21:33 masak the 007 issue queue is full of use cases at this point :>
21:34 * masak hunts down the link
21:34 * brrt looks at the 007 issue queue
21:35 masak brrt: https://gist.github.com/masak/13210c51f034f931af0c
21:36 itaipu joined #perl6
21:37 pierre_ joined #perl6
21:37 brrt in what phase in 007 is the macro evaluated?
21:40 brrt alright, i renemeber now
21:41 tailgate How can i generate all combinations of n length of 1..255 wtih repeating?
21:42 brrt ehm, by a loop, i'd think
21:42 brrt although i realise you're looking for an 'easy' way
21:42 brrt and i don't know that :-)
21:42 TimToady m: .say for 1..255 X 1..255 X 1.255
21:43 TimToady oopsie
21:43 camelia rakudo-moar fe90be: OUTPUT«(1 1 1.255)␤(1 2 1.255)␤(1 3 1.255)␤(1 4 1.255)␤(1 5 1.255)␤(1 6 1.255)␤(1 7 1.255)␤(1 8 1.255)␤(1 9 1.255)␤(1 10 1.255)␤(1 11 1.255)␤(1 12 1.255)␤(1 13 1.255)␤(1 14 1.255)␤(1 15 1.255)␤(1 16 1.255)␤(1 17 1.255)␤(1 18 1.25…»
21:43 TimToady m: say (1..255 X 1..255 X 1..255)[^100]
21:43 camelia rakudo-moar fe90be: OUTPUT«((1 1 1) (1 1 2) (1 1 3) (1 1 4) (1 1 5) (1 1 6) (1 1 7) (1 1 8) (1 1 9) (1 1 10) (1 1 11) (1 1 12) (1 1 13) (1 1 14) (1 1 15) (1 1 16) (1 1 17) (1 1 18) (1 1 19) (1 1 20) (1 1 21) (1 1 22) (1 1 23) (1 1 24) (1 1 25) (1 1 26) (1 1 27) (1 1 28) (1 1 29) (1 …»
21:44 TimToady you mean repeating like that?
21:44 tailgate nah, sampling the item in the combinations
21:44 tailgate i.e. 1 1 1 is a valid 3-combination
21:44 TimToady but order doens't matter?
21:44 gfldex say [^100] is redundant
21:44 brrt also, textual macro's aint' that bad :-P
21:44 tailgate order is important
21:45 TimToady m: say (1..255 X 1..255 X 1..255)
21:45 camelia rakudo-moar fe90be: OUTPUT«((1 1 1) (1 1 2) (1 1 3) (1 1 4) (1 1 5) (1 1 6) (1 1 7) (1 1 8) (1 1 9) (1 1 10) (1 1 11) (1 1 12) (1 1 13) (1 1 14) (1 1 15) (1 1 16) (1 1 17) (1 1 18) (1 1 19) (1 1 20) (1 1 21) (1 1 22) (1 1 23) (1 1 24) (1 1 25) (1 1 26) (1 1 27) (1 1 28) (1 1 29) (1 …»
21:45 TimToady I guess it is :)
21:45 masak brrt: routine macros are evaluated ASAP, which is either as soon as all the arguments have parsed, or (in the case of when the macro was in a quasi) when the quasi gets spliced into the mainline and suddenly all of its unquotes are present as Qnodes
21:46 masak brrt: visitor macros are evaluated sometime aroung CHECK time. I've found things that want to run before them and things that want to run after them.
21:46 brrt what bad would happen in routine macros are evaluated at CHECK time?
21:50 masak I bet some anaphoric things would fail
21:50 masak sorry, I realize "anaphoric" is not part of normal vocabulary... :)
21:50 masak let me unpack that for you
21:51 masak let's say the macro has decided to unhygienically introduce a variable `$foo` into the body of a block
21:51 masak if it gets to run before the block is parsed, everything is fine
21:51 masak if it runs at CHECK time, not so much
21:52 brrt uhuh
21:52 brrt why not?
21:52 masak because the parser doesn't wait until CHECK time in verifying whether `$foo` has been declared or not
21:53 masak and so it'd die
21:55 brrt hmm... why doesn't the parser wait?
21:55 brrt there is probably a good reason
21:55 masak ask TimToady :)
21:55 masak m: $foo; my $foo
21:55 camelia rakudo-moar fe90be: OUTPUT«5===SORRY!5=== Error while compiling <tmp>␤Variable '$foo' is not declared␤at <tmp>:1␤------> 3<BOL>7⏏5$foo; my $foo␤»
21:56 torbjorn joined #perl6
21:56 masak heh, `map` in Perl *5* is actually a good example of an anaphoric macro. it makes `$_` appear out of nowhere inside its block, and the user doesn't have to declare it.
21:57 masak in Perl 6, the `$_` management has been made part of the general block handling instead.
21:59 gfldex this may be useful in conjunction with NativeCall https://github.com/endrazine/w​cc#wld--the-witchcraft-linker
22:00 brrt hmmm
22:00 brrt alright, use case
22:00 brrt suppose i want to make a macro that takes a parameters and adds code in a loop
22:01 brrt how'd i do that?
22:01 brrt and how easy would it be for me to do that
22:05 masak brrt: let me try to understand your use case -- the macro accepts an iteration count $N and some code, and emits that code $N times?
22:05 brrt yes, or code-modified, or something like that
22:06 masak sir, let me direct you to the appropriate github issue
22:06 masak https://github.com/masak/007/issues/167
22:07 masak now, admittedly there are more questions than answers there, but at least that's a very solid use case (IMO) for code modification
22:10 * brrt reads
22:11 brrt okay, i see what that is like
22:11 brrt hmm
22:11 brrt seems like something for visitor macros
22:19 masak brrt: yes.
22:20 brrt hmm
22:20 brrt i like visitor macros in principle
22:20 brrt but yeah, can be hard
22:25 brrt hmm
22:25 brrt well, thanks for sharing the queue anyway
22:25 brrt i may have more useful ideas in the future
22:27 masak \o/
22:27 masak I'm a macros use case collector :)
22:41 torbjorn joined #perl6
22:42 silug joined #perl6
22:49 kurahaupo joined #perl6
22:57 kurahaupo joined #perl6
23:04 Nex6 joined #perl6
23:08 pduh left #perl6
23:09 pduh joined #perl6
23:18 torbjorn joined #perl6
23:53 aries_liuxueyang joined #perl6

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

Perl 6 | Reference Documentation | Rakudo