🦋 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.
pelevesque @tonyo - I wish there was a test-depends emptied field in your fez generated META6.json. 00:37
tonyo can be added - 01:19
jjatria I'm using IO::Socket::Async to write a UDP client/server pair, but I can't figure out how the server gets the host/port of the incoming connection to send a response. I can receive messages on the server, but not respond 11:15
Does anybody know where I can get where to send a response to? 11:17
lizmat jjatria: I'm actually unsure whether UDP is supported at all on Moar 11:24
perhaps time for a SO question
jjatria Sure, I can do that 11:38
霧嶋 董香 Hi, how to get all built-ins functions and keywords in raku ? 12:25
[Coke] is this for an editor/IDE - I think many cheat and keep a list. You could introspect the grammar and CORE:: (I think) to try to get a introspected list. 13:17
[Coke] m: dd CORE::.keys[^5] 13:20
camelia ("\&prefix:<++⚛>", "\&chop", "UIntPosRef", "\&print", "\&all")
[Coke] m: dd CORE::.keys.sort[^5]
camelia ("!INIT_VALUES", "\$!", "\$/", "\$=pod", "\$?BITS")
[Coke] m: dd CORE::.keys.grep(*.starts-with("\&").sort[^5]
camelia ===SORRY!=== Error while compiling <tmp>
Unable to parse expression in argument list; couldn't find final ')' (corresponding starter was at line 1)
at <tmp>:1
------> :.keys.grep(*.starts-with("\&").sort[^5]⏏<EOL>
[Coke] dd CORE::.keys.grep(*.contains("&c")) 13:22
evalable6 ("\&cross", "\&chop", "\&circumfix:<\{ }>", "\&…
[Coke], Full output: gist.github.com/821a380a4ab322cbda...b8a44fa659
[Coke] the &'s will be all the top level subs.
but you'd need to look at the grammar to get syntax like "for" 13:24
[Coke] The grammar is complicated enough you're probably better off keeping the keyword list separate. 13:26
jjatria lizmat: stackoverflow.com/questions/75889032 13:41
霧嶋 董香 @coke thank you! 13:59
tonyo vrurg: taking a look at your question on the `rev` thing today. did the globber work better? the review command is a little difficult without an AST available to fez (it's just a dumb grepper) 15:18
vrurg tonyo: the globber seems to be ok, except for the attempt to read from an excluded file. 15:20
tellable6 2023-03-28T08:35:50Z #raku <Xliff> vrurg Ah! Thanks!
tonyo okay cool
vrurg As to the "dumb grepper", but module names are in the source. The dumbest one would've found them.
tonyo the dumbest one would also add anything with two colons to something else 15:21
vrurg :D
Anyway, you have the repo and can test against it. And I consider the new features as a great move into the right direction. Though my tooling is already based around own-brewed makefile-based subsystem, where fez serves as an uploader only. 15:23
tonyo no worries, testing is much appreciated - working on making fez see your repo a little more sanely 15:25
also, i'm moving the 'production' key out of the META6.json and into a `.fez` file 15:26
vrurg The way I assumed the key to be? 15:27
tonyo i have it here: pastebin.com/6VJTzg96 which looks sane to me 15:28
yea
also in that .fez file you can disable warnings about those types by adding `ignore-provides: ["HelperMethod", ...]`
i'll put up a PR so you have an example and then i'll fix the globber in that repo 15:30
vrurg I saw the ignore feature. Might be a bit too much in some cases, but I hope things change for better with RakuAST. One thing could be done already though. If you see a module declaration then you could try import it and iterate available symbols. Barely useful with 'my', but otherwise might work. 15:31
tonyo i thought about that but it was failing badly for modules that reach out to some service when `use`d 15:33
pastebin.com/aMweXXtL
vrurg And possible internal integrity issues if the modules messes up with things in an surprising way. But that could be resolved by spawning a child process. And ignoring outcomes if it fails. Then it could just fallback to the current behavior. 15:34
I need to go. Will be away for a while. 15:35
Like it where fez goes anyway.
Thanks!
tonyo thanks vrurg ! 15:36
tonyo fez v49 adds the test depends pelevesque, should fix #90 and make #92 more palatable vrurg 16:33
tonyo m: use Raku::Grammar 17:25
camelia ===SORRY!=== Error while compiling <tmp>
Could not find Raku::Grammar in:
/home/camelia/.raku
/home/camelia/rakudo-m-inst-2/share/perl6/site
/home/camelia/rakudo-m-inst-2/share/perl6/vendor
/home/camelia/rakudo-m-inst-2…
lizmat m: use Raku::Grammar:from<nqp> 17:27
camelia ===SORRY!=== Error while compiling <tmp>
Could not find Raku::Grammar:from<nqp> in:
/home/camelia/.raku
/home/camelia/rakudo-m-inst-2/share/perl6/site
/home/camelia/rakudo-m-inst-2/share/perl6/vendor
/home/camelia/rakud…
lizmat m: use Raku::Grammar:from<NQP>
camelia ( no output )
lizmat tonyo ^^
still WIP though 17:28
tonyo danke 17:30
trying to prepare for some stuff i'd like to add to fez or individual tooling eventually
hmm, is there a method to just get the AST from a string? 17:40
looking at that class in nqp it looks like it's evaluating compunits
pelevesque @tonya - 17:59
lizmat m: say Q|say "tonyo"|.AST 18:07
camelia RakuAST::StatementList.new(
RakuAST::Statement::Expression.new(
expression => RakuAST::Call::Name.new(
name => RakuAST::Name.from-identifier("say"),
args => RakuAST::ArgList.new(
RakuAST::QuotedString.new(
tonyo whoa
lizmat what you hoped for and more? :-) 18:08
tonyo yea very sweet and easy
tonyo m: use experimental :rakuast; sub X {}; "sub X {}".AST; 18:44
camelia Use of Nil in string context
in block <unit> at <tmp> line 1
===SORRY!=== Error while compiling
Missing block
------> sub X ⏏<EOL>
tonyo m: use experimental :rakuast; sub ABCX {}; "sub ABCX {}".AST;
camelia Use of Nil in string context
in block <unit> at <tmp> line 1
===SORRY!=== Error while compiling
Missing block
------> sub ABCX ⏏<EOL>
[Coke] tonyo: you want single quote. 19:05
tonyo m: use experimental :rakuast; sub ABCX {}; 'sub ABCX {}'.AST;
camelia ( no output )
[Coke] m: dd 'sub X {}'.AST
camelia sub X { }
tonyo is the ast meant to also act as a linter? 19:06
[Coke] otherwise you're interpolating a nil with that {}, I think.
tonyo yea you're right, brain dead today
[Coke] in that you get standard output, not original source input
tonyo yea
[Coke] but I think it's more "porcelain" than "linted", if that matters.
tonyo ah, so not planned to also be a linter 19:07
[Coke] interesting, at some point sub output empty parens, but that's no longer showing up here.
tonyo this makes writing a linter much easier than six years ago 19:52
Nemokosch that was part of the reason I suppose 20:17
guifa needs to publish an update to Pretty::RAST 20:52
ultimately it could be used as a formatter and possibly a linter at some point
lizmat m: say Q|sub foo ($a) { $a + $a }|.AST.DEPARSE 21:00
camelia sub foo (Any $a) { $a + $a }
lizmat tonyo: deparsing lints to an extent already 21:01
Nemokosch github.com/Raku/atom-language-perl6/pull/101 22:02
with this PR, I hereby announce my intentions to take control over the highlighter repository 🤠 22:03
tonyo m: say Q|say 1;|.AST.DEPARSE 22:15
camelia say(1)
guifa is going to try to find a way to get it so we can say something like pretty-print $rast-node :type<html>, :options(:foo); 22:16
and then get a perfect HTML-ready output
rather than rely on a 98% accurate syntax highlighter
lizmat just for the record: the class doing the deparsing, is RakuAST::Deparse 22:17
it can be subclassed, or you can write your own 22:18
and you can specify the class for deparsing as an argument to .DEPARSE
m: use v6.*; say Q|say 1;|.AST.DEPARSE(RakuAST::Deparse)
camelia say(1)
Nemokosch an HTML generator is very welcome. This is not an either-or thing. There are editors using this highlighter, and in fact, Github itself uses it for highlighting Raku code. You aren't gonna replace that. 22:20
tonyo HTML generator is available as Ryml 22:28
Nemokosch like please, not this "I don't care because I will manage without/I know better" sort of mentality again 22:30
lizmat Nemokosch you have my blessing re atom-language 22:32
also, I've just renamed the repo.... :-)
afk& 22:33
Nemokosch I'd say eventually it cannot (or at least shouldn't) stay "atom" either; if there is any editor to be named, it would be TextMate since the files are using the TextMate format 22:44
guifa Nemokosch: yeah, the advantage of a highlighter like the Atom one is it generally will work fairly well on something that's syntantically invalid 22:46
tellable6 guifa, I'll pass your message to Nemokosch
guifa e.g. highlighting correctly up to somewhere around abouts the error
an HTML (or other outputter) from RAST will barf on a syntax error 22:47
(but nicely could potentially handle embedded languaages a bit better heh)
Nemokosch I don't think there is a dichotomy here, it's fairly simple. You don't always get the freedom to generate custom HTML. I wonder how much you get that freedom from an average TextMate-compatible editor, and you definitely don't get that freedom from something essentially like a markdown highlighter in a much broader system. 22:51
So while it's also true that I don't think we have anything better quality-wise, either way, there needs to be something that can just work with the existing "rigid" tools, even if it only covers 98% of cases.
guifa yeah 22:56
we're in agreement :-)
like you said, it's not an either or -- good reason for both
in reality, I'm making the pretty-print to just give me colorization when printing out in-progress RAST code 22:57
but there's not too much difference between inserting an ANSI code and an HTML <span> of course
Nemokosch the difference is in the (often declarative) interface these tools provide 22:58
they might as well be dumb HTML generators under the hood if they don't let you make it smarter 22:59
Anyways... In general, right now the question isn't if we can get that 98% up to a hundred, much more like, if we can get visible presence at all. There is still no highlighting for Discord and I had to accept that either one of us gets a highlighter into highlight.js or the time just won't magically come, ever. There are dozens of supported languages, including ones that I've never heard of and/or seem like a kind 23:00
of joke.
Languages that I'm absolutely sure are less known and used than Raku - however, the difference is made by the people who create the tooling.
And this is when I feel "nostalgic" about Minecraft in around 2012, which had 5 English dialects, "Pirate language" and perhaps even cat language - but no Hungarian, for quite a lot of time 23:01
tonyo are you a hungarian native speaker nemo? 23:04
Nemokosch Yes 23:07