Camelia, the Perl 6 bug

IRC log for #perl6, 2015-08-04

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:00 Zoffix Sounds scary :)
00:02 timotimo lucasb: maybe the combinations method should flat-out throw an exception if it gets an Index instance? :P
00:03 TimToady m: say <a b c>.combinations("0").perl
00:03 camelia rakudo-moar a38b59: OUTPUT«Cannot call combinations(Str: Str, Str, Str); none of these signatures match:␤    (List $: Int $of, *%_)␤    (List $: Range $ofrange = { ... }, *%_)␤  in block <unit> at /tmp/JxchiHTiyJ:1␤␤»
00:03 timotimo as it makes no sense to get as many items in the combinations as the position of something in some string is ...
00:03 lucasb In the specific case of .combinations, the simple fix would be a line like "return ((),) if $k == 0"
00:04 lucasb timotimo: I know my example was contrived :)
00:05 lucasb but maybe there are other places that accepts a Int and tests it with 'if $n' or 'unless $n' ...
00:05 Sgeo Maybe 0 should just be truthy
00:05 TimToady I was leaning toward ifdef/whiledef until I realized whiledef doesn't help much, since whiledef "abc".index('a',$pos) -> $pos {...} doesn't actually work
00:05 Sgeo Or maybe there should be an if-defined function that passes to a pointy block the result
00:05 timotimo Sgeo: not in general, no
00:06 timotimo if-defined doesn't help, i don't think
00:06 timotimo er, wait, yeah it does
00:06 timotimo time for me to get some rest
00:06 b2gills If combinations coerced to Int it would work as is
00:06 TimToady ifdef index "abc",index('a') -> $pos {...} is okay
00:06 TimToady er
00:07 TimToady ifdef "abc".index('a') -> $pos {...} is okay
00:07 Sgeo Maybe if could be flexible in some way that allows both transforming into something for a truthy test and keeping the original
00:07 TimToady since you're not trying to feed $pos back into the index
00:07 b2gills m: say "abc".index('a').Int.^name
00:07 camelia rakudo-moar a38b59: OUTPUT«Int␤»
00:07 timotimo schwartzian conditional
00:08 Sgeo Actually sounds a bit like when if it wasn't too overly elaborate to do the given or $_ assign
00:08 b2gills m: my $i = "abc".index('a'); say so $i; say so $i.Int
00:08 camelia rakudo-moar a38b59: OUTPUT«True␤False␤»
00:09 TimToady really, we should just have a version of index that returns all the entries as a list, and not try to use explicit pos for that
00:10 TimToady then it's just: for "abc".indices('a') {...}
00:10 dha So. If I were to change the -M section in 5to6.pod, should I do it directly to the main repo, or fork and put in a pull request for someone else to review and change?
00:11 TimToady forgiveness > permission
00:11 laouji joined #perl6
00:12 dha All right, then. :-)
00:12 TimToady the only downside is you have to be prepared to be forgiven :)
00:14 timotimo good night everybody!
00:14 dha night timotimo
00:16 tony-o how do we get blog posts up in p6 weekly/?
00:19 flussence step 1: get noticed, step 2: ???
00:20 tony-o cool
00:20 tony-o super cool
00:21 flussence that's about it, I've been mentioned there without any interaction
00:21 dha step 3: Profit!
00:21 ShimmerFairy TimToady: I think I like the sound of indices, and testing its size to see if anything's found (and maaaaybe get rid of index in favor of specifying from which direction with first-/last-index ?)
00:21 b2gills There is a question about "How to get start with Perl6?" on StackOverflow if someone wants to add anything https://stackoverflow.com/q/31791362/1337 No account necessary, unless you want those sweet rep points
00:27 BenGoldberg joined #perl6
00:28 TimToady ShimmerFairy: I run with t/spec linked into roast
00:29 TimToady works fine
00:29 ShimmerFairy TimToady: I set that up, I just have to be careful about git clean -dfx now :)
00:30 TimToady yeah, I never do that
00:30 * TimToady leaves too much tmp stuff sitting around for that
00:33 ShimmerFairy btw, it seems first-index is broken:
00:33 ShimmerFairy m: say "abc".first-index("a"); say "abc".index("a")
00:33 camelia rakudo-moar a38b59: OUTPUT«Nil␤0␤»
00:33 dha I have a note here that you can still "no" a pragma in Perl 6, but not a module. Is that, in fact, correct?
00:34 TimToady yes, we generally rely on lexical scoping for limiting the scope now
00:34 TimToady since imports are lexical
00:34 dha *nod* thanks.
00:36 dalek doc: 8c725bf | (David H. Adler)++ | lib/Language/5to6.pod:
00:36 dalek doc: Changed 5to6.pod to reflect the actual status of -M/-m
00:36 dalek doc: review: https://github.com/perl6/doc/commit/8c725bf579
00:36 ShimmerFairy I almost want pragmas to have a different syntax from modules, unless pragmas are supposed to be vaguely module-esque (as I understand it, currently pragmas just flip switches in P6's grammar)
00:37 b2gills pragmas in Perl 5 are modules
00:37 * skids wonders if a camelia directive could be spun up with jnthn++s GLR code loaded.
00:37 ShimmerFairy .oO(  no warnings; ... { yes warnings; ... }  )
00:40 laouji joined #perl6
00:40 ShimmerFairy Unless Perl 6 is still planned to allow pragmas written by external sources in the form of modules, I think it'd be nice if pragmas looked a bit different from modules in usage.
00:42 laouji joined #perl6
00:51 Sgeo m: if 0 -> $x { say "o.O"; } else { say $x; }
00:51 camelia rakudo-moar a38b59: OUTPUT«5===SORRY!5=== Error while compiling /tmp/GtXcNRyoHh␤Variable '$x' is not declared␤at /tmp/GtXcNRyoHh:1␤------> 3if 0 -> $x { say "o.O"; } else { say 7⏏5$x; }␤»
00:51 Sgeo m: if 0 -> $x { say "o.O"; } else -> $x { say $x; }
00:51 camelia rakudo-moar a38b59: OUTPUT«0␤»
00:51 Sgeo :)
00:51 ShimmerFairy m: if (42 but False) -> $x { say "o.O"; } else -> $x { say $x; }
00:51 camelia rakudo-moar a38b59: OUTPUT«42␤»
00:51 ShimmerFairy huh, didn't expect that to work :)
00:52 ShimmerFairy m: if (42 but False) -> $x { say "o.O"; } elsif (21 but False) { say "still o.O" } else -> $x { say $x; }
00:52 camelia rakudo-moar a38b59: OUTPUT«21␤»
00:53 ShimmerFairy looks like 'else' gets passed the last branch's test. Not sure if that's a bug or not though :)
00:55 llfourn joined #perl6
01:02 Sgeo Maybe the first way is best, if if is going to stay magic
01:03 Sgeo So you could get each test's value in later tests
01:03 Sgeo But then you lose the idea of pointy blocks for if
01:04 TimToady we will never scope a variable to outside its block like that
01:04 TimToady the only exception is signature declarations like that
01:04 TimToady but P5's mysterious extra scopes are not gonna happen in P6
01:04 ShimmerFairy so else getting a previous test value is a bug, I take it?
01:05 Sgeo else getting a previous test value can be useful though, e.g. if you're testing for valuable or failure
01:05 Sgeo But getting only the previous one seems limiting
01:09 TimToady the main use case does not care about elsif
01:09 TimToady ShimmerFairy: not a bug, since you pass it explicitly
01:09 yeahnoob joined #perl6
01:11 Sgeo m: if Mu but True { say "Mu but True"; } else { say "Mu but True is falsey?"; }
01:11 camelia rakudo-moar a38b59: OUTPUT«Mu but True␤»
01:12 Sgeo Does that make a new Mu or a shim around Mu or something?
01:13 ShimmerFairy My random guess as to what's happening is that, since the if/elsif/else construction is taken as one expression, said construction keeps around just one 'condtional' value across the branches, writing it with whatever the latest result is.
01:14 geekosaur http://design.perl6.org/S12.html#Ano​nymous_Mixin_Roles_using_but_or_does
01:14 [Coke] m: (Mu but True).perl.say
01:14 camelia rakudo-moar a38b59: OUTPUT«Mu+{<anon>}␤»
01:14 * geekosaur should probably use the Snn:ll syntax but looked it up in the html, not the text
01:14 geekosaur anyway it's an anonymous mixin
01:18 dayangkun joined #perl6
01:19 dha joined #perl6
01:24 rmgk_ joined #perl6
01:34 tony-o m: say "hello".^can('something');
01:34 camelia rakudo-moar a38b59: OUTPUT«␤»
01:34 tony-o m: say "hello".^can('something'); say 'hello'.^can('something').DEFINED;
01:34 camelia rakudo-moar a38b59: OUTPUT«␤Method 'DEFINED' not found for invocant of class 'Parcel'␤  in block <unit> at /tmp/oH9eGctttL:1␤␤»
01:34 tony-o m: say "hello".^can('something'); say 'hello'.^can('something').DEFINITE;
01:34 camelia rakudo-moar a38b59: OUTPUT«␤True␤»
01:35 japhb m: say "hello".^can('something').WHAT;
01:35 yoleaux 2 Aug 2015 07:47Z <azawawi> japhb: re your discussion with timotimo++ about Electron. It is basically chrome + nodejs + API which we are accessing via JSON::RPC. We're setting up a nodejs jsonrpc server and using it via JSON::RPC and wrapping all into lovely p6 classes :)
01:35 camelia rakudo-moar a38b59: OUTPUT«(Parcel)␤»
01:35 yoleaux 2 Aug 2015 07:48Z <azawawi> japhb: examples are found here https://github.com/azawawi/perl6-a​tom-electron/tree/master/examples
01:36 japhb tony-o: ^^ That's why, .^can is returning all matches, so always a list-like thing (a Parcel, pre-GLR)
01:36 tony-o i'm more trying to figure out what .DEFINITE does
01:37 japhb tony-o: If it's an instance, not a type object.
01:37 tony-o i saw it somewhere that i thought was getting false positives
01:37 japhb This is faster than .defined, and also not overridden by adding a 'method defined'
01:38 japhb .tell azawawi Ah, thank you for the Electron info!
01:38 yoleaux japhb: I'll pass your message to azawawi.
01:39 tony-o makes sense why with a parcel it gets True where I'd not suspect it
01:39 tony-o then, thanks japhb
01:39 japhb yw!
01:47 colomon joined #perl6
01:49 Sgeo Can .DEFINITE be overridden?
01:56 Sgeo "X::ControlFlow
01:56 Sgeo Thrown when a control flow construct (such as next or redo) is called outside the dynamic scope of an enclosing construct that is supposed to catch them."
01:56 Sgeo next is dynamically scoped?
01:56 TimToady no, .DEFINITE is quite primitive
01:57 Sgeo m: sub foo() { next; }; for 1, 2 { foo(); say "Did foo()"; }
01:57 camelia rakudo-moar a38b59: ( no output )
01:57 Sgeo m: sub foo() { }; for 1, 2 { foo(); say "Did foo()"; }
01:57 camelia rakudo-moar a38b59: OUTPUT«Did foo()␤Did foo()␤»
01:58 TimToady default next is dynamic, with lable, lexotic
01:58 TimToady *label
01:59 TimToady (a bit distracted)
02:02 roguelazer left #perl6
02:02 roguelazer joined #perl6
02:03 Sgeo "No compiler compiler available for language '$.lang'";
02:06 EINVAL joined #perl6
02:16 Sgeo m: say &lol
02:16 camelia rakudo-moar a38b59: OUTPUT«sub lol (*@l) { #`(Sub|60094288) ... }␤»
02:23 labster m: lol lol lol lol &lol
02:23 camelia rakudo-moar a38b59: ( no output )
02:30 gfldex joined #perl6
02:40 llfourn joined #perl6
02:45 noganex_ joined #perl6
03:42 khw joined #perl6
03:44 kaare_ joined #perl6
03:50 rangerprice so
03:51 skids sooo....?
03:59 labster m: say so .WHAT
03:59 camelia rakudo-moar a38b59: OUTPUT«False␤»
04:17 rangerprice so i love Perl
04:19 Sgeo So, when does @foo expand in an argument list and when does it not? Does it only expand when it's where a slurpy is?
04:22 gfldex joined #perl6
04:27 Sgeo m: {$_}.WHAT
04:27 camelia rakudo-moar a38b59: ( no output )
04:27 Sgeo m: say {$_}.WHAT
04:27 camelia rakudo-moar a38b59: OUTPUT«(Block)␤»
04:33 davido__ joined #perl6
04:33 Sgeo Hrm, there are a lot of identity-like functions :/
04:36 davido__ joined #perl6
04:40 ChoHag joined #perl6
04:58 skids Sgeo: post-GLR flattening behavior was first described here: http://pmthium.com/2014/10/apw2014/ then modified slightly here: https://github.com/perl6/specs​/blob/master/S07-glr-draft.pod and jnthn++s gist today is showing the first bits of an implementation prototype: https://gist.github.com/jnthn/aa370f8b32ef98e4e7c9
04:59 Sgeo ty
05:05 rangerprice Bye !
05:07 Sgeo Seq is not Positional, thus cannot be bound to array variables.
05:07 Sgeo That's different from current behavior with := lazy stuff, right?
05:13 TimToady yes, but we have to get better control of which types cache values
05:14 Sgeo Will slips have syntax sugar?
05:14 TimToady we might be able to unify them with |
05:14 Sgeo I think I can imagine if slips were the only things that got flattened
05:14 Sgeo or... flattened's the wrong word there, but if we have slips do we need flattening?
05:15 TimToady slip is one level, flattening is recursive
06:13 llfourn joined #perl6
06:25 ChoHag Perl#s running out of symbols.
06:28 ChoHag
06:36 nightfrog joined #perl6
06:37 moritz jnthn++ # https://gist.github.com/jnthn/aa370f8b32ef98e4e7c9
06:42 moritz eeks
06:42 moritz moritz@pat:~$ dig www.bitcard.org +short
06:42 moritz moritz@pat:~$
06:42 moritz so, no bitcard login to rt.perl.org :(
06:43 FROGGS joined #perl6
06:46 * moritz wanted to reject https://rt.perl.org/Public/​Bug/Display.html?id=125745
06:47 FROGGS "You shall implement an ACCEPTS method"
06:48 ChoHag Well now you'll have to fix it than.
06:49 azawawi joined #perl6
06:49 moritz ok, answered by email; I hope to be able to log in later
06:50 moritz (asking the authorotative DNS server gives an answer for www.bitcard.org, so I guess it's only a caching issue right now)
06:51 moritz ok, DNS works again
06:57 ChoHag How can I have class Foo in Foo.pm and class Bar in Bar.pm where they both depend on each other?
06:57 ChoHag If they were in the same file I could stub one and it'd be fine, but use-ing the files falls over.
06:58 FROGGS you cant
06:59 ChoHag That's not the sort of thing I expect to hear in relation to perl.
06:59 FROGGS you can stub Foo in Bar.pm, declare Bar and use Foo, but Foo won't know about Bar
07:00 FROGGS the thing is that we have compilation units
07:00 FROGGS and when you compile Foo, all the symbols it knows about must be resolved
07:00 FROGGS so, the only way is to put both in the same compilation unit (file)
07:09 rurban_ joined #perl6
07:10 rurban joined #perl6
07:18 telex joined #perl6
07:19 darutoko joined #perl6
07:22 llfourn joined #perl6
07:24 brrt joined #perl6
07:25 nine .tell dha please merge your 5-to-6 docs into docs.perl6.org. Yesterday I would have had a use for it but couldn't find it.
07:25 yoleaux nine: I'll pass your message to dha.
07:26 RabidGravy joined #perl6
07:26 zakharyas joined #perl6
07:27 azawawi hi
07:27 yoleaux 01:38Z <japhb> azawawi: Ah, thank you for the Electron info!
07:27 azawawi how do i .can('sub') on a module?
07:27 RabidGravy marnin!
07:29 simcop2387 joined #perl6
07:29 azawawi i.e. test whether subs exist in a module or not. Any example?
07:30 labster moritz: I rejected your rejection.  If there aren't any uses of declaring a new infix:<~~> that will ever work, I think we need a warning message.
07:34 RabidGravy azawawi, something like this perhaps?
07:34 RabidGravy m: module B { our sub c() {} }; say &B::c.defined'
07:34 camelia rakudo-moar a38b59: OUTPUT«5===SORRY!5=== Error while compiling /tmp/LEWYcVTr2o␤Two terms in a row␤at /tmp/LEWYcVTr2o:1␤------> 3 B { our sub c() {} }; say &B::c.defined7⏏5'␤    expecting any of:␤        infix␤        infix stopper␤        postfix␤        s…»
07:34 RabidGravy m: module B { our sub c() {} }; say &B::c.defined
07:34 camelia rakudo-moar a38b59: OUTPUT«True␤»
07:34 nine m: module B { our sub c() {} }; say &B::d.defined
07:34 camelia rakudo-moar a38b59: OUTPUT«False␤»
07:35 RabidGravy has to be an "our" tjough
07:36 nine Which is only logical. Why should you be able to test existence of a function you are not supposed to see?
07:36 RabidGravy oh yeah
07:41 azawawi RabidGravy: thx
08:04 pdcawley joined #perl6
08:13 zakharyas joined #perl6
08:16 zakharyas joined #perl6
08:18 rurban joined #perl6
08:37 ponbiki_ joined #perl6
08:37 oha joined #perl6
08:37 Ulti joined #perl6
08:37 SHODAN joined #perl6
08:37 Sgeo joined #perl6
08:37 [Coke] joined #perl6
08:37 Util joined #perl6
08:37 agentzh joined #perl6
08:37 Possum joined #perl6
08:37 shmibs joined #perl6
08:37 Celelibi joined #perl6
08:37 bloonix joined #perl6
08:37 ilbelkyr joined #perl6
08:37 garu joined #perl6
08:37 japhb joined #perl6
08:37 sjn joined #perl6
08:37 ruoso joined #perl6
08:40 jnthn I don't think we should confuse flattening into a caller argument list with slip construction comfortably
08:40 jnthn uh, could ... comfortably
08:49 Mhoram joined #perl6
08:56 vytas`` joined #perl6
09:01 ChoHag Can you have a private and public method of the same name & signature, such that calls from within the class call the private and external code the public?
09:09 jnthn Sure
09:10 jnthn Note the syntax for calling a private is different
09:10 jnthn So there's no ambiguity
09:30 Woodi hi #perl6 :)
09:31 Woodi do slip needs to be some data structure ? flat isn't...
09:32 Abc333 joined #perl6
09:33 Woodi and realy do not know why  @a = [1,2], [3,4] # 4 elems  is big deal. on how many levels it is bad or something ?
09:34 * Woodi checked what Perl5 is doing in  = @b, @c  case and it slipped into WHAT IT IS DOING ?? ;)
09:36 |Tux| joined #perl6
09:36 jnthn Actually I think flat will return a Slip
09:38 jnthn I don't think looking at "what does Perl 5 do here" is very useful. We've already very well established through the nearly-double-digit previous number of list implementations that we don't want those kinds of implicit flattening semantics.
09:40 virtualsue joined #perl6
09:41 ChoHag To be honest what perl 5 does with lists isn't all that useful in itself.
09:43 ChoHag I've thought "I've got to disrupt the flow and pass and then unwrap a bloody reference again" far more than "Oh how useful - I never wanted a discrete variable anyway"
09:43 Woodi umm, think I just wrote it wasn't helpful :)  Perl5 just consumed @c...
09:43 Woodi but "To concatenate two lists/arrays use flat" is weird...
09:44 ChoHag "Flatten two adjacent lists into one" isn't that weird.
09:45 jdv79 tony-o: what is wrong with the existing grammar tut?
09:45 Woodi and I'm not talking about eg. @b bying [1,[2,3]] but just [1,2,3]... maybe this is problem ?
09:45 ChoHag And having a distinction between "append this list onto that list" and "append the contents of this list onto that list" is useful and also non-weird.
09:45 rindolf joined #perl6
09:46 Woodi also there was a problem with Nil elements in lists in some cases. probably "slip them" was orginal recipe...
09:47 jnthn The new implementation doesn't take any interest in Nil
09:47 jnthn The only thing that'll vanish is an empty Slip
09:47 Woodi if you saying that's OK then it's OK :)
09:48 jnthn Well, once Nil was designed to vanish in lists, but then it was decided this wasn't desirable
09:51 Woodi anyway @a = @b, @c # 2 elems is deadly logical :)
09:52 mr-foobar joined #perl6
09:52 ChoHag Funny that logic and programming should coincide...
09:52 DrForr So rare nowadays.
09:52 ChoHag (Something about kids and lawns)
09:53 huf plant some kids on my lawn!
09:54 DrForr My brother keeps raving about how with JS nobody needs a server anymore, I keep explaining I want an *interesting* language to work with.
09:55 ChoHag Yeah who wants an internet anyway?
09:56 DrForr Apparently it's node.js all the way down.
09:59 DrForr As I sit here applying "don't repeat yourself" to codebase after codebase.
10:03 mr-foobar joined #perl6
10:03 espadrine joined #perl6
10:06 itz "You can't adverb that" <=- surely you can't verb an adverb in the error message either?
10:07 jnthn lol
10:07 jnthn But that's verbing a noun
10:08 jnthn Which is well established as productive in English, even is prescriptivists hate it. :)
10:08 ChoHag Winding up language purists is a laudable goal.
10:08 llfourn joined #perl6
10:08 itz I can't actually think of a better, short replacement anyway :/
10:08 nwc10 or is this a bug report that the error message is LTA because it doesn't mangae to verb an adverb, and acchieve sentience (or something equally terrible)
10:10 virtualsue i'd say it's not explicable to what i assume is your target audience, e.g. people who are able to write programs and understand english reasonably well :-)
10:10 virtualsue ETOOCUTE
10:11 nwc10 I think you're right, and you've expressed it better than me
10:11 nwc10 in particular, is it possible to replace "that" in the message with the token that triggered the problem?
10:12 virtualsue that would probably be helpful
10:12 jnthn Uh
10:12 jnthn I'm pretty sure right below that message is a pretty red/yellow/green thingy with an eject system showing exactly where we got confused.
10:13 jnthn *symbol
10:13 nwc10 sorry, fail on my part. I failed to ask "or is it pointing at the offending thingy"?
10:13 jnthn m: say [1, 2, 3]:hmm
10:13 camelia rakudo-moar a38b59: OUTPUT«Unexpected named parameter 'hmm' passed␤  in block <unit> at /tmp/kj_P8RUVWW:1␤␤»
10:13 jnthn gah :)
10:13 jnthn How do I actually trigger the error...
10:13 jnthn m: class Foo { } :bar
10:13 camelia rakudo-moar a38b59: OUTPUT«5===SORRY!5=== Error while compiling /tmp/gm5uh2ic5m␤You can't adverb that␤at /tmp/gm5uh2ic5m:1␤------> 3class Foo { } :bar7⏏5<EOL>␤    expecting any of:␤        pair value␤»
10:14 virtualsue well sorry, i saw that message and it was not helpful
10:14 virtualsue i'm not saying it needs to be fixed ASAP or that it's even a blocker
10:14 virtualsue to anything ever ;-)
10:15 jnthn virtualsue: Was the primary problem not knowing what it meant by "adverb", or that you weren't sure what it thought you were trying to adverb, ooc?
10:15 nwc10 I think it would be clearer as "You can't use "bar" as an adverb"
10:16 jnthn If the former we could maybe do "You can't use adverb ':bar' here"
10:16 nwc10 (with the usual way of doing quotes, that I don't know how to manage
10:16 nwc10 yes, how you said it
10:16 virtualsue i know what adverbs are in english. it wasn't immediately obvious to me what the message meant in the context of the code
10:16 jnthn nwc10: :bar is a perfectly fine adverb; it's the place it's being used that's at issue.
10:16 jnthn I think we could probably include the adverb itself in the error 'cus it's likely short
10:17 jnthn But if we include the entire term the parser took it as applying to, it could be something rather long...
10:17 nwc10 the adverb is enough, I think
10:18 virtualsue i'm barely a dabbler in perl6. i'm just possibly about to start learning the new required lingo
10:18 ChoHag With the :.
10:25 ChoHag How do you get construction logic into a role?
10:25 ChoHag Multiple roles' submethod BUILDs conflict with each other.
10:27 lizmat good *, #perl6!
10:27 lizmat ShimmerFairy: re http://irclog.perlgeek.de/p​erl6/2015-08-04#i_10998537 , first-index takes a list
10:27 ChoHag Can it even be done without the consuming class taking a hand in the resolution?
10:27 lizmat m: "foo".first-index("foo").say
10:27 camelia rakudo-moar a38b59: OUTPUT«0␤»
10:28 lizmat ShimmerFairy: and "foo" is a 1 elem lust
10:28 lizmat *list
10:28 lizmat and then whatever you specify, is smartmatched with each element
10:28 lizmat m: "foo".first-index("bar").say
10:28 camelia rakudo-moar a38b59: OUTPUT«Nil␤»
10:28 itz what about "You can't adverb that - you may need to move your colon" :)
10:28 jnthn ChoHag: We've been discussing submethods role-compose such that you end up with all of them being called
10:28 lizmat m: say "foo" ~~ "bar"
10:28 camelia rakudo-moar a38b59: OUTPUT«False␤»
10:30 ChoHag What's come of the discussions so far?
10:33 jnthn ChoHag: No code :(
10:34 jnthn ChoHag: It's pretty much at the point where we need to try to implement it
10:34 ChoHag What's 'it' then? Each role may have a BUILD submethod which is called in order or something more exotic?
10:36 jnthn ChoHag: I think it's about that.
10:36 jnthn ChoHag: Basically, arranging that find_method ends up containing something that invokes the lot
10:36 jnthn uh, *retruning* something
10:36 jnthn And installs in the method cache
10:37 jnthn Which is how it'll work out most of the time
10:37 jnthn It'll want some care, so we don't break .^lookup (which should probably just go on returning the direct declaration of BUILD in the class, if any)
10:38 jnthn Maybe submethod_table will need breaking up into submethod_table and submethod_invokee_table or so
10:39 ChoHag ... implementation details I grok only by inference.
10:40 RabidGravy in the meantime there is probably some kind of hack you can perform but it's not immediately clear to me
10:40 jnthn ChoHag: These are the names of things that actually show up in the code, which I mention in case anyone wants to grep for them, get to know the code in question, and have a go at it :)
10:42 ChoHag I'd like to have a look (really!) but it's hard enough to do my own thing - which I understand - when I can only code in 5 minute snatches.
10:42 ChoHag I need a lock on my door...
10:43 RabidGravy my intuition is that it would probably involve making a specific trait_mod:<does> for the role itself which creates the method before applying the role
10:43 jnthn RabidGravy: Noh, it'd want handling entirely in the MOP code
10:44 jnthn RabidGravy: In RoleToRoleApplier/RoleToMethodApplier, and then tweaking find_method and publish_method_cache
10:44 ChoHag I think he's talking about the hacky workaround I'm considering whether to avoid writing.
10:44 jnthn Oh... :)
10:44 jnthn Anyway, I can look into it, but first I need to get the GLR stuff sorted-er
10:45 RabidGravy yeah, by way of answering the original question with what is avaulable now ;-)
10:45 jnthn And then want to get the new supply stuff in shape
10:49 colomon_ joined #perl6
10:50 jnthn TimToady: Interestingly it turns out very naturally that flat won't go overly deep on [...] after all. [[1, 2], [3, 4]] actually works out as [$[1, 2], $[3, 4]] because an Array is a set of Scalar containers. So my @a = [1, 2], [3, 4]; my @b = [4, 5], [6, 7]; my @c = flat @a, @b; will end up with @c having 4 elems. Which seems good. :)
10:51 jnthn TimToady: Note that since [[1, 2], [3, 4]] is equivalent to [$[1, 2], $[3, 4]] we can of course .perl to the pretty thing without $$$ everywhere. :)
10:53 ChoHag Can you ensure that role A is never composed alongside role B?
10:53 colomon joined #perl6
10:58 jnthn Hm, I guess...
10:58 jnthn m: role A { }; role B { die 'no!' if any(::?CLASS.^roles_to_compose) ~~ A }; class C does B { }
10:58 camelia rakudo-moar a38b59: ( no output )
10:58 jnthn m: role A { }; role B { die 'no!' if any(::?CLASS.^roles_to_compose) ~~ A }; class C does A does B { }
10:58 camelia rakudo-moar a38b59: OUTPUT«===SORRY!===␤Cannot find method 'role_typecheck_list'␤»
10:58 jnthn Somehow the exception is swallowed and it gets upset
10:58 jnthn But it successfully ensures it :P
10:59 ChoHag heh
11:00 jdv79 jnthn++ # concrete glr stuffs
11:00 jdv79 though the benchs for 1/2 of those were the same or slightly worse here
11:00 jdv79 *benches?
11:00 jnthn benchmarks :)
11:01 jdv79 yes, those
11:01 jnthn I see one that is worse
11:01 jnthn And a couple of others are a small win
11:01 jnthn And a couple are big wins
11:01 jnthn What they hide is that some of them also involve a notable memory usage decrease.
11:02 jnthn On the one that is worse, I fed it to the profiler. It's suffering mostly out of some sucky code-gen on a hot path.
11:02 jdv79 no doubt.  but memory is still cheaper than time:)  probably always will be.
11:02 ChoHag Could/should memore usage not be benchmarked?
11:02 jdv79 oh nice
11:03 jnthn ChoHag: Probably, but I'm not going yak shaving...
11:06 jnthn jdv79: I'm not going optimizing particularly hard yet, though. I want to optimize the correct semantics. If we're winning all but one benchmark before optimization, and some of them by a factor of 5-10 or so, then we're not doing bad. :)
11:07 timotimo \o/
11:07 timotimo is the code-gen you've seen Perl6::Optimizer-level stuff?
11:08 jnthn timotimo: More QAST -> MAST level
11:08 llfourn joined #perl6
11:08 jnthn timotimo: And not seeing spesh doing the inlining I'd hope
11:09 nwc10 jnthn: are you planning to merge after the August release?
11:09 jnthn nwc10: Not sure yet.
11:09 jnthn nwc10: We need to understand how painful the disruption will be.
11:09 |Tux| test             50000    42.285    42.195
11:09 |Tux| test-t           50000    41.911    41.821
11:10 |Tux| jnthn, at least NO slowdown! (even a bit better, but within noise)
11:10 jnthn |Tux|: Nice. Though I don't think I committed anything since you last checked, given I'm working out of repo on the GLR stuff for the moment :)
11:11 ChoHag Oh while I remember, can I test changes to files in src/core or src/Perl6 other than by a full recompile?
11:11 jnthn ChoHag: "make" will compile as little as is actually needed.
11:11 jnthn ChoHag: Which is still an amount
11:12 jnthn ChoHag: For changes to src/core stuff I often find a way to try them out of there first
11:12 ChoHag What way is that?
11:13 jnthn ChoHag: If it's a new sub/method I just try it in a normal code file, or augment the class I would add it to, for example.
11:13 ChoHag Note that I haven't even tried looking yet, so apologies if it's obvious.
11:16 Psyche^ joined #perl6
11:16 sergot hi #perl6 \o
11:23 lizmat sergot o/
11:23 lizmat long time no see ?
11:23 timotimo jnthn: the QAST -> MAST part isn't what i've been working on recently, right? but maybe it's something you could roughly instruct me to look at?
11:31 rurban joined #perl6
11:31 sergot lizmat: \o yeah... I'm not ok with this.
11:31 sergot lizmat: I want to come back to you people :)
11:32 jnthn timotimo: Well, looking at the code geneated for pull-one in the map iterator implementation would be a good starting point
11:32 timotimo i'll have a look later
11:33 jnthn The profiler output is telling too
11:33 lizmat sergot: welcome again  :-)
11:33 jnthn You may also play with inlining thresholds
11:33 timotimo right now i'm a bit weirded out by a grammar apparently matching, but then returning (Any) :|
11:33 jnthn Of note, trying to get the size of code post-specialization to be checked against the threshold too
11:34 pdcawley joined #perl6
11:34 sergot lizmat: thanks :)
11:34 jnthn 'cus spesh tosses so many checks in a method prelude...
11:37 timotimo oooh
11:37 timotimo it must be because my custom <ws> wants a \s at the end of the document ... but it's EOF instead
11:37 timotimo yes, that was it

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

Perl 6 | Reference Documentation | Rakudo | Niecza | Specs