🦋 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.
antononcube I sort of want to write a package that duplicates the functionalities of Python's "argparse", but looks like a fair amount of that is in the "Getopt::Long" module. Do you think it is a good idea to: 1) Extend "Getopt::Long" or similar package, 2) write a package "Python::ArgParse::Grammar", 3) write a package "Getopt::Grammar"? 17:56
leont antononcube: Getopt::Long is written to be extensible, that route would be sensible to me. AFAICT the additional functionality is mainly a help generator 18:38
SmokeMachine Hi all!!! I've been reading about Elixir, does anyone here have played with it? I'm finding it very interesting... I started playing with it in Raku (github.com/FCO/OTPish) does anyone think something like this would be interesting? 18:45
antononcube @leont Thank you for your answer! I will study the code of "Getopt::Long". 18:46
leont hasn't played with Elixir, but has with Erlang a long time ago. It's pretty interesting, and wildly different from Raku 18:48
SmokeMachine leont: I've been only reading about it... but I really liked the "process way" of doing stuff... I really like the Hash example I've added on the README of that repo... I really think it can goes well with raku... 18:50
I've implemented the "process" with Promises... 18:54
Does anyone thinks something like that for Raku would be interesting? 19:08
antononcube @leont I decided not to mess (your neat) "Getopt::Long" setup. Meaning fork it, change it, make a PR. I decided to make "Getopt::Long::Grammar". 19:42
leont What are you trying to achieve exactly? 19:48
antononcube @leont Given a Jupyter chatbook made with Python kernel I want to be able to switch to a Raku kernel for that notebook and use the chatbook cells as they are, without changing the cells "magic specs." This means that I have to implement parsing of the argument specs the way Jupyter Python uses them. 19:52
For example, I need this say getopt-interpret('my_command --option=value'); to produce {arguments => (Any), command => my_command, options => [{long-opt => {opt-arg => value, opt-name => option}, short-opt => (Any)}]} or something similar. 19:53
Geth CCR: raiph++ created pull request #5:
Create AaronSherman.md
20:01
leont I don't quite do the long-opt short-op distinction (and I don't know why anyone would think that's useful), but you can generally fake it by treating all single-character arguments as short 20:05
Geth ecosystem/main: f100c02d4c | (Elizabeth Mattijsen)++ | META.list
Remove Hash::Consistent

It lives in the zef ecosystem now
20:08
antononcube @leont Agreed -- no need to distinct short-opt and long-opt. I am simply trying to emulate Python's "argparse" (the way I understand it.)
@leont See examples of the preiliminary version here: github.com/antononcube/Raku-Getopt-Long-Grammar 20:50
leont Odds are you're not handling quoting correctly 20:52
You really want to split converting the string into an array, and then interpreting the array. That would be two reusable parts, together they're not really reusable. That's probably also why the name is wrong. 20:53
antononcube @leont Yeah, thanks. 21:14
SmokeMachine It also has a Stack implementation using GenServer now as example: github.com/FCO/OTPish 21:16