🦋 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.
00:19 sauvin left 00:20 sauvin joined
guifa hrm 00:34
p6: my $t = token { 'a' <?{ say self.pos }> 'r' }; 'bbbbbbbar' ~~ $t
camelia 0
guifa p6: my token t { 'a' <?{ say self.pos }> 'r' }; 'bbbbbbbar' ~~ /<t>/
camelia 7
guifa 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, cpan-raku joined, cpan-raku left, cpan-raku joined
elcaro guifa: this works... 01:38
p6: my $t = token { 'a' <?{ say self.pos }> 'r' }; 'bbbbbbbar' ~~ /$t/
camelia 7
guifa elcaro: so it seems putting the token in a regex is required for it to function properly. 01:39
elcaro yeah, seems related to how $t is interpreted in smartmatch (.ACCEPTS)
01:43 Geth left, Geth joined, cpan-raku left
guifa 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
01:43 cpan-raku joined
guifa 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:44
01:48 cpan-raku left 01:51 cpan-raku joined, cpan-raku left, cpan-raku joined 02:08 ufobat_ joined 02:10 wamba left 02:11 ufobat left
elcaro 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
p6: my $t := token { 'a' <?{ say self.pos }> 'r' }; 'bbbbbbbar' ~~ &$t
camelia 0
elcaro using the token as a callable in ~~ works as follows: 02:18
p6: my token t { 'ar' }; 'bbbbbbbar' ~~ &t
camelia ( no output )
elcaro p6: my token t { 'ar' }; say 'bbbbbbbar' ~~ &t
camelia 「ar」
elcaro 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
eh, maybe not. `token` ratches, `regex` does not, but assigning a `regex` to a scalar and matching on that still produces `0` 02:25
regardless, you are not comparing apples to apples. `'bbar' ~~ $token` is eqv to `'bbar' ~~ &token` 02:27
moritz 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, Doc_Holliwould left 04:38 guifa2 left 04:39 guifa2 joined 05:39 releasable6 left, unicodable6 left, nativecallable6 left, bisectable6 left, quotable6 left, reportable6 left, shareable6 left, coverable6 left, statisfiable6 left, committable6 left, benchable6 left, bloatable6 left, notable6 left, squashable6 left, greppable6 left, sourceable6 left, statisfiable6 joined, bloatable6 joined 05:40 quotable6 joined, nativecallable6 joined, committable6 joined, squashable6 joined, coverable6 joined, benchable6 joined 05:41 sourceable6 joined, greppable6 joined, bisectable6 joined 05:42 notable6 joined, reportable6 joined, shareable6 joined, unicodable6 joined, releasable6 joined 06:22 jmerelo joined 06:38 horsepatat joined
Geth doc: dd5b764fab | (JJ Merelo)++ | doc/Type/Pair.pod6
Adds note on synthetic numerics refs #2632
06:38
06:46 kensanata joined
Geth doc: 02c55490a2 | (JJ Merelo)++ | doc/Language/list.pod6
Adds enums as shape specifier refs #2632
06:53
jmerelo 214 out of 296 new items in 6.d already documented github.com/Raku/doc/issues/2632 82 to go... Any help is appreciated... 06:55
07:12 xinming left 07:13 xinming joined 07:32 jmerelo left 07:49 wamba joined 07:55 stoned75 left, 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, 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, scimon_ joined, scimon left, scimon_ is now known as scimon, scimon left 12:31 scimon joined 12:39 Voldenet left 12:41 wamba joined 12:44 Voldenet joined, Voldenet left, Voldenet joined 13:01 lucasb joined 13:11 tejr left 13:12 tejr joined 13:21 AlexDaniel left 13:26 chloekek joined
chloekek p6: use 🙈; EVAL 'say "hi"' 13:26
camelia 5===SORRY!5=== Error while compiling <tmp>
Bogus term
at <tmp>:1
------> 3use7⏏5 🙈; EVAL 'say "hi"'
expecting any of:
argument list
infix
infix stopper
postfix
prefix
13:30 domidumont joined 13:38 vividsnow joined
jmerelo chloekek: you added that as a synonym? Cool! 13:51
chloekek No. 13:52
13:52 Altai-man_ joined
chloekek It’s also wrong, because evil and eval are different words. 13:52
13:55 jmerelo left, 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, 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, Doc_Holliwould joined 16:49 patrickb joined 17:09 jmerelo left
Geth ecosystem: 35adc2934a | (Jonathan Worthington)++ (committed using GitHub Web editor) | META.list
Remove OO::Monitors; it's now on CPAN
17:22
17:27 scimon left
cpan-raku New module released to CPAN! OO::Monitors (1.1.1) by 03JNTHN 17:27
17:37 patrickb left 17:48 libertas left, libertas_ left 17:52 Altai-man_ joined 17:55 sena_kun left
lizmat weekly: andrewshitov.com/2020/01/08/callin...interface/ 17:57
notable6 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
Tirifto Hello! 18:31
tellable6 hey Tirifto, you have a message: gist.github.com/6c006d356501e511e9...7f800893b9
18:34 moon-child joined
Tirifto 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:36
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
[Coke] wonders if he can get raku on his raspberry pi 4 19:43
(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
ToddAndMargo HI All. Newbie question. How do I write (transfer just the bits) back and forth from an Integer (int16) and a Cardinal (unit16)? 20:11
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:13
20:14 mspo joined
guifa2 [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:15
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:19
20:21 mahmudov joined
ToddAndMargo guifa2: that you for the confirmation. That is what I will do. 20:21
guifa2 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:22
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
camelia Signed -1 is unsigned 65535
guifa2 You could also maybe think about doing a circumfix operator instead of a sub. 20:27
p6: sub circumfix:<u( )>(int16 $n --> uint16) { $n +| 0 }; my int16 $a = -1; my uint16 $b = u($a); say "Signed $a is unsigned $b"
camelia Signed -1 is unsigned 65535
20:28 chloekek joined
guifa2 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:29
20:30 stoned75 joined 20:32 rindolf left
ToddAndMargo Thank you! 20:34
20:40 kensanata joined 20:52 dogbert11 left
ToddAndMargo forgive a dumb question. Are standard Raku Str strings UTF8 by default? 21:12
sena_kun yes 21:13
or, to be precise, ahem...
tadzik they're unicode strings, and they may become utf8 if you choose to encode them that way :)
ToddAndMargo 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:21
ABC: "A", nul,"B", nul, "C", nul, nul, nul 21:22
21:26 vividsnow left 21:30 guifa2 left
guifa Note that internally there is some grapheme caching going on, but ATM I forget exactly what the details of it are 21:34
lizmat and you don't get back a UTF16 string from NativeCall, I would think you get back a Blob? 21:39
ToddAndMargo You get back byte wise a UTF16 string 21:46
21:52 Altai-man_ joined
ToddAndMargo Win api calls. I don't know about others 21:54
21:54 sena_kun left
lizmat Blob.decode("utf-16") 21:56
ToddAndMargo cool. how do you decode a little endian? 21:58
lizmat Blob.decode("utf-16le") 21:59
ToddAndMargo very cool. Thank you! is a `CArray[WCHAR]` also a "Blob"? 22:01
Tirifto 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:06
lizmat Tirifto: you could make the attributes in question read-only, and create custom mutators 22:07
that would make clear that accessing is always read-only 22:08
or do you want the mutators also to not be available ?
Tirifto 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:11
lizmat 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
camelia A $a = A.new(a => 666)
22:14 kensanata left 22:16 guifa2 joined
Tirifto 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:16
lizmat if I parse your sentence correctly, yes 22:17
Tirifto (Sorry if my phrasing is odd! :P) 22:18
Then I might try the wrapper object… thank you for your hints, lizmat! 22:19
lizmat hmmm... I was going to suggest the "handles" trait, but I guess that will just pass on the containerness 22:21
22:24 chloekek left
Tirifto Reading up on ‘handles’ now! 22:25
22:29 wamba left
Tirifto 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:34
lizmat m: class A { has $.a handles "foo" }; class B { has $.foo = "foo" }; my $a = A.new(a => B.new); dd $a.foo 22:36
camelia "foo"
lizmat hope that answers your question :-)
lizmat is tired and is off to bed&
Altai-man_ lizmat, good night. o/ 22:39
Tirifto 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, xinming joined