🦋 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 00:02 reportable6 joined 00:24 tg57 joined, tg57 left
pingu how come constant does not need my or our 00:36
Voldenet if it's a constant, scope doesn't matter 00:37
pingu hmm 00:38
I'm not sure about that
in C theres also static const locals and static const globals 00:39
as well as global const and local consts
then again C is terrifying sometimes so maybe I shouldnt care 00:40
rf Well, in Raku constant means constant
pingu thats fair enough I guess
yeah in C sometimes constants are modifiable 00:41
but thats really a hardware thing not a C thing
rf In C everything is modifiable if you try hard enough.
pingu on some hardware it will modify, on others it will not
something to do with the .bss section in memory
Voldenet Well basically, in C there's `static const` and that's it 00:42
you can put it in any scope you want, but iirc initialization is roughly the same 00:43
the difference is that the symbol is not easily accessible outside of the scope if you use local one
the same story happens in raku
m: sub some-function { constant X = 3; say X }; constant X = 4; say X; some-function 00:46
camelia 4
3
Nemokosch by the way, I'm actually not sure if the Raku constant is "actually constant" or you can in fact bind some container to it 00:48
Voldenet oh, and there is "my" and "our" you can use
m: module Foo { my constant Bar = 4; }; say Foo::Bar
camelia Could not find symbol '&Bar' in 'Foo'
in block <unit> at <tmp> line 1
Voldenet m: module Foo { our constant Bar = 4; }; say Foo::Bar
camelia 4
Voldenet m: module Foo { constant Bar = 4; }; say Foo::Bar 00:49
camelia 4
Nemokosch okay so it's our-scoped by default
m: constant funky = $ = 12; say funky; funky = 15; say funky; 00:50
Raku eval 12 15
Nemokosch yeah, very "constant" indeed 😂
I think it's just a BEGIN-timed term
Voldenet I do wonder what happens if you do that in the actual module
which has precompiled constants built-in 00:51
I'm betting it becomes constant
Nemokosch that's a very good question... something must happen, right? xD
pingu so what if you didnt want another program reading a constant 00:52
Nemokosch but the same stands for anything BEGIN-timed, in one way or another
pingu :-)
it dont have to try and modify it
im pretty sure C or ASM could modify raku constants anyhow 00:53
C can redefine what even keywords are if you use a macro with inline assembler 00:54
#define return __ASM ( /*code here */ ) 00:55
Voldenet I've tested and constants inside modules are pretty constant, but not entirely 00:57
m: const foo = class { has $.y is rw = 12 }.new; say foo.y; foo.y = 15; say foo.y;
camelia ===SORRY!=== Error while compiling <tmp>
Preceding context expects a term, but found infix = instead.
Did you make a mistake in Pod syntax?
at <tmp>:1
------> const foo =⏏ class { has $.y is rw = 12 }.new; say f
Voldenet m: constant foo = class { has $.y is rw = 12 }.new; say foo.y; foo.y = 15; say foo.y;
camelia 12
15
Nemokosch what's the difference? 00:58
ohh "const"
Voldenet it's hard to swim out of the C 00:59
Nemokosch tbh I tried raku -I. -Mdemo -e 'funky = 15; say funky' with a demo.rakumod file and nothing changed
El_Che The C gives, the C takes
Nemokosch where would the precompilation kick in, is that still not enough?
Voldenet nope, because constants can't be rebound 01:00
the underlying data can be mutated though 01:01
01:03 ispyhumanfly joined 01:04 xinming left
Nemokosch okay but that's not binding, it's assignment, so that wouldn't contradict per se 01:05
only the initialization is a binding
01:06 xinming joined 01:18 thundergnat_ left 01:19 ispyhumanfly left 01:25 epony left 01:29 ispyhumanfly joined
rf How can I cube root a number easily? 01:33
Voldenet say 2197 ** (1/3) 01:35
m: say 2197 ** (1/3)
camelia 12.999999999999998
evalable6 12.999999999999998
:(**@rest, *%rest) floating point be like 01:36
rf Ah, not sure how I forgot about that lol 01:37
Voldenet there's also roots subroutine but its output… may not be what you expect 01:38
m: say roots(2197, 3)
camelia (12.999999999999998+0i -6.4999999999999964+11.258330249197702i -6.500000000000004-11.258330249197698i)
Voldenet technically correct
rf That's what I reached for first.
Nemokosch based version
Voldenet the output's too complex for most people
01:38 tg57 joined
Nemokosch better too complex than too real 😎 01:41
Voldenet everything's complex if you can imagine 01:44
pingu oh my GOD making a parser is so hard!!! 01:53
:(**@rest, *%rest) parser of what? 01:54
01:58 tg57 left
Voldenet grammars make it a bit easier but they need some getting used to 01:58
02:00 Bocaneri joined 02:01 Bocaneri is now known as Guest7808 02:02 Sauvin is now known as Guest6400, Guest6400 left, Guest7808 is now known as sauvin, sauvin is now known as Sauvin 02:03 raschip joined
guifa My recommendation with grammars: start with the smallest elements, and prefer tokens to anything else. Also, be very careful not to allow empty matches with anything that repeats, all ensure you match at least one thing 02:06
02:08 rf left
guifa so for a number parse, make <decimal-digit> and <sign> first, then make <integral-part> and <fractional-part>, then combine it all as <sign>? <integral-part> [ '.' <fractional-part> ]? or something akin to that 02:08
I find if you go the other way, you're more like to run into problems
02:26 cfa left 02:49 rf joined
[Coke] < discord-raku-bot> <:(**@rest, *%rest)> - is that really someone's nick or is the bridge failing? 03:00
Nemokosch it is, don't worry 03:04
03:10 razetime joined 03:25 ispyhumanfly left 03:27 raschip left
rf I understand double slurpy, but i'm struggling to see why i'd ever use it 03:33
jaguart doesn't it flatten more? 03:36
rf m: sub f(*@a) { @a.raku.say; }; sub g(**@a) { @a.raku.say; }; f(1,2,3,4,[5,6]); g(1,2,3,4,[5,6]); 03:40
camelia [1, 2, 3, 4, 5, 6]
[1, 2, 3, 4, [5, 6]]
rf I guess if I want to preserve the listyness of an argument 03:41
03:51 ispyhumanfly joined 03:55 ispyhumanfly left 04:02 pingu left, razetime left 04:06 rf left 04:10 ispyhumanfly joined 04:15 ispyhumanfly left
:(**@rest, *%rest) no flattening 04:24
jaguart ah - so double-star flattens less 04:33
reminds me of the pawns of null-a 04:34
hey mr el gatito cat - are you also known as 'little bobby tables?' 04:35
:(**@rest, *%rest) maybe just because im not familiar with it? no language ive learned has this kind of flattening varargs and i just don't see how flattening is of any use 04:36
what?
jaguart you know - little bobby tables - his surname is ' or 1==1; drop table customer; 04:41
Voldenet related xkcd.com/327/ 04:42
jaguart flattening is useful when you want to generalise and destructure perhaps in a mixed coder environment when you don't control other modules 04:44
:(**@rest, *%rest) could just slip it? 04:45
jaguart yeah - but you might want the destructure to happen in your Signature - esp if you have a where validation on it. 04:50
04:51 razetime joined
in any case, the ** variant does not flatten as much - the more common * does 04:53
so you would use that if you were feeling Listy
05:08 razetime left 05:23 ispyhumanfly joined 05:34 ispyhumanfly left 05:46 ispyhumanfly joined 05:51 ispyhumanfly left 05:54 razetime joined, razetime left 06:00 reportable6 left 06:03 reportable6 joined 06:21 ispyhumanfly joined 06:28 ispyhumanfly left
tonyo . 06:34
06:55 abraxxa joined 07:01 abraxxa left 07:02 abraxxa joined 07:39 ispyhumanfly joined 07:41 Sgeo left 07:48 ispyhumanfly left 08:06 snonux_ left, snonux left
patrickb Xliff: Have you seen github.com/rakudo/rakudo/blob/main...agement.md ? 08:44
tellable6 patrickb, I'll pass your message to Xliff
08:52 sena_kun joined
jjatria I found a typo on on conf.raku.org. The header says "Tickeets" 08:59
09:10 ispyhumanfly joined 09:14 ispyhumanfly left 09:17 jpn joined 09:19 dakkar joined 09:46 Nemokosch joined
Nemokosch .tell rf I had this thought that your modern CMake-based native module building workflow could be used to modernize the module for termios, what do you think? 09:48
tellable6 Nemokosch, I'll pass your message to rf
09:48 Nemokosch left 09:55 Manifest0 joined 10:21 ispyhumanfly joined 10:25 ispyhumanfly left 10:31 sena_kun left 10:37 dakkar left
lizmat clickbaits rakudoweekly.blog/2023/01/31/2023-...b-awarded/ 10:48
Nemokosch today I tried to build Rakudo for SPARC 10:55
welp, no go
11:11 sena_kun joined, jpn left 11:14 jpn joined 11:17 dakkar joined
am I understanding right that raku.land/github:moznion/HTML::Escape is raku.land/zef:lizmat/HTML::Entity::Fast but less comprehensive? 11:28
lizmat could well be 11:31
11:40 ispyhumanfly joined 11:48 ispyhumanfly left
:(**@rest, *%rest) why 11:49
anyways is there raku for 32bit?
Nemokosch Perhaps not 11:59
because I needed to work on a SPARC machine? lol
12:00 reportable6 left 12:01 reportable6 joined
:(**@rest, *%rest) SPARC machines are pretty much dead now? or am I dead wrong 12:25
Nemokosch I think you're pretty much right
:(**@rest, *%rest) imagine having to work on a sparc 😭 12:27
Nemokosch however, this is a machine used for supervising some NY metro lines
horribly expensive of course
we need it for testing 12:28
there are some companies that don't want to switch to Linux, some of them not even to x64
the thing is, even virtualizing these machines is a pain 12:29
:(**@rest, *%rest) hmm can’t you work with existing tools that support sparc
Nemokosch maybe I could if I knew what I needed. I really only wanted to do some search and replace on all files in a folder 12:30
I hoped to get away without bizarre escaping of sed-like tools
but eventually I settled for that
:(**@rest, *%rest) perl ig
Nemokosch I googled all around
Perl also only has s/// for substitutions from all I can tell 12:31
and unlike Raku, it doesn't seem to allow embedded strings
nine Rakudo does support 32 bit architectures: build.opensuse.org/project/show/de...ages:perl6
Nemokosch is that the i586 one? 12:32
12:33 ispyhumanfly joined
nine yes 12:33
I'm also building for other architectures here: build.opensuse.org/project/show/ho...rakudo-git 12:34
I've even done MIPS locally in qemu, but boy was that slow
12:36 Xliff joined 12:37 ispyhumanfly left
Xliff Does anyone know if there is anything in Raku that can run and monitor an external program and restart it if it segfaults? 12:38
tellable6 2023-02-01T08:44:59Z #raku <patrickb> Xliff: Have you seen github.com/rakudo/rakudo/blob/main...agement.md ?
Nemokosch where is MIPS used? 12:40
Xliff patrickb: No. Thanks for the link! 12:42
Anton Antonov What is "the best" package for date time specifications parsing? Is it "DateTime::Parse" or something else? 12:45
12:45 lizmat_ joined, Geth left
:(**@rest, *%rest) playstation 1 12:46
Nemokosch @Anton Antonov DateTime::Parse is simple and straightforward - if only there was somebody to merge the PR's... 😦 12:47
12:47 RakuIRCLogger left
I also created a format that I needed for a task 12:47
the "whatever the ls command can give you" format
12:48 lizmat left
Anton Antonov Yeah, ok. But "DateTime::Parse" does not provide separate grammar for parsing, so, I cannot use it as is. (And yes the PRs seem to add useful functionalities.) 12:48
12:49 MasterDuke left
Nemokosch oh you mean grammar that doesn't downright invoke the actions? 12:50
Anton Antonov No -- I want separate grammar and actions classes. (One of the reasons I made "Markdown::Grammar", BTW.) 12:51
12:53 ab5tract joined
Nemokosch hm, I think there are only less suitable alternatives to DateTime::Parse for that 12:53
:(**@rest, *%rest) aren’t grammars and actions already separate in raku 12:54
Nemokosch yes but the module itself couples them
Anton Antonov Ok, thanks. It looks like I have to refactor "DateTime::Parse" for my needs. 12:55
See here : github.com/sergot/datetime-parse/b...se.rakumod
13:09 ispyhumanfly joined 13:21 Xliff left 13:31 Tirifto left 13:32 Tirifto joined 14:13 rf joined 14:23 RakuIRCLogger__ left 14:24 Geth joined, lizmat_ left, lizmat joined 14:27 lichtkind_ joined 14:28 Geth left, Geth joined 14:31 lichtkind left 14:37 vrurg left 14:38 vrurg joined 14:58 tg57 joined 15:39 pingu joined 15:44 Sgeo joined 15:51 ab5tract left 15:52 ab5tract joined
ab5tract However, I'm still lost :D 15:52
[Coke] (bobby tables) - someone should add Raku to bobby-tables.com/ 16:09
tonyo delphi, blast from the past here 16:34
[Coke] mmm. I added the coldfusion entry, so glad I don't have to worry about that anymore. 16:43
16:46 cfa joined
cfa o/ 16:47
16:58 haxxelotto joined 17:05 haxxelotto left 17:24 tg57 left 17:34 jmcgnh left, Xliff joined 17:39 jmcgnh joined, tg57 joined 17:40 dakkar left 18:00 reportable6 left 18:02 reportable6 joined 18:06 sena_kun left 18:19 pingu left 18:28 tg57 left
Nemokosch well I doubt Delphi deserves the bad rap, it's just not all technologies get bought by the most visionary companies 18:33
rf Can you make a raw socket in Raku? Something like: Socket.open(Socket::PF_INET, Socket::SOCK_RAW, Socket::IPPROTO_RAW) in Ruby? 18:34
tellable6 2023-02-01T09:48:16Z #raku <Nemokosch> rf I had this thought that your modern CMake-based native module building workflow could be used to modernize the module for termios, what do you think?
rf Hmm, I haven't seen the codebase for termios Nemokosch, i'll look into it.
Nemokosch the idea is motivated by the relative abundance of dependents 18:35
rf Yeah I don't see why it couldn't 18:36
Nemokosch for the sockets, I'tm fairly clueless, I only know that leont keeps saying that the Unix domain sockets are missing
rf I'm looking to bind a socket to recieve ethernet frames, I want to get as close to the metal without writing a driver
If possible. 18:37
leont Yeah, our IO is fairly high level, both async and sync. That becomes a problem whenever you want to do something that Cro doesn't need.
rf I wonder how much of a hassle unix sockets would be, is it Moar holding it back? 18:38
leont Yeah, it needs Moar support. 18:39
I don't even think it's difficult per se, it's just that it requires understanding more MoarVM details than I know
rf Maybe I can look into writing that, will probably take me to the end of the year lol. I know Rakudo fairly well, but Moar is a whole other beast 18:40
Nemokosch Kaiepi also talked about working on networking but got distracted in the depths of it 18:42
tonyo moar team is very receptive to adding features ime 18:46
jdv moar features
tonyo moar success 18:51
18:52 jpn left 18:53 sena_kun joined 18:55 NemokoschKiwi joined
rf moar moar moar 18:55
18:55 NemokoschKiwi left
Nemokosch with a rebel yell 18:55
tonyo fwiw nqp may have what you need rf 18:56
github.com/Raku/nqp/blob/c8a811a00...ap.nqp#L97
github.com/Raku/nqp/blob/0724fd6ab...synclisten 18:58
Nemokosch is this not UDP though? 19:01
[Coke] finally remembers to set shiftwidth on vim on his work machine after 4 years.
19:02 jpn joined
rf udp is fine, as long as I can get the ethernet frame 19:13
cfa if i want to allocate a string (char**) to supply as an out parameter in FFI, is NativeHelpers::CBuffer my best option? 19:34
or to frame that differently, what is the recommended approach? 19:37
19:39 snonux joined 19:40 snonux_ joined
rf cfa: github.com/rakudo/rakudo/blob/main...rays.c#L33 19:48
There is an example, if you go to 05-arrays.t
19:48 snonux_ left
rf github.com/rakudo/rakudo/blob/main...rays.t#L36 19:49
19:49 snonux left
tonyo if it's a pointer to an array then cpointer might be a better option 19:53
until you get down to the data
rf Yeah I think when in doubt CPointer works for most stuff 19:54
19:54 tg57 joined
cfa sure, but i'm still not clear on what the best approach here is 19:54
rf What data are you passing? 19:55
cfa to clarify, i'm (i) allocating space in raku, (ii) calling an ffi function that takes a char**, to which it writes string data, (iii) reading this data from raku and (ideally) treating it as a Str
rf I see, I would use a CPointer 19:56
I don't know if there is really a "best practice" when it comes to this.
cfa allocated how? 19:57
19:57 raschip joined
tonyo is the char** allocated in C or in raku? 19:58
cfa raku 19:59
tonyo i can write an example but about to get into a meeting for two hours
i'd reckon you pass a ptr to the carray to the FFI func
but can't test atm
cfa nods
rf I can try here: sub ManipulatePointer(Pointer is rw) returns something is native ... 20:00
That's how I would pull in my native function (sorry I have a meeting right away too, just spit balling)
cfa sure, i'm following
rf then just my Pointer $ptr .= new; ManipulatePointer($ptr); 20:01
is rw is important on the param
cfa but what's that pointer pointing to? i need to allocate $x bytes for storage
and yes, the signature makes sense but it's not clear what the caller needs to do in terms of allocation 20:02
Nemokosch is returns the same here as --> or it must be preferred?
cfa do i just need CArray[byte].allocate($x) ?
rf you have to use is returns for nativecall iirc 20:03
Worth a shot
cfa hmm
rf Anything stopping you from allocating the memory in your C code?
cfa i'm using a library that expects an allocated out string 20:04
rf Pass a raku pointer, malloc, do your stuff, then spit back the pointer
cfa if i were to write a wrapper, sure
i'd rather just use the library as is
this works fine with CBuffer fwiw
20:05 jpn left
rf I'll play around with this after work 20:05
20:06 abraxxa left
rf Speaking of which, prod just went down (: 20:06
cfa okay this works
i have my native signature taking a CArray[byte] $buf, the caller allocates my $buf = CArray[byte].allocate($x); i can read out a string with $buf.list.chrs 20:14
nice and simple -- thanks! 20:16
somewhat tangential, this just cropped up: 20:18
m: my $buf = CArray[byte].allocate(8); say $buf
camelia ===SORRY!=== Error while compiling <tmp>
Undeclared name:
CArray used at line 1. Did you mean 'array', 'Array'?
cfa m: use NativeCall; my $buf = CArray[byte].allocate(8); say $buf
camelia NativeCall::Types::CArray[byte].new
cfa but
m: use NativeCall; my CArray[byte] $buf .= allocate(8); say $buf 20:19
camelia This type (Scalar) does not support positional operations
in method allocate at /home/camelia/rakudo-m-inst-1/share/perl6/core/sources/A0A96FBF793726A548EDC85C30C96DFD8D2A177F (NativeCall::Types) line 154
in block <unit> at <tmp> line 1
cfa which surprised me
rf m: use NativeCall; my CArray[byte] @buf .= allocate(8); say $buf
camelia ===SORRY!=== Error while compiling <tmp>
Variable '$buf' is not declared. Did you mean any of these: '@buf',
'Buf'?
at <tmp>:1
------> y CArray[byte] @buf .= allocate(8); say ⏏$buf
cfa i expected these to be equivalent -- what am i missing?
rf m: use NativeCall; my CArray[byte] @buf .= allocate(8); say @buf
camelia No such method 'allocate' for invocant of type
'Array[NativeCall::Types::CArray[byte]]'
in block <unit> at <tmp> line 1
rf Look at the type signature, that explains it :)
Oh wait i'm drunk 20:20
cfa heh
rf Huh weird that CArray is not positional
I thought that was the benefit over CPointer
cfa oh hang on 20:21
ah, never mind -- confusion persists 20:22
rf m: use NativeCall; my CArray[byte] $buf = CArray[byte].allocate(8); say $buf
camelia NativeCall::Types::CArray[byte].new
rf Madness 20:23
cfa that's what i just tested, yes
i can't see why .= allocate(8) shouldn't work
rf m: use NativeCall; my CArray[byte] $buf .= allocate(5000); say $buf
camelia This type (Scalar) does not support positional operations
in method allocate at /home/camelia/rakudo-m-inst-1/share/perl6/core/sources/A0A96FBF793726A548EDC85C30C96DFD8D2A177F (NativeCall::Types) line 154
in block <unit> at <tmp> line 1
rf was wondering how many bytes camelia would let me allocate 20:24
cfa the error seems to indicate that it's the positional (rather than named?) argument to allocate that's the problem
which also seems misleading
rf m: use NativeCall; my CArray[byte] $buffer; say $buffer; 20:26
camelia (CArray[byte])
rf m: use NativeCall; my CArray[byte] $buffer; $buffer .= allocate(8); say $buffer;
camelia This type (Scalar) does not support positional operations
in method allocate at /home/camelia/rakudo-m-inst-1/share/perl6/core/sources/A0A96FBF793726A548EDC85C30C96DFD8D2A177F (NativeCall::Types) line 154
in block <unit> at <tmp> line 1
cfa line 154 is the bindpos_u line here: 20:27
multi method allocate(::?CLASS:U \type: Int:D $elems) {
my $arr := nqp::create(type);
nqp::bindpos_u($arr, $elems - 1, 0);
$arr;
}
rf Ahh this is not a submethod 20:28
Would that do it?
cfa i was under the impression that my T $t .= foo(...) was equivalent to my T $t = T.foo(...) 20:29
which is clearly not the case from the above test(s) 20:30
namely,
m: use NativeCall; my CArray[byte] $buf = CArray[byte].allocate(8); say $buf
m: use NativeCall; my CArray[byte] $buf .= allocate(8); say $buf
camelia NativeCall::Types::CArray[byte].new
This type (Scalar) does not support positional operations
in method allocate at /home/camelia/rakudo-m-inst-1/share/perl6/core/sources/A0A96FBF793726A548EDC85C30C96DFD8D2A177F (NativeCall::Types) line 154
in block <unit> at <tmp> line 1
cfa i'm speaking purely as a user, not somebody who understands raku(do) internals 20:31
rf m: class T { method make { T.new; }; submethod makeSub { T.new;}; }; my T $n .= make; say $n;
camelia T.new
rf m: class T { method make { T.new; }; submethod makeSub { T.new;}; }; my T $n .= makeSub; say $n;
camelia T.new
rf Okay, yeah there must be a special rule here.
Nemokosch could be a bug at any time tbh
rf my: Pointer p .= new; 20:32
cfa m: my Date $d = Date.today; say $d;
m: my Date $d .= today; say $d;
rf m: my Pointer $p .= new;
camelia 2023-02-01
===SORRY!===
Type 'Pointer' is not declared
at <tmp>:1
------> my Pointer⏏ $p .= new;
Malformed my
at <tmp>:1
------> my⏏ Pointer $p .= new;
rf m: use NativeCall; my Pointer $p .= new; say $p;
camelia NativeCall::Types::Pointer<NULL>
cfa i'd expect comparable behaviour to those date examples
rf Maybe the type signature throws it off 20:33
cfa Nemokosch yeah, hence my raising it -- either i'm unaware of some corner case (in which case the error is LTA) or perhaps there's a bug?
rf Generic CArray
m: CArray $arr .= allocate(8); say $arr;
camelia ===SORRY!=== Error while compiling <tmp>
Variable '$arr' is not declared. Perhaps you forgot a 'sub' if this
was intended to be part of a signature?
at <tmp>:1
------> CArray ⏏$arr .= allocate(8); say $arr;
rf m: my CArray $arr .= allocate(8); say $arr;
camelia ===SORRY!===
Type 'CArray' is not declared. Did you mean any of these: 'array',
'Array'?
at <tmp>:1
------> my CArray⏏ $arr .= allocate(8); say $arr;
Malformed my
at <tmp>:1
------> my⏏ CArray $arr .= allocate(8);…
cfa heh
rf m: use NativeCall; my CArray $arr .= allocate(8); say $arr;
camelia No such method 'allocate' for invocant of type
'NativeCall::Types::CArray'
in block <unit> at <tmp> line 1
20:34 snonux joined
rf m: use NativeCall; my CArray @arr .= allocate(8); say $arr; 20:35
camelia ===SORRY!=== Error while compiling <tmp>
Variable '$arr' is not declared. Did you mean '@arr'?
at <tmp>:1
------> all; my CArray @arr .= allocate(8); say ⏏$arr;
rf m: use NativeCall; my CArray @arr .= allocate(8); say @arr;
camelia No such method 'allocate' for invocant of type
'Array[NativeCall::Types::CArray]'
in block <unit> at <tmp> line 1
20:35 snonux_ joined
rf Yeah I got no idea lol 20:35
This is a lizmat or moritz thing I think :D
cfa no worries, thanks for looking into it (and talking through the ffi stuff)
rf Yeah most of my FFI experience is with C++, trying my best :D 20:36
Nemokosch have you seen moritz around lately? 20:39
have you seen moritz around lately? 20:40
rf .seen moritz
tellable6 rf, I saw moritz 2023-01-22T15:14:09Z in #raku: <moritz> that's because Lists can contain references, so they aren't good value types
Nemokosch > No such method 'allocate' for invocant of type␤'Array[NativeCall::Types::CArray] btw this is still clear and understandable - you declared an array of CArray
rf Yeah I realised that. I thought CArray would be positional for some reason. 20:41
Nemokosch m: use NativeCall; my @arr is CArray .= allocate(8); say @arr;
Raku eval Exit code: 1 No such method 'allocate' for invocant of type 'NativeCall::Types::CArray' in block <unit> at main.raku line 1
rf m: use NativeCall; my @arr is CArray[byte] .= allocate(8); say @arr; 20:42
camelia Cannot resolve caller allocate(NativeCall::Types::CArray[byte]:D: Int:D); none of these signatures matches:
(NativeCall::Types::CArray[byte]:U \type: int $elems, *%_)
(NativeCall::Types::CArray[byte]:U \type: Int:D $elems, *%_)
in bloc…
rf Aha there is the real error
m: use NativeCall; my @arr is CArray[byte] .= allocate(byte, 8); say @arr;
camelia Cannot resolve caller allocate(NativeCall::Types::CArray[byte]:D: byte:U, Int:D); none of these signatures matches:
(NativeCall::Types::CArray[byte]:U \type: int $elems, *%_)
(NativeCall::Types::CArray[byte]:U \type: Int:D $elems, *%_)
Nemokosch why does it start off as :D ...
rf m: use NativeCall; my CArray[Byte] $arr .= allocate(byte, 8); say $arr; 20:43
camelia ===SORRY!=== Error while compiling <tmp>
Undeclared name:
Byte used at line 1. Did you mean 'byte'?
rf m: use NativeCall; my CArray[byte] $arr .= allocate(byte, 8); say $arr;
camelia Cannot resolve caller allocate(NativeCall::Types::CArray[byte]:U: byte:U, Int:D); none of these signatures matches:
(NativeCall::Types::CArray[byte]:U \type: int $elems, *%_)
(NativeCall::Types::CArray[byte]:U \type: Int:D $elems, *%_)
Nemokosch m: use NativeCall; my @arr is CArray[byte] = CArray[byte].allocate(byte, 8); say @arr;
Raku eval Exit code: 1 Cannot resolve caller allocate(NativeCall::Types::CArray[byte]:U: byte:U, Int:D); none of these signatures matches: (NativeCall::Types::CArray[byte]:U \type: int $elems, *%_) (NativeCall::Types::CArray[byte]:U \type: Int:D $elems, *%_) in block <unit> at main.raku line 1
rf m: use NativeCall; my @arr is CArray[byte] = CArray[byte].allocate(8); say @arr; 20:44
camelia Cannot modify an immutable NativeCall::Types::CArray[byte] (NativeCall::Types::C...)
in block <unit> at <tmp> line 1
Nemokosch so much hassle..
cfa hmm? 20:45
rf m: use NativeCall; my $arr is CArray[byte] .= allocate(8); say $arr;
camelia ===SORRY!=== Error while compiling <tmp>
is trait on $-sigil variable not yet implemented. Sorry.
Did you mean: my NativeCall::Types::CArray[byte] $arr?
at <tmp>:1
------> use NativeCall; my $arr is CArray[byte]⏏ .= allocate(8); …
rf Could be that the native call stuff plays by its own set of rules. 20:46
Nemokosch m: use NativeCall; say CArray[byte].allocate(8);
Raku eval NativeCall::Types::CArray[byte].new
Nemokosch m: use NativeCall; my @arr := CArray[byte].allocate(8); say @arr; 20:47
Raku eval NativeCall::Types::CArray[byte].new
Nemokosch heh
"no bindings", except when only bindings work properly...
20:48 raschip left
is CArray even mutable by Raku terms? could be that it doesn't create containers at all 20:50
rf That would make sense 20:51
Nemokosch m: use NativeCall; my @arr := CArray[byte].allocate(8); say @arr[2].VAR.WHAT 20:52
Raku eval (UIntPosRef)
Nemokosch so yeah I'd think this handles mutation weirdly, if at all
20:54 jpn joined 21:03 Bocaneri joined, Bocaneri is now known as Guest857 21:05 Sauvin left 21:12 jpn left 21:19 jpn joined 21:43 pingu joined
tonyo cfa: you get the char** figured? 22:27
22:27 Guest857 is now known as Sauvin 22:30 snonux left
rf Yeah, CArray did it. 22:30
22:30 snonux_ left
rf But we found some weird semantics tonyo 22:30
m: my CArray[byte] $buff .= allocate(8); 22:31
camelia ===SORRY!===
Type 'CArray' is not declared. Did you mean any of these: 'Array',
'array'?
at <tmp>:1
------> my CArray⏏[byte] $buff .= allocate(8);
Malformed my
at <tmp>:1
------> my⏏ CArray[byte] $buff .= allocate…
rf m: use NativeCall; my CArray[byte] $buff .= allocate(8);
camelia This type (Scalar) does not support positional operations
in method allocate at /home/camelia/rakudo-m-inst-1/share/perl6/core/sources/A0A96FBF793726A548EDC85C30C96DFD8D2A177F (NativeCall::Types) line 154
in block <unit> at <tmp> line 1
22:40 jpn left 22:44 ab5tract left
tonyo isn't char** technically a pointer to a pointer of some contiguous "bytes"? 22:45
this repo may have some info in it, too github.com/salortiz/NativeHelpers-Blob 22:46
22:51 NemokoschKiwi joined, NemokoschKiwi left, NemokoschKiwi joined 22:54 tg57 left
NemokoschKiwi .seen avuserow 23:19
tellable6 NemokoschKiwi, I saw avuserow 2022-12-09T02:09:33Z in #raku: <avuserow> otherwise I would look for a PPA, or use rakubrew
23:24 sena_kun left 23:25 NemokoschKiwi left 23:30 lichtkind_ left
cfa tonyo: if you have suggestion for a better approach please let me know; having a buffer for contiguous bytes works fine in the case of this library 23:53
23:59 spacekookie left