»ö« Welcome to Perl 6! | perl6.org/ | evalbot usage: 'perl6: say 3;' or rakudo:, niecza:, std:, or /msg p6eval perl6: ... | irclog: irc.perl6.org/ | UTF-8 is our friend! Set by sorear on 4 February 2011. |
|||
sjohnson | *peek a boo* | 00:06 | |
00:07
s1n joined
|
|||
[Coke] finally can check IRC today. hey, perl6eeps. | 00:09 | ||
sorear | hey, [Coke]] | ||
TimToady | .oO(perlbeeps?) |
||
phenny | TimToady: 28 Jun 23:06Z <pmichaud> tell TimToady I'm hoping you can answer the question on p6u about the rationale behind say vs print (gist versus string). I can write a response, but I'm fearfull I'll miss some of the nuances you ran into. | ||
[Coke] | you BEEPing perlians. | 00:12 | |
diakopter | 6leeper | ||
00:14
Chillance left
|
|||
TimToady | .oO(perl b from outer space) |
00:18 | |
[Coke] | www.youtube.com/watch?v=chfwaUtuOEk :: WTF? | 00:27 | |
flussence | Wat. | 00:34 | |
00:37
spider-mario left
00:39
jaldhar joined
00:44
tyatpi left
00:45
tyatpi joined
01:12
pat_js left
01:17
s1n left
01:30
scott_ joined,
scott_ is now known as Guest41876
01:31
s1n joined
01:39
Guest57355 left,
vlixes left
01:41
harmil1 joined
01:42
benabik_ joined
01:45
smash_ joined,
apejens_ joined,
pochi_ joined,
BlueT__ joined,
estrai_ joined,
am0c left,
alester left
01:46
benabik_ is now known as benabik,
flussence joined,
harmil joined,
am0c joined,
p6eval joined,
ChanServ sets mode: +v p6eval
|
|||
colomon | sorear: ping? | 01:50 | |
01:54
Exio joined
01:56
aloha joined
02:00
jaldhar left
|
|||
sorear | colomon: pong | 02:23 | |
colomon | sorear: I'm trying to figure out how to fix postinc and postdec for Bools | 02:24 | |
I wanted to ask you how to create a Bool object in Builtins.cs, but that's Kernel.FalseV and Kernel.TrueV, right? | 02:25 | ||
sorear | right. | ||
colomon | I'm very puzzled at the moment because I've somehow managed to fix 2 of the 5 fails. | ||
02:26
shinobicl joined
02:27
Exio is now known as Ex
|
|||
colomon took an embarrassingly long time searching the source to figure out TrueV and FalseV | 02:27 | ||
ah, wait, fixed 2 of 3, the other 2 are something else. | 02:28 | ||
sorear: still there? | 02:32 | ||
sorear | yes. | 02:33 | |
colomon | turns out I fixed the bit I was trying to fix, and it's the other bit that's still wrong | 02:34 | |
can you break down what bit of v.AssignO(o1.mo.mro_succ.Get(v), false) does what? | |||
o1 is the value of the variable... mro_succ gets the next value | 02:35 | ||
but why is Get(v) there? | |||
02:35
leprevost joined
|
|||
colomon | n: my $x = Bool; my $y = $x--; say $x | 02:35 | |
p6eval | niecza v19-5-g75130da: OUTPUT«Potential difficulties: $y is declared but not used at /tmp/EmnF9Ls52Q line 1:------> my $x = Bool; my ⏏$y = $x--; say $xBool()» | ||
colomon | that should be False, as far as I can tell. | 02:36 | |
sorear | colomon: o1.mo.mro_succ returns a ContextHandler<Variable> object that implements succ() | 02:37 | |
colomon: for some of the hottest methods, a vtable-like mechanism is used to avoid the mro_methods hash table | 02:38 | ||
colomon: ContextHandler<Variable> is a virtual class with an abstract method Get(). So you can implement succ() in C# code and it will be directly called | 02:39 | ||
colomon | ah! | ||
sorear | colomon: we could also have used delegates here, but they're measurably slower and a bit less nice from a serialization POV | ||
colomon | There doesn't seem to be a CtxBoolSuccish? | 02:40 | |
sorear | no, there isn't | 02:43 | |
so mro_succ is a CtxCallMethod instance | |||
which forwards the call to Perl 6 code | |||
colomon | which calls.... CommonEnum.succ? | ||
sorear | it's just method succ() { True }, iirc | ||
quite possibly CommonEnum.succ | 02:44 | ||
colomon | yup. | 02:46 | |
okay, I'm going to bed, but I think I know how to sort this now. | 02:47 | ||
sorear++ | |||
02:47
shinobicl left
|
|||
colomon | afk | 02:49 | |
02:53
xinming_ joined
03:07
jaldhar joined
03:09
CRAZEDPSYC is now known as crazedpsyc
03:16
cognominal left
03:19
cognominal joined
03:25
stephenl1 left
03:46
tyatpi left
03:48
tyatpi joined
04:07
leprevost left
04:11
tyatpi left
|
|||
pmichaud | static.happyplace.com/assets/images...2d3d4.jpeg # answers from a new perl 6 programmer? | 04:35 | |
04:37
tyatpi joined
|
|||
cognominal | pmichaud, the exercice does not talk about comparing numbers. That's where the fail lies. | 04:49 | |
04:49
birdwindupbird joined
|
|||
pmichaud | r: print < or >; | 04:50 | |
p6eval | rakudo 39087a: OUTPUT«or» | ||
pmichaud | looks correct to me! :-) | ||
cognominal | TimToady would say something about context. | ||
pmichaud | r: my &Write = &say; Write < or >. | ||
p6eval | rakudo 39087a: OUTPUT«===SORRY!===Confusedat /tmp/_3KEtA7Fel:1» | ||
pmichaud | r: my &Write = &say; Write < or > | ||
p6eval | rakudo 39087a: OUTPUT«or» | ||
cognominal | ho, I forgot about the syntax. You did set up the context. But I am not yet awake. | ||
pmichaud, I guess I will add that jpeg to my fpw presentation | 04:52 | ||
pmichaud | I found it via www.happyplace.com/3907/unintention...m-children | 04:53 | |
04:58
kaleem joined
05:16
fhelmberger joined
05:18
s1n left
|
|||
moritz | \o | 05:33 | |
sorear | o/ | 05:35 | |
cognominal | pmichaud what is the url of your presentation about lists/iterators and laziness? | 05:51 | |
05:51
jaldhar left
|
|||
cognominal | i got it | 06:06 | |
06:19
wtw joined
06:47
cognominal left
06:49
odoacre left
06:51
cognominal joined
06:56
Entonian joined
06:58
Entonian left
07:05
odoacre joined
07:22
cognominal left
07:23
am0c_ joined
07:26
eiro left
|
|||
tadzik | hello from FPW #perl6 | 07:28 | |
07:34
eiro joined
07:41
am0c_ left
07:46
tyatpi left,
adam7504 joined
07:50
yves_ joined
07:54
am0c_ joined
07:58
kresike joined
|
|||
kresike | good morning all you happy perl6 people | 07:58 | |
sorear | good morning kresike | 08:00 | |
08:00
adam7504 left
|
|||
kresike | hello sorear o/ | 08:00 | |
moritz | r: say <a b c>[^10].perl | 08:03 | |
p6eval | rakudo 39087a: OUTPUT«("a", "b", "c")» | ||
moritz | r: say <a b c>.list[^10].perl | ||
p6eval | rakudo 39087a: OUTPUT«("a", "b", "c")» | ||
08:09
MayDaniel joined
08:17
mucker joined
|
|||
moritz | r: say <a b c>.Arry[^10].perl | 08:22 | |
p6eval | rakudo 39087a: OUTPUT«No such method 'Arry' for invocant of type 'Parcel' in block <anon> at /tmp/cGxLbqoyu2:1» | ||
moritz | r: say <a b c>.Array[^10].perl | ||
p6eval | rakudo 39087a: OUTPUT«("a", "b", "c", Any, Any, Any, Any, Any, Any, Any)» | ||
moritz | oh | ||
08:24
am0c_ left
08:25
cj left
08:26
cj joined
08:30
cognominal joined
|
|||
moritz | r: say <a b c> | 08:33 | |
p6eval | rakudo 39087a: OUTPUT«a b c» | ||
08:33
mucker left
|
|||
moritz | r: print <a b c> | 08:33 | |
p6eval | rakudo 39087a: OUTPUT«abc» | ||
moritz | r: my Date $x; say $x; print $x; | 08:38 | |
p6eval | rakudo 39087a: OUTPUT«Date()use of uninitialized variable $v of type Date in string context in block <anon> at /tmp/4Og3VnYutO:1» | ||
dalek | q: 2945628 | moritz++ | answers.md: explain difference between say and print, .Str and .gist |
08:41 | |
08:47
GlitchMr joined
|
|||
dalek | q: 493f417 | moritz++ | answers.md: advocacy tweaking |
08:48 | |
08:50
cognominal left
08:56
am0c_ joined,
brrt joined
09:00
fglock joined
09:01
cognominal joined
09:03
cognominal left
09:12
felher joined,
cognominal joined
09:14
moritz left,
moritz joined
|
|||
dalek | ast: 4214a48 | moritz++ | S32-array/push.t: RT #109476 |
09:16 | |
09:26
cognominal left
09:31
cognominal joined
09:33
thou_ joined
09:35
odoacre left
09:37
thou left
10:00
daxim joined,
cognominal left
10:05
am0c_ left,
cognominal joined
10:09
Guest41876 left
10:10
cognominal left
|
|||
dalek | q: ecfb825 | moritz++ | questions: update questions file with answered questions |
10:22 | |
10:29
spider-mario joined
10:38
GlitchMr left
10:56
snearch joined
|
|||
dalek | ecza: 02206bd | (Solomon Foster)++ | lib/ (2 files): Fix postinc and postdec to properly initialize return values from undefined Bool objects. Add Bool.succ and Bool.pred so we get proper results from Bool. |
11:05 | |
colomon | So, I just had a flash that the spec and our discussion yesterday was all wrong. | 11:06 | |
rn: my $x = Rat; my $y = $x++; say $x.WHAT say $y.WHAT | 11:08 | ||
p6eval | rakudo 39087a: OUTPUT«===SORRY!===Confusedat /tmp/5BRwSxsJ5C:1» | ||
..niecza v19-5-g75130da: OUTPUT«===SORRY!===Two terms in a row (method call requires colon or parens to take arguments) at /tmp/7UUpsp6mjE line 1:------> my $x = Rat; my $y = $x++; say $x.WHAT ⏏say $y.WHATParse failed» | |||
colomon | rn: my $x = Rat; my $y = $x++; say $x.WHAT; say $y.WHAT | 11:09 | |
p6eval | niecza v19-5-g75130da: OUTPUT«Rat()Int()» | ||
..rakudo 39087a: OUTPUT«Int()Int()» | |||
colomon | by the logic we talked about yesterday, those should both be Rat. The spec and both compilers are wrong. | ||
pugs: my $x = Rat; my $y = $x++; say $x.WHAT; say $y.WHAT | |||
p6eval | pugs: OUTPUT«IntInt» | ||
colomon | all three compilers | ||
afk # "yoo hoo daddy, you're good at reading..." | 11:10 | ||
moritz | maybe the spec should say "coerce the 0 to the container type if the container type ~~ Numeric' | 11:17 | |
11:24
safinaskar joined
|
|||
colomon | moritz: exactly my thought | 11:24 | |
safinaskar | rakudo: say 2 + 2 | ||
p6eval | rakudo 39087a: OUTPUT«4» | ||
colomon just read "Knuffle Bunny Too" twice | |||
safinaskar | what is this rakudo and p6eval? | 11:25 | |
moritz | safinaskar: rakudo is a Perl 6 compiler | ||
colomon | rakudo (in this context) is one of a series of nicks which call the p6eval program to run a snippet of Perl 6 | ||
safinaskar | moritz: colomon: thanks | ||
moritz | safinaskar: and p6eval is a but that runs rakudo and other perl 6 compilers with some sample input | ||
colomon | bot | 11:26 | |
moritz | n: say 'niecza also exists' | ||
p6eval | niecza v19-5-g75130da: OUTPUT«niecza also exists» | ||
safinaskar | okey, okey | ||
moritz | erm, yes. :-) | ||
colomon | r: say "and the one letter abbreviations are easier to type" | ||
p6eval | rakudo 39087a: OUTPUT«and the one letter abbreviations are easier to type» | ||
moritz | nrp: say 'and they can be combined :-)' | 11:27 | |
p6eval | rakudo 39087a, niecza v19-5-g75130da, pugs: OUTPUT«and they can be combined :-)» | ||
flussence | quick question: does defining a multi method new() in a class always remove access to the built in one? | 11:28 | |
11:29
safinaskar left
|
|||
moritz | no | 11:30 | |
flussence | rn: class A { has $.v; multi method new(Str $q) { A.new(:v($q)) }; A.new('q'); | ||
p6eval | niecza v19-5-g75130da: OUTPUT«===SORRY!===Unable to parse block at /tmp/Si132pPjrF line 1:------> class A {⏏ has $.v; multi method new(Str $q) { A.nCouldn't find final '}'; gave up at /tmp/Si132pPjrF line 1 (EOF):------> w(Str $q) { A.new(:… | ||
..rakudo 39087a: OUTPUT«===SORRY!===Unable to parse blockoid, couldn't find final '}' at line 2, near ""» | |||
flussence | rn: class A { has $.v; multi method new(Str $q) { A.new(:v($q)) } }; A.new('q'); | ||
p6eval | niecza v19-5-g75130da: OUTPUT«Unhandled exception: Cannot call new; none of these signatures match: A, Str at /tmp/eeAAjaEte6 line 1 (A.new @ 4)  at /tmp/eeAAjaEte6 line 1 (mainline @ 5)  at /home/p6eval/niecza/lib/CORE.setting line 3916 (ANON @ 3)  at /home/p6eval/niecza/li… | ||
..rakudo 39087a: ( no output ) | |||
flussence | oh, maybe it's a nieczabug | 11:31 | |
moritz | it seems to not declare Mu.new a multi | ||
11:33
baest joined
11:45
eiro left
11:46
eiro joined
11:50
jaldhar joined
|
|||
colomon | moritz: are there tests relying on Mu.new being a multi? | 11:50 | |
colomon is trying to see if there is a performance impact of switching right now, but suspects that any spectests which test this must be skipped in niecza right now. | 11:52 | ||
moritz | colomon: I guess there aren't any (or many) tests relying on it | ||
colomon | moritz: is it actually required by the spec? I was under the impression it wasn't, but that may have been as a result of hitting this very bug in Niecza.... | 11:54 | |
moritz | colomon: I don't think it's specced so far, but it should be | 11:55 | |
because it's quite important for user-space code | |||
12:01
GlitchMr joined
|
|||
huf | what's the grammatical mood (or perhaps that's not even the right category name) for sentences like "do take a seat!"? | 12:13 | |
moritz | imperative? | 12:14 | |
erm | |||
imperative! | |||
huf | i'm actually trying to find out what "do" is doing there | 12:15 | |
and what happened to the form "do you take a seat!" | |||
which i found while reading sherlock holmes | |||
moritz | it's kind of an emphasis | ||
not sure if there's a grammatical name for it; I'm not a linguist :-) | |||
huf | yeah, that's how far i got ;) | ||
i was hoping fishing in this channel would get me a linguist :D | |||
moritz | I hope arnsholt (where is that guy when you need him?) or TimToady or so know :-) | 12:16 | |
huf | i found this: en.wikipedia.org/wiki/Hortative | ||
but it doesnt appear to be what i'm looking for | |||
dalek | ecs: 13a69e8 | moritz++ | S32-setting-library/Basics.pod: [S32] Mu cleanup Mu is a class, not a role. There is no need for an undefine method. new() must be a multi method |
12:18 | |
moritz | colomon: there, now it's specced | ||
colomon | moritz: the change appears to not hurt Niecza's performance, so I'd be glad to make it, if you'd change the .... wait, you just did! | ||
moritz | colomon: :-) | ||
colomon | you actually pushed the change while I was typing that sentence! awesome! | 12:19 | |
now if we can just figure out some tests... | |||
moritz | I'll add some to S12-construction/new.t | 12:20 | |
colomon | moritz++ | ||
dalek | ecza: 5e25209 | (Solomon Foster)++ | lib/CORE.setting: Make Mu.new a multi method. |
||
12:20
brrt left,
tyatpi joined
|
|||
dalek | ast: d578243 | moritz++ | S12-construction/new.t: test that Mu.new is a multi method |
12:23 | |
flussence | colomon++ moritz++ | 12:25 | |
colomon | moritz: in your NewFromMu test, should you be declaring NewFromMu.new to be a multi? | 12:28 | |
oh, I see you did that in the next one... | 12:29 | ||
huh. I declared Mu.new to be a multi method, but it doesn't see to help with the tests at all. | 12:31 | ||
moritz | n: class A { has $.a; multi method new($a) { $.new(:$a) } }; say A.new(a => 42).a | 12:33 | |
p6eval | niecza v19-6-g02206bd: OUTPUT«Unhandled exception: Cannot call new; none of these signatures match: A, Any at /tmp/HbOOelBYuG line 1 (mainline @ 5)  at /home/p6eval/niecza/lib/CORE.setting line 3918 (ANON @ 3)  at /home/p6eval/niecza/lib/CORE.setting line 3919 (module-CORE @ 5… | ||
moritz | that's still the old version | ||
colomon: what does that do on an up-to-date niecza? | |||
12:53
smash_ is now known as smash
|
|||
colomon | Cannot call new; none of these signatures match: | 12:54 | |
A, Any | |||
moritz | huh | 12:55 | |
looks like it doesn't consider the one from Mu | |||
there isn't another 'new' method in Any, by chance? | |||
masak | hi from FPW! | 12:56 | |
masak just gave his talk | |||
moritz | \o | ||
masak: what did you talk about? | |||
macros? | |||
masak | aye. | 12:57 | |
slightly refurbished talk. | |||
but basically the same. | |||
colomon | heh, there are method news all over the place in Niecza. | 13:01 | |
13:01
kaleem left
|
|||
colomon | none of which are Any.new, as far as I can see. | 13:01 | |
I need to get going, need to take the little guy to www.traindoctor.com/GLBTE_poster.pdf | 13:02 | ||
13:02
kaleem joined
|
|||
masak read "GLBTE" as gay/lesbian/bi/trans/extraterrestrial | 13:04 | ||
huf | huh. | 13:06 | |
i just assumed it's some lgbt thing too | |||
13:10
Psyche^ joined
13:14
kaleem left,
Patterner left,
Psyche^ is now known as Patterner,
snearch left
13:20
Gesh joined
|
|||
colomon | "Great Lakes Bay" is a terrible name for our area... as if there is only one bay in the Great Lakes. | 13:20 | |
PerlJam | colomon: obviously there' only one of any importance ;) | 13:21 | |
moritz | obviously there's one with first claim on the name :-) | 13:23 | |
PerlJam | perhaps not first, but certainly most vociferous :) | ||
colomon | as far as I know, our area only started using the name in the last decade. but maybe no one else grabbed the URL before them... | 13:37 | |
13:42
pupoque joined,
evgeny joined,
[hds] joined
13:43
pupoque left,
Gesh left,
evgeny left
13:48
sisar joined
13:52
alvis left
13:53
mikemol joined
13:57
JimmyZ joined
|
|||
JimmyZ | qore.org/ # Perl-ish language? | 13:58 | |
Perl6-ish | 13:59 | ||
14:05
Pleiades` left
14:08
MayDaniel left
|
|||
[hds] | The "short description" of the language is way too long. | 14:10 | |
14:10
Pleiades` joined
14:13
jaldhar left
14:15
Pleiades` left
14:16
PacoAir joined
|
|||
moritz | pseudo-methods - so each type now has a "pseudo-class" whose methods can be run on any value of that type (ex: "this is a string".size()) | 14:19 | |
erm, how does that differ from any normal method? | |||
anyway, looks interesting | 14:20 | ||
PerlJam | that's a warning sign | ||
14:21
fgomez joined
|
|||
PerlJam | "these are faked up method-like things that aren't really methods" | 14:21 | |
kresike | could use some interpolation | 14:24 | |
kresike dislikes printf | 14:25 | ||
14:45
jaldhar joined
14:47
kaleem joined,
fhelmberger left
14:54
jaldhar left
14:57
wtw left
|
|||
sirrobert | Is there a perl6 equivalent to javascript's ".hasOwnProperty" method? | 15:16 | |
(testing to see if an object has a property/method) | |||
timotimo | you can check .^methods, can't you? | 15:17 | |
moritz | .can('methodname') | ||
timotimo | that sounds better actually | ||
sirrobert | great, thanks | ||
moritz | note that attributes are only exposed to the outside via getter/setter methods | ||
sirrobert | righto | ||
moritz | r: class A { has $.x }; say so A.can('x') | 15:18 | |
p6eval | rakudo 39087a: OUTPUT«True» | ||
moritz | r: class A { has $.x }; say A.can('x') | ||
p6eval | rakudo 39087a: OUTPUT«x» | ||
moritz | r: class A { has $.x }; say A.can('x').WHAT | ||
p6eval | rakudo 39087a: OUTPUT«Parcel()» | ||
moritz | r: class A { has $.x }; say A.can('x')[0].WHAT | ||
p6eval | rakudo 39087a: OUTPUT«Method()» | ||
sirrobert | huh... what's a parcel? | ||
moritz | parenthesis cell. Something list-y | 15:19 | |
if you write (1, 2, 3) that's a Parcel | |||
sirrobert | ah, ok | ||
PerlJam | except it's not the parens that make the parcel | ||
moritz | and it's immutable, unless you put variables into it | 15:20 | |
my ($x, $y) = (2, 3)# here the ($x, $y) is an immutable parcel, but you can still assign to the variables inside the parcel | |||
timotimo | oh, interesting. .can('x') will give all multi-methods called x, yes? | 15:21 | |
sirrobert | hmmm... interesting. | ||
moritz | timotimo: I... think so | ||
r: class A { multi method x() { }; multi method x() { }}; say A.can('x').elems | |||
p6eval | rakudo 39087a: OUTPUT«1» | ||
moritz | hm, no | ||
those are grouped inside a proto method | |||
r: class A { multi method x() { }; multi method x() { }}; say A.can('x').candidates.elems | |||
p6eval | rakudo 39087a: OUTPUT«No such method 'candidates' for invocant of type 'Parcel' in block <anon> at /tmp/J767OIoA88:1» | ||
moritz | r: class A { multi method x() { }; multi method x() { }}; say A.can('x')[0].candidates.elems | 15:22 | |
p6eval | rakudo 39087a: OUTPUT«2» | ||
moritz | r: class A { method x() { } }; class B is A { method x {} }; say B.can('x').elems | ||
p6eval | rakudo 39087a: OUTPUT«2» | ||
moritz | ah | ||
it returns all methods from the class hierarchy in mro order | |||
sirrobert | mro? | 15:23 | |
moritz | method resolution order | ||
sirrobert | ah | ||
wow, that's coool | |||
moritz | r: say Str.^mro | ||
p6eval | rakudo 39087a: OUTPUT«Str() Cool() Any() Mu()» | ||
timotimo | and for each candidate i can query which class it comes from, yes? | 15:24 | |
moritz | hmmm | ||
r: class A { method x() { } }; class B is A { method x {} }; say B.can('x')[0].signature.parameters[0].perl | |||
p6eval | rakudo 39087a: OUTPUT«No such method 'parameters' for invocant of type 'Signature' in block <anon> at /tmp/Ny1aRJOFpj:1» | ||
moritz | r: class A { method x() { } }; class B is A { method x {} }; say B.can('x')[0].signature.params[0].perl | 15:25 | |
p6eval | rakudo 39087a: OUTPUT«B » | ||
timotimo | also: what's the use of two multi methods with the exact same signature? | ||
moritz | r: class A { method x() { } }; class B is A { method x {} }; say B.can('x')[0].signature.params[0].type | ||
p6eval | rakudo 39087a: OUTPUT«B()» | ||
moritz | that way you can get at the invocant type | ||
timotimo | will the one defined earlier be used and it could delegate to the next one will nextsame or something like that? | ||
moritz | timotimo: no, there will be an ambiguous dispatch | 15:26 | |
timotimo: that was just for illustration | |||
timotimo | ambiguous dispatch means the compiler will yell at me? | ||
moritz | timotimo: although you can call $obj.*x() and call all matching methods | ||
yes | |||
r: multi a() { }; multi a() { }; a() | |||
p6eval | rakudo 39087a: OUTPUT«Ambiguous call to 'a'; these signatures all match::():() in block <anon> at /tmp/AIk854ml5d:1» | ||
timotimo | perl is weird sometimes :) | ||
15:27
JimmyZ left
|
|||
moritz is also weird sometimes | 15:27 | ||
:-) | |||
timotimo | if i can use .* to call all matching methods, how do i do it with multi subs? | ||
moritz | you cannot | ||
timotimo | OK | ||
moritz | except... | ||
you can abuse subs as methods | 15:28 | ||
timotimo | r: class A { method a() { say "foo"; 1; }; method a() { say "blergh"; 10; }; say A.new().*a() | ||
p6eval | rakudo 39087a: OUTPUT«===SORRY!===Package 'A' already has a method 'a' (did you mean to declare a multi-method?)at /tmp/MrSB0850m_:1» | ||
timotimo | r: class A { multi a() { say "foo"; 1; }; multi a() { say "blergh"; 10; }; say A.new().*a() | ||
p6eval | rakudo 39087a: OUTPUT«===SORRY!===Unable to parse blockoid, couldn't find final '}' at line 2, near ""» | ||
timotimo | r: class A { multi a() { say "foo"; 1; }; multi a() { say "blergh"; 10; }; } say A.new().*a() | ||
p6eval | rakudo 39087a: OUTPUT«===SORRY!===Confusedat /tmp/updzJbhHaP:1» | ||
moritz | r: multi a($, $?) { 1 }; multi a($) { 2 }; say Any.*&a() | ||
p6eval | rakudo 39087a: OUTPUT«Ambiguous call to 'a'; these signatures all match::(, ):() in sub a at /tmp/kJ7OMJcERz:1 in method dispatch:<.*> at src/gen/CORE.setting:864 in block <anon> at /tmp/kJ7OMJcERz:1» | ||
timotimo | r: class A { multi a() { say "foo"; 1; }; multi a() { say "blergh"; 10; }; }; say A.new().*a() | ||
p6eval | rakudo 39087a: OUTPUT«» | ||
moritz | hm, seems .* doesn't mix with sub-as-method abuse | ||
timotimo | .* also doesn't seem to work at all | 15:29 | |
moritz | timotimo: you need to write 'multi method' | ||
timotimo | oh, ok | ||
r: class A { multi method a() { say "foo"; 1; }; multi method a() { say "blergh"; 10; }; }; say A.new().*a() | |||
p6eval | rakudo 39087a: OUTPUT«Ambiguous call to 'a'; these signatures all match::(A , Mu *%_):(A , Mu *%_) in method a at src/gen/CORE.setting:320 in method dispatch:<.*> at src/gen/CORE.setting:864 in block <anon> at /tmp/UPlVRbwFBn:1» | ||
moritz | timotimo: right now you have two multi subs, and .* cannot find any matching methods, and is happy with it | ||
hm | |||
maybe I'm wrong about how .* works | 15:30 | ||
and it only works on only-methods | |||
timotimo | how does "call every candidate" translate to only methods? will it call each candidate in the mro? | 15:31 | |
moritz | yes | ||
15:35
Pleiades` joined
15:38
fglock left
15:39
domidumont left
|
|||
kresike | bye all | 15:40 | |
15:40
kresike left
15:42
Pleiades` left
15:47
MayDaniel joined
|
|||
sirrobert | does Test.pm have some version of no_plan? | 15:57 | |
15:59
birdwindupbird left
16:03
kaleem left
16:06
birdwindupbird joined
16:21
Pleiades` joined
|
|||
pmichaud | good morning, #perl6 | 16:26 | |
sirrobert: (no_plan) I think it's 'plan *' | |||
see lib/Test.pm:32 | |||
GlitchMr | perl6: my $variable = 'the cake'; print $$$$$$$variable; | 16:27 | |
pmichaud | # "plan 'no_plan';" is now "plan *;" | ||
# It is also the default if nobody calls plan at all | |||
p6eval | rakudo 39087a, niecza v19-7-g5e25209: OUTPUT«the cake» | ||
16:27
vmspb joined
|
|||
GlitchMr | So, pugs was removed? | 16:27 | |
pmichaud | pugs: my $variable = 'the cake'; print $$$$$$$variable; | ||
p6eval | pugs: OUTPUT«the cake» | ||
pmichaud | pugs is just not in the default 'perl6:' set | ||
but you can also do | |||
GlitchMr | I guess it's because I convert scalar into scalar | ||
pmichaud | npr: my $variable = 'the cake'; print $$$$$$$variable; | 16:28 | |
p6eval | rakudo 39087a, niecza v19-7-g5e25209, pugs: OUTPUT«the cake» | ||
sorear | good * #perl6 | 16:30 | |
mmm npr. | |||
pmichaud | moritz++ # faq.perl6.org | 16:32 | |
tadzik | hello #perl6 | 16:34 | |
sorear | hello tadzik. | ||
dalek | o: d3123ea | tadzik++ | bin/ufo: Make it work after &dir changes |
16:35 | |
pmichaud | ...are we sure the &dir changes are going to stay? | ||
tadzik | I feel sort of uneasy about them | 16:36 | |
especially the "what used to work now needs basename()" bit | |||
16:36
[hds] left
|
|||
pmichaud | yeah | 16:36 | |
tadzik | r: for ^1 { when 1 { .path } } | 16:38 | |
p6eval | rakudo 39087a: ( no output ) | ||
tadzik | r: for ^1 { when 1 { say .path } } | ||
p6eval | rakudo 39087a: ( no output ) | ||
masak | doesn't seem to be reproducible. | ||
maybe it's been fix'd in recent rakudos. | 16:39 | ||
tadzik | no, this one doesn't work either | ||
hold on | |||
pmichaud | right now I'm feeling more like I want to leave &dir as it was (perhaps working towards phasing it out entirely) and introduce a new function or method that is the improved version. | ||
masak | +1 | ||
tadzik | for Range.new(0, 1) -> $p { when $p { say $_.perl; say $_.path } } | 16:40 | |
masak | &dir has been widely popular, but I think we can do better. | ||
tadzik | r: for Range.new(0, 1) -> $p { when $p { say $_.perl; say $_.path } } | ||
p6eval | rakudo 39087a: OUTPUT«use of uninitialized variable $a of type Any in numeric context in block <anon> at /tmp/bhcZACNkRT:1Null PMC access in find_method('perl') in block <anon> at /tmp/bhcZACNkRT:1 in method reify at src/gen/CORE.setting:5079 in method reify at src/gen/CORE.set… | ||
tadzik | there we are | ||
masak submits rakuodbug | |||
rakudobug* :) | |||
pmichaud | ...why is that a bug, ooc? | ||
masak | pmichaud: Null PMC access | ||
tadzik | NPA | ||
pmichaud | oh, I see. | ||
masak | r: for ^1 -> $p { when $p { .foo } } | 16:41 | |
p6eval | rakudo 39087a: OUTPUT«use of uninitialized variable $a of type Any in numeric context in block <anon> at /tmp/HzMxDYTCaC:1Null PMC access in find_method('foo') in block <anon> at /tmp/HzMxDYTCaC:1 in method reify at src/gen/CORE.setting:5079 in method reify at src/gen/CORE.sett… | ||
timotimo | that's more interesting | ||
pmichaud | ...variable $a, hmm. | 16:42 | |
tadzik | that's usual | 16:43 | |
it says random names when it doesn't know the real one | |||
pmichaud | they aren't "random" | ||
tadzik | I've noticed that a few times already | ||
yeah, I know | |||
pmichaud | they're internal to CORE | ||
tadzik | I think it catches the name... right | ||
pmichaud | r: use fatal; for ^1 -> $p { when $p { .foo } } | ||
p6eval | rakudo 39087a: OUTPUT«use of uninitialized variable $a of type Any in numeric context in block <anon> at /tmp/VxGqGx5w3a:1Null PMC access in find_method('foo') in block <anon> at /tmp/VxGqGx5w3a:1 in method reify at src/gen/CORE.setting:5079 in method reify at src/gen/CORE.sett… | ||
pmichaud | oh, it's the .ACCEPTS bug | 16:45 | |
masak | oh? | ||
pmichaud | sure, it's the when $p that is attempting to convert Any into a number | ||
in order to smart match it against $p | |||
masak | the interesting thing is that the Range, the 'when' and the $_.foo call are all irreducible parts of triggering the bug. | ||
remove any of them, and the Null PMC Access disappears. | 16:46 | ||
pmichaud | r: for (0,1) -> $p { when $p { .foo } } | ||
p6eval | rakudo 39087a: OUTPUT«use of uninitialized variable $a of type Any in numeric context in block <anon> at /tmp/VgCIK_kuoP:1Null PMC access in find_method('foo') in block <anon> at /tmp/VgCIK_kuoP:1 in method reify at src/gen/CORE.setting:5079 in method reify at src/gen/CORE.sett… | ||
masak | maybe not. :) | ||
pmichaud | r: for 0 -> $p { when $p { .foo } } | ||
masak | ok, the Range is not essential, then. | ||
p6eval | rakudo 39087a: OUTPUT«use of uninitialized variable $a of type Any in numeric context in block <anon> at /tmp/2BcvX6lmnC:1Null PMC access in find_method('foo') in block <anon> at /tmp/2BcvX6lmnC:1 in method reify at src/gen/CORE.setting:5079 in method reify at src/gen/CORE.sett… | ||
masak | huh. | ||
tadzik: I'm pretty sure we tested that. | |||
hm. | 16:47 | ||
pmichaud | given 0 -> $p { when $p { .foo } } | ||
r: given 0 -> $p { when $p { .foo } } | |||
p6eval | rakudo 39087a: OUTPUT«use of uninitialized variable $a of type Any in numeric context in block <anon> at /tmp/SJ1JbHQSej:1Null PMC access in find_method('foo') in block <anon> at /tmp/SJ1JbHQSej:1 in block <anon> at /tmp/SJ1JbHQSej:1» | ||
tadzik | masak: yeah, same. Odd | ||
pmichaud | (-> $p { when $p { .foo } }).(0) | ||
r: (-> $p { when $p { .foo } }).(0) | |||
p6eval | rakudo 39087a: OUTPUT«use of uninitialized variable $a of type Any in numeric context in block <anon> at /tmp/5zdWF1O_Fa:1No such method 'foo' for invocant of type 'Any' in block <anon> at /tmp/5zdWF1O_Fa:1 in block <anon> at /tmp/5zdWF1O_Fa:1» | ||
masak | there. it disappeared. | ||
I think iteration is involved somehow, anyway. | |||
pmichaud | well, not with 'given' | 16:48 | |
there's no iteration with the .given | |||
masak | hm, troo. | ||
so, why does it trigger with 'for' and 'given', but not with that last one, with a block? | |||
pmichaud | r: my $ps = -> $p { when $p { .foo } }; $ps(0); | ||
p6eval | rakudo 39087a: OUTPUT«use of uninitialized variable $a of type Any in numeric context in block <anon> at /tmp/Ap9xU9dVVo:1No such method 'foo' for invocant of type 'Any' in block <anon> at /tmp/Ap9xU9dVVo:1 in block <anon> at /tmp/Ap9xU9dVVo:1» | ||
pmichaud | 0.map( -> $p { when $p { .foo } }).eager | 16:49 | |
r: 0.map( -> $p { when $p { .foo } }).eager | |||
p6eval | rakudo 39087a: OUTPUT«use of uninitialized variable $a of type Any in numeric context in block <anon> at /tmp/JRkifpk737:1No such method 'foo' for invocant of type 'Any' in block <anon> at /tmp/JRkifpk737:1 in method reify at src/gen/CORE.setting:5079 in method reify at src/gen… | ||
pmichaud | the NPA has to be something in the way the closures are being built when part of 'for' or 'given' | 16:50 | |
which means it's a bug in <xblock> | |||
(in Actions.pm) | |||
here's another, then | |||
r: if 1 -> $p { when $p { .foo } } | |||
p6eval | rakudo 39087a: OUTPUT«use of uninitialized variable $a of type Any in numeric context in block <anon> at /tmp/C8Mba0rmGT:1» | ||
pmichaud | hmm. | ||
r: while 1 -> $p { when $p { .foo }; } | 16:51 | ||
oops | |||
p6eval | rakudo 39087a: OUTPUT«(timeout)use of uninitialized variable $a of type Any in numeric context in block <anon> at /tmp/h2Ig9XgW2m:1use of uninitialized variable $a of type Any in numeric context in block <anon> at /tmp/h2Ig9XgW2m:1use of uninitialized variable $a of type Any in nu… | ||
pmichaud | okay, so, the "unintialized variable $a..." is coming from an ACCEPTS call | 16:52 | |
I'm guessing it's this one: | |||
src/core/Numeric.pm:4: multi method ACCEPTS(Numeric:D: $a) { | |||
The NPA is because the pointy block is somehow getting the wrong outer $_ | 16:53 | ||
masak | ah. | 16:54 | |
pmichaud | but only when being used as part of 'for' or 'given' (so far... could be other structures) | ||
r: $_ = 'hello'; if 1 -> $p { when $p { .say } } | 16:55 | ||
p6eval | rakudo 39087a: OUTPUT«Cannot convert string to number: base-10 number must begin with valid digits or '.' in '⏏hello' (indicated by ⏏) in method Numeric at src/gen/CORE.setting:9480 in sub infix:<==> at src/gen/CORE.setting:2509 in sub infix:<==> at src/gen/CORE.setting:2509 in … | ||
pmichaud | r: $_ = Bool; if 1 -> $p { when $p { .say } } | 16:56 | |
p6eval | rakudo 39087a: OUTPUT«use of uninitialized variable $a of type Bool in numeric context in block <anon> at /tmp/amepJyEJYf:1» | ||
pmichaud | r: Bool.say | ||
p6eval | rakudo 39087a: OUTPUT«Bool()» | ||
pmichaud | *there* | ||
masak | \o/ | 16:57 | |
pmichaud | the .say got a $_ that isn't the one with the Bool | 16:58 | |
even though the one with the Bool is the one that was used for the smartmatching 'when' | |||
masak | I'm lost, but I'm including this in the report anyway :P | ||
pmichaud | please do, it's pretty well golfed. | 16:59 | |
masak | pmichaud++ | ||
pmichaud | or, more directly: | ||
r: $_ = Bool; .say ; if 1 -> $p { when $p { .say } } | |||
p6eval | rakudo 39087a: OUTPUT«Bool()use of uninitialized variable $a of type Bool in numeric context in block <anon> at /tmp/aXNaM4d6Ty:1» | ||
pmichaud | the second .say isn't the same as the first. | ||
masak | & | 17:01 | |
17:11
alvis joined
17:13
birdwindupbird left
17:17
oftl joined
|
|||
pmichaud | phenny: tell moritz should the faq be listed on perl6.org somewhere? (e.g., the front page might be good?) | 17:18 | |
phenny | pmichaud: I'll pass that on when moritz is around. | ||
sirrobert | is there a difference between .pm and .pm6? | 17:19 | |
17:20
Je joined
17:21
alester joined
17:25
Je left
17:27
Je joined
|
|||
moritz | pmichaud: faq.perl6.org was kind of an underground project so far | 17:27 | |
phenny | moritz: 17:18Z <pmichaud> tell moritz should the faq be listed on perl6.org somewhere? (e.g., the front page might be good?) | ||
pmichaud | moritz: okay, that's fine with me. | ||
moritz | pmichaud: if people like it, we should link to it. If not, we should improve it :-) | ||
pmichaud | I'll work on the improving it part a bit. | 17:28 | |
I like it, fwiw. | |||
moritz | \o/ | ||
I've also got a private email from finanalyst who liked it too | |||
17:30
xinming_ left
|
|||
sirrobert | What's a good paradigm for writing a class that has provides a standard set of objects. | 17:31 | |
for example: an HTTP status class that gives you objects like $status.code; $status.definition | |||
(and there's a defined list). Or error codes | |||
17:32
smash left
17:33
Je left
|
|||
sisar | sirrobert: afaik, there is no difference between .pm and .pm6. Modules can have either extension. | 17:33 | |
giving Perl6 modules a .pm6 is (maybe) a good idea. ( for eg .STD.pm6) | 17:35 | ||
sirrobert | sisar: thanks =) | ||
17:37
xinming joined
|
|||
sisar | moritz: in S32/Exception, the X::Hash::Store::OddNumber entry, "Thrown when hash assignment finds a trailing hash key with a value."... s/with/without ? | 17:39 | |
pmichaud | just as an initial comment, I find it very difficult to decipher the X::... entries in CORE.setting when I encounter them. | 17:40 | |
it makes the code much less readable, imho. | 17:43 | ||
a good example is Str.pm:547, which basically reads | |||
else { | |||
X::Str::Match::x.new(got => $x).throw; | |||
} | |||
I have no idea what error condition is being detected there. Compare to: | |||
else { | 17:45 | ||
die "Invalid argument to :x, must be Int or Range, got type {$x.^name}"; | |||
} | |||
17:46
mucker joined
|
|||
pmichaud | I understand (and mostly agree with) the rationale for typed exceptions... but it feels like we could do much better. | 17:46 | |
sisar | pmichaud: you seem to have the same question which oetiker++ asks here: github.com/rakudo/rakudo/pull/59#d...on_r505731 | 17:48 | |
pmichaud | I think I would *much* prefer something like | ||
well.... maybe not | |||
the advantage of having exception classes declared centrally is that it's easier to find them all and perhaps provide localizations | 17:49 | ||
at least, that's the advantage I would envision. | |||
Still, "X::Str::Match::x" tells me very little about the exception being raised. | 17:50 | ||
sisar | pmichaud: yes that is one big advantage, but it tells very little... yes, what you said. | ||
flussence | it's hard for me to make sense of that example even in context :/ | 17:52 | |
why's the type check done that way, and not in the signature? | 17:53 | ||
moritz | because type checks from signatures give very unspecific error messages | ||
flussence | ah | ||
sorear | o/ moritz | 17:54 | |
moritz | \o sorear | ||
flussence | would be nice if there were a way to say "throw this instead of the generic exception in this scope"... | ||
pmichaud | r: $_ = Bool; .say ; if 1 -> $p { when $p { .say } } | 17:56 | |
p6eval | rakudo 39087a: OUTPUT«Bool()use of uninitialized variable $a of type Bool in numeric context in block <anon> at /tmp/0juX88KhmQ:1» | ||
pmichaud | r: $_ = Bool; .say ; if 1 -> $p { when $p { say 'matched'; .say; } } | ||
p6eval | rakudo 39087a: OUTPUT«Bool()use of uninitialized variable $a of type Bool in numeric context in block <anon> at /tmp/Xp2KfnzIoF:1» | ||
pmichaud | r: $_ = Bool; .say ; unless 0 -> $p { when $p { say 'matched'; .say; } } | 17:57 | |
p6eval | rakudo 39087a: OUTPUT«Bool()use of uninitialized variable $a of type Bool in numeric context in block <anon> at /tmp/quU8s4LhiS:1matchedBool()» | ||
pmichaud | never mind, my earlier 'if' example didn't prove anything. | ||
moritz | flussence: that's what CATCH is for | 17:58 | |
flussence: but it's usually a terrible idea | |||
pmichaud | r: $_ = Bool; for ^1 -> $p { when $p { say 'matched'; $_.say; } }; | ||
p6eval | rakudo 39087a: OUTPUT«use of uninitialized variable $a of type Bool in numeric context in block <anon> at /tmp/zEMNrAQfoT:1matchedNull PMC access in find_method('say') in block <anon> at /tmp/zEMNrAQfoT:1 in method reify at src/gen/CORE.setting:5079 in method reify at src/gen/… | ||
moritz | flussence: because you can never pin-point the location sufficiently enoguh | ||
flussence: you only seldomly see the actual location of an exception in a lexical scope; usually it's from a dynamic scope inside a lexical scope | 17:59 | ||
which means that anything "down the stack" gets caught | |||
pmichaud updates #113904. | 18:04 | ||
18:10
mikemol left
18:11
Chillance joined
18:19
akshay_ joined
18:20
akshay_ left
|
|||
TimToady wonders what will happen if the next implementation is named "rpn" or some such... | 18:23 | ||
pmichaud | We'll adjust somehow. :) | ||
au | npr: say [*] 1..3 | 18:25 | |
p6eval | rakudo 39087a, niecza v19-7-g5e25209, pugs: OUTPUT«6» | ||
18:31
pupoque joined
|
|||
pmichaud | au: o/ | 18:33 | |
sorear | au!! o/ | ||
au | o/ | 18:40 | |
18:42
je joined
|
|||
sirrobert | What are the class methods to use to define string context for print and say? | 18:42 | |
sorear | .Str and .gist, respectively | 18:43 | |
sirrobert | ah, thanks | ||
sorear | it's amusing to see je and thou_. | ||
thou_ | o/ | 18:44 | |
18:44
thou_ is now known as thou
|
|||
TimToady | "do" is a proverb that, in "do take a seat", serves as an intensifier, since the "take" is also there | 18:44 | |
huf | hmm | 18:45 | |
TimToady: when did the form "do you take a seat" fall out of usage? is it even the same thing? | |||
or a more intense version of the same | |||
TimToady is not a historical linguist; could never remember the examples... | 18:47 | ||
huf | :) | ||
sorear | although for completeness we need tu and I | ||
pmichaud | these spectests look wrong to me... | 18:48 | |
huf | so this is still just... imperative mood, with an intensifier? | ||
pmichaud | # numeric context on undefined values | ||
ok($foo == 0, "Any == 0"); | |||
ok(@foo[0] == 0, "Array Any == 0"); | |||
anyone agree? | |||
18:48
daxim left
|
|||
sirrobert | huf: yes; the "do" adds the connotation of insistance | 18:48 | |
pmichaud | (I think comparing Any == 0 should produce a warning or failure) | ||
sirrobert | huf: they're denotatively equivalent | 18:49 | |
sorear | pmichaud: it is very traditional Perl behavior that undefined values act as "" or 0 depending on context | ||
pmichaud: warning, not failure | |||
pmichaud | sorear: it's also traditional that they warn. | ||
sorear | ok() ignores warnings | ||
TimToady | "do" is perhaps more properly called a "propredicate", since its antecedent is the whole action: " | ||
"Shall I take a seat?" "Please do." | |||
it stands in for "take a seat", not just "take" | |||
pmichaud | note that failures can also act as "" or 0 depending on context | 18:50 | |
ok() doesn't ignore warnings, fwiw. | 18:52 | ||
(it doesn't fail on warnings, but they still show up) | 18:53 | ||
I'm fine if we say that type objects warn (versus fail) on stringification/numification. I'd just like to know the use case or rationale for treating them differently from other forms of numification. | 18:54 | ||
I think I'd also like a pragma that increases the strictness of such numification; i.e., that treats numification of undef as a fail instead of a warn (but still falls short of being fatal) | 18:55 | ||
btw, the context for this is getting Any ~~ 0 to dtrt | 18:56 | ||
sirrobert | What's the best way to implement a two-way lookup in perl6? | 18:57 | |
instead of a hash (values and keys are both unique and should be able to look each other up) | 18:58 | ||
18:58
bluescreen10 joined
|
|||
TimToady | my %revhash = %hash.invert; # if there are no dups | 19:00 | |
sisar just recompiled parrot, rakudo, nqp from scratch because of the oh-so annoying 'Wrong or missing version of dependency...' error :( | |||
sirrobert | TimToady: thanks | ||
sisar | "perl Configure.pl --gen-parrot" was not able to remove the "Wrong or missing ...." error. I had to reclone everyting and build from scratch. | 19:02 | |
pmichaud | could be a missing dependency somewhere. | 19:03 | |
sisar | pmichaud: like ? | ||
pmichaud | sisar: I don't know; trying it with MODULE_DEBUG set would probably give more clues. | 19:04 | |
I'd also need to know what you were running. | |||
(i.e., what 'perl6' command were you doing?) | |||
sisar | pmichaud: now ican't try it, I cleaned everything. | ||
pmichaud: i did (more) | 19:05 | ||
moritz | you might need rm -rf ~/.perl6/lib install/ ~/.panda/ | ||
pmichaud | sisar: right... so, we can find out more the next time it occurs. But "Wrong or missing version of dependency" by itself isn't sufficient to know what dependency may be broken. :) | ||
19:06
je left
|
|||
moritz | the proper error message would be "Trying to load $pirfile for module $module, but it was precompiled with a different rakudo version" | 19:06 | |
pmichaud | (Any.Numeric) another possibility is that Any.Numeric always returns a Failure, but it's marked as already handled so that the exception isn't thrown. | 19:07 | |
TimToady | "but it was compiled with version X instead of version Y" | ||
pmichaud | moritz: +1 | ||
TimToady: +1 | |||
sisar | pmichaud: oh that error I have in my terminal log. It always says "Missing or wrong version of dependency 'src/stage2/QRegex.nqp' current instr.: '' pc 496 (src/gen/perl6.pir:200) (src/main.nqp src/gen/main-version.nqp:0)" | 19:08 | |
pmichaud | although "version X" doesn't quite fit in this context. | ||
it's not version so much as "compilation instance" | |||
sisar: I'd still need to see what was loading it and where. | |||
sisar | pmichaud: ok, next time I encounter it, i'll use the MODULE_DEBUG option. How do I set it ? | 19:09 | |
pmichaud | export MODULE_DEBUG=1 | ||
I think | |||
moritz | TimToady: that might cause confusion when the two different versions don't have different version identifier | ||
export RAKUDO_MODULE_DEBUG=1 | |||
TimToady | then the version identifier doesn't identify a version :P | ||
moritz | well | 19:10 | |
that's correct | |||
sisar | pmichaud, moritz: these are env variables ? | ||
pmichaud | but it was precompiled with a different rakudo instance | ||
moritz | sisar: yes | ||
sisar | ok | ||
thhanks | |||
pmichaud | "...but it was precompiled with a different rakudo binary' | ||
moritz | +1 | 19:11 | |
pmichaud | although in some cases it also has to be "...but it was precompiled with a different nqp binary" | 19:12 | |
actually, it's not the binaries that make the difference. | |||
sirrobert | what can I read about best practices for throwing errors? | ||
moritz | sirrobert: there's not much literature on the subject yet | 19:13 | |
sirrobert: what do you want to know? | |||
sirrobert | I've got a dictionary that basically has valid codes and their meanings. I want to throw an error if someone tries to use a code that's not in the dictionary. | ||
pmichaud | "Trying to load module $module with signature $sig, but the one I found at $pirfile has signature $sig." | 19:14 | |
*that's* really what we want. | |||
sirrobert | if (!%CODE.exists($code)) { ...? } | ||
I don't even know what syntax I should use inside the if there =) | |||
moritz | class X::YourApp::NoSuchCode is Exception { has $.code; method message { "trying to access YourApp-code $.code, but it does not exist" } }; | 19:15 | |
pmichaud | sirrobert: p5ish would be die "error" unless %CODE.exists($code) | ||
moritz | if (!%CODE.exists($code)) { X::YourApp::NoSuchCode.new(:$code).throw } | ||
sirrobert | what is X::? is that something I should fill in? | ||
pmichaud | X is the exceptions namespace | ||
sirrobert | ohh | ||
moritz | no, it's the namespace we use for exceptions | 19:16 | |
pmichaud | it's a literal 'X' | ||
moritz | YourApp is something you should fill in :-) | ||
sirrobert | heh nod | ||
it's just in library class. I suppose I can make it arbitrarily long? =) | |||
pmichaud | moritz: does fail X::YourApp::NoSuchCode work? | ||
moritz | pmichaud: fail X::YourApp::NoSuchCode.new works | ||
pmichaud | how about X::YourApp::NoSuchCode.new.fail ? | 19:17 | |
moritz | that's harder to do | ||
doesn't work right now | |||
pmichaud | oh yes, that would be quite a bit harder. | ||
TimToady | sirrobert: one should generally fail rather than throw if there's any chance the caller wants to handle failure that way | ||
pmichaud | yes, if we're keeping Failure, then the canonical "error handler" should be "fail something" and not X::Something.new.throw | 19:18 | |
I'm fine if it's "fail X::Something.new"... but that seems to want better syntactic sugar to me | 19:19 | ||
fail X::Something, code=>$code, msg=>$msg # maybe | |||
sorear still does not quite grok fail semantics | |||
sirrobert | TimToady: Ok... how does one handle a fail() in general? | 19:20 | |
TimToady | the caller can decide, by testing with //, or by "use fatal", or by letting the failure hit a sink or an attempt to use the bogus value as a real value (a lazy throw, as it were) | 19:22 | |
sirrobert | sounds dangerous =) | ||
TimToady | it lets you treat failure as data rather than control flow, if you want to | 19:23 | |
pmichaud | it's a "soft fail". | ||
as opposed to something like "die" which is a "hard fail" that has to be caught and handled immediately | 19:24 | ||
TimToady | this becomes more important as parallelism introduces more implicit control flowish ideas | ||
sirrobert | ah | ||
pmichaud | ...this feels like a good faq entry :) | ||
I need lunch now but will write one upon returning from lunch. | |||
sirrobert | I was trying to figure out a use case for treating the failure as data (in a non TRY-CATCH fashion) | ||
thanks, pmichaud | 19:25 | ||
pmichaud | TimToady: if you have an opinion on Mu.Numeric doing warn versus fail, it would help me to resolve 3.ACCEPTS(Any) | ||
bbiaw | |||
moritz | currently fail() is more dangerous than die() (in rakudo) becase we don't have sink context which would cause the failures to throw | ||
sorear | there are a lot of unanswered questions about sink context. | 19:26 | |
also it's one of those features that you have to pay for whether or not you use, which always grates on my nerves. | |||
sirrobert | Find out more in Stephen King's next thriller.... Sinkholes! | ||
pmichaud | I can certainly get Rakudo to have a sink context quickly enough, I think. | 19:27 | |
TimToady | sorear: I don't see that. Pure FP never has sink contexts, since its point is induce side effects. | ||
lunch & | 19:28 | ||
moritz | pmichaud: I'd appreciate that | 19:29 | |
pmichaud: I have tried and failed, but that was mostly due to my lack of understanding of rakudo's codegen | |||
sorear | TimToady: I'm not necessarily talking about pure FP; also imperative code that uses assignments a lot but never fail() | ||
pmichaud: are you going to implement the version of fail() that eagerizes lists and searches them for Failures? | 19:30 | ||
19:30
Entonian joined
|
|||
sorear | pmichaud: sorry, the version of sink() that... | 19:30 | |
moritz | oh, Exception.throw isn't hard to do either | 19:37 | |
erm, .fail | 19:38 | ||
19:39
GlitchMr left
|
|||
dalek | kudo/nom: 1180041 | moritz++ | / (2 files): Exception.fail |
19:39 | |
19:42
Entonian left,
ChibaPet joined
|
|||
ChibaPet | Ah, many more people here. =drops into lurk-and-learn mode= | 19:42 | |
flussence | more compared to what? :) | ||
ChibaPet | Compared to #perl6 on MAGnet | ||
moritz | that's not hard to do :-) | 19:43 | |
sirrobert | one more: can someone explain the first argument to .bless? | ||
I just copied out of the perl book, but I don't understand the asterisk. | |||
flussence | I assume it's the same as perl5, so the asterisk means the class being constructed | 19:44 | |
sirrobert | yeah, I assumed the same thing, but ... would rather work from some more concrete knowledge =) | 19:45 | |
in case there's subtlety. | |||
moritz | sirrobert: think of it as a piece of malloc()ed memory that is to be turned into an object; a * means "do the allocation for me" | ||
pmichaud | in this case, asterisk means "please create a new instance for me" rather than "use this instance I already created" | ||
sirrobert | hmmm ok, I can handle that... | ||
is that true anywhere? | 19:46 | ||
or just inside bless? | |||
pmichaud | asterisk in general means "whatever" | ||
sirrobert | ok | ||
pmichaud | it's up to the thing being called to decide what "whatever" means | ||
thus 5..* is "5 up to whatever" (Infinity) | |||
sirrobert | that's pretty cool. | ||
moritz | 5 + * # 5 plus whatever, creates a closure that adds 5 to its argument | ||
pmichaud | @a[*-1] is "the last element" or "one less than whatever the biggest one is" | ||
sirrobert | r: 5 + * | 19:47 | |
p6eval | rakudo 39087a: ( no output ) | ||
sirrobert | how would I *use* that? | ||
pmichaud | r: my $x = 5 + *; say $x(20) | ||
p6eval | rakudo 39087a: OUTPUT«25» | ||
sirrobert | ahh | ||
pmichaud | r: my $x = 5 + *; say $x(3) | ||
p6eval | rakudo 39087a: OUTPUT«8» | ||
pmichaud | it's a closure. | ||
sirrobert | that's super nice | ||
moritz | r: say map *+5, 1, 2, 3 | ||
p6eval | rakudo 39087a: OUTPUT«6 7 8» | ||
pmichaud | moritz++ # better example | 19:48 | |
sirrobert | I get the closure aspect... just didn't get the syntax for using it =) | ||
pmichaud | you use it like any other block or closure, then :) | ||
sirrobert | moritz: nice | ||
moritz | r: say (1..10).grep: * %% 2 | ||
p6eval | rakudo 39087a: OUTPUT«2 4 6 8 10» | ||
sirrobert | well, closure in general is broader than a block ... | ||
moritz | right | ||
sirrobert | there's no particular syntax associated | ||
moritz | but usually it only makes sense to generate small closures with the * syntax | 19:49 | |
sirrobert | yeah | ||
moritz | and usually blocks are used when small, anonymous pieces of code are needed | ||
pmichaud | not sure I understand "closure in general is broader than a block" in a p6 sense... but... whatever :-) | ||
sirrobert | r: say * + *, 1, 3 | ||
p6eval | rakudo 39087a: OUTPUT«WhateverCode.new()13» | ||
moritz | pmichaud: routines are also closures | ||
r: say (* + *)(1, 3) | 19:50 | ||
p6eval | rakudo 39087a: OUTPUT«4» | ||
pmichaud | moritz: routines are also blocks | ||
sirrobert | ah, kinda lispy for the grouping | ||
pmichaud | well, maybe not. | ||
moritz | r: say Routine ~~ Block | ||
p6eval | rakudo 39087a: OUTPUT«True» | ||
pmichaud | yes, Routines are also Blocks :-) | ||
moritz | r: my $c = * + *; say $c(1, 3) | ||
p6eval | rakudo 39087a: OUTPUT«4» | ||
19:50
je joined
|
|||
sirrobert | closure is just the principle of preservation of context past the scope's accessibility | 19:50 | |
pmichaud | sirrobert: but that happens for all blocks in Perl 6, at least conceptually | 19:51 | |
moritz | sirrobert: that's a nice way to put it | ||
sirrobert | moritz: thanks =) | ||
pmichaud: true, but the reverse isn't true | |||
pmichaud: (not necessarily, I mean) | |||
pmichaud | ...reverse isn't true? | ||
sirrobert | just because all blocks offer closures doesn't mean all closures create blocks | 19:52 | |
that's all I meant =) | |||
pmichaud | that's the part I don't understand (in a P6 context) | ||
r: say (* + 1) ~~ Block | 19:53 | ||
p6eval | rakudo 39087a: OUTPUT«False» | ||
pmichaud | okay, now I understand it. | ||
moritz | pmichaud: fwiw I've emailed back and forth with szabgab++ for feedback on my &dir experiments (because he seems to use &dir at the moment). He likes it better than what we have now, and had some small ideas for further improvements | ||
pmichaud | moritz: do your &dir experiments keep some level of API compatibility with 2012.06 ? | 19:54 | |
19:54
adu joined
|
|||
moritz | oh, speaking of &dir, that's also a backwards compatiblity break that wasn't already in 2012.06 | 19:54 | |
pmichaud: some level, yes | |||
pmichaud: they return Cool objects that stringify to the short name | |||
pmichaud | that's likely sufficient for me. | ||
moritz | whereas 2012.06 returns strings that are short names | ||
ok | |||
then I'll work on getting it into nom | 19:55 | ||
pmichaud | at this point I don't think &dir has to return Str; it just has to return something that acts like a Str (which Cool would do) | ||
moritz | oh, and I should do the star release this weekend, unless somebody else wants the honor | ||
pmichaud | sorear: (sink) I'm thinking of getting enough of sink context in place to handle the Failure case; eager might be a bit more than a first cut implementation. | 19:56 | |
moritz | it's all prepared; just needs some final glances, maybe a second look through the announcement, and a 'make VERSION=2012.07' + tar czf | ||
pmichaud | but I also think we may have made a fundamental misassumption on sink, so I'm trying to figure out how to illustrate/word the misassumption | 19:57 | |
that's after lunch | |||
moritz: +1 to a star release whenever you're ready | |||
sorear | pmichaud: yeah, I just get a bit antsy about some-function-which-incidentally-returns-a-million-element-array; 2 could do a lot more work than the user expects | ||
pmichaud | oh, I'm not too worried about million element arrays. It should be costly only in the case of function that generates a million-element-array | 19:58 | |
in which case you really *do* want the function to be fully executed, to get its side effects. | |||
19:59
ChibaPet left
|
|||
pmichaud | i.e., function that returns 1..1000000 can be cheap in sink context. | 19:59 | |
sorear | what if the function is like sub modinplace($arr, $ix, $v) { $arr[$ix] = $v; $arr; } | ||
19:59
brrt joined
|
|||
sorear | and then the user does modinplace($bigarr, 1000, 2); | 19:59 | |
pmichaud | but function that returns 1..100000.map(&block) should do the full thing | ||
sorear | (this is a contrived example, but I beleive it illustrates a real problem that will wind up on the 'Perl 6 Warts' FAQ if we aren't careful) | 20:00 | |
pmichaud | sorear: I don't see how the example is problematic in sink context. | ||
sorear | pmichaud: sink needs to rescan $bigarr for Failures | 20:01 | |
moritz | more than that | ||
sink context empties arrays, no? | |||
pmichaud | not in this context, no. | ||
sorear | the user would have expected that sequence of operations to be constant in the size of $bigarr | ||
moritz | there are multiple sink contexts? | ||
pmichaud | I don't understand "sink content empties arrays" | ||
20:01
birdwindupbird joined
20:02
je left
|
|||
moritz | my @a = 1, 2, 3; @a; say @a; # what output do you expect? | 20:02 | |
pmichaud | I expect 1 2 3 | ||
sorear | I expect 1 2 3 | ||
moritz | ok | ||
the never mind | |||
pmichaud | sink context eagerly evaluates things. in the case of an iterator, it may throw away the results of the iteration | 20:03 | |
but arrays aren't iterators | |||
sorear | When would sink() ever see a naked iterator? | 20:04 | |
moritz | ok | ||
20:04
brrt left
|
|||
dalek | ecs: 9a73239 | moritz++ | S32-setting-library/Exception.pod: [S32::Exception] add Exception.fail |
20:04 | |
ecs: 010e028 | moritz++ | S32-setting-library/Exception.pod: [S32::Exception] error message typos spotted by Nick Glencross |
|||
pmichaud | sink on a list could get propagated to its iterator | ||
sink would not likely see an iterator directly. | |||
but this gets back to my notion that we have a misassumption on sink context.... and I really need lunch so I'll be back in a while | 20:05 | ||
afk for real this time bbl I really mean it good bye | |||
moritz | pmichaud: don't let us hold you off | ||
20:05
brrt joined
|
|||
sorear | 'we have a misassumption on sink context' yay, I'm not the only one who thinks this | 20:05 | |
20:07
Tangaroa joined
20:09
sisar left
20:10
sisar joined
|
|||
sirrobert | I can't seem to get "diag" to output anything in Test.pm | 20:22 | |
Any ideas why? | |||
sorear | r: use Test; diag "Moo" | 20:23 | |
p6eval | rakudo 118004: OUTPUT«# Moo» | ||
sirrobert | in my actual tests, it doesn't output anything. | ||
sorear | npr: use Test; diag "Moo" | ||
p6eval | rakudo 118004, niecza v19-7-g5e25209: OUTPUT«# Moo» | ||
..pugs: OUTPUT«pugs: *** Unsafe function 'use' called under safe mode at /tmp/WQVp8fws1j line 1, column 1» | |||
sorear | sirrobert: how are you running your tests? | 20:24 | |
sirrobert | I ran ufo, then doing make test | ||
moritz | the harness catches those, I believe | ||
sirrobert | which calls: prove -e 'perl6' -r t/ | ||
moritz | if you run perl6 -Iblib/lib t/yourtestfile.t you should see it | ||
sorear | that's your problem. | ||
prove hides diagnostics | |||
it's just intended to give a summary | 20:25 | ||
you could run prove -v -e perl6 -r t/ | |||
that will give you all the diagnostics - maybe more than you expect, Test.pm calls diag() internally for all failing tests | 20:26 | ||
moritz finds that very useful | |||
sorear | I like prove -v because it automatically color-codes the output | ||
you could also run the tests directly with moritz' command | |||
sirrobert | working on getting the right dirs... | 20:27 | |
there we go | 20:28 | ||
had to set my env correctly. | |||
thanks, both. | |||
how can I coerce a string '123' into the int? | 20:30 | ||
moritz | +'123' | ||
or '123'.Int | |||
sirrobert | ok | ||
masak | evening, #perl6 | 20:34 | |
moritz | \o masak | ||
how's fpw? | |||
sirrobert | hey | ||
masak | moritz: great. | ||
moritz: spent the evening with jnthn and tadzik at a cozy restaurant by the riverside. | 20:35 | ||
moritz: it's bloody hot here, but the evenings are manageable. | |||
20:40
MayDaniel left
20:41
brrt left
|
|||
moritz | masak: I hope you'll like that commit... | 20:44 | |
dalek | kudo/nom: 36922f3 | moritz++ | src/Perl6/Metamodel/MultiMethodContainer.pm: improve error message for missing proto in the setting |
||
kudo/nom: 9394f7d | moritz++ | / (2 files): &dir rework part 2 &dir now returns IO::File and IO::Dir objects. It restores partial backwards compatiblity by returning Cool objects that stringify to the basename, but still has a .path method that returns the full path, enabling the things that masak++ wanted to achieve with his first rework. You can still call file test methods on the result objects. Apologies to everyone who has to update their &dir-using code a second time within two weeks, but I firmly believe this is a good way forward. |
|||
moritz | tomorrow I'll update ufo and File::Tools, unless somebody beats me to it | ||
20:47
vmspb left
|
|||
pmichaud | back again | 20:49 | |
in general, I suspect that sink context should not cause Failures in scalar variables to throw | |||
that would resolve the issue with sorear++'s example | |||
the fact that a Failure is stored into a scalar variable is really enough to say "it's safe to handle this later" | 20:50 | ||
moritz | that sounds interesting | ||
my $f = open 'nosuchfile'; $f; # lives | 20:51 | ||
my $f: = open 'nosuchfile'; $f; # dies | |||
masak | moritz++ # &dir | ||
moritz | I know, it's the "doctor, it hurts when I do this" stuff | ||
pmichaud | yeah, if you're doing a bind, you're already saying "I know what I'm doing here." | ||
(a low-level bind) | |||
moritz | we just need to document that :-) | 20:52 | |
masak | moritz: just from reading the commit comment, it does sound like the best of two worlds. | ||
moritz | masak: I hope it is. I've put a fair amount of thinking and work into it | 20:53 | |
pmichaud | should I put a blank notice into the announcement(s) that the IO system is likely to undergo some changes in the next few releases? | ||
tadzik | good evening | ||
pmichaud | s/blank/blanket/ | ||
sorear | pmichaud: doesn't that still leave the issue with repeated rescanning of arrays for bound failures? | ||
moritz | pmichaud: yes; but we should also document stuff that'll continue to work | ||
pmichaud | sorear: not sure about "bound failures" | ||
sorear: afaic, I think of arrays as containers | 20:54 | ||
and a container somewhat implies "you don't have to scan me for Failures" | |||
masak almost said "hm, maybe I should thoughtlessly break more stuff so that smart and ambitious people will consider how to Do Them Right..." :P | 20:55 | ||
pmichaud | the fact that a container is holding a Failure shouldn't be enough to make that Failure want to throw. | ||
masak | s/Them/It/. 'stuff' is singular, I guess. | ||
my ability to parse French in real time still surprises and shocks me a bit. | |||
sorear | pmichaud: what does sink [ map { maybe_fails($_) }, 1..* ] do? | ||
pmichaud: I am supposing you want to make this a difference between List and Arraty | 20:56 | ||
pmichaud | I'm more looking at it as a difference between contained and not-contained | ||
but if that sink [ ... ] didn't throw any failures, it wouldn't bother me. | 20:57 | ||
moritz | masak: heh, ufo doesn't even need any changes after the last change | 20:58 | |
pmichaud | in some sense having the brackets there is like doing a bunch of $a[0] = maybe_fails(1); $a[1] = maybe_fails(2); ... | ||
and assignments shouldn't throw failures | |||
moritz | masak: but one can remove some redundant code | ||
dalek | o: 1593c6b | moritz++ | bin/ufo: simplify &dirwalk code after last rakudo &dir update |
20:59 | |
masak | moritz++ | 21:01 | |
21:01
pupoque left
|
|||
sorear | pmichaud: what about sink do { my @foo; @foo[0] := maybe_fails(1) } | 21:01 | |
masak | tadzik++ fixed ufo earlier today, because it turned out some dunce had committed a &dirwalk "fix" that actually broke the thing. | ||
pmichaud | I'm not sure that a binding should throw failures, either. | ||
tadzik | hah, funny, just recently we've talked abot basename-alike being core-ish | 21:02 | |
moritz++ making stuff sane | |||
moritz | tadzik: maybe you want to change File::Find to return IO::File and IO::Dir objects instead of file File::Find::Result | 21:03 | |
pmichaud | but since there's a := there, I'd be okay if it threw. That's a case that I'm willing to postpone a decision upon for the moment, unless there's a clear use case where it's a problem. | ||
moritz | tadzik: now that we have 'em | ||
sorear | pmichaud: should a List which contains failures throw? | ||
masak | so much of Perl 6 development is investing brain cycles in making stuff sane. I like that. | ||
pmichaud | sorear: if the List is being evaluated eagerly, I could see that. | 21:04 | |
tadzik | moritz: I shall look into that tomorrow | ||
moritz | tadzik: gist.github.com/3020637 that's a patch to make it work | ||
(but still uses File::Find::Result) | |||
pmichaud | I can imagine that a List being evaluated eagerly and sunk would throw any Failures it encounters. | 21:05 | |
tadzik | moritz: do you have a commit bit? If not then please send me a pull request and I'll merge it tomorrow once I get the proper internet | 21:06 | |
21:06
drbean joined
|
|||
sorear | pmichaud: but not an Array being evaluated eagerly and sunk? | 21:07 | |
moritz | tadzik: I don't think I have one | ||
pmichaud | sinking an array wouldn't throw away its values; they're stored. | ||
moritz | going to bed now, will pull request tomorrow | ||
pmichaud | put another way, sinking an Array is simply performing bindings/assignments on its elements | ||
sorear | pmichaud: sinking Lists throws away values? | 21:08 | |
pmichaud | sorear: if they're unbound, yes. | ||
sorear | pmichaud: "unbound"? | ||
pmichaud | my @a := map &block, 1..*; # bound List | 21:09 | |
tadzik disconnects | |||
pmichaud | map &block 1..*; # unbound List | ||
so, the other idea I had and have been playing with is to revisit the notion of 'want' | 21:10 | ||
sorear | pmichaud: how can &sink tell the difference? is this where my decision to go with a GC instead of reference counting is about to bite me? | ||
pmichaud | sorear: Rakudo also doesn't do reference counting, so we want to avoid the same thing | ||
iiuc, we eliminated 'want' because it's too hard to understand context in the presence of multiple dispatch | 21:11 | ||
however, just because we're eliminating context such as list context, boolean context, etc for dispatch doesn't mean that all 'contextual' information has to be gone. Indeed, any 'context' that doesn't affect the results of multiple dispatch could still be detected. | 21:12 | ||
and perhaps sink context is one of those. | |||
the other big context that we had to throw out was lvalue context, because it's definitely affecting multiple dispatch in the sense of 'is rw' | 21:13 | ||
sorear | I don't understand how this aside on &want is related to the discussion of &sink | 21:14 | |
pmichaud | because a function can decide how to respond to sink context, instead of having to return something that knows how to do it | 21:15 | |
sorear | Are you saying that we should syntactically not call &sink on the results of the bind macro? | ||
pmichaud | I'm saying that sink is literally a (p5-style) context that a called function will decide how to handle. | ||
instead of something to be invoked on the return from that function | |||
sorear | ah.. | 21:16 | |
pmichaud | thus assignment would ignore sink context altogether | ||
sorear | I'll play with this idea | ||
pmichaud | while .map would say "oh, I'm in sink context, so eagerly evaluate and throw what I get" | ||
sorear | I need to add p5-style contexts to the Niecza VM anyway to support 'use v5' in uncooperative environments | 21:17 | |
pmichaud | there are some tricky parts to this approach, though | 21:19 | |
sub foo() { something; 1..*.map(&block); } would need to pass the context of foo()'s caller to the map | 21:20 | ||
same for things like 'return' and the like. | |||
it's just an idea I had that might be worth exploring as opposed to trying to always sink return values. | 21:21 | ||
sorear | pmichaud: thank you for reminding me of this | ||
pmichaud: timtoady has been very clear in the past that 'am I being called in sink context' is a bit in the callframe | 21:22 | ||
sirrobert | what's the right way to do this in a regex: /blah \s* (<alpha>|<ws>*) $/ | ||
pmichaud | for all of these discussions, it would be really helpful to have a list of things that we know must sink (wrt eagerness and failure throwing) and things that never sink | ||
sirrobert | ? | ||
pmichaud | sirrobert: <ws>* seems not-very-useful | ||
sorear | sirrobert: <ws>* is always wrong, becuase <ws> matches zero or more whitespace characters | ||
sirrobert | yeah, I want the * to apply to both <alpha> and <ws> | ||
sorear | it's like [\s*]* | 21:23 | |
pmichaud | sirrobert: (<alpha>|<ws>)* ? | ||
sirrobert | I want to capture something like, "I am here" with that snippet. | ||
words with spaces | |||
sorear | /blah \s* (<alpha+space>*)/ | ||
sirrobert | hmmm | ||
hrm! | |||
sorear | /blah \s* (<:Alpha+:Space>*)/ # will be much faster on niecza | ||
pmichaud | sirrobert: you want "I am here" to be caught by the parens? | 21:24 | |
i.e., not including the 'blah' ? | |||
sirrobert | yeah | ||
and in my particular case, the blah is always numerical | |||
let's say it's always \d* | |||
so that's easy =) | |||
pmichaud | ( \w+ %% <.ws> ) | 21:25 | |
sirrobert | what's %%? | ||
masak | sirrobert: separator modifier. | ||
pmichaud | or perhaps it's ( \w+ % <.ws> ) | ||
sirrobert | lots of voodoo going on here ;) | ||
21:26
fioc joined
|
|||
pmichaud | sirrobert: foo %% ',' will match "foo", "foo,foo", "foo,foo,foo", etc. | 21:26 | |
sirrobert | (<:alpha+:space>*) seems to work | ||
masak | the %% form will match 'foo,foo,foo,' as well. | ||
the % form won't. | 21:27 | ||
pmichaud | right | ||
I'm still having to learn the new %% and % forms; I'm still used to ** :-) | |||
sirrobert | ok, I almost grok that | ||
I can see it, but I'll have to use it a few times... | |||
so is non-greedy the same? *? | |||
pmichaud | basically <abc> % <def> means "one or more <abc> separated by <def>" | ||
sirrobert | same as perl5 I mean | ||
masak | this is strangely consistent with % in arith being "modulo" and %% being "evenly divides". um, I guess :) | ||
pmichaud | adding ? after a quantifier makes it frugal, yes. | ||
masak | it makes more sense if you don't think about it :P | ||
pmichaud | (frugal == non-greedy) | 21:28 | |
sirrobert | bon mot =) | ||
pmichaud | adding : after a quantifier makes it non-backtracking | ||
sirrobert | not thinking is slightly psychoallergenic for me, masak ;) | ||
flussence | .oO( for symmetry we should define infix:</>(Str, Regex) to call split() :) |
||
sirrobert | btw, I did some regex a minute ago that spun for a long, long time (never finished... I had to ^C out) | 21:29 | |
want me to try to reproduce? | |||
pmichaud | it's possible to create regexes that infinite loop, yes. | ||
especially if you quantify a zero-width match. | |||
21:30
zby_home_ joined
|
|||
pmichaud | sorear: (sink bit in callframe) yeah, that's what led me to think of this. But I'm still not sure of all the mechanics of handling it, nor of the list of use cases we have to handle. | 21:31 | |
and in some places (e.g. metaoperators and the like) we may have to work to keep the intermediate callers "invisible" to sink bit stuff. | 21:32 | ||
masak | sirrobert: about 'not thinking is slightly psychoallergenic for me', I know what you mean. I wasn't entirely serious. :) | ||
it's not as bad as I first thought with the meanings of % and %% in arith and regexes. it does make sense even when you think about it, actually. | 21:33 | ||
sirrobert | masak: I knew you were kidding =) | 21:34 | |
masak | in both, %% means 'evenly divides'. in the regex world this comes out as meaning 'the "foo" and "," things are the same in amount' | 21:36 | |
s/amount/quantity/ | |||
sirrobert | hmmm | 21:37 | |
I think I like that6 | |||
-6 | |||
I didn't know %% meant anything arithmetically =) | 21:38 | ||
arithmatically? | |||
pmichaud | sirrobert: "evenly divisible by" | ||
r: say 100 %% 5 | 21:39 | ||
p6eval | rakudo 9394f7: OUTPUT«True» | ||
pmichaud | r: say 100 %% 3 | ||
p6eval | rakudo 9394f7: OUTPUT«False» | ||
pmichaud | it's the short form of (a % b == 0), in effect. | ||
sirrobert | neat | 21:40 | |
ok, one more regex change... | |||
how can I also capture hyphens in that capture? | |||
(<:alpha+:space>*) | 21:41 | ||
pmichaud | (<:alpha+:space+[-]>*) | ||
sirrobert | I need alphas, whitespaces, and hyphens... =) | ||
ahh | |||
I had tried it without the brackets | |||
pmichaud | brackets are the "and these characters" part. | ||
sirrobert | that makes sense... an anonymous char class | ||
pmichaud | right... same idea as <[aeiou]> | ||
thus you can do <+[aeiou]+:space> | 21:42 | ||
sirrobert | FINALLY... all tests passed =) | ||
pmichaud is still not used to the colon syntax there | |||
sirrobert | going to go get dinner | ||
pmichaud | sirrobert: \o/ | ||
sirrobert | (yeah, colon is weird for me still too =) | ||
thanks a lot; ttyl. | 21:43 | ||
well, I guess I should commit and push first ;) | |||
pmichaud | commit early and often, yes :) | ||
TimToady: (sink context) what mechanism would you imagine being used to detect things like "3 + $a; 1" resulting in "useless use of + in sink context"? Is that a compile-time detection, based on a trait of &infix:<+>, or is it something that &infix:<+> would carp about at runtime? | 21:45 | ||
TimToady: do I need to resurrect a version of misc/pm.txt for these questions? ;-) | 21:47 | ||
sorear | based on talking to TimToady in the past, I imagined the former | 21:49 | |
21:51
birdwindupbird left
|
|||
pmichaud | is it a trait on the proto sub, then? | 21:52 | |
22:06
whiteknight joined,
whiteknight is now known as Guest8599
22:18
spider-mario left
22:22
alester left
|
|||
dalek | ecs: d067a9c | pmichaud++ | S05-regex.pod: Add a note about declarative semantics to the section on interpolated arrays. |
22:23 | |
ecs: 58b9c43 | pmichaud++ | questions.txt: Add "questions.txt", a place where spec-related implementation |
|||
pmichaud | github.com/perl6/specs/blob/master...stions.txt # resurrection of misc/pm.txt | 22:26 | |
22:34
shinobicl joined
22:35
cistos joined
22:36
cistos left
22:40
bluescreen10 left
22:51
zby_home_ left,
adu left
22:52
mucker left
22:53
bluescreen10 joined
22:54
fioc left
22:57
shinobicl left
|
|||
sorear | pmichaud: I would put it as a trait on the proto sub. | 23:23 |