»ö« Welcome to Perl 6! | perl6.org/ | evalbot usage: 'p6: say 3;' or rakudo:, or /msg camelia p6: ... | irclog: irc.perl6.org or colabti.org/irclogger/irclogger_logs/perl6 | UTF-8 is our friend!
Set by moritz on 22 December 2015.
00:10 BenGoldberg joined, wbill joined
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␤␤»
MasterDuke unmatched}: thanks for the PRs, i didn't know trailing commas aren't valid JSON 00:20
00:24 adu joined
timotimo yeah, json kind of sucks that way ;( 00:24
00:25 dj_goku joined, dj_goku left, dj_goku joined 00:27 zacts joined 00:30 dj_goku left
unmatched} MasterDuke: I frequently find them in META files (and myself fall to the same issue) 00:32
And this doesn't sound like a bad idea: twitter.com/jnthnwrthngtn/status/7...9841787904
00:41 canopus left 00:43 zacts left 00:47 canopus joined 00:49 aries_liuxueyang left, aries_liuxueyang joined
dalek c: 5a41939 | Altai-man++ | doc/Type/ (6 files):
Make examples compile
00:49
00:51 adu left
dalek c: 3ef4a0c | Altai-man++ | doc/Type/IO.pod6:
Fix example identation
00:53
00:55 pierre_ left 01:03 rpburkholder joined 01:06 BenGoldberg left 01:22 eam left 01:27 harovali1 left 01:28 sufrostico left 01:38 bob778 joined 01:39 bob777 left, bob778 is now known as bob777 01:44 sena_kun left 01:45 ilbot3 left 01:47 ilbot3 joined 01:50 labster left 01:53 bob777 left 01:58 pierre_ joined, RabidGravy left 02:13 dj_goku joined 02:18 dj_goku left 02:21 noganex joined 02:24 noganex_ left, pierre_ left 02:31 anser left 02:39 labster joined 02:45 kid511 left 02:48 pierre_ joined 02:49 Actualeyes left 02:52 ovibos left 02:54 Actualeyes joined 03:05 nightfrog joined 03:07 rpburkholder left 03:11 pierre_ left 03:17 nightfrog left 03:22 pierre_ joined 03:23 skids left 03:27 pierre_ left
dalek c: 38a6482 | (Wenzel P. P. Peppmeyer)++ | doc/Type/Callable.pod6:
better example for .assuming
03:28
c: 410a848 | (Wenzel P. P. Peppmeyer)++ | doc/Language/typesystem.pod6:
classes are packages (kind of)
03:28 perl69 joined 03:29 khw left, perl69 left 03:56 MilkmanDan left 04:01 dj_goku joined 04:03 labster left 04:07 dj_goku left 04:10 MilkmanDan joined 04:17 mtj_ joined 04:24 pierre_ joined 04:25 Cabanossi left 04:28 Cabanossi joined 04:29 pierre_ left 04:54 Xliff_ left 04:55 pduh left, pduh joined, pduh left, bob777 joined, pduh joined 05:11 andrzejku joined
andrzejku hi 05:12
:)
05:12 andrzejku left 05:13 andrzejku joined
andrzejku hi :) 05:14
05:36 CIAvash joined
sammers ola 05:43
andrzejku I am looking for Perl friend 05:45
05:50 dj_goku joined 05:54 dj_goku left 06:00 Actualeyes left
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:02
06:03 Nex6 left
titsuki I'm creating the Perl 6 interface of this line: github.com/jtsiomb/kdtree/blob/mas...ree.c#L211 06:06
06:24 trnh joined 06:28 andrzejku left 06:31 trnh left 06:32 trnh joined 06:34 setty2 joined 06:41 holyghost left 06:42 AlexDaniel joined, holyghost joined
holyghost gm, have a nice weekend, we have a holiday on monday :-) 06:43
06:43 AlexDaniel left, AlexDaniel joined 06:48 andrzejku joined, wbill left 06:53 rindolf joined
Woodi titsuki: OpaquePointer ? perl6advent.wordpress.com/2015/12/...-beyond-c/ 07:06
07:08 andrzejku left
titsuki Woodi: Thanks. However OpaquePointer is deprecated and same as Pointer functionally. 07:08
07:09 jluis left 07:11 jluis joined 07:14 TheLemonMan joined 07:17 darutoko joined
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
m: use NativeCall; my $a = Pointer.new; nativecast(Str, $a).WHAT.say
camelia rakudo-moar baeabb: OUTPUT«(Str)␤»
titsuki *do it 07:27
07:35 pierre_ joined 07:36 pierre_ left, andrzejku joined, pierre_ joined, trnh left 07:38 dj_goku joined 07:43 dj_goku left 07:46 labster joined, wbill joined 07:51 jluis left 07:58 jluis joined 07:59 firstdayonthejob joined 08:01 cyphase left 08:02 kaare_ left 08:03 titsuki left
ab5tract skids: regarding nativecall, I believe that limitation is only for repr('CStruct'), not repr('CPonter') 08:04
08:04 andrzejku left 08:05 kaare_ joined, andrzejku joined 08:06 cyphase joined 08:09 jluis left
ab5tract ah, nevermind. you can't add attributes there wither 08:12
*either
08:15 hankache joined, wamba joined
dalek line-Perl5: ca3950f | niner++ | META.info:
Version 0.10
08:17
c: 338a351 | (Wenzel P. P. Peppmeyer)++ | util/list-missing-methods.p6:
allow comments in util/ignored-methods.txt
08:18
c: e24b596 | (Wenzel P. P. Peppmeyer)++ | util/ignored-methods.txt:
ignore some methods in Str
c: 70d3629 | (Wenzel P. P. Peppmeyer)++ | util/list-missing-methods.p6:
comment on comments
c: 67306ab | (Wenzel P. P. Peppmeyer)++ | doc/Type/Str.pod6:
make file parseable
c: 9441261 | (Wenzel P. P. Peppmeyer)++ | util/ignored-methods.txt:
forgot one method to ignore
08:21
08:26 spider-mario joined, jluis joined 08:28 RabidGravy joined 08:37 andrzejku left 08:44 yqt joined
gfldex m: my $l = List; dd $l(1,2,3); 08:52
camelia rakudo-moar baeabb: OUTPUT«(1, 2, 3)␤»
08:55 jluis left
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)␤»
hankache m: my @a = 1,2,3; say @a.WHAT; 09:00
camelia rakudo-moar baeabb: OUTPUT«(Array)␤»
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
hankache why does = have higher precedence over the comma when it comes to scalars but not arrays? 09:02
dalek c: 24cce0f | (Wenzel P. P. Peppmeyer)++ | util/list-missing-methods.p6:
split returns empty strings that are defined
c: 64080eb | (Wenzel P. P. Peppmeyer)++ | util/ignored-methods.txt:
add to be ignored methods for Array
ab5tract but perhaps it's an evolution of the first-arg rules
c: 0dc31df | (Wenzel P. P. Peppmeyer)++ | CONTRIBUTING.md:
tell contributors about list-missing-methods.p6
gfldex because the compiler knows what a @-sigil is for
09:02 quester joined
gfldex that's one of the many reasons to have the @-sigiled container 09:02
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
in p5 you get the length of the list in scalar, but here it looks like we pull the first one
huf (you totally dont get the length of a list in scalar context in p5) 09:04
hankache gfldex so this is normal?
gfldex it's intentional and works the same way as in signatures 09:05
ab5tract elements of array
gfldex m: my ($i, @a) = 1,2,3; dd @a;
camelia rakudo-moar baeabb: OUTPUT«Array @a = [2, 3]␤»
gfldex m: my ($i, $j) = 1,2,3; dd $i, $j; 09:06
camelia rakudo-moar baeabb: OUTPUT«Int $i = 1␤Int $j = 2␤»
hankache ok thanks
gfldex the @-sigiled behaviour is the odd one out acutally (as it is magical)
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:09
09:10 kurahaupo left
ab5tract gfldex: now that you point it out, it's quite familiar indeed 09:10
09:10 kurahaupo joined
ab5tract I got it mixed up with never really needing parens on the RHS when assigning into an @ 09:10
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:13
09:18 nadim joined
nadim Good Morning all, good to be back after 2 months away. 09:19
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?
hankache++
gfldex zef works better and understand META6
09:21 jluis joined
nadim zef it is then 09:21
gfldex both wont tell you what $PATH to set 09:22
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)
gfldex do you got $HOME/.perl6 ?
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
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, dj_goku left, dj_goku joined
ab5tract this is a pretty interesting case though: 09:27
m: my ($a,$b) = my $c = (1,2,3); dd $a, $b, $c
camelia rakudo-moar baeabb: OUTPUT«Int $a = 1␤Int $b = 2␤List $c = $(1, 2, 3)␤»
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?
ab5tract hankache: yeah, strict mode is on everywhere now.
nadim bleah! seg fault for the first thing I want to do, well second, installing zef. 09:29
09:30 labster left 09:31 dj_goku left, pierre_ left, labster joined
AlexDaniel ab5tract: so what is interesting about it? 09:35
09:42 pmurias joined 09:54 kurahaupo left 09:55 hankache left
nine nadim: sounds decidedly odd. Did panda's bootstrap complete successfully? 09:56
09:58 wbill left, kurahaupo joined 10:09 kurahaupo left 10:14 darutoko left 10:22 yqt left 10:30 wamba left 10:32 mvorg joined
stmuk_ is there anyway of passing a "no pragma" from the command line? 10:32
geekosaur -X and prefix with No, usually 10:35
whoops
wrong channel :/
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 10:48 kurahaupo joined
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:48
10:53 yqt joined 10:54 labster left 10:58 jluis left 11:09 quester left 11:14 dj_goku joined 11:19 dj_goku left 11:27 spider-mario left 11:56 canopus left 12:03 canopus joined 12:08 kaare_ left 12:11 telex left, firstdayonthejob left
masak TimToady: long-term, how many of the S02/Grammatical Categories would you expect to be definable as subs? 12:13
dalek c: fb86f5e | gfldex++ | doc/Language/typesystem.pod6:
link to Submethod
masak (currently we have normal operators (but not metaoperators) and terms in Rakudo, I believe)
12:14 dj_goku joined
masak oh, and trait_mods 12:14
I ask because probably many of these could be definable as macros, as long as we figure out decent parameters for them. 12:15
12:19 kid51 joined 12:21 pierre_ joined
dalek ateverable: d1d936c | (Daniel Green)++ | Bisectable.p6:
We shouldn't provide any stdin when we test the starting points
12:24
gfldex m: dd (my method {}); 12:26
camelia rakudo-moar 32902f: OUTPUT«Method <anon> = method <anon> (Mu $: *%_) { #`(Method|47560688) ... }␤»
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)
masak pmurias: most certainly. let me know what I can do to help.
12:27 telex joined
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:27
12:27 dj_goku left
pmurias write any backend would make subsequent ones easier as that would help define the line between backend and interpreter 12:28
masak right
pmurias: I just created github.com/masak/007/issues/169 to track this 12:29
12:34 dj_goku joined
RabidGravy oh I half typed something last night in reply to something, forgot to press enter then got distracted 12:35
oh well
12:41 ambs joined
pmurias masak: I'll look it it more closely once I do the current nqp-js cleanup/hack removal 12:42
12:46 kurahaupo left
masak cool. 12:46
I'll bump up the priority of the JS backend, then.
as I hint at in that issue -- github.com/masak/007/issues/166 -- the task feels like 90% straightforward and 10% real tough work 12:47
12:47 titsuki joined
masak so I might be able to code up something Mostly Working quite rapidly 12:47
enough to be useful 12:48
13:04 skids joined 13:14 TheLemonMan left 13:22 andrzejku joined 13:26 pierre_ left 13:31 pierre_ joined
stmuk_ 13:32
13:33 andrzejku left
masak stmuk_: 13:47
(hope this invisible ink works)
stmuk_ I can't find Acme::Bleach for p6! :( 13:48
13:51 grondilu joined 13:52 pecastro left 13:55 andrzejku joined 13:56 yqt left 13:57 TRUMP-PENCE left 13:59 TRUMP-PENCE joined, TRUMP-PENCE left 14:04 pecastro joined 14:14 TRUMP-PENCE joined, pecastro left 14:27 skids left, nowan joined 14:28 MilkmanDan left 14:30 nowan_ left
timotimo github.com/thundergnat/Acme-Scrub 14:31
stmuk_: -^
14:32 nowan left, nowan_ joined 14:38 nightfrog joined, nightfrog left 14:39 nightfrog joined 14:40 BenGoldberg joined 14:44 avenj left 14:46 kurahaupo joined 14:48 khw joined 14:51 zacts joined 14:54 ARM9 joined, n1lp7r joined 14:56 giraffe joined
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
over in #krita
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:02
lucs likes to build up LaTeX strings, but having to escape all the ordinary curlies is quite annoying. 15:04
mst timotimo: seems to've gone already. it helps if you use 'mst:' to hilight me so I actually see the request 15:16
timotimo ah! i'll try to remember that the next time 15:17
and yes, an op in #krita has appeared in the mean time
15:19 nightfrog left 15:37 n1lp7r left 15:43 pierre_ left
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:48
15:50 Wiertek joined 15:54 zacts left
ugexe if you give it multiple install locations it will give you *all* the paths it installed bin files to even: gist.github.com/ugexe/b0bf45798d3b...7fa4b3620d 15:55
AlexDaniel TIL brotli is a great general purpose compression algorithm: github.com/perl6/whateverable/issu...-239627248 15:56
15:57 andrzejku left 16:03 andrzejku joined 16:09 prussian joined
ab5tract AlexDaniel: The interesting bit is that in that expression, the scalar $c does end up with the list 16:10
When I golfed that, I was trying to verify that the RHS List really was the return value of the expression 16:11
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
Which feels nicely Perlish to me :)
Gar, how did those RHS parens slip in.. Nevermind, my reasoning was based on a grave misunderstanding 16:17
16:19 zacts joined 16:25 MilkmanDan joined
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
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
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:47 torbjorn left
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:49
camelia rakudo-moar e89721: OUTPUT«List $c = $(1, 2, 3)␤»
mst TimToady: this is why I really enjoy fexpr based lisps
an fexpr gets handed its arguments plus an environment, so you can control what's evaluated then 16:50
AlexDaniel ab5tract: :)
mst generalises macros and functions at the cost of being hilariously difficult to optimise
16:53 telex left 16:54 telex joined 16:55 MilkmanDan left
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
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 16:56
17:02 xfix left 17:05 MilkmanDan joined
BenGoldberg m: dd %*LANG 17:08
camelia rakudo-moar e89721: OUTPUT«Failure.new(exception => X::Dynamic::NotFound.new(name => "\%*LANG"), backtrace => Backtrace.new)␤»
17:09 pierre_ joined 17:13 pierre_ left
TimToady it's in the compiler, not your code 17:13
m: BEGIN %*LANG<Regex>.^name.say 17:15
camelia rakudo-moar e89721: OUTPUT«Perl6::RegexGrammar␤»
TimToady arguably BEGIN should not be able to poke up into the compiler like that, at least without some kind of MONKEY 17:17
17:21 mvorg left
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␤»
TimToady m: BEGIN %*LANG<Regex> := grammar Oops { method unbalanced($x) { die "haha" } }; /foo/
camelia rakudo-moar e89721: OUTPUT«===SORRY!===␤haha␤»
TimToady and you shouldn't be able to change the language your parents think they're parsing like that 17:23
currently it's just "with great power comes great responsibility" :) 17:24
TimToady suspects we rely on that power currently to get as far with slangs as we do... 17:25
17:25 zacts left
ugexe nadim: it sounds like your rakudo environment is borked if neither zef or panda are giving you bin/ files 17:28
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:29
github.com/rakudo/rakudo/blob/nom/...on.pm#L268 17:31
17:34 japhb left 17:35 TakinOver joined 17:36 japhb joined 17:38 Nex6 joined 17:40 Nex6 left, xfix joined 17:41 TakinOver left 17:43 TakinOver joined 17:48 TakinOver left
BenGoldberg m: my @fib := (1, 1, *+* ...^ *).cache; say @fib[^10]; 17:50
camelia rakudo-moar e89721: OUTPUT«(1 1 2 3 5 8 13 21 34 55)␤»
BenGoldberg m: my @fib := (1, 1, *+* ...^ *);
camelia rakudo-moar e89721: OUTPUT«Type check failed in binding; expected Positional but got Seq (?)␤ in block <unit> at <tmp> line 1␤␤»
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)␤»
BenGoldberg m: my $fib := (1, 1, *+* ...^ *); say $fib[^5] for 1..2; 17:52
camelia rakudo-moar e89721: OUTPUT«(1 1 2 3 5)␤(1 1 2 3 5)␤»
BenGoldberg m: my $fib := (1, 1, *+* ...^ *); say $fib.WHAT
camelia rakudo-moar e89721: OUTPUT«(Seq)␤»
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␤␤»
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)␤»
BenGoldberg m: my $fib := 1, 1, *+* ...^ *; dd $fib
camelia rakudo-moar e89721: OUTPUT«(1, 1, 2, 3, 5, 8, 13, 21, 34, 55... (lazy list)␤»
BenGoldberg wonders why he could print out $fib[^5] twice.
17:57 sena_kun joined, wamba left 18:04 TakinOver joined 18:07 harovali joined 18:14 TakinOver left 18:20 dataangel joined 18:22 pduh is now known as plsix
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:22
18:24 TakinOver joined
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:25
18:26 Wiertek left
dataangel raiph: that code produces an error at runtime though 18:27
18:27 plsix is now known as duh
dataangel raiph: I'm just wondering if it could be compile time instead 18:27
18:27 duh is now known as Guest19108 18:28 Guest19108 is now known as peterduh, peterduh is now known as pduh 18:29 Wiertek joined
TimToady we could probably do better there 18:30
we do know the exact candidate list at compile time
18:30 MilkmanDan left
TimToady but currently the checks are only on nominal type, and Cool is cool with both numbers and strings 18:31
dataangel Interesting 18:32
18:32 trnh joined, trnh left, trnh joined
TimToady BenGoldberg: I believe .[^5] implies a .cache 18:32
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
TimToady => autoquotes an identifier on the left
dataangel Interesting feature but if you're going to have it why only the left? 18:34
Do hashes usually only have string keys?
18:35 pierre_ joined
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
18:35 TakinOver left
TimToady in the :foo(1) form it's enforced to be an identifier too, you'll note 18:35
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
TimToady identifiers are a subset of strings, but we only autoquote identifiers 18:37
because, well, otherwise you'd have quotes anyway...
for similar reasons, normal hashes default to string keys, and you have to work a little harder to use objects as keys 18:38
it's merely that people often use them that way, so it's a reasonable default
dataangel hmm I see 18:39
18:40 pierre_ left
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)␤»
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)␤»
TimToady depends on how you define "type"
18:49 heatsink joined
TimToady nominally, they're the same type 18:49
18:49 TakinOver joined 18:50 MilkmanDan joined, labster joined 18:55 TakinOver left
dalek ateverable: 700cb30 | (Daniel Green)++ | Benchable.p6:
Add the ability to benchmark different snippets of code to each other at HEAD
18:59
19:20 noganex left 19:21 trnh left 19:26 noganex joined 19:29 heatsink left
timotimo ooooh! 19:29
19:31 harovali left 19:37 andrzejku left
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:48
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␤␤»
timotimo that's exactly what violating a definedness constraint means 19:49
dataangel timotimo: but I didn't pass a type object did I? 19:50
I don't see how a type object comes into it
timotimo m: my Int $y; say $y.perl
camelia rakudo-moar fe90be: OUTPUT«Int␤»
dataangel Assuming that a type object is an object that represents a type, like what I assume is being returned by WHAT
timotimo a scalar variable starts out with the type object in it as the default value
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?
geekosaur in general, yes
TimToady it's the gist
if you actually try to convert to string, it carps 19:53
m: print Any
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␤»
TimToady m: print Any.gist
camelia rakudo-moar fe90be: OUTPUT«(Any)»
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:55
Is there something like dir(foo) in python, that lists all of the methods on an object? 19:56
TimToady m: say Int.^methods
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…»
TimToady m: say 42.^methods 19:57
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…»
TimToady m: say Int.^mro
camelia rakudo-moar fe90be: OUTPUT«((Int) (Cool) (Any) (Mu))␤»
dataangel huh, wouldn't have expected those to be the same
timotimo those meaning Int.^methods vs 42.^methods?
dataangel Yes
TimToady yes, Int is an undefined 42
m: say Int ~~ Cool 19:58
camelia rakudo-moar fe90be: OUTPUT«True␤»
TimToady this is just like asking 'Is Socrates a man?'
well, Socrates is more like 42 there
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__?
TimToady m: say 42 ~~ Cool 19:59
camelia rakudo-moar fe90be: OUTPUT«True␤»
TimToady but we can reason about classes without having an instance of it
.^ 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
m: say 42.REPR
camelia rakudo-moar fe90be: OUTPUT«P6opaque␤»
TimToady note that the representation is largely invisible even to the class definition itself 20:01
our object system is agnostic about whether the underlying object is represented like a C++ object or a Python object
s/object/class/ 20:02
"representational polymorphism", to use the 50¢ phrase
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␤»
TimToady m: say Int.HOW
camelia rakudo-moar fe90be: OUTPUT«Perl6::Metamodel::ClassHOW.new␤»
dataangel Why in the word HOW? 20:04
TimToady $x.^foo($y) is short for $x.HOW($x, $y)
it's how it works!
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
that too
almost nothing in p6 is done for a single reason
dataangel Pretty cool so far
timotimo everything also has the additional reason of "larry wall is simply bonkers"
20:06 andrzejku joined
dataangel lol 20:06
timotimo i mean that in a loving manner
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:07
timotimo no GIL to speak of 20:08
which also means you have to be a bit careful, or suffer data loss
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
dataangel timotimo: just the usual threading race condition sort of stuff, or can I actually crash the VM? 20:09
Beat me to it ;)
timotimo other than that, we have excellent data structures and mechanisms to go with "nothing shared" style of coding
promises, channels (a little bit like Go), supplies (like observables or "reactive" streams or what have you), stuff like that
a fair bit of asynchronous I/O, like with sockets and processes
AlexDaniel dataangel: well, if your goal is to crash it then you will ;) 20:10
20:10 TEttinger left
timotimo yes, you'll definitely be able to crash the VM by trying. 20:10
m: use NativeCall; my Pointer $foo .= new(0); say $foo; say $foo[0]
camelia rakudo-moar fe90be: OUTPUT«NativeCall::Types::Pointer<NULL>␤NativeCall::Types::Pointer<NULL>␤»
timotimo hmm
m: use NativeCall; my Pointer $foo .= new(12345); say $foo; say $foo[0] 20:11
camelia rakudo-moar fe90be: OUTPUT«NativeCall::Types::Pointer<0x3039>␤NativeCall::Types::Pointer<0x3039>␤»
timotimo how do i ...
TimToady you're incompetent at being incompetent
timotimo i can't even get that wrong ;(
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
timotimo we're striving to make the VM uncrashable, but it's still possible in this current state
in more ways than we find acceptable, but that's just a matter of not having enough programmers bang their heads against it
dataangel understood, which is totally reasonable
20:13 trnh joined
timotimo many improvements we want to have fall into the SMOP category 20:13
20:13 TEttinger joined
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
timotimo cool :) 20:19
20:29 rindolf left 20:30 zakharyas joined 20:32 TEttinger left 20:33 TEttinger joined 20:37 chkn joined 20:38 chkn left 20:40 TEttinger left, harovali joined 20:42 cdg joined 20:43 nightfrog joined, TEttinger joined 20:49 smls joined, nadim left 20:54 nightfrog left
masak dataangel: that sounds like quite a nice use case :) 20:56
TimToady: re irclog.perlgeek.de/perl6/2016-08-13#i_13018211 -- I was more wondering what categories you envision being available as sugar 20:57
TimToady: in other good news, the `is parsed` picture is finally coming into focus (in 007)
TimToady still kinda hates 'is parsed' insofar as it's an inside-out interface from the viewpoint of the grammar 20:59
20:59 MilkmanDan left
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
in that it can only happen at the "cutpoints" created by the grammatical categories 21:00
21:01 MilkmanDan joined
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
aka "writing parsers is hard"
21:02 nightfrog joined, nightfrog left
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
then what we think of as the macro body is really just the action routine
being able to write those action routines in a better AST is of course a goal 21:04
masak from the point of view of the macro, it will want to get Q nodes as parameters 21:06
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
I feel I have a clearer picture of it than a week ago, so it's heading in the right direction
21:08 torbjorn joined
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
masak famous last words :P 21:09
21:10 Wiertek left, mvorg joined 21:11 CIAvash left
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:14
21:17 brrt joined
brrt hey masak 21:19
on an earlier moment in these days, i had an awesome idea about macros
i kind of forgot
but it revolved around having nicer/subtler/perlisher interaces to make code, between quasis and directly manipulating ASTs 21:20
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:23 torbjorn left, andrzejku left 21:28 torbjorn joined
masak brrt: hey hey 21:31
brrt: let me know if you remember more :> 21:32
brrt :-)
masak brrt: and keep in mind that I react really well to concrete examples and actual use cases
brrt oh yes
my basic idea is that raw template macros are on the lower end of interesting
masak I can agree to that 21:33
have you seen my "three kinds of macros" gist?
brrt the problem with use cases is that... i'm kind of wondering myself what i'd want it for
i think i have but i don't hink i completely recall its contents
link?
masak the 007 issue queue is full of use cases at this point :> 21:34
masak hunts down the link
brrt looks at the 007 issue queue
masak brrt: gist.github.com/masak/13210c51f034f931af0c 21:35
21:36 itaipu joined 21:37 pierre_ joined
brrt in what phase in 007 is the macro evaluated? 21:37
alright, i renemeber now 21:40
tailgate How can i generate all combinations of n length of 1..255 wtih repeating? 21:41
brrt ehm, by a loop, i'd think 21:42
although i realise you're looking for an 'easy' way
21:42 pierre_ left
brrt and i don't know that :-) 21:42
TimToady m: .say for 1..255 X 1..255 X 1.255 21:43
oopsie
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…»
TimToady m: say (1..255 X 1..255 X 1..255)[^100]
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 …»
TimToady you mean repeating like that? 21:44
tailgate nah, sampling the item in the combinations
i.e. 1 1 1 is a valid 3-combination
TimToady but order doens't matter?
gfldex say [^100] is redundant
brrt also, textual macro's aint' that bad :-P 21:45
tailgate order is important
TimToady m: say (1..255 X 1..255 X 1..255)
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 …»
TimToady I guess it is :)
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
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:47
21:49 trnh left
masak I bet some anaphoric things would fail 21:50
sorry, I realize "anaphoric" is not part of normal vocabulary... :)
let me unpack that for you
let's say the macro has decided to unhygienically introduce a variable `$foo` into the body of a block 21:51
if it gets to run before the block is parsed, everything is fine
if it runs at CHECK time, not so much
brrt uhuh 21:52
why not?
masak because the parser doesn't wait until CHECK time in verifying whether `$foo` has been declared or not 21:53
and so it'd die
21:53 itaipu left
brrt hmm... why doesn't the parser wait? 21:55
there is probably a good reason
21:55 torbjorn left
masak ask TimToady :) 21:55
m: $foo; my $foo
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
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:56
in Perl 6, the `$_` management has been made part of the general block handling instead. 21:57
gfldex this may be useful in conjunction with NativeCall github.com/endrazine/wcc#wld--the-...aft-linker 21:59
brrt hmmm 22:00
alright, use case
suppose i want to make a macro that takes a parameters and adds code in a loop 22:01
how'd i do that?
and how easy would it be for me to do that
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
github.com/masak/007/issues/167
now, admittedly there are more questions than answers there, but at least that's a very solid use case (IMO) for code modification 22:07
brrt reads 22:10
okay, i see what that is like 22:11
hmm
seems like something for visitor macros
22:19 khw left
masak brrt: yes. 22:19
brrt hmm 22:20
i like visitor macros in principle
but yeah, can be hard
hmm 22:25
well, thanks for sharing the queue anyway
i may have more useful ideas in the future
masak \o/ 22:27
I'm a macros use case collector :) 22:28
22:30 firstdayonthejob left 22:31 torbjorn left, silug left 22:34 brrt left 22:39 zakharyas left 22:42 torbjorn joined, silug joined 22:45 smls left 22:49 kurahaupo left, kurahaupo joined 22:50 kurahaupo left 22:57 kurahaupo joined 23:04 Nex6 joined 23:05 Nex6 left 23:06 torbjorn left 23:09 pduh left, pduh joined 23:18 torbjorn joined 23:25 pmurias left 23:39 japanoise left 23:47 labster left 23:48 aries_liuxueyang left 23:52 sena_kun left 23:53 aries_liuxueyang joined