🦋 Welcome to the MAIN() IRC channel of the Raku Programming Language (raku.org). Log available at irclogs.raku.org/raku/live.html . If you're a beginner, you can also check out the #raku-beginner channel!
Set by lizmat on 6 September 2022.
00:00 reportable6 left
Tirifto Bridge and Real were not mentioned in the documentation on ‘Context and contextualizers’. I wonder if there’s a better place I should have searched in? Or should there be no single page in the official documentation to learn all of this from? `o` 00:00
00:01 reportable6 joined
avuserow Yes, I agree. I actually only knew this because I implemented a module using this many years ago. Though I don't remember what the minimum requirements are, and I'm still a bit confused on getting the `+` operator to work. 00:08
"I agree" in the sense that this should be documented in a single consistent place, since this is very useful in the right domain :) 00:09
m: class Foo does Real {has Int() $.data; method Bridge { $!data }; method succ {self + 1}}; multi sub infix:<+>(Foo $a, Real $b) {Foo.new(:data($a.data + $b))}; my $f = Foo.new(:data(3)); $f++; say $f; say $f.WHAT; my $f2 = $f + 1; say $f2; say $f2.WHAT; my $f3 = $f + $f2; say $f3; say $f3.WHAT 00:13
camelia 4
(Foo)
5
(Foo)
9
(Foo)
avuserow I feel like there's a better way than re-implementing all the math operators, but maybe it depends on how you want your type to behave? 00:16
e.g. do you need `$f++` to return a Foo instance? `$f--`? `$f * 4`? and not to mention if there's a Foo and Bar, which one wins? 00:20
docs.raku.org/type/Real#method_Bridge has more details 00:22
00:23 snonux left, rantanplan joined 00:45 Manifest0 left 01:25 dogbert17 joined 01:29 dogbert11 left 01:39 lichtkind_ left
guifa so one of the catches making a new number class isn't so much reimplementing the math operators but making sure that they work globally 01:46
that's not in and of itself hard, but it deoptimizes all over the place
right now, the best way that I know how to do it is to wrap each infix, and wrapping is slooooow 01:47
If there were a way to add multi candidates at the global level that would solve things and probs not kill optimizations but I don't think there is a way, and I'm not sure there will be a way 02:07
02:21 teatwo left
guifa (at least, no official way. I think you could do some under the hood magic by violating OOP to adjust the @!dispatchees and @!dispatch order maybe) 02:22
02:22 teatwo joined 02:23 tea3po joined 02:26 teatwo left 03:26 notable6 left, unicodable6 left, coverable6 left, statisfiable6 left, greppable6 left, benchable6 left, sourceable6 left, linkable6 left, bloatable6 left, evalable6 left, committable6 left, quotable6 left, bisectable6 left, tellable6 left, releasable6 left, nativecallable6 left, squashable6 left, shareable6 left, reportable6 left 03:27 evalable6 joined, tellable6 joined, quotable6 joined, sourceable6 joined, benchable6 joined, coverable6 joined 03:28 reportable6 joined, committable6 joined, linkable6 joined, releasable6 joined, statisfiable6 joined, bloatable6 joined, bisectable6 joined, greppable6 joined, nativecallable6 joined 03:29 notable6 joined, shareable6 joined, squashable6 joined, unicodable6 joined 04:29 linkable6 left, evalable6 left 04:31 linkable6 joined 04:32 evalable6 joined 05:32 evalable6 left, linkable6 left 05:33 evalable6 joined 05:34 linkable6 joined 05:46 jpn joined 06:00 reportable6 left 06:01 reportable6 joined 06:03 jpn left 06:12 jpn joined 07:12 linkable6 left, tellable6 left, notable6 left, nativecallable6 left, releasable6 left 07:14 linkable6 joined, tellable6 joined, notable6 joined 07:15 nativecallable6 joined, releasable6 joined 07:38 jpn left 07:39 jpn joined 07:44 jpn left 08:01 jpn joined
Nemokosch To be fair, the abstraction is correct. It's not an intrinsic property of numbers that they are ordered 08:08
It is, however, an intrinsic property of real numbers 08:09
08:12 rantanplan is now known as snonux 08:17 jpn left 08:32 jpn joined 08:34 moritz left, moritz joined, derpydoo left 08:37 jpn left 09:00 Sgeo left 09:15 Manifest0 joined 09:36 mst left, mst joined 09:52 justache- joined 09:53 justache left 09:58 jpn joined 10:03 squashable6 left 10:04 jpn left 10:06 squashable6 joined 10:09 derpydoo joined 10:53 jpn joined 10:57 jpn left 11:02 jpn joined 11:06 spacekookie left, jpn left 11:07 spacekookie joined 11:37 gfldex left 11:39 gfldex joined 11:48 jpn joined 11:53 jpn left 12:00 reportable6 left, reportable6 joined 12:05 elcaro left, elcaro joined 12:12 Some-body_ joined 12:13 DarthGandalf left 12:16 Some-body_ is now known as DarthGandalf 12:42 jpn joined 12:46 jpn left 13:12 dogbert11 joined 13:15 dogbert17 left 13:20 dogbert17 joined 13:22 dogbert11 left 13:27 euandreh left 13:29 euandreh joined 13:33 lichtkind_ joined 13:34 derpydoo left 13:45 jpn joined 13:50 jpn left 14:02 justache- is now known as justache, derpydoo joined 14:05 MasterDuke joined
Anton Antonov This link in the documentation does not work: docs.raku.org/syntax/identifiers.h...dentifiers . Linked from: docs.raku.org/language/optut.html . 14:20
14:22 teatwo joined 14:24 teatwo left, teatwo joined 14:25 tea3po left
guifa should be docs.raku.org/language/syntax#Exte...dentifiers 14:29
14:59 euandreh left 15:06 euandreh joined 15:10 euandreh left 15:12 euandreh joined 16:12 linkable6 left, evalable6 left 16:15 evalable6 joined, linkable6 joined 16:31 dogbert17 left 16:44 derpydoo left 17:07 jpn joined 17:12 jpn left 17:29 cm left 17:30 cm joined 17:37 bigdata joined 17:49 derpydoo joined 17:50 Sgeo joined 18:00 reportable6 left 18:01 reportable6 joined 18:09 jcallen left, jcallen joined 18:16 bigdata left 18:30 jpn joined 18:35 jpn left
librasteve you can open an issue here github.com/Raku/doc/issues 18:36
Anton Antonov Will do — thanks! 18:37
librasteve 👍
Tirifto Has anyone perchance used the NCurses package by azawawi? `o` 18:57
There’s a set of functions (getstr, getnstr, wgetstr, etc.) which take a string as an argument (char* in C, Str in the Raku binding), and are supposed to read a string from input and store it there. But when I pass a String to one of these functions, its value never changes. 19:25
The library uses NativeCall and I tried adding ‘is rw’ to the Str argument (though by my understanding that shouldn’t be necessary), but to no avail. So I’m not sure if I’m doing something wrong, or if the library is, and in the latter case, if it might be simple to fix or not. `o` 19:27
19:35 linkable6 left, evalable6 left, linkable6 joined 19:38 evalable6 joined 20:07 vrurg left 20:25 euandreh left 20:26 euandreh joined 20:35 vrurg joined 20:38 vrurg left 20:40 vrurg joined
librasteve Tirifto: i haven't used before but just installed (rakubrew, mac, zef) and the synopsis runs fine for me --- can you provide your code in a gist maybe? 20:43
sorry must to bed - another good place to ask is stackoverflow with the [raku] tag... 20:52
Tirifto Good night, librasteve. 20:53
I have uploaded an example here: tirifto.xwx.moe/d/curse.raku
21:08 euandreh left, euandreh joined 21:21 jpn joined 21:27 jpn left 22:36 euandreh left 22:40 jpn joined 22:46 jpn left 22:54 kst left 23:03 ProperNoun left 23:08 ProperNoun joined 23:19 kst joined