stevied I tried that. But no whay to get the month name "January" from that 01:14
this is what I'm looking for: 01:16
I'm stumped again. Got this: 06:32
#! /usr/bin/env raku
use v6;
class Vimwiki::File is IO::Path {
06:32 discord-raku-bot left, discord-raku-bot joined 06:37 discord-raku-bot left, discord-raku-bot joined 08:36 m_athias left, m_athias joined 09:05 dakkar joined
Nemokosch Because you set a different variable, I guess 09:18
Hm, or that nextwith overrides the value, not sure what it even does 09:24
gfldex `self.bless` returns a new `self` that `nextwith` doesn't know about. 10:40
Subclassing `IO::Path` may have surprising results.
lizmat I think IO::Path is not really subclassable at the moment... 10:43
that may warrant a Rakudo issue
gfldex A `subset` might do. 10:48
11:39 frost joined 12:14 frost left
lizmat and yet another Rakudo Weekly News hits the Net: 13:06
13:34 A26F64 joined 13:55 discord-raku-bot left 13:56 discord-raku-bot joined 14:31 ychaouche joined
ychaouche hello 14:31
I am trying to learn about raku, coming from python, I am reading python to raku ( 14:32
I am intrigued by the "\" sigill (is it a sigill). It says : Sigilless variables, declared with a \ but used without them, are bound to the value they are assigned to and are thus immutable.
Are they like constants ?
the kind of variable you write in all caps in C for example ? 14:33
well, not variable, constant
lizmat they are bound: if they are bound to a scalar container, they can be changed 14:34
m: my \foo = 42; foo = 666
camelia Cannot modify an immutable Int (42)
in block <unit> at <tmp> line 1
lizmat m: my \foo = my $ = 42; foo = 666; say foo 14:35
camelia 666
lizmat the "my $" is a nameless variable with a container
ychaouche so in the second example you bound foo to a scalar variable, which let you change its content ? 14:37
scalar unnamed variable
lizmat yup 14:40
ychaouche ok thanks mate 14:41
lizmat # the article predates the rename, but the content is still correct otherwise
ychaouche maybe I shouldn't read that article, as I was not a perl developer myself 14:43
I'm afraid to get confused
gfldex The confusion is not Perl specific. 14:44
lizmat ychaouche: the concept of binding and containers is important to get right in your mind when using Raku 14:45
ychaouche gfldex: it is article specific. it is comparing perl5 and perl6, I fear of getting lost when learning both languages
gfldex: better stick with raku
lizmat ychaouche++ 14:46
gfldex this might help then:
lizmat gfldex++
ychaouche thanks gfldex, it seems easy enough to read for beginners 14:47
not too long and paragraph headers do not introduce too many new concepts
gfldex Well, I'm not really happy with any of the docs we have. They don't state why we need binding to raw "things" and that can be quite important to understand what is really going on. 14:48
ychaouche oh, by the way, are lists a data type in raku or is still an internal structure not really meant to be used by the developer ?
gfldex Unless you do fancy stuff, just stick to sigiled variables.
lizmat ychaouche: lists are first class citizens in Raku 14:49
however, their contents *can* be mutable if elements are bound to a container
ychaouche "For a deeper discussion of the various kinds of ordered containers in Raku, see the overview of lists, sequences, and arrays; for unordered containers, see sets, bags, and mixes" 15:08
are raku "containers" what other languages may call "collections" ? 15:09
a data structure where you can put more than one value 15:10
hum, no 15:11
even single value data is a container (scalar) 15:12
can't understand this yet : f() = 42; 15:17
lizmat that function f() returns a container 15:18
m: sub foo() is raw { my $ }; foo() = 42
camelia ( no output )
lizmat m: my $bar; sub foo() is raw { $bar }; foo() = 42; say $bar 15:19
camelia 42
lizmat the "is raw" on the sub makes sure it doesn't de-containerize (which is the default)
ychaouche is "is rw" the same as "is raw" ? 15:20
lizmat m: my $bar; sub foo() is rw { $bar }; foo() = 42; say $bar 15:21
camelia 42
lizmat in this context, yes
ychaouche oh...
so they're really different things 15:22
I was making sure it's not syntactic sugar
otherwise rw is like read/write ?
lizmat m: sub foo($a is rw) { dd }; foo 42 # another context for "is rw"
camelia Parameter '$a' expects a writable container (variable) as an argument,
but got '42' (Int) as a value without a container.
in sub foo at <tmp> line 1
in block <unit> at <tmp> line 1
lizmat m: sub foo($a is rw) { dd }; my $b = 42; foo $b 15:23
camelia sub foo($a is rw)
lizmat (a bare dd just shows the sub / method with signature it is called in
m: sub foo($a is raw) { dd }; foo 42 # with "is raw" it will just bind to the constant 15:24
camelia sub foo($a is raw)
ychaouche "In order to mutate attributes in Raku, you must use the is rw trait on the attributes:" 15:42
so, by default, all attributes are immutable ? 15:43
lizmat public attributes are set at object creation time by default, and then immutable from the outside
a class may change any attribute using the private attribute syntax
m: class A { has $!a; method foo() { $!a = 42 }; method bar() { $!a } }; my $a =; say $; $; say $ 15:44
camelia (Any)
ychaouche so the "!" is for private ? 15:47
lizmat yeah, ! used as a twigil means private 15:50
. used as a twigil means public 15:51
ychaouche are twigils mandatory or can you have "has $attribute" ? 15:53
lizmat you actually can, but there's talk of having that form deprecated 15:55
so better not learn that now :-)
ychaouche ok 15:58
is andrew shittov around ?
lizmat andrew usually doesn't hang out on IRC 15:59
ychaouche ok
just found his course on a bing search
lizmat but he hangs out on Twitter: @andrewshitov
ychaouche nice to know, thanks 16:00
thanks all of you 16:07
maybe next time
16:07 ychaouche left
stevied OK, thanks for feedback on subclassing IO::Path 16:20
I tried a million different things to try to subclass it properly. None of them worked. 16:21
I found a module that did do it but it used some nqp to pull it off using a function called `augment` 16:22
lizmat yeah... augment is not a good idea generally :-( 16:23
stevied 16:24
according to docs, you can't give the object attributes when augmented 16:29
raiph said to avoid trying to subclass it and use an attribute to delegate to IO::Path
how so I submit a rakudo issue? 16:31
lizmat 16:46
17:03 A26F64 left
stevied ok,, thanks. writing something u 17:14
17:36 dakkar left