»ö« Welcome to Perl 6! | perl6.org/ | evalbot usage: 'p6: say 3;' or /msg camelia p6: ... | irclog: irc.perl6.org or colabti.org/irclogger/irclogger_log/perl6 | UTF-8 is our friend! 🦋
Set by Zoffix on 25 July 2018.
timotimo httpbin.org/ - this is a site that allows you to ask for specific responses of different kinds, good for seeing what you're sending for example 00:00
perlBird figured I'd do in perl, cause, you know, whipitupitude
timotimo sure :)
perlBird oh excellent that could be usefull
timotimo perhaps the target server actually wants form-data/urlencoded! :P
perlBird it specifies a json payload 00:01
but that very well could be the case
timotimo it could be absolutely terrible in any amount of ways :D 00:02
because it's the web, and the web is like that
perlBird i do love that about the web
timotimo first you use whipuptitude to implement what the API docs or specification specify 00:03
then you use manipulexity to work around all the bugs in the spec and implementation :D
perlBird aint no jargon like perl6 jargon cause perl6 jargon have fun with words 00:04
timotimo i haven't been part of the perl5 world, but i think a lot of the spirit was already alive and well there :)
perlBird tru tru. I just got into playing with perl6, mostly cause my boss was telling me the ridiculosity you can perform with whipitupified perl 00:05
timotimo but yes, we do love puns
oh, that's cool! :)
perlBird it's been fun so far 00:06
I like a language that's basically silly putty, and perl seems to allow for that
timotimo "silly" surely applies :D :D
TimToady
.oO(Perl golf is putty...)
00:09
perlBird truely! 00:10
timotimo ah, because just choosing perl puts you on the green already? :)
TimToady well, it also takes drive, and a willingness to iron out problems 00:11
perlBird say "\c[Smiling Face with Sunglasses]"
evalable6 😎
timotimo i'm so thankful for the caddies who helped me get this far 00:12
MasterDuke_ but is the experience really up to par?
TimToady don't pitch a fit :P
MasterDuke_ hey, i like to chip in where i can 00:13
perlBird so far it's been a hole-in-one
timotimo TBH, sometimes i'm so enthusiastic and ecstatic that i feel like a little Birdie
perlBird MasterDuke had to wedge himself in there for sure :D
MasterDuke_ what can i can say? perl makes me fly like an eagle 00:14
TimToady retreats to his bunker 00:14
perlBird when you pun hard enough on a lang that the creator of said lang holes himeself up, you can say you've had a good day, I think 00:17
timotimo :3 00:19
buggable New CPAN upload: AttrX-Mooish-v0.4.11.tar.gz by VRURG modules.perl6.org/dist/AttrX::Mooish:cpan:VRURG 00:24
perlBird hey, I'm having this weird thing where calling flat or 02:18
| on a nested array [[1,2,3],[4,5,6]] just returns ([[1,2,3],[4,5,6]]) 02:20
Now I get the feeling that's on purpose and I'm not calling the right stuff, but
what should I be doing
lookatme_q m: dd |[[1,2,3],[4,5,6]] 02:22
camelia Array element = $[1, 2, 3]
Array element = $[4, 5, 6]
lookatme_q perlBird, so what do you want to do ? 02:25
perlBird I'd like to return an array of [1,2,3,4,5,6] in this case
,welll heck not i gotta go anyway 02:28
perlawhirl if you have an array like [[1,2,3],[4,5,6]], how is it being created. typically you can flatten it while you create it
perlawhirl you shouldn't really need a 'flatten' function, but if you want, this will do 02:28
m: sub flatten($l) { gather $l.deepmap(*.take) }; say flatten ([[1,2,3],[4,5,6]])
camelia (1 2 3 4 5 6)
geekosaur surely thats' concatenate 02:32
and you misunderstand |, it flattens *upward* not downward 02:34
it interpolates its parameter into the container it is in directly. so |[[1,2,3],[4.5.6] willstill give you the sublists, but as elements of the outer list 02:35
m: say [1,2,3,|[[4,5,6],[7,8,9]],10]
camelia [1 2 3 [4 5 6] [7 8 9] 10]
geekosaur m: say [1,2,3,[[4,5,6],[7,8,9]],10]
camelia [1 2 3 [[4 5 6] [7 8 9]] 10]
geekosaur "outward" vs. "inward" is probably better description 02:36
ccc_ m: [2,0,1].grep({say $_;False}, :k) 03:15
camelia 2
0
1
ccc_ m: [2,0,1].grep({say $_;False}, :kv) 03:16
camelia 2
0
1
ccc_ m: [2,0,1].grep({say $_;False}, :p)
camelia 2
0
1
ccc_ So the matcher only ever gets the value, the options to grep juse apply to the output?
chenyf good afternoon! 05:29
lindylex Greetings 05:32
El_Che Am I a bad person because the formatting on "Learning Perl 6" makes me uneasy? :) 06:47
lindylex El_Che : I am big fan of Think Perl 6_ 06:58
tyil is the weekly delayed? :( 07:15
tyil does Perl 6 have tail call optimization? 08:01
lizmat no, not afaik 08:02
breakfast&
masak the specification? I think it mentions something about tail calls. but not (automatic) tail call optimization. 08:03
masak right, `callsame` and `callwith` make tail calls. 08:04
so I guess the answer is "no, Perl 6 allows manual tail calls, but it's not optimized for you automatically"
tyil alright, thanks
masak I know TCO is cool to have, but it also has a "cost", implementation-wise. that's why EcmaScript 6 specifies that TCO should be made, but in practice, browser implementations still don't do that, 3 years after ES6 was released 08:07
masak correction: Safari does. Edge, Firefox, Chrome don't. 08:07
tyil someone in another channel asked 08:08
he seems to be of the opinion that you cant have a serious language without TCO
geekosaur tempted to suggest you point them at haskell. tail cals are an aspect of imperative evaluation, not of graph reduction. 08:09
tyil he's a haskell user
masak tyil: with all due respect to that person and that opinion, it sounds like someone who has either not factored in that cost, or who has and is convinced that it's worth the cost 08:10
tyil masak: I dont know them personally, so I don't know in which category he falls
geekosaur and there are a lot fo new people who ask about tail calls alost mediately; someone is apparently teaching them that tail call elimination is magic pixie dust
masak tyil: I think it's not controversial to say that Haskell is quite a different language. evaluation semantics, for example, is quite different.
masak tyil: I 100% agree that *Haskell* would be worthless without TCO :P 08:10
masak geekosaur: dunno about magic pixie dust, but TCO is quite useful. there are some genuinely useful patterns that would just run you out of stack immediately if you tried them without TCO 08:12
masak so I'm not at all making the argument that it's an over-hyped feature. just that it's not easy to add after the fact. 08:12
it's one of those "cross-cutting" features
albertferrico hello everyone 08:17
tyil hi :>
albertferrico does anyone use CRO? 08:20
masak albertferrico: it sounds like you have a second question you're sitting on if someone says "yes" :) 08:23
albertferrico yep, hehehe 08:25
I want to use Cro as a server and router for a small personal project, but I need to serve dynamic pages with objects so I was wondering if someone can recommend some good ORM for Cro 08:27
lookatme_q Where is the new weekly report ? 08:57
I am waiting for it all days :/ 08:58
lizmat lookatme_q: working on it right now...
spent more time in transit yesterday and was too tired to finish it last night
lookatme_q thanks lizmat++ 08:59
tyil lizmat++ 09:02
I too was worried about
lizmat earlier today: [01:06:31] <+lizmat>PSA: due to extended travel time, the Perl 6 Weekly will be published in about 12 hours 09:03
tyil I was asleep at that time :(
lizmat tyil: I was very close to that as well, and 15 mins prior to that, behind the wheel still :-) 09:08
tyil did you at least get a good night's rest/
?
lizmat yeah, mostly 09:10
:-)
tyil :D
lizmat can't beat a night's rest in one's own bed
Geth doc: 7d40c87080 | (JJ Merelo)++ | doc/Language/operators.pod6
Changes anchors and reflows
10:01
synopsebot Link: doc.perl6.org/language/operators
albertferrico can someone help with a doubt? In this module github.com/tony-o/perl6-db-orm-quicky it says 'Depends DBIish', does it mean that I need to install DBIish and after perl6-db-orm-quicky to make it work? 10:27
tadzik your package manager will do that by itself 10:29
since it's specified here: github.com/tony-o/perl6-db-orm-qui...A6.json#L7
albertferrico oh I see, tadzik thank you very much. So I could install perl6-db-orm-quicky and straight coding my model, and it will create the table for me, and then I can access the object, right? 10:31
I'm planning to play with perl6-db-orm-quicky and modules.perl6.org/dist/cro:cpan:JNTHN 10:32
to have a lite web app where I can have dynamic content 10:33
tadzik albertferrico: well, I don't know how the ORM works :) But you definitely don't need to install the deps manually 10:34
albertferrico great tadzik, thanks a lot for replying! 10:36
Zoffix ccc_: that's correct. You can use .kv/.pairs/.keys methods to convert the output prior to grepping stuff; e.g. m: [2,0,1].pairs.grep({say $_;False}, :p) 10:39
El_Che: no, you're not a bad person because of that.
timotimo ccc isn't here any more :(
Zoffix I know, but maybe they read the logs 10:40
timotimo ah
Zoffix perlawhirl: FWIW that flatten function annihilates hashes: 10:41
m: sub flatten($l) { gather $l.deepmap(*.take) }; say flatten ([[1,2,3],{:42foo, :100bar}])
camelia (1 2 3 42 100)
Zoffix perlBird: `flat` doesn't flatten containerized things. Since arrays containerize their elements by default ( perl6advent.wordpress.com/2017/12/02/ ), your inner arrays are containerized and aren't flattened. You often can avoid this sort of problems and the need to flatten everything by using more appropriate datatypes for your stuff, but if you do have to flatten it, just decont the stuff before the 10:44
flat call: `m: dd flat [[1,2,3],[4,5,6]]».<>`
lizmat notable6: weekly reset 10:51
notable6 lizmat, Moved existing notes to “weekly_2018-09-11T10:51:36Z”
lizmat blogs.perl.org/users/damian_conway/...riday.html 10:52
moritz is going to see Damian Conway tonight in Erlangen 11:03
timotimo ooh, es gibt ja so viel wissenswertes über erlangen!
dmaestro m: package TestD { role R { method foo(-->Int) {...} }; class C { has R $.delegate handles * is required; }; class D does R { has Int $.foo; }; }; my $d = TestD::D.new(:foo(2)); my $c = TestD::C.new(delegate => $d); say $d.foo; say $c.foo 11:59
camelia 2
2
dmaestro Can anybody take a look at this issue? Can't figure out what I (might) be doing wrong here ... github.com/rakudo/rakudo/issues/2269 12:00
Loading from a library file doesn't work like the inline code above - throws an error "Cannot invoke this object" 12:02
Any chance someone can duplicate it? 12:07
scimon If you put the code into a script rather than on the command line where does it error? (Creating $d, Creating $c, doing $d.foo, doing $c.foo ? ) 12:15
I've had similar issue recently that seemed to be related to the JIT compiler (another thing if you add no precompilation to the class file does it still error?) 12:16
lizmat and another Perl 6 Weekly hits the Net: p6weekly.wordpress.com/2018/09/11/...of-damian/ 12:19
moritz lizmat++ 12:19
dmaestro scimon: I'll try those ... 12:37
dmaestro Cannot invoke this object (REPR: Null; VMNull) at SETTING::src/core/traits.pm6:439 (/usr/local/opt/rakudo-star-2018.06/share/perl6/runtime/CORE.setting.moarvm:) from gen/moar/Metamodel.nqp:3281 (/usr/local/opt/rakudo-star-2018.06/share/nqp/lib/Perl6/Metamodel.moarvm:find_method_fallback) from gen/moar/Metamodel.nqp:1123 (/usr/local/opt/rakudo-star-2018.06/share/nqp/lib/Perl6/Metamodel.moarvm:find_method) 12:42
Looks like it's looking up the method, trying fallback (!) and failing.
scimon: How do I disable precomp? 12:43
lizmat dmaestro: no precompilation; 12:45
dmaestro_ yes, 'no precompilation' in the loaded module fixes the error. 12:49
ccc I've been trying to find good examples of using pod to document my exported objects, and it seems that pod isn't used at all in rakudo core. 13:09
Is the intermixed code and documentation style that pod was designed for not used in practice anymore? 13:10
If it is in fact still used, could someone point me to a good example of its use in an existing module? 13:13
moritz ccc: it's not used inside rakudo because the documentation isn't rakudo specific 13:14
ccc I mean the perl6 core modules 13:14
Set.pm6 etc. 13:15
moritz and the second thing is that we want commits to docs to be done pretty freely, but to rakudo we have much stricter review 13:16
yes, I'm also talking about those
moritz the documentation lands on docs.perl6.org/ which is not rakudo specific 13:16
so why should the docs be in the rakudo code base?
ccc ok then, but where could I find a good example of pod usage? 13:17
the modules I've looked at had no pod or put all the pod at the end 13:18
or in a separate file
moritz no, sorry. I hope somebody else has good examples 13:25
lucasb let's grep "#=" and "#|" in the modules code base :) 13:28
ccc well, I did grep '^=' and didn't come up with much; thus my question 13:29
ccc is "#=" a pod alias? 13:29
lucasb it's a hash "#", if you want intermixed
I have zero experience with it, but I think it's a POD comment 13:30
ccc /docs.perl6.org/language/pod doesn't mention this
lucasb looking for some examples, but github seems instable right now 13:31
ccc so it seems pod has been abandoned for intermixed usage
lucasb *unstable
ccc is the community moving to perhaps have the documentation in special comments like java or go? 13:34
ccc or is this just a case that people operating at the frontier don't like doing documentation 13:37
lizmat ccc: perhaps, or maybe just not enough time 13:40
timotimo using #| and #= is for attaching pod to an object so that it becomes available via the .WHY accessor 14:43
AlexDaniel timotimo: geez I hate that syntax so much :D 14:47
in fact I'd normally write #↓ and #← even though it does not “work”
timotimo heh. 14:48
make a slang for that ;)
AlexDaniel 🤷
if #| and #= were supposed to paint arrowy things then maybe we can just add the it right in 14:49
as per github.com/rakudo/rakudo/wiki/save...from-ascii
.oO(wow that page still exists)
TimToady: what's the logic behind #| and #= ? 14:50
I mean in the choice of symbols
lucasb well, there are limited ascii punct chars 14:52
tadzik heh, I remember implementing #= as part of my gsoc, but when afterwards #| was brought up I refused to do it because I considered it ugly :P 14:53
Geth doc: 12de1c212d | (Itsuki Toyota)++ (committed using GitHub Web editor) | resources/i18n/jp/README.jp.md
Update README.jp.md
14:53
AlexDaniel method cast(#|{ A spell } Spell $s)
AlexDaniel is looking at design speculations 14:54
so in that case ↑ the | symbol is somewhat… meaningless? :)
AlexDaniel ok then #↓ and #← will be misleading. Alright then… 14:55
unless #→ and #↑ are also added of course 14:56
which is… uh… whatever…
Geth doc: 28ca78f1cc | (Will "Coke" Coleda)++ | resources/i18n/jp/README.jp.md
whitespace
15:06
TimToady AlexDaniel: the first thing to understand about #| and #= is that, from observation of how people actually use inline docs in most languages that support them, precomments are usually long paragraphs, and postcomments are usually short descriptions that fit on the same line 16:09
so other than the simple fact that you don't want the symbols confusable with each other, the two constructs also operate a bit different psychologically 16:10
AlexDaniel TimToady: ok, so why | and = ? 16:11
TimToady so in the case of #=, we picked something that looks like an assignment operator, because assignment operators take some value on the right and use it to diddle something on the left
in the case of #|, you don't want to have to visually reparse the opener every time you go to another line, so you want something that looks like a fake left margin
TimToady the arrows are cute, but a bit distracting from the purpose of documentation, insofar as they point to the mechanism rather than just being functors, much like the different between C's switch/case vs Perl's given/when 16:13
TimToady and fwiw, people are also used to = setting up a kind of two-column table in an algebraic proof 16:17
TimToady this is that, and this is that, and this is that... 16:17
AlexDaniel alright, I see
TimToady interestingly, some languages use ← for assignment anyway 16:18
AlexDaniel a bit of a stretch though for, say, a beginner trying to remember which is which… but maybe proper documentation can help
TimToady but then it's really distinguishing operational assignment from equality
but the most important point is that the two symbols function differently in mental parsing: with #= you must interrupt the flow on every line with a "THIS is really THAT" thought, or you misparse, and while you can and should line up the #= to help the visual isolation, each one must be considered separately 16:23
with #|, the mental parsing goes two different ways, depending
if you interested in the paragraph, as I mentioned above, you want the lined up #| symbols to disappear as a fake left margin 16:24
but if you're not interested in the paragraph, you want something that drops you straight through to the actual code below
AlexDaniel github.com/perl6/doc/issues/2305 16:25
TimToady and I would submit that a vertical row of | is easier to follow down than a vertical row of ↓ 16:25
AlexDaniel and a column of #= should be followed up, right? 16:26
TimToady yes, there's a sort of one-to-one correspondence contract built into #= that isn't built into #| 16:27
TimToady so trying to teach them as the identical thing just facing different directions is slightly misguided, in my opinion 16:28
AlexDaniel not sure I understood that last part. I was thinking about something like this: gist.github.com/AlexDaniel/f5e267f...500d2afaac 16:28
TimToady ah, yes, you can use multiple #= for line overflow, sure 16:29
AlexDaniel #→{ A spell } will definitely look a bit weird though 16:30
TimToady so in that sense it's similar to #|
AlexDaniel same with #↑ tbh… OK 16:30
TimToady tbh, I'd be tempted to restrict #| to only be beginning of line
culturally, if not syntactically 16:31
TimToady most people find small precommentary to be irritating in actual conversation, and would rather hear the basic nub of what you're saying before you try to modify what you're saying 16:34
"Get to the point" is what you get if you try to do modifications to your thought before you actually say the thought 16:35
AlexDaniel heh :)
TimToady so prefaces need to be easily skippable, which is why we generally put them in a separate section before Chapter 1 :) 16:36
TimToady to summarize, my thinking on #| and #= is driven primarily by what the human reader is doing, not by what the computer is doing 16:38
AlexDaniel but I love to point at things! ↑ 16:39
TimToady (or the human writer, who is one of those people we love to torment :) 16:40
AlexDaniel though maybe I should be using 👆 :)
anyway, that settles it for now, thanks 16:41
Xliff Is there a way to set delegation at run-time? 16:46
Or to make a delegate object handle all of the methods of the delegate class without specifying all of the method names using the handles trait?
timotimo you can always mix in a custom-made role at run time, or you can have a FALLBACK method that handles handles for you 16:48
vrurg Xliff: I have a construct like this in my code: handles [|@Logger::level-methods, |<log logf>] – but it's not exactly run-time as @level-methods is a constant with predefined method names. But could serve a food for thought. 17:08
Xliff OK, so the thought is... how do I add methods of an entire class, without listing them all. 17:10
Hmmm...
If it is just a delegate class, I guess I could fill in an array with a BEGIN phaser.
our @methodnames = Class::^methods(:local).map(*.^name) 17:11
vrurg Xliff: Make sure that the class was already composed. I would say CHECK or INIT are better candidates for this, but can't tell exactly without prior testing. 17:14
Basically, if you're worried about perfomance matters of FALLBACK you could manually generates the delegates and install them on your class. 17:15
method FALLBACK($name) { my &m = method ( |c ) { self.handler."$name"(|c) }; self.^add_method( $name, &m ); self.&m( |c ) } 17:17
Xliff vrurg: That's a good idea! Thanks!! 17:22
vrurg Xliff: welcome!
Xliff vrug: However, I would like to avoid the situation where $name did not exist in self.handler 17:23
But still.... good stuff!
vrurg I gave you a sceleton, the rest is up to you. For example, you could do FALLBACK( $name where self.handler.^can( * ), |c ) BTW, I forgot about |c in the signature of the first example. 17:24
Xliff Ooh! Nifty! 17:25
Is ".^can( * )" equiv to ".^can($name)"? I'm not well versed in WhateverCode 17:26
geekosaur $name won't have a value at that opoint, the potential valeue is passed as a parameter and will b assigned to $name only if it passes the where check 17:27
Xliff Ah! Thanks. 17:28
vrurg Should be. I'm rather a newby too, so might do some mistakes in the syntax. If * doesn't work for you, then when { self.handler.^can( $_ ) } will for sure.
Xliff Ah! Excellent.
vrurg Another possible confusion you'll see with FALLBACL. If $name won't match the clause you'll get a confusing AUTOGEN-related error message. To avoid it it is better to have FALLBACK a multi method and have a more general version of it which will catch all the misses and do whatever you think is right to do about them. 17:30
SmokeMachine m: class A {method a {"a"}; method b {"b"}}; class B { has A $!a handles A.^methods>>.name }; say B.a; say B.b 17:31
camelia Cannot look up attributes in a B type object
in block <unit> at <tmp> line 1
SmokeMachine m: class A {method a {"a"}; method b {"b"}}; class B { has A $!obj-a handles A.^methods>>.name }; say B.a; say B.b
camelia Cannot look up attributes in a B type object
in block <unit> at <tmp> line 1
SmokeMachine m: class A {method a {"a"}; method b {"b"}}; class B { has A $!obj-a handles A.^methods>>.name }; say B.new.a; say B.new.b 17:32
camelia a
b
SmokeMachine Xliff: ☝️ 17:33
vrurg SmokeMachine: 👍🏻 The elegance in the nutshell... :) 17:36
Xliff SmokeMachine++!!! 17:37
Xliff That's exactly what I am looking for., 17:37
Xliff m: class A {method a {"a"}; method b {"b"}; method new { say "WHEE"; }; class B { has A $!obj-a handles A.^methods>>.name.grep(* ne 'new'); method new { say "B"; }; ] ; say B.new.a; say B.new.b 17:39
camelia 5===SORRY!5=== Error while compiling <tmp>
Type check failed in binding to parameter '$expr'; expected Any but got A (?)
at <tmp>:1
Xliff m: class A {method a {"a"}; method b {"b"}; method new { say "WHEE"; }; class B { has A $!obj-a handles A.^methods>>.name.grep({$_ ne 'new'}); method new { say "B"; }; ] ; say B.new.a; say B.new.b
camelia 5===SORRY!5=== Error while compiling <tmp>
Type check failed in binding to parameter '$expr'; expected Any but got A (?)
at <tmp>:1
Xliff m: class A {method a {"a"}; method b {"b"}; method new { say "WHEE"; }; class B { has A $!obj-a handles A.^methods>>.name\; method new { say "B"; }; ] ; say B.new.a; say B.new.b
camelia 5===SORRY!5=== Error while compiling <tmp>
Type check failed in binding to parameter '$expr'; expected Any but got A (?)
at <tmp>:1
Xliff m: class A {method a {"a"}; method b {"b"}; method new { say "WHEE"; }; class B { has A $!obj-a handles A.^methods>>.name.grep(* ne 'new'); method new { say "B"; }; }; say B.new.a; say B.new.b 17:40
camelia 5===SORRY!5=== Error while compiling <tmp>
Type check failed in binding to parameter '$expr'; expected Any but got A (?)
at <tmp>:1
Xliff m: class A {method a {"a"}; method b {"b"}; method new { say "WHEE"; self.bless; }}; class B { has A $!obj-a handles A.^methods>>.name; method new { say "B"; self.bless; }; }; say B.new; say B.new.a; say B.new.b; 17:44
camelia B
B.new
B
a
B
b
SmokeMachine m: class A {method a {"a"}; method b {"b"}; method bla { say "WHEE" } }; class B { has A $!obj-a handles A.^methods>>.name; method bla { say "B" } }; say B.new.a; say B.new.b; B.new.bla # Xliff
camelia a
b
B
Xliff Excellent! So A.new isn't included.
m: class A {method a {"a"}; method b {"b"}; method new { say "WHEE"; self.bless; }}; class B { has A $!obj-a handles A.^methods>>.name; }; say B.new; say B.new.a; say B.new.b;
camelia B.new
a
b
Xliff Yup
m: class A {method a {"a"}; method b {"b"}; method new { say "WHEE"; self.bless; }}; class B { has A $!obj-a handles A.^methods>>.name; }; say A.new; B.new; say B.new.a; say B.new.b; 17:45
camelia WHEE
A.new
a
b
Xliff m: class A {method a {"a"}; method b {"b"}; method new { say "WHEE"; self.bless; }}; class B { has A $!obj-a handles A.^methods>>.name; }; say A.new; say B.new; say B.new.a; say B.new.b;
camelia WHEE
A.new
B.new
a
b
SmokeMachine Xliff: is that what you want? 17:48
Xliff Close enough. I need to make sure BUILD initializes $obj-a, though.
m: class A {method a {"a"}; method b {"b"}; method new { say "WHEE"; self.bless; }}; class B { has A $!obj-a handles A.^methods>>.name; submethod BUILD { $!obj-a = A.new; }; }; say A.new; say B.new; say B.new.a; say B.new.b; 17:49
camelia WHEE
A.new
WHEE
B.new
WHEE
a
WHEE
b
Xliff m: class A {method a {"a"}; method b {"b"}; method new { say "WHEE"; self.bless; }}; class B { has A $!obj-a handles A.^methods>>.name; submethod BUILD { $!obj-a = A.new; }; }; say B.new.a; say B.new.b;
camelia WHEE
a
WHEE
b
Xliff m: class A {method a {"a"}; method b {"b"}; method new { say "WHEE"; self.bless; }}; class B { has A $!obj-a handles A.^methods>>.name; submethod BUILD { $!obj-a = A.new; }; method new { say "B"; self.bless; }; }; say B.new.a; say B.new.b; 17:50
camelia B
WHEE
a
B
WHEE
b
Xliff Yup. Exactly.
SmokeMachine m: class A {has $.val; method a {"a$!val"}; method b {"b$!val"}}; class B { has A:D $!obj-a handles A.^methods>>.name = A.new: :42val }; say B.new.a; say B.new.b
camelia 5===SORRY!5=== Error while compiling <tmp>
Variable definition of type A:D requires an initializer
at <tmp>:1
------> 3"}}; class B { has A:D $!obj-a handles A7⏏5.^methods>>.name = A.new: :42val }; say
expecting any of:
SmokeMachine m: class A {has $.val; method a {"a$!val"}; method b {"b$!val"}}; class B { has A:D $!obj-a = A.new: :42val handles A.^methods>>.name }; say B.new.a; say B.new.b 17:51
camelia 5===SORRY!5=== Error while compiling <tmp>
Two terms in a row
at <tmp>:1
------> 3lass B { has A:D $!obj-a = A.new: :42val7⏏5 handles A.^methods>>.name }; say B.new.
expecting any of:
infix
infix stopper
TreyHarris After the flood of the past few days, I started to write a message to ToddandMargo on p6-l suggesting that as a new learner of Perl 6, they might want to... then I had a moment of recognition, "ToddandMargo?" and did a search--they've been sending messages to p6-l in the same form--"this is confusing I don't get it" since December 2015. Are they just trolling? 17:52
TimToady no, Todd just has a very different learning style from most folks 17:53
TreyHarris Some of the questions they asked in the most recent thread are literally the Subject lines of old messages
TimToady: hmm. Yes. It feels like they're reading a textbook going in alphabetical index order.
TimToady as someone on the verge of senility, I resemble that remark :) 17:54
Xliff Get 10 people. Determine their learinng styles. You'll discover that the number of styles is greater than the number of people.
TimToady yeah, it's almost as bad as borscht... 17:55
Xliff It would be worrisome if that number was less.
But just slightly.
TreyHarris Hey, I reimplemented 'wc' a couple days ago, so I resemble that remark too... I need a brain wash. But not a brainwash.
Xliff LOL! I almost feel into that trap last week, TreyHarris.
Except I wanted to use awk. So don't feel bad. 17:56
TimToady remembers the effort 20-mumble years ago to reimplement all the Unix commands in Perl...
TreyHarris Xliff: One of the astrophysicists at JPL tweeted a couple days ago that they did a websearch to see that the volume of a sphere is 4/3 pi r^3. So, yeah. 17:57
SmokeMachine psh?
Xliff I heard about that, TimToady.
TreyHarris: That reminds me. I need an xkcd dose.
TreyHarris TimToady: oh god, that was _brilliant_ as a learning exercise. Since pretty much everything I ever needed to do could be expressed as "this bit of that command and that bit of the other command" but where a shell pipeline was impractical.
I learned more about how to do proper stdio handling from looking at the "tail -f" reimplementation than anything else. People still get that wrong more often than they get it right, btw 17:58
(In every language.) 17:59
TimToady blames Pascal
TreyHarris Ugh, see the case of "Procedure v. Function". The Court was split and the case was remanded, as I recall. 18:00
TimToady Pascal got one thing right, which was one-pass parsing :)
Xliff TreyHarris: Was that Pascal vs. LISP?
(see! TimToady was right!) 18:01
TreyHarris Xliff: no, that was a cricket test match
It had to be cancelled after it continued into the time the next year's test match was supposed to begin.
Xliff TreyHarris: Who one? Or are they still playing?
TimToady
.oO(TimToady was right only after invoking Rule #2 at the turn of the millenium...)
18:01
Xliff Oh! I see.
TreyHarris: Now it would be interesting to see how that match would have played out if left to continue after December 31, 1999. 18:02
s/after/through/
TimToady Perl 5 broke the one-pass parsing rule in so many different ways...
Xliff And Perl6 continues that tradition... and rightfully so. 18:03
TreyHarris TimToady: I recall a very drunken evening at a YAPC many years ago where a certain person on this channel did a fantastic monologue about your invoking Rule 34.
Xliff What's Rule 34? 18:03
And where can I get a whole list?
TreyHarris Xliff: Google it, but don't say I didn't warn you. 18:04
Xliff I yam forewarned.
TreyHarris: xkcd.com/305/ 18:05
geekosaur there's also some repeats; the current discussion about sub vs. method and invocants came upa few months ago
it's not sticking
TreyHarris As I recall, it went something along the lines that the thing the Internet needed to _really_ get interested in Perl 6 development was... and so Rule 34 was invoked.
AlexDaniel O_O 18:06
TreyHarris: have you checked if their questions are answered in the documentation?
because if not, to me it doesn't matter if it's the same person repeating the question or a different one 18:07
Xliff sub_and_method_in_parallel.avi
AlexDaniel the problem is not in the person but in the docs
TreyHarris geekosaur: yup, that was what I saw in searching.
TimToady You can fool all of the people some of the time, and some of the people all of the time, but the docs are always wrong. 18:08
TreyHarris AlexDaniel: perhaps. I was thinking that maybe there should be a "legend" overlay in the corner of every doc page to give a quick reminder of signatures and links to further explication? It is all in the docs, but if one expects a signature to explain itself when you haven't learned how to read signatures, the docs kinda become impenetrable. 18:09
AlexDaniel TreyHarris: possibly. File a ticket and see if doc folks can figure out a way to do that
TreyHarris AlexDaniel: Like my position is "no, Language/Regex should not have a complete introduction to regexes"
TimToady it seems one should be able to find the tutorials from the references, and vice versa 18:11
TreyHarris TimToady++
TimToady what we can't assume is that everyone is going to parachute into the territory in the spot most conducive to their continued sanity 18:12
Xliff Solution: Use proper Portals. 18:13
TreyHarris I have learned that trying to learn a new language by seeking 1:1 mappings between concepts in the new language and a familiar language is the worst possible way to learn a language. Perhaps my first two languages being Haskell and Perl 4 gave me a head-start on that, but when I've needed to port things to a new language I've fallen back into that trap--it's never good. 18:13
TimToady people make the same mistake with natural languages, and with culture in general 18:14
.oO(I want a word-for-word translation of what St Paul said in King James English!)
18:15
even the word Word means different things in Greek vs English 18:16
TreyHarris Perl 6 is especially dangerous for this though, as I just mentioned on p6-l. Being able to create a "mutating method with rw arguments returning a possible Failure that throws exceptions". You _can_ find the 1:1 mapping of anything--it's just almost guaranteed to be incredibly ugly.
Hotkeys mhm, getting out of the translation mindset is an important step in learning a new natural language 18:17
though I think that's not *as much* of a problem with programming languages 18:18
TimToady well, it's fine for a path in, but most people eventually tune into shorter ways to say what they want due to natural Laziness
also, those who do not learn from history are doomed to have it repeated to them...
it takes a village to raise a programmer... 18:20
Xliff That depends on who coded the village. 18:20
TreyHarris In college I had an Esperanto penpal from Germany, who wrote to me "Mi tracontinenttrajnvojagxos Orientaurbaurbo." ("I will be travelling across the continent by train to the eastern port city." He was writing German in Esperanto.
TimToady I coded this village. :P 18:21
TimToady though I'm afraid it still has a few bugs... 18:21
TreyHarris It's not that they're bugs, it just DWIMs differently from WIM 18:23
AlexDaniel Hotkeys: but then, with no translation mindset whatsoever you may end up being unable to discuss some topics even in languages that you are proficient with 18:24
Xliff TimToady: I like this village! 18:25
TimToady My grandma used to start telling a joke, then give the punchline in low german. When asked for a translation, she'd say: It's not funny in English.
AlexDaniel Hotkeys: e.g. doing everything related to software development in English, but then somebody asks you a simple question in your first language
Xliff TimToady: Other villages, however, are not so welcoming to newcomers.
huf AlexDaniel: then you start mixing english into your first language until you get something you can use 18:26
and you'll just expect the other party to get with the program of course :D
AlexDaniel huf: that's if you understand the question…
huf well if they're using first-language it-slang then yeah, i probably wont
but that's why we dont do that :) 18:27
grondilu lernis esperanton de longe 18:29
TimToady Learning a new language is like a kid playing with tools of unknown power and danger. Someone's gonna get hurt, but we don't know who yet... 18:31
grondilu Hi all. What's the status of the JS port?
s/port/target/ 18:32
Xliff TimToady: Isn't that almost like science?
TimToady sure, which is why you stand back :)
Xliff \TimToady++
AlexDaniel pmurias: ↑ 18:33
Xliff wonders if JK Rowling played with Esperanto... it would explain a lot of the "magic" in Harry Potter.
TimToady if you really want to bend your mind, don't just learn another Indo-European langauge... 18:35
which arguably Esperanto is 18:36
TimToady picked to learn a language that actually uses reverse Polish, and I don't mean Polish backwards 18:37
grondilu The vocabulary is mostly latin, but I can vaguely see influences of oriental languages
grondilu admits his knowledge of oriental languages is limited though 18:38
Xliff Taichi in reverse is ChiTai
TimToady in 日本語, the prepositions are all postpositions, and the main verb always comes at the end, not at or near the beginning 18:40
so you have to keep the stack in your head very differently from IE lanuages
grondilu Not related: I like Perl6 "Mix" structure, sadly I see nothing equivalent in other languages. And I'm not sure which word to use to search it.
TimToady sure, that's related to the earlier concept of "This concept doesn't map well into that language" :) 18:41
Hotkeys [iʃtjat]
taichi in reverse :v
grondilu I mean even if a language doesn't support it natively, I would expect a library to exist, but I have no idea how to look for it.
TimToady search for where rosettacode has Mix for the P6, then see what other languages call it? 18:42
maybe RC doesn't call for Mix much...
TreyHarris As a comp ling student, I had to take the entire CS sequence, the entire linguistics sequence, and three semesters each of three languages, one of which had to be non-Indo-European. Since I was part-time, that meant it was literally impossible to ever complete my degree without taking enormous gaps between language semesters--I maybe should have thought of that first. :-) 18:43
grondilu there is one task apparently
TimToady I'll bet most other languages use the term "weighted" in there somewhere
but we like our 3-letter type names a lot :)
grondilu nope, my bad.
TreyHarris grondilu: look at the "associative array/dictionary/hash" thing. People will swear mighily whichever one they learned is the "correct" name for it and the others are implementational or imprecise 18:45
TimToady we don't think "hash" is more correct, it's just shorter :)
TreyHarris TimToady: "People" != you
Uh...
grondilu a hash is not exactly a Mix, though.
TimToady one of the reasons language designers get along fine, but their followers always get into fights 18:46
TreyHarris For some sets of "people", a TimToady is not a subset.
TimToady for at least one set of people, TimToady is an improper subset 18:47
Hotkeys You'd probably have more luck with bags aka multisets 18:48
TreyHarris Hmm, now that we're firmly in Unicode-land, we could rename it a "haŝ", to keep the three-letter thing. Or a "haʃ".
Hotkeys but Mixes are a pretty straight forward comrade to the bag 18:48
grondilu "multiset" sounds like a good try 18:49
TimToady some bag or multiset article or other might have an outbound cross reference
grondilu it only takes integer values, though. Not reals.
Hotkeys Real-valued multisets is apparently the name for a mix 18:50
grondilu is actually much more tired than he though. Goes to bed. 18:51
Hotkeys now I feel the itch to write an implementation of mixes in haskell 18:52
TreyHarris Hotkeys: Indexed data structures are so rarely useful in Haskell, in my experience. But a mix might be the exception. Interesting. A mix could be easily constructed and traversed with a zipper... could you just make it generally applicative? 18:54
TimToady so...what would a complex-values multiset be called in p6?
*valued
TreyHarris TimToady: Complex, as in real+imaginary complex?
TreyHarris A Mjx? 18:54
(pronounced "myiks") 18:55
lizmat
.oO( Commix )
TimToady a Mandel?
TreyHarris That would work better if Perl used j rather than i as the imaginary unit. 18:56
b2gills Confusing?
TimToady so we need something imaginary, I Img
Hotkeys Not sure TreyHarris, I'd have to have a think on it 18:57
or a try at implementing :P
TimToady we could, y'know, break the rule that says all such types have to be 3 letters, since this is, like, way out in the mathosphere 18:58
TreyHarris (Am I the only one who freely switches between Cartesian coordinates, polar coordinates, and complex numbers when doing 2D graphics based on whatever the language library I have makes easiest? No rotation function? That's okay, I can turn the coordinates into complex numbers and multiply!) 18:58
TimToady and, in fact, we chose to spell out Complex for similar reasons 18:59
TimToady huffman coding doesn't work if everything has to be short; I'm looking at you, APL 19:00
TreyHarris I find complex numbers ridiculously useful for things that have nothing to do with irreal mathematics.
geekosaur I thik most people avoid it because the conversion errors become significant quickly 19:00
TimToady ooh, lunchtime, how'd that happen so quick? 19:01
TreyHarris geekosaur: ah, interesting. I tend to be doing it in the context of plots and diagrams, occassionally UI elements, and generally in something like SVG. It doesn't really catch up to you then. 19:02
TimToady
.oO(If you don't have to stand back, it's not science.)
19:05
TreyHarris
.oO(I wish there were a Rosetta Stone for the XY problem. Meaning, if I have X problem, show me the best libraries in any/every language. The Rosetta Stone wiki itself is at slightly lower-level than I'm talking about; not algorithms, but entire problem sets, like "ORM" or "vector drawing")
19:07
Hotkeys "Rosetta Library" 19:10
doesn't roll off the tongue very well
TreyHarris Mostly because I'd like to steal shamelessly from them all and make the best version in Perl 6. ;-) 19:13
Hotkeys haha 19:16
pmurias grondilu: I'll release a parcel (module bundler plugin) to allow running Perl 6 scripts in the browser tommorow 19:38
grondilu: rakudo.js passes 1005 roast test files on node.js
pmurias grondilu: that's 77% percent of all of them 19:40
grondilu: a bunch of the failing ones are IO/threads which I'm not focusing on
TreyHarris That's fantastic; who's working on a reactive architecture for it a la Elm? 20:03
SmokeMachine m: class A {has $.val; method a {"a$!val"}; method b {"b$!val"}}; class B { has A:D $!obj-a handles {$_ ne "new"} = A.new: :42val}; say B.new.a; say B.new.b # Xliff I only had time to try it now... 20:12
camelia a42
b42
pmurias TreyHarris: I'm not aware of working on a reactive architecture for rakudo.js 20:13
TreyHarris (Is Cro able to be repurposed to use rakudo.js for in-page reactive components?) 20:14
pmurias TreyHarris: I would have to think about it
TreyHarris pmurias: I'm sure it will come. I'd make a stab at it myself if I didn't watch Elm development and see how tough a problem it is to do well and in a performant way
timotimo sounds like something you can just Add To Cro™ 20:14
TreyHarris Er, "expressive, performant, and debuggable--pick two" seems to be the way with such things, but Elm struck a very nice balance (well, for those of us who are extremely comfortable with FP, I suppose) 20:15
pmurias TreyHarris: I'll have to think about it on a fresh mind 20:17
TreyHarris: using React will work
pmurias TreyHarris: I have a start of a JSX DSL working 20:18
s/DSL/slang
SmokeMachine me too! :)
github.com/FCO/p6-react 20:19
pmurias remembers that there where two JSXes 20:22
SmokeMachine: yours was a bit more perlish rather then trying to be exactly the same thing if I remember correctly right? 20:23
SmokeMachine pmurias: yes
pmurias nc 20:36
sorry 20:37
TreyHarris pmurias, SmokeMachine: That's where I think the Elm architecture is particularly brilliant--it leveraged the nice things about the language as compared to JS to make a react that was much pleasanter to use without being any less expressive. 20:50
TreyHarris Gah--yeah, I couldn't even make a stab at it--I don't understand either JS or the DOM well enough 21:27
timotimo you can have JSX completely without the dom! :) 21:31
the part that connects JSX and the DOM is the reconciler 21:32
but react native has JSX without HTML DOM
TreyHarris timotimo: I'll have to give it a try; the samples reachable from reactjs.org/docs/introducing-jsx.html suggest it's still too JavaScripty for me--I'd want a version of JSX that's Perl6 21:41
timotimo jnthn has been designing a template language that ought to feel perl6ish 21:42
but it's supposed to go into template files rather than directly in your code
which doesn't have to be the case
TreyHarris (Again, my history with Haskell goes so far back that Elm feels far more expressive than JSX, so I'm probably a weird case.) 21:43
timotimo heh 21:43
TreyHarris geekosaur: Todd just replied but I still don't understand what he was saying was "really a bad idea to use". It feels like I asked "what is it?" and he replied "yes, very much". 22:35
timotimo maybe that it's confusing to use rw parameters heavily, and instead if you just have one value that has to go out, return it instead? 22:36
TreyHarris timotimo: ah-hah, yes, I can see that reading. But I'm not sure wanting examples to be a) non-contrived, b) clear and concrete, and c) showing best practice only is compatible with any desire they be d) concise.... 22:39
I frequently find the best examples are ones that include "this won't work" paired with what will work 22:40
geekosaur haven' received it yet
TreyHarris Oh, bizarre--my reply went direct to him, not the list, and he replied likewise, and we had a back-and-forth that was entirely without the list. Something strange about that particular message--Gmail defaults to reply, not reply-all. 22:45
timotimo: I'm impressed you were able to interpret an email you never saw :-D 22:47
timotimo i ... thought i saw that mail 22:50
geekosaur you may have seen something similar in another thread, since there's at least two overlapping ones 22:53
timotimo OK
that's an interpretation i'm completely fine with
TreyHarris I resent my side of the convo anyway. 22:54
geekosaur it's also possible someone's mailer has been deleting recipients
timotimo i'm sad to hear you resent the discussion ;) ;) ;)
TreyHarris re-sent :-)
timotimo i couldn't resist :) 22:55
TreyHarris Ugh, and Gmail mucked with my formatting so that it moved some of my text into the hidden reply portion 22:57
TreyHarris shrugs
timotimo ah dangit 22:59
mail is *really* hard
Herby_ \o 23:33
Xliff What's the best way to get the name of a module's .moarvm file? 23:39
timotimo querying the comp unit repo's precomp store i guess? 23:44
Xliff Got docs? ;) 23:45
timotimo if it's not easily findable on the doc site, then i'm afraid there might only be the source code 23:46
though there are design docs from the beginning
no clue how far the implementation and design have changed since then