🦋 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. |
|||
SmokeMachine | xinming_: www.irccloud.com/pastebin/VG7hKIbp/ | 00:06 | |
xinming_: it's working, but gives an error if you not pass a Ble to your Ble... | 00:08 | ||
xinming_: it's working, but gives an error if you not pass a Ble to your Bla... | |||
xinming_: the important part is: `has UInt $!ble-id is column{ :references{ Ble.id }, :!nullable }` | 00:14 | ||
00:23
Doc_Holliwood left
00:25
redable left,
ggoebel left
00:28
lucasb left
|
|||
SmokeMachine | red: model Bla { ... }; model Ble { has $!id is serial; has Bla @.blas is relationship{ .ble-id } }; model Bla { has $!id is serial; has UInt $!ble-id is column{ :references{ Ble.id }, :!nullable }; has Str $.name is column; has Ble $.ble is relationship{ .ble-id } }; my $*RED-DB = database "SQLite"; Bla.^create-table; Ble.^create-table; Ble.^create: :blas[{:name<bla>}, {:name<ble>}]; .say for Bla.^all; Bla.^create: | 00:39 | |
:name<bli> | |||
00:40
redable joined
|
|||
SmokeMachine | red: model Bla { ... }; model Ble { has $!id is serial; has Bla @.blas is relationship{ .ble-id } }; model Bla { has $!id is serial; has UInt $!ble-id is column{ :references{ Ble.id }, :!nullable }; has Str $.name is column; has Ble $.ble is relationship{ .ble-id } }; my $*RED-DB = database "SQLite"; Bla.^create-table; Ble.^create-table; Ble.^create: :blas[{:name<bla>}, {:name<ble>}]; .say for Bla.^all; Bla.^create: | 00:40 | |
:name<bli> | |||
00:40
redable left
|
|||
SmokeMachine | red: model Bla { ... }; model Ble { has $!id is serial; has Bla @.blas is relationship{ .ble-id } }; model Bla { has $!id is serial; has UInt $!ble-id is column{ :references{ Ble.id }, :!nullable }; has Str $.name is column; has Ble $.ble is relationship{ .ble-id } }; my $*RED-DB = database "SQLite"; Bla.^create-table; Ble.^create-table; Ble.^create: :blas[{:name<bla>}, {:name<ble>}]; .say for Bla.^all; Bla.^create: | 00:43 | |
:name<bli> | |||
01:46
ggoebel joined
|
|||
Geth | problem-solving/old-issue-tracker: 57f7054251 | (Aleks-Daniel Jakimenko-Aleksejev)++ | solutions/rakudo/Old-Issue-Tracker-Dismantling-Plan.md Mention others too |
02:06 | |
problem-solving/old-issue-tracker: 57f2e8ebb8 | (Aleks-Daniel Jakimenko-Aleksejev)++ | solutions/rakudo/Old-Issue-Tracker-Dismantling-Plan.md Mention that perl6/ will likely not be “perl6/” later |
|||
03:19
ZzZombo joined
|
|||
Geth | ecosystem: 9b15b778ca | tony-o++ (committed using GitHub Web editor) | META.list sqlite orm |
03:42 | |
04:30
marcusr left,
marcusr joined
06:20
epony left
|
|||
discord6 | <Aearnus> does cro/cro::webapp have anything like partials | 06:39 | |
<Aearnus> a-la ruby on rails' <%= render ... %> | |||
<Aearnus> I couldn't find anything like that online | 06:40 | ||
<Aearnus> aha, cro::webapp provides <:use '...'> | |||
<Aearnus> 😄 | 06:41 | ||
Geth | doc: 3b828abad6 | (Stoned Elipot)++ | doc/Language/classtut.pod6 Pursue .WHAT removal - Sync output with code example - Update code example description - Advise .^name usage |
06:48 | |
doc: 9fc140b745 | (Juan Julián Merelo Guervós)++ (committed using GitHub Web editor) | doc/Language/classtut.pod6 Merge pull request #3074 from stoned/classtut-no-what Pursue .WHAT removal We can discuss whether .WHAT should be removed from this particular document, but this PR just makes the text match the example. |
|||
07:08
sena_kun joined
07:12
Doc_Holliwood joined
07:24
Voldenet joined
09:06
sarna joined
09:32
xinming_ left
09:34
xinming_ joined
09:39
Doc_Holliwood left
10:09
cpan-raku left
10:10
cpan-raku joined,
cpan-raku left,
cpan-raku joined,
chloekek joined
10:55
chloekek left
10:59
sarna left
11:05
sena_kun left
11:21
sena_kun joined
11:23
sena_kun left
|
|||
tbrowder | tony-o: hi, how do you create a "unique(field1, field2)" constraint in xoo? | 11:24 | |
xinming_ | SmokeMachine: When a has_many relationship is defined, How can we further filter the has_many? | 11:26 | |
For example, $object.has_many_items.^load: xxxx; | |||
When I try this, I got ` No such method 'load' for invocant of type 'Perl6::Metamodel::ClassHOW'. Did you mean 'head'?` | 11:27 | ||
SmokeMachine: Got it, It's a bit confusing that some api are not "unified", we need to use .grep instead of .^grep, `Model.^load: 1;` works, but `$xx-object.has_many_items.^load: 1;` doesn't. with has_many_items relationship, We need to use $xx-object.has_many_items.grep: ...; The API is bit confusing. | 11:34 | ||
11:38
xinming_ left
11:39
xinming_ joined
|
|||
xinming_ | SmokeMachine: Also, How do we do multi-key primary key? ;-) | 11:48 | |
SmokeMachine: Also, the way to get all columns from a row. | 12:10 | ||
12:15
markmarkmark joined
|
|||
SmokeMachine | xinming_: $obj.has-many.first: *.name eq “bla” | 12:21 | |
xinming_: you can have multiple `is id` fields... | 12:26 | ||
xinming_: the obj has all columns... | 12:27 | ||
12:30
markmarkmark is now known as markmark
12:32
stoned75 joined
12:37
chloekek joined
12:38
markmark is now known as markmarkmark
12:50
Doc_Holliwood joined
12:59
lucasb joined
|
|||
SmokeMachine | xinming_: `$obj.has-multi` returns an ResultSeq, so, you can do with it anything you would do with `Model.^all`... | 13:12 | |
13:27
xinming_ left,
xinming_ joined
13:33
Kaeipi left
13:36
epony joined
13:42
chloekek left
|
|||
SmokeMachine | xinming_: have you seen my answers? | 13:44 | |
xinming_: colabti.org/irclogger/irclogger_lo...-10-26#l76 | 13:45 | ||
13:45
cpan-raku left
|
|||
SmokeMachine | .tell xinming_ colabti.org/irclogger/irclogger_lo...-10-26#l76 | 13:46 | |
tellable6 | SmokeMachine, I'll pass your message to xinming_ | ||
13:47
cpan-raku joined,
cpan-raku left,
cpan-raku joined
14:16
stoned75 left,
stoned75 joined
|
|||
SmokeMachine | red: model Bla { ... }; model Ble { has $!id is serial; has Bla @.blas is relationship{ .ble-id } }; model Bla { has $!id is serial; has UInt $!ble-id is column{ :references{ Ble.id }, :!nullable }; has Str $.name is column; has Ble $.ble is relationship{ .ble-id } }; my $*RED-DB = database "SQLite"; Bla.^create-table; Ble.^create-table; Ble.^create: :blas[{:name<bla>}, {:name<ble>}]; .say for Bla.^all; Bla.^create: | 14:26 | |
:name<bli> | |||
14:31
Doc_Holliwood left
14:47
xinming_ left
14:50
xinming_ joined
|
|||
xinming_ | SmokeMachine: Thanks. | 15:05 | |
tellable6 | 2019-10-26T13:46:01Z #raku <SmokeMachine> xinming_ colabti.org/irclogger/irclogger_lo...-10-26#l76 | ||
xinming_ | I'll reconnect, bll | 15:06 | |
SmokeMachine: What I mean is, wether there is a method to call, so we can get all columns data from model. | |||
15:06
xinming_ left
15:10
xinming joined
|
|||
xinming | back with new config, seems ssl on freenode will kill me for a period. | 15:10 | |
SmokeMachine | xinming_: Model.^columns | ||
xinming | SmokeMachine: How about the object? | ||
SmokeMachine | xinming: $obj.^columns | 15:11 | |
xinming | SmokeMachine: the ^columns returns an Hash with values? | 15:12 | |
SmokeMachine | xinming: no, a list of `Attribute`s | ||
ZzZombo | Remind me if I can declare custom `has` traits? | 15:13 | |
SmokeMachine | ZzZombo: sorry, what do you mean? | 15:14 | |
ZzZombo | I know you can declare custom `is` traits, but back then couldn't `has`. Did that change? | 15:15 | |
SmokeMachine | not that I know.. | 15:17 | |
red: say 42 | 15:19 | ||
15:21
xinming left,
xinming joined
|
|||
vrurg | ZzZombo: you can't declare a custom trait yet. Not sure if it ever be possible. | 15:21 | |
ZzZombo | But why not? What's the difference between "is" and "has" that allows to declare the former and not the latter? | 15:22 | |
15:22
redable joined
|
|||
vrurg | ZzZombo: the difference is in grammar. Traits are handled individually each one. | 15:24 | |
ZzZombo: actually, it should be possible to define a slang and add a custom trait. | 15:25 | ||
The problem with traits is that they have different syntax. | 15:26 | ||
vrurg is afk | |||
SmokeMachine | red: use Post; say Post.new.^columns # <- xinming | 15:29 | |
redable | SmokeMachine, [Int $!id Int $!author-id Str $!title Str $!body Bool $!deleted DateTime $!created Set $!tags] | ||
15:33
redable left
16:07
Doc_Holliwood joined
16:18
sena_kun joined
|
|||
xinming | red: use Post; say Post.new.^columns.map: { .perl.say }; | 16:22 | |
Why doesn't bot respond for me? | 16:24 | ||
red: "hello".say; | |||
timotimo | y'know, we could totally have something short for the evalbot where it'd give you a bunch of models with example data to play around with | 16:30 | |
like "use RedEx" :D | |||
and a specific output module that spits out CSV with headers, creating gists where the filename is (related to) the query code and the contents are the result as sortable/filterable tables | 16:33 | ||
SmokeMachine | xinming: I've turned it off... sorry | 16:45 | |
timotimo: it's a good idea... about the models, I've alread started: github.com/FCO/RedBot/tree/master/samples | 16:47 | ||
16:55
redable joined
|
|||
SmokeMachine | red: use Post; say Post.new.^columns.map: { .perl.say }; | 16:56 | |
redable | SmokeMachine, post.idpost.author_idpost.title...tags(True True True True True True True) | ||
16:56
pmurias joined
|
|||
pmurias | hi | 16:56 | |
tellable6 | 2019-10-26T16:40:14Z #raku-dev <MasterDuke> pmurias: any idea why github.com/MasterDuke17/nqp/commit...fcfdd891d9 doesn't work and gives this? gist.github.com/MasterDuke17/14d6d...3d13d13bb8 | ||
MasterDuke | hey hey | 16:57 | |
SmokeMachine | red: use Post; say Post.^columns.map: { .column.name }; | ||
redable | SmokeMachine, (id author_id title body deleted created tags) | ||
SmokeMachine | xinming: ^^ | 16:58 | |
pmurias: hi! | |||
timotimo: any idea of models we should have? | 17:07 | ||
timotimo | no idea ... the typical ones i guess?! | ||
todo application! states and their capitals around the world? | 17:08 | ||
veesh | a blog? | ||
that's the other classic | |||
uh.... ecommerce! | 17:09 | ||
SmokeMachine | red: say Post.^all.head.author # <- veesh | ||
redable | SmokeMachine, 04===SORRY!04=== Error while compiling /code/./code.p6Undeclared name: Post used at line 2 | ||
SmokeMachine | red: use Post; say Post.^all.head.author # <- veesh | 17:10 | |
redable | SmokeMachine, (Person) | ||
SmokeMachine | red: use Person; Person.^create: :name<SmokeMachine>, :posts[{:title("new post"), :body("A new post")}] | 17:11 | |
redable | SmokeMachine, gist.github.com/2fa3109ccbe52c8356...e9db16b74d | ||
SmokeMachine | red: use Post; say Post.^all.sort(*.id).tail.author # <- veesh | ||
redable | SmokeMachine, (Person) | ||
SmokeMachine | :( | 17:12 | |
red: use Post; .say for Post.^all | |||
redable | SmokeMachine, gist.github.com/b7b899950a0e06c5fc...175044de9d | ||
xinming | red: use Post; my Post $post .= new; $post does role { method columns-data () { my %colmap = self.^attr-to-column; %(self.^columns.map: { %colmap{.name} => .get_value(self) }); } }; $post.columns-data.perl.say; | 17:17 | |
redable | xinming, {:author_id(Any), :body(Any), :created(DateTime.new(2019,10,26,17,17,34.04522466659546)), :!deleted, :id(Any), :tags(set()), :title(Any)} | ||
xinming | red: use Post; my Post $post .= new; $post does role { method columns-data () { %(self.^columns.map: { .column.name => .get_value(self) }); }; $post.columns-data.perl.say; | 17:18 | |
redable | xinming, 04===SORRY!04=== Error while compiling /code/./code.p6Missing blockat /code/./code.p6:3------> 03<BOL>08⏏04<EOL> | ||
xinming | red: use Post; my Post $post .= new; $post does role { method columns-data () { %(self.^columns.map: { .column.name => .get_value(self) }); } }; $post.columns-data.perl.say; | ||
redable | xinming, {:author_id(Any), :body(Any), :created(DateTime.new(2019,10,26,17,18,59.74856209754944)), :!deleted, :id(Any), :tags(set()), :title(Any)} | 17:19 | |
xinming | red: use Post; my Post $post = Post.^all.head; $post does role { method columns-data () { %(self.^columns.map: { .column.name => .get_value(self) }); } }; $post.columns-data.perl.say; | ||
redable | xinming, {:author_id(Any), :body(Any), :created(DateTime.new(2019,10,26,17,19,35.81536102294922)), :!deleted, :id(Any), :tags(set()), :title(Any)} | ||
xinming | SmokeMachine: I mean, the columns-data returns the column-value map from the db directly. | 17:20 | |
I tried to write the meta method in MetaModelX::Red::Model | |||
Not enough understanding of it for now. | |||
SmokeMachine | red: use Post; my $post = Post.^all.head; $post.HOW does role :: { method column-values($obj --> Hash()) { $obj.^columns.map: { .column.name => .get_value: $obj } } }; say $post.column-values | 17:26 | |
redable | SmokeMachine, No such method 'column-values' for invocant of type 'Post' in block <unit> at ./code.p6 line 2 | ||
SmokeMachine | red: use Post; my $post = Post.^all.head; $post.HOW does role :: { method column-values($obj --> Hash()) { $obj.^columns.map: { .column.name => .get_value: $obj } } }; say $post.^column-values | ||
redable | SmokeMachine, {author_id => (Any), body => body-test1, created => 2019-10-22T12:00:19.196347Z, deleted => 0, id => 1, tags => set(), title => test1} | 17:27 | |
17:27
wildtrees joined
|
|||
SmokeMachine | xinming: ^^ | 17:27 | |
17:27
wildtrees left
|
|||
xinming | SmokeMachine: I get that version too. | 17:34 | |
I think you can add this meta method. | |||
It's useful. | |||
17:36
redable left,
chloekek joined
17:37
pmurias left
17:38
wildtrees joined,
pmurias joined
17:39
redable joined
18:26
gdonald left,
gdonald joined
18:27
stoned75 left
18:28
stoned75 joined
18:40
redable left
18:41
xinming left,
xinming joined
18:52
pmurias left
|
|||
xinming | SmokeMachine: termbin.com/cwav | 18:57 | |
SmokeMachine: This test script will raise a bug. Maybe multi column relationship is not perfect. | |||
SmokeMachine | red: termbin.com/cwav | 19:19 | |
19:21
Geth_ joined,
Geth left
|
|||
SmokeMachine | xinming: a relationship should point to a foreign key, not to a primary key... | 19:23 | |
19:24
redable joined
|
|||
SmokeMachine | red: termbin.com/cwav | 19:25 | |
redable | SmokeMachine, Successfully fetched the code from the provided URL | ||
SmokeMachine, 04===SORRY!04=== Error while compiling /code/./code.p6'EXPORTHOW::DECLARE::model' conflicts with an existing meta-object imported into this lexical scopeat /code/./code.p6:6------> 03use Red08⏏04; | |||
SmokeMachine | www.irccloud.com/pastebin/JY6hC3p0/ | 19:27 | |
red: www.irccloud.com/pastebin/raw/JY6hC3p0/ | 19:28 | ||
redable | SmokeMachine, Successfully fetched the code from the provided URL | ||
SmokeMachine, 04===SORRY!04=== Error while compiling /code/./code.p6'EXPORTHOW::DECLARE::model' conflicts with an existing meta-object imported into this lexical scopeat /code/./code.p6:5------> 03use Red08⏏04; | |||
19:28
pmurias joined
|
|||
SmokeMachine | www.irccloud.com/pastebin/QUqMTYof/ | 19:28 | |
red: www.irccloud.com/pastebin/raw/QUqMTYof/ | 19:29 | ||
redable | SmokeMachine, Successfully fetched the code from the provided URL | ||
SmokeMachine, gist.github.com/fe17b251363660ecf9...f9fe8b7990 | |||
SmokeMachine | xinming: ^^ | ||
xinming | SmokeMachine: Thanks, After adding the references, It worked. | ||
SmokeMachine: yea, Your slogan is right for Red, It's WIP, but quite usable. | 19:30 | ||
BTW, how is transaction handled? | |||
SmokeMachine | xinming: transactions are NYI | 19:31 | |
xinming | Ok, But for now, We can still wrap txn ourselves by manually get the dbh | 19:32 | |
19:33
pmurias left
|
|||
SmokeMachine | xinming: I'm happy you are liking it... :) | 19:33 | |
xinming: what parts you are geting more troubles? | 19:34 | ||
19:35
sena_kun left
19:38
stoned75 left,
pmurias joined
19:39
chloekek left
|
|||
xinming | SmokeMachine: Not much for now, maybe in the future, We may try customized sql function call, customized join | 19:56 | |
If customized join doesn't work, I can use view to do that, which is not a big problem ATM. | |||
Also customized baseclass for ResultSeq | 19:59 | ||
Maybe different class/role applied to the Row object based on different logic. | 20:00 | ||
20:02
redable left
20:04
gdonald left
20:06
pmurias left
20:08
Doc_Holliwood left,
chloekek joined
20:10
gdonald joined
20:11
wamba joined
20:13
pmurias joined
20:19
xinming left
20:20
xinming joined,
veesh left,
veesh joined
|
|||
xinming | m: my %h; my %y = %(x => %("a" .. "d")); %h.append(%y<x><a c>:p[], :x); %h.perl.say; | 20:35 | |
camelia | {:a("b"), :c("d")} | ||
xinming | How can I also append the :x to the %h? | ||
If I don't want to do it twice | |||
don't want to append %h twice | 20:36 | ||
m: my %h; my %y = %(x => %("a" .. "d")); %h.append(%(%y<x><a c>:p, :x)); %h.perl.say; | |||
camelia | {"a\tb c\td" => :x} | ||
xinming | m: my %h; my %y = %(x => %("a" .. "d")); %h.append(%(|(%y<x><a c>:p), :x)); %h.perl.say; | 20:37 | |
camelia | {:a("b"), :c("d"), :x} | ||
xinming | This one worked, But not perfect. | ||
Any ideas? | |||
I don't like the |(), As it might run out of memory IIRC | 20:39 | ||
timotimo | m: my %h; my %y = %(x => %("a" .. "d")); %h.push(%(|(%y<x><a c>:p), |(:x))); say %h.perl | 20:42 | |
camelia | {:a("b"), :c("d"), :x} | ||
timotimo | it's not shorter | 20:43 | |
SmokeMachine | m: my %h; my %y = %(x => %("a" .. "d")); %h = |%y<x>, :x; %h.perl.say | 20:44 | |
camelia | {:a("b"), :c("d"), :x} | ||
xinming | timotimo: there is | | 20:47 | |
timotimo | yes, true | ||
xinming | The reason I don't like | is, when you use it with push, It sometimes make program quit directly. | ||
Before I meet once, IIRC, the array is too large. | |||
so, I learnt @array[] and %xx<> | 20:48 | ||
timotimo | sounds like accidentally trying to expand an infinite sequence | ||
or maybe argument lists growing beyond the limit? | |||
xinming | timotimo: yes, arg lists growing beyond the limit | 20:50 | |
timotimo | ah, yes | ||
vrurg | m: sub DYNAMIC($name) { say "DYN $name"; 42 }; say $*no-var | 20:58 | |
camelia | DYN $*no-var 42 |
||
vrurg | heh... ;) | ||
A solution for the recent weekly. | 20:59 | ||
SmokeMachine | Creating a new file I had a good surprise! :) usercontent.irccloud-cdn.com/file/.../image.png | 21:02 | |
I didn't know this DYNAMIC sub... | 21:03 | ||
vrurg | SmokeMachine: this is how $* gets resolved. | ||
SmokeMachine | can you belive I got confused by model and module?!! :P | 21:06 | |
m: sub DYNAMIC($name) { say "DYN $name"; 42 }; say $*no-var; my $*yes-var = 42; say $*yes-var | |||
camelia | DYN $*no-var Cannot modify an immutable Int (42) in block <unit> at <tmp> line 1 42 DYN $*yes-var |
||
SmokeMachine | m: sub DYNAMIC($name) { say "DYN $name"; 42 }; say $*no-var; my $*yes-var = 13; say $*yes-var | ||
camelia | DYN $*no-var Cannot modify an immutable Int (42) in block <unit> at <tmp> line 1 42 DYN $*yes-var |
||
SmokeMachine | m: sub DYNAMIC($name) is rw { say "DYN $name"; $ //= 42 }; say $*no-var; my $*yes-var = 13; say $*yes-var | 21:07 | |
camelia | DYN $*no-var 42 DYN $*yes-var DYN $*yes-var 13 |
||
vrurg | SmokeMachine: oh, easily. Yesterday I was double-fixing a single simple condition. Messing up two similar words? Easily... ;) | ||
m: sub DYNAMIC($name) is raw { $ //= 42 }; $*no-var = 1; say $*yes-var | 21:08 | ||
camelia | 1 | ||
vrurg | m: sub DYNAMIC($name) is raw { state %h; %h{$name} }; $*no-var = 1; say $*yes-var; | 21:09 | |
camelia | (Any) | ||
SmokeMachine | vrurg: how is the original implementation? Does it leak memory? | 21:24 | |
vrurg | SmokeMachine: Sure, no. It only lookups for the requested symbols | 21:25 | |
SmokeMachine | m: sub DYNAMIC($name) is raw { state %h; %h{$name} }; for ^10 { $*no-var .= 1 }; say $*no-var | 21:26 | |
camelia | 5===SORRY!5=== Error while compiling <tmp> Missing required term after infix at <tmp>:1 ------> 3e %h; %h{$name} }; for ^10 { $*no-var .=7⏏5 1 }; say $*no-var expecting any of: dotty method or postfix |
||
SmokeMachine | m: sub DYNAMIC($name) is raw { state %h; %h{$name} }; for ^10 { $*no-var ~= 1 }; say $*no-var | 21:27 | |
camelia | 1111111111 | ||
SmokeMachine | m: {my $*no-var; for ^10 { $*no-var ~= 1 } }; # is this still storing 1111111111? | 21:28 | |
camelia | ( no output ) | ||
SmokeMachine | m: sub DYNAMIC(|c) is raw { say c; 1 }; { say $*no-var }; say $*no-var | 21:30 | |
camelia | \("\$*no-var") 1 \("\$*no-var") 1 |
||
vrurg | SmokeMachine: don't actually rely on this. I'm considering changing this and getting rid of the sub, moving the functionality into PseudoStash. | 21:31 | |
I don't feel good about possible accidental redefinition of the sub in a user code. | 21:32 | ||
21:36
pmurias left
21:38
pmurias joined
21:40
wamba left
|
|||
Geth_ | ¦ problem-solving: vrurg assigned to jnthn Issue Dynamic symbols resolution via &DYNAMIC is potentially a problem in user code github.com/perl6/problem-solving/issues/127 | 21:40 | |
rba | raku.org is serving github.com/perl6/perl6.org independently NOW. let me know if you find any issues. | 21:46 | |
22:04
wildtrees left
22:17
pmurias left
22:19
pmurias joined
|
|||
uzl[m] | m: class A { has $!n = 1; method n { $!n } }; A.new.n.say | 23:03 | |
camelia | 1 | ||
tellable6 | 2019-10-15T16:03:09Z #raku <jmerelo> uzl changes are agreed, but not yet deployed. Documentation should reflect what's already there. | ||
uzl[m] | .tell jmerelo Thanks for letting me know ;-)! | 23:04 | |
tellable6 | uzl[m], I'll pass your message to jmerelo | ||
uzl[m] | m: class A { has $.n = 1; method new { self.bless() } }; A.new.n.say | ||
camelia | 1 | ||
uzl[m] | So which one of these shows more intent? The end goal is that I don't want the client to set the attribute during construction. The first one declares a $! attribute and creates a method of the same name. The second one declares a $. attribute and then overrides the new method so as to avoid the client setting it. | 23:09 | |
jnthn | Well, the first isn't really possible to circumvent, whereas the second is by the client calling .bless or even .Mu::new(:1n) :) | 23:10 | |
uzl[m] | I'm inclined to go with the former, at the expense of creating a method that's already provided by Raku, since I don't have to mess with the object construction needlessly. | ||
jnthn | The other option you miss is declaring a `submethod BUILD() { $!n = 1 }`, since BUILD gives complete control of the construction at that inheritance level. | 23:11 | |
uzl[m] | Yeah, totally forgot about BUILD... ;-) | 23:14 | |
23:15
pmurias left
|
|||
uzl[m] | m: class A { has $.n; submethod BUILD() { $!n = 1} }; A.new(n => 5).n.say | 23:15 | |
camelia | 1 | ||
uzl[m] | Oh, great. It seems I wrongly assumed that the BUILD's signature needed to match whatever the bless method's capture is ( (:$n) in this case). | 23:20 | |
23:39
Kaiepi joined
23:43
gdonald left
|
|||
Geth_ | perl6.org: f37711cb14 | (Aleks-Daniel Jakimenko-Aleksejev)++ | 7 files Initial Raku changes Now that raku.org no longer redirects, I think it's time to start changing references to Perl 6. This is the first pass and I manually corrected just some of the pages. It is a bit hard because there are many different variations (with space, with no space, with unicode nbsp, with html entity), and sometimes it is part of “Rakudo Perl 6”, ... (5 more lines) |
23:47 | |
AlexDaniel | rba: ↑ | ||
23:48
lucasb left
|
|||
AlexDaniel | rba: https issue here: docs.raku.org/ | 23:51 | |
wrong certificate | |||
rba: same as modules.raku.org/ and everything else | |||
23:52
gdonald joined
|