<< 28-10-2023 >>

00:15:40FromDiscord<treeform> In reply to @chronos.vitaqua "Hey <@107140179025735680>, I may": Can you make a small test case?
00:25:02*raynei joined #nim
00:29:32*raynei quit (Ping timeout: 258 seconds)
02:08:49*itsmekali321 joined #nim
02:09:20*itsmekali321 quit (Client Quit)
03:22:04*edr quit (Quit: Leaving)
03:33:58FromDiscord<wick3dr0se> Do you guys think it's reasonable to write an MMO game like this in Nim? Not really sure its 2D https://media.discordapp.net/attachments/371759389889003532/1167667546586091730/tibia_121391_full.png?ex=654ef625&is=653c8125&hm=7ad6a0762111c51e113580428fe5f747e10244da8ca6c37456c2c111625bd367&
03:43:33FromDiscord<Elegantbeef> sure
04:00:28FromDiscord<wick3dr0se> In reply to @Elegantbeef "sure": Would you recommend a starting point for something like this? Simple combat system, arrow key, cursor movement, nothing too wild..
04:00:42FromDiscord<Elegantbeef> Sdl is nice and easy
04:04:49FromDiscord<wick3dr0se> In reply to @Elegantbeef "Sdl is nice and": Is there any solid refrences for something like this in Nim?
04:08:38FromDiscord<wick3dr0se> Actually find a few
04:08:44FromDiscord<wick3dr0se> (edit) "find" => "found"
04:10:24FromDiscord<Elegantbeef> Sdl is simple and it's the same everywhere
04:10:51FromDiscord<wick3dr0se> I see now its a C wrapper and I could just learn through that too. That helps a lot
05:47:00FromDiscord<0_archkubi_0> i can't see help channel ?
05:47:39FromDiscord<0_archkubi_0> i need help i start nim lang today
05:47:42FromDiscord<Elegantbeef> Maybe it doesn't exist
05:47:42FromDiscord<Elegantbeef> Maybe you are here
05:49:07FromDiscord<0_archkubi_0> sent a code paste, see https://play.nim-lang.org/#ix=4K8e
05:49:14FromDiscord<0_archkubi_0> expression '' has no type (or is ambiguous) what is this
05:49:37FromDiscord<Elegantbeef> `astroObject: type` is wrong
05:49:38FromDiscord<odexine> `var astroObject: type = AstroObject` remove `: type`
05:49:42FromDiscord<Elegantbeef> Variables cannot be types
05:49:57FromDiscord<odexine> you prolly meant `: AstroObject` instead
05:50:02FromDiscord<0_archkubi_0> i start learn today bro
05:51:34FromDiscord<0_archkubi_0> can you fix for me i'm realy tired i need sleep 😦
05:55:49FromDiscord<0_archkubi_0> i don't know how i fix all error but thanks again
06:03:17NimEventerNew thread by icedquinn: Nim#, see https://forum.nim-lang.org/t/10570
06:29:43*xet7 quit (Remote host closed the connection)
06:46:12*junaid_ joined #nim
07:01:06FromDiscord<that_dude.> In reply to @wick3dr0se "Would you recommend a": I also recommend taking a look at raylib, the nim wrappers are all pretty close to what you would find on the cheat sheet. It's what I use for my stuff
07:47:02*junaid_ quit (Remote host closed the connection)
07:50:12FromDiscord<Phil> I mean, if you want I can give you a step-by-step explainer. Just say the word.
07:50:18FromDiscord<Phil> <@1037987236840488980>
07:51:54FromDiscord<Phil> You have overall around 5 problems in your code above
08:00:31FromDiscord<Phil> sent a code paste, see https://play.nim-lang.org/#ix=4K8u
08:00:51FromDiscord<Phil> (edit) "https://play.nim-lang.org/#ix=4K8u" => "https://play.nim-lang.org/#ix=4K8v"
08:01:20FromDiscord<Phil> (edit) "https://play.nim-lang.org/#ix=4K8v" => "https://play.nim-lang.org/#ix=4K8w"
08:03:36FromDiscord<odexine> 4 and 5 may not apply, I was under the impression that it was a snippet of code
08:07:07FromDiscord<Phil> I mean we're missing correct object instantiation syntax, I was willing to assume that was the entire piece of code copied from somewhere to be taken as basis
08:07:23FromDiscord<Phil> (edit) "I mean we're missing correct object instantiation syntax, I was willing to assume that was the entire piece of code copied from somewhere to be taken as basis ... " added "for playing around with it"
08:16:35*neceve joined #nim
08:35:06NimEventerNew thread by sei: Reuse generic Type of Concept as field Type of another generic Type, see https://forum.nim-lang.org/t/10572
08:45:08FromDiscord<Phil> I wonder what the actual usecase for std/random is
08:45:52FromDiscord<Phil> Given that for a given range it returns always the same numbers in the same order
08:48:07FromDiscord<Elegantbeef> @Phil call `randomize`?
08:48:52FromDiscord<Phil> Huh, given that I tend to always use sysrand I keep forgetting that that is a thing
08:49:38FromDiscord<Elegantbeef> It's important for when you want to have a replayable rng
08:50:19FromDiscord<Phil> Ah beef, concept question
08:51:32FromDiscord<Phil> sent a long message, see http://ix.io/4K8B
08:52:26FromDiscord<Elegantbeef> sent a code paste, see https://play.nim-lang.org/#ix=4K8C
08:53:22FromDiscord<Phil> In this scenario, Orm is a placeholder for "any type", right?
08:53:35FromDiscord<Elegantbeef> No
08:53:47FromDiscord<Elegantbeef> `Orm` is the type that you're concept is checking for
08:53:48FromDiscord<Phil> It's kinda like T when declaring a generic with the bracket syntax of `proc x[T](): T` ?
08:53:51FromDiscord<Elegantbeef> your\
08:54:19FromDiscord<Phil> Yeah but it could be the type `Model` from norm, the type `Entity` from another package I just invented etc
08:54:37FromDiscord<Elegantbeef> It's the type you're attempting to match
08:54:40FromDiscord<Phil> Check
08:54:51FromDiscord<Elegantbeef> If you have a `read(int64): string` it'll work
08:56:28FromDiscord<Phil> sent a code paste, see https://play.nim-lang.org/#ix=4K8D
08:56:48FromDiscord<Phil> Wait, could I just... `Orm().id is int`?
08:57:01FromDiscord<Elegantbeef> You could, but that is the exact same
08:57:52FromDiscord<Phil> Wait so I could `Orm.id is int`?
08:58:06FromDiscord<Elegantbeef> No my point is `Orm().id` is redundant
08:58:16FromDiscord<Elegantbeef> it's the same as your example
08:59:01FromDiscord<Phil> sent a code paste, see https://play.nim-lang.org/#ix=4K8E
08:59:41FromDiscord<Phil> Though it doesn't compile at the moment, hmmm
09:00:22FromDiscord<Elegantbeef> So have both?
09:00:27FromDiscord<Elegantbeef> `concept entity, type Orm`
09:03:23FromDiscord<Phil> sent a code paste, see https://play.nim-lang.org/#ix=4K8F
09:04:06FromDiscord<Elegantbeef> `entity` introduces a instance
09:04:12FromDiscord<Elegantbeef> `type Orm` introduces a alias for type
09:04:48FromDiscord<Phil> Could you even make a Concept that defines how 2 types interact with one another?
09:05:01FromDiscord<Elegantbeef> https://nim-lang.org/docs/manual_experimental.html#concepts
09:05:02FromDiscord<Phil> Like a Concept encompassing 2 types that are both generic?
09:05:12FromDiscord<Elegantbeef> Not really
09:05:23FromDiscord<Phil> I'd imagine so, I can't even properly visualize it in my head
09:05:25FromDiscord<Elegantbeef> It's a type match
09:05:45FromDiscord<Elegantbeef> You can only say that "For a match to happen this list must be true"
09:06:02FromDiscord<Phil> 👍
09:06:29FromDiscord<Phil> The fact that generic concepts exist is kind of wild to me
09:07:28FromDiscord<Elegantbeef> Eh most people use them wrong
09:08:31FromDiscord<Elegantbeef> sent a code paste, see https://play.nim-lang.org/#ix=4K8G
09:09:08FromDiscord<Elegantbeef> `true` is just a placeholder
09:11:00FromDiscord<Phil> If I essentially define an entire interface through that concept with like a dozen or two procs I wonder how much that'll slow down compilation
09:15:20FromDiscord<Elegantbeef> I'd like to imagine it caches matches, but who knows
09:24:40FromDiscord<Phil> sent a code paste, see https://play.nim-lang.org/#ix=4K8K
09:27:26FromDiscord<Chronos [She/Her]> In reply to @treeform "Can you make a": Yeah I was doing that before I went to get some rest, issue is that it crashes when you try comparing a ref type, for example
09:33:59NimEventerNew question by gnuchanos: raylib nim i learn this language today i have to much problem, see https://stackoverflow.com/questions/77378852/raylib-nim-i-learn-this-language-today-i-have-to-much-problem
09:34:22FromDiscord<Phil> At this point the error message serves more as a negative filter: Whatever is in there is mentioned in there most definitely not the problem
09:36:39FromDiscord<Phil> Looking at the question above, I wonder why people pick up the lang, don't familiarize themselves with the basics and just immediately go "How about I implement something difficult immediately?"
09:39:27*neceve quit (Ping timeout: 240 seconds)
09:42:36NimEventerNew thread by archkubi: I need explain error logs what mean, see https://forum.nim-lang.org/t/10573
09:43:09*xet7 joined #nim
09:47:16FromDiscord<Phil> In reply to @0_archkubi_0 "i can't see help": Given your questions elsewhere, have you read the other advise that was already posted here and familiarized yourself with nim as a language first before diving into more complex topics.↵Like e.g. what the difference between an int and a float is or how you create an object instance in nim=
09:47:17FromDiscord<Phil> (edit) "nim=" => "nim?"
09:47:26FromDiscord<Phil> (edit) "topics.↵Like" => "topics?↵Like"
09:49:44FromDiscord<Phil> Because fundamentally for example, ` var astroObject = AstroObject(astro_texture, astro_x, astro_y, astroSpeed)` for example is not valid nim syntax to create objects.↵I posted this here: https://discord.com/channels/371759389889003530/371759389889003532/1167734614551441509
09:56:00FromDiscord<Phil> Beeeeeeef
09:56:04FromDiscord<Phil> Concepts are being mean again!
09:57:08FromDiscord<Phil> sent a code paste, see https://play.nim-lang.org/#ix=4K8P
09:57:33FromDiscord<Phil> (edit) "https://play.nim-lang.org/#ix=4K8P" => "https://play.nim-lang.org/#ix=4K8Q"
09:58:51FromDiscord<Phil> (edit) "https://play.nim-lang.org/#ix=4K8Q" => "https://play.nim-lang.org/#ix=4K8R"
10:19:17*junaid_ joined #nim
10:21:24FromDiscord<Chronos [She/Her]> From my limited knowledge of concepts, maybe because `EntityTyp` isn't a concrete type?
10:21:39FromDiscord<Chronos [She/Her]> So you can't have a seq of it?
10:27:34*xet7 quit (Quit: Leaving)
10:36:02FromDiscord<vindaar> sent a code paste, see https://play.nim-lang.org/#ix=4K8V
10:40:46FromDiscord<Phil> ... I was contemplating opening an issue for that, but I see there's 4 pages of concept bugs and I don't think this one will fare any better
10:41:26FromDiscord<Phil> sent a code paste, see https://play.nim-lang.org/#ix=4K8Y
10:42:06FromDiscord<Phil> (edit) "better" => "better.↵Particularly since this is so easily encountered that I assume one of the issues of those 4 pages of concept bugs that are 3+ years old at times will contain them somewehre"
10:42:08FromDiscord<vindaar> In reply to @isofruit "... I was contemplating": well, the more activity there is about this sort of stuff the higher the pressure to fix some of them 🙂
10:56:31FromDiscord<Phil> In reply to @vindaar "well, the more activity": Does this sound like it explains the problem:↵> [Concept] predicates that check for proc return types that are seqs always fail when using a `type X` concept parameter↵ ?↵The entire thing is a bit hard to put into words so I'm struggling with the title
10:56:41*Qaziquza joined #nim
10:57:26*Qaziquza quit (Client Quit)
11:00:30FromDiscord<vindaar> Seems fine. I'd probably rephrase a bit to (personal preference mostly)↵> [Concept] predicates checking for proc return types `seq[X]` fail for `type X` concept parameter
11:04:46FromDiscord<Phil> Sidenote, specific reason you prefer typeof over type ? 😛
11:07:41*junaid_ quit (Remote host closed the connection)
11:09:17FromDiscord<vindaar> see recent Araq comments in #internals. He considers it a design fault because `type` can both refer to a `typedesc` and the usage of `typeof` iirc
11:12:06FromDiscord<vindaar> (he's mentioned that multiple times over the years in different places)
11:15:48FromDiscord<vindaar> In reply to @vindaar "see recent Araq comments": here: https://discord.com/channels/371759389889003530/768367394547957761/1166807095761440920
11:29:14FromDiscord<OdoItal> I figure this might be old news to some people, but I just saw [this comment](https://plugins.jetbrains.com/plugin/15128-nim/reviews#review=91174-91204)\: Here's hoping I can use jetbrains for Nim again before too long 🤞
11:54:23FromDiscord<Chronos [She/Her]> Is there a quick way to get a string from a `seq[byte]` without casting? Feels hacky to just use cast for that
12:23:04FromDiscord<Chronos [She/Her]> Hm... For some reason mysql doesn't like `sqlDump`
12:23:09FromDiscord<Chronos [She/Her]> For comparing objects
12:23:23FromDiscord<Chronos [She/Her]> The issue is though... How else do I compare them :/
12:28:02FromDiscord<Chronos [She/Her]> Hm... Anyone able to look at this and see if I'm missing something? https://github.com/Yu-Vitaqua-fer-Chronos/debby/actions/runs/6676840851/job/18146301502#step:9:158↵I'd imagine the issue is with the comparison of binary data but not sure how I'd fix that so
12:54:44FromDiscord<Phil> Which flags can I pass to be as close to an apple-style compilation as possible?↵I know I need to pass -cc:clang to use clang, anything else?
12:54:54FromDiscord<Phil> (edit) "-cc:clang" => "--cc:clang" | "clang," => "clang like they do on macOs,"
12:54:59FromDiscord<Phil> (edit) "apple-style" => "macOs-style"
12:55:11FromDiscord<Chronos [She/Her]> In reply to @chronos.vitaqua "Hm... Anyone able to": Hmm test seems to work on PostgreSQL
12:55:16FromDiscord<Chronos [She/Her]> Time to test on my SQL then
12:57:03FromDiscord<Chronos [She/Her]> (edit) "my SQL" => "MySQL"
13:01:03FromDiscord<Phil> I can not express how much I hate the fact that to replicate any kind of bug for an apple device you need to own said apple device, literally burning money essentially
13:02:52FromDiscord<Chronos [She/Her]> Rip
13:03:14FromDiscord<Chronos [She/Her]> Just bundle your application with Wine or smth smh
13:07:29FromDiscord<odexine> In reply to @isofruit "Which flags can I": own a mac
13:07:58FromDiscord<Chronos [She/Her]> Run Darwin yourself :yeet:
13:08:02FromDiscord<odexine> sure
13:09:19FromDiscord<Phil> Just kinda sucks when somebody can't even compile the owlkettle examples because on apple the linker for clang somehow croaks: https://media.discordapp.net/attachments/371759389889003532/1167812340654297108/message.txt?ex=654f7cfe&is=653d07fe&hm=6ff4c756f10edb5f8c87448ec9625fcf99ff9f8d03a778764b7cc88519c9984f&
13:10:56FromDiscord<Chronos [She/Her]> In reply to @chronos.vitaqua "Time to test on": Yep this is a fucking MySQL bug
13:24:44FromDiscord<lee1262> Does anyone know what the -g switch does on compile I can’t find it in the nim -fullhelp - I think it has something to do with debugging but don’t know what that is - ta
13:38:37FromDiscord<michaelb.eth> In reply to @isofruit "Just kinda sucks when": what version of Nim?
13:38:45FromDiscord<Phil> nim 2.0
13:41:05FromDiscord<michaelb.eth> there used to be a problem with limitations of bsd ar, used on macos by default while Nim assumed/s it will work like gnu ar. i thouth that was fixed but maybe not?
13:41:20*CO2 quit (Quit: WeeChat 4.1.0)
13:41:24FromDiscord<michaelb.eth> let me find a link…
13:41:49FromDiscord<michaelb.eth> (edit) "thouth" => "thought"
13:42:00FromDiscord<Phil> I mean, mind you I don't know jack about compiling
13:42:16FromDiscord<Phil> I can use them and have mediocre usage knowledge
13:44:08FromDiscord<michaelb.eth> https://github.com/nim-lang/Nim/issues/15589#issuecomment-709536971
13:44:26FromDiscord<michaelb.eth> try that workaround with llvm-ar
13:45:17FromDiscord<Phil> I'll forward that to the issue at hand where this cropped up:↵https://github.com/can-lehmann/owlkettle/issues/130
13:48:26FromDiscord<Phil> In reply to @michaelb.eth "https://github.com/nim-lang/Nim/issues/15589#issuec": Out of curiosity are you on mac and remember this therefore or is that just in your memory from contributing?
13:49:13FromDiscord<michaelb.eth> i was running into it and figured out the workaround
13:49:21FromDiscord<michaelb.eth> the/a
13:51:23FromDiscord<michaelb.eth> when the problem manifested itself wasnt clear what was going on, but after turning nim c verbosity to 3 i eventually figured out it was the ar tool that’s failing
13:51:46FromDiscord<michaelb.eth> (edit) "itself" => "it"
14:21:21FromDiscord<wick3dr0se> In reply to @that_dude. "I also recommend taking": Have you tried SDL and raylib? Sdl looks more difficult but I care more about performance, portability and such
14:25:18FromDiscord<Chronos [She/Her]> Huh... My newer test that isn't using bytes is still broken
15:24:20*CO2 joined #nim
15:30:36FromDiscord<pcarrier> how should I structure my project (directories, nim and nimble configs) if I have: (1) a bunch of platform agnostic "library" code (no need to generate a lib) (2) a wasm binary (3) a non-wasm portable TUI?
15:48:44*krux02 joined #nim
16:11:54FromDiscord<takemichihanagaki3129> sent a code paste, see https://play.nim-lang.org/#ix=4Kap
16:12:04FromDiscord<takemichihanagaki3129> Have I done smt wrong?
16:12:54FromDiscord<takemichihanagaki3129> (edit) "https://play.nim-lang.org/#ix=4Kap" => "https://play.nim-lang.org/#ix=4Kar"
16:14:44FromDiscord<Phil> That's typically just a hint, you sure that's the entire stacktrace you get in your terminal?
16:16:36FromDiscord<takemichihanagaki3129> In reply to @isofruit "That's typically just a": Fixed! 😅
16:16:49FromDiscord<takemichihanagaki3129> Wrong indentation...
16:17:39FromDiscord<summarity> I'm wrapping a C lib, what's the correct translation of `float` (as in an array of floats)? `ptr UncheckedArray[cfloat]` ?
16:19:46FromDiscord<Chronos [She/Her]> Should just be `UncheckedArray[cfloat]`, since arrays in C are always pointers
16:20:37FromDiscord<Chronos [She/Her]> `ptr UncheckedArray[cfloat]` would be `float`
16:20:42FromDiscord<Chronos [She/Her]> @summarity
16:21:44FromDiscord<summarity> I see. Makes sense from `char` == `cstringArray` == `ptr UncheckedArray[cstring]`
16:25:20FromDiscord<Phil> In reply to @summarity "I'm wrapping a C": You might get away with seq I think, for char arrays I know you can use cstring
16:25:47FromDiscord<Phil> So double pointer char array is ptr cstring
16:26:01Amun-Rasummarity: yes, ptr UncheckedArray[cfloat]
16:26:40Amun-RaChronos: no, arrays in C are different type than pointers
16:28:01Amun-Rabut that's a common misconception because it's not possible to pass an array to a function and retain the type
16:29:54FromDiscord<Phil> I mean in gtk I have the luxury of never having to access the actual data in the data structures, I can just make distinct pointer types and use getters/setters that gtk provides
16:29:55Amun-Rafor example, char (*)[100] becomes char *
16:31:37Amun-RaI did something similar in my gtk library
16:32:19Amun-Ratype Widget {.incompletestruct.}: Object; type WidgetPtr* = ptr Widget
16:33:32FromDiscord<Phil> type toast = distinct pointer
16:33:50FromDiscord<Phil> (edit) "toast" => "AdwToast"
16:34:00Amun-Rayes, different approach, same result
16:34:32FromDiscord<Phil> What does your syntax do? I'm curious since I've never seen that pragma
16:35:18Amun-Rait's used for opaque types, when the real size of the object is hidden
16:35:42Amun-RaI have to push my libs to gh someday… ;>
16:36:38FromDiscord<Phil> Assume I'm a python Dev, opaque types?↵Like I don't know the type so I can assume it has any field?↵How does that behave?
16:37:17Amun-Ralet's say you have in a header: struct foo; void somefunc(struct foo *f);
16:38:04Amun-Rathe function operates on pointer to foo, size of a pointer is known
16:38:16Amun-Rasize of a struct isn't know but is not needed
16:39:07Amun-Raanother example of such a struct is VLA (variable length array) - struct foo { int x; int y; int arr[]; };
16:39:26FromDiscord<Phil> How does that differentiate the syntax from just making a distinct pointer?↵Does it hide better from a user that it is a pointer?
16:40:07FromDiscord<Phil> Curious about the nuances the the two approaches differ in
16:41:12Amun-RaI did that way for two reasons - I wanted to keep objects as close to originals as possible, that way I don't have to rememeber I made something a pointer that wasn't in original ABI
16:42:34FromDiscord<Chronos [She/Her]> In reply to @Amun-Ra "Chronos: no, arrays in": Really? Huh
16:42:58FromDiscord<Phil> Doing the distinct pointer approach introduces a new pointer?
16:43:38FromDiscord<Phil> When I'm home I'll have to do an image
16:43:48Amun-RaI mean GtkWidget is a struct, that's why I have GtkWidget = object
16:44:39Amun-Raand because gtk always operates on GtkWidget* I don't really have to implement all the fields
16:45:16Amun-RaPhil: this is how I implemented object hierarchy: https://dpaste.com/5Y8PZX58S
16:46:11Amun-Racreate_object_ptr is a macro that creates type ObjectName {.final, incompletestruct, pure.} = object; ObjectNamePtr* = ptr ObjectName
16:48:36Amun-Rait's just a different approach, both methods are fine
16:49:04FromDiscord<demotomohiro> sent a code paste, see https://play.nim-lang.org/#ix=4KaC
16:51:45FromDiscord<Chronos [She/Her]> Looking through the usages seems to show it's essentially the same `cstringArray {.importc: "char", nodecl.} = ptr UncheckedArray[cstring]`
16:52:05FromDiscord<Chronos [She/Her]> That's frm https://github.com/nim-lang/Nim/blob/fbc801d1d15aa2c5f12a3f3bc1e35aad185dafb1/lib/system/ctypes.nim#L68
16:54:14FromDiscord<demotomohiro> `cstring` in Nim is `char` in C, and `ptr UncheckedArray[cstring]` is `char`.
16:54:28Amun-Raptr UncheckedArray[cstring] is an equivalent of const char **
16:55:52Amun-Raor, when represented as array type, as const char * (*)[]
16:56:33FromDiscord<Chronos [She/Her]> Aah alright then, thanks y'all
16:57:18Amun-Rasimply put: it signals the type is a pointer to an array of [type] with unknown lenght
16:57:35Amun-Raand it allows to get a value via []
16:57:51Amun-Rahowever ordinary ptr type does not
16:58:16Amun-Ras/to get/getting/
16:58:32FromDiscord<Chronos [She/Her]> Ah
17:32:33FromDiscord<michaelb.eth> anyone familiar with D, in particular `ldc` and `ldc.simd`? There's some D code making use of SIMD that I want to understand better what it's doing so maybe I can do something similar in Nim, which might involve using nimsimd, or maybe what I need is already in laser/arraymancer
18:10:44*neceve joined #nim
18:52:20arkanoidin "let mystring = $mycstring", mystring is a full GCed copy of mycstring?
18:52:40arkanoidor better, ORCed copy of mycstring
18:54:35FromDiscord<Elegantbeef> Yes
18:54:45arkanoidthanks
18:54:50FromDiscord<Elegantbeef> `string` is a pascal string where len and capacity are stored
18:56:51arkanoidsure, but I did not know if the buffer was copied or just re-liked
18:57:15FromDiscord<Elegantbeef> You cannot safely point to a cstring given you cannot know where it came from or who allocated it
18:57:24FromDiscord<Elegantbeef> So deallocating it is impossible
18:57:31FromDiscord<Elegantbeef> Atleast inside of a Nim string
19:01:38*SebastianM joined #nim
19:08:10*SebastianM quit (Quit: -a- IRC for Android 2.1.59)
19:09:52NimEventerNew post on r/nim by Robert_Bobbinson: What's wrong with my code (Nim 2.0), see https://reddit.com/r/nim/comments/17ikpje/whats_wrong_with_my_code_nim_20/
19:10:16FromDiscord<cephonaltera> is it possible to compile and dynamically load a module?
19:13:58FromDiscord<Chronos [She/Her]> In reply to @cephonaltera "is it possible to": Sure, if you want to mess with shared libraries and including a Nim compiler + C compiler in your program
19:14:31FromDiscord<Chronos [She/Her]> A better question is what are you trying to do?
19:18:57FromDiscord<cephonaltera> sent a code paste, see https://play.nim-lang.org/#ix=4Kbj
19:24:12FromDiscord<Phil> That just means that said lib wasn't on the path where binaries look for shared object files
19:24:25FromDiscord<Phil> Which is something I have to google every time where that is
19:28:06FromDiscord<cephonaltera> yeah it was hidden away in some ~/.choosenim/ thing but now im just failing to compile https://media.discordapp.net/attachments/371759389889003532/1167907664806817832/image.png?ex=654fd5c5&is=653d60c5&hm=b5b100d4ac4cf24adcd0de186462a72a8eacdac351ac52306540d2d1e40e8d94&
19:35:41FromDiscord<Phil> All you youngins and your fancy colored terminals with those fancy non-black backgrounds 😛
19:35:59FromDiscord<Phil> But yeah, looks like the C code is blowing up for some reason
19:36:40FromDiscord<Phil> Which I'm not sure where that's from, but try again without hotcodereloading and without the nimcache flag ?
19:36:53FromDiscord<Phil> basically just nim c main.nim?
19:37:04FromDiscord<cephonaltera> it happened without the cache flag, i added it in case cache fucked up
19:37:16FromDiscord<cephonaltera> it also compiled before i added the .so files
19:37:21FromDiscord<Phil> Ah check, does it also occur with --mm:refc?
19:39:40FromDiscord<cephonaltera> compiled with `--mm:refc` however why wont it load the .so https://media.discordapp.net/attachments/371759389889003532/1167910575859302460/image.png?ex=654fd87c&is=653d637c&hm=919b01d77670884bb3dcbe2e04a86850f82f655a827daf9f2c45891a36d7fea9&
19:40:07FromDiscord<Phil> I mean, do as it suggests and maybe it'll spit out more info ^^
19:40:46FromDiscord<cephonaltera> `libnimhcr.so: cannot open shared object file: No such file or directory`↵the plot thickens
19:41:01FromDiscord<cephonaltera> maybe this dlopen does not look in the executable directory?
19:41:56FromDiscord<cephonaltera> looks like that was the case
19:42:12FromDiscord<cephonaltera> `could not import: nimrtl_nimGC_setStackBottom` based
19:42:31FromDiscord<cephonaltera> maybe i need to compile them with --mm:refc too?
19:45:05FromDiscord<cephonaltera> OK i got it working
19:45:08FromDiscord<cephonaltera> sick
19:46:48FromDiscord<Phil> 👍 ↵And now you know more about DLLs and loading them than me 😄
20:10:17Amun-Racephonaltera: you have to compile lib/nimhcr.nim iirc
20:10:47FromDiscord<cephonaltera> yes i did, this dlopen for some reason just does not look in the executable directory for .so files for some reason
20:10:58FromDiscord<cephonaltera> i copied them to /usr/lib and they got loaded
20:11:12Amun-Raadd "./" to the path
20:11:12FromDiscord<cephonaltera> kinda dirty though, stinky even id say, id need to figure that out
20:11:43FromDiscord<cephonaltera> im not calling dlopen manually. std/hotcodereloading does
20:12:21Amun-Rastrace it and check
20:13:36FromDiscord<cephonaltera> im reading the dlopen manpage, maybe checking the executable directory is specifically a C++ thing? theres no mention of it
20:14:13FromDiscord<cephonaltera> https://media.discordapp.net/attachments/371759389889003532/1167919266939543642/image.png?ex=654fe094&is=653d6b94&hm=cce0cbcd2ac13502e192a10c868adbf07a5159c9087aa1ad2f65e68c6819bc1b&
20:15:13Amun-Rasee ld.so(8)
20:15:40FromDiscord<cephonaltera> https://media.discordapp.net/attachments/371759389889003532/1167919631193874584/image.png?ex=654fe0ea&is=653d6bea&hm=ccf228aeec4da0d25e8a550d3e544fff4704162d0a79bb21ac69029d14992975&
20:15:49FromDiscord<cephonaltera> weird first 2 locations to check but ok
20:16:26Amun-Raman ld.so lists all the paths shared library are searched in
20:17:05Amun-Rayou can use for example: LD_LIBRARY_PATH=. ./prog
20:17:21Amun-Raassuming that .so is in .
20:17:50FromDiscord<cephonaltera> i could yeah
20:20:11Amun-Rabtw, you don't have to generate strace.log, you can grep it directly when redirected, ie: strace ./foo 2>&1|grep ^open
20:20:25Amun-Raor ^access
20:20:44FromDiscord<cephonaltera> yes true, however i never remember the fancy 2>&1| combination
20:20:59Amun-Ra:)
20:21:46Amun-Rastderr (fileno 2) redirected to stdout (fileno 1)
20:43:33*neceve quit (Ping timeout: 258 seconds)
20:57:45FromDiscord<nordgaren> sent a code paste, see https://play.nim-lang.org/#ix=4KbF
20:59:42FromDiscord<Phil> I think consts get inlined
20:59:58FromDiscord<nordgaren> I mean, even if it does, it still has to ve in memory, somewhere
21:00:03FromDiscord<nordgaren> (edit) "ve" => "be"
21:01:20FromDiscord<Phil> Just because addr doesn't work doesn't mean its not in memory.↵It just means that the compiler refuses to make addr work in this scenario
21:01:38FromDiscord<nordgaren> Okay, so it just won't let me get the address of the static resource?
21:02:23FromDiscord<Phil> You'd need to ask the details somebody that actually is deeper in this stuff, I never cared to know because you never should get pointers of consts either way
21:02:53FromDiscord<nordgaren> Well, it's just a static resource that I need to copy data out of.
21:05:12FromDiscord<Phil> I mean best I can do here is recommend `let x = myResource; x.addr`
21:05:25FromDiscord<Phil> It's the solution I'd know off the top of my head at least
21:08:55FromDiscord<helwastaken> im pretty sure it's cause const evaluates code in a vm
21:09:08FromDiscord<Chronos [She/Her]> In reply to @nordgaren "I mean, even if": Use `let` instead, `const` is basically (as far as I know) 'copy and paste'-ing `myResource` to wherever it's used
21:10:23FromDiscord<Chronos [She/Her]> Does anyone know how I'd check to see if my Nim code is being looked over with `nimcheck` instead of compiled?
21:10:49FromDiscord<helwastaken> if you use godbolt with nim 1.0.4 with the following code `var x {.exportc.} = 0xDEADBEEF` you can see deadbeef compiled into the code but if you turn var into const it doesnt get compiled in
21:11:35FromDiscord<nordgaren> Well, a whole file would probably be done differently.
21:11:49FromDiscord<helwastaken> if you know the best :Shrug:
21:12:02FromDiscord<nordgaren> Most langs will just take anything smaller than the architecture pointer size and inline it in the ASM.
21:12:22FromDiscord<nordgaren> But ofc you can't do that with a large file.
21:13:55FromDiscord<Chronos [She/Her]> May be that Nim can't guarantee it won't be inlined so it doesn't allow it
21:14:12FromDiscord<Chronos [She/Her]> In this case, doing as Phil suggested or I said earlier will do the job
21:14:28FromDiscord<nordgaren> Yea, gonna try that in a sec.
21:17:29FromDiscord<Chronos [She/Her]> In reply to @chronos.vitaqua "Does anyone know how": `nimsuggest` worked!
21:32:02FromDiscord<Chronos [She/Her]> Hm... Trying to think of a way to be able to uniquely identify each server without it being possible to impersonate it
21:32:33FromDiscord<Chronos [She/Her]> Okay
21:32:34FromDiscord<Chronos [She/Her]> So
21:32:35FromDiscord<Phil> That sounds like jtv territory
21:32:54FromDiscord<Chronos [She/Her]> Let me draw a diagram actually
21:33:19FromDiscord<Chronos [She/Her]> Cuz I understand it in my mind, words are just a mess tho
21:38:49Amun-RaChronos: https://play.nim-lang.org/#ix=4KbN
21:41:43FromDiscord<Chronos [She/Her]> Oh useful! Thanks!
21:45:41Amun-Ra:)
21:50:31FromDiscord<Chronos [She/Her]> Hm...
21:51:03FromDiscord<Chronos [She/Her]> Ugh, not sure how I'm supposed to structure this flow
21:54:28FromDiscord<TӨMΛ ☠> In reply to @cephonaltera "just an idea i": I see fellow plugin systems enjoyer 🥰
21:55:13FromDiscord<cephonaltera> hell yeah
22:00:01FromDiscord<Phil> Write docs on plugin systems in nim for the next person 😛
22:00:23arkanoidif I define procs within other procs but the inner one is not reading not writing data with the outer one, is it defined as a closure or it is just a normal proc with limited visibility from the outside context (desired behavior)
22:00:58FromDiscord<Elegantbeef> annotate it `{.nimcall.}` to see
22:01:05FromDiscord<Elegantbeef> If it fails compilation it was a closure
22:01:12FromDiscord<Elegantbeef> If it passes compilation it was a nimcall 😄
22:02:02arkanoidElegantbeef, thanks, but I did know that. My question was about if nim compiler is smart enough to detect and tag nimcall an inner function
22:02:27FromDiscord<Elegantbeef> It only makes it a closure if it needs to be one
22:02:29FromDiscord<Elegantbeef> Is my point
22:02:40arkanoidgood!
22:02:42arkanoidthanks
22:05:14FromDiscord<wick3dr0se> sent a code paste, see https://play.nim-lang.org/#ix=4KbP
22:13:39FromDiscord<Elegantbeef> sent a code paste, see https://play.nim-lang.org/#ix=4KbR
22:14:11FromDiscord<Elegantbeef> whoops should be `ch.setMode` and `ch.removeMode`
22:28:17FromDiscord<wick3dr0se> sent a code paste, see https://play.nim-lang.org/#ix=4KbT
22:29:24FromDiscord<Chronos [She/Her]> My idea does jackshit... Lol
22:30:06FromDiscord<Chronos [She/Her]> This was the idea, but having it laid out in a diagram just showed me it literally does nothing https://media.discordapp.net/attachments/371759389889003532/1167953462995193958/image.png?ex=6550006d&is=653d8b6d&hm=6672a685862e1edb5f2702bfde403f73c9e519dd60b1072398049580f97f5dfa&
22:36:17NimEventerNew thread by choltreppe: Map, mapIt for arrays, see https://forum.nim-lang.org/t/10575
22:42:07FromDiscord<wick3dr0se> sent a code paste, see https://play.nim-lang.org/#ix=4KbU
22:55:18FromDiscord<cyberlis (cyber_lis)> Hi. Is it possible to Move variable to thread ?
22:56:41FromDiscord<cyberlis (cyber_lis)> When I use `createThread(aThread, printer, move myStr)`↵I still get `=dup(myStr)`
22:56:41FromDiscord<Elegantbeef> Make a union around the types and then use that 😄
22:57:50FromDiscord<Elegantbeef> You should be able to move data across threads that's what `std/isolation` is for afterall
22:58:55FromDiscord<cyberlis (cyber_lis)> I see. I should use `Thread[Isolated[MyStr]]`
23:01:12FromDiscord<cyberlis (cyber_lis)> sent a code paste, see https://paste.rs/GcUof
23:01:57FromDiscord<Elegantbeef> did you attempt to `createThread` on a `Thread[void]`?
23:02:13FromDiscord<Elegantbeef> Might need a `when T is void` inside thread
23:02:27FromDiscord<Elegantbeef> Or you didnt update the thread proc
23:03:35FromDiscord<cyberlis (cyber_lis)> I just tried to change it inside my local copy of nim
23:05:05FromDiscord<cyberlis (cyber_lis)> Screenshot 2023-10-29 at 02.03.13.png https://media.discordapp.net/attachments/371759389889003532/1167962272363204688/Screenshot_2023-10-29_at_02.03.13.png?ex=655008a1&is=653d93a1&hm=66c9d7259fcd98a20b6a7f1c3415ec1ddf9734fa636e07ca7c01ef2fb98a91f3&
23:05:07FromDiscord<Elegantbeef> `sink void` is likely causing the issue
23:05:08FromDiscord<Elegantbeef> As `sink` likely hides the void type
23:05:09FromDiscord<Elegantbeef> sent a code paste, see https://play.nim-lang.org/#ix=4KbY
23:07:03FromDiscord<cyberlis (cyber_lis)> Thank you. I will try. I just thought that it will be cool to have an option to move variable to thread without Isolated. But maybe it is error prone and possibly dangerous
23:12:22FromDiscord<Elegantbeef> Well the issue is that if you move a resource that contains other references you might attempt to deallocate twice
23:13:37FromDiscord<Elegantbeef> Isolated prevents that by ensuring no references escape
23:17:12FromDiscord<nordgaren> What nim plugins are people using btw? I preffer jetbrains, but don't mind using VSCode. I downloaded the one for intellij, but I feel it's lackluster. I don't get completion for things like `.addr` and there is no debugger.↵↵The VSCode one I downloaded doesn't seem to be able to be able to run/debug, either, but it atleast has slightly better syntax highlights. I did see there are two for vs code, but one is older and hasn't been
23:18:22FromDiscord<choltreppe> sent a code paste, see https://play.nim-lang.org/#ix=4Kc0
23:19:23FromDiscord<Elegantbeef> Probably
23:23:51FromDiscord<cyberlis (cyber_lis)> Doesn't work with isolate too
23:24:50FromDiscord<cyberlis (cyber_lis)> sent a code paste, see https://play.nim-lang.org/#ix=4Kc5
23:28:25FromDiscord<Elegantbeef> Right Nim's threads are not made with it in mind
23:28:43FromDiscord<Elegantbeef> https://github.com/Araq/malebolgia think this uses it
23:30:28*krux02 quit (Remote host closed the connection)
23:31:26*beholders_eye joined #nim