»ö« 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 moritz on 25 December 2014. |
|||
Kristien | Is there a nicer way to do the for loop? | 00:00 | |
Couldn't find an each function or something like that | |||
masak | map? | ||
Kristien | map is lazy | 00:01 | |
AFAIK | |||
masak | troo | ||
but you're feeding things into it, so that shouldn't be a problem, I think. | |||
vendethiel | m: : 1..* Z @lines ==> map { "$^i: $^l" } ==> map(&say); | 00:02 | |
camelia | rakudo-moar f12020: OUTPUT«===SORRY!=== Error while compiling /tmp/CkJoJ8iYDBInvocant colon not allowed hereat /tmp/CkJoJ8iYDB:1------> :⏏ 1..* Z @lines ==> map { "$^i: $^l" } ==» | ||
Kristien | m: sub each(&f, @xs) { for @xs { &f($_) } }; each (1, 2, 3, 4, 5), &say | ||
camelia | rakudo-moar f12020: OUTPUT«Type check failed in binding &f; expected 'Callable' but got 'Parcel' in sub each at /tmp/bboYqen_J_:1 in block <unit> at /tmp/bboYqen_J_:1» | ||
Kristien | m: sub each(&f, @xs) { for @xs { &f($_) } }; each &say, (1, 2, 3, 4, 5) | ||
camelia | rakudo-moar f12020: OUTPUT«12345» | ||
vendethiel | m: : 1..* Z @lines ==> map { "$^i: $^l" } ==> each(&say); | ||
camelia | rakudo-moar f12020: OUTPUT«===SORRY!=== Error while compiling /tmp/uWM3fyBizIInvocant colon not allowed hereat /tmp/uWM3fyBizI:1------> :⏏ 1..* Z @lines ==> map { "$^i: $^l" } ==» | ||
Kristien | m: map &say, (1, 2, 3, 4, 5) | ||
camelia | rakudo-moar f12020: OUTPUT«12345» | ||
vendethiel | m: 1..* Z @lines ==> map { "$^i: $^l" } ==> each(&say); | ||
camelia | rakudo-moar f12020: OUTPUT«===SORRY!=== Error while compiling /tmp/t3qGX7NwwyVariable '@lines' is not declared. Did you mean '&lines'?at /tmp/t3qGX7Nwwy:1------> 1..* Z @lines⏏ ==> map { "$^i: $^l" } ==> each(&say); expecting any…» | ||
Kristien | well it only shows that because I force it to print the result of say | ||
how about | |||
vendethiel | m: 1..* Z <a b c> ==> map { "$^i: $^l" } ==> each(&say); | ||
camelia | rakudo-moar f12020: OUTPUT«===SORRY!=== Error while compiling /tmp/QrAAdolFhDUndeclared routine: each used at line 1» | ||
vendethiel | oh,yes, you declared it | 00:03 | |
Kristien: sink() | |||
Kristien | m: sub ignore(Any $x) { }; ignore(map(&say, (1, 2, 3, 4, 5))) | ||
camelia | ( no output ) | ||
vendethiel | which is like ml's sink | ||
m: 1..* Z <a b c> ==> map { "$^i: $^l" } ==> map(&say); | |||
camelia | rakudo-moar f12020: OUTPUT«1: a2: b3: c» | ||
vendethiel | this works though | ||
Kristien | no | 00:04 | |
it only works in this case because the output of map is iterated over | |||
I need eager map which returns Nil | |||
00:04
dayangkun left
|
|||
vendethiel | m: 1..* Z <a b c> ==> map { "$^i: $^l" } ==> map(&say); 1 | 00:05 | |
camelia | rakudo-moar f12020: OUTPUT«1: a2: b3: c» | ||
Kristien | but sink should work | ||
m: my @lines = "Hello", "World"; sink { 1..* Z @lines ==> map { "$^i: $^l" } ==> map &say }; | 00:06 | ||
camelia | rakudo-moar f12020: OUTPUT«1: Hello2: World» | ||
Kristien | Dankeschön! | 00:09 | |
00:10
espadrine_ left
|
|||
Kristien | I like sub each(&f, @xs) { for @xs { &f($_) } } better, though. | 00:14 | |
Plays nicely with ==>. | |||
I guess sink is implicit when an expression is used as a statement in non-return position? | 00:15 | ||
masak | aye | 00:16 | |
Kristien | When a good Perl 6 book comes out I'll be the first one to buy a copy! | 00:18 | |
masak | "a good Perl 6 book" might be our biggest weakness... :/ | 00:19 | |
we tried to do it as a community effort once, and ran into difficulties. | 00:20 | ||
00:30
zakharyas left
|
|||
Kristien | Methods like join and uc seem to be callable without . | 00:35 | |
m: say(join(' ', <1 2 3>)) | |||
camelia | rakudo-moar f12020: OUTPUT«1 2 3» | ||
Kristien | however, I can only find documentation of methods | 00:36 | |
Is this special behaviour for method calls or am I overlooking something? | |||
m: say(<1 2 3>.join(' ')) | 00:39 | ||
camelia | rakudo-moar f12020: OUTPUT«1 2 3» | ||
vendethiel | Kristien: it's there if you put the "is export" on the method, IIRC | ||
m: class Foo { method bar is export { 1 } }; bar(Foo.new); | |||
camelia | rakudo-moar f12020: OUTPUT«===SORRY!=== Error while compiling /tmp/RFlM_J46TPUndeclared routine: bar used at line 1. Did you mean 'bag'?» | ||
vendethiel | no, so, probably just declared below. | ||
(I know what is export does, but I thought it also did that) | |||
Kristien | > Methods also take the "is export" trait: the method will then be exported as a multi sub that takes the object as the first parameter: | ||
vendethiel | right :-) | 00:40 | |
masak | I don't know if that's supposed to work or not, but I can say this: | 00:44 | |
the notion that the sub form of built-in methods are an exported form of the method in Perl 6 has been replaced by other things. | 00:45 | ||
usually, the sub is just defined in the setting, and calls the corresponding method. | 00:46 | ||
Kristien | m: class Foo { method bar is export { 1 } }; import Foo; say bar(Foo.new); | 00:47 | |
camelia | rakudo-moar f12020: OUTPUT«1» | ||
vendethiel | Kristien++ # smarter than me | ||
masak | hey, it works :) | ||
Kristien | :D | ||
masak | what I said still holds true, though. | 00:48 | |
I don't end up exporting methods a lot. | |||
IIRC, even Perl 5 lore considers it a Bad Thing. | |||
Kristien | This is also interesting: | 00:51 | |
This works: | |||
m: sub filter-profanity(Str $s) { $s.subst(/Java/, '****', :g) }; "Perl 6 is so much more fun than Java!" ==> filter-profanity() ==> uc() ==> say() | |||
camelia | rakudo-moar f12020: OUTPUT«PERL 6 IS SO MUCH MORE FUN THAN ****!» | ||
Kristien | whereas this fails: | ||
m: sub filter-profanity(Str $s) { $s.subst(/Java/, '****', :g) }; "Perl 6 is so much more fun than Java!" ==> filter-profanity ==> uc ==> say | |||
camelia | rakudo-moar f12020: OUTPUT«===SORRY!=== Error while compiling /tmp/71EN2a_iYqPreceding context expects a term, but found infix ==> insteadat /tmp/71EN2a_iYq:1------> fun than Java!" ==> filter-profanity ==>⏏ uc ==> say» | ||
00:51
agentzh joined
|
|||
vendethiel | Kristien: you currently need () after a call inside a ==> | 00:52 | |
m: 'a' ==> say | |||
camelia | rakudo-moar f12020: OUTPUT«===SORRY!=== Error while compiling /tmp/Eod2xKzdcTUnsupported use of bare 'say'; in Perl 6 please use .say if you meant $_, or use an explicit invocant or argumentat /tmp/Eod2xKzdcT:1------> 'a' ==> say⏏<EOL>…» | ||
vendethiel | m: 'a' ==> say() | 00:53 | |
camelia | rakudo-moar f12020: OUTPUT«a» | ||
Kristien | "currently" so will it not stay that way? | ||
vendethiel | well, it works in std | ||
std: 'a' ==> say | |||
camelia | std f9b7f55: OUTPUT«===SORRY!===Unsupported use of bare 'say'; in Perl 6 please use .say if you meant $_, or use an explicit invocant or argument at /tmp/AWH6U6dwVw line 1:------> 'a' ==> say⏏<EOL>Check failedFAILED 00:00 134m» | ||
vendethiel | TimToady: can you confirm that's a STD bug? | ||
or maybe masak++ can find the RT ticket associated to this one | |||
Kristien | ==> is most shiny. |> was my favourite feature in LiveScript and F# | ||
vendethiel | we completly and utterly stole it from f#, yes :P | 00:54 | |
Kristien | I wonder if Arabs like normal calls better. :) | ||
vendethiel | I think elixir did that as well | ||
Kristien | In Elixir x |> f(1) is sugar for f(x, 1) | ||
In LiveScript and F# it's sugar for f(1) x | 00:55 | ||
Well in F# it's slightly different | |||
TimToady | well, we're still trying to figure out what feed operators are | ||
Kristien | in F# it's sugar for let __1 = x; f(1) x | ||
because of order of evaluation being LTR always | |||
TimToady | and we certainly didn't steal it from F# | ||
Kristien | uh s/x$/__1/ | 00:56 | |
TimToady | it's really just the idea of Unix pipes that can transmit objects, is all | ||
I think we thought of it before PowerShell | |||
Kristien | Joe the Plumber is proud. | ||
vendethiel | TimToady: sorry, my "we" was from LiveScript ;-) | 00:57 | |
TimToady | as for join, that can't be done by 'is export' because the order of arguments is different | ||
ok | |||
vendethiel | Kristien: I'd certainly like f# better with more curry | 00:58 | |
Kristien | vendethiel: LasagnaScript steals it from Elixir because almost no JS APIs are curried. | ||
vendethiel | Kristien: that's why prelude.ls has curry() | ||
Kristien | Meh | 00:59 | |
I kinda implemented protocols btw :P | |||
masak | wait... LasagnaScript? | ||
vendethiel | masak: Kristien's altJS :P | 01:00 | |
also, ls's |> allows for the "_" placeholder, so that if a API is considered "poxy", you can just work around it. ('foo' |> fn arg1, _) | |||
masak | I see. | ||
Kristien | vendethiel: I generalised that; % operator takes any term and turns it into a function, turning %n into the nth argument | ||
vendethiel | this is like clojure's %, right? | 01:01 | |
Kristien | jawohl, except it doesn't restrict to calls | ||
E.g. %%1 is the identity function. %(%1 * %2 + %3) and %try { foo(%1) } finally { bar() } are other examples. | 01:02 | ||
vendethiel | oh, pretty good | 01:03 | |
Kristien | Not sure about nesting of them though. Could disallow or make %n pick arguments from the innermost %-function | ||
masak | a little bit like we use whatever and placeholder parameters for in Perl 6. | ||
Kristien | If you want a constant function returning a number you have to parenthesise the number though, so %(42) instead of %42 | 01:05 | |
since the latter will try to yield the 42nd argument :P | |||
01:05
BenGoldberg left
01:06
BenGoldberg joined
01:10
spider-mario left
01:28
telex left
01:30
telex joined
01:42
beastd left
|
|||
masak | 'night, #perl6 | 01:48 | |
Kristien | masak: goodbye | 01:50 | |
psch | hi #perl6 \o | 01:51 | |
vendethiel: you mis-containered %num-to-notes in your PR :) | |||
vendethiel: it's still neater though ;) | 01:52 | ||
vendethiel | psch: mmh? | ||
did I? :p sorry! | |||
psch | vendethiel: yes, you scalared it, even though it's a hash | ||
vendethiel: also, there's a tad more in the repo now, including a README, and tritone-in-c.pl has fallen to the wayside | 01:53 | ||
vendethiel | psch: 'twas a typo, sorry :( | 01:54 | |
psch | vendethiel: it's fine. the repo is a collection of stuff i'm trying and that file in particular was just a check to see if what i'm imagining could be feasible :) | 01:55 | |
tony-o_ | jnthn: ab5tract: bsd32 fails to build JVM perl6 too with the same error | ||
too weird | |||
01:56
fil_ left
|
|||
tony-o_ | ab5tract: what 686 linux distro did you use? | 01:58 | |
02:00
Kristien left
02:08
ggoebel111111111 joined
02:09
retupmoc1 joined,
nine_ joined,
felher_ joined
02:10
Psyche^ joined,
robins joined
02:11
Tux__ joined,
xinming_ joined,
breinbaa1 joined
02:12
broquain1 joined
02:14
raydiak_ joined
02:16
Pleiades` left,
Patterner left,
vukcrni left,
raydiak left,
xinming left,
ggoebel111111119 left,
breinbaas left,
|Tux| left,
tadzik left,
mattp_ left,
avuserow left,
robinsmidsrod left,
retupmoca left,
nine left,
broquaint left,
lestrrat left,
felher left,
mattp__ joined,
Pleiades` joined
02:18
avuserow joined
02:20
tadzik joined
02:21
vukcrni joined
02:22
cxreg joined,
skaufman_ joined
02:23
japhb_ joined
02:24
[particle]1 joined,
nebuchad` joined
02:26
simcop2387_ joined
02:27
TimToady_ joined,
slavik1 joined,
risou is now known as 17SABKHBC,
risou joined,
VAB17AF joined,
lestrrat joined
02:28
gfldex left,
gfldex joined
02:29
rmgk_ joined,
rmgk left,
rmgk_ is now known as rmgk
02:33
daxim_ joined,
agentzh left
02:35
cxreg2 left,
skaufman left,
TimToady left,
japhb left,
nebuchadnezzar left,
petercommand left,
[particle] left,
17SABKHBC left,
slavik left,
simcop2387 left,
daxim left,
simcop2387_ is now known as simcop2387
02:40
Ben_Goldberg joined,
[particle] joined
02:41
kst` joined
02:44
[Coke]_ joined,
huf_ joined,
bartolin_ joined,
Juerd_ joined,
cosimo_ joined
02:45
ab5tract_ joined,
BinGOs_ joined,
osfamero1 joined,
krunen_ joined,
yeltzooo joined
02:46
Gothmog_1 joined,
bcode_ joined
02:49
[particle]1 left,
BenGoldberg left,
bcode left,
dalek left,
IllvilJa left,
PZt left,
[Tux] left,
lue left,
pnu left,
Juerd left,
krunen left,
jferrero left,
BinGOs left,
Gothmog_ left,
bartolin left,
woolfy left,
ab5tract left,
renormalist left,
kst left,
osfameron left,
huf left,
[Coke] left,
yeltzooo9 left,
dg left,
cosimo left,
charsbar_____ left,
bcode_ is now known as bcode,
Juerd_ is now known as Juerd,
Gothmog_1 is now known as Gothmog_
02:50
jferrero joined
02:51
renormalist joined
02:52
dg joined,
TimToady_ is now known as TimToady,
TimToady left,
TimToady joined
02:55
lue joined
02:56
IllvilJa joined
02:57
gfldex left
02:58
[Tux] joined
02:59
charsbar_____ joined
03:00
woolfy joined
03:02
pnu joined,
dalek joined,
pnu left,
pnu joined,
ChanServ sets mode: +v dalek
03:15
VAB17AF joined
03:29
dj_goku left,
dj_goku_ joined,
dj_goku_ left,
dj_goku_ joined
03:37
Maddingu1 joined
03:39
kaare__ joined
03:41
ugexe_ joined
03:45
kst` is now known as kst
03:48
stux|RC joined,
Timbus_ joined
03:50
silug_ joined,
noganex joined
03:52
Timbus left,
stux|RC-only left,
Alina-malina left,
molaf_ left,
kaare_ left,
silug left,
ugexe left,
Maddingue left
03:54
noganex_ left,
molaf_ joined
03:58
dj_goku_ left
04:18
dj_goku joined,
dj_goku left,
dj_goku joined
04:35
dj_goku left
04:38
dj_goku joined,
dj_goku left,
dj_goku joined
|
|||
skids | .tell japhb "The last statement in a module with more than one statement seems to have some extra-sinky context (because it supplies the return value of "use" I think). I just put 1; at the end of the module to prevent that." | 04:58 | |
yoleaux | skids: I'll pass your message to japhb. | ||
timotimo | i don't think we have return values from use | ||
TimToady | the last statement of a module file should be sunk just as much as the other statements; if not, it's a bug | 05:13 | |
in fact, the 1; should be complaining about a useless use of '1' in a sink context | 05:16 | ||
skids | Well, I can't get it do error anymore so maybe it is fixed? I'll try with the code I needed to put it in way back when. | 05:19 | |
TimToady | and, in fact, it doesn't complain, so it's a bug I thnk | ||
if the final statement is a for loop, that used to require a more explicit sink | 05:20 | ||
nowadays we autosink any loop in a statementlist | |||
skids | Yeah, no complaints about the final 1; in my Sum module, which uses it in most of the files. | 05:22 | |
TimToady | but it does seem to sink the final statement anyway, just won't complain about useless use there for some reason | 05:23 | |
m: module Foo { 42; 43; 44 } | |||
camelia | rakudo-moar f12020: OUTPUT«WARNINGS:Useless use of constant integer 42 in sink context (line 1)Useless use of constant integer 43 in sink context (line 1)Useless use of constant integer 44 in sink context (line 1)» | ||
TimToady | warns there | 05:24 | |
m: module Foo; 42; 43; 44 | |||
camelia | rakudo-moar f12020: OUTPUT«WARNINGS:Useless use of constant integer 42 in sink context (line 1)Useless use of constant integer 43 in sink context (line 1)Useless use of constant integer 44 in sink context (line 1)» | ||
TimToady | and there, huh | ||
but use seems to suppress the final one somehow | 05:25 | ||
skids | It used to more than sink it, it somehow extra-double-super-secret-sunk it and punned the role. I have to yank out all the 1s and try all combos of precomp to see if there is still any such problem. | 05:26 | |
TimToady | weird, if I put a module foo; at the front of my foo.pm, it warns on the last one now | ||
so the whole file is treated as a block that might return a value, but if we switch into module, it enforces sink on the last statement | 05:27 | ||
skids | .tell japhb well, maybe read the backlog before doing what I just said. | 05:29 | |
yoleaux | skids: I'll pass your message to japhb. | ||
05:30
adu joined
|
|||
skids | m: (role A { }).HOW.WHAT.say; A.HOW.WHAT.say; # scratches head, wishes he had more time to read code. | 05:50 | |
camelia | rakudo-moar f12020: OUTPUT«(Perl6::Metamodel::ParametricRoleHOW)(Perl6::Metamodel::ParametricRoleGroupHOW)» | ||
06:02
Alina-malina joined
06:08
atroxaper joined
06:54
espadrine_ joined
|
|||
japhb_ | Thanks for taking a gander at my Role problem, skids. | 07:11 | |
07:11
japhb_ is now known as japhb
|
|||
japhb | .botsnack | 07:11 | |
yoleaux | :D | ||
04:58Z <skids> japhb: "The last statement in a module with more than one statement seems to have some extra-sinky context (because it supplies the return value of "use" I think). I just put 1; at the end of the module to prevent that." | |||
05:29Z <skids> japhb: well, maybe read the backlog before doing what I just said. | |||
moritz | \o | 07:16 | |
07:30
adu left
07:32
darutoko joined,
espadrine joined
07:33
espadrine_ left
07:36
xfix joined
07:52
rindolf joined
|
|||
FROGGS[mobile] | o/ | 08:04 | |
08:04
prime left
|
|||
FROGGS[mobile] | mornäng | 08:04 | |
08:05
Ben_Goldberg left,
Ben_Goldberg joined
08:09
adu joined
08:11
prime joined
08:28
xinming_ left
08:29
xinming joined
|
|||
moritz | .ask jnthn is there a good reason to keep $!started in Proc::Async private? sounds like potentially useful information for the caller | 08:37 | |
yoleaux | moritz: I'll pass your message to jnthn. | ||
dalek | ast: 7eb85d9 | usev6++ | S32-str/substr-rw.t: Add test for RT #114526 (fudged 'skip' for Parrot) |
08:42 | |
synopsebot | Link: rt.perl.org/rt3//Public/Bug/Displa...?id=114526 | ||
dalek | ast: f16e55e | usev6++ | S32-str/sprintf.t: Fudge two tests (todo) since error message would change with NQP PR 219 |
08:48 | |
08:52
zby_home joined
|
|||
dalek | c: 1517511 | moritz++ | lib/Type/ (2 files): Start to documtn Proc::Async |
08:54 | |
09:05
agentzh joined,
ptc_p6 joined
09:06
atroxaper left,
telex left
09:08
telex joined
|
|||
dalek | p: 878c6ae | usev6++ | src/HLL/sprintf.nqp: Change message for mismatch between specified arguments in directives and supplied arguments |
09:11 | |
p: 6fa84cc | usev6++ | t/hll/06-sprintf.t: Adjust error message for directives/arguements mismatch in nqp tests |
|||
p: 5a33762 | moritz++ | / (2 files): Merge pull request #219 from usev6/master Improve error message for sprintf |
|||
09:16
jakesyl left
09:17
jakesyl joined
09:22
nebuchad` is now known as nebuchadnezzar
09:23
vendethiel left
09:24
vendethiel joined
09:27
mr-foobar left
09:30
molaf__ joined
09:33
molaf_ left,
Ben_Goldberg left
09:34
Ben_Goldberg joined
09:35
Ben_Goldberg left,
Ben_Goldberg joined
09:36
Rounin joined
09:39
kaare__ is now known as kaare_
09:46
vendethiel left
09:50
BinGOs_ is now known as BinGOs,
zby_home left,
BinGOs left,
BinGOs joined
10:00
espadrine_ joined
10:01
virtualsue joined
10:04
espadrine left
10:09
vendethiel joined
10:11
bjz_ joined,
bjz left
10:13
Ben_Goldberg left
10:19
gfldex joined
10:27
sz joined,
mvuets joined,
sz left
10:29
abraxxa joined
10:30
szabgab joined,
breinbaa1 left
|
|||
szabgab | rakudo: say 19+23 | 10:30 | |
camelia | rakudo-{parrot,moar} f12020: OUTPUT«42» | ||
masak | good antenoon, #perl6 | 10:37 | |
10:42
breinbaas joined
10:43
zby_home_ joined,
zby_home_ left
10:49
agentzh left
|
|||
moritz | good *, masak | 10:53 | |
dalek | c: 1c9eace | moritz++ | lib/Type/ (2 files): Document X::Proc::Async::AlreadyStarted |
10:59 | |
szabgab | hello ppl | 11:01 | |
moritz | \o szabgab | ||
szabgab | I have a really strange bug on the Perl6Maven site | ||
\o moritz | |||
beside it leaking memory like hell :) | |||
once in a while it seems as if the regex engine stopped working | 11:02 | ||
ab5tract_ | m: my $x = '\E]45;65H'; say $x.substr(/45/,77) | ||
camelia | rakudo-moar f12020: OUTPUT«No such method '!cursor_start' for invocant of type 'Int' in sub substr at src/gen/m-CORE.setting:7679 in method substr at src/gen/m-CORE.setting:4097 in block <unit> at /tmp/161RXUN10t:1» | ||
moritz | szabgab: are you ever using user-supplied strings in regexes? | ||
11:03
Woodi left
|
|||
szabgab | every time someone visits the site, it loads a file, parses it using some regexes | 11:03 | |
do you mean the regex part? | |||
I think no | |||
let me check | |||
but I finish the sentence first :) | |||
moritz | oh, you weren't | ||
then go ahead :-) | |||
ab5tract_ | ah, never mind.. another confusion of subst and substr | 11:04 | |
szabgab | so the code parses the header that looks like =title Title | ||
but sometimes it seems it stops the parsing | |||
and does not recognize the matching rows | |||
then after the restart (I have to restart the server every 30 requests) it works again | 11:05 | ||
so far I could not figure out what might trigger the behaviour | |||
pastebot? | 11:06 | ||
moritz | none here | ||
just use gist.github.com or so | |||
szabgab | gist.github.com/szabgab/35359cfe441fd0a9f9fb | 11:07 | |
those seem to be the only regexes | 11:08 | ||
but that's just my code, maybe some of the modules I use... | |||
Maybe the template module? | |||
moritz | which one do you use? | ||
szabgab | Template::Mojo | 11:09 | |
Eerything is Rakudo Star 2014.12 except Bailador which I've patched | |||
I thin Bailador builds regexes on-the-fly | 11:11 | ||
from the routes in the application | |||
moritz | but I hope those aren't user-input | ||
szabgab | If that's what you were after | ||
not from the end-user | |||
from the source code of Perl6::Maven | 11:12 | ||
moritz | but I think my question as mis-guided. I thought the regexes hangs, but it seems they simply don't match= | ||
s/=/?/ | |||
szabgab | right | ||
they stop matching | |||
and never resume matching | |||
moritz | can you identify the place where the first stop matching? | 11:13 | |
11:13
rurban_ joined
|
|||
szabgab | probably not | 11:14 | |
I might need to add lots of logging and that might help | |||
moritz | well, I haven't heard of this phenomenon before | 11:15 | |
szabgab | OK, if there is nothing obvious to you, then I'll just add more code to be able to log the requests well | ||
moritz | it might or might not help | ||
szabgab | and then I might have better input | ||
11:16
espadrine_ left
|
|||
szabgab | is there a logging module ? | 11:16 | |
11:17
spider-mario joined
11:20
isBEKaml joined
|
|||
moritz | I'm not aware of any | 11:23 | |
dalek | kudo/nom: 6429a22 | moritz++ | src/core/Proc/Async.pm: Proc::Async.write: accept Blob, not Buf |
11:24 | |
szabgab | ok, thanks | 11:26 | |
11:37
kjs_ joined
11:41
szabgab left
|
|||
rurban_ | got now msvc on win64 working | 11:56 | |
dalek | kudo/nom: 7e8d8af | moritz++ | src/core/Proc/Async.pm: Proc::Async: fix exception throwing |
12:00 | |
12:11
rindolf left
|
|||
dalek | line-Python: c26bd6e | (Stefan Seifert)++ | .gitignore: .gitignore file |
12:13 | |
12:15
abraxxa left
12:18
jluis_ joined
12:19
Kristien joined
12:31
kjs_ left
12:38
rmgk_ joined,
rmgk left,
rmgk_ is now known as rmgk
|
|||
Kristien | hola #perl6 | 12:50 | |
masak | \o | 12:54 | |
vendethiel: which would you say was the first altJS? has someone written a history/chronicle about them? which altJS languages do you think will be in use/remembered 20 years down the line, and why? | 12:55 | ||
12:56
rurban_ left
12:57
jluis_ left
|
|||
vendethiel | masak: GWT would probably be it | 13:00 | |
masak | oh, right. | ||
GWT is basically abandoned now, is it? | 13:01 | ||
13:02
virtualsue left
|
|||
vendethiel | masak: I think gmail still uses it? | 13:03 | |
masak | oh, mebbe. | ||
vendethiel | masak: sorry, apparently it isn't anymore. But it seems chrome web store and google groups use it groups.google.com/forum/#!msg/goog...WzIrZ1vzcJ | 13:04 | |
it was from 2011 though, so maybe not up to date | |||
masak | ah. | ||
interesting that Gmail moved off it. | |||
I wonder why. | |||
vendethiel | masak: I'm not *sure* it did. gwt's website doesn't mention it -- it mentions adwords and wallet | 13:05 | |
masak | *nod* | ||
vendethiel | masak: GWT 2.7 on nov 14. I don't think it's been "abandoned" -- it's just that no one wants to write java | ||
masak | fair enough | 13:07 | |
isBEKaml | masak: Gmail didn't abandon GWT - but AFAICR, they maintain their own version of GWT | 13:10 | |
masak: that was in addition to open source releases of GWT (by its own team) | 13:11 | ||
masak | ugh | ||
13:11
jluis_ joined
|
|||
isBEKaml | yeah, as I read it back then - their use of GWT was simply too complex and it cannot be integrated into the main release. | 13:11 | |
so they had to maintain their own internal version of GWT | 13:12 | ||
Kristien | masak: Objective-C is also pretty old | 13:20 | |
I mean Objective-J | |||
masak | heard about it, but not more'n that | 13:21 | |
what is it? | |||
Kristien | It's Objective-C except with JavaScript instead of C. | ||
masak | but... hm. | 13:22 | |
JS already has an object system. and a syntax for method calls. | |||
I guess I don't see the point. | |||
Kristien | Objective-J has a new separate object system xD | ||
masak | o.O | 13:23 | |
they must've not liked the first one... | |||
moritz | .oO( how did that happen? :-) |
13:28 | |
13:29
adu left
|
|||
masak | random thought: P6 is a bigger breaking change than py3k because Larry had more to atone for than Guido (language-wise) | 13:30 | |
ab5tract_ | masak: that's an interesting perspective | 13:34 | |
masak | maybe that's obvious, I dunno. the Perl 5 line didn't shirk from sinning if it got the job done. | ||
Perl 6 aims to do better. Python somehow always did. | |||
13:37
Kristien left
|
|||
ab5tract_ | for that generation of dynamic languages, it seems to me that python "won" in the sense that it runs the spectrum of teaching to sysadmin to web to science and back again | 13:38 | |
and i always take the POV that perl 6 caused some sort of irreperable harm to the reputation of perl 5 with a grain of salt | 13:39 | ||
because it was pretty clear to me that people were leaving perl 5 to python at a pretty big clip even prior to the announcement | 13:40 | ||
masak | yes, Python sure has mindshare. | 13:42 | |
and deservedly, if you ask me. I say that as someone who loves Perl. | |||
(and as one who isn't all that into indentation-as-blocks) | 13:43 | ||
ab5tract_ | it is almost certainly a retcon on my part, but i always took the design of python as directly inspired by perl, but in the sense that guido's design was in realizing the power of exploring a language where DWIM is reinforced by the fact that !(TMTOWTDI) | 13:44 | |
moritz | as a relative beginner in python, I find that it seldom DWIM | 13:45 | |
but it usually gives an error instead of doing the wrong thing | 13:46 | ||
ab5tract_ | moritz: that's because when there is one way to do it, 'do what i mean' takes on a new dimension where you must 'mean what you do' | ||
when TMTOWTDI, meaning what you do can come free-form, even retaining the jazz definition; the multiplicity is a double edged sword, though. that's why part of p5's continued popularity is at least partly a result of the "modern perl" movement, which advocated heavily for trimming down the cuteness and dark magic | 13:51 | ||
13:56
isBEKaml left
|
|||
ab5tract_ | i'm a huge fan of TIMTOWTDI, but i've always largely attributed python's near-universal appeal (minus the haters-for-life) to guido's rejection of the principle | 13:56 | |
14:00
osfamero1 is now known as osfameron
|
|||
ab5tract_ | what makes perl 6 so appealing to me is that it really does feel like it has been carefully designed to host that multiplicity of 'ways to do it', while addressing things like the dangers of building a monkey patching culture by making it basically unnecessary *and* still provide support for it :) | 14:02 | |
*providing | |||
dalek | ast: 3101a04 | usev6++ | S11-modules/export.t: Add test for RT #84280 |
14:03 | |
synopsebot | Link: rt.perl.org/rt3//Public/Bug/Displa...l?id=84280 | ||
dalek | c: c9d67d3 | moritz++ | lib/Type/ (3 files): Document a bit more of Proc::Aync, related exceptions |
14:06 | |
14:08
Kristien joined
|
|||
moritz | lizmat: Proc::Async.say doesn't use .gist to stringify its argument. Is that intentential? | 14:09 | |
14:12
jluis_ left
|
|||
moritz | m: say $*KERNEL.signal('KILL') | 14:16 | |
camelia | rakudo-moar 7e8d8a: OUTPUT«9» | ||
moritz | m: say $*KERNEL.signal('SIGKILL') | ||
camelia | rakudo-moar 7e8d8a: OUTPUT«9» | ||
moritz | m: say $*KERNEL.signal(SIGKILL) | ||
camelia | rakudo-moar 7e8d8a: OUTPUT«9» | ||
moritz | m: say $*KERNEL.signal(9) | ||
camelia | rakudo-moar 7e8d8a: OUTPUT«9» | ||
14:17
jluis_ joined,
Peter_R joined
|
|||
Kristien | m: say $*KERNEL.WHAT | 14:18 | |
camelia | rakudo-moar 7e8d8a: OUTPUT«(Kernel)» | ||
Kristien | Interesting. | ||
dalek | c: 3b83fb1 | moritz++ | lib/Type/Proc/Async.pod: mostly finish documenting Proc::Async |
14:22 | |
14:22
rindolf joined
|
|||
lizmat | moritz: Proc::Async.say not gisting is probably an oversight | 14:25 | |
14:28
mr-foobar joined
|
|||
dalek | c: 83a1c78 | moritz++ | lib/Type/Proc/Async.pod: Add a note that only MoarVM supports Proc::Async |
14:28 | |
Kristien | m: ObjAt.new | 14:29 | |
camelia | ( no output ) | ||
Kristien | Segfaults on my machine :P | ||
moritz | :( | ||
14:30
sirdancealot joined
|
|||
dalek | ast: bc2983c | moritz++ | S17-procasync/basic.t: start to test some exceptions for Proc::Async |
14:31 | |
Kristien | seems to be an old bug | 14:34 | |
dalek | ast: e223c44 | moritz++ | S17-procasync/basic.t: Proc::Async: test more exceptions |
14:35 | |
Kristien | Stuff like Set uses WHICH to determine equality right? | ||
moritz | identity | 14:36 | |
Kristien | right | ||
good | |||
moritz | (sorry for being pedantic) | 14:37 | |
Kristien | And it should be perfectly fine to override WHICH for immutable user-defined types? | ||
lizmat | Kristien: yes, that's the idea | 14:38 | |
Kristien | Nice. | ||
Perl 6 is well-designed. | 14:39 | ||
moritz | can anybody on windows confirm that 'type' on the command line without arguments reads from STDIN? | ||
or do I have to use 'copy con' or such weird magics? | 14:40 | ||
lumimies | moritz: It does not | 14:43 | |
type con: seems to | 14:44 | ||
moritz | lumimies: thanks | 14:48 | |
Kristien | This is interesting: gist.github.com/rightfold/f05c4d4c31e09ca0d9bf | 14:53 | |
moritz | Kristien: the REPL has known problems with natively typed variables | ||
Kristien | OK! | ||
moritz | Kristien: basically, it starts a new compilation unit for each line | ||
Kristien: but to make the previous variables available, it copies them into an outer scope | 14:54 | ||
Kristien: and that doesn't work well yet in some corner cases | |||
Kristien | I have to implement a REPL soon. | 14:55 | |
moritz | +1 | 14:56 | |
Kristien | I think I have an idea of how I'll do it. | ||
14:58
jmark joined
14:59
_4d47 joined
|
|||
dalek | ast: 67bb8b3 | moritz++ | S17-procasync/basic.t: more tests for Proc::Async in particular: * test .write and .print, open for writing * .close-stdin * more exceptions |
15:07 | |
Kristien | Just a reduction over the lines of stdin :P | 15:08 | |
vendethiel | moritz: it doesn't either here :P | 15:12 | |
15:14
virtualsue joined
|
|||
[Tux] | what is the perl way to do «my Str $foo = function (); is_valid_utf8 ($foo) and "UTF8".say» ? | 15:15 | |
where full-ASCII would return False | 15:16 | ||
15:16
rurban_ joined
15:18
Ben_Goldberg joined
|
|||
moritz | [Tux]: checking of a Str is valid utf-8 is mixing of levels | 15:19 | |
[Tux] | ? | ||
moritz | [Tux]: Str is an encoding-indepenent sequence of codepoints (later hopefully graphemes) | ||
Kristien | > Perl 6 is well-designed. | 15:20 | |
[Tux] | fine :) | 15:21 | |
Ben_Goldberg | Somewhere hidden behind the Str is a Buf, which will contain some form of utf, but that's a separate level. | ||
moritz | [Tux]: what do you want to achieve in the end? | ||
[Tux] | So, how can I check id *all* codepoints in a string are inside ASCII? | ||
moritz | all($str.ords) < 128 # but probably not most efficient | 15:22 | |
[Tux] wants to copy as much as possible of Text::CSV_XS (perl5) to Text::CSV (perl6) | |||
it is lazy, so I do not care about performance there | |||
Kristien | encode it to ASCII and check for encoding errors | 15:23 | |
that's what I'd do | |||
I don't like hardcoding 128 | |||
moritz | m: say so 'abc' ~~ /^ <[\x0 .. \x127]>* $ / | ||
camelia | rakudo-moar 7e8d8a: OUTPUT«True» | ||
moritz | m: say so 'abcö' ~~ /^ <[\x0 .. \x127]>* $ / | ||
camelia | rakudo-moar 7e8d8a: OUTPUT«True» | ||
moritz | huh | ||
erm | |||
m: say so 'abcö' ~~ /^ <[\x0 .. \x7F]>* $ / | 15:24 | ||
camelia | rakudo-moar 7e8d8a: OUTPUT«False» | ||
[Tux] | :) | ||
moritz | m: say so defined try 'abcö'.encode('ASCII') | ||
camelia | rakudo-moar 7e8d8a: OUTPUT«True» | ||
moritz | m: say 'ö'.encode('ASCII') | ||
camelia | rakudo-moar 7e8d8a: OUTPUT«Blob[uint8]:0x<3f>» | 15:25 | |
moritz | that looks like a bug to me | ||
ab5tract_ | [&&] "6kgj".ords.map( * < 128 ) | ||
Kristien | m: say 'ö'.encode('ASCII').decode('ASCII') | 15:26 | |
camelia | rakudo-moar 7e8d8a: OUTPUT«?» | ||
Kristien | moritz: it uses a replacement character instead of throwing an exception | ||
moritz | Kristien: and that's a dangerous default, IMHO, because it silently loses information | ||
Kristien | Yes. | ||
IMO there should be a way to parameterise on error handling mechanic. | 15:27 | ||
moritz | well, .encode('ASCII', :replacement) could work | ||
ab5tract_ | fwiw, i was banging my head on the wall trying to manipulate terminal escape sequences | ||
Kristien | I've seen one C++ library do enum ErrorHandling { Throw, Replacement, AssumeOK }; | ||
moritz | AssumeOK seems pretty dangerous | ||
ab5tract_ | yes, adverbs seem like a good approach, and move the current default behavior into one | ||
moritz | but Perl 5's Encode has similar options, iirc | ||
Kristien | Yeah, it's UB if it's not actually OK | 15:28 | |
[Tux] forsees some interesting problems in decoding binary data :) | |||
moritz | and we try to avoid undefined behavior where we can | ||
[Tux] | images in CSV | ||
Kristien | moritz: good | ||
:replacement might also take a parameter: $str.encode('ASCII', :replacement('x')) | 15:29 | ||
or rather a uint8 not a Str | |||
15:31
ingy1 is now known as ingy
15:32
Kristien left
|
|||
lizmat | seems like usev6 ( bartolin_ ??? ) has forgotten to add a RT84280.pm to roast | 15:34 | |
ab5tract_ | one thing i've been bumping my head on is how to print an escape sequence once it is in a variable without it getting interpolated | 15:35 | |
moritz | ab5tract_: because it's not UTF-8? | ||
ab5tract_ | i imagine it is related somehow. just printing the variable will "do" the cursror move command i have stored in the variable | 15:36 | |
and i can even extract the numbers with regex groups | 15:37 | ||
moritz | ab5tract_: oh, you want it for debugging? | ||
ab5tract_ | but so far my efforts to put numbers back in have been fruitless | ||
exactly | |||
moritz | say $str.perl; # ? | ||
15:37
zakharyas joined
|
|||
ab5tract_ | damnit moritz, you genius :) | 15:38 | |
dalek | ast: d591ae5 | moritz++ | S17-procasync/basic.t: More Proc::Async tests |
||
moritz | it would be very welcome if somebody could run S17-procasync/basic.t on windows | 15:39 | |
and inform me of any failures | |||
ab5tract_ | i don't suppose there is a built in character class for matching escape sequences :) | 15:40 | |
moritz | iirc there's <print> for printable characters | ||
so something not-<print>able could be an escape sequence | |||
bartolin_ | lizmat: oops, you're right. | 15:44 | |
ab5tract_ | m: "\n" !~~ /<print>/ | ||
camelia | rakudo-moar 7e8d8a: OUTPUT«Cursor<139843422512584>Cursor<139843422562104>P6opaque: no such attribute '$!pos' in method ACCEPTS at src/gen/m-CORE.setting:14610 in block <unit> at /tmp/ASa6x7LUws:1» | ||
ab5tract_ | same error for single-quotes | 15:45 | |
dalek | kudo/nom: 5dd603b | lizmat++ | src/core/Proc/Async.pm: Make Proc::Async.say gist, spotted by moritz++ |
15:46 | |
FROGGS[mobile] | <print> is either NYI or it picks up the print sub | ||
dalek | ast: e8465cb | usev6++ | packages/RT84280.pm: Add missing file for test for RT #84280 |
||
synopsebot | Link: rt.perl.org/rt3//Public/Bug/Displa...l?id=84280 | ||
bartolin_ | lizmat++ # spotting the missing file | 15:47 | |
FROGGS[mobile] | ab5tract_: matching escape sequences is not quite possible when these are interpolated :o) | ||
but you can match a backslash and something afterwards, according to what you wanna see | 15:48 | ||
ab5tract_ | m: "for" ~~ /<print>/ | ||
camelia | rakudo-moar 7e8d8a: OUTPUT«Cursor<140112800721080>Cursor<140112800770600>P6opaque: no such attribute '$!pos' in method ACCEPTS at src/gen/m-CORE.setting:14610 in block <unit> at /tmp/BXPDVP2xWT:1» | ||
FROGGS[mobile] | m: "foo" ~~ /<say>/ | 15:49 | |
camelia | rakudo-moar 7e8d8a: OUTPUT«Cursor.new()Cursor.new()P6opaque: no such attribute '$!pos' in method ACCEPTS at src/gen/m-CORE.setting:14610 in block <unit> at /tmp/9ocu5YoTtd:1» | ||
ab5tract_ | FROGGS[mobile]: ah.. i am seeing a way through now, actually. but yeah, something there doesn't seem happy | 15:50 | |
15:51
Kristien joined
15:53
pnu left
15:54
ggherdov left,
Ben_Goldberg left
|
|||
[Tux] | «has %errors = (1 => "foo", 2 => "bar");» can that be typed? «has %errors (int => Str) = (1 => "foo", 2 => "bar");^? | 15:54 | |
15:54
pnu joined,
Ben_Goldberg joined
|
|||
masak | [Tux]: `has Str %.errors{Int};`, I think. | 15:56 | |
FROGGS_ | m: my $errors = :{ 1 => "foo", 2 => "bar" }; say $errors.perl | ||
camelia | rakudo-moar 7e8d8a: OUTPUT«:{1 => "foo", 2 => "bar"}» | ||
FROGGS_ | m: my $errors = :{ 1 => "foo", 2 => "bar" }; say $errors.keys[0].WHAT | ||
camelia | rakudo-moar 7e8d8a: OUTPUT«(Int)» | ||
FROGGS_ | m: my %errors{Int} = 1 => "foo", 2 => "bar"; say %errors.keys[0].WHAT | ||
camelia | rakudo-moar 7e8d8a: OUTPUT«(Int)» | ||
Kristien | m: class C { }; my %errors{C} = C.new => 'a', C.new => 'b'; say %errors.keys[0].WHAT | 15:57 | |
camelia | rakudo-moar 7e8d8a: OUTPUT«(C)» | ||
Kristien | m: class C { }; my %errors{C} = C.new => 'a', C.new => 'b'; say %errors.WHAT | ||
camelia | rakudo-moar 7e8d8a: OUTPUT«(Hash[Any,C])» | ||
Kristien | Shiny, I thought hashes worked only with string keys. | ||
FROGGS_ | m: say "a" => b => c | 15:58 | |
camelia | rakudo-moar 7e8d8a: OUTPUT«===SORRY!=== Error while compiling /tmp/qmGmFUa_GBUndeclared routine: c used at line 1» | ||
FROGGS_ | m: say "a" => b => "c" | ||
camelia | rakudo-moar 7e8d8a: OUTPUT«a => b => c» | ||
FROGGS_ | m: say ("a" => b => "c").keys | ||
camelia | rakudo-moar 7e8d8a: OUTPUT«a» | ||
FROGGS_ | m: say (("a" => b) => "c").keys | ||
camelia | rakudo-moar 7e8d8a: OUTPUT«===SORRY!=== Error while compiling /tmp/Sn981WiJk2Undeclared routine: b used at line 1» | ||
FROGGS_ | m: say (("a" => "b") => "c").keys | ||
camelia | rakudo-moar 7e8d8a: OUTPUT«a => b» | ||
FROGGS_ | a pair as a key... | ||
everything can be a key nowadays :o) | 15:59 | ||
so you don't have to serialize something to be used as a key | |||
masak | pairs are not good keys, though. | ||
they're mutable. | 16:00 | ||
m: my $p = a => 5; $p.value = 42; say $p | 16:01 | ||
camelia | rakudo-moar 7e8d8a: OUTPUT«a => 42» | ||
Kristien | m: say (("a" => "b") => "c")[("a" => "b")] | ||
camelia | rakudo-moar 7e8d8a: OUTPUT«No such method 'Int' for invocant of type 'Pair' in sub postcircumfix:<[ ]> at src/gen/m-CORE.setting:2869 in block <unit> at /tmp/Sam3vOxEkV:1» | ||
16:01
ggherdov joined
|
|||
Kristien | oops lol | 16:01 | |
m: say (("a" => "b") => "c"){("a" => "b")} | |||
camelia | rakudo-moar 7e8d8a: OUTPUT«c» | ||
Kristien | If pairs are mutable I don't agree with this behavior. | ||
m: say (("a" => "b") => "c").WHAT | 16:02 | ||
camelia | rakudo-moar 7e8d8a: OUTPUT«(Pair)» | ||
Kristien | Hmm. | ||
16:02
Ben_Goldberg left
|
|||
Kristien | Oh right. I'm a fool. | 16:02 | |
[Tux] | int is not allowed, Int is | ||
16:02
Ben_Goldberg joined
|
|||
[Tux] | m: Str %error{Int} = :{ 1 => "foo" }; | 16:03 | |
camelia | rakudo-moar 7e8d8a: OUTPUT«===SORRY!=== Error while compiling /tmp/QgY1kjMr_WUndeclared routine: error used at line 1» | ||
[Tux] | m: my Str %error{Int} = :{ 1 => "foo" }; | ||
camelia | rakudo-moar 7e8d8a: OUTPUT«Saw 1 call to deprecated code during execution.================================================================================%error = itemized hash called at: /tmp/9_zmuVNxtd, line 1Deprecated since v2014.7, will be removed with release v201…» | ||
16:03
ptc_p6 is now known as [ptc]
|
|||
[Tux] | m: my Str %error{int} = :{ 1 => "foo" }; | 16:03 | |
camelia | rakudo-moar 7e8d8a: OUTPUT«Type check failed in binding key; expected 'int' but got 'Int' in method STORE_AT_KEY at src/gen/m-CORE.setting:10768 in block at src/gen/m-CORE.setting:10398 in method STORE at src/gen/m-CORE.setting:10391 in block <unit> at /tmp/LAnR3Muz…» | ||
16:05
Ben_Goldberg left
|
|||
Kristien | m: my $k = ("a" => "b"); say $k.WHAT; my $h = {("a" => "b") => "c"}; say $h.WHAT; say $h{$k} | 16:05 | |
camelia | rakudo-moar 7e8d8a: OUTPUT«(Pair)(Hash)c» | ||
16:05
Ben_Goldberg joined
|
|||
Kristien | m: my $x = 'a' => 'b'; my $y = $x; $x.value = 'c'; say $x, $y; | 16:06 | |
camelia | rakudo-moar 7e8d8a: OUTPUT«a => ca => c» | ||
Kristien | m: my $x = 'a' => 'b'; my $y = 'a' => 'c'; $x.value = 'c'; say $x === $y; | ||
camelia | rakudo-moar 7e8d8a: OUTPUT«False» | ||
16:07
[ptc] left
|
|||
Kristien | Does Hash not use WHICH for keys? | 16:07 | |
16:08
[ptc] joined
|
|||
skids | Default Hash is Str, Hash[Any] should use WHICH IIRC | 16:12 | |
Kristien | m: subset Nat of Int where { * >= 0 }; say -1 ~~ Nat | ||
camelia | rakudo-moar 7e8d8a: OUTPUT«True» | ||
16:12
Ben_Goldberg left
16:13
Ben_Goldberg joined
|
|||
Kristien | weird | 16:14 | |
16:14
[ptc] left
|
|||
[Tux] | Saw 1 call to deprecated code during execution. | 16:14 | |
================================================================================ | |||
%!errors = itemized hash called at: | |||
Deprecated since v2014.7, will be removed with release v2015.7! | 16:15 | ||
Please use %!errors = %(itemized hash) instead. | |||
masak | [Tux]: did you use {} ? | ||
Kristien | m: say :{('a'=>'b') => 1, ('a'=>'b') => 2} | ||
camelia | rakudo-moar 7e8d8a: OUTPUT«(a => b) => 1, (a => b) => 2» | ||
Kristien | So far so good. | ||
skids | m: subset Nat of Int where * >= 0; say -1 ~~ Nat | 16:16 | |
camelia | rakudo-moar 7e8d8a: OUTPUT«False» | ||
[Tux] | I used «has Str %!errors{Int} = :{ 1 => "foo" }; | ||
Kristien | m: say :{('a'=>'b') => 1, ('a'=>'b') => 2}{('a' => 'b')} | ||
camelia | rakudo-moar 7e8d8a: OUTPUT«(Any)» | ||
16:16
[ptc] joined
|
|||
Kristien | ah, cool | 16:16 | |
skids | { * => 0 } is a closure that returns a closure. | ||
Kristien | skids: aahh I ee | ||
I see* | |||
16:17
kaare_ left
|
|||
[Tux] | m: my Str %e{Int} = :{ 1 => "foo" }; | 16:18 | |
camelia | rakudo-moar 7e8d8a: OUTPUT«Saw 1 call to deprecated code during execution.================================================================================%e = itemized hash called at: /tmp/m5E55mLkbx, line 1Deprecated since v2014.7, will be removed with release v2015.7!…» | ||
FROGGS_ | m: my Str %e{Int} = 1 => "foo"; | ||
camelia | ( no output ) | ||
FROGGS_ | that is redundant when you supply the shape | ||
Kristien | Time for dinner. Byebye! | ||
FROGGS_ | o/ | ||
16:18
Kristien left
16:21
spider-mario left
16:22
[ptc] left
|
|||
[Tux] | FROGGS_++ | 16:23 | |
masak | yeah, I suspected there was one hash too many in there. | 16:25 | |
16:26
jluis_ left
|
|||
[Tux] | so «warn "foo\n"» does not prevent noting the location of the warn as it does in perl5 | 16:30 | |
16:30
[ptc] joined,
[ptc] left
|
|||
[Tux] | does perl6 have a warn that prints to catchable STDERR without noting the location? | 16:31 | |
dalek | c: bacbf30 | moritz++ | lib/Type/Proc/Async.pod: Proc::Async: say, write and print return promises |
||
16:31
[ptc] joined
|
|||
moritz | [Tux]: note() prints to STDERR | 16:31 | |
but it's not an exception like warn | |||
16:31
[ptc] left
|
|||
dalek | c: b60db22 | moritz++ | lib/Type/Promise.pod: Try to fix formatting of a code block |
16:32 | |
16:32
[ptc] joined
16:33
[ptc] left
16:34
[ptc] joined
|
|||
[Tux] | bummer | 16:34 | |
skids | So when browsing doc/ via github, the reaon some files do not display is because github renders with perl5 pod, right? | ||
moritz | skids: correct | ||
doc.perl6.org should display them correctly, though :-) | 16:35 | ||
dalek | c: bc676ad | moritz++ | README.md: README: add a note that github mis-displays the pod files |
16:36 | |
skids | Any way to just get github to do plaintext for .pod? | 16:39 | |
moritz | no idea | ||
rurban_ | name it pod6 | ||
skids | Hmm.... | ||
rurban_ | they won't interfer with this perl5 vs perl6 fight who got the better/right pod format | 16:40 | |
moritz | I see no fight | ||
skids | I was thinking more a project-local setting. | ||
16:41
Kristien joined
|
|||
Kristien | my %x = :{ ('a' => 'b') => 'c' }; say %x{('a' => 'b')}; | 16:42 | |
m: my %x = :{ ('a' => 'b') => 'c' }; say %x{('a' => 'b')}; | |||
camelia | rakudo-moar 5dd603: OUTPUT«cSaw 1 call to deprecated code during execution.================================================================================%x = itemized hash called at: /tmp/3YhNbc4pTr, line 1Deprecated since v2014.7, will be removed with release v201…» | ||
Kristien | m: my $x = :{ ('a' => 'b') => 'c' }; say $x{('a' => 'b')}; | 16:43 | |
camelia | rakudo-moar 5dd603: OUTPUT«(Any)» | ||
Kristien | Ok, good. | ||
16:44
[ptc] left,
[ptc] joined
16:45
[ptc] left
|
|||
Kristien | m: class A { has $.x = 1; submethod BUILD { } }; say A.new.x; | 16:48 | |
camelia | rakudo-moar 5dd603: OUTPUT«1» | ||
[Tux] | what is the most readable/most common way to write qq{"abc\nc"} in perl6? I keep getting confused with all Q and <> variations | 16:50 | |
moritz | qq{"abc\nc"} is good, IMHO | 16:51 | |
[Tux] | it sees the \n not as newline / | ||
moritz | oh | ||
you don't want that? | |||
q{"abc\nc"} | |||
16:51
Peter_R left
|
|||
[Tux] | I want an embedded newline, as in perl5 | 16:51 | |
moritz | m: say q{"abc\nc" | 16:52 | |
camelia | rakudo-moar 5dd603: OUTPUT«===SORRY!=== Error while compiling /tmp/GYGKJtq0R7Couldn't find terminator }at /tmp/GYGKJtq0R7:1------> say q{"abc\nc"⏏<EOL>» | ||
moritz | m: say q{"abc\nc"} | ||
camelia | rakudo-moar 5dd603: OUTPUT«"abc\nc"» | ||
moritz | m: say qq{"abc\nc"} | ||
camelia | rakudo-moar 5dd603: OUTPUT«"abcc"» | ||
moritz | that one expand the newlne | ||
[Tux] | weeeeeeeird | ||
16:52
[ptc] joined
|
|||
[Tux] looks for another cause then | 16:52 | ||
dalek | c: 7c4d12d | moritz++ | lib/Type/Proc/Async.pod: More formatting fixes |
16:53 | |
Kristien | m: my %h = 1, 2, 3, 4; say %h.WHAT; say map({ .WHAT }, %h.keys); | 16:55 | |
camelia | rakudo-moar 5dd603: OUTPUT«(Hash)(Str) (Str)» | ||
Kristien | :S | ||
moritz | fwiw I've now changed the doc.perl6.org updating cron job to run every 5 minutes, but only if it's not running (via flock (1)) | ||
and it only does something if there's a new commit | |||
Kristien | m: my %h{Any} = 1, 2, 3, 4; say %h.WHAT; say map({ .WHAT }, %h.keys); | ||
camelia | rakudo-moar 5dd603: OUTPUT«(Hash[Any,Any])(Int) (Int)» | ||
Kristien | Ahh, it defaults to Str. | 16:56 | |
moritz | yes | ||
Kristien | Why? | ||
moritz | p5 legacy (and often still very useful behavior) | ||
Kristien | OK. | 16:57 | |
dalek | c: 0afbbe8 | moritz++ | lib/Type/Any.pod: A bit more documentation for class Any |
17:03 | |
[ptc] | moritz: hi! Have you got time for a couple of questions? | 17:04 | |
moritz | [ptc]: yes (though $family might demand some attention) | ||
[ptc] | cool! (and if you need to go, no worries) | 17:05 | |
um, I was looking at #28 on the docs repo; the one about syntax highlighting the code on the website | |||
and was looking at what people had already mentioned, and found SyntaxHighlighter somewhat wanting in functionality | 17:06 | ||
namely, it doesn't handle angle brackets nicely... | |||
anyway, I noticed that pygments (pygments.org) handles Perl6. | |||
moritz | as does vim | ||
[ptc] | would it be ok to investigate that as an option for docs.perl.org for the syntax highlighting/ | 17:07 | |
moritz | the problem with not doing it in the browser is that Perl 6 pod allows interweaving of code with markup | ||
you can do things like | |||
=being code :allow<B L> | |||
and then B<...> and L<...> tags in the code produce bold/link HTML | 17:08 | ||
but the rest is taken literally | |||
[ptc] | aha | ||
moritz | and it's hard to find hilighters that support that | ||
17:08
TimToady_ joined
|
|||
moritz | I guess I should add that to the ticket | 17:08 | |
17:09
ab5tract joined
|
|||
[ptc] | dunno if pygments does that; they even advertise that they support perl6 :-) | 17:09 | |
17:09
krunen joined
|
|||
[ptc] | even though it's in python... | 17:09 | |
flussence | the pygments support was adaded to get perl6 to look nice on github (which then promptly dropped pygments entirely, for an in-house library with half the functionality...) | ||
17:09
xfix_ joined
|
|||
flussence | s/adaded/added/ | 17:09 | |
17:10
risou_ joined,
Kristien_ joined,
petercom1and joined
|
|||
[ptc] | I just wondered if it's worthwhile investigating using pygments instead of something like highlight.js or SyntaxHighlight for docs.perl.org | 17:10 | |
the problem I see is that one probably has to install pygments on the server, which might not be an option... | 17:11 | ||
just trying to throw ideas around... | |||
moritz | [ptc]: installing stuff on the server is an option | ||
17:11
huf joined
|
|||
flussence | there's a high chance it's already there as part of some other dep... | 17:11 | |
moritz | [ptc]: I have root there :-) | ||
flussence | (asciidoc uses it, and plenty of things use that) | 17:12 | |
moritz | [ptc]: it just shouldn't be something obscure which I end up having to maintain that | ||
if it's debian-packaged, that makes it easier (but it's not a hard requirement) | |||
Kristien_ | m: say [1, 2, 3].perl, set(1, 2, 3).perl | ||
camelia | rakudo-moar 5dd603: OUTPUT«[1, 2, 3]set(1,2,3)» | ||
[ptc] | moritz: which was one thing that sort of made me a bit uneasy when looking at the other solutions | ||
Kristien_ | Inconsistent whitespace! :P | 17:13 | |
17:13
rmgk_ joined,
rmgk left,
rmgk_ is now known as rmgk
|
|||
moritz | [ptc]: understandable | 17:13 | |
[ptc] | moritz: it's in debian | ||
moritz | python-pygments, python3-pygments | ||
[ptc] | I'll look into it a bit more before you need to install anything | ||
I'll push a feature branch when I'm ready and ping you so for feedback if that's ok | 17:14 | ||
moritz | [ptc]: sure | ||
[ptc] | moritz: cool, ta :-) | 17:15 | |
moritz | [ptc]: fwiw on my blog I use vim + Text::VimColor for hilighting Perl 6 code | ||
17:15
lestrrat left,
jakesyl left,
krunen_ left,
ab5tract_ left,
risou left,
Kristien left
|
|||
moritz | [ptc]: but I'm not married to that solution by any means | 17:15 | |
17:15
jakesyl joined,
xfix left,
Alina-malina left,
huf_ left,
kst left,
TimToady left
|
|||
[ptc] | hrm, that might be a better option; didn't know about Text::VimColor | 17:17 | |
that might be easier, and a Perl-only solution | |||
moritz | I've considered porting Text::VimColor to Perl 6 | 17:18 | |
but haven't done it yet | |||
[ptc] | I'll play with a couple of options, and then recommend something; I'd like to keep the admin-overhead as low as possible, and not have to use too many languages in building the html docs | 17:19 | |
flussence | heh, I just saw the pygments homepage... :) | 17:20 | |
(that list) | |||
17:33
IllvilJa left
17:34
jantore left,
jantore joined
|
|||
TimToady_ | it's quite possible that szabgab's bug is the one we flushed out of spesh a week or two ago | 17:37 | |
that one that involved regex and negations | |||
17:38
IllvilJa joined
17:39
espadrine_ joined
17:42
ugexe_ is now known as ugexe
17:43
sirdancealot left
17:46
sirdancealot joined
17:50
Vlavv_ left
17:55
xfix_ is now known as xfix
17:56
zakharyas left
17:59
telex left
18:00
telex joined
18:02
Vlavv_ joined
|
|||
dalek | c: 13001a6 | paultcochrane++ | lib/Language/operators.pod: Add missing prepositon |
18:04 | |
c: 0b382b6 | paultcochrane++ | lib/Type/Any.pod: Merge branch 'master' of github.com:perl6/doc |
|||
18:06
espadrine_ left
|
|||
timotimo | could we spec UNDO phasers inside grammars/regexes to fire if we backtrack over a closure? | 18:16 | |
18:19
Alina-malina joined
|
|||
moritz | isn'T that already specced | 18:26 | |
Kristien_ | If you use map in sink context, does it produce a list or is that optimised out? | ||
moritz | Kristien_: I think it's optimized out | ||
timotimo | dunno | 18:31 | |
18:33
FROGGS__ joined
18:34
Sqirrel left
18:35
sirdancealot left
18:36
Sqirrel joined,
lestrrat joined
18:37
FROGGS_ left
|
|||
TimToady_ | it's treated as eager | 18:43 | |
but it doesn't have to actually return any values | |||
part of the GLR is to make sure more things optimize that | 18:44 | ||
it does have to run the block though, since it might have side effects | |||
I think P5 goes as far as to put the inside of the map's block into void context | 18:45 | ||
[ptc] | is it ok if I add '# vim: ft=perl6' at the bottom of files I come across, so that at least vim knows the file is perl6? | 18:56 | |
Kristien_ | Install a proper ft detection plugin. | ||
nwc10 | use emacs? :-) | 18:57 | |
(couldn't resist. I'm not sure if emacs does it any better.) | |||
[ptc] | ok. Just thought I'd ask before I start changing files willy-nilly | 18:58 | |
Kristien_: what would you recommend? | 18:59 | ||
Kristien_ | Or make the file extension pm6 instead of pm. | ||
bartolin_ | fwiw: most (if not all) test files from roast have '# vim: ft=perl6' as last line | 19:01 | |
TimToady_ | [ptc]: you should generally also add et to expand tabs to spaces | ||
expandtab and sw=4 | |||
[ptc] | bartolin_: yeah, that's one reason why I ask; I've seen files with, and several without | 19:02 | |
and have had the problem that some files aren't detected correctly as perl6 | |||
TimToady_: that's a good idea, I'll do that where there already is a vim coda | |||
19:03
rindolf left
|
|||
TimToady_ | a lot of rakudo files have vim modelines, but not many nqp files yet | 19:04 | |
19:04
TimToady_ is now known as TimToady
|
|||
bartolin_ | +1 for adding vim modelines | 19:04 | |
itz_ | perl6 vim tags generation would be nice too | 19:06 | |
19:12
Mouq joined
|
|||
japhb | While glancing through the backlog, I saw a discussion about what encoding high-codepoint strings to ASCII should do. Did anyone suggest it returning Failure? That seems the obvious choice for dial-able complaint level .... | 19:12 | |
geekosaur | that was the suggested default | 19:13 | |
hm, no, that was an exception | |||
Failure might work | |||
Kristien_ | should be configurable though | 19:14 | |
japhb | Kristien_: 'use fatal' | ||
Kristien_ | no I mean whether it should fail or use a replacement character | 19:15 | |
Mouq | Also, would it make sense to remove accents? or is that outside the scope of .encode? | ||
japhb | Kristien_: now *that* could be an adverb | 19:16 | |
Kristien_ | "class FatRat is Cool does Rational[Int, Int]" reads funny | ||
japhb | Mouq: I think that's outside the .encode scope -- that's more of a mapping than an encoding | ||
(Insomuch as you expect .encode to be reversible) | 19:17 | ||
Also, transliteration seems to me a very non-core thing, ripe for modules | 19:18 | ||
(Because it would likely have to be language-dependent.) | |||
19:19
KCL_ joined
|
|||
japhb | And the core setting provides mechanism and tools, not policy. | 19:19 | |
bartolin_ | when I looked at the nqp code for sprintf I found that we are very strict (using nqp::die) when the number of used arguments in directives and the number of supplied arguments are different. on the other hand we are much less strict when at least one index is used. (examples follow) | ||
m: say sprintf "%s", "a", "b", "c"; # here we die | 19:20 | ||
camelia | rakudo-moar 5dd603: OUTPUT«Too few directives: found 1, fewer than the 3 arguments after the format string» | ||
bartolin_ | m: say sprintf "%1$s", "a", "b", "c"; # but here not | ||
camelia | rakudo-moar 5dd603: OUTPUT«===SORRY!=== Error while compiling /tmp/7vj5HvGMVtVariable '$s' is not declaredat /tmp/7vj5HvGMVt:1------> say sprintf "%1$s⏏", "a", "b", "c"; # but here not expecting any of: postfix» | ||
bartolin_ | m: say sprintf q[%1$s], "a", "b", "c"; # but here not | ||
camelia | rakudo-moar 5dd603: OUTPUT«a» | ||
bartolin_ | m: say sprintf q[%5$s], "a", "b", "c"; # and here neither | ||
camelia | rakudo-moar 5dd603: OUTPUT«» | ||
bartolin_ | I was surprised about the latter two | 19:21 | |
japhb | bartolin_: I would think that's most likely a NYI, just because harder. | 19:24 | |
Mouq | moritz: I saw you were trying to parellelize doc/htmlify.p6. I have an old branch sitting around that converts all the processing into safe actions on Supplies. It still failed when I last tried to add start { } blocks, but I'll push the branch to github | 19:26 | |
bartolin_ | japhb: yes, that's plausible. I wanted to make sure there is no other reason | ||
19:33
Rounin left
|
|||
Kristien_ | I think Rat.nude is quite an appropriate name. | 19:33 | |
It removes the wrapper, making the numbers nude :P | |||
dalek | c/supplied: 8d8fd30 | Mouq++ | / (3 files): WIP... |
19:39 | |
c/supplied: 5c25606 | Mouq++ | / (188 files): Merge branch 'master' into supplied Conflicts: htmlify.p6 |
|||
rl6-roast-data: a7f253b | coke++ | / (5 files): today (automated commit) |
19:40 | ||
19:41
agentzh joined
|
|||
dalek | kudo/nom: 243c164 | lizmat++ | src/core/Any.pm: Remove now superfluous test for < 0 |
19:44 | |
japhb clears the last crashing bug out of a chunk of code he's been fighting for weeks, has a successful run, and has one of those "OMG -- I can't believe that actually WORKED!" moments | |||
lizmat | japhb++ | 19:46 | |
Kristien_ | m: for 42 { .say } | 19:47 | |
camelia | rakudo-moar 5dd603: OUTPUT«42» | ||
Kristien_ | It'll be fun to implement something like Scala's case class feature. | ||
dalek | Heuristic branch merge: pushed 31 commits to specs/newio by lizmat | 19:48 | |
19:49
jmark left
|
|||
vendethiel | Kristien_: well, "sealed" would be more interesting to implement :) | 19:49 | |
Kristien_: see timotimo's adt.p6 | |||
Kristien_ | I don't like adt.p6 in that it does parsing stuff. | ||
vendethiel | :( | 19:51 | |
Kristien_ | But having immutable records with automatic .perl and .WHICH is very nice. | ||
moritz | Mouq++ | 19:53 | |
dalek | c/supplied: ada0d13 | Mouq++ | / (2 files): Fix for latest Rakudo |
19:55 | |
Kristien_ | Maybe it can be achieved with just regular class syntax and some extra methods to generate construction, .perl and .WHICH | 19:56 | |
m: sub record($class) { $class.^add_method('perl', my method perl() { "TODO" }); }; class A { record(A) }; say A.new.perl | 19:59 | ||
camelia | rakudo-moar 5dd603: OUTPUT«A.new()» | ||
Kristien_ | Something like that. | ||
Except without the bug, lol. | |||
compose seems to override perl | 20:00 | ||
moritz | m: sub record($class) { $class.^add_method('perl', anon method perl() { 'TODO' }) }; class A { BEGIN record(A) }; say A.new.perl | ||
camelia | rakudo-moar 5dd603: OUTPUT«===SORRY!===Type check failed in binding $class; expected 'Any' but got 'A'» | ||
moritz | m: sub record(Mu $class) { $class.^add_method('perl', anon method perl() { 'TODO' }) }; class A { BEGIN record(A) }; say A.new.perl | ||
camelia | rakudo-moar 5dd603: OUTPUT«TODO» | ||
_4d47 | just finished my first module, i'm happy have to share github.com/4d47/Tag | 20:01 | |
Kristien_ | ah cool | ||
moritz: nice lemme expand on this stuff | |||
20:01
haxmeister joined
|
|||
moritz | _4d47: nice | 20:02 | |
Kristien_ | btw why is it add_method not add-method? | 20:03 | |
moritz | _4d47: see doc.perl6.org/language/modules for how to get it into the ecosystem | ||
Kristien_: because jnthn++ came up with all the meta model :-) | 20:04 | ||
Kristien_: there was a time when we said that low-level stuff should have _ in the name and high-level stuff - | |||
Kristien_ | ah OK | ||
masak | oh, we've stopped saying that? pity. | ||
Mouq | *low_level | ||
moritz | Kristien_: that hasn't really panned out, but we don't have too much consistency as the result :( | ||
masak: I'm not sure | |||
vendethiel | Kristien_: seems like we could add another declarator instead of "class". like "record" | 20:05 | |
and you'd do `record Foo { has $!a; has !b; }`. or maybe `is immutable` on the class | |||
moritz | m: multi trait_mod:<is>(Mu $class, :$record!) { say $class.^add_method('marker', anon method() { 'MARKED' } }; class Flurb is record { }; say Flurb.marker | 20:07 | |
camelia | rakudo-moar 5dd603: OUTPUT«===SORRY!===Type 'method' is not declared. Did you mean 'Method'?at /tmp/qZfE1aWWFO:1------> $class.^add_method('marker', anon method⏏() { 'MARKED' } }; class Flurb is recordMalformed anonat /tmp/qZfE1a…» | ||
moritz | m: multi trait_mod:<is>(Mu $class, :$record!) { say $class.^add_method('marker', anon method () { 'MARKED' } }; class Flurb is record { }; say Flurb.marker | ||
camelia | rakudo-moar 5dd603: OUTPUT«===SORRY!=== Error while compiling /tmp/_8vwqkKrmNUnable to parse expression in argument list; couldn't find final ')' at /tmp/_8vwqkKrmN:1------> d('marker', anon method () { 'MARKED' } ⏏}; class Flurb is record…» | ||
moritz | m: multi trait_mod:<is>(Mu $class, :$record!) { say $class.^add_method('marker', anon method () { 'MARKED' } ) }; class Flurb is record { }; say Flurb.marker | ||
camelia | rakudo-moar 5dd603: OUTPUT«<anon>MARKED» | ||
moritz | (minus the first say) | ||
vendethiel | m: class MetamodelX::RecordHOW is Metamodel::ClassHOW { }; my package EXPORTHOW { package DECLARE { constant record = MetamodelX::RecordHOW; } }; record X {}; | 20:08 | |
camelia | rakudo-moar 5dd603: OUTPUT«===SORRY!=== Error while compiling /tmp/4QOLDnNaGtUnexpected block in infix position (two terms in a row, or previous statement missing semicolon?)at /tmp/4QOLDnNaGt:1------> = MetamodelX::RecordHOW; } }; record X ⏏…» | ||
Kristien_ | gist.github.com/rightfold/9d119b8ef0aa5e284b54 | 20:09 | |
awesome :) | |||
dalek | c: de93815 | moritz++ | lib/Type/Mu.pod: Small improvements to the Mu docs |
||
c: 2148faf | moritz++ | lib/Type/Proc/Async.pod: Proc::Async.say now calls .gist, just like regular &say. lizmat++ |
|||
Kristien_ | Now only new with positional agruments, and WHICH | ||
and copy to create a new instance with some attributes replaced, e.g. $person.copy(:name<vendethiel>) | 20:10 | ||
moritz | Kristien_: .clone already does that | ||
Kristien_ | holy shit! | 20:11 | |
moritz | Kristien_: doc.perl6.org/routine/clone | ||
Kristien_ | oh wait, perl is already there | 20:12 | |
only WHICH, then | 20:13 | ||
moritz | isn't it funny when you start to extend stuff, and find it's already there? :-) | ||
Kristien_ | yeah | 20:14 | |
can't get it to prevent compose from adding WHICH though | |||
moritz | call record at BEGIN time | ||
or use a trait, which automatically runs ASAP | |||
irclog.perlgeek.de/perl6/2015-01-25#i_10002270 | 20:15 | ||
Kristien_ | oh neat | ||
masak | semi-cogent thought about 'is parsed': someone suggested the other day that 'is parsed' be further separated from the macro itself, and the two communicate over an interface or something. | 20:16 | |
vendethiel | Kristien_: or create a declarator: github.com/jnthn/oo-monitors/blob/...onitors.pm :P | ||
masak | but if we look inside the compiler, regex and code are not just combined into one, they are *interleaved*. | 20:17 | |
Kristien_ | vendethiel: is that the correct link? | ||
vendethiel | Kristien_: yes, it's exporting the "monitor" keyword, see at the bottom | ||
Kristien_ | oh right | ||
shiny | |||
lizmat | m: my $h = :{}; my $p = (a => 42); $h{$p} = 63; say $h{$p}:p; $p.value = 17; say $h{$p}:p; say $h.pairs # is this intended / desired bahaviour ? | ||
camelia | rakudo-moar 5dd603: OUTPUT«(a => 42) => 63(a => 17) => 63(a => 17) => 63» | ||
vendethiel | Kristien_: github.com/jnthn/oo-monitors/blob/.../t/basic.t then in the test he uses "monitor Classname" | 20:18 | |
masak | (sometimes I feel that the factoring with actions is a wee bit overgeneralized. I get the "you can have N action classes to 1 grammar!" advantage, but normally I just have 1-to-1.) | ||
vendethiel | masak: I think is parsed's syntax should really look like sweetjs :-) | ||
(which is just racket templates) | |||
masak | regex and code are interleaved in the sense that we really like to check consistency ASAP, which often means right in the middle of a parse. | 20:19 | |
dalek | kudo/nom: 403b0f0 | moritz++ | src/core/Proc/Async.pm: Fix wording of error message at least I do not think "process" made sense here, when it is about handles/streams |
20:20 | |
lizmat | moritz: but but, it's "Proc" async ? | 20:21 | |
moritz | lizmat: I don't understand your objection | 20:22 | |
lizmat | IO::Async has a similar error, no? | 20:23 | |
IO::Socket::Async I mean | |||
moritz | lizmat: haven't document that one yet :-) | ||
so I don't know | |||
lizmat | hmmm... doesn't seem to have that check :-( | 20:24 | |
it probably should | |||
moritz | does the "process" in "Can only tap one of chars or bytes supply for process stdout" make sense? | ||
lizmat | and then maybe it's important to see in the message whether it was a process or a socket | ||
moritz | stdout is not a process | ||
oh | 20:25 | ||
but IO::Socke::Async won't have stdout/stderr, will it? | 20:26 | ||
lizmat | it has a chars_supply/bytes_supply | ||
and I also guess we don't want to do both at the same time there either | 20:27 | ||
moritz | yes, but my point is that the error message won't be amibguous, because it doesn't say "stdout" or "stderr" in the error message | ||
lizmat | ok :-) | 20:28 | |
dalek | c: d93a043 | moritz++ | lib/Type/ (2 files): Document X::Proc::Async::CharsOrBytes |
||
moritz | Proc::Async is about 280 lines of code (including the exception classes), and it took me basically all the hacking time of the weekend to document it | 20:29 | |
now I think the documentation is complete, in the sense that it covers all features | |||
Kristien_ | K. | ||
Mouq | masak: macro foo ($a, $b) { #`[code goes here] }; { parsed foo { <.sym> <.ws> (<.num>)(\S+) }; foo 4inches }; parsed foo { (<.num>) <.ws> in unit <.ws> (<.EXPR>) }; 4 in unit "inches" | ||
20:29
robins left
|
|||
moritz | Mouq: you skipped the interesting part: what does the code look like | 20:31 | |
20:31
jmark joined,
jmark left,
robinsmidsrod joined
|
|||
moritz | 'cause it will have to use the captures from parse to be useful | 20:31 | |
Kristien_ | vendethiel: this works: gist.github.com/rightfold/fefad5f66e7654e1a0e5 | 20:32 | |
I only have to fix WHICH to return some proper unique value but I can't do that now since ObjAt.new segfaults | |||
moritz | I guess we should fix that then :-) | 20:33 | |
masak | ok, the easiest way to make 'is parsed' an code interleave I guess is just using the code block feature of regexes. | ||
and* | 20:34 | ||
Mouq | moritz: True... :) | ||
moritz | m: sub f(str $x) { say $x }; my Str $x = 'foo'; f $x | ||
camelia | rakudo-moar 5dd603: OUTPUT«foo» | ||
masak | yeah, putting the parse after the macro code is surely the wrong way forward. | 20:35 | |
20:35
darutoko left
|
|||
moritz | .oO( why did I just want to write 'tmux attack'? ) |
20:35 | |
Mouq | m: sub infix:<in unit> (|) { "test" }; say 4 in unit "meters" # nbsp to the rescue | ||
camelia | rakudo-moar 243c16: OUTPUT«test» | ||
moritz | that's supposed to not work | 20:36 | |
Mouq | Oh, wait.. it works with regular space too | ||
moritz | operators my not contain whitespace | ||
Mouq | Yeah, that's not so good | ||
dalek | kudo/nom: cb5bb33 | moritz++ | src/core/ObjAt.pm: Make ObjAt.new(str) work Kristien_++ for reporting it as not working |
20:38 | |
moritz | Kristien_: there you go | ||
Kristien_ | shiny, thanks | 20:39 | |
will try it tomorrow, no time to reinstall rakudo right now | |||
moritz | Kristien_: have the appropriate amount of fun! | ||
20:40
brrt joined
|
|||
vendethiel | Kristien_: nice :-) | 20:40 | |
Kristien_ | vendethiel: I noticed your comment on GH :P | 20:41 | |
20:41
_4d47 left
|
|||
Kristien_ | The overview section is just to make fun of CoffeeScript, though. :P | 20:42 | |
20:42
ggherdov left,
pnu left
|
|||
dalek | ast: 7d17de6 | moritz++ | S32-str/sprintf.t: unfudge now passing test, bartolin++ |
20:44 | |
20:47
kst joined
20:48
brrt left
|
|||
bartolin_ | moritz: won't that require a nqp bump to work? | 20:48 | |
moritz | bartolin_: it passed for me, and I'm on the recommended nqp version | 20:49 | |
(I think :-) | |||
$ ./install/bin/nqp-m --version | 20:50 | ||
This is nqp version 2015.01-2-g4589d81 built on MoarVM version 2015.01-5-ga29eaa9 | |||
$ cat tools/build/NQP_REVISION | |||
2015.01-2-g4589d81 | |||
oh | |||
where did that come from? | |||
bartolin_: spectesting with nqp master now, and if it's fine, I'll bump the NQP_REVISION | 20:51 | ||
Kristien_ | Is it possible to create custom phasers? | ||
bartolin_ | moritz++ | ||
20:52
Kristien_ is now known as Kristien
|
|||
moritz | Kristien_: I don't think so, because phasers most usually hook in some compiler code or even backend-specific codegen to get fired | 20:52 | |
Kristien | OK. | ||
moritz | Kristien: what phase did you have in mind? | ||
Kristien | just wondering | ||
jnthn | Well, if you are going to write the code to fire them it's do-able I guess. | ||
yoleaux | 08:37Z <moritz> jnthn: is there a good reason to keep $!started in Proc::Async private? sounds like potentially useful information for the caller | ||
Kristien | No specific use-case in mind. | 20:53 | |
dalek | kudo/nom: 00c3fae | moritz++ | tools/build/NQP_REVISION: Bump NQP revision. gives us an sprintf error message fix, free beer and world peace |
||
20:53
jluis_ joined
|
|||
moritz | now I did the 'git push' without waiting for the spectest to finish. The muscle memory is strong in this one... | 20:54 | |
20:54
haxmeister left
|
|||
jnthn | m: sub foo() { }; &foo.add_phaser('FOO', { say "lol" }); &foo.fire_phasers('FOO'); | 20:54 | |
camelia | rakudo-moar 243c16: OUTPUT«lol» | ||
Kristien | make it a pre-push hook | ||
jnthn: lol | 20:55 | ||
dalek | osystem: d73f217 | (Mathieu Gagnon)++ | META.list: Add Tag module |
||
osystem: c63af83 | moritz++ | META.list: Merge pull request #39 from 4d47/master Add Tag module |
|||
jnthn | You can store any phasers you want on the block. But yeah, a bunch lead to some code-gen in the surroudning scope. | ||
If you can arrnage for that to happen then something should be possible in slang land... | 20:56 | ||
moritz: No strong reason; do you have a use-case in mind? | |||
moritz | jnthn: not really; just that if you juggle with multiple Proc::Async objects, it likely helps to get that piece of information | 20:58 | |
or you can write sub f(Proc::Async:D $proc where { .started }) { ... } | 20:59 | ||
20:59
agentzh left
|
|||
moritz | to declare that you only want started processes there | 20:59 | |
just like $.w is public | |||
(which I haven't documented yet!) | |||
jnthn | Yeah, no objects to making it publicly readable | 21:01 | |
21:04
PZt joined
|
|||
Kristien | m: sub f { END { say "hi" } }; f; f; f; | 21:04 | |
camelia | rakudo-moar 243c16: OUTPUT«hi» | ||
dalek | ast: 0630ae1 | usev6++ | S (2 files): Unfudge passing tests |
21:06 | |
kudo/nom: 225cf21 | moritz++ | src/core/Proc/Async.pm: Proc::Async: make $!started public |
21:13 | ||
c: ccb0946 | moritz++ | lib/Type/Proc/Async.pod: document .w, .started |
|||
ast: 8c487c0 | moritz++ | S17-procasync/basic.t: Test Proc::Async.w and .started |
21:16 | ||
c: d742c13 | moritz++ | lib/Type/Proc/Async.pod: Fix typo |
21:21 | ||
[ptc] | moritz: I got the syntax highlighting working with pygments | 21:22 | |
the solution is (at present) quite ugly, however can be improved; I just don't yet know how | |||
moritz | [ptc]: push it to a branch, please | 21:23 | |
[ptc] | unfortunately, I had to patch Pod::To::HTML and doc... should I push both branches? Or should I send patches? | ||
is it ok to push to a branch in the main repo, or should I do it on my own github account | |||
(sorry, still learning the ropes of the project) | 21:24 | ||
moritz | [ptc]: pull request for Pod::To::HTML (it's not in the perl6 org) | ||
[ptc]: and a branch for doc | |||
[ptc] | moritz: atually Pod::To::HTML is in the perl6 org... I pushed code to it today... | 21:25 | |
moritz | [ptc]: oh, then a branch is fine | ||
dalek | c/add_pygments_highlighting: d7e1907 | paultcochrane++ | html/css/pygments.css: Add pygments css colour definitions file |
||
c/add_pygments_highlighting: 776d3f4 | paultcochrane++ | template/head.html: Load pygments style definitions |
|||
[ptc] | ok | ||
moritz | [ptc]: and my memory is out of date :-) | ||
[ptc]: you already know your way around the ecosystem better than me, it seems :-) | 21:27 | ||
21:27
xfix left
|
|||
[ptc] | moritz: still learning, I'm afraid. But getting there :-) | 21:27 | |
moritz: I used `perl6 -Ipath/to/Pod-To-HTML/lib/ htmlify.p6` to test | 21:28 | ||
21:28
kjs_ joined
|
|||
[ptc] | the output looks good, and I don't know if it slows down the htmlify program that much | 21:28 | |
moritz | [ptc]: I see what you mean about it being ugly. I'd suggest to patch Pod::To::HTML to accept a callback for code / preformatted text, and then set that callback in htmlify | 21:29 | |
[ptc] | it basically runs a qqx on pygmentize, the output of which then replaces what used to be simply in a <pre> | ||
moritz | [ptc]: because making Pod::To::HTML generally depend on pygmentize is a bad idea | ||
[ptc] | agreed | ||
it's really just a proof of concept | |||
21:29
kjs_ left
|
|||
moritz | aye | 21:30 | |
21:30
kjs_ joined
|
|||
b2gills | m: sub test ( :named($) where *.defined ){...}; test() | 21:32 | |
camelia | rakudo-moar 243c16: OUTPUT«Constraint type check failed for parameter '<anon>' in sub test at /tmp/IkGVAotpuW:1 in block <unit> at /tmp/IkGVAotpuW:1» | ||
b2gills | m: sub test ( :named($)! where *.defined ){...}; test() | ||
camelia | rakudo-moar 243c16: OUTPUT«Required named parameter 'named' not passed in sub test at /tmp/fVCYwjA8VD:1 in block <unit> at /tmp/fVCYwjA8VD:1» | ||
[ptc] | I'd like to know how to pass the contents of a pod node out to a qqx without having to store the output in a temporary file first | ||
unfortunately, couldn't work that one out, hopefully someone here as an idea | 21:33 | ||
b2gills | Perhaps you could try Proc::Async instead | 21:34 | |
[ptc] | anyway, I'll head off | ||
gn8! | |||
21:35
FROGGS[mobile] left
|
|||
moritz | aye, Proc::Async works | 21:36 | |
21:38
[ptc] left
21:39
Kristien left
21:40
Kristien joined
21:42
jluis_ left
21:47
agentzh joined
21:51
mvuets left
|
|||
dalek | kudo/nom: e34a9c0 | lizmat++ | src/core/control.pm: Add CLONE-HASH-DECONTAINERIZED helper sub |
21:51 | |
22:00
Kristien left
22:02
jack_rabbit joined
|
|||
dalek | kudo-star-daily: 50edfb8 | coke++ | log/ (9 files): today (automated commit) |
22:03 | |
22:06
zby_home joined
|
|||
Mouq | gist.github.com/Mouq/10d5b19f7869add9e9e0 | 22:07 | |
(bug in Supply.categorize) | 22:08 | ||
Mouq rakudobugs it | 22:14 | ||
22:14
kjs_ left
|
|||
lizmat | will look at it tomorrow, unless someone beats me to it | 22:14 | |
ab5tract | still running into some weirdness with regexes and escapes sequences :( gist.github.com/ab5tract/4961802803d3e5fb489d | ||
moritz | Mouq: should it call .done of the sub-supplies before or after the outer? | 22:16 | |
ab5tract | m: my @a = ("55x77" ~~ rx{(\d\d)(x)(\d\d)}).values; @a.say | 22:17 | |
camelia | rakudo-moar 243c16: OUTPUT«「55」 「x」 「77」 » | ||
22:18
doobi-sham-5008 joined
|
|||
ab5tract | m: my @a = ("55x77" ~~ rx{(\d\d)(x)(\d\d)}).values.map: { ~$_ }; @a.perl.say | 22:18 | |
camelia | rakudo-moar 243c16: OUTPUT«Array.new("55", "x", "77", "")» | ||
22:19
zby_home left
|
|||
skids | r: sub f (|c) { c.perl.say }; f(1, b => 3); f(1, "b" => 3); \(1, "b" => 3).perl.say; # Should Capture literals use Capture syntax rules? | 22:19 | |
camelia | rakudo-{parrot,moar} 243c16: OUTPUT«Capture.new(list => (1,), hash => {"b" => 3})Capture.new(list => (1, "b" => 3,))Capture.new(list => (1,), hash => {"b" => 3})» | ||
ab5tract | what's with the extra element, and i'm guessing there is a better way to get the "just the strings please" of regex captures? | ||
timotimo | m: say("55x77" ~~ rx{(\d\d)(x)(\d\d)}) | 22:20 | |
camelia | rakudo-moar 243c16: OUTPUT«「55x77」 0 => 「55」 1 => 「x」 2 => 「77」» | ||
Mouq | I'd say after, since that seems to be the case for other supply-generating methods, but I don't really know. Although if you're relying on the order that .done is called on Supplies, you're probably doing something wrong :P | ||
timotimo | m: say(("55x77" ~~ rx{(\d\d)(x)(\d\d)}).values.perl) | ||
camelia | rakudo-moar 243c16: OUTPUT«(Match.new(orig => "55x77", from => 0, to => 2, ast => Any, list => ().list, hash => EnumMap.new()), Match.new(orig => "55x77", from => 2, to => 3, ast => Any, list => ().list, hash => EnumMap.new()), Match.new(orig => "55x77", from => 3, to => 5, ast => A…» | ||
timotimo | m: say(("55x77" ~~ rx{(\d\d)(x)(\d\d)}).values>>.Str.perl) | 22:21 | |
camelia | rakudo-moar 243c16: OUTPUT«("55", "x", "77", "")» | ||
ab5tract | ah, yes.. >>.Str, should have thought of that | ||
timotimo is not sure where that final element comes from, something about .values being wonky? | |||
m: say(("55x77" ~~ rx{(\d\d)(x)(\d\d)}).values[*-1].perl) | |||
camelia | rakudo-moar 243c16: OUTPUT«[]» | ||
timotimo | m: say(("55x77" ~~ rx{(\d\d)(x)(\d\d)}).values[*-1]) | 22:22 | |
camelia | rakudo-moar 243c16: OUTPUT«» | ||
timotimo | m: say(("55x77" ~~ rx{(\d\d)(x)(\d\d)}).values[*-2]) | ||
camelia | rakudo-moar 243c16: OUTPUT«「77」» | ||
timotimo | i got nothin' | ||
except bedtime | |||
i definitely gots the bedtime | |||
ab5tract | :( | ||
ye | |||
22:22
brrt joined
|
|||
lizmat | good night timotimo! | 22:22 | |
ab5tract | i'm about there too | ||
it's just weird that i can print the escape sequences after its been processed, and it just prints back. if i write that output back in manually as an argument to print, it moves the cursor | 22:26 | ||
22:26
doobi-sham-5008 left
|
|||
ab5tract | m: my @a = ("55x77" ~~ rx{(\d\d)(x)(\d\d)}).values>>.Str; @a.join.say; @a.join.comb.elems.say | 22:30 | |
camelia | rakudo-moar 243c16: OUTPUT«55x775» | ||
ab5tract | invisible characters :( | 22:31 | |
dalek | kudo/nom: a1c8b97 | lizmat++ | src/core/ (3 files): Some more uses of CLONE-HASH-DECONTAINERIZED() |
||
22:32
brrt left
|
|||
moritz | Mouq: I seem to have a fix for you; waiting for spectests... | 22:34 | |
22:34
ggherdov joined
22:35
pnu joined
|
|||
moritz | fwiw I've installed mosh on hack.p6c.org | 22:36 | |
might interest some of you :-) | |||
22:38
ilbot3 left
|
|||
dalek | kudo/nom: 0c524e3 | moritz++ | src/core/Proc/Async.pm: Throw an X::OS from Proc::Async if the external command could not be launched |
22:38 | |
kudo/nom: 94501a6 | moritz++ | src/core/SupplyOperations.pm: Supply.categorize: distribute .done to sub-supplies |
|||
22:38
ilbot3 joined
|
|||
Mouq | moritz++ | 22:43 | |
Mouq rebuilds | |||
lizmat | moritz: wouldn't that not also need to be done for Supply.classify ? | 22:46 | |
dalek | kudo/nom: 8d7542d | lizmat++ | src/core/control.pm: Create helper sub CLONE-LIST-DECONTAINERIZED |
22:49 | |
22:52
moomin-aba joined,
moomin-aba left
22:53
ken joined,
ken is now known as Guest13945
|
|||
Guest13945 | Hey | 22:54 | |
22:54
Guest13945 left,
brrt joined,
fil_ joined
|
|||
fil_ | I've been staring at this code all day: rosettacode.org/wiki/Multifactorial#Perl_6 | 22:55 | |
specifically sub mfact($n, :$degree = 1) { [*] $n, *-$degree ...^ * <= 0 } | |||
I don't understand the line in the braces | |||
I assume that is a "whatever" star? | |||
masak | fil_: [*] means "multiply all these things" | ||
dalek | kudo/nom: 371434f | lizmat++ | src/core/Proc/Async.pm: One more use of CLONE-LIST-DECONTAINERIZED |
||
masak | fil_: the `...` creates a sequence of values. | 22:56 | |
lizmat | m: say [+] 1,2,3,4,5 | ||
camelia | rakudo-moar 243c16: OUTPUT«15» | ||
masak | fil_: and the `*-$degree` comes out meaning "subtract $degree from the previous value" | ||
lizmat | and on that note, good night, #perl6! | ||
masak | fil_: the `^` on the `...^` means "discard the last value" | ||
fil_: the `* <= 0` means "keep doing the sequence until we find a value that less than or equal to 0" | 22:57 | ||
(and then don't include that value in the sequence, due to `^`) | |||
fil_ | so you can use a conditional in place of a limit value? | ||
22:57
Ben_Goldberg left
22:58
Ben_Goldberg joined
|
|||
fil_ | I think part of my confusion is that * is overloaded in the statement | 22:58 | |
Ovid_ | m: sub f(Int $x) {...}; f(3.0) | ||
camelia | rakudo-moar 243c16: OUTPUT«===SORRY!=== Error while compiling /tmp/Y3anEyM3JHCalling 'f' will never work with argument types (Rat) Expected: :(Int $x)at /tmp/Y3anEyM3JH:1------> sub f(Int $x) {...}; ⏏f(3.0)» | ||
masak | fil_: you can use anything that can be matched against. `* <= 0` just happens to create a little runnable thing that returns a boolean when called. | ||
fil_ | within the [*] it means multiply, but then later it is a whatever star | ||
masak | m: my $c = (* <= 0); say $c(-4); say $c(0); say $c(7) | ||
camelia | rakudo-moar 243c16: OUTPUT«TrueTrueFalse» | ||
masak | (parentheses for clarity; not needed) | 22:59 | |
fil_: after a while you learn to distinguish by context. | |||
fil_: there's `*` as an operator, which just means multiplication. | |||
Ovid_ | Since 3.0 == 3 (not ===), is it fair to say that the hard-coded Rat 3.0 can’t match an Int? | ||
masak | fil_: and then there's `*` as a term, which is pronounced "whatever" and has a number of useful semantics. | ||
fil_ | ok let me try this. | 23:00 | |
{ [*] $n, *-$degree ...^ * <= 0 } | |||
masak | Ovid_: I think so, yes. | ||
fil_ | [*] multiply what follows. | ||
masak | Ovid_: provided I understand your question. | ||
Ovid_ | I sort of agree they shouldn’t match, but it looks a touch odd. | 23:01 | |
fil_ | $n, *-$degree ..^ * <=0 means start with $n, then a term minus degree, then keep subtracting degree until you are <= 0 dropping last term | ||
masak | m: my $degree = 5; my $n = 20; say $n, *-$degree ...^ * <= 0 | ||
camelia | rakudo-moar 243c16: OUTPUT«20 15 10 5» | ||
masak | fil_: ^^ maybe helps | ||
fil_: yes, you got it just right. | |||
fil_ | the part that's a bit confusing is the $n, *-$degree part | ||
those are the first two terms in the sequence? | |||
masak | fil_: yes, with the second one being a bit special. | ||
fil_: since it's also a WhateverCode, just like the stopping criterion. | 23:02 | ||
m: my $degree = 5; say (* - $degree).^name | |||
camelia | rakudo-moar 243c16: OUTPUT«WhateverCode.new()» | ||
fil_ | there's a REPL here! Coolness! | ||
masak | we lovez our camelia. | ||
Mouq | m: say 20, -> $i { $i - 5 } ... ^ -> $n { $n <= 0 } | 23:03 | |
camelia | rakudo-moar 243c16: OUTPUT«Cannot call 'Numeric'; none of these signatures match::(Mu:U \v: *%_) in sub prefix:<^> at src/gen/m-CORE.setting:8468 in block <unit> at /tmp/vEqOSIpuun:1» | ||
Mouq | Err | ||
m: say 20, -> $i { $i - 5 } ...^ -> $n { $n <= 0 } | |||
camelia | rakudo-moar 243c16: OUTPUT«20 15 10 5» | ||
fil_ | m: 10, 9, *-1 ... 0 | 23:04 | |
camelia | ( no output ) | ||
fil_ | m: 10, *-1 ... 0 | ||
camelia | ( no output ) | ||
Mouq | fil_: "say " | ||
fil_ | m: say 10, 9, *-1 ... 0 | ||
camelia | rakudo-moar 243c16: OUTPUT«10 9 8 7 6 5 4 3 2 1 0» | ||
fil_ | so the whatever term doesn't have to be the first term | ||
but I assume it has to be the last one? | |||
masak | it has to be the term before the `...` | ||
fil_ | aha | ||
masak | but you can have several `...`, so you can sort of "steer" the sequence if you need to. | 23:05 | |
m: say 1, 2 ... 10, 20 ... 100 | |||
camelia | rakudo-moar 243c16: OUTPUT«1 2 3 4 5 6 7 8 9 10 20 30 40 50 60 70 80 90 100» | ||
Mouq | m: my @fib := 1, 1, * + * ... *; say @fib[^10] | ||
camelia | rakudo-moar 243c16: OUTPUT«1 1 2 3 5 8 13 21 34 55» | ||
fil_ | how does [*] work? It takes any infix operator? | ||
masak | yep. | 23:06 | |
m: say [&&] True, False, True | |||
camelia | rakudo-moar 243c16: OUTPUT«False» | ||
masak | m: say [&&] True, True, True | ||
camelia | rakudo-moar 243c16: OUTPUT«True» | ||
masak | fil_: we call them "metaoperators". we have a couple of them, besides [op] | ||
fil_ | I'm getting concerned masak that artificial intelligence has been discovered, but it's being kept a secret. You're just too fast to be believable... | 23:07 | |
23:07
kaare_ joined
|
|||
masak | fil_: we have >>op<<, "distribute operation elementwise" (also works on prefixes and postfixes, with appropriate modification) | 23:07 | |
fil_: I type fast. | |||
fil_: we have Xop, though just X is easier to understand at first. | |||
fil_ | so later on in the program it calls the sub as: map &mfact.assuming(:$degree), 1 .. 10; | 23:08 | |
masak | @a X @b gives you all combinations of @a elements and @b elements. | ||
right. | |||
fil_ | what is .assuming? | ||
it's not in learnxiny | |||
masak | it takes a sub and fills in one of the parameters with a value. | ||
let's make an example. | |||
m: sub greet($name) { say "howdy, $name!" }; &greet.assuming(:name<fil_>).() | 23:09 | ||
camelia | rakudo-moar 243c16: OUTPUT«Too few positionals passed; expected 1 argument but got 0 in sub greet at /tmp/Mlk1yQ8UA1:1 in sub CURRIED at src/gen/m-CORE.setting:3687 in block <unit> at /tmp/Mlk1yQ8UA1:1» | ||
fil_ | in this case it's filling in with $_ from map and 1..10? | ||
masak | m: sub greet(:$name) { say "howdy, $name!" }; &greet.assuming(:name<fil_>).() | ||
camelia | rakudo-moar 243c16: OUTPUT«howdy, fil_!» | ||
masak | there we go. | ||
I think I just proved I'm not an AI, too ;) | |||
fil_ | Just because you can pass the Turing test doesn't mean you're not an AI | ||
masak | no, it's filling in with $degree from the for loop. | 23:10 | |
fil_: true... | |||
I could have faked that mistake... | |||
gee, you humans have very high requirements. | |||
fil_ | there is no for loop | ||
masak | on the line before the map | ||
the line before the .assuming, I should say | 23:11 | ||
23:11
ribasushi left
|
|||
fil_ | what's the difference between &mfact.assuming(:$degree) and &mfact(:degree<$degree>) | 23:12 | |
masak | it's :degree($degree) | ||
but given that, no difference -- it's a shorthand | |||
fil_ | let me try again | ||
masak | (it's :name<str> when you mean a literal string and :name($expr) when you mean an expression) | ||
fil_ | what's the difference between &mfact.assuming(:$degree) and &mfact(:$degree) | 23:13 | |
masak | the .assuming produces a new sub, still without calling it. | ||
fil_ | oh I see! | ||
masak | the *map* calls that new sub, and passes $_ | ||
23:13
agentzh left
|
|||
fil_ | that's what the & is doing | 23:13 | |
23:13
ribasushi joined
|
|||
masak | which binds to the $n | 23:13 | |
fil_ | I see | 23:14 | |
it's like a "partial" | |||
in clojure | |||
masak | yes, the & here means "we're talking about the sub as a thing, not calling it" | ||
m: sub foo {}; say &foo | |||
camelia | rakudo-moar 243c16: OUTPUT«sub foo () { #`(Sub|66661536) ... }» | ||
masak | m: sub foo {}; say &foo.arity | ||
camelia | rakudo-moar 243c16: OUTPUT«0» | ||
masak | m: sub foo($n) {}; say &foo.arity | ||
camelia | rakudo-moar 243c16: OUTPUT«1» | ||
fil_ | I think the writer did a poor job writing that perl6 example | 23:15 | |
masak | in Perl 6, subs secretly are actually called `&foo` etc. it's just that `foo` is a shorthand for `&foo()` | ||
fil_: it looks like good Perl 6 to me. | |||
fil_: that's not to say there aren't other ways. | |||
fil_ | when I read the Java example, it's immediately clear to the reader what's going on | 23:16 | |
this one is using some pretty advanced concepts | |||
masak | fil_: I probably would've reached for a sub inside the for loop instead. then I wouldn't have to pass $degree with .assuming. | ||
fil_ | do we really need a partial! | ||
masak | no. | ||
here, let me rewrite it for you without it. | |||
fil_ | I think I'm just going to change it for the sake of future generations | 23:17 | |
masak | m: for 1 .. 5 -> $d { sub mfact($n) { [*] $n, *-$d ...^ * <= 0 }; say "$d: ", map &mfact, 1..10 } | ||
camelia | rakudo-moar 243c16: OUTPUT«1: 1 2 6 24 120 720 5040 40320 362880 36288002: 1 2 3 8 15 48 105 384 945 38403: 1 2 3 4 10 18 28 80 162 2804: 1 2 3 4 5 12 21 32 45 1205: 1 2 3 4 5 6 14 24 36 50» | ||
masak | there ya go | ||
speedy rewrite! AI wins again \o/ | |||
ooh, and I can show off postfix >> | 23:19 | ||
m: for 1 .. 5 -> $d { sub postfix:<mfact>($n) { [*] $n, *-$d ...^ * <= 0 }; say "$d: ", (1..10)>>mfact } | 23:20 | ||
camelia | rakudo-moar 243c16: OUTPUT«1: 1 2 6 24 120 720 5040 40320 362880 36288002: 1 2 3 8 15 48 105 384 945 38403: 1 2 3 4 10 18 28 80 162 2804: 1 2 3 4 5 12 21 32 45 1205: 1 2 3 4 5 6 14 24 36 50» | ||
masak | not much longer, and kinda cute :) | ||
23:20
_4d47 joined
|
|||
masak | note how the `>>` means "distribute this operator (that we just defined) over all the elements" | 23:20 | |
Mouq | m: for 1 .. 5 -> $d { sub mfact($n) { [*] $n, *-$d ...^ * <= 0 }; say "$d: ", (1..10)>>.&mfact } # works too | ||
camelia | rakudo-moar 243c16: OUTPUT«1: 1 2 6 24 120 720 5040 40320 362880 36288002: 1 2 3 8 15 48 105 384 945 38403: 1 2 3 4 10 18 28 80 162 2804: 1 2 3 4 5 12 21 32 45 1205: 1 2 3 4 5 6 14 24 36 50» | ||
masak | ooh, yes. | ||
fil_ | I think your first approach was clearer | 23:21 | |
masak | Mouq++ is here using the fact that any sub can be called as a method: `$obj.&mysub` | ||
fil_: yes, possibly. | |||
fil_: though it depends what you're used to. | |||
I agree not much is gained by making it an operator here. | |||
sometimes it makes a world of difference. when you can use [op], for example. | 23:22 | ||
fil_ | I've updated rosettacode.org/wiki/Multifactorial#Perl_6 with your simplified solution. Thanks for walking me through this! | 23:26 | |
masak | my pleasure. | 23:27 | |
fil_ | I understand that { [*] $n, *-$degree ...^ * <= 0 } is the correct way to write it, but it troubles me that perl6 allows for three completely different meanings of * in the same statement. | ||
masak | two are the same, though. | ||
fil_ | well kinda | ||
but they're not the same instance | |||
If I saw two $n in the same statement, chances are they referred to the same thing. But here the first one refers to "previous term" and the second one refers to "current term" | 23:28 | ||
masak | would it reassure you if I said that Perl 6 itself is never confused as to what kind of `*` you use, and that with (minimal) practice it's a breeze to tell the two different meanings apart? | ||
fil_ | fair enough | ||
masak | oh, but the `*` means "whatever". | ||
fil_ | I just started studying it today | ||
masak | that you *have* to know, otherwise it will not make sense :) | 23:29 | |
fil_ | like what's the difference between $_ and * | ||
masak | the thing with "whatever" is that the surrounding context/callee fills in the appropriate meaning. | ||
easiest to show the difference. hold on. | |||
23:29
_4d47 left
|
|||
masak | m: my &t = { $_ == 7 }; say &t(5); say &t(7) | 23:29 | |
camelia | rakudo-moar 243c16: OUTPUT«FalseTrue» | ||
masak | m: my &t = * == 7; say &t(5); say &t(7) | 23:30 | |
camelia | rakudo-moar 243c16: OUTPUT«FalseTrue» | ||
masak | so `*` is kind of `$_` plus invisible `{ }` | ||
fil_ | ah | ||
ok that is a HUGE help | |||
it means that spaces are significant in perl | 23:31 | ||
or at least moreso than in other languages like Java or C. | |||
masak | correct. | ||
it's used to differentiate whether something is a postfix or an infix, for example. | 23:32 | ||
m: my @a; @a[0] | |||
camelia | ( no output ) | ||
masak | m: my @a; @a [0] | ||
camelia | rakudo-moar 243c16: OUTPUT«===SORRY!=== Error while compiling /tmp/DItW6NY4u5Two terms in a rowat /tmp/DItW6NY4u5:1------> my @a; @a [⏏0] expecting any of: infix stopper infix or meta-infix bracketed…» | ||
masak | ok, that last one wasn't an infix, but still. | ||
fil_ | ya | ||
interesting | |||
masak | m: my $x; $x ++ | ||
camelia | rakudo-moar 243c16: OUTPUT«===SORRY!=== Error while compiling /tmp/W7u86gAYMYPreceding context expects a term, but found infix + insteadat /tmp/W7u86gAYMY:1------> my $x; $x ++⏏<EOL>» | ||
fil_ | I actually kind of like spaces being significant | ||
results in code with more consistent styling | 23:33 | ||
23:33
brrt left
|
|||
fil_ | hey I have another question for you. | 23:34 | |
Mouq | fil_: Another rational is that, with the complex grammar of Perl 6, it's super useful to be able to easily tell the user that there's a typo. Having significant space means that typos are much less likely to be interpreted as valid code | ||
masak | fil_: the thing that some people don't like is that they can't put spaces between `mysub` and `(...)` | ||
fil_ | I submitted an issue on learnxiny | ||
github.com/adambard/learnxinyminut...t-71391089 | |||
masak | heh | 23:35 | |
m: sub named-def(:$def) { say "\$def is $def" }; named-def(:10def) | |||
camelia | rakudo-moar 243c16: OUTPUT«$def is 10» | ||
masak | there's a backstory to why this weird feature exists. | 23:36 | |
fil_ | so at least you agree with me that it doesn't look right... :-) | ||
23:36
rurban_ left
|
|||
masak | yes, but I'm also showing that it works. | 23:36 | |
the reason it's there is to support this feature: | 23:37 | ||
m: $_ = "ABCDE"; m:4th/./; say ~$/ | |||
camelia | rakudo-moar 243c16: OUTPUT«D» | ||
fil_ | Does the second m: refer to camelia or match? | 23:39 | |
masak | m: $_ = "ABCDE"; m/./; say ~$/ | 23:40 | |
camelia | rakudo-moar 243c16: OUTPUT«A» | ||
masak | it's `m//` for "match using this regular expression" | ||
fil_ | I see | ||
that's pretty freekin obscure | |||
so someone has created :nd, :st, :rd etc... | |||
masak | note how I'm not arguing back. | ||
yep. | |||
fil_ | sigh | ||
masak | when it's useful, it's very useful. | 23:41 | |
fil_ | That's Larry and his desire for the language to match English | ||
masak | but it's rare. | ||
fil_ | is there a :me for French? | ||
masak | I could have lived with just :nth($n), actually | ||
fil_: only in the expansion pack. | |||
fil_ | lol | ||
It feels like cuteness that will help ppl win obfuscation awards | 23:42 | ||
masak | and the 'm' and the 'e' have to be written with Unicode superscript. | ||
fil_ | but it doesn't add anything to the clarity of the language | ||
masak | oh, I don't know about that. | ||
m:2nd/ <$regex> / | |||
feels pretty clear to me. | 23:43 | ||
fil_ | I assume then that named arguments can't start with numbers for that reason | ||
does it only work for numbers | |||
or can you use <strings>, $vars or other things? | 23:44 | ||
It feels like an entire language construct just added for the benefit of the match operation | |||
masak | basically. | 23:46 | |
named arguments can't start with numbers because identifiers can't. | |||
there's prior art there from basically all other languages. | |||
if identifiers could start with numbers, you'd have to backtrack once you distinguished an identifier from a number literal. | 23:47 | ||
and we prefer to keep our languages backtrack-free. | |||
fil_ | so masak, besides being an amazing perl6 tutor, what's your role in the perl6 community? | ||
masak | I like to break things. | ||
fil_ | :-) | 23:48 | |
masak | no; correction. I use stuff, and it breaks. | ||
then I submit literally hundreds of bug reports. | |||
fil_ | nice | ||
are you a core perl6 contributor? | |||
masak | on a good day, yes. | ||
fil_ | cool! | ||
how many of you are there? | |||
masak looks around | |||
looks like just me :( | |||
fil_ | lol | ||
I mean core perl6 code contributors | 23:49 | ||
masak | it's a fuzzy number, for sure. | ||
fil_ | is Larry writing compiler/interpretor code? | ||
masak | there are scores of names in the Rakudo commit log, for example. | ||
fil_: yes, nowadays he is. | |||
fil_ | that's cool | ||
have you ever met him in person? | |||
masak | fil_: he had a self-imposed embargo for several years. | ||
something about Perl 5 ending up a bit messy in the implementation. | 23:50 | ||
fil_ | I've read through perl5 source code. | ||
It was seriously terrible | |||
I had a bug I needed to deal with | |||
Some of the worst code I've ever seen | |||
masak | fil_: I have met him in person. I've done the whole star-struck thing, and "omgomg I'm sitting next to Larry at a hackathon", and gotten yelled at by him, and had amazing technical discussions (mostly on IRC). | ||
fil_: what I've seen has made my hair curl a bit, too :) | 23:51 | ||
fil_ | Larry's a visionary, and I'm loving what I see on perl6. Just goes to show you can write an inspirational spec without being able to write a great compiler for it | ||
masak | see, for example, strangelyconsistent.org/blog/dash-n-and-dash-p | ||
fil_: if you want to see something great that Larry wrote, though, check out STD.pm6 | 23:52 | ||
fil_: that's inspirational. and it's running code, too. | |||
back when the rest of us couldn't imagine how to make a Perl 6 parser work, Larry wrote one in Perl 6, then wrote "just enough" shimming to translate that Perl 6 back to Perl 5, so it could run. | 23:53 | ||
fil_ falls prostate | 23:55 | ||
masak | considering how messy Perl 5's whole lexer/parser is -- to the point where people talk about "X ways a parser can lie to itself" when they describe it -- STD.pm6 just stands out as an awesome exemplar of clarity and intent. | 23:56 | |
fil_ | gotta go make dinner | ||
thanks for the inspiration | |||
masak | nice talking to you | ||
fil_ | l8ras | ||
masak | o/ | ||
fil_ | before I go | ||
nah | |||
another time | |||
masak | :) | ||
fil_ | l8r | ||
23:56
fil_ left
|