<< 15-03-2022 >>

00:20:00*pch joined #nim
00:20:29pchhow again do I round a float and then place it into an integer type
00:21:46pchI want to `var integer: int16 = math.[neededproc](float)` pretty much
00:22:32pchand google is being absolutely useless since everything I can find assumes you never want to do this ever and should always keep it in the floats haha teehee
00:24:53FromDiscord<Recruit_main707> https://nim-lang.org/docs/math.html#round%2Cfloat32
00:25:19FromDiscord<Recruit_main707> docs and ctrl + f are way more useful than plain google usually
00:26:23FromDiscord<Recruit_main707> ah, didnt read correctly
00:26:58FromDiscord<Recruit_main707> but i think you can then just safely cast it:↵`var integer: int16 = round(float).int16`
00:27:11pchthat's not a cast that's a conversion
00:27:28pchill do the conversion with reluctance
00:27:32FromDiscord<Elegantbeef> `cast[int16](myFloat)`
00:28:00FromDiscord<Elegantbeef> Cast in nim is a bit cast which means it does not give a value close to the input
00:28:22FromDiscord<Recruit_main707> wait that works?
00:28:31FromDiscord<Elegantbeef> Why wouldnt it work?
00:28:58FromDiscord<Elegantbeef> You might need `cast[ptr int16](myFloat.addr)[]` as i think casting like this can be UB
00:29:17FromDiscord<Elegantbeef> Might be wrong about the UB though
00:29:59FromDiscord<Recruit_main707> because cast takes the raw bytes, but floats and ints arent represented in the same way afaik
00:30:38FromDiscord<Elegantbeef> Sure but they asked for a cast not a conversion
00:30:57FromDiscord<Elegantbeef> They said and i quote "that's not a cast that's a conversion" 😛
00:31:35FromDiscord<Recruit_main707> i thought he was just correcting me xD
00:31:44FromDiscord<Elegantbeef> Ah
00:32:43FromDiscord<Elegantbeef> You'd round and manually convert it unless you want to write a `converter toInt16(f: float): int16 = int16 f`
00:33:09FromDiscord<Elegantbeef> Converter is generally to be avoided though, as it causes many headaches
00:33:20FromDiscord<Recruit_main707> id round it inside the converter
00:34:03FromDiscord<Recruit_main707> anyways, its clearly too late for solving issues, bye bye
00:34:11FromDiscord<Elegantbeef> Depends on what you're after i guess
00:34:30FromDiscord<Elegantbeef> But it's only 18\:34
00:34:50FromDiscord<Recruit_main707> 1:34 here :p
00:37:09pchno I didn't ask for a cast or conversion
00:37:21pchI asked for a proc that would just result in an integer after rounding
00:37:43pchbut a conversion is fine
00:37:45pcha cast will not work
00:38:19pch@Elegantbeef you were slightly off and I was looking at a different window, sorry
00:38:37*jmdaemon quit (Ping timeout: 240 seconds)
00:38:44pcha cast will result in a horribly screwed up number that is NOT what I am wanting
00:40:59pchwhat I'm doing is that I'm writing performance-imperative code that's going to be run potentially tens of thousands of times a second, in a rasterizer
00:42:27pchso literally any compiler-optimizable way of turning normalized buffer coords into buffer postions is what I need
00:44:29FromDiscord<Elegantbeef> Hey i didnt get the first message here! I take no blame 😛
00:45:13pchoh it's fine
00:45:40pchoh, this is a long-time user btw who pops in and out I'm just completely getting rid of my old nick for these purposes
00:45:46pchpreviously known as kinkinkijkin
00:53:55NimEventerNew question by itil memek cantik: Nim source file which after it&#39;s normalized, see https://stackoverflow.com/questions/71475788/nim-source-file-which-after-its-normalized
00:57:57NimEventerNew thread by Mardiyah: To have source file has been normalized, see https://forum.nim-lang.org/t/9012
02:52:44nrds<Prestige99> What's the best way to do something like https://play.nim-lang.org/#ix=3Shp ? I get an error about redefining projectionAxes
02:53:37nrds<Prestige99> Which I find a bit odd..
02:55:45FromDiscord<Elegantbeef> Nim doesnt allow reusing field names
02:56:07FromDiscord<Elegantbeef> So make one `pProjectionAxes` and the other `rProjectionAxes` with a property
02:56:34nrds<Prestige99> weird because only one should exist when the object is created, but alright
02:56:45nrds<Prestige99> just expected this to work 😛
02:57:06FromDiscord<Elegantbeef> Well yea but it's a case of `projectionAxes` is ambiguous without knowing the kind statically
03:00:27FromDiscord<Elegantbeef> sent a code paste, see https://paste.rs/T9Z
03:01:12FromDiscord<Elegantbeef> https://github.com/nim-lang/RFCs/issues/368 there is this RFC
03:27:53pchoh dear I've just found out that nobody teaches softrast-friendly rasterization methods anymore
03:28:24pchand instead teaches the dummy complex methods that are faster only if you are running on a massive vector processor
03:31:57*mahlon quit (Ping timeout: 250 seconds)
03:34:34*ltriant_ joined #nim
03:34:50*mahlon joined #nim
03:35:21*ltriant quit (Ping timeout: 245 seconds)
03:45:20FromDiscord<Girvo> Hi all 🙂
03:46:48*arkurious quit (Quit: Leaving)
03:46:54*jmdaemon joined #nim
03:48:27FromDiscord<Girvo> Is there a common Either[L, R] or Result[Ok, Err] type similar to Option[T]? I know there are a couple libraries, was just wondering I guess what the current go-to is for error/result return vals. `(bool, string)` as the return works for what I'm doing right now, but figured I'd ask!
03:50:41FromDiscord<Elegantbeef> either use `std/options` or one of the libraries, exceptions are how you're "supposed" to do it
03:51:25FromDiscord<Girvo> Alrighty cheers
04:03:14FromDiscord<Girvo> I'm having fun writing an AT command response parser right now. Fun, fun, fun... 😭
04:04:47FromDiscord<Girvo> Reckon I might write a PEG for it, considering its at least semi-structured. No idea what the performance/memory pressure will be like with it though. Wish me luck!
04:10:29*slowButPresent quit (Quit: leaving)
04:11:16FromDiscord<Girvo> sent a code paste, see https://play.nim-lang.org/#ix=3ShG
04:11:21FromDiscord<Girvo> Any obvious thing I'm doing wrong?
04:13:43FromDiscord<Girvo> `testament r tests/test0.nim` gives the same error
04:29:41FromDiscord<Girvo> Man even trying to get the old `unittest` module working is proving fun with the crazy `nim.cfg` I have to have for this embedded stuff to work
04:30:18FromDiscord<Girvo> `C:\nim\lib\std\exitprocs.nim(10, 8) Error: cannot open file: unittest` when I use `--skipCfg -r` on a simple `import unittest` based suite
04:30:38FromDiscord<Girvo> (edit) "`C:\nim\lib\std\exitprocs.nim(10," => "`C:\Users\JoshGirvin\Code\lithium\lithium\src\tests\test0.nim(1,"
04:31:23FromDiscord<Girvo> If I change it to `import std/unittest` it now "works" but fails on `import locks` somewhere in `exitprocs.nim` -- almost like its broken the `std` prefix being automatically added?
04:32:11*rockcavera quit (Remote host closed the connection)
04:38:50FromDiscord<Elegantbeef> Why are you importing `locks`?
04:38:59FromDiscord<Girvo> I'm not haha
04:39:02*rockcavera joined #nim
04:39:02*rockcavera quit (Changing host)
04:39:02*rockcavera joined #nim
04:39:06FromDiscord<Girvo> Hence why I'm very confused 😄
04:39:22FromDiscord<Girvo> sent a code paste, see https://play.nim-lang.org/#ix=3ShK
04:51:15pchhmm, how again do I make a type that's an array of a programmer-defined size but a very specific contained type
04:51:34pchand passes its size as an arg
04:55:08FromDiscord<Elegantbeef> `type MyType[size: static int] = array[size, MyType]`
04:55:18FromDiscord<Elegantbeef> Sorry that'll not work\: `type MyType[size: static int] = array[size, MyOtherType]`
05:07:52FromDiscord<Elegantbeef> @Girvo\: what's the config?
05:08:23FromDiscord<Elegantbeef> Oh the issue is you want `--skipProjCfg:on`
05:08:25FromDiscord<Elegantbeef> Atleast i think
05:08:27FromDiscord<Girvo> Ohhhhh
05:08:27FromDiscord<Girvo> sent a code paste, see https://play.nim-lang.org/#ix=3ShY
05:08:33FromDiscord<Girvo> Sweet cheers I'll give it a try!
05:08:46FromDiscord<Elegantbeef> image.png https://media.discordapp.net/attachments/371759389889003532/953157790342467614/image.png
05:08:47FromDiscord<Elegantbeef> Whole lot of them
05:09:40FromDiscord<Girvo> Okay i'll have a play, cheers
05:09:58FromDiscord<Girvo> Boom! `skipParentCfg` is what I was after 😄
05:10:00FromDiscord<Girvo> Works, cheers!
05:10:27FromDiscord<Elegantbeef> No problem
05:12:21FromDiscord<Girvo> Now I can write this damned `pegs` parser for AT commands without pulling my hair out deploying it to the real microcontroller lol
05:24:25FromDiscord<Elegantbeef> AT commands?
05:27:07*Guest4 joined #nim
05:32:19*rockcavera quit (Remote host closed the connection)
05:33:36*Guest4 quit (Quit: Client closed)
06:52:22FromDiscord<Generic> pch: normal cpus are vector processors now
07:12:44NimEventerNew Nimble package! argon2_highlevel - A high-level Nim Argon2 password hashing library, see https://github.com/termermc/argon2-highlevel
07:17:12FromDiscord<Elegantbeef> Congrats termer i now get to criticize your code
07:18:18FromDiscord<Elegantbeef> Hmm is termer even heree?
07:43:02FromDiscord<Mysterysib> Hey when I try to install a package I get `In file included from /Users/evan/.cache/nim/balls_r/stdlib_system.nim.c:7:↵/opt/local/lib/nim/lib/nimbase.h:269:10: fatal error: 'limits.h' file not found↵#include <limits.h>`. I know limits.h is in the XCode Developer Tools library on OSX, but what do I modify to get nimble to include it when compiling .C ?
07:43:38FromDiscord<Mysterysib> Like, the CFlags so I can add -L/path/to/libs to it
07:44:00FromDiscord<Elegantbeef> `--cincludes:DIR`
07:45:00FromDiscord<Elegantbeef> Or you can do `--passC:` to pass to the C compiler or `--passL:` to pass to the linker
07:55:23*PMunch joined #nim
07:55:40FromDiscord<Mysterysib> Erm, now I get `Undefined symbols for architecture x86_64:↵ "_main", referenced from:↵ implicit entry/start for main executable↵ld: symbol(s) not found for architecture x86_64` What could this possibly mean?
07:56:14FromDiscord<Elegantbeef> Are you attempting to cross compile on a M1?
07:56:36FromDiscord<Mysterysib> Nope, simply to compile for my Intel chip
07:57:31FromDiscord<Elegantbeef> Hmm dont know what to say you're on a modern Nim version right?
07:57:57FromDiscord<Mysterysib> Yeah, and I tried both clang and gcc
07:58:32FromDiscord<Elegantbeef> What are you trying to install btw?
07:58:43FromDiscord<Mysterysib> Oh okay `/usr/bin/clang -c` finally worked. It was a a package
07:59:01FromDiscord<Mysterysib> Basically using the system clang versus the one I installed using a package manager, and added the -c flag
07:59:01FromDiscord<Elegantbeef> yea but what package
07:59:41FromDiscord<Mysterysib> [email protected]
08:00:14FromDiscord<Mysterysib> Is there a way of specifying the compiler itself to nimble?
08:00:23FromDiscord<Mysterysib> Because I was debugging using my own commands, not nimble
08:01:03FromDiscord<Elegantbeef> you can do `--cc` with a shellscript that calls the proper one
08:02:20PMunchCan't you just set the gcc config variable?
08:02:30FromDiscord<Elegantbeef> Oh right you can do that too
08:02:36FromDiscord<Elegantbeef> I was thinking about the zig compiler issue
08:05:00FromDiscord<Mysterysib> `Error: arguments can only be given if the '--run' option is selected` what does this mean?
08:05:10FromDiscord<Mysterysib> I tried including --run and I get the same error
08:05:22*jjido joined #nim
08:05:31FromDiscord<Elegantbeef> Arguments for install go before the package name i think
08:05:48FromDiscord<Elegantbeef> Or if this is using nim it's cause you're doing `nim c myFile.nim --someArg`
08:06:55NimEventerNew thread by Oyster: WZeeGird and wChart app on windows are labled as Real Protect-PENGSD5! virus, see https://forum.nim-lang.org/t/9014
08:24:14FromDiscord<System64 ~ Flandre Scarlet> How can I put something in the stream please? https://media.discordapp.net/attachments/371759389889003532/953206980720336927/unknown.png
08:25:07FromDiscord<Elegantbeef> `steam: ptr UncheckedArray[uint8]`
08:25:16FromDiscord<Elegantbeef> stream\
08:25:23FromDiscord<Elegantbeef> then just `stream[i] = val`
08:26:50FromDiscord<System64 ~ Flandre Scarlet> In reply to @Elegantbeef "then just `stream[i] =": I don't have i↵In C it looks like that https://media.discordapp.net/attachments/371759389889003532/953207632385179698/unknown.png
08:27:23FromDiscord<Elegantbeef> I dont know what `>>=` does for a pointer
08:27:43PMunchx = x shr y
08:27:49FromDiscord<Elegantbeef> Wait never mind i cant read
08:27:53FromDiscord<Elegantbeef> It doesnt asign it in that code
08:28:35FromDiscord<Elegantbeef> `cast[ptr int16](stream)[] = sampleValueInterpolated.int16`
08:31:32FromDiscord<System64 ~ Flandre Scarlet> sent a code paste, see https://play.nim-lang.org/#ix=3Siy
08:32:23PMunchWell it would be `stream = cast[ptr uint8](cast[int](stream) + 1)` or something similar
08:32:31PMunchBut it would be better to rewrite it to use indexes
08:33:00FromDiscord<System64 ~ Flandre Scarlet> In reply to @PMunch "Well it would be": It's the SDL audio callback
08:33:11PMunchOkay?
08:33:44PMunchYou should still try to avoid pointer arithmetic when simple indexes will suffice
08:34:27PMunchfg
08:34:36PMunchOops, wrong window
08:34:37FromDiscord<System64 ~ Flandre Scarlet> sent a code paste, see https://paste.rs/zpV
08:36:20FromDiscord<System64 ~ Flandre Scarlet> so it absolutely wants a pointer to uint8
08:39:01FromDiscord<Rika> ptr UncheckedArray[uint8] is "equivalent" to ptr uint8
08:39:44FromDiscord<System64 ~ Flandre Scarlet> It says that now https://media.discordapp.net/attachments/371759389889003532/953210880328343552/unknown.png
08:40:06FromDiscord<System64 ~ Flandre Scarlet> for SDL it's not the same thing
08:40:26FromDiscord<Rika> for your binding it isnt
08:40:31FromDiscord<Rika> can you control the binding
08:40:59FromDiscord<System64 ~ Flandre Scarlet> I have 2 SDL bindings, I don't know which is the right one
08:42:34PMunchYou still take in the ptr uint8 argument, but you cast it to a `ptr UncheckedArray[uint8]` in your body
08:46:04FromDiscord<System64 ~ Flandre Scarlet> sent a code paste, see https://paste.rs/g1x
08:46:17FromDiscord<Mysterysib> I got how to set CFLAGS, but now I get the error `ld: library not found for -lm` 😵
08:46:35FromDiscord<Mysterysib> No idea where this library even is on OSX, google isn't helping
08:46:40FromDiscord<Mysterysib> it's just libmath afaik
08:48:57FromDiscord<Mysterysib> This is the linker error now
08:49:03FromDiscord<Mysterysib> It does compile to .o files
08:49:05FromDiscord<Mysterysib> finally
08:49:23PMunchCan you compile C code on this machine?
08:49:25FromDiscord<demotomohiro> You have C compiler but don't have standard library looks strange. Maybe your compiler doesn't require `-lm` option to use math.h?
08:49:32FromDiscord<Mysterysib> Idt it does
08:49:36PMunchYour C compiler setup seems to be completely broken..
08:49:44FromDiscord<Mysterysib> Yeah, I can. I've compiled tons of difficult to compile stuff
08:49:55PMunchHmm, weird
08:49:58FromDiscord<Mysterysib> I believe it is just OSX
08:50:05FromDiscord<Mysterysib> I never had to specify -lm
08:50:14PMunchBut plenty of other people use Nim on OSX without issues
08:50:17FromDiscord<Mysterysib> if I leave out the CFlags I'm adding in, it simply calls clang
08:50:26FromDiscord<Mysterysib> Hmmm
08:50:53FromDiscord<Mysterysib> Let's try this 😆 mv /usr/local/bin/clang /usr/local/bin/clang.bak
08:50:54*jjido quit (Quit: My MacBook Air has gone to sleep. ZZZzzz…)
08:51:26FromDiscord<Elegantbeef> This is where i point out system that C code is just doing indexing in the dumbest way possible
08:51:27PMunchHow did you install Nim?
08:51:32FromDiscord<Mysterysib> It worked!!!!!
08:51:36FromDiscord<Rika> 64, you're trying to write a uint16 into a uint8?
08:51:53FromDiscord<Mysterysib> I got rid of my packaged clang literally by renaming it and it worked without even supplying any additional arguments
08:52:01FromDiscord<Elegantbeef> It's a for loop that's dumbly written afact
08:52:08FromDiscord<System64 ~ Flandre Scarlet> In reply to @Rika "64, you're trying to": My audio output is int16
08:52:53FromDiscord<Rika> but the array is a uint8 array
08:53:01FromDiscord<System64 ~ Flandre Scarlet> In reply to @Rika "but the array is": it's my buffer
08:53:16FromDiscord<Elegantbeef> sent a code paste, see https://play.nim-lang.org/#ix=3SiA
08:53:27FromDiscord<Elegantbeef> The fact it's using a while loop and stupid pointer arithmetic is beside the point
08:54:00FromDiscord<Elegantbeef> sent a code paste, see https://paste.rs/ySv
08:54:01FromDiscord<Rika> this would break once you change endianness no? lol
08:54:11FromDiscord<Elegantbeef> Endianess doesnt change locally
08:54:16FromDiscord<Rika> i know
08:54:18FromDiscord<Rika> but in another system
08:54:22FromDiscord<Rika> this wouldnt work
08:54:23FromDiscord<Elegantbeef> This is for SDL2 audio
08:54:39PMunch@System64_~_Flandre_Scarlet, but if you do stream++ you go one byte in, and if you then write a uint16 into there you're overriding one of the bytes the last write did..
08:54:42FromDiscord<Elegantbeef> Who the fuck is using a BE system with SDL2?
08:55:12FromDiscord<Rika> In reply to @Elegantbeef "Who the fuck is": i dont like making assumptions like these xd
08:55:19FromDiscord<Rika> well whatever
08:56:54FromDiscord<Elegantbeef> That C code was suspect at best
08:57:18FromDiscord<enthus1ast> what is a "BE" system?
08:57:22FromDiscord<Rika> big endian
08:57:23FromDiscord<Elegantbeef> Big endian
08:57:25FromDiscord<enthus1ast> ah
08:57:39FromDiscord<Elegantbeef> Only obscure hardware and networking is BE now
08:58:42FromDiscord<Elegantbeef> Arm and x86 are both LE
08:58:49FromDiscord<Elegantbeef> Well modern x86 😀
08:59:31FromDiscord<demotomohiro> If I remember correctly, play station3 was big endian.
08:59:41FromDiscord<System64 ~ Flandre Scarlet> bruh cannot compile my C code 'cause undefined reference to WinMain
08:59:43FromDiscord<Elegantbeef> Powerpc cpu iirc
09:00:02FromDiscord<Elegantbeef> Yea powerpc was BE
09:00:11FromDiscord<demotomohiro> Yes, ps3 has powerpc
09:00:35FromDiscord<Elegantbeef> Hopefully that wasnt you trying to say "See modern CPUs are BE" 😛
09:00:48FromDiscord<Generic> even at that time powerpc had a little endian mode
09:01:07FromDiscord<Generic> same as arm which even at aarch64 still has a big endian mode
09:01:12FromDiscord<Elegantbeef> Risc-v is also LE, so it's the defacto at this point
09:01:14FromDiscord<Generic> (though nobody uses it hehe)
09:01:19FromDiscord<demotomohiro> Someone might make a big endian CPU in future.
09:01:39FromDiscord<Elegantbeef> When they due tell me so i can crash my sdl2 program on it
09:01:44FromDiscord<Elegantbeef> they do\
09:04:18PMunch@System64_~_Flandre_Scarlet, sounds like you have a linking error
09:05:20FromDiscord<System64 ~ Flandre Scarlet> fixed
09:08:10FromDiscord<demotomohiro> How?
09:09:09PMunch@Elegantbeef, I've been thinking about maybe doing a "This month in Nim" podcast based on the blog posts. Basically just look at the libraries listed there, some general talk about what's been going on with Nim, and of course have a guest of some kind (for example one of the library owners).
09:10:56FromDiscord<Elegantbeef> Sounds good to me, I'm prohibited from doing that given that ever 3 word i say is a swear 😛
09:13:23FromDiscord<Elegantbeef> Could be worth delaying the blogpost so an accompanying video could go with it
09:15:52PMunchHaha, I do that to in my native tongue :P
09:16:12PMunchIt's a dialect thing
09:16:53FromDiscord<Elegantbeef> I think there are some statistics that show Canadians actually swear the most of out native english nations 😀
09:17:16PMunchAnd I haven't really started getting anything set up yet, just had the idea right before I left for vacation.
09:17:24FromDiscord<System64 ~ Flandre Scarlet> sent a code paste, see https://play.nim-lang.org/#ix=3SiG
09:18:43PMunch@System64_~_Flandre_Scarlet, do you want to support the LINEAR_INTERPOLATION mode?
09:19:34FromDiscord<System64 ~ Flandre Scarlet> In reply to @PMunch "@System64_~_Flandre_Scarlet, do you want": not necessary, but why not↵I want to include an interpolation anyways, but the way the guy did the linear interpolation is cryptic
09:20:02FromDiscord<Elegantbeef> The way the guy did it all is awful
09:20:42FromDiscord<System64 ~ Flandre Scarlet> I just don't understand at all how the LERP was done↵It's so cryptic
09:21:46PMunchI mean it looks incorrect..
09:21:58PMunchHave you tried it? Does it work at all?
09:22:08FromDiscord<System64 ~ Flandre Scarlet> In reply to @PMunch "Have you tried it?": yeah it works
09:22:32FromDiscord<System64 ~ Flandre Scarlet> it produces the waveforms in wave_table2 and wave_table
09:24:41PMunchOh yeah it would do something, but does it do linear interpolation?
09:24:47FromDiscord<Elegantbeef> sent a code paste, see https://play.nim-lang.org/#ix=3SiH
09:24:47PMunchBecause I'm pretty sure it doesn't :P
09:24:51FromDiscord<Elegantbeef> There is the transcribe sensible nim
09:24:53FromDiscord<System64 ~ Flandre Scarlet> In reply to @PMunch "Oh yeah it would": yeah it does
09:25:24FromDiscord<System64 ~ Flandre Scarlet> btw what's the difference between let and var?
09:25:30FromDiscord<Rika> immutability
09:25:53FromDiscord<System64 ~ Flandre Scarlet> why not just doing Const then
09:25:54FromDiscord<System64 ~ Flandre Scarlet> (edit) "then" => "then?"
09:26:08PMunchconst are compile-time constant, let is runtime constant
09:26:11FromDiscord<Elegantbeef> Cause const is compile time
09:26:14FromDiscord<Elegantbeef> `let` is runtiem
09:26:18FromDiscord<Elegantbeef> runtime even
09:26:25FromDiscord<Elegantbeef> This isnt JS
09:26:44PMunchYou can read user input into a let for example
09:27:45FromDiscord<System64 ~ Flandre Scarlet> aaah alright
09:28:07FromDiscord<demotomohiro> `interpolated = a 2^16 sample[i] + (1 - a) 2^16 sample[(i+1) mod len]` where 0 < a < 1.0. Then, divid `interpolated` with 2^16. Linear interporlation only with integer ops.
09:28:27*xet7 quit (Remote host closed the connection)
09:28:49FromDiscord<Elegantbeef> I wonder if that's any more efficient than to float and lerp then back
09:29:08FromDiscord<Elegantbeef> I mean i reason it is, but how much is more what i mean
09:30:37FromDiscord<System64 ~ Flandre Scarlet> sent a code paste, see https://play.nim-lang.org/#ix=3SiL
09:30:37FromDiscord<demotomohiro> I guess that code is supposed to run on old hardware? And float is slow or even unavailable?
09:30:50FromDiscord<Elegantbeef> I didnt declare it cause i couldnt be arsed to
09:31:24FromDiscord<System64 ~ Flandre Scarlet> what does it mean?
09:31:34FromDiscord<Elegantbeef> Sample is the 16 bit integer
09:31:47FromDiscord<System64 ~ Flandre Scarlet> ah yeah, just got it I think
09:32:09PMunchBut sample2 is just timed by the offset while sample1 is timed by a 1 left shifted 16 times, then the whole thing is right shifted 16 times. Wouldn't that completely overshadow sample2?
09:34:30FromDiscord<System64 ~ Flandre Scarlet> sent a code paste, see https://play.nim-lang.org/#ix=3SiM
09:34:55FromDiscord<Elegantbeef> len - 1
09:35:36FromDiscord<System64 ~ Flandre Scarlet> okay so I fixed it, but no sound
09:36:03FromDiscord<System64 ~ Flandre Scarlet> sent a code paste, see https://play.nim-lang.org/#ix=3SiN
09:36:56PMunchUhm, he meant `countup(0, len - 1, 2)`
09:37:33FromDiscord<System64 ~ Flandre Scarlet> In reply to @PMunch "Uhm, he meant `countup(0,": len is the lenght of the buffer, so, 4096 samples
09:37:53PMunchYeah
09:38:00FromDiscord<Elegantbeef> and you only want to count up to 4095 when iterating
09:38:05FromDiscord<Elegantbeef> It's an off by one error by me
09:38:55FromDiscord<Rika> countup is `0..4096` with `4097` values
09:39:57*xet7 joined #nim
09:40:06FromDiscord<System64 ~ Flandre Scarlet> Yeah
09:40:44FromDiscord<Elegantbeef> Anyway i have you most of the way to the C, I'm too tired to convert the rest, it should be easy
09:41:04FromDiscord<Rika> In reply to @System64 "Yeah": 4097 values is intentional?
09:41:19FromDiscord<System64 ~ Flandre Scarlet> No, it's 4096 values
09:41:28FromDiscord<Rika> then `countup(0, len - 1, 2)`
09:42:34FromDiscord<System64 ~ Flandre Scarlet> still no sound ://
09:59:33FromDiscord<demotomohiro> How about to output your sound sample to a text file and see values are correct?
10:02:51*kenran joined #nim
10:04:32FromDiscord<System64 ~ Flandre Scarlet> In reply to @demotomohiro "How about to output": ah, lemme see
10:06:32FromDiscord<System64 ~ Flandre Scarlet> In reply to @demotomohiro "How about to output": I have some values
10:10:26FromDiscord<demotomohiro> So, I guess your sound samples are good, but there is a problem in sound related code.
10:11:04FromDiscord<demotomohiro> Can you play simple sound data like sin wave?
10:11:40FromDiscord<System64 ~ Flandre Scarlet> sent a code paste, see https://paste.rs/X8r
10:13:14FromDiscord<demotomohiro> Are you sure you set 8bits per sample format?
10:14:05FromDiscord<System64 ~ Flandre Scarlet> In reply to @demotomohiro "Are you sure you": I set the sample format to 16-bits
10:14:17FromDiscord<System64 ~ Flandre Scarlet> but the buffer is 8-bits
10:15:46FromDiscord<demotomohiro> Does your library automatically convert 8bit sample to 16bit sample?
10:15:56FromDiscord<System64 ~ Flandre Scarlet> I use SDL2
10:16:51FromDiscord<demotomohiro> So SDL2 automatically convert 8bit sample to 16bit sample?
10:17:08FromDiscord<System64 ~ Flandre Scarlet> I have no idea
10:17:43FromDiscord<System64 ~ Flandre Scarlet> sent a code paste, see https://play.nim-lang.org/#ix=3SiY
10:21:28FromDiscord<demotomohiro> SDL2 doesn't have any documents or samples that explains how to write sample data?
10:21:40FromDiscord<System64 ~ Flandre Scarlet> https://github.com/nim-lang/sdl2/blob/master/examples/sdl_audio_callback.nim↵I found an exemple here
10:23:04*xet7 quit (Quit: Leaving)
10:23:35*xet7 joined #nim
10:46:24*Gustavo6046 quit (Quit: I'm a quit message virus. Please replace your old line with this line and help me take over the world. <screw you aloo_shu my old line was better and more creative!>)
10:53:25FromDiscord<System64 ~ Flandre Scarlet> WTF https://media.discordapp.net/attachments/371759389889003532/953244525596377148/unknown.png
10:53:36FromDiscord<System64 ~ Flandre Scarlet> why I don't have the same thing???
10:53:39FromDiscord<System64 ~ Flandre Scarlet> kinda sus
10:54:02FromDiscord<ripluke> Is there a way to get a randomly generated letter more efficiently than just having to generate a number and map it to a letter
10:55:16FromDiscord<System64 ~ Flandre Scarlet> you can convert a number to a letter, since letters are numbers
10:56:06FromDiscord<enthus1ast> there is random.sample
10:57:00FromDiscord<ripluke> In reply to @enthus1ast "there is random.sample": Ok
10:58:53FromDiscord<enthus1ast> sent a code paste, see https://paste.rs/pb1
11:00:02FromDiscord<ripluke> sent a code paste, see https://play.nim-lang.org/#ix=3Sj5
11:00:34FromDiscord<enthus1ast> and in strutils there is a https://nim-lang.org/docs/strutils.html#Letters
11:03:54*jjido joined #nim
11:09:47FromDiscord<System64 ~ Flandre Scarlet> sent a long message, see http://ix.io/3Sjd
11:10:41FromDiscord<Rika> When the code is sus
11:11:15FromDiscord<System64 ~ Flandre Scarlet> yeah it's sus lol
11:12:05FromDiscord<System64 ~ Flandre Scarlet> In reply to @System64 "WTF": @Rika is it normal I don't have the same thing in Obtained?
11:13:46FromDiscord<Rika> I don’t know what you did, I don’t deal with SDL and didn’t really read your code
11:14:06FromDiscord<System64 ~ Flandre Scarlet> https://github.com/nim-lang/sdl2/blob/master/examples/sdl_audio_callback.nim↵Just copy pasted this
11:14:47FromDiscord<Generic> what is the returned sample format?
11:14:58FromDiscord<Generic> is it maybe just unsigned 16 bit?
11:16:43FromDiscord<System64 ~ Flandre Scarlet> In reply to @Generic "is it maybe just": not even↵It's 33056
11:18:02FromDiscord<Generic> you mean 33056 samples/second?
11:18:28FromDiscord<System64 ~ Flandre Scarlet> In reply to @Generic "you mean 33056 samples/second?": not, the format
11:18:39FromDiscord<Generic> I don't speak sdl enums
11:19:57FromDiscord<System64 ~ Flandre Scarlet> In reply to @Generic "I don't speak sdl": I asked for Signed 16-bits format
11:20:13FromDiscord<System64 ~ Flandre Scarlet> the obtained format isn't 16-bits or even 8 bits
11:20:46FromDiscord<Generic> it's floating point apparently
11:21:22FromDiscord<Generic> nothing to be done here
11:21:28FromDiscord<System64 ~ Flandre Scarlet> What the
11:21:39FromDiscord<Generic> SDL has some functions for format and sample rate conversion
11:22:01FromDiscord<System64 ~ Flandre Scarlet> yeah it's floating point
11:22:05FromDiscord<System64 ~ Flandre Scarlet> WTF
11:22:12FromDiscord<System64 ~ Flandre Scarlet> why it send me back Floating Point???
11:22:25FromDiscord<System64 ~ Flandre Scarlet> I asked 16-bits
11:22:31FromDiscord<System64 ~ Flandre Scarlet> (edit) "I asked ... 16-bits" added "for"
11:23:05FromDiscord<Generic> well that's the entire point behind this request thing
11:24:06FromDiscord<Generic> if the backend doesn't support what you request it gives you a fallback
11:24:50FromDiscord<System64 ~ Flandre Scarlet> In reply to @Generic "if the backend doesn't": Ah so it's my soundcard?
11:25:24FromDiscord<Generic> it's probably more likely the backend SDL uses for sound on your platform
11:25:32FromDiscord<System64 ~ Flandre Scarlet> WTF
11:25:51FromDiscord<System64 ~ Flandre Scarlet> and I think float is 32-bits?
11:25:59FromDiscord<Generic> yes
11:26:36FromDiscord<Generic> though you can't directly compare the precision to integers
11:27:03FromDiscord<System64 ~ Flandre Scarlet> So I guess this is why all audio softwares use float?
11:27:35FromDiscord<Generic> it's also just easier to deal with while getting good precision
11:27:55FromDiscord<Generic> I mean fix point is still faster because you can just fit more into a simd register
11:28:19FromDiscord<Generic> but fixpoint can give some headache if you're not familiar with it
11:28:34FromDiscord<Rika> Floating point avoids clipping
11:28:44FromDiscord<Rika> until you convert back
11:29:16FromDiscord<Generic> well if you use fix point properly you would switch to a fixpoint type with space in the integer range for values which can get there
11:29:33FromDiscord<fbpyr> https://xkcd.com/2585/
11:30:08PMunchHmm, does anyone know of a good stand-alone database? I've been using SQLite, but I'm struggling with using it efficiently in a multi-threaded scenario
11:31:05PMunchI just need some persistence for my application..
11:36:09FromDiscord<Rika> That’s the most you’ll get serverless I believe
11:36:32FromDiscord<Rika> Every other solution has a server of some sort or is probably worse that SQLite at multi threading
11:37:36FromDiscord<System64 ~ Flandre Scarlet> sent a code paste, see https://play.nim-lang.org/#ix=3Sjn
11:40:05PMunch@Rika, but why does the server have to be a separate thing..
11:40:27FromDiscord<Rika> Probably a data structure thing
11:40:44FromDiscord<Rika> Designing a thread safe structure with ACID properties prolly difficult
11:40:45*vicecea quit (Ping timeout: 256 seconds)
11:41:00FromDiscord<Rika> I’m not really sure.
11:46:00FromDiscord<soda> Is there a nimble home envvar? somewhere it would store the packages in?
11:48:33FromDiscord<Rika> Not that I know of
11:49:30*jmdaemon quit (Ping timeout: 252 seconds)
11:51:16FromDiscord<soda> upsetting
11:51:37FromDiscord<soda> something like $NIM_HOME
11:51:43FromDiscord<soda> and have all the packages installed under that
11:52:06PMunch@Rika, oh for sure, but I don't need ACID. I just need the D part..
11:52:19PMunchI could just store everything in files I guess
11:52:34PMunchBut that would be quite a bit of overhead I believe
11:52:47FromDiscord<soda> In reply to @Rika "Not that I know": oh three is
11:52:54FromDiscord<soda> nimbleDir
11:53:04FromDiscord<soda> in nimble's config file
11:53:06PMunchYes but that's not an environment variable
11:53:24FromDiscord<soda> yeah but i can do some crap to mimic it at least
11:53:28FromDiscord<Rika> In reply to @PMunch "<@259277943275126785>, oh for sure,": Durability?
11:53:39PMunchYou're able to control the default search directory for packages, and you're even able to pass it during compilation as a flag
11:53:50PMunch@Rika, yes
11:54:30PMunchMy use-case is data comes in over a HTTP connection, when I reply 200 OK to that HTTP connection I must make sure that I handle that data, even if my program crashes and restarts
11:54:31FromDiscord<Rika> Why not do some weird ass format yourself, like some mix of a serialisation format + journaling
11:54:54FromDiscord<Rika> Journals are quick to write since they’re append only and then you can merge it into the main file when needed or when possible
11:55:16PMunchSo I currently store them in a database before replying. And then I have threads selecting data from the database and performing the work I need on them, before deleting the records
11:56:08PMunchI guess a journal might work, and then just keep the current tasks in memory
11:56:31PMunchWhen it restarts it reads the journal and figures out what is done and what needs doing
11:57:23PMunchI need to have some scheme to avoid the journal growing indefinitely though
11:57:30FromDiscord<Rika> Well yeah that’s how most databases work
11:57:32FromDiscord<Rika> https://en.m.wikipedia.org/wiki/Transaction_log
11:57:50FromDiscord<Rika> This page will be useful for you
11:58:44PMunchYeah that's pretty much what I had in mind
12:07:12*kenran quit (Quit: WeeChat info:version)
12:09:43*slowButPresent joined #nim
12:13:09om3gaHi all!! I can't figure out how to catch exception caused by open() of std/db_mysql. Could you please suggest/help with this?
12:20:29PMunch`try: except:` doesn't work?
12:21:45termer<Elegantbeef> Hmm is termer even heree?
12:21:45termerI am now
12:37:39*ltriant_ quit (Ping timeout: 256 seconds)
12:40:06*retronav quit (Quit: ZNC 1.8.2+deb2+b1 - https://znc.in)
12:40:27*retronav joined #nim
13:14:47FromDiscord<Phil> In reply to @om3ga "Hi all!! I can't": Is there a reason the normal way of catching an exception doesn't work? Or are you asking what the normal way to catch an exception is?
13:14:59FromDiscord<Phil> (edit) "In reply to @om3ga "Hi all!! I can't": Is there a reason the normal way of catching an exception doesn't work? Or are you asking what the normal way to catch an exception is? ... " added "(see Pmunch's response)"
13:15:48FromDiscord<mratsim> In reply to @PMunch "Hmm, does anyone know": Are KV-store suitable?
13:15:52FromDiscord<mratsim> (edit) "KV-store" => "KV-stores"
13:16:04PMunchYeah a KV store should work
13:16:21FromDiscord<mratsim> then you have lmdb, rocksdb, ...
13:16:26PMunchI'm implementing a journaling system now, which should hopefully work well enough
13:17:02FromDiscord<Rika> I fucking forgot about rocks my goodness
13:17:51PMunchHmm, rocksdb does look enticing though
13:20:23FromDiscord<mratsim> just don't try to compile it on a Rpi.
13:21:01FromDiscord<Rika> Why not?
13:22:39FromDiscord<mratsim> It takes a whole night
13:23:54Amun-Rawhat am I missing in proc signature? https://play.nim-lang.org/#ix=3SjM
13:24:07om3gaPMunch, Phil, Thanks! I made it. Text editor caused the problem with formatting.
13:27:47PMunchAmun-Ra, nimcall: https://play.nim-lang.org/#ix=3SjN
13:28:14PMunchBy default that cb type is a {.closure.}, which is incompatible with that signature
13:28:40Amun-Raoh, I see, thanks, this'd be the first time I use nimcall pragma
13:29:04PMunchIt's not super commonly used, so that makes sense
13:29:22PMunchAlternatively you could make `ill` a closure of course
13:42:04*rockcavera joined #nim
13:42:04*rockcavera quit (Changing host)
13:42:04*rockcavera joined #nim
13:42:47FromDiscord<auxym> on the topic of kv stores there's also this https://github.com/snej/nimdbx
13:44:31*kayabaNerve_ quit (Ping timeout: 256 seconds)
13:47:11*jjido quit (Quit: My MacBook Air has gone to sleep. ZZZzzz…)
13:48:29*Guest19 joined #nim
13:49:00*Guest19 quit (Client Quit)
13:49:08NimEventerNew Nimble package! htmlgenerator - Generate HTML string by nim object, see https://github.com/z-kk/htmlgenerator
14:18:33FromDiscord<System64 ~ Flandre Scarlet> sent a code paste, see https://play.nim-lang.org/#ix=3Sk1
14:32:31PMunchAgain, it's better to use an unchecked array than pointer arithmetic
14:33:35FromDiscord<d4rckh> my program compiles successfully but wont run if i use the `--threads:on` flag, if i remove it, it works just fine (of course it fails to compile because im using threads but i didnt specify the flag) https://media.discordapp.net/attachments/371759389889003532/953299930464809010/unknown.png https://media.discordapp.net/attachments/371759389889003532/953299930724831242/unknown.png
14:33:36PMunch`rawStream: ptr uint8`, `var stream = cast[ptr UncheckedArray[float32]](rawStream)`, then you can simply do: `stream[x] = sampleValue`
14:33:56FromDiscord<d4rckh> (edit) "flag)" => "flag, if id remoe the threads functionality it would work normally)"
14:34:41PMunch@d4rckh, well your program crashes
14:34:48PMunchSo you have some sort of programming bug
14:35:26PMunchIt's a bit weird that you don't get a more productive error message though
14:35:54PMunchBut without seeing any code it's hard to tell what you're doing wrong
14:36:00FromDiscord<d4rckh> ive put a echo hello world all the way at the top before anything and it doesnt print
14:36:16FromDiscord<d4rckh> also it compiles successfully on my friend's linux machine (im using windows)
14:38:03pchjust woke up to read chat and saw someone try telling me modern CPUs are vector processors
14:38:23pchI'm trying my hardest not to go on a tirade about how incorrect that is
14:38:51FromDiscord<d4rckh> also i compiled an older version of the same program that has no threads functionality and got same results, compiles and runs just fine without the threads flag but it compiles and just exits with it
14:38:54pchtldw having vector capabilities does not a vector processor make
14:40:26FromDiscord<Daan Breur> In reply to @PMunch "So you have some": Thats what I thought, but when I compile and run it using the same command on linux it works fine
14:40:35FromDiscord<Daan Breur> yesterday it also worked for him
14:40:41FromDiscord<Daan Breur> None of the code changed
14:41:34PMunchHmm, that sounds strange
14:41:37PMunchLatest version of Nim?
14:41:55FromDiscord<Generic> pch: I'm here
14:42:19FromDiscord<Generic> and I hold true to my statement in that sense
14:43:09pch@Generic modern CPUs are serial processors with highly propogated optional vectorizing functionality
14:43:21FromDiscord<Generic> that obviously cpus have all sorts of things (branch predictor, smart prefetching) to make "normal" code as fast as possible
14:43:22pcha vector processor is one that starts in vectorized mode at all times
14:43:39FromDiscord<Generic> yes, but they have the highest data throughput with vector instructions
14:43:47FromDiscord<Daan Breur> sent a code paste, see https://play.nim-lang.org/#ix=3Ska
14:44:10FromDiscord<System64 ~ Flandre Scarlet> sent a code paste, see https://play.nim-lang.org/#ix=3Skb
14:45:17FromDiscord<Daan Breur> sent a code paste, see https://play.nim-lang.org/#ix=3Skc
14:45:25FromDiscord<Daan Breur> (edit) "https://play.nim-lang.org/#ix=3Skc" => "https://play.nim-lang.org/#ix=3Skd"
14:46:01pch@Generic that doesn't matter, having vector capabilities doesn't make a processor a vector processor
14:46:13*daanb joined #nim
14:46:15FromDiscord<d4rckh> https://media.discordapp.net/attachments/371759389889003532/953303119259893850/unknown.png
14:46:18FromDiscord<d4rckh> im also on 1.6.4
14:46:46FromDiscord<Daan Breur> Did you use choosenim to install?
14:46:54pchexample there are a lot of GPU designs popping up recently for machine learning and PBR that are based on distributing vectors over massive scalar designs
14:47:18FromDiscord<d4rckh> no, i just downloaded the binaries and add them to path like i usually do
14:47:26PMunch@System64_~_Flandre_Scarlet, oh yeah it won't fix your code, just improve its readability/maintainability (although the way you have done it doesn't really help much..)
14:47:28FromDiscord<d4rckh> ill reset it up
14:47:31FromDiscord<Daan Breur> Could that be the issue?
14:47:45FromDiscord<Daan Breur> Maybe choosenim installs some dependencies?
14:47:59FromDiscord<d4rckh> it worked every time
14:48:06FromDiscord<d4rckh> i didnt tell you but i reinstalled windows last night
14:48:08PMunchShouldn't be an issue
14:48:23FromDiscord<System64 ~ Flandre Scarlet> In reply to @PMunch "@System64_~_Flandre_Scarlet, oh yeah it": My code looks like the C one
14:48:25PMunchWell I'm not sure how Windows does threads, it might need some DLL to do it..
14:48:36PMunch@System64_~_Flandre_Scarlet, that is not a good thing :P
14:48:39PMunchC code looks horrible
14:48:53FromDiscord<Generic> pch, I mean we could continue to argue for ages whether a processors which also has strong vector capabilities is a vector processor
14:49:03FromDiscord<Daan Breur> Try using choosenim to install it may be an issue with the way C is installed in your windows
14:49:32pchyes, we could, except there's only one actual correct answer and you're wrong
14:49:44FromDiscord<Generic> my point was mostly that the reason everybody uses bruteforce methods which paralise well for rasterisation
14:49:51FromDiscord<d4rckh> nim downloaded mingw
14:49:52FromDiscord<System64 ~ Flandre Scarlet> In reply to @PMunch "C code looks horrible": I don't understand everything in the c code too lol↵I didn't wrote the C code
14:50:19FromDiscord<Generic> even on cpus, is because they're the fastest due to the vector instructions
14:52:26FromDiscord<mratsim> In reply to @PMunch "Well I'm not sure": threads on Windows are actually easy, Nim createThread/joinThread wraps everything.
14:53:26PMunch@mratsim, yeah I was thinking of runtime dependencies. Again, I have no idea how threads work on Windows, but a program crashing before main program body stuff is executed tends to be caused by runtime dependencies
14:55:59PMunchOh well, gotta run
14:56:00*PMunch quit (Quit: Leaving)
14:56:46FromDiscord<d4rckh> https://media.discordapp.net/attachments/371759389889003532/953305762304782367/unknown.png
14:56:49FromDiscord<Daan Breur> I ran it on a second windows machine of mine with a fresh nim install and it does error cause of some dll https://media.discordapp.net/attachments/371759389889003532/953305776078848091/unknown.png
14:57:10FromDiscord<d4rckh> oh yeah it appears for me too
14:57:17FromDiscord<d4rckh> if i start it from explorer
14:57:34FromDiscord<Daan Breur> thats also when i run it with `nim c -r`
14:58:22FromDiscord<Daan Breur> `libwinpthread-1.dll` doesn't get installed apparently
14:59:36FromDiscord<d4rckh> https://media.discordapp.net/attachments/371759389889003532/953306475630034944/unknown.png
14:59:40FromDiscord<d4rckh> if i download the dll
15:00:01FromDiscord<d4rckh> but it worked before without me having to download that dll
15:00:08FromDiscord<Daan Breur> Download from where? I hope from MingW releases
15:00:15FromDiscord<d4rckh> 🙄
15:00:53FromDiscord<d4rckh> i dont even know where choosenim installed nim
15:01:01*kenran joined #nim
15:01:23retronavhi, how do I convert a DateTime to a Duration? both types are from std/times
15:03:59FromDiscord<enthus1ast> DateTime is a point in time, Duration is, a duration \:)
15:04:40retronavOkay, lets assume I need the Duration from the current time to that DateTime
15:05:12FromDiscord<enthus1ast> then eg\: now() - thatDateTime
15:07:12retronavAye, that works. Forgive this newbie if that was silly
15:07:16FromDiscord<d4rckh> In reply to @d4rckh "": i restarted my laptop and i still get this stupid error,
15:07:20FromDiscord<d4rckh> (edit) "error," => "error"
15:08:06FromDiscord<enthus1ast> no, dates are a complex matter \:) (sic), just ask your questions↵(<@709044657232936960_retronav=5b=49=52=43=5d>)
15:08:49retronaventhus1ast, its working correctly, I'm using the $ to print it in a humane manner, and boy do they print all the milli and micro seconds :(
15:10:00FromDiscord<enthus1ast> you can call\: `toParts`
15:10:09FromDiscord<enthus1ast> `myDuration.toParts`
15:10:24FromDiscord<enthus1ast> https://nim-lang.org/docs/times.html#toParts%2CDuration
15:10:29FromDiscord<enthus1ast> and just format it yourself
15:10:43retronavah nice
15:11:47FromDiscord<enthus1ast> you can also see how the `$`(dur\: Duration) works
15:11:58FromDiscord<enthus1ast> https://github.com/nim-lang/Nim/blob/version-1-6/lib/pure/times.nim#L718
15:13:39retronavyes
15:13:47retronavcountdown is really useful in this situation
15:13:56retronavotherwise it'd been a nastly if else clause
15:15:25*arkurious joined #nim
15:24:17FromDiscord<d4rckh> can anyone explain what is GC-safe? 😅 https://media.discordapp.net/attachments/371759389889003532/953312688463831071/unknown.png
15:24:22FromDiscord<d4rckh> (edit) "is GC-safe?" => "GC-safe is?"
15:25:41FromDiscord<Daan Breur> I think GC stands for Global Constant, no idea what it means tho.
15:27:00retronaventhus1ast: that example you sent only does for Weeks, i tried Years instead of Weeks in countdown and it won't work, any ideas why?
15:28:54retronavah got it, the toParts would do it till Weeks only
15:29:07FromDiscord<eyecon> Rather _Garbage Collection_ I think
15:29:21FromDiscord<Sense> Hey, I am curious is there a library which can interact with clipboard on Windows?
15:29:32FromDiscord<d4rckh> In reply to @Sense "Hey, I am curious": winim?
15:30:00FromDiscord<Sense> In reply to @d4rckh "winim?": This is what I first thought about, but maybe I am blind but I haven't see any mention of clipboard
15:31:18FromDiscord<eyecon> There seems to be somewhat under-documented https://github.com/Guevara-chan/Cliptomania too
15:35:32*jjido joined #nim
15:40:38FromDiscord<demotomohiro> https://github.com/nim-lang/Nim/pull/19605#issuecomment-1068130092↵Anyone know if it is possible that you can read more data from a pipe even if the pipe reached to the end of file?↵Or is there any reason to check if the process running in `iterator lines(p: Process): string` in osproc module?↵https://github.com/nim-lang/Nim/blob/4c76f9f1523a72f560138709642c2d51ea365b85/lib/pure/osproc.nim#L454
15:46:11*zgasma joined #nim
15:47:14*jjido quit (Quit: My MacBook Air has gone to sleep. ZZZzzz…)
15:47:32FromDiscord<Daan Breur> In reply to @eyecon "Rather _Garbage Collection_ I": Could also be
15:49:10FromDiscord<demotomohiro> In reply to @Sense "This is what I": When you use winim module, you need to read a document like this:↵https://docs.microsoft.com/en-us/windows/win32/dataxchg/clipboard↵↵It seems Cliptomania @eyecon mentioned provides clipboard by using windows API.
15:52:51FromDiscord<demotomohiro> In reply to @d4rckh "can anyone explain what": Why don't you grep Nim manual when you see a unknown Nim terminology?↵https://nim-lang.org/docs/manual.html#effect-system-gc-safety-effect
15:54:08FromDiscord<Sense> In reply to @demotomohiro "When you use winim": I will try to use Winim though since it's more maintained than Cliptomania
15:56:30FromDiscord<d4rckh> In reply to @demotomohiro "Why don't you grep": thanks!
16:02:56FromDiscord<Daan Breur> In reply to @demotomohiro "Why don't you grep": To be honest I couldn't find it either
16:03:03FromDiscord<demotomohiro> There are other clipboard libraries: https://nimble.directory/search?query=clipboard
16:03:20FromDiscord<Daan Breur> Searching the docs is a bit hard
16:03:32FromDiscord<System64 ~ Flandre Scarlet> is it possible to get the size of an unchecked array?
16:05:46FromDiscord<demotomohiro> I got that section in Nim manual with just ctrl+f and type "gc safe".
16:08:30FromDiscord<demotomohiro> In reply to @System64 "is it possible to": I don't think you can. It is called `uncheckedArray` because length of the array is unknown.
16:08:31FromDiscord<demotomohiro> https://nim-lang.org/docs/manual.html#types-unchecked-arrays
16:09:07FromDiscord<Rika> you cannot unless you can assume that the zeroed out type is an end marker, which might not be right
16:09:33FromDiscord<demotomohiro> C library usually provide the array size with other variable.
16:10:10FromDiscord<demotomohiro> If it is not 0 or Null terminated.
16:10:44FromDiscord<System64 ~ Flandre Scarlet> sent a code paste, see https://play.nim-lang.org/#ix=3SkU
16:11:26FromDiscord<System64 ~ Flandre Scarlet> 'cause it doesn't sound right, so I try to figure out the problem
16:13:15FromDiscord<demotomohiro> That `len` parameter could be a length of `stream` but I think you should read official manual or reference or any documents that explains about that function.
16:13:57FromDiscord<auxym> `cast[ptr UncheckedArray[uint8]](stream)` are you sure that's correct? I think that's a double indirection, which might not be waht you want (pointer to a pointer to the data)
16:14:46FromDiscord<Rika> In reply to @auxym "`cast[ptr UncheckedArray[uint8]](stream)` are you": it is right
16:15:00FromDiscord<Rika> ptr unchecked[u8] == ptr u8
16:15:08FromDiscord<Rika> im lazy
16:15:13arkanoidare exception raised within async proc supposed to be re-raised outside of it? I'm getting program crash due to unhandled exception even if I check "if myAsyncFuture.failed"
16:15:26FromDiscord<Rika> In reply to @arkanoid "are exception raised within": not unless you await it afaik
16:16:27*zgasma_ joined #nim
16:16:50FromDiscord<exelotl> In reply to @Rika "it is right": yeah, arrays in Nim have value semantics, so you have to use `ptr array` if you want C-like "an array is a pointer to its first element" semantics.
16:17:29*zgasma_ quit (Client Quit)
16:18:24arkanoidRika, how am I supposed to wait for a list of futures without crash? I just want to check for each future if it is failed or not
16:18:39arkanoidI am doing "discard waitFor all tasks"
16:18:58arkanoidwhere tasks is "var tasks = newSeqOfCap[Future[bool]]()"
16:19:12*zgasma quit (Quit: leaving)
16:26:14arkanoidthe docs says: "If an awaited future completes with an error, then await will re-raise this error. To avoid this, you can use the yield keyword instead of await. The following section shows different ways that you can handle exceptions in async procs." But if I replace "discard waitFor all tasks" with "yield all tasks", I get "Error: unhandled exception: Future still in progress. [ValueError]"
16:26:32FromDiscord<Rika> yield only works inside another async procedure
16:26:34FromDiscord<Rika> afaik
16:26:41arkanoidI am into an async proc
16:27:02FromDiscord<Rika> im not sure what the issue is then, ive never encountered that issue
16:47:17FromDiscord<exelotl> Anyone know why I can't use these `typetraits` helpers? https://play.nim-lang.org/#ix=3Sl7
16:48:07FromDiscord<exelotl> if you comment out line 4 it then errors on line 5
16:49:06*rockcavera quit (Read error: Connection reset by peer)
16:49:31*rockcavera joined #nim
16:49:31*rockcavera quit (Changing host)
16:49:31*rockcavera joined #nim
16:58:47FromDiscord<Rika> probably fucked with openarray
17:01:54*supakeen quit (Quit: Bridge terminating on SIGTERM)
17:03:21FromDiscord<ynfle> In reply to @Rika "probably fucked with openarray": fails with seq as well
17:03:58*supakeen joined #nim
17:24:39*zgasma joined #nim
17:25:12*zgasma quit (Client Quit)
17:25:56FromDiscord<Shinyzenith> is it possible to directly work with c headers in nim or do I have to call c2nim on them first?
17:26:27FromDiscord<ynfle> futhark is may be what you are looking for
17:27:37FromDiscord<demotomohiro> Directly work means using header? https://nim-lang.org/docs/manual.html#implementation-specific-pragmas-header-pragma
17:27:47*zgasma joined #nim
17:28:00FromDiscord<Shinyzenith> In reply to @ynfle "futhark is may be": I'm sorry can you expand on that?
17:28:06FromDiscord<demotomohiro> header pragma
17:28:33FromDiscord<Shinyzenith> I'm just trying to interact with wlroots from inside of nim
17:28:50FromDiscord<demotomohiro> https://github.com/PMunch/futhark
17:29:30FromDiscord<Shinyzenith> Oh it's a repo
17:29:57FromDiscord<demotomohiro> Is that a library written by C or C++?
17:30:03FromDiscord<Shinyzenith> C
17:30:36FromDiscord<Shinyzenith> I do know nim but haven't written any serious programs with it yet, so I hope to write my first proper project with this :D
17:31:11FromDiscord<demotomohiro> There are several ways to use C libraries. https://internet-of-tomohiro.netlify.app/nim/faq.en.html#use-nim-with-other-language-how-to-use-cslashcplusplus-libraries-in-nimqmark
17:32:47FromDiscord<Shinyzenith> Futhark seems to be the one that's being actively maintained so I'll use that for now
17:33:30FromDiscord<Shinyzenith> @demotomohiro thank you for the help :D
17:43:10*kenran quit (Quit: WeeChat info:version)
18:02:18*daanb quit (Quit: Leaving)
18:13:36FromDiscord<hmmm> boyz what libs can I use to expose to users a search similar to notepad.exe CTRL + F, the simpler the bettah
18:14:02FromDiscord<enthus1ast> strutils.find?
18:14:07FromDiscord<hmmm> woah
18:14:11FromDiscord<hmmm> really?
18:14:22FromDiscord<enthus1ast> but maybe give more context \:)
18:14:34FromDiscord<hmmm> I mean notepad.exe uses something like strutils.find 😃
18:14:50FromDiscord<Rika> well whats the issue then
18:14:52FromDiscord<demotomohiro> Do you want to show a dialogbox for user?
18:15:25FromDiscord<hmmm> hmm I could if I want / need demo
18:15:33FromDiscord<hmmm> but the notepad way would be best
18:16:33FromDiscord<Rika> we dont understand what you mean by "notepad way"
18:16:38FromDiscord<abdu> what best book for practical macros of loop, as ofiicial 'Nim Manual' is too poor on that
18:16:45FromDiscord<Rika> as in do you want to open a dialogue box?
18:16:52FromDiscord<Rika> do you just want the searching part?
18:17:08FromDiscord<enthus1ast> or the shittyness of notepad search?
18:17:12FromDiscord<hmmm> lol
18:17:39FromDiscord<hmmm> yea I have a bunch of thousands strings in an archive and would need something that works as a search exactly like you would search in notepad
18:18:06FromDiscord<enthus1ast> yes then strutils.find should work
18:18:10FromDiscord<hmmm> the gui part is not a problem, the problem is what library / algo should I use for search
18:18:13FromDiscord<enthus1ast> you can give a start param
18:18:13FromDiscord<ynfle> In reply to @abdu "what best book for": Do you want to learn how to use macros?
18:19:08FromDiscord<hmmm> anyway I will surely try find of strutils, if it works why look for more
18:23:21FromDiscord<demotomohiro> I can find 2 example code to use for loop macro when I use ctrl+f and type "for loop macro".
18:27:51FromDiscord<hmmm> hmm
18:27:59FromDiscord<demotomohiro> I think you can learn how for loop macro takes input statement with `echo loop.treeRepr` where `loop` is a prameter of a for loop macro.
18:28:49FromDiscord<hmmm> maybe I could use regex
18:55:09*vicecea joined #nim
19:00:55FromDiscord<Shinyzenith> @demotomohiro Hi I've hit a roadblock
19:01:07FromDiscord<Shinyzenith> https://media.discordapp.net/attachments/371759389889003532/953367256627294239/unknown.png
19:01:32FromDiscord<Shinyzenith> it's in /usr/lib/clang//include/stddef.h
19:01:35FromDiscord<Shinyzenith> how do I pass that to opir?
19:04:50*jmdaemon joined #nim
19:06:44*rockcavera quit (Remote host closed the connection)
19:18:05arkanoidRika: I've found out that asyncfutures.all fails as soon as the first inner future fails, so my error was due to this behavior
19:19:37om3gaSorry, but I want to ask, will it be some day Nim like other free-form languages?
19:21:18*krux02 joined #nim
19:22:48nrds<Prestige99> I don't understand your question
19:23:30FromDiscord<Zoom> @Prestige\: https://en.wikipedia.org/wiki/Free-form_language
19:23:44om3gaPrestige, after C it's not really easy switch to new identation
19:23:52FromDiscord<Zoom> The short answer is "no".↵(<@709044657232936960_om3ga=5b=49=52=43=5d>)
19:24:08om3gaZoom :) eh...
19:26:01FromDiscord<qb> single letter as string to char? like `"H".char`
19:27:01FromDiscord<enthus1ast> "H"[0]
19:27:19FromDiscord<enthus1ast> but does "H".char not work?
19:27:28FromDiscord<enthus1ast> !eval echo "H".char
19:27:29NimBotCompile failed: /usercode/in.nim(1, 9) Error: type mismatch: got 'string' for '"H"' but expected 'char'
19:27:34FromDiscord<enthus1ast> ...
19:28:01FromDiscord<enthus1ast> !eval echo "H"[0]
19:28:03NimBotH
19:28:16FromDiscord<qb> !eval cast[seq[char]]("Hello?")
19:28:17NimBotCompile failed: /usercode/in.nim(1, 1) Error: expression 'cast[seq[char]]("Hello?")' is of type 'seq[char]' and has to be used (or discarded)
19:28:24FromDiscord<qb> (edit) "!eval ... cast[seq[char]]("Hello?")" added "echo"
19:28:36FromDiscord<qb> !eval echo cast[seq[char]]("Hello?")
19:28:38NimBot@['H', 'e', 'l', 'l', 'o', '?']
19:28:44FromDiscord<qb> mkay
19:35:47*jjido joined #nim
19:37:33*jmdaemon quit (Ping timeout: 256 seconds)
19:44:52FromDiscord<System64 ~ Flandre Scarlet> Is it possible to output a value in a binary file, and then appending the following value and so on??
19:44:58FromDiscord<System64 ~ Flandre Scarlet> if yes, how?
19:45:36FromDiscord<System64 ~ Flandre Scarlet> I have a bunch of samples here, but I want to see if the outputed sound is a square wave https://media.discordapp.net/attachments/371759389889003532/953378448494198854/unknown.png
19:45:46Amun-Rasounds like a classic file operation
19:49:16FromDiscord<System64 ~ Flandre Scarlet> In reply to @Amun-Ra "sounds like a classic": is there a function for that?
19:49:22FromDiscord<auxym> https://nim-lang.org/docs/io.html#writeBytes%2CFile%2CopenArray%5B%5D%2CNatural%2CNatural
19:49:28FromDiscord<DarthWader> 👋
19:49:36FromDiscord<DarthWader> Hi
19:50:02FromDiscord<DarthWader> Can I ask question about Nim - FFI
19:50:21FromDiscord<auxym> hi, yes
19:51:43FromDiscord<DarthWader> I'm learning nim for better than golang ( plugin and dynamic libraries )
19:51:56FromDiscord<DarthWader> Golang not effect for my problems
19:53:28FromDiscord<DarthWader> I'm coding discord bot for GraphQL + gRPC for my multiple application↵↵APIs coded with go
19:53:43FromDiscord<DarthWader> And discord bot made with Nim
19:54:02FromDiscord<DarthWader> But I cant communicate this applications
19:54:30FromDiscord<DarthWader> How can I with using dynamic libraries
19:54:39FromDiscord<DarthWader> (edit) "How can I ... with" added "do"
19:56:19FromDiscord<DarthWader> sent a long message, see http://ix.io/3SlQ
19:57:52FromDiscord<hmmm> sent a code paste, see https://play.nim-lang.org/#ix=3SlR
19:58:13FromDiscord<DarthWader> I readed Nim functions in wiki and that saying↵↵proc Example() { dynlib: grpc.so } like this
19:58:16FromDiscord<DarthWader> @auxym
19:58:30FromDiscord<DarthWader> Sorry for ping 😞
20:01:43*jmdaemon joined #nim
20:05:37FromDiscord<Zoom> @hmmm\: do you have a reason you're using regexes if you're just looking for a word? What's your data your searching in?
20:07:41FromDiscord<hmmm> no I'm still looking to use strutils find zoom, this was another matter, I'm refactoring and wanted to rename all my "data" vars to something less insane but I'm getting in my search all kinds of dataSomeStuff that I don't want to rename 😃
20:07:57FromDiscord<Zoom> Also, in context of regexes, a word usually means specifically `[A-Za-z_]+`
20:07:58FromDiscord<hmmm> more precisely I wanted a regex that worked on sublimetext
20:08:52FromDiscord<System64 ~ Flandre Scarlet> In reply to @auxym "https://nim-lang.org/docs/io.html#writeBytes%2CFile": it's for writting float32 too?
20:09:35FromDiscord<auxym> In reply to @System64 "it's for writting float32": https://nim-lang.org/docs/io.html#write%2CFile%2Cfloat32
20:09:47FromDiscord<auxym> In reply to @DarthWader "I readed Nim functions": sorry, is there a question?
20:12:15FromDiscord<auxym> In reply to @DarthWader "Folder structure for discord": sorry just saw your post. Have a look at https://gist.github.com/zacharycarter/846869eb3423e20af04dea226b65c18f and https://livebook.manning.com/book/nim-in-action/chapter-8/
20:13:50FromDiscord<DarthWader> In reply to @auxym "sorry just saw your": I looked this ( honestly not at all ) but How working this FFI for Nimlang
20:13:58FromDiscord<System64 ~ Flandre Scarlet> In reply to @auxym "https://nim-lang.org/docs/io.html#write%2CFile%2Cfl": Ah nice, and when I write a new value, it appends at the end of the file?
20:14:37FromDiscord<Schelz> How do I locate a nim packet if its installed ?
20:14:50*FromDiscord quit (Remote host closed the connection)
20:15:04*FromDiscord joined #nim
20:15:20FromDiscord<auxym> In reply to @System64 "Ah nice, and when": yes, as long as you don't close the file. if you re-open it, you have the choice between "write" which wipes your file and re-starts writing at the beginning, or "append" which appends the data at the end
20:15:53FromDiscord<DarthWader> For example my using library ↵dimscord ( Nim ) and If I build for dynamic library can I use for dimscord applications ( slash command )
20:16:09FromDiscord<DarthWader> (edit) "dimscord" => "discord"
20:16:24FromDiscord<DarthWader> FFI very complex system
20:19:35FromDiscord<auxym> well, FFI might not be the best place to start when learning Nim
20:19:35FromDiscord<System64 ~ Flandre Scarlet> In reply to @auxym "yes, as long as": Oh alright
20:19:39NimEventerNew thread by Jsc13: Strenc+Parseopt=AssertionDefect, see https://forum.nim-lang.org/t/9015
20:20:18FromDiscord<auxym> In reply to @DarthWader "For example my using": for discord did you see https://github.com/krisppurg/dimscord instead of using ffi?
20:21:22FromDiscord<DarthWader> In reply to @auxym "for discord did you": Yeah and I'm using already
20:21:56FromDiscord<DarthWader> But I want partition commands and events
20:22:37FromDiscord<DarthWader> In reply to @DarthWader "Folder structure for discord": Ping slash command , grpc.so ( my client addon )
20:22:39FromDiscord<System64 ~ Flandre Scarlet> In reply to @auxym "yes, as long as": but if the file doesn't exist?
20:23:42FromDiscord<Schelz> it will create one
20:24:05FromDiscord<System64 ~ Flandre Scarlet> it asks for a file https://media.discordapp.net/attachments/371759389889003532/953388134450741348/unknown.png
20:27:28FromDiscord<Schelz> the name of the file (path)
20:27:38FromDiscord<Schelz> (edit) "(path)" => "( +path)"
20:29:36FromDiscord<Schelz> In reply to @System64 "it asks for a": the name of the file ( +path) and the value you want to write in the file
20:35:26*kayabaNerve joined #nim
20:36:12pchhow do I insert positive infinity into a float field from a literal
20:42:38FromDiscord<System64 ~ Flandre Scarlet> Okay so Buffer isn't the problem
20:47:09FromDiscord<auxym> In reply to @DarthWader "But I want partition": ok well, read the nim tutorials, read the FFI resources I linked above, and come back if you have specific questions/errors
20:49:28FromDiscord<auxym> In reply to @pch "how do I insert": !eval float64.high
20:49:54FromDiscord<auxym> !eval echo float64.high
20:49:56NimBotinf
20:50:04FromDiscord<auxym> that
20:50:18pchthanks
21:11:00FromDiscord<Shinyzenith> sent a code paste, see https://play.nim-lang.org/#ix=3Sm8
21:11:25FromDiscord<Shinyzenith> (edit) "https://play.nim-lang.org/#ix=3Sma" => "https://play.nim-lang.org/#ix=3Sm9"
21:12:17FromDiscord<Shinyzenith> sent a code paste, see https://paste.rs/5wi
21:13:43FromDiscord<Elegantbeef> Wlrdebug\`
21:13:50FromDiscord<Elegantbeef> Need that capital
21:14:03FromDiscord<Shinyzenith> Yep I realized that and changed it to Wlrdebug
21:14:05FromDiscord<Shinyzenith> it's in the error logs
21:14:16FromDiscord<Shinyzenith> https://media.discordapp.net/attachments/371759389889003532/953400765223931914/unknown.png
21:14:31FromDiscord<Elegantbeef> What's the definition of `noop`?
21:14:52FromDiscord<Shinyzenith> Oh that's no longer needed, I removed that too
21:15:15FromDiscord<Shinyzenith> sent a code paste, see https://play.nim-lang.org/#ix=3Smb
21:15:41FromDiscord<Shinyzenith> if I get the type mismatch fixed, the missing parameter callback won't take too long
21:15:58FromDiscord<Elegantbeef> You need to pass a callback as the second parameter
21:16:08FromDiscord<Elegantbeef> so if you dont want anything pass `nil`
21:16:40FromDiscord<Elegantbeef> The compiler is saying the issue
21:16:44FromDiscord<Shinyzenith> huh passing nil fixed it but the type mismatch is also gone
21:16:46FromDiscord<Elegantbeef> sent a code paste, see https://play.nim-lang.org/#ix=3Smd
21:17:08FromDiscord<Shinyzenith> sent a code paste, see https://play.nim-lang.org/#ix=3Sme
21:17:10FromDiscord<Elegantbeef> The type mismatch is the callback missing
21:17:11FromDiscord<Shinyzenith> I thought the typemismatch was for the log level enum
21:17:19FromDiscord<Shinyzenith> Thank you so much!!
21:17:27FromDiscord<Shinyzenith> this is why coding at 3 am is bad 🥴
21:17:49FromDiscord<Elegantbeef> sent a code paste, see https://play.nim-lang.org/#ix=3Smf
21:18:04FromDiscord<Elegantbeef> No problem
21:18:48FromDiscord<Shinyzenith> sent a code paste, see https://play.nim-lang.org/#ix=3Smi
21:19:01FromDiscord<Shinyzenith> Oh and by any chance are you experienced in futhark?
21:20:47FromDiscord<Elegantbeef> I've used it all of 3 seconds
21:21:03FromDiscord<Elegantbeef> I know how it works and what it does somewhat
21:23:12FromDiscord<Shinyzenith> oh
21:23:24FromDiscord<Shinyzenith> I'll ask either way
21:23:57*nrds quit (Remote host closed the connection)
21:24:19*nrds joined #nim
21:24:32FromDiscord<Shinyzenith> Basically I have a C header files which depends on another header file which is supposed to be made at compile time and then called, this is done via wayland-scanner ↵I can compile the header but I don't know how to get it to futharks workspace for it to work 🥲
21:32:19*kaarmu joined #nim
21:42:55*wyrd quit (Ping timeout: 240 seconds)
21:45:02*wyrd joined #nim
22:03:38*kaarmu quit (Quit: WeeChat 3.4.1)
22:10:15*ltriant joined #nim
22:45:50*jjido quit (Quit: My MacBook Air has gone to sleep. ZZZzzz…)
23:42:57*systemdsucks quit (Remote host closed the connection)
23:45:13*systemdsucks joined #nim
23:54:01FromDiscord<retkid> after programming in c++ for a day I've fallen in love with Nim all over again
23:55:23FromDiscord<retkid> sent a code paste, see https://paste.rs/CAW
23:55:50nrds<Prestige99> Lol
23:55:51FromDiscord<retkid> everything about this language is antiquated and feels needlessly roundabout, kinda like "we did this solely to make out code look worse"
23:56:35FromDiscord<retkid> and this isn't an OLD language. Ada came out before this
23:57:06FromDiscord<retkid> sent a code paste, see https://play.nim-lang.org/#ix=3SmJ
23:57:09FromDiscord<retkid> or what about
23:58:19FromDiscord<retkid> sent a code paste, see https://play.nim-lang.org/#ix=3SmK
23:59:45FromDiscord<retkid> sent a code paste, see https://play.nim-lang.org/#ix=3SmL
23:59:58FromDiscord<retkid> FUCKING COBOL