š¦ 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. |
|||
00:05
librasteve joined
00:06
rindolf joined
00:10
librasteve left
00:31
arkiuat left
00:39
arkiuat joined
00:41
librasteve joined
00:47
librasteve left
00:56
rir left
00:58
librasteve joined
01:02
librasteve left
01:14
librasteve joined
01:19
librasteve left
01:23
Guest54 joined
01:29
kjp left
01:31
librasteve joined
01:36
librasteve left
01:39
kjp joined,
Guest54 left
01:40
kjp left
01:41
kjp joined
01:45
kylese left,
kylese joined
01:48
librasteve joined
01:53
librasteve left
02:05
librasteve joined
02:10
librasteve left
02:15
kylese left,
kylese joined
02:22
librasteve joined
03:45
kylese left
03:46
japhb left
03:48
kylese joined
|
|||
guifa | apogee_ntv++ | 03:52 | |
one thought for the interface | |||
Would there ever be a situation where you'd have two Term::Size objects and they would produce different values? | |||
I ask because if it's unlikely, you might consider a term approach, so I could do something akin to | 04:04 | ||
use Term::Size; my $area-in-pixels = term-width * term-cell-width + term-height * term-cell-width; (or whatever other naming convention you'd want to use) | 04:07 | ||
04:16
human-blip left
04:18
human-blip joined
|
|||
Voldenet | you could have two Term::Size objects: $previous-size and $current-size | 04:25 | |
04:30
librasteve_ left
04:32
librasteve left
04:33
librasteve joined
04:38
librasteve left
04:57
arkiuat left
05:05
librasteve joined
05:07
human-blip left
05:09
human-blip joined,
librasteve left
05:14
human-blip left,
librasteve joined
05:16
human-blip joined
05:19
librasteve left
05:22
Aedil joined
05:26
arkiuat joined
05:28
librasteve joined
05:31
arkiuat left
05:38
librasteve left
05:44
arkiuat joined
05:46
librasteve joined
05:48
arkiuat left
06:00
arkiuat joined
06:07
arkiuat left
06:21
arkiuat joined
06:25
librasteve left
06:26
arkiuat left
06:30
librasteve joined,
arkiuat joined
06:35
arkiuat left,
librasteve left
06:47
arkiuat joined
06:53
arkiuat left
06:54
librasteve joined
06:59
librasteve left
07:00
librasteve joined
07:01
Sgeo left
07:09
librasteve left
07:19
wayland joined
07:22
arkiuat joined
07:26
arkiuat left
07:37
librasteve joined
07:41
librasteve left
07:47
arkiuat joined
07:56
jjido joined
07:57
arkiuat left,
apac joined
08:00
librasteve joined
08:04
librasteve left
08:08
librasteve joined
08:09
arkiuat joined
08:13
human-blip left
08:14
apac left
08:15
human-blip joined
08:16
arkiuat left
08:17
jjido left
|
|||
disbot3 | <jubilatious1_98524> @apogee I can abstract the literal word "foo" into a variable, but that's about it: [0] > my $w = "foo"; my regex X { :i $w $ }; say "HELLO FOO" ~~ rx/ <X> /; ļ½¢FOOļ½£ X => ļ½¢FOOļ½£ | 08:25 | |
08:28
arkiuat joined
08:36
arkiuat left
09:05
arkiuat joined
09:08
librasteve left
09:12
arkiuat left
09:18
librasteve joined
09:27
arkiuat joined,
lichtkind joined,
rindolf left
09:32
arkiuat left
09:51
arkiuat joined
09:55
arkiuat left
10:21
librasteve left
10:24
arkiuat joined
|
|||
lizmat | .tell librasteve plainvanillaweb.com/index.html perhaps of interest? | 10:29 | |
tellable6 | lizmat, I'll pass your message to librasteve_ | ||
10:30
arkiuat left
|
|||
apogee_ntv | guifa: As Voldenet said, you might want to populate a new one on sigwinch and compare | 10:31 | |
10:31
librasteve joined
10:36
librasteve left
10:45
librasteve joined
|
|||
apogee_ntv | My main use case is getting cell width/height in px to render images at a roughly correct aspect ratio in Kitty/WezTerm | 10:49 | |
10:49
librasteve left
10:50
arkiuat joined
|
|||
SmokeMachine | Sorry for insisting on that, but about github.com/rakudo/rakudo/issues/5929 I would like to know if thatās confusing to everyone and if it would wanted to be changed⦠that was I can start investigating on how to do that to create a PR for that⦠| 10:54 | |
10:54
arkiuat left
|
|||
SmokeMachine | But if people donāt think it should change, I shouldnāt start investigating⦠| 10:55 | |
11:05
librasteve joined
11:16
librasteve left
11:24
arkiuat joined
11:29
librasteve joined
11:30
arkiuat left
11:35
librasteve left
11:41
grondilu left
11:52
jjido joined,
arkiuat joined
11:57
arkiuat left
|
|||
apogee_ntv | @jubilatious1_98524 I found a lib that makes regexs from perl regex's, RegexUtils - github.com/m-doughty/LLM-Character...ng.rakumod | 12:02 | |
12:03
librasteve joined
12:21
librasteve left
12:25
arkiuat joined
|
|||
arkiuat | SmokeMachine, I don't think you have anything to apologize for. I haven't commented because the issue is kind of over my head | 12:30 | |
12:33
jjido left
|
|||
apogee_ntv | Same, I still feel a bit like a noob trying to comprehend it. | 13:03 | |
SmokeMachine | My point there is about this: docs.raku.org/language/signatures#..._arguments . The docs says it uses the attribute to destruct the values. But only my tests I saw that If I declare an attribute and a method with the same name, it will use the value returned by the method. But if I do not declare the attribute, it will not use the method⦠I think that instead of using the attribute, it should ignores if there | 13:56 | |
are attributes and just use methods⦠I think that would be simpler and more useful⦠| |||
m: class A {$.a = 42; method a { 13 }; sub (A (:$a)) { say $a }; a A.new | 13:59 | ||
camelia | ===SORRY!=== Error while compiling <tmp> Variable $.a used where no 'self' is available at <tmp>:1 ------> class A {$.a<HERE> = 42; method a { 13 }; sub (A (:$a)) { expecting any of: term |
||
SmokeMachine | m: class A { has $.a = 42; method a { 13 }; sub (A (:$a)) { say $a }; a A.new | 14:00 | |
camelia | ===SORRY!=== Error while compiling <tmp> Missing block at <tmp>:1 ------> 13 }; sub (A (:$a)) { say $a }; a A.new<HERE><EOL> expecting any of: postfix statement end statement modifier statement modi⦠|
||
SmokeMachine | m: class A { has $.a = 42; method a { 13 } }; sub (A (:$a)) { say $a }; a A.new | ||
camelia | ===SORRY!=== Error while compiling <tmp> Undeclared routine: a used at line 1 |
||
SmokeMachine | m: class A { has $.a = 42; method a { 13 } }; sub a(A (:$a)) { say $a }; a A.new | 14:01 | |
camelia | 13 | ||
SmokeMachine | m: class A { has $!a = 42; method a { 13 } }; sub a(A (:$a)) { say $a }; a A.new | ||
camelia | (Any) | ||
SmokeMachine | m: class A { method a { 13 } }; sub a(A (:$a)) { say $a }; a A.new | ||
camelia | (Any) | ||
SmokeMachine | m: class A { has $.a = 42 }; sub a(A (:$a)) { say $a }; a A.new | ||
camelia | 42 | ||
SmokeMachine | m: class A { has $!a = 42 }; sub a(A (:$a)) { say $a }; a A.new | 14:02 | |
camelia | (Any) | ||
SmokeMachine | arkiuat, apogee_ntv: š | ||
apogee_ntv | Is that not the expected behavior since $.a is public and $!a is private? | 14:03 | |
Since a (sub) is outside A (class) it should not be able to directly access $!a? or am I missing something? | 14:04 | ||
Oh hm, but it's ignoring the method... that seems wrong? idk | 14:05 | ||
14:06
arkiuat left
|
|||
SmokeMachine | On doc, it says it uses attributes and not methods⦠but only that case, the first example (that worked), it should print the attribute value (42) instead of the method one (13) | 14:07 | |
I just thought about a problem on my suggestion⦠whe then to have more methods than attributes (at least I suppose) and we would need to list all methods (or use a |) | 14:15 | ||
m: class A { has $.a = 1; has $.b = 2 }; sub a(A (:$a)) { say $a }; a A.new | |||
camelia | Unexpected named argument 'b' passed in sub-signature in sub a at <tmp> line 1 in block <unit> at <tmp> line 1 |
||
14:18
arkiuat joined
14:22
arkiuat left
14:34
Sgeo joined
14:52
arkiuat joined
14:59
arkiuat left
15:02
arkiuat joined
15:06
arkiuat left
15:23
human-blip left
15:24
human-blip joined
15:34
arkiuat joined
15:39
arkiuat left
15:42
abraxxa-home joined
15:46
abraxxa-home left
15:47
abraxxa-home joined
15:48
arkiuat joined
15:53
arkiuat left
16:05
arkiuat joined
16:11
arkiuat left
16:38
arkiuat joined
16:43
arkiuat left
17:05
arkiuat joined
17:10
melezhik joined
|
|||
melezhik | o/ | 17:10 | |
17:10
arkiuat left
|
|||
melezhik | Got an interesting case for Sparrow in one of SO questions - superuser.com/a/1910086/2953966 | 17:10 | |
17:10
human-blip left
|
|||
melezhik | Especially genetic form to print N preceding lines before pattern | 17:11 | |
generic | 17:12 | ||
17:12
human-blip joined
17:38
arkiuat joined
|
|||
SmokeMachine | glot.io/snippets/h94f2n4544 | 17:40 | |
17:43
arkiuat left
17:50
arkiuat joined
|
|||
disbot3 | <librasteve> lizmat: thanks for sharing plainvanilla, I think this chatgpt.com/share/68714ec8-8c64-80...ec15b77373 ... TLDR this shit needs a lot of baggage and has some question marks ... harc stack needs just htmx and picocss - all the rest is server side in raku | 17:53 | |
17:55
arkiuat left
18:00
ACfromTX left
|
|||
lizmat | fwiw, I like the idea of not having to depend on frameworks. | 18:04 | |
18:05
arkiuat joined
|
|||
disbot3 | <librasteve> Air::Base is a base library of custom components that use Air::Component (which is built on SmokeMachine excellent Cromponent module which has a strong central concept which I have butchered a bit). It is possible to imagine Cromponent getting support for Web Component ... but that raises some issues around component build phase and would need raku to JS to load the Shadow DOM, a raku ES Module maybe and then that would kill | 18:05 | |
all the HTMX I suppose. | |||
SmokeMachine | librasteve: talking about Cromponent, today, or max this weekend, Iām going to release a new version of it, supporting cookies and websocket⦠and also a new post on my blog about that⦠| 18:09 | |
tellable6 | SmokeMachine, I'll pass your message to librasteve_ | ||
disbot3 | <librasteve> I would love to see Cromponent take on this challenge and the prebuilt repository Cro template regular Cromponent is a good candidate for this. I am keen to try and maintain mutual consumption of Cromponent & Air::Component s - ie. they can call each other bidirectionally which SM and I have already checked (needs a rest test). HARC has a more scripty feel | 18:10 | |
<librasteve> SmokeMachine: tx for the update .... dont for get to come here and go weekly: url to share | 18:11 | ||
18:21
ACfromTX joined
18:25
japhb joined
|
|||
SmokeMachine | librasteve: what do you mean by build phase, etc? | 18:30 | |
tellable6 | SmokeMachine, I'll pass your message to librasteve_ | ||
SmokeMachine | We can have stuff running on js without a building phase⦠an example would be: github.com/FCO/MemoizedDOM | 18:33 | |
disbot3 | <librasteve> I mean that cro templates are added to a repository that is built on run cro | 18:44 | |
<librasteve> ah yes MemoizedDOM - that would seem a good building block for Cromponents to implement Web Components ala ES module? | 18:45 | ||
<librasteve> SmokeMachine: sorry I am giving you the CTO job to build the tricksy new technologies - can't think of anyone better qualified! | 18:48 | ||
SmokeMachine | librasteve: but Cromponent works already with templates?! If Iām not misremembering, It adds a method on your component class with your template already compiled making you own class itās ārepositoryā and when using it as a sub/macro it works exactly the same me way Cro template modules are suggested to be created⦠| 18:53 | |
tellable6 | SmokeMachine, I'll pass your message to librasteve_ | ||
SmokeMachine | github.com/FCO/Cromponent/blob/mai...akumod#L23 | 18:54 | |
So, what I mean is that the templates on Cromponent are compiled on role composition time, so compile time⦠| 18:55 | ||
Unless, of course, Iām completely wrong⦠| 18:56 | ||
One thing I think would help using Cromponents would be a way to not need to use &HTML when using a cromponent object⦠| 19:03 | ||
19:20
melezhik left
20:34
jjido joined
20:39
kuzdra left
|
|||
disbot3 | <librasteve> SmokeMachine: that's what I said - when you go cro run, the Cro templates are compiled (or maybe linked if they were alerady precompiled), no disagreements there | 21:10 | |
<librasteve> HARC stack is built on the concept that some web applications benefit from (small pieces of already compiled code) that run at errr run time - so &HTML is crucial to the HARC model - my sincere hope is that we can continue with this "two ways to do it" with Air::Components continuing to use Cromponent latest build and with cross callable components in both directions - do you agree? | 21:13 | ||
<librasteve> btw I really enjoy collaborating with you - the MOP Meister - and I get blown away every time with you insights into the optimum code shape | 21:17 | ||
<librasteve> aside - that level of music can only be played on raku ... the stradivarius of languages | 21:19 | ||
<librasteve> sorry &afk | |||
21:34
Aedil left
|
|||
arkiuat | If I define an attribute in a role, is it possible to apply different constraints to that attribute in the different classes that use that role? | 21:54 | |
Usually you'd apply the constraint when declaring the attribute with "has", but this can happen only once, either in the role or in the class. I need for methods in both the role and the class to operate on the attribute, but the constraints that should apply differ in each of the instantiating classes. | 21:55 | ||
disbot3 | <librasteve> you mean like has Int $i | ||
arkiuat | role A { has Int $.i }; class B does A { has Int $.i where { 1 <= $_ <= 100 } } | ||
like that, but camelia would spit it out because "has Int $.i" is only allowed one time | 21:56 | ||
21:56
rir joined
|
|||
arkiuat | librasteve, yes exactly | 21:58 | |
disbot3 | <librasteve> well $. is a bit of a toy to "do Python in raku" by autoboilerplate getter/setter methods and FETCH/STORE | ||
arkiuat | I think the problem would be the same if I declared it as $!i no? | 21:59 | |
disbot3 | <librasteve> you will need to change to 2nd gear and use private attrs and write your own setter/getter methods | ||
arkiuat | oh really? hrm. | ||
disbot3 | <librasteve> its not hard | 22:00 | |
arkiuat | no, it's starting to make sense already. If the attr is private, I can declare it in both the role and the class, right? | ||
disbot3 | <librasteve> yeah and then you can use multi s and raku's awesome type graph and interfaces | 22:03 | |
guifa | correct: each can only access their own private attr and have no knowledge of the other's (unless they `trust` each other) | ||
arkiuat | thanks! | 22:05 | |
guifa, what is this 'trust' of which you speak? Because I think I'm going to need them to trust one another (it's all one module) | |||
disbot3 | <librasteve> docs.raku.org/language/typesystem#trait_trusts | 22:06 | |
arkiuat | librasteve++ | 22:07 | |
guifa I wonder if augment could make some of this easier lol, I've always hated the need for forward declaration but totally understand why it's needed | 22:08 | ||
m: use MONKEY-TYPING; class A { has $!foo; method !foo { return-rw $!foo }; method raku { "A.new(foo => $!foo)" } }; class B { has A $.a .= new; method change { $!a!A::foo = 42; self } }; augment class A { trusts B }; say B.new.change; | 22:10 | ||
camelia | ===SORRY!=== Error while compiling <tmp> Cannot call private method 'foo' on package 'A' because it does not trust the 'B' package. at <tmp>:1 ------> A $.a .= new; method change { $!a!A::foo<HERE> = 42; self } }; augment class A { trust ⦠|
||
guifa | ^^ I feel like this should work | ||
ah but it's being done at compile time that's the issue | |||
not runtime | |||
disbot3 | <librasteve> so 1st gear is Python mode, 2nd gear is en.wikipedia.org/wiki/SOLID and 99th gear is MOP | 22:12 | |
guifa | all this said | 22:13 | |
if you're thinking you need `trusts`, I'd strongly encourage a rethink in design | 22:14 | ||
arkiuat | guifa, yes, I was just starting to think about defining a type and some subtypes | ||
disbot3 | <librasteve> docs.raku.org/type/Numeric#typegraphrelations | 22:15 | |
arkiuat | that way the constraints can be tied to the subtype definitions instead of the attribute declarations | 22:16 | |
jdv | lizmat: did you get around to getting whateverable "published"? | 22:17 | |
disbot3 | <librasteve> yeah you can use subsets and so on with multimethods | ||
<librasteve> and where clauses | |||
SmokeMachine | weekly: dev.to/fco/cromponent-new-features-3bhf | 22:19 | |
notable6 | SmokeMachine, Noted! (weekly) | ||
SmokeMachine | librastive: by &HTML I meant <&HTML($cromponent)> | 22:25 | |
22:29
abraxxa-home left
|
|||
lizmat | jdv: arg, no... will look at it tomorrow | 22:38 | |
guifa | lizmat: I *think* videos from TPRC are finally formally posted | 22:39 | |
at least I saw a post saying they're going up | |||
so maybe the Raku talks will be up by Monday | |||
lizmat | guifa: please post a weekly: with the link, so librasteve can pick it up for the weekly | 22:40 | |
guifa | lizmat++ librasteve++ will do once I get a link | ||
jdv | you asked me to ask. thanks. | ||
22:41
arkiuat left
|
|||
lizmat | jdv++ | 22:45 | |
afk& | |||
SmokeMachine | m: role R[::T = Any] { has T $.a }; class :: does R[Int] {}.new.a.^name.say; class :: does R[Str] {}.new.a.^name.say | 22:49 | |
camelia | Int Str |
||
SmokeMachine | .tell arkiuat would something like this do what you wanted? `role R[::T = Any] { has T $.a }; class :: does R[Int] {}.new.a.^name.say; class :: does R[Str] {}.new.a.^name.say` | 22:50 | |
tellable6 | SmokeMachine, I'll pass your message to arkiuat | ||
22:51
arkiuat joined
|
|||
SmokeMachine | m: role R[::T = Any] { has T $.a }; class :: does R[Int] {}.new.a.^name.say; class :: does R[Str] {}.new.a.^name.say; class :: does R {}.new.a.^name.say; | 22:53 | |
camelia | Int Str Any |
||
arkiuat | SmokeMachine, I don't think so? B and C do role A; there's an attribute in A that should be constrained differently in B than in C. I think I can do what I need with type definitions, and apply the constraints there. | 23:00 | |
tellable6 | 2025-07-11T22:50:54Z #raku <SmokeMachine> arkiuat would something like this do what you wanted? `role R[::T = Any] { has T $.a }; class :: does R[Int] {}.new.a.^name.say; class :: does R[Str] {}.new.a.^name.say` | ||
arkiuat | it's probably not going to be able to raise an error in every single call where I might have an out-of-constraint argument, but in enough calls to be much better than no checking at all | 23:02 | |
SmokeMachine | On my example R is a role that has an attribute an and Iām creating 2 classes that uses R and where a is Int and on the other itās Str⦠| 23:03 | |
arkiuat | oh i see, that makes sense! | ||
disbot3 | <librasteve> by &HTML I meant <&HTML($cromponent)> too tired ... will look again tomorrow | 23:04 | |
arkiuat | I haven't ever worked with parametrized roles yet, is that what that is? | ||
The documentation for parameterized roles is awfully terse. | 23:05 | ||
Voldenet | yes, however parametrized roles are tested in roast | 23:06 | |
github.com/Raku/roast/blob/master/...ype.t#L109 | |||
there's more tests on parametrized roles and it's very informative | 23:07 | ||
arkiuat | Voldenet++ | 23:08 | |
23:09
lichtkind left
|
|||
arkiuat | SmokeMachine, I'm going to try it your way. Great opportunity for me to learn how to use parameterized roles. | 23:10 | |
the roast tests are very helpful | 23:14 | ||
(and even better is the idea that if I can't figure out the doco, I should look at the tests!) | |||
SmokeMachine | m: role R[::T = Any] { has T $.a }; class A does R[Int] {}; class B does R[Str] {}; say A.new.a; B.new.a | 23:22 | |
camelia | (Int) | ||
SmokeMachine | m: role R[::T = Any] { has T $.a }; class A does R[Int] {}; class B does R[Str] {}; say A.new.a; say B.new.a | 23:24 | |
camelia | (Int) (Str) |
||
arkiuat | yep, that's what I'm talking about | 23:28 | |
SmokeMachine | arkiuat: The type T can also be used on methods | 23:31 | |
arkiuat | and the roasts tests make it look as if I can just do role R[::T] then class A does role R[Int where { 0 <= $_ <= 99 }] | 23:37 | |
I can just put the constraints directly into the supplied parameter | |||
SmokeMachine++ | |||
or maybe not. The roast test definitely show type constraints there, but not where-clauses | 23:41 | ||
SmokeMachine | The constraint must be on the role definition⦠| 23:43 | |
arkiuat | right, I see that now. | 23:44 | |
that just means I'll be going back to my original idea of defining a tiny type hierarchy and impose the constraints on the type definitions, then define the classes as filling in the parameter with those types | 23:53 | ||
that idea fits perfectly with role parameterization | 23:54 |