<< 26-04-2024 >>

00:03:35rockcaveraIs there any way to transform a `ptr T` into an `openArray[T]`? The size of `ptr T` is known
01:10:11FromDiscord<Elegantbeef> Rockavera `cast[ptr UncheckedArray[T]](yourPtr).toOpenArray(0, len -1 )`
01:10:55*xet7 joined #nim
01:12:38*krux02_ quit (Remote host closed the connection)
01:20:49rockcaveraElegantbeef, I didn't know there was a `toOpenArray()` for `UncheckedArray[T]`. Thanks
01:59:02FromDiscord<sOkam! 🫐> In reply to @PMunch "<@259277943275126785>, well you can,": wait, please explain 👀
02:02:31FromDiscord<sOkam! 🫐> In reply to @strogon14 "I'm using nimscript, i.e.": I made `confy` for this reason. might be worth taking a look if you are already pushing nimscript to its limit with such "complex" tasks as making a symlink↵_sarcastic, btw. its a simple task, and easily doable in non-nimscript. but it's not exposed to the vm, because... nimscript 🤷‍♂️_↵https://github.com/heysokam/confy
02:03:50strogon14sOkam!, thanks, I'll definitely have a look.
02:05:59FromDiscord<sOkam! 🫐> @ElegantBeef do you know anything about that comment from @pmunch about not importing the implictely imported `system`?
02:15:32*SchweinDeBurg quit (Quit: WeeChat 4.3.0-dev)
02:23:22*def- quit (Quit: -)
02:24:30*def- joined #nim
02:27:42*def- quit (Client Quit)
02:27:53*def- joined #nim
02:57:55FromDiscord<aryzen> So, maybe I'm approaching this from the wrong angle, but I'm trying to use "cinterop" which supposedly works with complex libraries (Creator said it works for Diligent, which I know is more complex than Filament), but it has little documentation; I haven't even begun trying to link the binaries I'm already having trouble getting it to find the headers
02:59:21FromDiscord<aryzen> It recognises when I ask it to open a header file myself in nim, but if that header wants to include another header, it can't find it; even though I'm asking it to open that exact header file too
03:13:33FromDiscord<aryzen> I mean, I know I'm doing something wrong because I can't get the compiler arguments right either, supposedly I should use a cpp switch but I can't get it to recognise it
03:21:05FromDiscord<aryzen> I managed to get cpp to work but my error messages are now kinda insane https://media.discordapp.net/attachments/371759389889003532/1233256513124958319/image.png?ex=662c6f21&is=662b1da1&hm=da58f34b9149524cc1f834f50bf6eef8c6044e2fd70adc6a41c8fb638a0fae82&
03:40:53FromDiscord<aryzen> alright... a lot further along than I was before now. I'm keenly in the "I don't know how cpp works" realm now, since I don't know wtf a protected constructor and destructor is
03:51:18*SchweinDeBurg joined #nim
04:56:18FromDiscord<pmunch> In reply to @heysokam "<@145405730571288577> do you know": Sorry, I went to bed 😅 https://nim-lang.org/docs/nimscript.html#patchFile%2Cstring%2Cstring%2Cstring I believe you can replace system by putting this in your config.nims. alternatively you can use `--lib` but that changes the entire standard library path
06:04:43*rockcavera quit (Remote host closed the connection)
06:34:19*PMunch joined #nim
06:39:37FromDiscord<pmunch> Hmm, it doesn't seem like `patchFile` works for system.. That's a shame
06:54:44PMunchHad a poke around the compiler and system.nim is in fact treated different than other modules and thus doesn't pass through the patchFile check
06:54:59PMunchA bit unfortunate, but should be easily fixable if anyone cares to do it
07:50:03FromDiscord<sp8061> hi, im new to nim
07:51:13FromDiscord<sp8061> i was looking to use this webgpu style library https://github.com/heysokam/ngpu?tab=readme-ov-file
07:52:14FromDiscord<sp8061> so I got the src directory and the first example, the e00_hellongpu.nim↵cd to it and "nim c -r e00_hellongpu.nim"
07:52:32FromDiscord<sp8061> e00_hellongpu.nim(9, 8) Error: cannot open file: nsys
07:52:51FromDiscord<Elegantbeef> You did not do `nimble install -d`
07:57:16FromDiscord<sp8061> that- that makes sense
07:57:19FromDiscord<sp8061> thanks
08:56:29FromDiscord<sOkam! 🫐> In reply to @sp8061 "so I got the": `nimble hello`
08:57:08FromDiscord<sOkam! 🫐> https://github.com/heysokam/ngpu/blob/cbf8ec66edcb6cac7729e3c0b7bb71b52a5954cc/ngpu.nimble#L39-L52
08:58:12FromDiscord<sOkam! 🫐> In any case, its likely that none of them will work because I deprecated wgpu and I haven't updated it in a while↵the readme in both ngpu and wgpu is a must-read, it explains everything
08:59:59FromDiscord<sp8061> sent a code paste, see https://play.nim-lang.org/#pasty=UJPxipxPWuSZ
09:00:35FromDiscord<sp8061> for some reason this happens, im trying to edit the nim files in your wgpu library but to no avail
09:00:48FromDiscord<sOkam! 🫐> yeah because I figured nobody was using ngpu anyway, and Its deprecating wgpu, so I started working on a futhark wgpu wrapper but didn't fully implement it
09:01:24FromDiscord<sp8061> oh 😦 is there an alternative'
09:01:25FromDiscord<sp8061> ?
09:02:00FromDiscord<sOkam! 🫐> in short, I recommend cloning an older commit of the wgpu wrapper and going that route↵or I can help you fix whatever issues come up in the wgpu futhark wrapper, but it would be tedious
09:02:08FromDiscord<sOkam! 🫐> ngpu will definitely not work for a long time
09:02:50FromDiscord<sOkam! 🫐> wgpu-native is a C library, so it can be wrapped with futhark "fairly easily"↵although if you are new to nim, that easy won't be too easy
09:03:26FromDiscord<sp8061> indeed haha. I will try the old clone for now
09:03:42FromDiscord<sOkam! 🫐> let me try to find you that commit
09:03:59FromDiscord<sp8061> From what I understood, ngpu wasn't only a wrapper right? it attempted to also make life easier
09:05:01FromDiscord<sOkam! 🫐> @sp8061 b88fb2dcf80eda0f94b77c407bf6b3ba6afb95a5
09:05:44FromDiscord<sOkam! 🫐> In reply to @sp8061 "From what I understood,": yes, but its not finished by any means, and i'm refactoring it to be built in C with Vulkan. so it will be a long while until its usable again (think a couple of years, given the current pace)
09:15:32FromDiscord<sp8061> I understand 100%
09:16:20FromDiscord<sp8061> I started using WebGPU with JS and although the setup took a while I kinda learnt it and did my own examples
09:17:36FromDiscord<sp8061> Issue is, I want to develop a native app, on a decently fast language, and the little maturity of Dawn and webgpu-native are cornering me into c/c++ which I'm not experienced with
09:19:05FromDiscord<sp8061> i think it's time for me to man up and do it in c++ 😢 😄
09:19:34*def- quit (Quit: -)
09:20:00*def- joined #nim
09:21:35*ntat joined #nim
09:25:40*def- quit (Quit: -)
09:27:13*def- joined #nim
09:47:46FromDiscord<sOkam! 🫐> In reply to @sp8061 "i think it's time": I would be willing to help setup the futhark wrapper for wgpu-native
09:48:31FromDiscord<sOkam! 🫐> I haven't done it because I haven't had a personal reason to revive it yet. But if you want to give it a go, and help debug it, I can give you a hand and collab so we have a reliable wgpu wrapper again
10:05:43FromDiscord<sp8061> realistically there is little time for me to invest on anything for the next half a year so I wouldn't be able to contribute
10:06:00FromDiscord<sp8061> but thanks a lot for the offer, really
10:22:52*coldfeet joined #nim
10:30:07*coldfeet quit (Remote host closed the connection)
11:39:25*krux02 joined #nim
12:00:30*def- quit (Quit: -)
12:00:47*def- joined #nim
12:12:22PMunchPlaying around some more with libfuse. Incorporated libvlc and metatag (will probably replace metatag with functions from libvlc in the future) and now I have a small music player as a file system :P
12:14:01PMunchYou give it a folder and it creates by-artist, by-album, and by-year folders, along with a control folder. In the by-X folders there is a bunch of song names as files, the content of a file is the path to the original file. To play a song you cat a song into control/current and write "play" to control/command. You can also write a list of files to control/up-next and they will be played in order.
12:14:49PMunchSo if you want to shuffle all songs by an artist you do something like `cat by-artist/<artist>/* | sort --random > control/up-next`
12:15:28FromDiscord<nervecenter> In reply to @patitotective "Hi, I'm using datamancer": Try deep copying the frame over to the thread before doing anything with it?
12:44:29FromDiscord<patitotective> Well, the dataframe is created inside the thread, so I don't think that would be the problem
13:13:05*def- quit (Quit: -)
13:13:54*def- joined #nim
13:25:12*rockcavera joined #nim
13:55:07FromDiscord<vindaar> In reply to @patitotective "Well, the dataframe is": as long as the DF is created on the separate thread, it should work fine. if you can share more code, I can try to help more. Sounds more like an issue with the compiler being too paranoid
13:58:38FromDiscord<patitotective> In reply to @vindaar "as long as the": Well, I didn't want to create the DF on another thread since it's created from a 18MB CSV file and I don't want the GUI to freeze while loading the CSV
14:11:04NimEventerNew thread by ninovanhooff: Please review my types: ref object or plain object, see https://forum.nim-lang.org/t/11499
14:11:42*pbsds quit (Ping timeout: 252 seconds)
14:11:57*pbsds3 joined #nim
14:24:32*ntat quit (Quit: Leaving)
14:34:20FromDiscord<hyperdbg> hey, how many TCP socket can I create from one device in parallel and without interruption use them?↵does this depend on networking hardware? if so, which exactly? I don
14:34:37FromDiscord<hyperdbg> (edit) "don" => "don't control my ethernet cable, but I can buy, for example, better router\switch"
14:46:32*ntat joined #nim
15:31:47*Mister_Magister quit (Excess Flood)
15:32:13*Mister_Magister joined #nim
16:42:15FromDiscord<wileycoleman> sent a long message, see https://pasty.ee/oDukrVQscWdR
16:45:45*krux02 quit (Remote host closed the connection)
16:50:17FromDiscord<threefour> In reply to @hyperdbg "hey, how many TCP": What do you mean without interruption? I believe sockets are essentially just a software abstraction for multiplexing your network interface(s), which are all serial, including Ethernet, afaik.
16:51:14FromDiscord<threefour> The socket limit depends on what your file descriptor limit is set to, which on Linux, you'd do via `ulimit`.
16:53:03FromDiscord<hyperdbg> In reply to @threefour "What do you mean": imagine me opening N connection to Z hosts. Intuitevely, aside from software limits there are hardware limits as well. That's the my questions, in case of N connection to Z hosts, what is the first bottleneck cause that I should look for (in networking hardware)?
16:53:09FromDiscord<hyperdbg> (edit) "connection" => "connections"
17:00:49FromDiscord<aintea> sent a long message, see https://pasty.ee/sSoqTtFxtNQs
17:01:54strogon14you can always generalize things too far.
17:02:31*SchweinDeBurg quit (Quit: WeeChat 4.3.0-dev)
17:08:10FromDiscord<polylokh_39446> a loop is less lines of assembly than the unrolled loop. The CPU might execute the unrolled loop faster because there are no branches to predict and no branch-predictions to fail.
17:09:10FromDiscord<.lisuwu_> In reply to @aintea "Nim compiler has two": by speed it means nim compiler will focus on speed, then nim compiler might add some things to make it faster↵↵i cant really think of any examples where nim compiler might do things, but i heard of this example that might happen in C side:↵if you do `x 15`, the C compiler might convert that into `(x << 4) - x`, overall ending up faster because CPU can do bitshifts faster than it can d
17:09:25FromDiscord<.lisuwu_> (edit) "In reply to @aintea "Nim compiler has two": by speed it means nim compiler will focus on speed, then nim compiler might add some things to make it faster↵↵i cant really think of any examples where nim compiler might do things, but i heard of this example that might happen in C side:↵if you do `x 15`, the C compiler might convert that into `(x << 4) - x`, overall ending up faster because CPU can do bitshifts faster than
17:11:43FromDiscord<polylokh_39446> in general, you're probably viewing the CPU as much simpler and mechanical than it is. With something like intel, proprietary microcode, deep pipelines and layers of cache and branch prediction, a better mental model is probably that your assembly is high level program code for a virtual machine with a JIT compiler, than like 'assembly'.
17:14:48FromDiscord<polylokh_39446> anyway the conventional explanation for the flags that there are space/speed tradeoffs that Nim will consider, like inlining and loop unrolling, that wil lead to larger binaries but maybe faster execution. And an example that still works with a primitive-CPU model is inlining: there is "more machine code" in the binary, but on any given execution path there is actually less machine code because you're skipping calls/returns and doi
17:15:00FromDiscord<polylokh_39446> (edit) "wil" => "will"
17:19:16FromDiscord<demotomohiro> In reply to @aintea "Nim compiler has two": Optimizing speed might not inline functions or expand loop in order to generate smaller code while optimizing speed might do both.
17:30:25Amun-Ra"Optimizing speed" → "Optimizing size"
17:43:42FromDiscord<Robyn [She/Her]> The urge to make a custom package manager for Nim :p
17:44:02FromDiscord<aintea> It's pretty easy to make one
17:44:17FromDiscord<Robyn [She/Her]> Is it?
17:44:33FromDiscord<aintea> yes
17:44:34FromDiscord<aintea> here
17:44:48Amun-Rabut… why?
17:45:11FromDiscord<aintea> sent a code paste, see https://play.nim-lang.org/#pasty=EwIMBYZnwHjA
17:45:19FromDiscord<aintea> run this in your shell and you're good to go
17:45:42FromDiscord<Robyn [She/Her]> In reply to @Amun-Ra "but… why?": Boredom and because the lang server has ruined my motivation to work on my parser for now lol
17:45:45Amun-Rawon't work in my shell
17:45:51FromDiscord<aintea> nushell
17:45:54FromDiscord<aintea> or fish
17:45:58Amun-Rafish
17:46:05FromDiscord<Robyn [She/Her]> In reply to @aintea "run this in your": >.>
17:46:12Amun-Rabut won't work in dash, csh, ksh, zsh either ;)
17:46:17FromDiscord<Robyn [She/Her]> In reply to @Amun-Ra "fish": Eyyyy, same
17:46:21FromDiscord<aintea> works in zsh
17:46:26Amun-Rahmm
17:46:35FromDiscord<aintea> because zshrc is in ~/.zshrc
17:47:04Amun-RaI thought ${SHELL##/} is bashism
17:47:29FromDiscord<aintea> nope, it's just taking `$SHELL` and only getting what's after the last `/`
17:47:44FromDiscord<aintea> so `/bin/zsh` would return zsh
17:47:46Amun-Rayes, the problematic part is ##/
17:47:48FromDiscord<aintea> (edit) "zsh" => "`zsh`"
17:48:17FromDiscord<Robyn [She/Her]> Anyone know what the point of a JSON library that uses 'pointers' is? Is it quicker and less memory intensive to access keys or?
18:01:26FromDiscord<odexine> Pointers usually make things slower
18:01:33FromDiscord<Robyn [She/Her]> Make sense
18:01:39*lucasta joined #nim
18:01:43Amun-Radepends vs what
18:02:04FromDiscord<Robyn [She/Her]> Something like Jsony when it's kept in memory
18:02:37Amun-Rafor example, I wouldn't say pointers are slower than copying whole objects
18:12:19FromDiscord<Robyn [She/Her]> That also checks out :p
18:12:35FromDiscord<Robyn [She/Her]> I'd assume pointers would also be much more compact?
18:15:33Amun-Rabut with great power comes great responsiblity
18:22:55FromDiscord<nocturn9x> question
18:23:14FromDiscord<nocturn9x> can I use nim's views to tell `std/algorithm`'s `sort` to only sort a subset of an array
18:23:46FromDiscord<nocturn9x> I use an array of static size with a lenght field because it's cheaper than allocating and sizing a dynamic list every time, but that means not all elements of the array are valid
18:24:08FromDiscord<nocturn9x> and I want these invalid elements (which are all at the end) to be sliced off the sorting
18:24:23FromDiscord<nocturn9x> do I have to reimplement like quicksort or is it possible to do in some other way?
18:36:21FromDiscord<demotomohiro> In reply to @nocturn9x "question": How about to use this?↵https://nim-lang.org/docs/system.html#toOpenArray%2Carray%5BI%2CT%5D%2CI%2CI
18:37:58FromDiscord<nocturn9x> does that copy
18:40:13FromDiscord<demotomohiro> I don't think it creates copy. It should just returns sub-range of array as openArray.
18:41:00FromDiscord<demotomohiro> I also wrote array + lenght field module: https://github.com/demotomohiro/littlesugar/blob/main/src/littlesugar/staticSeq.nim
18:42:35FromDiscord<demotomohiro> And it has `toOpenArray` with bound checks: https://github.com/demotomohiro/littlesugar/blob/main/src/littlesugar/staticSeq.nim#L117
18:43:32FromDiscord<Phil> In reply to @wileycoleman "I get an error": I'm not aware of active gintro usage so I can't claim to have a huge understanding there.↵I think Stefan lurks in the discord so he might answer, but that's asking for luck
18:44:13FromDiscord<Phil> He's using matrix though and goes by the user StefanSalewski there
19:30:47*coldfeet joined #nim
19:38:10*lucas_ta joined #nim
19:38:40*lucasta quit (Ping timeout: 245 seconds)
19:53:34*lucas_ta quit (Quit: Leaving)
19:54:37*ntat quit (Quit: Leaving)
20:50:15*def- quit (Quit: -)
20:51:02*def- joined #nim
21:07:24FromDiscord<norbert3873> sent a code paste, see https://play.nim-lang.org/#pasty=qHEzyuVTdxyZ
21:07:29*krux02 joined #nim
21:08:20FromDiscord<nnsee> In reply to @norbert3873 "Since upgrading to 2.0.x,": i've personally never seen that. what does your nim.cfg look like?
21:10:25FromDiscord<norbert3873> In reply to @nnsee "i've personally never seen": Not sure I have one... I'm using choosenim
21:11:32FromDiscord<norbert3873> derp found it let me peruse it for anything abnormal
21:14:16FromDiscord<Elegantbeef> @norbert3873 `--deepcopy` must be defined in the project config file on any projects that depend on code that uses it
21:14:26FromDiscord<Elegantbeef> This means that if you import code that depends on it you need to make a `config.nims` with it
21:15:38FromDiscord<norbert3873> In reply to @Elegantbeef "This means that if": is the naming `config.nims` important here? I would thing a `mypkgname.config` would work, same with pasing it to `nimble build`
21:15:51FromDiscord<norbert3873> (edit) "thing" => "think"
21:16:11FromDiscord<Elegantbeef> you can do `config.nims` or put a `mypkgname.nims` next to the entry file
21:16:38FromDiscord<Elegantbeef> But config.nims are only searched for in the present directory or the entry file
21:23:07FromDiscord<norbert3873> Thanks beef. It was an issue with the upstream package not building, installing with nimble let me fallback to #head and that built
21:23:25FromDiscord<Elegantbeef> You need to do `nimble build --deepcopy:on`
21:23:28FromDiscord<Elegantbeef> Or make a config file
21:23:31FromDiscord<zidsal> sent a code paste, see https://play.nim-lang.org/#pasty=VueqXJmltWZN
21:23:43FromDiscord<Elegantbeef> deepcopy is explicitly not enabled by default as it's expected to be removed
21:23:51FromDiscord<Elegantbeef> Enums and unicode operators are default now
21:23:54FromDiscord<Elegantbeef> strictfuncs has changed
21:24:01FromDiscord<Elegantbeef> Orc is also default
21:24:07FromDiscord<zidsal> thanks beef
21:24:16FromDiscord<norbert3873> the error was confusing me because of the `arc/orc` mention in the error. Thanks for the help.
21:38:23*coldfeet quit (Remote host closed the connection)
21:52:28*SEP quit (Ping timeout: 268 seconds)
21:54:13*SEP joined #nim
22:20:21*def- quit (Quit: -)
22:39:01*def- joined #nim
23:23:36*krux02 quit (Remote host closed the connection)
23:24:20*SchweinDeBurg joined #nim