[00:19] *** sauvin left [00:20] *** sauvin joined [00:34] hrm [00:34] p6: my $t = token { 'a' 'r' }; 'bbbbbbbar' ~~ $t [00:34] rakudo-moar 5d8ef435d: OUTPUT: «0␤» [00:34] p6: my token t { 'a' 'r' }; 'bbbbbbbar' ~~ // [00:34] rakudo-moar 5d8ef435d: OUTPUT: «7␤» [00:35] What’s the rationale for the difference? [00:35] It feels buggy to me [00:39] *** lucasb left [00:55] *** wildtrees left [01:10] *** Tirifto left [01:24] *** cpan-raku left [01:24] *** cpan-raku joined [01:24] *** cpan-raku left [01:24] *** cpan-raku joined [01:38] guifa: this works... [01:38] p6: my $t = token { 'a' 'r' }; 'bbbbbbbar' ~~ /$t/ [01:38] rakudo-moar 5d8ef435d: OUTPUT: «7␤» [01:39] elcaro: so it seems putting the token in a regex is required for it to function properly. [01:39] yeah, seems related to how $t is interpreted in smartmatch (.ACCEPTS) [01:43] *** Geth left [01:43] *** Geth joined [01:43] *** cpan-raku left [01:43] I couldn’t quite see what was causing it in the ACCEPTS method. But that’s also all written in NQP and I might be missing something. My guess is it has something to do with it being the top level and tokens aren’t generally expected to be used as a top level regex, but called by others. [01:43] *** cpan-raku joined [01:44] I filed an issue, but maybe it’s correct by design. If so, that’s a good gotcha to mention in the docs somewhere [01:48] *** cpan-raku left [01:51] *** cpan-raku joined [01:51] *** cpan-raku left [01:51] *** cpan-raku joined [02:08] *** ufobat_ joined [02:10] *** wamba left [02:11] *** ufobat left [02:17] i think it's by design. possibly something to do with token ratcheting behaviour [02:17] if you use the token itself (ie. not inside a regex) you get the same result as the lone scalar [02:17] p6: my $t := token { 'a' 'r' }; 'bbbbbbbar' ~~ &$t [02:17] rakudo-moar 5d8ef435d: OUTPUT: «0␤» [02:18] using the token as a callable in ~~ works as follows: [02:18] p6: my token t { 'ar' }; 'bbbbbbbar' ~~ &t [02:18] rakudo-moar 5d8ef435d: ( no output ) [02:18] p6: my token t { 'ar' }; say 'bbbbbbbar' ~~ &t [02:18] rakudo-moar 5d8ef435d: OUTPUT: «「ar」␤» [02:19] i could be wrong, but maybe the ratcheting essentially ignores everything that failed, so when the token finally matches, the pos is 0. but inside a regex, that regex is keeping track of the pos, not the token itself. [02:19] i'm just guessing here, but it's plausible [02:25] eh, maybe not. `token` ratches, `regex` does not, but assigning a `regex` to a scalar and matching on that still produces `0` [02:27] regardless, you are not comparing apples to apples. `'bbar' ~~ $token` is eqv to `'bbar' ~~ &token` [02:27] don't confuse ratcheting (not backtracking) with searching for a match by applying a top-level .pos [03:22] *** mahmudov left [03:34] *** guifa2 joined [04:00] *** Doc_Holliwood left [04:00] *** Doc_Holliwould left [04:38] *** guifa2 left [04:39] *** guifa2 joined [05:39] *** releasable6 left [05:39] *** unicodable6 left [05:39] *** nativecallable6 left [05:39] *** bisectable6 left [05:39] *** quotable6 left [05:39] *** reportable6 left [05:39] *** shareable6 left [05:39] *** coverable6 left [05:39] *** statisfiable6 left [05:39] *** committable6 left [05:39] *** benchable6 left [05:39] *** bloatable6 left [05:39] *** notable6 left [05:39] *** squashable6 left [05:39] *** greppable6 left [05:39] *** sourceable6 left [05:39] *** statisfiable6 joined [05:39] *** bloatable6 joined [05:40] *** quotable6 joined [05:40] *** nativecallable6 joined [05:40] *** committable6 joined [05:40] *** squashable6 joined [05:40] *** coverable6 joined [05:40] *** benchable6 joined [05:41] *** sourceable6 joined [05:41] *** greppable6 joined [05:41] *** bisectable6 joined [05:42] *** notable6 joined [05:42] *** reportable6 joined [05:42] *** shareable6 joined [05:42] *** unicodable6 joined [05:42] *** releasable6 joined [06:22] *** jmerelo joined [06:38] *** horsepatat joined [06:38] ¦ doc: dd5b764fab | (JJ Merelo)++ | doc/Type/Pair.pod6 [06:38] ¦ doc: Adds note on synthetic numerics refs #2632 [06:38] ¦ doc: review: https://github.com/Raku/doc/commit/dd5b764fab [06:46] *** kensanata joined [06:53] ¦ doc: 02c55490a2 | (JJ Merelo)++ | doc/Language/list.pod6 [06:53] ¦ doc: Adds enums as shape specifier refs #2632 [06:53] ¦ doc: review: https://github.com/Raku/doc/commit/02c55490a2 [06:55] 214 out of 296 new items in 6.d already documented https://github.com/Raku/doc/issues/2632 82 to go... Any help is appreciated... [07:12] *** xinming left [07:13] *** xinming joined [07:32] *** jmerelo left [07:49] *** wamba joined [07:55] *** stoned75 left [07:55] *** wamba left [08:15] *** rindolf joined [08:17] *** rindolf left [08:19] *** rindolf joined [08:24] *** Ulti left [08:59] *** scimon joined [09:01] *** domidumont joined [09:16] *** sena_kun joined [09:37] *** squashable6 left [09:39] *** squashable6 joined [09:43] *** Merfont joined [09:44] *** Kaeipi left [09:52] *** Altai-man_ joined [09:55] *** sena_kun left [10:14] *** wamba joined [10:39] *** Doc_Holliwould joined [10:39] *** Doc_Holliwood joined [10:40] *** wamba left [10:41] *** wamba joined [10:42] *** wamba left [11:05] *** kensanata left [11:25] *** domidumont left [11:29] *** wamba joined [11:41] *** melezhik left [11:49] *** kensanata joined [11:53] *** sena_kun joined [11:54] *** Altai-man_ left [12:09] *** wamba left [12:18] *** jmerelo joined [12:29] *** horsepat1t joined [12:30] *** horsepatat left [12:30] *** scimon_ joined [12:30] *** scimon left [12:30] *** scimon_ is now known as scimon [12:30] *** scimon left [12:31] *** scimon joined [12:39] *** Voldenet left [12:41] *** wamba joined [12:44] *** Voldenet joined [12:44] *** Voldenet left [12:44] *** Voldenet joined [13:01] *** lucasb joined [13:11] *** tejr left [13:12] *** tejr joined [13:21] *** AlexDaniel left [13:26] *** chloekek joined [13:26] p6: use 🙈; EVAL 'say "hi"' [13:26] rakudo-moar ccb92df2f: OUTPUT: «5===SORRY!5=== Error while compiling ␤Bogus term␤at :1␤------> 3use7⏏5 🙈; EVAL 'say "hi"'␤ expecting any of:␤ argument list␤ infix␤ infix stopper␤ postfix␤ prefix␤ …» [13:30] *** domidumont joined [13:38] *** vividsnow joined [13:51] chloekek: you added that as a synonym? Cool! [13:52] No. [13:52] *** Altai-man_ joined [13:52] It’s also wrong, because evil and eval are different words. [13:55] *** jmerelo left [13:55] *** sena_kun left [14:42] *** rindolf left [14:49] *** rindolf joined [15:16] *** horsepat1t left [15:29] *** xinming left [15:32] *** xinming joined [15:48] *** melezhik joined [15:49] *** Doc_Holliwood left [15:49] *** Doc_Holliwould left [15:52] *** kensanata left [15:53] *** sena_kun joined [15:55] *** Altai-man_ left [16:10] *** chloekek left [16:19] *** jmerelo joined [16:32] *** domidumont left [16:34] *** Doc_Holliwood joined [16:34] *** Doc_Holliwould joined [16:49] *** patrickb joined [17:09] *** jmerelo left [17:22] ¦ ecosystem: 35adc2934a | (Jonathan Worthington)++ (committed using GitHub Web editor) | META.list [17:22] ¦ ecosystem: Remove OO::Monitors; it's now on CPAN [17:22] ¦ ecosystem: review: https://github.com/perl6/ecosystem/commit/35adc2934a [17:27] *** scimon left [17:27] New module released to CPAN! OO::Monitors (1.1.1) by 03JNTHN [17:37] *** patrickb left [17:48] *** libertas left [17:48] *** libertas_ left [17:52] *** Altai-man_ joined [17:55] *** sena_kun left [17:57] weekly: https://andrewshitov.com/2020/01/08/calling-cpp-and-fortran-functions-from-raku-using-the-nativecall-interface/ [17:57] lizmat, Noted! (weekly) [18:01] *** libertas joined [18:02] *** squashable6 left [18:03] *** squashable6 joined [18:05] *** xinming left [18:06] *** kensanata joined [18:09] *** xinming joined [18:17] *** wildtrees joined [18:18] *** moon-child left [18:29] *** Tirifto joined [18:31] Hello! [18:31] hey Tirifto, you have a message: https://gist.github.com/6c006d356501e511e9c5967f800893b9 [18:34] *** moon-child joined [18:36] uzl[m]: Thanks for the note! For this case I'll go with ‘use lib’, since it's just for a single portable script. [18:53] *** wamba left [19:25] *** MasterDuke joined [19:28] *** brass left [19:32] *** brass joined [19:34] *** wamba joined [19:37] *** MasterDuke left [19:42] *** MasterDuke joined [19:43] * [Coke] wonders if he can get raku on his raspberry pi 4 [19:43] <[Coke]> (without having to self compile) [19:51] *** vividsnow left [19:53] *** sena_kun joined [19:55] *** Altai-man_ left [19:58] *** kensanata left [19:59] *** vividsnow joined [20:10] *** ToddAndMargo joined [20:11] HI All. Newbie question. How do I write (transfer just the bits) back and forth from an Integer (int16) and a Cardinal (unit16)? [20:13] my workaround is to do a bitwise OR on them($x = $y +| 0x0000), but I'd like to know the right way of doing it. [20:14] *** mspo joined [20:15] [Coke]: self compiling is the worst with limited resources. I tried to get it on my shared hosting but it popped my memory limit =\ [20:19] ToddAndMargo: Hmm, I don't think there's a great way beyond what you're doing. I'd probably do it as a sub though [20:21] *** mahmudov joined [20:21] guifa2: that you for the confirmation. That is what I will do. [20:22] I actually just looked up how to do it in C and it's not very straightforward there either so at least Raku's not trailing too far beyond the lowerlevel languages :-) [20:25] p6: sub into-uint16(int16 $n --> uint16) { $n +| 0 }; my int16 $a = -1; my uint16 $b = into-uint16 $a; say "Signed $a is unsigned $b" [20:25] rakudo-moar ccb92df2f: OUTPUT: «Signed -1 is unsigned 65535␤» [20:27] You could also maybe think about doing a circumfix operator instead of a sub. [20:27] p6: sub circumfix:(int16 $n --> uint16) { $n +| 0 }; my int16 $a = -1; my uint16 $b = u($a); say "Signed $a is unsigned $b" [20:27] rakudo-moar ccb92df2f: OUTPUT: «Signed -1 is unsigned 65535␤» [20:28] *** chloekek joined [20:29] Then you can use u( foo ) to convert to unsigned. Or use a different bracking like u< > or u[ ], etc dependin gon your taste. [20:30] *** stoned75 joined [20:32] *** rindolf left [20:34] Thank you! [20:40] *** kensanata joined [20:52] *** dogbert11 left [21:12] forgive a dumb question. Are standard Raku Str strings UTF8 by default? [21:13] yes [21:13] or, to be precise, ahem... [21:13] they're unicode strings, and they may become utf8 if you choose to encode them that way :) [21:21] I am converting from a UTF16 string coming back from a WinAPI call, so I wanted to make sure I knew exactly what a Raku Str was..Thank you! [21:22] ABC: "A", nul,"B", nul, "C", nul, nul, nul [21:26] *** vividsnow left [21:30] *** guifa2 left [21:34] Note that internally there is some grapheme caching going on, but ATM I forget exactly what the details of it are [21:39] and you don't get back a UTF16 string from NativeCall, I would think you get back a Blob? [21:46] You get back byte wise a UTF16 string [21:52] *** Altai-man_ joined [21:54] Win api calls. I don't know about others [21:54] *** sena_kun left [21:56] Blob.decode("utf-16") [21:58] cool. how do you decode a little endian? [21:59] Blob.decode("utf-16le") [22:01] very cool. Thank you! is a `CArray[WCHAR]` also a "Blob"? [22:06] I’ve another question! If I want to make an object’s attributes read/write, but have them work read-only when passed to certain routines (specially the ones loaded from some modules), is wrapping it in a different object which has the same interface but only implements the read accessors and passing that to the said routines instead a decent way to do this in Raku? [22:07] Tirifto: you could make the attributes in question read-only, and create custom mutators [22:08] that would make clear that accessing is always read-only [22:08] or do you want the mutators also to not be available ? [22:11] lizmat: Ideally the loaded routine visiting the object would have no way at all to alter it. (I reckon they would if you mean custom methods of different names by mutators.) [22:13] m: class A { has $.a; method set_a(\value) { $!a = value } }; my $a = A.new(a => 42); $a.set_a(666); dd $a # something like that [22:13] rakudo-moar 66cf6f811: OUTPUT: «A $a = A.new(a => 666)␤» [22:14] *** kensanata left [22:16] *** guifa2 joined [22:16] If access to the object shouldn't include the access to the means of modification, the latter just can not be contained within the object as a method, right? [22:17] if I parse your sentence correctly, yes [22:18] (Sorry if my phrasing is odd! :P) [22:19] Then I might try the wrapper object… thank you for your hints, lizmat! [22:21] hmmm... I was going to suggest the "handles" trait, but I guess that will just pass on the containerness [22:24] *** chloekek left [22:25] Reading up on ‘handles’ now! [22:29] *** wamba left [22:34] Okay, so if an object’s attribute ‘handles’ a method (name), and that method is called on the object, it will be called on whatever the attribute is holding instead, right? [22:36] m: class A { has $.a handles "foo" }; class B { has $.foo = "foo" }; my $a = A.new(a => B.new); dd $a.foo [22:36] rakudo-moar 66cf6f811: OUTPUT: «"foo"␤» [22:36] hope that answers your question :-) [22:36] * lizmat is tired and is off to bed& [22:39] lizmat, good night. o/ [22:39] lizmat: Yeah, it assured me. It doesn't provide a new solution, but might be helpful for the wrapper. Thank you and may you sleep well! [22:43] *** chsanch left [22:45] *** guifa2 left [23:53] *** sena_kun joined [23:55] *** Altai-man_ left [23:57] *** xinming left [23:57] *** xinming joined