This channel is intended for people just starting with the Raku Programming Language (raku.org). Logs are available at irclogs.raku.org/raku-beginner/live.html
Set by lizmat on 8 June 2022.
stevied anyone got a clue on this problem I encountered? stackoverflow.com/questions/751904...irectory-e 00:27
maybe the name of my module, "Directory" is the problem? 00:28
Nemokosch that part you can easily try, I'd say. But let's check the mi6 sources first 00:34
okay, definitely a problem during the fez step 00:37
stevied yeah, tried running the fez step manually, same error 00:39
was just getting ready to go relax for the evening now I'm all uptight because this isn't working 🙂
Nemokosch 😅 00:40
so, do you do fez checkbuild in the folder where your META6.json is to be found? 00:42
stevied no, not familiar with that 00:44
```
> $ fez checkbuild [±main ✓]
>>= Inspecting ./META6.json
>>= meta<provides> looks OK
>>= meta<resources> looks OK
>>= Directory:ver<0.0.1>:auth<zef:sdondley> looks OK
```
Nemokosch and you run mi6 release in the same folder? 00:45
stevied yes sir
or ma'am
Nemokosch I wonder if you can run `pax`? 00:50
stevied never heard of it 00:51
Nemokosch me neither but doesn't matter 00:52
stevied here's where the error is generated: github.com/tony-o/raku-fez/blob/8d...kumod#L241 00:57
Nemokosch yeah yeah 00:59
that's why I'm asking if you can do this pax
this is where the tarball is created github.com/skaji/mi6/blob/965ecfee...akumod#L31 01:10
this is the first ls candidate github.com/tony-o/raku-fez/blob/64...akumod#L27 01:12
stevied what can that tell me? 01:13
Nemokosch hm?
stevied looks like I have a /bin/pax command 01:14
Nemokosch it would be good to know what it returns for the actual archive you get 01:16
stevied I don't know how to run that command on the archive
Nemokosch well the example is right there in the code
stevied ``` 01:17
> $ pax -f Directory-0.0.1.tar.gz [±main ✓]
pax: Cannot identify format. Searching...
pax: Cpio file name length 29594 is out of range
pax: Invalid header, starting valid header search.
pax: End of archive volume 1 reached
```
what does that tell me? anything useful? 01:18
Nemokosch is there any reason you aren't doing the kind of call zef does? 01:19
stevied I don't follow you.
i'm just doing `mi6 release` like I've done many times before. this is the first time I've ran into this problem. 01:20
Nemokosch anyway 01:21
stevied paste.debian.net/1267994/ 01:24
ok, this looks interesting 01:25
Nemokosch are those pax: lines going to stderr? 01:26
stevied see github.com/frithnanth/perl6-Archiv...1377385341 01:28
I think I might have fucked something up
Nemokosch rip
stevied hmm, removing the symlink didn't help 01:31
ugh
Nemokosch anyway, what is the output if you do 2> /dev/null on the pax command?
because it seems it should only take the stdout into account
also you could do an echo $? after 01:32
stevied I get this: paste.debian.net/1267996/ 01:33
Nemokosch I think the space is significant there
stevied `echo $?` is 0
Nemokosch 2> as opposed to 2 >
stevied k
Nemokosch anyway, this pretty much spoiled it: the errors shouldn't matter 01:34
stevied now I get: paste.debian.net/1267997/
Nemokosch okay, this is getting nice, but also surprising 01:35
sadly Raku is nowhere near built on this shittopű 01:36
sadly Raku is nowhere near built on this shittop
stevied what do you mean?
Nemokosch trynna play with glot.io then
stevied <@297037173541175296> so what are you thinking? any ideas? 01:42
oh wait
Nemokosch if only this crap wasn't this slow 01:43
stevied damn, my idea didn't work
01:46 jgaz left
Nemokosch idk, could you substitute this output into ^this snippet? 01:47
as the ls
stevied substitute what output? 01:48
Nemokosch the output of that pax stuff
the lines I guess
okay, I think I have it 01:49
._Directory-0.0.1 is the problem
I don't know where this came from 01:50
stevied heh, i was just wondering about that myself
Nemokosch I suppose you don't have a file like that in your folder
does it really exist in the tar?
stevied hmmm, nope 01:53
Nemokosch well then maybe we could compare it with other distros that did work properly and see if that pax command reports fake files for those as well. But not now because it's really late and I'm falling asleep 01:54
stevied ok, i'll try 01:55
thanks for your help. i'll keep working on it 01:56
04:40 discord-raku-bot left, discord-raku-bot joined 05:23 raku-discord joined 05:24 raku-discord left 05:25 raku-discord joined, raku-discord left 05:26 raku-discord joined, raku-discord left 05:33 Heptite left
el gatito <@853712446660673566> 06:19
m: ```raku 06:23
echo('hello world');
```
m: ```raku 06:24
say('hello world');
```
07:40 discord-raku-bot left, discord-raku-bot joined 08:39 Heptite joined 08:40 discord-raku-bot left 08:41 discord-raku-bot joined 09:29 jack9 joined
jack9 hi 09:30
Nemokosch 👋 09:46
jack9 why can't i create variable without `my` 09:49
Nemokosch you can: there is also `our` and `state` 😛 09:50
jack9 m: $var = 0; 09:51
camelia ===SORRY!=== Error while compiling <tmp>
Variable '$var' is not declared. Did you mean '&VAR'?
at <tmp>:1
------> <BOL>⏏$var = 0;
Nemokosch well I can't see `our` or `state` in that example 09:52
09:57 NemokoschKiwi joined
NemokoschKiwi m: our $var = 0; 09:57
camelia ( no output )
NemokoschKiwi m: state $var = 42;
camelia ( no output )
NemokoschKiwi now let me ask back: do you want to declare variables implicitly, and if so, why? 09:58
jack9 so i don't have to type `my` 10:00
NemokoschKiwi not gonna lie, I don't find that such a noble goal, it's fairly arbitrary 10:01
10:24 jack9 left
lakmatiol You get two implicit variables, `$_` and `$`. In general, implicit variables create some annoying ambiguities and complicate scope resolution, while providing minimal merit. 10:39
where $_ is block scoped, and `$` is state
Nahita there are more "implicit" variables than those 10:56
and you should add "in my opinion" or something to end of that sentence
Nemokosch 🚔 11:03
11:07 NemokoschKiwi left 11:09 ab5tract joined
Nahita if you're replying to me, i don't see those garbage anymore, so might as well not bother 11:27
sour hi, does raku work properly on windows (no WSL) ? I've had various issues in installing zef / installing packages using zef 11:29
lizmat there are some known issues on Windows I believe
sour thx, is there a discussion I can follow somewhere? 11:30
el gatito what is `state` declaration keyword? 11:37
ik that `my` is block scoped (like js `let`) and `our` is global but what is `state`?
11:43 jack9 joined, jack9 left
Nemokosch static variable: created per subroutine 11:45
<@265592945552392212> most useful experimenting is related to Coke's activity I think, he did try things ever now and then 11:55
weird flex... no worries, your main activity was sabotage either way lmao
sour is there someplace i can follow their activity? 11:56
Nemokosch for now I'd say, if you have a particular problem in mind, let's try to knock that down directly 11:59
he is definitely present in <#633753286209699870> - could be here as well but yeah, in either case, it's nighttime in the US now 12:00
sour there like 4 problems i encountered while trying to install zef & cro (using zef) 12:14
I eventually got it to work by skipping tests `--/test` and trying to install cro multiple times `--force-install`, and restarting the shell session (somehow this matters)
there like 4 problems i encountered while trying to install zef & cro, App::Mi6 (using zef) 12:15
12:17 jack9 joined
Nemokosch Not gonna lie: it seems like sheer luck if Cro can install with tests, I had failures there in WSL as well 12:18
I wish it got some priority for the devs
sour yeah, unfortunately there were other issues besides failing tests 12:22
jack9 weak typing? 12:23
docs.raku.org/type/Str#(Cool)_routine_abs
Nemokosch OpenSSL stuff? 12:24
jack9: what do you mean by weak typing? 12:25
jack9 > Coerces the invocant (or in the sub form, the argument) to Numeric
12:25 jack9 left
Nemokosch Mhm, if the type is suitable, it will 12:26
jack9 a strongly typed lang will throw an error if a non numeric is passed
Nemokosch I'm not sure if that's what "strong typing" really means 12:27
but yes, by these terms, Raku isn't that
in Raku, the general principle is that the operation defines the type of the operand, not the other way around 12:28
jack9 m: say(1 + 'hello') 12:29
m: say(1 . 'hello')
Nemokosch exactly. + is numeric addition, and 'hello' is not suitable for that
this helped now, although I'm not sure I would keep that error after the big schism from Perl 12:31
m: say(1 ~ 'hello') 12:33
lizmat 1 can be coerced to string 12:35
"hello" cannot be coerced to a number 12:36
12:48 ab5tract left 12:50 ab5tract joined
jack9 my brain on php 13:04
13:05 Heptite left
lizmat so much better and less addictive than pcp 13:09
jack9 anyways, how much does different sigils affect how the same data is treated? 13:16
as an example```raku
my $coll = (1, 2, 3);
my @coll = (1, 2, 3);
``` `$coll` is a list while `@coll` is an array
and my intuition is that `$coll` is treated as a single value while `@coll` is treated as a collection
but what are the concrete differences between two of them
`$coll` is not an iterable while `@coll` is?
lizmat @coll contains mutable elements, $coll does not
$coll is also an Iterable, but inside a container
jack9 so `$coll` is like python tuple 13:17
lizmat and that makes it itemized
could be, don't know enough python for that :-)
jack9 and `%coll` would be invalid 13:19
Nahita a List in Raku is like tuple of Python. In your both lines, the right hand side is a List 13:24
commas make a List
in the second line, though, when you're assigning a List to a @-sigiled variable, that @-sigiled variable will be an Array 13:25
which is... like the lists of Python
so $coll is like a single thing as you say, puts/wraps that single thing in a container where that single thing is a List 13:26
@coll is a collection of things and is an Array
sorry if I resulted in confusion 13:27
%coll would be invalid but only because there are odd number of elements so it cannot fully make pairs out of RHS 13:28
to make the mapping
Nemokosch to be accurate: tuples in Python are deeply immutable, that's quite an important feature of them 13:37
Raku's lists are not deeply immutable, I like to put it as "they don't provide an interface for mutation" but that's it 13:38
stevied I got a CI test failing on Windows apparently because TAP won't install on it: github.com/sdondley/Directory/acti...6814622245
Nemokosch did you succeed on uploading it, by the way? ^^ 13:39
stevied I did, I used another machine.
Nemokosch tricky haha
stevied I think I somehow broke libarchive library when trying to get Archive::Libarchive module installed. I'm not sure, though. 13:40
Nemokosch is there an issue at Raku/tap-harness6 or tap6-harness or whatever the name is? 13:42
I mean I wouldn't be surprised
stevied I just filed an issue. didn't see one there. 13:47
jack9 m: 13:48
$lst = (1, 2, 3);
$lst[1] = 4;
say($lst);
m:
my $lst = (1, 2, 3);
$lst[1] = 4;
say($lst);
13:50 jack9 joined
Nemokosch m: 13:52
jack9 can custom objects (classes) define what happens when they are assigned to a @ or a % variable?
Nemokosch my $foo = 2;
my $lst = (1, $foo, 3);
$lst[1] = 4;
say($lst);
13:53 jack9 left
pfff, good question 13:54
jack9 ono 😳
Nemokosch that's what I mean by "just not providing mutation". the $-sigilled variable did 13:56
you know, by default, a @variable is created as an Array 13:57
they are enforced to be Positional (which an Array obviously is)
jack9 `$foo` is a reference inside that list?
Nemokosch something like that. Instead of the reference terminology, the interface that provides the mutation is called "container" 13:59
when you create a my $variable, you get a Scalar container and your symbol is bound to that
jack9 and `($i,)` is passing the container to the list 14:01
Nemokosch yep 14:02
a way to see what you have underlying is to call .VAR on a value
my $foo = 2; 14:03
my $lst = (1, $foo, 3);
say(.WHAT, .VAR.WHAT) given $lst[0];
say(.WHAT, .VAR.WHAT) given $lst[1];
ugh
m: 14:04
my $foo = 2;
my $lst = (1, $foo, 3);
say(.WHAT, .VAR.WHAT) given $lst[0];
say(.WHAT, .VAR.WHAT) given $lst[1];
jack9 so how do i "dereference" a scalar var 14:06
Nemokosch using decontainerisation, which is commonly achieved as a "fake indexing" 14:07
$foo[] or $foo<>
if you meant to get the raw content 14:08
jack9 back to this question 14:09
14:10 ab5tract left
Nemokosch could you get a more concrete example? 14:10
I have the impression that the broad answer is no but many actually related and relevant things can be achieved 14:11
jack9 ```perl 14:18
class Person {
has $.name;
has $.age;
has $.gender;
}
my $person = Person.new(name => 'John Smith',
age => 30,
gender => :male);
# what will happen?
my @person = Person.new(name => 'John Smith',
age => 30,
gender => :male);
```
lizmat the Person object will be in the first element of @person
jack9 and it will always be like that for whatever class it is? 14:19
or the class can change this behavior?
and it will always be like that for whatever object it is? 14:20
or the object can change this behavior?
lizmat whatever class it is
the class can not change that behaviour
Nemokosch is it possible to create new sigils? 14:22
p6steve jack9: fwiw raku is quite forgiving ... here you are assigning a single item to a list and this may prevent a lot of boilerplate in the case that you have a function that returns both a single item and a list ... but surely it would be clearer to a maintainer that you really mean ```my @person = [Person.new(...)];``` 14:23
or ```@person.push: Person.new(...);``` 14:24
lizmat it is currently not possible to create new sigils, afaik
jack9 you can call a function in that syntax? 14:27
is that equivalent `@person.push(Person.new(...))`
p6steve yes
if you want the rhs of an "assignment" to change the behaviour, I would say (i) don't try this with an assignment "=" and (ii) take a look at the Store/Fetch proxy in the docs 14:30
so a way to kind of do this is to make the lhs be a method of some kind of "role" and to give the rhs object a type 14:31
something like
jack9 role? is that like a mixin? 14:32
p6steve ``` 14:34
role R {
has $.a;
multimethod m(Str $x ) { $!a = $x xx 2 }
multimethod m(Int $x ) { $!a = $x * 2 }
}
my $r = R.new; # here we punt the role to a class
$r.m: 23;
$r.m: 'xyz';
say $r.a;
```
yes you can go ```class C does R { ... }``` 14:35
with a store/fetch proxy you can do this ```$r.m = 23; $r.m = 'xyz';``` 14:36
you can likely even use the FALLBACK method to avoid using the '.m' ... 14:37
jack9 glot.io has some problems with it``` 14:38
===SORRY!=== Error while compiling /home/glot/main.raku
Unable to parse expression in argument list; couldn't find final ')' (corresponding starter was at line 3)
at /home/glot/main.raku:3
------> multimethod m(Str⏏ $x ) { $!a = $x xx 2 }
expecting any of:
infix
infix stopper
```
you forgot to put spaces in between `multi` and `method` thats why 14:44
Nemokosch that's right 14:47
p6steve ```
1 role R {
2 has $.a;
3
4 multi method m( Str $x ) { $!a = ($x xx 2) }
5 multi method m( Int $x ) { $!a = ($x * 2) }
6 }
7 my $r = R.new; # here we punt the role to a class
8 $r.m: 23;
9 $r.m: 'xyz';
10 say $r.a;
```
oh sugar
stevied <@297037173541175296> github.com/tony-o/raku-fez/issues/72 14:49
i'm not sure if that's causing the issue I'm having on my intel mac
i'm gonna try on an another, older intel mac 14:50
running an older version of macos
Nemokosch macOS should be banned from development finally 😆 14:51
stevied raku would have problems being a linux only platform 14:53
p6steve ^^^ both right!
Nemokosch I mean, not if people just agreed to avoid Mac once and for all 14:54
p6steve or use vftools ;-) 14:55
Nemokosch there are no similar problems for even BSD
stevied if only there were world peace
p6steve free beer
stevied if only i had a full head of hair again 14:56
Nemokosch then everybody would use Minix 15:05
stevied ok, uploaded a new version of my distro without issue on my older intel mac 15:11
huh
so wtf is wrong with my main machine? I have no idea.
jack9 m:
$a = [1, 2, 3];
m: 15:12
my $a = [1, 2, 3];
say $a.WHAT;
stevied kind of a dumb error message
jack9 i can assign an array without `@`
wil 15:13
stevied right
jack9 til
stevied you can also assign a hash to a scalar var
jack9 does people get angry if i do that 15:15
stevied no 15:16
I won't, at least
jack9 nice, i will code using only `$`, no one will give a shit
stevied the @ and % can help you keep track of what the variable contains 15:17
but up to you
also, the scalar variable will "box" the data structure. so it can behave differently under certain circumstances 15:18
maybe this will help shed clarity on when to use what: stackoverflow.com/a/62142436/1641112 15:22
jack9 ```raku
sub char_count($str) {
my %res = {};
my @chars = $str.comb;
for @chars -> $c {
if (%res.contains($c)) {
%res[$c]++;
} else {
%res[$c] = 1;
}
}
%res;
}
say char_count('The quick brown fox jumps over the lazy dog');
stevied use `%res{$c}`
curly instead of square brackets 15:23
jack9 and why?``` 15:25
Applying '.contains' to a Hash will look at its .Str representation.
Did you mean 'Hash{needle}:exists'?
```
stevied why curly braces? because that's the syntax. 15:26
square brackets are for arrays
jack9 no i mean why is this warning 15:27
stevied i've never seen a .contains method on hashes. Did you see that used somewhere else? 15:28
contains is a method for a string 15:29
docs.raku.org/type/Str#method_contains 15:30
all you need is `%res{$c}++` 15:31
you don't need to check if it already exists
jack9 yes i assume there is a method with a same name for hashes
stevied it will autovivify
lizmat that will stringify the hash and call .contains on that
jack9 it will automatically add an entry in `%res` (like implicit `%res{$c} = 0`) before `++`ing it? 15:34
stevied yeah 15:35
jack9 raku be implicitly creating zeros 15:38
why does this script give a weird output``` 15:42
sub char_count($str) {
my %res;
my @chars = $str.comb;
for @chars -> $c {
%res{$c}++;
}
%res;
}
my %char_count = char_count('The quick brown fox jumps over the lazy dog');
for %char_count -> $char, $count {
say "$char: $count\n";
}
```output here```
oh nah i need to call `.kv` 15:43
15:46 Heptite joined
``` 15:53
my @char_count_sorted = char_count($str).kv.sort(sub($e) {$e.key});