🦋 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 00:01 reportable6 joined 00:46 kjp left 00:49 kjp joined 01:08 Voldenet left 01:17 deoac joined 01:28 razetime joined 01:31 bigdata joined 01:51 MasterDuke joined 01:52 Voldenet joined 02:31 bigdata left 03:31 evalable6 left, linkable6 left, evalable6 joined 03:33 linkable6 joined 03:40 jmcantrell left 04:03 deoac left 04:16 razetime left 05:02 razetime joined 05:16 abraxxa joined 05:23 siavash joined 06:00 reportable6 left 06:02 reportable6 joined 06:36 xelxebar_ joined 06:37 jdv_ joined 06:38 silug8 joined, Woodi_ joined, peder_ joined, pat_js joined, kaol_ joined 06:39 gugod_ joined, silug left, gugod left, Woodi left, xelxebar left, peder left, ingy left, pejayes left, jdv left, kaol left, silug8 is now known as silug, peder_ is now known as peder 06:43 amano joined
amano How do I poll a queue without removing an item from it? 06:43
Channel doesn't allow me to know whether it is queued at all. 06:44
I want to push something onto a queue only if it is empty.
Or, I want a queue that drops new items if it is not empty already. 06:48
06:50 ingy joined
amano Is it safe to share an Array among multiple react blocks? 06:57
07:03 jpn joined
amano I want a bounded queue. 07:06
siavash `poll` method returns `Nil` if there is no item in the channel, so `send` an item in an `else` block? 07:10
docs.raku.org/language/concurrency...y_concerns 07:15
07:19 razetime left
amano siavash: I don't understand what you propose. 07:19
07:21 xelxebar_ is now known as xelxebar
siavash `if $channel.poll -> $item { ... } else { # queue is empty, so do what you wanted to do }` 07:42
07:46 Woodi_ is now known as Woodi 07:49 Sgeo left
librasteve stackoverflow.com/questions/437828...en-threads 07:57
^^^ jnthn's answer here is pretty definitive
short version: No
amano siavash: I would like $channel.peek. And, I would also like a bounded queue that has a limited size. 08:04
08:10 discord-raku-bot left, dakkar joined, discord-raku-bot joined 08:20 tea3po joined 08:23 teatwo left 08:36 sena_kun joined
amano A function that sends a new item to a bounded queue can either wait or drop the new item. 08:40
If the bounded queue is full. 08:41
A bounded queue can be of size 5.
or 1.
hackage.haskell.org/package/stm-2....Queue.html 08:42
hackage.haskell.org/package/brick-...BChan.html 08:43
09:14 jpn left 09:20 abraxxa left 09:34 kaol_ is now known as kaol 09:36 abraxxa joined
nemokosch www.reddit.com/r/rakulang/comments...2023_date/ 09:45
09:49 jpn joined
amano: raku.land/cpan:JNTHN/Concurrent::Queue maybe this is of interest 09:56
09:56 Voldenet left
librasteve .oO 09:57
might be a relatively straightforward mini project to fork this and add some bounds... 09:59
10:03 Voldenet joined
amano What is the best IPC mechanism in raku apart from a stream unix socket created by IO::Socket::Async.listen-path? 10:32
10:32 Voldenet left, siavash left 10:49 Voldenet joined 11:18 jpn left
amano It seems Supply.throttle may do what I want for implementing bounded queues. 11:29
11:34 ProperNoun left 11:35 ProperNoun joined
nemokosch CIAvash is desperately underrated 11:41
amano Are Raku Supplies concurrent or parallel? 11:43
nemokosch I would assume it depends on the scheduler for starters 11:45
docs.raku.org/language/concurrency#Schedulers does this help somewhat? 11:46
ugexe concurrent 11:52
or rather Supply is used for concurrency control 11:53
amano Can Supply.throttle be used for bounded queue? 11:57
Perhaps, I should just get rid of the unix socket while the raku script is processing a message. 11:58
12:00 reportable6 left 12:03 reportable6 joined 13:03 bisectable6 left, shareable6 left, greppable6 left, reportable6 left, releasable6 left, squashable6 left, coverable6 left, benchable6 left, notable6 left, linkable6 left, tellable6 left, quotable6 left, evalable6 left, unicodable6 left, bloatable6 left, sourceable6 left, committable6 left, nativecallable6 left, greppable6 joined, tellable6 joined, shareable6 joined, quotable6 joined 13:04 reportable6 joined, benchable6 joined, unicodable6 joined, coverable6 joined, bloatable6 joined, squashable6 joined, evalable6 joined, nativecallable6 joined 13:05 releasable6 joined, notable6 joined, bisectable6 joined, committable6 joined, sourceable6 joined, linkable6 joined
amano I just tested Supply.throttle. It does what I want... 13:06
13:52 amano left
antononcube @nemokosch Thanks for mentioning CIAvash! I am not sure how that relates to the concurrency discussion -- his "Curry" module? -- but the "PatternMatching", raku.land/zef:CIAvash/PatternMatching, should be very useful for working with LLMs. 14:18
(It seems that "PatternMatching" can be combined very well with "Text::SubParsers".) 14:20
14:48 ab5tract joined 15:02 Voldenet left 15:28 [Coke] joined 15:51 xinming left 15:58 eseyman left 15:59 manu_ joined 16:02 manu_ is now known as eseyman 16:08 xinming joined 16:11 abraxxa left 16:43 jdv_ is now known as jdv 17:00 dakkar left
holmdunc I wonder why the 😄 constraint isn't the default in Raku. It seems like most of the time when type annotating function parameters, object instances are what a programmer is thinking about? 17:23
librasteve that's a great question - I personally think that it is useful for a coder to signal "there is no sensible value for this variable yet" rather than be required to load a default (some, any default) of the required type 17:28
(dons hard hat in anticipation of the "raku does not have variables, just containers and value" commentary) 17:29
nemokosch well, there is a "default value" this way as well, except one that might cause trouble if you try to fetch it 17:30
librasteve with :D and :U smileys in eg multi signatures, you can then go a little deeper when you need to make that distinction
m: my Int $x; dd $x; 17:31
Raku eval Int $x = Int
librasteve m: my Int $x; dd $x.WHAT; 17:32
Raku eval Int
librasteve yeah - well I think it is nice that the default value for a typed container is the type object since that carries the type around everywhere whether you loaded an actual value yet 17:33
17:35 rf joined 17:44 jpn joined
(or not) 17:47
17:49 jmcantrell joined
and I think that this way a signature can check the type of the value and does not care if the argument is initially contained in a typed or untyped container 17:50
m: sub fn( Int $y ) {say $y}; my $x; fn($x); 17:51
Raku eval Exit code: 1 Type check failed in binding to parameter '$y'; expected Int but got Any (Any) in sub fn at main.raku line 1 in block <unit> at main.raku line 1
librasteve m: sub fn( Int $y ) {say $y}; my Int $x; fn($x);
Raku eval (Int) 17:52
librasteve m: sub fn( Int $y ) {say $y}; my $x=Int; fn($x);
Raku eval (Int)
18:00 reportable6 left 18:02 reportable6 joined 18:11 abraxxa-home joined 18:22 jpn left 18:24 abraxxa-home left 18:25 jpn joined 18:38 rf left 18:44 abraxxa-home joined 19:11 jpn left 19:26 m_athias left, nine left, nine joined, m_athias joined 19:48 sena_kun left, sena_kun joined 19:49 deoac joined 19:57 abraxxa-home left 20:08 Guest22 joined, Guest22 left 20:14 Guest46 joined, Guest46 left 20:17 teatwo joined 20:18 teatwo left 20:19 teatwo joined
gfldex m: my Int:D $i = 42; $i = Nil; 20:20
camelia Type check failed in assignment to $i; expected Int:D but got Int (Int) (perhaps Nil was assigned to a :D which had no default?)
in block <unit> at <tmp> line 1
20:20 tea3po left
gfldex @librasteve Does this ^^^ help to crack that nut? 20:20
Also Raku used to be called Perl 6 and we love our `//`s. 20:21
librasteve m: my Int:D $i = is-default(42); $i = Nil; 20:25
Raku eval Exit code: 1 ===SORRY!=== Error while compiling /home/glot/main.raku Undeclared routine: is-default used at line 1
librasteve m: my Int:D $i = is default(42); $i = Nil;
Raku eval Exit code: 1 ===SORRY!=== Error while compiling /home/glot/main.raku Undeclared routines: default used at line 1 is used at line 1
gfldex Tm: my Int:D $i is default(42); $i = Nil;
m: my Int:D $i is default(42); $i = Nil; 20:26
camelia ( no output )
librasteve ^^ that
gfldex Complexity is the arch-enemy of all programmers. Types can lower complexity but they don't have to. Hence the need for gradual tying. Often &infix:<//> is less hassle then enforcing DEFINITEness. 20:30
m: class undefinedness { method defined { False } }; my $u = undefinedness.new; sub s(Any:D $) { say „huh‽“ } say defined($u); s($u);
camelia ===SORRY!=== Error while compiling <tmp>
Strange text after block (missing semicolon or comma?)
at <tmp>:1
------> dness.new; sub s(Any:D $) { say „huh‽“ }⏏ say defined($u); s($u);
expecting any of:
gfldex m: class undefinedness { method defined { False } }; my $u = undefinedness.new; sub s(Any:D $) { say „huh‽“ }; say defined($u); s($u);
camelia False
20:31 ProperNoun left
gfldex The :D type smiley does *not* ask for definedness. 20:31
20:36 ProperNoun joined
librasteve (i) I am sure that you are right (trust-wise), (ii) I am sure that you are right (philosophically), (iii) BUT as a "meat and potatoes coder" guy I still cling to the idea of a variable to which a value may be assigned - please humour me/us 20:37
(when I get a tuit I plan to link back up to what I think your saying on my blog) 20:38
meantime - I get that there is .defined (object-wise test that is easy to override) and .DEFINITE (class-wise test that is hard wired) 20:39
gfldex Actually, DEFINITE goes deeper then a class. It exists even before Rakudo learns about classes. 20:41
librasteve being out here in "rakuland" ( as opposed to "NQPland"), please can you point me to the most pithy docs (docs or synapses or blogs is fine) 20:44
gfldex This is not documented. You have to read the source of MoarVM, nqp and Rakudo to understand what is really going on. 20:45
librasteve ok - I see ... that's cool & many thanks!!! 20:47
gfldex If you like to, we can have a little voice chat on Discord. Same handle then here. 20:48
20:51 hythm76 joined, hythm left
nemokosch the funny thing is that even if you type out .DEFINITE, it's not an actual method call... 20:52
librasteve thanks - I need a couple of days on $day-job will ping when I can 20:57
21:11 jpn joined 21:19 jpn left 21:20 jpn joined 21:37 Voldenet joined, jpn left 21:46 amano joined
amano yo 21:47
21:47 amano left 21:58 deoac left 22:15 Sgeo joined 22:36 sena_kun left 22:49 rf joined 23:49 linkable6 left, evalable6 left 23:51 evalable6 joined 23:52 linkable6 joined