<< 02-02-2025 >>

00:00:19FromDiscord<Elegantbeef> No clue it's a pthread\_mutex\_t if it's any help
00:17:42FromDiscord<arkanoid> I've untangles the Result vs Guarded problem, and now I'm down to this\:↵`Error: 'configurationJob' is not GC-safe as it accesses 'conf' which is a global using GC'ed memory`which was the step 0 when I picked StackStrings. Now I have Guarded, but same issue. No matter if I use set and get, compiler won't go if global var is accessed from thread
00:18:30FromDiscord<Elegantbeef> Ugh right
00:20:19FromDiscord<Elegantbeef> sent a code paste, see https://play.nim-lang.org/#pasty=wBntRBVg
00:25:01FromDiscord<arkanoid> woa, tons of errors. I guess UFS goes nuts here\: `Error: undeclared field: 'get' for type guarded.Guarded`↵I'll try to replace all .get into .get()
00:25:15FromDiscord<arkanoid> woa, tons of errors. I guess UFC goes nuts here\: `Error: undeclared field: 'get' for type guarded.Guarded`↵I'll try to replace all .get into .get()
00:36:19FromDiscord<arkanoid> sent a code paste, see https://play.nim-lang.org/#pasty=oZEqzChj
00:37:26FromDiscord<arkanoid> but my innerConf is indeed var, not immutable
00:37:32FromDiscord<Elegantbeef> Seems the cast prevents a var from being propagated upwards, everything has gone to hell
00:38:16FromDiscord<Elegantbeef> sent a code paste, see https://play.nim-lang.org/#pasty=nFYHkWeD
00:39:11FromDiscord<arkanoid> I'll try this one. Another idea would be to pass the global to threads via addr
00:39:20FromDiscord<Elegantbeef> That's what I imagined you were going to do anyway
00:43:30FromDiscord<arkanoid> sent a code paste, see https://play.nim-lang.org/#pasty=bHxUkuMn
00:51:08FromDiscord<arkanoid> I'll try with pointers and .. if that won't work, I'll use StackStrings again ... or just Golang
00:53:58*SchweinDeBurg quit (Read error: Connection reset by peer)
00:59:48*SchweinDeBurg joined #nim
01:14:41FromDiscord<arkanoid> sent a code paste, see https://play.nim-lang.org/#pasty=QcgDpNrb
01:18:03FromDiscord<arkanoid> not sure why, but dereferencing is failing here. Maybe is UFC playing tricks on me
01:19:09FromDiscord<Elegantbeef> `ptr` I don't think converts to `var`
01:19:13FromDiscord<Elegantbeef> You have to manually dereference
01:22:26FromDiscord<arkanoid> I'm doing `var thing = guardedthingptr[]` inside the thread
01:24:06FromDiscord<Elegantbeef> Well then why would it be `ptr Guarded[Context]`?
01:24:16FromDiscord<Elegantbeef> It'd be `Guarded[Context]`
01:31:31FromDiscord<arkanoid> hooray! it compiled
01:32:14FromDiscord<arkanoid> I was missing a {.inject.} it the wrapper function
01:38:24FromDiscord<arkanoid> oh now, it passes `nim check` but it fails `nim build`
01:38:32FromDiscord<arkanoid> oh no, it passes `nim check` but it fails `nim build`
01:38:51FromDiscord<Elegantbeef> At this rate you should've just hired me to write the code 😛
01:48:25FromDiscord<arkanoid> sent a code paste, see https://play.nim-lang.org/#pasty=iISQkPeM
01:50:05FromDiscord<arkanoid> I think I'm facing this https://github.com/nim-lang/Nim/issues/14873
01:51:47FromDiscord<arkanoid> fixed by avoiding `$` on Lock
01:52:40FromDiscord<Elegantbeef> Literally broken software
01:55:58FromDiscord<arkanoid> but with the best bikeshedding to design ratio of all langs
01:59:45*Artea quit (Ping timeout: 246 seconds)
02:28:05*ensyde quit (Ping timeout: 252 seconds)
02:30:15*ensyde joined #nim
03:22:48*Artea joined #nim
04:44:53FromDiscord<arkanoid> is --expandArc changed in 2.2.0 ? I'm trying to use it but it prints nothing. No code, no errors. I tried with both function name and file/module name
04:54:22FromDiscord<Elegantbeef> No
04:58:34*SchweinDeBurg quit (Quit: WeeChat 4.6.0-dev)
04:59:04*SchweinDeBurg joined #nim
05:36:29*pbsds3 quit (Quit: Ping timeout (120 seconds))
05:37:00*pbsds3 joined #nim
05:37:32*m5zs7k quit (Quit: m5zs7k)
05:38:07*m5zs7k joined #nim
05:48:24*GnuYawk67 quit (Quit: The Lounge - https://thelounge.chat)
05:48:43*GnuYawk67 joined #nim
06:03:45*ensyde quit (Ping timeout: 260 seconds)
07:05:44*ensyde joined #nim
07:05:49*pbsds3 quit (Ping timeout: 245 seconds)
07:06:03*pbsds35 joined #nim
07:51:30*xet7 joined #nim
08:18:18FromDiscord<elykpha> sent a code paste, see https://play.nim-lang.org/#pasty=MMSuwUVU
08:19:20FromDiscord<odexine> sent a code paste, see https://play.nim-lang.org/#pasty=kordRjZo
08:23:34FromDiscord<elykpha> thankss
08:24:19FromDiscord<elykpha> interesting. i guess i dont need to hide my fields like in other languages with `_field` like syntax?
08:24:23FromDiscord<elykpha> cool stuff
08:24:38FromDiscord<elykpha> (edit) "interesting. i guess i dont need to hide my fields like in other languages with `_field` like syntax? ... " added "(if i want them to be hidden)"
08:34:08FromDiscord<lainlaylie> https://nim-lang.org/docs/manual.html#procedures-export-marker
08:41:13*ntat joined #nim
09:16:25*coldfeet joined #nim
09:44:32*ensyde quit (Quit: WeeChat 4.5.1)
11:36:05*ntat quit (Quit: Leaving)
11:39:02*SchweinDeBurg quit (Quit: WeeChat 4.6.0-dev)
11:39:12*SchweinDeBurg joined #nim
11:46:26FromDiscord<matkuki.> sent a code paste, see https://play.nim-lang.org/#pasty=VjaskzTa
11:57:24FromDiscord<demotomohiro> In reply to @matkuki. "Hi guys, quick question.": https://nim-lang.org/docs/manual.html#statements-and-expressions-table-constructor
12:26:35FromDiscord<kapendev> Love it when the docs are just 8 lines.
13:07:33FromDiscord<matkuki.> @demotomohiro Thank you 👍
13:22:04FromDiscord<lowlowcode_96272> Hello eveyrone, I have many objects and I want to store each one of them in a sequence and then call the same method on all, each one has a different implementation of this method. Can you tell me which options I have to do that and what is the most performant ? Im looking for something without dynamic dispatch ideally
13:24:09FromDiscord<ninovanhooff> sent a long message, see https://pasty.ee/fbvHxOqi
13:24:41FromDiscord<ninovanhooff> (edit) "https://pasty.ee/OKELeeYR" => "https://pasty.ee/FcZGWqUx"
13:29:39FromDiscord<albassort> what type can i use for a tuple of typedesc
13:29:41FromDiscord<albassort> e.g
13:30:12FromDiscord<albassort> sent a code paste, see https://play.nim-lang.org/#pasty=SMcamTYa
13:32:37FromDiscord<odexine> In reply to @ninovanhooff "I already got my": https://nim-lang.org/docs/manual_experimental.html#importing-private-symbols
13:38:22FromDiscord<odexine> In reply to @albassort "what type can i": “What type”?
13:49:53FromDiscord<albassort> In reply to @odexine "“What type”?": idk what you're saying
13:50:12FromDiscord<odexine> In reply to @albassort "idk what you're saying": What do you mean “what type”
13:50:20FromDiscord<albassort> did i even say that
13:50:29FromDiscord<albassort> err
13:50:41FromDiscord<albassort> i feel like that is very simple and clear english, i will not elaborate
14:29:05FromDiscord<lowlowcode_96272> How to use a pointer to another object in an object ? (Stack allocated object)
14:55:39FromDiscord<Robyn [She/Her]> In reply to @lowlowcode_96272 "Hello eveyrone, I have": You'd have to have some form of dynamic dispatch really, you could use `method`s or store function pointers in the object these all inherit from
14:56:20FromDiscord<Robyn [She/Her]> they'd have to be ref objects too, if you plan on storing different types of data in each instance of the object
14:56:43FromDiscord<Robyn [She/Her]> `std/streams` uses function pointers for example
14:58:41FromDiscord<Robyn [She/Her]> In reply to @lowlowcode_96272 "How to use a": `addr myObj` to get a pointer from an object
14:59:12FromDiscord<Robyn [She/Her]> The type would be `ptr Obj` where Obj is the type name
15:00:07FromDiscord<Robyn [She/Her]> Though you may run into problems like Nim freeing the object before you use it again, if it's a Nim-owned object
15:03:27FromDiscord<odexine> In reply to @albassort "i feel like that": okay, i will not answer
15:16:05FromDiscord<arkanoid> could you please help me understand the logic behind `A custom '=destroy' hook which takes a 'var T' parameter is deprecated; it should take a 'T' parameter [Deprecated]`Most of the patterns I try to follow to embrace Nim move semantics ends up in requiring a var T for destructor instead of T. I could not make them without var, but I don't get where I am wrong
15:21:46FromDiscord<odexine> what are you trying to do within your destructors?
15:29:56FromDiscord<lowlowcode_96272> In reply to @battery.acid.bubblegum "The type would be": thanks
15:41:32FromDiscord<Robyn [She/Her]> np
15:46:33FromDiscord<arkanoid> for example setting inner C struct pointer to null↵(@odexine)
15:47:11FromDiscord<odexine> does this need to be done if the object is being destroyed anyway?
15:47:44FromDiscord<odexine> like if i have an object with ptr field named `something` and i free `something`, it doesnt matter if i set `something` to null since the object is being destroyed anyway
16:10:42*coldfeet quit (Quit: Lost terminal)
16:22:21FromDiscord<bosinski2023> In reply to @odexine "like if i have": true, but won't work when you have some self-allocated region, you need to free inside `=destroy()` and the pointer to that region inside a `Atomic[ptr UnchaeckedArray]`. Then you need the `var` in the destructor-signature. A hard-cast might work as well...
16:23:43FromDiscord<bosinski2023> (edit) "In reply to @odexine "like if i have": true, but won't work when you have some self-allocated region, you need to free ... insideUncheckedArray]`." added "it" | "UnchaeckedArray]`." => "UncheckedArray]`."
16:49:32*ntat joined #nim
17:03:55FromDiscord<arkanoid> sent a long message, see https://pasty.ee/FutIhUit
17:04:10FromDiscord<odexine> Ah, locks, okay
17:07:53FromDiscord<arkanoid> that's the reason of my question. If Nim says var T destructor is deprecated, it means that all those patterns that require it are somehow doing it wrong
17:52:21FromDiscord<solitudesf> In reply to @arkanoid "that's the reason of": you should ask it in internals.
18:24:17*ntat quit (Remote host closed the connection)
18:25:52*ntat joined #nim
18:56:50FromDiscord<arkanoid> sent a code paste, see https://play.nim-lang.org/#pasty=siXFmzuo
19:00:20FromDiscord<Elegantbeef> arkanoid is it just a opaque pointer?
19:00:57FromDiscord<arkanoid> yes, no other fields other than C struct ptr
19:01:28FromDiscord<Elegantbeef> `type MyWrapper {.importc: "struct CStruct".}= ptr object` should be best methinks
19:05:20FromDiscord<arkanoid> mm no, that doesn't isolate nim interface from c interface
19:06:42FromDiscord<Elegantbeef> Well then remove the importc
19:06:56FromDiscord<Elegantbeef> The importc was assuming you wanted good type checks
19:07:03FromDiscord<arkanoid> also, I like futhark generated C api as ground floor for Nim wrapper. Using that you don't have to deal with importc pragma anymore
19:07:28FromDiscord<Elegantbeef> I both like it and dislike it
19:08:51FromDiscord<arkanoid> I've managed to wrap huge C libs with that in no time, and then just wrap objects I need with hooks to handle memory\: win win
19:09:11FromDiscord<Elegantbeef> Yea it's nice in that regard
19:12:49FromDiscord<Elegantbeef> I don't think it uses the `importc` pragma so there is a small chance of using an old header with incorrect ABI depending on how you link
19:12:50FromDiscord<Elegantbeef> Well atleast I think there is, might not be actually since the linker can still do the assurances....
19:13:45FromDiscord<arkanoid> well you're always requested to use correct .h for your .a/.so/.dll, that's the point of automatic generation from .h
19:14:03FromDiscord<arkanoid> headers and libs usually comes in bundle for a reason
19:15:32FromDiscord<Elegantbeef> right, but most people don't want to depend upon futhark so will ship a generated .nim
19:15:55FromDiscord<Elegantbeef> Atleast for 'released packages'
19:16:17FromDiscord<Elegantbeef> Not to say I don't use futhark and love it, but it's just an issue with C abi regardless 😄
19:18:17FromDiscord<arkanoid> sent a code paste, see https://play.nim-lang.org/#pasty=RsTVuOER
19:18:43FromDiscord<Elegantbeef> I mean you should ship both
19:20:58FromDiscord<arkanoid> sent a code paste, see https://play.nim-lang.org/#pasty=PsJhFDbG
19:21:13FromDiscord<Elegantbeef> Of course they do
19:21:36FromDiscord<arkanoid> but you can't rewrite
19:21:39FromDiscord<Elegantbeef> Yes you can
19:21:51FromDiscord<Elegantbeef> The destructor is made on the first usage if not declared
19:22:35FromDiscord<Elegantbeef> sent a code paste, see https://play.nim-lang.org/#pasty=BHVnyUhf
19:23:04FromDiscord<arkanoid> sent a code paste, see https://play.nim-lang.org/#pasty=PXcDrrIr
19:23:17FromDiscord<arkanoid> sent a code paste, see https://play.nim-lang.org/#pasty=RECiDisE
19:23:30FromDiscord<Elegantbeef> Right cause your copy is already generated
19:23:37FromDiscord<Elegantbeef> Put the copy before the destroy
19:24:35FromDiscord<Elegantbeef> `self.Socket` can require a copy which I assume why the compiler thinks a copy is needed
19:25:57FromDiscord<arkanoid> mh, aren't conversions from between distincs type just type sugar at the end
19:28:28FromDiscord<Elegantbeef> They should be so the compiler just is being a bit silly
19:28:29FromDiscord<arkanoid> ah ok
19:34:48FromDiscord<arkanoid> sent a long message, see https://pasty.ee/BVAIhHuQ
20:36:05FromDiscord<Robyn [She/Her]> I wonder if this is compatible with Nim: https://github.com/tyfkda/xcc
20:36:40FromDiscord<Robyn [She/Her]> No goto statement tho
20:48:09FromDiscord<michael.lenz.> I tried it three or four years ago
21:25:17*ntat quit (Quit: Leaving)
21:26:52FromDiscord<fl4shk> Question about Nim. Is C++ style RAII possible? I was planning on targeting an embedded system.
21:27:05FromDiscord<fl4shk> garbage collection appears to be something I should avoid for the project.
21:28:12FromDiscord<fl4shk> (side note: actually, I am developing the embedded system in question. I am finishing up a GCC port targeting my custom CPU. I have also implemented the CPU as FPGA code.)
21:28:31FromDiscord<fl4shk> but I think Nim would be a good pick for the software I write for the system.
21:29:39FromDiscord<Elegantbeef> Is it possible?! It's what Nim's ARC is
21:33:43FromDiscord<arkanoid> Just never allocate heap (ref type) objects and let ARC do it's job. You can write your own =destroy that ARC will call it for you when object goes out of scope
21:33:53FromDiscord<Elegantbeef> No
21:33:59FromDiscord<Elegantbeef> You can heap allocate and let arc do it's job
21:37:51FromDiscord<arkanoid> I know, I was aswering @fl4shk about "garbage collection appears to be something I should avoid for the project". Generally speaking, that means no heap use. ARC indeed works for heap allocate objects too, no difference
21:38:03FromDiscord<Elegantbeef> Yea gotta be over specific when talking to people, do not need to send them down the path of "I MUST AVOID REF"
21:38:47FromDiscord<fl4shk> In reply to @arkanoid "I know, I was": well that doesn't always mean no heap use
21:39:16FromDiscord<fl4shk> well
21:39:30FromDiscord<arkanoid> yes, not always, but many embedded projects I know avoid heap for some reason
21:39:53FromDiscord<fl4shk> I'm not wanting to avoid heap entirely
21:40:09FromDiscord<fl4shk> I'm wanting more easily understandable timing
21:40:14FromDiscord<fl4shk> ...which for me won't mean no heap
21:40:22FromDiscord<fl4shk> if I have to write that myself, that's not such a big deal
21:40:37FromDiscord<fl4shk> having my own `=destroy` is fine
21:41:01FromDiscord<fl4shk> I thought I heard somewhere that Nim had support for something that's C++ like
21:41:22FromDiscord<arkanoid> cool. If you want more control on how allocation works, you can also replace the allocator with some Nim code. That way you can also avoid fragmentation for your specific needs
21:41:30FromDiscord<fl4shk> oh okay that works for me
21:41:38FromDiscord<fl4shk> I'll have to learn the language first.
21:41:51FromDiscord<fl4shk> I think Nim would work as a good C++ replacement for the stuff I do.
21:42:05FromDiscord<fl4shk> I know Nim can interop with C++
21:42:33FromDiscord<fl4shk> I do kind of want to write my own allocator
21:42:41FromDiscord<fl4shk> so I suppose that's something I'll look into
21:43:01FromDiscord<fl4shk> I read that there are good macros in Nim
21:43:05FromDiscord<fl4shk> way better situation than C++
21:44:41FromDiscord<Elegantbeef> Nim has proper introspection macros
21:44:41FromDiscord<Elegantbeef> Not just guess and shoot templates
21:44:54FromDiscord<fl4shk> yeah that's the stuff I want to take advantage of
21:44:59FromDiscord<fl4shk> (edit) "take advantage" => "make use"
21:45:02FromDiscord<fl4shk> It just sounds really cool
21:45:17FromDiscord<fl4shk> I've been using C++ since 2008 but I think I'd like to move on now
21:45:27FromDiscord<fl4shk> (2008 was when I started learning how to code)
21:45:43FromDiscord<fl4shk> at least for my personal projects haha
22:55:26*beholders_eye joined #nim
23:05:35FromDiscord<amarevite> nimble build/run do not work in git repos that use sha256 hashes instead of sha1 hashes↵[looking at the code](<https://github.com/nim-lang/nimble/blob/ef7b8c9a44cdbebfacc437d3e7a0521f495bf24d/src/nimblepkg/packageparser.nim#L332>), nimble appears to explicitly run a sha1 hash no matter what, even if the git repo is using sha256↵is there a version of nimble that has support for sha256? or some hacky workaround until then?
23:31:56*xet7 quit (Remote host closed the connection)