🦋 Welcome to Raku! raku.org/ | evalbot usage: 'p6: say 3;' or /msg camelia p6: ... | irclog: colabti.org/irclogger/irclogger_log/raku
Set by ChanServ on 14 October 2019.
rypervenche Is there a short way to do: $var = -$var; ? 01:47
timotimo you can *= -1 01:56
rypervenche Oooh 02:28
Thank you much.
Why might this give me "Use of Nil in numeric context"? my Int:D $operand = +$<integer> // 0; Shouldn't it use 0? 02:31
rypervenche Oh, it's the + . Hmmm. 02:34
timotimo yeah, if you want you can "quietly" that to get rid of the warning message, otherwise maybe you like "my Int:D $operand = 0; $operand = +$_ with $<integer>" 02:44
m: my Int:D $op = +$<integer> orelse 0; 02:46
camelia WARNINGS for <tmp>:
Useless use of constant integer 0 in sink context (line 1)
Use of Nil in numeric context
in block <unit> at <tmp> line 1
timotimo m: my Int:D $op = (+$<integer> orelse 0);
camelia Use of Nil in numeric context
in block <unit> at <tmp> line 1
timotimo m: my Int:D $op = try +$<integer> orelse 0;
camelia WARNINGS for <tmp>:
Useless use of constant integer 0 in sink context (line 1)
Use of Nil in numeric context
in code at <tmp> line 1
timotimo m: my Int:D $op = try +$<integer> // 0;
camelia Use of Nil in numeric context
in code at <tmp> line 1
rypervenche Guess I'll do that then. 02:52
timotimo i mean, if you have a grammar you may have different ways to react to how you parsed the input 02:54
even in a normal regex, you can use code blocks inside an alternation
rypervenche Yeah, I'm using a regex. Oh! I should probably be doing this in a with statement actually. 02:57
guifa What about 02:58
$<integer>.?Int instead?
Weird. That still produces it 02:59
Also, I thought Nil was suppsoed to return Nil on all method calls ? 03:00
timotimo isn't .?blah more about "does a blah method exist"
rypervenche This is essentially what I'm working on. Just a little practice project. gist.github.com/rypervenche/8b325e...2b9a52ed0e 03:02
timotimo ah 03:05
rypervenche You'll have to excuse the poorly named variables as well, haha. I challenged myself to do a friend's homework in Raku.
timotimo i'd say the "with $<operator>" line is a good approach
since that implies that something matched \d+
timotimo in general, you could even put all the work into an actions class 03:06
rypervenche Yeah, that might be better. Hmm, I'll have to create the variable outside of the with statement, or make it a dynamic variable if I want this to work this way... 03:09
timotimo grammars + action classes let you put parsing of input together with "reacting to the shape of parse results" 03:09
if you move operator + operand into its literal own method that has only the two things, the corresponding action method will only ever be called when operator and operand are both valid 03:12
alternatively, you can do the "code block inside of an alternation" thing i mentioned earlier, it's kind-of-sort-of the same thing as an action method 03:13
guifa timeless: the .?Int is supposed to be see if the method exists, and if so, call it, otherwise, return Nil 03:17
m: class A { method a { ‘aaa’ } }; say A.?a 03:18
camelia aaa
guifa m: class A { method a { ‘aaa’ } }; say A.?b
camelia Nil
timeless looks up 03:20
nope. not me. 03:21
guifa timeless: oops, sorry, meant timotimo
I was too quick with the tab :-)
timeless sorry about the delay, irccloud sends notifications to my phone on delay
timeless can be faster to complain ;-)
rypervenche Nice, used an actions and turned both possible outputs into a list. 03:54
And I think my last question for the night: There's no way to shorten this, is there? $!current-value = ($!current-value ÷ $num).Int; 03:58
timotimo you can use div, that does integer division 04:02
moon-child could go for $!current-value ÷= $num; $!current-value .= Int 04:03
rypervenche I've got $.current-value set as an Int:D though, so that wouldn't work. Oh, div! That does the job. 12:20
timotimo: Thank you much :)
[Coke] TIL why they call small alerts on a web page "Toast" 14:26
timotimo is it because they jump up from the bottom like a toast would from a toster? 14:27
[Coke] YES 14:35
tadzik I had no idea they're called toasts :o 14:36
tadzik I know about snackbars though, and I've no idea what do they have to do with snacks 14:36
pamplemousse That makes so much sense! 14:37
I think snackbars are because you have a bunch of different small options in a row, like you would at a snackbar 14:38
Like a snackbar at a deli, etc 14:39
tadzik hm, but the website snackbar is basically a small strip of text that disappears quickly
like a fortune from a fortune cookie :)
tobs let's not forget breadcrumbs! 14:44
timotimo hamburger menu 14:47
i think that's just because the symbol is typically ≡
patrickb .tell tony-o Have you seen github.com/tony-o/perl6-pluggable/pull/17 ? 15:10
tellable6 patrickb, I'll pass your message to tony-o
patrickb rba: The rakubrew releases still didn't make it to the website. :-( Can I poke you again? 15:11
tbrowder TIL TIL 15:36
guifa Is there a built in way to check if a given value matches a parameter? 15:38
$value ~~ $parameter doesn’t work
timotimo you can try matching against a signature 15:45
guifa` timotimo: yeah, I knew that, it's surprising I can't directly against a single parameter too 16:02
guifa` is creating a trait that allows for unordered positionals, assuming they're different types
I can write a routine to do the check manually, just feels like it should be built in ha 16:03
timotimo well, Parameter ~~ Parameter would surely check if one parameter accepts the same (or more?) things than another, but perhaps Any ~~ Parameter could do what you want? 16:04
guifa` Yeah, that was what I had tried, but it just returns false for everything that's not a parameter. Ah well. 16:07
timotimo right, it's not yet in the language obviously
but a parameter should also let you get the type check stuff it has
guifa` Doing it via smart match though would get you the weird case that you have a parameter whose type constraint is parameter. But I guess Signature has the same issue probably. I might code that up and see if folks think it worthy for core. 16:10
timotimo haha
oh my
guifa` All of this because I was thinking about how to make language tag creation easier :-) 16:12
moritz
.oO( guifa` is playing tag with language creators? :D )
16:28
guifa` taps moritz on the shoulder, screams "TAG" and runs off 16:29
moritz feels at a TAGtical disadvantage
MasterDuke are you wearing a TAG Heuer watch? that should help 16:32
[Coke] ... feeling very attagged right now. 16:49
moritz [Coke]: no wonder, you're our attagé here :D 17:24
andrzejku hi 18:07
tellable6 2020-09-23T18:24:43Z #raku <Xliff> andrzejku: The pieces are there to make some really nice games in Raku.
2020-09-23T18:25:11Z #raku <Xliff> andrzejku: However Raku's performance issues (particularly compiling) are offputting to most game developers.
2020-09-23T18:26:07Z #raku <Xliff> andrzejku: I actually wrote a generic card deck class a while ago. Never took the time to make a formal game out of it.
andrzejku I wanted to ask if status in raku gaming has changed?
Doc_Holliwould Are there any low level input libraries yet? 18:11
Methinks these are essential for a game
tadzik SDL bindings have been around for a while 18:12
andrzejku tadzik: mmm 18:14
tadzik: raku gaming would be great
tadzik: you wrote a snake, right? 18:15
tadzik I wrote something...
gfldex guifa`: like so? gist.github.com/gfldex/b94039d4bd5...4a23683ef1 18:40
guifa` gfldex: basically yeah :-) I'm doing a bit more checking (handling constraints, definedness, optionality, etc) and then wrapping it in a trait 18:43
gfldex .oO( is-unorderly ) 18:50
timotimo andrzejku: SDL2::Raw has a snake as an example 19:38
it's also got a simple particle system 19:39
andrzejku timotimo: nice 19:46
timotimo also something kind of resembling a vertical scrolling shmup 19:47
rypervenche guifa`: So I ran generate-template.raku and merged my changes into it, but I get this message when I simply import my module: gist.github.com/rypervenche/2b4dc5...f49fd2b1ec 19:53
guifa` rypervenche: unfortunately, there's a few of them that require some extra work before the first compile is successful =/ I've got notes on all them, but a quick way to find them all is look for SlurpySentry and $! (private vars). Annoying, I know 19:55
rypervenche guifa`: I also noticed that your update scripts have pm6 hardcoded into them, but don't work since you renamed to rakumod.
guifa` oops :-)
guifa` has been a bit scatter brained lately 19:56
rypervenche Is generate-template the best way to get a template file? The README says there's a template.rakumod file there, so I guess that also needs to be updated. 19:57
guifa` That one I believe is the most updated one. 20:00
timotimo well, i haven't brained at all lately
so you're already ahead of me
guifa` The issue is just that the template copys verbatin what's in the Exceptions.pm6 file 20:01
rypervenche guifa`: You're saying that template.rakumod is the most up-to-date? Because it doesn't exist anymore.
guifa` And a few of them reference private stuff, which causes an error until you switch them to public. I'm just not sure yet how to consistently handle that on the generation 20:02
rypervenche guifa`: I've got the first part of zh-TW ready and wanted to submit a PR. I've changed all ! to . but can't figure out the SlurpySentry bit. Still gives the same error. 22:12
guifa rypervenche: go ahead and submit the PR and I’ll do a quick modification right after accepting it 23:27
rypervenche guifa: Will do, would you like it with or without the ! to . change? 23:34
guifa with please 23:35
rypervenche guifa: Done. 23:58