|
00:55
maylay left
01:46
maylay joined
01:49
hulk joined
01:51
kylese left
02:07
vasko45355861 left
02:15
hulk left,
kylese joined
05:39
Sgeo left
05:43
Sgeo joined
06:46
bd3i left
06:55
Sgeo left
06:58
bd3i joined
07:02
abraxxa joined
07:10
dustinm` left
07:33
dustinm` joined
08:03
sorenson left,
sorenson joined
13:38
dicit joined
15:23
snobber left
15:24
snobber joined
15:51
lizmat left
16:53
human-blip left
16:55
human-blip joined
17:16
Sgeo joined
|
|||
| lucs | This raises the reasonable and understandable error "Illegally post-declared type Baz...": | 18:07 | |
| class Jub::Foo {has $.baz = Baz.new}; class Baz {} | |||
| But the following raises no complaints, and having a similar structure in my code is leading to problems which I can't understand and which I am having trouble to golf down, sorry: | |||
| class Baz::Foo {has $.baz = Baz.new}; class Baz {} | |||
| What's up with that? | |||
| [Coke] | m: class Baz::Foo {has $.baz = Baz.new}; dd Baz | 18:08 | |
| camelia | Baz | ||
| lucs | I think I can fix my problem by using the canonical solution to the "Doctor, it hurts when I do this." | 18:11 | |
| problem. | |||
| But I don't get it. | |||
| ugexe | something like class Baz::Foo creates an empty Baz | ||
| lucs | Oh, huh. | 18:12 | |
| ugexe | m: class Foo::Bar { }; say ::("Foo") | ||
| camelia | (Foo) | ||
| ugexe | m: class FooX::Bar { }; say ::("Foo") | ||
| camelia | No such symbol 'Foo' in block <unit> at <tmp> line 1 |
||
| lucs | I'll see if changing the order of my declarations fixes things, or maybe report a more understandable error. | 18:14 | |
| Voldenet | Baz in the case of `class Baz::Foo { has $.baz = Baz.new; }` is a package | 18:41 | |
| so it's correct identifier | |||
| m: class Baz::Foo { has $.baz = Baz.new }; say Baz.HOW; # relevant example | 18:43 | ||
| camelia | Perl6::Metamodel::PackageHOW.new | ||
| Voldenet | but it becomes a ClassHOW in runtime | 18:44 | |
| if you define a class | |||
| m: class Baz::Foo { has $.baz = Baz.new }; BEGIN say Baz.HOW; say Baz.HOW; class Baz {} | |||
| camelia | Perl6::Metamodel::PackageHOW.new Perl6::Metamodel::ClassHOW.new |
||
| Voldenet | it kinda makes sense but perhaps stubbing the class for sanity reasons is a good idea | 18:45 | |
| m: class Baz { … }; class Baz::Foo { has $.baz = Baz.new }; BEGIN say Baz.HOW; say Baz.HOW; class Baz {} | |||
| camelia | Perl6::Metamodel::ClassHOW.new Perl6::Metamodel::ClassHOW.new |
||
|
18:52
lizmat joined
|
|||
| Voldenet | in which case if you forgot or misdeclare the class, you'll get an error instead of silent runtime errors | 18:53 | |
| m: class Baz { … }; class Baz::Foo { has $.baz = Baz.new }; BEGIN say Baz.HOW; say Baz.HOW; # relevant example | 18:54 | ||
| camelia | Perl6::Metamodel::ClassHOW.new The following packages were stubbed but not defined: Baz |
||
| Voldenet | keep in mind that this behavior is rakudo-specific - mutsu and rakupp treat Baz as class always, so I'm not sure if that's specified | 18:56 | |
| lucs | Voldenet: Wow. That's pretty advanced stuff for the little I understand of Raku's metatmodel. | 19:17 | |
| Thanks for the explanation anyway, I'm copy/pasting it for future reference when I'm a bit more knowledgeable :-) | 19:18 | ||
|
19:18
abraxxa left
|
|||
| Voldenet | it's all implementation-specific and boils down to "pre-define class for extra sanity" :> | 19:19 | |
| lucs | Yep :-) | 19:20 | |
| Anyway, turns out my real problem was something else, which I now have managed to golf down and will gist momentarily. | 19:22 | ||
|
20:02
lizmat left
20:04
lizmat joined
20:19
eseyman left
20:20
manu_ joined
|
|||
| lucs | Bah, no gist necessary. | 20:35 | |
| Turns out my grammar was using an actions class that had an attribute of the same name as one of the grammar rules, 'foo', apparently colliding with the actions method of the same name, whether or not the actions class defines that method or not. | |||
| Took me a while to figure out because the error I was getting was "Too many positionals passed; expected 1 argument but got 2", reported at the 'Foo.new' line here: `class Actions {... has $.foo = Foo.new; ...}`. | 20:36 | ||
| My class Foo had no 'new' method, so I'm not sure what that "2 arguments" is about. | |||
| Anyway, simply changing the name of the rule fixed it. | |||
| lizmat | if the attribute was public ($.foo) it would create an accessor method in the Actions class | 20:37 | |
| so unless you defined a method by that name in the actions class, it would call that accessor method | |||
| lucs | Makes sense, but why the "2 arguments"? | 20:38 | |
| lizmat | since the accessor method only takes one argument (the invocant), and the grammar calls the method with $/ as the positional argument | ||
| lucs | Aaah. | 20:39 | |
| lizmat | the accessor was called with $action.foo($/) which is 2 args | ||
| lucs | Gotcha. | ||
| lizmat | guess I should add an extra check in raku.land/zef:lizmat/actions for that | 20:40 | |
| lucs | Oh, interesting concept there. | 20:41 | |
| [Coke] | when constructing a raku script to use in a command pipeline, is there a way to avoid Failed to write 96 bytes to filehandle: Broken pipe | 21:07 | |
| (and a huge backtrace) | 21:08 | ||
| Voldenet | for more bearable error maybe prefix it with `try` | 21:21 | |
| and for absolutely no error `$*OUT.out-buffer = 0; try { … }` | 21:25 | ||
| (though it's slower) | |||
| hm, there's another way that practically works… | 21:31 | ||
| but it's awful # use NativeCall; sub _exit(int32) is native { * }; try { … }; _exit(0) | |||
| I've checked that prefixing any code with just `use NativeCall; sub _exit(int32) is native { * }; LEAVE _exit(0);` works on my box | 21:42 | ||
|
21:43
silug left
|
|||
| Voldenet | but I've failed to package it into a module and it's not really nice way to exit a process anyway | 21:44 | |
|
22:18
Sgeo left
22:19
Sgeo joined
22:42
human-blip left
22:48
jargan joined,
shareable6 left,
notable6 left,
releasable6 left,
bisectable6 left,
sourceable6 left,
bloatable6 left
22:49
jast left,
human-blip joined
22:50
nativecallable6 left,
quotable6 left,
unicodable6 left
22:51
releasable6 joined,
notable6 joined,
nativecallable6 joined,
quotable6 joined,
shareable6 joined,
unicodable6 joined,
bloatable6 joined,
bisectable6 joined,
sourceable6 joined
22:52
bloatable6__ joined
22:56
bloatable6 left
22:58
unicodable6 left
23:00
nativecallable6 left,
quotable6 left
23:01
nativecallable6 joined,
quotable6 joined,
bloatable6__ left,
bisectable6 left,
sourceable6 left,
unicodable6 joined
23:02
notable6 left
23:03
notable6 joined
23:04
bisectable6 joined,
bloatable6 joined,
sourceable6 joined,
bloatable6__ joined,
releasable6 left,
shareable6 left
23:05
releasable6 joined,
shareable6 joined
23:08
bloatable6 left
23:11
unicodable6 left,
unicodable6 joined,
notable6 left,
nativecallable6 left,
quotable6 left
23:12
bisectable6 left,
sourceable6 left
23:13
bloatable6__ left,
notable6 joined
23:14
releasable6 left,
shareable6 left
23:15
quotable6 joined,
nativecallable6 joined,
releasable6 joined,
shareable6 joined,
shareable6__ joined,
bisectable6 joined,
sourceable6 joined
23:16
bloatable6 joined
23:19
shareable6 left
23:20
unicodable6 left
23:21
notable6 left
23:23
unicodable6 joined,
quotable6 left,
releasable6 left
23:24
bisectable6 left,
sourceable6 left,
notable6 joined
23:25
bloatable6 left,
bisectable6 joined,
sourceable6 joined
23:26
bloatable6 joined,
nativecallable6 left
23:27
quotable6 joined,
nativecallable6 joined,
releasable6 joined
23:28
shareable6__ left
23:29
shareable6 joined,
shareable6__ joined
23:33
unicodable6 left,
unicodable6 joined,
shareable6 left,
notable6 left
23:34
bisectable6 left,
sourceable6 left
23:35
bloatable6 left
23:36
quotable6 left,
nativecallable6 left,
releasable6 left
23:37
nativecallable6 joined,
quotable6 joined,
releasable6 joined,
notable6 joined,
bisectable6 joined,
sourceable6 joined
23:38
bloatable6 joined,
shareable6__ left,
bloatable6__ joined
23:39
shareable6 joined,
shareable6__ joined
23:41
unicodable6 left
23:43
bloatable6 left,
shareable6 left
23:44
unicodable6 joined
23:46
nativecallable6 left,
quotable6 left,
releasable6 left,
notable6 left,
bisectable6 left,
sourceable6 left,
releasable6 joined,
notable6 joined,
nativecallable6 joined,
quotable6 joined
23:47
bisectable6 joined,
sourceable6 joined,
bloatable6__ left
23:48
shareable6__ left,
bloatable6 joined
23:51
shareable6 joined,
shareable6__ joined,
unicodable6 left
23:54
releasable6 left,
notable6 left,
nativecallable6 left,
quotable6 left,
unicodable6 joined
23:55
shareable6 left
23:56
bisectable6 left,
sourceable6 left
23:57
notable6 joined,
quotable6 joined,
nativecallable6 joined,
bisectable6 joined,
releasable6 joined,
sourceable6 joined,
bloatable6 left
23:58
bloatable6 joined,
shareable6__ left
|
|||