»ö« Welcome to Perl 6! | perl6.org/ | evalbot usage: 'p6: say 3;' or rakudo:, std:, or /msg camelia p6: ... | irclog: irc.perl6.org | UTF-8 is our friend! Set by masak on 12 May 2015. |
|||
ugexe | the promise is also marked as kept | 00:04 | |
m: say Proc.new(:exitcode(42)) | 00:06 | ||
camelia | rakudo-moar 91212c: OUTPUT«Proc.new(in => IO::Pipe, out => IO::Pipe, err => IO::Pipe, exitcode => -1, pid => Any, signal => Any)» | ||
ugexe | FROGGS: github.com/rakudo/rakudo/blob/nom/...roc.pm#L14 BUILD needs :$!exitcode | 00:13 | |
for this line in Proc::Async: $!exit_promise.keep(Proc.new(:exitcode(status))) | 00:14 | ||
japhb | ugexe: Send a PR? The collection of people with commit rights in Rakudo is much larger (and spans many more timezones). | 00:30 | |
ugexe | im testing it right now | ||
japhb | Excellent! | 00:34 | |
timotimo | atweiden, raiph: you want "my Silo @silos" rather than "my Array[Silo] @silos", otherwise you're declaring an AoA | 00:41 | |
00:42
ShimmerFairy left
00:48
Ben_Goldberg joined
|
|||
atweiden | timotimo: intended to be multidimensional array | 00:52 | |
00:56
][Sno][ left
|
|||
tony-o | m: enum Silo <ASSETS EXPENSES INCOME LIABILITIES EQUITY>; my Array[Silo] @silos; my Silo @assets = ASSETS; @silos.unshift($(@assets)); say @silos.perl | 00:56 | |
camelia | rakudo-moar 91212c: OUTPUT«Array[Array[Silo]].new(Array[Silo].new(Silo::ASSETS))» | ||
00:57
[Sno] joined
|
|||
tony-o | atweiden ^^ | 00:58 | |
ugexe | nqp-m: nqp::say(nqp::istype(-1, Int)); | ||
camelia | nqp-moarvm: OUTPUT«0» | ||
ugexe | m: use nqp; say nqp::istype(-1, Int); | ||
camelia | rakudo-moar 91212c: OUTPUT«1» | ||
tony-o | nqp-m: nqp::say(nqp::istype(-1, int)); | 00:59 | |
camelia | nqp-moarvm: OUTPUT«0» | ||
tony-o | nqp-m: nqp::say(nqp::istype(-1, twitter)); | ||
camelia | nqp-moarvm: OUTPUT«0» | ||
tony-o | nqp-m: nqp::say(nqp::istype(-1, int8)); | 01:00 | |
camelia | nqp-moarvm: OUTPUT«0» | ||
timotimo | oh, now i see that, too | 01:05 | |
01:13
yqt left
01:16
[Sno] left,
[Sno] joined
01:42
atroxaper joined
01:46
atroxaper left
01:58
ShimmerFairy joined
02:05
aborazmeh joined,
aborazmeh left,
aborazmeh joined
02:09
noganex_ joined
02:12
noganex left
|
|||
raiph | m: constant #`( s/constant/term/? ) scalar = $ = 42; say scalar; scalar--; scalar.say; | 02:12 | |
camelia | rakudo-moar 91212c: OUTPUT«4241» | ||
raiph | m: constant #`( s/constant/term/? ) dict = { pi=>i, e=>now }; say dict; dict<pi>--; say dict.invert | ||
camelia | rakudo-moar 91212c: OUTPUT«e => Instant:1435371205.021879, pi => 0+1iInstant:1435371205.021879 => e -1+1i => pi» | ||
raiph | m: constant #`( s/constant/term/? ) list = [pi, e]; list[2] = True; say list; list>>--; say list; say [+] @(list) | ||
camelia | rakudo-moar 91212c: OUTPUT«3.14159265358979 2.71828182845905 True2.14159265358979 1.71828182845905 False3.85987448204884» | ||
02:14
rubz joined
02:16
rubz left
02:23
sue__ joined
|
|||
raiph | m: constant dict =%= pi, i, e, now; say dict; dict{pi}--; say dict.invert | 02:24 | |
camelia | rakudo-moar 91212c: OUTPUT«2.71828182845905 => Instant:1435371876.325275, 3.14159265358979 => 0+1iInstant:1435371876.325275 => 2.71828182845905 -1+1i => 3.14159265358979» | ||
02:24
sue__ is now known as sue
|
|||
raiph | .oO ( enjoying a few rounds of sigil golf ) | 02:25 | |
m: constant scalar =$= 10; scalar += 5; say [1,2] >>+>> scalar; | 02:27 | ||
camelia | rakudo-moar 91212c: OUTPUT«16 17» | ||
raiph | m: constant list =@= 10; list += 5; # compile error? | 02:28 | |
camelia | ( no output ) | ||
raiph | m: my @list = 10; @list += 5; # compile error? | ||
camelia | ( no output ) | ||
raiph | m: constant list =@= 10,20; say list >>+>> 5 | 02:29 | |
camelia | rakudo-moar 91212c: OUTPUT«15 25» | ||
raiph | .oO ( s/constant/a/, where 'a' introduces a term, to enable "a foo =@= ..." etc.) | 02:32 | |
02:38
rmgk_ joined,
rmgk is now known as Guest30350,
Guest30350 left,
rmgk_ is now known as rmgk
02:39
atweiden left
02:44
rjbs left,
vendethiel left
|
|||
ugexe | Proc::Async exitcode PR sent | 02:50 | |
raiph | ugexe++ | 02:51 | |
ugexe: Do you like or dislike the sigilless idiom (see ^^)? Do you know what it's downsides are? | 02:52 | ||
ugexe | i like sigils, because i feel it explains more naturally while reading left to right | 02:56 | |
raiph | ugexe: Me too. I think it's a mistake to leave out the sigils in serious code. | 02:57 | |
Ben_Goldberg | m: my @list = 10; @list += 5; say @list | ||
camelia | rakudo-moar 91212c: OUTPUT«6» | ||
02:57
colomon left
02:58
colomon joined
|
|||
raiph | ugexe: Unless serious code includes code for beginners. | 02:58 | |
Ben_Goldberg: great example | 02:59 | ||
m: constant foo = 1,2; #`( code much later ) foo += 5; say foo # not obvious that the increment of foo is wrong | 03:02 | ||
camelia | rakudo-moar 91212c: OUTPUT«Cannot modify an immutable Int in block <unit> at /tmp/DMcRrUSE1g:1» | ||
raiph | Heh, interesting | ||
ugexe | problem is, if you put code like that out there for beginners it will become what people think is standard. sort of like how perl5 was plagued with terrible google results like matts script archive | 03:03 | |
03:04
nys left
03:05
kaare_ joined
|
|||
Ben_Goldberg | m: my @x = 'Just Another Perl/Bidi Hacker,'.comb; print(chr(8237) ~ @x.shift ~ chr(8238) ~ @x.pop) while @x; | 03:08 | |
camelia | rakudo-moar 91212c: OUTPUT«J,ursetk cAanHo tihdeirB /Pler» | ||
ugexe | if i have to write some ugly C-like code for whatever reason i might find it useful to have a slang to do that so I can make the code more terse | ||
Ben_Goldberg | m: my $x = +my @x = 'Just Another Perl/Bidi Hacker,'.comb; print 8237.chr, @x.shift, 8238.chr, @x.pop while @x; print 8236.chr x $x; | 03:15 | |
camelia | rakudo-moar 91212c: OUTPUT«J,ursetk cAanHo tihdeirB /Pler» | ||
raiph | ugexe: I meant as introductory, lies-to-children code. Create an alias for | 03:16 | |
oops | |||
Ben_Goldberg | Lies-to-children are important. If noone told you: When playing, Reversi (aka Othello), whomever has the most corners at the end of the game wins... you'd play extraordinarily poorly, at least at first. | 03:19 | |
raiph | m: constant foo = 1,2; #`( code much later ) foo += 5; say foo | 03:24 | |
camelia | rakudo-moar 91212c: OUTPUT«Cannot modify an immutable Int in block <unit> at /tmp/NwKu2T8_p_:1» | ||
raiph | m: constant foo =@= 1,2; #`( code much later ) foo += 5; say foo | ||
camelia | rakudo-moar 91212c: OUTPUT«7» | ||
raiph | m: constant @foo = 1,2; #`( code much later ) foo += 5; say foo | 03:25 | |
camelia | rakudo-moar 91212c: OUTPUT«5===SORRY!5=== Error while compiling /tmp/0WWo3E3sqjPrefix + requires an argument, but no valid term foundat /tmp/0WWo3E3sqj:1------> 3 @foo = 1,2; #`( code much later ) foo +7⏏5= 5; say foo expecting any of: prefix» | ||
raiph | m: constant @foo = 1,2; #`( code much later ) @foo += 5; say @foo | ||
camelia | rakudo-moar 91212c: OUTPUT«Cannot modify an immutable Int in block <unit> at /tmp/Owht8dqc0b:1» | ||
raiph | m: constant @foo = [1,2]; #`( code much later ) @foo += 5; say @foo | ||
camelia | rakudo-moar 91212c: OUTPUT«7» | ||
03:49
aborazmeh left
04:12
Ben_Goldberg left
04:13
Ben_Goldberg joined
04:18
aborazmeh joined,
aborazmeh left,
aborazmeh joined
|
|||
tony-o | m: \foo = Int.new(10); foo +=5; foo.say | 04:24 | |
camelia | rakudo-moar 91212c: OUTPUT«5===SORRY!5=== Error while compiling /tmp/slJwFu7BUZPreceding context expects a term, but found infix = insteadat /tmp/slJwFu7BUZ:1------> 3\foo =7⏏5 Int.new(10); foo +=5; foo.say» | ||
tony-o | m: my \foo = Int.new(10); foo +=5; foo.say | ||
camelia | rakudo-moar 91212c: OUTPUT«Default constructor for 'Int' only takes named arguments in block <unit> at /tmp/Ws2FHwOh59:1» | ||
tony-o | m: my \foo = $(1,2); foo +=5; foo.say | 04:36 | |
camelia | rakudo-moar 91212c: OUTPUT«Cannot assign to a readonly variable or a value in block <unit> at /tmp/AKn0reHeu0:1» | ||
04:39
khw left
04:50
amurf joined
04:55
amurf left
04:57
tinyblak joined
05:11
[Sno] left,
[Sno] joined
05:18
Ben_Goldberg left
05:19
StavroMueller joined,
atroxaper joined
05:20
bjz left
05:24
atroxaper left
05:31
aborazmeh left
05:37
telex left
05:38
telex joined
05:46
bjz joined,
bjz left
05:54
tinyblak left
05:56
skids left
|
|||
dalek | kudo/nom: 254eff9 | (Nick Logan)++ | src/core/Proc.pm: bugfix: exitcode for Proc::Async Proc::Async sets the exitcode via `Proc.new(:exitcode(1))` so BUILD requires a :$exitcode argument See github.com/rakudo/rakudo/blob/nom/...nc.pm#L176 |
06:04 | |
kudo/nom: 0ff4557 | FROGGS++ | src/core/Proc.pm: Merge pull request #449 from ugexe/patch-4 bugfix: exitcode for Proc::Async |
|||
06:15
RabidGravy joined
|
|||
raiph | .tell tony-o I've realized that use of {(...)} entirely eliminates the problems ("fooling around with ending a block and restarting a block or whatever ... buffering crap into a temp str to use that as the return value") | 06:17 | |
yoleaux | raiph: I'll pass your message to tony-o. | ||
raiph | .tell tony-o (Also, that the say-in-say approach will end in tears) | 06:18 | |
yoleaux | raiph: I'll pass your message to tony-o. | ||
raiph | .tell tony-o I've updated github.com/tony-o/perl6-template-p...e/issues/1 | 06:19 | |
yoleaux | raiph: I'll pass your message to tony-o. | ||
06:30
xfix joined,
xfix left,
xfix joined
06:34
araujo_ joined,
rindolf joined
06:35
araujo left
06:40
amurf joined
06:41
araujo__ joined
06:42
araujo_ left
06:44
amurf left
06:58
tinyblak joined
06:59
gfldex joined
|
|||
dalek | c: 5e2a992 | RabidGravy++ | lib/Type/IO/Path.pod: Add link/symlink |
07:18 | |
07:23
tinyblak left
07:25
tinyblak joined
|
|||
dalek | c: 0b24f07 | RabidGravy++ | lib/Type/IO/Path.pod: Add chdir() |
07:59 | |
08:02
darutoko joined
08:08
vendethiel joined
08:09
atroxaper joined
08:13
atroxaper left
08:22
rurban joined
08:23
xfix_ joined,
xfix_ left,
rurban left
08:26
xfix left
08:35
jaffa4 joined
|
|||
jaffa4 | hi all | 08:35 | |
How can I translate binmode? | 08:36 | ||
I guess it is :bin in open | |||
I would like to be able to set it independently | |||
not at open | |||
labster | jaffa4: what do you mean by independently? | 08:40 | |
jaffa4 | like binmode in Perl 5 | ||
labster | Ah, you mean setting it on a filehandle outside of an open call. | 08:42 | |
my $fh = "foo".IO.open(); $fh.encoding('bin'); # should work, not sure if it does | 08:44 | ||
hm, no test cases for this, not an encouraging sign | 08:49 | ||
jaffa4: if you want binmode with a layer, like utf-8 or iso-8859-1 or windows-1252 -- all of those will work by passing it to the encoding function. I'm just not sure about actual binary binmode yet. | 08:51 | ||
*encoding method | |||
jaffa4 | where is the source? | 08:52 | |
labster | for this? /src/core/IO/Handle.pm, but it looks like I'll need to dig into NQP to see how it actually handles binary. | 08:53 | |
jaffa4 | what is the url? | 08:59 | |
[Tux] | m: IO::Handle.^methods».name.say | 09:00 | |
camelia | rakudo-moar 0ff455: OUTPUT«FALLBACK gist new» | ||
labster | github.com/rakudo/rakudo/blob/nom/...le.pm#L572 | ||
[Tux] | hmm, locally I get this: pipe open input-line-separator nl close eof get getc words lines read seek tell write opened t print print-nl slurp slurp-rest spurt copy chmod IO path flush encoding DESTROY e d f s l r w x modified accessed changed watch umask say Str gist perl <anon> <anon> | ||
labster | [Tux]: probably RESTRICTED.setting | 09:01 | |
m: say "/home/camelia/test".IO.open.^methods | 09:04 | ||
camelia | rakudo-moar 0ff455: OUTPUT«pipe open input-line-separator nl close eof get getc words lines read seek tell write opened t print print-nl slurp slurp-rest spurt copy chmod IO path flush encoding DESTROY e d f s l r w x modified accessed changed watch umask say Str gist perl <anon> <a…» | ||
09:04
spintronic joined
|
|||
RabidGravy | looking at the code for IO::Handle it would seem that the only major thing that :bin does at that level is *not* set any encoding | 09:08 | |
jaffa4 | yes, but encoding is set, how to undo it | 09:09 | |
09:09
diana_olhovik_ joined
|
|||
labster | read it in as ascii, and then call .encode on the string to get a Buf? not awesome. | 09:09 | |
RabidGravy | read will just get the bytes anyway doesn't it? | 09:10 | |
labster | yes. | 09:11 | |
m: "test".IO.open.read(20).say | 09:12 | ||
camelia | rakudo-moar 0ff455: OUTPUT«Buf[uint8]:0x<>» | ||
labster | perhaps I should try that on a bigger file :D | ||
09:14
[Sno] left
|
|||
labster | I wish there was someone around who could give a more definitive answer, but early Saturday morning is not the best time for this channel. | 09:14 | |
This is something that should work and be documented, though. | 09:15 | ||
And tested, of course. | |||
09:15
spintronic left
|
|||
RabidGravy | there isn't an nqp op for the opposite of setencoding as far as I can tell | 09:16 | |
09:16
domidumont joined
|
|||
labster | QASTOperationsMAST.nqp:QAST::MASTOperations.add_core_moarop_mapping('setencoding', 'setencoding', 1); It's just sent straight down the the VM anyway. | 09:17 | |
09:17
Foxcool joined
09:18
spintronic joined
09:20
[Sno] joined
09:21
domidumont left
09:22
domidumont joined
09:25
atroxaper joined
|
|||
labster | night, #perl6 | 09:27 | |
RabidGravy | erp | ||
Woodi | hallo #perl6 | 09:29 | |
RabidGravy | erp | ||
Woodi | grammars kills me constantly :) gist.github.com/anonymous/bcb011dc022b76857855 | ||
09:29
atroxaper left
|
|||
Woodi | G1 works, G2 IMO should be simple replacement but don't work... | 09:29 | |
RabidGravy | Woodi, change the "rule parts" to "token parts" | 09:31 | |
09:32
domidumont left
|
|||
Woodi | yay :) | 09:34 | |
RabidGravy | a, er, rule of thumb is that a "rule" is the combination of some tokens | ||
not strictly accurate but it helps me remember ;-) | 09:35 | ||
Woodi | so tokens as "leaves" and rules as "nodes", will try that. thanx :) | 09:36 | |
RabidGravy | pretty much, it's down to the difference between the implicit flags applied to the "rule", "token" and "regex" largely | 09:38 | |
09:44
raiph left
|
|||
RabidGravy | right, off out now | 09:50 | |
09:51
Al-Caveman joined
09:52
diana_olhovik_ left
09:55
RabidGravy left
10:01
spider-mario joined
10:04
spintronic left
10:13
gagalicious left
10:17
amurf joined
10:22
amurf left
10:23
domidumont joined
10:35
dpk left
10:37
dpk joined
10:41
cognominal left
10:46
tinyblak left
10:47
cognominal joined,
xfix joined,
xfix left,
xfix joined,
xfix left
10:49
cognominal left,
leont joined,
cognominal joined
10:50
aborazmeh joined,
aborazmeh left,
aborazmeh joined
10:51
cognominal left
10:55
bin_005 left
|
|||
lizmat | good *, #perl6! | 11:03 | |
m: Proc::Status.new # where did it go? | 11:04 | ||
camelia | rakudo-moar 0ff455: OUTPUT«Could not find symbol '&Status' in block <unit> at /tmp/_JwT2ZYuIi:1» | ||
lizmat | there's a Proc::Status class in the setting... | 11:05 | |
11:11
domidumont left
|
|||
jaffa4 | how would you translate this &(%linkage{$opt})($A,$B.$C) from Perl 5 | 11:13 | |
? | |||
moritz | %linkage{$opt}($A, $B, $C) | 11:16 | |
jaffa4: but I doubt that what you wrote is actually valid perl 5 code | |||
jaffa4 | moritz: ... and you are right | 11:17 | |
let us approximately | |||
moritz | no, it's good to be precise when talking about syntax | 11:18 | |
11:24
Alina-malina left
11:25
Alina-malina joined
|
|||
dalek | kudo/nom: acaeb17 | lizmat++ | src/core/IO/Handle.pm: Revive Proc::Status This is a bandaid. Some recent changes made Proc::Status disappear from the world when still having code defining it. Suspect some sort of MOP messup with creating parent packages. By creating a stub for the parent package beforehand, we seem to have quelched the issue. Something that needs to be investigated further! |
11:33 | |
lizmat | interestingly, now test 13 in t/spec/S17-procasync/basic.t (line 39) fails because the returned object is a Proc rather than a Proc::Status | 11:37 | |
whereas the other tests work out ok afterward | |||
.tell jnthn you might want to have a look at why github.com/rakudo/rakudo/commit/acaeb17897 was needed to revive Proc::Status | 11:38 | ||
yoleaux | lizmat: I'll pass your message to jnthn. | ||
lizmat | .tell jnthn as an added datapoint, check why test 13 in t/spec/S17-procasync/basic.t (line 39) fails | 11:41 | |
yoleaux | lizmat: I'll pass your message to jnthn. | ||
11:43
AlexDani` joined
11:46
tinyblak joined
11:54
diana_olhovik joined
11:57
tinyblak left,
tinyblak joined
11:59
rurban joined
|
|||
lizmat | looking at #125485, I guess | 12:00 | |
synbot6 | Link: rt.perl.org/rt3/Public/Bug/Display...?id=125485 | ||
lizmat | m: "{ @_ }" # is just an expression of: | 12:01 | |
camelia | rakudo-moar acaeb1: OUTPUT«5===SORRY!5=== Error while compiling /tmp/V4Li3mqwS1Placeholder variable @_ may not be used here because the surrounding block takes no signatureat /tmp/V4Li3mqwS1:1------> 3"{ @_ }7⏏5" # is just an expression of: expecting any of…» | ||
lizmat | m: -> { @_ } # this one | ||
camelia | rakudo-moar acaeb1: OUTPUT«5===SORRY!5=== Error while compiling /tmp/FbH2YyCuDCPlaceholder variable '@_' cannot override existing signatureat /tmp/FbH2YyCuDC:1------> 3<BOL>7⏏5-> { @_ } # this one» | ||
12:10
aborazmeh left
|
|||
lizmat | perhaps use of @_ and $^a in blocks should be referring to the first outer code instead ? | 12:10 | |
12:13
pmurias joined
|
|||
moritz | but then you couldn't say reduce { $^a + $^b }, @vals | 12:13 | |
just write explicit signatures for routines that contain other blocks, and you're fine | 12:14 | ||
jaffa4 | Is perl6-debug-m supoosed to work? | ||
What is the state of perl6-debug-m? | 12:15 | ||
lizmat | moritz: good point | 12:17 | |
well, hmmm... then perhaps only if the block is part of an interpolated string? | 12:18 | ||
I can see that as something that would help p5 -> 6 migration | |||
anyways, afk until later today& | |||
12:23
ShimmerFairy left
|
|||
jaffa4 | What could help? | 12:24 | |
12:33
bjz joined,
rindolf left
12:36
ShimmerFairy joined
12:45
colomon left
13:02
atroxaper joined
13:07
atroxaper left
13:09
domidumont joined
13:10
RabidGravy joined
|
|||
jaffa4 | I have a code which seems to fail without saying a word | 13:11 | |
13:11
Fleurety joined
13:12
spintronic joined
13:15
tinyblak left
13:17
rindolf joined
13:18
nowan joined
13:19
Fleurety left
|
|||
Woodi | RabidGravy++ # mixing rules with tokens works :) | 13:24 | |
13:24
Fleurety joined
|
|||
Woodi | about GLR: for me "tuples" sound weird too. they was used in old relational database texts so they have v. old-ish conotations... | 13:27 | |
pmurias | nqp-js: say("still alive...?"); | ||
camelia | nqp-js: OUTPUT«/bin/sh: node: command not found» | ||
Woodi | Nil is planned to disappear ? so how to get results with NULLs from db ? | 13:28 | |
13:29
araujo__ left
|
|||
pmurias | would just having it as DBI::NULL be a problem? | 13:29 | |
Woodi | also in 1990 Mr. Codd augmented relational database theory with one more NULL, some 4th-valued-logic... | 13:30 | |
timotimo | and why wouldn't a type object be a good fit? | ||
Woodi | pmurias: you get data from db, ( "J.Kowalski", male, Nil, Nil), this looks nice... | 13:31 | |
timotimo | the cool thing about type objects is you still get to know what type the column has | 13:32 | |
also: oh god, NULL values are EVIL in SQL :) | |||
Woodi | timotimo: I don't know. but we have some Mu's so maybe someone already thinking about this :) | ||
timotimo: but 'we don't know value for that' is proper answer... at least to keep shape of tables :) | 13:33 | ||
13:36
sjn_phone_ joined,
araujo joined,
araujo left,
araujo joined
13:47
AlexDani` is now known as AlexDaniel
|
|||
AlexDaniel | So, how can I run a shell command, get its output, and have the parameters quoted correctly? This link describes everything besides shell quoting perl6advent.wordpress.com/2014/12/...om-perl-6/ | 13:50 | |
this was a painful perl5 problem which required CPAN dependency (ShellQuote) | 13:52 | ||
moritz | AlexDaniel: doc.perl6.org/type/Proc::Async | ||
13:53
sjn_phone_ left
|
|||
AlexDaniel | moritz: are you sure that it actually answers my question? | 13:53 | |
geekosaur | um? you could do it without ShellQuote | ||
unless your notion of how to do it is incorrect from the start, which tbh is suggested by that response | 13:54 | ||
(the correct answer is *don't use the shell*) | |||
AlexDaniel | thanks, that does not help as well | ||
moritz: you see, most people will not bother with that | 13:55 | ||
moritz: look at that perl6advent link and notice this line | |||
my @commit_results = qqx/git commit -am "$message"/.lines; | |||
clearly a mistake | |||
13:55
amurf joined,
FROGGS[mobile] joined
|
|||
AlexDaniel | so I'm asking how to fix that, and you tell me that the answer is to use Proc::Async. If that's true, do you understand that we will keep seeing shell injection everywhere? | 13:56 | |
FROGGS[mobile] | AlexDaniel: use: run($prog, ..., :out) | ||
moritz | AlexDaniel: I'm just saying hat Proc::Async offers capturing and no need for quoting | 13:57 | |
FROGGS[mobile] | that's available since yesterday | ||
moritz | oooh | ||
AlexDaniel | m: say run 'echo' 'test' | ||
camelia | rakudo-moar acaeb1: OUTPUT«5===SORRY!5=== Error while compiling /tmp/SBoxeFPZi0Two terms in a rowat /tmp/SBoxeFPZi0:1------> 3say run 'echo'7⏏5 'test' expecting any of: infix infix stopper postfix statement end …» | ||
FROGGS[mobile] | comma | 13:58 | |
moritz | no &run in camelia either, I think | ||
AlexDaniel | m: say run 'echo', 'test' | ||
camelia | rakudo-moar acaeb1: OUTPUT«run is disallowed in restricted setting in sub restricted at src/RESTRICTED.setting:1 in sub run at src/RESTRICTED.setting:14 in block <unit> at /tmp/ci9sXRssZo:1» | ||
AlexDaniel | okay I'll recompile | ||
FROGGS[mobile] | AlexDaniel: look at S32-io/pipe.t | ||
there are examples | |||
AlexDaniel | FROGGS[mobile]: thanks | 13:59 | |
13:59
amurf left
14:02
araujo left
14:05
lichtkind joined
14:06
nys joined
|
|||
moritz | FROGGS[mobile]: why does sub run do a 'try $proc.spawn(@args)'? (I mean, why the 'try'?) | 14:08 | |
FROGGS[mobile] | moritz: I dunno, I forgot | 14:12 | |
moritz | FROGGS[mobile]: looks dangerous to me | ||
FROGGS[mobile] | then we should remove it and test | 14:14 | |
moritz | I'm doing a spectest as is, and hope that I'll remember to remove it and re-test when it finishes :-) | 14:15 | |
(or maybe I should do it on hack, not on my workstation :-) | |||
14:15
tinyblak joined
|
|||
FROGGS[mobile] | :o) | 14:18 | |
I guess it was about a "cmd not found" issue | |||
ohh dang, I forgot to test run/shell on windows :S | 14:19 | ||
moritz | but the API is *very* nice, FROGGS[mobile]++ | 14:20 | |
and FROGGS++ too, I guess :-) | |||
AlexDaniel | $output = run('echo', $test, :out).out.get; | ||
$output = qqx/echo $test/; | |||
Huffmanly speaking, which one is better and why? | |||
FROGGS[mobile] | good question | 14:22 | |
14:24
diana_olhovik__ joined
|
|||
AlexDaniel | FROGGS[mobile]: thanks for listening, I always feel ignored when I raise questions about shell quoting | 14:24 | |
14:25
diana_olhovik left
|
|||
moritz | I realize the defaults are maybe still the wrong way around, but now Perl 6 has a much nicer API for capturing err/out and no need for quoting | 14:25 | |
compared to p5 | |||
AlexDaniel | the typical answer is "well, it works, so what's your problem?". Well, you can inject any arbitrary shell thing into it, that's the problem... | ||
and if it had better Huffman coding I think that the problem will fade away | 14:26 | ||
well, at least it will get better | |||
FROGGS[mobile] | AlexDaniel: I'll think about a sane and safe short-cut | ||
moritz | maybe have a quoting for that preserves scalars as single items, and only splits literals on spaces? | 14:27 | |
AlexDaniel | that's what I though, actually | 14:28 | |
which basically means that it should autoquote variables, but then again, what does it mean to quote things correctly? | |||
it depends on the underlying shell | |||
jaffa4 | Is this ok grep ($_ eq $opt, @hits)? | ||
moritz | so that my $foo = "a b"; my @list = q:w:S<echo $foo> is equivalent to my @list = ('echo', $foo) | 14:29 | |
jaffa4: it doesn't do what you want | |||
jaffa4 | std: grep ($_ eq $opt, @hits) | ||
camelia | std 28329a7: OUTPUT«5===SORRY!5===Variable $opt is not predeclared at /tmp/7hVV_j54vO line 1:------> 3grep ($_ eq 7⏏5$opt, @hits)Variable @hits is not predeclared at /tmp/7hVV_j54vO line 1:------> 3grep ($_ eq $opt, 7⏏5@hits)Check failedFAILED 00:00…» | ||
geekosaur | I feel like insistence that making the naive shell quoting solution "work" is just encouraging security holes | ||
moritz | jaffa4: if $opt is a string, you can just do @hits.grep($opt) | 14:30 | |
AlexDaniel | geekosaur: what do you mean? | ||
moritz | geekosaur: the point is to not need shell quoting | ||
geekosaur | yes, I understand this is not popular. the widest proof being how the Internet is rife with such security holes (mostly in the related area of SQL quoting) | ||
moritz | geekosaur: but always pass the argument list out-of-band | ||
geekosaur | moritz, but I was informed that avoiding the shell was not the correct answer | ||
moritz | geekosaur: who informed you, and it wasn't the correct answer to what question? | 14:31 | |
geekosaur | because the question was shell quoting. never mind thaty the question is wrong | ||
sigh | |||
moritz minds that the question is wrong | |||
geekosaur | yes, I understand the point was to ask about shell quoting itself | ||
moritz | appeal to authority doesn't work well in here, sorry | 14:32 | |
geekosaur | but, from a security standpoint,m the answer to that is "avoid it at all costs" | ||
AlexDaniel | yea the question was a bit wrong, you are right | ||
geekosaur: if the answer is "use 'run'" then it is OK though | |||
geekosaur | because even when you think uyou've covrred all the cases, you get hit by shellshock *sigh* | ||
(I mean, who expects their dhcp client is vulnerable to shell injection attack?) | 14:33 | ||
moritz | only those who you call "paranoid" | 14:34 | |
AlexDaniel | geekosaur: so what do you recommend? Make 'run' better Huffmanly coded and that's it? | ||
geekosaur | I don't know. I feel like there is a tendency to say "people will use the simple solution so let's make it secure" and this fails when there is demonstrably no way to make it secure. But also demonstrably steering people away from the simple solution doesn't work | 14:35 | |
AlexDaniel | geekosaur: good point | ||
FROGGS[mobile]: backticks are not used? We can use backticks for that! Haha | 14:37 | ||
FROGGS[mobile] | AlexDaniel: with an argument list? :o) | ||
AlexDaniel | yeah :) | 14:38 | |
14:41
bjz left
|
|||
dalek | c: 9d2b828 | moritz++ | lib/Type/Proc.pod: Document type Proc (and &run) |
14:44 | |
c: d1bcc0a | moritz++ | lib/Type/IO.pod: Fix documentation for &run in type IO |
|||
moritz | FROGGS[mobile]: a short proof-read of those docs would be very much appreciated | 14:45 | |
AlexDaniel | actually, we should listen to what geekosaur said | 14:47 | |
and after reading "Piping several commands is easy too." I realize that he is absolutely right | |||
which probably means that qx should actually go away | 14:49 | ||
14:49
araujo joined
|
|||
geekosaur | unclear actually. the problem is if you remove it, someone will re-add it (probably in an even worse way) for convenience | 14:53 | |
see "steering people away from the simple solution doesn't work" | |||
AlexDaniel | what about qwx or something? | 14:55 | |
moritz | FROGGS[mobile], jnthn: it's a bit unfortunate that Proc.out and Proc::Async.stdout have a diverging naming scheme | ||
AlexDaniel | that will split stuff by spaces and pass that to run | ||
14:55
FROGGS joined
|
|||
FROGGS[mobile] | moritz: aye, and I'd vote for shorter names fwiw | 14:58 | |
FROGGS | moritz: I'll proofread the docs this evening | ||
I've got currently about five kids under age 6 around me | 14:59 | ||
jaffa4 | This is ok, right? return (0) if $passthrough; | 15:02 | |
timotimo | i'd propose "return 0 if $passthrough" instead | 15:05 | |
15:05
FROGGS left
15:10
rindolf left
15:11
shlomif joined,
tinyblak left,
tinyblak joined
|
|||
AlexDaniel | FROGGS: "with an argument list? :o)" hm, it can do the same thing < > is doing | 15:12 | |
FROGGS[mobile] | I was thinking about that, but I'm not sure about that yet | 15:14 | |
15:16
skids joined
|
|||
japhb | Apologies that I've only skimmed, but doesn't the quoting of << >> get what most people want from "shell quoting" when they don't *actually* want a shell? | 15:19 | |
Note << >> instead of < > | 15:20 | ||
AlexDaniel | japhb: I'm not really following you, can you show a code example? | 15:21 | |
japhb | AlexDaniel: Well, I'm not caught up with the details of FROGGS++'s new implementations, but in the old days I might have said something along the lines of run(<< echo "foo $bar" @baz <<wheee>> >>) and expected it to work safely | 15:25 | |
15:25
JimmyZ_ joined
|
|||
japhb | I guess that should have been @baz[] | 15:26 | |
But my point was that << >> has a lot of the DWIM that people want from shell quoting without the danger of an actual shell parsing. | 15:27 | ||
15:27
nys left
|
|||
jnthn | evening, #perl6 | 15:30 | |
yoleaux | 11:38Z <lizmat> jnthn: you might want to have a look at why github.com/rakudo/rakudo/commit/acaeb17897 was needed to revive Proc::Status | ||
11:41Z <lizmat> jnthn: as an added datapoint, check why test 13 in t/spec/S17-procasync/basic.t (line 39) fails | |||
japhb | o/ jnthn | 15:31 | |
nwc10 | good UGT heresy, jnthn | ||
DB are less late than the scandawedigian railways? | |||
15:31
CIAvash joined
|
|||
AlexDaniel | $output = run('echo', $test, :out).out.get; | 15:32 | |
$output = run(<<echo $test>>, :out).out.get; | |||
$output = qqx/echo $test/; | |||
timotimo | << >> is still not properly implemented, right? | ||
15:32
CIAvash left,
CIAvash joined
|
|||
AlexDaniel | japhb: you see, it does make it easier | 15:32 | |
japhb: maybe just a bit | |||
japhb | AlexDaniel: Of course, you can use real guillemots, but the keyboard I am on is less than awesome for entering Unicode ... | 15:33 | |
timotimo | « » | ||
japhb | And then it gets more readable | ||
AlexDaniel | oh right | ||
and it is actually one character shorter then | 15:34 | ||
15:34
tinyblak left
|
|||
AlexDaniel | still not shorter than qqx... | 15:34 | |
ugexe | i look forwarding to writing my first run(<<$cmd $var>>.list>>.value>>) | ||
15:34
araujo left
|
|||
japhb | I find I often "spend" that minor savings by adding an extra space before the first item and after the last. | 15:34 | |
Since Windows doesn't actually have multiple arguments, how is run() implemented there? | 15:35 | ||
dalek | kudo-star-daily: ff22ac7 | coke++ | log/ (2 files): today (automated commit) |
15:36 | |
rl6-roast-data: 25f8ebd | coke++ | / (9 files): today (automated commit) |
|||
japhb | (For precision, I mean that at the C runtime level, processes receive a single giant string, rather than pre-split command and args as in the *nix world -- and then they do their own command string parsing) | ||
ugexe | im not sure what the answer is, but you use %* in powershell | ||
FROGGS[mobile] | japhb: libuv handles it in some way | 15:37 | |
japhb fears that implementation | |||
15:37
lichtkind_ joined
|
|||
FROGGS[mobile] | we pass it a char ** | 15:37 | |
japhb | Good for libuv for at least presenting the better API to its callers, I suppose. But man, I hope they've implemented something that all the C runtimes will handle correctly .... | 15:38 | |
15:38
nys joined
15:39
lichtkind left
|
|||
jnthn | I suspect they've had more resources to think it through than we'd have been able to give to it if we'd solved it ourselves... :) | 15:41 | |
Plus it's presumably been exercised plenty thanks to node.js using libuv. | 15:42 | ||
japhb | True! | ||
skids also looked at better commandline parsing (emulating legacy syntaxes) a couple weeks ago. | 15:51 | ||
15:52
Ven joined
|
|||
skids | There wer a couple blockers for what I wanted to do. | 15:52 | |
The primary one was that Cursor doesn't work right yet from inside rules. | |||
15:53
shlomif left
|
|||
skids | So there was no way to build something like a <bag($bag)> subrule that would match strings from a bag anywhere in a grammar, but only as many times as they were in the bag. | 15:53 | |
Also I had to punt and rejoin ARGS with '\0' separators, for lack of matching against structural data. | 15:54 | ||
15:56
tinyblak joined
|
|||
TimToady is home again, and finds the air at sea level is too thick now... :) | 15:57 | ||
16:00
Ven left
|
|||
jnthn | I think the structural matching stuff is very post-6.0 :) Not sure what "Cursor doesn't work right yet" means, though... | 16:03 | |
skids | You don't get a current .pos. | 16:04 | |
Or a current partial match. | |||
jnthn | Depends. | ||
japhb | Welcome back to the lowlands, TimToady! | ||
jnthn | You should if in, say, a code block | 16:05 | |
skids | You don't though. | ||
jnthn | m: 'a' ~~ /(.) { say $/[0] } / | ||
camelia | rakudo-moar acaeb1: OUTPUT«「a」» | ||
skids | On the first time, sometimes you do. It is not reliable. | 16:06 | |
jnthn | It'd help if you actualy showed code. | ||
*actually | |||
skids digs around in his stuff. | 16:07 | ||
mst | skids: you're currently telling one of the authors you know his code better than him, without showing any examples | ||
skids: this is ... unlikely to help anybody | |||
jnthn | On the <bag($bag)> thing, where did you plan to keep the "how many we saw" state? | ||
skids | Dynamic probably. | ||
jnthn | In TOP? | ||
skids | Likely defined in a custom .parse. | 16:08 | |
mst | perl5 has a rule for regexp questions where we ask for input, expected output, and what code you have so far | 16:09 | |
generally for fiddly stuff an example of that form is the only way to clearly communicate | |||
so maybe that would be the best next step? | |||
16:10
estrabd joined,
khw joined
|
|||
skids | mst: I actually have to be somewhere right now, so I can't do that right now. Was looking for a quick example but looks like I was doing it on cli, so I'll have to go see if it's still in my history. | 16:11 | |
mst | skids: ok, just, "you don't though" isn't desperately easy to diagnose :) | 16:12 | |
TimToady pictures jnthn as a desperado... | 16:13 | ||
mst | if I was a gun fighter with his eyesight I'd be pretty desperate too | ||
vendethiel | *g* | 16:14 | |
jnthn | m: grammar G { method parse(*@, :$bag) { my %*BAGGED := $bag.BagHash; my $*BAG-RX = /| @($bag.keys)/; callsame; }; token TOP { <.bag>+ }; token bag { (<{ $*BAG-RX }>) <?{ %*BAGGED{~$0}-- }> } }; say G.parse('aabbc', bag => bag <c b a a b >); say G.parse('aaabbc', bag => bag <c b a a b >); | 16:15 | |
camelia | rakudo-moar acaeb1: OUTPUT«「aabbc」(Any)» | ||
jnthn | There's a quickly thrown together solution for the problem (or one like the problem) I think you're wanting to solve, btw. | 16:16 | |
oh, now I look at it it can be a tad simpler too | 16:17 | ||
m: grammar G { method parse(*@, :$bag) { my %*BAGGED := $bag.BagHash; my $*BAG-RX = /| @($bag.keys)/; callsame; }; token TOP { <.bag>+ }; token bag { ($*BAG-RX) <?{ %*BAGGED{~$0}-- }> } }; say G.parse('aabbc', bag => bag <c b a a b >); say G.parse('aaabbc', bag => bag <c b a a b >); | |||
camelia | rakudo-moar acaeb1: OUTPUT«「aabbc」(Any)» | ||
jnthn | a thing of type Regex already interpolates proper |