🦋 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.
thundergnat m: say Date(now) 00:11
camelia Type check failed in binding to parameter '$dateish'; expected Str but got Instant (Instant.from-posix(<85342309...)
in block <unit> at <tmp> line 1
tellable6 2020-05-11T15:41:16Z #raku <tigerpaws> thundergnat: Thanks, I'll have a look, with the understanding they are out of date.
thundergnat bisectable6: 2020.01 say Date(now)
bisectable6 thundergnat, Using old=2020.01 new=HEAD in an attempt to do what you mean
thundergnat, Bisecting by exit code (old=2020.01 new=110324d). Old exit code: 0
thundergnat, bisect log: gist.github.com/5c4297b65b3da90a89...dd1eddb18a
thundergnat, (2020-02-29) github.com/rakudo/rakudo/commit/d9...d198747f09
thundergnat sigh 00:12
submitted issue GH#3683 00:19
linkable6 GH#3683 [open]: github.com/rakudo/rakudo/issues/3683 Date(now) no longer works
cpan-raku New module released to CPAN! Sparrow6 (0.0.20) by 03MELEZHIK 02:08
jdv79 if there is a libicuuc.so shoudn't it just be "is native('icuuc')"? 02:21
jdv79 how does one handle an arg that is a pointer to a typedef enum? 02:56
eiro it seems there is no p6doc in the rakudostar bundle. is there something to install with zef? 05:43
jjmerelo Hey, I got in. Anyone else had trouble this morning getting in? 08:50
lizmat jjmerelo: no, I didn't 09:22
tellable6 lizmat, I'll pass your message to jjmerelo
lizmat clickbaits rakudoweekly.blog/2020/05/11/2020-...e-release/ 09:30
Dwarf I'm trying to write a dice roll program but it seems I'm getting stuck around line 16. I expected it to sum all the rolls, but it seems that since it's just one die it won't do that bpa.st/MTHA 10:20
So the result is always zero even if line 25 returns a number 10:21
Geth doc: JJ self-assigned False positives in routine-definitions.t github.com/Raku/doc/issues/3395
1bd6b05bfb | (JJ Merelo)++ | xt/routine-definitions.t
10:26
linkable6 DOC#3395 [open]: github.com/Raku/doc/issues/3395 [docs] False positives in routine-definitions.t
Geth doc: 5355f2ce93 | (JJ Merelo)++ | 2 files
Checked false positive, closes #3395
10:34
linkable6 DOC#3395 [closed]: github.com/Raku/doc/issues/3395 [docs] False positives in routine-definitions.t
hungrydonkey Hello,everyone. How to check two arrays have the same value? 10:36
Geth doc: 69cf105abf | (JJ Merelo)++ | 2 files
Eliminating two #3390 errors
10:38
doc: 369c4abe4d | (JJ Merelo)++ | 3 files
Eliminating several #3390 errors
linkable6 DOC#3390 [open]: github.com/Raku/doc/issues/3390 [docs][xt] xt/routine-definitions.t failures
Dwarf hungrydonkey: one & two should return the intersection of the arrays docs.perl6.org/language/operators#..._%E2%88%A9 10:39
Geth doc: d623c0a591 | (JJ Merelo)++ | doc/Type/Any.pod6
Latest fixes, closes #3390
10:40
linkable6 Link: docs.raku.org/type/Any
DOC#3390 [closed]: github.com/Raku/doc/issues/3390 [docs][xt] xt/routine-definitions.t failures
tbrowder .tell Altai-man_ I took care of completing Rakudo issus #3682. 11:43
tellable6 tbrowder, I'll pass your message to Altai-man_
Altai-man_ tbrowder++ 11:44
libertas hi, I've built a really small script to count the number of odd and even numbers in each line of text and print some statistics. 12:49
But it's very slow to run 12:50
can you please check whether there's something that is causing this slowness?
The script's in pastebin.com/uJYdqdPt
lizmat for "aa.txt".IO.lines -> $line 12:51
would not copy all lines into memory
also, the "values" is unnecessary
also, why not set up the %oe_count directly, why the extra @odd_evens array ? 12:54
[Coke] installed cro. raku -MCro::HTTP::Server -e1; runs for a bit then I get "Abort trap: 6". ... will update raku and report back. 12:57
(it's from 2020.01 vintage)
libertas it's only my first script :-) 12:58
Geth doc/master: 4 commits pushed by Coke++
libertas the "aa.txt" file has circa 26MB
lizmat then the for "aa.txt".IO.lines -> $line should be helpful already 12:59
libertas: if you switch odds and evens around, you could do: 13:01
my @pair = 0,0; @pair[$_ % 2]++ for @nrs 13:02
libertas good 13:03
lizmat or actually: @pair[$_ % 2]++ for $line.words[2..6]
[Coke] rakubrew.org still giving a cert error. Do we need to buy a new cert? 13:05
Dwarf SSL certificates are free with letsencrypt.org 13:06
Dwarf You probably meant a different kind of certificate huh 13:08
[Coke] (I am surprised to see that rakubrew is a binary file)
libertas I've changed the script but still it's as slow as before, although more idiomatic for sure 13:13
I'm evaluating raku and tcl for some work, and raku is 11x slower than tcl, which is a lot for my purposes 13:14
[Coke] Anything in particular that's slow? Sometimes rewriting as idiomatic raku can help with speedups. 13:16
lizmat libertas: what's the current version of your script? the gist appears unchanged?
[Coke] Can't run rakubrew binary on mac - it complains about not being able to verify the author. 13:18
libertas lizmat: it's pastebin.com/F4rrQGPS 13:20
sena_kun libertas, can you please provide a bit of test data you are using? Not necessarily exact one, but something for people to tests against. 13:22
libertas sena_kun: sure. In total, I'm testing aa.txt with 933000 lines. The first 1000 are in pastebin.com/J7N2W144 13:25
if that data is file aa.txt, then for f in {1..9}; do cat bb.txt >> cc.txt; done 13:28
sorry, {1..933} instead of {1..9} will give a file of some size 13:29
[Coke] (reinstalled raku, still getting the abort trap on raku -MCro::HTTP::Server -e1;)
libertas I can post the tcl script for you to compare relative speeds 13:30
I could try it in perl5, but don't know the language
[Coke] libertas: do you need to be keeping 'odd_evens' for anything other than the math? 13:40
I imagine keeping all those around has a cost.
Dwarf I have a text file with regexes on each line. I read these strings with 'file.txt'.IO.lines, but I want to read these as regex and not as Str type. I've tried .map(*.regex) but that's sadly not a thing. Any pointers?
libertas [Coke]: I need them just for the math 13:41
timotimo i wonder how much faster it would be to `split(" ", $line).skip(2).head(4)` 13:43
libertas: ^
timotimo Dwarf: you can write this: /<$variable>/ and it will interpret the contents of $variable as regex syntax and compile it for you. beware code execution, though. you must trust the input file for this to be ok 13:43
sena_kun golfed to gist.github.com/Altai-man/ecb0e116...ecc69f0e7f 13:44
[Coke] Dwarf: I think you want docs.raku.org/language/regexes#Reg...erpolation
sena_kun but it seems `split(' ')` is what takes the most time, everything else is cheap.
timotimo cool, there's the skip+head
sena_kun [Coke], regexes would be even slower I'm afraid.
Dwarf Ah! Awesome, thank you both 13:45
[Coke] so then if you have a $string, you can say $regex = / <$string> /;, I think
sena_kun It takes from ~290 to 350 milliseconds to me, but if you just leave `for "aa.txt".IO.lines -> $line { $line.split(' ') }` in the script it takes 180-230 milliseconds. 13:46
[Coke] sena_kun: I was answering Dwarf's question about regex there.
sena_kun *The whole script from 290 to 350
[Coke], oh, sorry, silly me.
I have to keep up with the converstaion better...
tobs fwiw, my take on "idiomatic" appears to be somewhat slower hastebin.com/ikacawopic.pl
sena_kun Anyway, I'd say both `.words` or `.split(' ')` seem like the main source of slowness here. 13:47
[Coke] wonder if a grammar would be faster. 13:49
timotimo are these numbers simple? do they need full number parsing? 13:50
timotimo if you don't expect a 0x or so in front, and no decimal point, you can just check the last character against 0, 2, 4, 6, 8 13:51
but since it's mostly the split that takes so long, that may not be worth anything much 13:52
[Coke] if the lines all have the same format, maybe substr is faster? 13:54
timotimo did anybody try race-ing it yet?
[Coke] ah, not quite the same length
sena_kun [Coke], they differ in length. :S
libertas timotimo: with your suggestion, run time dropped to half, from 1m48 to 55s
timotimo what? wow!
nice
still 5x slower than tcl, sadly 13:55
lizmat libertas: could you try gist.github.com/lizmat/ca60dd89924...c1dd1128f4 ?
timotimo lizmat: should it be head 5 or 4? 13:56
lizmat [2..6] was in the original code, no?
[Coke] lizmat: useless join at the end?
timotimo ah, that's inclusive, of course right 13:56
lizmat [Coke]: it's a map!
timotimo just some python brain damage :) :)
[Coke] oh 13:57
timotimo with just the 1k lines it finishes way too fast to measure sensibly :) :)
libertas: would it be representative to just repeat the 1000 lines you gave us a bunch of times?
libertas lizmat: it's quicker, 47s instead of 55 13:58
konvertex I have a good one as well. Did some more advent of code and that's a hefty-defty slowdown: gist.github.com/dweqv/3f686b6f4615...f813158d96 Part2 takes four times as long. And that type of puzzle comes up again later on. :(
libertas timotimo: yes, that's what I did, it's just an experiment for me
timotimo OK!
lizmat ok, now stick in a '.race(:batch(1024))" after the .lines and before the .map
timotimo ahaha, i should maybe have a moarvm with C optimizations enabled 13:59
lizmat libertas: ok, now stick in a '.race(:batch(1024))" after the .lines and before the .map 14:00
libertas timotimo: that is using all the cores... it's down to 15s 14:01
lizmat libertas: that's with the .race ?
libertas yes 14:02
lizmat cool!
you might want to twiddle a little with the 1024 value, try doubling it / halving it
libertas ok
thanks all 14:03
timotimo a quick profile shows Str's Numeric method takes the most time in sena's version 14:06
lizmat yeah, also in mine
timotimo i think libertas tried my optimization of only checking the last character, as a string, against the even digits 14:07
and got a 2x speedup
sena_kun would like to see the code for it
timotimo could it have been the 2..5 has been wrong? 14:11
have we been getting a Failure all this time?
lizmat that would have thrown in the % 2 , would it not ? 14:14
timotimo "1 20150103 22 48 49 30 31" 14:15
this line is what made my code wrong
libertas: how would you like this kind of datum to be interpreted?
timotimo oh whoops, when i catted the files together to make a bigger file i ended up with a double-sized line on each seam :D 14:17
libertas at this time I'm not interested in the date
timotimo an empty entry tripped up one of my versions :D 14:18
timotimo aww, ends-with can't be inlined because takenextdispatcher 14:28
lizmat huh? why would it need a next dispatcher ? 14:30
timotimo not sure, it just starts with takedispatcher, then takenextdispatcher
lizmat what are the ends-with parameters you're looking at ? 14:31
lizmat I mean, ends-with is pure nqp with an optional private method call if things go awry 14:32
it's a multi, but so are many other methods ? 14:33
timotimo i don't know much about the current dispatcher mechanism, only about the upcoming one %) 14:34
lizmat does substr-eq suffer from the same issue ? 14:36
timotimo i'm glad that at least $even and $odd being int are being incremented using a proper add_i instead of a call
timotimo yes it does 14:38
lizmat ok, than it's probably in the named parameter handling ? 14:43
timotimo cannot inline &infix:<->, cannot inline substr, cannot inline sink, but at least using eq on a "str" variable generates an actual eq_s op without a call 14:44
all of these prevented by takenextdispatcher
jnthn I thought the dispatcher stuff got reverted ahead of the last release? 14:45
timotimo perhaps it was brought back after the release
timotimo oh or maybe my nqp is old 14:45
Geth doc: tbrowder++ created pull request #3398:
Add warning info for sprintf use
14:46
timotimo i'll just rebuild my everything
timotimo i think my rakudo was wildly out of date :) 15:01
like 45 commits
timotimo much better 15:05
sorry about all the confusion!
[Coke] 'cro stub app app' dies for me with Abort Trap: 6 15:11
timotimo can you gdb that?
or lldb or whatever
anyway, with ends-with, all the ends-withs are inlined 15:12
but calculating the end position once and using substr-eq may be more efficient
[Coke] running lldb on cro seems painful, since it's a script calling a script calling ... 15:13
timotimo also, ends-with grabs the string out of the self twice in a row. i wonder if it's possible to get that faster
oh crap good point
gdb can "follow the child on every fork", but that could be wrong, too
ah, the obvious solution is core dumps
[Coke] finally installs brew so he can install gdb so he can .. 15:19
if I had gdb, how would I run 'cro stub...' under it? 15:24
timotimo normally you'd raku-gdb-m the script 15:27
[Coke] raku-gdb-m - not found 15:30
I assume it wasn't installed because I didn't have gdb when I ran the installer?
ah, no. perl6-gdb-m is installed...
timotimo oh, little oversight clearly 15:31
MasterDuke might have raku(do)-lldb-m
jdv79 so i learned today that icu suffixes their func names with the lib ver - there's no clever way around having to manually find that out beforehand, right? 15:32
MasterDuke some of those are only installed as rakudo-*, not raku
[Coke] MasterDuke++
jdv79 not a huge deal i guess
[Coke] so how to run the cro script with args? 15:33
jjmerelo [Coke] what do you mean? Can't you simply use args? (or, better, environment variables) (Just curious, I've used Cro only very shallowly) 15:37
[Coke] jjmerelo: in gdb
timotimo ok, substr-eq doesn't have to recalculate the position every time, but it does have to verify that the integer isn't a big integer and that it's not negative
jjmerelo [Coke] ah, OK. Don't know, but environment variables will still be transmitted, right? 15:38
timotimo actually 15:39
if you can get it to pause in between somehow
you can attach gdb to the running process at the right moment
ctrl-z can potentially do it if you manage to hit it when the right process is already started but hasn't crashed yet
[Coke] checking... 15:45
if I start cro, there are like 4 rakudo processes running doing precomp 15:46
haven't I lost the ability to follow the children at that point? 15:47
(5, not 4)
timotimo attaching to running processes goes by pid, so that should be fine 15:48
[Coke] I can't find the right process to connect to. looks like there are lot of short lived processes running with target=mbc, and by the time I try to connect to them, they're gone. Wonder where the parent process is. 16:26
... ah. cro is still calling to 'perl6', not 'raku'
Unable to find Mach task port for process-id 2087: (os/kern) failure (0x5). (please check gdb is codesigned - see taskgated(8)) 16:27
so, more work to do on my end to figure this out. :| 16:29
timotimo ah, of course 16:30
gdb isn't allowed to do stuff because security
which is a very sane thing to do as an OS 16:31
but annoying to deal with
is there a way to get around this with sudo perhaps?
[Coke] sudo gdb gets me further. if I don't have a rakudo with debug symbols enabled, is this going to be at all helpful? 16:32
jnthn Probably not, though it's only MoarVM that you need rebuild with them 16:33
[Coke] when I connect, I get: Error calling thread_get_state for GP registers for thread 0x1603 16:34
timotimo jnthn: i humbly petition we always build with debug symbols. opinions?
MasterDuke +1 from me. i always do and have noticed extremely minimal slowdown whenever i've bothered to compare 16:36
[Coke] if I continue from that point, the trap eventually happens, but gdb says "[Inferior 1 (process 2330) exited normally]" 16:36
jnthn I've noticed they can be misleading as heck when you have an optimized build. 16:37
Though maybe the info they give is better than nothing, if taken with the appropriate grain of salt
timotimo there's a way to get debug symbols split off from the main .so so they can be loaded in gdb afterwards
jnthn (The backtraces are generally OK, but values of variables in optimized builds can be all over the place.)
timotimo i think you don't even get line numbers without debug symbols
MasterDuke jnthn: misleading how? my usual build is optimized, but with debugging
[Coke] timotimo: (gdb) bt 16:38
#0 0x00007fff69066296 in ?? ()
MasterDuke oh, yeah. there are a lot of optimized out values
timotimo oh, may also want to MVM_JIT_DISABLE=1
jnthn MasterDuke: Often I see totally bogus values (doesn't even say optimized out)
timotimo hmm
jnthn Maybe latest versions of compilers etc. do better at it.
I've just learned that if I don't want to go on a wild goose chase because foo pointer is corrupt, I'd better debug a non-optimized build. 16:39
MasterDuke i'm using arch linux, so usually have pretty recent versions of stuff
[Coke] timotimo: MVM_JIT_DISABLE=1 # still abort traps, still get "exited normally" 16:40
timotimo disabling jit makes backtraces make more sense much of the time
i don't even know what trap number 6 would be. like it got signal 6, but some piece of code somewhere caught it and just called "exit(0)" for some reason?
Geth ¦ p6-sake: AlexDaniel self-unassigned “Sake” is overused, come up with something else github.com/perl6/p6-sake/issues/19 16:42
[Coke] stack overflow says trying to access memory you don't own (typically with strcpy)
timotimo how do you bp that
[Coke] bp? 16:43
found another suggesting "unhandled C++ exception"... :)
timotimo breakpoint 16:44
[Coke] how do I build a non-optimized build of rakudo? 16:45
(as opposed to a debug version) 16:46
[Coke] (MVM_SPESH_DISABLE=1 MVM_JIT_DISABLE=1 cro stub app app - still abort traps) 16:49
[Coke] needs to just give up on this and go full docker route. :| 16:51
timotimo sorry coke, i'm sidetracked 16:54
the optimization flags go in the moarvm configure.pl
which with --gen-nqp and such will be called for you, but there's also --moar-opts or something in the rakudo configure.pl 16:55
[Coke] Yah, that's a lot to dig through. 16:57
[Coke] for now, will try to get cro working in docker instead. 16:57
[Coke] cro.services/docs/docker-deployment suggests an old version of the docker container, btw. 18:07
sour I have a newbie question, how would one represent a tagged union in raku? Something like a sealed class in scala / sum type in haskell 18:07
[Coke] like a Junction? 18:07
m: my $a = True | False 18:08
camelia ( no output )
[Coke] docs.raku.org/type/Junction # if so
MasterDuke sour: i think Kaiepi has some modules that might be relevant 18:09
[Coke] though glancing over www.schoolofhaskell.com/user/Gabri...sum-types, maybe it's more like a where clause on a subset. 18:10
[Coke] defers to MasterDuke . :)
sour like an enum with associated data types 18:11
useful for representing ASTs, for example
sour representing ASTs, for example, in Java with Java classes is eh 18:11
big eh
[Coke] yah, guessing 'subset X of Y where ...' is what you want. you can pick a top level class that is shared (or Any/Mu), and you can specify a where clause with specific limits, like explicit types, or "has this method"... 18:14
then you can declare your variables of the type of the subset.
docs.raku.org/language/typesystem#subset
sour very interesting mechanism, thanks all 18:17
there is multi after all, that helps a bit with this 18:19
[Coke] ah, yes, if you're just trying to restrict on parameters, you don't even need the subset then, just X multis. 18:21
(and you can define a coercion in the signature definition if all you're doing is casting)
guifa2 So.... what exactly is {YOU_ARE_HERE} ? 18:23
there's no documentation on it in docs.raku.org but it's definitely still in the grammar, but I'm not quite getting the intent based on the synopses 18:24
[Coke] it's part of a setting - your code basically runs as if it were in the setting at that point, if I remember correctly. 18:25
m: say {YOU_ARE_HERE}
camelia 5===SORRY!5=== Error while compiling <tmp>
The use of {YOU_ARE_HERE} outside of a setting is reserved (use whitespace if not a setting, or rename file with .setting extension?)
at <tmp>:1
------> 3say {YOU_ARE_HERE}7⏏5<EOL>
sour is there some more general mechanism behind having the Promise.start be a keyword? Was that done just because it is aesthetically pleasing? Wouldn't it then make sense to have some Channel operations be keywords? 18:38
vrurg sour: It just doesn't make sense for a channel. 18:53
jnthn sour: Partly that common things deserve shorter spellings, but in this case also because a `start` block also declares a fresh `$/` and `$!` in the block's scope, which helps one with correctness. 18:55
sour D: I don't know man it irks me
I still think channels deserve their own keywords 18:58
jnthn Also, you *can* use the `whenever` syntax to consume a channel
sour hmmm
jnthn (It's not syntax especially for channels, just general enough that it will work out)
sour have you got some links for how that works? 19:02
nevermind, I found (on the old design docs) that whenever competes for values 19:04
design.raku.org/S17.html#Channels
this is pretty noteworthy imo
Geth doc/fix-link-param-roles: bc05f269ed | (Stoned Elipot)++ | doc/Type/Associative.pod6
Fix link to parameterized roles
20:24
doc: stoned++ created pull request #3399:
Fix link to parameterized roles
20:25
guifa2 Should there be a third type of pod link? Instead of just linking to POD sections and external URL, it would be nice to also be able to link to specific blocks 20:35
tlcu_ hello raku community, I want to know if I am doing something wrong because my raku scripts are running really slow
lizmat tlcu_ : do you have a gist ? 20:43
tlcu_ lizmat rosettacode.org/wiki/Roman_numerals/Encode#Raku 20:44
it is taking about 430ms to execute, while perl takes 42ms. Seems impossible 20:45
lizmat well, at those scales, you should remember that Raku takes abour 120 msecs to start up 20:47
jnthn I suspect rosettacode solutions are often written for pretty rather than speed. The use of multi dispatch to match the 0 case is neat, but (at least under the current implementation) rather slower than just using an `if` to check it. 20:52
lizmat jnthn: a profile shows that about 2/3 of the time is spent in saying the result 20:57
hmmm... maybe not 20:59
jdv79 why does Pair.kv and Hash.kv return different things? 21:01
just noticed that
lizmat m: dd (a => 42).kv
camelia ("a", 42).Seq
lizmat m: dd {a => 42}.kv 21:02
camelia ("a", 42).Seq
lizmat they do? or not?
hmmm... running a --profile on that rosetta code entry explodes pretty much
jdv79 weird. idk what i just ran into then. 21:03
tlcu_ lizmat jnthn thanks for clarifying 21:06
lizmat tlcu_: using "0" as a candidate in a signature, is short for: Int:D where * == 0 21:07
which implies that *every* dispatch needs to execute Raku code to see if it was 0, and then select that candidate
ctilmes m: use NativeCall; class Foo is repr('CStruct') { has uint16 $.x is rw }; class Bar is repr('CStruct') { HAS Foo $.foo }; my $bar = Bar.new; $bar.foo.x = 2; 21:14
camelia Cannot bind attributes in a Foo type object
in block <unit> at <tmp> line 1
ctilmes With "HAS", the struct should be embedded, how can it possibly be a 'type object'? 21:15
jnthn ctilmes: The marshalled view of the data structure being embedded doesn't mean that the Raku-level model of it will be (and I'm pretty sure it isn't, because there's isn't any general concept of "reference to part of an object"). 21:23
So it probably is, in Raku terms, represented as object containing object, and flattened out as it's mapped 21:24
ctilmes I'm passing it to C that is supposed to be returning some bytes to me, but Raku thinks it is a type object. How do I tell Raku that the bytes are really there? 21:26
ctilmes (I don't even allocate it -- it is allocated by C and returned to me.) 21:27
jnthn ctilmes: Not sure, I'm afraid (and a bit tied up with something else to go digging), though did you try calling native-refresh (or whatever the sub is called) on it? 21:36
lizmat jnthn: I have a patch that makes "42".Numeric 4.3x as fast, "+42".Numeric unchanged, and "42.35".Numeric about 12% slower 21:46
so, should I commit that ?
jnthn Hm, it's probably a net win overall 21:49
lizmat I guess I should at one point look at val() processing
(again)
ok, will commit then 21:50
(after a final spectest test)
timotimo there is the ADT module (that i made) ;) 22:00
oops i was scrolled way up 22:01
scovit ctilmes did you try to nativecast your struct to a CArray and extract the values from memory? 22:29
if the struct is filled by C code it should work
scovit ctilmes , jnthn , IMHO nativecall has a bug. That can be worked around by accessing the bytes. As can be seen by running this gist gist.github.com/scovit/8d2e0254fdc...a177a5fe03 22:33
timotimo i wasn't aware we have working assign-struct-to-structy-attribute now 22:37
m: gist.github.com/scovit/8d2e0254fdc...a177a5fe03
camelia 12
11
3
94392304
0
3
scovit timotimo buggy you mean? 22:41
I have a fix
first I opened an issue github.com/rakudo/rakudo/issues/3687
timotimo is $!a set to anything when TWEAK runs? 22:43
scovit I guess it is set with the value of the pointer
but this is incorrect
timotimo m: say 94392304.base(16) 22:44
camelia 5A04FF0
scovit this need to handle that github.com/MoarVM/MoarVM/blob/mast...uct.c#L612
let me write a patch 22:45
timotimo cool
scovit timotimo, could you test this patch? github.com/MoarVM/MoarVM/pull/1285 22:49
timotimo is there a proper check that the size used for the memcpy source has enough space in the target struct? 22:50
like, is there a way to assign from the wrong type or something?
scovit that is typechecked by higher level code 22:52
I think
scovit I tried and it gives me error 22:52
Type check failed in binding; expected IntStruct but got ..
timotimo anything you can do with deriving? 22:53
scovit I don't know, CStruct are quite rigid. You might get good ideas for breaking it
One thing is that binding could be done automagically by the constructor, I do not know if it was meant to be that way? 22:54
timotimo m: class IntBase is repr<CStruct> { has int32 $.a; has int32 $.b }; class IntDerived is IntBase { has int64 $.x; has int64 $.y };
camelia ( no output )
timotimo i guess it would have to. you're thinking of a change in the buildplan?
scovit yes, but I would have to figure out how to approach it 22:57
timotimo, for the moment maybe this fix is enough 22:59
it mirrors more or less what need to be done in the not inlined case
ctilmes scovit, jnthn, timotimo: thanks. I just cheat and pull the inside structure out with nativecast(my structure, Pointer.new(nativecast(Pointer,self)+offset of inside structure)) 23:31