»ö« 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.
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
timotimo yeah, json kind of sucks that way ;( 00:24
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
dalek c: 5a41939 | Altai-man++ | doc/Type/ (6 files):
Make examples compile
00:49
dalek c: 3ef4a0c | Altai-man++ | doc/Type/IO.pod6:
Fix example identation
00:53
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)
andrzejku hi 05:12
:)
andrzejku hi :) 05:14
sammers ola 05:43
andrzejku I am looking for Perl friend 05:45
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
titsuki I'm creating the Perl 6 interface of this line: github.com/jtsiomb/kdtree/blob/mas...ree.c#L211 06:06
holyghost gm, have a nice weekend, we have a holiday on monday :-) 06:43
Woodi titsuki: OpaquePointer ? perl6advent.wordpress.com/2015/12/...-beyond-c/ 07:06
titsuki Woodi: Thanks. However OpaquePointer is deprecated and same as Pointer functionally. 07:08
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
ab5tract skids: regarding nativecall, I believe that limitation is only for repr('CStruct'), not repr('CPonter') 08:04
ab5tract ah, nevermind. you can't add attributes there wither 08:12
*either
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
gfldex m: my $l = List; dd $l(1,2,3); 08:52
camelia rakudo-moar baeabb: OUTPUT«(1, 2, 3)␤»
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
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
ab5tract gfldex: now that you point it out, it's quite familiar indeed 09:10
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
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
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
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
AlexDaniel ab5tract: so what is interesting about it? 09:35
nine nadim: sounds decidedly odd. Did panda's bootstrap complete successfully? 09:56
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
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
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)
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
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.
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
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
RabidGravy oh I half typed something last night in reply to something, forgot to press enter then got distracted 12:35
oh well
pmurias masak: I'll look it it more closely once I do the current nqp-js cleanup/hack removal 12:42
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
masak so I might be able to code up something Mostly Working quite rapidly 12:47
enough to be useful 12:48
stmuk_ 13:32
masak stmuk_: 13:47
(hope this invisible ink works)
stmuk_ I can't find Acme::Bleach for p6! :( 13:48
timotimo github.com/thundergnat/Acme-Scrub 14:31
stmuk_: -^
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
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
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
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
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.
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 ;)
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
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
BenGoldberg m: dd %*LANG 17:08
camelia rakudo-moar e89721: OUTPUT«Failure.new(exception => X::Dynamic::NotFound.new(name => "\%*LANG"), backtrace => Backtrace.new)␤»
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
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
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
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.
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
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
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:27
TimToady we could probably do better there 18:30
we do know the exact candidate list at compile time
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
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?
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: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
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"
TimToady nominally, they're the same type 18:49
dalek ateverable: 700cb30 | (Daniel Green)++ | Benchable.p6:
Add the ability to benchmark different snippets of code to each other at HEAD
18:59
timotimo ooooh! 19:29
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"
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
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
timotimo many improvements we want to have fall into the SMOP category 20:13
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 ;)
timotimo cool :) 20:19
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
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
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"
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
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
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
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.
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
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
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
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
brrt hmm... why doesn't the parser wait? 21:55
there is probably a good reason
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␤»
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
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