»ö« 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:08
Ven left
00:11
mcmillhj joined
00:13
vendethiel- joined,
vendethiel left
00:14
matiaslina left
00:15
mcmillhj left
00:23
mcmillhj joined
00:28
mcmillhj left
00:41
mcmillhj joined
00:46
mcmillhj left,
mcmillhj joined
00:47
bjz joined
|
|||
Xliff | How do I access a hash, dynamically? Please not I am not talking dynamic variables in the * sense, but a variable name that is formed programatically. | 00:48 | |
::("%variable_name") maybe? | 00:49 | ||
m: my %a = (a => 1); dd ::("%a"); | |||
camelia | rakudo-moar 6a8278: OUTPUT«Hash %a = {:a(1)}» | ||
geekosaur | may need to use '' instead | ||
Xliff | Oooo! | ||
rakudo++ # Able to work out stuff on your own. | |||
Well... | 00:50 | ||
m: my %a = (a => 1); my $var = "a"; dd ::("%$var"); | |||
camelia | rakudo-moar 6a8278: OUTPUT«Hash %a = {:a(1)}» | ||
Xliff | Awesome. | ||
00:50
zacts joined
|
|||
awwaiid | m: my %a = (a => 1); my $var = '%a'; dd ::($var) | 00:52 | |
camelia | rakudo-moar 6a8278: OUTPUT«Hash %a = {:a(1)}» | ||
00:52
jameslen_ left
|
|||
awwaiid | you should think of the % as part of the name of the var, such that separating it out is unnatural | 00:53 | |
00:55
bioduds joined
|
|||
bioduds | hey there | 00:55 | |
===SORRY!=== Error while compiling hello.pl Can't use unknown trait 'is required' in an attribute declaration. | |||
this is weird | 00:56 | ||
has $.name is required; | |||
awwaiid | hm | ||
in a class? | 00:57 | ||
bioduds | yes | ||
in a class | |||
awwaiid | link the whole example maybe | ||
'cause seems like that should work | |||
Xliff | awwaiid: Given interpolation, does it really matter? | ||
bioduds | #!/usr/bin/env perl6 use v6; class Human { # CLASS ATTRIBUTE - like static my $.species = "Homo Sapiens"; # Attributes has $.name is required; has $.age is required is rw; # is rw so that it can be modified later has $.sex is required; method talk { return "Money Talks!"; } } my $human = Human.new( name=>'Eduardo', age=>36, sex=>'M' ); say $human.age ~ " start age"; $human.age = 37; say "One year later... " | ||
tbrowder | Xliff: that is why i asked the question earlier and mentioned docs on hash are sketchy. see gdflex's answer to me | ||
awwaiid | Xliff: doesn't matter in the technial sense at all, more a philosophical / strategic suggestion | 00:58 | |
Xliff | m: $a = { hex => '#404040', red => 64, green => 64, blue => 64 }; my $arr = [ $a{keys $a}:p.flat ]; dd $arr; | ||
camelia | rakudo-moar 6a8278: OUTPUT«5===SORRY!5=== Error while compiling <tmp>Variable '$a' is not declaredat <tmp>:1------> 3<BOL>7⏏5$a = { hex => '#404040', red => 64, gre» | ||
Xliff | m: my $a = { hex => '#404040', red => 64, green => 64, blue => 64 }; my $arr = [ $a{keys $a}:p.flat ]; dd $arr; | ||
camelia | rakudo-moar 6a8278: OUTPUT«Array $arr = $[:red(64), :green(64), :blue(64), :hex("#404040")]» | ||
tbrowder | Xliff: that should be gfldex | 00:59 | |
bioduds | no errors there | ||
Xliff | awwaiid: Understood. That was more an optimization since I am only working with programmatical hashes (can't say "dynamic" anymore!) | ||
bioduds | ran in another machine | ||
awwaiid | m: class Human { has $.name is required; has $.age is required is rw } ; my $human = Human.new( name=>'justice', age=>79, sex=>'M') ; say $human | ||
camelia | rakudo-moar 6a8278: OUTPUT«Human.new(name => "justice", age => 79)» | ||
awwaiid | m: class Human { my $.species = 'homo sapiens'; has $.name is required; has $.age is required is rw } ; my $human = Human.new( name=>'justice', age=>79, sex=>'M') ; say $human | 01:00 | |
camelia | rakudo-moar 6a8278: OUTPUT«Human.new(name => "justice", age => 79)» | ||
bioduds | ===SORRY!=== Error while compiling hello.pl Can't use unknown trait 'is required' in an attribute declaration. at hello.pl:9 ------> expect | ||
geekosaur | this would be easier if you'd use a pastebin of some kind instead of cramming it into an irc line | 01:01 | |
awwaiid | I'm surprised my $.species works, bu tit doesn't have an is required so probably irrelevant | ||
bioduds | it is weird | ||
awwaiid | I guess that's a class-scoped var | 01:02 | |
bioduds | cause in another machine runs fine | ||
awwaiid | oh that's very interesting | ||
same rakudo? | |||
bioduds | i installed the same way on both | ||
sudo apt install rakudo | |||
awwaiid | check it anyway :) | ||
perl6 --version | |||
bioduds | how to check rakudo version? | ||
oh | |||
wait | |||
awwaiid | yep | 01:03 | |
bioduds | so first is | ||
This is Rakudo version 2016.08.1-3-g668dc5c built on MoarVM version 2016.08 implementing Perl 6.c. | |||
awwaiid | deliciously up to date | ||
bioduds | this above works | ||
second one does not | 01:04 | ||
This is perl6 version 2013.12 built on parrot 5.9.0 revision 0 | |||
awwaiid | 2013.12 ya | ||
bioduds | very old | ||
awwaiid | anything older than about 2015.12 (christmas release) is going to not be worth using | ||
bioduds | i installed before sudo apt update I guess | ||
awwaiid | could be, or maybe different debians? | ||
bioduds | let me rebuild the machine | 01:05 | |
awwaiid | sounds good | ||
albeit drastic. but machines are just files these days I suppose | |||
Xliff | DAGNABBIT! | 01:06 | |
Is the use of "require" statements not allowed in pasers? | |||
awwaiid | well you don't have to be upset about it -- in unix EVERYTHING is a file anyway, might as well make the machine a file too | ||
is 'pasers' -> 'phasers' or -> 'parsers' ? | 01:07 | ||
Xliff | I get this if I try to require() in BEGIN or INIT "Cannot invoke this object (REPR: Null; VMNull)" | ||
Eer. | |||
awwaiid, if its not obvious by now, s/pasers/phasers/ | |||
geekosaur | sounds like That Bug yet again | ||
awwaiid | Xliff: :) | ||
Xliff | geekosaur: Is "That Bug" a recent occurence? I last rakudobrew'd two weeks ago. | 01:08 | |
geekosaur | (there's a bug they've been playing whack-a-mole with where the compilation context isn't maintained properly in things like that) | ||
it is not something recently introduced or recently fixed | |||
Xliff | kk | ||
I will rakudobrew anyway | |||
Just because I like the sound of my compilers, and the smell of burnt silicon in the morning. | 01:09 | ||
geekosaur | RT 129096 is the most recently reported instance of it (and has links to other instances) | ||
Xliff | should I RT this one? | ||
geekosaur | RT #129096 wakey wakey... | 01:10 | |
synopsebot6 | Link: rt.perl.org/rt3//Public/Bug/Displa...?id=129096 | ||
jeek | Does perl6 have decent bigint support, and if so, how's the performance? | ||
awwaiid | jeek: yes decent support. I don't know about performance. | ||
Xliff | jeek: BigInt is baked into Int | ||
geekosaur | probably, if there isn't one already that covers it which is why I dug out that bug | ||
jeek | I've been doing weird recreational math crap for this retired professor for funsies, wondering how well it'd run. Might have to give it a crack. | ||
Rakudo still the VM of choice? | |||
bioduds | same thing | ||
awwaiid | jeek: it is. rakudobrew recommended way of getting it, or apt if you are on debian unstable | 01:11 | |
bioduds | after rebuilding the slice and updating | ||
awwaiid | bioduds: same version of rakudo? | ||
bioduds | yes | ||
i guess I should perhaps upgrade | |||
awwaiid | bioduds: what does `cat /etc/issue` say you are running? I suspect the other machine is debian unstable and this is not | ||
bioduds | let me see | 01:12 | |
awwaiid | m: $n = 4567827273678726678376378263782263637383; $n++ ; say $n ; say $n.WHAT # <- jeek | ||
camelia | rakudo-moar 6a8278: OUTPUT«5===SORRY!5=== Error while compiling <tmp>Variable '$n' is not declaredat <tmp>:1------> 3<BOL>7⏏5$n = 45678272736787266783763782637822636» | ||
awwaiid | m: my $n = 4567827273678726678376378263782263637383; $n++ ; say $n ; say $n.WHAT # <- jeek | ||
camelia | rakudo-moar 6a8278: OUTPUT«4567827273678726678376378263782263637384(Int)» | ||
awwaiid | hmm. maybe that wasn't big enough | ||
bioduds | it is ubuntu 14.04 | ||
LTS | |||
awwaiid | bioduds: and the one that works? | 01:13 | |
geekosaur | that's testing, not unstable | ||
bioduds | should work by updating | ||
skink | jeek, We also have proper rationals :) | ||
bioduds | the one that works is ubuntu 16.04 | ||
geekosaur | right, that would make sense | ||
awwaiid | bioduds: yep, there you go then. in fact, I'm not sure how ubuntu 16.04 has the version released this month | ||
geekosaur | you need to use rakudobrew with 14.04 | ||
and I don't know about 16.04 either | 01:14 | ||
bioduds | I believe 16.04 with simple apt install rakudo was enough | ||
geekosaur | you do *not* want to try to convert ubuntu or an ubuntu-derived system to debian sid | ||
bioduds | im upgrading 14.04 to try | ||
01:16
perlawhirl joined
|
|||
awwaiid | is there like an update channel for rakudo in ubuntu that keeps it up to date? ubuntu 16.04 released in April shouldn't have August rakudo, right? | 01:16 | |
01:16
girafe left
|
|||
geekosaur | 16.04 is an LTS, I can't see it having a later rakudo | 01:16 | |
awwaiid | in fact, looking at launchpad.net/ubuntu/+source/rakudo, I don't think you got your recent rakudo from apt, bioduds . what does `which rakudo` say? | ||
geekosaur | maybe the system has a PPA for someone's up to date rakudo build though | ||
perlawhirl | what's the best way to read a POD file... Specifically, how do I render the POD that comes with Text::CSV | 01:17 | |
bioduds | which rakudo says nothing | ||
geekosaur | that was the wrong command | ||
bioduds | upgraded didnt work too | ||
geekosaur | which perl6 (or better, type perl6) | ||
bioduds | which perl6 /home/admin/.rakudobrew/bin/perl6 | 01:18 | |
awwaiid | ah | ||
geekosaur | there you go | ||
skink | Hm, interesting | ||
awwaiid | ok bioduds, on your machine running perl6 2016.08 you installed it using rakudobrew rather than apt | ||
skink | m: my Int $x = 10; for ^1000000 { $x / 2 }; say now - INIT now; | ||
camelia | rakudo-moar 6a8278: OUTPUT«WARNINGS for <tmp>:Useless use of "/" in expression "$x / 2" in sink context (line 1)2.5922761» | ||
bioduds | nope, just apt-get install rakudo | 01:19 | |
awwaiid | geekosaur: I never used type to find something in the path. fancy | ||
bioduds | dont worry | ||
geekosaur | bioduds, apt-get does not install /home/admin/.rakudobrew/bin/perl6 | ||
that is rakudobrew | |||
bioduds | well | ||
skink needs to upgrade | |||
bioduds | only thing I did was sudo apt-get install rakudo | ||
but dont worry | 01:20 | ||
i need to leave now | |||
awwaiid | bioduds: maybe someone else did it :) | ||
bioduds | thanks for assistance | ||
:) | |||
ill try late | |||
later | |||
awwaiid | cool, have fun! | ||
geekosaur | awwaiid, the difference is in most shells (for bash, it depends on the version of bash) "which" shows what a *new* shell will see, whereas "type" always shows what the current shell thinks it knows | 01:21 | |
awwaiid | ah | ||
geekosaur | (this may be incorrect if someone removed the thing after the shell last saw it) | ||
awwaiid | right. hence me randomly running 'rehash' when i stop trusting things. | ||
Xliff | m: my %a = { a => 1}; dd ::("%a); | 01:27 | |
camelia | rakudo-moar 6a8278: OUTPUT«5===SORRY!5===Unable to parse expression in double quotes; couldn't find final '"' at <tmp>:1------> 3my %a = { a => 1}; dd ::("%a);7⏏5<EOL> expecting any of: postfixOther potential difficulties: Useless use of h…» | ||
geekosaur | even more fun, if it's not a shell builtin then it may be looking at your dotfiles --- meaning it shows what you will see the next time you log in, if you edited your dotfiles and didn't make the same changes to your running shell | ||
Xliff | m: my %a = { a => 1}; dd ::("%a"); | ||
camelia | rakudo-moar 6a8278: OUTPUT«Potential difficulties: Useless use of hash composer on right side of hash assignment; did you mean := instead? at <tmp>:1 ------> 3my %a = { a => 1}7⏏5; dd ::("%a");Hash %a = {:a(1)}» | ||
geekosaur | loads of fun :/ | ||
Xliff | m: my %a = ( a => 1 ); dd ::("%a"); | 01:28 | |
camelia | rakudo-moar 6a8278: OUTPUT«Hash %a = {:a(1)}» | ||
Xliff | m: my %a = ( a => 1 ); dd ::("%a")<a>; | ||
camelia | rakudo-moar 6a8278: OUTPUT«Int %a = 1» | ||
Xliff | o_O | ||
geekosaur | I think you have exceeded the scope of dd, there | 01:29 | |
(it's a bit of a hack) | |||
Xliff | Well. No. | 01:31 | |
camelia returns what I would expect. | |||
However I appear to have oversimplified my use case. | |||
Because what I am really trying to do is not working. | 01:32 | ||
01:32
zacts left
|
|||
Xliff | I'm working on github.com/Xliff/p6-color-names | 01:33 | |
And when trying to do "perl6 -Ilib --stagestats -e 'use Color::Names; dd ::("\%Color::Names::Cloford::Colors")<grey42>;'" | |||
timotimo | you might have to put the actual :: operator between the pieces of name | ||
Xliff | I get "Any %Colors = Any" | ||
timotimo: You mean something like --> ::("\%Color)::("Names")::("Cloford")::("Colors") | 01:35 | ||
(aaieee! | |||
geekosaur | m: package Foo { our $bar = 5; }; dd ::('$Foo::bar') | 01:36 | |
camelia | rakudo-moar 6a8278: OUTPUT«Int $bar = 5» | ||
timotimo | well, after the first part i think you can leave out the (" and ") | ||
because then it's no longer dynamic | |||
Xliff | Even this doesn't work --> "perl6 -Ilib --stagestats -e 'use Color::Names; dd %Color::Names::Cloford::Colors<grey40>;'" | ||
timotimo | hm | ||
oh | |||
you do realize you have that as "my %Colors"? | 01:37 | ||
and thus it'd only be available from inside the package? | |||
Xliff | Changed to "our" like 10 minutes ago | ||
timotimo | OK | ||
what do things like Color::.keys and such give you? | |||
Xliff | What I would expect. | 01:38 | |
A long sequence of color names. | |||
timotimo | every step of the way? | ||
Xliff | Every step of the way? "Color::.keys" gives me an error | 01:39 | |
timotimo | i thought it gives you a long sequence of color names? | ||
Xliff | perl6 -Ilib --stagestats -e 'use Color::Names; dd %Color::.keys' --> "Variable '%Color' is not declared. Did you mean '&color'?" | ||
perl6 -Ilib --stagestats -e 'use Color::Names; dd %Color::Names::Cloford::Colors.keys' --> Long Seq of color names | 01:40 | ||
timotimo | oh | ||
if you put %Color in the first bit, that'll give you trouble if you have a long sequence of individual parts | |||
Xliff | Ahh | 01:41 | |
perl6 -Ilib --stagestats -e 'use Color::Names; dd Color::.keys' --> '("Names").Seq' | |||
perl6 -Ilib --stagestats -e 'use Color::Names; dd Color::Names.keys' --> '()' | 01:42 | ||
timotimo | ok, so the % in front must have been the problem | ||
you need Color::Names::.keys | |||
you're not refering to a package otherwise | |||
Xliff | ("Cloford", "EXPORT").Seq | 01:43 | |
01:43
perlawhirl left
|
|||
Xliff | Color::Names::Cloford::.keys --> ("\%Colors",).Seq | 01:43 | |
So ::("%Color::Names::Cloford::Colors) and ::("Color::Names::Cloford::%Colors) gives me the same results | 01:45 | ||
01:45
ilbot3 left
|
|||
Xliff | I can dd the entire hash, but I can't pull out an element | 01:45 | |
::("%Color::Names::Cloford::Colors)<grey42> and ::("Color::Names::Cloford::%Colors)<grey42> both return an Any | 01:46 | ||
Errr... Assume terseness on my part and that everything int the last bit was properly quoted. | |||
timotimo | which part gives youwhat exactly | ||
01:47
ilbot3 joined
|
|||
Xliff | timotimo: ?? - I don't understand what you are asking in that last bit. | 01:47 | |
perl6 -Ilib --stagestats -e 'use Color::Names; dd ::("Color::Names::Cloford::%Colors"){"grey42"}' --> "Any %Colors = Any" | 01:48 | ||
But... | |||
perl6 -Ilib --stagestats -e 'use Color::Names; dd ::("Color::Names::Cloford::%Colors")' --> will return a dump of the entire hash | |||
*sigh* it is now Saturday night, and my willingness to be sober has evaporated. | 01:50 | ||
Actually evaporated 30 minutes ago, but I'm out of beer. | 01:51 | ||
01:53
labster left
01:54
araujo_ joined
|
|||
timotimo | very weird | 01:54 | |
01:57
araujo__ left
|
|||
Xliff | timotimo, I thought so to! | 02:00 | |
You think I should RT? | |||
timotimo | i'ven't had any concentration left in my brain an hour ago | ||
and it's too warm in my apartment to get any sleep | |||
Xliff | OK. It can wait until later when both of us have braincells in operation. :) | ||
timotimo | suffice it to say, i'm pretty sure there's a simple solution to our problem, i'm just not coming up with it from a distance | 02:01 | |
Xliff | LOL | ||
timotimo | i haven't cloned the repository, for example. that seems like an obvious first step | ||
Xliff | I actually feel the same way about THIS one. It's the other one that's bothering me. | ||
02:02
mcmillhj left
02:06
mcmillhj joined
02:08
pierre_ joined
02:10
pierre_ left
02:14
mcmillhj left
02:15
vendethiel joined,
vendethiel- left,
bjz left
02:16
grondilu left
02:17
bjz joined
02:22
mcmillhj joined
02:26
grondilu joined
02:27
pierre_ joined
02:28
mcmillhj left
02:29
mcmillhj joined,
pierre_ left
02:31
skink left
02:32
grondilu left
02:34
grondilu joined
02:43
pecastro_ joined,
kenedensency joined
|
|||
kenedensency | 哈囉 | 02:44 | |
02:44
noganex joined,
mcmillhj left
|
|||
grondilu | m: my Int sub () { 13 } # I had no idea this was correct syntax! | 02:45 | |
camelia | ( no output ) | ||
02:45
kenedensency left
|
|||
grondilu | m: my Int sub () { "Foo" }() | 02:45 | |
camelia | rakudo-moar 6a8278: OUTPUT«Type check failed for return value; expected Int but got Str ("Foo") in sub at <tmp> line 1 in block <unit> at <tmp> line 1» | ||
grondilu | coo | 02:46 | |
cool | |||
02:46
mcmillhj joined
02:47
noganex_ left
|
|||
Ben_Goldberg | m: my sub (--> Int) { 13 }().say; | 02:50 | |
camelia | rakudo-moar 6a8278: OUTPUT«13» | ||
Ben_Goldberg | m: my sub (--> Int) { "Foo" }().say; | ||
camelia | rakudo-moar 6a8278: OUTPUT«Type check failed for return value; expected Int but got Str ("Foo") in sub at <tmp> line 1 in block <unit> at <tmp> line 1» | ||
02:51
Ben_Goldberg is now known as BenGoldberg
|
|||
BenGoldberg | grondilu, As you can see, perl6 offers more than one way to do it :) | 02:51 | |
m: my sub (--> Int) { "Foo" }; | |||
camelia | ( no output ) | ||
BenGoldberg | It would be nice though, if rakudo attempted, at compile time, to do some type checking, even before the sub got called. | 02:53 | |
geekosaur | that kind of stuff is WIP | 02:54 | |
02:59
mcmillhj left
|
|||
dalek | ateverable: fbf968b | MasterDuke17++ | / (2 files): Change %additional_files to the more idiomatic %additional-files |
03:01 | |
03:01
cognominal joined
03:02
eliasr left
|
|||
grondilu | how do you deal with typedefs in NativeCall? I mean for instance with "typedef int32 myIntType;". Do you just replace all occurence of myIntType with int32? | 03:07 | |
subset myIntType of int32 would not work, would itN | 03:08 | ||
it? | |||
Xliff | constant with bind operator, I think | 03:11 | |
constant myIntType := int32 | |||
grondilu | m: constant foo := int; sub (foo) { say "ok" }(23); | 03:12 | |
camelia | rakudo-moar 6a8278: OUTPUT«ok» | ||
grondilu is impressed | |||
so you can define types as constants. Nice. | |||
03:14
mcmillhj joined
|
|||
Xliff | (types as objects)++ | 03:14 | |
03:15
adu joined
|
|||
b2gills | m: constant foo := int; say foo.^name; # it is an alias | 03:17 | |
camelia | rakudo-moar 6a8278: OUTPUT«int» | ||
03:18
Xliff_ joined
03:19
mcmillhj left,
baest_ joined,
mohae joined,
sQuEE` joined
03:20
edenc_ joined,
peteretep_ joined
03:21
zostay_ joined
03:22
Roamer` left,
Roamer` joined,
Cabanoss- joined,
AlexDani` joined,
AlexDaniel left
03:23
sergot_ joined,
markk_ joined,
pecastro1 joined,
ilmari_ joined,
atacama_ joined
03:24
khagan_ joined,
albino_ joined
03:25
nbg23 joined,
Cabanossi left,
Cabanoss- is now known as Cabanossi,
peteretep left,
edenc left,
pecastro left,
dalek left,
sergot left,
markk left,
dylanwh left,
mohae_ left,
SmokeMachine____ left,
nbg left
03:26
DrParis left,
atacama left,
sQuEE left,
Xliff left,
committable6 left,
khagan left,
SourceBaby joined,
dalek joined,
synopsebot6 joined,
ChanServ sets mode: +v dalek,
zostay_ is now known as zostay,
dylanwh joined,
peteretep_ is now known as peteretep
03:27
mcmillhj joined
03:28
vike joined,
geekosaur joined
03:29
BuildTheRobots left,
broquaint joined,
SmokeMachine____ joined
03:32
DrParis joined,
sftp joined,
timeless joined,
mcmillhj left,
BuildTheRobots joined
03:34
adu left
|
|||
grondilu | so I'm trying to see if I'm not too dumb to use NativeCall. | 03:36 | |
03:36
kurahaupo joined,
TEttinger left
|
|||
grondilu | so I put this line in a test.c file: | 03:36 | |
int add(int a, int b) { return a + b; } | 03:37 | ||
I compile it as such: | |||
$ gcc -shared -c test.c -o libtest.so | |||
and then I try: | |||
03:38
Guest6604 is now known as konobi,
mcmillhj joined
|
|||
grondilu | $ perl6 -e 'use NativeCall; sub add(int64, int64 --> int64) is | 03:38 | |
native<./test> {...}; say add(1, 2);' | |||
and it fails | |||
with: | |||
Cannot locate native library '/home/grondilu/libtest.so': /home/grondilu/libtest.so: only ET_DYN and ET_EXEC can be loaded | 03:39 | ||
03:39
TEttinger joined
|
|||
grondilu | and I feel like that: | 03:39 | |
i1.kym-cdn.com/photos/images/facebo...65/b7e.jpg | |||
oh wait, probably wrong gcc arguments | 03:40 | ||
geekosaur | grondilu, I think you need a bit more than that to make a shared object | ||
my guess is it's an ordinary object file (.o) | 03:41 | ||
03:43
mcmillhj left
|
|||
grondilu | oh yeah | 03:43 | |
first: | |||
$ gcc -c test.c | |||
then: | |||
03:43
kurahaupo left
|
|||
grondilu | $ gcc -shared -o libtest.so test.o | 03:43 | |
03:43
kaare_ joined
|
|||
geekosaur | first gcc needs -fPIC | 03:44 | |
(you can get away without it on 32-bit x86 linux, but you should not rely on this. notably, you *must* use PIC on 64-bit) | |||
you also need -Wl,-soname,libtest.so.1 on the second one | |||
which is the secret sauce that makes ld generate a shared object | 03:45 | ||
03:45
autarch left
|
|||
geekosaur | (an ET_DYN, as your error message put it) | 03:46 | |
03:49
autarch joined
|
|||
Xliff_ | FEH! | 03:52 | |
perl6 -Ilib --stagestats -e 'use Color::Names; dd ::("Color::Names::Cloford::%Colors"){"gray42"}' --> works | |||
Xliff_ headdesks | |||
timotimo: ^^ | |||
03:53
mcmillhj joined
03:54
setty1 left
03:56
gfldex left
03:58
mcmillhj left
|
|||
Xliff_ | Can someone tell me why this doesn't work? | 03:58 | |
github.com/Xliff/p6-color-names/bl...mes.pm#L34 | |||
grondilu | m: package Foo {}; require Foo; | 03:59 | |
camelia | rakudo-moar 6a8278: OUTPUT«Could not find Foo at line 0 in: /home/camelia/.perl6 /home/camelia/rakudo-m-inst-1/share/perl6/site /home/camelia/rakudo-m-inst-1/share/perl6/vendor /home/camelia/rakudo-m-inst-1/share/perl6 CompUnit::Repository::AbsolutePath…» | ||
Xliff_ | Attempting to use Color::Names with that uncommented yields "Cannot invoke this object (REPR: Null; VMNull)". I have not yet been able to golf a smaller use case. | ||
geekosaur | pretty much any time you get that error from something in a phaser, you're hitting a version of the bug I pointed to earlier | 04:00 | |
where it's trying to use a context that the compiler didn't save as part of the phaser | |||
04:03
mcmillhj joined
04:04
pierre_ joined
04:06
Cabanossi left
04:08
mcmillhj left
04:09
Cabanossi joined
|
|||
Xliff_ | geekosaur, should I RT and point to the repo since I can't golf it down further? | 04:16 | |
geekosaur | probably, yes | 04:17 | |
Xliff_ | kk | ||
geekosaur | I expect it'll just get added to that list of null-SC tickets | ||
until someone can figure out a better way to handle it that doesn't need special handling every time someone trips over this | 04:18 | ||
Xliff_ | HAH! | 04:21 | |
Golfed. | |||
04:23
khw left
|
|||
geekosaur | so, what's happening is, when the compiler generates bytecode, it does so in a thing called a serialization context. every module has its own SC, and phasers also get their own independent SCs because they run at different times than the module does. | 04:24 | |
Xliff_ | Dammit. | 04:25 | |
geekosaur | the SC for a phaser is thrown away after the code for the phaser is compiled. but if you do certain things in the phaser, the generated code wants to add things to the SC at runtime (imported symbols, in this case). but the compiler threw the SC away and its pointer is VMNull | ||
Xliff_ | Can someone reset this from perl5 to perl6? | ||
rt.perl.org/Ticket/Display.html?id...1a40b383a8 | |||
geekosaur | ...and I think you don't even want to add to that SC, you want to add to the module's SC, which is not something the compiler currently deals with very well if at all | 04:26 | |
so, this is a fairly hairy class of internal compiler bug | |||
Xliff_ | grrr... I can't change the details in my own ticket! :P | 04:27 | |
I can't even DELETE my ticket so I can re-create it properly. *sigh* | 04:29 | ||
Ah well. I've commented. It's in there. | |||
geekosaur: Ouch. I get it. Maybe selectively throw away the SC if certain op codes are present (ala "require" or "use") | 04:31 | ||
But I guess that opens its own can of works. | |||
s/works/worms/ | |||
geekosaur | see the second part, it needs to serialize what it's compiling to the compile time SC but store the module's main SC as the runtime SC. and make sure the two are compatible. | ||
jnthn could tell you more (and correct any errors in my understanding), but generally it's a tangled mess that conflates compile time and runtime in bad ways | 04:32 | ||
04:41
mcmillhj joined,
pecastro_ left
04:45
mcmillhj left
04:49
NeuralAnomaly joined,
aindilis joined
04:54
BenGoldberg left
|
|||
NeuralAnomaly | New blog post: "Open Source Projects: When Ideas Meet Reality": perl6.party/post/Open-Source-Projec...et-Reality | 04:57 | |
04:59
mcmillhj joined,
pierre_ left
05:02
NeuralAnomaly left
|
|||
Xliff_ | Hrm. | 05:03 | |
Koans? | |||
05:04
mcmillhj left
|
|||
Xliff_ | The Java koans are weird. | 05:06 | |
I wonder if the extensive use of "__" is there to encourage people to figure out what is supposed to happen and replace it with the answer. | 05:07 | ||
geekosaur: So, in the short term, you would recommend me trying to refactor this code without a phaser? | 05:09 | ||
The only other way I think this would work is if I could add my behavior to the default EXPORT(). | 05:10 | ||
geekosaur | that's probably the easiest way that will get you something working | ||
Xliff_ | Otherwise I'd have to call an extra sub to init things, and that would be sub-optimal, but as you say, it would work. | 05:11 | |
geekosaur: Do you know anything about the EXPORT mechanics? | |||
geekosaur | not really, no | 05:12 | |
Xliff_ | kk | ||
Any suggestions as to who to ask? | |||
jnthn perhaps (although he has enough on his plate!) | |||
05:13
cibs left,
mcmillhj joined
05:15
cibs joined
|
|||
timotimo | i know a bit about the mechanics | 05:15 | |
what do you need to know? | |||
05:18
mcmillhj left
05:23
pierre_ joined,
ufobat joined
|
|||
Xliff_ | timotimo: I figured out my mistake earlier. As you suspected, it was something silly. | 05:26 | |
Re: EXPORT. Is there any way I can add custom behavior to the default? | 05:27 | ||
Maybe redefine and use callsame()? | |||
or would that be nextsame() | |||
Please note that this would be a hack to work around the fact that I can't use INIT or BEGIN to do what I need. | 05:28 | ||
timotimo | i don't think there's a default EXPORT | ||
just the difference between having no export and having any export? | |||
Xliff_ | Hrm. | ||
OK. Lemme read up on it. | |||
I will probably have to manually emulate. | 05:29 | ||
timotimo | the last time i looked a bit more into that whole thing was long before the whole CompUnit Repo stuff | ||
Xliff_ | Right. | ||
timotimo | i wonder if you find the EXPORT:: in the module even before "use"ing | ||
Xliff_ | perl6 -Ilib --stagestats -e 'use Color::Names; dd ::("Color::Names::Cloford::%Colors"){"gray42"}' --> works | ||
^^ | 05:30 | ||
/o\ | |||
timotimo | did you use grey instead of gray the whole time? | 05:32 | |
Xliff_ | Yes. | 05:35 | |
timotimo | fantastic \o/ | ||
Xliff_ | LOL | ||
Well crap... require in EXPORT() gives the same error. | 05:36 | ||
timotimo | what error are you getting? | ||
Xliff_ | Cannot invoke this object (REPR: Null; VMNull) | ||
timotimo | what are you requiring in export for? | ||
Xliff_ | Well, I'm trying to abstract sub packages behind a main package. | 05:37 | |
I have Color::Names. I don't really want the user to have to worry about needing "Color::Names::Crayola" or "Color::Names::Cloford" | 05:38 | ||
timotimo | btw, since your packages all just include that single hash every time, i'm almost going to recommend loading the data from %*RESOURCES at EXPORT time | ||
is it really important to you that you're not just loading all the other modules in your top-level module? | |||
05:38
mcmillhj joined
|
|||
Xliff_ | *sigh* | 05:38 | |
I guess I could do that. | |||
timotimo | hehe | ||
let me check out your code and have a look-see | 05:39 | ||
Xliff_ | Originally I wanted it to be selectable. So that the end user, if they looked at the nitty-gritty and didn't want collisions, could avoid it. | ||
timotimo | OK, so you were going for something like "use Color::Names 'crayons'"? | ||
Xliff_ | And also so people could submit PRs and have the new modules automatically picked up. | 05:40 | |
05:40
TEttinger left
|
|||
Xliff_ | timotimo: Yes. Exactly. | 05:40 | |
timotimo | and it's not acceptable to use import tags? | ||
Xliff_ | or "use Color::Names" (semantically equivalent to "use Color::Names 'all') | ||
timotimo | oh wait what is this? | 05:41 | |
Xliff_ | I'd rather not have all of that data cluttering up Color::Names. | ||
timotimo | what are you going through the repo chain like that for? | ||
Xliff_ | LOL | ||
I could probably do that better with %*RESOURCES when I understand what it does. | |||
That code finds the Color::Names directory and grabs all of the submodules. | 05:42 | ||
Like I said. I didn't want the user to NEED to know all of the package names if they didn't want to worry about it. | |||
I will admit this is probably overthinking. | |||
timotimo | i'm pretty sure that's not the way to do it :) | ||
05:43
mcmillhj left
|
|||
Xliff_ | Well I wouldn't have known it was not the way to do it until I tried doing it.... right?! =) | 05:43 | |
So I have avoided trying to grok %*RESOURCES because last time I looked, the docs were light on explanation. | 05:44 | ||
05:44
TEttinger joined
|
|||
Xliff_ | I could then move all that crap to EXPORT() or some such. | 05:44 | |
But hey... I now know how to find all of the include paths. | 05:45 | ||
timotimo | well, resources is just a section of the meta.json that you put files into that you later want to be able to grab out of the RESOURCES constant | ||
Xliff_ | OH! | ||
Yeah. I haven't gotten to the META.json part, yet. | 05:46 | ||
(maybe I should add that. | |||
) | |||
timotimo | well, if you don't have a meta.json, things are going to be very difficult with regards to moduley stuff | ||
Xliff_ | I usually don't worry about that until I've finished coding. | ||
timotimo | if you don't have one, your files are probably going to be considered "just a bunch of random files" | ||
Xliff_ | OK. So "Start with META.json" -- got it. | 05:47 | |
timotimo | hm, gtk-simple is not a good example for RESOURCES | ||
Xliff_ | LOL!~ | ||
I looked there! | |||
timotimo | where'd the "every perl6 module" thing go; i swear i had it cloned on my machine at one point | 05:48 | |
Xliff_ | What? Ecosystem? | ||
timotimo | github.com/moritz/perl6-all-modules | ||
no | |||
every perl6 module we have in the ecosystem in one folder | |||
Xliff_ | Oh wow! | 05:49 | |
Good to know! | |||
timotimo | also, i should have said %?RESOURCES the whole time. | ||
Xliff_ | LOL! | 05:51 | |
Ooh... Zoffy has a Color class. | |||
timotimo | i was hoping i could find a cool example of export tags | ||
Xliff_ | I may want to add optional support for that. | ||
So I guess I could try "require Color" CATCH if it doesn't exist? | 05:52 | ||
timotimo | m: try require Foo::Bar::Baz; say Foo::Bar::Baz::.defined | ||
camelia | rakudo-moar 6a8278: OUTPUT«Could not find symbol '&Baz' in block <unit> at <tmp> line 1Actually thrown at: in block <unit> at <tmp> line 1» | ||
timotimo | oh, right | 05:53 | |
m: try require Foo::Bar::Baz '&bazz'; say &bazz.defined | |||
camelia | rakudo-moar 6a8278: OUTPUT«False» | ||
timotimo | m: try require Test '&is'; say &is.defined | ||
camelia | rakudo-moar 6a8278: OUTPUT«False» | ||
timotimo | well, that's not how! | ||
Xliff_ | :( | ||
timotimo | m: try require Test '&is'; say is | ||
camelia | rakudo-moar 6a8278: OUTPUT«Cannot invoke this object (REPR: Uninstantiable; Callable) in block <unit> at <tmp> line 1» | ||
timotimo | m: require Test '&is'; say is | ||
camelia | rakudo-moar 6a8278: OUTPUT«Cannot resolve caller is(...); none of these signatures match: (Mu $got, Mu:U $expected, $desc = "") (Mu $got, Mu:D $expected, $desc = "") in block <unit> at <tmp> line 1» | ||
timotimo | m: try require Test '&is'; say is 1, 2, "whoa"; | 05:54 | |
camelia | rakudo-moar 6a8278: OUTPUT«Cannot invoke this object (REPR: Uninstantiable; Callable) in block <unit> at <tmp> line 1» | ||
timotimo | m: say (try require Test).perl; | ||
camelia | rakudo-moar 6a8278: OUTPUT«Test» | ||
timotimo | m: say (try require BazQuux).perl; | ||
camelia | rakudo-moar 6a8278: OUTPUT«Nil» | ||
timotimo | that's probably the easiest way to get at it | ||
Xliff_ | Cool! | ||
timotimo | m: say (try require BazQuux)::.keys; | ||
camelia | rakudo-moar 6a8278: OUTPUT«5===SORRY!5=== Error while compiling <tmp>Confusedat <tmp>:1------> 3say (try require BazQuux):7⏏5:.keys; expecting any of: colon pair» | ||
timotimo | m: say (try require BazQuux).keys; | ||
camelia | rakudo-moar 6a8278: OUTPUT«()» | ||
timotimo | m: say (try require Test).keys; | ||
camelia | rakudo-moar 6a8278: OUTPUT«()» | ||
timotimo | that's what i meant to copy-paste | ||
hm, but that's not it | 05:55 | ||
m: say (try require Test).WHAT.perl; | |||
camelia | rakudo-moar 6a8278: OUTPUT«Test» | ||
timotimo | ... right | ||
i haven't done enough with modules and packages at all | |||
Xliff_ | m: say (try require BazQuux).WHAT.perl | ||
camelia | rakudo-moar 6a8278: OUTPUT«Nil» | ||
timotimo | m: say (try require Test); say Test::.keys; | ||
camelia | rakudo-moar 6a8278: OUTPUT«5===SORRY!5=== Error while compiling <tmp>Undeclared name: Test used at line 1» | ||
timotimo | m: say (try require Test); say GLOBALish::Test::.keys; | ||
camelia | rakudo-moar 6a8278: OUTPUT«(Test)Could not find symbol '&Test' in block <unit> at <tmp> line 1Actually thrown at: in block <unit> at <tmp> line 1» | ||
timotimo | m: say (try require Test); say GLOBAL::Test::.keys; | ||
camelia | rakudo-moar 6a8278: OUTPUT«(Test)(&todo_output EXPORT &failure_output &output)» | ||
timotimo | that's closer to it | ||
m: say (try require Test); say GLOBAL::Test::EXPORT::.keys; | |||
camelia | rakudo-moar 6a8278: OUTPUT«(Test)(DEFAULT ALL)» | ||
timotimo | m: say (try require Test); say GLOBAL::Test::EXPORT::DEFAULT::.keys; | 05:56 | |
camelia | rakudo-moar 6a8278: OUTPUT«(Test)(&isnt &plan &pass &cmp-ok &flunk &does-ok &subtest &unlike &like &use-ok &todo &skip-rest &eval-dies-ok &is-deeply &throws-like &ok &is &diag &done-testing &bail-out &is-approx &skip &dies-ok &lives-ok &eval-lives-ok &MONKEY-SEE-NO-EVAL &nok &is_…» | ||
timotimo | but relying on require putting stuff into GLOBAL is not going to stay around, i believe | ||
Xliff_ | I like the .WHAT.perl version | ||
timotimo | pssh, i'm sleep-deprived | ||
nine is working on making imports properly lexical | |||
Xliff_ | Simple and probably more correct than checking EXPORT. | ||
But this has been helpful, timotimo++ | 05:57 | ||
05:57
mcmillhj joined
|
|||
timotimo | if anything, you probably got a little laugh out of me | 05:59 | |
Xliff_ | Nah. | ||
Seriously... nothing could be worse than "grey" vs "gray" | |||
:p | |||
timotimo | :) | 06:00 | |
Xliff_ | m: say (try require BazQuux).defined | ||
camelia | rakudo-moar 6a8278: OUTPUT«False» | ||
Xliff_ | m: say (try require Test).defined | ||
camelia | rakudo-moar 6a8278: OUTPUT«False» | ||
timotimo | i have cravings for things but it's sunday so grocery shops won't open :( | ||
Xliff_ | Ouch. | ||
Craving for what? | |||
And damn... delivery here is done for the night. 2am | |||
timotimo | strawberry milkshake ... or something like that | 06:01 | |
all i ever drink at home is tap water ... i'm mostly completely fine with that, but sometimes it ain't enough | |||
Xliff_ | HO! No! Some places are open until 4am for Sat. | ||
\o/ | |||
06:02
mcmillhj left
|
|||
Xliff_ | But no milkshakes. :( | 06:02 | |
Dammit! Missing 4¢ from delivery minimum! | 06:04 | ||
Xliff_ shakes fist. | |||
timotimo | milkshake fist? | ||
Xliff_ | Stop it! | 06:05 | |
Darn it... no milk. | |||
timotimo | i love it when i'm just randomly clicking through pages of a tumblr and suddenly the theme is completely differend and at the very beginning there's just some random code leaking out | ||
Xliff_ | I have everything else. | ||
06:05
TEttinger left
|
|||
Xliff_ avoids social media. | 06:05 | ||
What random tumblr did you find with code? | 06:06 | ||
timotimo | oh, no, that's actual code that's supposed to be configuring the theme | ||
it's just spilling out at the seams, because something somewhere in the pipeline sprung a leak | |||
Xliff_ | I don't know why, but I equate "social media" as the internet equivalent of "reality tv" | ||
Oh, LOL! | |||
OK. So I doubled my order of chips. Delivery inbound. Buffalo wings... MMMMMMMm | 06:07 | ||
timotimo | www.youtube.com/watch?v=p-R1O7FN3yI - it started out with this cute loopable video and it went on from there with pretty/stimulating/satisfying gifs and vines and such | ||
Xliff_ | timotimo, will %?RESOURCES work from module source tree (ie not installed) | 06:08 | |
timotimo | rakudo will pick up META.json in not installed modules, i believe | ||
i don't remember the exact way it works | |||
Xliff_ | Cool. | ||
rakudo++ | |||
06:08
mcmillhj joined
|
|||
Xliff_ | m: say (try require Test).WHAT.perl | 06:09 | |
camelia | rakudo-moar 6a8278: OUTPUT«Test» | ||
timotimo | i hope it actually does and i'm not just imagining things again :D | ||
Xliff_ | m: say (try require Test).WHAT | ||
camelia | rakudo-moar 6a8278: OUTPUT«(Test)» | ||
Xliff_ | m: say (try require Test) | ||
camelia | rakudo-moar 6a8278: OUTPUT«(Test)» | ||
Xliff_ | m: say (try require Test).defined | ||
camelia | rakudo-moar 6a8278: OUTPUT«False» | ||
Xliff_ | Oh. Type object. | ||
timotimo needs sleep... BADLY! | |||
=) | 06:10 | ||
Or is that "food".... or is that both "sleep" and "food"? | |||
Or should we just settle with "milkshake"?? | |||
timotimo | i need sloop | ||
Xliff_ | Because I wouldn't mind all three right now. | ||
sloop.defined --> False | 06:11 | ||
timotimo | at this point, the plural of sloop would just be pure luxury | ||
sloop is the singular of sleep | |||
just like shoop is the singular of sheep | |||
and foot is the singular of feet | |||
Xliff_ | I disbeliefe. | ||
s/fe/ve/ | |||
It sounds need, though. | |||
timotimo | doesn't make it any less truo! | ||
... true! | |||
Xliff_ | ROFL | ||
If it's dark will you be eaten by a gruo? | 06:12 | ||
timotimo | it's not dark. it's 8am. sun's already up. | ||
Xliff_ | Do you postdate that reference? | ||
en.wikipedia.org/wiki/Grue_(monster) | 06:13 | ||
timotimo | hm? | ||
06:13
mcmillhj left
|
|||
timotimo | oh. no, i've seen grues referenced often enough | 06:13 | |
Xliff_ | Ah. | ||
timotimo | i haven't played the original that had it. some text adventure i believe? | ||
06:13
wamba joined
|
|||
Xliff_ | Zork | 06:13 | |
And I have. | |||
timotimo | ah. *the* text adventure | ||
Xliff_ | When it was released! | ||
And now I have dated myself. :P | 06:14 | ||
timotimo | Zork McCorken and Allen the MorndBornder, right? | ||
06:14
TEttinger joined
|
|||
Xliff_ | en.wikipedia.org/wiki/Zork | 06:14 | |
timotimo | i know, i know :) | ||
Xliff_ | I don't know where you got "McCorken" and "MorndBornder" though. | 06:15 | |
timotimo | Zak McKraken and the Alien Mindbenders | ||
Xliff_ | Ah! | ||
Yeah. I knew that! | |||
Now I need to think of something new for SVG::Plot. | 06:16 | ||
06:17
pierre_ left
|
|||
timotimo | ah, the color names thing was for svg::plot because svg supports these color names natively? | 06:21 | |
06:21
CIAvash joined
|
|||
Xliff_ | No | 06:30 | |
timotimo | no? | 06:31 | |
Xliff_ | Came from working on SVG::Plot examples and me having to look up color charts on the web to get the hex codes. | ||
timotimo | oh, ok! | ||
are the plots benchable outputs still unreadable on gist because of the transparent background? | |||
oh, wait ... that's probably only on my laptop because i have the "dark github" style on there! | |||
Xliff_ | LOL | ||
I use that too. | 06:32 | ||
I didn't know there were benchable outputs. | |||
06:32
skids left
|
|||
timotimo | oh? | 06:33 | |
.seen benchable | |||
yoleaux | I saw benchable 11 Aug 2016 12:25Z in #perl6: <benchable> unmatched}: ¦«sleep»:Cannot find this revision | ||
timotimo | gist.github.com/Whateverable/ee017...332eaefd62 | ||
i'm not sure why it says "is invalid so it cannot be displayed" | 06:34 | ||
gist.github.com/Whateverable/5df6e...2e37cc5df6 | |||
there we go, we have an example | |||
Xliff_ | That worked. | ||
Hum.... how was that graph generated? | 06:35 | ||
Is that something benchable does? | |||
timotimo | yeah, i believe it uses SVG::Plot | 06:36 | |
Xliff_ | Ah.... plots the results of "releases my @a = (^15).combinations(3); my $a = @a.elems" | ||
timotimo | no, it plots the timings of that code | ||
Xliff_ | Oh.. for each release. | ||
timotimo | the results from that code would ideally be the same no matter what release you use | ||
Xliff_ | Well... if rakudo was stable and not in the middle of optimizations. | 06:37 | |
timotimo | optimizations should not change the amount of combinations of 3 numbers between 0 and 14 you can get | 06:38 | |
Xliff_ | Well.. optional support for Color object added. I think it will break the other methods, though. | ||
Actually no... it's fine. | |||
Now I just need to get all of this EXPORT stuff sorted. | 06:39 | ||
I really want selective loading.... but ... | |||
06:39
mcmillhj joined
|
|||
Xliff_ | Next stop... META.json | 06:40 | |
...After reading more Stross... and eating more Buffalo wings.... and sleep... and.... | |||
timotimo | if you read the color data in your EXPORT from %?RESOURCES, you wouldn't even need submodules any more | ||
and it'll be pre-compiled for you, too | |||
Xliff_ | Eh... how would I do that? | 06:41 | |
Put the color data in META.json?!? | |||
timotimo | no, of course not | ||
Xliff_ | <- conf00sled | ||
timotimo | the meta.json just lists the files that contain your easy-to-parse format for these color names to color values | ||
then EXPORT will check what colors the user wanted, open these resources files and parse, then give back enums or hashes or what-have-you | 06:42 | ||
Xliff_ | Ah! But the parsing! | ||
One of the design goals was to avoid parsing. | |||
Hence the submodules. | |||
timotimo | if it's just 4 space-separated strings per line, is that really "parsing"? :) | ||
Xliff_ | I may not be grokking what you are trying to say though. | ||
4? | 06:43 | ||
color hex r g b | |||
timotimo | ok, 5. whatever :) | ||
Xliff_ | throw X::OffByOne | 06:44 | |
It's a common coder ailment. ;) | |||
06:44
mcmillhj left
|
|||
timotimo | i didn't realize you had a hex representation in there | 06:44 | |
i would've just generated it from the color values, but *shrug* | |||
Xliff_ | Pre optimization. | ||
timotimo | also, as long as our color stuff doesn't actually support better color spaces and profiles, we won't be taken seriously. | ||
Xliff_ | I actually take the hex and generate the r g b when I create the submodules. | 06:45 | |
Look in gen/ | |||
timotimo | not everything is sRGB, you know | ||
Xliff_ | Yes. Which is why I quickly added support for Color object. | ||
timotimo | :) | ||
timotimo ran out of serious | |||
Xliff_ ran out of serious hours ago. | 06:46 | ||
About the time when I ran out of beer. | |||
Then I bought more beer. | |||
timotimo | we have a serious shortage. of serious. for serious. | ||
Xliff_ | (why is my glass empty?!) | ||
SRSLY!!! | |||
timotimo | i don't like beer. but i would have liked to share a few bottles of pear cider with my friend tonight | ||
Xliff_ | I also-s got rum to go with my coke... | 06:47 | |
Or is that coke to go with my rum. | |||
(why is my glass empty again!??) | |||
timotimo | i'll awayfrom my keyboard for a little bit | 06:49 | |
06:50
ufobat left
|
|||
Xliff_ | ok | 06:50 | |
I think I will too. | |||
Wings... Stross... RUM! | |||
06:58
mcmillhj joined
07:02
mcmillhj left
07:04
darutoko joined
07:08
mcmillhj joined
07:13
mcmillhj left
07:18
pecastro joined
07:28
canopus left
07:29
Rawriful joined
07:32
nadim joined
07:36
araujo__ joined
07:37
canopus joined,
araujo__ left
07:38
araujo__ joined
07:39
araujo_ left
07:40
firstdayonthejob joined
07:41
mcmillhj joined
07:43
labster joined
07:44
_slade_ left
07:45
mcmillhj left
|
|||
stmuk_ | www.youtube.com/watch?v=LfrlqxzeSSE | 07:46 | |
that seems to have all 10 hrs of the main room | 07:47 | ||
of YAPC | |||
07:54
mcmillhj joined
07:59
mcmillhj left
08:00
labster left
08:05
geraud left
08:08
mcmillhj joined
08:09
lizmat left,
setty1 joined
08:12
labster joined
08:13
mcmillhj left
08:14
wamba left
08:18
El_Che left
08:27
woolfy left
|
|||
Xliff_ | GAH! | 08:35 | |
"You cannot create an instance of this type (Color)" | |||
resulted from | |||
::("Color").new(:hex($c<hex>)) | |||
But this works | |||
timotimo | is it just a package? | 08:36 | |
Xliff_ | perl6 -e 'require Color; dd ::("Color").new(:hex("#ffffff"))' | ||
No. Color is an object. | |||
Hm....ah crap. Scope. | |||
timotimo | well, would you look at that | ||
masak | m: class Color { has $.hex }; say Color.new(:hex<#ffffff>) | 08:37 | |
camelia | rakudo-moar 6a8278: OUTPUT«Color.new(hex => "#ffffff")» | ||
masak | works here. | ||
m: class Color { has $.hex }; say ::("Color").new(:hex<#ffffff>) | |||
camelia | rakudo-moar 6a8278: OUTPUT«Color.new(hex => "#ffffff")» | ||
Xliff_ | I think this is messing things: | ||
if $obj.defined && !(try require ::("Color")).WHAT.perl.defined { | |||
die "Color module cannot be found."; | |||
} else { | |||
require ::("Color"); | |||
} | |||
masak | try without the `else`, perhaps? | 08:38 | |
also, I don't know offhand if `require` does any importing by default | |||
Xliff_ | The else is new. | ||
I would think the try would do it. | |||
But it does not.' | |||
timotimo | require will put your stuff into the lexical scope it's in | ||
that's also why you have to "try require" and not "try { require }" | |||
unless you use the return value of the try | 08:39 | ||
rather than relying on the thing being available in your scopes | |||
masak | oh, right. you're doing `require` twice | ||
Xliff_ | Right, but I get that error with and without the else. | ||
08:39
pecastro left
|
|||
timotimo | if you're gonna die anyway, why not put require ::("Color") further on the outside and check if the requirement was met, and die otherwise? | 08:40 | |
masak | (and, in general, be very suspicious of `try`) | ||
timotimo | do, with, or for. there is no try. | 08:41 | |
masak | `try` is the "oh look, I can put my hand on this stovetop -- it makes smoke but it doesn't hurt!" of error handling | ||
Xliff_ | Are you effing kidding me!??!? | ||
masak | no. | ||
Xliff_ | require Color if $colorSupport; | 08:42 | |
==> Cannot invoke this object (REPR: Null; VMNull) | |||
Xliff_ pulls hair. | |||
masak | Xliff_: if you can golf that, we might have something to rakudobug. | ||
Xliff_ | masak: Already done. | ||
rt.perl.org/Ticket/Display.html?id=129109 | 08:43 | ||
masak | reproduced locally. | ||
$ perl6 -Ilib -e'my $colorSupport = True; require Color if $colorSupport; say "hi"' | |||
===SORRY!=== | |||
Cannot invoke this object (REPR: Null; VMNull) | |||
Xliff_ | I'm now thinking it has nothing to do with phasers and everything to do with programatic require. | ||
masak adds the case with the `if` statements to that ticket | 08:44 | ||
Xliff_ | masak++ | ||
That thing has been biting me all day. | |||
(and my day should have long been over, by now) | 08:45 | ||
masak | seems eminently workaroundable, luckily. | ||
Xliff_ | However wings, Stross, and perl6 have been keeping me awake. | ||
Despite beer, rum and coke! | |||
masak: Workaround, you say? Do tell! ;) | 08:46 | ||
masak | just a feeling. | ||
Xliff_ is now playing: Eschaton - Imaginary Skies (Nemanoe Remix) | |||
Xliff_ bops | |||
masak | or put it like this: | ||
Woodi | hi today :) | 08:47 | |
Xliff_ | \o Woodi | ||
masak | the fact that `require Color` works but `require Color if $something` doesn't means that you can use the former and not hit the error. | ||
hi Woodi | |||
Woodi: you're mistaken, though: it's already tomorrow. | |||
today was yesterday :P | |||
Woodi | I'm trying zef and it wants put things into /usr/share... --to opotions don't want to put things into /usr/me/perl6... how to use zef ? | 08:48 | |
Xliff_ | masak: "require Color; ::("Color").new(:hex("#ffffff"))" --> You cannot create an instance of this type (Color) | 08:49 | |
Woodi | masak: I can agree with that cruel statement - today WAS yesterday :) | ||
Xliff_ | Woodi: But does that mean that today is really tomorrow? | ||
Woodi | Xliff_: not sure about tomorow :) | ||
Xliff_ | =) | 08:50 | |
Woodi | *tomorrow even | ||
masak .oO( jam to-morrow and jam yesterday -- but never jam today ) | 08:51 | ||
timotimo | Xliff_: do you remember the ::EXPORT::DEFAULT dance? | ||
how about you try to require Color and then ::Color::EXPORT::DEFAULT::Color.new? | |||
masak | maybe combined with setting `constant C = ::Color::EXPORT::DEFAULT::Color;`. | 08:52 | |
08:56
smls joined
08:57
mcmillhj joined
|
|||
Xliff_ | ::Color doesn't work. | 08:57 | |
GLOBAL::Color::EXPORT::DEFAULT doesn't work because Color is a class. | 09:00 | ||
09:02
mcmillhj left
|
|||
Xliff_ | s$ perl6 -Ilib -e 'require Color; dd GLOBAL::Color::.keys' | 09:02 | |
("ValidRGB",).Seq | |||
There should be something that can reference all Class objects. | |||
09:02
TEttinger left
|
|||
Xliff_ | s$ perl6 -Ilib -e 'require Color; dd GLOBAL::.keys' | 09:02 | |
Oops | 09:03 | ||
m: dd GLOBAL::.keys' | |||
camelia | rakudo-moar 6a8278: OUTPUT«5===SORRY!5=== Error while compiling <tmp>Two terms in a rowat <tmp>:1------> 3dd GLOBAL::.keys7⏏5' expecting any of: infix infix stopper postfix statement end statement modifier…» | ||
Xliff_ | m: dd GLOBAL::.keys;' | ||
camelia | rakudo-moar 6a8278: OUTPUT«5===SORRY!5=== Error while compiling <tmp>Unable to parse expression in single quotes; couldn't find final "'" at <tmp>:1------> 3dd GLOBAL::.keys;'7⏏5<EOL> expecting any of: single quotes term» | ||
Xliff_ | m: dd GLOBAL::.keys; | ||
camelia | rakudo-moar 6a8278: OUTPUT«().Seq» | ||
Xliff_ | Wheee! | ||
09:04
geraud joined
|
|||
masak | so it doesn't do any import | 09:06 | |
09:06
kaare_ left
09:07
TEttinger joined
|
|||
Xliff_ | Not for classes. | 09:09 | |
I thought Classes didn't need import. | |||
masak | you're saying that it imports some things, but not classes? | ||
Xliff_ | That's what it looks like. | 09:10 | |
masak | Xliff_: if you do `use`, then classes are definitely imported by default. | ||
Xliff_: I don't think I would expect the same with a bare `require`. | |||
Xliff_ | Now if I "use" it works. However "use" in a conditional sense is lexical. | ||
masak | yes, because `use` is BEGIN-time. | ||
Xliff_ | Right. We are saying the same thing. | ||
So how can I import a class given an already executed require()? | 09:11 | ||
Or access said class globally? | |||
09:13
mcmillhj joined
09:17
RabidGravy joined
09:18
mcmillhj left
|
|||
masak | reading S11, it seems `require Color <Color>;` might do the trick. | 09:21 | |
Xliff_ | Testing | 09:23 | |
"Trying to import from 'Color', but the following symbols are missing: Color" | 09:25 | ||
09:31
rindolf joined
09:33
antipsychiatry joined,
girafe joined,
antipsychiatry left
|
|||
nine | Wow...just woke up after ~ 12 hours of sleep | 09:35 | |
masak | nine: is this in any way connected to YAPC::Europe? :) | 09:38 | |
(which I hear was especially good this year, by the way) | |||
09:40
mvorg joined
|
|||
nine | masak: it does seem likely ;) | 09:40 | |
Nevertheless I'm looking forward to the Alpine Perl Workshop :) | 09:42 | ||
timotimo | xl, i got a milkshake | 10:00 | |
smls | We've exceeded 1400 open RT tickets... :S | 10:01 | |
10:03
mcmillhj joined,
espadrine joined
|
|||
timotimo | goo.gl/photos/FPqcTz5ceFjMi6Lg7 | 10:04 | |
10:05
pierre_ joined
10:09
mcmillhj left
|
|||
timotimo | imagine we didnt have enough users so our bug tracker was empty all the time | 10:10 | |
10:11
leont joined
10:21
lambd0x joined
|
|||
lambd0x | Hi everyone! | 10:21 | |
> my @a = <1 2 3 4>; sub test($num, *@tmp) { $num.say; }; say test(@a); | 10:25 | ||
m: my @a = <1 2 3 4>; sub test($num, *@tmp) { $num.say; }; say test(@a); | |||
camelia | rakudo-moar 6a8278: OUTPUT«[1 2 3 4]True» | ||
lambd0x | I wanted to know whether its possible to take a num from an array in test using random order. Is it? | 10:27 | |
10:27
TEttinger left
10:29
gfldex joined
10:30
mcmillhj joined
10:32
labster left
10:35
mcmillhj left
|
|||
titsuki | m: my @a = <1 2 3 4>; sub test($num, *@tmp) { $num.say; @tmp.say; }; test(|@a.pick: *); | 10:36 | |
camelia | rakudo-moar 6a8278: OUTPUT«3[4 2 1]» | ||
titsuki | m: my @a = <1 2 3 4>; sub test($num, *@tmp) { $num.say; @tmp.say; }; test(|@a.pick: *); | 10:37 | |
camelia | rakudo-moar 6a8278: OUTPUT«2[1 3 4]» | ||
titsuki | ambd0x: Is my answer sufficient for you ? | 10:39 | |
lambd0x | titsuki: It's perfect, I just am trying to undestand the meaning of '|' in front of @a.pick and ': *' | 10:41 | |
*understand. | |||
titsuki: could you explain it to me, please? | |||
titsuki | | means flatten | ||
m: sub test($num, *@temp){ say $num; }; test(1,2,3); | 10:42 | ||
camelia | rakudo-moar 6a8278: OUTPUT«1» | ||
10:42
setty1 left
|
|||
titsuki | m: sub test($num, *@temp){ say $num; }; test([1,2,3]); | 10:43 | |
camelia | rakudo-moar 6a8278: OUTPUT«[1 2 3]» | ||
lambd0x | titsuki: Ok, and the second means: pick every el. of the array? | ||
titsuki | yes | 10:44 | |
lambd0x | titsuki: awesome. Thank you :) | ||
titsuki | :) | ||
10:48
mcmillhj joined
10:51
n1lp7r joined
10:53
mcmillhj left
10:58
leont left,
pierre_ left
10:59
leont joined
|
|||
smls | Is `sub EXPORT` implemented in Rakudo? | 10:59 | |
I can't seem to get it to work... | 11:00 | ||
It says "no EXPORT sub, but you provided positional argument in the 'use' statement" even though I did declare an EXPORT sub in the `use`d module. | 11:02 | ||
11:08
cygx joined
|
|||
cygx | o/ | 11:08 | |
smls: you have to declare EXPORT in the mainline, ie outside any package/module/class declaration | 11:09 | ||
smls | cygx: Thanks! | 11:12 | |
11:16
eliasr joined
11:22
MasterDuke joined
11:27
BenGoldberg joined
|
|||
MasterDuke | Xliff_: there are a couple things that i can think of to add to SVG::Plot (if you're looking for ideas) | 11:29 | |
yoleaux | 27 Aug 2016 13:55Z <tbrowder> MasterDuke: thanks! | ||
MasterDuke | setting a background color, having the line plot also show ticks at the data points, option to put text at the data points, ability to modify the rotation of x/y labels (and customize them more in general), option to hover over the points and see the x/y coordinates | 11:30 | |
11:30
wamba joined
11:31
kaare_ joined
11:40
araujo__ left
|
|||
Xliff_ | \o/ | 11:40 | |
MasterDuke++ | |||
MasterDuke: Good ideas. Can you open an issue on the github page so I don't forget? | 11:41 | ||
11:41
araujo joined
|
|||
MasterDuke | sure | 11:41 | |
Xliff_ | Thanks. | ||
11:42
albino_ is now known as albongo
|
|||
Xliff_ | timotimo++ # Milkshake | 11:42 | |
11:42
Ven joined
|
|||
Xliff_ | Can I just say that Python SUCKS! | 11:42 | |
Really. I am trying to get something working that used to work and I am running into so many silly issues. | |||
Of course, I am a Python n00b, so that probably has something to do with it. | |||
mst | everything is terrible | 11:46 | |
MasterDuke | Xliff_: i just created a bunch of issues in SVG::Plot | 11:49 | |
11:51
Ven left
|
|||
Xliff_ | Thanks, MD | 11:51 | |
mst: You have no idea. | |||
PyQt5.... srsly?!? | |||
Pain. In. The. Ass. | 11:52 | ||
mst | for i in "foo", "bar": | ||
remove "bar" from the list and try not to break your code | |||
Xliff_ | mst: indenting.... | ||
mst | Xliff_: nope | 11:53 | |
for i in "foo",: | |||
Xliff_ | ┌∩┐(ಠ_ಠ)┌∩┐ | ||
mst | will go once round the loop with i set to "foo" | ||
for i in "foo": | |||
will iterate three times with i as "f", "o", "o" | |||
MANDATORY TRAILING COMMAS | |||
Xliff_ | 「(゚ペ) | 11:54 | |
Dude... when I pull out the emoticons... | |||
RUN! | |||
(why is my glass empty again... and is that daylight?!?) | |||
11:54
smls left
|
|||
Xliff_ is a vampire. The sun is out. Color him with "Why am I on fire White" | 11:55 | ||
11:56
mcmillhj joined
12:01
mcmillhj left
|
|||
timotimo | i liked pyqt, but that was when 4 was ... not out yet? | 12:01 | |
12:04
iH2O joined
12:07
leont left
12:10
Ven joined
|
|||
Xliff_ | Thing takes longer to compile than the Linux kernel! | 12:13 | |
MasterDuke | i liked PerlQT, but i think that was back in the QT3 days | ||
mst likes p3rl.org/Tkx.pm | 12:14 | ||
er | |||
mst likes p3rl.org/Tkx | |||
12:15
AlexDani` is now known as AlexDaniel
|
|||
Xliff_ | Then again... I think this is a uniproc Make | 12:15 | |
s/Make/Makefile/ | 12:16 | ||
It's been a long time since I've run into one of those. | |||
Xliff_ breaks and runs "make -j8" instead. | 12:17 | ||
Ahh... much better. | |||
12:17
iH2O left
|
|||
Xliff_ | And after all that, I still get a type error. *sigh* | 12:21 | |
So much for continuing my work on calibre. | |||
12:23
mcmillhj joined
12:26
n1lp7r left
|
|||
Xliff_ | Well... committed my changes. I will have to circle back another time. | 12:26 | |
12:27
committable6 joined
12:28
mcmillhj left
12:29
wamba left
12:31
pierre_ joined,
El_Che joined
12:35
leont joined
12:52
grondilu left
|
|||
dogbert17 experimentally drops pin ... | 12:56 | ||
looks as if the second code example is missing a few @'s docs.perl6.org/language/control#gather/take | 12:59 | ||
13:00
mcmillhj joined
|
|||
dalek | c: 288dcdb | (Jan-Olof Hendig)++ | doc/Language/control.pod6: Fixed broken code example |
13:04 | |
13:04
mcmillhj left
|
|||
Xliff_ | MasterDuke: SVG::Plots now support background color. See examples/bubbles.pl in the latest commit. | 13:06 | |
s/Plots/Plot/ | |||
timotimo | my fan is now unbearably meepy | 13:07 | |
but at least i have a laptop again | |||
13:07
MasterDuke left
|
|||
timotimo | however | 13:08 | |
now both pads rather than just the one are connected to the heatsink apparatus with thermal paste | |||
nine | I wonder if the best way to have a Perl program with a Qt UI would actually be to build the Qt UI in Qt Designer (or maybe KDE Develop) and have it access the Perl functionality via a network socket and a lot of JSON | 13:09 | |
13:11
mcmillhj joined
13:13
vendethiel left
13:16
mcmillhj left,
gfldex left
13:17
kurahaupo joined
|
|||
timotimo | holy fuck, i can watch a stream on twitch and instead of 79 degC on both measurement points i get just 55 degC | 13:22 | |
tbrowder | ref modules: Can anyone point to a complete description of the META json format for a module source dir? I particularly need to see how to handle binary dependencies that require downloading, building, and installing. I see how it's done in the travis file, but I assume neither zef nor panda use that. | 13:25 | |
timotimo | tbrowder: GTK::Simple has something. you'd find it in the Build.pm | 13:27 | |
Build.pm is where you put code that you want to run at module installation time | |||
mst | surely external non-perl6 deps are out of scope for that | 13:28 | |
I mean for META | |||
timotimo | at the moment, yes | ||
we might want to at some point be able to declare we want something | |||
though it'll not be possible to have it actually be picked up by any package managers | |||
that way lies cthulhu's resurrection | |||
mst | perl5 has barely started experimenting with that via CPAN::Plugin::Sysdeps | 13:29 | |
timotimo | resurrection may be the wrong word. i don't think cthulhu is actually dead? | ||
mst | only sleeping | ||
I would say "yes, in theory, it would be nice to do that, but I would be extremely suspicious of anybody who claims they have a solution to the problem" | |||
timotimo | yeah | ||
sounds about right | |||
mst | (actually, I think I *do* have a solution to the problem, but I'm very suspicious of myself there ;) | 13:30 | |
timotimo | we could build our own package manager and repositories for libraries! | ||
fork portage and just re-write it in perl6 | |||
a line-by-line port from python | |||
from python and bash* | |||
lambd0x | guys a quite doubt: junctions evals. expressions eagerly while the 'and, &&' operators do it in a lazy way? | ||
timotimo | and, &&, ... are what you call "short-circuiting" | 13:31 | |
they'll actually have a control-flow implication to them | |||
13:31
mcmillhj joined
|
|||
timotimo | the junction operators aren't special in any way, so they don't get to do short-circuiting | 13:32 | |
lambd0x | ok. | ||
timotimo | but when collapsing a junction to a single bool value (via "so"/"not" or "if"/"unless" and friends) it won't go through more values than it needs to | ||
lambd0x | I'm asking because I have two exprs to be avaluated as true and one of them is an array index that if goes to -1 shall return false. It works with '&&, and' but fail with 'all' so that's the reason? | 13:34 | |
tbrowder | timotimo: thanks! | ||
timotimo | that's the reason, yes | ||
lambd0x | timotimo: Would there be another way to perform this comparison in a shorter way? | 13:35 | |
13:36
mcmillhj left,
Deep_Thought joined
13:39
jameslenz joined
|
|||
timotimo | m: my @a; say @a[-1] // False | 13:39 | |
camelia | rakudo-moar d43ea0: OUTPUT«5===SORRY!5=== Error while compiling <tmp>Unsupported use of a negative -1 subscript to index from the end; in Perl 6 please use a function such as *-1at <tmp>:1------> 3my @a; say @a[-1]7⏏5 // False» | ||
timotimo | m: my @a; (try say @a[-1]) // False | ||
camelia | rakudo-moar d43ea0: OUTPUT«5===SORRY!5=== Error while compiling <tmp>Unsupported use of a negative -1 subscript to index from the end; in Perl 6 please use a function such as *-1at <tmp>:1------> 3my @a; (try say @a[-1]7⏏5) // False» | ||
timotimo | ah, compile-time error, of course | 13:40 | |
m: my $index = -1; my @a; (try say @a[$index]) // False | |||
camelia | ( no output ) | ||
timotimo | m: my $index = -1; my @a; say @a[$index] // False | ||
camelia | rakudo-moar d43ea0: OUTPUT«False» | ||
timotimo | m: my $index = -1; my @a; say (@a[$index] // False) | ||
camelia | rakudo-moar d43ea0: OUTPUT«False» | ||
timotimo | that's how i'd do it | ||
Xliff_ | "//" ?? | 13:43 | |
dalek | c: b72a2b3 | (Jan-Olof Hendig)++ | doc/Language/control.pod6: day-of-week returns values in the range 1..7, not 0..6 |
13:44 | |
lambd0x | timotimo: thanks you | ||
Xliff_ | Is that something similar to perl5 "a || b"? | ||
tadzik | it's similar to perl5's "a // b" :) | ||
Xliff_ | OK. So what is "//"/ | ||
Er.... s/\/$/?/ | 13:45 | ||
tadzik | if a is defined, it evals to a, otherwise to b | ||
Xliff_ | Ah. I always thought "||" did that. | ||
tadzik | it's close but not the same | ||
Xliff_ | "||" is boolean and "//" is defined? | ||
tadzik | correct | ||
Xliff_ | kk | 13:46 | |
tadzik | kinda :) | ||
Xliff_ | (dammit) | ||
tadzik | evalbot where art thou | ||
Xliff_ | Ok. So "correct enough for government work?" | ||
tadzik | haha | ||
Xliff_ | :) | ||
tadzik | well, it doesn't mean "defined" :) | 13:47 | |
Xliff_ | (my glass is empty again...) | ||
tadzik | ||: $a ? $a : $b | ||
//: defined $a ? $a : $b | |||
my $a = 0; my $b = 5; say $a || $b => 5 | |||
Xliff_ | Wouldn't that be "//: $a.defined ?? $a !! $b" 8-) | ||
tadzik | in perl6, yes | 13:48 | |
:) | |||
Xliff_ | hehe | ||
tadzik | consider default parameters to subs | ||
if you did $arg ||= 5, you'd overwrite the passed argument if it's 0 | |||
Xliff_ | Seriously, I may never go back to the default trinary again. | ||
tadzik | so //= 5 is a better fit | ||
Xliff_ | It took me so long to switch, though. | ||
I dread going back to Java or... (shudder) ... C++ | 13:49 | ||
tadzik | hehe | ||
I like going back to C | |||
Xliff_ | Feh. | ||
tadzik | it feels like taking your shirt of and chopping wood with your bare hands | ||
masak | Xliff_: in my experience, going back is rough the first few times | ||
tadzik | C++ is similar, except you mutilate yourself first and then cover your face with the blood of infants | ||
Xliff_ | It's not that I can't do it. It's that I'd rather not! | ||
masak | Xliff_: going back and *forth* is even rougher | ||
Xliff_ | masak++ | 13:50 | |
masak | Xliff_: I can't tell you how many times I've written things like `a ? b ! c` or `a ?? b :: c` | ||
Xliff_ | Your head becomes a racketball court. | ||
LOL! | |||
masak | Xliff_: ...but the good news is, it passes. at least it did for me. | ||
brain learns to compartmentalize, and choose the right one in the right environment. | |||
Xliff_ | Yeah. That's assuming you play enough games of racketball. The "walls" get callouses. | 13:51 | |
OK. You said it better than I did. | |||
masak | gosh darnit, now I'm *staring* at `a ? b ! c` and my brain is going "but that's correct... isn't it?" | ||
tadzik | :D | ||
Xliff_ | Hahaha! | ||
Sheesh. On a related topic, you know how long it took me to grok the difference between "x" and "xx"? | 13:52 | ||
masak | Xliff_: even more important is to grok why it has to be two ops in Perl 6. | ||
Xliff_ | That's what I mean. | ||
Was about a week and it was like a switch flipping. | 13:53 | ||
tadzik | I never remember which one's which, x and xx, always have to try :P | ||
Xliff_ | O I C goes brain | ||
13:53
Ven left
|
|||
tadzik | does anyone have a good mnemonic? | 13:53 | |
Xliff_ | x == Str, xx == Array | ||
masak | tadzik: oh? I have no problem at all distinguishing them. I wonder why. | ||
Xliff_ | Or if you really wanna be pedantic... | ||
x ~~ Str, xx ~~ Array | 13:54 | ||
cygx | .oO( number of 'x' == number of 'r' in typename) |
||
masak | cygx++ | ||
tadzik: there's your mnemonic | |||
tailgate | I guess I remember that xx looks more like an array than x | ||
tadzik | masak : well, I know what they mean, I just don't remember which one's for what | ||
masak .oO( Listrr ) | |||
tadzik | oh | ||
dalek | c: 8f50e70 | (Armand Halbert)++ | doc/Type/Range.pod6: Added method sum() to Range pod |
||
c: 5270805 | RabidGravy++ | doc/Type/Range.pod6: Merge pull request #863 from ahalbert/861 Added method sum() to Range pod |
|||
Xliff_ | cygx++ # Wow! That really works. Took me a bit. | ||
tadzik | if there's more than one x, then it's a collection | ||
ahahah | 13:55 | ||
Xliff_ | I like mine better though. | ||
tadzik | it took me even longer | ||
tailgate | then again, nobody's ever accused perl of having too few operators | ||
13:55
nadim_ joined
|
|||
Xliff_ | Oh yeah!! | 13:56 | |
Someone mentioned something about QT | |||
masak | tadzik: though logically, `xx` ought to be a Bool-based operator, considering all the prior art with && || ^^ ?? !! | 13:57 | |
Xliff_ | <nine> I wonder if the best way to have a Perl program with a Qt UI would actually be to build the Qt UI in Qt Designer (or maybe KDE Develop) and have it access the Perl functionality via a network socket and a lot of JSON | ||
masak | :P | ||
13:57
Ven joined
|
|||
Xliff_ | nine: How would that even work? | 13:57 | |
cygx | masak: but then, x should return a junction | ||
Xliff_ | Wouldn't it be better to write NativeCall bindings and write a pyuic equivalent in P6? | 13:58 | |
mst | doubtful | 13:59 | |
neither rakudo nor qt have pluggable event loops AFAIK | |||
Xliff_ | nine: I admit that there is a possibility that your idea would be workable in an order of magnitude faster than what I am suggesting. | ||
mst | so separate processes strikes me as likely to be less annoying | ||
otherwise they'll fight over e.g. signal handling | |||
Xliff_ | eep! | ||
14:00
nadim left
|
|||
mst | it's not hard to imagine how much fun that wouldn't be :) | 14:00 | |
14:00
nadim_ left,
nadim joined
|
|||
Xliff_ | I was hoping libqt would handle that and all we'd need is binding. | 14:00 | |
So much for that hope. | |||
mst | eh? | ||
tadzik | masak: that'd fit, yeah | ||
mst | point is, rakduo has a (UV) event loop, qt has its own event loop | ||
everything gets complicated at that point | 14:01 | ||
Xliff_ | mst: and QT's event loop isn't exposed by the QT API? | ||
tadzik | masak: also, two-letter operators are for Strings: eq, ne, lt, gt... xx? | ||
Xliff_ | tadzik: stop trying to confuse the issue!!! | ||
14:01
holyghost joined
|
|||
tadzik | xxxD | 14:01 | |
Xliff_ | ROFLMAO | ||
tadzik | did you notice the joke, I put xxx there to get more confusion on board | 14:02 | |
Xliff_ | That's what the added "MAO" was for. | ||
tadzik | much appreciated | 14:03 | |
Xliff_ | ====) | ||
tadzik | xxD is when you need to get more than one person laughing, while xD is just one person laughing longer | ||
Xliff_ | And this is a fist bump.... (๑˃̵ᴗ˂̵)و | 14:04 | |
14:04
mcmillhj joined
|
|||
mst | Xliff_: that's not my point | 14:04 | |
tadzik | ooh, that's going into ~/fatfaces, I didn't have that | 14:05 | |
mst | Xliff_: my point is that a two-process model would allow you to use all of rakudo's native event stuff for the perl6 code | ||
Xliff_ | (tadzik++)++ | ||
mst: Oooooo... and hence the not fun | |||
mst: You must pardon me. The emoticons have come out, my glass is empty, I've been up all night, and I've had to deal with fecking Python. | 14:06 | ||
tadzik | ooh, sweet karma for memeing | ||
Xliff_ | mst: So "I'm punchy" is putting it mildly. Also slow on the uptake. | ||
Did I mention slow? | |||
masak | on the uptake, yes. | 14:08 | |
Xliff_ | o(^▽^)o | ||
14:09
mcmillhj left
|
|||
Xliff_ | mcmillhj is having a rough time of it. | 14:09 | |
titsuki | m: loop (my $foo;0;){}; loop (my $foo;0;){} # is this a bug ? | 14:11 | |
camelia | rakudo-moar d43ea0: OUTPUT«Potential difficulties: Redeclaration of symbol $foo at <tmp>:1 ------> 3loop (my $foo;0;){}; loop (my $foo7⏏5;0;){} # is this a bug ?» | ||
nine | Xliff_: the trouble with Qt bindings has historically been that maintaining them actually seems to be quite a lot of work and onebody seemed to stick to it. | 14:14 | |
14:15
mcmillhj joined
|
|||
Xliff_ | nine: onebody? | 14:19 | |
14:20
mcmillhj left
|
|||
lambd0x | bpaste.net/show/6096c9c29b15 Is there a way to optimize this code, removing those two basic opers. atributed to two vars and directly doing it? I made some attempts but found no way so far... | 14:31 | |
14:32
mcmillhj joined
|
|||
timotimo | mixed tabs and spaces? :( | 14:35 | |
14:36
mcmillhj left
14:37
espadrine left
14:39
espadrine joined
|
|||
lambd0x | timotimo: Sorry the my code lost identation when pasting: bpaste.net/show/27109db27469 | 14:39 | |
*sorry ... | 14:40 | ||
14:46
mniip joined,
ChoHag joined
14:47
mcmillhj joined
|
|||
nine | Xliff_: also, since nowadays Qt UIs are usually written with Qt Quick (and it's Javascript language), there's already good infrastructure for separating front- and backend. | 14:48 | |
Xliff_: err...nobody of course :) | |||
timotimo | huh? | ||
are you sure anybody except mobile devs use qt quick for uis? | 14:49 | ||
nine | All of KDE? | 14:50 | |
timotimo | what? | ||
seriously? | |||
that's certainly news to me | |||
nine | That was one of the huge changes with KDE SC 5. The move to Qt 5 and reimplementation of a lot of UIs in Qt Quick. Qt Quick 2 to be precise AFAIK | 14:51 | |
Xliff_ boggles. | |||
Well... Javascript. And rakudo is getting a javascript VM, right? | |||
14:51
mcmillhj left
|
|||
Xliff_ | Not that will have much to do with it. | 14:52 | |
I think. | |||
nine | en.wikipedia.org/wiki/KDE_Plasma_5 "The graphical interface was fully migrated to QML, which uses OpenGL for hardware acceleration resulting in better performance and reduced power consumption." | ||
14:56
espadrine left
|
|||
leont | QML for GUI seems to make sense, we do it at work (though I'm not near that part of the code) | 14:57 | |
timotimo | wow | ||
i didn't know you can make anything more complex than a big box of text and one or two buttons with QML | 14:58 | ||
my brain just doesn't seem to work that way | |||
i tried to build an app with qml once. it failed horribly | |||
leont | IME QML apps have a nasty habit of compiling fine when missing essential dependencies, and then giving cryptic error messages, but it's great for speed of development | 14:59 | |
nine | QML is Qt catching up with the flexibility of XAML. Except that it's a lot less XML and more usable. Both are just a big step away from having a fixed list of widgets. | ||
15:10
skids joined
|
|||
Xliff_ finally passes out.... | 15:15 | ||
15:15
Xliff_ is now known as Xliff_zzzzz
|
|||
moritz | \o | 15:25 | |
15:34
Ven left
15:37
Ven joined
15:38
cognominal left
15:39
Ven left,
setty1 joined
15:40
n1lp7r joined
15:54
pmurias joined
15:55
wamba joined
|
|||
harmil | Sometimes I just look up at the stars... | 15:56 | |
m: say (1, 2, 3, * * * ** * ... *)[^5] | |||
camelia | rakudo-moar d43ea0: OUTPUT«(1 2 3 8 13122)» | ||
pmurias | timotimo: re extra deps being cthulu insane, why is just installing system packages (with confirmation from the user) so crazy? | ||
s/extra/external/ | 15:57 | ||
leont | It's hard to support in any portable manner | 15:58 | |
And it's not something and ordinary user can do, usually | |||
timotimo | pmurias, what is the package called? | 16:00 | |
BenGoldberg | m: (1*2**3, 2*3**8, 3*8**13122).say; | 16:02 | |
camelia | rakudo-moar d43ea0: OUTPUT«(8 13122 6667001656068882507949166491097252226058888627222166005887173256462278906983053370146466725548450482632931634331353515641968601006235950862408107856368826639386598694870796685532822659501609002312671269415569151459443538320419362567186388828519037…» | ||
16:03
pierre_ left
16:05
vendethiel joined,
khw joined
|
|||
timotimo | that eacalated quickly | 16:05 | |
16:09
cygx left
16:18
lizmat joined
16:22
lambd0x left,
eliasr left
|
|||
pmurias | timotimo: the module authors can just provide the package name for the popular distros (like debian) | 16:24 | |
timotimo: often when installing stuff (and modules from cpan) I just look in the docs and install the debian packages they mention | 16:25 | ||
harmil | BenGoldberg: Yeah, there's a reason I only output the 4th element of that list :) | ||
er fifth | |||
Also note that the 7th element blows up Perl :) | 16:26 | ||
m: say (1, 2, 3, * * * ** * ... *)[^7] | |||
camelia | rakudo-moar d43ea0: OUTPUT«Numeric overflow in whatevercode at <tmp> line 1 in block <unit> at <tmp> line 1Actually thrown at: in block <unit> at <tmp> line 1» | ||
pmurias | timotimo: or I'm installing a package with a somewhat related name and a -dev prefix without a particularly deep understanding about it | 16:27 | |
16:35
jonadab joined
|
|||
pmurias | timotimo: specifiying once for all platforms doesn't seems doable in a sane manner | 16:37 | |
timotimo | quite. | 16:41 | |
16:49
Cabanossi left
|
|||
dalek | c: e7c5a4a | (Jan-Olof Hendig)++ | doc/Language/control.pod6: Fixed typos |
16:50 | |
pmurias | CPAN::Plugin::Sysdeps++ seems just have a mapping between modules and the required package in different system managers | 16:51 | |
16:55
aindilis left
16:56
salva joined,
Purcell joined
17:01
Purcell left
|
|||
ugexe | i dont think a meta field for distro packages really fits the scope of rakudo though; rather some 3rd party module would just define their own format and you'd build-depends *that* | 17:11 | |
stmuk_ wonders if zef could support prove6 | 17:14 | ||
M-Illandan | where is zef from? It's the new panda? | ||
ugexe | stmuk_: it does github.com/ugexe/zef/blob/master/l...ce/TAP.pm6 (havent tested in a few months though) | 17:15 | |
17:16
mvorg left
|
|||
ugexe | to enable you either edit the resources/config.json or do `--/prove --/default-tester` to disable the 2 testers that are tried first | 17:17 | |
stmuk_ | ah! | ||
Woodi | ugexe: can I install modules via zef into eg. ~/perl6 dir ? | 17:18 | |
ugexe | i've kept regular prove as the default for now because it was significantly faster. maybe not anymore | ||
17:18
domidumont joined
|
|||
ugexe | Woodi: github.com/ugexe/zef#custom-instal...-locations | 17:18 | |
Woodi | ugexe: thanx :) | 17:20 | |
ugexe | Could use a config option to set the default still though | ||
Woodi | how I miss that ? I checked readme first... | 17:21 | |
17:23
domidumont left,
domidumont joined
17:24
vendethiel left
17:26
zacts joined
17:32
baest_ left
17:35
grondilu joined
17:37
labster joined,
baest joined
17:38
Deep_Thought left,
espadrine joined
17:42
domidumont left
|
|||
grondilu is reading about Vulkan and considers adding its API to the most wanted modules list. | 17:44 | ||
it seems to have a clean C API (and in surprisingly few different header files) | |||
BenGoldberg | m: sub hailstone-length(Int $n) is cached { $n == 1 ?? 1 !! $n +& 1 ?? 1+hailstone-length($n * 3 + 1) !! 1+hailstone-length($n div 2) }; say hailstone-length(27); | 17:46 | |
camelia | rakudo-moar d43ea0: OUTPUT«5===SORRY!5=== Error while compiling <tmp>Use of the 'is cached' trait is experimental; please 'use experimental :cached'at <tmp>:1» | ||
BenGoldberg | m: use experimental :cached; sub hailstone-length(Int $n) is cached { $n == 1 ?? 1 !! $n +& 1 ?? 1+hailstone-length($n * 3 + 1) !! 1+hailstone-length($n div 2) }; say hailstone-length(27); | 17:47 | |
camelia | rakudo-moar d43ea0: OUTPUT«112» | ||
17:49
smls joined
|
|||
zacts | hi #perl6 | 17:49 | |
dalek | rl6-most-wanted: 48c04d0 | grondilu++ | most-wanted/bindings.md: update bindings.md add [Vulkan](en.wikipedia.org/wiki/Vulkan_%20API%21) Not sure it's really "most wanted", but it seems cool and from what I read OpenGL is doomed to disappear anyway, so we'll need something else for 3D graphics. |
17:50 | |
El_Che | zacts: hi | ||
zacts | does perl6 let you redefine the language kind of like lisp does? | ||
leont | Yes, except it has syntax | ||
grondilu | it's not quite completely operational now though. | 17:51 | |
but it's a major goal of the language. | |||
zacts | ah ok cool | 17:52 | |
so what is making this difficult currently? | |||
leont | Having syntax :-p | 17:53 | |
geekosaur | mostly that what's currently there needs to be rethought because it's not flexible enough as yet, I think | ||
nine | pmurias: rather than package names, I'd try depending on libraries, as package managers often have options to search for packages by library name. | ||
17:55
rindolf left
|
|||
grondilu | btw will eventually be able to define and use slangs without having to use NQP code? | 17:55 | |
s/will /& we/ | |||
because the examples I've seen so far are quite cumbersome. | |||
17:58
nadim left
|
|||
geekosaur | eventually, yes. as I said, design still needs to be worked out; the current one never got finished (hence nqp goop) because it was realized it couldn't do everything they wanted | 18:00 | |
18:01
rindolf joined
|
|||
dalek | rl6-most-wanted: 7f475c7 | grondilu++ | most-wanted/bindings.md: Update bindings.md fix URI encoding |
18:01 | |
18:11
pecastro1 left
18:14
CIAvash left
18:16
mohae left
|
|||
El_Che | Interesting read with Perl 6 content: salva.github.io/YAPC-Europe-2016/ | 18:18 | |
mst and lizmat are the heros again :) | |||
"Perl 6 is mostly Lisp with a (funny) syntax!!!" | 18:19 | ||
grondilu | I've read the same thing about javascript, IIRC | 18:20 | |
leont made that point years ago: blogs.perl.org/users/leon_timmerman...erent.html | 18:28 | ||
18:30
mohae joined
|
|||
RabidGravy | who do some paths in the docs have the literal '$COLON' in them for ':' ? | 18:30 | |
is that intentional or just something having the wrong sort of quotes somewhere? | |||
18:31
webstrand left
|
|||
RabidGravy | e.g. "docs.perl6.org/type/X$COLON$COLONS...ONNumeric" | 18:31 | |
stmuk_ | It's intentional .. although I don't really understand why the usual url encoding isn't used | 18:32 | |
18:32
cyphase left
|
|||
RabidGravy | very odd | 18:33 | |
18:34
webstrand joined
|
|||
AlexDaniel | “someone has to start …” haha | 18:34 | |
18:35
zacts left
18:36
pmurias left
18:37
cyphase joined
|
|||
RabidGravy | is there a better way of constraining the length of the elements of an array than something like: | 18:42 | |
m: my @foo where { !$_.grep({ $_.chars > 3}).elems }; @foo = <aaaa b c>; | |||
camelia | rakudo-moar d43ea0: OUTPUT«Type check failed in assignment to @foo; expected <anon> but got Str ("aaaa") in block <unit> at <tmp> line 1» | ||
ugexe | m: my @foo[3]; @foo = <1 2 3 4> | 18:43 | |
camelia | rakudo-moar d43ea0: OUTPUT«Index 3 for dimension 1 out of range (must be 0..2) in block <unit> at <tmp> line 1» | ||
ugexe | m: my @foo[3]; @foo = <1 2 3> | 18:44 | |
camelia | ( no output ) | ||
ugexe | oh of the elements, doh | ||
RabidGravy | yeah :) | ||
smls | m: my @foo where .all.chars > 3; @foo = <aaaa b c>; | ||
camelia | rakudo-moar d43ea0: OUTPUT«Type check failed in assignment to @foo; expected <anon> but got Str ("b") in block <unit> at <tmp> line 1» | ||
18:45
domidumont joined
18:46
chris2 joined,
jameslenz left
18:47
zacts joined
18:48
atweiden joined,
jameslenz joined
|
|||
RabidGravy | ah yes, that is at least nicer looking cheers | 18:48 | |
18:49
domidumont left
|
|||
smls | m: subset ShortStr of Str where .chars <= 3; my ShortStr @foo; @foo = <aaa bbbb>; | 18:52 | |
camelia | rakudo-moar d43ea0: OUTPUT«Type check failed in assignment to @foo; expected ShortStr but got Str ("bbbb") in block <unit> at <tmp> line 1» | ||
smls | RabidGravy: This one ^^ even produces a nicer error message | 18:53 | |
18:55
ufobat joined
18:58
firstdayonthejob left
|
|||
atweiden | i made a concise DSL grammar example, one that involves `include` directives such as those found in Haml templates | 19:00 | |
i'm trying to understand why the include directive AST isn't bubbling up in Actions | |||
in this file: bitbucket.org/atweiden/recursive-i...ew-default | |||
i am passing the AST up from `method include`, to `include-line`, to `segment:include-line` | |||
but it stops bubbling up for some reason | |||
19:01
darutoko left
|
|||
stmuk_ | blogs.perl.org/users/steve_mynott/2...apceu.html | 19:03 | |
smls | atweiden: I think `Inclusive.parsefile` is setting $/ in the current scope to its own Match object, and then `make` operates on that. | 19:04 | |
atweiden: Instead of using `method include($/ is copy)`, try e.g. `method include($m)` and then do `$m.make:` instaed of `make`. | 19:05 | ||
arnsholt | Yeah, that's a classic action class surprise | ||
atweiden | smls: ty, wow i was spending so much time on this yesterday | 19:07 | |
didn't know you could do $m.make: | 19:08 | ||
19:11
pecastro joined
19:12
grondilu left
19:13
grondilu joined
19:15
nadim joined
19:24
firstdayonthejob joined
|
|||
RabidGravy | smls, it's on my todo to find a way to let subsets to define the error messages | 19:26 | |
19:26
kaare_ left
19:29
canopus left
19:30
allanofkingston joined,
rindolf left
19:31
allanofkingston left
19:36
canopus joined,
ggoebel joined
19:40
AndyBotwin joined,
wamba left
19:42
smls left
19:43
cognominal joined
19:47
gfldex joined
19:55
dogbert11 joined
19:58
dogbert17 left
20:13
bioduds left,
bioduds joined
20:15
nadim left,
ufobat left
20:17
MasterDuke joined
20:20
salva left
20:38
pecastro left
20:41
mvorg joined
20:43
luxio joined
|
|||
moritz | m: subset Foo of Int where { fail "not quite" }; my Foo $x = 42; | 20:46 | |
camelia | rakudo-moar d43ea0: OUTPUT«not quite in any at /home/camelia/rakudo-m-inst-1/share/perl6/runtime/CORE.setting.moarvm line 1 in block <unit> at <tmp> line 1» | ||
moritz | RabidGravy: ^^ see above | ||
dalek | ateverable: f649e15 | MasterDuke17++ | / (3 files): Move commit shortening into a shared function (only implemented in Benchable and Committable for now) |
||
20:47
cxreg joined
20:50
luxio left
20:51
espadrine left
20:55
pecastro joined
|
|||
tbrowder | I need help with the Build.pm. I think I need my own script unless there's a way not to use the Build classes make. | 21:02 | |
dalek | ateverable: c401d58 | MasterDuke17++ | Benchable.p6: Set the background of the graph to white to make it more legible, Xliff++ |
21:03 | |
ugexe | so write a build class that runs your own script | 21:15 | |
class Build { method build($dir) { run '...', :cwd($dir); } }; | 21:16 | ||
21:22
TEttinger joined
21:24
pmurias joined
21:29
Rawriful left
21:32
Rawriful joined
21:38
girafe left
21:39
pyrimidine joined
21:41
pyrimidi_ left
21:45
setty1 left
21:47
pecastro left
21:53
heatsink joined
21:55
pecastro joined,
atweiden left
21:57
bjz left
|
|||
ugexe | m: my $module-support = BEGIN (try require ::("Test")) !~~ Nil; INIT { if $module-support { require ::("Test"); }; }; say ?$module-support ?? ::("Test").perl !! "Failed to load"; # Programmatic requires not only works, but it works in phasers | 22:06 | |
camelia | rakudo-moar d43ea0: OUTPUT«Test» | ||
22:12
araujo left,
pmurias left
|
|||
dalek | ateverable: 1919837 | MasterDuke17++ | Benchable.p6: Don't know how this happened, but revert breaking change |
22:15 | |
22:16
labster left
22:19
labster joined
22:24
BillSussman joined
22:26
notbenh left,
charsbar_____ left,
AndyBotwin left,
cpage_ left,
bpmedley left
22:27
cpage_ joined,
zostay left,
Khisanth left,
a3r0 left
22:28
adrusi left,
tailgate left,
decent left,
lucs joined,
notbenh joined,
jdv79 joined,
a3r0 joined,
Hor|zon joined
22:29
bpmedley joined,
decent joined,
mindos joined
22:30
MasterDuke left,
pnu_ joined,
zostay joined
22:32
adrusi joined
22:34
firstdayonthejob left
|
|||
Xliff_zzzzz | ugexe++ # Mod support in phasers | 22:36 | |
22:36
leont left
22:39
aindilis joined
22:40
bjz joined,
Khisanth joined
22:41
tailgate joined,
charsbar_____ joined,
b2gills joined
22:45
Rawriful left
22:47
bjz left
22:49
pRiVi left,
mvorg left
22:51
BenGoldberg left
|
|||
grondilu | can I not declare a stub sub in a role and define it in a class implementing that role? | 22:54 | |
m: role Talker { sub talk {...} }; class :: does Talker { sub talk { say "hi" } }.talk | |||
camelia | rakudo-moar d43ea0: OUTPUT«Method 'talk' not found for invocant of class '<anon|57780256>' in block <unit> at <tmp> line 1» | ||
grondilu | m: role Talker { sub talk {...}; method talk { talk } }; class :: does Talker { sub talk { say "hi" } }.talk | 22:55 | |
camelia | rakudo-moar d43ea0: OUTPUT«Stub code executed in sub talk at <tmp> line 1 in method talk at <tmp> line 1 in block <unit> at <tmp> line 1Actually thrown at: in block <unit> at <tmp> line 1» | ||
grondilu | ^like that? | ||
22:56
AngeloMichael left,
mithaldu_ left,
RabidGravy left
22:57
notbenh_ left,
BuildTheRobots left,
olinkl left,
kipd left,
SmokeMachine____ left
|
|||
grondilu | m: use NativeCall; sub fork is native {*}; fork; say "hi" | 22:58 | |
camelia | rakudo-moar d43ea0: OUTPUT«hihi» | ||
22:58
Lucas_One left,
labster left
|
|||
jnthn | grondilu: No, since subs are orthogonal to OO; the MOP doesn't have any idea about them. | 22:59 | |
22:59
pRiVi_ joined
|
|||
jnthn | So they're not really part of the role | 23:00 | |
They just happen to be in the lexical scope that is the role's body | |||
23:05
kurahaupo left
23:08
robinsmidsrod joined
23:09
Lucas_One joined,
SmokeMachine____ joined,
notbenh_ joined,
AngeloMichael joined
|
|||
grondilu | the thing is, I was reading docs.perl6.org/language/nativecall...f_Pointers (the part about objects and handles) and I was wondering how to factorize it for various classes using different native functions. | 23:09 | |
so now I'm considering something like role Foo[Sub &native_func] is native('CPointer') {...} | 23:10 | ||
and then something like class Bar does Foo(sub () is native(&lib) is symbol('make_a_bar') {*}) {...} | 23:11 | ||
23:12
BuildTheRobots joined
23:13
pRiVi_ left,
kipd joined
23:15
mithaldu_ joined
23:16
olinkl joined
23:17
antiTORTURE joined
23:18
heatsink left
|
|||
grondilu | m: use NativeCall; say .WHAT given sub () is native() is symbol('fork') {*} | 23:19 | |
camelia | rakudo-moar d43ea0: OUTPUT«(Sub+{}+{})» | ||
23:19
antiTORTURE left
|
|||
grondilu | so it seems I can use a sub declaration as an object, even if it's a native binding | 23:19 | |
so maybe I can get away with using a parametric role indeed. | 23:20 | ||
'fork' is a neat example of a function to use here for showcasing NativeCall here with camelia. Anyone knows others? | 23:29 | ||
b2gills | m: #`(I finally have a use for the ring operator) say {([Ro] %(<+ - * />Z=>*+1,*-1,* *2,*div 2){.comb})(0)}('++**--/') # codegolf.stackexchange.com/a/91483/1147 | ||
camelia | rakudo-moar d43ea0: OUTPUT«3» | ||
grondilu | nice. If we had an obfuscation context, you might win :) | 23:30 | |
23:31
mniip left,
mniip joined
|
|||
grondilu | though to be fair it's actually fairly readable. | 23:31 | |
it is a nice golf anyway | |||
m: say {([Ro] | 23:32 | ||
camelia | rakudo-moar d43ea0: OUTPUT«5===SORRY!5=== Error while compiling <tmp>Unable to parse expression in parenthesized expression; couldn't find final ')' at <tmp>:1------> 3say {([Ro]7⏏5<EOL> expecting any of: statement end statement modifier…» | ||
grondilu | m: say ([Ro] %(<+ - * />Z=>*+1,*-1,* *2,*div 2)<+ + * * - - />)(0) | 23:34 | |
camelia | rakudo-moar d43ea0: OUTPUT«3» | ||
jnthn | It may be possible to save a char by using the Unicode multiplication operator instead of * *2 | 23:36 | |
(thus removing the space) | 23:37 | ||
23:40
araujo joined
|
|||
jnthn | sleep & | 23:40 | |
23:43
tomboy65 left,
mtj_ left,
mtj_ joined
23:44
_slade_ joined
|
|||
b2gills | On that site it is usually scored by bytes not chars, × is two bytes in utf8 so it would be the same number of bytes. Though it would make it clearer | 23:48 | |
grondilu | if I have a repr('CPointer') can I still mix it with a role? | 23:51 | |
m: use NativeCall; role Foo {}; class Bar is repr('CPointer') does Foo {} | |||
camelia | ( no output ) | ||
grondilu | m: use NativeCall; role Foo { method foo { say "foo!" } }; class Bar is repr('CPointer') does Foo {}; Bar.foo | 23:54 | |
camelia | rakudo-moar d43ea0: OUTPUT«foo!» | ||
grondilu | seems to work. | 23:55 | |
23:55
tomboy65 joined
|
|||
grondilu | It surprises me, considering I can't mix roles to Blobs. Why Blobs would be harder to mixin than CPointers is beyond me. | 23:55 | |
m: use NativeCall; role Foo[Sub &native] { has &.native }; role Bar is repr('CPointer') {}; class :: does Bar does Foo(sub fork is native {*}) {} | 23:58 | ||
camelia | rakudo-moar d43ea0: OUTPUT«5===SORRY!5=== Error while compiling <tmp>Unable to parse expression in typename; couldn't find final ')' at <tmp>:1------> 3ointer') {}; class :: does Bar does Foo(7⏏5sub fork is native {*}) {}» | ||
grondilu | m: use NativeCall; role Foo[Sub &native] { has &.native }; role Bar is repr('CPointer') {}; class :: does Bar does Foo(sub fork() is native {*}) {} | 23:59 | |
camelia | rakudo-moar d43ea0: OUTPUT«5===SORRY!5=== Error while compiling <tmp>Unable to parse expression in typename; couldn't find final ')' at <tmp>:1------> 3ointer') {}; class :: does Bar does Foo(7⏏5sub fork() is native {*}) {}» |