00:00 bjz joined, bjz left
haxmeister learned simple subs, file IO and some methods, regex implementation... I'm liking it so far 00:00
00:00 rindolf left
AlexDaniel haxmeister: does not look bad at all 00:01
haxmeister it works.. I'm gonna add some stuff to it
I need it to not look in certain directories there.. will need to figure out the method for figuring out the folder name 00:02
00:03 Geth joined, ChanServ sets mode: +v Geth
haxmeister does .basename return the folder if it's not a file? 00:03
00:04 nadim joined
nadim Hi, just got the latest rakudo, I was 571 commits back, 00:05
I have ::("Terminal::ANSIColor::EXPORT::ALL::&color") fail when it worked before, what has changed
AlexDaniel nadim: maybe this? rakudo.org/2017/03/18/lexical-requi...rade-info/ 00:08
timotimo timo@schmand ~> perl6 -e 'require ::("Terminal::ANSIColor"); say ::("Terminal::ANSIColor::EXPORT::ALL::&color")' 00:14
sub color (Str $what) { #`(Sub|77895256) ... }
this is on my latest rakudo right now 00:15
nadim that also works for me, and the version I have is 2 hours old 00:16
timotimo hm, so we'll need to look at a bit more context for the case where it doesn't work
00:17 kurahaupo left
gfldex haxmeister: that's how I would write it: gist.github.com/gfldex/9bf8ed50c2c...6cbef83f9c 00:17
nadim nopaste.linux-dev.org/?1123980 00:18
timotimo haxmeister: doing regex matches for a very simple thing like "ends in .log" is a whole lot of unnecessary overhead; try something like $thepath ~~ *.ends-with(".log") instead
00:19 stmuk joined
timotimo well, yeah, that can't work 00:19
didn't i have a pull request for you a couple days ago? where did that disappear to ...
nadim I merged it manually 00:20
timotimo okay, then you missed the most important bit
nadim lol!
timotimo yes, indeed
00:20 stmuk__ left
nadim the if (try require ::Terminal::ANSIColor) !=== Nil { $is_ansi = True } is certainly your 00:20
timotimo when you require ::Terminal::ANSIColor like that in method new, it'll only be visible inside the new method 00:21
that's why i stashed away the &color sub in an attribute
if you apply that part of my patch again, things should work again
i think i'll go to bed now 00:22
have a good one!
nadim I found what I did here: * 7ba0dd8 FIXED: lexical require, patch by timo (3 weeks ago, Nadim Khemir) but since it was by hand I probably missed a bit as you said
timotimo yeah, i looked at that
nadim I guess I will find it in your repo od Data::Dump::Tree 00:23
timotimo by moving the self.bless at the end my patch also enables us to turn &.ansicolor into &!ansicolor so it's no longer visible to the outside. that'll require a submethod TWEAK(:&!ansicolor) { } though
github.com/nkh/P6-Data-Dump-Tree/c...9a016089cc
that was my patch
why it's inside nkh/P6-Data-Dump-Tree instead of my own fork of it i'm not sure 00:24
nadim thanks and good night :)
timotimo you're welcome :)
00:26 Cabanossi left 00:27 Cabanossi joined 00:28 Rawriful left
gfldex brrt++ # brrt-to-the-future.blogspot.de/2017...-mean.html 00:30
00:36 k-man joined 00:46 dj_goku joined 00:51 dj_goku left, ponbiki joined 00:53 Praise joined, Praise left, Praise joined 00:55 astj joined 00:56 Praise left 00:57 Praise joined, Praise left, Praise joined 00:58 Zoffix joined 01:01 Voldenet left
Zoffix haxmeister: your script has a bug. You're not exhausing output of `dir` call before recursing into other dirs, so it'll crash when you recurse over enough dirs to reach maximum per-process open files. gfldex's version has it as well, except it hides the bug behind the `try` 01:04
haxmeister: the docs have an example of recursive search without that bug. Note how it's pushing all the dirs to look at into an array instead; this lets it open and close each dir 1 at a atime: docs.perl6.org/routine/dir 01:05
haxmeister: better yet, just use File::Find module. It can take a regex for the filename to look for: github.com/tadzik/File-Find 01:06
haxmeister tyvm Zoffix .. hopefully the page doesn't have features I haven't learned yet 01:07
01:07 Voldenet joined, Voldenet left, Voldenet joined
samcv in grammars, is there a method that gets hit at the very end of parsing? 01:07
and only hit once
01:08 Zoffix left
samcv action classes i mean 01:09
AlexDaniel samcv: what about using method TOP? :) 01:10
samcv it gets hit many times 01:11
AlexDaniel wonders under what conditions this could happen 01:12
samcv i thkn
err
maybe. hm
01:13 stmuk_ joined
Geth doc: c991862cf9 | (Zoffix Znet)++ | doc/Type/IO/Path.pod6
[io grant] Add warning to dir about...

  ...exhausting open files limit due to not exhausing the
iterator of the Seq the routine returns.
01:13
haxmeister ugh 01:14
01:15 stmuk left 01:16 espadrine left
haxmeister so I should push what I get from dir() into an array and iterate the array because dir() holds the directory open wating for the recursive call? 01:16
and gfldex I have no idea what .&?ROUTINE is yet..lol 01:17
gfldex haxmeister: &?ROUTINE referes to the current sub (or method) 01:19
haxmeister: and .& means $_.&(some-sub-or-method-here) 01:20
haxmeister that's hard to remember
01:20 idyll joined
haxmeister but I have difficulty with understanding when we are not addressing $_ explicitly.. took me a minute looking at yours to get it 01:22
AlexDaniel haxmeister: wait, what's hard to remember? 01:24
haxmeister gfldex: could you have put parenthesis in your logic ... (.f) && (.basename ~~ $build-log-regex) ?
AlexDaniel: .&?ROUTINE 01:25
AlexDaniel haxmeister: well, $_. can always be shortened to .
01:25 Cabanossi left
AlexDaniel but to be honest it's the first time I see &?ROUTINE :D 01:26
haxmeister AlexDaniel: maybe I should just make an explicit call for now.. lol
01:26 Cabanossi joined
haxmeister when I'm a perl6 badass.. then I'll do .&?ROUTINE ..lol 01:27
AlexDaniel haxmeister: sure, why not. You'll quickly get tired of it anyway :P
gfldex for advanced players, there is &?BLOCK
haxmeister AlexDaniel: yeah but by that time I won't be trying to remember all kinds of other new stuff in my head
gfldex see docs.perl6.org/language/variables#...26%3FBLOCK 01:28
AlexDaniel gfldex: interestingly, &?ROUTINE is broken
gfldex: oops, in the docs I mean
it points here docs.perl6.org/syntax/&?ROUTINE but it is 404
it should probably point here docs.perl6.org/language/variables#&?ROUTINE
01:29 curt_ left
samcv AlexDaniel, nope top is being called twice 01:29
i wasn't crazy
01:29 idyll left
AlexDaniel samcv: alright. Why? 01:30
samcv: I mean, that would mean that TOP actually matched twice
samcv the cations class
actions class
i don't mean the grammar
AlexDaniel yes?
samcv it gets hit three times 01:31
and it's messing things up
i need something that's only called once at the end not 3 times
gist.github.com/c9ffe206206648e7e9...ffae69a37b 01:32
three times :(
AlexDaniel well, do you match TOP recursively?
01:33 yqt left
AlexDaniel hm… probably not… 01:33
samcv how would i do that
AlexDaniel like rule TOP { <TOP> } 01:34
samcv nope
AlexDaniel code? 01:35
samcv ok it's not doing it i forget what i changed. trying something else here 01:39
not sure what was going on. but. will get back to you
01:40 dj_goku joined, dj_goku left, dj_goku joined 01:43 labster left 01:45 ilbot3 left 01:46 AlexDaniel left 01:48 ilbot3 joined, ChanServ sets mode: +v ilbot3
samcv oh ok changing TOP from regex to a token makes it only run once 01:52
but also breaks the world
Geth Swapped META.info → META6.json in 1 dists in github.com/perl6/ecosystem/commit/ce13941798 01:57
samcv i'm trying to get this code to only run once github.com/samcv/SPDX-Parser/blob/...m6#L78-L84
and only at the end of it. if there aren't any $<compound-expression> matches found in the grammar 01:58
then i need to make sure to push the <simple-expression> matches since they won't be pushed inside the complex expression ones
02:32 adu joined 02:47 poohman joined 02:53 nadim left 03:04 poohman left 03:16 eater joined 03:24 Cabanossi left 03:26 Cabanossi joined 03:30 adu left 03:31 BenGoldberg left 03:37 pierre_ joined 03:38 labster joined 03:40 adu joined 03:41 adu left 03:44 pierre_ left 03:46 Actualeyes left 03:59 aborazmeh joined, aborazmeh left, aborazmeh joined 04:01 wigner joined 04:03 adu joined 04:13 CIAvash joined 04:25 Cabanossi left 04:26 Cabanossi joined 04:32 aborazmeh left, adu left 04:42 ChoHag left 04:45 poohman joined, poohman left, poohman_ joined 04:52 wigner left 05:05 khw left 05:09 Cabanossi left 05:11 Cabanossi joined
moritz \o 05:19
05:34 skids left
sammers hi moritz 05:39
05:39 Cabanossi left 05:41 Cabanossi joined 05:43 Actualeyes joined 05:48 sena_kun joined 05:51 poohman_ left 05:54 gdonald left
samcv \o 05:56
sena_kun o/ 05:57
samcv anybody can help me? 05:58
TOP is called multiple times in the action class for my grammar and i need a method called on the
sena_kun samcv, don't ask to ask. :) It depends on your problem.
samcv only once and at the end
sena_kun hmmm. it is too complex to phasers as it seems. 06:00
FIRST and LAST works only on loops, afaik.
you can recognize first method call with inner state variable, but I am not sure you can guess where the last call would be. 06:01
if you don't want to explicity call it from TOP, perhaps there are some magical grammar methods that can be overloaded. 06:05
samcv hm 06:09
yeah
i need a like DONE method or something
to be called at the very end of the action parse
sena_kun as an ugly alternative, cannot you wrap(change?) your result up(if you want to do it) outside of `parse`? I mean, after `parse` you get a tree and you can customize it by hands in the worst case. 06:11
moritz samcv: you can do something like regex TOP { your regex goes here <.finish_marker> } 06:12
samcv ooo
moritz samcv: token finish_marker { <?> }
samcv and have it be zero width?
nice
thank you moritz :)
moritz method TOP { return unless $<finish_marker> } 06:13
or if TOP is supposed to match the whole string, you can do return unless $/.to == $/.orig.chars;
samcv also how to call the autogenerated USAGE sub 06:16
yourself i mean
USAGE() isn't working
moritz m: sub MAIN() { say $?USAGE } 06:21
camelia ===SORRY!=== Error while compiling <tmp>
Variable '$?USAGE' is not declared
at <tmp>:1
------> sub MAIN() { say $?USAGE }
moritz :(
m: sub MAIN() { &::('USAGE')() } 06:22
camelia No such symbol ''
in sub MAIN at <tmp> line 1
in block <unit> at <tmp> line 1

Actually thrown at:
in sub MAIN at <tmp> line 1
in block <unit> at <tmp> line 1
samcv hm
moritz looking at src/core/Main.pm, it looks like USAGE is pretty well encapsulated 06:23
samcv :(
moritz and the specced ways to access it aren't implemented
samcv suprised there's not a USAGE you can call
that's what i assumed. and that you would override it if you defined it yourself
moritz, the finish_marker gets called first 06:48
06:50 wamba joined 06:51 parv joined 06:54 Cabanossi left 06:56 Cabanossi joined 06:57 pierre_ joined 07:03 TEttinger left 07:04 espadrine joined 07:09 gdonald joined 07:17 Actualeyes left, wamba left 07:30 jeek left 07:37 wamba joined 07:39 Actualeyes joined
Geth Inline-Perl5: f1594f9fb6 | (Stefan Seifert)++ | META6.json
Fix installed Inline::Perl5 not finding all the sub-modules

Add missing keys in "provides" in META.json
08:00
samcv making major progress now on SPDX parser 08:13
not bug free. but over a lot of the issues 08:14
weird error though 08:15
===SORRY!===
Cannot find method 'has_compile_time_value' on object of type NQPMu
08:19 rindolf joined 08:21 Actualeyes left 08:27 pierre_ left 08:38 ufobat joined 08:45 rogbro joined, rogbro left 08:47 rogbro joined, Ven joined 08:48 Ven is now known as Guest85461, rindolf left 08:51 rindolf joined 08:57 jjones-jr joined 09:01 rogbro left 09:02 rogbro joined 09:05 nadim_ joined 09:09 Cabanossi left 09:11 Cabanossi joined 09:13 Guest85461 left 09:19 pmurias joined, rogbro left
pmurias do we want nqp::sprintf("%d", ["not a number"]) to work? 09:20
09:20 rogbro joined 09:22 Ven joined, Ven is now known as Guest91537, rogbro left 09:23 Guest91537 left 09:26 Ven_ joined, pierre_ joined, CIAvash left 09:27 pierre_ left
samcv hmm pmurias not sure but if a string has a number in it. hm 09:28
maybe that's why it works?
a bit odd though. but
bbl
09:28 jjones-jr left 09:32 darutoko joined 09:33 rogbro joined, rogbro left 09:36 rogbro_ joined 09:39 wamba left 09:51 rogbro_ left, parv left 09:52 rogbro joined 10:04 pierre_ joined 10:09 pierre_ left 10:10 rogbro left 10:12 rogbro joined 10:13 Rawriful joined 10:15 labster left 10:16 Ven_ left 10:19 Ven joined, Ven is now known as Guest98432 10:21 eliasr joined 10:22 rogbro left 10:31 laouji joined 10:38 Cabanossi left 10:41 Cabanossi joined 10:45 notbenh joined 11:06 Guest98432 left 11:10 Cabanossi left 11:11 Cabanossi joined 11:15 Ven_ joined 11:26 laouji left, bjz joined 11:28 freesoftwarejoe left 11:29 laouji joined 11:31 wamba joined, Ven_ left 11:34 Ven joined, Ven is now known as Guest9182 11:40 AlexDaniel joined 12:06 pierre_ joined, rindolf left 12:10 pierre_ left 12:22 laouji left 12:38 laouji joined 12:40 zakharyas joined 12:42 rindolf joined 12:58 mcmillhj joined 12:59 zakharyas left 13:06 cdg joined 13:07 zakharyas joined 13:09 Cabanossi left 13:11 Sound joined, Cabanossi joined, Sound is now known as Guest71992, Guest71992 left 13:12 Sound_ joined 13:16 pierre_ joined, sammers left 13:18 laouji left
[Coke] $dayjob question - anyone ever have to provide proof of relationship for medical benefits? (US or not) 13:23
(I have to dig up the marriage & birth certs for new job) 13:24
colomon I’m on my wife’s benefits, and I don’t remember providing proof
only changed a couple of years ago 13:25
Voldenet [Coke]: Well, you have to provide it now, so yes, but I don't remember providing anything like that in Poland
perl6-related question: what's the best way to say "the argument $x needs to have method y" in a signature? 13:26
13:27 drrho_ left
timotimo m: say Str.^can("uc") 13:27
camelia (uc uc)
timotimo m: say Str.^can("not_this_though")
camelia ()
timotimo so you could 'where *.^can("methodname")'
DrForr That's no guarantee though that the method is going to do what you expect when you call it, though. Maybe you're after a class instead? 13:28
Voldenet m: sub do-stuff($x where { $x.^can("u"); }) { say $x.u; }; do-stuff(class { method u {} }.new()) 13:31
camelia Nil
Voldenet m: sub do-stuff($x where { $x.^can("u"); }) { say $x.u; }; do-stuff(class { }.new())
camelia Constraint type check failed in binding to parameter '$x'; expected anonymous constraint to be met but got <anon|51954672> (<anon|51954672>.new)
in sub do-stuff at <tmp> line 1
in block <unit> at <tmp> line 1
Voldenet Perfect.
DrForr class MyStr is Str { method do-stuff { } }; my $x = MyStr.new; sub foo( MyStr $x ) { }
Voldenet but then your object must be of type MyStr 13:32
Basically, though I want to pass an implementation to the given protocol (java style anonymous class)
DrForr True, but you also know that the do-stuff() method accepts the arguments you want because you created it that way. And it's also still a Str.
Voldenet is there any better way to do what I want?
DrForr If you can accept it being that generic, then I'd go for it. Otherwise I'd probably have to see the code and scratch my head for a bit. 13:33
[Coke] use a role, but also allow specific core classes that you know do what you want? 13:34
DrForr I would've suggested a role as well but I wasn't sure if those would play well with whatever hierarchy that he's established. 13:35
I do something similar in Perl6::Parser, a combination of roles to restrict the things classes can do, and a simple, nearly empty class hierarchy that people can do ~~ conparisons on. 13:36
Voldenet m: role Anon { method u { ... } }; sub do-stuff(Anon $x) { $x.u; }; do-stuff(class X does Anon { method u {} }.new()) 13:37
camelia ( no output )
Voldenet m: role Anon { method u { ... } }; sub do-stuff(Anon $x) { $x.u; }; do-stuff(class X does Anon { }.new())
camelia ===SORRY!=== Error while compiling <tmp>
Method 'u' must be implemented by X because it is required by roles: Anon.
at <tmp>:1
Voldenet Yeah, the error message is a lot better. 13:38
+ it's compile-time
DrForr You can also declare method foo {!!!} to state that the method must exist in child classes. 13:39
Voldenet I wish I could get rid of class name inside of "do-stuff(class X does Anon { }.new)" though, hm 13:40
13:40 skids joined 13:41 drrho_ joined
Voldenet m: role Anon { method u { !!! } }; sub do-stuff(Anon $x) { $x.u; }; do-stuff(class { also does Anon; method u {} }.new) 13:42
camelia ( no output )
timotimo but then your objects have to cooperate 13:43
13:44 laouji joined
MasterDuke_ m: role Anon { method u { ... } }; sub do-stuff(Anon $x) { $x.u; }; do-stuff(class :: does Anon { }.new()) 13:44
camelia ===SORRY!=== Error while compiling <tmp>
Method 'u' must be implemented by <anon|54615424> because it is required by roles: Anon.
at <tmp>:1
Voldenet that looks... better :) 13:45
13:47 poohman joined 13:52 poohman left 13:54 Cabanossi left, bjz left 13:55 ufobat left
haxmeister can't figure out why I get an error on my while loop.. pastebin.com/G8gX8uDX 13:55
says missing block while ⏏@listing { 13:56
13:56 Cabanossi joined
AlexDaniel haxmeister: did you mean for ? 13:58
ah no, probably not 13:59
haxmeister was trying to change to push and pop.. the example uses while
don't want to use the example.. want to understand the example
13:59 cdg left
AlexDaniel e: pastebin.com/raw/G8gX8uDX 13:59
evalable6 AlexDaniel, Successfully fetched the code from the provided URL.
(exit code 1) ===SORRY!=== Error while compiling /tmp/GGd2uf91Kv
Missing block
at /tmp/GGd2uf91Kv:17
------>
␉while @listing {
13:59 cdg joined
AlexDaniel c: HEAD pastebin.com/raw/G8gX8uDX 14:00
committable6 AlexDaniel, Successfully fetched the code from the provided URL.
AlexDaniel, ¦HEAD(eb1ce41): «04===SORRY!04=== Error while compiling /tmp/3MrG7lPnwC␤Missing block␤at /tmp/3MrG7lPnwC:17␤------> 03␉while 08⏏04@listing { «exit code = 1»»
AlexDaniel haxmeister: probably needs a space after dir($start-dir) 14:01
haxmeister that was it 14:04
dug out a few other errors.. but now the proggy runs with no response
AlexDaniel \o/
haxmeister the error messages are tricky sometimes..lol
AlexDaniel haxmeister: mostly, we consider less than awesome error messages as bugs, so feel free to submit tickets 14:05
haxmeister ah man.. I dunno I'm pretty noobish, that might get irritating sorting through my tickets to find the ones that are not just my ignorance 14:07
AlexDaniel haxmeister: I doubt that would be a problem 14:10
and you can always ask here beforehand ;)
you'll have to golf it down to 1-2 lines of code though
haxmeister where is the bug reporting page at? 14:12
MasterDuke_ huggable: rakudobug 14:17
huggable MasterDuke_, Report bugs by emailing to [email@hidden.address]
MasterDuke_ haxmeister: ^^^
haxmeister kk 14:18
ty
now I have no errors but my code seems to loop infinitely without producing anything..lol 14:20
pastebin.com/UU2nf1Di
MasterDuke_ this isn't the problem, but you could simplify `my @listing; for dir($start-dir) {@listing.push($_);}` to just `my @listing = dir($start-dir)` 14:25
14:26 ggoebel left
haxmeister yes MasterDuke_ that is how I had it before.. I changed it to long hand while trying to root out an error I had.. thank you for the advice 14:27
14:28 TimToady left
haxmeister I just am not seeing how this isn't working.. I feel so noobish lol, I would have nailed it the first time in lisp ;-P 14:29
14:29 TimToady joined
MasterDuke_ you're popping@listing, but if $item is a directory that doesn't match the regex, you're putting it right back in @listing 14:31
Geth ecosystem: bfec6ee8e3 | (Stefan Seifert)++ | META.list
Switch to versioned releases on CPAN for Inline::Perl5
MasterDuke_ haxmeister: i.e., it's just testing the same directory over and over again 14:33
pmurias Voldenet: re java style anonymous class, you are aware that Perl 6 has closures?
haxmeister MasterDuke_: having to stare at it a minute.. I'm not seeing it yet 14:35
pmurias Voldenet: so that you can do something like $foo.foo(-> {"do some stuff here"}) 14:36
haxmeister MasterDuke_: if it's a directory who's basename is not "work".. push it back on the stack.. that's what I'm intending
I've never used a while loop on a stack that while block is changing.. that's different to me 14:38
MasterDuke_ m: my @a = <a b c>; while @a { my $i = @a.pop; say $i; if $i ne "c" { @a.push($i) }; }
camelia (timeout)c
b
b
b
b
b
b
b
b
b
b
b
b
b
b
b
b
b
b
b
b
b
b
b
b
b
b
b
b
b
b
b
b
b
b
b
b
b
b
b
b
b
b
b
b
b
b
b
b
b
b
b
b
b
b
b
b
b
b
b
b
b…
14:38 evalable6 left
haxmeister lol 14:39
14:39 ChoHag joined
MasterDuke_ that's what's happening 14:40
14:41 ggoebel joined
Voldenet pmurias: but the interface looking like that: (&fn1, &fn2, &fn3) isn't very descriptive when you're reading code 14:41
erm, sub (&fn1, &fn2, &fn3)
14:44 alimon joined
Geth Inline-Perl5/release-0.26: aa06e66e93 | (Stefan Seifert)++ | META6.json
Point to the source tar ball in META6.json
14:45
14:46 ggoebel left 14:47 pierre_ left, mr-foobar left
pmurias Voldenet: you can pass named arguments 14:49
14:50 Rawriful left
Geth ecosystem: eeac110f08 | (Stefan Seifert)++ | META.list
Fix Inline::Perl5 versioned releases

Thanks to ugexe++ for explaining, how this is supposed to work.
14:50
Voldenet pmurias: ah, right, hm, I might reconsider 14:51
pmurias there is nothing wrong with requiring a role and passing an class instance that's implement it btw 14:52
but from my limited java experience they use anonymous class with a method or two mostly to make up for the lack of closures 14:53
15:09 Cabanossi left 15:10 st_elmo joined
Voldenet pmurias: yes, however more modern java has the option to "autoimplement" the anonymous inner class with a lambda, which pretty much does the same 15:11
15:11 Cabanossi joined
Voldenet except the consumer can think of interfaces, still 15:11
15:17 domidumont joined 15:31 nhywyll joined 15:32 mr-foobar joined 15:35 laouji left
stmuk_ rakudo.org/2017/05/01/announce-raku...e-2017-04/ 15:35
15:39 setty1 left, ChoHag left 15:42 khw joined 15:43 laouji joined
Geth ¦ perl6.org: 8580a455a8 | (Steve Mynott)++ | source/downloads/index.html 15:46
¦ perl6.org: R* 2017.04
¦ perl6.org: review: github.com/perl6/perl6.org/commit/8580a455a8
nadim_ hi all, I'd rather not optimize code like an idiot, but I also prefer to not have completely silly code. I am trying to make Data::Dump::Tree better but speed is still a problem. I have profiles it (and not got must smarter in the move) done reviews. .. now I am asking if there is someone who would like to have a look at it. Maybe I am missing something or I am using something that I should not. Help pointing at what to do is appreciated. 15:47
haxmeister MasterDuke_: got it working.. so happy.. works plus I understand it with my limited syntax knowledge 15:49
MasterDuke_: thanks for help
MasterDuke_ np 15:50
haxmeister MasterDuke_:this does prevent dir() from remaining open on recursion as far as I can tell pastebin.com/5d89hbxF 15:51
MasterDuke_ haxmeister: fyi, `for dir($listing) { @stack.push($_); }` could be `@stack.append(dir($listing))` 15:53
haxmeister append would put it on bottom right? 15:55
more appropriate on bottom actually 15:56
makes me wonder why the loop doesn't stop prematurely when I'm pushing on top
MasterDuke_ append is the same as push, but it essentially flattens what it's pushing 15:57
m: my @a = <a b c>; my @b = <d e f>; @a.append: @b; say @a; my @c = <a b c>; @c.push: @bl say @c 15:59
camelia ===SORRY!=== Error while compiling <tmp>
Variable '@bl' is not declared
at <tmp>:1
------> @b; say @a; my @c = <a b c>; @c.push: @bl say @c
haxmeister so append could prevent me from accidentally putting the whole list in a single stack item 16:00
MasterDuke_ m: my @a = <a b c>; my @b = <d e f>; @a.append: @b; say @a; my @c = <a b c>; @c.push: @b; say @c
camelia [a b c d e f]
[a b c [d e f]]
MasterDuke_ exactly
16:00 laouji left
haxmeister in the case of what I have written.. I avoided the problem by chance yeah? 16:00
MasterDuke_ kind of. depends if you knew how push treats lists as arguments 16:01
if you're familiar with Perl 5, it automatically flattens much of the time. Perl 6 usually treats them as single entities, and you have to explicitly flatten them if you want that 16:02
s/flattens/flattens lists/
haxmeister I don't honestly.. but from now on when I want to be sure to extend the stack, I will use append so as not to get lost in my own logic 16:03
perl having lists and arrays both is interesting to me, but at the same time can be confusing when it's not apparent what the functional differences might be
16:05 laouji joined 16:18 st_elmo left 16:24 mcmillhj left 16:25 laouji left, laouji joined
haxmeister at first I thought it was irritating that dir() returned IO objects.. but now I love it.. absolutely well thought out 16:27
16:30 st_elmo joined, Guest9182 left 16:32 zakharyas left
haxmeister so this will always flatten properl? my @stack = dir($start); 16:33
16:33 Ven joined, nebuchad` joined, Ven is now known as Guest61766 16:34 mcmillhj joined 16:36 laouji left 16:37 ambs_ joined 16:38 mcmillhj left 16:41 eliasr left, rodarmor left, xfix left, lucs left, nebuchadnezzar left, ilmari left, emeric left, laouji joined 16:42 incredible joined, ilmari joined, rodarmor joined 16:43 setty1 joined 16:44 lucs joined, mcmillhj joined 16:48 emeric joined, BuildTheRobots joined 16:49 TreyHarris joined 16:50 kurahaupo joined
moritz yes 16:50
16:51 eliasr joined 16:59 zakharyas joined 17:02 laouji left 17:03 kurahaupo left 17:06 kurahaupo_ joined 17:11 TEttinger joined 17:12 poohman joined 17:18 laouji joined 17:20 alimon left 17:21 ChoHag joined 17:24 poohman left 17:33 alimon joined, Guest61766 left 17:35 nebuchad` is now known as nebuchadnezzar 17:44 nhywyll left 17:51 poohman joined
poohman hello was playing with win32 api native calling today and came across a function to get the machine name. It was returned in a pointer. Can I access the name using the pointer or can only use pointers to pass to other functions say as handles? 17:54
17:55 Cabanossi left 17:56 Cabanossi joined 17:57 poohman2 joined
awwaiid poohman: is it a pointer to a string? It might work like magic to say it is an Str 17:59
poohman: link us to the function call definition
18:01 poohman left
poohman2 will switch over to pc - give me a moment 18:04
18:05 poohman joined 18:07 poohman_ joined
poohman_ BOOL WINAPI GetComputerName( 18:07
_Out_ LPTSTR lpBuffer,
_Inout_ LPDWORD lpnSize
);
18:08 xfix joined
poohman_ sorry had to switch over from mobile to laptop - for example - if I want to dereference lpBuffer and get the name - how can I do it? 18:08
18:10 poohman_ left
moritz what's LPTSTR? 18:10
18:10 poohman left 18:11 cdg left, poohman_ joined
poohman_ lpBuffer [out] 18:11
A pointer to a buffer that receives the computer name or the cluster virtual server name. The buffer size should be large enough to contain MAX_COMPUTERNAME_LENGTH + 1 characters.
18:11 zakharyas left 18:12 poohman joined
moritz so a char* ? 18:12
poohman_ ja
moritz then just declare it as "returns Str", and it should work 18:13
18:14 poohman2 left
moritz sub GetComputerName(uint16) returns Str is encoded('utf8') is native('yourlibrary'); 18:15
something like that
poohman_ hmmm ok will try it tomorrow in my windows machine - but why do you expect it to dereference it considerings its an opaquepointer - because its a String?? 18:16
moritz well, if it's a char*, you can just declare it as Str, no need to treat it like an opaque pointer 18:17
geekosaur isn't it utf16? 18:18
jnthn Hm, but BOOL is the return type, and LPTSTR is a pointer to a string
And a string is already a pointer
moritz oh
so it's Str $out is rw?
jnthn If that works, then yes :)
And also the second parameter would be Int $foo is rw
Otherwise there's the good old CArray of length 1 trick :-)
Uh, not Int, but int32 18:19
Since it seems it takes the buffer length and then updates it with how much stuff is in the buffer after
poohman_ its LPTSTR it says in the documentation
jnthn Yeah, I think that means "long pointer to string" or some such :) 18:20
geekosaur I was thinking that means you need a preallocated Buf?
jnthn Right :-)
And then to decode it yourself
I'm rusty on Win32 API but my guess is there's a GetComputerNameW that returns wide (utf-16) 18:21