🦋 Welcome to Raku! raku.org/ | evalbot usage: 'p6: say 3;' or /msg camelia p6: ... | irclog: colabti.org/irclogger/irclogger_log/raku Set by ChanServ on 14 October 2019. |
|||
raydiak | codesections: if you have no objections, I'm going to report your conditional state in a loop bug which we discussed last week. I messed with it a bit, came up with some other related failures, and found one open and two closed issues which are related but neither appreciate the full array of failure cases, nor have any currenlty relevant example code | 00:48 | |
00:49
evalable6 left,
linkable6 left
00:51
evalable6 joined,
linkable6 joined
|
|||
moon-child | ix.io/2W7Q/perl6 how to make a JIT in raku | 01:06 | |
01:13
kvw_5 joined
01:16
japhb joined
01:37
abraxxa left
|
|||
guifa | moon-child: so my lower level stuff is a bit weak but lemme see if I’m getting that right | 01:38 | |
the $a[…] are just the series of opcodes yeah? | 01:39 | ||
codesections | raydiak: not only would I not mind, I'd appreciate it! I have writing that up as a task on my to-do list (well, actually in a todo comment in the related code), and getting to check it off without having to do anything is a nice surprise :) | ||
01:39
abraxxa joined
|
|||
moon-child | guifa: right | 01:41 | |
0xb8 is mov eax | 01:42 | ||
0x15 00 00 00 is the little-endian representation of 21 | |||
and 0xc3 is ret | |||
guifa | Neat. The only machine code stuff I’ve really done was like any CS student — good old pep | ||
moon-child | pep? | 01:43 | |
guifa | computersystemsbook.com/5th-edition/pep9/ <— fairly common textbook in CS departments, has its own CPU simulator | 01:44 | |
moon-child | ah, cool | ||
I know mips gets used a lot too...only ever bothered to properly learn x86, though | |||
guifa is going back for an MS in CS because he’s a glutton for punishment haha | 01:45 | ||
but I feel like doing some of this stuff at the lower level I might be able to help contribute outside of just making modules ha | |||
moon-child thinking about going to uni | 01:46 | ||
still not entirely sure what I want to do though | |||
guifa | I get go for free, so it’s a bit of a no-brainer for me | ||
but still, just finished up a PhD so haha | 01:47 | ||
codesections | yeah, that would make it a lot easier. For those of us without that as a job perk, my impression is that CS MS degrees are pretty pricey -- is that right? | 01:48 | |
guifa | It really depends. Stateside, at least, if you can go in state it’s probably not terrible | 01:49 | |
codesections | In contrast to PhDs, where the (monetary) cost is probably the lowest barrier | ||
guifa | Although if you go fulltime, you should be getting an assistanceship, but that kind of negates the “do it while working $job” bit | 01:50 | |
codesections | ha, yeah | ||
guifa | GaTech has an MS in CS that’s fully online for $7k | ||
codesections | hmm, interesting. | 01:51 | |
guifa | And of course, GaTech is not a podunk school | ||
codesections | indeed | ||
moon-child | guifa: wait, you have a phd and you're going back for an ms? | 01:52 | |
why? | |||
guifa | moon-child: different fields. | ||
moon-child | ahh | ||
what's the phd in? | |||
guifa | Spanish & Portuguese | ||
moon-child | oh wow, cool | 01:53 | |
guifa | my dissertation had some uuuuuuuuuuuuuuugly Raku code | ||
moon-child | haha | ||
guifa | I’m hoping this summer to clean it up | ||
codesections | yeah, if I were to get a MS, I'd also be taking it after a terminal degree. Not a PhD, but we still got to wear the octagonal hats | ||
guifa ’s university doesn’t do a special cap for PhD :-( | 01:54 | ||
moon-child | :/ | ||
codesections | that _is_ :-( | 01:55 | |
guifa | Oh don’t even get me started | ||
01:56
webstrand left
|
|||
codesections | do you own a set of robes now, though? | 01:56 | |
guifa | Yeah. And after I ordered it my dad told me he actually had my grandpa’s old (high quality) ones in storage | 01:57 | |
I was like, thanks dad | |||
codesections | ha | ||
01:57
webstrand joined
|
|||
guifa | But yeah, hopefully with the MS I can have better chances at attracting some grant money for my research, but also really would like to be able to contribute more to Raku | 01:58 | |
01:58
MasterDuke left
01:59
Woodi joined
|
|||
guifa | (especially for binary grammars…. those are basically beginning to be mega optimized) | 02:01 | |
02:02
Voldenet joined,
Voldenet left,
Voldenet joined
|
|||
moon-child | binary grammars? | 02:03 | |
codesections | do you have a sense of what places like that would make of my (total lack of) formal CS background? I'm looking at the GaTech site (since you mentioned it) | ||
and they say "Having a strong undergraduate background in computer science, including C programming, is highly recommended for applicants" | |||
guifa | codesections: they require letters of rec from people in the field. GaTech’s at that level where they can really demand it =/ | 02:04 | |
codesections | somehow, I don't think a Philosophy BA or a JD would really help all that much :D | ||
guifa | At my university, we have three leveling courses you have to take (and potentially three math courses as well, depending on your undergraduat ecourses) | ||
codesections | do y'all have a distance program? There's a non-zero chance that I'd be able to count as an in-state resident there within the next couple of years | 02:07 | |
guifa | in TN? And yeah, it’s available entirely online. | 02:08 | |
The one nice thing, I suppose, about our program is we have strong links with Oak Ridge which … | 02:10 | ||
en.wikipedia.org/wiki/Summit_(supercomputer) | |||
codesections | it's possible. NC is more likely, but somewhere in that general region is pretty likely | ||
guifa | I would imagine at this point most major and regional state schools have them all online. I’d be *extremely* surprised if UNCH doesn’t have one | 02:11 | |
err UNCCH | |||
codesections | yeah. I'm actually in a college town right now, and my plan had been to try to audit a class in person while I was here. But that obviously didn't happen in 2020 | 02:13 | |
guifa | moon-child: re binary grammar, I proposed two new grammar type systems, one would work on binary data (instead of strings) and the other on object sequences. Most of the work I’ve done is towards the former. Once RakuAST comes out I’ll go back to work on it to try to get it to a real usable state | 02:20 | |
moon-child | 'object sequences' interesting | ||
so something you would be able to use to make a general-purpose state machine? | 02:21 | ||
guifa | Exactly. I came towards it because of some work I was doing on NLP | ||
being able to represent, say [noun, singular] [adjective, neuter AND ends in -o] | 02:22 | ||
or perhaps | 02:23 | ||
more concretely for what I was helping a friend search for: [noun, singular, feminine] .*? [verb, copular, singular] .*? [adjective, neuter AND ends in -o] | |||
codesections | is this for nlp without machine learning? | 02:25 | |
raydiak | . | 02:26 | |
oops | |||
moon-child | .. | 02:27 | |
codesections | ... | ||
raydiak | codesections: cool, consider it done. I'll have it reported within the next 24 hours | ||
very funny y'all :) | 02:28 | ||
codesections | raydiak++ | ||
moon-child | guifa: cool! | ||
also reminds me of j, which has a state machine builtin www.jsoftware.com/help/dictionary/d332.htm | |||
raydiak | codesections: happy to help. I miss being more active here, so thanks for letting me do at least one little thing | 02:30 | |
codesections | moon-child: wow, _that_ is something I hadn't heard of before. (And might be the first thing I've heard about J that would make even a modern APL programmer jealous!) | 02:32 | |
moon-child | honestly I think apl and j are mostly at parity at this point. Dyalog stole most of j's innovations (as well as the primary implementor...), doing some of them better (like under), but j still seems to have the better ecosystem | 02:34 | |
and it's oss | 02:35 | ||
codesections | yeah, that's the big hangup with Dyalog for sure | ||
not _just_ the license part of it, but also the whole ecosystem/mindset that goes with it. E.g., their docs talk a lot about generating output into Excel without saying anything about printing to stdout | 02:37 | ||
moon-child | yeah | ||
I think the next version is _finally_ supposed to have support for running scripts | |||
guifa | codesections: yeah, mainly corpus searching / processing | 02:43 | |
Asturian has very little work done so far, so I’m going to basically build my NLP chops up with it, beginning with the most important (and easiest) tools and moving from there | 02:44 | ||
02:51
_jrjsmrtn joined
|
|||
codesections | very cool/interesting | 02:57 | |
03:04
parv left
03:38
abraxxa left
03:40
abraxxa joined
03:42
mowcat joined,
neshpion left
04:38
Xliff left
04:46
mowcat left
05:09
aindilis` joined
05:10
aindilis` left
05:15
aluaces joined,
wamba joined
05:20
jmerelo joined
|
|||
jmerelo | m: my \ñ = 3; say ñ ≤ | 05:21 | |
camelia | 5===SORRY!5=== Error while compiling <tmp> Missing required term after infix at <tmp>:1 ------> 3my \ñ = 3; say ñ ≤7⏏5<EOL> expecting any of: prefix term |
||
jmerelo | 5️⃣ | ||
m: my \ñ = 3; say ñ ≤ 5️⃣ | 05:22 | ||
camelia | 5===SORRY!5=== Error while compiling <tmp> '5️⃣' is not a valid number at <tmp>:1 ------> 3my \ñ = 3; say ñ ≤ 5️⃣7⏏5<EOL> |
||
jmerelo | releasable6: status | 05:33 | |
releasable6 | jmerelo, Next release in ≈2 days and ≈13 hours. 2 blockers. 0 out of 175 commits logged (⚠ 1 warnings) | ||
jmerelo, Details: gist.github.com/b743c098c0d3cb4bf2...85da37e546 | |||
05:37
frost-lab joined
06:07
domidumont joined
06:10
Xliff joined
06:28
jmcgnh left
06:34
jmcgnh joined
06:38
asymptotically joined
06:42
parabolize left
06:45
abraxxa left
06:47
abraxxa joined
06:57
asymptotically left
07:00
MasterDuke joined
07:18
brtastic joined
07:21
natrys joined
07:27
pecastro joined
07:29
brtastic1 joined,
brtastic left,
brtastic1 is now known as brtastic
|
|||
raydiak | m: do say state $ = "foo" | 07:31 | |
camelia | (Any) | ||
raydiak | bisectable6: do say state $ = "foo" | ||
bisectable6 | raydiak, Will bisect the whole range automagically because no endpoints were provided, hang tight | ||
raydiak, ¦6c (52 commits): «(Any)» | |||
raydiak, Nothing to bisect! | |||
07:32
aborazmeh joined
07:36
pmurias joined
|
|||
pmurias | codesections: re devirtualisation Rakudo uses method caches, so most of the time it is not doing multidispatch but just a lookup in a method hash (like js does) | 07:40 | |
07:42
Sgeo left
|
|||
pmurias | codesections: my line of though is that Raku is a lot closer to JS than to C++ (which seems to be the main webassembly target) in terms of what the JIT needs to optimize | 07:42 | |
07:47
aborazmeh left
07:50
dakkar joined,
abraxxa left
07:52
abraxxa joined
08:10
softmoth left
08:29
eseyman joined
08:41
asymptotically joined
09:08
ufobat joined
09:10
Kaeipi joined
09:21
PimDaniel joined
|
|||
PimDaniel | \o | 09:21 | |
tellable6 | 2021-04-13T20:45:12Z #raku <El_Che> PimDaniel: rakudo-pkg can be installed next to rakudo supplied by the OS if you want to | ||
PimDaniel | .tell El_Che I could install rakudo-pkg and i do not have yet any problem. | 09:23 | |
tellable6 | PimDaniel, I'll pass your message to El_Che | ||
PimDaniel | .tell El_Che Thank You for your help. | ||
tellable6 | PimDaniel, I'll pass your message to El_Che | ||
10:01
PimDaniel left
10:06
PimDaniel joined
|
|||
PimDaniel | .tell lizmat The piece of my code that rised the crash and the error : pastebin.com/LLuC6XPE | 10:07 | |
tellable6 | PimDaniel, I'll pass your message to lizmat | ||
10:08
pmurias left,
MasterDuke left
10:09
MasterDuke joined,
Black_Ribbon left
|
|||
PimDaniel | .tell lizmat golf tentative did not reproduce but look at the comments at the end of the text : pastebin.com/8a1vCuuz | 10:09 | |
tellable6 | PimDaniel, I'll pass your message to lizmat | ||
lizmat | PimDaniel: discussed this with nwc10 the other day, and have come to the conclusion that what you're doing is "naughty" :-) | ||
but it can be easily fixed by: | |||
for %vmis_pts.keys.eager -> $k | 10:10 | ||
PimDaniel | lizmat ok i know i'm a naughty boy. | ||
lizmat | problem is that the hash key iterator does not handle keys being added while it is not exhausted yet | ||
El_Che | ok, now itś getting weird :) | 10:11 | |
tellable6 | 2021-04-15T09:23:10Z #raku <PimDaniel> El_Che I could install rakudo-pkg and i do not have yet any problem. | ||
2021-04-15T09:23:44Z #raku <PimDaniel> El_Che Thank You for your help. | |||
lizmat | it doesn't go wrong always | ||
El_Che | lizmat: I see you went the Parrot memory lane with chromatic on reddit :) | ||
lizmat | wasn't that HN ? | ||
El_Che | possible | ||
PimDaniel | lizmat i knew the code was naughty. I know it is a mistake and i'll not keep this code. But it NOT the subject. | 10:12 | |
El_Che | weird how raku was mentioned while it's not really related to what happened on perl | ||
lizmat | PimDaniel: what is the subject then ? | 10:13 | |
PimDaniel | The subject is it normal that it leads to a crash? I thought that's what we talked about. | 10:14 | |
lizmat | being naughty that way *can* lead to a crash | ||
it all depends on how the hash is randomized for that particular run | 10:15 | ||
El_Che | that sounds bad | ||
PimDaniel: make sure to document it if you keep it | |||
lizmat | 6guts.wordpress.com/2021/04/15/rak...ispatcher/ | ||
El_Che | it sound difficult to debug if you don't know about it | ||
PimDaniel | And nauthty code is sometimes good to discover bugs. | 10:16 | |
lizmat | Well, I've been considering making .keys and friends eager by default | ||
but that can have some serious consequences on performance | |||
PimDaniel | Once again: i dit yet explain that it was temporary not optimized code just to make tests. | 10:19 | |
And the self insertion was in fact a mistake. | |||
You should respect Naughty programmers and bad programmers like me because they can find bugs. | 10:21 | ||
10:21
PimDaniel left
10:27
ghisl1m joined
10:29
ghisl1m left
10:35
wamba left
10:36
wamba joined
11:03
rindolf joined
11:48
rjbs joined
12:01
sam8 joined
|
|||
sam8 | Hey | 12:01 | |
12:01
sam8 left
12:07
abraxxa left
12:10
jmerelo left,
abraxxa joined
12:27
ggoebel joined
12:30
ggoebel_ joined,
ggoebel left
|
|||
ggoebel_ | .tell guifa there is another option at Georgia Tech for old hackers... the university system of georgia's board of regents has a 62 and older program which waives tuition and fees for georgia residents. | 12:34 | |
tellable6 | ggoebel_, I'll pass your message to guifa | ||
ggoebel_ | admission.gatech.edu/non-degree/62...er-program | 12:35 | |
demostanis[m] | Saying this here as I can't write in #moarvm, it looks like MoarVM/libatomic_ops is outdated, it would be great to either use the original repo or to merge some PRs (such as github.com/ivmai/libatomic_ops/pull/32) | 12:37 | |
m6locks | ggoebel_: very nice | ||
12:39
abraxxa left
|
|||
MasterDuke | demostanis[m]: just took a look at their changelog, looks like 7.6.12 is not released yet (any idea when it will be?) and we're only at 7.6.2 | 12:41 | |
i guess there's no reason we couldn't try going to 7.6.10 now, we update libuv pretty regularly | 12:42 | ||
demostanis[m]: why can't you write in #moarvm? | 12:44 | ||
12:44
abraxxa joined
|
|||
demostanis[m] | You do not have permission to post to this room. I'm using matrix. | 12:45 | |
12:56
DiffieHellman joined
12:58
tejr joined
13:27
frost-lab left
|
|||
jdv79 | parrot stuff - blast from the past wow. dan & leo. was a fun read - hn back and forth on it | 13:33 | |
13:49
mahafyi joined
13:59
gordonfish joined
14:09
Sgeo joined
14:33
ufobat_ joined
14:37
ufobat left
14:38
wamba left
14:44
abraxxa left
14:46
abraxxa joined
14:51
ggoebel_ left
14:56
wamba joined
15:06
parabolize joined
15:07
ggoebel_ joined
15:27
clarjon1 joined
|
|||
guifa | ggoebel_ indeed, that’s actually an option at most places. But… I’m only about half way there in age ;-) | 15:33 | |
tellable6 | 2021-04-15T12:34:35Z #raku <ggoebel_> guifa there is another option at Georgia Tech for old hackers... the university system of georgia's board of regents has a 62 and older program which waives tuition and fees for georgia residents. | ||
15:44
mowcat joined
15:55
abraxxa left
15:56
abraxxa joined
16:10
kleb joined
16:28
neshpion joined
16:31
dakkar left
16:48
mowotter joined
16:50
mowcat left,
mahafyi left
16:51
dataangel left,
dataange` joined
17:11
Kaeipi left
17:12
Sgeo_ joined
17:14
Sgeo left
17:18
aindilis joined
17:22
domidumont left
17:26
Kaiepi joined
17:27
justsomeguy joined,
justsomeguy left
17:47
parv joined
|
|||
demostanis[m] | Can `zef` create a META6.json file for me? | 17:48 | |
17:51
brtastic left
|
|||
demostanis[m] | I hate writing JSON | 17:52 | |
17:55
abraxxa left,
Sgeo_ left
17:56
Sgeo joined
17:57
abraxxa joined
|
|||
raydiak | demostanis[m]: zef doesn't, but there is a META6 module for working with meta files from raku, and META6::bin for doing it from the command line, which can also provide a complete skeleton for a new module | 18:00 | |
18:00
abraxxa left
18:01
|oLa| joined
18:02
abraxxa joined
18:08
|oLa| left
|
|||
demostanis[m] | Thanks for the answer. Why doesn't zef do this? | 18:09 | |
raydiak | you're welcome. zef is just a module installer, creating/editing modules and their meta files is outside of its intended scope | 18:10 | |
there is a more recent tool called fez, intended to facilitate uploading to the ecosystem, but I don't know if it provides the kind of functionality that META6/META6::bin does. I haven't tried it, personally | 18:12 | ||
demostanis[m] | it would be much helpful. Most language package installers do this, such as npm creating a package.json | 18:13 | |
META6::bin seems to have lots of bugs, such as when credentials.username is unset in .gitconfig or when some directory I never heaard about doesn't exist | 18:16 | ||
codesections | we could also do it with a zef plugin -- which is similar to how some languages handle it (e.g., for rust, `cargo add` uses a cargo plugin) | ||
demostanis[m] | does one already exist? | ||
codesections | not that I know of. But adapting mi6 doesn't seem like a huge lift | 18:18 | |
(in theory) | |||
demostanis[m] < matrix.org/_matrix/media/r0/downlo...essage.txt > | |||
18:19
natrys left
|
|||
raydiak | in general, much of the raku ecosystem follows a linux-like philosophy of having a specialized tool for a specific task, rather than monolithic solutions to large problem spaces. many other languages (including perl's cpan and cpanm, last time I used it) are also this way. that said, I'm sure any contributions you care to make in pursuit of your prefered paradigm would be more than welcome, whether that's | 18:21 | |
writing a zef plugin or contributing patches to META6::bin | |||
that's right, I forgot about App::MI6 | 18:23 | ||
App::Mi6, I mean | |||
how old is your raku? | 18:27 | ||
18:28
neshpion left
18:29
neshpion joined
18:30
natrys joined
18:40
wamba left
18:44
simcop2387 joined
18:47
lucasb joined
|
|||
demostanis[m] | <raydiak "in general, much of the raku eco"> That's UNIX philosophy :) | 18:52 | |
Implementing the Raku(tm) programming language v6.d. | 18:53 | ||
Built on MoarVM version 2021.03. | |||
<raydiak "how old is your raku?"> ^ | |||
raydiak | Thank you for the correction. Not everything in my memory maintains perfect cohesion over the decades of my life. | 18:57 | |
18:57
kleb left
|
|||
raydiak | I'm installing star right now to see if I can reproduce your issue | 18:57 | |
demostanis[m] | I will read about creating a zef plugin | 18:59 | |
Is there any documentation about ti? | 19:00 | ||
it | |||
19:00
abraxxa left
19:02
abraxxa joined,
simcop2387 left
|
|||
raydiak | not that I see right off the bat | 19:03 | |
tonyo: ping | |||
.seen tonyo | 19:04 | ||
tellable6 | raydiak, I saw tonyo 2021-04-14T20:17:26Z in #raku: <tonyo> they want to go to a new version and they're going with p7 | ||
raydiak | oops, where did I see his name? | 19:06 | |
tonyo: sorry, wrong person | |||
.seen ugexe | |||
tellable6 | raydiak, I saw ugexe 2021-04-14T23:34:07Z in #raku: <ugexe> need to implement^ | ||
19:11
wamba joined
|
|||
dpk | guifa: hi, on 31 March we discussed :ignoremark's potentially broken semantics w/r/t graphemes which aren't just a base character + mark (like hangul and emoji flags). you said you'd write up an issue — did you? because if not, i have some time now and could investigate more thoroughly and write up an issue myself | 19:12 | |
19:25
brtastic joined
|
|||
raydiak | demostanis[m]: multitasking beyond my comfort. forgot to deactivate rakubrew before installing and using star, had to start all over. almost there | 19:25 | |
guifa | dpk: I did. I’ve been discussing it with samcv as well (she’s the maintainer for basically all of the unicode stuff). We’ve got some ideas, but the main thing is if we’re going to make a change now, we want to make sure it’s the right one | 19:26 | |
it’s much better to say “in Raku(do) v. X and below, :ignoremark used only the base character. As of v. Y, ignoremark ignores a, b, c, which are defined by i, j, k.” than to try to fiddle with it over multiple versions | 19:28 | ||
dpk | yep, agreed | ||
good to hear! is there a GitHub issue i can subscribe to or something or is this discussion happening in camera? | |||
codesections | (I'm not really following this discussion, but dpk++ for the use of the phrase 'in camera' :D ) | 19:30 | |
guifa | sure. github.com/Raku/problem-solving/issues/276 | ||
one thing I’m thinking about right (and it’s not in that thread) is restricting :ignoremark to use the Unicode-defined diacritics. But that *will* ignore some Mn and *does* include some non-M | 19:31 | ||
and so then perhaps we could do anything classed as both Mark *and* Diacritic. But that’s just a current idea and there may still be other better avenues for handling it intelligently | 19:34 | ||
19:35
justsomeguy joined
19:36
asymptotically left
|
|||
raydiak | demostanis[m]: yes, I do encounter the same issue, in both star and a rakubrew installation | 19:38 | |
brtastic | What are all those happy faces in Raku docs? :D | 19:53 | |
guifa | :D means “defined" | ||
brtastic | aah :D thanks | ||
guifa | sub foo (Str:D $a) { … } <— have to pass a defiend string | 19:54 | |
sub foo (Str:U $a) { … } <— have to pass an undefined string (basically, a type object for Str or a subclass) | |||
sub foo (Str:_ $a) { … } <— explicitly don’t care (but that’s the default so there’s no real reason to ever use it, except maybe to indicate that you *really* do accept both if you’re strongly typing) | 19:55 | ||
19:55
|oLa| joined
|
|||
moon-child | what's the difference between :D and :D:? | 19:55 | |
codesections | and, since they _do_ look so much like happy faces, they're known as "type smileys" in the docs | 19:56 | |
guifa | :D: is actually two separate things | ||
[:D][:] == [defined][previous entry is invocant] | |||
moon-child | right | 19:57 | |
guifa | sometimes it can just make code clearer to use something other than self, so | 19:58 | |
method foo(\this:D :) { … } # java style instant method | |||
method foo(\this:U :) { … } # java style static method | 19:59 | ||
19:59
MasterDuke left
|
|||
guifa | the *really* cool thing about this though is … | 19:59 | |
19:59
MasterDuke joined
|
|||
brtastic | I don't really get Str:U, an undefined string? | 20:00 | |
guifa | brtastic: correct. | ||
For instance, if you type an array, and request an item out of bounds, you get an undefined Str | |||
moon-child | m: multi foo(Str:D $a) { say "You passed me $a" }; multi foo(Str:U) { say "WTF man" }; my Str $x; foo $x | 20:01 | |
camelia | WTF man | ||
20:01
abraxxa left
|
|||
brtastic | ah okay, that makes sense | 20:02 | |
codesections | m: my Str $s; dd $s.WHAT # Anything typed will be an undefined of that type before it's assigned | ||
camelia | Str | ||
guifa | You can also sometiems pass just a type for other reasons | ||
parv | m: multi foo(Str:D $a) { say "You passed me $a" }; multi foo(Str:U) { say "WTF man" }; my $x; foo $x | ||
camelia | Cannot resolve caller foo(Any:U); none of these signatures match: (Str:D $a) (Str:U) in block <unit> at <tmp> line 1 |
||
guifa | Imagine you have a converter class that reads in several files in one format and dumps them in another. | 20:03 | |
20:04
abraxxa joined
|
|||
guifa | sub convert(Format:U $in, Format:U $out, IO::Path @files) { … } | 20:04 | |
brtastic | m: my Str $test; say $test.defined | ||
camelia | False | ||
brtastic | that's pretty cool | 20:05 | |
20:05
dataange` left
20:06
dataangel joined
|
|||
guifa | m: class X { method replace(X:D $self is rw:) { $self = "X is gone" } }; my $x = X.new; say $x; $x.replace; say $x; | 20:09 | |
camelia | X.new X is gone |
||
guifa | ^^ you can actually wholesale replace and object if it’s in a writable container | ||
20:12
Black_Ribbon joined
20:14
ufobat_ left
|
|||
brtastic | I'd like to have a keyword like 'has', that would change a bit how a class works by changing its static state. What should I look at? | 20:44 | |
20:46
ufobat_ joined
|
|||
lizmat | m: role A[$foo] { method foo() { $foo} }; class B does A[42] { }; dd B.foo | 20:46 | |
camelia | 42 | ||
lizmat | m: role A[$foo] { method foo() { $foo} }; class B does A[666] { }; dd B.foo | ||
camelia | 666 | ||
lizmat | brtastic ^^ something like that ? | 20:47 | |
docs.raku.org/language/objects#ind...ized_Roles | |||
brtastic | lizmat: That would do, but I'd like to have much more than just a single parameter, so not the best place to put the parameters I think | 20:49 | |
lizmat | you can haz any number of positional or named parameters | 20:50 | |
it follows signature rules | |||
m: role A[:$foo] { method foo() { $foo} }; class B does A[foo => 666] { }; dd B.foo | |||
camelia | 666 | ||
brtastic | I'm a bit worried about it being unreadable though | ||
what I want is really to try to reimplement my form parsing perl module in raku as a learning excercise | 20:51 | ||
codesections | I'm not sure what precisely you have in mind by 'static state' brtastic, but classes can have `my` variables that are static | 20:52 | |
guifa | ^^ I was just aobut to suggest that | ||
El_Che | raku's OO is a lot reacher than core perl and the many CPAN modules implementing OO. Maybe a 1 to 1 conversion is not the best approach | 20:53 | |
brtastic | I'd like to be able to say something like: form-has and follow with a definition of a form field | 20:54 | |
guifa | m: class A { my $instances = 0; method reset { $instances = 0 }; method new { $instances++; self.bless }; method instances { $instances } }; my @a = A.new xx 10; say A.instances; A.reset; say A.instances; | ||
camelia | 10 0 |
||
brtastic | I understand static variables in classes with 'my', I guess what I'm really asking is how to create this kind of syntactic sugar in raku. I can just make a method that will be defining the fields and force to reimplement it, but in perl I was able to create a helper that would make it possible to create fields much like class attributes. It was done by messing with the symbol table though | 20:59 | |
here: metacpan.org/source/BRTASTIC/Form-...iny.pm#L96 | 21:00 | ||
21:01
simcop2387 joined
|
|||
demostanis[m] | <raydiak "demostanis: yes, I do encounter "> Sorry for the late answer. What can be done? | 21:05 | |
MasterDuke | brtastic: maybe create a slang that adds a new scope_declarator? | 21:07 | |
guifa | MasterDuke: could probably even avoid that with a simple sub that’s used in composing the class too | 21:08 | |
and just using a little bit of .^add_method and ^.add_attribute perhaps | |||
brtastic | I'm really a beginner, so if you could point me to documentation pages that I should read that would be great | 21:12 | |
guifa | brtastic: I guess what would be most helpful for us (to help you) is if you give us a mock up of both the class and how you’re intended to add the fields. I never did much OO perl so I admit looking at the code you linked to I didn’t entirely follow your end-goal. While I did a lot of non-OO perl, there are some others on here who can help who don’t have the same perl background but are excellent with Raku | 21:16 | |
docs.raku.org/type/Metamodel::ClassHOW <— docs on making classes through code | 21:18 | ||
It’s not a tutorial fashion, though, but as a quick tip, all of those methods can be shortened to .^foo (which is short for .HOW.foo) | 21:19 | ||
brtastic | would that help? metacpan.org/pod/release/BRTASTIC/...d#SYNOPSIS form_field declares a new form field, as opposed to Moose's 'has', which declares a class attribute just like in raku | ||
so I can mix has and form_field to have both form fields and attributes in classes | |||
what I want to achieve is pretty much what's in SYNOPSIS, but in Raku's class | 21:20 | ||
guifa | Aaah, okay. So there’s a couple of different approaches. | ||
21:21
wamba left
|
|||
guifa | lemme do a quick mock up of a few | 21:21 | |
21:25
ufobat_ left
|
|||
[Coke] | I think jnthn released a module with that sort of syntactic sugar. | 21:30 | |
github.com/jnthn/oo-monitors | |||
that's using 'monitor' to replace 'class', but it'll get you started, I think. | 21:31 | ||
guifa | ^^ that’s probably the long term best way to do it, although EXPORTHOW IIRC isn’t fully specced yet? | 21:33 | |
codesections | EXPORTHOW is what Red uses, right? | 21:35 | |
guifa | Yeah | 21:36 | |
TBH despite not being fully documented, given that both Red, OO::Monitors and Cro use it… | |||
If you don’t want to deal with EXPORTHOW, here’s a “poor man’s” version of doing it: tio.run/##rZCxDoJADIZ3nqIYFUiQ0eFQ...PyvUNiXd8A | 21:37 | ||
21:41
rindolf left
|
|||
brtastic | [Coke]: guifa: Okay I'll take a look at this, thanks a lot | 21:42 | |
guifa | (FWIW when I mention those modules using the EXPORTHOW, Red and Cro are both stand-out modules that will have long-term influence on other modules and how people use Raku. So you can feel safe to use what they’re doing for the most part and not worry) | 21:43 | |
21:44
parv left
|
|||
brtastic | Yes I've seen Cro and heard about Red, so I'll look at their source code for the reference if the EXPORTHOW documentation won't be enough :P | 21:45 | |
lizmat | guifa: why CALLER:: ? | ||
or is that cargo culted ? | |||
guifa | lizmat: because $?CLASS won’t be available in the sub. There’s not a $*CLASS is there? | 21:47 | |
lizmat | hmmm... | ||
feels to me it should be able to run that at compile time... | |||
hmm | |||
nm me | |||
codesections | odd, that tio.run link isn't working for me | 21:51 | |
guifa | codesections: maybe IRC cut it off somehow | ||
bit.ly/3uRaTqI | |||
21:52
parv joined
|
|||
codesections | ty that works | 21:52 | |
guifa | (although I suppose in this case, you’d want to store the form fields into a hash or something instead of directly creating methods) | 21:54 | |
22:00
parv left,
parv joined,
xelxebar_ joined
22:01
xelxebar left,
abraxxa left
22:03
abraxxa joined
22:24
Geth left
22:45
gordonfish left
23:04
mowotter left
23:05
gordonfish joined
23:15
brtastic left
23:31
pecastro left
23:40
b2gills left
23:53
natrys left,
natrys joined,
natrys left
|