Camelia, the Perl 6 bug

IRC log for #perl6, 2015-07-07

Perl 6 | Reference Documentation | Rakudo | Niecza | Specs

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

All times shown according to UTC.

Time Nick Message
00:32 Ben_Goldberg joined #perl6
00:32 geekosaur joined #perl6
00:35 cognominal_ joined #perl6
00:46 tinyblak joined #perl6
00:51 dalek rakudo/nom: da530e3 | labster++ | src/core/Temporal.pm:
00:51 dalek rakudo/nom: Time zone changes now preserve fractional seconds
00:51 dalek rakudo/nom:
00:51 dalek rakudo/nom: Also get rid of some supersticious use of float() and .Int, use int div.
00:51 dalek rakudo/nom: Now 3% faster DateTime.now() ... still kinda slow.
00:51 dalek rakudo/nom: review: https://github.com/rakudo/rakudo/commit/da530e3049
00:56 timotimo labster: thanks for working on this :)
00:56 timotimo m: say now
00:56 camelia rakudo-moar 6e425f: OUTPUT«Instant:1436230654.277332␤»
00:57 timotimo does this also get faster, out of curiosity?
01:15 rmgk joined #perl6
01:30 vendethiel joined #perl6
01:32 kanl joined #perl6
01:34 labster timotimo: no, just the DateTime object, because it does time zone conversion
01:36 dayangkun joined #perl6
01:43 timotimo OK
01:46 timotimo still a good thing to improve, of course!
02:02 kaare_ joined #perl6
02:04 dalek roast: ee637c4 | skids++ | S06-signature/introspection.t:
02:04 dalek roast: Add idempotency tests for .perl of Signatures with anonymous parameters
02:04 dalek roast: review: https://github.com/perl6/roast/commit/ee637c4814
02:19 noganex_ joined #perl6
02:27 aborazmeh joined #perl6
02:27 aborazmeh joined #perl6
02:43 aborazmeh joined #perl6
02:43 aborazmeh joined #perl6
02:55 kanl m: say [||] ( True, False ) ?? 'a' !! 'b'; say [&&] ( True, False ) ?? 'a' !! 'b';
02:55 camelia rakudo-moar da530e: OUTPUT«a␤a␤»
02:55 * kanl blinks
02:59 dayangkun joined #perl6
02:59 ShimmerFairy m: say [||] ( True, False ) ?? 'a' !! 'b'; say ([&&] ( True, False )) ?? 'a' !! 'b';
02:59 camelia rakudo-moar da530e: OUTPUT«a␤b␤»
03:00 kanl why [||] need not be quoted?
03:00 ShimmerFairy The conditional was checking the truth value of the list (that is, ?(True, False) ),
03:00 ShimmerFairy m: say [||] (False, False) ?? 'a' !! 'b'
03:00 camelia rakudo-moar da530e: OUTPUT«a␤»
03:00 lsm-desktop joined #perl6
03:00 ShimmerFairy m: say ([||] (False, False)) ?? 'a' !! 'b'
03:00 camelia rakudo-moar da530e: OUTPUT«b␤»
03:01 ShimmerFairy the [||] needs to be in parens too, you just got lucky with the list you were using :)
03:02 kanl how is it parsed in the case when i was lucky?
03:02 kanl i'd expect it to say True/False instead of any varieties of 'a', 'b'
03:04 kanl ah, ic. [] has the lowest precedence, apparently.
03:05 kanl so [&&] on 'a'/'b' would get 'a'/'b'
03:05 leont Reduction operators are list operators, they have very low precedence
03:06 kanl ( True, False ) of course, evaluate to True, being not empty.
03:06 kanl thanks!
03:07 kanl it's probably one of those best-practices things, new operators increase potential for misuse :)
03:10 leont It's the same in perl5 really
03:11 kanl i'm not familiar with this feature in p5.
03:11 leont It doesn't have reduction operators, but it does have list operators
03:15 kanl leont: such as? ( i honestly am not familiar with any list ops in p5, other than things like splice et-al. :)
03:16 Ben_Goldberg m: sau ?(False, False)
03:16 camelia rakudo-moar da530e: OUTPUT«5===SORRY!5=== Error while compiling /tmp/aXgwRH9o2A␤Undeclared routine:␤    sau used at line 1. Did you mean 'say'?␤␤»
03:16 Ben_Goldberg m: say ?(False, False)
03:16 camelia rakudo-moar da530e: OUTPUT«True␤»
03:16 Ben_Goldberg m: say ?(False)
03:16 camelia rakudo-moar da530e: OUTPUT«False␤»
03:16 kanl m: say ?(False,)
03:16 camelia rakudo-moar da530e: OUTPUT«True␤»
03:16 Ben_Goldberg kanl, You read my mind!  I was about to type that :)
03:20 labster m: say ([&&] True, False) ?? 'a' !! 'b'; # don't need the inner parens, commas make a List
03:20 camelia rakudo-moar da530e: OUTPUT«b␤»
03:21 kanl old p5 habits die hard :p
03:24 dalek rakudo/nom: d524b22 | (Nick Logan)++ | src/core/IO/Path.pm:
03:24 dalek rakudo/nom: bugfix: chdir ensure `.` is resolved to abspath
03:24 dalek rakudo/nom:
03:24 dalek rakudo/nom: Fixes:
03:24 dalek rakudo/nom:
03:24 dalek rakudo/nom:     nickl@localhost:~/perl6$ perl6 -e 'say ".".IO.chdir("rakudo/t").IO.perl.say'
03:24 dalek rakudo/nom:     Failed to change the working directory to '/rakudo/t': does not exist
03:24 dalek rakudo/nom:
03:24 dalek rakudo/nom: This also addresses windows behavior where the volume would become lost.
03:24 dalek rakudo/nom: review: https://github.com/rakudo/rakudo/commit/d524b22aaa
03:24 dalek rakudo/nom: f0816d3 | lizmat++ | src/core/IO/Path.pm:
03:24 dalek rakudo/nom: Merge pull request #462 from ugexe/patch-9
03:24 dalek rakudo/nom:
03:24 dalek rakudo/nom: bugfix: chdir ensure `.` is resolved to abspath
03:24 dalek rakudo/nom: review: https://github.com/rakudo/rakudo/commit/f0816d3479
03:54 dalek roast: 961c60f | lizmat++ | S32-temporal/DateTime.t:
03:54 dalek roast: Unfudge now passing test, labster++
03:54 dalek roast: review: https://github.com/perl6/roast/commit/961c60f5ba
04:12 dj_goku joined #perl6
04:23 davido__ joined #perl6
04:24 amurf joined #perl6
04:29 davido___ joined #perl6
04:32 dalek rakudo/nom: f5ebbf4 | skids++ | src/core/Block.pm:
04:32 dalek rakudo/nom:   .assuming now produces closures with populated signatures.
04:32 dalek rakudo/nom:   ... (fixes RT#78240/RT#77744 noting that 2 tests in RT#77744 are
04:32 dalek rakudo/nom:   ...  outdated due to trying to use named parameters to fill positionals)
04:32 dalek rakudo/nom:   .assuming now supports * and Nil primers with special behaviors.
04:32 dalek rakudo/nom:   .assuming will try to bind primer arguments to a partial signature:
04:32 dalek rakudo/nom:   ... currently it will mix most failures into the returned closure.
04:32 synbot6 Link:  https://rt.perl.org/rt3/Publ​ic/Bug/Display.html?id=78240
04:32 dalek rakudo/nom:   ... eventually we can phase-in throwing them instead.
04:32 dalek rakudo/nom:   For now, subsignatures are mostly ignored during this bind.
04:32 dalek rakudo/nom:   For now, constraints pointing to captured types are stripped.
04:32 dalek rakudo/nom:   Where clauses and default value exprs are not evaluated until runtime invoke.
04:32 dalek rakudo/nom:   This currently uses EVAL to construct the closure, which is LTA,
04:32 dalek rakudo/nom:   but it gives us something functional/testable to work forward from.
04:32 dalek rakudo/nom:   Roast tests available at https://github.com/skids/roast/tree/assuming
04:32 dalek rakudo/nom: review: https://github.com/rakudo/rakudo/commit/f5ebbf480c
04:32 dalek rakudo/nom: 072d691 | lizmat++ | src/core/Block.pm:
04:32 dalek rakudo/nom: Merge pull request #463 from skids/assuming
04:32 dalek rakudo/nom:
04:32 dalek rakudo/nom:   .assuming now produces closures with populated signatures.
04:32 dalek rakudo/nom: review: https://github.com/rakudo/rakudo/commit/072d691c43
04:33 skids Thanks, lizmat++
04:33 dalek rakudo/nom: 07a05cd | lizmat++ | src/core/Exception.pm:
04:33 dalek rakudo/nom: Add latest P5 worries as exceptions
04:33 dalek rakudo/nom: review: https://github.com/rakudo/rakudo/commit/07a05cd181
04:33 dalek rakudo/nom: 369ec75 | lizmat++ | src/core/Exception.pm:
04:33 dalek rakudo/nom: Hmmm...  apparently we can't heredoc in the core
04:34 dalek rakudo/nom: review: https://github.com/rakudo/rakudo/commit/369ec75e43
04:34 dalek rakudo/nom: 47d1ed6 | lizmat++ | src/Perl6/Grammar.nqp:
04:34 dalek rakudo/nom: Make P5 reference worries typed
04:34 dalek rakudo/nom: review: https://github.com/rakudo/rakudo/commit/47d1ed6ae2
04:34 lizmat skids: yw
04:35 Dee22 joined #perl6
04:52 dalek rakudo/nom: a891f98 | lizmat++ | src/ (2 files):
04:52 dalek rakudo/nom: Make 0234 octal warning a typed exception
04:52 dalek rakudo/nom: review: https://github.com/rakudo/rakudo/commit/a891f98d49
04:53 ugexe zef can now bootstrap itself from source and install modules on windows/linux and moar/jvm :D https://gist.github.com/ugexe/2a2d4a2654dea9b253a2
04:53 * skids wonders how long to wait to push/unskip/unfudge spectests so as not to catch any autobuilds without the new .assuming code.
04:55 lizmat anybody smoking spectests is assumed to get the latest code
04:56 lizmat so it should be safe now, I think
04:57 dalek roast: a19359e | skids++ | S06-currying/named.t:
04:57 dalek roast: Tests for new .assuming implementation
04:57 dalek roast: review: https://github.com/perl6/roast/commit/a19359e5f7
04:57 dalek roast: d97da19 | skids++ | S06-currying/ (2 files):
04:57 dalek roast: Unfudge/unskip passing JVM tests
04:57 dalek roast: review: https://github.com/perl6/roast/commit/d97da19525
04:57 * lizmat runs a spectest
05:02 lizmat $ perl6 t/spec/S06-currying/named.t
05:02 lizmat ===SORRY!===
05:02 lizmat Could not find Test::Assuming in any of:
05:03 lizmat skids: could it be you forgot to add Test::Assuming ?
05:04 lizmat hmm... it also seems to cause t/spec/S17-supply/classify.t to hang
05:04 lizmat hmmm.. flapper
05:05 skids Oh doh I screwed that commit up.  Forgot to add after patching my main tree.
05:05 lizmat please PR, and I'll merge
05:06 leont joined #perl6
05:06 skids Rather than just push them?
05:06 lizmat ah, well, if you can push, then push!
05:07 dalek roast: 216231d | skids++ | / (4 files):
05:07 dalek roast: Add forgotten files for .assuming tests
05:07 dalek roast: review: https://github.com/perl6/roast/commit/216231dde6
05:07 * lizmat runs another spectest
05:07 skids Wow JVM spectest takes time.
05:08 lizmat yeah :-(
05:08 diana_olhovik_ joined #perl6
05:10 skids At least S06 is towards the top :-)
05:13 atroxaper joined #perl6
05:14 dalek roast: ab80106 | lizmat++ | S06-currying/named.t:
05:14 dalek roast: Add missing 'use lib'
05:14 dalek roast: review: https://github.com/perl6/roast/commit/ab80106073
05:14 lizmat skids:  after adding ^^, I get:
05:14 lizmat t/spec/S06-currying/named.rakudo.moar (Wstat: 768 Tests: 27 Failed: 3)
05:14 lizmat Failed tests:  4, 21, 27
05:14 lizmat TODO passed:   5, 22
05:19 skids Hrm those should be fudged.
05:19 lizmat even after that fix, I see all of the S17-supply tests flapping, and worse, hanging when they flap
05:19 skids I don't think .assuming is used anywhere in core.
05:20 lizmat I think the EVAL is somehow interacting badly
05:20 lizmat true
05:20 lizmat but still, empirically, I see this
05:21 lizmat let me revert your patch (locally) and make sure it's not one of the things I just did this morning
05:22 * skids wonders why his "todo"s don't work in named.t
05:27 lizmat no flappers with your patch reverted  :-(
05:27 skids Hrm.
05:27 lizmat how about we give it a day and hope jnthn will be able to shed a light as to why your patch has this effect ?
05:28 skids Yeah.  I'm up too late yet again.
05:29 skids Is a new moarvm invoked for each test file?
05:29 lizmat yes, afaik
05:30 lizmat judging from top and the hanging tests, I'm quite sure  :-)
05:30 skids Soo how the heck... well it's not like I've never seen code work just because I moved something else around.
05:31 * skids wonders if anyone can wider-ecosystem-grep to see how much .assuming use is out there.
05:32 lizmat perhaps someone will as they wake up
05:32 * lizmat is just up early to ventilate the house before another hot day
05:35 lizmat .tell jnthn Could you have a look as to why f5ebbf480c5936 is causing S17-supply hangs
05:35 yoleaux lizmat: I'll pass your message to jnthn.
05:36 skids Yeah my housemate goes crazy with the box fans about this time of night.
05:36 tinyblak joined #perl6
05:36 skids Probably using more wattage than an AC would.
05:37 lizmat only using natural ventilation here (open all of the possible windows *wide*)
05:38 skids Anyhow I hate to leave breakage in my wake, but my "wake" is waning fast.
05:40 lizmat don't worry about it...
05:40 lizmat mind if I try some things in the mean time ?
05:41 skids No go right ahead.  I've got nothing related pending.
05:41 skids good n8, thanks for the help again
05:41 spollei left #perl6
05:41 lizmat yw, sleep well!
05:42 dalek rakudo/nom: eaee44f | lizmat++ | src/Perl6/Grammar.nqp:
05:42 dalek rakudo/nom: Seems we don't need worryobs anymore
05:42 dalek rakudo/nom: review: https://github.com/rakudo/rakudo/commit/eaee44f812
05:58 dalek rakudo/nom: 0585860 | lizmat++ | src/core/Block.pm:
05:58 dalek rakudo/nom: Return more gently
05:58 dalek rakudo/nom: review: https://github.com/rakudo/rakudo/commit/058586052a
05:58 dalek rakudo/nom: cbff68a | lizmat++ | src/core/Block.pm:
05:58 dalek rakudo/nom: Change $s.substr(0,..) eq $f to $s.starts-with($f)
05:58 dalek rakudo/nom:
05:58 dalek rakudo/nom: Oddly enough, this change seems to fix the hanging S17-supply tests!
05:58 dalek rakudo/nom: review: https://github.com/rakudo/rakudo/commit/cbff68a64d
06:04 lizmat .tell jnthn empirically, cbff68a fixes the hanging S17-supply tests
06:04 yoleaux lizmat: I'll pass your message to jnthn.
06:04 diana_olhovik_ joined #perl6
06:12 mr-foobar joined #perl6
06:27 FROGGS joined #perl6
06:31 RabidGravy joined #perl6
06:33 atroxaper joined #perl6
06:44 abraxxa joined #perl6
06:46 brrt joined #perl6
06:50 domidumont joined #perl6
06:50 quester joined #perl6
06:54 domidumont joined #perl6
07:00 espadrine_ joined #perl6
07:11 darutoko joined #perl6
07:11 xinming joined #perl6
07:21 g4 joined #perl6
07:21 g4 joined #perl6
07:21 nine That's odd:
07:21 nine m: say [{a => 1}][0].perl; say [{a => 1}, {a => 2}]>>.perl
07:21 camelia rakudo-moar cbff68: OUTPUT«{:a(1)}␤a => 1 a => 2␤»
07:22 nine Why is >>.perl giving me something different than .perl on individual elements?
07:23 moritz nine: because >> descends into hashes
07:24 nine m: say [{a => 1}, {a => 2}].map: *.perl
07:24 camelia rakudo-moar cbff68: OUTPUT«{:a(1)} {:a(2)}␤»
07:24 lizmat m: (a=>1).perl.say
07:24 camelia rakudo-moar cbff68: OUTPUT«:a(1)␤»
07:24 nine So there is a difference between map and >>
07:25 moritz yes
07:25 lizmat m: say [<a b>]>>.WHAT.say
07:25 camelia rakudo-moar cbff68: OUTPUT«(Array)␤True␤»
07:25 lizmat m: say [<a b>]>>.WHAT.elems.say
07:25 camelia rakudo-moar cbff68: OUTPUT«0␤True␤»
07:25 lizmat m: say [<a b>]>>.elems.say
07:25 camelia rakudo-moar cbff68: OUTPUT«1 1␤True␤»
07:25 * lizmat should wak up
07:26 El_Che lizmat: wake up or you'll miss Christmas!
07:26 lizmat getting up at 5am is not my cuppa tea
07:28 nine lizmat: still so hot up there?
07:28 RabidGravy marnin!
07:29 lizmat nine: high of 31C / 88F expected again
07:29 moritz we expect more like 36C
07:31 El_Che lizmat: where are you now?
07:31 lizmat at home  :-)
07:31 El_Che exotic limburg :)
07:32 lizmat RabidGravy o/
07:32 RabidGravy are we all fabulous this morning?
07:33 labster super fabulous here 🌈
07:33 lizmat the part of me that's awake, is fabulous
07:33 * moritz is tinkering with continuous deployment
07:33 RabidGravy most excellent!
07:33 moritz fun, if a bit tedious
07:34 lizmat .oO( all the time! )
07:35 labster I almost have some comparison operators for DateTime, just need to write some tests.
07:50 DrForr It was 37 or so yesterday afternoon.
07:52 moritz yesterday was fine here (not too hot), but it was 37 to 38 on the weekend
07:57 masak morning, #perl6
07:58 moritz 'o masak
07:59 dakkar joined #perl6
08:02 masak labster++ # DateTime cmp ops
08:10 domidumont joined #perl6
08:20 masak I discovered I needed them the other day when I was writing Real Actual Code.
08:24 dalek roast: c1c25bf | lizmat++ | S02-types/WHICH.t:
08:24 dalek roast: Add the X::Worry classes
08:24 dalek roast: review: https://github.com/perl6/roast/commit/c1c25bf4fa
08:24 lizmat afk for a few hours&
08:25 virtualsue joined #perl6
08:28 [TuxCM] joined #perl6
08:32 rindolf joined #perl6
08:37 atroxaper joined #perl6
08:39 mr-fooba_ joined #perl6
08:46 larion joined #perl6
08:46 Fleurety joined #perl6
08:48 smls joined #perl6
08:48 oha gethost() is not implemented in rakudo, right?
08:49 smls right
08:50 smls The design docs only seem to mention this signature for 'fail':
08:50 smls multi fail (Str $message)
08:50 smls But Rakudo has these:
08:50 smls sub fail (Exception $e)
08:50 smls sub fail ($payload)
08:50 smls sub fail (*@msg)
08:50 smls Are those official (and should be documented on p6doc)?
08:52 smls And isn't the second-to-last one redundant?
08:54 moritz not quite
08:54 moritz it probably doesn't stringify $payload
08:54 moritz whereas the *@msg case stringifies
08:55 moritz (which makes the Str case redundant)
08:55 moritz but it's a nice optimization
08:55 moritz I'm pretty sure fail ( Exception ) should be documented on perl6/doc
08:55 smls *@msg dfoesn't stringify either for the n=1 case:  my $payload = @msg == 1 ?? @msg[0] !! @msg.join;
08:55 moritz oh
08:55 moritz the way I understand multi dispatch, it should never happen
09:05 labster masak: I'm afraid time cmp ops are going to have to wait until tomorrow, my brilliant plans didn't take time zones into account :/  Incidentally, how do you feel about comparing Date to DateTime?  Might DWIM, might just be weird.
09:06 masak labster: uuh
09:06 masak labster: (1) just convert both DateTimes to Instant and compare those? you don't have to do the calculation yourself...
09:07 labster Yes that makes more sense I realize now, but I had fun.
09:07 masak labster: (2) I think we should disallow comparing Date to DateTime. even though for "most" values it makes sense, for some it doesn't.
09:07 masak I'd rather people convert their DateTime to a Date, and compare that with the other Date.
09:08 labster Right, so no Datish candidates then.
09:09 masak main hiccup with DateTime vs Date comparisons would be when the DateTime falls within the Date. breaks transitivity.
09:10 espadrine_ joined #perl6
09:10 masak rather than hide the underlying complexity of that, better to force the programmer to be explicit.
09:13 masak lunch &
09:15 rurban joined #perl6
09:15 mr-foobar joined #perl6
09:17 oha m: say v1.3 le v1.25, v1.3 cmp v1.25;
09:17 camelia rakudo-moar cbff68: OUTPUT«FalseLess␤»
09:19 oha is le coercing to Str, while cmp being smart?
09:19 moritz yes
09:20 moritz m: say v1.3 before v1.25
09:20 camelia rakudo-moar cbff68: OUTPUT«True␤»
09:20 oha i see now, i should use before
09:20 oha right
09:20 oha thanks
09:20 dalek doc: ad5acd2 | smls++ | lib/Type/Exception.pod:
09:20 dalek doc: Document sub fail
09:20 dalek doc: review: https://github.com/perl6/doc/commit/ad5acd2efa
09:26 bin_005 joined #perl6
09:28 AlexDaniel joined #perl6
09:36 amurf joined #perl6
09:37 brrt joined #perl6
09:44 tinyblak joined #perl6
09:49 andreoss joined #perl6
09:50 * timotimo had unRESTful sleep :|
09:50 telex joined #perl6
09:50 timotimo not actually sure if the sleep can be said to have been had
09:51 RabidGravy Oooh "Package rakudo-star.x86_64 0:0.0.2015.06-1.fc21 will be an update" pretty snappy there from Fedora
09:52 VinceDee joined #perl6
09:59 nowan joined #perl6
09:59 atroxaper joined #perl6
10:14 rindolf joined #perl6
10:22 aborazmeh joined #perl6
10:22 aborazmeh joined #perl6
10:42 huf joined #perl6
11:00 smls Can the Perl 6 type system express  "either a string, or an array of strings"  ?
11:01 xinming joined #perl6
11:05 vendethiel smls: it's always the case :P
11:05 vendethiel m: my $a = "a string"; say $a[0]; # *g*
11:05 camelia rakudo-moar cbff68: OUTPUT«a string␤»
11:05 vendethiel m: sub f(@strs) { say @strs.elems }; f("hey"); f(("hey", "foo"));
11:05 camelia rakudo-moar cbff68: OUTPUT«5===SORRY!5=== Error while compiling /tmp/c7TCdKpIP0␤Calling f(str) will never work with declared signature (@strs)␤at /tmp/c7TCdKpIP0:1␤------> 3sub f(@strs) { say @strs.elems }; 7⏏5f("hey"); f(("hey", "foo"));␤»
11:06 smls No, I mean a type constraint that aceepts an Array objects whose elements are Str, *or* a single Str, but nothing else
11:09 vendethiel m: subset OneOrManyStr where all($_) ~~ String; say "a" ~~ OneOrManyStr; say ("a", "b") ~~ OneOrManyStr;
11:09 camelia rakudo-moar cbff68: OUTPUT«5===SORRY!5=== Error while compiling /tmp/OrGNEwYzi_␤Undeclared name:␤    String used at line 1. Did you mean 'Stringy'?␤␤»
11:09 vendethiel m: subset OneOrManyStr where all($_) ~~ Str; say "a" ~~ OneOrManyStr; say ("a", "b") ~~ OneOrManyStr;
11:09 camelia rakudo-moar cbff68: OUTPUT«True␤False␤»
11:10 vendethiel m: subset OneOrManyStr where all($_.list) ~~ Str; say "a" ~~ OneOrManyStr; say ("a", "b") ~~ OneOrManyStr;
11:10 camelia rakudo-moar cbff68: OUTPUT«True␤True␤»
11:10 kanl joined #perl6
11:10 vendethiel smls: sigils aren't first-class, so... I guess that way?
11:11 smls hm, I guess
11:12 domidumont joined #perl6
11:14 smls is there a declarative way (i.e. without 'where') to specify an "Array whose elements are Str" constraint?
11:14 smls Array[Str] does the wrong thing
11:15 smls Array[Str]() does not seem to work either
11:15 vendethiel smls: not if you didn't declare your array explicitly as such
11:16 smls :(
11:16 oha smls, i might be wrong, but i read something about roles that could support template type signatures, but not sure if that would help anyways
11:18 vendethiel problem being that "if you pass an Array to a function expecting Array[Str], someone *outside* could add something that's not an int"
11:18 vendethiel s/int/Str/
11:20 oha smls, http://doc.perl6.org/language​/objects#Parameterized_Roles but i don't know if there is a "core" role that works as an array container
11:21 vendethiel there's Array[X] AFAIK
11:25 amurf joined #perl6
11:32 nine Captures are the closest analogue to Perl 5's scalar references we have, aren't they?
11:35 moritz or containers (type Scalar), depending on the context
11:37 nine Well, I'm trying to find something that can represent a P5 scalar ref in Perl 6 land. DBIx::Class expects a reference to a string for literal SQL and I wonder how I could pass that from Perl 6.
11:39 smls exoecting a Capture would be the most generic way to handle such cases for the purposes of Inline::Perl
11:40 smls though if you're talking about *porting* DBIx::Class to Perl 6, you should change the API to be more 6ish.
11:40 nine smls: I'm talking about using Perl 5's DBIx::Class as is :)
11:41 lizmat nine: what would be wrong with just passing the string from P6 ?
11:41 lizmat and make it a ref on the P5 side?
11:42 lizmat by doing a nqp::getattr($s,Str,'$!value') ?
11:42 smls lizmat: I guess the PErl 5 side wants to distinguish different meanings basewd on whether it got a CALAR
11:42 smls or reference
11:43 smls *scalar
11:43 nine lizmat: the string ref is an argument for DBIx::Class::ResultSet::search. Making it a ref on the P5 side would mean that I have to write a wrapper for every call of that method where I want to supply a ref.
11:43 lizmat but that's really an optimization, isn't it?
11:43 RabidGravy for anyone who cares DBIsh seems afflicted by the recent \  Capture changes
11:44 lizmat because it generates a lot of worries?  or maybe too many?
11:45 nine $resultset->search({foo => "bar"}) generates ~~ select * from table where foo = 'bar'; while $resultset->search({foo => \"= bar"}) generates ~~ select * from table where foo = bar; # without the quoting, thereby allowing literal SQL
11:45 RabidGravy a lot of worries, I'll check it out later
11:45 nine m: sub test(Positional $foo) { say $foo.WHAT }; test(\("foo"));
11:45 camelia rakudo-moar cbff68: OUTPUT«Type check failed in binding $foo; expected 'Positional' but got 'Capture'␤  in sub test at /tmp/PAyfZfHCh3:1␤  in block <unit> at /tmp/PAyfZfHCh3:1␤␤»
11:46 nine But according to http://doc.perl6.org/type/Capture class Capture does Positional does Associative { }
11:46 lizmat Associative for the named parameters, I think
11:47 lizmat I mean, there's a *lot* of machinery around a Capture
12:00 ribasushi nine: both \$sql and \[ $sql, @bind ] are actually SQL::Abstract syntax thingies
12:01 ribasushi so the application is wider
12:02 lizmat ribasushi: would \[$sql]' be the same as \$sql ?
12:03 ribasushi lizmat: yes, but both are user-facing API
12:03 lizmat so nine could fake this on the P6 side by either doing $sql or [$sql]
12:04 atroxaper joined #perl6
12:04 ribasushi he can't just do $sql... how do you tell it apart from "value containing the string $sql"
12:04 ribasushi let me show a clearer example
12:05 ShimmerFairy Would it be possible to make use of blocks with  use v5;  in them?
12:05 huf :q!
12:05 huf nooooo
12:09 ribasushi http://paste.scsys.co.uk/492394
12:09 gfldex joined #perl6
12:09 ribasushi lizmat: ^^
12:09 ribasushi smls: ^^
12:09 ribasushi nine: ^^
12:09 ribasushi note the presence/absence of ` quotes
12:09 Possum joined #perl6
12:10 moritz maybe one needs to create a type P5Ref or so for explicit (un)marshalling
12:12 * ribasushi doesn't have an informed opinion about the p6 side, just pointing that all of the above are different invocations in active use by end users
12:14 smls moritz: So one would have to write  P5Ref.new("= col as-is")  on the Perl 6 side?
12:14 smls instead of   \"= col as-is"
12:15 moritz smls: yes
12:15 moritz maybe there's a way to make Capture marshalling DWIM
12:15 smls I guess P5Ref could be made to act like Scalar, so that when it is *returned* from a P5 sub, the Perl 6 side doesn't even have to care that it got a reference
12:16 smls but can still check  ~~ P5Ref  in case that it does care
12:17 ribasushi http://paste.scsys.co.uk/492397 <--- better paste, showcasing *why* there is a { -value }
12:17 smls getting back a Capture would be... unwieldy.
12:17 smls thought for *calling* Perl 5 subs,  \  is prettier than   P5Ref.new()
12:17 ribasushi (think PostgreSQL arrays)
12:18 moritz m: sub prefix:<P5\>($x) { say "P5 ref to $x" }; say P5\"foo"
12:18 camelia rakudo-moar cbff68: OUTPUT«5===SORRY!5=== Error while compiling /tmp/8CXnRrZRO2␤Unable to parse expression in quote words; couldn't find final '>'␤        ␤at /tmp/8CXnRrZRO2:1␤------> 3$x) { say "P5 ref to $x" }; say P5\"foo"7⏏5<EOL>␤    expecting any of:␤    …»
12:18 moritz m: sub prefix:<P5\>($x) { say "P5 ref to $x" }; say P5\ "foo"
12:18 camelia rakudo-moar cbff68: OUTPUT«5===SORRY!5=== Error while compiling /tmp/fiI7NRG00w␤Unable to parse expression in quote words; couldn't find final '>'␤        ␤at /tmp/fiI7NRG00w:1␤------> 3x) { say "P5 ref to $x" }; say P5\ "foo"7⏏5<EOL>␤    expecting any of:␤    …»
12:19 moritz m: sub prefix:<P5\\>($x) { say "P5 ref to $x" }; say P5\ "foo"
12:19 camelia rakudo-moar cbff68: OUTPUT«5===SORRY!5=== Error while compiling /tmp/6KQ_KGO_Dy␤Bogus postfix␤at /tmp/6KQ_KGO_Dy:1␤------> 3P5\\>($x) { say "P5 ref to $x" }; say P57⏏5\ "foo"␤    expecting any of:␤        infix␤        infix stopper␤        postfix␤        …»
12:20 ribasushi and then there is "the other direction", also public API and used all over the place: https://metacpan.org/pod/DBI​x::Class::ResultSet#as_query
12:21 nine moritz: introducing a P5Ref type for this (presumabliy in Inline::Perl5) would be a step back to where the user has to use Inline::Perl5 explicitly.
12:21 nine ribasushi: yep, that happens when people who write extremely important modules know perl too well.
12:23 ribasushi all of these "design decisions" were made way before me, and the step from one to the other is straightforward
12:23 ShimmerFairy joined #perl6
12:23 ribasushi "ohhh you want to pass in whatever? - sure just give a reference to it"
12:23 ribasushi "ooooh... you also need to pass binds... hmm well if \$sql means as-is, then \[ $sql, @binds ] is a no-brainer"
12:24 ribasushi "hmmm you want to pass around random snippets in a stateless manner? - well we will just return you the \[ ... ] you already know and love"
12:24 nine To be fair, it is actually a quite ok interface.
12:24 moritz and this is where sqlalchemy just feels much better designed
12:24 smls nine, moritz: Why not both? Automatically turn a P6 Capture into a P5 reference, but when *returning* a P5 reference to P6 code, return it as a P5Ref object that acts like P6's Scalar
12:24 Alina-malina joined #perl6
12:25 ribasushi moritz: haven't had much experience with it, so can't comment
12:25 nine smls: I'd really like this stuff to round-trip without modification
12:25 nine ribasushi: sqlalchemy really is worth a look
12:25 moritz ribasushi: I'm using it for a $work project now, and quite enjoy it
12:25 tinyblak joined #perl6
12:25 ribasushi if it is better designed surface-wise, but without the ability to inject random stuff in any spot - this is actually a drawback
12:25 moritz ribasushi: also it gives much better error messages when doing something wrong during the schema definition
12:26 ribasushi nod
12:26 smls nine: Well, it still rount-trip in the sense that you could feed the P5Ref back to P5:  Capture --1st-trip--> P5Ref --2nd-trip--> P5Ref ...
12:27 leont joined #perl6
12:27 ribasushi moritz: I will be the first to say - DBIC is rather user-unfriendly, as the user-facing side was not really designed, but instead built on top of built on top of built on top ;/
12:28 ribasushi in any case - does either of you have a pointer to sqlalchemy's "insert random RDBMS-specific thing" ?
12:30 moritz ribasushi: http://docs.sqlalchemy.org/e​n/latest/core/compiler.html is the first thing I could find
12:31 moritz ribasushi: doesn't seem to be quite as ad-hoc as dbic
12:32 nine ribasushi: http://docs.sqlalchemy.org/en/rel_​1_0/core/tutorial.html#using-text
12:33 nine smls: but if I give a Capture to Perl 5 code that just returns it, I get some weird P5Ref thing back instead of what I put in.
12:34 ribasushi right... that's what I got back when I was looking - it's an "either/or"
12:34 smls true
12:34 ribasushi wheread in DBIC he "low-tech" approach allowed for arbotrary "mix-n-match"
12:34 ribasushi which has its own strengths and drawbacks
12:35 ribasushi bah mucho typos :/
12:35 nine ribasushi: this looks pretty mix-n-match to me: select([ text("users.fullname || ', ' || addresses.email_address AS title") ]).where(and_(text("users.id = addresses.user_id"),
12:36 ribasushi nine: I meant more like this: https://youtu.be/aqUcMFalaek?t=193
12:36 ribasushi i.e. usable directly from the high-level API
12:37 ribasushi it's likely possible with a custom-compilation akin to Class::DBI, but that borders on "SQL dictionary" in a sense
12:38 nine In any case, I can't wait to see the results, when someone finally uses all of Perl 6's possibilities to create the one API to rule them all :)
12:38 ribasushi if someone takes on this project I am always available to shoot holes in whatever beta-API someone comes up with
12:39 * ribasushi doesn't have many design chops, but has plenty of "this is bad, because users will abuse it like that" experience
12:40 nine I hope this someone will not make the same mistake like pretty much all others and starts with basic queries. One should really take the most extreme query imaginable with correlated subqueries, common table expressions, conditionals, custom functions and what not and create the API around that. Because that's where APIs usually really fall apart completely.
12:41 ribasushi this.
12:45 dalek roast: 6543aed | lizmat++ | S02-types/WHICH.t:
12:45 dalek roast: Somehow we messed up with the last commit
12:45 dalek roast: review: https://github.com/perl6/roast/commit/6543aedfd5
12:45 cdc_ m: so 2 == 2 & True
12:45 camelia rakudo-moar cbff68: ( no output )
12:45 cdc_ m: say so 2 == 2 & True
12:45 camelia rakudo-moar cbff68: OUTPUT«False␤»
12:45 lizmat .o( me, myself and I )
12:45 cdc_ hello #perl6, is this expected: ^^
12:46 lizmat m: say (2 & True).perl
12:46 camelia rakudo-moar cbff68: OUTPUT«all(2, Bool::True)␤»
12:46 moritz m: say so (2 == 2) & True
12:46 camelia rakudo-moar cbff68: OUTPUT«True␤»
12:46 moritz cdc_: looks pretty non-surprising to me
12:46 moritz & binds tigther than ==
12:47 cdc_ oops, thanks!
12:47 moritz so you're checkint 2 == (2 & True), which autothreads to (2 == 2) & (True == 2)
12:47 moritz which evaluates to True & False
12:47 moritz which again collapses to False
12:47 cdc_ moritz: many thanks for the explanation :)
12:47 moritz cdc_: you're welcomew
12:48 moritz s/w$//
12:49 domidumont joined #perl6
12:54 hoelzro (timotimo|lizmat)++ # p6weekly
12:59 zakharyas joined #perl6
13:05 abraxxa1 joined #perl6
13:18 timotimo thanks :)
13:18 timotimo liz gets all the credit for lifting it off my shoulders for the last few weeks
13:19 timotimo or at least all my kudos
13:19 timotimo lizmat++ # good work on the p6weekly

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

Perl 6 | Reference Documentation | Rakudo | Niecza | Specs