»ö« Welcome to Perl 6! | perl6.org/ | evalbot usage: 'perl6: say 3;' or rakudo:, niecza:, std:, or /msg camelia perl6: ... | irclog: irc.perl6.org | UTF-8 is our friend! Set by sorear on 25 June 2013. |
|||
00:10
vendethiel left
|
|||
raydiak | oh right | 00:12 | |
tony-o: you might have more luck if you make it an "our" method | |||
m: class Foo { our method foo ($foo) {say $foo} }; my $f = &Foo::foo; $f(Foo,123); | |||
camelia | rakudo-moar 91d899: OUTPUT«123» | ||
00:15
vendethiel joined
|
|||
TimToady | an "our" method is not really a method, it's just a subroutine in disguise | 00:24 | |
the problem with m:g and smartmatch is that m:g does not yet return a fake Match object | 00:27 | ||
m: say (m:g/\w/.WHAT given "abcde") | |||
camelia | rakudo-moar 91d899: OUTPUT«(List)» | ||
TimToady | m: say (m:g/\w/ given "abcde") | ||
camelia | rakudo-moar 91d899: OUTPUT«「a」 「b」 「c」 「d」 「e」» | ||
TimToady | so use given for now, instead of ~~ | ||
smls: ^^ | 00:28 | ||
tony-o | guess i'm changing this to a module then :-) | 00:33 | |
TimToady | if you really want a method, you'd can as the MOP for the method reference using .can | ||
but it won't be stored in a package | |||
unlike in Perl 5 | 00:34 | ||
tony-o | i'm trying to pass an instance method as a reference | ||
TimToady | with or without its invocant? | ||
tony-o | with | ||
TimToady | the only way to do that is with $code.assuming($obj), where $code is what you get back from the MOP | 00:35 | |
but it probably means you just want to be using functions instead | 00:36 | ||
well, okay, you can also just return a closure instead of using assuming | 00:37 | ||
-> |args { $obj.method(|args) } or so | |||
in that case the method lookup would be late bound | 00:38 | ||
unlike looking up $code = $obj.can("method")[0], which is earlier bound | 00:39 | ||
tony-o | m: class c { method g() {'g'.say;} }; sub r($call) {'r'.say;$call();'/r'.say;}; r(c.new.can('g')[0]); | 00:44 | |
camelia | rakudo-moar 91d899: OUTPUT«rToo few positionals passed; expected 1 argument but got 0 in method g at /tmp/8sYbjHE0lJ:1 in sub r at /tmp/8sYbjHE0lJ:1 in block <unit> at /tmp/8sYbjHE0lJ:1» | ||
tony-o | m: class c { method g() {'g'.say;} }; sub r($call) {'r'.say;$call();'/r'.say;}; my $c = c.new; r($c.^can('g')[0]); | ||
camelia | rakudo-moar 91d899: OUTPUT«rToo few positionals passed; expected 1 argument but got 0 in method g at /tmp/aB9zymykGC:1 in sub r at /tmp/aB9zymykGC:1 in block <unit> at /tmp/aB9zymykGC:1» | ||
00:45
dayangkun joined
|
|||
tony-o | m: class c { method g() {'g'.say;} }; sub r($call) {'r'.say;$call();'/r'.say;}; my $c = c.new; r(-> |args { $c.g(|args); }); | 00:47 | |
camelia | rakudo-moar 91d899: OUTPUT«rg/r» | ||
tony-o | closure is probably easiest | 00:48 | |
00:48
smls left
|
|||
tony-o | thanks TimToady | 00:48 | |
00:48
Spot_ left
00:49
Spot__ joined
00:50
clkao left,
ipa_blah joined,
ggherdov left
|
|||
Timbus | m: class c { method g() {'g'.say;} }; sub r($call) {'r'.say;$call();'/r'.say;}; my $c = c.new; r(c.new.can('g')[0].assuming($c)); | 00:51 | |
camelia | rakudo-moar 91d899: OUTPUT«rg/r» | ||
Timbus | yeah. blocks are definitely the best way to pass 'lazy code' around. would macros be able to fix that | 00:53 | |
or course they could | 00:54 | ||
of* | |||
00:55
ggherdov joined
00:58
pmurias left
00:59
stapler joined,
dayangkun left
|
|||
stapler | hi! | 00:59 | |
00:59
vendethiel left
|
|||
Timbus | helo | 01:01 | |
TimToady | tony-o: to do it the .can way, you also have to provide teh invocant with .assuming | ||
01:06
vendethiel joined
01:12
ssqq joined
|
|||
tony-o | interesting | 01:14 | |
similar to the .apply in js | |||
but more secure | 01:15 | ||
japhb | I haven't been able to update my r-j build today (first time in ~a month), because it crashes attempting to install bootstrap panda. Is this known? | 01:25 | |
Also, is it expected that pl6anet.org is unstyled? | 01:27 | ||
01:28
stapler left
01:29
stapler joined
01:32
ash___ joined
|
|||
ash___ | Hi guys | 01:32 | |
Can you explain the loop/winner construction for working with channels? | |||
Namely, I am not sure about how this works: | 01:33 | ||
$ch = Supplier.for(1..10).Channel; | |||
01:33
bjz left
01:34
ssqq left
|
|||
ash___ | loop { winner $ch { more $ch -> $x {say "x=$x"} more $ch -> $y {say "y=$y"} done {...}}} | 01:34 | |
here, the two more keywords, do they state any kind of parallelism> | |||
? | |||
ugexe | japhb: if its the thread exception error im thinking of, then just keep trying | 01:41 | |
01:49
vendethiel left
|
|||
dalek | osystem: 6a13a31 | tony-o++ | META.list: Simple "REST"ful style router for http-async |
01:51 | |
01:52
vendethiel joined
|
|||
timotimo | ash___: i don't think supplying the same argument to more twice makes sense | 01:54 | |
winner is about race-free-ly matching one of many channels/promises to give a result/value or finish | 01:55 | ||
also, i think winner has been re-named to earliest recently? | |||
perlcabal.org/syn/S17.html#Channels - maybe this explanation helps? | 01:56 | ||
well, "specification" really | |||
japhb | ugexe: Ewww. >.< | 01:57 | |
timotimo | japhb: yeah, pl6anet.org was supposed to be a very short-term stop-gap solution | 01:58 | |
japhb | timotimo: Ah, I see. | ||
BenGoldberg | Is there a more concise way to do the following? | 02:01 | |
m: my @a = (^6).pick(*); my $p = Promise.new; for ^4 { my @b = @a; start { repeat { @b .= pick(*) } until [<=] @b; $p.keep(@b) } }; say await $p; | |||
camelia | rakudo-moar 91d899: OUTPUT«0 1 2 3 4 5» | ||
BenGoldberg | Keeping it as a concurent bogosort, of course ;) | ||
timotimo | BenGoldberg: can you try to turn the @b + @b .= pick(*) ... [<=] @b into a sequence? | 02:02 | |
(because fsck memory usage, am i rite) | |||
tony-o | i had to look up bogosort to figure out why you'd do something that way | ||
timotimo | :D | 02:03 | |
tony-o | that should be a module..lol | ||
02:04
dayangkun joined
|
|||
BenGoldberg | m: my @s := [(^5).pick(*)], [$_.pick(*)] ... [<=] @$_; say @s[0]; say @s[1]; | 02:06 | |
camelia | rakudo-moar 91d899: OUTPUT«2 0 1 3 4Nil» | ||
02:07
ipa_blah is now known as clkao
|
|||
timotimo | m: my @s := [(^5).pick(*)], [(@$_).pick(*)] ... [<=] @$_; say @s[0]; say @s[1]; | 02:11 | |
camelia | rakudo-moar 91d899: OUTPUT«1 2 4 0 3Nil» | ||
timotimo | m: my @s := [(^5).pick(*)], [(@$_).pick(*)] ... { [<=] @$^a }; say @s[0]; say @s[1]; | 02:12 | |
camelia | rakudo-moar 91d899: OUTPUT«3 0 2 4 1» | ||
timotimo | i wonder if it flattens the individual arrays before applying the endpoint check | ||
m: my @s := [(^5).pick(*)], [(@$_).pick(*)] ... { say "checking $^a.perl()" }; say @s[0]; say @s[1]; | 02:13 | ||
camelia | rakudo-moar 91d899: OUTPUT«checking [4, 1, 3, 0, 2]4 1 3 0 2Nil» | ||
timotimo | m: say [<=] @$_ given [4, 1, 3, 0, 2] | ||
camelia | rakudo-moar 91d899: OUTPUT«False» | ||
timotimo | oh, wait | 02:14 | |
we'd have to reverse that, no? | |||
hm, no, we wouldn't | |||
ah | 02:15 | ||
it probably doesn't build the code properly | 02:16 | ||
m: my @s := [(^5).pick(*)], { [(@$^a).pick(*)] } ... { [<=] @$^a }; say @s[0]; say @s[1]; | |||
camelia | rakudo-moar 91d899: OUTPUT«0 1 4 3 23 2 1 0 4» | ||
timotimo | m: my @s := [(^5).pick(*)], { [(@$^a).pick(*)] } ... { [<=] @$^a }; say @s[0]; say @s[*-1] | ||
camelia | rakudo-moar 91d899: OUTPUT«2 3 4 0 10 1 2 3 4» | 02:17 | |
japhb | m: my @a = ^6.pick(*); my $p = Promise.new; for ^4 {start {$p.keep((@:=$@a, *.pick(*) ... {[<=] $^a})[*-1])}}; say await $p; | ||
camelia | rakudo-moar 91d899: OUTPUT«0 1 2 3 4 5eption in code scheduled on thread 139789340813056» | ||
japhb | ^^ Either produces the right answer in parallel, or a thread exception, or both. In the above case, both. :-( | ||
tony-o | is the thread-exception thing a known issue with moar? | 02:18 | |
i've been getting it a lot .. | |||
now that i'm no longer working in serials | |||
japhb | I dunno. It really shouldn't be, but something is clearly wrong. | ||
timotimo | well, jnthn has said often enough that the parallel stuff hasn't had enough time to harden yet | 02:19 | |
tony-o | what happened to diakopter and moar? | ||
japhb | diakopter is deep in no-free-hacking-'time land | ||
tony-o | is moar still being developed? | 02:20 | |
japhb | tony-o: Oh definitely. jnthn is the founder and still active (just not today). There are a number of other contributors as well. | 02:21 | |
tony-o | ahh, i thought diakopter started that project, he recruited me into the 5 lines i commited to it :p | 02:22 | |
japhb | I believe he was #2 or #3. | ||
02:24
jimmy_ joined
02:26
dayangkun left
|
|||
[Coke] | japhb: that prints out 0 1 2 3 4 5 locally. | 02:26 | |
This is perl6 version 2014.11-46-g62c092f built on MoarVM version 2014.11-59-g25a4405 ( OS X) | 02:27 | ||
doing a fresh rebuild to check... | |||
japhb | [Coke]: If you re-run it a few times, do you always get the same (correct) result? | 02:35 | |
02:36
vendethiel left
|
|||
[Coke] | japhb: fresh build, same thing. | 02:40 | |
while [ 1 ] ; do perl6 foo.p6 ; done # gets me a page full of the same results. | 02:41 | ||
ProductName:Mac OS X | |||
ProductVersion:10.9.5 | |||
IWBNI panda said "please wait, panda-ing" during a rebootstrap instead of vanishing. | 02:43 | ||
[Coke] is bummed that X 1..13 doesn't work anymore. | 02:44 | ||
timotimo | tony-o: i'm among the people who work on moar, though my contributions are very rarely features, mostly little tweaks and attempts to improve performance | 02:59 | |
japhb | [Coke]: No, I meant, just rerun it over and over (up-arrow, enter :-) | 03:03 | |
[Coke] | japhb: ... my way is more efficient. no, same result. :P | ||
japhb | [Coke]: Oh, sorry, didn't see the line where you while-1'ed. | ||
In any case, I guess I should be happy it's rock solid on *some* OS. Clearly not on whatever camelia is running on at the moment, | 03:04 | ||
s:2nd/,/./ | 03:05 | ||
[Coke] | wierd that it's OS X, though. :) | ||
03:05
KCL_ joined
|
|||
japhb is working his way through reading the source for all concurrency classes in Rakudo to get a handle on how to start testing the underlying nqp::ops. | 03:07 | ||
03:07
Mso150 joined
|
|||
[Coke] commits some stuff to github.com/coke/poker, which he hasn't done in ages. whee. | 03:10 | ||
03:22
noganex joined
03:26
noganex_ left
03:34
onebitboy joined
03:50
dayangkun joined,
dayangkun left
03:51
erkan joined,
erkan left,
erkan joined,
Mso150 left
|
|||
stapler | you guys seem alive an kicking for the most part | 03:56 | |
03:58
immortal joined,
immortal left,
immortal joined
04:00
erkan left
04:04
erkan joined
04:05
stapler left
04:06
immortal left
04:21
sorear left
04:24
sorear joined
04:36
adu joined
05:01
mr-fooba_ left
05:02
BenGoldberg left
05:04
araujo left
05:11
kaare_ joined
05:22
Possum left
05:24
araujo joined
05:34
onebitboy left
05:35
onebitboy joined
05:36
jimmy_ left
05:38
onebitboy left
05:39
onebitboy joined
05:43
onebitboy left
05:44
onebitboy joined
06:02
telex left
06:04
telex joined
06:06
[Sno] left
06:14
dayangkun joined
06:27
jimmy_ joined,
dayangkun left
06:42
kaleem joined
06:44
Possum joined
06:50
rindolf joined
06:54
araujo left
06:55
Possum left
06:57
Possum joined
|
|||
TimToady | was livelier before the sun wandered out over the Pacific... | 07:00 | |
07:00
anaeem1 joined
|
|||
TimToady | we need some minions in Hawaii :) | 07:00 | |
07:00
anaeem1 left
07:01
anaeem1_ joined
07:04
V_S_C joined
07:08
[Sno] joined
|
|||
lizmat | the minions in Perl just woke up | 07:11 | |
woolfy | I see Perl houses | 07:12 | |
lizmat | (the other Perl people are still asleep, apparently :-) | 07:13 | |
07:16
sqirrel_ joined
07:21
Possum left,
FROGGS joined
07:26
rindolf left
07:30
V_S_C left,
oetiker_ is now known as oetiker
07:31
oetiker left,
oetiker joined
07:33
chenryn joined
07:46
zakharyas joined
07:52
sqirrel_ left
07:57
adu left
07:59
Isp-sec joined
08:00
Possum joined
08:03
ribasushi left
08:06
ribasushi joined
08:07
virtualsue joined
08:11
cibs left,
cibs joined,
zakharyas1 joined
08:13
zakharyas left
08:18
darutoko joined
08:25
krunen joined
08:30
araujo joined
08:35
kurahaupo left
08:36
sqirrel_ joined
08:39
onebitboy left
08:42
onebitboy joined
08:46
KCL joined
|
|||
sergot | morning o/ | 08:48 | |
TimToady | \o | ||
08:49
immortal joined,
vendethiel joined,
KCL_ left
08:51
erkan left
08:54
Mso150 joined
08:58
mathw_ is now known as mathw
|
|||
dalek | kudo/newio: 6e8aaa2 | (Elizabeth Mattijsen)++ | src/core/ (2 files): Fix some spurt() related spectest glitches |
08:58 | |
mathw | o/ | ||
09:00
molaf_ joined
09:02
molaf left
09:12
vendethiel left
09:14
dddddd joined,
ssqq joined
09:15
mvuets joined
|
|||
dalek | p: 6bde551 | TimToady++ | src/ (4 files): reduce NFAs 40% by removing 2/3 of epsilons Edges that point to simple epsilon states can instead point to whatever the epsilon points to (transitively). Identical fates can be similarly merged. Once the useless states are delinked, we resequence the states and associated edges, removing any states that no longer have any reference, and remapping the state pointers. Also fixed a bug in quant that can produce states with no edges when quant is called with a 'to' of -1. Also installed a whole lot of debugging code to figure all this out. Also added tests for epsilons pointing to 0 on parrot and jvm (moar already has this check). Should become unnecessary once nqp is rebootstrapped, but the stage 0 NFAs have the edgeless state bug that triggers this. |
09:15 | |
p: 70056d5 | TimToady++ | tools/build/MOAR_REVISION: bump moar |
|||
jimmy_ | \o TimToady++ | 09:17 | |
lizmat | TimToady++ indeed! | ||
commute to Amsterdam& | |||
09:17
lizmat left
09:21
woolfy left
09:23
salv0 left
|
|||
TimToady | there is, apparently, still some subtle bug causing t/spec/integration/99problems-41-to-50.t to fail, but that's the only failure that seems related | 09:24 | |
09:24
gtodd left
|
|||
jimmy_ | TimToady: dentout's arg looks like unused? | 09:24 | |
TimToady | it returns it | 09:25 | |
09:26
gtodd joined
|
|||
TimToady | so we can unindent after whatever the final statement is | 09:26 | |
dalek | kudo/nom: 03d1599 | TimToady++ | tools/build/NQP_REVISION: bump nqp |
09:32 | |
TimToady | it's vaguely possible that the parsing bug that is biting 99problems-41-to-50.t will also affect something downstream, but hopefully not | 09:33 | |
it seems to involve a 0 state transition from a non-epsilon somehow, but I'll look at that tomorrow | 09:34 | ||
tadzik | TimToady++ | ||
moritz | stage parse: 30s | ||
TimToady++ | |||
TimToady | uh, are you using nqp/master? or did you wait for the bump? | 09:36 | |
09:36
sqirrel_ left
|
|||
moritz | nqp/master | 09:36 | |
and moar/master | |||
TimToady | what was yours before? | ||
nwc10 | good *, * | 09:37 | |
nwc10 did wonder that | |||
TimToady | this shouldn't really speed up the parser by more than a few percent | ||
moritz | TimToady: no idea; it's also been a while since I last looked at the build time on this machine | ||
TimToady | given the nfa was only 10% of the parser before this | ||
also, compiling grammars has more overhead, but they run faster once they're compiled, so parsing a parser is a bit of a wash | 09:38 | ||
should also help any regex that uses nfa | 09:39 | ||
09:40
virtualsue left,
salv0 joined
09:44
dakkar joined
|
|||
TimToady | and startup should be a bit faster too | 09:44 | |
since the optimization is applied before serialization | |||
09:45
vendethiel joined
|
|||
jimmy_ | didn't see a faster startup, I think that's because coresetting init spents too much time | 09:46 | |
09:52
Ugator joined
09:55
abraxxa joined
|
|||
TimToady | this is bizarre, when I checked out rakudo on a different machine and configed it, it says it pulled in 650333f for MoarVM, just as the tag is, but it's missing the patch that showed up in #moarvm a couple hours ago | 10:03 | |
how can two different versions have the same hash? | 10:04 | ||
10:05
yoleaux left
|
|||
TimToady | my nqp and moar are both on branch master, and the bumps both looks right | 10:05 | |
lemme try downloading again | 10:06 | ||
10:06
Isp-sec left,
fhelmberger joined
10:08
vendethiel left
10:13
pecastro joined
|
|||
TimToady | fresh clone seems to have fixed it somehow | 10:15 | |
ssqq | which file define token *<ident>* in the nqp repo? | 10:19 | |
FROGGS | TimToady++ # 6bde551 | 10:20 | |
TimToady | and jvm only fails the same 99problems test on my laptop, so I think I'll go to bed and let my other machine crank on all the spectests while I sleep | ||
10:21
vendethiel joined
|
|||
TimToady | zzz & | 10:21 | |
FROGGS | sleep wall | 10:23 | |
err, well | |||
TimToady | with a will | ||
10:24
ssqq_ joined
10:27
bjz joined,
ssqq left
10:33
jimmy_ left
10:37
virtualsue joined
10:42
pecastro left,
mvuets left
10:43
virtualsue left,
vendethiel left
10:44
denis_boyun_ joined
|
|||
Ulti | could I get an invite for the advent calendar? Wordpress username is 'matteoates' | 10:52 | |
10:53
virtualsue joined
|
|||
Ulti | also whatever changes have happened in the last couple of days ++ 23% speed up on my bioinformatics stuff | 10:55 | |
:) | |||
jnthn | mebbe TimToady++'s NFA work, if you're parse-heavy... | 11:00 | |
Ulti | actually I haven't run the parsing test but I noticed yesterday that was fast enough that I couldn't notice it doing it on a reasonable sized file when it used to take a while | 11:02 | |
this is mostly splitting strings into lists and back again | |||
11:03
Mso150 left
11:06
pecastro joined
11:08
chenryn left
11:11
vendethiel joined
|
|||
Ulti | out of interest what memory usage should I expect from rakudo on moarvm just for hello world? | 11:12 | |
tadzik | up to 200M, I think? | 11:16 | |
just guessing :) | |||
Ulti | ~132MB for me here | 11:18 | |
tadzik | here it seems to be below 100, freshly built | 11:22 | |
how are you measuring it though? | |||
11:34
vendethiel left
11:36
Possum left
11:37
chenryn joined
11:44
mvuets joined
11:48
mr-foobar joined
11:51
Akagi201_ left
11:53
ssqq_ left
11:54
Possum joined
|
|||
Ulti | memusg which basically calls ps over and over | 11:54 | |
11:55
kurahaupo joined
|
|||
Ulti | so has a bias for longer running jobs, like it says ruby and perl use about 1KB to do hello world which feels too small | 11:55 | |
moritz | $ /usr/bin/time ./perl6-m -e '' | 11:56 | |
0.20user 0.02system 0:00.23elapsed 99%CPU (0avgtext+0avgdata 94612maxresident)k | |||
so about 100M max RSS | |||
11:56
Alina-malina left
|
|||
moritz | though I guess the virtual memory size might be more interesting | 11:57 | |
11:57
Alina-malina joined,
ssqq_ joined
11:59
kaleem left
12:01
ssqq joined
12:06
jferrero joined
12:12
smls joined
|
|||
smls | m: say +"aa\nbb\n".comb(/^^/); say +"aa\nbb\ncc".comb(/^^/); | 12:13 | |
camelia | rakudo-moar 91d899: OUTPUT«23» | ||
smls | ^ Why does it not match the final newline in the first case? | ||
12:16
rindolf joined
|
|||
colomon | smls: Because you asked it to match the beginning of lines, and no line begins there? | 12:18 | |
12:18
mr-fooba_ joined
|
|||
smls | does an empty line not have a beginning? :) | 12:18 | |
12:20
mr-foobar left
12:23
mr-fooba_ left
12:24
prevost joined
12:29
psch joined
|
|||
psch | hi #perl6 | 12:29 | |
S05:804 # smls, as reference | |||
synopsebot | Link: perlcabal.org/syn/S05.html#line_804 | ||
psch | no idea if it would make more sense to have line-beginning at the end of a line that ends with "\n", but it's been thought about apparently | 12:30 | |
s/end of a line/end of a string/ | |||
smls | ok, thanks | ||
12:31
ssqq left
|
|||
timotimo | my core setting moarvm file is still 13 mb, i wonder how much of that is serialized NFA | 12:32 | |
12:37
kurahaupo left
|
|||
colomon | smls: there was oodles of thought given to what empty strings you might get back from comb. I don't remember all the rules, alas. | 12:37 | |
smls | yeah come to think of it, the way it works probably does DWIM for most use-cases of ^^ | 12:38 | |
in my case I'll just use (1 + .comb(/\n/)) | 12:39 | ||
12:39
sven_123 left,
sven_123 joined
12:40
ssqq joined
12:43
rindolf left,
ssqq_ left
12:45
chenryn left
|
|||
colomon | m: say "aa\nbb\n".comb(/^^/); say "aa\nbb\ncc".comb(/^^/); | 12:48 | |
camelia | rakudo-moar 91d899: OUTPUT«  » | ||
12:49
virtualsue left
13:21
mephinet- left,
mephinet- joined,
mephinet- left,
mephinet- joined,
mephinet- is now known as mephinet
|
|||
jnthn | timotimo: It's your Perl6/Grammar.nqp that shoulda shrunk for the most part | 13:26 | |
timotimo | ah, of course | 13:27 | |
3.1 megabytes. i wonder how big it was before | 13:28 | ||
13:28
kaleem joined
|
|||
psch | timotimo: i have a Perl6/Grammar.moarvm from a few days ago with 5.5MB here | 13:31 | |
the "rougly 40%" seems to be a decent estimate | |||
13:33
dayangkun joined
|
|||
timotimo | cool | 13:34 | |
nwc10 | is there any command line parsing for NQP other than src/HLL/CommandLine.nqp ? | ||
and if so, is there any way to use it other than tools/build/gen-cat.pl? | |||
why am I asking - because I would like to write a build tool *in* NQP | |||
13:35
ash___ left
13:37
prevost left
13:39
dayangkun left
|
|||
psch | i don't think there's anything but src/HLL/CommandLine.nqp, but it's also used in HLL/Compiler.nqp which hands the Result to the process, iirc | 13:43 | |
13:44
mr-foobar joined
|
|||
psch still finds bootstrapping compiler somewhat magical | 13:45 | ||
jnthn | Bootstrapping compiler finds itself somewhat magical... :) | 13:47 | |
arnsholt | I'm discovering enough magic in making a non-bootstrapping compiler | ||
moritz | :-) | 13:48 | |
arnsholt | To get all functions to be class instances I'll probably cheat a bit, at least for the initial iteration | 13:50 | |
smls | m: note "foo"; sub note ($msg) { CORE::note("Info: $msg") } | 13:53 | |
camelia | rakudo-moar 91d899: OUTPUT«Cannot find method 'Any' in sub note at /tmp/WdJJaTCqov:1 in block <unit> at /tmp/WdJJaTCqov:1» | ||
smls | ^ Is something like that possible? | ||
arnsholt | Oh come to think of it, the spec actually allows for some cheating, with the separation between built-in and user-defined functions | ||
Yaaay \o/ | |||
psch | smls: delayed declaration? or overwriting builtins? | 13:54 | |
smls | wrapping built-ins | ||
e.g. add ANSI color codes to all warn/note messages | |||
psch | m: my ¬e = ¬e.assuming("Info: " ~ *); note("test") | ||
timotimo | m: say &SETTING::note | ||
camelia | rakudo-moar 91d899: OUTPUT«No such method 'assuming' for invocant of type 'Callable' in block <unit> at /tmp/2TdHeYzyXt:1» | ||
rakudo-moar 91d899: OUTPUT«(Any)» | |||
moritz | that's the beauty of the built-ins just being in an outer scope | ||
timotimo | m: say SETTING::note | 13:55 | |
camelia | rakudo-moar 91d899: OUTPUT«(Any)» | ||
moritz | m: say CORE::<¬e> | ||
camelia | rakudo-moar 91d899: OUTPUT«sub note (Any |) { #`(Sub|69342656) ... }» | ||
timotimo | ah | ||
moritz | it's not a package | ||
psch | i wonder if it's sensible to &assuming with a WhateverCode. probably not... | ||
m: my ¬e = -> { note("Info: " ~ $^a) }; note("test") | 13:56 | ||
camelia | rakudo-moar 91d899: OUTPUT«===SORRY!=== Error while compiling /tmp/2QNg0AET_YPlaceholder variable '$^a' cannot override existing signatureat /tmp/2QNg0AET_Y:1------> my ¬e = -> { note("Info: " ~ $^a) }⏏; note("test") expecting…» | ||
psch | oh, right | 13:57 | |
m: my ¬e = { note("Info: " ~ $^a) }; note("test") | |||
camelia | rakudo-moar 91d899: OUTPUT«Memory allocation failed; could not allocate 1583080 bytes» | ||
colomon | :\ | ||
psch | m: { my ¬e = { &CORE::<note>("Info: " ~ $^a) }; note("test") } | ||
camelia | rakudo-moar 91d899: OUTPUT«===SORRY!=== Error while compiling /tmp/4TMEoZ0ppTUndeclared routine: &CORE used at line 1» | ||
psch | eh, now i have all the pieces i think... :) | 13:58 | |
sorry for the spam | |||
13:59
telex left
|
|||
jnthn | hah, that large allocation was probably yet more stack frames :P | 14:00 | |
smls | m: sub note { CORE::<¬e>("Info: $^a") }; note "test" | ||
camelia | rakudo-moar 91d899: OUTPUT«Info: test» | ||
smls | \o/ | ||
14:00
telex joined
|
|||
psch | moritz++ for the right place to look for ¬e | 14:00 | |
14:00
xinming left
14:01
xinming joined,
anaeem1_ left
|
|||
smls | m: say $*DISTRO.name | 14:02 | |
camelia | rakudo-moar 91d899: OUTPUT«linux» | ||
smls | ^ will that always say 'linux' on any linux distro? | ||
14:04
virtualsue joined
|
|||
moritz hopes so | 14:06 | ||
smls | Why do we have $*DISTRO.is-win but not .is-unix .is-posix etc.? | 14:09 | |
FROGGS | smls: because in most cases you'll find: if $is-win { ... } else { ... } | 14:10 | |
14:12
adu joined
|
|||
timotimo | sad truth? | 14:12 | |
smls | m: my ¬e = $*DISTRO.is-win ?? CORE::<¬e> !! { CORE::<¬e>("\x1b" ~ $^a ~ "\x1b") }; note "test" | 14:13 | |
camelia | rakudo-moar 91d899: OUTPUT«test» | ||
smls | ^^ On a scale of 1 ro 10, how evil would you rate this? :P | ||
*to | |||
moritz | 3 | 14:14 | |
smls | Would it be better to have a new sub that checks each time whether it should add colors? | ||
14:14
vendethiel joined
|
|||
smls | (each time it is called) | 14:14 | |
14:14
silug left
|
|||
dalek | ake: cd52f91 | (Arne Skjærholt)++ | src/Snake/ (2 files): Implement hash literals. |
14:15 | |
FROGGS | smls: we have have a env var in rakudo about colors... starts with RAKUDO_ | ||
this should be taken into account too | |||
14:16
blackbolt joined
|
|||
smls | FROGGS: Even in a user script? | 14:16 | |
FROGGS | smls: I use that variable in modules too that output color, aye | 14:17 | |
14:23
jluis left
|
|||
nwc10 | how does one use nqp::readfh from NQP? I can only find examples that use it which are Perl 6 | 14:24 | |
14:30
jluis joined
|
|||
timotimo | FROGGS: that's for Pod::To::Text | 14:30 | |
FROGGS | timotimo: and for backtrace printing | 14:31 | |
14:31
rindolf joined
|
|||
timotimo | oh? | 14:32 | |
didn't know that | |||
FROGGS | nqp-m: my $fh := nqp::open("foo", "r"); say(nqp::readfh($fh)); nqp::closefh($fh); | 14:33 | |
camelia | nqp-moarvm: OUTPUT«Arg count 1 doesn't equal required operand count 3 for op 'read_fhb' at gen/moar/stage2/QAST.nqp:1466 (/home/camelia/rakudo-inst-2/languages/nqp/lib/QAST.moarvm:compile_mastop:209) from gen/moar/stage2/QAST.nqp:1682 (/home/camelia/rakudo-inst-2/languages…» | ||
FROGGS | nqp-m: my $fh := nqp::open("foo", "r"); my $result; say(nqp::readfh($fh, $result, 42)); nqp::closefh($fh); | 14:34 | |
camelia | nqp-moarvm: OUTPUT«Failed to open file: no such file or directory at /tmp/_Ps3Utgnql:1 (<ephemeral file>:<mainline>:23) from gen/moar/stage2/NQPHLL.nqp:1239 (/home/camelia/rakudo-inst-2/languages/nqp/lib/NQPHLL.moarvm:eval:172) from gen/moar/stage2/NQPHLL.nqp:1432 (/ho…» | ||
FROGGS | nwc10: ^^ | ||
nqp-m: my $fh := nqp::open("/home/camelia/rakudo-inst-2/VERSION", "r"); my $result; say(nqp::readfh($fh, $result, 4)); nqp::closefh($fh); | 14:35 | ||
camelia | nqp-moarvm: OUTPUT«Failed to open file: no such file or directory at /tmp/ctifKM74Ba:1 (<ephemeral file>:<mainline>:23) from gen/moar/stage2/NQPHLL.nqp:1239 (/home/camelia/rakudo-inst-2/languages/nqp/lib/NQPHLL.moarvm:eval:172) from gen/moar/stage2/NQPHLL.nqp:1432 (/ho…» | ||
nwc10 | FROGGS: no, that doesn't work | ||
read_fhb requires a native array to write to at /home/nc/test/moar.nqp:15 (<ephemeral file>:MAIN:98) | |||
FROGGS | ohh | ||
14:35
immortal left
|
|||
nwc10 | I can't work out how to create the relevant array of uint8 | 14:35 | |
sorry, should have been clearer that that was my probelm | |||
psch | nqp::bootarray and nqp::bootintarray don't seem to work, from my tests just now | 14:36 | |
which makes this somewhat confusing | 14:37 | ||
nwc10 | from the C code, it looks like I need to have | ||
REPR(result)->ID == MVM_REPR_ID_MVMArray | |||
and | |||
(MVMArrayREPRData *)STABLE(result)->REPR_data)->slot_type == MVM_ARRAY_U8 | |||
(or MVM_ARRAY_I8) | |||
but I have no idea how to write NQP code that makes something that the C code likes | |||
arnsholt | bootintarray probably has word-sized ints | 14:38 | |
In Rakudo I think Buf[int8] should do the trick | |||
14:39
mephinet left,
smls left,
mephinet joined
|
|||
nwc10 | arnsholt: that seems to be syntactically valid NQP, but it's not working (same error message about 'requires a native array' | 14:40 | |
) | |||
psch | nwc10: does nqp::readcharsfh fit for you use-case? | ||
14:40
dalek left,
smls joined
|
|||
nwc10 | psch: no, sadly not | 14:40 | |
arnsholt | Yeah, not sure how to do it in NQP | 14:41 | |
psch | from docs.markdown it does look like you need the perl6-type Buf for readfh :/ | ||
FROGGS | gimme another minute | ||
psch bbl o/ | |||
14:42
dalek joined,
ChanServ sets mode: +v dalek
|
|||
nwc10 | but, Rakudo is written in NQP, so it must have a way to make its Buf objects using NQP :-) | 14:42 | |
arnsholt | Yeah, it's all accessible from NQP | ||
PerlJam | my $Buf := buf8.new(); | 14:43 | |
timotimo | it seems like the memory usage of "say 'test'" went down noticably (now 102 megabytes maxrss) | 14:44 | |
i claim TimToady++ is to blame for this | |||
smls | FROGGS: I don't think normal scripts should react to RAKUDO_* variables. | 14:45 | |
Why should users care that running a program they installed happens to involve something calles "Rakudo"? | |||
And shouldn't authors try to keep their Perl 6 scripts implementation independent? | |||
14:46
psch left
|
|||
FROGGS | it is just that rakudo is the leading Perl 6 implementation and modules authors can take sane environment variables into account to disable colored prompts | 14:46 | |
if there are more Perl 6 implementations I make my modules happily aware of more implementation specific things | 14:47 | ||
smls | if it's just for *dis*abling, then okay | ||
FROGGS | that's better than 20+ different env vars just to disable colors for a handful modules | ||
yes | |||
I think this one was about disabling | |||
14:48
molaf_ left
|
|||
smls | Ideally, one should also check whether $*OUT is a terminal | 14:48 | |
like `ls` prints color codes, but `ls > file` does not | 14:49 | ||
m: say $*OUT.t | 14:50 | ||
camelia | rakudo-moar 91d899: OUTPUT«Cannot find method 'isatty': no method cache and no .^find_method in method t at src/gen/m-CORE.setting:15808 in block <unit> at /tmp/RrRl45JJjr:1» | ||
smls | NYI? | ||
moritz | not yet implemented | ||
erm | |||
you weren't asking what 'NYI' meant :-) | |||
p: say $*OUT.t | 14:51 | ||
camelia | rakudo-parrot 91d899: OUTPUT«False» | ||
moritz | smls: seems NYI; a ticket would be welcome | ||
smls | haven't opened a Rakudo ticket before; should I get into the habit? | ||
14:51
adu left
|
|||
PerlJam | smls: I think only masak has made it habitual :) | 14:52 | |
smls | hrm, the links from rakudo.org/tickets/ lead to bogus "cross site forgery" warning page | ||
timotimo | yeah | 14:53 | |
you can safely ignore that one if it reads "some malicious site may be trying to do a search on your behalf" | |||
because that's exactly what rakudo.org is trying to do and it's not dangerous to execute a particular search, at least AFAIK | 14:54 | ||
smls | I clicked "new tickets", and the first one it shows is 5 years old | ||
Am I in the right place? | |||
timotimo | "new" is just a state a ticket can be in | 14:55 | |
moritz | smls: you have to click on 'created' to sort by newness | ||
14:58
anaeem1_ joined
|
|||
nwc10 | jnthn: my $buf := NQPArray.new; creates (I think) an array of objects. How do I create an array of unit8? I think I need to end up in the `case MVM_STORAGE_SPEC_BP_INT:` of compose() in MVMArray.c | 14:59 | |
FROGGS | nqp::list_i would give you an int array | ||
but not uint8 | |||
nwc10 | io.c is fussy | ||
timotimo | that's something that the native shaped arrays stuff is going to change, if my guess is correct | 15:00 | |
arnsholt | You'll probably have to pull out the relevant stuff from Rakudo's source | ||
FROGGS | I am trying to create an uint8 and then Blob[uint8] type using the mop in nqp... but I end up getting: This representation (VMArray) does not support attribute storage | ||
15:00
vendethiel left
|
|||
nwc10 | FROGGS: thanks for continuing to try. I didn't realise that I'd DOSed you :-/ | 15:01 | |
arnsholt | Make an int8 native type, then create an array type and set it to be of the int8 type | ||
timotimo | i kind of think list_i will only give you something that's compatible with the integer registers of the VM | ||
FROGGS | nqp-m -e 'my $fh := nqp::open("test.pl", "r"); my $result := nqp::list_i; say(nqp::readfh($fh, $result, 4)); nqp::closefh($fh);' | 15:02 | |
read_fhb requires a native array of uint8 or int8 | |||
arnsholt | You want the array_type trait in src/core/traits.pm from Rakudo, the header of src/core/Buf.pm and src/core/natives.pm | ||
15:02
blackbolt left
|
|||
arnsholt | Then stuff the equivalent types into your code | 15:02 | |
FROGGS | that is the best you can do without the mop I think | ||
arnsholt: which is what I tried | 15:03 |