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.
01:30 m_athias left 01:31 m_athias joined 01:43 frost joined 01:45 razetime joined 02:55 Util_ left 05:30 Util joined 08:06 lizmat_ left, lizmat joined
elcaro I was thinking about this earlier... here are some idle thoughts... 08:20
Raku is a very dynamic language... almost to a fault. If you call a `Str` method on a lie, like `.chars` or `.uc`, the list is coerced to a `Str` and then the method is called. Similarly, if you call `.elems` or `.reverse` on a `Str`, it is coerced to a something iterable (probably a `Seq`) and the method is called.
Now, calling `"stringy"[0]` is calling a _listy_ method (`.AT-POS`) on the string... so it gets coerced to a list, just like the other examples. This is why method names are unique for different types, eg. `.flip` vs `.reverse`, or `.chars` vs `.elems`... rather than having a generic `.length` method.
That may be a decent rationale, but it doesn't mean it not confusing for the beginner. In fact, calling `.contains` on a list was such a common beginner error...
```
> $*PERL.compiler
rakudo (2018.04.1)
> (< one two three >).contains('two')
True
> (< one two three >).contains('e t')
True
```
A warning was eventually added
```
rakudo (2022.07)
[1] > (< one two three >).contains('two')
Calling '.contains' on a List, did you mean 'needle (elem) list
```
I was thinking about this earlier... here are some idle thoughts... 08:21
Raku is a very dynamic language... almost to a fault. If you call a `Str` method on something `Iterable` (eg. a `Seq`), like `.chars` or `.uc`, and the `Seq` is coerced to a `Str` and then the method is called. Similarly, if you call `.elems` or `.reverse` on a `Str`, it is coerced to a something iterable (probably a `Seq`) and the method is called.
Now, calling `"stringy"[0]` is calling a _listy_ method (`.AT-POS`) on the string... so it gets coerced to a list, just like the other examples. This is why method names are unique for different types, eg. `.flip` vs `.reverse`, or `.chars` vs `.elems`... rather than having a generic `.length` method.
That may be a decent rationale, but it doesn't mean it not confusing for the beginner. In fact, calling `.contains` on a list was such a common beginner error...
```
> $*PERL.compiler
rakudo (2018.04.1)
> (< one two three >).contains('two')
True
> (< one two three >).contains('e t')
True
```
A warning was eventually added
```
rakudo (2022.07)
[1] > (< one two three >).contains('two')
Calling '.contains' on a List, did you mean 'needle (elem) list
```
I was thinking about this earlier... here are some idle thoughts... 08:24
Raku is a very dynamic language... almost to a fault. If you call a `Str` method on something `Iterable` (eg. a `Seq`), like `.chars` or `.uc`, the `Seq` is coerced to a `Str` and then the method is called. Similarly, if you call `.elems` or `.reverse` on a `Str`, it is coerced to a something iterable (probably a `Seq`) and the method is called.
Now... Calling `"stringy"[0]` is calling a _listy_ method (`.AT-POS`) on the string... so it gets coerced to a list, just like the other examples! This is why method names are unique for different types, eg. `.flip` vs `.reverse`, or `.chars` vs `.elems`... rather than having a generic `.length` method. It facilitates coercing things automatically. This is nice _sometimes_.
That may be a decent rationale, but it doesn't mean it not confusing for the beginner. In fact, calling `.contains` on a list was such a common beginner error...
```
> $*PERL.compiler
rakudo (2018.04.1)
> (< one two three >).contains('two')
True
> (< one two three >).contains('e t')
True
```
A warning was eventually added
```
rakudo (2022.07)
[1] > (< one two three >).contains('two')
Calling '.contains' on a List, did you mean 'needle (elem) list
```
It's not unreasonable to suggest that calling `Str.AT-POS` should perhaps show a similar warning that suggest calling `.substr`
Thank you for coming to my TED Talk
I was thinking about this earlier... here are some idle thoughts... 08:25
Raku is a very dynamic language... almost to a fault. If you call a `Str` method on something `Iterable` (eg. a `Seq`), like `.chars` or `.uc`, the `Seq` is coerced to a `Str` and then the method is called. Similarly, if you call `.elems` or `.reverse` on a `Str`, it is coerced to a something iterable (probably a `Seq`) and the method is called.
Now... Calling `"stringy"[0]` is calling a _listy_ method (`.AT-POS`) on the string... so it gets coerced to a list, just like the other examples! This is why method names are unique for different types, eg. `.flip` vs `.reverse`, or `.chars` vs `.elems`... rather than having a generic `.length` method. It facilitates coercing things automatically. This is nice _sometimes_.
That may be a decent rationale, but it doesn't mean it not confusing for the beginner. In fact, calling `.contains` on a list was such a common beginner error...
```
rakudo (2018.04.1)
> (< one two three >).contains('two')
True
> (< one two three >).contains('e t')
True 08:26
```
A warning was eventually added
```
rakudo (2022.07)
[1] > (< one two three >).contains('two')
Calling '.contains' on a List, did you mean 'needle (elem) list
```
It's not unreasonable to suggest that calling `Str.AT-POS` should perhaps show a similar warning that suggest calling `.substr`
08:28 discord-raku-bot left, discord-raku-bot joined
Nemokosch what is this? 08:51
yabobay i tried to do the thing that the error said
did you mean "needle (elem) list"
Nemokosch what needle? never heard of it 08:53
yabobay it says it here
Nemokosch oh the message 08:55
aaah
no no that's an operator 08:56
needle and list are variable names in that example
confusingly enough tbh
the (elem) operator
āˆˆin other words 08:57
elcaro yeah, as in `$needle (elem) @haystack`
or `$needle āˆˆ @haystack`
oh, Nemo beat me to it, but yes.
lizmat PR for making that error message less confusing welcome :)
yabobay calling it "needle" makes it sound like a function 08:59
Nemokosch well, it does
yabobay or at least they could put the sigils in the error message
so you just intuitively get it
elcaro yeah, it assumes familiarity with the English idiomatic expression "needle in a haystack"... Pretty sure something in perldoc (maybe `index`) used to say something like `index(haystack, needle)` 09:01
www.youtube.com/watch?v=37BBmRnJnwY
It's a simple PR to fix, if either of you are interested, <@297037173541175296> or <@989550365533937664>
yabobay well i dunno how to do any of that
and i don't know what the "right" error message should be
so im not doing it
elcaro I can submit it... but you were the one confused by it... so could you suggest something that you would have found less confusing. 09:03
What about just putting sigiles on the words, ie `did you mean '$needle (elem) @list`
I can submit it... but you were the one confused by it... so could you suggest something that you would have found less confusing.
What about just putting sigiles on the words, ie `did you mean '$needle (elem) @list`?
Nemokosch if the input was a List, that should be fine imo 09:05
yabobay well
i don't think $needle and @list is a good combination of names
it should be either $needle and @haystack, or $item and @list
both of those ar econsistent
well
i don't think $needle and @list is a good combination of names
it should be either $needle and @haystack, or $item and @list
both of those are consistent
elcaro yeah, I think the whole 'needle in a haystack' thing associates better with searching a string... a list is discrete elements , not so much a haystack... so `$item` and `@list` is probably better, and less Anglocentric. 09:09
yabobay well the error message is in english anyway 09:11
and so is the rest of raku
elcaro I'm aware. I speak the same 2 languages as John McClane... English and bad English. Also, `needle` is used extensively throughout the codebase... but errors are for the user and should be more broadly understandable. 09:15
You sure you don't wanna submit a PR. You'll have your name in ~~lights~~ the contributors list! 09:17
github.com/rakudo/rakudo/blob/51c0...l.pm6#L209
If, not I will submit one
Nemokosch I do appreciate the effort to make Raku "as little anglocentric" (does this even make sense?) as possible 09:19
yabobay looking at code is intimidating
Nemokosch I think it's rather exciting 09:21
yabobay is it line 209? 09:22
screw it, i'm gonna do it 09:23
lizmat ++yabobay 09:24
elcaro Sweet... I could do it, but I'd rather empower you.
yabobay single-quotes don't interpolate right? 09:27
single-quotes don't interpolate, right?
lizmat indeed, they do not 09:34
yabobay help, i don't know how to open source 09:52
do i just pr this?
09:53 jaguart joined
Nemokosch the one that contains the fix, I suppose 09:53
to the original rakudo repository
yabobay and what happens when someone accepts that request? does the rakudo repo now have a new branch? 09:54
Nemokosch no, your branch will go to an existing remote branch
like the master branch of arakudo/rakudo 09:55
like the master branch of rakudo/rakudo
yabobay ohhh i see
so like... should i PR it now? 09:58
i made the edit 09:59
Nemokosch The thing is, I don't know the workflow for rakudo
but I suppose you should open a pull request from the branch with your modification to the master of the original rakudo repo
yabobay idk, it's spooky 10:01
Nemokosch šŸ˜‚
either way, you can't mess up anything
yabobay you gotta admit it's pretty scary tho
Nemokosch since it's just a "request"
it might be overwhelming at first
yabobay i clicked the big button 10:03
Nemokosch šŸ„ 10:06
elcaro I'm still confused by git. I fudge my way through... `git clone` or `git pull`, `git branch`, `git commit -am 'foo'`, and `git push`. 10:14
If I run into any errors, I use the same trick as described in XKCD 1597
xkcd.com/1597/
Nemokosch I still keep finding new things about git that I don't use often enough to learn 10:15
also I don't get the point of `merge` if there is the omnipotent `rebase` 10:17
I didn't know about `git add --patch <filename>` for a long time 10:19
allows you to select only a part of your changes in a file
lizmat also clicked a big button :-) 10:20
yabobay++ 10:21
Nemokosch the reason why Unison is debated - we have great portable tooling for source code stored in plain text
not so much for hashed syntax trees...
11:21 Kaiepi joined 11:24 Kaipei left 12:33 raiph joined, raiph left 12:54 frost left
masukomi um... can someone explain what's going on with this to me ? 13:21
```
my @exports = <&foo &bar>;
@exports.^name # Array
@exports[].^name # Array
<@exports> #-> "<@exports>"
<@exports[]> #-> "<&foo &bar>" 13:22
```
that last line really confuses me. Here's what's going through my head.
* the `<...>` seems to be a "make an array out of these literal strings with no interpretation " operation
* `@exports` is an array, that, unsurprisingly isn't interpreted when shoved into `<...>`
* `@exports[]` is also an array, which, being the same thing, I'd expect to be treated the same way.
* in addition to what seems to be the same type of object being treated in a different way, we have the compounding factor of `<...>` being a thing you use when you _don't_ want to interpret the contents.
Obviously, something's wrong in my thinking but what?
um... can someone explain what's going on with this to me ?
```
my @exports = <&foo &bar>;
@exports.^name #-> Array
@exports[].^name #-> Array
<@exports> #-> "<@exports>"
<@exports[]> #-> "<&foo &bar>"
```
that last line really confuses me. Here's what's going through my head.
* the `<...>` seems to be a "make an array out of these literal strings with no interpretation " operation
* `@exports` is an array, that, unsurprisingly isn't interpreted when shoved into `<...>`
* `@exports[]` is also an array, which, being the same thing, I'd expect to be treated the same way.
* in addition to what seems to be the same type of object being treated in a different way, we have the compounding factor of `<...>` being a thing you use when you _don't_ want to interpret the contents.
Obviously, something's wrong in my thinking but what?
um... can someone explain what's going on with this to me ? 13:23
```
my @exports = <&foo &bar>;
@exports.^name #-> Array
@exports[].^name #-> Array
<@exports> #-> "<@exports>"
<@exports[]> #-> "<&foo &bar>"
```
that last line really confuses me. Here's what's going through my head.
* the `<...>` seems to be a "make an array out of these literal strings with no interpretation " operation
* `@exports` is an array, that, unsurprisingly isn't interpreted when shoved into `<...>`
* `@exports[]` is also an array, which, being the same thing, I'd expect to be treated the same way.
* in addition to what seems to be the same type of object being treated in a different way, we have the compounding factor of `<...>` being a thing you use when you _don't_ want to interpret the contents.
Obviously, something's wrong in my thinking but what?
git merge is, as far as i can tell, just a convenience feature to make it easier for folks than thinking about rebasing. 13:28
see also `git checkout foo` creating a new local `foo` branch if you didn't have one, but you have 1 (and only one) remote that has a `foo` branch, and then switching to it. They did this, presumably because folks had trouble with `git checkout -b foo some_remote/foo` or `git branch foo some_remote/foo; git checkout foo`
there have been a lot of "convenience wrappers" around functionality since its inception.
.
git merge is, as far as i can tell, just a convenience feature to make it easier for folks than thinking about rebasing.
see also `git checkout foo` creating a new local `foo` branch if you didn't have one, but you have 1 (and only one) remote that has a `foo` branch, and then switching to it. They did this, presumably because folks had trouble with `git checkout -b foo some_remote/foo` or `git branch foo some_remote/foo; git checkout foo`
there have been a lot of "convenience wrappers" around functionality since its inception.
. 13:29
`git merge` is, as far as i can tell, just a convenience feature to make it easier for folks than thinking about rebasing.
see also `git checkout foo` creating a new local `foo` branch if you didn't have one, but you have 1 (and only one) remote that has a `foo` branch, and then switching to it. They did this, presumably because folks had trouble with `git checkout -b foo some_remote/foo` or `git branch foo some_remote/foo; git checkout foo`
there have been a lot of "convenience wrappers" around functionality since its inception.
. 13:30
`git merge` is, as far as i can tell, just a convenience feature to make it easier for folks than thinking about rebasing.
see also `git checkout foo` creating a new local `foo` branch if you didn't have one, but you have 1 (and only one) remote that has a `foo` branch, and then switching to it. (it used to just error). They did this, presumably because folks had trouble with `git checkout -b foo some_remote/foo` or `git branch foo some_remote/foo; git checkout foo`
there have been a lot of "convenience wrappers" around functionality since its inception.
13:50 Kaiepi joined 14:11 Guest68 joined, raiph joined
Guest68 Hi! I have posted a question on stackoverflow (stackoverflow.com/questions/734149...u-2022-04) about qqx, shell and run failing inside a loop reading from STDIN with raku 2022.04. Earlier versions work just fine. A minimal example is attached to the post. Any thoughts? 14:13
raiph Guest68 Hi, just saw your SO comment and now here. :) 14:14
Guest68 Hi raiph! :) Thank you very much for guiding me!
raiph masukomi: I can engage about <@foo[]> if you're around. 14:15
lizmat: the IRC logs seem to be repeating stuff like crazy.
yabobay++ 14:16
yabobay hi what? 14:17
Nemokosch Just stop using Mac aaaaaaa
That's not just "wasting time", that's knowingly wasting work put into software for the sake of a company deliberately staying incompatible with everyone 14:19
The more you guys repeat Mac, the louder I will protest 14:20
raiph Guest68: I think the first thing to do is run a bot to identify the commit at which the behavior changed. 14:22
Does that make sense to you?
And then we can look at the commit to see what the dev said about it and look at the code. 14:23
bisectable: hello 14:25
Guest68: I've not been on IRC much the last few years. 14:27
Ā I think it's my first time on this channel.
I don't yet recall how to run the bisect bot, nor how to find out how to. 14:28
I will now try figure it out. 14:29
But we may have to wait for someone else to speak up.
Or go to some other channel.
I still think this was the right place to start.
Guest68: But if I figure out otherwise I'll let you know here or on SO. 14:30
help # <-- for bots or Rakoons (who I'm presuming are actually humans, but a chatty furry little animal will be cool too) 14:33
Guest68 Thank you for your time and effort, raiph! 14:49
raiph bisectable6: help 14:53
14:58 raiph left 15:33 raiph joined
raiph Guest68: Please connect to the #whateverable channel and meet me there. 15:34
Then we'll work out how to bisect and read where the behavior changed. :) 15:35
16:28 tbrowder left, tbrowder joined
Guest68 I'm terribly sorry but I've got to go now. And I won't be near a computer until Monday. If you want we can proceed together then. 16:42
lizmat raiph: I don't think it's the logger, it's the discord bridge: discord allows editing of messages, and each edit appears as a new line on IRC 17:11
yabobay the fact there's people still using IRC makes me happy, and whenever i very occasionally use IRC it makes me happy, but i have to wonder why people are still using IRC on a large scale like this 17:18
instead of something like matrix. is it just because irc already has adoption? 17:19
or does it have something that nothing else really can do?
17:30 razetime left 18:12 jgaz joined 18:23 raiph left 18:34 Guest68 left 19:28 raiph joined 19:29 jgaz left 19:37 raiph left
i don't remember if raku is where i heard this existing, but i remember seeing a code snippet that's something along the lines of `if $x == 1 or 0` 20:09
is this a thing?
which is equivalent to `if $x == 1 or $x == 0`
Nahita it's not `or` but `|`
`or` is the lower precedence version of `||`, i.e., logical or 20:11
`|` is the any junction operator
yabobay any junction operator?
Nahita docs.raku.org/type/Junction
superposition of values...
in boolean context, `|`s collapse with the "any" semantic
20:13 jaguart left 20:33 jgaz joined 21:19 jgaz left
yabobay as a user do i have any reason for wanting to use jvm over moarvm (or vice versa)? 21:21
guifa I'd say to use JVM mainly if you have a reason to tie into other Java VM resources. Otherwise, there's not really any advantage 21:26
22:18 Kaiepi left 22:19 Kaiepi joined 23:21 Kaiepi left