🦋 Welcome to the MAIN() IRC channel of the Raku Programming Language (raku.org). This channel is logged for the purpose of keeping a history about its development | evalbot usage: 'm: say 3;' or /msg camelia m: ... | Log inspection is getting closer to beta. If you're a beginner, you can also check out the #raku-beginner channel! Set by lizmat on 25 August 2021. |
|||
00:00
linkable6 joined,
evalable6 joined
00:02
reportable6 left
00:49
lichtkind left
00:52
oodani left
00:53
oodani joined
00:55
Xliff left
01:43
frost joined
01:44
justsomeguy joined
02:44
linkable6 left,
evalable6 left
02:49
[Coke] left
02:51
[Coke] joined
03:22
zacts left
03:34
justsomeguy left
03:45
linkable6 joined
03:47
evalable6 joined
04:00
holyghost left
05:00
notable6 left,
benchable6 left,
nativecallable6 left,
committable6 left,
bisectable6 left,
squashable6 left,
releasable6 left,
quotable6 left,
bloatable6 left,
unicodable6 left,
evalable6 left,
statisfiable6 left,
greppable6 left,
coverable6 left,
shareable6 left,
sourceable6 left,
tellable6 left,
linkable6 left,
linkable6 joined,
sourceable6 joined,
tellable6 joined
05:01
coverable6 joined,
squashable6 joined,
unicodable6 joined,
evalable6 joined
05:02
benchable6 joined,
nativecallable6 joined
05:19
stoned75 left
|
|||
tonyo | codesections: that seems fine to me .. it's not re-binding 'nope' and 'yep'. it's rebinding something currently pointing at 'yep' to 'nope'. | 05:19 | |
05:35
codesections left
05:36
codesections joined
05:58
ufobat_ joined
06:01
releasable6 joined,
statisfiable6 joined
06:05
reportable6 joined
|
|||
moritz_ | but aren't function params supposed to be ready-only by default? | 06:06 | |
putting an "Any" in front should not change that | |||
moon-child | m: sub f(Any $x) { $x := 5 }; f my $x = 6; say $x | 06:09 | |
camelia | 6 | ||
moon-child | I do not understand why Any changes things, though | 06:10 | |
moritz_ | it shouldn't, and that's a bug | 06:14 | |
07:00
quotable6 joined,
notable6 joined
07:02
committable6 joined
07:13
Sgeo left
07:24
sena_kun joined
07:46
lichtkind joined
07:57
dogbert17 left
08:00
greppable6 joined
08:01
bisectable6 joined
08:07
dakkar joined
|
|||
MasterDuke | committable6: releases sub f(Any $x) { $x := 5 }; f my $x = 6; say $x | 08:16 | |
committable6 | MasterDuke, ¦releases (58 commits): «6» | ||
MasterDuke | committable6: releases sub f($x) { $x := 5 }; f my $x = 6; say $x | 08:17 | |
committable6 | MasterDuke, ¦releases (58 commits): «04===SORRY!04=== Error while compiling /tmp/Bdk9j60ANyCannot use bind operator with this left-hand sideat /tmp/Bdk9j60ANy:1------> 03sub f($x) { $x := 5 08⏏04}; f my $x = 6; say $x «exit code = 1»» | ||
08:25
dogbert17 joined
08:31
discord-raku-bot left
08:32
discord-raku-bot joined
09:00
bloatable6 joined
09:04
abraxxa left
09:06
abraxxa joined
10:01
shareable6 joined
11:01
linkable6 left,
evalable6 left
11:02
linkable6 joined
11:39
TheAthlete joined
11:55
Guest28 joined
11:58
Guest28 left
12:02
reportable6 left
12:03
evalable6 joined
12:11
whatnext joined
|
|||
whatnext | hello all - quick question about classes and required attributes | 12:12 | |
in the docs for the "required" trait here: docs.raku.org/language/typesystem#...s_required it seems to include `submethod BUILD` and pass `$attr` to `$!attr` - I am guessing this is in order to prevent the error message "attr is required but not provided" | 12:15 | ||
however, this seems a bit ugly (e.g. when compared to Moose). If there are 10 required params then this needs to be done with all 10 (?) Is there a way to avoid having to include that `BUILD` method? | 12:17 | ||
(ie and still pick up the required param from the input) | |||
? | 12:18 | ||
12:18
TheAthlete left
|
|||
lizmat | why do you need BUILD? | 12:19 | |
tbrowder | yep, that looks like a bad example | 12:23 | |
whatnext | to be honest I don't know that I do | ||
I assumed I could just pass the param in `.new( attr => $attr )` without needing BUILD, but that seems to produce the error "attr required but not provided" | 12:24 | ||
possibly I have something else wrong | |||
MasterDuke | m: class A { has $.b is required }; say A.new(b=>3) | 12:26 | |
camelia | A.new(b => 3) | ||
MasterDuke | m: class A { has $.b is required }; say A.new(b=>3).b | ||
camelia | 3 | ||
Geth | doc: 0a01431977 | (Tom Browder)++ (committed using GitHub Web editor) | doc/Language/typesystem.pod6 Update typesystem.pod6 BUILD not required in that example. |
12:27 | |
linkable6 | Link: docs.raku.org/language/typesystem | ||
whatnext | wait I think I got it - I need to define it as `$.attr` not `$!attr` | 12:29 | |
lizmat | m: class A { has $.a is required }; A.new | 12:31 | |
camelia | The attribute '$!a' is required, but you did not provide a value for it. in block <unit> at <tmp> line 1 |
||
lizmat | m: class A { has $.a is required }; dd A.new(a => 42) | ||
camelia | A.new(a => 42) | ||
lizmat | whatnext ^^ must be something else? | ||
oops, should backlog before writing :-) | 12:32 | ||
whatnext | yes I think you would need `BUILD` if you want to keep the attribute private | ||
tbrowder | m: class A { has $!a is required}; A.new | ||
camelia | The attribute '$!a' is required, but you did not provide a value for it. in block <unit> at <tmp> line 1 |
||
whatnext | ok its a relief that this isn't needed! Thanks | 12:33 | |
MasterDuke | m: class A { has $!b is required }; say A.new(b=>3) | ||
camelia | The attribute '$!b' is required, but you did not provide a value for it. in block <unit> at <tmp> line 1 |
||
lizmat | also, if you want an attribute to not be specifiable with .new, but you want it to have an accessor | 12:35 | |
you can use "is built(False)" | |||
MasterDuke | tbrowder: your commit was correct, since the example given used `$.attr`, but it might be good to add an example with `$!attr` and show that it errors unless you have the BUILD | ||
lizmat | m: class A { has $.a is built(False) = 42 }; dd A.new.a | ||
camelia | 42 | ||
lizmat | m: class A { has $.a is built(False) = 42 }; dd A.new(a => 666).a | 12:36 | |
camelia | 42 | ||
tbrowder | good point (but TWEAK instead...) | ||
codesections | and `is built` is doc'ed at docs.raku.org/type/Attribute#index...t_is_built | ||
lizmat | vice-versa, if you want something to be specifiable but *not* have an accessor: | ||
m: class A { has $!a is built = 42; method b() { $!a } }; dd A.new(a => 666).b | 12:37 | ||
camelia | 666 | ||
MasterDuke | tbrowder: no, it has to be BUILD, TWEAK is too late | ||
tbrowder | are you sure? | 12:38 | |
MasterDuke | m: class A { has $!b is required; submethod TWEAK(:$b) { $!b = $b } }; say A.new(b=>3) | 12:40 | |
camelia | The attribute '$!b' is required, but you did not provide a value for it. in block <unit> at <tmp> line 1 |
||
MasterDuke | m: class A { has $!b is required; submethod BUILD(:$b) { $!b = $b } }; say A.new(b=>3) | ||
camelia | A.new | ||
12:40
marmayr joined
12:42
marmayr left
12:54
whatnext left
|
|||
tbrowder | ok :-) | 13:02 | |
13:04
reportable6 joined
13:05
frost left
13:11
eseyman left
|
|||
Geth | doc: fe13e801de | (Tom Browder)++ (committed using GitHub Web editor) | doc/Language/typesystem.pod6 Update typesystem.pod6 Add an example with a private attribute. |
13:19 | |
linkable6 | Link: docs.raku.org/language/typesystem | ||
tbrowder | not finished yet... | 13:24 | |
[Coke] | I wonder if we should disallow doc edits through the web. :| | 13:28 | |
Geth | doc: 7c6e458d51 | Coke++ | doc/Language/typesystem.pod6 class keyword is case sensitive; missing } whitespace cleanup |
||
linkable6 | Link: docs.raku.org/language/typesystem | ||
tbrowder | [Coke]: i agree with that! it's too inviting or shooting from the hip | 13:30 | |
*for | |||
MasterDuke | can you make web edits be allowed, but only mergeable via PR? | 13:32 | |
[Coke] | We could encourage it, not sure if we could enforce it. | 13:33 | |
Eh. probably more interesting to consider switching to a regular release schedule on docs (so that edits aren't immediately pushed out) | 13:34 | ||
(maybe on the same schedule as the release of the software) | |||
codesections | I make doc edits through the web UI. I'm happy to stop, but that'd probably mean I'm less inclined to make minor fixes | 13:55 | |
(I do usually open a PR, though) | |||
re: a docs release schedule, I thought nothing is currently pushed out automatically – that it all waited on JJ to cut a release. Did that change? | 14:00 | ||
14:04
linkable6 left
14:05
linkable6 joined
|
|||
tbrowder | no complaint here, i *usually* do the same (see PR to fix my mess shortly) | 14:24 | |
14:25
Sgeo joined
|
|||
Geth | doc: tbrowder++ created pull request #3967: Clarify effect of 'is required' on a private attribute |
14:25 | |
tbrowder | i think it would help to add a following note about using a BUILD in either case would quell the error even though the user does not enter an explicit value with new. | 14:29 | |
m: class A { has $.a is required; submethod BUILD(:$a) { $!a = $a } }; A.new | 14:31 | ||
camelia | ( no output ) | ||
14:39
whatnext joined
|
|||
whatnext | next question :) : why would I get "Cannot look up attributes in a My::Class type object" ? | 14:40 | |
MasterDuke | you need an instance of the class | 14:41 | |
m: class A { has $.a = 4 }; say A.new.a; say A.a | 14:42 | ||
camelia | 4 Cannot look up attributes in a A type object in method a at <tmp> line 1 in block <unit> at <tmp> line 1 |
||
Altreus | whatnext: this confused me for ages. It's a "type object" of My::Class, not a My::Class-type object | ||
codesections | m: my Rat $r = 1/3; say $r.denominator | 14:43 | |
camelia | 3 | ||
MasterDuke | i wonder why that error doesn't suggest 'are you missing a .new?'? which error does that...? | ||
codesections | m: say Rat.denominator | ||
camelia | Cannot look up attributes in a Rat type object in block <unit> at <tmp> line 1 |
||
whatnext | hm... that would make sense, though I can't seem to make it fit with my situation | 14:46 | |
MasterDuke | m: class A { has $.a = 4; method foo(A:D:) { say "hi" } }; A.new.foo; A.foo | 14:48 | |
camelia | hi Invocant of method 'foo' must be an object instance of type 'A', not a type object of type 'A'. Did you forget a '.new'? in method foo at <tmp> line 1 in block <unit> at <tmp> line 1 |
||
MasterDuke | ^^^ that's what i was thinking of | ||
whatnext | I think I do have an instance of the class. I am trying to access e.g. `self.filename` from within a `load` method in an instance of the class | 14:52 | |
hm.. it's a good clue though, thanks :) | 14:54 | ||
codesections | you need to use $!filename to access an attribute from inside the class | ||
whatnext | I was wondering about that - so `self.filename` is not a good idea? | 14:59 | |
Altreus | m: class A { has $.a = 4; method foo { say self.a } }; A.new.foo | 15:02 | |
camelia | 4 | ||
Altreus | shrug | ||
m: class A { has $!a = 4; method foo { say self.a } }; A.new.\foo | |||
camelia | 5===SORRY!5=== Error while compiling <tmp> Malformed postfix call at <tmp>:1 ------> 3= 4; method foo { say self.a } }; A.new.7⏏5\foo |
||
Altreus | pardon me I'm sure | 15:03 | |
codesections | self.a (or $.a) call the `a` public method on A. Which works when there _is_ an `a` public method (including an auto-generated one) | 15:04 | |
and when A has been fully built | |||
Altreus | m: class A { has $!a = 4; }; | 15:06 | |
camelia | ( no output ) | ||
Altreus | ok it was probably that \ I put in by accident | ||
m: class A { has $!a = 4; method}; A.new.foo | |||
camelia | 5===SORRY!5=== Error while compiling <tmp> Missing block at <tmp>:1 ------> 3class A { has $!a = 4; method7⏏5}; A.new.foo |
||
Altreus | ?? where did my method body go | ||
stupid IRC client | |||
anyway | |||
15:19
holyghost joined
15:25
abraxxa left
|
|||
whatnext | ok thanks for the clarification :) | 15:30 | |
15:54
whatnext left
16:02
happy-dude left,
juanfra left,
demostanis[m] left,
AlexDaniel left,
cnx left,
CIAvash left
16:04
juanfra joined
16:25
AlexDaniel joined,
cnx joined,
happy-dude joined,
demostanis[m] joined,
CIAvash joined
16:36
dakkar left,
Altai-man joined
16:37
Altai-man left
17:11
Xliff joined
|
|||
holyghost | hi Xliff | 17:31 | |
Xliff | \o | 17:44 | |
18:02
reportable6 left
18:05
clarjon1 joined,
reportable6 joined
|
|||
[Coke] chuckles at github.com/rottytooth/rot8000 | 18:42 | ||
holyghost | lol, elvish rot13 | 18:59 | |
19:05
linkable6 left,
evalable6 left
19:06
evalable6 joined
20:04
stoned75 joined
|
|||
[Coke] | codesections: in www.codesections.com/blog/raku-lisp-impression/ (nice article!) you say IFFE when I think you mean IIFE. | 20:14 | |
20:41
stoned75 left
|
|||
codesections | [Coke] ah, yes, the more obscure Inherently Fabulous Function Expression. (thanks; fixed) | 20:47 | |
21:29
Oshawott joined
21:30
tejr left
21:33
archenoth left
21:34
eseyman joined
21:37
jgaz joined
21:59
djerius left,
ufobat_ left,
djerius joined
22:11
jgaz left
22:15
jgaz joined
22:19
jgaz left
22:36
tejr joined
|
|||
[Coke] | :) | 22:43 | |
23:07
linkable6 joined
|