»ö« 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 |