00:00:19 | FromDiscord | <Elegantbeef> No clue it's a pthread\_mutex\_t if it's any help |
00:17:42 | FromDiscord | <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:30 | FromDiscord | <Elegantbeef> Ugh right |
00:20:19 | FromDiscord | <Elegantbeef> sent a code paste, see https://play.nim-lang.org/#pasty=wBntRBVg |
00:25:01 | FromDiscord | <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:15 | FromDiscord | <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:19 | FromDiscord | <arkanoid> sent a code paste, see https://play.nim-lang.org/#pasty=oZEqzChj |
00:37:26 | FromDiscord | <arkanoid> but my innerConf is indeed var, not immutable |
00:37:32 | FromDiscord | <Elegantbeef> Seems the cast prevents a var from being propagated upwards, everything has gone to hell |
00:38:16 | FromDiscord | <Elegantbeef> sent a code paste, see https://play.nim-lang.org/#pasty=nFYHkWeD |
00:39:11 | FromDiscord | <arkanoid> I'll try this one. Another idea would be to pass the global to threads via addr |
00:39:20 | FromDiscord | <Elegantbeef> That's what I imagined you were going to do anyway |
00:43:30 | FromDiscord | <arkanoid> sent a code paste, see https://play.nim-lang.org/#pasty=bHxUkuMn |
00:51:08 | FromDiscord | <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:41 | FromDiscord | <arkanoid> sent a code paste, see https://play.nim-lang.org/#pasty=QcgDpNrb |
01:18:03 | FromDiscord | <arkanoid> not sure why, but dereferencing is failing here. Maybe is UFC playing tricks on me |
01:19:09 | FromDiscord | <Elegantbeef> `ptr` I don't think converts to `var` |
01:19:13 | FromDiscord | <Elegantbeef> You have to manually dereference |
01:22:26 | FromDiscord | <arkanoid> I'm doing `var thing = guardedthingptr[]` inside the thread |
01:24:06 | FromDiscord | <Elegantbeef> Well then why would it be `ptr Guarded[Context]`? |
01:24:16 | FromDiscord | <Elegantbeef> It'd be `Guarded[Context]` |
01:31:31 | FromDiscord | <arkanoid> hooray! it compiled |
01:32:14 | FromDiscord | <arkanoid> I was missing a {.inject.} it the wrapper function |
01:38:24 | FromDiscord | <arkanoid> oh now, it passes `nim check` but it fails `nim build` |
01:38:32 | FromDiscord | <arkanoid> oh no, it passes `nim check` but it fails `nim build` |
01:38:51 | FromDiscord | <Elegantbeef> At this rate you should've just hired me to write the code 😛 |
01:48:25 | FromDiscord | <arkanoid> sent a code paste, see https://play.nim-lang.org/#pasty=iISQkPeM |
01:50:05 | FromDiscord | <arkanoid> I think I'm facing this https://github.com/nim-lang/Nim/issues/14873 |
01:51:47 | FromDiscord | <arkanoid> fixed by avoiding `$` on Lock |
01:52:40 | FromDiscord | <Elegantbeef> Literally broken software |
01:55:58 | FromDiscord | <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:53 | FromDiscord | <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:22 | FromDiscord | <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:18 | FromDiscord | <elykpha> sent a code paste, see https://play.nim-lang.org/#pasty=MMSuwUVU |
08:19:20 | FromDiscord | <odexine> sent a code paste, see https://play.nim-lang.org/#pasty=kordRjZo |
08:23:34 | FromDiscord | <elykpha> thankss |
08:24:19 | FromDiscord | <elykpha> interesting. i guess i dont need to hide my fields like in other languages with `_field` like syntax? |
08:24:23 | FromDiscord | <elykpha> cool stuff |
08:24:38 | FromDiscord | <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:08 | FromDiscord | <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:26 | FromDiscord | <matkuki.> sent a code paste, see https://play.nim-lang.org/#pasty=VjaskzTa |
11:57:24 | FromDiscord | <demotomohiro> In reply to @matkuki. "Hi guys, quick question.": https://nim-lang.org/docs/manual.html#statements-and-expressions-table-constructor |
12:26:35 | FromDiscord | <kapendev> Love it when the docs are just 8 lines. |
13:07:33 | FromDiscord | <matkuki.> @demotomohiro Thank you 👍 |
13:22:04 | FromDiscord | <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:09 | FromDiscord | <ninovanhooff> sent a long message, see https://pasty.ee/fbvHxOqi |
13:24:41 | FromDiscord | <ninovanhooff> (edit) "https://pasty.ee/OKELeeYR" => "https://pasty.ee/FcZGWqUx" |
13:29:39 | FromDiscord | <albassort> what type can i use for a tuple of typedesc |
13:29:41 | FromDiscord | <albassort> e.g |
13:30:12 | FromDiscord | <albassort> sent a code paste, see https://play.nim-lang.org/#pasty=SMcamTYa |
13:32:37 | FromDiscord | <odexine> In reply to @ninovanhooff "I already got my": https://nim-lang.org/docs/manual_experimental.html#importing-private-symbols |
13:38:22 | FromDiscord | <odexine> In reply to @albassort "what type can i": “What type”? |
13:49:53 | FromDiscord | <albassort> In reply to @odexine "“What type”?": idk what you're saying |
13:50:12 | FromDiscord | <odexine> In reply to @albassort "idk what you're saying": What do you mean “what type” |
13:50:20 | FromDiscord | <albassort> did i even say that |
13:50:29 | FromDiscord | <albassort> err |
13:50:41 | FromDiscord | <albassort> i feel like that is very simple and clear english, i will not elaborate |
14:29:05 | FromDiscord | <lowlowcode_96272> How to use a pointer to another object in an object ? (Stack allocated object) |
14:55:39 | FromDiscord | <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:20 | FromDiscord | <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:43 | FromDiscord | <Robyn [She/Her]> `std/streams` uses function pointers for example |
14:58:41 | FromDiscord | <Robyn [She/Her]> In reply to @lowlowcode_96272 "How to use a": `addr myObj` to get a pointer from an object |
14:59:12 | FromDiscord | <Robyn [She/Her]> The type would be `ptr Obj` where Obj is the type name |
15:00:07 | FromDiscord | <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:27 | FromDiscord | <odexine> In reply to @albassort "i feel like that": okay, i will not answer |
15:16:05 | FromDiscord | <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:46 | FromDiscord | <odexine> what are you trying to do within your destructors? |
15:29:56 | FromDiscord | <lowlowcode_96272> In reply to @battery.acid.bubblegum "The type would be": thanks |
15:41:32 | FromDiscord | <Robyn [She/Her]> np |
15:46:33 | FromDiscord | <arkanoid> for example setting inner C struct pointer to null↵(@odexine) |
15:47:11 | FromDiscord | <odexine> does this need to be done if the object is being destroyed anyway? |
15:47:44 | FromDiscord | <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:21 | FromDiscord | <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:43 | FromDiscord | <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:55 | FromDiscord | <arkanoid> sent a long message, see https://pasty.ee/FutIhUit |
17:04:10 | FromDiscord | <odexine> Ah, locks, okay |
17:07:53 | FromDiscord | <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:21 | FromDiscord | <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:50 | FromDiscord | <arkanoid> sent a code paste, see https://play.nim-lang.org/#pasty=siXFmzuo |
19:00:20 | FromDiscord | <Elegantbeef> arkanoid is it just a opaque pointer? |
19:00:57 | FromDiscord | <arkanoid> yes, no other fields other than C struct ptr |
19:01:28 | FromDiscord | <Elegantbeef> `type MyWrapper {.importc: "struct CStruct".}= ptr object` should be best methinks |
19:05:20 | FromDiscord | <arkanoid> mm no, that doesn't isolate nim interface from c interface |
19:06:42 | FromDiscord | <Elegantbeef> Well then remove the importc |
19:06:56 | FromDiscord | <Elegantbeef> The importc was assuming you wanted good type checks |
19:07:03 | FromDiscord | <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:28 | FromDiscord | <Elegantbeef> I both like it and dislike it |
19:08:51 | FromDiscord | <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:11 | FromDiscord | <Elegantbeef> Yea it's nice in that regard |
19:12:49 | FromDiscord | <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:50 | FromDiscord | <Elegantbeef> Well atleast I think there is, might not be actually since the linker can still do the assurances.... |
19:13:45 | FromDiscord | <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:03 | FromDiscord | <arkanoid> headers and libs usually comes in bundle for a reason |
19:15:32 | FromDiscord | <Elegantbeef> right, but most people don't want to depend upon futhark so will ship a generated .nim |
19:15:55 | FromDiscord | <Elegantbeef> Atleast for 'released packages' |
19:16:17 | FromDiscord | <Elegantbeef> Not to say I don't use futhark and love it, but it's just an issue with C abi regardless 😄 |
19:18:17 | FromDiscord | <arkanoid> sent a code paste, see https://play.nim-lang.org/#pasty=RsTVuOER |
19:18:43 | FromDiscord | <Elegantbeef> I mean you should ship both |
19:20:58 | FromDiscord | <arkanoid> sent a code paste, see https://play.nim-lang.org/#pasty=PsJhFDbG |
19:21:13 | FromDiscord | <Elegantbeef> Of course they do |
19:21:36 | FromDiscord | <arkanoid> but you can't rewrite |
19:21:39 | FromDiscord | <Elegantbeef> Yes you can |
19:21:51 | FromDiscord | <Elegantbeef> The destructor is made on the first usage if not declared |
19:22:35 | FromDiscord | <Elegantbeef> sent a code paste, see https://play.nim-lang.org/#pasty=BHVnyUhf |
19:23:04 | FromDiscord | <arkanoid> sent a code paste, see https://play.nim-lang.org/#pasty=PXcDrrIr |
19:23:17 | FromDiscord | <arkanoid> sent a code paste, see https://play.nim-lang.org/#pasty=RECiDisE |
19:23:30 | FromDiscord | <Elegantbeef> Right cause your copy is already generated |
19:23:37 | FromDiscord | <Elegantbeef> Put the copy before the destroy |
19:24:35 | FromDiscord | <Elegantbeef> `self.Socket` can require a copy which I assume why the compiler thinks a copy is needed |
19:25:57 | FromDiscord | <arkanoid> mh, aren't conversions from between distincs type just type sugar at the end |
19:28:28 | FromDiscord | <Elegantbeef> They should be so the compiler just is being a bit silly |
19:28:29 | FromDiscord | <arkanoid> ah ok |
19:34:48 | FromDiscord | <arkanoid> sent a long message, see https://pasty.ee/BVAIhHuQ |
20:36:05 | FromDiscord | <Robyn [She/Her]> I wonder if this is compatible with Nim: https://github.com/tyfkda/xcc |
20:36:40 | FromDiscord | <Robyn [She/Her]> No goto statement tho |
20:48:09 | FromDiscord | <michael.lenz.> I tried it three or four years ago |
21:25:17 | * | ntat quit (Quit: Leaving) |
21:26:52 | FromDiscord | <fl4shk> Question about Nim. Is C++ style RAII possible? I was planning on targeting an embedded system. |
21:27:05 | FromDiscord | <fl4shk> garbage collection appears to be something I should avoid for the project. |
21:28:12 | FromDiscord | <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:31 | FromDiscord | <fl4shk> but I think Nim would be a good pick for the software I write for the system. |
21:29:39 | FromDiscord | <Elegantbeef> Is it possible?! It's what Nim's ARC is |
21:33:43 | FromDiscord | <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:53 | FromDiscord | <Elegantbeef> No |
21:33:59 | FromDiscord | <Elegantbeef> You can heap allocate and let arc do it's job |
21:37:51 | FromDiscord | <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:03 | FromDiscord | <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:47 | FromDiscord | <fl4shk> In reply to @arkanoid "I know, I was": well that doesn't always mean no heap use |
21:39:16 | FromDiscord | <fl4shk> well |
21:39:30 | FromDiscord | <arkanoid> yes, not always, but many embedded projects I know avoid heap for some reason |
21:39:53 | FromDiscord | <fl4shk> I'm not wanting to avoid heap entirely |
21:40:09 | FromDiscord | <fl4shk> I'm wanting more easily understandable timing |
21:40:14 | FromDiscord | <fl4shk> ...which for me won't mean no heap |
21:40:22 | FromDiscord | <fl4shk> if I have to write that myself, that's not such a big deal |
21:40:37 | FromDiscord | <fl4shk> having my own `=destroy` is fine |
21:41:01 | FromDiscord | <fl4shk> I thought I heard somewhere that Nim had support for something that's C++ like |
21:41:22 | FromDiscord | <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:30 | FromDiscord | <fl4shk> oh okay that works for me |
21:41:38 | FromDiscord | <fl4shk> I'll have to learn the language first. |
21:41:51 | FromDiscord | <fl4shk> I think Nim would work as a good C++ replacement for the stuff I do. |
21:42:05 | FromDiscord | <fl4shk> I know Nim can interop with C++ |
21:42:33 | FromDiscord | <fl4shk> I do kind of want to write my own allocator |
21:42:41 | FromDiscord | <fl4shk> so I suppose that's something I'll look into |
21:43:01 | FromDiscord | <fl4shk> I read that there are good macros in Nim |
21:43:05 | FromDiscord | <fl4shk> way better situation than C++ |
21:44:41 | FromDiscord | <Elegantbeef> Nim has proper introspection macros |
21:44:41 | FromDiscord | <Elegantbeef> Not just guess and shoot templates |
21:44:54 | FromDiscord | <fl4shk> yeah that's the stuff I want to take advantage of |
21:44:59 | FromDiscord | <fl4shk> (edit) "take advantage" => "make use" |
21:45:02 | FromDiscord | <fl4shk> It just sounds really cool |
21:45:17 | FromDiscord | <fl4shk> I've been using C++ since 2008 but I think I'd like to move on now |
21:45:27 | FromDiscord | <fl4shk> (2008 was when I started learning how to code) |
21:45:43 | FromDiscord | <fl4shk> at least for my personal projects haha |
22:55:26 | * | beholders_eye joined #nim |
23:05:35 | FromDiscord | <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) |