🦋 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:07 reportable6 left 00:09 reportable6 joined 00:10 euandreh left, dextercd left
guifa Skarsnik: if you look in the Raku grammar, the normal way to do it is 00:12
token foo { <bar> || <.error> }
m: grammar Foo { token TOP { [<alpha> || <.error: 'need letter'>]+ }; method error ($msg) { die $msg }; }; say Foo.parse('ab3'); 00:16
camelia need letter
in method error at <tmp> line 1
in regex TOP at <tmp> line 1
in block <unit> at <tmp> line 1
guifa m: grammar Foo { token TOP { [<alpha> || <.error: 'need letter'>]+ }; method error ($msg) { die $msg }; }; say Foo.parse('abc');
camelia need letter
in method error at <tmp> line 1
in regex TOP at <tmp> line 1
in block <unit> at <tmp> line 1
guifa err
yeah, duh, it's bombing at end of string 00:20
but anyways, that's the idea
00:56 frost joined 01:11 euandreh joined 01:19 frost left 01:44 seednode99 left 01:46 seednode99 joined
SmokeMachine I like doing error like this: github.com/FCO/bernalang/blob/572c...r.pm6#L186 01:54
01:59 frost joined 02:05 frost left 02:18 euandreh left 02:24 frost joined 02:30 frost left 02:43 frost joined 03:12 discord-raku-bot left, discord-raku-bot joined 03:16 frost left 03:21 frost joined
Voldenet >A friend twitted his terrible idea of writing a programming language entirely without special characters. 03:26
it exists, it's called pascal
03:40 gabiruh left, gabiruh joined 03:41 frost left 03:43 monkey_ joined 03:51 frost joined 03:56 frost left
tonyo what does special characters mean in this instance? 03:57
Voldenet anything not being alnum or whitespace 04:31
04:39 monkey_ left 04:47 mexen left 05:09 mexen joined 06:07 reportable6 left 06:19 frost joined 06:30 tejr left, tejr joined 07:10 reportable6 joined 07:19 tejr left, tejr joined 07:36 holyghost joined 07:38 frost left 07:46 seednode99 left 07:47 seednode99 joined, frost joined 07:53 frost left 08:01 abraxxa joined 08:02 Sgeo left 08:08 abraxxa left 08:10 abraxxa joined 08:15 abraxxa left 08:16 abraxxa joined 08:52 jjido joined 09:10 dakkar joined 09:13 jjido left
Nemokosch Why Pascal? It has square brackets, semicolons and normal operators 09:35
lizmat clickbaits rakudoweekly.blog/2022/01/10/2022-...-perching/ 09:41
Nemokosch anyway, it reminds me of the weird habit of obsessing over banal syntax decisions in programming languages 09:45
the law of triviality
and "it looks like a real language, it has brackets after all" as a phenomenon
El_Che damn, Pascal was probably the first language I learnt (and forgot) 10:06
who's calling me old??
moritz_ I learned qbasic before flirting with Pascal 10:12
Nemokosch It was my first language as well so surely not me
😄
El_Che moritz_: I didn't have a pc, but look at the source of those gorilla games :) 10:13
10:13 linkable6 left, evalable6 left
Nemokosch a part of the story is that I learned Pascal as a first language in 2011 as a first encounter with programming 😛 10:14
El_Che 2011, wow 10:15
let me guess. you also have vinyl LPs :)
moritz_ El_Che: I implemented extra features and levels for "nibbles" (the snake-like game in qbasic)
10:16 stanrifkin joined
El_Che oh, I remember it 10:16
10:16 evalable6 joined
stanrifkin Anyone also get an git protocol error with 'rakubrew available'? 10:17
Nemokosch I bought one LP but you know, where do I put the player and the speakers? Nowadays, buying CD's is just retro enough 10:18
El_Che true, very true
Nemokosch and don't write Free Pascal off 😼
El_Che I remember all the excitement in the Linux world about Lazarus (and the meh reaction when it finally arrived) en.wikipedia.org/wiki/Lazarus_(software) 10:19
stanrifkin why the "meh" reaction? 10:20
El_Che because it was very --very-- hyped
Nemokosch my question exactly
stanrifkin Lazarus is used in our school system here 10:21
El_Che and it was rather buggy
stanrifkin ah ok
El_Che it may be ok now
I am talking about 20 y agi
stanrifkin i heard this "tourist" guy uses free pascal occasionally in competitive programming. 10:22
Nemokosch I don't know, I haven't used Lazarus for some time
But I support the development of Castle Engine
I think we have to be thankful for the existence of one actively developed, multiplatform game engine for Object Pascal
lately with Delphi support as well, so I heard 🙂 10:23
El_Che Delphi was very popular 10:24
stanrifkin "The unauthenticated git protocol on port 9418 is no longer supported." with rakubrew available
i am not much into git stuff. Should I set GIT_PROTOCOL environment variable?
Nemokosch Also, I tend to pick Lazarus software out there
like PyScripter or Cudatext
10:25 euandreh joined
I wonder what you are doing 10:26
10:27 frost joined 10:32 frost left 10:42 frost joined
stanrifkin GIT_PROTOCOL=https solved my problem. I looked into the rakubrew source code. It defaulted to "git". 10:53
10:55 frost left
Skarsnik this is weird 11:01
11:02 frost joined 11:26 frost left
El_Che I would expect to default to https, idd 11:35
raise an issue?
stanrifkin i don't know how :) 11:40
i think rakubrew crew are reading this and it gets corrected soon 11:41
El_Che github.com/tadzik/rakudobrew/issues 11:42
github.com/tadzik/rakudobrew/issues/69
there is one
stanrifkin El_Che: ah yeah. already addressed 11:43
El_Che: in 2015? :) 11:44
El_Che I haven't used rakudobrew in a while, I don't know how active it is 11:46
stanrifkin El_Che: what do you use? I am used to perlbrew. So natural I use rakubrew. 11:47
11:47 frost joined
El_Che I build Linux packages 11:47
11:51 jjido joined, frost left
Nemokosch I thought rakubrew was the way to go 11:55
github.com/Raku/App-Rakubrew 11:56
rakudobrew is an older version 11:57
the github page actually says that
12:07 reportable6 left 12:14 linkable6 joined
Geth App-Rakubrew: a1e15f493c | (Patrick Böker)++ | 2 files
Switch Git protocol to https

This follows fact that GitHub disabled the `git` protocol.
12:53
App-Rakubrew: fb7d4c5297 | (Patrick Böker)++ | .circleci/config.yml
Update CircleCI MacOS base image

The previous one is to be removed.
App-Rakubrew: ccfd316ee1 | (Patrick Böker)++ | 4 files
Version 26
12:54
13:07 frost joined 13:29 jjido left 13:39 lgtaube joined 13:41 frost left 14:10 reportable6 joined 14:48 MasterDuke left 14:52 qorg11 left 14:53 qorg11 joined 15:06 MasterDuke joined 15:08 stanrifkin left 15:10 jgaz joined 15:11 Sgeo joined 15:21 jjido joined 15:31 jjido left 15:47 cono left 15:54 razetime joined 16:12 holyghost left 16:31 kjp left 16:33 jgaz left 16:34 kjp joined
thowe I've been looking for a while for a good academic example or discussion about how one should go about building a CLI... Like a shell or really any command interpreter. Also think Juniper or Cisco switch CLI. Is there a "pattern" for that that I would be naive for not using? 16:38
I want all the fancy things like command auto completion etc... 16:39
Do I just build a loop and a data structure that has the commands in it and somehow knows how to dispatch to the right mehtod for them? That sounds like the naive solution but I dunno. 16:40
jercos that certainly sounds like a working start to me. I don't know of an absolute standard for interpreters or repls, and well... some existing shells would make pretty poor examples to copy the structure of :p 17:04
for most shells I know of, the first word being auto-completed is from a list of valid commands, while completion for a command's arguments are either generic (into the local filesystem) or entirely determined by the specific command. 17:08
using a naive initial structure doesn't rule out building on more complex functionality 17:10
thowe I guess. I just don't want to put something out there that's going to be frowned upon. 17:14
MasterDuke you could look at some existing ones. e.g., zef, mi6 17:15
thowe zef has a cli? 17:16
tonyo zef has a cli. 17:19
thowe how do you start it? it just seems to take commands and exit. 17:20
MasterDuke ah, you want an interactive cli, like the repl 17:21
thowe yeah... Otherwise I might look for something like Perl's App::Cmd
wish there was an App::Cmd for interactive shell framework. 17:22
psql CLI is a good example of what I want I guess, but not so many features needed. 17:23
17:27 abraxxa left, mexen left 17:28 razetime left
thowe looks like Arne Sommer might have written one for some kind of transportation planning thing... I might look at that. 17:32
guifa for Raku, the nice thing is that you can run on a loop and have a grammar parse stuff, which can make dispatching much cleaner/straightforward 17:34
thowe guifa, OK, yeah... That sounds like something I want to do. I also feel like I need to capture every character entered, though. So I can do tab completion. and if not a special character, just somehow do nothing and let it sit on the command line. I'm a little fuzzy on how that would work. 17:37
17:38 dakkar left
solitario n/20 17:38
guifa yeah, that's something I'm not as sure how to do. It's super easy if you're okay waiting for the enter key ha
17:40 djerius left 17:41 djerius joined
thowe Sommer's networkplanner command uses "Linenoise", which may do some of these things for you(?) 17:43
I really need to get it through my head what a "callback" is. 17:46
guifa Yeah, trick with linenoise is it's a binary dependency, rather than pure Raku. But given the complexities of doing anything other than "type command, hit enter, process command", it's understandable it's not exactly a built in in most languages 17:47
the niche for a nice CLI library would be one that provides for a fallback if linenoise isn't available for some reason 17:48
17:48 lucasb joined
[Coke] wasn't someone already working on that? 17:57
japhb, maybe? 17:58
thowe I'm happy to test maybe. Hitting tab key in networkplanner crashes it. 18:01
what's japhb's cpan name? 18:03
18:04 cognominal joined 18:06 squashable6 left 18:08 reportable6 left 18:10 reportable6 joined 18:23 jjido joined 18:24 squashable6 joined
thowe ah, this? raku.land/zef:japhb/Terminal::LineEditor 18:28
OK, japhb has some neat stuff. they can have all my stars. 18:35
guifa haha there are osme really nifty modules out there 18:42
18:46 Maylay left 18:50 Maylay joined
tonyo there's also a readline module 19:05
either is worth using so you don't need to handle `up` key or emulate history 19:06
19:07 [Coke]_ joined
thowe a pure raku solution would be nifty, but I'm asking japhb about command completion and disambiguation of short forms... I don't see a way to do it from his README. 19:07
19:10 [Coke] left 19:13 jjido left
tonyo it's one of those simple seeming problems that gets out of control with features quickly 19:19
19:27 mexen joined
thowe yeah, that's why I'm looking for a bottled solution :) 19:29
stevied someone should nudge whoever is in charge of homebrew package to get it updated: formulae.brew.sh/formula/rakudo-star 19:55
the version I was using was badly broken when trying to load modules
I'm on monterey 19:57
El_Che use rakudo instead instead 19:58
(that's what I use when in macos)
stevied I'm using the binary 19:59
guifa I really need to figure out a way to do a DMG or .pkg install for Rakudo. Gatekeeper is annoying AF with command-line only stuff 20:00
20:00 seednode99 left 20:01 seednode99 joined
stevied that would be nice. 20:03
what's gatekeeper? 20:05
perryprog macOS thingie that does security stuff with installing stuff 20:17
it's actually quite good but can be a huge pain when installing DMGs/.pkgs from unknown sources (which is common for devs)
(which I think is quite ironic
20:18 jjido joined
guifa perryprog it's not terrible as long as the whole package is signed. the problem is, a CLI thing isn't an application package 20:21
perryprog Right
guifa so from what I was reading, you basically create a dumy application of sorts, and it can sign its command line stuff
anyways, I'm sure once I figure it out it'll be easy to make releases just.... I need to stop adding new projects to my plate 20:22
20:22 zacts left
perryprog guifa, I believe Julia actually does exactly what you're looking to do 20:24
I have a Julia.app that basically just starts julia in Terminal.app—I personally have never used it, but I'm going guess they're doing what you're describing there 20:26
stevied oh, right, you have to do that security thing
I have an apple developer account
maybe that would help
guifa I'd imagine to do "julia foo" on command line they'd need to adjust the path var. Not sure if the app itself can do that, or if it that would be handled by the installer. 20:27
perryprog guifa if you look at brew cat --cask julia you can see what exactly is being done 20:29
but it seems there's a symlink (probably from brew?) that goes from /usr/local/bin to the .app's julia executable 20:30
yeah, it's homebrew linking it
20:30 Sgeo_ joined
perryprog I don't know why I installed it through the cask and not the formula, but it works 🤷‍♂️ 20:31
20:33 Sgeo left 20:45 Maylay left 20:47 Maylay joined 20:52 [Coke]_ left 20:55 [Coke] joined 21:34 euandreh left 21:52 euandreh joined 22:09 cognominal left 22:10 cognominal joined 22:11 cognominal left
stevied With Moose in Perl, you could do a "lazy" build of class attributes. Is there a similar mechanism with Raku? 22:49
looks like I need a module for that? raku.land/cpan:JSTOWE/Attribute::Lazy 22:51
22:51 stevied joined
Nemokosch I noticed something odd with cached, trynna golf it 23:39
m: ```multi factorial(0) { 1 } 23:44
multi factorial($n) is cached { $n*factorial($n-1) }
say factorial(7);
```
m: multi factorial(0) { 1 } multi factorial($n) is cached { $n*factorial($n-1) } say factorial(7); 23:45
okay... then _trust me bro_ remains
this works alright
(use experimental :cached;)
m: use experimental :cached; multi factorial(0) { 1 } multi factorial($n) is cached { $n*factorial($n-1) } say factorial(7); 23:46
anyway, if you add _is cached_ to the constant clause (factorial(0)), the factorial(7) call will fail
`Constraint type check failed in binding to parameter '<anon>'; expected 0 but got 7` 23:49
23:51 evalable6 left, linkable6 left 23:53 linkable6 joined