🦋 Welcome to the former MAIN() IRC channel of the Raku Programming Language (raku.org). This channel has moved to Libera (irc.libera.chat #raku)
Set by lizmat on 23 May 2021.
Xliff o 05:56
Who maintains the Atom plugin for Raku?
lizmat clickbaits rakudoweekly.blog/2021/05/31/2021-...r-the-bus/ 10:26
stoned75 ~ 12:16
oops
Od1n hello 13:26
jberkel hi, i'm trying to write a simple regex but it's already failing. I want to match a single hash (#) sign: my regex hash { \# }; => Malformed regex 13:28
does hash need to be escaped in some other way? 13:29
Altreus quote it 13:32
Juerd It works with '#' but shouldn't \# work too? 13:33
Altreus that's one for the grown ups 13:34
I just know non-alnum strings need quoting
jberkel docs.raku.org/language/regexes mentions: / \# /; # matches the hash metacharacter literally 13:35
so i assumed that's the way to do it
it looks like the # is interpreted as end of line comment, leaving a single \ 13:37
Altreus ah, regex foo { ... } doesn't trigger the same parsing rules as / ... / then I guess 13:46
Shaeto what does meat *@ and *% in parameters definition ? 13:50
tyil[m] Shaeto: docs.raku.org/type/Signature#index...y_argument 13:52
jberkel ok, it works with quoting, so i'm already a bit further. thanks 13:54
Shaeto single * or double ** or + is slurpy :( or my god
ty
holly github.com/theholyghost2/Solstice should be more compilable except for SDL2::Raw system. I will debug some more later on 15:24
Solstice is an old NES game, see google images or something 15:25
It's easy to RPG elements now 15:26
s/to/to add
lizmat m: react whenever supply emit "hello" { .say } # a roundabout way of saying "hello" :-) 16:02
camelia hello
moritz how async of you :D 16:05
holly ok, Solstice compiles :-) 16:21
now to coerce it
I want it in the ecosystem later on 16:22
lizmat holly: would be nice if it had tests before you put it in the ecosystem :-) 16:26
holly sure, I'll paint a Solstice-o-matic :-) 16:27
tests are for after debugging the game
it's more or less difficult to test
but I'll see what I can do 16:28
Later on I'll make an adventure game out of it 16:29
from back in the day, problem is I'm not too good at graphics 16:30
holly Maybe we can make one with us designing the storyline 16:32
PRs or something 16:33
holly anyway, SFY 16:37
guifa o/ 17:19
holly hi 17:20
Xliff Good morning. 18:04
How hard would this be to implement?
Heredoc quoting construct is q:to/END/ right? 18:05
Xliff WVCards, markup their ilk are becoming more popular and they include their own ending delimiter? 18:05
So why not a heredoc that has the ending inclusive so one can do.... 18:06
q:TO/END:VCARD/?
Would this be better served on problem-solving?
codesections I kind of like that. Proposed syntax: q:thru/VCARD/ 18:07
but yeah, I think that'd probably need a problem-solving issue, since it'd be a new language feature 18:08
holly maybe use delimiter problem solving
e.g. theorem prover
codesections Would it only work for a delimiter that is the only thing on its line? Or any line-terminal delimiter? 18:10
Xliff codesections: Only thing on its line.
I will move to problem-solving. Thanks!
codesections++ # Better syntax 18:11
Done. 18:17
github.com/Raku/problem-solving/issues/282
codesections Anyone interested in a Birds of a Feather session at the Perl & Raku conf? www.reddit.com/r/rakulang/comments...raku_conf/ 18:29
guifa Xliff++ that sounds like a pretty nice proposal 19:17
I don't think it would be too hard, it's probably just setting a boolean during parsing and then adjusting the cut off point for the string somewhere along the way 19:18
(although it's crossing language boundaries, so that may complicate it a bit but not too badly)
Xliff guifa: I don't think it will be too hard to implement. I am just seeking thoughts on the matter, so if you can comment on the issue, I'd appreciate it. 19:21
guifa Xliff: will do. your stray space actually causd jnthn to make a really good point (although he didn't expound on it) 19:25
The location of END in a normal q:to/END/ lets the parser know how many spaces on each line to strip out 19:26
since it's on its own line, that doesn't really cause any issues at all. But for, e.g., an XML end tag that may be on the same line as one or more other tags, it's not clear how to apply the indent-stripping functionality 19:27
lizmat guifa: the end string needs to be the only thing apart from whitespace, no> 19:28
?
guifa in a traditional heredoc yeah. 19:29
codesections Yeah, I asked about that ^^^ and Xliff confirmed that would still be true in this proposal
guifa err whoa, I totally missed that, apologies
codesections But yeah, absent that it'd get ... tricky 19:30
(That'd be nice in many use cases, but much harder to implement)
guifa I guess you could always allow for an extra modifier, but that does complicate it more. Like q:thru:4indent/</xml>/; 19:31
(and so I'd probably not recommend it ha) 19:32
leont still has some conference driven development to do for conf next week 19:44
codesections I wonder how many values have been used in "$_ driven development" 19:48
holly YARH :-) 19:50
colomon o/
Having a really weird show-stopper problem in my Raku script. I have a class which "has %.files". When I try to look at %.files, Raku hangs. Hoping this rings a bell for someone... 19:56
gfldex codesections: I'm still waiting for "QA driven development". 19:57
lizmat colomon: how do you "look" ?
colomon lizmat -- pretty much any way I've tried fails. For sure dd %.files 19:58
lizmat could you do a dd %!files ?
colomon oh! That does work. 19:59
Tried it earlier, but still hung because I had another %.files later, and I didn't notice it ran further before hanging
Xliff codesections: LOL! That's a bug I just found in my code. Hah! 20:00
lizmat colomon: also realize that %.files is just short for self.files could that explain something ?
colomon ARGH 20:01
that's it -- idiot me also defined a files method, which of course calls itself
okay, I can fix this no problem. Thank you for helping me sort things out. 20:02
holly so %!, %. problem
Xliff Class Attribute doesn't have a .private ? Can I ask why? 20:03
So instead I have to do $attr.name.starts-with('$!') which seems LTA 20:04
colomon lizmat++
Xliff Actually, $attr.name.substr(1, 1) 20:05
Check that against '!'
lizmat attributes always have the private name, no?
Xliff lizmat: With '!' as a part of their sigil? 20:06
lizmat: Yes, but as part of the public API, I would rather have a method than a check on attribute name.
lizmat m: class A { has $.a }; dd A.^attributes.head.name
evalable6 "\$!a"
Xliff lizmat: Would a PR adding a .is-private be worthwhile? 20:07
japhb Xliff: You're wanting to know if there was an auto-generated accessor created for the attribute?
Xliff japhb: Sure. But also if its considered private! 20:08
:)
Consider: "$attr.name.substr(1, 1) eq '!';" vs "$attr.is-private" in code.
I would prefer the latter.
japhb But that first one is broken is what lizmat++ I think was trying to say.
Xliff Yeah. It was. 20:09
Moved on from that.
japhb All attributes are created with a ! twigil ... it's just a question of whether an accessor was generated.
Xliff japhb: OK. How would one check for an accessor?
japhb But of course you can create your own accessor, so I think we have a similar problem to knowing if a sequence is infinite 20:10
lizmat m: class A { has $.a }; dd A.^attributes.head.has_accessor
evalable6 Bool::True
lizmat m: class A { has $!a }; dd A.^attributes.head.has_accessor
evalable6 Bool::False
Xliff m: class A { has $.a; has $!b }; A.^attributes.map( *.name ).sa
evalable6 (exit code 1) No such method 'sa' for invocant of type 'Seq'. Did you mean any of
these: 'isa', 'say', 'so'?
in block <unit> at /tmp/_gRyyg7081 line 1
Xliff m: class A { has $.a; has $!b }; A.^attributes.map( *.name ).gist.say
evalable6 ($!a $!b)
lizmat Xliff ^^
has_accessor is what you want
Xliff lizmat++
Thank you. 20:11
holly cool
lizmat++
lizmat m: class A { has $!a; method a() { "foo" } }; dd A.^attributes.head.has_accessor
evalable6 Bool::False
lizmat it really is the flag that indicates whether an accessor should be made automatically 20:12
Xliff m: class A { has $!a; method a { $!a } }; dd A.^attributes.head.has_accessor
evalable6 Bool::False
Xliff heh
lizmat m: class A { has $!a; method a() { "foo" } }; dd A.^attributes.head.has_accessor && !A.^find_method("a")
evalable6 Bool::False
lizmat m: class A { has $!a; method a() { "foo" } }; dd A.^find_method("a") 20:13
evalable6 Method a = method a (A: *%_) { #`(Method|94155151744592) ... }
lizmat m: class A { has $!a }; dd A.^find_method("a")
evalable6 Mu
lizmat Xliff: I guess you can do something with that to your liking ?
Xliff lizmat: No. .has_accessor is what I was looking for. Just checking for a gotcha. 20:14
gfldex lolibloggedalittle: gfldex.wordpress.com/2021/06/01/lo...e-quoting/ 20:23
raydiak bisectable6: regex { \# } 20:26
bisectable6 raydiak, Will bisect the whole range automagically because no endpoints were provided, hang tight
raydiak, Output on all releases: gist.github.com/16efbe386bbb47055c...f00bc17a5f 20:27
raydiak, Nothing to bisect!
guifa thanks himself for providing lots of test files for Fluent. Makes tracking down issues in the Intl reorganization *much* easier 20:30
codesections gfldex: wow, I'd never thought of implementing bare strings like that. I can't decide if I love it, hate it, or both! 20:32
(er, nvm actually, I read that too quickly/got over-excited – I thought you meant something more by "bare strings". Still very cool, but not quite as wild as I first thought) 20:38
guifa codesections: that said, it would be not too difficult to implement a php-esque DSL starter 20:39
imaging doing <html> and </html> as the equivalent of “ and ”
But that could also interpolate variables AND then generate a non-Str object as the result (instead of a Str, though presumably would have a .Stringy method) 20:40
codesections You mean as a slang? 20:42
guifa Yup 20:43
The only issue I've had so far with my slangs is enabling handing control back to the other (Quote / Core / Regex) languages. I *think* I can figure that out but since the project I've been doing it with will rely heavily on RakuAST, I've not looked too far into it 20:45
Xliff Hrm. Looking at Perl6::Grammar, I may have to revise my opinion on implementation. 20:47
Even knowing the rule name, I can't see where I'd add q:thru...
Doc_Holliwood is there any writing on why we use @a[*-1] instead of @a[-1] like Perl does? 20:48
$a[-1] rather 20:50
gfldex Doc_Holliwood: I'm not sure if it is written down already. It's quite easy tho. *-1 is a WhateverCode what is a Callable. 20:51
Doc_Holliwood i know
Xliff Doc_Holliwood: Better written now as @a.tail
Doc_Holliwood i just wonder what's wrong with negative indexes?
gfldex It's easy to get wrong by simply typos/thinkos. 20:52
my $index = 10; say @a[$index-1]; # and here you forget to type $index
The result is valid code that will may even work for a 1 element list. 20:53
Raku can complain with out-of-bounds.
Doc_Holliwood m: say (.[0], .[1..*-2].pick(*), .[*-1])[*;*].join with 'AbcdefgH'.comb 20:54
camelia AfcgebdH
Doc_Holliwood neat trick there
Geth doc/allomorph: aa95971fd2 | (Stoned Elipot)++ | doc/Type/Allomorph.pod6
Document Allomorph class

ref #3653 #3888 #3346
20:55
doc/allomorph: 6bada45c2d | (Stoned Elipot)++ | 4 files
Adapt allomorph classes documentation for Allomorph class

  - Condense the introduction and link to the Allomorph class documentation
  - Remove documentation for methods inherited from the Allomorph class
  - While here document the === operator for the allomorph classes
Doc_Holliwood m: (.[0], .[1..^*-1].pick(*), .[*-1]).flat.join with 'AbcdefgH'.comb
camelia ( no output )
Doc_Holliwood m: say (.[0], .[1..^*-1].pick(*), .[*-1]).flat.join with 'AbcdefgH'.comb
camelia AbcdgefH
codesections Xliff: I thought I remember .tail and .[*-1] having subtly different semantics -- but I can't remember how
Doc_Holliwood m: say (.[0], .[1..^*-1].pick(*).[*-1]).flat.join with 'AbcdefgH'.comb 20:56
camelia Ag
Doc_Holliwood m: say (.[0], .[1..^*-1].pick(*), .[*-1]).flat.join with 'AbcdefgH'.comb
camelia AdfgbecH
Geth doc: stoned++ created pull request #3893:
Document Allomorph class and adjust documentation for ComplexStr, IntStr, NumStr and RatStr classes
Doc_Holliwood like in these ranges, the whatever looks out of place imho
codesections (Maybe I'm just thinking of ) 20:58
m: my @a = (1, 2); dd @a[*-2 .. *]; dd @a.tail: 2 20:59
camelia (1, 2)
(1, 2).Seq
codesections but that doesn't apply to @a.tail()
gfldex Doc_Holliwood: there where a lot of things that looked out of place to me when I started with the language. Getting used to stuff helps. :) 20:59
Xliff Can you eval a QAST tree? 21:01
guifa can't seem to send regular messages for some reason
But /me work okay
er, maybe it's something weird in what I was typing out to Xliff
Anywyas, Xliff: I found where the quote modifiers are being done, but for the life of me I can't find the quote language's definition. In NQP it's defined directly in the grammar 21:02
Nevermind, I'm an idiot: github.com/rakudo/rakudo/blob/f83e....nqp#L5387 21:03
Xliff guifa: I'm ahead of you. I think it's here: github.com/rakudo/rakudo/blob/mast...r.nqp#L167 21:06
However I can't decipher that into a rule that parses the string "q:to"….
Trying to compile some test code into RakuAST and it is SLOW.
guifa I have to head out for the afternoon, but I'll take a look at it tommorrow and see if I can't figure out more (nuless you make some more progress) 21:07
Xliff No worries. Thanks for your help, guifa++ 21:10
Xliff Is CALLER:: documented? 23:04
codesections Just with docs.raku.org/language/packages#in..._(package) afaik 23:05
guifa Xliff: I'm going to guess you're running into one of the gotchas that I had with CALLER, perhaps. CALLER can only see stuff that's dynamic 23:42
Xliff Um. Hah. Not really. Sorry to give you that impression. 23:46
guifa Xliff: was worth a shot haha 23:49