🦋 Welcome to the MAIN() IRC channel of the Raku Programming Language (raku.org). Log available at irclogs.raku.org/raku/live.html . If you're a beginner, you can also check out the #raku-beginner channel!
Set by lizmat on 6 September 2022.
00:00 reportable6 left, reportable6 joined 00:13 kst joined 00:40 holyghost joined 01:17 hulk joined 01:18 kylese left 02:05 kotrcka left 02:09 rir_ joined, oodani left 02:11 oodani joined 02:12 rir left, merp left, xkr47 left, hulk left 02:13 kylese joined, polettix left, xkr47 joined 02:14 polettix joined, _________ left, _________ joined 02:15 kylese left, kylese joined 03:34 jpn joined 04:57 jpn left 05:02 merp joined 05:16 jpn joined 05:30 Sgeo left 06:00 reportable6 left 06:01 reportable6 joined 07:05 jpn left 07:52 linkable6_ left 07:55 linkable6_ joined 07:57 jpn joined 08:10 dakkar joined 08:22 haxxelotto joined 08:36 haxxelotto left 08:38 haxxelotto joined 08:46 sena_kun joined 08:47 linkable6_ left 08:48 linkable6_ joined 09:16 sena_kun left 09:22 jpn left 09:39 jpn joined
xinming github.com/jonathanstowe/Attribute-Lazy <--- Is this "feature" moved core? 09:41
10:07 abraxxa joined 10:12 abraxxa left 10:19 teatime left 10:29 abraxxa joined 11:19 admeliora joined 11:32 admeliora left 11:40 teatime joined 11:41 jpn left 12:00 reportable6 left, reportable6 joined
antononcube Does anyone have / know Raku Docker images (or specs from them) that have “DB:Pg” and “DB::SQLite” installed ? 12:15
lizmat xinming: not sure what your question is ? 12:22
12:26 haxxelotto left 12:30 holyghost left, holyghost joined 12:52 jpn joined
xinming lizmat: I saw in stackoverflow, someone said, Attribute::Lazy thing may be moved to core, So I'm not sure. 12:53
lizmat m: class A { has $.a is lazy } 12:54
camelia ===SORRY!=== Error while compiling <tmp>
Can't use unknown trait 'is' -> 'lazy' in an attribute declaration.
at <tmp>:1
expecting any of:
rw
readonly
box_target
leading_docs
trailing_do…
lizmat guess not :-*(
xinming lizmat: BTW, I think I found a bug, not sure it's bug in DBIish or core
!paste
?paste
lizmat we usually use something like gist.github.com 12:55
ab5tract any pastebin will do, of course 12:56
xinming pastebin.com/KnicMGC0 <--- With this script, We'll get eror 12:58
Cannot look up attributes in a VMNull type object. Did you forget a '.new'?
in block <unit> at raku-will-l
in block <unit> at raku-will-lazy-bug.raku line 10
lizmat m: class A { has $.a will lazy } 12:59
camelia ===SORRY!=== Error while compiling <tmp>
Missing block
at <tmp>:1
------> class A { has $.a will lazy ⏏}
expecting any of:
block or pointy block
lizmat m: class A { has $.a will lazy { "foo" } }
camelia ===SORRY!=== Error while compiling <tmp>
Can't use unknown trait 'will' -> 'lazy' in an attribute declaration.
at <tmp>:1
expecting any of:
lazy
xinming We need Attribute::Lazy
lizmat m: class A { has $.a will lazy({ "foo" }) }
camelia ===SORRY!=== Error while compiling <tmp>
Missing block
at <tmp>:1
------> class A { has $.a will lazy⏏({ "foo" }) }
expecting any of:
block or pointy block
xinming I think Attribute::Lazy is still not in core yet.
lizmat it most definitely is not 13:00
xinming But I don't think it's probably a Attribute::Lazy bug, Probably DBIish uses c bindings caused some bugs
Some c bindings affected the core.
13:01 jpn left
lizmat xinming: could you post a --ll-exception backtrace? 13:02
ab5tract xiinming: does it work as expected with a less complex thingy inside the lazy block? `has $.re will lazy { /foo/ }` or such?
lizmat golf: use Attribute::Lazy; class A { has $.a; has $.b will lazy { $!a } }; A.new.b 13:03
xinming pastebin.com/F4UdBcVk
lizmat Cannot look up attributes in a VMNull type object. Did you forget a '.new'?
xinming lizmat: yea, this is the shortest code to trigger the bug 13:04
13:04 jpn joined
xinming So it's a bug in Attribute::Lazy? 13:04
lizmat m: class A { }; use nqp; nqp::getattr(nqp::null, A, '$!') 13:07
camelia Cannot look up attributes in a VMNull type object. Did you forget a '.new'?
in block <unit> at <tmp> line 1
lizmat that's basically the error
looking at the generated QAST, it generates a nqp::getattr(self, A, '$!') 13:08
*but* no self is known in the "lazy" block
use Attribute::Lazy; class A { has $.a; has $.b will lazy { self } }; dd A.new.b # Mu 13:09
so there *is* a "self" known in that scope, it's just that it isn't getting set 13:10
xinming: but I did find a workaround 13:12
use Attribute::Lazy; class A { has $.a = 42; has $.b will lazy -> $self { $self.a } }; dd A.new.b 13:13
^^
xinming: the $self is just for clarity, it could be named anything 13:14
actually, a better workaround;
use Attribute::Lazy; class A { has $.a = 42; has $.b will lazy { .a } }; dd A.new.b # 42
the object *is* available as the topic inside the block, so instead of: $!dbh.prepare("SELECT 1"); 13:15
you should do: .dbi.prepare("SELECT 1"); 13:16
that's even one char less
13:17 haxxelotto joined
ab5tract that's really interesting actually. It might be a cool exercise to rewrite Attribute::Lazy in RakuAST 13:21
lizmat or just add it to core and allow: has $.b will lazy *.a
as syntax
xinming thanks 13:25
Yea, I think `-> $self` is more clear version
14:18 lizmat left, lizmat joined
tbrowder m: my $x = "\n"; say ($x ~~ /\n/).so 15:26
camelia True
tbrowder my $x = '\n'; say ($x ~~ /\n/).so 15:27
evalable6 False
tbrowder m: my $x = '\t'; say ($x ~~ /\t/).so 15:29
camelia False
tbrowder m: my $x = "\t"; say ($x ~~ /\t/).so 15:30
camelia True
tbrowder reality check. " vs ' with special chars and ~~ 15:31
hm, which quoting construct enables the equiv of ["\n", "\t"] without entering the double quotes? 15:49
m: my @a = qq[ \n \t]; say @a.gist 15:50
camelia [
]
tbrowder m: my @a = qq[\n]; say (@a[0] ~~ /\n/).so 15:52
camelia True
tbrowder looks like that's what i'm looking for 15:53
15:58 jpn left
tbrowder nope, not quite it... 16:05
16:08 haxxelotto left 16:15 linkable6_ left 16:16 haxxelotto joined 16:17 linkable6_ joined 16:18 linkable6_ left 16:20 linkable6_ joined 16:33 jgaz joined 16:45 dakkar left 16:50 linkable6_ left 16:51 linkable6_ joined 16:54 abraxxa left 17:17 squashable6 left 17:20 squashable6 joined 17:32 swaggboi joined 17:41 sena_kun joined 17:45 squashable6 left 17:47 squashable6 joined 18:00 reportable6 left 18:01 reportable6 joined 19:30 jpn joined 19:41 jpn left 19:58 linkable6_ left 20:00 linkable6_ joined 20:43 haxxelotto left 21:55 sftp left 21:57 sftp joined 22:25 kjp left 22:37 Sgeo joined 22:45 Sgeo left 22:46 Sgeo joined 22:47 sena_kun left