<< 28-12-2024 >>

02:13:18*mal`` quit (Quit: Leaving)
02:42:04*mal`` joined #nim
03:36:09*alexdaguy joined #nim
05:54:36*mahlon quit (Ping timeout: 276 seconds)
06:44:41*GnuYawk67 quit (Quit: The Lounge - https://thelounge.chat)
06:44:59*GnuYawk67 joined #nim
06:52:46*mahlon joined #nim
08:01:14*beholders_eye joined #nim
08:08:34*coldfeet joined #nim
08:20:43*beholders_eye quit (Read error: Connection reset by peer)
08:24:49*mahlon quit (Ping timeout: 248 seconds)
08:26:33*beholders_eye joined #nim
08:40:54FromDiscord<aintea> Nimlangserver is more stable, and it works pretty well in neovim with nvim-cmp, however with blink.cmp it is slow, like real slow
08:53:58FromDiscord<nick.stokoe> Elegantbeef\: .throwstar
08:54:22*SchweinDeBurg quit (Quit: WeeChat 4.6.0-dev)
08:57:37*SchweinDeBurg joined #nim
09:05:57FromDiscord<Elegantbeef> Nice inane spam
09:18:10*beholders_eye quit (Ping timeout: 272 seconds)
09:49:43FromDiscord<odexine> In reply to @Elegantbeef "Nice inane spam": Throw star
10:11:59*thunder quit (Read error: Connection reset by peer)
11:33:18*def- quit (Quit: -)
11:34:23*def- joined #nim
11:57:34FromDiscord<System64 ~ Flandre Scarlet> In reply to @aintea "Nimlangserver is more stable,": I struggle to setup nvim (even with a distro) and Helix sadly
12:02:13*coldfeet quit (Quit: Lost terminal)
12:06:20FromDiscord<System64 ~ Flandre Scarlet> Btw↵Is it possible to implement Discord Rich presence in Nim program please? Is there a Nim module for that?
12:09:41*ntat joined #nim
12:14:45FromDiscord<intellij_gamer> https://github.com/DavideGalilei/nimpresence↵Zero clue if it works↵Just remember using it once ages ago
13:02:16*thunder joined #nim
13:07:58FromDiscord<fabric.input_output> In reply to @sys64 "I struggle to setup": you ever tried going the incremental route?
13:53:03*ntat quit (Ping timeout: 272 seconds)
14:18:14*xet7 joined #nim
14:42:25*alexdaguy quit (Quit: ded)
14:49:32*ntat joined #nim
16:31:52FromDiscord<nnsee> In reply to @sys64 "Btw Is it possible": you don't really need a special module for that, the API calls are easy to perform using any HTTP client
16:58:09FromDiscord<System64 ~ Flandre Scarlet> In reply to @nnsee "you don't really need": I guess it's only post requests since I send data
17:12:18om3ga_hi all! I forgot how to dereference for example ptr int
17:13:03om3ga_for example I have ptr to something, created by createShared(int, sizeof(int))
17:13:22om3ga_how to take int and not ptr int, []?
17:14:27*coldfeet joined #nim
17:16:12FromDiscord<lainlaylie> Yes
17:16:14FromDiscord<lainlaylie> https://nim-lang.org/docs/manual.html#types-reference-and-pointer-types
17:16:17om3ga_static code analyser eats it
17:16:32om3ga_probably I have other issues with the code
17:17:07om3ga_Seems passing var Lock to the thread war will not work
17:17:27om3ga_https://play.nim-lang.org/#pasty=OioYkVOH
17:18:34om3ga_oh, not this
17:19:00om3ga_https://play.nim-lang.org/#pasty=YhOcYFmL
17:20:09*om3ga_ is now known as om3ga
17:21:11om3gaIn my opinion this should work
17:22:01om3gacreate shared is not necessary, both code examples in theory should be ok
17:40:30om3gahmm, probably this will not work in C too
17:55:36om3gayes, in C pthread locks are also defined in global, please ignore
18:20:12*thunder quit (Remote host closed the connection)
18:20:41*thunder joined #nim
18:53:04FromDiscord<System64 ~ Flandre Scarlet> sent a code paste, see https://play.nim-lang.org/#pasty=JTCtgRGM
18:53:46FromDiscord<System64 ~ Flandre Scarlet> because if there is slow internet for example, it will take ages to startup
18:53:56FromDiscord<System64 ~ Flandre Scarlet> (edit) "https://play.nim-lang.org/#pasty=FBeXnoHQ" => "https://play.nim-lang.org/#pasty=pqTubDNQ"
19:04:30FromDiscord<thepotatochronicler> Don't use await? :hmm
19:04:32FromDiscord<thepotatochronicler> (edit) ":hmm" => ":hmm:"
19:25:13*ensyde joined #nim
19:25:41FromDiscord<jm_sts> sent a code paste, see https://play.nim-lang.org/#pasty=WYGmNZZj
19:41:05FromDiscord<treeform> You can print out whats in the nnkStmtListExpr .. I bet it some sort of resolution choosing object to use on or the other.
19:41:19FromDiscord<treeform> (edit) "on" => "one" | "other." => "other definition."
19:41:34FromDiscord<jm_sts> Ahhh let me check
19:50:27*GnuYawk67 quit (Quit: The Lounge - https://thelounge.chat)
19:50:45*GnuYawk67 joined #nim
19:51:30FromDiscord<jm_sts> sent a code paste, see https://play.nim-lang.org/#pasty=XWhfgqlM
19:52:08FromDiscord<jm_sts> (edit) "https://play.nim-lang.org/#pasty=lEXlUzPX" => "https://play.nim-lang.org/#pasty=zBbhgTFs"
19:52:13FromDiscord<griffith1deadly> sent a code paste, see https://play.nim-lang.org/#pasty=IoURVVMH
19:52:41FromDiscord<System64 ~ Flandre Scarlet> In reply to @griffith1deadly "use another thread?": Oh, this can work!
19:56:00FromDiscord<System64 ~ Flandre Scarlet> In reply to @griffith1deadly "use another thread?": Or I can use the Drain() proc
20:21:03FromDiscord<System64 ~ Flandre Scarlet> Lol the double segfault https://media.discordapp.net/attachments/371759389889003532/1322660609975652352/image.png?ex=6771af2f&is=67705daf&hm=fc2a071e76bb062ce77b45a6b3d992f20e7085721abd73be1673f81a549553e5&
20:31:48FromDiscord<Robyn [She/Her]> sent a code paste, see https://play.nim-lang.org/#pasty=uprEepKe
20:31:57FromDiscord<Robyn [She/Her]> In reply to @sys64 "Oh, this can work!": oh it was said already
20:32:44FromDiscord<Robyn [She/Her]> sent a code paste, see https://play.nim-lang.org/#pasty=XAztyDRV
20:32:56FromDiscord<Robyn [She/Her]> Then just check if `presence != null`
20:33:50FromDiscord<System64 ~ Flandre Scarlet> In reply to @chronos.vitaqua "oh wait it's async?": But asyncCheck can throw an exception, and exceptions are quite expansive I think
20:34:07FromDiscord<Robyn [She/Her]> In reply to @sys64 "Lol the double segfault": yeah async dispatch and threads do NOT like eachother
20:34:35FromDiscord<Robyn [She/Her]> In reply to @sys64 "But asyncCheck can throw": await can also throw exceptions, and iirc in arc/orc, try-except are basically just an if statement
20:35:04FromDiscord<System64 ~ Flandre Scarlet> Oh, good to know
20:35:26FromDiscord<Robyn [She/Her]> plus you're using async, isn't most stuff allocated on the heap?
20:35:54FromDiscord<System64 ~ Flandre Scarlet> I think?
20:37:26FromDiscord<Elegantbeef> Async and threads like eachother just fine
20:37:35FromDiscord<Elegantbeef> Futures are just thread local
20:37:43FromDiscord<System64 ~ Flandre Scarlet> In reply to @chronos.vitaqua "oh wait it's async?": so it's↵asyncCheck myFunction()?
20:39:16FromDiscord<Robyn [She/Her]> In reply to @sys64 "so it's asyncCheck myFunction()?": yeah
20:40:08FromDiscord<Robyn [She/Her]> In reply to @Elegantbeef "Async and threads like": you can't spawn an async function on another thread if the future comes from a different thread though, right? that's what i mean
20:40:45FromDiscord<Elegantbeef> Right but that's not what you said
20:41:22FromDiscord<System64 ~ Flandre Scarlet> Isn't using threads just easier?
20:43:29FromDiscord<Elegantbeef> They're two completely different things
20:43:29FromDiscord<Elegantbeef> So no
20:43:29FromDiscord<Elegantbeef> Using selectors is easier
20:44:08FromDiscord<Robyn [She/Her]> In reply to @Elegantbeef "Right but that's not": it captures the meaning sorta :p
20:44:43FromDiscord<Elegantbeef> It reads as you cannot use threads and async at the same time which is false
20:45:15FromDiscord<umi_l> Anyone know of a 3d physics engine for gamedev written in (or has bindings to) nim?
20:49:50FromDiscord<Robyn [She/Her]> In reply to @Elegantbeef "It reads as you": fair enough yeah
20:50:26FromDiscord<Robyn [She/Her]> In reply to @umi_l "Anyone know of a": UE has Nim bindings, there's also Nim bindings for Godot
20:51:06FromDiscord<Elegantbeef> "Physics engine"
20:51:25FromDiscord<umi_l> In reply to @chronos.vitaqua "UE has Nim bindings,": I'm using raylib for my game engine so can't really justify bundling in a whole other game engine, nor would I know how I could do that
20:53:03FromDiscord<System64 ~ Flandre Scarlet> In reply to @chronos.vitaqua "oh wait it's async?": I use an option
20:53:20*beholders_eye joined #nim
20:53:53*ntat quit (Read error: Connection reset by peer)
20:54:11*ntat joined #nim
20:55:21*ntat quit (Remote host closed the connection)
20:55:40*ntat joined #nim
20:56:14FromDiscord<Robyn [She/Her]> oh physics engine sorry
20:57:07FromDiscord<Robyn [She/Her]> In reply to @umi_l "I'm using raylib for": You could run Futhark on Bullet3D's C API
20:57:12FromDiscord<Elegantbeef> Jolt would be the best to look at
20:57:16FromDiscord<Elegantbeef> It has a C-API and is a good engine
20:57:20FromDiscord<Robyn [She/Her]> Or maybe use Jolt or Rapier yeah
20:57:22FromDiscord<Elegantbeef> Well unofficial C api
20:58:58*ntat quit (Read error: Connection reset by peer)
21:00:33*ntat joined #nim
21:01:31*xet7 quit (Remote host closed the connection)
21:03:06FromDiscord<System64 ~ Flandre Scarlet> /home/system64/.choosenim/toolchains/nim-2.2.0/lib/pure/asyncmacro.nim(250, 31) Error: 'runRichPresence (Async)' is not GC-safe as it calls 'initPresence'↵↵I love using threads...
21:03:32FromDiscord<Elegantbeef> Stop using globals 😛
21:03:57*ensyde quit (Ping timeout: 276 seconds)
21:04:01FromDiscord<System64 ~ Flandre Scarlet> I don't even use globals
21:04:13FromDiscord<Elegantbeef> You obviously do if a proc is not gcsafe
21:04:39FromDiscord<System64 ~ Flandre Scarlet> sent a code paste, see https://play.nim-lang.org/#pasty=cDkQuILQ
21:04:56FromDiscord<Elegantbeef> `initPresence`
21:05:45FromDiscord<System64 ~ Flandre Scarlet> In this case, it's the library fault since it's not my function
21:06:50FromDiscord<System64 ~ Flandre Scarlet> Oh probably some Future stuff
21:10:00*thunder quit (Remote host closed the connection)
21:10:31*thunder joined #nim
21:16:33*beholders_eye quit (Ping timeout: 252 seconds)
21:16:49*thunder quit (Remote host closed the connection)
21:17:14*thunder joined #nim
21:19:45*beholders_eye joined #nim
21:43:43FromDiscord<System64 ~ Flandre Scarlet> sent a code paste, see https://play.nim-lang.org/#pasty=DiNLLGYT
21:45:46FromDiscord<Elegantbeef> It'll block the thread and wait, so probably not check
21:46:07FromDiscord<System64 ~ Flandre Scarlet> In reply to @Elegantbeef "It'll block the thread": And what if I use sleep()?
21:52:59FromDiscord<griffith1deadly> In reply to @sys64 "And what if I": why not just [addTimer](https://nim-lang.org/docs/asyncdispatch.html#addTimer%2Cint%2Cbool%2CCallback) and [poll](https://nim-lang.org/docs/asyncdispatch.html#poll%2Cint)
21:55:15FromDiscord<griffith1deadly> or even just addTimer and waitFor
22:04:34FromDiscord<Robyn [She/Her]> sent a code paste, see https://play.nim-lang.org/#pasty=VbRVcuBV
22:09:46FromDiscord<System64 ~ Flandre Scarlet> asyncCheck is easier imo
22:11:44FromDiscord<System64 ~ Flandre Scarlet> sent a code paste, see https://play.nim-lang.org/#pasty=KkWYfonk
22:19:35FromDiscord<fabric.input_output> thread pool?
22:22:32*coldfeet quit (Quit: Lost terminal)
22:27:34*coldfeet joined #nim
22:28:09FromDiscord<Robyn [She/Her]> sent a code paste, see https://play.nim-lang.org/#pasty=AyULIvve
22:28:10FromDiscord<System64 ~ Flandre Scarlet> Error : Enable "experimental" pragma↵Also error : invalid pragma "experimental"
22:28:18FromDiscord<System64 ~ Flandre Scarlet> In reply to @chronos.vitaqua "could use malebolgia": Is it simpler?
22:28:34FromDiscord<Robyn [She/Her]> yeah it's a simple lib, you could also use taskpools
22:29:40FromDiscord<Robyn [She/Her]> idk if malebolgia works here actually
22:39:09FromDiscord<System64 ~ Flandre Scarlet> sent a code paste, see https://play.nim-lang.org/#pasty=mXXVyljr
22:43:07FromDiscord<Robyn [She/Her]> sent a code paste, see https://play.nim-lang.org/#pasty=qXmigYnm
22:43:23FromDiscord<System64 ~ Flandre Scarlet> I love vague error messages
22:45:26FromDiscord<Elegantbeef> isolated has to be consumed directly
22:45:54FromDiscord<System64 ~ Flandre Scarlet> In reply to @Elegantbeef "isolated has to be": So my functions must return something?
22:46:19FromDiscord<Elegantbeef> No you must construct the objects inside the `spawn` expression
22:46:50FromDiscord<System64 ~ Flandre Scarlet> In reply to @Elegantbeef "No you must construct": Oh, so I can't use pre-existing objects?
22:52:00FromDiscord<System64 ~ Flandre Scarlet> Oh even with threadpools I have this isolation problem
22:55:16*ntat quit (Quit: Leaving)
22:55:33FromDiscord<System64 ~ Flandre Scarlet> Lol↵I can bypass it by using... POINTERS
22:58:00*ensyde joined #nim
22:58:45*coldfeet quit (Quit: Lost terminal)
23:01:51FromDiscord<dedraiaken> Is there a means of converting a `ptr UncheckedArray[char]` to a string without copying?
23:02:46FromDiscord<Elegantbeef> Nope
23:03:10FromDiscord<Elegantbeef> Nim strings own data so there must be a copy
23:05:47rockcaveradedraiaken https://github.com/rockcavera/nim-zerocstringtostring I was playing around with this once, but I don't know if it's 100% safe.
23:06:11FromDiscord<dedraiaken> hmm so kind of hosed if a library is expecting a string? Shouldn't be able to mimic the data structure and perform a cast?
23:06:15FromDiscord<Elegantbeef> Well it's clearly not safe as you do not own the data
23:06:34FromDiscord<Elegantbeef> Use Nim's string instead then convert to `cstring`
23:06:41FromDiscord<Elegantbeef> Nim strings are null terminated
23:07:26FromDiscord<Elegantbeef> You can abuse the fact Nim strings have a copy on write feature to achieve your no copy, but it's some low level shenanigans that can always change
23:08:12FromDiscord<Elegantbeef> Rock does your implementation abuse the MSB of the capacity(or is it length?) indicating a 'constant'?
23:08:32FromDiscord<dedraiaken> Hmm.. I've got gigabytes of data in a buffer that I want to parse chunks out of as JSON without copying.
23:09:12FromDiscord<Elegantbeef> Well you could abuse that mechanism if you wanted to
23:11:10rockcaveraElegantbeef I don't remember anything about the project, I was just playing around
23:11:42rockcaveraI vaguely remember that I ran valgrind and no problems were reported
23:13:30FromDiscord<Elegantbeef> I looked, you arent
23:13:32FromDiscord<Elegantbeef> Oh it uses the capacity as a flag
23:13:32FromDiscord<Elegantbeef> Which means you need to have an int before the string and say "this is a constant"
23:13:32FromDiscord<Elegantbeef> https://github.com/nim-lang/Nim/blob/devel/lib/system/strs_v2.nim#L26
23:14:02FromDiscord<Elegantbeef> Yea if you're very cautious with your code it's safe
23:14:16FromDiscord<Elegantbeef> But if you attempt to grow the string, or don't call the zero it'll attempt to free the memory
23:14:30rockcaverayes
23:16:59*beholders_eye quit (Ping timeout: 260 seconds)
23:26:35FromDiscord<ricky._.spanish> is there a nim library for creating a LSP for another language?
23:28:22FromDiscord<System64 ~ Flandre Scarlet> sent a code paste, see https://play.nim-lang.org/#pasty=nIVApLSU
23:31:57FromDiscord<System64 ~ Flandre Scarlet> Like, I don't understand why
23:39:54*mahlon joined #nim
23:59:45FromDiscord<drugss> IMG-20241228-WA0002.jpg https://media.discordapp.net/attachments/371759389889003532/1322715645304897618/IMG-20241228-WA0002.jpg?ex=6771e270&is=677090f0&hm=829a85c42edc94629a39fbf496678af01f55b4196939f96e0fe381a3d9812afa&