»ö« 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.
comborico1611 Pong 01:02
lookatme Ping 01:03
comborico1611 Hi 01:03
comborico1611 Anyone else studying? 01:21
comborico1611 Yup. 01:40
lookatme Studying what ? 01:41
comborico1611 C 01:43
Trying to study to get a job where i can work from home. 01:44
lookatme Oh, are you a student ?
comborico1611 Studying to try to get a job*
comborico1611 Nope. I'm 31 years old. 01:45
lookatme oh
lookatme So you want find a C dev job ? 01:46
comborico1611 I'm not sure what field. Code maintenance or networking sound good. 01:47
lookatme oh, what language are you good at ? 01:49
comborico1611 I know c++ best. 01:50
lookatme Oh, I'm c/c++ develop too
comborico1611 But I'm not talented in pr 01:51
lookatme s/develop/developer/
comborico1611 Development. I think I'd be better suited not in development.
lookatme How about software tester ? 01:52
comborico1611 s/develop/developer/? 01:52
I'm haven't been exposed to that. I'm definitely meticulous. 01:53
lookatme oh
comborico1611 Is tester a prolific occupation? 01:54
TEttinger comborico1611: if you're studying, you're a student :)
lookatme I'm not get it, "prolific"? 01:55
TEttinger if you're studding, you may be a horse
lookatme Haha :)
comborico1611 Heh. True, but i didn't want to give the impression I'm a formal student.
TEttinger true true
lookatme We are all student in Perl6 01:56
comborico1611 Yup.
TEttinger I don't know what the employment situation is like for C. But I know I'd rather deal with C than recoil in horror at some of the C++ I see: github.com/imneme/pcg-cpp/blob/mas...#L513-L528 01:58
comborico1611 I can't follow that. 01:59
TEttinger to be honest, I have no clue what that does. I think it's internal to that library, but I tried to port it
it's C++ template gore
comborico1611 lol 02:00
I haven't learned c++14 update.
TEttinger I think that's actually some older version, since it was written around 2014 IIRC, or earlier 02:03
maybe C++11
comborico1611 Lookatme, how long have you been in the business? 02:04
Oh yeah, i forgot about 11. They must have messed up. 98, 11, 14, 17. 02:05
TEttinger haha 02:06
yeah
it was C++0x for a while
then the 00s passed with no update
comborico1611 I see. 02:07
TEttinger it's not quite the same as Java 9, which was also delayed without end. But I wouldn't say a stable release of Java 9 has come out yet, since they released it by throwing it to the pavement
comborico1611 Hmm. I didn't know that.
TEttinger I just have had a rotten time with Java 9 stuff, it does seem to break most moderately-complex software 02:08
comborico1611 That's too bad. I'm rooting for Java, in the Java vs C# battle.
TEttinger Java has more open source libs in the ecosystem, but C# is actually open source and won't get Oracle to sue you for billions of dollars if you fork it
Oracle v. Google, settled out of court for $0 but caused lasting legal damage to open source as a concept, potentially. thanks Oracle... 02:09
comborico1611 Microsoft can turn rabid on you.
comborico1611 Hmm. I was unaware. 02:10
TEttinger that's a concern, but Oracle already has
Oracle's lawyers argued that the Java API, not even the code, was copyrightable, which no court had previously allowed
which would make open source versions of closed source APIs illegal
or at least a breach of copyright 02:11
comborico1611 I can see Microsoft making C# opensource for however many years for C# to get established, then start licensing it.
TEttinger can't
it's MIT licensed, you can't pull the existing MIT licensed code out of that state 02:12
OpenJDK is GPL with classpath exception, IIRC
comborico1611 You seem you have legal training, no?
TEttinger none, I just follow all this junk
comborico1611 Self-learned is better. I'm self learned legal student. 02:13
TEttinger Oracle still holds tremendous influence over OpenJDK via funding development. they defunded JSON parsing in Java 9 for unknown reasons
comborico1611 So you think C# is a great balance to Java?
TEttinger Microsoft is currently the biggest contributor to the Linux kernel (all GPL, they I believe need to abide by Linux kernel contributor rules which may help the patent issue), and one of if not the largest organization contributing to open source on GitHub 02:14
it's a shocking turnaround. windows 10 still has lots of sketchy telemetry stuff 02:15
oracle at least isn't doing that, other than the ask toolbar installer in the java installer
comborico1611 I hate 10 (9).
TEttinger same. I had to go through a serious amount of work to install windows 7 on this recent laptop, but it did work 02:16
TEttinger ubuntu (I used xubuntu) has better out-of-the-box hardware support than windows 7, which is nicee 02:16
comborico1611 Kubuntu for me. 02:17
TEttinger if a hardware switch on this laptop turns off, I plug in a liveusb and I can turn it on with the normal buttons from xubuntu. that only sometimes works from windows
TEttinger it's also rather surprising how insecure all versions of windows are... I have another usb that erases password protection on windows accounts, takes under 5 minutes. I made it because a friend's laptop had the fingerprint login stop working, and she hadn't ever used her password, so no way to get in... without erasing the password 02:19
we were both somewhat alarmed at how easy it was 02:20
comborico1611 Hmm.
comborico1611 C# the name is a marketing lie. Should be Java++. 02:23
C# is trying to lure c++ guys. 02:24
TEttinger I've only needed to be her IT guy twice (plus one more time handling the computer buying), but the password thing I thought would be a huge deal to resolve. especially since the other IT issue was a nasty popup that looked like a clickjacking attempt
kinda, C# is pretty close to C/C++ compared to Java
it mixes a bunch of features from both
comborico1611 I read to the contrary, but i haven't investigated it myself. 02:25
TEttinger it has unsigned types, which Java doesn't, and value types (like all types in C that aren't specifically references, I think)
it has goto, though its use is strongly discouraged in most cases 02:26
Java reserves the goto keyword but does not implement it
C# has a limited amount of operator overloading, also unlike Java but like C++
some things are closer to Java, mostly in the lib. C#'s List is very close to ArrayList, though also C++ Vector 02:27
lookatme IDK C#, but heard it was better than Java
TEttinger it is
I use Java as my primary language, but I also use some C#, and if I actually put the effort in to learn all the features in C# I think I would do some things differently 02:28
comborico1611 But the jobs...
TEttinger depends on industry and location 02:29
C# has a huge financial sector usage base
Java seems more commonly used in Spanish-speaking countries, though I don't know why that would be
comborico1611 From our conversation, I'll keep an open mind to C#. 02:30
TEttinger yeah it's really turned around, I wouldn't have even considered it in version 1.0 but it's advanced so well
lookatme In China, they like Java / PHP :)
TEttinger PHP, a recursive acronym for PHP Hates People
lookatme And C# also have a lot of chances :) 02:31
Haha
comborico1611 And what of Go? 02:34
lookatme Golang sames like popular here, but only in Big City 02:35
lookatme I think 02:35
comborico1611 Well, I'd like to see little ol perl6 beat these guys. 02:37
I'm off to bed. Goodnight, guys. Thanks for the info! 02:38
ZzZombo Say, I have an array of string. Most of them have a prefix, so that you could group them by that prefix. I need to sort string in groups, and then groups themselves. Anybody have done something like this? 03:08
lookatme .classify ? 03:09
ZzZombo Example: ('asd1','asd2','asd0','word','another','wordYes') -> ('another','asd0','asd1','asd2','word','wordYes') 03:10
lookatme m: my @strs = < foo foo1 foo2 foo3 foo4 bar bar1 bar2 bar3 bar4 >; say @strs.classify({ $^a.substr(0,3) })
camelia {bar => [bar bar1 bar2 bar3 bar4], foo => [foo foo1 foo2 foo3 foo4]}
ZzZombo see, my string are of different length. It can be arbitrary.
strings*
lookatme sort according you own rule ? 03:11
s/you/your/
geekosaur I'm not understanding what exactly you're after; your example is just an ordinary lexical sort
ZzZombo Ah, sorry, I got that wrong. Silly me. I should NOT change the order of groups. 03:12
Example: ('asd1','asd2','asd0','word','another','wordYes') -> ('asd0','asd1','asd2','word','wordYes','another') 03:13
Unless I'm merging them.
lookatme :) I'm not get it 03:14
ZzZombo Like with the group 'word'.
lookatme Hmm, lunch time 03:15
ZzZombo lookatme: rosettacode.org/wiki/Longest_commo...fix#Perl_6 03:18
except in my case it needs to figure the prefix itself, given a list of strings, for each group. 03:19
lookatme ZzZombo, I think it's easily use that `lcp` build your code. 03:48
piojo m: my Int constant Four = 'a string'; say Four ~ ', ' ~ Four.WHAT; 04:16
camelia Use of uninitialized value of type Str in string context.
Methods .^name, .perl, .gist, or .say can be used to stringify it to something meaningful.
a string,
in block <unit> at <tmp> line 1
piojo m: my Int constant Four = 'a string'; say Four; say Four.WHAT; 04:18
camelia a string
(Str)
piojo I saw this syntax in LWP::Simple, and it obviously doesn't work. Is it supposed to, or is it an accident that this parses correctly but doesn't work as it appears?
ZzZombo How can I when `.spurt`ing a `Str` tell Perl what endianess the resulting file should be in for UTF-16? 04:28
lookatme ZzZombo, do you mean named argument `enc` of `open` 04:49
ZzZombo no 04:50
I mean `:enc` in `.spurt`
lookatme Maybe you should specify the encoding to UTF-16LE or UTF-16BE, but I don't think rakudo support them currently 04:53
lookatme m: my Int constant Four = 'a string'; 04:57
camelia ( no output )
lookatme m: my Int $Four = 'a string';
camelia Type check failed in assignment to $Four; expected Int but got Str ("a string")
in block <unit> at <tmp> line 1
lookatme piojo, I think it's a bug or something, the type constraint does not work.. 04:58
geekosaur I feel like that's a known bug but can't find it in RT quickly 06:24
wander what is the efficiency of %my-hash.elems? 07:36
O(1) or O(n)?
jast if you want all elements, constant time is impossible pretty much by definition 07:37
wander ? 07:38
i want to get how many elems
if we use a bit to store it, it is O(1); if we count it, then may be O(n) 07:39
i don't know which way we use
wander seems the former, i've built a hash contain 100000 elems, that costs some time. and %hash.elems uses no time. 07:41
jast possibly the time is spent as you iterate over it 07:42
AlexDaniel wander: it depends on the backend 07:47
wander: on MoarVM it's O(1) because the number of elements is stored
wander: see this for example: github.com/MoarVM/MoarVM/blob/bc6e...ash.h#L489
wander AlexDaniel: what about MoarVM
thank you
AlexDaniel on jvm it's probably O(1) too 07:49
but I don't have any proof :)
AlexDaniel ok, on jvm it's implemented with a simple HashMap and .size on a HashMap is O(1) too github.com/perl6/nqp/blob/4fd4b48a...ce.java#L8 07:51
AlexDaniel wander: as far as I can see, it is O(n) on js backend 07:58
but I could be wrong
jast whoops, my bad. I had a different language in mind where elems returns all elements, not the count...
AlexDaniel so it's implemented using a Map, and I found this: tc39.github.io/ecma262/#sec-get-ma...otype.size 07:59
so according to that description, it's definitely O(n)
but maybe real implementations are allowed to cheat? I don't know 08:00
AlexDaniel 💤 08:01
wander :P 08:03
wander how to overload operation on custom class? 08:25
i use form like `method infix:<&>(BitMap \other)`
but in `dd ($bitmap & (BitMap.new(n=>10).set(5)))`, `&` acts like all-junction operator 08:26
lookatme The custom operator must be sub 08:27
moritz and receive two arguments: left and right operand 08:28
wander sub infix:<&>(BitMap \this, BitMap \other)
wander ok i will try it 08:28
moritz use "multi sub" 08:29
wander ok
moritz otherwise you'll override all uses for this operator
also, Perl 6 uses +& and ~& for bit-wise operators
+ for numbers and ~ for strings
wander i know
moritz then don't use &, which is for junctions
wander oh, right 08:30
for consistent
besides, what's the best way to define multi object construction. i try to overload BUILD, but seems i cannot do that. 08:31
ZzZombo Can I combine `grep` and `map` in one go? It's often needed to perform some sort of operation on matched items, and I'd like not to iterate again on resulting list with `map`, when `grep` could run code on matched elements right away. 08:33
wander maybe i can overload `new` 08:34
DrForr say grep { ++$_; True }, 1, 2, 3; 08:35
evalable6 (exit code 1) Cannot resolve caller prefix:<++>(Int); the following candidates
match the t…
DrForr, Full output: gist.github.com/fff40fa9b79118e784...3539db8151
DrForr say grep { $_=$_+1; True }, 1,2,3 08:36
evalable6 (exit code 1) Cannot assign to an immutable value
in block <unit> at /tmp/nIvGn8PWek line 1
moritz m: say (1..10).map: { next if $_ %% 2; $_ * 2 }
camelia (2 6 10 14 18)
moritz ZzZombo: ^^
DrForr ah, right, you can still use the old "return undef" "trick" :) 08:37
moritz or you can make it a regular loop:
m: say gather for 1..10 { unless $_ %% 2 { take 2 * $_ } }
camelia (2 6 10 14 18)
ZzZombo I could never get my head around this `gather/take` thing. 08:39
moritz it's not that hard 08:40
gather { take 1; take 2} 08:41
is pretty similar to
{ my @temp; push @temp, 1; push @temp, 2; @temp }
lookatme m: say gather { take 1; sub inner() { take 2;}(); }
camelia (1 2)
moritz except that it's also lazy (the inner block stops after the first "take" until the value is consumed by the caller) 08:42
wander m: class A {has $!x; method new($x) {self.bless(:$x)};method x() {$!x;};};say A.new(4).x; 08:44
camelia (Any)
wander why? how `bless` works? i've found we have `new`, `bless`, `BUILD`, etc. to write correct code is an exploration 08:45
wander surely i expect $!x to be 4 08:45
lookatme docs.perl6.org/language/classtut#Constructors 08:48
lookatme wander, Private attributes really are private. This means that bless is not allowed to bind things to &!callback and @!dependencies directly. 08:50
wander so i need to overload BUILD?
lookatme yeah
wander but i try to write multi submethod BUILD..
lookatme m: class A {has $!x; submethod BUILD(:$!x) {}; method x() {$!x;};};say A.new(4).x; 08:51
camelia Default constructor for 'A' only takes named arguments
in block <unit> at <tmp> line 1
lookatme m: class A {has $!x; submethod BUILD(:$!x) {}; method x() {$!x;};};say A.new(x => 4).x;
camelia 4
moritz wander: what do you want to achieve?
wander BitMap constructed by size/n or bits direactly 08:52
moritz wander: what should the calls to .new look like? 08:53
wander BitMap.new(size=>10) or BitMap.new(bits=>7) # where 7 = (0111)_2
inside the constructor, i need to init other attr using param passed 08:54
so the initial logics are different, i think i need overload constructor in some way
lookatme m: class A {has $!x; method new($x) { self.bless(:$x); }; submethod BUILD(:$!x) {}; method x() {$!x;};};say A.new(4).x; 08:55
camelia 4
wander gist.github.com/W4anD0eR96/73d4c66...8fc2ee73ea
lookatme: yes, it can be done if only one construction logic exists. without `multi` or something 08:56
moritz wander: just add a submethod BUILD(:$!mask, :$!size, :$!bits) {}
moritz and you're done 08:56
wander oh
that works. thank you two, sorry for i'm not so familiar with oo in psix 08:58
lookatme That's why read the document is important. 09:00
wander i read it not deeply :P 09:01
piojo Wow, I didn't know you could use "next" in map. moritz, is this obscure or should I add it as another example to the `map` documentation? 09:07
wander m: class A {has Int $.x;multi sub infix:<+&>(A $a, A $b) { $a.x +& $b.x };};say (A.new(x=>4) +& A.new(x=>4)); 09:09
camelia Cannot resolve caller Numeric(A: ); none of these signatures match:
(Mu:U \v: *%_)
in block <unit> at <tmp> line 1
wander iI thought it would be well.. 09:10
now its signature is multi sub infix:<+&>(Type lhs, Type rhs) {...} 09:11
m: class A {has Int $.x;multi method and(A $b) { self.x +& $b.x };};say (A.new(x=>4).and(A.new(x=>4))); 09:12
camelia 4
wander i can do that in *this* way, but what about override operator..
m: class A {has Int $.x;};multi sub infix:<+&>(A $a, A $b) { $a.x +& $b.x };say (A.new(x=>4)+&(A.new(x=>4))); 09:17
camelia 4
moritz piojo: it's intentional; I'm pretty sure we have tests for that in roast 09:27
wander m: class A { has Int $.x;multi method new(:n($size)) { self.bless(:x($size))};multi method new(:b($bits)) { self.bless(:x($bits))};submethod BUILD(:$!x) { }};multi sub infix:<+&>(A \this, A \other){my $bits = (other.x +& this.x);A.new(n=>$bits)};say A.new(n=>4) +& A.new(n=>4); 09:36
camelia A.new(x => 4)
wander m: class A { has Int $.x;multi method new(:n($size)) { self.bless(:x($size))};multi method new(:b($bits)) { self.bless(:x($bits))};submethod BUILD(:$!x) { }};multi sub infix:<+&>(A \this, A \other){my $bits = (other.x +& this.x);A.new(b=>$bits)};say A.new(n=>4) +& A.new(n=>4); 09:37
camelia Type check failed in assignment to $!x; expected Int but got Any (Any)
in submethod BUILD at <tmp> line 1
in method new at <tmp> line 1
in sub infix:<+&> at <tmp> line 1
in block <unit> at <tmp> line 1
wander shortest example: 09:38
m: class A { has Int $.x;multi method new(:n($size)) { self.bless(:x($size))};multi method new(:b($bits)) { self.bless(:x($bits))};submethod BUILD(:$!x) { }};say A.new(b=>4);
camelia Type check failed in assignment to $!x; expected Int but got Any (Any)
in submethod BUILD at <tmp> line 1
in method new at <tmp> line 1
in block <unit> at <tmp> line 1
wander m: class A { has Int $.x;multi method new(:n($size)) { self.bless(:x($size))};multi method new(:b($bits)) { self.bless(:x($bits))};submethod BUILD(:$!x) { }};say A.new(n=>4);
camelia A.new(x => 4)
moritz piojo: I found one test for it with a quick "git grep", in S32-list/map.t: is (1..4).map({ next if $_ % 2; 2 * $_ }).join('|'), ...
wander turn to figure out how named parameter passed 09:39
moritz wander: declare the named params as mandatory
multi method new(:n($size)!) { ... }
piojo moritz: thanks. I'll make a note and try to add that. Because I've returned |() in map, but 'next' is much less awkward 09:40
moritz you can also use last in map, fwiw
piojo thanks 09:41
wander does that mean if i want to apply `multi method new(:n($size)!) { ... }`, i have to pass a parameter named `n`? 09:42
without `!` and method can take named parameter not appears in signature cause the issue 09:43
moritz yes, named params are optional by default
wander hah, i need more practice to keep in mind 09:46
wander dinner&
ZzZombo timotimo, so what about that `write_fhb` thing? 10:12
sjn o/ 10:49
araraloren o\ 10:55
timotimo ZzZombo: there's a bug, but i'm not sure what's to blame. utf16 encoding returns a 16-bit-per-entry buf, but writing binary data only wants to deal with 8-bit-per-entry buffers. both make sense on their own 11:07
sacomo hi all
sjn looks at perl6 dynamic variables, and wishes $*HOSTNAME was one of them 11:08
sacomo I am experimenting with some ideas and was wondering if anyone here my have some input. I want to implement a module that allows a developer to override that module's functions internally to the module. 11:09
a solution I came up with uses multis
DrForr sacomo: have you looked at dynamic variables? 11:10
sjn sacomo: why not just use callbacks?
sacomo ok, that might work. 11:11
DrForr Oh, wait, overriding - Just expose the method in the class and let someone subclass it?
sacomo well, I want the dev to be able to pass in a replacement so that the core module uses their version instead of core 11:12
I have a solution, but it is clunky
i will put together a gist...
DrForr class Foo { method X($z) { self._replace-me($z); } } class My::Foo is Foo { method _replace-me($z) { $z++ } } 11:13
sacomo gist.github.com/scmorrison/e8b73ec...adb54a863c 11:16
so that allows me to override the multi module-wide. So even if an internal sub from Foo calls bar it will use the external version 11:17
DrForr No need for that mechanism - Subclass Foo and replace method bar()? 11:18
sacomo but will that version be used by all of Foo's other methods too?
ZzZombo So what is my best bet in writing data in an not implemented encoding? Turns out my file is actually UCS-2 LE with BOM. 11:20
DrForr One mo, let me write up a gist.
ZzZombo Rakudo doesn't deal with it.
sacomo thanks
DrForr gist.github.com/drforr/64c6adb7cca...7503eb323b 11:22
Woops, forgot to properly subclass. 11:26
Update it.
timotimo ZzZombo: you can have a class implement the Encoder/Decoder role and register it with the encoding registry 11:27
you'd grab the .NFC of your incoming string and spit out 8bit bufs with the 16 bit numbers split either LE or BE
and explode when the value is higher than 16bit, of course
ZzZombo I know nothing about the internals you suggested me to tinker with. Is there any examples? 11:28
Are*
timotimo docs.perl6.org/type/Encoding#method_encoder - i got the name wrong, but they aren't internal, they are language features, iiuc 11:30
oh
that's not the right place
sacomo DrForr, updated, but getting an error... 11:31
getting regular, regular...
timotimo but Encoding::Encoder only needs a single method called "encode-chars" that takes a Str:D and returns a Blob:D 11:32
DrForr Oh, another tyop.
There.
Sorry, I'm distracted. 11:33
ZzZombo So I will need to create a subclass from that, and have its encode-chars turn $str.NFC -> Buf and return it? 11:34
DrForr There. All better.
ZzZombo Then, how do I use it in spurt and similar functions? 11:35
sacomo ok, I see how that works, but what I want is that whenever a method in Foo calls bar internally, or a method in another module that uses Foo, it will use the override
timotimo either just pass the encoder object in the :enc field, or make sure it has a proper .name and Encoding::Registry.register(MyUCS2Encoder) 11:36
also, i lied, you also need to create an Encoding that returns your Encoding::Encoder when .encoder is called on it
and you register *that* 11:37
also implement a decoder method that throws an X::NYI or something
ZzZombo It just got me thinking: why does Perl 6 read the supposedly UTF-16 file w/ no problem, but can't save it back? 11:39
Shouldn't it have problems reading it as well? 11:40
samcv is there a way to get the PID from a Proc object? 11:41
DrForr sacomo: Someone calling Foo.bar(...) still has to choose to use the different version of bar(), right? 11:42
sacomo not in this scenerio. so, the idea is that the core module might call bar() just as it usually does, but I want to remap all of its internal calls to bar() to an external version passed in regardless where Foo tries using bar() 11:43
at this stage I am just playing with this idea. that solution I put in the gist does solve this, but looking for other ideas. 11:44
DrForr I still think simply letting the client subclass your Foo class is the simplest answer. 11:45
sacomo so, the client isn't using bar() 11:46
DrForr I think I need to see more code.
sacomo it is telling Foo to always use External.bar() whenever it wants to use something called bar()
not even sure what this is called. i guess overriding
The client isn't importing and then overriding, it is telling Foo to never use its version of bar() internally again, use this other version instead. 11:47
DrForr Yes, but your client instantiates Foo at some point, yes? 11:48
At which point you can pass your subclass with the new 'bar' method. 11:49
sacomo ok, I will play around with that idea. Passing in a new bar method would allow Foo::Some::Deeper::Class to reference it as well? 11:54
I am trying avoid having the client talk to Foo::Some::Deeper::Class directly
DrForr I think I still need to see some code, I think there's something upside-down here. 11:55
sacomo well, at this stage it is all just a big experiement. so just looking for ideas. I will tinker with the subclass idea. 11:57
DrForr Is there a module I can see on GH?
sacomo not yet, i will get something up to look at and ping you 11:58
thanks for the input too
DrForr Cool. I think you should look at dynamic variables as well, that might be a cleaner solution for you. 11:59
sacomo ok, I will take a look
DrForr I really need to sit down and outline 'Perl 6 Best Practices.' 12:00
timotimo ZzZombo: we'll make moarvm able to write not-only-8bit stuff and then the utf16 encoder will work as-is
sacomo that example gist I showed you is using a few dynamic variables in the is-override and me subs
DrForr Not to say that you're doing something wrong at all, I'm just musing.
ilmari timotimo: then you have to care about endianness... wouldn't it be better to leave that to the encoder? 12:01
moritz DrForr: want to write a book, eh? :-) 12:03
DrForr sacomo: gist.github.com/drforr/f2f2738ee1f...ce5baa468e 12:04
timotimo the utf16 encoder will have to write a BOM
DrForr moritz: Don't get me started :) It's not impostor syndrome at this point, it's just not beng sure I have enough ideas. 12:05
DrForr moritz: I've been bugged by quite a few people already :) 12:06
moritz DrForr: if you want any kind of input or review, please let me know 12:07
I'll be happy help, if you want 12:08
DrForr Thanks.
holyghost There's SDL 2 game startup code at github.com/theholyghost/holly6src the subrepo is named PaganVisions2 12:37
sacomo DrForr, here is a simplified version github.com/scmorrison/perl6-module...er/app.pl6 12:45
pmurias m: "foo" ~~ /<:NoSuchUniCodePropertyForSure>/ 13:01
camelia ( no output )
pmurias ^^ do we want to silently accept unrecognized unicode properties?
ZzZombo so, timotimo, I'm looking into writing my own encoder, but I don't know how to 1) determine endianess, 2) swap byte order if needed. Can you provide some pointers? I can only find Perl5 solutions. 13:03
holyghost timotimo : I've answered the mail, there's plenty more SDL -> 2.x to start from, thanks for the help 13:12
just game programming
Ulti win 2 13:39
buggable Ulti, Thank you for entering Accidental /win Lottery! The next draw will happen in 2 weeks, 10 hours, 20 minutes, and 5 seconds
Ulti hah 13:40
nice
what do I win....
is it the respect of my peers?
jast you'll find out in 2 weeks, 10 hours, 20 minutes, and 5 seconds, minus delta t
Ulti that is a lot of hype 13:41
jast I wonder if it's static or random
win 14
buggable jast, Thank you for entering Accidental /win Lottery! The next draw will happen in 2 weeks, 10 hours, 18 minutes, and 33 seconds
jast imagine that.
Ulti worryingly counting down to something
this makes me want to fix my emotionally sensitive bot 13:42
jast though if I win, I'll cede my prize to you, after all I didn't truly enter by accident
Ulti well depending on how careful the implementaiton is perhaps I can spam win via PM and up my share 13:46
nope :( too smart
jast so I guess you'll need sockpuppet accounts 13:47
comborico1611 Does any programming language truly pass by reference? 14:10
Here for context stackoverflow.com/questions/222949...rence-in-c 14:11
perlpilot comborico1611: perl? 14:13
(sorta :)
comborico1611 Perl and perl6? 14:15
perlpilot Perl 5 14:15
pmurias comborico1611: in c++ you can mark something as passed by reference
comborico1611 Static? 14:16
araraloren Many language pass object(not native type) by reference, like JAVA C# Python Perl6 14:16
perlpilot yeah, that's true too 14:17
ZzZombo There used to be official online Perl6 compiler, right?
comborico1611 Hmm. I think I'm getting in-over-my-head with this question. The Sam
perlpilot "official"?
pmurias m: say('is this an online Perl 6 compiler?') 14:18
camelia is this an online Perl 6 compiler?
comborico1611 Thanks for the input!
holyghost *lol*
ZzZombo nah, it is missing modules I'd like to use.
holyghost You probably need a 2 or 3D eplxorer program :-) 14:19
just pop up from your irc client
that's what I would like, I once made a picture distribution of image from lynx 14:20
pmurias ZzZombo: the js backend is still a WIP so you will have to wait for your super fancy with-in-browser-graphic REPL
ZzZombo uh, now perl REPL prints garbade characters whenever I press Backspace. 14:20
holyghost is ompilint 2017 10 14:21
araraloren ZzZombo, please install Readline
holyghost is ompilin*g* 2017 10
holyghost is compilin*g* 2017 10
araraloren or Linenoise
jast three tries, not bad :)
Altreus re a conversation in #perl - does perl6 maintain stack information when an exception is re-thrown? 14:22
holyghost Altreus : good point, I still need to read the code 14:23
Altreus does the spec mention the idea? :)
holyghost probably it should have just an operation stack, unless we want more than that :-) 14:24
Altreus maybe it should! Python3 has this behaviour and I'd like to be able to maintain my obstinate distaste for python
moritz m: sub f() { g }; sub g() { die "foo" }; sub h() { f(); CATCH { } }; h()
camelia foo
in sub g at <tmp> line 1
in sub f at <tmp> line 1
in sub h at <tmp> line 1
in block <unit> at <tmp> line 1
ZzZombo WTF
why does `zef` change my console font settings? It's ugly!
Altreus more like how 14:24
holyghost I am happy to be a perl6 archhacker but I do need to read the code 14:25
araraloren I don't think zef can change your font settings
moritz Altreus: seems like contains the original stack trace
holyghost moritz : if we want a SDL 2 deployment of camelia outputs, would it be doable ?
ZzZombo But running it sure does change that.
holyghost need the right irc client I guess 14:26
Altreus hmm
scimon sacomo: Reading your earlier stuff why not just use a Role instead of a Class?
Altreus m: sub f() { g }; sub g() { die "foo" }; sub h() { f(); CATCH { default { die $_ } } }; h()
camelia foo
in block at <tmp> line 1
in sub g at <tmp> line 1
in sub f at <tmp> line 1
in sub h at <tmp> line 1
in block <unit> at <tmp> line 1
Altreus is that the exact implied code?
holyghost You're always talking in subs you should need to display modules 14:27
moritz holyghost: what kind of output does SDL produce?
holyghost moritz : it's SDL 2 now 14:28
jast ZzZombo: it's more likely that some of its output triggers a weird render mode in your terminal emulator. does it persist into new terminal sessions/windows, or when you use the 'reset' tool? 14:28
sacomo scimon, that might work. I want to set an override at the initial setup, and have the overrided method used throughout the module regardless of where the original is called from, even from within the origin core module's subclasses, etc.
moritz holyghost: what kind of output does SDL 2 produce?
holyghost SDL libs
to load
so if you alter BitchX to display the jvm or moarvm code it should run within client 14:29
maybe .class files, I dunno
moritz uhm, count me out
holyghost sure
moritz you can fork camelia, and try to patch the fork 14:30
github.com/perl6/evalbot
but... I don't think IRC is the right medium for that 14:31
holyghost you need the SDL2:Raw module then open a window to paint and event upon
holyghost complies
scimon sacomo: If you're using a factory you can always do runtime composition. my Foo $foo .= new; $foo does FoeOverride; return $foo;
Because runtime composition is funny. 14:32
holyghost AFAIK you need to patch the BitchX client to put the code through, as I understand
it's about botwise
parse-wise of in - ouput 14:33
scimon m: role Foo { method bar() { "Foo::bar" } };role Foo2 does Foo { method bar() { "Foo2::bar" } };my Foo $f .= new;say $f.bar;$f does Foo2;say $f.bar;my Foo2 $f2 .= new;say $f2.bar
camelia Foo::bar
Foo2::bar
Foo2::bar
scimon :D
holyghost moritz : I might do that in the future, but as you know the perl6 input is parsable 14:34
you have to open a window with some parser and put it into your X11 window system
e.g. SDL 2
holyghost is compiling 2017 10 14:35
holyghost deadfall :-) 14:36
sacomo scimon, one thing is that Foo::Extra for example might make a regular call to Foo::bar from inside the module without being aware of the Foo2 version when I initiated Foo
scimon Ahhhh. modules. 14:37
sacomo right 14:37
holyghost \o Cabanossi
sacomo that is what I have come up with so far. the working example in that link
ZzZombo This doesn't work in my local Perl REPL but works with camelia: 14:38
`use Encode:from<Perl5> <decode encode>;`
Type check failed in binding to parameter '$handle'; expected CompUnit::Handle but got Sub (sub EXPORT (*@args) {...)
in any statement_control at C:\rakudo\share\nqp\lib/Perl6/Grammar.moarvm line 1
my last hope at tackling this encoding problem died so far :( 14:39
holyghost moritz : what did you want to say that SDL 2 does produce ? 14:42
the GUI should come out from it, by using your system's jvm/moarvm modules 14:43
holyghost so a download as e.g. hotjava 14:44
moritz holyghost: I know that it doesn't work through plain IRC, so it won't land in the official camelia
holyghost sure
moritz holyghost: if you need a special client, there is not much benefit in using IRC at all, IMHO 14:45
holyghost complies
I'd like to have a decent bot for it
like displaying my image files from lynx 14:46
It needs an API
pastebin etc. are ok though, I do understand
ZzZombo pastebin.com/ViqqpsCQ 14:52
Looks like the new `zef` that comes with the latest Star release is borked, at least on Windows.
Nothing I've tried can be installed or upgraded. 14:53
stmuk ZzZombo: have you tried the following? 15:35
cd %USERPROFILE%
rd /s .zef
rs /s .perl6
stmuk ZzZombo: Inline::Perl5 didn't work on Windows last time I tried anyway 15:36
ZzZombo ir works. 15:37
stmuk ?
ZzZombo the module, and I just followed the nuke advice from an issue, zef works for now. 15:38
stmuk there is a quoting bug in the Windows qqx which breaks (or broke) Inline::Perl5 15:42
a problem with rakudo itself 15:43
Ulti < pmurias> ZzZombo: the js backend is still a WIP so you will have to wait for your super fancy with-in-browser-graphic REPL <--- Jupyter REPL lets you output SVG inline ;) 15:44
github.com/bduggan/p6-jupyter-kernel
the tab complete on it is quite nice too 15:45
github.com/bduggan/p6-jupyter-kern.../svg.ipynb
also Im noticing that GitHub can render that notebook.... which is impressive! 15:46
does that mean they have Rakudo and the ipython stuff running somewhere?
nah all pre rendered 15:48
Ulti is there any way to get the union of a bag where the counts are summed together? 15:55
dogbert2 m: bag(<a a b c a d>) (+) bag(<a a b c c>) === ("a"=>5,"c"=>3,"b"=>2,"d"=>1).Bag 15:57
camelia WARNINGS for <tmp>:
Useless use of "===" in expression "(+) bag(<a a b c c>) === (\"a\"=>5,\"c\"=>3,\"b\"=>2,\"d\"=>1).Bag" in sink context (line 1)
dogbert2 m: say bag(<a a b c a d>) (+) bag(<a a b c c>) === ("a"=>5,"c"=>3,"b"=>2,"d"=>1).Bag 15:58
camelia True
dogbert2 m: say bag(<a a b c a d>) (+) bag(<a a b c c>)
camelia Bag(a(5), b(2), c(3), d)
dogbert2 Ulti: ^^ unless I totally sisunderstood what you wanted 16:02
dogbert2 sigh bad spelling
Ulti nope thats it thanks dogbert2 16:05
wander what is the usual reason for
'Aborting due to test failure: Algorithm::BitMap:ver<0.0.1> (use --force-test to override)'
i'm follow the guide of Distributing Modules, and with 'zef install .' in my module dir it complains 16:06
moritz the usual reason is that a test fails 16:07
wander which test? i've run `perl6 t/01-basic.t` and passed it. that is the only test file. 16:10
Ven Hi, #perl6. 16:12
.u ²
yoleaux U+00B2 SUPERSCRIPT TWO [No] (²)
comborico1611 Hello! 16:13
ZzZombo <ZzZombo> so, timotimo, I'm looking into writing my own encoder, but I don't know how to 1) determine endianess, 2) swap byte order if needed. Can you provide some pointers? I can only find Perl5 solutions. 16:22
timotimo ^ 16:23
wander could someone do me a favor try this guy and figure out why `zef install .` complains? 17:04
github.com/W4anD0eR96/Algorithm-BitMap
perlpilot cd 17:04
perlpilot wander: Parse errors: No plan found in TAP output 17:06
wander: either explicitly plan the number of tests or add a "done-testing" to the end
wander yes it works, thank you perlpilot 17:11
Geth mu: f595b21d00 | (Zoffix Znet)++ (committed using GitHub Web editor) | misc/perl6advent-2017/schedule
Remove post
17:15
ecosystem/W4anD0eR96-patch-1: 12c1959ed5 | (Alex Chen)++ (committed using GitHub Web editor) | META.list
Add Algorithm::BitMap

Thank you for submitting a module to the Perl 6 Ecosystem!
If adding a new module please review the following check boxes and check the appropriate boxes by going to the preview tab and checking them interactively or alternatively replacing the space in the checkboxes with an X. Your work is appreciated and every module helps make the Perl 6 Ecosystem a bigger and better place ♥
  - [X] I **agree** to the usage of the META file as listed [here](github.com/perl6/ecosystem#legal).
... (5 more lines)
17:17
ecosystem: W4anD0eR96++ created pull request #379:
Add Algorithm::BitMap
17:18
[Coke] hopes everyone is having a good week. 17:28
jnthn It's a national holiday tomorrow, so I'm at least having a shorter week :) 17:32
jnthn .wun 36 17:36
oops :)
jnthn bbl 17:39
[Coke] our national holidays are next week here in the states; I'm luck to have a 3 day work week 17:52
*lucky
tabv :m rx/<alnum + [.-]>/ 18:23
m: rx/<alnum + [.-]>/
camelia 5===SORRY!5=== Error while compiling <tmp>
Quantifier quantifies nothing
at <tmp>:1
------> 3rx/<alnum +7⏏5 [.-]>/
tabv m: rx/<[.-] + alnum>/
camelia ( no output )
tabv I would have expected the first one to work
timotimo ZzZombo: UCS2 doesn't have the concept of a byte order mark? 18:31
timotimo wikipedia is frustratingly unclear about that 18:34
m: use NativeCall; my $one = Buf[uint16].new(0xabcd); say nativecast(Buf[uint8], $one).perl; 18:35
camelia Internal error: unhandled target type
in sub nativecast at /home/camelia/rakudo-m-inst-1/share/perl6/sources/24DD121B5B4774C04A7084827BFAD92199756E03 (NativeCall) line 658
in block <unit> at <tmp> line 1
timotimo m: use NativeCall; my $one = Buf[uint16].new(0xabcd); say nativecast(CArray[uint8], $one)[0].base(16);
camelia -33
timotimo m: use NativeCall; my $one = Buf[uint16].new(0x1234); say nativecast(CArray[uint8], $one)[0].base(16);
camelia 34
timotimo m: use NativeCall; my $one = Buf[uint16].new(0x1234); say nativecast(CArray[uint8], $one)[1].base(16);
camelia 12
timotimo ZzZombo: that's how you determine endianness of your system
well, one way at least
and byte order swapping is simple, too, with a bit of bitwise arithmetic: 18:36
m: my $before = 0x1234; my $after = $before & 0xff << 8 +| $before & 0xff00 >> 8; say $after.base(16)
camelia 5===SORRY!5=== Error while compiling <tmp>
Unsupported use of << to do left shift; in Perl 6 please use +< or ~<
at <tmp>:1
------> 3 = 0x1234; my $after = $before & 0xff <<7⏏5 8 +| $before & 0xff00 >> 8; say $after.
timotimo m: my $before = 0x1234; my $after = $before & 0xff +< 8 +| $before & 0xff00 +> 8; say $after.base(16)
camelia all(1234, FF34, FF)
timotimo haha
timotimo m: my $before = 0x1234; my $after = $before +& 0xff +< 8 +| $before +& 0xff00 +> 8; say $after.base(16) 18:37
camelia 3412
timotimo ZzZombo: does that help?
hythm Hi, Is there module to install to have colors in REPL? 18:59
timotimo hythm: if you want syntax highlighting, maybe the jupyter kernel + an terminal shell for that can do it. if you mean printing out your own colored stuff, there's Term::ANSIColor for unix terminals 19:00
hythm timotimo I meant syntax highlighting when writing in REPL. I will check jupyter kernel 19:01
Ulti hythm: you can use the jupyter kernel 20:13
;)
if you set this up github.com/bduggan/p6-jupyter-kernel with the iperl6 alias the resulting REPL has some syntax highlighting 20:14
and you get all the other reply goodness of jupyter
hythm Thanks timotimo and Ulti, I tried installing 20:16
using: zef install Jupyter::Kernel. but I got this error "Invalid json? File: /home/helganiny/.zef/store/JSON-Tiny-1.0.tar.gz/JSON-Tiny-1.0/.gitignore 20:17
"
so What I'm doing now, I will upgrade perl6 and zef then try again 20:18
AlexDaniel I don't get it… is GitLab really so hard to use, or is it just a habit? 20:19
Ulti ? 20:20
timotimo hythm: would be interesting to hear what your versions of things are
AlexDaniel I don't know. There's just something about it that makes me want to defenestrate it 20:21
hythm timotimo: $ perl6 --version 20:22
This is Rakudo version 2017.07-132-gabf1cfe72 built on MoarVM version 2017.07-318-g604da4d0
implementing Perl 6.c.
Dont know how to get zef version, zef --version doesn't provide it 20:24
moritz zef list --installed # or something like that 20:25
hythm This is the output of zef list --installed: gist.github.com/hythm7/09322ec138b...133a5ee39f 20:27
moritz zef:ver('0.1.26'):auth('github:ugexe') 20:35
0.1.32 is the current version 20:36
hythm Thanks moritz, I'm upgrading everything now, Will test after that 20:38
tony-o is telemetry in blead ? 20:44
lizmat tony-o: yes, it lives in lib 20:46
comborico1611 I always thought Elements were the value stored in the Subscript. The thing in the subscript is just called a value. That's lame. 20:48
tony-o lizmat: is it in the 6d preview? 20:49
fresh blead build and can't find Telemetry for 'use Telemetry' 20:50
lizmat tony-o: that's weird
m: use Telemetry
camelia ( no output )
lizmat works even in Camelia ?
tony-o oh dear.
comborico1611 I just realized the connection with camelia . . . 20:51
lizmat m: use Telemetry; snap; sleep .2
camelia Telemetry Report of Process #7349 (2017-11-16T20:51:28Z)
Number of Snapshots: 2
Initial/Final Size: 87740 / 92172 Kbytes
Total Time: 0.21 seconds
Total CPU Usage: 0.01 seconds
No supervisor thread has been running

wallclo…
Ulti tony-o: have you switched to master?
at least that caught me out when I first looked for the Telemetry stuff since it was the same time (ish) 20:52
tony-o Ulti: was building blead with rakudobrew but i'll build from the repo
ugexe its probably because rakudobrew calls `moar-blead` moar-blead-master` now instead of `moar-blead-nom`, so `rakudobrew switch moar-blead` could pick eithe rone
tony-o ah
Ulti tony-o: yeah but did you update rakudobrew to look at master
ugexe probably wanna delete ~/.rakudobrew/moar-blead-nom, and also run `rakudobrew self-update` 20:53
tony-o nuking made it pick master instead of nom
ty.
Ulti rakudobrew build moar master && rakudobrew switch moar-master && rakudobrew nuke moar-nom
I think
yeah 20:54
ugexe moar-blead is not the same as moar-master
moar-blead should bring in blead nqp/moar as well
Ulti sure but it also doesnt switch from nom unless you nuke it in rakudobrew
so if you nuke it and rebuild it works
ugexe yes, but nuke moar-nom will not do that, and `moar-master` should be `moar-blead-master` (or just remove the -master) 20:55
Ulti 4m7.365s <--- dealing with a 44MB file :( I regret my choice to use Perl 6 for this task 20:56
tony-o ran nuke blead, self-update, and build blead and it switched from -nom to -master
lizmat++ for Telemetry
i can update benchmark now 20:57
Ulti ok interesting the lines IO part is only 36s of that 4 minutes 20:58
the grep with lots of .first into an array is slow I assume 20:59
ooo .race can work \o/
Ulti weird the .race was twice as slow as just the normal grep 21:13
but I also gamed that 5 minutes down to 54s using a set 21:14
perlpilot
.oO( that's because it's turtles all the way down! )
El_Che someone with access to rakudo.org/how-to-get-rakudo/#Insta...Star-Linux present? 22:11
lizmat decommute& 22:16
tony-o m: require ::('Telemetry'); sub n { ::('Telemetry').new; }; sub r ($a, $b) { say $b - $a; }; r(n,n); 22:45
camelia Cannot resolve caller Numeric(Telemetry: ); none of these signatures match:
(Mu:U \v: *%_)
in sub r at <tmp> line 1
in block <unit> at <tmp> line 1