»ö« Welcome to Perl 6! | perl6.org/ | evalbot usage: 'p6: say 3;' or rakudo:, std:, or /msg camelia p6: ... | irclog: irc.perl6.org | UTF-8 is our friend!
Set by masak on 12 May 2015.
00:05 kjs1 joined 00:09 softmoth joined, rabie joined 00:10 rabie left 00:12 kjs1 left
cognominal_ m: say prefix:<-«>(2,3,4,) 00:13
camelia rakudo-moar 36c4c6: OUTPUT«5===SORRY!5=== Error while compiling /tmp/T6w0zpkrtQ␤Undeclared routine:␤ prefix:<-«> used at line 1. Did you mean 'prefix:<->', 'prefix:<-->', 'prefix:<~>', 'prefix:<so>'?␤␤»
00:14 softmoth left
cognominal_ here, it says : Cannot find method 'is_dispatcher' 00:14
00:15 leont left 00:21 BenGoldberg left 00:22 BenGoldberg joined, RabidGravy left 00:23 BenGoldberg left, BenGoldberg joined 00:30 spider-mario left
TimToady currently it requires the & 00:30
00:31 lichtkind left
cognominal_ m: say &prefix:<-«>(2,3,4,) 00:33
camelia rakudo-moar 36c4c6: OUTPUT«Too many positionals passed; expected 1 argument but got 3␤ in block <unit> at /tmp/9OXQ6KsDu6:1␤␤»
TimToady and currently it requires exactly one argument, but may be able to relax both of those
cognominal_ ok, I was just experimenting 00:35
TimToady I had it working with multiple for prefixes, but had trouble with postfixes for some reason, but maybe I'm past that
00:41 xdoctor joined 00:42 dayangkun joined
TimToady nope, still gets upset, so we'll continue to restrict unaries to, like, one argument :) 00:48
00:48 cygx left, raiph joined 00:49 pmurias left 01:00 tokuhirom_h joined
zengargoyle is there a hash like thing that takes a list/array/not-string as key? 01:12
01:13 tokuhirom_h left
zengargoyle m: my $i = 1,2,3; my %h = $i => 'foo'; say %h{$i}; 01:13
camelia rakudo-moar 36c4c6: OUTPUT«WARNINGS:␤Useless use of constant integer 2 in sink context (line 1)␤Useless use of constant integer 3 in sink context (line 1)␤foo␤»
zengargoyle m: my $i = 1,2,3; my %h; %h{$i} = 'foo'; say %h{$i}; 01:15
camelia rakudo-moar 36c4c6: OUTPUT«WARNINGS:␤Useless use of constant integer 2 in sink context (line 1)␤Useless use of constant integer 3 in sink context (line 1)␤foo␤»
zengargoyle m: my $i = (1,2,3); my %h; %h{$i} = 'foo'; say %h{$i}; 01:16
camelia rakudo-moar 36c4c6: OUTPUT«foo␤»
zengargoyle m: my $i = (1,2,3); my %h; %h{$i} = 'foo'; say %h{$i}:exits;
camelia rakudo-moar 36c4c6: OUTPUT«Unexpected named parameter 'exits' passed␤ in block <unit> at /tmp/y01kgnyyER:1␤␤»
zengargoyle m: my $i = (1,2,3); my %h; %h{$i} = 'foo'; say %h{$i}:exists;
camelia rakudo-moar 36c4c6: OUTPUT«(False False False)␤»
flussence m: say :{ [1,2,3] => 'foo' }.perl;
camelia rakudo-moar 36c4c6: OUTPUT«:{[1, 2, 3] => "foo"}␤»
01:17 ilbot3 left
zengargoyle what's the : there? 01:17
flussence m: my %h{Array} = [1,2,3] => "foo"; say %h{[1,2,3]};
camelia rakudo-moar 36c4c6: OUTPUT«Type check failed in binding key; expected Array but got Int␤ in block <unit> at /tmp/duz4BOA0AS:1␤␤»
flussence the : means "don't coerce keys to Str by default" 01:18
m: my %h{Array} = [1,2,3] => "foo"; say %h{$[1,2,3]};
camelia rakudo-moar 36c4c6: OUTPUT«(Any)␤»
flussence m: my %h{Array} = [1,2,3] => "foo"; say %h{[1,2,3].item};
camelia rakudo-moar 36c4c6: OUTPUT«(Any)␤»
flussence m: my %h{Array} = [1,2,3] => "foo"; say %h.perl;
camelia rakudo-moar 36c4c6: OUTPUT«(my Any %{Array} = [1, 2, 3] => "foo")␤»
flussence m: my %h{Array} = [1,2,3] => "foo"; say %h{%h.keys[0]}; 01:19
camelia rakudo-moar 36c4c6: OUTPUT«Type check failed in binding key; expected Array but got Int␤ in block <unit> at /tmp/qS7TuNMzTE:1␤␤»
flussence well that's awkward...
zengargoyle how would : work in general like %h:{$something} ? 01:20
psch zengargoyle: no, :{} is the shorthand for %{Any}
zengargoyle ah
flussence if you want to use a named hash var, just do "my %h{Any}".
zengargoyle m: my $i = (1,2,3); my %h{Any}; %h{$i} = 'foo'; say %h{$i}:exists; 01:21
camelia rakudo-moar 36c4c6: OUTPUT«(False False False)␤»
psch (where '%{Any}' is actually somewhat distractingly shortened)
zengargoyle how do i keep $i from turning into a slice with :exists?
psch m: (my %{Any} = { &infix:<+> => 1 }).keys[0].WHAT.say
camelia rakudo-moar 36c4c6: OUTPUT«Potential difficulties:␤ Useless use of hash composer on right side of hash assignment; did you mean := instead?␤ at /tmp/hSpvsrzbnb:1␤ ------> 3(my %{Any} = { &infix:<+> => 1 }7⏏5).keys[0].WHAT.say␤Sub+{<anon|57909456>}+{Precedence}…» 01:22
psch m: (my %(){Any} = { &infix:<+> => 1 }).keys[0].WHAT.say
camelia rakudo-moar 36c4c6: OUTPUT«5===SORRY!5===␤The () shape syntax in hash declarations is reserved␤at /tmp/pVCmFNy1JV:1␤------> 3(my %(7⏏5){Any} = { &infix:<+> => 1 }).keys[0].WH␤Other potential difficulties:␤ Useless use of hash composer on right side of hash ass…»
psch yeah, it doesn't work like that...
01:22 finanalyst joined
zengargoyle i was fine with it stringifying, but then it sliced... 01:22
01:22 ilbot3 joined
psch zengargoyle: i'd say report this 01:23
m: my $i = (1,2,3); my %h{Any}; %h{$i} = 'foo'; say %h.EXISTS-KEY($i) # this works
camelia rakudo-moar 36c4c6: OUTPUT«True␤»
zengargoyle ended up doing something like %hash{"$i"}
psch and %h{$key} should be equivalent, barring any design concerns
zengargoyle: to clarify, please open an RT ticket
zengargoyle also seems to behave differently than %h<<$i>>
BenGoldberg m: (my % {Any} = ( &infix:<+> => 1 )).keys[0].WHAT.say
camelia rakudo-moar 36c4c6: OUTPUT«5===SORRY!5=== Error while compiling /tmp/m_vtOg4f1t␤Unexpected block in infix position (missing statement control word before the expression?)␤at /tmp/m_vtOg4f1t:1␤------> 3(my %7⏏5 {Any} = ( &infix:<+> => 1 )).keys[0].WH␤ expecting a…»
BenGoldberg m: (my % = ( &infix:<+> => 1 )).keys[0].WHAT.say 01:24
camelia rakudo-moar 36c4c6: OUTPUT«Sub+{<anon|57909456>}+{Precedence} object coerced to string (please use .gist or .perl to do that) in block <unit> at /tmp/HgttH4iHj8:1␤(Str)␤»
zengargoyle psch: will do in a bit after coming up with a test case of some sort.
psch zengargoyle: fwiw, the bit you're tried with camelia seems sufficient to showcase the WAT 01:25
zengargoyle: as in, assigning to the key $i works, but fetching it doesn't
01:25 aborazmeh joined, aborazmeh left, aborazmeh joined
zengargoyle cool, i still take it the %h{Any} part is important as well. 01:25
psch just stuff everything into the ticket :P 01:26
zengargoyle :)
heh, test case breaks Test 01:40
01:40 mike` joined 01:41 tokuhirom joined 01:46 tokuhirom left 01:57 aborazmeh left 01:58 softmoth joined 02:02 softmoth left
zengargoyle rakudobug filed. 02:12
konobi pmurias: oh sorry... I'm generally available during PST. 02:14
pmurias: assuming we can get a 1-on-1 chat... i think we can get the node stuff cleared... I know how it all works. 02:15
02:21 shinobi-cl joined
masak good morning, #perl6 02:22
konobi where is jnthn these days? 02:23
masak you mean, like, geographically?
masak .oO( physical location! how quaint! )
konobi masak: more TZ wise 02:24
=0P
masak oh. he's in CET, still.
which is UTC+1 in the winter. 02:25
konobi rgr
masak I had a random thought about typecasting. so, I'm reading this book on algebra, and it said something like "in a legalistic sense, the real number c ∈ ℝ is a different mathematical object than the constant polynomial c ∈ ℝ[X] -- but we're not going to be sticklers so you'll see the former sometimes when it's clear that the latter is intended" 02:28
and I just thought, hm, that has happened to me too. 02:29
in programming.
so -- this is wildly conjectural, and may be a really bad and silly idea for reasons that I don't see right now. caveat emptor.
but, let's say we had a phenomenon called "type subsumption" (NB: masak's made up name. maybe this exists and is called something better) 02:30
I'll give two examples:
(a) in 007, we often end up creating identifiers out of strings. it looks like this: Q::Identifier("foo"). there's a strong natural temptation to just use "foo" where Q::Identifier("foo") was expected. type subsumption would notice the "have Str, want Q::Identifier" situation, and automatically type-cast (in this case, wrap) the Str into a Q::Identifier 02:31
02:32 raiph left
masak (b) the Perl 6 FAQ of people wanting to `my Rat $r = 7` (Int ~~> Rat) and `my Num $n = 5/2` (Rat ~~> Num) is a type subsumption situation. people's intuition yell at them that it's *one* number line and those types may not be subclasses of each other in the OO sense, but they sure are subsumable in the ways shown. 02:33
I can see jnthn's objection already -- that this would be an epicycle and Yet Another Exception on the type system, degrading it further. and I agree, I think. 02:35
but maybe it should be a pragma? or a module in the ecosystem. something that allows you to predeclare "I'm willing to take a performance hit on typechecking so that I don't have to cast these things manually" 02:36
02:38 xdoctor left 02:39 raiph joined
AlexDaniel m: my Num $n = (5/2).Num; say $n; # a bit annoying indeed, but not much 02:40
camelia rakudo-moar 36c4c6: OUTPUT«2.5␤»
masak I'm fully aware of the "it's not hard to do the explicit cast" argument. 02:41
there seems to be a vocal contingent that isn't satisfied with that, though. and I kind of understand them.
it does somehow feel like stopping short of the expected levels of excellence and DWIM. 02:42
AlexDaniel I think that it is more “annoying” than “not much”, so I pretty much agree
psch .u ℝ
yoleaux U+211D DOUBLE-STRUCK CAPITAL R [Lu] (ℝ)
psch i don't know what |R[X] is supposed to mean 02:43
(where |R is ℝ)
masak psch: it's the ring of polynomials over ℝ in one unknown X
psch ah, my ring intuition is underdeveloped, i might read up on that tomorrow 02:44
oh wait
02:44 ilbot3 left
psch is that just any polynomial that has one unknown 02:44
masak yes
with real coefficients
psch hmm
masak and "ring" here just means "you can + and *, and it works like you'd hope" 02:45
psch yeah, i know algebraic rings
masak then you've arrived already :)
psch still, i'll have to think about it :P
i'll be back with potential insight tomorrow o/ 02:46
masak well, do you agree that 5 and Polynomial([5]) are incompatible types on the face of it?
psch i reserve the right to agree or not agree tomorrow, i need rest :)
masak sure thing
ugexe io::socket::async with a sync wrapper + io::socket::ssl, but i can't figure out a better way to handle a byte count request greater than what is left to still be read other than to read 1 byte at a time (and its crushing performance) gist.github.com/ugexe/71d82eb4bb5653125bd8
02:46 ilbot3 joined 02:50 raiph left 02:52 Oatmeal left, raiph joined 02:54 vendethiel joined 02:59 Oatmeal joined 03:10 shinobi-cl left
masak the test file t/spec/S17-scheduler/at.rakudo.moar aborts here after 'ok 15': "Method 'cancel' not found for invocant of class 'Any'" 03:14
similarly, t/spec/S32-array/pop.rakudo.moar aborts after 'not ok 34': "Method 'Int' not found for invocant of class 'Any'" 03:15
apart from that, my spectest run today is clean. 03:16
03:16 weihan joined 03:18 vendethiel left
masak "It’d be nice, to eventually see the day where JavaScript is able to precisely compute decimal arithmetic as well as able to represent large integers safely." -- heh. sounds familiar somehow. :P -- ponyfoo.com/articles/es6-number-im...s-in-depth 03:22
03:23 raiph left 03:43 tokuhirom joined 03:46 softmoth joined, telex left 03:47 tokuhirom left, BenGoldberg left 03:48 telex joined 03:50 softmoth left, mike` left 04:00 raiph joined 04:05 llfourn joined 04:14 bjz_ left 04:22 raiph left 04:33 raiph joined 04:38 abaugher left 04:40 abaugher joined 04:41 skarn joined 04:42 riatre joined 05:01 atweiden joined 05:03 gtodd left
atweiden i'm getting unexpected results when passing a regex with a closure: gist.github.com/atweiden/ce8aa39e506ebb969898 05:04
05:04 gtodd joined 05:06 Sgeo_ joined
atweiden is this the correct way to grep where $name is of type Regex? @people.grep({ .name ~~ $name }) 05:06
TimToady that should work 05:09
masak looks fine, yes
05:14 kaare_ joined 05:19 Sgeo_ left 05:20 Sgeo joined 05:34 softmoth joined 05:38 softmoth left 05:43 tokuhirom joined 05:48 tokuhirom left 06:00 WizJin joined, WizJin left 06:06 cognominal_ left 06:11 weihan left 06:12 [BNC]WizJin joined, [BNC]WizJin left 06:13 adhoc left, bjz joined 06:20 skids left 06:24 AlexDaniel left 06:25 tokuhirom joined, raiph left 06:29 tokuhirom left 06:45 atweiden left, mr-foobar left 06:56 mr-foobar joined 07:06 kmel joined 07:18 kmel left, kmel joined
kmel hello 07:18
masak ahoj, kmel 07:19
kmel hiya masak
this piece of code is not returning any value: 07:20
class Human { has $!name; method name { self.name; } }; my $john = Human.new(name => 'John'); say $john.name;
i know the . twigil will automatically declare an accessor for me, but i was trying to see what happens if i declare one myself. 07:21
dalek kudo/nom: 40de1a0 | TimToady++ | src/Perl6/Grammar.nqp:
support autogen on sigilless and &[] forms too
ast: e348d4f | TimToady++ | S03-metaops/ (6 files):
test autogen on sigilless and &[] forms
masak kmel: it's an infinite loop
kmel the above code goes into infinite loop 07:22
masak kmel: `self.name` means "call the method name"
kmel: the method that statement is in, that is
kmel: you probably meant `$!name`, not `self.name`
07:22 softmoth joined
masak kmel: another, shorter way of doing what you want is `has $.name;` with a dot 07:22
then you don't need to write the getter method yourself -- Perl 6 does it for you 07:23
TimToady you can still override if you declare with .
masak also, if you use ! in the attr declaration, then you cannot pass it into (the default) .new the way you do now
m: say <a b c> >>~>> "foo"
camelia rakudo-moar 36c4c6: OUTPUT«(afoo bfoo cfoo)␤»
masak m: say (:a, :b, :c) >>~>> "foo" 07:24
camelia rakudo-moar 36c4c6: OUTPUT«Cannot modify an immutable Pair␤ in block <unit> at /tmp/6Y7aczZpV1:1␤␤»
masak I don't understand this error -- could someone enlighten me?
m: say :a ~ "foo"
camelia rakudo-moar 36c4c6: OUTPUT«a Truefoo␤»
kmel m: class Human { has $!name; method name { $!name; } }; my $john = Human.new(name => 'John'); say $john.name; 07:25
camelia rakudo-moar 36c4c6: OUTPUT«(Any)␤»
Hotkeys m: say [~] (:a, "foo")
camelia rakudo-moar 36c4c6: OUTPUT«a Truefoo␤»
kmel m: class Human { has $.name; method name { $!name; } }; my $john = Human.new(name => 'John'); say $john.name;
camelia rakudo-moar 36c4c6: OUTPUT«John␤»
kmel thanks masak and TimToady 07:26
Hotkeys m: say (:a, :b, :c) >>~>> ("foo", "foo", "foo")
camelia rakudo-moar 36c4c6: OUTPUT«Cannot modify an immutable Pair␤ in block <unit> at /tmp/yxKlVUI6eQ:1␤␤»
masak kmel: the above method overriding works, but it's redundant because Perl 6 already gives you that
m: class Human { has $.name }; my $john = Human.new(name => 'John'); say $john.name 07:27
camelia rakudo-moar 36c4c6: OUTPUT«John␤»
TimToady m: say (:a, :b, :c) X~ "foo"
camelia rakudo-moar 36c4c6: OUTPUT«(a Truefoo b Truefoo c Truefoo)␤»
07:27 softmoth left
TimToady seems specific to hypers 07:27
kmel yes masak but the one above doesn't work
m: class Human { has $!name; method name { $!name; } }; my $john = Human.new(name => 'John'); say $john.name;
camelia rakudo-moar 36c4c6: OUTPUT«(Any)␤»
kmel it seems i have to declare it with the . twigil and then override it
TimToady yes, he just said you need a . to initialize in new 07:28
masak I did say that :) 07:29
ShimmerFairy kmel: you actually don't need to define that 'method name' for a $.name declaration
TimToady kmel said that too :) 07:30
masak submits >>~>> rakudobug
kmel yes ShimmerFairy I was trying to define it myself (the rationale being a case where i need to override accessors) 07:31
ShimmerFairy kmel: sure, nothing wrong with providing different accessors, just mentioning that the specific example shown here is redundant :) 07:32
kmel ShimmerFairy oh yes definetly! 07:33
masak .oO( not only redundant, but redundant! ) 07:34
Hotkeys oops I forgot to run the rakudobrew build in the magical visual studio prompt 07:36
kmel m: say 'kmel is too lazy to provide a comprehensible example so he just wrote a redundant method';
camelia rakudo-moar 36c4c6: OUTPUT«kmel is too lazy to provide a comprehensible example so he just wrote a redundant method␤»
kmel I hear laziness is a good thing?
masak depends on the laziness ;) 07:38
Hotkeys meanwhile on my vps
Makefile:427: recipe for target 'CORE.setting.moarvm' failed
kmel masak ;)
Hotkeys my computer got through that stage though 07:40
wonder why my vps is getting angry
kmel what is considered more idiomatic 07:42
this: class Human { has $.age; method assess-eligibility {if $!age < 21 {'No'} else {'Yes'}}}
or this: class Human { has $.age; method assess-eligibility {if self.age < 21 {'No'} else {'Yes'}}}
TimToady --> zzz & 07:43
Hotkeys I want to say the former, but I'm no expert 07:45
masak I find myself using either more or less interchangeably. 07:48
they *do* have a semantic difference: if you subclass Human and provide an overridden method `age`, the second variant will pick up the overridden method. 07:49
kmel indeed
masak so in a sense it depends what you want to happen in that case. but I find that most of the time I don't prepare classes for being overridden like that, although maybe I should.
Hotkeys would using a ternary instead of an if be less idiomatic?
Hotkeys likes ternaries
kmel Hotkeys ternary? 07:50
masak from a Smalltalk "late-bind all the things" point of view, you ought to use the method form
Hotkeys class Human { has $.age; method assess-eligibility { $!age < 21 ?? 'Yes' !! 'No' }}
masak I'd do the ternary there
I always do when it's about a returned value
Hotkeys plus you get to get rid of a few curlies
masak oh, and another variant is `$.age` -- which means the same as `self.age` 07:51
Hotkeys so that would get picked up on an override?
masak yes 07:52
because `self.age` and `$.age` are interchangeable, modulo some itemization, maybe
kmel i like the ternary thing
Hotkeys yeah nice and clean and generally readable unless you chain them like a madman 07:53
masak easiest to think of ?? !! as an if statement but for expressions 07:54
if you start chaining, then probably what you want is a small given/when
Hotkeys doing some stackoverflow codegolf and happy to report you can still make gross looking code in perl 6 07:55
@*ARGS[0].trans(/\d/=>{[~](0..$/)},/<:L>/=>{[~] samecase("a",~$/)..~$/}).say
what a beauty 07:56
07:56 adhoc joined
kmel Hotkeys are you trying to scare me with this code ^ 07:57
because i am :(
Hotkeys it's really not super complicated
just looks like it in one line
masak kmel: the thing to know is that "golf" is for people who like to compress code to as few characters as possible.
nine Is it true that I cannot use a custom .new of a Perl 6 object from NQP? 07:58
masak kmel: the above code can certainly be written more clearly if that is the goal.
Woodi hallo #perl6 :)
07:59 mr-foobar left
kmel masak: i see 07:59
thanks for the explanation
Hotkeys here it is expanded out a bit pastebin.com/38TBK0fj
basically it replaces all digits in the string with 0..digit 08:00
and all letters with a..letter, in the same case
I'm sure someone more savvy might be able to save a few characters somewhere in there 08:01
but that's the best i could do
I actually was able to get it to that size because I saw someone talking about the samecase function in here just before I did it 08:02
otherwise I would've just matched each case separately
08:02 FROGGS joined
Woodi masak: about [something like] subsumptions & just my subjective impresion: pre GLR lists features was tangled with sugared syntax, now we have more clear "rules", etc but I somehow think sugar syntaxes aka user-friendly-DWIMs are implicitly prohibited... 08:03
kmel i still have a lot to learn.
Hotkeys anyone know why I'm getting this error building rakudo w/ rakudobrew
Makefile:427: recipe for target 'CORE.setting.moarvm' failed
on Ubuntu 15.04
nine Hotkeys: can you paste the full rakudobrew output on gist.github.com? 08:04
Woodi masak: so, i think "sugar" syntax should be allowed on top of the language, somehow. and obviously proverbial jnthn++ is right about language but sugar coating users want is from other "layer"...
Hotkeys the whole thing or just the relevant section
nine Hotkeys: can't hurt to have the whole thing 08:05
Hotkeys alright one minute 08:08
masak Woodi: it's weird to me to think of this as "sugar" (because it actually changes semantics, not syntax) -- but I think I see your point. 08:11
08:15 darutoko joined 08:17 diana_olhovik_ joined 08:21 rindolf joined 08:22 xfix joined, firstdayonthejob joined 08:25 tokuhirom joined 08:27 protium left 08:30 tokuhirom left 08:31 diana_olhovik_ left
Woodi also I think i realy hate "casting". probably becouse a) I don't know/learn where to put it; b) it's SO UGLY in any language I seen so far... 08:32
when moust-common-case is well known then some DWIM could be handy instead of "use cast, always"... 08:34
Hotkeys nine: gist.github.com/johnspurr/934c87ecac2f799dc49e 08:35
08:35 RabidGravy joined
masak Woodi: arguing the other side, though; there is a clear sense in which every implicit casting degrades the ability of the type system to flag up type errors. 08:36
Woodi masak: yes and no 08:37
Hotkeys It gets a little bit angry in a few places
But it only gets really angry at the end
Woodi yes - what you said; no - becouse sugar layer should be "invisible" for language layer 08:38
llfourn Woodi: isn't that what coercions like Int() is for?
masak Woodi: I'm not sure what you mean.
Woodi llfourn: we thinking about not using implicit casting here :) 08:39
nine Hotkeys: This is strange: "Stage parse : Killed"
Hotkeys: could it be that it runs into some resource limit? Maybe it uses too much memory? 08:40
Woodi masak: i understans "sugar" as something what is automatically un-golfed as it is parsed into proper language. so that sugar do not degrade anything
masak I wasn't talking about implicit casting at all. subsumption would likely be governed by the target type declaring some method or other, like `method subsume(Int $n) { $n.Rat }`
nine Hotkeys: stage parse can eat a GB or two of RAM
masak Woodi: right, "sugar" is a syntactic thing. the subsumption we're talking about is not.
Hotkeys Oh
08:41 diana_olhovik_ joined
Woodi even ingy Hotkeys last gist there are many warning in MoarVM compilation becouse someone do not put casting :) 08:41
Hotkeys It *is* only a baby vpa
Vps
Maybe it is running out mem
Woodi masak: probably, I just thinked it is similiar thing :)
08:41 ShimmerFairy left
Hotkeys Cab I compile it for Ubuntu on my windows machine 08:42
nine Hotkeys: I don't think so, no.
Hotkeys Darn 08:43
nine Hotkeys: maybe you can add some swap on your Vps?
Hotkeys I suppose I could 08:44
nine Ok, how can I get at CompUnit::Handle from nqp? I get the impression that gethllsym finds only symbols that were added from nqp with bindhllsym.
Hotkeys I'll do it tomorrow
Because I'm in bed and can't be bothered to set up ssh keys with my phone right now 08:45
08:45 protium joined
nine Hotkeys: or today and let it compile over night. Using swap for this will probably make it extremely slow ;) 08:45
Hotkeys Having perl 6 on my vps isn't time sensitive :p 08:46
Just wanted it for fiddling around
Maybe making an irc bot for funsies
08:49 xyf joined 08:55 diana_olhovik_ left
Woodi m: my Rat $a = 7 08:58
camelia rakudo-moar 40de1a: OUTPUT«Type check failed in assignment to $a; expected Rat but got Int␤ in block <unit> at /tmp/ZcbOWJJHUy:1␤␤»
Woodi for me at declaration time it should just work...
masak Woodi: I think the word you're looking for is "convenience", not "sugar" 09:00
Woodi: "at declaration time"? what about `my $n1 = 7; my Rat $n2 = $n1` ?
Woodi masak: 'my Rat .+' is just better&complete notation for cast then: my Rat = (Rat) $n1 :) 09:02
masak: yes, ATM I do not see difference between sugar and convenience... 09:03
*then my Rat $n2 = $n1
grr... 09:04
masak "sugar" is when there's a short/nice form of some feature, and the longer form works just the same. I guess you could argue that the *lack of typecasting* (i.e. the empty) string counts as a kind of sugar, but I don't like to think of it as that. 09:05
Woodi: `my Rat $n2` means this: "I want the compiler and runtime to flag up an error whenever someone puts a value in $n2 that is not a Rat". that's what type-checking is. 09:06
this is what needs to be understood in order to understand why auto-casting stuff degrades the type-checking. 09:07
09:10 softmoth joined
Woodi masak: ok, so let's: my Rat $a = <Int>+; work as lazy users want and: = $b as failure :) 09:10
kmel what is the use of class variables?
in practice 09:11
Hotkeys Gives your classes something to hold
masak Woodi: I think that would be easier to arrange, yes. I'm still not sure that's a good solution, though. or if people would just become annoyed at new inconsistency, and that'd become a new FAQ. 09:12
kmel: "class variables"?
kmel masak: class attributes 09:13
masak kmel: not much of a use case in well-designed OO, I'd say. thing is, the world is full of real-world compromises. 09:15
09:15 softmoth left
masak Woodi: also, for which pairs of types would this be made to work? Int ~~> Rat and Rat ~~> Num, for sure. what about Real ~~> Complex? what about Bool ~~> Int? Int ~~> Bool? Str ~~> Numeric? 09:16
kmel doc.perl6.org/language/classtut#Static_fields%3F
masak there's some kind of slippery slipe there.
kmel: hm, "fields" is not a Perl OO term. that should probably be changed in the classtut.
we call them "attributes", like you did above. 09:17
"fields" from a Perl perspective sounds like something in a column in a record you read from a file :)
kmel well since you will be changing the classtut can you provide a more straightforward example for class attributes? 09:20
as someone who is new to Perl 6, i didn't really understand the example 09:21
masak what non-contrived example would you suggest? :)
masak hasn't looked at the current example 09:22
Woodi masak: Int -> Rat -> Num should work. declaration: my [Int|Rat|Num] $a is realy clear, IMO 09:23
kmel hehe, i don't know something a la java
an attribute that holds how many objects of that class were created 09:24
each time you call new() it gets incremented 09:25
Woodi masak: Str into number and Number into Bool is probably language design.
nine Finally! my $CompUnitHandle := nqp::who($*W.find_symbol(["CompUnit"])).AT-KEY('Handle'); 09:26
Woodi nine: but weekend just started ;) 09:27
nine Woodi: my plan is not to spend all of the weekend on this ;) 09:29
09:29 Psyche^ left 09:30 Psyche^ joined 09:34 xinming_ joined 09:35 spider-mario joined
Woodi btw. it is crazy that automating casting do not work like it do in human brain... 09:41
09:42 xyf left 09:44 mj41 joined
Woodi U: Cortana, how many thieves goes through that window ? C: Errr... I don't realy know what to say... U: WHAT ?? C: You see, first was two but one left with something and there was only one... So my co-procesor send me 1.5 but I have humans as Int type... 09:45
lizmat good *, #perl6! 09:51
dalek kudo/curli: 4ddc391 | (Stefan Seifert)++ | src/ (3 files):
Have load_module return a CompUnit::Handle istead of a bare Stash

This is a step towards moving more functionality into CompUnit::Handle.
09:51 vendethiel joined
lizmat m: dd Pair.new 09:51
camelia rakudo-moar 40de1a: OUTPUT«Pair $var = Mu => Mu␤»
09:52 firstdayonthejob left
lizmat masak: ^^^ is the source of #126510 09:52
synbot6 Link: rt.perl.org/rt3/Public/Bug/Display...?id=126510
lizmat I'm not sure what a Pair.new would need to do without having been specifified a key or value 09:53
09:55 xyf joined
nine Ah, even easier: $*W.find_symbol(["CompUnit", "Handle"]); 09:58
10:01 Alina-malina left
RabidGravy tadzik, I've done another PR for JSON::Unmarshal github.com/tadzik/JSON-Unmarshal/pull/6 when you have a moment :) 10:02
masak kmel: your class attribute musings reminded me of strangelyconsistent.org/blog/i-can-haz-constant 10:03
kmel masak: i am reading it 10:04
masak kmel: notably, "When I learned about `static` fields in Java, even the examples were contrived."
(and then the example you suggested above, which I can't recall needing in practice.)
10:05 dayangkun left
masak m: class Car { my $.cars-produced; submethod BUILD { $!cars-produced++ } }; Car.new xx 3; say Car.cars-produced 10:05
camelia rakudo-moar 40de1a: OUTPUT«5===SORRY!5=== Error while compiling /tmp/TAvDBBaLhV␤Attribute $!cars-produced not declared in class Car␤at /tmp/TAvDBBaLhV:1␤------> 3 submethod BUILD { $!cars-produced++ } }7⏏5; Car.new xx 3; say Car.cars-produced␤ expecting any of:…»
masak hm. 10:06
kmel m: class Human {has $.name;my $.counter = 0;method new($name) {self.bless(:$name);Human.counter++;}}my $a = Human.new('a');my $b = Human.new('b');say Human.counter;
camelia rakudo-moar 40de1a: OUTPUT«5===SORRY!5=== Error while compiling /tmp/ByT5NCxJij␤Strange text after block (missing semicolon or comma?)␤at /tmp/ByT5NCxJij:1␤------> 3) {self.bless(:$name);Human.counter++;}}7⏏5my $a = Human.new('a');my $b = Human.new␤ expecting an…»
masak m: class Car { my $cars-produced; submethod BUILD { $cars-produced++ }; method cars-produced { $cars-produced } }; Car.new xx 3; say Car.cars-produced 10:07
camelia rakudo-moar 40de1a: OUTPUT«3␤»
masak ...I thought I distinctly remembered `my $.cars-produced` giving me both the `my` variable and the accessor.
kmel m: class Human {has $.name; my $.counter = 0; method new($name) { self.bless(:$name); Human.counter++; } }; my $a = Human.new('a'); my $b = Human.new('b'); say Human.counter;
camelia rakudo-moar 40de1a: OUTPUT«2␤»
10:08 kjs_ joined
kmel masak: this is the only example i learned while taking a java course. I don't know if it can be used in practice or not. I'll take your world for it. 10:09
lizmat masak: re #126510 , I think the problem is really that the hyper expects something Iterable, and a Pair is not
synbot6 Link: rt.perl.org/rt3/Public/Bug/Display...?id=126510
masak kmel: I think the thing to understand about class-level variables is that they are morally indistinguishable from globals.
kmel: and thus have all the pitfalls and anti-patterns globals have. 10:10
kmel: I once thought I had a great use, until I wanted to test that code base. then it all broke down and turned out to be a really bad idea.
kmel: I remember mst materializing after I said that here on channel, muttering "I could have told you that" :P
lizmat: huh. I know I haven't been following along with all the "nodal" shenanigans lately, but (a) I'm not trying to iterate inside the pairs, and (b) it's talking about mutating the pair, which also I'm not. 10:12
kmel masak: ok then, class attributes are the devil :)
masak lizmat: note that it does work as advertized with X~, as TimToady showed.
lizmat: and this is from code in a production code base that used to work.
kmel masak: thanks for your explanation
lizmat masak: basically it's doing $type.new and then try to assign the result into that
10:13 isBEKaml joined, Alina-malina joined
masak lizmat: even after your explanation above, I still kind of expect it to work (and I'm confused as to why mutation needs to happen) 10:13
lizmat my $type = left.WHAT; 10:14
my \result := $type.new;
result = @keys Z=> HYPER(&op, left{@keys}, right, :$dwim-left, :$dwim-right);
vendethiel RabidGravy: second-class multi dispatch (as in, pattern matching :P) is also pretty great 10:15
moritz maybe coercion could make it work? 10:17
isBEKaml OHHAI, folks -- been a while, it's good to see all that activity around bugsquashing on RT :-)
moritz (left.WHAT)(@keys Z=> HYPER(&op, left{@keys})
lizmat perhaps the problem is caused by Pair being Associative ? 10:18
Woodi about globals: do function + global varible [+ programming discipline] is equivalent to closure ?
moritz Woodi: no 10:19
Woodi: with a global variable you only ever get one instance of a cosure
Woodi moritz: ah, right
isBEKaml There used to be a --with-moar option on nqp's configure script, right? Or am I not remembering correctly? 10:20
masak isBEKaml: --gen-moar ? 10:21