🦋 Welcome to the MAIN() IRC channel of the Raku Programming Language (raku.org). This channel is logged for the purpose of keeping a history about its development | evalbot usage: 'm: say 3;' or /msg camelia m: ... | Log inspection is getting closer to beta. If you're a beginner, you can also check out the #raku-beginner channel!
Set by lizmat on 25 August 2021.
00:03 reportable6 left 00:04 reportable6 joined
Xliff japhb: I've never internationalized before, but I'll accept PRs! 00:16
00:18 Skarsnik left
japhb Fair enough. :-) 00:35
japhb is currently hacking on github.com/japhb/Terminal-LineEditor
I will be happy when I can call it a strict superset of Linenoise, but I still need to do tab completion and hints. At least the key bindings are in much better shape now. 00:36
moon-child japhb: just tried it, alt+left causes it to print 'Str $base = "\x[1B][D"', then a newline, then 'Array @args = ["1", "3"]'; and then it freezes 00:44
00:45 frost joined
japhb moon-child: That indicates that I haven't decoded that key properly and it's printing out the escape sequence info so I can figure out what I'm missing. Helps people give good bug reports. :-) 01:00
Were you just trying key combos, or is there something you expect to be bound to that?
moon-child just trying inputs randomly 01:01
japhb I should still at least have *decoded* that properly, even if it's not bound
Looking at it now.
D'oh, I see what I missed. 01:05
01:13 clarjon1 left
japhb Just waiting for GH tests before uploading 01:27
moon-child: It's `fez upload`ed, but hasn't appeared in raku.land yet 01:29
moon-child: Please do let me know if you come across any more of those. 01:32
Actually, that applies to anyone, not just moon-child++ :-) 01:33
02:04 merpaderp left, merpaderp joined 02:23 pony left 02:28 vrurg left, vrurg joined 02:40 SmokeMachine left, kawaii_ left, leont left, SmokeMachine joined 02:41 rjbs left, ecocode__ left, leont joined, rjbs joined 02:42 pjlsergeant left, patterner_ left, patterner_ joined, pjlsergeant joined 02:45 ecocode__ joined 02:46 kawaii_ joined 02:50 patterner_ left 02:51 mjgardner left 03:05 mjgardner joined, patterner_ joined 03:18 patterner_ left, mjgardner left 03:21 patterner_ joined, mjgardner joined
japhb moon-child: 0.0.8 is there now, with more README docs about keymaps. 03:41
04:01 kawaii_ left 04:02 PotatoGim left, ecocode__ left, zostay left, skaji left, zostay joined 04:03 patterner_ left, pjlsergeant left, SmokeMachine left, SmokeMachine joined, mjgardner left, kawaii_ joined, patterner_ joined, rjbs left 04:04 pjlsergeant joined, leont left, PotatoGim joined, skaji joined, ecocode__ joined, mjgardner joined, rjbs joined
moon-child japhb: I am trying to teach lineeditor that multiple kills in sequence should append/prepend to the 'yankable' buffer (so given '^W^W^W^Y', you should get back all three words); but other transformations should reset it 04:21
only problem is, moving the cursor should also trigger this, but EditableBuffer does not model the location of the cursor
04:21 leont joined
moon-child not sure if there's a good solution, beyond just providing it a method to say 'something happened', which seems a bit dirty 04:21
04:22 A26F64 left
moon-child alternately, the kill buffer should not be managed by the buffer itself. Actually, that seems like the better solution, now that I think about it 04:22
japhb moon-child: Interesting. Is that expected for *any* sequence of deletes? Like should ^W^D^D<backspace>^Y pull all deleted bits back? 04:32
When you say "other transformations should reset it" do you mean you expect them to stop the chain, or reset the yank buffer? 04:33
(Note that I haven't modeled the Readline concept of a kill/yank ring yet, are you expected that as well?) 04:34
moon-child japhb: I mean that they should stop the chain; an operation other than a kill, following a kill, should make it so that subsequent kills will replace the kill buffer rather than adding to it 04:36
japhb Normally EditableBuffer reports from its methods whether *it* made a change to the buffer, and part of the reason for that is that it *does* track the position of the insert cursor.
moon-child my experience with zle and readline is that characterwise deletions should not count
japhb moon-child: ... or in the case of a kill/yank ring, start a new kill buffer on "top"? 04:37
moon-child but repeated word-wise or other deletions should. So ^W M-D M-D ^W ^Y should give you back all four words
japhb: 'on "top"' yeah
japhb Interesting. OK, makes sense (or at least, as much as any historical baggage does :-) ) 04:38
Oh, sorry: 04:39
moon-child in terms of defaults. Presumably you would have an operation 'kill-character-back' vs 'delete-character-back', and can bind whichever you like
japhb Terminal::LineEditor::SingleLineTextInput has-a Terminal::LineEditor::SingleLineTextBuffer::WithCursors -- which is exactly what it sounds like
moon-child oh, I see 04:40
japhb Oh decent point, so then just have word-ish bindings default to kill, and char-ish bindings default to delete?
moon-child that's what I would do. There's also delete-line which should probably (?) replace the entire buffer 04:42
japhb (FWIW, the infrastructure was designed to support infinite cursors and arbitrary undo/redo, neither of which is actually used to full extent when emulating a POSIX shell's line editor, but you know ... it's there. I even tried to make the lower-levels amenable to supporting someone who wants to do collaborative CLI apps.)
moon-child: Yeah, I originally had Ctrl-U bound to delete-line, but found out that was a misunderstanding and it should be (as it is now) delete-to-start 04:44
Oh, you're saying it should create a whole new kill buffer?
moon-child in zsh: 'ab cd |ef gh' (| is the cursor), ^W ^U ^Y gives 'cd ab ef gh' 04:45
it would be neat to give 'ab cd ef gh', but I think 'ab ef gh' is preferable to 'cd ab ef gh' 04:46
(that is, the delete-line operation, regardless of which key it is bound to) 04:47
japhb Yeah, looks like bash/readline gives 'ab cd ef gh' as you want. 04:52
OK, do you want to continue hacking away, or would you like me to give it a swing?
04:58 squashable6 left 05:29 Xliff left 06:02 reportable6 left 06:04 gfldex left, a3r0 left, AlexDaniel left, happy-dude left 06:05 a3r0 joined, gfldex joined, happy-dude joined, AlexDaniel joined 06:12 CIAvash left, goblin left, Scotteh left, codesections left, chronon left, corwin left, broquain1 left, moritz_ left 06:13 goblin joined, moritz joined, broquaint joined, chronon joined, corwin joined, corwin left, corwin joined, codesections joined, Scotteh joined 06:17 CIAvash joined 06:32 squashable6 joined
japhb moon-child: I assumed the former, and instead sketched out Linenoise-style tab completion in a branch: github.com/japhb/Terminal-LineEdit...ompletions (And updated the Rakudo PR to match: github.com/rakudo/rakudo/pull/4623) 06:58
07:03 reportable6 joined 07:17 seednode left 07:18 seednode joined 07:29 abraxxa joined 07:35 abraxxa left 07:36 abraxxa joined 07:43 xinming__ left 07:45 xinming__ joined 08:04 abraxxa left, jcallen_ is now known as jcallen 08:08 Manifest0 left 08:09 xinming__ left 08:10 Manifest0 joined, xinming__ joined 08:12 frost left 08:17 xinming__ left, abraxxa joined 08:18 Sgeo left 08:19 xinming__ joined 08:22 abraxxa left 08:54 dakkar joined 09:07 Skarsnik joined 10:32 abraxxa-home joined 10:34 abraxxa-home left 10:35 abraxxa-home joined 11:35 evalable6 left, linkable6 left 11:36 evalable6 joined 11:39 frost joined 12:02 reportable6 left 12:03 reportable6 joined 12:11 Skarsnik left 12:37 linkable6 joined
frost m: say DateTime.now 12:47
camelia 2021-11-08T13:47:21.589178+01:00
12:48 linkable6 left 13:42 melezhik joined, melezhik left 13:49 linkable6 joined 13:50 eseyman left 13:53 frost left 14:42 melezhik joined
melezhik . 14:42
weekly: Raku weekly on mybfio - mybf.io/?language=Raku&filter=top 14:44
notable6 melezhik, Noted! (weekly)
15:25 melezhik left 15:53 Sgeo joined 16:04 A26F64 joined 16:32 suman joined
suman m: my @shaped_array[3,4]; say @shaped_array; 16:36
camelia [[(Any) (Any) (Any) (Any)]
[(Any) (Any) (Any) (Any)]
[(Any) (Any) (Any) (Any)]]
suman Is it possible to assign all elements to be zero? 16:37
lizmat m: my @shaped_array[3,4] is default(0); say @shaped_array 16:40
camelia 5===SORRY!5=== Error while compiling <tmp>
is default on shaped Array not yet implemented. Sorry.
at <tmp>:1
------> 3my @shaped_array[3,4] is default(0)7⏏5; say @shaped_array
expecting any of:
constraint
lizmat meh
ugexe double sorry
16:44 abraxxa joined 16:57 eseyman joined 16:58 sena_kun joined
suman m: my @new_arr = [2,3,4]; say [@new_arr for 1..3]; 16:59
camelia [[2 3 4] [2 3 4] [2 3 4]]
suman Is this right to create a new list with multiples of same list? 17:00
17:00 abraxxa left 17:01 abraxxa joined
Altreus m: my @new_arr = [2,3,4]; say @new_arr xx 3 # maybe 17:03
camelia ([2 3 4] [2 3 4] [2 3 4])
Altreus This seems more semantic
17:04 xinming__ left, abraxxa left
suman Hmm 17:05
17:06 xinming__ joined
dakkar m: my @a=[2,3,4];my @b= @a xx 3; @b[0][0]=7; say @b 17:24
camelia [[7 3 4] [7 3 4] [7 3 4]]
dakkar Altreus: suman: notice that little issue, though
Altreus I presumed this was intended by "the same list"
I forgot to mention it though :) 17:25
dakkar it may be intended, it may be surprising… we never know ☺
m: my @a=[2,3,4];my @b= map { [.Slip] }, @a xx 3; @b[0][0]=7; say @b 17:26
camelia [[7 3 4] [2 3 4] [2 3 4]]
dakkar there may be a nicer way of saying "shallow-clone this array"
Altreus m: my @new_arr = [2,3,4]; my @b = [|@new_arr] xx 3; @b[0][0] = 7; say @b # maybe 17:29
camelia [[7 3 4] [2 3 4] [2 3 4]]
Altreus oh it worked
xx calculates per iteration, not before iterating!
dakkar ah yes, it's chunked! 17:30
ugexe .clone does a shallow clone
my @b = @a.clone xx 3;
dakkar ugexe: I should have guessed ☺ thanks
tonyo m: my @a[3,4] = [0 xx 4] xx 3; dd @a 17:35
camelia Array element = Array.new(:shape(3, 4), [0, 0, 0, 0], [0, 0, 0, 0], [0, 0, 0, 0])
17:36 dakkar left 17:53 MoC joined 18:02 reportable6 left 18:04 reportable6 joined 18:08 andinus` left 18:09 andinus joined
andinus do we have something like go's defer? 18:09
i would like to close Net::SMTP's socket before the program ends, be it from crash or otherwise 18:10
ugexe LEAVE
andinus i see,s o just a LEAVE phaser in MAIN() will do? 18:11
ugexe or END, or whatever phaser you find most appropriate 18:13
andinus is there any difference in using LEAVE (in MAIN()) or using END? 18:15
ugexe yes, LEAVE fires when the block is exited 18:16
andinus ah i see, exit prevents LEAVE to be executed, i asumme END runs everytime
ugexe people can call main my $foo = MAIN(...)
so END cannot be the same as LEAVE
codesections Also, if you have both, END comes last 18:17
ugexe as far as exit short circuiting the LEAVE... that kinda sucks at first glance but also seems like it might make sense 18:18
andinus ah isee, make sense, thanks 18:19
ugexe "It's a common idiom to use LEAVE phaser for closing the handles, which ensures the handle is closed regardless of how the block is left." 18:23
i cant tell if that sentence is technically wrong re: exit or not
lizmat LEAVE .disconnect with $handle;
m: LEAVE say "bye"; exit 1 18:24
camelia ( no output )
lizmat hmmm
m: END say "bye"; exit 1
camelia bye
lizmat if it's about program exit, I guess END is safer
ugexe while it might be case in the naive sense, managing the number of handles open usually shouldnt wait till program END (nor is there probably any reason to close handles at END) 18:25
tonyo if you exit the process cleanly it should close those handles anyway..using exit in the case of leaving files open seems like bad design anyway 18:27
18:56 gordonfish joined, suman left 19:32 MoC left
gfldex lolibloggedalittle: gfldex.wordpress.com/2021/11/08/2nd-class-join/ 19:47
codesections m: say (1900..2100).grep({ Date.new(.Int, 1, 1).day-of-week | Date.new(.Int, 12, 31).day-of-week == 4 }).batch(8)».join(' ').join("\n") 19:54
camelia 1903 1908 1914 1920 1925 1931 1936 1942
1948 1953 1959 1964 1970 1976 1981 1987
1992 1998 2004 2009 2015 2020 2026 2032
2037 2043 2048 2054 2060 2065 2071 2076
2082 2088 2093 2099
codesections gfldex++ ^^^ (not that I'd be opposed to a smarter &join, mind you :D ) 19:55
ugexe the feed operator is underused because it is slow 19:56
codesections what makes it slow? It seems like is should be basically the same as a method chain 19:58
is it just a lack of opt work, or is there something about the semantics? 19:59
ugexe from what i remember (and its been a long time so take with a grain of salt) the current implementation was mostly just to have them in the language before release, and that someone really need to put work into revamping or improving them 20:02
there was github.com/rakudo/rakudo/pull/2903 from Kaiepi though 20:04
lizmat and yet another Rakudo Weekly hits the Net: rakudoweekly.blog/2021/11/08/2021-...wo-commas/
ugexe "Turns out getting this to run faster was just a matter of handling QAST better. Feed operators now run roughly 500% faster than the current implementation."
codesections 500% faster is good :) 20:05
ugexe hopefully they will rev-ist their efforts eventually 20:07
revisit
gfldex I believe feed operators use .assuming under the good. 20:08
20:15 Skarsnik joined
Kaiepi that was kind of a vague explanation of how that was faster 20:17
it's from the use of STORE instead of append for each stage of the feed
i tried to take it a step further with Channel but iirc came with overhead for the simpler use cases for feeds 20:18
there's probably a means of taking that a step further through Iterator
20:20 euandreh joined
lizmat fwiw, this is what I did about that about 3 years ago: gist.github.com/lizmat/787a6ddb31d...f3403de78c 20:21
20:25 euandreh left 20:28 A26F64 left
Skarsnik Hello lizmat, should I fill a bug repport for my INIT/BEGIN confusing behavior in a module or is that hidden in the spec somewhere? xD 20:32
20:35 pony joined
lizmat Skarsnik: yes, please 20:35
although it should probably be a problem solving issue
Skarsnik Language Issue? 20:44
20:52 abraxxa-home left
Skarsnik lizmat, I realise also we maybe need more phaser for module? since all the compile time phaser in a module only happen at precomp. 21:17
gfldex Skarsnik: Do you want to run code at EXPORT-time? 21:26
Skarsnik Not really, I wanted to forbide a sub to be run at BEGIN time 21:28
so I added a INIT phaser in it to set something so you know it's run time or not in the exported sub, but INIT get run on use/export for the module 21:29
SmokeMachine Hi there! I'm trying to make it easier to share connection, schema, models, etc inside a project, to do that, I've made something that when using like this: github.com/FCO/Red/pull/524/files#...a8d27303R7 it would export all Red, your connection, your models and your schema. But to accomplish that, a use should write something like this: 21:40
github.com/FCO/Red/pull/524/files#...733aedfeR3 I'd like to have that settled without the user having to write the EXPORT sub. Is that possible (without using macro?) is there some way of doing that?
using that, `red-config` does almost everything, but the user needs to place it inside a EXPORT... is there a way to make the EXPORT not necessary? I've tried exporting a fund called EXPORT, but it's exported before the function call... so I can't customise the export...(only if I put that inside a BEGIN, I suppose... but if I have to put that inside anything, the EXPORT would be better) 21:50
21:52 linkable6 left, evalable6 left
SmokeMachine or would it be better to leave the EXPORT there to make it visible it's being exported? 21:52
21:54 evalable6 joined, linkable6 joined 22:07 dogbert17 joined 22:09 dogbert11 left 22:46 xkr47 left 22:47 xkr47 joined
tonyo bloatware 22:51
22:59 Skarsnik left 23:27 djerius left, djerius joined