»ö« Welcome to Perl 6! | perl6.org/ | evalbot usage: 'p6: say 3;' or rakudo:, or /msg camelia p6: ... | irclog: irc.perl6.org or colabti.org/irclogger/irclogger_logs/perl6 | UTF-8 is our friend! Set by moritz on 22 December 2015. |
|||
00:10
canopus_ is now known as canopus
00:11
pierre_ joined
00:28
ifdog joined
00:29
rindolf left
00:32
ifdog left
|
|||
Xliff | Does anyone know if cglobal still needs the full library name as stated here: docs.perl6.org/language/nativecall..._variables | 00:34 | |
00:34
wisti left
|
|||
Xliff | Nope! Don't look like it. | 00:37 | |
00:45
AlexDaniel left
|
|||
Xliff | Also what's the best way to handle FILE* passing using NativeCall? | 00:46 | |
timotimo | just use Pointer without anything specific, i guess | ||
Xliff | Hrm. | 00:48 | |
timotimo | they aren't really pointers, but when you use Pointer you get the right size for pointers on your platform, right? | ||
leont | In C89, not all pointers need to be equally sized AFAIK | 00:50 | |
Xliff | Yeah. | ||
timotimo | oh jesus christ ... | ||
what platforms do we support that have that? | 00:51 | ||
Xliff | Hmm... lemme look up IO::Handle, again. | ||
leont | I don't think any reasonable platforms have differently sized pointers, but it is legal and has existed | ||
geekosaur | timotimo, none I suspect. variable pointer sizes were a thing on old mainframes | 00:52 | |
timotimo | OK | ||
leont | Old DOS also had a long/short pointer concept | ||
geekosaur | like on PDP10s a (char) pointer could index part of a machine word, since it packed from 4 to 6 characters depending on representation into a 36-bit word | ||
leont | but that wasn't type dependent like some platforms had them -_- | ||
timotimo | oh yeah, lptr, i remember hearing of those | 00:53 | |
geekosaur | also there used to be tagged architectures, where the tag size depended on the type | 00:54 | |
Xliff | OK. So --> sub fdopen(int32 $fd, Str $mode) is native returns Pointer { * }; | 00:55 | |
That way I can use $iohandle.native-descriptor() | |||
The only trick is guessing $mode. | 00:56 | ||
leont | That problem isn't perl related :-p | ||
01:01
ocbtec left
|
|||
Xliff | leont: Actually, it is. | 01:01 | |
IO::Handle knows the mode, so why can't it be retrieved from the object? | |||
01:02
girafe left,
cdg left
|
|||
Xliff | Nothing in the docs. | 01:02 | |
01:03
setty1 left
|
|||
Xliff | I mean it really isn't the problem as long as the person opening the IO::Handle is the person converting it to a pointer, but that's not always the case for modules. | 01:03 | |
leont | Ah like that | ||
01:04
setty1 joined
01:05
skink joined
|
|||
skink | viki, @_@ | 01:07 | |
For the thing earlier, say $buf works after doing Buf.new($buf[..]), but only if you previously said $buf | |||
01:11
aborazmeh joined,
aborazmeh left,
aborazmeh joined
|
|||
geekosaur | Xliff, I don't think IO::Handle knows the mode /per se/. the underlying libuv descriptor probably (but not certainly) does, but may not make it available or moarvm may not provide a way to query it | 01:16 | |
and not all of them are opened in a way where you can know for sure (if you inherit a handle as stdin/stdout/stderr, it is not necessarily open for read/write/write respectively: ttys/ptys, network sockets, and on BSDs pipes can be open read+write) | 01:17 | ||
Xliff | geekosaur: Hence my comment. | 01:18 | |
So I have to hold my nose and use "w" for my calls to fdopen() | 01:19 | ||
But you are correct, my assertion that IO::Handle always knew the mode was incorrect. | 01:20 | ||
Well... first .h file conversion to module complete. On to the actual classes. | |||
First step in a looong journey. | |||
timotimo | have you had a look at gptrixie yet? | 01:22 | |
because that'll turn a .h file into a nativecall-using module for you | |||
Xliff | Yes, I am very familiar with gprixie. I used it for Audio::OggVorbis. | 01:24 | |
It has its flaws. | |||
timotimo | good to know | ||
Xliff | Particularly, it has a maximum limit before it will crash. | 01:25 | |
timotimo | oh, wow | ||
Xliff | It will *not* handle libxml2 | ||
Nor, by extension, libxslt | |||
timotimo | i wonder what exact part causes the crash? | 01:26 | |
skink | Speaking of nativecall stuff | ||
I am heavily limited as to what methods I can put on a repr('CPointer'), yeah? | |||
Xliff | timotimo: Don't know. I haven't had the patience to complete my trace. | ||
skink: You can have methods on a repr('CPointer') as long as you don't try to use self. | 01:27 | ||
timotimo | skink: shouldn't be, no | ||
you can totally use self | |||
Xliff | Hmmm... | ||
That's changed since my XML::LibXML days. | |||
timotimo | it could be i'm full of crap | ||
Xliff | (ie... the summer) | ||
timotimo | but it shouldn't be a problem | ||
skink | I can use self yeah, for self.free() { handle_free(self) } | 01:28 | |
Xliff | skink: What are you trying to do? | ||
skink | But I can't have a method that asks for in this case a size_t | ||
Xliff | skink: Yeah, that's legit | ||
timotimo | "asks for"? | ||
skink | >Cannot look up attributes in a type object | ||
Xliff | Thaaat's the one | ||
timotimo | that sounds like you're calling a method on an undefined instance of something | ||
Xliff | skink: Can you pastebin some code? | 01:29 | |
timotimo | actually, that error could totally get more output | ||
skink | sec | ||
Xliff | s/pastebin/fpaste/ | ||
skink | gotta update this gist anyway | ||
Xliff | Or gist. | ||
I need to stop using pastebin and start using more gist. | |||
skink | gist.github.com/skinkade/0a1a83adf...47b2224ed2 | 01:30 | |
I copy-pasted that codeblock from the nativecall docs, apart from CCRNG.buffer(size_t $len) | 01:31 | ||
01:31
wisti joined
|
|||
Xliff | skink: Yeah. repr('CPointer') can't have attributes. | 01:32 | |
skink | que lastima | ||
Guess I just need a buffer(ptr, len) then? | 01:33 | ||
timotimo | i just pushed a moarvm commit that also tells you what exact type it's trying to access | ||
Xliff | skink: Why do you think you need $!initialized? | 01:34 | |
skink | Like I said, copy-paste :) | ||
Xliff | LOL | ||
Fair enough. | |||
skink | Without buffer though, it works | ||
timotimo | i wonder why we allow attributes to be put onto an "is repr('CPointer')" class at all | 01:35 | |
01:35
leont left
|
|||
Xliff | Yeah, it's confusing. | 01:36 | |
skink | So we can do hacky crap? :) | ||
Xliff | Could be useful as long as only the P6 side uses it though. | ||
skink: You could have an inner class that handles the repr('CPointer') stuff. | 01:37 | ||
Then a regular P6 class. | |||
If you really want to do it the way I think you are trying to do it. | |||
MasterDuke | IO::Handle had a .mode, it returns the .mode of its $!path | 01:38 | |
skink | I mean this is just a POC that I was seeing if I could make look nice. | ||
MasterDuke | *has | ||
doesn't seem to be in the docs though | |||
Xliff | MasterDuke: Is that the mode it was opened with or the file permissions? | ||
MasterDuke | file permissions | ||
Xliff | HAH! Knew it. | 01:39 | |
Not the mode I'm looking for. Thanks, though. | |||
MasterDuke | tbrowder was also looking for the opened mode, Zoffix suggest how he could add it | ||
01:40
mst joined,
BinGOs left,
BinGOs joined,
Ulti joined
|
|||
MasterDuke | irclog.perlgeek.de/perl6/2016-11-02#i_13505117 | 01:41 | |
01:42
pierre_ left
|
|||
Xliff | m: class A { class B {}; }; my $a = A.new | 01:42 | |
camelia | ( no output ) | ||
Xliff | skink: I've commented on your gist. See if that makes any sense. | 01:43 | |
01:44
mst left,
mst joined,
aborazmeh left
01:46
aborazmeh joined,
aborazmeh left,
aborazmeh joined,
pierre_ joined
|
|||
Xliff | Aaand another. ;) | 01:46 | |
*sigh* | 01:48 | ||
viki is Zoffix? | |||
skink | You cannot declare attribute '$!rng' here; maybe you'd like a class or a role? | ||
for the last one | |||
first one got the same 'you cannot have attributes' thing | |||
Xliff | That man has more nicks than random alias generator. | 01:49 | |
Maybe he is a random alias generator. | |||
skink: o_O | |||
skink: What language is rust written in? | 01:53 | ||
That is not C | |||
skink | what :D | ||
Xliff | gcc barfed when I tried to compile the first part of your gist. | 01:54 | |
Do you know how hard compiler barfage is to get out of cotton?!?!? | |||
]8-D | |||
skink | Oh, well this is good | 01:55 | |
I am now getting inconsistent sigsegvs :D | |||
script'll work once or twice then die | 01:56 | ||
Xliff headdesks | |||
Rust is a language. Thanks skink! | |||
:P | |||
skink | I thought you were joking :) | ||
Xliff | Nope. No alcohol, tonight. | ||
Inconsistent SEGVs is something you will always have to worry about with NativeCall | 01:57 | ||
But rakudo is no longer complaining, right? | |||
About the only thing you can do is to turn on debugging information in your rust-build lib | 01:58 | ||
Then use perl6-gdb-m | |||
Just for shits and grins... Comment out $!rng.free | |||
skink | I reverted back to some earlier non-OO code | 01:59 | |
Xliff | It's possible that DESTROY isn't being called when you think it should be. | ||
And with that.... I must go *poof* | 02:00 | ||
Good luck, skink! | |||
02:03
cdg joined
|
|||
japhb | Xliff: People seem to assume a lot regarding $Zoffix.nicks. For one, that they are merely nicks and not distinct personas. Or that Zoffix is the root persona. Or that all $Zoffix.nicks are male-gendered (and that Zoffix itself is). I see no particular reason to assume any of these, unless Zoffix has specifically stated otherwise .... | 02:04 | |
seatek | even if he/she/* stated otherwise, he/she/* might be lying | 02:08 | |
yoleaux | 3 Nov 2016 14:01Z <gfldex> seatek: have you considered to include the following module into the tutorial? github.com/jnthn/grammar-debugger | ||
geekosaur assumes they are nicks, and Zoffix is approximately human | |||
seatek | i see no reason to assume Zoffix is human, or even a mammal | 02:09 | |
japhb | .oO( On the Internet, why would anyone care if you're a dog? ) |
02:10 | |
seatek | i would be unreasonbly swayed to the points any dog was trying to make | 02:11 | |
gfldex: i didn't even know about that grammar debugger myself! I'll need to play with it for a while before i do so i can sound like i know something | 02:13 | ||
02:22
Su-Shee joined
02:25
Su-Shee_ left
|
|||
Xliff | I still want to learn grammars. | 02:29 | |
I just haven't had the time. | |||
japhb: So the rule about Zoffix is "Do not assume you know Zoffix" | 02:30 | ||
seatek | Xliff: new tutorial for grammars in the docs now that takes you from knowing nothing about them rather than having to work it out for yourself | ||
Xliff | I got that, already. :) | ||
seatek: docs.perl6.org/language/grammars ?? | 02:31 | ||
seatek | Xliff: would be curiouss if you found it helpful | ||
Xliff | Will take a look, then | 02:32 | |
seatek | Xliff: docs.perl6.org/language/grammar_tutorial | ||
skink | japhb, Can we actually have a $Zoffix.nicks for one of the bots to list all his known aliases? | ||
02:32
cdg left
|
|||
seatek | Xliff: if you stumble on something or it doesn't make sense somehow along the way... | 02:32 | |
Xliff | seatek: I will drop you a line or something. | 02:33 | |
Or write a gist and pass that through yoleaux | 02:34 | ||
skink | ... is yoleaux pronounced yolo? | ||
seatek | Xliff: sweet thanks Xliff :) I really want it to work for people. I had a heck of time trying to understand them myself at first | 02:36 | |
Xliff | skink: Yes. Using a bad french accent. | ||
Well, I get the grammar creation part. It's the Actions that I don't get. | 02:37 | ||
Which I guess we'll find out. | |||
seatek | :) | ||
Xliff | LOL | 02:41 | |
"But not really." | 02:42 | ||
seatek | hehe :) | ||
Xliff | Not a good sign in a dry piece of documentation, but makes for great reading. | ||
seatek | well, they're a little weird... | ||
Xliff | Good documentation should make for moderately decent reading. | 02:43 | |
And this is a tutorial, so less formal language is usually helpful. | |||
seatek | gfldex: love the ::Tracer! that would have come in handy had i known about it. have a feeling i'll need to get some inheritances built up to really effectively learn the debugger element | 02:44 | |
Xliff | Hmmmm..... | ||
seatek | Xliff: thanks! yeah, that's what I was kinda going for... i wish i would have had that. i was struggling trying to figure out what was going on for a long time | ||
Xliff | seatek++: I now understand what "make" and "made" do after hearing about them for so long. | 02:45 | |
I still don't see the reason for it yet.... | |||
seatek | Xliff: ha!! yeah. such a simple thing once it clicks eh? | ||
keep going you will :) | |||
Xliff | seatek: Wow! That was a quick and easy read for a simple grammar, and it makes sense. | 02:47 | |
seatek | Xliff: yay! :) | ||
Xliff | The next thing that would be helpful is a "step 2" or "Intermediate" tutorial. | ||
seatek | now do you know what actions are? :) | ||
Xliff | Go from parsing single lines to a multi-line object... ala a simple language parser. | 02:48 | |
Oh, I've always known they were a class, but I have the gist of them. | |||
seatek | multi-line wouldn't be any different -- newlines are just whitespace | 02:49 | |
Xliff | At least now I may be able to get some idea as to how SLANG::SQL works. | ||
Nice job, seatek! | |||
Now I have to get ready for sleep. My eyelids are getting heavy. | 02:50 | ||
seatek | Xliff: thank you! | ||
Xliff | yw | ||
seatek | well, good dreams | ||
02:50
Rawriful left
|
|||
dalek | c: de536c7 | seatek++ | doc/Language/grammar_tutorial.pod6: mention Grammar::Debugger and also format break a couple lines at 80 cols. Maybe 100 cols. Maybe 1 80 and the other 100. |
03:08 | |
synopsebot6 | Link: doc.perl6.org/language/grammar_tutorial | ||
03:10
PerlJam joined
03:23
skink left
03:32
atweiden joined
03:33
djbkd joined
03:51
atweiden left,
wisti left
|
|||
samcv | i'm trying to alter the value of just one value in a multi dimensional array. doing %hash{'key'} = thing => 'value'; removes the other things from the hash that are there | 03:52 | |
well that are in 'key' | |||
geekosaur | well, yes, that is exactly what you told it to do | 03:54 | |
%hash{'key | |||
er | |||
03:54
noganex_ joined
|
|||
geekosaur | %hash{'key'}{'thing'} = 'value'; | 03:55 | |
samcv | that's what i thought, and i tried that. but i get an error, let me find it | ||
geekosaur | wonder if you need a . in there (which would be ugh) | ||
samcv | maybe it's because it's %!hash in a method, but i can do what i said above that removes values because it replaces the whole key fine | 03:56 | |
03:56
pierre_ left
|
|||
samcv | Type check failed in assignment to %!channel-event-data; expected Hash but got Array hmm | 03:57 | |
geekosaur | m: my %h = (a => {b => 'c', d => 'e'}); %h<a><d> = 'f'; dd %h | ||
camelia | rakudo-moar 5b2bde: OUTPUT«Hash %h = {:a(${:b("c"), :d("f")})}» | ||
03:57
noganex left
|
|||
samcv | but i'm doing now.Str | 03:57 | |
m: my %h = a => now.Str; | |||
camelia | ( no output ) | ||
samcv | m: my %h = a => now.Str; say %h; | 03:58 | |
camelia | rakudo-moar 5b2bde: OUTPUT«{a => Instant:1478231921.060494}» | ||
geekosaur | ...then why pair syntrax there | ||
samcv | %.channel-event-data{$e.nick}{'spoke'} = now.Str; this is what i have in my file | ||
so maybe it's the now.Str getting something weird | |||
m: now.Str.WHAT.say | |||
camelia | rakudo-moar 5b2bde: OUTPUT«(Str)» | ||
samcv | hm | ||
geekosaur | oh, I read that error backwards... | 03:59 | |
03:59
pierre_ joined
|
|||
samcv | ok i tested and %.channel-event-data{$e.nick}{'spoke'} = '1000'; also removes the other values in it | 04:00 | |
geekosaur | oh... it's an attribute. that gets trickier | ||
samcv | not sure why | ||
yeah maybe i should not do that | |||
geekosaur | it's calling an accessor, which may not be doing what you expect | ||
04:08
cyphase left
04:12
cyphase joined
|
|||
samcv | hmm looks like it was getting a multidimensional array not a hash | 04:21 | |
what's the best way to convert from an array to a hash? | |||
gfldex | m: dd <a b c d>.Hash | 04:22 | |
camelia | rakudo-moar 5b2bde: OUTPUT«Hash % = {:a("b"), :c("d")}» | ||
gfldex | depends on the structure of your array | ||
04:22
wisti joined
|
|||
gfldex | m: dd do for <a b c d> { $^a => $^b } | 04:23 | |
camelia | rakudo-moar 5b2bde: OUTPUT«(:a("b"), :c("d"))» | ||
gfldex | that's actually a list of Pair tho | ||
samcv | i'm trying to use json::tiny {name => [{spoke => 0} {join => 1477091584} {part => 1477090875}], here is one of the things in the array | 04:26 | |
when i print it | |||
when i do .Hash it says typcheck failed. i specified my Hash %hash | 04:27 | ||
gfldex | can you gist the code in question? | 04:28 | |
samcv | here you go gfldex vpaste.net/Esirp | 04:30 | |
%channel-event-data = from-json($!channel-event-fh.slurp-rest).Hash; this line is what's causing the typecheck error | |||
gfldex | i'm asking for a gist because of packages.debian.org/jessie/gist btw | 04:31 | |
also, a gist would show line numbers. Makes talking about the code easier. | 04:33 | ||
from-json can return all kind of things. So just calling .Hash on it is dangerous in any case | 04:37 | ||
samcv | yeah there's not much info on the github page for it | ||
gfldex | ohh, my Hash %foo is a Hash of Hash and from-json will never return that | 04:39 | |
04:40
khw left
|
|||
gfldex | as I see it from-json can return Int, Str, List (or Array) and Hash | 04:40 | |
Xliff | What does the JSON look like? | 04:42 | |
gfldex | i would leave the data returned as it is and either handle it with a given/when block (if it's simple) or a recursive multi walker if it's complex | ||
04:42
Sgeo_ joined
04:43
Tonik joined,
Su-Shee_ joined
04:45
Sgeo left
|
|||
gfldex | samcv: also: gfldex.wordpress.com/2016/08/01/wa...the-flats/ and gfldex.wordpress.com/2015/12/20/i-...-them-now/ | 04:46 | |
04:46
Su-Shee left,
Su-Shee_ is now known as Su-Shee
04:47
skids left
04:49
pierre_ left
|
|||
samcv | ah so leaving it as a list would be best... | 04:54 | |
that sounds sub optimal. well i created the json from a hash at least | |||
but unfortunately tiny json isn't returned it as one i guess | 04:55 | ||
04:55
pierre_ joined
04:58
cpage_ left
05:00
pierre_ left
|
|||
gfldex | m: sub type-dump(\any = Empty){ any ~~ Iterable ?? any».&type-dump !! any.WHAT }; say type-dump([a=>1, b=>2, {:c(3)}, 42 ]) | 05:01 | |
camelia | rakudo-moar 5b2bde: OUTPUT«[(Pair) (Pair) {c => (Int)} (Int)]» | ||
gfldex | samcv: ^^^ simply type dumper that will walk a tree | 05:02 | |
Perl 6 is awesome :) | |||
samcv | it is | ||
05:15
Su-Shee_ joined
05:18
Su-Shee left
05:32
Cabanossi left
05:33
wamba joined
05:35
Cabanossi joined
05:43
Tonik left
05:56
cpage_ joined
06:01
wisti left
06:11
Tonik joined
06:13
Su-Shee joined
06:16
Su-Shee_ left
06:18
Khisanth left
06:23
domidumont joined
06:25
ufobat joined
06:27
domidumont left
06:28
domidumont joined
06:29
canopus left
06:30
djbkd left,
djbkd joined
06:32
Khisanth joined
06:33
perlawhirl left
06:35
djbkd left
06:36
domidumont left
06:38
canopus joined
06:39
aborazmeh left
06:41
andrzejku joined,
cgfbee left
06:42
aborazmeh joined,
aborazmeh left,
aborazmeh joined
06:45
bjz joined
06:48
RabidGravy joined
06:49
pierre_ joined
06:50
cgfbee joined
|
|||
japhb | .tell tadzik I sent you a PR to add 256-color and 24-bit RGB color support to Terminal::ANSIColor. Enjoy. :-) | 06:51 | |
yoleaux | japhb: I'll pass your message to tadzik. | ||
06:56
domidumont joined
07:02
andrzejku left,
bjz left,
jameslenz left,
andrzejku joined
07:04
sivoais left
07:05
sivoais joined
07:14
darutoko joined
07:16
bjz joined,
neuraload joined
|
|||
llfourn_ | m: my $foo = "bar"; for |$foo { $_ = "baz" }; # is |$foo on a non-iterable meant to decont? | 07:17 | |
camelia | rakudo-moar 5b2bde: OUTPUT«Cannot assign to an immutable value in block <unit> at <tmp> line 1» | ||
07:19
jameslenz joined
|
|||
Xliff | gfldex++: Awesome code! | 07:21 | |
07:21
bjz left
07:22
bjz joined
07:27
eliasr joined
07:28
RabidGravy left
07:29
perlawhirl joined
07:31
firstdayonthejob joined
07:35
perlawhirl left
07:42
firstdayonthejob left
07:46
wamba left
07:47
bjz left
07:48
TeamBlast left
07:49
sivoais left
07:50
bjz joined
07:51
sivoais joined
07:54
Su-Shee_ joined
07:55
Su-Shee left
07:58
Su-Shee_ left
07:59
Su-Shee joined
08:11
TeamBlast joined
08:13
bjz left
08:14
andrzejku left
08:18
bjz joined
08:23
noganex_ left,
brrt joined
08:25
noganex joined
08:32
maybekoo2 joined
|
|||
masak | morning, #perl6 | 08:35 | |
DrForr | Mornin'. | 08:36 | |
08:37
zakharyas joined
08:42
Su-Shee_ joined
08:43
Su-Shee left,
Su-Shee_ is now known as Su-Shee
|
|||
lizmat | good morning, #perl6! | 08:43 | |
masak | ahoj lizmat | 08:44 | |
08:44
neuraload left
|
|||
brrt | good *, lizmat, DrForr, masak | 08:44 | |
08:45
bjz_ joined,
bjz left
|
|||
lizmat | brrt: maybe it's time for a blog post on the JIT progress ? :-) | 08:46 | |
08:46
neuraload joined
|
|||
brrt | :-$ | 08:46 | |
yes... it probably is... | |||
I'm overengineering my blog posts, usually | |||
moritz | brrt: it would also be a awesome if you wrote something about the JIT project for the perl 6 advent calendar | 08:50 | |
DrForr | Well, I announced the Perl 6 Pocket Reference (not the actual name) at Cluj.pm - Going to get started this weekend. | ||
moritz | \o/ | 08:51 | |
brrt | it's time for perl6 books, yes :-) | ||
moritz | DrForr++ | ||
brrt | moritz: but *what*? | ||
moritz has prepared three blog posts so far for his book, but will wait a bit with publishing them | |||
brrt: whatever you find interesting. Or others could find interesting | 08:52 | ||
brrt | usually perl6 advent calendars are 'treats' of things that can be practically applied by readers | ||
well... what i find interesting | |||
moritz | doesn't have to be this will | ||
*way | |||
brrt | this morning I realized that there is an isomorphism between recursion and queueing | ||
is isomorphism even the correct word? | |||
moritz | you could distill a progress report from the grant reports so far; or write about the tiler | ||
brrt | recursion is a subset of queueing? | ||
moritz | if it's a subset, it's not isomorphism :-) | 08:53 | |
brrt | true | ||
hmm | |||
08:55
wamba joined
|
|||
DrForr | Amusingly one of my slides last night had people asking about transfinite arithmetic :) | 08:55 | |
08:56
Su-Shee left
|
|||
brrt | what is transfinite arithmetic.... is it what it sounds like? and how would that ever work | 08:56 | |
DrForr | Arithmetic involving aleph-null and above :) | 08:57 | |
08:58
rindolf joined
09:01
wamba left
09:02
Actualeyes left
09:06
labster left
|
|||
lizmat | afk for a bit& | 09:13 | |
09:14
Actualeyes joined
09:17
seatek left
09:18
wamba joined,
labster joined
09:23
rindolf left
09:26
KevinYang joined
09:29
KevinYang left
09:30
espadrine joined
09:31
araujo joined
09:39
pierre_ left
09:54
pierre_ joined
|
|||
viki | m: sub type-dump(\any = Empty){ any ~~ Iterable ?? any».&type-dump !! any.WHAT }; say type-dump([a=>1, b=>2, {:c(3)}, 42 ]) | 10:04 | |
camelia | rakudo-moar 050cf7: OUTPUT«[(Pair) (Pair) {c => (Int)} (Int)]» | ||
viki | m: say deepmap {.WHAT}, [a=>1, b=>2, {:c(3)}, 42 ] | ||
camelia | rakudo-moar 050cf7: OUTPUT«[(Pair) (Pair) {c => (Int)} (Int)]» | ||
viki | Xliff: Rust is written in.. Rust :) | 10:05 | |
10:13
cpin joined
10:17
nadim joined
10:21
rindolf joined
10:24
ocbtec joined
|
|||
viki | japhb: interesting hypothesis :) What if there is no Zoffix persona and the different nicks represent the ever-changing and ever-new personas assumed by the persona-less Zoffix entitity? Either that, or Zoffix is just trolling everyone :} | 10:24 | |
.oO( the zoffix is a lie ) |
10:25 | ||
10:28
leont joined
10:30
AlexDaniel joined,
pmurias joined
10:33
djbkd joined
10:34
labster left
10:38
djbkd left
10:40
espadrine left
10:42
mephinet left,
eliasr left,
notbenh_ left
10:43
timeless left
10:44
chansen_ joined,
avalenn left,
damnlie_ joined,
JimmyZ joined,
damnlie left,
notbenh_ joined,
mephinet joined
10:45
avalenn joined,
ilmari joined,
AlexDaniel left,
mrsolo joined
10:46
pierre_ left
10:47
clkao joined,
timeless joined
10:48
Hotkeys joined
10:49
robinsmidsrod joined
10:52
benchable6 left,
committable6 left
10:54
dylanwh left
10:55
dylanwh joined
10:57
ugexe joined
10:59
jnap_ joined
|
|||
moritz | the conitnuity (or lack thereof) or identity is an interesting research topic, IMHO | 11:04 | |
11:05
rodarmor left
|
|||
brrt | continuity of what? | 11:05 | |
11:05
cdg joined
|
|||
moritz | s/or/of/ | 11:05 | |
of identity | |||
11:06
user9 left
11:07
user9 joined,
rodarmor joined
11:11
perlawhirl joined
11:12
zakharyas left
|
|||
perlawhirl | hi perlers. | 11:13 | |
i have a question that's kinda hard to explain over irc, so i've put it in a gist: gist.github.com/0racle/2c29dc66413...a795767a08 | 11:14 | ||
I'm not sure if I can do it by returning an explicit Seq.new... | 11:16 | ||
brrt | I think the thing you are running into is that you want lazy-indexed behaviour rather than lazy-sequence behaviour | 11:18 | |
the AT-POS solution seems good to me | |||
perlawhirl | yeah, it's good for something simple, but means you can't really pass additional args to .thing(). | 11:20 | |
11:21
leont_ joined
|
|||
perlawhirl | my other though was just to return an anon class that implements AT-POS | 11:21 | |
might have a play with that idea | |||
11:21
nadim_ joined
11:24
leont left
11:25
nadim left
11:29
mephinet left
11:30
mephinet joined
11:32
cgfbee left
11:33
TEttinger left
11:37
cdg_ joined
11:39
cdg left
12:09
perlawhirl left
12:15
pierre__ joined
12:19
zakharyas joined
12:21
cgfbee joined
12:23
yoleaux left,
yoleaux joined,
ChanServ sets mode: +v yoleaux
12:24
wamba left
|
|||
dalek | c: 8e6f20a | coke++ | doc/Language/grammar_tutorial.pod6: remove trailing whitespace |
12:27 | |
synopsebot6 | Link: doc.perl6.org/language/grammar_tutorial | ||
12:39
raiph left
|
|||
pmurias | node.js-- # v8-profiler is broken on node 7.0 and the pull request to fix it is unmerged :( | 12:40 | |
masak | pmurias: oh, so it's not just me -- node.js seems to be a bit of a wild west of "move fast and break things" | 12:43 | |
DrForr | AFAIK TauStation's node.js stack is still technically broken because there's a broken module in npm. | 12:46 | |
masak | DrForr: does it prevent them from doing work? | 12:47 | |
perlpilot | masak: that's been my experience as well. | ||
moritz | I hope they run a local npm mirror | ||
masak | this year I read an article whose point was "if you really care about stability, make a snapshot of node_modules" | ||
I went looking for it the other week, but I couldn't find the article again :/ | 12:48 | ||
it was in connection to the pad-left thing | |||
moritz | we have a nexus running, which acts as a caching proxy for npm modules | ||
masak | moritz: it's not just about them being available though, it's also about them being updated under your feet with breaking changes | ||
moritz | masak: can't you pin versions? | 12:49 | |
DrForr | No, we just pin module versions using .. gulp? | ||
masak .oO( from the department of "OMG dependencies are tricky" ) | |||
moritz: yes -- provided you do that for everything I guess it's the same | |||
moritz | masak: well, there's something to be said for rebuilding the environment on each build, just to make sure you still can | ||
gfldex | m: class C { method subscript(|c){ say "subscript of: ", c.perl } }; multi sub postcircumfix:<[ ]>(C:D \SELF, \pos){ SELF.subscript(pos) }; C.new.[1,42]; | 12:50 | |
camelia | rakudo-moar b1c41b: OUTPUT«subscript of: \((1, 42))» | ||
gfldex | .tell perlawhirl objects can be made aware of being subscripted with class C { method subscript(|c){ say "subscript of: ", c.perl } }; multi sub postcircumfix:<[ ]>(C:D \SELF, \pos){ SELF.subscript(pos) }; C.new.[1,42]; | 12:51 | |
yoleaux | gfldex: I'll pass your message to perlawhirl. | ||
12:52
mscha joined
|
|||
mscha | m: say e**(π*i) + 1; | 12:52 | |
camelia | rakudo-moar b1c41b: OUTPUT«0+1.22464679914735e-16i» | ||
12:55
R_I_D joined
|
|||
masak | m: my %h = a => 1, b => 2; subset mh of Str where %h{$_} :exists; my mh $x = "b"; %h<b> :delete; say $x | 12:56 | |
camelia | rakudo-moar b1c41b: OUTPUT«b» | ||
masak | ta-daa! | ||
(not a but, just something to keep in mind) | |||
bug* | |||
R_I_D | do modules need to be explicitly linked when perl6 is called? | 12:58 | |
masak | no | ||
R_I_D: the whole compilation stage is largely hidden and implicit -- you indicate a source file, and perl6 goes and figures it out from there | 12:59 | ||
R_I_D | okay. I have a User.pm6 file which delcares a user object, and a test-user.pm6 file which invokes a new() one. | ||
the test file has User.pm6 at line one, but when I run perl6 test-user.pm6, it says cannot find User | 13:00 | ||
timotimo | '.' isn't in the search path by default | 13:01 | |
masak | I tend to do `export PERL6LIB=lib` | ||
(that's assuming that the User.pm6 file is in lib/) | |||
R_I_D | You put that in your .bashrc? | ||
masak | no, but that could totally be done | ||
13:02
cdg_ left
|
|||
masak | I just re-run it when I have a fresh tab that I do perl6 development in :) | 13:02 | |
13:02
brrt left
|
|||
DrForr | I just do 'alias 6="perl6 -Ilib"' and put my libraries in lib/. | 13:02 | |
viki | R_I_D: you can also include paths with -I switch | ||
13:02
cdg joined
|
|||
DrForr | (which is pretty much perl6 standards.) | 13:03 | |
13:04
rindolf left
|
|||
R_I_D | ah! it's alive! thanks everyone | 13:06 | |
13:07
cdg left
|
|||
masak | no problem! bring it on! :D | 13:07 | |
13:08
rindolf joined
|
|||
mscha | m: my \ℕ = 1..∞; say 42 ∈ ℕ; | 13:13 | |
13:14
lichtkind joined
|
|||
camelia | rakudo-moar b1c41b: OUTPUT«(timeout)» | 13:14 | |
13:14
R_I_D left
13:20
wamba joined
|
|||
viki | m: my \ℕ = 1..∞; say 42 ~~ ℕ; | 13:20 | |
camelia | rakudo-moar b1c41b: OUTPUT«True» | ||
viki | mscha: the ∈ is a set operator and converts args to sets, which causes the hang. The smartmatch against a range is the Right Way to do it. | ||
13:23
bjz joined
|
|||
viki | m: multi infix:<∈> (\n, Range \r) { n ~~ r }; my \ℕ = 1..∞; say 42 ∈ ℕ; | 13:23 | |
camelia | rakudo-moar b1c41b: OUTPUT«True» | ||
13:23
cpage left
13:24
cpage joined
|
|||
awwaiid | though then 12.5 ∈ ℕ will still not work out very well :) . or will it... | 13:24 | |
13:24
bjz_ left
|
|||
awwaiid | m: my \ℕ = 1..∞; say 12.5 !~~ ℕ | 13:24 | |
camelia | rakudo-moar b1c41b: OUTPUT«False» | ||
awwaiid | AMAZING | ||
13:24
cpage_ left,
cpage__ joined,
cpage__ is now known as cpage_
|
|||
viki | :) | 13:25 | |
m: my \ℕ = 1..∞; say 12.5+1i ~~ ℕ | |||
camelia | rakudo-moar b1c41b: OUTPUT«True» | ||
viki | heh | ||
m: multi infix:<∈> (\n, Range \r) { n ~~ UInt and n ~~ r }; my \ℕ = 1..∞; say 42+9i ∈ ℕ; | 13:26 | ||
camelia | rakudo-moar b1c41b: OUTPUT«False» | ||
viki | m: multi infix:<∈> (\n, Range \r) { n ~~ UInt and n ~~ r }; my \ℕ = 1..∞; say 42.5 ∈ ℕ; | ||
camelia | rakudo-moar b1c41b: OUTPUT«False» | ||
viki | m: multi infix:<∈> (\n, Range \r) { n ~~ UInt and n ~~ r }; my \ℕ = 1..∞; say 42 ∈ ℕ; | ||
camelia | rakudo-moar b1c41b: OUTPUT«True» | ||
viki | There we go. | 13:27 | |
awwaiid | m: multi infix:<∈> (Int \n, Range \r) { n ~~ r }; my \ℕ = 1..∞; say 42 ∈ ℕ | ||
camelia | rakudo-moar b1c41b: OUTPUT«True» | ||
awwaiid | er | ||
13:28
leont_ left
|
|||
awwaiid | m: multi infix:<∈> (Int \n, Range \r) { n ~~ r }; my \ℕ = 1..∞; say 42+9i ∈ ℕ | 13:28 | |
camelia | rakudo-moar b1c41b: OUTPUT«Cannot resolve caller infix:<∈>(Complex, Range); none of these signatures match: (Int \n, Range \r) in block <unit> at <tmp> line 1» | ||
viki | m: my \ℕ = subset :: of UInt where 1..∞; say 45+5i ~~ ℕ | ||
camelia | rakudo-moar b1c41b: OUTPUT«False» | ||
viki | m: my \ℕ = subset :: of UInt where 1..∞; say 45 ~~ ℕ | 13:29 | |
camelia | rakudo-moar b1c41b: OUTPUT«True» | ||
viki | :) | ||
awwaiid | nice | ||
is the 1..∞ adding any value over UInt there? | 13:30 | ||
viki | Oh, I guess not :D | ||
awwaiid++ | |||
awwaiid | maybe zero? | ||
viki | Oh, right | ||
13:31
wamba left
13:37
bjz left
13:39
user9 left
13:42
JimmyZ left,
JimmyZ joined
13:46
neuraload left
13:48
skids joined
13:50
nicq20 joined
|
|||
nicq20 | Hello \o | 13:51 | |
pmurias | masak: yes, node.js seems to have a very wild west approach in general | 13:52 | |
DrForr | o/ | ||
moritz | pmurias: would you be willing to write a blog post on nqp-js/rakudo-js for the perl 6 advent calendar? | 13:53 | |
perlpilot | moritz++ that would be excellent IMHO | 13:58 | |
14:00
aborazmeh left
14:03
wisti joined
|
|||
awwaiid | what... zoffix became viki now? You just like to reset my context all the time! I need state damnit to shortcut assumptions -- purely functional conversations are not efficient! | 14:04 | |
viki | tehee | 14:06 | |
awwaiid | I would have taken yesterday's conversation about disabling flicker failing tests quite differently, for example. On the one hand I would have given much more weight to someone I recognized as an active contributor and non-stranger, on the other hand I would have felt much more comfortable being direct about my observatons and experiences. Lame I tell you. LAME. But that's fine. Break my world. BREAK IT GOO | 14:08 | |
D | |||
awwaiid switches over to paying attention at $day-job | |||
mst | awwaiid: when I'm not sure I /whois since he's still @perl6.party | 14:09 | |
though at this point I've got a fairly good mental index of which nicks turn out to be tie()ed to Zoffix | |||
awwaiid | makes sense. My irc skillz and instincts could be improved :) | ||
mst | I've been an op for over ten years, my alt spotting spidey senses have been built up by a decade of idiocy | ||
awwaiid | hehe | ||
viki | :D | 14:10 | |
mst | in this case, they're being used for something more pleasant | ||
but it's still the same basic set of instintcs | |||
14:10
khw joined
|
|||
perlpilot | mst: don't give him hints about what to change though. Next thing you know we'll be talking 5 different nick that are all Zoffix and we won't be able to tell. | 14:10 | |
:-) | 14:11 | ||
14:11
ufobat left
|
|||
awwaiid | I want to see those 5 talk to themselves in a constructive way. Imagine the collaboration potential! | 14:11 | |
I of course expect 5x the PRs | |||
moritz | you want a DDoS on github? | 14:12 | |
nicq20 | How do I know that everyone here isn't Zoffix already? | ||
awwaiid | indeed. How do any of us know. | ||
moritz | nicq20: maybe you are Zoffix! | ||
perlpilot | Any nick I don't recognize, I immediately assume is Zoffix. It's worked well so far :) | ||
awwaiid | haha | ||
mst | perlpilot: many years ago when we were both younger and stupider I played hide and seek with zoffix over a channel ban; I'm reasonably confident I can spot him even if he's trying to stay cloaked ;) | 14:13 | |
14:14
kurahaupo__ joined
|
|||
mst | new nick + similar speech patterns + similar areas of knowledge is generally quite sufficient | 14:14 | |
moritz | .oO( cogney accept helps! ) |
14:15 | |
nicq20 | mst: Plus the UL may help | ||
*URL | |||
mst | I meant even if he'd changed the hostmask | ||
perigrin | moritz: cockney? | 14:22 | |
14:22
kurahaupo__ is now known as kurahaupo
14:24
zacts left,
pierre__ left
14:27
pierre__ joined,
mscha left
|
|||
Xliff | mst: So you are "on" to The Zoffix Collective? | 14:38 | |
Heck! We might as well just cave and call it what it really is. | 14:39 | ||
mst | hah | ||
Xliff | Resisting The Zoffix is futile. | ||
nicq20 | Xliff: Hivemind? | ||
arnsholt had actually forgotten that Zoffix is the base name | |||
Xliff | nicq20: Close. Up the geek index by 20. | ||
arnsholt | At this point it's just "that guy" | ||
Xliff | arnsholt: Look, if one of his nicks is "locutus", I'm gone. | 14:40 | |
14:42
yoleaux left
14:44
yoleaux joined,
ChanServ sets mode: +v yoleaux,
pierre__ left
14:45
pierre__ joined
|
|||
[Coke] loves the code archeology of knowing when someone did a cut and paste because of the shared typos. | 14:45 | ||
14:45
user9 joined
|
|||
japhb | Xliff: Patrick Stewart is a 6er? I'm all for it! | 14:53 | |
Although at this point I've seen the "mild shock" meme template so many times it's about the second thing I think of when I think of him now. | 14:54 | ||
14:57
sufrostico left
|
|||
Xliff | japhb: To reduce such an illustrious career to a simple image.... sad.... | 14:59 | |
15:00
Lucas_One left
15:01
Lucas_One joined,
huajie-hu joined
|
|||
masak | [Coke]: I once saw phylogenetic techniques being applied to a bunch of chain emails. you could basically topo-order them by looking at where typos and changes were introduced. | 15:06 | |
ilmari | is it solipsistic in here or is it just zoffix? | 15:07 | |
yoleaux | 3 Nov 2016 12:23Z <tbrowder> ilmari: please check my WIP module at github.com/tbrowder/Misc-Utils-Perl6 for proposed module names shown in the table in the README. comments, please. | ||
15:08
huajie-hu left
15:09
kyclark joined,
cdg joined
|
|||
viki | .oO( zofflipsism ) |
15:09 | |
The theory that only Zoffix exists :P | 15:10 | ||
15:10
cdg left
|
|||
ilmari | and we are all a figment of their imagination | 15:10 | |
15:10
cdg joined
|
|||
ilmari | s/a figment/figments/ | 15:10 | |
i english gud | |||
viki | Zoffix cogitet, ergo sum | 15:11 | |
15:13
Rawriful joined
15:17
huajie-hu joined
|
|||
huajie-hu | zzz | 15:18 | |
viki | xxx | 15:19 | |
nicq20 | yyy? | 15:20 | |
viki | 🦋🦋🦋 | ||
pmurias | moritz: I'll think about it, if I get rakudo.js to a (semi-)presentable state I'll try to do that | ||
nicq20 | Oops, ccc | ||
15:21
brillenfux joined
|
|||
moritz | pmurias: ok, thanks | 15:24 | |
15:24
brillenfux left
|
|||
moritz | pmurias: IMHO it would be worth it writing about it even if it's not semi-presentable, just to get more publicity for the project | 15:24 | |
15:25
huajie-hu left
15:29
huajie-hu joined
15:30
zacts joined
|
|||
kyclark | How can I turn off any output buffering? In Perl 5, it’s $| =1. | 15:31 | |
15:31
ufobat joined
|
|||
[Coke] | multis or multies ? (I prefer the former) | 15:31 | |
viki | [Coke]: the latter. And it's the correct English. | 15:32 | |
[Coke] | docs.perl6.org/language/5to6-perlvar - "currently autoflush is not implemented in Perl 6" | ||
15:32
huajie-hu left
|
|||
kyclark | Ah, thanks. | 15:32 | |
[Coke] | viki: except that "multi" is a "word" in Perl 6 lingo. | ||
but ok, multies is fine. one less thing to change here. Danke. | 15:33 | ||
viki | [Coke]:oh, i confused the rule for -y ending nouns. | 15:34 | |
kyclark: I'm not seeing any buffering, at least when printing to STDOUT | 15:36 | ||
kyclark | I’m working on a little game that refreshes the entire screen. It seems laggy. | ||
I’ll post in a minute | |||
bouncy balls! | |||
15:38
wamba joined
|
|||
[Coke] ponders adding more code words from perl 6's src file to the doc spell checker to a) future proof it, and b) allow us to spell check the src comments. Probably just not worth it. | 15:39 | ||
s/src file/src dir/ | |||
kyclark | OK, here’s a bouncy ball game: pastie.org/10955904 | 15:50 | |
It seems shaky because of output buffering (I think). Overall, it’s working well, but I’d love feedback. | |||
[Coke] | kyclark++ | 15:51 | |
kyclark | I wanted to write a Pong, but I have no idea how to capture keystrokes | ||
viki | You need to turn off shell buffering and then capture via $*IN | 15:52 | |
15:52
vike joined
|
|||
viki recalls doign something like that but totally forget the codes | 15:52 | ||
moritz | $*IN.getc? | ||
or does that still require an enter/return? | 15:53 | ||
[Coke] | getc is still buffered, someone just wrote that up for the docs. | ||
viki | moritz: yeah, it's $*IN.getc, but you still have to tell the shell to not buffer | 15:54 | |
kyclark: your game works fine on my screen. | |||
kyclark: by "lag", do you mean the jerky motion of the ball? That's just 'cause you're moving it by character and not by pixel | |||
moritz | viki: some nasty stty invocation, maybe? | 15:55 | |
kyclark | Yes, I guess that is what I mean. Just jumpy. Of course my kids think it looks really primitive, but they gave me a thumbs-up just the same. | ||
I took inspirado from the Perl 6 Game of Life and Forest Fire games. | |||
[Coke] | docs.perl6.org/routine/getc#Buffering_terminals | 15:56 | |
kyclark | Can anyone advise on how to turn off the shell buffering to capture single keystrokes? It was a question I posed the other day, too. | ||
[Coke] | section right after that talks about the issue with combiners. | ||
kyclark | Is it a call to “stty” to unbuffer? | 15:57 | |
viki | fiwiw, there's a program called unbuffer | 15:58 | |
sudo apt-get install expect-dev | |||
tbrowder | morning #perl6 | 15:59 | |
viki | noon, tbrowder | ||
mspo | that's only for pipes | ||
tbrowder | good noon, viki | ||
viki | oh, OK, they I may have used something elese | 16:00 | |
mspo | set stty_init "-opost" | 16:01 | |
it's a sh + tcl script you can probably borrow from | |||
viki | Didn't work | ||
tbrowder | i would like to have a hash inside a sub that is static for the life of the program, but i don't think that's currently possible. i can have a file scoped hash, but is there a better way to minimize its exposure? | 16:02 | |
viki | tbrowder: state | ||
m: sub foo { state $x = 42; dd $x++ }; foo; foo; foo; foo ; | |||
camelia | rakudo-moar 2ef2fd: OUTPUT«42434445» | ||
tbrowder | ah, thanks, i was looking for static...great! | 16:03 | |
mst | m: { my %x := (foo => 'bar'); sub foo ($x) { %x{$x} } } dd foo('foo') | ||
camelia | rakudo-moar 2ef2fd: OUTPUT«5===SORRY!5=== Error while compiling <tmp>Strange text after block (missing semicolon or comma?)at <tmp>:1------> 3foo => 'bar'); sub foo ($x) { %x{$x} } }7⏏5 dd foo('foo') expecting any of: infix infix stopper…» | ||
viki | Hm... stdbuf -i0 -o0 -e0 perl6 -e 'my $c = $*IN.getc; dd $c' also doesn't work for some reason :/ | ||
mst | m: { my %x := (foo => 'bar'); sub foo ($x) { %x{$x} } }; dd foo('foo') | ||
camelia | rakudo-moar 2ef2fd: OUTPUT«5===SORRY!5=== Error while compiling <tmp>Undeclared routine: foo used at line 1» | ||
viki | mst: subs are lexical | ||
by default | |||
mst | oh for crying out loud | ||
yes | |||
I realised that as soon as I saw the error | 16:04 | ||
viki | :) | ||
16:04
cdg left
16:05
cdg joined
|
|||
nicq20 | Is it possible to grab the name of a token alternation? Basically get 'bar' from `token foo:sym<bar> { ... }` | 16:06 | |
viki | nicq20: <sym> | ||
Well, <sym> would match 'bar' | 16:08 | ||
m: say grammar { proto token foo {*}; token foo:sym<bar> { .+? <sym> .+ } }.parse: "meow bar moo", :rule<foo> | |||
camelia | rakudo-moar 2ef2fd: OUTPUT«「meow bar moo」 sym => 「bar」» | ||
nicq20 | Hmm. I 'm probably just doing something wrong then. :/ | 16:09 | |
viki: Is it possible to use that outside the grammar? Like in an actions class for it? | 16:10 | ||
16:10
skids left
|
|||
viki | nicq20: "that" being what? | 16:10 | |
nicq20: in actions you'd declare multi method foo:sym<bar> ($/) {} that would be called when sym is <bar> | 16:11 | ||
16:12
Sound joined
|
|||
viki | m: say grammar { proto token foo {*}; token foo:sym<bar> { { make first *, &?ROUTINE.name.comb: /"<"<(.+)>">"/ } } }.subparse("meow bar moo", :rule<foo>).made | 16:13 | |
camelia | rakudo-moar 2ef2fd: OUTPUT«bar» | ||
viki | ahahaha :) | ||
16:13
cdg left
16:14
cdg joined
|
|||
nicq20 | viki: What I'm trying to accomplish is grab the "name" of the rule/token from inside an actions class. If I need to make a method for each alternation, that's fine. I'm just being lazy really. | 16:14 | |
viki | nicq20: what's in $<sym> ? | 16:15 | |
nicq20 | viki: From within TOP | ||
timotimo | right, if you match <sym>, you should also have a $<sym> | 16:16 | |
viki | nicq20: I kinda figured the :sym stuff was precicely so you could have multiple separate action methods. So I don't think I udnerstand your laziness approach. If you aren't using multi action methods, why use :sym at all and not an alternation? | 16:17 | |
nicq20 | From in TOP, I was doing `method TOP($/) { make: $<thing><sym>.Str }` but that does not return anything. | 16:18 | |
viki | nicq20: did you match for <sym>? | ||
nicq20 | viki: I am using multiple tokens of the same base-name, but I wanted to be "lazy" about it because there are only three alternations. | 16:19 | |
viki | nicq20: so why are there three tokens instead of one alternation with three variants? | 16:20 | |
m: say grammar { rule TOP { $<a>=\d+ $<sign>=<[+-]> $<b>=\d+ }; }.parse("4 + 4", :actions(class {method TOP($/) { make $<sign> eq "+" ?? $<a> + $<b> !! $<a> - $<b> }})).made | 16:21 | ||
camelia | rakudo-moar 2ef2fd: OUTPUT«8» | ||
viki | m: say grammar { rule TOP { $<a>=\d+ $<sign>=<[+-]> $<b>=\d+ }; }.parse("4 - 2", :actions(class {method TOP($/) { make $<sign> eq "+" ?? $<a> + $<b> !! $<a> - $<b> }})).made | ||
camelia | rakudo-moar 2ef2fd: OUTPUT«2» | ||
nicq20 | viki: Sorry, bad with terminology. :/ Let my try and paste the code somewhere. | ||
16:23
maybekoo2 left
|
|||
nicq20 | viki: pastie.org/10955917 | 16:24 | |
viki | nicq20: just use make ~$/ | ||
nicq20: oh, wait | 16:25 | ||
16:25
pmurias left
|
|||
viki | nicq20: you want the command to be one of "status"/"check"/"add"? | 16:25 | |
nicq20 | viki: Right. | ||
viki | nicq20: I don't see that information preserved anywhere when I dump the match object. | 16:27 | |
In fact, your method command isn't even called | 16:28 | ||
nicq20 | viki: I can make a new method for each one of the `command:sym<stuff>` tokens that returns 'status'/'check'/'add' appropriately. I wanted to know if there was a better way to do it first. | ||
viki | m: say grammar { rule TOP { $<a>=\d+ <sign> $<b>=\d+ }; proto token sign {*}; token sign:sym<plus> { "+" }; token sign:sym<minus> { "-" } }.parse("4 + 4", :actions(class {method command ($/) { dd [ "Here", $/ ] }})).made | 16:29 | |
camelia | rakudo-moar 2ef2fd: OUTPUT«(Any)» | ||
16:29
cosimo joined
|
|||
viki | Oh, duh, I'm using <sign> :P | 16:29 | |
m: say grammar { rule TOP { $<a>=\d+ <sign> $<b>=\d+ }; proto token sign {*}; token sign:sym<plus> { "+" }; token sign:sym<minus> { "-" } }.parse("4 + 4", :actions(class {proto method sign ($/) { dd [ "Here", $/ ] }})).made | 16:30 | ||
camelia | rakudo-moar 2ef2fd: OUTPUT«(Any)» | ||
viki | Nope, still ain't called | ||
nicq20 | I can't find anything in the docs about if it is supposed to be or not. | 16:31 | |
16:31
araujo left
|
|||
timotimo | it wouldn't surprise me if it actually only calls the one with the "correct" "full" name | 16:32 | |
i.e. including the :sym<...> part | |||
viki | Yeah, I'd expect it to work that way | ||
16:32
araujo joined
|
|||
nicq20 | Makes sense. Only call the proto if none of the others match. | 16:33 | |
timotimo | actually, i think the :sym mechanism is only a thing inside grammars | ||
or is that wrong? | |||
viki | m: say grammar { rule TOP { :my $*SYM; $<a>=\d+ <sign> $<b>=\d+ }; proto token sign {*}; token sign:sym<plus> { { $*SYM = "plus" } "+" }; token sign:sym<minus> { { $*SYM = "minus" } "-" } }.parse("4 + 4", :actions(class {method TOP($/){ make "Sym is $*SYM" }})).made | ||
camelia | rakudo-moar 2ef2fd: OUTPUT«Sym is plus» | ||
viki | nicq20: another way ^ Though IMO adding each :sym methods in actions is cleaner | 16:34 | |
nicq20 | Oh, well. I'll just do it manually. :) | ||
viki | m: class { method you:are<wrong> { say "yep" } }."you:are<wrong>"() | 16:35 | |
camelia | rakudo-moar 2ef2fd: OUTPUT«yep» | ||
timotimo | viki: you misunderstood me :) | 16:36 | |
m: class { method you:are<wrong> { say "yep" } }."you"() | |||
camelia | rakudo-moar 2ef2fd: OUTPUT«No such method 'you' for invocant of type '<anon|70393936>' in block <unit> at <tmp> line 1» | ||
timotimo | ^- that's what i meant by that | ||
not the syntax, but the mechanism that'll call those symmed variants for you | |||
16:37
domidumont left
|
|||
viki | In actions? It doesn't call the one without the full name. | 16:37 | |
nicq20 | I originally got the idea that it would work from this: docs.perl6.org/language/grammar_tutorial . At the end of it, the `<sym>` bit is used in the actions class. | 16:39 | |
viki | nicq20: that works because there's a <sym> token being matched in the grammer | 16:40 | |
Whereas yours doesn't. | |||
And <sym> is the value of the :sym<...> bit, so that's how you end up being able to retrieve that information. | |||
token foo:sym<whatever> { <sym> } matches text "whatever" | 16:41 | ||
And captures it into the $<sym> capture | |||
nicq20 | Oh, ok. That makes sense. | ||
16:43
MilkmanDan left,
MilkmanDan joined
16:44
[particle] joined
|
|||
viki | m: class Foo { proto method speak {*}; method speak:cat<meow> { say "yep" } }.speak | 16:44 | |
camelia | rakudo-moar 2ef2fd: OUTPUT«Use of uninitialized value of type Any in string context.Methods .^name, .perl, .gist, or .say can be used to stringify it to something meaningful. in block <unit> at <tmp> line 1Cannot resolve caller speak(Foo); none of these signatures match:…» | ||
viki | tehe | 16:45 | |
16:46
nicq20 left
16:47
setty1 left,
setty1 joined
16:49
bisectable6 left,
evalable6 left
16:50
evalable6 joined,
bisectable6 joined,
ChanServ sets mode: +v bisectable6,
kyclark left,
seatek joined
16:51
[particle] left
16:53
[particle] joined
16:55
Tonik left
|
|||
dalek | : 6dcf602 | (Zoffix Znet)++ | misc/perl6advent-2016/schedule: Book Dec 24. |
16:57 | |
17:00
silug left
17:01
zakharyas left
17:05
Sound left,
hankache joined
|
|||
hankache | yello * | 17:07 | |
viki | lo lo | ||
hankache | hiya viki | ||
japhb | 255,255,127 | ||
17:09
cdg left
17:10
mattp_ left
17:13
mattp_ joined
17:17
silug joined
17:21
Tonik joined
|
|||
viki | TIL a magpie is not a pie :o | 17:21 | |
.oO( a magpie pie ) |
17:23 | ||
17:25
xinming left
|
|||
timotimo | magpies are the kind of bird who'd say "pickle pea! pump-a-rum!" | 17:26 | |
17:27
pierre__ left,
pierre_ joined
17:32
pierre_ left
|
|||
huf | what | 17:32 | |
timotimo | www.youtube.com/watch?v=7MlHmCpnJIU - watch out, memes | 17:33 | |
huf | wow. what is this wonderful thing please | 17:35 | |
timotimo | darksouls3.wiki.fextralife.com/Pick...a-Rum+Crow | 17:36 | |
viki | huuu www.wired.com/2016/11/googles-chro...rity-model | 17:37 | |
.seen pmuchad | |||
17:37
Rawriful left
|
|||
yoleaux | I haven't seen pmuchad around. | 17:37 | |
viki | .seen pmichaud | 17:38 | |
yoleaux | I saw pmichaud 15 Sep 2016 01:34Z in #perl6: <pmichaud> m: my $input = '(\d\d\d)'; my $m = 'a 123' ~~ /$0=<$input>/; say $m | ||
viki | We need to stort out HTTPS on rakudo.org | ||
"Starting in January, Chrome will flip the web’s security model: Instead of warning users only about HTTPS-encrypted sites with faulty or misconfigured encryption, as Chrome currently does, it will instead flag as “not secure” any unencrypted sites that accept a username and password or a credit card." | 17:39 | ||
timotimo | well, we don't ask for username/password on rakudo.org | 17:41 | |
viki | We actually do. | ||
"Meta" column, bottom right., | 17:42 | ||
17:42
nowan left
|
|||
timotimo | we know the risks when we log in there | 17:42 | |
DrForr | letsencrypt is decent to set up. | ||
viki | What does us knowing anything have to do with Chrome actively listing our site as unsecure? | 17:43 | |
17:45
nowan joined
|
|||
DrForr | I woukd at one time hace been more circunspect, but now I see it as simple scsre tactics. | 17:46 | |
viki | Because no one MIMed your traffic with your knowledge, not because of how easy it is to do :) | 17:48 | |
18:02
ale1ster joined
18:14
labster joined
|
|||
viki | Challenge for the day :) www.wechall.net/challenge/training.../index.php | 18:22 | |
A tiny 1-liner in Perl 6 :) | |||
18:22
khw left
18:27
Rawriful joined
18:29
Rawriful left
18:31
canopus left
18:35
nicq20 joined,
huf left,
wamba left,
huf joined
|
|||
nicq20 | Hello o/ | 18:35 | |
18:39
canopus joined
18:40
grondilu joined
|
|||
viki | \o | 18:43 | |
18:43
xinming joined,
firstdayonthejob joined
18:47
domidumont joined
|
|||
viki | wow | 18:48 | |
m: my @l = "A".."Z"; dd @l[(1, 2, (10, 11), 3), (3, 4, 5)] | |||
camelia | rakudo-moar 2ef2fd: OUTPUT«(("B", "C", ("K", "L"), "D"), ("D", "E", "F"))» | ||
viki | TIL you can shape results using indexes like that | ||
timotimo | viki: i'd think it'd only warn as soon as it asks for username/password | 18:49 | |
viki: and no normal user will try to log in without having credentials | |||
18:50
cdg joined
18:56
ocbtec left
|
|||
timotimo | we're still bursting a whole bunch of cpu usage every few minutes to update testers.perl6.org | 18:59 | |
nicq20 | Huh, didn't know that was a thing. | 19:01 | |
timotimo | i'd love someone to write up a tiny thing that only does the hard work when there has been new stuff since the last update | 19:02 | |
also, the reports seem kind of b0rked? all show up as N/A | 19:04 | ||
viki | m: say "meow" ~~ 0 | 19:09 | |
camelia | rakudo-moar 2ef2fd: OUTPUT«Cannot convert string to number: base-10 number must begin with valid digits or '.' in '3⏏5meow' (indicated by ⏏) in block <unit> at <tmp> line 1Actually thrown at: in block <unit> at <tmp> line 1» | ||
harmil_wk | m: class Foo is Hash { has $.blah = 0 }; say Foo.new.blah.perl | ||
camelia | rakudo-moar 2ef2fd: OUTPUT«Any» | ||
harmil_wk | I have a feeling I'm doing something I should know better than to do... | ||
19:09
firstdayonthejob left
|
|||
viki | Was that meant to explode? I kinda would want it to return False. | 19:09 | |
[Coke] | viki: seems like that's missing a try somewhere, yah. | 19:10 | |
viki | harmil_wk: Hash has .perl method | ||
[Coke] | m: say pi ~~ 0 | ||
camelia | rakudo-moar 2ef2fd: OUTPUT«False» | ||
[Coke] | m: say "pi" ~~ 0 | ||
camelia | rakudo-moar 2ef2fd: OUTPUT«Cannot convert string to number: base-10 number must begin with valid digits or '.' in '3⏏5pi' (indicated by ⏏) in block <unit> at <tmp> line 1Actually thrown at: in block <unit> at <tmp> line 1» | ||
harmil_wk | viki: I'm not sure I understand... | ||
viki | s: Hash.new, 'perl', \() | ||
SourceBaby | viki, Sauce is at github.com/rakudo/rakudo/blob/2ef2...sh.pm#L206 | ||
viki | harmil_wk: oh, wait, neverf mind :} | 19:11 | |
harmil_wk | I wasn't calling .perl on hash, though | ||
viki | Yeah, I've just realized that | ||
s: Hash, 'new', \() | |||
SourceBaby | viki, Sauce is at github.com/rakudo/rakudo/blob/2ef2...Map.pm#L12 | ||
viki | Ah, there we go :) | ||
s: Mu, 'new', \() | 19:13 | ||
SourceBaby | viki, Something's wrong: ERR: Cannot resolve caller sourcery(Mu, Str, Capture); none of these signatures match: ($thing, Str:D $method, Capture $c) ($thing, Str:D $method) (&code) (&code, Capture $c) in block <unit> at -e line 6 | ||
19:14
bstamour joined
|
|||
harmil_wk | I'm sorry, but it has to be said: you can't Mu new review... | 19:14 | |
:-) | |||
19:14
firstdayonthejob joined
|
|||
viki | m: use nqp; class Foo { has $.blah = 0; method new { self.bless: :42blaz } }.new.blah.say | 19:15 | |
camelia | rakudo-moar 2ef2fd: OUTPUT«0» | ||
viki | m: use nqp; class Foo { has $.blah = 0; method new { self.bless: :42blah } }.new.blah.say | ||
camelia | rakudo-moar 2ef2fd: OUTPUT«42» | ||
viki | m: use nqp; class Foo { has $.blah = 0; method new { nqp::create(self) } }.new.blah.say | ||
camelia | rakudo-moar 2ef2fd: OUTPUT«(Any)» | ||
harmil_wk | oh really... | ||
viki | harmil_wk: what I'm seeing is nqp::create(self) doesn't set the defaults and that's what the Map's .new method is doin' | 19:16 | |
[Coke] | all the default logic is in the bootstrap file in rakudo, so that makes sense. | ||
harmil_wk | Yeah, that seems highly counterintuitive. At the very least, a warning (probably error) should result if your defaults are going to be ignored. | ||
viki | We can't warn about every possible usage without slowing the runtime down to a screetching halt | 19:17 | |
m: use nqp; class Foo { has $.blah; submethod BUILD (:$!blah = 42) {} }.new(:72blah).blah.say | |||
camelia | rakudo-moar 2ef2fd: OUTPUT«72» | ||
viki | m: use nqp; class Foo { has $.blah; submethod BUILD (:$!blah = 42) {} }.new.blah.say | 19:18 | |
camelia | rakudo-moar 2ef2fd: OUTPUT«42» | ||
viki | m: class Foo is Hash { has $.blah; submethod BUILD (:$!blah = 42) {} }.new.blah.perl.say | ||
camelia | rakudo-moar 2ef2fd: OUTPUT«Any» | ||
viki | mother... | 19:19 | |
19:19
sufrostico joined
|
|||
lizmat resists the urge to answer | 19:19 | ||
[Coke] | is there rakudo only code that demonstrates the issue? or do you have to (as viki did above), "use nqp" and then an nqp opcode? | ||
harmil_wk | My original code that derived from Hash | ||
m: class Foo is Hash { has $.blah = 0 }; say Foo.new.blah.perl | |||
camelia | rakudo-moar 2ef2fd: OUTPUT«Any» | ||
19:19
wisti left
|
|||
viki | lizmat: what's the answer? | 19:19 | |
I mean, answer to what | |||
lizmat | to your cry for help: "mother..." :-) | 19:20 | |
viki | m: class Foo is Hash { has $.blah; method new { self.bless: %_ } }.new.blah.perl.say | ||
camelia | rakudo-moar 2ef2fd: OUTPUT«Too many positionals passed; expected 1 argument but got 2 in method new at <tmp> line 1 in block <unit> at <tmp> line 1» | ||
viki | Ah :) | ||
harmil_wk | lizmat: heh | ||
viki | m: use nqp; class Foo { has $.blah; method new { self.bless: |:42blah, |%_} }.new(:72blah).blah.say | 19:21 | |
camelia | rakudo-moar 2ef2fd: OUTPUT«72» | ||
viki | m: use nqp; class Foo { has $.blah; method new { self.bless: |:42blah, |%_} }.new.blah.say | ||
camelia | rakudo-moar 2ef2fd: OUTPUT«42» | ||
viki | There. I win. | 19:22 | |
harmil_wk | My point is that "class Foo is ::($x) { has $.blah = 0 }" will only work if $x is a class that doesn't do what Hash does... that feels like a very difficult-to-detect bug from the user's side. | ||
[Coke] | Yup. I would say that should either work or, if it can't, throw an error asap that it can't work. | ||
harmil_wk | I'll rakudobug it for the record. | 19:23 | |
19:23
darutoko left
|
|||
viki | I forcee that will result in severe de-optimization. | 19:23 | |
And what about classes that don't even do the .new business? | 19:24 | ||
IMO, if you're going to base a class off a gut class, it's your job to familiarize yourself with its workings. | |||
m: class Foo is DateTime { has $.blah = 0 }.new.blah.say | 19:25 | ||
camelia | rakudo-moar 2ef2fd: OUTPUT«Cannot call Foo.new with no parameters in block <unit> at <tmp> line 1Actually thrown at: in any at gen/moar/m-Metamodel.nqp line 3096 in block <unit> at <tmp> line 1» | ||
viki | m: class Foo is DateTime { has $.blah = 0 }.now.blah.say | ||
camelia | rakudo-moar 2ef2fd: OUTPUT«0» | ||
19:25
wisti joined
|
|||
viki | m: class Foo is Set { has $.blah = 0 }.new-from-pairs("x").blah.say | 19:26 | |
camelia | rakudo-moar 2ef2fd: OUTPUT«(Any)» | ||
viki | m: class Foo is Nil { has $.blah = 0 }.new.blah.say | 19:27 | |
camelia | rakudo-moar 2ef2fd: OUTPUT«Nil» | ||
viki | m: class Foo is Array { has $.blah = 0 }.new.blah.say | ||
camelia | rakudo-moar 2ef2fd: OUTPUT«(Any)» | ||
viki | m: class Foo is Complex { has $.blah = 0 }.new.blah.say | ||
camelia | rakudo-moar 2ef2fd: OUTPUT«(Any)» | ||
viki | etc | ||
Here's a good one: | 19:31 | ||
m: class Foo is SetHash { has %.elems = :42meows }.new.elems.say | |||
camelia | rakudo-moar 2ef2fd: OUTPUT«{}» | ||
viki | m: class Foo { has %.elems = :42meows }.new.elems.say | ||
camelia | rakudo-moar 2ef2fd: OUTPUT«{meows => 42}» | ||
viki | So you need to know what you're doing when you're inheriting from core stuff. | ||
samcv | hmm from-json($json-string).WHAT.say => (Hash). but if i do: my Hash %hash = from-json($json-string), i get typecheck failed | ||
viki | Seems a flimsy idea too. | 19:32 | |
samcv | Type check failed in assignment to %hash; expected Hash but got Array | ||
viki | samcv: is it a constant by any chance? | ||
samcv | which one? | 19:33 | |
harmil_wk | Here's the problem I have: EVERYTHING is derived from something core. What happens when I use a module and derive from a class in that module that happens to derive from Hash or Set or whatever... Should I ever use defaults or are they just too uncertain to function? | ||
viki | samcv: constant %hash or my %hash? | ||
samcv | it's a my | ||
19:34
sivoais left
|
|||
viki | star: use JSON::Fast; my %hash = from-json Q|{"foo": true}|; dd %hash | 19:34 | |
camelia | star-m 2016.04: OUTPUT«Hash %hash = {:foo}» | ||
ugexe | you are typing your hash | ||
samcv | i'm sing json tiny | ||
viki | star: use JSON::Tiny; from-json Q|{"foo": true}|.WHAT.say; | ||
camelia | star-m 2016.04: OUTPUT«(Str)Input (4 characters) is not a valid JSON string in sub from-json at sources/9B467EEF9267A777BB53BAA2F19BE2C9D756BEED (JSON::Tiny) line 59 in block <unit> at <tmp> line 1» | ||
ugexe | %hash is already a hash, Hash %hash is not the same thing | ||
viki | star: use JSON::Tiny; from-json(Q|{"foo": true}|).WHAT.say; | ||
camelia | star-m 2016.04: OUTPUT«(Hash)» | ||
samcv | ah ok ugexe | ||
so i don't need to specify a type? | 19:35 | ||
viki | You can if you want to. | ||
timotimo | Hash %foo is "a hash where the elements are Hash" | ||
ugexe | depends on your requirements, but it *sounds* like you don't need to | ||
viki | my Int %hash = :42foo | 19:36 | |
m: my Num %hash = :42foo | |||
camelia | rakudo-moar 2ef2fd: OUTPUT«Type check failed in assignment to %hash; expected Num but got Int (42) in block <unit> at <tmp> line 1» | ||
viki | m: my Int %hash = :42foo | ||
camelia | ( no output ) | ||
samcv | thanks timotimo | ||
so i could do my Str %hash if i wanted to make sure all of them were strings or something? | 19:37 | ||
viki | harmil_wk: that's a good question and I don't think there's a certain answer. Guaranteeing some internal layout of core code would restrict development severely, so we can't do that, but without that guarantee, yes, you can't assume defaults. | 19:38 | |
m: class Foo does Setty { has %!elems } | 19:39 | ||
camelia | rakudo-moar 2ef2fd: OUTPUT«5===SORRY!5=== Error while compiling <tmp>Attribute '%!elems' already exists in the class 'Foo', but a role also wishes to compose itat <tmp>:1» | ||
viki | harmil_wk: ^ like stuff like this. If we need to create %!whatever attribute in Setty, that does have potential to break someone's code who does Setty and has that attribute defined. | 19:40 | |
samcv | if i try and do this: %channel-event-data{$e.nick}{'spoke'} = now.Str; i get: Type Array does not support associative indexing. | ||
viki | Also, to note, I wouldn't exactly claim "EVERYTHING is derived from something core", I'd think 95% of classes derive from Any. | 19:41 | |
19:41
sivoais joined
|
|||
viki | samcv: sounds like %channel-event-data{$e.nick} has an Array in it and not a hash | 19:41 | |
19:41
seatek left
|
|||
samcv | ah so a hash of arrays | 19:41 | |
viki | prolly | 19:42 | |
ugexe | m: sub validate(%hash (Str :$name, Int :$ver)) { %hash }; my %valid = :name<xxx>, :ver<1>; my %invalid = :name(Nil), :ver<fff>; say validate(%valid); say validate(%invalid) # its probably easier to validate your hash like this | ||
camelia | rakudo-moar 2ef2fd: OUTPUT«{name => xxx, ver => 1}Type check failed in binding to $name; expected Str but got Any (Any) in sub validate at <tmp> line 1 in block <unit> at <tmp> line 1» | ||
samcv | i guess that makes some sense | ||
19:43
RabidGravy joined
|
|||
viki | harmil_wk: though the impact can probably be ameliorated by some sort of convention... like all core attributes and internal methods have some sort of prefix and that would guarantee they don't clash with user code | 19:43 | |
viki contemplates the amount of work that would entail | |||
ugexe | prepend Rakudo::Internals:: to eerything | ||
harmil_wk | viki: Well, that addresses the issue you brought up, but doesn't really address the one I was concerned about. I do agree, though, that using some convention there is wise (and generally practiced in other languages) | 19:44 | |
lizmat | re subclassability of Hash: we could so something like with Date.new | 19:45 | |
which *is* subclassable | |||
viki | s: Date, 'new', \() | ||
SourceBaby | viki, Sauce is at github.com/rakudo/rakudo/blob/2ef2...ish.pm#L28 | ||
viki | s: Date, 'new', \("2016-11-11") | ||
SourceBaby | viki, Sauce is at github.com/rakudo/rakudo/blob/2ef2...ate.pm#L36 | ||
viki | m: say class Foo is Date { }.new === Date | 19:49 | |
camelia | rakudo-moar 2ef2fd: OUTPUT«False» | ||
viki | I rescind my previous comments. It does make sense for some behaviour to be expected and the non-setting of attribute defaults with Hash is LTA. | 19:50 | |
19:50
firstdayonthejob left
|
|||
viki | And on that note... 'tis quitting time \o/ | 19:50 | |
19:51
girafe joined
|
|||
masak | I just realized that with looping over a hash/dictionary/map, Perl 5, Perl 6, Python 2/3 and Java all have different behaviors. | 19:51 | |
Perl 5 loops over zipped keys/values in a flat list. Perl 6 loops over pairs as reified objects. Python loops over keys. Java doesn't allow it, and forces you to be more specific. | |||
samcv | hmm it looks like %hash has keys which point to arrays whith only one element, which hold a hash | 19:53 | |
er wait, no. a hash of arrays, which hold multiple elements, each of which is a hash | 19:54 | ||
agh | 19:55 | ||
harmil_wk | viki: have a good one | ||
19:56
firstdayonthejob joined
|
|||
viki | samcv, just dump your JSOn on this site and then use the Viewer tab to explore its structure: jsonviewer.stack.hu/ | 19:56 | |
masak | I'll also note that of the four languages, only Java and Perl 6 could be said to have reified pairs. though Python compensates well with 2-tuples. | ||
RabidGravy | Anyway I went someway to absolution for spending several days being annoyed by Scala at work by making a Vagrantfile with rakudo | 19:57 | |
so arguably I have actually been paid to do Perl 6 stuff today :) | 19:58 | ||
timotimo | neat | 19:59 | |
20:00
Rawriful joined
|
|||
harmil_wk | I think that in general, my feeling is that defaults on attributes isn't a good idea. I hate to be all "there's only one way to do it", but it feels as if defaults on BUILD parameters is the more reliable tool, at least as things stand. | 20:01 | |
RabidGravy | it depends what the requirement is, no point being absolutist about it | 20:03 | |
20:11
nicq20 left
20:13
ale1ster left
|
|||
masak | m: class C { has $.x = 18; submethod BUILD($!x = 5) {}; }; say C.new | 20:14 | |
camelia | rakudo-moar 55b9e9: OUTPUT«C.new(x => 5)» | ||
masak | harmil_wk: would you say that your preference has anything to do with the fact that BUILD parameter defaults *override* attribute defaults? :) | 20:15 | |
RabidGravy | I've always wondered whether that's right, that if there's a BUILD at all the defaults are ignored | 20:16 | |
masak | here's how I remember it | 20:17 | |
I was also always wondering/skeptical about whether that's right | 20:18 | ||
but tadzik was the one who put up the fight, and clearly expressed his dislike over the state of affairs | |||
at which point TimToady spoke up, and make it abundantly clear that the way things are is not an accident, and he would *not* change it -- for reasons of performance -- just because it was deemed convenient to do so | 20:19 | ||
tadzik | Aww yiss | ||
yoleaux | 06:51Z <japhb> tadzik: I sent you a PR to add 256-color and 24-bit RGB color support to Terminal::ANSIColor. Enjoy. :-) | ||
masak | tadzik: did I get that approximately right? | ||
tadzik | I don't like BUILD eitger | ||
Masak: yup | 20:20 | ||
masak | I never did ask follow-ups on the performance rationale, but I *do* trust that TimToady has thought this one through | ||
tadzik | The one from Moose may be improper, but it's useful | ||
masak | maybe the argument would go something like "running one BUILD is way faster than running lots of silly little attribute default thunks" | ||
which I guess I buy | 20:21 | ||
tadzik: what does the one from Moose do that Perl 6 doesn't? | 20:23 | ||
tadzik | japhb: <3, will check it out.after $movie | ||
Bbl& | |||
masak | alright :) | ||
RabidGravy | I've got used to it now, but I still occasionally get bitten when I've put defaults in and then decide that I need a BUILD for some reason | ||
masak assumes he could get tad zik's attention again by writing his nick, but chooses not to :) | |||
RabidGravy: yes -- that's what bothers me too. in the "wrong code that looks right" department, those attribute defaults look like they would do something, but they all become sitting ducks the moment a BUILD shows up. | 20:24 | ||
20:24
domidumont left
20:26
girafe2 joined
|
|||
masak | the most cheerful I can say about it is that at least the action-at-a-distance is limited to the same class, because (a) BUILD is a submethod, and (b) one tends to initialize !-twigil attrs, again because of (a) | 20:26 | |
20:27
girafe left
|
|||
ugexe | m: role Foo[$a] { has $.a = $a }; my %args = :a<2>; my $foo = Foo[1].new(|%args); say $foo.a # just use roles for all the things | 20:27 | |
camelia | rakudo-moar 55b9e9: OUTPUT«2» | ||
masak | ugexe: I was in the "just use roles for all the things" camp for a long time | 20:28 | |
ugexe: the place where it falls down is when you start doing multiple inheritance | |||
and you realize that you're dealing with a flat thing, not a hierarchy | 20:29 | ||
I had this happen in a very real way in the 007 project | |||
arnsholt | One feature in SmallTalk I really like is the method call chain syntax | ||
Not sure how it'd be transferrable to a more C-like syntax though | |||
masak | see github.com/masak/007/commit/ecb49f...459d3e9bba | ||
ugexe | all you have to do is add method and submethods of new, BUILD, some logic in the body of the role itself to... | 20:30 | |
heh yeah i know it starts to suck pretty fast | 20:31 | ||
masak | arnsholt: could you tell me a bit more about the method call chain syntax, and what you like about it? | ||
arnsholt | It's basically just a syntax to invoke several methods on the same invocant | ||
masak | ugexe: from then on, the rule in 007 was "roles for interface-y types, classes for concrete types" | ||
ugexe: but 007 is now gearing up to do all the MOP stuff in 007 rather than in Perl 6, so that's going away too :) | 20:32 | ||
arnsholt | So in a sense similar to what I think is called "fluent interfaces" (or some such), where methods return the invocant | ||
masak | arnsholt: what's the syntax? | ||
ugexe | i still like class_name[...].new() for things that are a container though | ||
arnsholt | Semicolon instead of period as statement terminator, and statements don't start with an invocant (there being more or less only return statements and method call statements in SmallTalk) | 20:33 | |
So you can for example do, to populate a hash: "dict := Dictionary new; add: 'foo' -> 1; add: 'bar' -> 2; yourself" | 20:34 | ||
masak re-vows to get through worrydream.com/EarlyHistoryOfSmalltalk/ | |||
arnsholt | Where yourself is a method that returns the object it's called on. Sounds like a silly method, but this is why it's there =) | ||
masak | :) | 20:35 | |
arnsholt | (For the particular example above theres Dictionary>>with:with: which does the same thing, but that'd be missing the point) | ||
Another absolutely hilarious SmallTalk method is become: | |||
Which takes mutates the instance it's invoked on into the instance passed as an argument | 20:36 | ||
Which is kind of o.O | |||
masak | I've heard about that method | ||
I think I read about it on ward's wiki | |||
arnsholt | Sounds entirely plausible | 20:37 | |
I haven't had occasion to use it yet, sadly =) | |||
20:41
tushar joined
20:44
avalenn_ joined
20:48
AlexDaniel joined,
avalenn left
20:52
TEttinger joined
|
|||
konobi | TimToady: I thought you might find this interesting: www.kickstarter.com/projects/23012359/minima | 21:05 | |
masak discovers a lot of other nice c2.com articles in looking for the one about `become:` | 21:08 | ||
samcvtest | having some issues with variable names with - in them | 21:14 | |
Variable '%channel-event-data' is not declared, and then before, said something like invalid use of '-' in sink context | 21:15 | ||
21:17
hankache left
|
|||
ugexe | thats... impressively vague | 21:17 | |
21:18
Actualeyes left
|
|||
samcvtest | yeah sorry trying to find it. it could be related to maybe problems in another spot. so i'm investigating | 21:18 | |
i'm thinking maybe it's not matching a parenthisis or something and misinterpreting the variable.. | 21:19 | ||
Useless use of "-" in expression "$fh-3.say( to-json( %.channel_event_data) )" in sink context, oh looks like | |||
wasn't related to the variable, i renamed the variable to use underscores | 21:20 | ||
so it's probably the to-json function | |||
jnthn | $fh-3 would be parsed as infix - | ||
grondilu | timotimo: that typeface is barely readable | ||
ugexe | not really a good idea to use -<number> in a variable name | ||
samcvtest | oh. the filehandle. ugh derp | ||
grondilu | timotimo: sorry meant to address that to TimToady | ||
jnthn | We required alpha after a - | ||
*require | |||
timotimo | is ok :) | ||
21:21
Actualeyes joined
|
|||
jnthn | (for it to be parsed as a variable name) | 21:21 | |
21:21
setty1 left
21:22
setty1 joined
21:26
bjz joined
21:32
bstamour left
|
|||
RabidGravy | oh dear I just looked at the Jenkins job definition xml | 21:37 | |
I really wish I hadn't | 21:38 | ||
only a java programmer could have perpetrated "<com.coravy.hudson.plugins.github.GithubProjectProperty plugin="github@1.22.4">" | 21:39 | ||
21:39
benchable6 joined
21:40
committable6 joined,
ChanServ sets mode: +v committable6,
MasterDuke_ joined
|
|||
timotimo | m) | 21:40 | |
21:44
MasterDuke left
21:46
ugjka left
21:47
tushar left
21:49
ugjka joined
21:50
Tonik left
|
|||
RabidGravy | it's not even a sane schema | 21:58 | |
22:06
pierre_ joined
22:08
seatek joined
22:16
wisti left
22:24
sufrostico left
22:28
BenGoldberg joined
22:33
ale1ster joined
|
|||
tadzik | masak: so, in Moose when I do BUILD I can put it there and not put it there and it doesn't impact the rest of the class ocde | 22:35 | |
in P6 when I do BUILD I break attribute initialization in some cases and not in some others | |||
and when a new attribute comes in I need to modify the BUILD signature again for attrs to initialize properly | 22:36 | ||
I wrote this stupid patch 5 years ago that introduced a method called AFTERPARTY that did all I wanted :P | 22:37 | ||
timotimo | just implement BUILDALL and put callsame at the top | ||
tadzik | I just want to Do Stuff When Everything Is Ready As It Should Be. Could do it in Moose, cannot in P6 | ||
'that could work; I assume there's a catch, and a reason why we usually go the overload-new/submethod-BUILD way instead | 22:38 | ||
perigrin | tadzik: obviously the answer is to port Moose to p6. | 22:39 | |
perigrin hides. | |||
tadzik | perigrin: fortunately there's Inline::Perl5 so we don't have to :P | ||
perigrin | :D | ||
22:40
seatek left
22:43
pierre_ left
22:44
pierre_ joined
22:47
bjz left
22:48
pierre_ left
22:49
rindolf left
23:04
RabidGravy left
23:08
pierre_ joined
|
|||
ugexe | always trick the end user into doing all initialization so its their fault | 23:10 | |
konobi | TimToady: any idea if there is something else already existing? | 23:12 | |
23:13
pierre_ left
|
|||
masak | tadzik: thank you -- that helped | 23:17 | |
now all I could ask for is for TimToady to put that into perspective somehow | |||
tadzik | :) | ||
I remember talking/arguing with TT over this and coming out as wrong (duh :P) | 23:18 | ||
masak | but giving the TimToady genie any explicit instructions is a fool's errand... right :P | ||
we'll... see what happens | |||
mst | everybody argues with TT and loses, especially when it comes to context | ||
hence DBIC's _rs methods etc. | 23:19 | ||
masak .oO( Club Of People Who Argued With TT and Lost ) | |||
MasterDuke_ | i think mst had a bunch of comments/suggestions/something about the difference between Moose and Perl 6 a couple weeks ago | 23:20 | |
in regards to the initialization of attributes | 23:21 | ||
mst | right, basically, as soon as you define a BUILD submethod, perl6 goes "surprise! let's make you type more than raw perl5 OO" | 23:22 | |
tadzik | yes! | ||
mst | if you duplicate all your attributes as named parameters in it, it goes back to doing mostly the right thing | 23:23 | |
when I complained about this, TimToady basically said that yes, people had noticed, and what really needed to be done was to have a subroutine for 'do the basic BUILD stuff' you could call anywhere you liked in your custom BUILD (thereby giving you the Moose functionality back -and- control over ordering), but nobody'd come up with a good name for it so it hadn't been implemented | 23:24 | ||
the fact that as a result, for most of the cases I care about, perl6 OO is more typing and requires me to duplicate attribute names and hope I don't typo, is why I'm using perl6 via Inline::Perl6 for stuff but stick to writing my OO stuff in perl5+Moo | 23:25 | ||
tadzik | now that's just crazy | ||
mst | well, that and perl6 has nothing like lazy either | ||
tadzik | nodnod | ||
mst | so basically perl6 OO is inferior to Moo for 99% of my use cases | ||
mst just wants grammars, I'll wait for the rest of the language to catch up to perl5 | 23:26 | ||
timotimo | wow | ||
masak | I'd love for p6 to have a good lazy story | ||
I 100% agree with mst that that's currently missing | |||
mst | basically, perl6's BUILD is actually (in my head) POPULATE, i.e. slot population | 23:27 | |
I'd like there to be two submethods | |||
one for overriding slot population | |||
and one for the much more common case that Moo(se) provide | 23:28 | ||
23:28
ale1ster left,
ttkp6 joined
|
|||
mst | given Moo/Moose's more featureful attributes, I've honestly never wanted to override slot population that way anyway | 23:28 | |
masak | I don't know about all y'all, but this sounds like something that could be tried out in a branch | 23:30 | |
mst | I'd be happy to play with it if somebody did | ||
but when TimToady says "yeah, we don't have that, we didn't think of a name" and lizmat basically told me she preferred positional constructors and manual population in BUILD, I just went back to writing the OO parts in perl5 since that already has all the features I needed | 23:31 | ||
esp. given p3rl.org/Function::Parameters to give me typed signatures | |||
masak | mst: could you perhaps provide some details of what you imagine the two submethods would do? | 23:32 | |
mst | easy | ||
POPULATE would to what BUILD currently does, i.e. override everything and make you do everything by hand | |||
BUILD would do what BUILD in Moo(se) does, i.e. populate the slots and then let you add whatever logic you want | |||
(names based on my mental model, not intended as recommendations or anything) | 23:33 | ||
23:33
Actualeyes left
|
|||
masak | ok, at this point I think there's enough info for whoever feels motivated to try it out in a branch | 23:33 | |
mst | this is, if memory serves, at least the third time I've had this conversation | ||
masak | :) | 23:34 | |
mst | maybe I need to give a YAPC talk titled "why perl5 OO is better than perl6" to motivate people to change that ;) | ||
masak | heh | 23:35 | |
mst | not serious. that would be almost as awful as lizmat's "why perl5 is the new perl4" talk in terms of fucking up community relations | 23:36 | |
a blog post called "things I miss from M*" might not be a terrible plan though | |||
23:37
firstdayonthejob left
|
|||
mst grumbles | 23:41 | ||
"you stole most of the things Moose did better than your old metamodel, why couldn't you've stolen these too" :P | |||
23:41
perlawhirl joined
23:45
wamba joined
23:51
cdg left
23:59
nadim_ left,
nadim_ joined
|