Perl 6 - the future is here, just unevenly distributed

IRC log for #perl6, 2012-10-07

Perl 6 | Reference Documentation | Rakudo

| Channels | #perl6 index | Today | | Search | Google Search | Plain-Text | summary

All times shown according to UTC.

Time Nick Message
00:00 tokuhiro_ joined #perl6
00:10 Circlepuller_ joined #perl6
00:29 simcop2387 joined #perl6
00:41 thou joined #perl6
00:45 cognominal__ joined #perl6
00:48 aharoni joined #perl6
01:19 armitage81 joined #perl6
01:26 armitage81 joined #perl6
01:32 [Coke] looking at nqp's src/NQP/Compiler.pm, I don't see where it's handling getting "foo.nqp" on the commandline.
01:34 armitage81 joined #perl6
01:38 [Coke] ah. my MAIN signature was wrong.
01:42 armitage81 joined #perl6
01:44 cognominal joined #perl6
01:46 [Coke] yay I can run 'make test' again. boo, everything fails.
01:47 cognominal_ joined #perl6
01:54 HarryS joined #perl6
01:58 thou joined #perl6
02:03 cognominal_ joined #perl6
02:20 simcop2387 joined #perl6
02:27 cognominal_ joined #perl6
02:36 ServerSage joined #perl6
02:40 orafu joined #perl6
02:42 cognominal joined #perl6
02:57 thou joined #perl6
03:20 benabik joined #perl6
03:52 will1309 joined #perl6
03:58 xinming joined #perl6
04:38 telex joined #perl6
04:44 wamba joined #perl6
04:45 preflex joined #perl6
04:54 cognominal joined #perl6
04:59 cognominal_ joined #perl6
05:23 Playb3yond joined #perl6
05:39 mdupont joined #perl6
05:47 kaare__ joined #perl6
05:52 killbot joined #perl6
06:08 _jaldhar joined #perl6
06:08 jnthn morning
06:44 mucker joined #perl6
06:53 moritz \o
07:18 rindolf joined #perl6
07:19 jnthn Hmm
07:19 jnthn I get a fail on test 50 of S02-names/pseudo.t
07:21 moritz oh, that might be my typed exception thingy
07:21 moritz I'll investigate
07:21 jnthn ah, I think I see what's going on
07:21 jnthn X::NoSuchSymbol(symbol => $name).fail unless $thing.WHO.exists($_);
07:21 jnthn missing a .new
07:21 * jnthn adds it and tests
07:22 moritz huh, I thought I had tested that case locally
07:22 jnthn I get some socket fails, but I guess that's because my Parrot is too new
07:22 moritz ah, I only tested one of the two
07:22 moritz moritz--
07:22 moritz or too old
07:23 jnthn yeah, adding the .new helps
07:24 dalek rakudo/nom: e52612f | jnthn++ | src/core/operators.pm:
07:24 dalek rakudo/nom: Fix an exception throw.
07:24 dalek rakudo/nom: review: https://github.com/rakudo/rakudo/commit/e52612f0aa
07:24 moritz jnthn++
07:34 dalek roast: 1baebc1 | moritz++ | S05-modifier/ii.t:
07:34 dalek roast: separate testing of :ii and that :ii implies :i
07:34 dalek roast: review: https://github.com/perl6/roast/commit/1baebc1f6c
07:39 Su-Shee joined #perl6
08:04 flightrecorder joined #perl6
08:08 cognominal joined #perl6
08:10 leont joined #perl6
08:22 wamba joined #perl6
08:22 GlitchMr joined #perl6
08:33 SamuraiJack joined #perl6
08:48 dalek nqp: f44a799 | jnthn++ | src/QRegex/P6Regex/Grammar.nqp:
08:48 dalek nqp: Toss :PIR{{...}} parsing in P6Regex.
08:48 dalek nqp:
08:48 dalek nqp: Legacy, and didn't even have an action method so couldn't possibly have
08:48 dalek nqp: been being used.
08:48 dalek nqp: review: https://github.com/perl6/nqp/commit/f44a7991f0
08:48 dalek nqp: e349cb6 | jnthn++ | src/ (4 files):
08:48 dalek nqp: Basic implementation of :dba(...).
08:48 dalek nqp: review: https://github.com/perl6/nqp/commit/e349cb6d8e
08:48 dalek rakudo/nom: 59fc70a | jnthn++ | tools/build/NQP_REVISION:
08:48 dalek rakudo/nom: Bump NQP_REVISION for :dba(...).
08:48 dalek rakudo/nom: review: https://github.com/rakudo/rakudo/commit/59fc70adf0
08:48 dalek rakudo/nom: 88a9ba4 | jnthn++ | src/Perl6/Grammar.pm:
08:48 dalek rakudo/nom: Uncomment and add some :dba(...).
08:48 dalek rakudo/nom: review: https://github.com/rakudo/rakudo/commit/88a9ba4fb8
09:12 moritz database administrators in Rakudo \o/
09:12 jnthn :P
09:16 moritz jnthn: I guess all the 'in PMC' in nqp_bigint.ops could just as well be 'invar PMC', right?
09:16 jnthn moritz: Yes
09:16 moritz then I'll do that
09:16 moritz r: say 9737 / 3343 # size reduction of src/ops/nqp_bigint_ops.c
09:17 p6eval rakudo 88a9ba: OUTPUT«2.912653␤»
09:17 dalek nqp: 30b8883 | moritz++ | src/ops/nqp_bigint.ops:
09:17 dalek nqp: [bigint ops] s:g/in PMC/invar PMC/
09:17 dalek nqp: review: https://github.com/perl6/nqp/commit/30b8883052
09:19 jnthn Wow
09:19 moritz I'm not sure there's any practical benefit from it
09:19 moritz maybe reduced size of binary
09:20 moritz but it feels good :-)
09:22 dalek nqp: 47593ca | jnthn++ | src/QRegex/P5Regex/Actions.nqp:
09:22 dalek nqp: Respect (?i) when compiling charclasses.
09:22 dalek nqp: review: https://github.com/perl6/nqp/commit/47593ca9a6
09:25 moritz jnthn: is :dba used in error messages already?
09:25 jnthn r: my @a; @a[393mnd3!.]
09:25 p6eval rakudo 88a9ba: OUTPUT«===SORRY!===␤Unable to parse expression in subscript; couldn't find final ']' at line 2, near "393mnd3!.]"␤»
09:25 jnthn Yes ;)
09:29 moritz \o/
09:30 moritz r: 1[1 1]
09:30 p6eval rakudo 88a9ba: OUTPUT«===SORRY!===␤Unable to parse expression in subscript; couldn't find final ']' at line 2, near "1 1]"␤»
09:30 moritz I think the old one was just "Confused"
09:30 moritz jnthn++
09:30 jnthn A small, but nice error reporting improvement.
09:34 moritz nqp: my int $i; say($i)
09:34 p6eval nqp: OUTPUT«0␤»
09:40 wamba joined #perl6
09:56 spider-mario joined #perl6
10:01 dalek roast: 69befed | moritz++ | S0 (2 files):
10:01 dalek roast: unfudge some tests for rakudo
10:01 dalek roast: review: https://github.com/perl6/roast/commit/69befed0c0
10:02 dalek rakudo/nom: 46b8eb8 | moritz++ | src/Perl6/Actions.pm:
10:02 dalek rakudo/nom: sprinkle some native types into Actions.pm
10:02 dalek rakudo/nom: review: https://github.com/rakudo/rakudo/commit/46b8eb8f55
10:02 jnthn yay, I fixed that annoying subcapture bug in the regex compiler...
10:07 dalek nqp: 8b5a7a0 | jnthn++ | src/QAST/Compiler.nqp:
10:07 moritz jnthn: that's good to hear
10:07 dalek nqp: Fix subcapture compilation.
10:07 dalek nqp:
10:07 dalek nqp: We have to ensure $!pos gets updated appropriately, since it is used by
10:07 dalek nqp: !cursor_capture. Fixes much in m:P5/.../ spectests, but could also be a
10:07 dalek nqp: bug in normal Perl 6 regexes too.
10:07 dalek nqp: review: https://github.com/perl6/nqp/commit/8b5a7a0129
10:07 dalek nqp: a1c54d8 | jnthn++ | t/p5regex/rx_captures:
10:07 dalek nqp: Untodo a P5Regex test.
10:07 dalek nqp: review: https://github.com/perl6/nqp/commit/a1c54d8d4b
10:08 SamuraiJack joined #perl6
10:18 dalek rakudo/nom: afb8a63 | jnthn++ | tools/build/NQP_REVISION:
10:18 dalek rakudo/nom: Bump NQP_REVISION for regex improvements.
10:18 dalek rakudo/nom: review: https://github.com/rakudo/rakudo/commit/afb8a6345e
10:18 dalek rakudo/nom: e644792 | jnthn++ | t/spectest.data:
10:18 dalek rakudo/nom: Run S05-modifier/perl5_4.t.
10:18 dalek rakudo/nom: review: https://github.com/rakudo/rakudo/commit/e644792226
10:18 dalek roast: 8d44d1c | jnthn++ | S05-modifier/perl5_4.t:
10:18 dalek roast: Fudge S05-modifier/perl5_4.t for Rakudo.
10:18 dalek roast: review: https://github.com/perl6/roast/commit/8d44d1c6c6
10:18 dalek roast: b27262e | jnthn++ | S05-modifier/perl5_ (2 files):
10:18 dalek roast: Rakudo unfudging.
10:18 dalek roast: review: https://github.com/perl6/roast/commit/b27262e7e8
10:32 dalek rakudo/nom: d3de02f | moritz++ | src/Perl6/Actions.pm:
10:32 dalek rakudo/nom: more native types for Actions.pm
10:32 dalek rakudo/nom: review: https://github.com/rakudo/rakudo/commit/d3de02f22b
10:35 grondilu joined #perl6
10:35 grondilu rn: say so True|False
10:35 p6eval rakudo 46b8eb, niecza v22-7-g7df6137: OUTPUT«True␤»
10:40 grondilu r: my $x = True|False; say $x ~~ Bool;
10:40 p6eval rakudo 46b8eb: OUTPUT«False␤»
10:40 cognominal joined #perl6
10:54 MayDaniel joined #perl6
10:55 FROGGS joined #perl6
10:57 topo_ joined #perl6
11:05 Su-Shee_ joined #perl6
11:08 nyuszika7h r: my $x = True&False; say $x ~~ Bool;
11:08 p6eval rakudo 46b8eb: OUTPUT«False␤»
11:08 nyuszika7h rn: say so True&False
11:08 p6eval rakudo 46b8eb, niecza v22-7-g7df6137: OUTPUT«False␤»
11:13 mucker joined #perl6
11:14 grondilu I'm actually fine with True|False not matching Bool.  It fits my particular need.
11:16 jnthn r: say True|False ~~ Junction
11:16 p6eval rakudo 46b8eb: OUTPUT«True␤»
11:21 GlitchMr perl6: say True|False ~~ Bool
11:21 p6eval rakudo d3de02, niecza v22-7-g7df6137: OUTPUT«False␤»
11:21 aharoni joined #perl6
11:22 grondilu In case you wonder, I used that to fix my endianness issue earlier.
11:23 grondilu r: constant little-endian = True|Fase; CHECK { little-endian ~~ Bool or die "please set little-endian constant in source code" }
11:23 p6eval rakudo d3de02: OUTPUT«===SORRY!===␤Could not find sub &Fase␤»
11:23 grondilu r: constant little-endian = True|False; CHECK { little-endian ~~ Bool or die "please set little-endian constant in source code" }
11:23 p6eval rakudo d3de02: OUTPUT«===SORRY!===␤please set little-endian constant in source code␤»
11:26 MayDaniel joined #perl6
11:27 whiteknight joined #perl6
11:30 gugod joined #perl6
11:30 wtw joined #perl6
11:39 birdwindupbird joined #perl6
11:44 moritz r: say (False|True).WHAT
11:44 p6eval rakudo d3de02: OUTPUT«Junction()␤»
11:44 moritz r: say Junction ~~ Bool
11:44 p6eval rakudo d3de02: OUTPUT«False␤»
12:11 PacoAir joined #perl6
12:35 rindolf joined #perl6
12:36 cognominal_ joined #perl6
12:46 wamba joined #perl6
12:57 Celelibi joined #perl6
13:27 rindolf joined #perl6
13:38 Coleoid joined #perl6
13:40 birdwindupbird joined #perl6
13:46 birdwind1pbird joined #perl6
13:57 rindolf joined #perl6
14:00 dalek Heuristic branch merge: pushed 30 commits to nqp/kill-nqpattr by jnthn
14:38 cognominal joined #perl6
14:40 [Coke] I just saw a video of masak!
14:41 timotimo_ whoa
14:41 moritz wow
14:41 flussence he exists?!?
14:41 timotimo_ was it some dope skateboard trick collage?
14:41 moritz masak is currently in .cn, I believe
14:46 mucker [Coke]: link
14:46 tadzik masak doing skateboard tricks in .cn? :)
14:46 leprevost joined #perl6
14:48 dalek nqp/kill-nqpattr: 8a899d4 | jnthn++ | src/NQP/Actions.pm:
14:48 dalek nqp/kill-nqpattr: Simplify some code.
14:48 dalek nqp/kill-nqpattr: review: https://github.com/perl6/nqp/commit/8a899d46d2
14:48 dalek nqp/kill-nqpattr: 7db86ab | jnthn++ | src/core/NQPRoutine.pm:
14:48 dalek nqp/kill-nqpattr: Flesh out NQPRegex a bit.
14:48 dalek nqp/kill-nqpattr:
14:48 dalek nqp/kill-nqpattr: Gives it methods and attributes that will store the captures and NFAs.
14:48 dalek nqp/kill-nqpattr: review: https://github.com/perl6/nqp/commit/7db86abc45
14:48 dalek nqp/kill-nqpattr: e212a96 | jnthn++ | src/QRegex/NFA.nqp:
14:48 dalek nqp/kill-nqpattr: Add a way to persist an NFA to a data structure.
14:48 dalek nqp/kill-nqpattr:
14:48 dalek nqp/kill-nqpattr: This will (eventually) be used to serialize the NFA instead of using the
14:48 dalek nqp/kill-nqpattr: nqpattr hack.
14:48 dalek nqp/kill-nqpattr: review: https://github.com/perl6/nqp/commit/e212a96d41
14:48 rindolf joined #perl6
14:48 leprevost joined #perl6
14:51 [Coke] mucker: http://www.youtube.com/watch?featur​e=player_embedded&v=OJwlCzW5O_Q
14:51 [Coke] (has several #perl6 people, actually.)
14:52 Psyche^ joined #perl6
14:58 xdbr joined #perl6
15:02 integral joined #perl6
15:02 integral joined #perl6
15:10 hash_table joined #perl6
15:17 flussence joined #perl6
15:24 rindolf joined #perl6
15:29 jnthn in Perl 5 regex, what does the ? mean in /(a(?(1)\1)){4}/ ?
15:31 GlitchMr (?(1)\1) appears to be "if capturing group 1 captures something" capture backreference 1
15:31 GlitchMr This is conditional
15:31 GlitchMr But I don't think it's neccessary in this case - simple \1 should be enough
15:32 jnthn Yeah, it's from a test :)
15:33 jnthn found it in perlre
15:33 jnthn (1) (2) ...
15:33 jnthn Checks if the numbered capturing group has matched something.
15:33 GlitchMr This is one of those things that nearly nobody uses
15:33 GlitchMr (but perhaps I'm wrong)
15:34 GlitchMr https://code.google.com/co​desearch#search/&q=%5C(%5C?%5C(&type=cs
15:34 GlitchMr Apperently, it is used
15:35 GlitchMr But rarely
15:35 jnthn Yeah, it's the (first) blocker on running S05-modifier/perl5_5.t
15:35 * jnthn is doing some gentle m:P5/.../ hacking while he de-lags :)
15:36 GlitchMr Should I make "explain regexp" tool?
15:36 jnthn std: m:P5/(a(?(1)\1)){4}/
15:36 p6eval std 77327a4: OUTPUT«ok 00:00 49m␤»
15:36 GlitchMr /^(a(?(1)\1)){4}$/
15:36 GlitchMr Should be identical to /^(a){4}/ in that case
15:37 GlitchMr Backreference is used before it was catched
15:38 jnthn *nod*
15:38 * jnthn tries to work out how STD_P5 parses that one
15:41 jnthn std: m:P5/(?a)/
15:41 p6eval std 77327a4: OUTPUT«ok 00:00 49m␤»
15:41 benabik joined #perl6
15:42 jnthn Hm, wonder why that doesn't trigger "quantifier quantifies nothing"
15:46 felher Is there a way to tell my grammar that it should never match any of \v? So that even . doesn't match \v anymore. Or this best done with a pre-check before using the grammar?
15:47 jnthn felher: What are you trying to do, exactly?
15:47 jnthn r: say ' ab ' ~~ /\V+/
15:47 p6eval rakudo d3de02: OUTPUT«「 ab 」␤␤»
15:47 jnthn er
15:48 jnthn r: say " ab\n" ~~ /\V+/
15:48 p6eval rakudo d3de02: OUTPUT«「 ab」␤␤»
15:48 jnthn There's that for matching anything put \v
15:48 jnthn Do you want to use rule but have its whitespace handling never match \v? If so just override ws.
15:49 jnthn *anything but
15:51 nodmonkey joined #perl6
15:51 GlitchMr ok, I still cannot remove service hook on glitchmr.github.com.
15:51 GlitchMr But I can change it, so I've changed it to http://example.com/... hope it will work
15:51 felher jnthn: I'm just don't write \V anywhere for one i'm lazy and two its kinda error prone :) This grammar only should parse single lines, and I wonder whats the best way to do it :)
15:52 GlitchMr Oh... I was supposed to click (remove), not clear the URL lol
15:52 GlitchMr Anyways, now the information shouldn't appear on this channel
15:53 felher while i sure can say something along the lines of: 'die "can not have newlines" unless $string ~~ /\v/; return grammar.parse($string, $actions)' its harder to get useful error-messages when i want to know in what subrule that '\v' appeared :)
15:53 sudokode joined #perl6
15:54 felher *if $string ~~ ...
15:55 jnthn felher: Well, a <before \V+ $> at the start of the regex is one way
15:55 jnthn But yeah, that won't tell you where it is
15:56 jnthn <before (\V+) [ $ || { die "Vertical whitespace after $1" }> # maybe
15:56 jnthn er, I missed a ] :)
15:56 GlitchMr Shouldn't I name my program to explain regexpes "regexplain"?
15:56 GlitchMr s/n't//
15:56 jnthn GlitchMr: Cute name :)
15:57 felher GlitchMr: yeah, sounds good :)
15:58 GlitchMr I originally wanted to name it "explain-regexp" but word games are nice ;-).
15:58 felher jnthn: thats better than a simple test, yes. But i think i will just write \V* instead of .* and <-[\:\V]> instead of <-[\:]> and such :)
15:58 felher jnthn: thanks :)
15:58 felher *<-[\:\v]>
15:59 GlitchMr It's going to be like YAPE::Regex::Explain, except supporting modern RegExp constructions
16:00 * felher doesn't know YAPE::Regex::Explain, but it sounds like a good idea :)
16:01 GlitchMr felher: http://search.cpan.org/~pinyan/YA​PE-Regex-Explain-3.011/Explain.pm
16:01 Su-Shee joined #perl6
16:01 GlitchMr Except I think I'll write that in JavaScript
16:04 felher GlitchMr: a JavaScript-Script to explain perl6 regexes?
16:05 felher GlitchMr: to build it into a website?
16:05 GlitchMr Well, most likely yes
16:05 GlitchMr But that will support Perl 5... Perl 6 will be later
16:06 felher GlitchMr: ah, okay :)
16:06 GlitchMr Perl 5 regexpes are simpler, but the architecture will be extensible, so Perl 6 would be possible too
16:06 felher GlitchMr++ :)
16:10 GlitchMr Or perhaps rather - like YAPE::Regex::Explain or RegexBuddy
16:16 GlitchMr /(?:\\\W|[^\\\[(){^$.|+*?]|\{(?!\d+(?:​,\d*)?\}))+(?![?*+]|\{\d+(?:,\d*)?\})/
16:16 GlitchMr This is regexp to match literal characters
16:16 GlitchMr (without /x modifier activated)
16:16 * mucker goes unconscious
16:17 GlitchMr If I would want to parse RegExp with /, I also would have to notice spaces and #
16:17 GlitchMr s/\//\/x/
16:20 xinming joined #perl6
16:39 GlitchMr /(?:\\\W|[^\\\[#(){^$.|+*?]|\{(?!\d+(?:,\d​*)?\}))+(?![?*+]|\{\d+(?:,\d*)?\})|(?:\\\W​|[^\\\[#(){^$.|+*?]|\{(?!\d+(?:,\d*)?\}))/
16:39 GlitchMr When you through it couldn't be worse
16:40 GlitchMr Hmmm... but I could shorten THAT
16:44 * [Coke] is glad jnthn is back hacking on nqp and friends.
16:46 GlitchMr /#[ \t]*(.*?)[ \t]*$/m
16:46 GlitchMr Ok :-)
16:52 felher :D
16:53 GlitchMr /(?:([+*?])|\{(\d+)(?:(,)(\d*))?)([?+])?/
16:53 GlitchMr This is going to be fun
16:53 GlitchMr Make cryptic regexpes in JavaScript to match RegExp parts
16:56 [Coke] where are methods available on the compiler/grammar in nqp defined?
16:56 brrt joined #perl6
16:56 [Coke] (I'm trying to get the parse tree, add stuff to it, then compile it.)
16:57 brrt hi #perl6
16:57 brrt i have thought about it
16:57 brrt and i have decided
16:58 brrt i hate your damn calling conventions
16:58 brrt but i can implement them just the same :-)
16:59 fridim_ joined #perl6
17:14 _edwin joined #perl6
17:16 cognominal joined #perl6
17:23 moritz [Coke]: in HLL::Compiler
17:26 grondilu joined #perl6
17:26 grondilu rn: class Foo is Str { method bar { self ~= "bar" } }; my Foo $x; say $x.bar;'
17:27 p6eval niecza v22-7-g7df6137: OUTPUT«[31m===[0mSORRY![31m===[0m��Bogus statement at /tmp/0_REinksgN line 1:�------> [32melf ~= "bar" } }; my Foo $x; say $x.bar;[33m�[31m'[0m��Parse failed��»
17:27 p6eval ..rakudo d3de02: OUTPUT«===SORRY!===␤Confused␤at /tmp/PHJjMML_2K:1␤»
17:27 cognominal_ joined #perl6
17:28 grondilu How would you write something like that?  It should be easy, shouldn't it?
17:29 grondilu I just want a class that extends Str and adds a method that puts something at the end.
17:31 GlitchMr use MONKEY_PATCHING
17:31 GlitchMr ... oh, extending
17:31 GlitchMr rn: class Foo is Str { method bar { self ~= "bar" } }; my Foo $x; say $x.bar;
17:31 p6eval niecza v22-7-g7df6137: OUTPUT«Unhandled exception: Writing to readonly scalar␤  at /tmp/pSzB8Exlx0 line 1 (Foo.bar @ 4) ␤  at /tmp/pSzB8Exlx0 line 1 (mainline @ 6) ␤  at /home/p6eval/niecza/lib/CORE.setting line 4198 (ANON @ 3) ␤  at /home/p6eval/niecza/lib/CORE.setting line 4199 (modul…
17:31 p6eval ..rakudo d3de02: OUTPUT«Cannot assign to a non-container␤  in block  at src/gen/CORE.setting:12006␤  in method bar at /tmp/H0v68N1GZv:1␤  in block  at /tmp/H0v68N1GZv:1␤␤»
17:31 GlitchMr Well, strings aren't mutable
17:32 GlitchMr So you cannot do that so easily
17:32 sorear good * #perl6
17:33 brrt rn: class Foo is Str { method bar { self ~ "bar" } }; my Foo $x; say $x.bar
17:33 p6eval niecza v22-7-g7df6137: OUTPUT«bar␤»
17:33 p6eval ..rakudo d3de02: OUTPUT«use of uninitialized value of type Foo in string context  in method bar at /tmp/sqbenEQ5fj:1␤␤bar␤»
17:33 grondilu n: class Foo is Str { method bar { self ~ "bar" } }; my Foo  $x; say $x.bar
17:33 p6eval niecza v22-7-g7df6137: OUTPUT«bar␤»
17:33 cognominal__ joined #perl6
17:33 grondilu n: class Foo is Str { method bar { self ~ "bar" } }; my Foo  $x;  $x.bar; say $x;
17:33 p6eval niecza v22-7-g7df6137: OUTPUT«Foo()␤»
17:34 brrt rn: class Foo is Str { method bar { self ~ "bar" } }; my Foo $x = ""; say $x.bar
17:34 p6eval niecza v22-7-g7df6137: OUTPUT«Unhandled exception: Nominal type check failed for scalar store; got Str, needed Foo or subtype␤  at /tmp/VC34uo3MNC line 1 (mainline @ 4) ␤  at /home/p6eval/niecza/lib/CORE.setting line 4198 (ANON @ 3) ␤  at /home/p6eval/niecza/lib/CORE.setting line 4199 (…
17:34 p6eval ..rakudo d3de02: OUTPUT«Type check failed in assignment to '$x'; expected 'Foo' but got 'Str'␤  in block  at /tmp/d4T_teVTcI:1␤␤»
17:34 GlitchMr This is Str, not Foo.
17:34 brrt fine
17:35 brrt role Foo { method bar { self ~ "bar" } }; my $x does Foo = "foo"; say $x.bar
17:35 GlitchMr I've no idea how to make Str without literals or .Str method that isn't empty
17:35 jaldhar joined #perl6
17:35 GlitchMr Hmmm... perhaps hax will work
17:36 GlitchMr > $str ~~ s/<?>/hello world!/
17:36 GlitchMr Type check failed in assignment to '$str'; expected 'Foo' but got 'Str'
17:36 GlitchMr No...
17:38 brrt rn:  role Foo { method bar { self ~ "bar" } }; my $x does Foo = "foo"; say $x.bar
17:38 p6eval niecza v22-7-g7df6137: OUTPUT«[31m===[0mSORRY![31m===[0mâ�¤â�¤Trait does not available on variables at /tmp/GB_FfiUtF5 line 1:â�¤------> [32m bar { self ~ "bar" } }; my $x does Foo [33mâ��[31m= "foo"; say $x.bar[0mâ�¤â�¤Unhandled exception: Check failedâ�¤â�¤  at /home/p6eval/niecza/boot/lib/CO…
17:38 p6eval ..rakudo d3de02: OUTPUT«No such method 'bar' for invocant of type 'Str'␤  in block  at /tmp/ssrNUVOF4C:1␤␤»
17:40 grondilu I want bar to mutate Foo.
17:40 grondilu I mean to mutate the calling instance.
17:40 jnthn That's not so much mutation as returning a concatenated thing though
17:41 jnthn r: my $x = "foo" but role { method bar { self ~ "bar" } }; say $x.bar
17:41 p6eval rakudo d3de02: OUTPUT«foobar␤»
17:41 grondilu Yeah that's why I tried =~ in the first place.
17:41 grondilu sorry:  ~=
17:42 grondilu r: my $x = "foo" but role { method bar { self ~= "bat" } }; say $x.bar;
17:42 p6eval rakudo d3de02: OUTPUT«Cannot assign to a non-container␤  in block  at src/gen/CORE.setting:12006␤  in method bar at /tmp/sDRDqDulN6:1␤  in block  at /tmp/sDRDqDulN6:1␤␤»
17:42 jnthn Str isn't mutable, so extending it isn't likely to go well
17:43 jnthn Delegation would probably work out better.
17:43 grondilu I don't get it.
17:43 jnthn You can't change the value a given Str has. They are imutable.
17:44 grondilu but I can instantiate a Str in something mutable, can't I?
17:44 jnthn sure
17:44 jnthn that's what I was suggesting
17:44 grondilu r: my Str $x = "foo"; say $x ~= "bar";
17:44 p6eval rakudo d3de02: OUTPUT«foobar␤»
17:44 jnthn sureRight, the second thing produces a new Str and assigns it to $x
17:45 grondilu That's a weird logic, imho.
17:46 jnthn r: class Foo { has Str $.value handles *; method bar() { $!value ~= "bar" } }; my $x = Foo.new(value => 'blah'); say $x.bar; # is more what I meant
17:46 p6eval rakudo d3de02: OUTPUT«blahbar␤»
17:47 brrt1 joined #perl6
17:47 grondilu jnthn: that's encapsulation, not extension.
17:48 grondilu Yet I admit I did not know about this "handles" modifier.  Seems handy.
17:55 grondilu Why is Str immutable anyway?  Not all strings are litterals, are they?
17:57 grondilu I mean, whatever $x is does when I type ' $x ~= "bar" ', I should be able to do it inside a method.
17:57 grondilu s/is does/does/
17:58 grondilu thus my 'self ~= "bar"' attempt.
17:59 jnthn ah, I see
18:00 rindolf joined #perl6
18:00 jnthn Well, self strips away any container
18:00 jnthn But you can do something like:
18:00 jnthn r: my $x = "foo" but role { method bar($invocant is rw:) { $invocant ~= "bar" } }; $x.bar; say $x;
18:00 p6eval rakudo d3de02: OUTPUT«foobar␤»
18:00 jnthn That is, you explicitly say "I want to modify the invocant"
18:00 jnthn (can call $invocant whatever you like)
18:01 grondilu I'm surprised this work.  What makes $invocant the invocant and not a method argument?
18:02 jnthn The colon
18:02 grondilu ok.  Well, that solves the issue indeed.  Thanks.
18:03 grondilu r: class Foo is Str { method bar($me is rw:) { $me ~= "bar" } }; my Foo $x; $x.bar; say $x;
18:03 p6eval rakudo d3de02: OUTPUT«Type check failed in assignment to '$x'; expected 'Foo' but got 'Str'␤  in block  at src/gen/CORE.setting:12006␤  in method bar at /tmp/gr2MIfQ3jS:1␤  in block  at /tmp/gr2MIfQ3jS:1␤␤»
18:04 grondilu Do I really need to use a role?
18:05 FROGGS joined #perl6
18:05 flightrecorder joined #perl6
18:07 jnthn The code you wrote there never makes an instance of Foo
18:07 grondilu r: class Foo is Str { method bar($me is rw:) { $me ~= "bar" } }; my Foo $x .= new; $x.bar; say $x;
18:07 p6eval rakudo d3de02: OUTPUT«Type check failed in assignment to '$x'; expected 'Foo' but got 'Str'␤  in block  at src/gen/CORE.setting:12006␤  in method bar at /tmp/fmSRayl0Zu:1␤  in block  at /tmp/fmSRayl0Zu:1␤␤»
18:08 spider-mario joined #perl6
18:08 jnthn Now you get that but the concatenation operator returns a Str as its result, not a Foo
18:08 aharoni joined #perl6
18:09 crab2313 joined #perl6
18:10 grondilu But shouldn't the concatenation operator take into account that it is called by a child class of Str, and thus return an instance of this child class?
18:10 moritz no
18:10 moritz we've had that with Int
18:11 moritz and somebody did, in essense, (1 but "1") + 2
18:11 moritz and printed it
18:11 moritz and was surprised that the result was "1", not "3"
18:11 GlitchMr That's obvious. He modified integerish value, not stringy value
18:11 moritz because the type of the LHS was (Int but "1"), and the + operator took taht for the result
18:12 GlitchMr Also...
18:12 GlitchMr > (1 but "1") + 2
18:12 GlitchMr 3
18:12 jnthn Well, yeah. Thing here is that "bar" is a Str, so how would it decide between the two types.
18:12 GlitchMr perl6: say (1 but "1") + 2
18:12 moritz yes, I've fixed infix:<+>(Int, Int) to always return exactly Int
18:12 p6eval rakudo d3de02, niecza v22-7-g7df6137: OUTPUT«3␤»
18:12 jnthn (even if it was going to do that)
18:13 moritz there's no sanity down that road
18:13 cognominal__ joined #perl6
18:13 grondilu can't I bless "bar" into Foo or something, then?
18:14 moritz r: class Foo is Str { }; given Foo.new("bar") { .say; say .WHAT }
18:14 grondilu I don't quite get how blessing works in Perl6, though.
18:14 p6eval rakudo d3de02: OUTPUT«Default constructor only takes named arguments␤  in method new at src/gen/CORE.setting:659␤  in block  at /tmp/3yGb1S0HVj:1␤␤»
18:14 moritz I guess that should be made to work
18:14 moritz r: class Foo is Str { }; given nqp::box_s(Foo, "bar) { .say; say .WHAT }
18:14 p6eval rakudo d3de02: OUTPUT«===SORRY!===␤Unable to parse expression in argument list; couldn't find final ')' at line 2, near "\"bar) { .s"␤»
18:15 moritz r: class Foo is Str { }; given nqp::box_s(Foo, "bar") { .say; say .WHAT }
18:15 p6eval rakudo d3de02: OUTPUT«Cannot unbox a type object as a native str␤  in any  at src/gen/BOOTSTRAP.pm:655␤  in block  at /tmp/ZTR6Xwa_yF:1␤␤»
18:15 moritz r: class Foo is Str { }; given nqp::box_s("bar", Foo) { .say; say .WHAT }
18:15 p6eval rakudo d3de02: OUTPUT«bar␤Foo()␤»
18:15 moritz that's how you can do it in Rakudo today, though the boxing is non-standard
18:25 xinming_ joined #perl6
18:25 grondilu bty I've just realized I can make a role in a whole file, as I would do with a class or module.  I tried that once with no success.
18:26 grondilu So I'll use a role then, I guess.
18:27 fglock joined #perl6
18:28 grondilu I'm confused.  It works with grammars as well?
18:28 dalek nqp: 9e503bd | jnthn++ | src/QRegex/P5Regex/ (2 files):
18:28 dalek nqp: Toss some P6Regex code that's ported.
18:28 dalek nqp: review: https://github.com/perl6/nqp/commit/9e503bdaac
18:28 dalek nqp: 5591588 | jnthn++ | src/QRegex/P5Regex/Actions.nqp:
18:28 dalek nqp: Handle quantification of vanishing things.
18:28 dalek nqp: review: https://github.com/perl6/nqp/commit/5591588e4c
18:28 dalek nqp: 3442c18 | jnthn++ | src/QRegex/P5Regex/ (2 files):
18:28 dalek nqp: Implement lookbehind.
18:28 dalek nqp: review: https://github.com/perl6/nqp/commit/3442c181da
18:28 dalek nqp: b8ad051 | jnthn++ | src/QRegex/P5Regex/Grammar.nqp:
18:28 dalek nqp: Parse 's' mod (though NYI).
18:28 dalek nqp: review: https://github.com/perl6/nqp/commit/b8ad051b5a
18:28 jnthn grondilu: A grammar is just a funny kind of class
18:29 brrt sub foo ($x) { say $x; }; my @a = 1,2,3; foo(|@a);
18:29 brrt r: ub foo ($x) { say $x; }; my @a = 1,2,3; foo(|@a);
18:29 p6eval rakudo d3de02: OUTPUT«===SORRY!===␤Variable $x is not declared␤at /tmp/6ehoJHL83m:1␤»
18:29 grondilu yeah but I thought the syntax 'class MyClass;' on the beginning of the file was only for modules and classes.
18:30 jnthn No, it's for any package.
18:30 grondilu Ok.  Good to know.
18:30 moritz .oO( more general than you thought )
18:30 jnthn Grrr. /a(?#xxx){3}c/
18:31 jnthn The {3} here would appear to apply to the a in P5 regex...
18:31 armitage81 joined #perl6
18:32 brrt p6: ub foo ($x) { say $x; }; my @a = 1,2,3; foo(|@a);
18:32 p6eval rakudo d3de02: OUTPUT«===SORRY!===␤Variable $x is not declared␤at /tmp/NpxJtdEfXF:1␤»
18:32 p6eval ..niecza v22-7-g7df6137: OUTPUT«[31m===[0mSORRY![31m===[0m��Variable $x is not predeclared at /tmp/Xku2uAvVWS line 1:�------> [32mub foo ([33m�[31m$x) { say $x; }; my @a = 1,2,3; foo(|@a)[0m��Unexpected block in infix position (two terms in a row, or previous statement missing sem…
18:32 brrt dammit
18:32 brrt p6: sub foo ($x) { say $x; }; my @a = 1,2,3; foo(|@a);
18:32 p6eval rakudo d3de02: OUTPUT«Too many positional parameters passed; got 3 but expected 1␤  in sub foo at /tmp/1kgVQEZVq3:1␤  in block  at /tmp/1kgVQEZVq3:1␤␤»
18:32 p6eval ..niecza v22-7-g7df6137: OUTPUT«Unhandled exception: Excess arguments to foo, used 1 of 3 positionals␤  at /tmp/Mfa6XCqved line 0 (foo @ 1) ␤  at /tmp/Mfa6XCqved line 1 (mainline @ 6) ␤  at /home/p6eval/niecza/lib/CORE.setting line 4198 (ANON @ 3) ␤  at /home/p6eval/niecza/lib/CORE.settin…
18:32 brrt p6: sub foo ($x,$y, $z) { say $x; }; my @a = 1,2,3; foo(|@a);
18:32 p6eval niecza v22-7-g7df6137: OUTPUT«Potential difficulties:â�¤  $y is declared but not used at /tmp/Of8eWuU18i line 1:â�¤------> [32msub foo ($x,[33mâ��[31m$y, $z) { say $x; }; my @a = 1,2,3; foo([0mâ�¤  $z is declared but not used at /tmp/Of8eWuU18i line 1:â�¤------> [32msub foo ($x,$y, [33mâ��[3…
18:32 p6eval ..rakudo d3de02: OUTPUT«1␤»
18:33 jnthn eval 'aaac' =~ /a(?#xxx){3}c/; $0
18:33 jnthn eval: 'aaac' =~ /a(?#xxx){3}c/; $0
18:34 jnthn ah, no buubot
18:34 jnthn also, $0 doesn't do that :)
18:36 brrt my @a = 1..Inf; sub foo($x) { say $x; }; foo(|@a);
18:38 brrt r: my @a = 1..Inf; sub foo($x) { say $x; }; foo(|@a);
18:38 p6eval rakudo d3de02: OUTPUT«Not enough positional parameters passed; got 0 but expected 1␤  in sub foo at /tmp/rUitvBYgCX:1␤  in block  at /tmp/rUitvBYgCX:1␤␤»
18:40 brrt1 joined #perl6
18:47 ingy joined #perl6
18:49 birdwindupbird joined #perl6
18:51 ingy hi jnthn o/
18:53 jnthn o/ ingy
18:53 jnthn Good journey back?
18:55 ingy jnthn: oui. uneventful == good
18:56 jnthn Indeed.
18:56 ingy you back too?
18:56 jnthn yeah
18:56 jnthn Also uneventfully.
18:56 ingy ah, the boring life! so grand
19:01 armitage81 joined #perl6
19:02 wooden joined #perl6
19:03 armitage81 joined #perl6
19:03 armitage81 joined #perl6
19:04 thou joined #perl6
19:21 dalek nqp: f982b88 | jnthn++ | src/QRegex/P5Regex/ (2 files):
19:21 dalek nqp: Revise whitespace and comment handling.
19:21 dalek nqp:
19:21 dalek nqp: This makes whitespace significant by default, requiring (?x) to make it
19:21 dalek nqp: insignificant again, as is the Perl 5 default. Also implements the (?#xxx)
19:21 dalek nqp: comment syntax.
19:21 dalek nqp: review: https://github.com/perl6/nqp/commit/f982b88e19
19:21 dalek nqp: 08e45ac | jnthn++ | t/p5regex/rx_metachars:
19:21 dalek nqp: Update tests for whitespace semantics.
19:21 dalek nqp: review: https://github.com/perl6/nqp/commit/08e45ac200
19:21 dalek nqp: 28bf11c | jnthn++ | src/QRegex/P5Regex/Actions.nqp:
19:21 dalek nqp: Implemnt (?m).
19:21 dalek nqp: review: https://github.com/perl6/nqp/commit/28bf11c08b
19:21 dalek nqp: cd58c13 | jnthn++ | src/QRegex/P5Regex/Actions.nqp:
19:21 dalek nqp: Give . Perl 5 semantics; honor (?s).
19:21 dalek nqp: review: https://github.com/perl6/nqp/commit/cd58c139c5
19:21 dalek nqp: 5238d7b | jnthn++ | t/p5regex/rx_metachars:
19:21 dalek nqp: Correct a test for Perl 5 semantics.
19:21 dalek nqp: review: https://github.com/perl6/nqp/commit/5238d7bb3b
19:26 dalek rakudo/nom: cc92def | jnthn++ | tools/build/NQP_REVISION:
19:26 dalek rakudo/nom: Get latest P5Regex improvements.
19:26 dalek rakudo/nom: review: https://github.com/rakudo/rakudo/commit/cc92def896
19:26 dalek rakudo/nom: 870d189 | jnthn++ | t/spectest.data:
19:26 dalek rakudo/nom: Run S05-modifier/perl5_5.t.
19:26 dalek rakudo/nom: review: https://github.com/rakudo/rakudo/commit/870d189bbc
19:26 dalek roast: 289e708 | jnthn++ | S05-modifier/perl5_5.t:
19:26 dalek roast: Fudge S05-modifier/perl5_5.t for Rakudo.
19:26 dalek roast: review: https://github.com/perl6/roast/commit/289e7084b8
19:26 dalek roast: 903d08b | jnthn++ | S05-modifier/perl5_ (2 files):
19:26 dalek roast: Rakudo unfudging.
19:26 dalek roast: review: https://github.com/perl6/roast/commit/903d08b86a
19:38 PacoAir joined #perl6
19:40 PacoAir joined #perl6
19:45 leont joined #perl6
19:51 PacoAir joined #perl6
19:51 rindolf joined #perl6
20:01 PacoAir joined #perl6
20:02 erkan joined #perl6
20:02 erkan joined #perl6
20:09 cognominal joined #perl6
20:15 nlpplz joined #perl6
20:20 benabik joined #perl6
20:24 birdwindupbird joined #perl6
20:30 MikeFair_ joined #perl6
20:31 fgomez joined #perl6
20:44 rindolf joined #perl6
20:56 bruges_ joined #perl6
20:57 raiph joined #perl6
21:00 jnthn sleep &
21:00 raiph sleep well and dream of large mops
21:02 raiph may i bring a bot (alpha status) that has nothing directly to do with perl 6 on to this channel?
21:02 LlamaRider joined #perl6
21:04 cognominal joined #perl6
21:18 cognominal_ joined #perl6
21:27 fgomez joined #perl6
21:45 cognominal__ joined #perl6
22:31 erkan joined #perl6
22:31 erkan joined #perl6
22:35 fridim_ joined #perl6
22:45 cognominal__ joined #perl6
23:00 rindolf joined #perl6
23:28 fgomez joined #perl6
23:53 grondilu joined #perl6
23:53 grondilu off topic:  spaceX is about to launch:  http://www.spacex.com/webcast/

| Channels | #perl6 index | Today | | Search | Google Search | Plain-Text | summary

Perl 6 | Reference Documentation | Rakudo