🦋 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.
andinus how can i get a bitstream with IO::Handle? i want to .read bits 06:18
melezhik Hi! I've created file with Raku, and then try to parse it with a program written on golnag and get this error - /tmp/config.json 08:19
load config: read and validate: unmarshal config file content: illegal base64 data at input byte 8
so looks like Raku save the file in ut8 format right? if so, how can I save it in plain/ascii mode?
melezhik I user spurt function to write to file 08:19
melezhik docs.raku.org/routine/spurt 08:22
looks like :enc
nemokosch Sounds about right 09:39
Andinus: I wonder what language lets you do that. Bit endianness is so low-level even C has only one feature that is affected by it (struct bit fields) 09:42
Voldenet actually, C# has BitArray that has endianness defined 10:16
Voldenet but streams (read etc.) work on bytes either way 10:17
nemokosch C# is also a kind of language that tackles everything for the sake of it 10:30
Voldenet raku has bits support too 10:31
nemokosch oh, if I understand it well, this is rather a high-level data structure with compact storage
Voldenet Blob.new([42]).read-ubits(0, 5).say 10:32
evalable6 5
Voldenet indeed, it's immensely useful if you need to implement bloom filters and such
nemokosch so like it's rather an internal "comforting" detail that it stores one bit of information on one bit 10:33
Voldenet sort of, but it can be constructed from byte[]
nemokosch read-bits might be "the right thing" here, actually 10:34
I wonder how it works under the hood but it might just be the thing
but the interface doesn't seem to be handy if you actually want to use the bits one by one 10:35
Voldenet read-bits just does bitshifts under the hood, nothing spectacular
nemokosch retrieve one bit and literally construct an Int for it? meh
if that's true, then The endianness of the bits is assumed to be BigEndian. should be false 10:36
because bitshifts don't care about bit endianness
okay, maybe not outright false but like lame 10:37
"you will get the right results for the wrong reason"
Voldenet possibly
not sure what nqp::bitshiftl_I does, I'd have to dig deeper
nemokosch I rolled with the assumption that it's like C 10:38
lately it bit me for work
if you do math, endianness won't matter at all - however, if you do structs, even bit endianness may matter 10:39
Voldenet it's a bit of pain that this problem bubbles to the high level 10:45
Voldenet either way: 10:46
> sub read-bits($h) { gather while my $b = $h.read: 1 { take ((1 +< $_) +& $b[0]) +> $_ for ^8 } };
that looks easy enough
parens are probably unnecessary 10:48
librasteve o/ 11:40
getting an odd compile error... 11:41
sub null-val( $dtype ) { given $dtype { when bool { False } when Bool { False } } }
Function 'bool' needs parens to avoid gobbling block at /Users/stephenroe/scum.raku:3 ------> when bool { False }⏏<EOL> Missing block (apparently claimed by 'bool') at /Users/stephenroe/scum.raku:3 ------> when bool { False }⏏<EOL>
goes away when I comment out the line with bool 11:42
(i) where should I stick the parens to silcence the error? (ii) is this a bug? 11:43
nemokosch this whole "gobbling block" is so unhelpful, what does it even mean 11:44
m: 13 ==> say
Raku eval Exit code: 1 ===SORRY!=== Argument to "say" seems to be malformed at /home/glot/main.raku:1 ------> 13 ==> say⏏<EOL> Other potential difficulties: Unsupported use of bare "say". In Raku please use: .say if you meant to call it as a method on $_, or use an explicit invocant or argument, or use &say to refer to the function as a noun. at /home/glot/main.raku:1 ------> 13 ==> say⏏<EOL>
nemokosch no, this is not it 11:45
I swear I've seen this before
librasteve i have no problem with the terminology ... usually it's pretty clear that the "bool" keyword needs to be "bool()" to disambiguate the syntax 11:47
nemokosch now this is the difference. What you said makes perfect sense, unlike "gobbling block" 11:48
I remember now, it was a gerund or how it is called 11:49
the action of gobbling
doesn't help if it's a niche C2 word
non-jargon even
librasteve ah - it seems that bool is not a native type - so it probably isn't a keyword that can be used here
works gine with int, num64 and so on 11:50
nemokosch but what is it? is there a &bool function somewhere?
oh, apparently any nonsense name can claim to be a function at that point 11:52
librasteve nope - but that's really my point ... since it is not a nativetype you can't smartmatch on it and then it gets interpreted as an (undefined) sub call and it does know if the block is intended as an argument or not
nemokosch when gibberish { ... }
librasteve you saying my code is gibberish? 11:53
(which frankly is a compliment)
nemokosch I'm saying that you could put any gibberish name there and the outcome would be the same
librasteve true that!
nemokosch I think it makes a difference that it's not even a legitimate symbol and yet it gets to claim to be a function
librasteve thanks! 11:54
nemokosch I think the error message is confusing but a parse error here is still better than downright refusing to parse when there are missing variables
> raku --target=ast -e '$a + $b' 11:55
librasteve ah - actually I forgot to go use NativeCall;
nemokosch > Variable '$a' is not declared. Perhaps you forgot a 'sub' if this was > intended to be part of a signature?
like, I don't care, I asked you to parse it
it's not nice that semantics is so deep-rooted that you basically cannot parse expressions without context 11:56
is it even legitimate? what are the two ways to parse $a + $b? 11:57
$a cannot even be called without the parens, really, why not give a proper parse output? 11:58
apparently, when gibberish { ... } works the other way around: it silently falls back to a function call without context 11:59
when this "block gobbling" situation arises, it would be good to try to resolve the symbol that looks like the called function 12:00
and if it isn't, give a better error message
Voldenet especially when there is no 'bool' subroutine in the first place 12:32
nemokosch yes, this is my point 12:40
with when map { ... } it could even be legit 12:46
leont RakuConf overlaps with PackagingConf :-/ 16:45
Oh, the overlapping day is the bonus day so I guess I could combine them 16:46
tonyo rf: is there a way to shutdown the humming bird server? 17:09
gracefully or otherwise? 17:11
antononcube @leont Sorry, no bonus. 17:17
Here is a clarification reference : playold.games/wp-content/uploads/2...-Sorry.jpg 17:30