»ö« 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:02
BrassLantern joined
00:13
labster left
|
|||
Zoffix | It's so quiet.... You could download the sound of a pin dropping... | 00:18 | |
00:19
kurahaupo left
00:21
addison left
|
|||
TEttinger | sprint! | 00:23 | |
dj_goku | ........| | 00:34 | |
00:35
RabidGravy left
00:56
BrassLantern left
01:07
rgrinberg left,
cdg left
01:10
BenGoldberg_ joined
01:14
labster joined
|
|||
Zoffix | If you are "neuron", "ianmcb", and "LLFourn" wish to use their full names instead of nicknames in this month's Rakudo's contributors list, let me know. | 01:14 | |
llfourn, ping ^ | |||
01:22
silug left
01:31
huggable joined
01:35
molaf left
01:37
silug joined
01:45
ilbot3 left
01:47
molaf joined,
ilbot3 joined
|
|||
TEttinger | Zoffix, that's their real name, it's welsh | 01:51 | |
it's pronounced by wrapping your tongue around your left eye and sneezing | 01:52 | ||
01:54
kalkin- left,
kalkin-_ joined
|
|||
jdv79 | could you demonstrate? | 01:54 | |
TEttinger | I haven't made my sacrifice to Wlldrkrrl today | 01:57 | |
01:58
MasterDuke joined
|
|||
Zoffix | Ah :) OK then :) | 02:06 | |
02:11
Khisanth left
02:14
itaipu joined
|
|||
dalek | sectbot: 6f9e9a6 | (Daniel Green)++ | benchable.pl: Discard STDOUT and round timing results |
02:19 | |
02:25
itaipu left
02:26
_28_ria left
02:28
Khisanth joined
|
|||
dalek | sectbot: b56e519 | (Daniel Green)++ | benchable.pl: Add missing initial '|' from error output |
02:35 | |
02:43
Madcap^Jake^ joined,
Madcap^Jake^ is now known as MadcapJake
02:44
noganex_ joined
02:47
noganex left
|
|||
dalek | sectbot: f579c64 | (Daniel Green)++ | benchable.pl: Better associate errors with the commit they came from |
02:49 | |
02:57
Tonik joined
|
|||
Tonik | I write | 03:00 | |
my $a = 42; | |||
my $b := $a; | |||
... and I do some awesome stuff ... | |||
but then I want $b to become a happy free variable again, not bound to $a. How do I do that without touching $a? | |||
AlexDaniel | great question | 03:02 | |
Zoffix | Bind it to something else? | ||
geekosaur just tried Scalar.new but it doesn't like that | |||
Zoffix | m: my $a = 42; my $b := $a; $b = 72; say $a; my $z = 42; $b := $z; $b = 'meow'; say $a | ||
camelia | rakudo-moar e2ec35: OUTPUT«7272» | ||
AlexDaniel | Zoffix: what if you want $b = 42 without binding? | ||
Zoffix | TBH, there's likely a much better solution to Tonik's problem. | 03:03 | |
Tonik | Zoffix, $b wants to be on its own, not bound to anyone :( | ||
Zoffix | Tonik, why? | ||
Tonik | because if it can't, it will feel something is wrong with Perl 6 | 03:04 | |
Zoffix | :/ | ||
Very well then. | |||
konobi | yeah, you'd just use a different variable in real life, no? | ||
but it's probably doable | 03:05 | ||
geekosaur | hack alert | 03:07 | |
m: my $a = 4; my $b := $a; $b = 6; say $a; $b := $; $b = 2; say $a; say $b; | |||
camelia | rakudo-moar e2ec35: OUTPUT«662» | ||
Tonik | I've been trying to wrap my mind around the idea of binding in Perl 6, and I almost convinced myself it makes sense, until I found out you can rebind what's already been bound, and it all fell apart for me. Seems that every variable is in fact a pointer, but you don't get to enjoy the full power of pointers as in other languages, and these pointers are shoved down your throat whether you want it or not | ||
konobi | well, everything's a reference | ||
Tonik | except "my $a := 42" which is not, right? | 03:08 | |
AlexDaniel | wait, um… if you don't want to rebind then just don't? Doctor, it hurts when I do this… | ||
konobi | Tonik: github.com/rakudo/rakudo/blob/nom/...ariable.pm | 03:10 | |
so gotta be able to do it somehow =0) | 03:11 | ||
geekosaur points up at hack | |||
an alternative would be for Scalar.new to not produce Nil... | |||
well, actually, the hack will lose if it's used in a scope that gets re-entered at some point, since $ will use the same Scalar each time whereas $a will be a new one each time, so not 100% the same behavior | 03:13 | ||
Tonik | geekosaur, uh, what is $ ? | 03:15 | |
geekosaur | anonymous state variable | ||
(like a C `static`) | |||
konobi | geekosaur: seems to me like a lot of that sort of state management would be a pretty interesting pattern for IOC | 03:16 | |
Tonik | I see | ||
geekosaur | but since it's anonymous, every use of `$` is distinct; so if you did `$b := $; $c := $;` then each one gets its own `state` variable which will be reused every time the scope is re-entered | 03:17 | |
would have to figure out how to bind it to a new Scalar to avoid this (which currently throws) | 03:19 | ||
m: my $a = 4; my $b := $a; $b = 6; say $a; $b := Scalar.new; $b = 2; say $a; say $b; | |||
camelia | rakudo-moar e2ec35: OUTPUT«6Cannot call method 'BUILDALL' on a null object in block <unit> at <tmp> line 1» | ||
geekosaur | (I suspect it can be made to work but Scalar.new needs more information, which if I had to guess is an initial content --- but it also does not take positionals. so I'd have to dig into implementation of Scalar to see what to feed it) | 03:20 | |
konobi | could you apply a role to the instance of the Scalar and override the scope? | 03:21 | |
*blink* could do some crazy stuff | 03:23 | ||
03:24
adu joined,
kid51 joined
|
|||
geekosaur looks at Scalar impl and gets a headache --- need to create a Perl6::Metamodel::ContainerDescriptor, then the Scalar with named parameters descriptor and value | 03:25 | ||
gfldex | konobi: could can't get hold of an instance of scalar. There is no way to tell the compiler you are talking to the container. There is Proxy tho. | ||
adu | TimToady! | ||
Zoffix | Would be neat if bisectable could bisect hangs. | 03:28 | |
Can it take a gist? | 03:29 | ||
AlexDaniel | sure | ||
Tonik | if some of you guys have a sensible visual representation of what a scalar is and how binding works, please share it with me | 03:30 | |
or draw it on a piece of paper and show it to me | |||
Zoffix | ," gist.githubusercontent.com/zoffixz...tfile1.txt | ||
bisect: gist.githubusercontent.com/zoffixz...tfile1.txt | |||
bisectable | Zoffix: Successfully fetched the code from the provided URL. | 03:31 | |
Zoffix: Exit code is 1 on both starting points, bisecting by using the output | |||
Zoffix: bisect log: gist.github.com/1314ad2dec81edc86f...a94eb64bc8 | |||
Zoffix: (2015-12-25) github.com/rakudo/rakudo/commit/07fecb5 | |||
Zoffix | Tonik, there's Containers page on docs. It may be useful: docs.perl6.org/language/containers | ||
Tonik | nono, I want to know how *you* *visualize* it | ||
adu | Tonik: "scalar"? | ||
Zoffix | I don't use binding. | 03:32 | |
Tonik sighs | |||
adu | Tonik: my personal definition of scalar is "not deep" | ||
gfldex | Zoffix: you do use binding by calling subs and methods | ||
my personal definiton of scalar is "double indirection". Also somebody else wrote that scalars are object the forward pretty much all their methods to another object. | 03:33 | ||
Tonik | gfldex, double indirection sounds about right :( | 03:34 | |
geekosaur | the "natural" state of a name is to bind to something. if you bind it to a value, the name is readonly. if you bind it to a container, the name is read-write and you can store values in the container and replace them with new values. `=` stores a new value in a container (and throws if it's not bound to a container). `:=` binds to something else, which may be a container from some other place. | ||
gfldex | don't look so much at := and ::= to understand binding. Look at signatures and calls. | 03:35 | |
also, default values. | |||
Tonik | hm. what is ::= ? | ||
gfldex | compile time binding | 03:36 | |
Tonik | oh | ||
geekosaur | it makes a reasonable amount of sense to me, but then I program in Haskell so I have a clear distinction between the concepts to start with :) | ||
gfldex | m: my Int $i = Failure.new('Dude, I'm empty!'); say $i; | ||
camelia | rakudo-moar e2ec35: OUTPUT«5===SORRY!5=== Error while compiling <tmp>Unable to parse expression in argument list; couldn't find final ')' at <tmp>:1------> 3my Int $i = Failure.new('Dude, I'7⏏5m empty!'); say $i; expecting any of: infix i…» | ||
gfldex | m: my Int $i is default Failure.new('Dude, I'm empty!'); say $i; | 03:37 | |
camelia | rakudo-moar e2ec35: OUTPUT«5===SORRY!5=== Error while compiling <tmp>Two terms in a rowat <tmp>:1------> 3my Int $i is default7⏏5 Failure.new('Dude, I'm empty!'); say $i expecting any of: constraint infix infix stopper …» | ||
gfldex | m: my Int $i = 1is default Failure.new('Dude, I'm empty!'); say $i; | ||
camelia | rakudo-moar e2ec35: OUTPUT«5===SORRY!5=== Error while compiling <tmp>Confusedat <tmp>:1------> 3my Int $i = 17⏏5is default Failure.new('Dude, I'm empty!» | ||
gfldex | m: my Int $i = 1 is default Failure.new('Dude, I'm empty!'); say $i; | ||
camelia | rakudo-moar e2ec35: OUTPUT«5===SORRY!5=== Error while compiling <tmp>Two terms in a rowat <tmp>:1------> 3my Int $i = 17⏏5 is default Failure.new('Dude, I'm empty expecting any of: infix infix stopper postfix statement…» | ||
Tonik | "::=" not yet implemented. Sorry. | ||
Tonik sighs | |||
gfldex | m: my Int $i is default Failure.new('Dude, I'm empty!') = 1; say $i; | ||
camelia | rakudo-moar e2ec35: OUTPUT«5===SORRY!5=== Error while compiling <tmp>Two terms in a rowat <tmp>:1------> 3my Int $i is default7⏏5 Failure.new('Dude, I'm empty!') = 1; sa expecting any of: constraint infix infix stopper …» | ||
geekosaur | doesn't is default require some kind of parens/braces? (i.e. it is syntactically an adverb) | ||
Zoffix | It's a trait | 03:39 | |
m: my Int $i is default(Failure.new: 'Dude, Im empty!') = 1; | |||
camelia | rakudo-moar e2ec35: OUTPUT«5===SORRY!5=== Error while compiling <tmp>Default value '(HANDLED) Dude, Im empty! in any at src/Perl6/World.nqp line 2199 in any trait_mod:sym<is> at gen/moar/m-Perl6-Actions.nqp line 5056 in any trait_mod:sym<is> at src/Perl6/Grammar.…» | ||
gfldex | m: my Int $i is default(42); $i = 10; $i = Nil; say $i; | 03:40 | |
camelia | rakudo-moar e2ec35: OUTPUT«42» | ||
gfldex | m: my $i is default(Failure.new("Dude, I'm empty!")) = 1; say $i; | 03:41 | |
camelia | rakudo-moar e2ec35: OUTPUT«1» | ||
gfldex | m: my $i is default(Failure.new("Dude, I'm empty!")); say $i; | ||
camelia | rakudo-moar e2ec35: OUTPUT«===SORRY!===Dude, I'm empty!» | ||
gfldex | the type constraint seams to peek into the container and triggers the Failure | 03:42 | |
m: my Int $i is default(Nil); | 03:44 | ||
camelia | rakudo-moar e2ec35: OUTPUT«5===SORRY!5=== Error while compiling <tmp>Default value 'Nil' will never bind to a parameter of type Intat <tmp>:1------> 3my Int $i is default(Nil)7⏏5; expecting any of: constraint» | ||
gfldex | m: my $i is default(Nil); | ||
camelia | ( no output ) | ||
gfldex | m: my $i is default(Nil); dd $i; | ||
camelia | rakudo-moar e2ec35: OUTPUT«Nil $i = Nil» | ||
03:44
Zoffix left
|
|||
gfldex | ha! I finally found a way to hold onto Nil. :) | 03:44 | |
that leaves the question if that is sensible to allow | 03:45 | ||
03:45
rgrinberg joined
04:00
kid51 left
|
|||
dalek | sectbot: a8df0e3 | (Aleks-Daniel Jakimenko-Aleksejev)++ | benchable.pl: Oops, restore server |
04:00 | |
04:02
benchable joined,
jsimonet left,
jsimonet joined
04:08
khw left
04:12
skids left
04:13
BrassLantern joined
|
|||
MasterDuke | benchable: HEAD~50..HEAD my $a = "a" x 2**16;my $b = $a.chop($_) for ^1000 | 04:18 | |
04:18
cpage__ joined
|
|||
benchable | MasterDuke: gist.github.com/0d621f847cc2b80db1...e77d20c71b | 04:19 | |
04:19
cpage_ left,
cpage__ is now known as cpage_
|
|||
AlexDaniel | benchable: 2015.10,2016.02,2016.04,HEAD my $a = "a" x 2**16;my $b = $a.chop($_) for ^5000 | 04:20 | |
benchable | AlexDaniel: |«2015.10»:1.1509|«2016.02»:1.0659|«2016.04»:1.0590|«HEAD»:1.1272 | ||
04:23
djbkd left
04:24
djbkd joined
|
|||
dalek | sectbot: f763de7 | (Aleks-Daniel Jakimenko-Aleksejev)++ | / (2 files): Fix encoding issue get_output should probably decode automatically, but for now this is enough. |
04:26 | |
04:27
adu left
|
|||
dalek | sectbot: 57bd995 | (Aleks-Daniel Jakimenko-Aleksejev)++ | committable.pl: Oops, missed “use” |
04:28 | |
04:29
bisectable left,
committable left,
bisectable joined,
committable joined
04:37
Cabanossi left
04:40
Cabanossi joined
04:57
holyghost left
04:58
holyghost joined
05:01
samb1 left
05:12
samb1 joined
05:20
AlexDaniel left
05:29
CIAvash joined
05:31
huggable left,
huggable joined
05:35
BrassLantern left
05:39
cpage_ left
05:40
cpage_ joined
05:42
wamba joined
05:48
BenGoldberg_ left
06:01
canopus left
06:05
furelypunctional joined
06:06
canopus joined
06:12
djbkd left
06:16
TreyHarr1 left
06:30
domidumont joined
06:34
domidumont left
06:35
domidumont joined
06:40
domidumont left
|
|||
masak | in a moment of weakness, I expected .prompt to be a method on $*IN, not just a global sub | 06:40 | |
now that I think about it, I'm not sure that was reasonable -- prompt() does involve both output and input | 06:41 | ||
but I will not that I did expect it :) | |||
note* | 06:42 | ||
no big deal either way -- I'll solve what I wanted to do in a different way ;) | 06:44 | ||
06:49
maddingue joined
06:58
darutoko joined
07:01
firstdayonthejob joined
07:03
donaldh joined
07:04
canopus left
|
|||
moritz | could $*OUT.prompt($message, :readfrom($*IN)) | 07:05 | |
or $*IN.prompt($message, :out($*OUT)) | |||
07:09
canopus joined
|
|||
Ulti | lizmat++ another tenth of a second saving on my tests | 07:18 | |
07:21
rgrinberg left,
domidumont joined
07:32
domidumont left
07:40
RabidGravy joined
07:49
donaldh left
07:51
wamba left
08:00
firstdayonthejob left
08:04
furelypunctional left
|
|||
Xliff_ | Will .defined return true if scalar is set to a type object? | 08:07 | |
Always thought it returned false. | |||
m: my $a = Str; say $a.defined; | 08:08 | ||
camelia | rakudo-moar e2ec35: OUTPUT«False» | ||
Xliff_ | And so it doesn't. Hmmm... | ||
m: use NativeCall; class A does Str { }; my $a = nativecast(A, Str); say $a.defined; | 08:09 | ||
camelia | rakudo-moar e2ec35: OUTPUT«5===SORRY!5=== Error while compiling <tmp>Str is not composable, so A cannot compose itat <tmp>:1» | ||
Xliff_ | m: use NativeCall; class A does Int { }; my $a = nativecast(A, Int); say $a.defined; | ||
camelia | rakudo-moar e2ec35: OUTPUT«5===SORRY!5=== Error while compiling <tmp>Int is not composable, so A cannot compose itat <tmp>:1» | ||
Xliff_ | Hrm. | 08:10 | |
08:19
FROGGS joined
|
|||
FROGGS | o/ | 08:22 | |
08:35
rindolf joined
08:39
girafe joined
08:41
cpage_ left
|
|||
holyghost | »ö« | 08:53 | |
09:01
Ven joined
09:10
wamba joined
|
|||
masak | »ö« | 09:21 | |
09:24
setty1 joined
09:31
huggable left,
huggable joined
09:36
Senji left,
Senji joined
09:39
TreyHarr1 joined
09:49
wamba left
09:55
donaldh joined,
espadrine joined
10:02
rindolf left
10:03
TEttinger left
10:06
rindolf joined
10:16
donaldh left
10:19
labster left
|
|||
Xliff_ | FROGGS: \o | 10:53 | |
m: use NativeCast; class A is repr('CStruct') { }; class B does A { }; my $a = A; my $b = nativecast(B, $a); say $b.defined; | 10:55 | ||
camelia | rakudo-moar cd19db: OUTPUT«===SORRY!===Could not find NativeCast at line 1 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::Re…» | ||
Xliff_ | m: use NativeCall; class A is repr('CStruct') { }; class B does A { }; my $a = A; my $b = nativecast(B, $a); say $b.defined; | ||
camelia | rakudo-moar cd19db: OUTPUT«5===SORRY!5=== Error while compiling <tmp>A is not composable, so B cannot compose itat <tmp>:1» | ||
Xliff_ | m: use NativeCall; class A is repr('CStruct') { has int32 $.a }; class B does A { }; my $a = A; my $b = nativecast(B, $a); say $b.defined; | 10:56 | |
camelia | rakudo-moar cd19db: OUTPUT«5===SORRY!5=== Error while compiling <tmp>A is not composable, so B cannot compose itat <tmp>:1» | ||
Xliff_ | m: use NativeCall; class A is repr('CStruct') { has int32 $.a }; class B is A { }; my $a = A; my $b = nativecast(B, $a); say $b.defined; | ||
camelia | rakudo-moar cd19db: OUTPUT«Internal error: unhandled target type in sub nativecast at /home/camelia/rakudo-m-inst-1/share/perl6/sources/24DD121B5B4774C04A7084827BFAD92199756E03 (NativeCall) line 406 in block <unit> at <tmp> line 1» | ||
jnthn | Xliff_: At a guess, you'd need to mark B as "is repr('CStruct')" too for that to work | 10:57 | |
Xliff_ | m: use NativeCall; class A is repr('CStruct') { has int32 $.a }; class B is A is repr('CStruct') { }; my $a = A; my $b = nativecast(B, $a); say $b.defined; | ||
camelia | rakudo-moar cd19db: OUTPUT«False» | ||
Xliff_ | jnthn: Yep. Thanks. | ||
jnthn | Also, you can factor things out in to roles and compose those into classes marked "is repr('CStruct')" if you like | ||
Since composition is flattening, that should Just Work. | 10:58 | ||
Xliff_ | jnthn: Thanks! That's good to know. | ||
Right now I'm trying to figure out why certain routines seem to be returning type objects even though they've gone through a .defined check. | 10:59 | ||
So far every use case I've tried through camelia seems to work fine, but in my code it doesn't. Must be missing something. | |||
jnthn | Odd... Guess it's a case of trying to boil it down to the smallest possible test case... | 11:04 | |
11:04
avenj left
11:08
TreyHarr1 left
11:19
kid51 joined
11:20
girafe left
11:22
girafe joined
|
|||
timotimo | also, just to make sure it's not something wonky in spesh or something, try MVM_SPESH_DISABLE=yesplease | 11:23 | |
11:40
pmurias joined
|
|||
pmurias | .tell konobi using v8-profiler and loading the profiles in chrome turned out the thing I needed for profiling | 11:42 | |
yoleaux | pmurias: I'll pass your message to konobi. | ||
pmurias | do we have an API for profiling things? | ||
that is for turning profiling on from Perl6/NQP code? | 11:43 | ||
11:43
cpage_ joined
|
|||
timotimo | we do for moarvm | 11:46 | |
but it's just two ops | |||
11:48
girafe2 joined,
TreyHarr1 joined
11:50
girafe left
|
|||
masak | moritz: I'd argue that .prompt is "more" a method on $*IN than on $*OUT, since $message is optional but the .get is not ;) | 11:55 | |
pmurias | timotimo: how are they used? | 12:09 | |
jnthn | pmurias: I think the most natural way would be to nqp::getcomp('perl6').eval('some code', :profile(1)) or some such | 12:10 | |
pmurias: (Which already should work, or something close to it) | 12:11 | ||
See run_profiled in the MoarVM Backend.nqp in the NQP repo for how it's done | |||
In fact, you can probably use nqp::getcomp('perl6').backend.run_profiled($code_object) | |||
12:12
kaare_ left
|
|||
jnthn | (Note, method names from memory, may not 100% match reality ;)) | 12:12 | |
12:27
amoe_ joined
12:37
pmqs_ joined
12:41
pmqs_ left
12:46
kid51 left
12:52
pmurias left
12:56
BenGoldberg_ joined
13:01
avenj joined,
avenj left,
avenj joined
|
|||
dogbert17 | it's very quiet around here, is everyone out tapping their beer supplies | 13:01 | |
m: say 'a b' ~~ /a b/ | 13:02 | ||
camelia | rakudo-moar 88c35e: OUTPUT«Potential difficulties: Space is not significant here; please use quotes or :s (:sigspace) modifier (or, to suppress this warning, omit the space, or otherwise change the spacing) at <tmp>:1 ------> 3say 'a b' ~~ /a7⏏5 b/Nil» | ||
dogbert17 | do we really need to list this as a trap when we get this warning? docs.perl6.org/language/traps#Regexes | 13:03 | |
13:05
sammers left
|
|||
MasterDuke | IMHO, yes. Perl 5 regexes are almost muscle memory now, but i have to stop and think about Perl 6 syntax. anything to warn people ahead of time is good | 13:10 | |
psch | the warning somewhat goes against /x as default | 13:12 | |
dogbert17 | MasterDuke: perl6 does warn you, but the text implies that is does not, perhaps it needs to be rephrased a bit | 13:13 | |
psch | and perl5 doesn't warn on 'say "foo" =~ / f o o /x' | ||
(yes, i had to check :P ) | |||
which is to say i'd rather like the warning to go and only keep it around in language/traps | 13:15 | ||
m: $ = quietly / a b / # especially as it's not quietly-able | 13:16 | ||
camelia | rakudo-moar 88c35e: OUTPUT«Potential difficulties: Space is not significant here; please use quotes or :s (:sigspace) modifier (or, to suppress this warning, omit the space, or otherwise change the spacing) at <tmp>:1 ------> 3$ = quietly / a7⏏5 b / # especial…» | ||
dogbert17 | that's one way I guess. to me it seems that the warning was added after the text was written | ||
13:16
sammers joined
13:18
pmurias joined
|
|||
pmurias | are the situations where you want use /a b/ instead of /ab/ common? | 13:20 | |
13:21
holyghost left
|
|||
psch | matching any continuous over an (arbitrary) length of 40 chars in a regex is where it applies | 13:21 | |
i don't know how common that is, but i also don't think that "how common" matters for my argument | |||
13:22
holyghost joined
|
|||
psch | but i also don't really feel strongly about it | 13:22 | |
it just seems weird to me that we "force" /x on people and complain when they use it to its full extend | |||
jnthn | m: no worries; / a b / | ||
camelia | rakudo-moar 88c35e: OUTPUT«Potential difficulties: Space is not significant here; please use quotes or :s (:sigspace) modifier (or, to suppress this warning, omit the space, or otherwise change the spacing) at <tmp>:1 ------> 3no worries; / a7⏏5 b /» | ||
jnthn | Hm, I'd have expected that to suppress it | ||
13:28
kurahaupo joined
13:30
holyghost left,
CIAvash left,
holyghost joined
13:31
huggable left,
huggable joined
|
|||
pmurias | psch: "how common" matters a lot for warnings, what the warning is IMHO intented to catch is people assuming :sigspace is in effect when it's not | 13:35 | |
psch | pmurias: as i said, i don't think that matters for my argument | 13:43 | |
13:43
skids joined
|
|||
psch | pmurias: i mean, the intend behind making all regexen assume /x semantic is to allow arbitrary whitespace | 13:43 | |
pmurias: and then we complain about arbitrary whitespace, which just seems weird | 13:44 | ||
but, as also said, i don't feel strongly about it | |||
13:48
cpage joined
13:49
cpage__ joined
|
|||
pmurias | psch: warnings are for things that are allowed but confusing/seem to be a mistake, for things that are not allowed we have errors | 13:49 | |
13:50
cpage_ left,
cpage__ is now known as cpage_
|
|||
psch | m: /a b+/ # i want to seperate, purposefully, for clarity | 13:51 | |
camelia | rakudo-moar 88c35e: OUTPUT«Potential difficulties: Space is not significant here; please use quotes or :s (:sigspace) modifier (or, to suppress this warning, omit the space, or otherwise change the spacing) at <tmp>:1 ------> 3/a7⏏5 b+/ # i want to seperate, p…» | ||
psch | because ab+ is easily misunderstood as "ab"+ | ||
having to silence the warning by rewriting that just makes it worse | |||
granted, if we could silence it that particular case stops being valid | 13:52 | ||
but we can't | |||
m: say "foo" or "bar" # why aren't we warning here? | |||
camelia | rakudo-moar 88c35e: OUTPUT«foo» | ||
psch stops now | |||
i'm getting way to invested :) | |||
masak | because for all the compiler knows, `say` might return something falsy, which makes the rhs of the `or` run | 13:56 | |
14:02
TreyHarr1 left
14:05
TreyHarr1 joined,
kaare_ joined
14:08
canopus left
|
|||
dogbert17 | m: sub postfix:<!>(Int $x where { $x >= 0 }) { [*] 1..$x }; say 5! # oddball question, but why does this take almost one sec to parse | 14:12 | |
camelia | rakudo-moar cd4265: OUTPUT«120» | ||
14:13
rgrinberg joined
|
|||
moritz | dogbert17: adding new operators is fairly expensive, because rakudo has to re-calculate the finite statement machines for the regex engine | 14:15 | |
dogbert17: but it surprises me that it takes almost a second | |||
Xliff_ | timotimo, what is spesh? | 14:16 | |
14:16
Xliff_ is now known as Xlif,
Xlif is now known as Xliff
|
|||
moritz | Xliff: just-in-time specialization of code | 14:16 | |
things like eliminating unecessary type checks, containers etc. | 14:17 | ||
timotimo | yup | ||
Xliff | kk | ||
dogbert17 | moritz: on my machine, (old i5) it takes ~0.9 sec | ||
moritz | 0.5s here | 14:18 | |
dogbert17 | moritz: do you have an i7? | ||
moritz | dogbert17: I think so | ||
14:19
canopus joined
|
|||
dogbert17 | moritz: compare with this, takes 0.13 sec for me: ulti minfix:<+>(Int $x, "same") { 2 * $x }; | 14:19 | |
moritz | if I change it to a regular sub, it takes 0.17s instead | ||
dogbert17 | aha, interesting | ||
moritz | infix:<+> already exists, so no parser changes required there | 14:20 | |
dogbert17 | ah, didn't think of that | ||
Xliff | If I have a base class that has attributes, and a descendent class that wants to set them, how would I do that? | 14:26 | |
Example: class A { has $.a }; class B is A { setA { # Want to set class A's $!a here } } | 14:27 | ||
I think I've asked this before but... | |||
Right now both are repr('CStruct') so I can use nativecast() to access the super, but I don't think that's a wise long-term solution. | |||
timotimo | did someone recommend mixing in a role yet? :) | 14:28 | |
gfldex | m: class B {...}; class A { has $!foo = 42; trusts B; method say { put $!foo } }; class B is A { method m(){ $A::foo = "answer"; } }; B.new.m.say | 14:29 | |
camelia | rakudo-moar cd4265: OUTPUT«answer» | ||
gfldex | Xliff: ^^^ (there may be dragons) | 14:30 | |
Xliff | gfldex: Thanks. Will try. Would prefer to see an example without "has $!att" | 14:31 | |
And that doesn't need trust. | |||
But then again, beggars can't be choosers. | |||
gfldex | m: class A { has $.foo = 42; method say { put $!foo } }; class B is A { method m(){ $A::foo = "answer"; } }; B.new.m.say | ||
camelia | rakudo-moar cd4265: OUTPUT«answer» | ||
gfldex | there you go | ||
Xliff | LOL | ||
timotimo | does the attribute really have to be private? | ||
Xliff | My attributes are not private. | 14:32 | |
gfldex | :-> | ||
timotimo | in that case, why don't you just $.foo = 10? | ||
Xliff | Rakudo doesn't let me. | ||
Says attribute is not found. | |||
timotimo | please share the code where that errors? | ||
14:33
khw joined
|
|||
Xliff | Let me see if I can create a use case, timotimo | 14:33 | |
timotimo | thanks | 14:34 | |
because what you're describing sounds a bit like a bug | |||
14:36
ggoebel joined
|
|||
Xliff | Attribute $!intSubset not declared in class XML::LibXML::Document | 14:38 | |
But $!intSubset is declared in xmlDoc, and class XML::LibXML::Document is xmldoc. | 14:39 | ||
Er... | |||
class XML::LibXML::Document is xmlDoc. | |||
github.com/Xliff/p6-XML-LibXML/blo...cts.pm#L95 <- xmlDoc def | 14:40 | ||
github.com/Xliff/p6-XML-LibXML/blo...ent.pm#L18 <- XML::LibXML::Document def | 14:41 | ||
github.com/Xliff/p6-XML-LibXML/blo...nt.pm#L527 <- Line causing error. | 14:43 | ||
timotimo, sorry to be throwing the kitchen sink at you, but every time I've tried to pair this down to something small, it doesn't reproduce. | |||
14:43
kid51 joined
|
|||
Xliff | One moar time... | 14:43 | |
14:43
kid51 left,
kid51 joined
|
|||
timotimo | oh | 14:43 | |
it's a regular class and the derived class is a cstruct? | 14:44 | ||
Xliff | Both classes are CStructs | ||
timotimo | i don't see the CStruct for xmlDoc | ||
Xliff | One is barebones for some nativecall routines other is full object rep. | ||
timotimo | when you have the superclass p6opaque and the subclass cstruct, i don't know how that behaves | 14:45 | |
Xliff | timotimo: that is part of the predef... github.com/Xliff/p6-XML-LibXML/blo...cts.pm#L24 | ||
timotimo | oh, ok | 14:46 | |
14:46
mtj_ left
|
|||
timotimo | i haven't used derived classes with cstruct yet, but i thought it'd Just Work™ | 14:46 | |
Xliff | m class A { has $.a }; class B is A { setA($a) { $!a = $a } }; my $b = B.new; $b.setA(42); say $b.a; | 14:47 | |
m: class A { has $.a }; class B is A { setA($a) { $!a = $a } }; my $b = B.new; $b.setA(42); say $b.a; | |||
camelia | rakudo-moar cd4265: OUTPUT«5===SORRY!5=== Error while compiling <tmp>Variable '$a' is not declaredat <tmp>:1------> 3lass A { has $.a }; class B is A { setA(7⏏5$a) { $!a = $a } }; my $b = B.new; $b.se» | ||
Xliff | m: class A { has $.a }; class B is A { method setA($a) { $!a = $a } }; my $b = B.new; $b.setA(42); say $b.a; | ||
camelia | rakudo-moar cd4265: OUTPUT«5===SORRY!5=== Error while compiling <tmp>Attribute $!a not declared in class Bat <tmp>:1------> 3 B is A { method setA($a) { $!a = $a } }7⏏5; my $b = B.new; $b.setA(42); say $b.a; expecting any of: horizontal whitespace…» | ||
Xliff | ^^^ | ||
m: class A { has $.a }; class B is A { method setA($a) { $A::a = $a } }; my $b = B.new; $b.setA(42); say $b.a; | 14:48 | ||
camelia | rakudo-moar cd4265: OUTPUT«(Any)» | ||
Xliff | O_o | ||
What did I miss? | |||
14:48
ggoebel_ joined
14:49
mtj_ joined
|
|||
Xliff | m: class A { has $.a }; class B is A { method setA($a) { $A!a = $a } }; my $b = B.new; $b.setA(42); say $b.a; | 14:50 | |
camelia | rakudo-moar cd4265: OUTPUT«5===SORRY!5=== Error while compiling <tmp>Variable '$A' is not declared. Did you mean '$a'?at <tmp>:1------> 3$.a }; class B is A { method setA($a) { 7⏏5$A!a = $a } }; my $b = B.new; $b.setA(42» | ||
Xliff | m: class A { has $.a }; class B is A { method setA($a) { $A::a = $a; say $a; } }; my $b = B.new; $b.setA(42); say $b.a; | ||
camelia | rakudo-moar cd4265: OUTPUT«42(Any)» | ||
Xliff | m: class A { has $.a }; class B is A { method setA($a) { $A::a = $a; say $a; say $.a; } }; my $b = B.new; $b.setA(42); say $b.a; | ||
camelia | rakudo-moar cd4265: OUTPUT«42(Any)(Any)» | ||
Xliff | m: class A { has $.foo = 42; method say { put $!foo } }; class B is A { method m(){ $A::foo = "answer"; } }; my $b = B.new; $b.m; say $b.foo | 14:51 | |
camelia | rakudo-moar cd4265: OUTPUT«42» | ||
Xliff | Ah. And thus the dragon breathes fire. | ||
14:52
ggoebel left
|
|||
Xliff | The assignment to $A::foo is not setting the $.foo attribute. | 14:52 | |
14:53
ggoebel_ is now known as ggoebel
14:54
Ven left
14:55
Ven joined
14:56
holyghost left
|
|||
gfldex | m: class A { has $.a }; class B is A { method setA($a) { $A::a := $a; say $a; say $.a; } }; my $b = B.new; $b.setA(42); say $b.a; | 14:56 | |
camelia | rakudo-moar cd4265: OUTPUT«5===SORRY!5=== Error while compiling <tmp>Cannot use bind operator with this left-hand sideat <tmp>:1------> 3s B is A { method setA($a) { $A::a := $a7⏏5; say $a; say $.a; } }; my $b = B.new; $» | ||
gfldex | $A::a is the accessor method, not the container | 14:57 | |
timotimo | sorry, i'm quite distracted | 14:58 | |
why would you have to $A::a? the method is already public, so it's derived and can be called on self | 14:59 | ||
15:00
ggoebel left
|
|||
gfldex | m: class A is rw { has $.a = 42 }; class B is A { method setA($a) { $.a = $a; } }; my $b = B.new; $b.setA(42); say $b.a; | 15:00 | |
camelia | rakudo-moar cd4265: OUTPUT«42» | ||
gfldex | Xliff: also ^^^ | ||
15:00
ggoebel joined
|
|||
gfldex | m: class A { has $.a = is raw 42 }; class B is A { method setA($a) { $.a = $a; } }; my $b = B.new; $b.setA(42); say $b.a; | 15:00 | |
camelia | rakudo-moar cd4265: OUTPUT«5===SORRY!5=== Error while compiling <tmp>Undeclared routines: is used at line 1 raw used at line 1» | ||
gfldex | m: class A { has $.a = is rw 42 }; class B is A { method setA($a) { $.a = $a; } }; my $b = B.new; $b.setA(42); say $b.a; | ||
camelia | rakudo-moar cd4265: OUTPUT«5===SORRY!5=== Error while compiling <tmp>Undeclared routines: is used at line 1 rw used at line 1» | ||
gfldex | m: class A { has $.a = is rw; }; class B is A { method setA($a) { $.a = $a; } }; my $b = B.new; $b.setA(42); say $b.a; | 15:01 | |
camelia | rakudo-moar cd4265: OUTPUT«5===SORRY!5=== Error while compiling <tmp>Undeclared routines: is used at line 1 rw used at line 1» | ||
gfldex | m: class A { has $.a is rw; }; class B is A { method setA($a) { $.a = $a; } }; my $b = B.new; $b.setA(42); say $b.a; | ||
camelia | rakudo-moar cd4265: OUTPUT«42» | ||
gfldex | ENEEDMORETEA | ||
Xliff | gfldex: Thanks! One of those might work. | 15:02 | |
timotimo: I was trying to set the attribute. Not access a method. | |||
15:04
kid51 left,
adu joined
|
|||
gfldex | Xliff: you may be aiming at your feed. Esp. if you intend to use threads to make your life harder. | 15:04 | |
threads are clearly the work of the devil | 15:05 | ||
pmurias | jnthn: re run_profiled it fits almost perfectly for the kind of profiling support I want to expose on the js backend | 15:07 | |
timotimo | but why don't you set the attribute via the method? | 15:08 | |
Xliff | timotimo: ??? | 15:09 | |
15:09
Ven left
|
|||
Xliff | timotimo: Via what method? | 15:09 | |
timotimo | well, make the attribute rw and set the value via the accessor? | ||
the method that has the same name as the attribute | |||
Xliff | Oh. Could do that, but sometimes we get "Cannot set an immutable object" so I'm forced to drop back to nqp and bindattr. | 15:10 | |
And in those situations I have to nativecast back to the superclass. | |||
And I'm worried that in some situations, when doing that I am confusing something in the model because test that should pass... aren't. | 15:11 | ||
timotimo | just "is rw" :) | 15:12 | |
Xliff | Even with "is rw" I get that "Cannot set an immutable object" error. | ||
Especially when dealing with structs that originate in libxml2. | |||
dogbert17 | m: gist.github.com/dogbert17/dcf078ff...5632b4ad63 | ||
15:12
kid51 joined,
camelia joined
|
|||
Xliff | ok 9 - DTD's system ID matches $htmlSystem | 15:12 | |
Cannot modify an immutable xmlDtdPtr | |||
timotimo | wtf? | ||
15:12
Ven joined
|
|||
Xliff | ^^ There's one. | 15:12 | |
dogbert17 | m: gist.github.com/dogbert17/dcf078ff...5632b4ad63 | 15:13 | |
timotimo | is that attribute rw? | ||
it doesn't seem like you're getting a container there | |||
Xliff | I changed xmlDoc to "is rw" | ||
dogbert17 | hmm, shouldn't that work, evaluating a gist that is | ||
15:13
ChanServ sets mode: +v camelia
|
|||
camelia | rakudo-moar cd4265: OUTPUT«Attempt to return outside of any Routine in block <unit> at <tmp> line 8» | 15:14 | |
Xliff | I can try changing that attribute to "is rw" as well. | ||
dogbert17 | why does the example fail with: Attempt to return outside of any Routine in block <unit> at <tmp> line 8 | ||
timotimo | is rw on the class should do that for you, but i'm not sure how stubbed classes and traits like that interact, really | ||
Xliff | Well I have done "is rw" on the class and the trait. | 15:15 | |
timotimo | OK | 15:16 | |
Xliff | FROGGS initially wrote most of this and was using nqp::bindattr to get around it. | ||
15:16
donaldh joined,
dvinciguerra_ joined
|
|||
gfldex | dogbert17: a pointy block is a Block, what is lower in the chain then A Routine. | 15:16 | |
Xliff | timotimo: Still getting same error. | ||
gfldex | dogbert17: IIRC nexsame and/or callwith fire control exceptions | 15:17 | |
dogbert17 | gfldex: dunno what it should look like but note that I took this from docs.perl6.org/language/functions | ||
gfldex | dogbert17: `return` basicylly _is_ a control exception, that's where the LTA error message comes from | ||
timotimo | are you sure nextsame and callwith work via control exceptoins? | 15:18 | |
... toins? | |||
dogbert17 | gfldex; so does that mean that the example is incorrect? | ||
Xliff | timotimo: github.com/Xliff/p6-XML-LibXML.git. Checkout 07dtd branch. Then run "perl6 -Ilib t/07dtd" to see what I am talking about. | ||
Gotta split for a bit. | |||
gfldex | dogbert17: since we don't got automatic testing on our examples and some of them are quite old, there will be broken examples | 15:19 | |
i know because I fixed a few already | |||
timotimo | i'm not sure i actually can figure that out now | ||
dogbert17 | gfldex: I've fixed a few too but in this case I don't know how it should look ;( | 15:20 | |
in order to do what the author intended | |||
gfldex | m: gist.github.com/gfldex/ecde10b59aa...dc4e74ddf0 | 15:22 |