🦋 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 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 8 June 2022.
guifa oooh 01:42
I may not have been able to get /…/ quotes to work as expected but thankfully adding ecma regex to a grammar is pretty easy 01:43
Nemokosch okay, here we go... 07:14
tellable6 2022-06-29T12:08:27Z #raku <patrickb> Nemokosch: I don't understand.
2022-07-06T09:32:09Z #raku <guifa> Nemokosch: Yeah. EMCA does flat ordering, and Raku nests
2022-07-09T14:51:33Z #raku <Xliff> Nemokosch: Howso? $dirs should just be a list of '/tmp', '/' and '~/tmp'
2022-07-11T08:56:35Z #raku <lizmat> Nemokosch: good spot, was watching the text more than semantics
2022-07-11T20:23:32Z #raku <guifa> nemokosch: ah. In that case, I'd still do a multi, and just have the whatever return a whatever returning the object itself (via .self)
2022-07-11T22:28:12Z #raku <guifa> Nemokosch: you can do a true call on * by encasing it in parentheses
Nemokosch good enough xD
Nemokosch What module would you use for accessing a REST API over HTTPS? 08:48
moritz Cro::HTTP::Client 09:42
Nemokosch okay, let's see 09:57
Nemokosch oh it supports authentication as well, nice 09:59
jjatria Nemokosch: I'm biased (since I wrote it) but I use HTTP::Tiny for pretty much anything these days 10:10
Nemokosch I have used HTTP::Tiny a couple of times myself 10:11
but now that I downloaded the known universe for Cro, I might as well try it, lol
jjatria lol 10:12
Yeah, that's one of the reasons I wanted to write that one: fewer deps
Nemokosch does it support HTTPS and basic authentication? 10:15
jjatria If you have IO::Socket::SSL installed, then it will use it for HTTPS 10:20
And basic auth should work if your URL has a user:password stanza in it: raku.land/zef:jjatria/HTTP::Tiny#request 10:21
Or you can set the header yourself
Nemokosch makes sense 👍 10:34
Do you know an alternative for Terminal::Getpass? 10:42
Something that doesn't break on unicode, lol
jjatria Yikes, not good. That's the one I use in `rakurl`, so I don't know. But if you find a better one, I can switch as well :D 10:52
Nemokosch ``` my $c = $*IN.read(1); 11:01
last if $c.decode("utf-8") ~~ /\n/;```
now this, this is not a wise thing to do
indeed it cuts actual utf-8 in half
I think it could be fixed 11:37
can I edit a module locally? 11:49
guifa Nemokosch you'd just need to download the source and make edits and then `zef install .` 11:51
Nemokosch well the fix seems to work for my case 11:57
simply changed 11:58
```my $c = $*IN.read(1);```
to
```
my $c = buf8.new;
$c.append($*IN.read(1)) until try $c.decode('utf-8');
```
guifa heh, conversions to Raku regex when you want it to be straightforward / one pass-y look hideous but they work 13:02
guifa (especially the infamous e-mail validator) 13:10
japhb Nemokosch: Terminal-LineEditor does password masking and handles at least left-to-right Unicode. 13:58
Speaking of which, if anyone in channel can read and write a right-to-left language, I'd love to pick your brain. 13:59
saint- When printing out a match object, is there a way to limit the depth that it prints? 14:05
saint- Oh nvm, I can just call .Str on it, thanks 14:14
Altreus I have a class with a lot of properties for which default behaviour is fine, and one property where I need to intercept the value provided to the constructor before it's set on the object - so TWEAK is too late. But it also looks like if I implement BUILD I have to put all of the properties in the signature! Is there something like BUILDARGS from p5's Moose, where I can transform what is given to the 14:16
constructor befoer it's used to construct?
Nemokosch japhb: if Terminal::Getpass doesn't get a fix, I will look into using LineEditor 14:18
again, the complexity
Altreus Specifically, I have an Int property, which is a bitmask, which I can construct from strings; so I'd like the user to be able to pass a list of strings, or a bitmask of their own
I need to do that transformation before any of the default processes try to assign that array of strings to the property 14:19
nine A list of strings sounds like a very Perlish solution. Why not declare an enum where the numeric value is actually the bit that value should set. Passing Foo +| Bar to that constructor isn't much different to passing a list of strings. 14:28
Altreus it's already an enum, but it's much more cumbersome to use that module and put ENUM:: on the front of everything, when one could simply do <x y z> 14:33
The idea was that I would do that ENUM::«$_» myself and reduce it 14:34
Altreus That's also why I would like to continue to support just passing an int - because that's how it's already done 14:34
wait, I might have overcomplicated my base case 14:35
yes I think I might have tbh 14:36
japhb Altreus: enums can be exported, so that their short names are available in the using code 14:38
Nemokosch: Sadly, my experience is that doing line editing even half-decently is decidedly not as easy as one might think. 14:39
But adding password handling was easy in comparison, so ... if you have a use for a line editor, you get the password input for "free". :-) 14:40
My reason for writing Terminal-LineEditor was actually that Linenoise did such a terrible job of it ... and the reason for *that* is because the authors were trying to write a smaller line editor than Readline, and bit off more than they could chew, Unicode-wise. 14:41
Altreus japhb: that was my overcomplication :)
japhb Altreus: :-) 14:45
japhb Oh, to be clear, I should mention that the Linenoise problem is not due to the Raku wrapper for it, the problems are in the underlying C library, which is just ... broken. And anglocentric. 14:46
melezhik Hi jjatria - thanks for github.com/melezhik/Tomtit/issues/2 , you took some interest in Tomty, don't you?   😁
Nemokosch Well, all I really need is a password input 14:56
and even for that, it's enough if it doesn't break for me and potentially colleagues 14:57
japhb My experience is that minimalist libraries don't tend to handle Unicode well. :-) I'd wager there's a cliff between "minimal password entry" and "does more than just password entry, but at least can handle Unicode and duospace glyphs" with not very much in between. Still, if you find such a thing, more power to ya. 15:02
Nemokosch I think I have told you about the problems I've come across when using Terminal::LineEditor as the REPL line editor, so there's still where to grind 😛 15:12
Right now, the only reason unicode failures bother me with the password prompt is that the password I'm using contains non-ascii characters (that are otherwise pretty generic Latin alphabet characters) 15:14
It's better to know about this stuff and fix it but it's not worth too much for me.
melezhik lizmat I made some comment on my PR to App::Rak 15:21
I'd interested to see your opinion ))) 15:22
[Coke] does zef install everything in bin/ ? I just realized I never declare that in something like meta6.json/provides. 15:25
melezhik [Coke] it does so by default
jjatria melezhik: starting a new difficult project means trying out the new tools! :D 15:26
melezhik everything you have in `bin/` will be installed by zen, you don't have to declare  anything explicitely
jjatria ahh, ok , I wonder how you are thinking use of Tomtit? You need a task runner? 15:27
jjatria Same problem: PublicSuffix. I'm currently prototyping the autobuilds using ake but I'm not sure I'm totally sold on it 15:28
melezhik so, it's ake vs tomtit? HA-HA  😁 15:30
overall if you don't need make like things likes tasks dependencies, tomtit could be simple way to go, as it's just task runner with Sparrow6 plugins support
jjatria So far, just trying stuff out :) 15:31
melezhik that means batteries included - every from sparrowhub.io just works with Tomtit ....
are you sold? HA-HA 😂
jjatria I tried a simple placeholder task and I got an inexplicable `Failed to copy '/home/user/repo/api/v1/index' to '/home/user/sparrow6/index'` so not quite there yet 15:33
melezhik it's simple to fix - `export SP6_REPO=sparrowhub.io/repo` 15:34
jjatria Neither of those directories exist so not sure where they are coming from 🤔
melezhik also please upgrade Sparrow6 to the latest version, as a new version of Tomtit requires the latest version of Sparrow6
by default tomtit ( well actually Sparrow) looks for repository of plugins at local directory (~/repo), it works well if one has this on their machine, however , most of the user don't - so just redefine SP6_REPO var to point to http public repository 15:36
export SP6_REPO=sparrowhub.io/repo
jjatria Maybe it should test if that exists and ignore it otherwise? 15:37
melezhik please fill a ticket and think about it ... 15:38
think -> I will think 15:39
I also might change repo default setting to sparrowhub.io/repo to avoid this confusion 15:40
jjatria melezhik: github.com/melezhik/Tomtit/issues/3 15:43
melezhik jjatria ++ 15:50
jjatria put my comment 16:02
guifa TIL <-ident> for "anything that's not in the <ident> character class 16:11
m: grammar Foo { token bar { <[a..f]> }; token TOP { <+[a..z]-bar>+ } }; say Foo.parse: 'xyz'; say Foo.parse: 'abc'; 16:13
camelia 「xyz」
Nil
guifa whoa
This is… not documented but very cool 16:15
only seems to work in a grammar though 16:19
m: my token nothex { <[g..z]> }; say '1920abc' ~~ / <[0..9]+[a..z]-nothex>+ / 16:20
camelia No such method 'nothex' for invocant of type 'Match'. Did you mean
'note'?
in block <unit> at <tmp> line 1
japhb Nemokosch: I remember you asking me if I was the author of Terminal-LineEditor, but I don't remember what you were concerned with. GitHub Issues welcome (github.com/japhb/Terminal-LineEditor/issues) :-) 16:21
guifa hmm so it looks like even though the <[foo]> is supposed to be for character classes (emphasis on character, singular), it'll happily take a multi-char match there 16:26
guifa it's not entirely intuitive though: 16:29
m: grammar A { token b { <[a..c]> <[d..f]> }; token TOP { <+ident -b>+ } }; A.parse($_).say for <a ad aad>;
camelia 「a」
Nil
「aad」
guifa actually, make that buggily unintuitive 16:31
how in the world does this match for aad? 16:32
m: grammar A { token b { <[a..c]> <[d..f]> }; token TOP { <+ident -b> } }; A.parse($_).say for <a ad aad>;
camelia 「a」
Nil
「aad」
guifa summons the regex magus 16:33
moritz: any ideas what's going on there? 16:34
Nemokosch what the hell, b isn't even a character class 16:37
guifa yeah. I figured it would only try to maybe match a single character to <b> (which should be an always fail), but no, not doing that 16:38
Nemokosch what about adad? 😄 16:41
guifa m: grammar A { token b { <[a..c]> <[d..f]> }; token TOP { <+ident -b> } }; A.parse($_).say for <a ad aad adad>;
camelia 「a」
Nil
「aad」
Nil
guifa m: grammar A { token b { <[a..c]> <[d..f]> }; token TOP { <+ident -b> } }; A.parse($_).say for <a ad aad adad aadad>;
camelia 「a」
Nil
「aad」
Nil
「aadad」
Nemokosch we can notice a... kind of pattern 17:03
guifa m: grammar A { token b { <[a..c]> <[d..f]> }; token TOP { <+ident -b> } }; A.parse($_).say for <a ad aad adad aadad aaadad>; 17:04
camelia 「a」
Nil
「aad」
Nil
「aadad」
「aaadad」
guifa I figured it was taking them in two at a time (aa, and then doing da da), but it's not that 17:05
something weird is going on, and I'm not sure if it's worth fixing before an eventual regex overhaul 17:06
(iirc that's the one of the next big projects after RakuAST) 17:11
Nemokosch also 17:12
> token TOP { <+ident -b> }
this grammar looks like something that consists of single characters?
like what even
guifa That's the character class syntax 17:15
<+[a..z]-[h..z]>
Add a..z, then subtract h..z. 17:16
That's a bit of a pointless example since you could just write <[a..g]>
token anything-letter-but-eszett { <+alpha -[ß]> } is much easier to write than, ugh, I dunno know what the start and end ranges would be 17:17
Nemokosch okay but that still only makes one character 17:18
guifa yeah. the bug is clearly that somehow it's looping even though it shouldn't
Nemokosch okay but in your very first example, at least there was a quantifier after the character group
since then, I have no idea what the behavior should be 17:19
[Coke]_ I want two executables that do the same except for one thing keyed off the name of the executable. Is there a clever way to do this other than 1) two scripts identical but for the one thing, 2) one script that exec's the next one and have the condition check for the name of the executable? 20:28
[Coke] The Naive #1 version is fine for now. 20:28
(but feedback welcome)
guifa Why not just have the name check in the small part that's different? 20:44
[Coke] but duplicate all the code in both? 20:49
[Coke] tries to dig back into creating a viewport in a command prompt and remembers why he stopped. 20:52
japhb perks up 20:54
What do you mean "creating a viewport"?
guifa: I think the problem that [Coke] is having is that the classic way of solving the problem is to have one script plus a link farm, and have that one script detect the name it was called with to figure out which link was used. Except zef doesn't know how to install links, I suspect. 20:56
(user-level links in bin/, not internal links, of course, which are a necessary part of doing the basic Raku install job)
guifa aaah 21:10
[Coke]_ (links) also probably not workable on windows easily 23:02
[Coke] (viewport) have a console window split into multiple sections, kind of link an irssi window 23:02
want to have scrolling output on top, and a status bar at the bottom 23:03
japhb Working on something that would help with that. Just my off-hours project, so not exactly moving screaming-fast, but I manage to put in a few hours most weekends. 23:48