00:15:40 | FromDiscord | <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:58 | FromDiscord | <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:33 | FromDiscord | <Elegantbeef> sure |
04:00:28 | FromDiscord | <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:42 | FromDiscord | <Elegantbeef> Sdl is nice and easy |
04:04:49 | FromDiscord | <wick3dr0se> In reply to @Elegantbeef "Sdl is nice and": Is there any solid refrences for something like this in Nim? |
04:08:38 | FromDiscord | <wick3dr0se> Actually find a few |
04:08:44 | FromDiscord | <wick3dr0se> (edit) "find" => "found" |
04:10:24 | FromDiscord | <Elegantbeef> Sdl is simple and it's the same everywhere |
04:10:51 | FromDiscord | <wick3dr0se> I see now its a C wrapper and I could just learn through that too. That helps a lot |
05:47:00 | FromDiscord | <0_archkubi_0> i can't see help channel ? |
05:47:39 | FromDiscord | <0_archkubi_0> i need help i start nim lang today |
05:47:42 | FromDiscord | <Elegantbeef> Maybe it doesn't exist |
05:47:42 | FromDiscord | <Elegantbeef> Maybe you are here |
05:49:07 | FromDiscord | <0_archkubi_0> sent a code paste, see https://play.nim-lang.org/#ix=4K8e |
05:49:14 | FromDiscord | <0_archkubi_0> expression '' has no type (or is ambiguous) what is this |
05:49:37 | FromDiscord | <Elegantbeef> `astroObject: type` is wrong |
05:49:38 | FromDiscord | <odexine> `var astroObject: type = AstroObject` remove `: type` |
05:49:42 | FromDiscord | <Elegantbeef> Variables cannot be types |
05:49:57 | FromDiscord | <odexine> you prolly meant `: AstroObject` instead |
05:50:02 | FromDiscord | <0_archkubi_0> i start learn today bro |
05:51:34 | FromDiscord | <0_archkubi_0> can you fix for me i'm realy tired i need sleep 😦 |
05:55:49 | FromDiscord | <0_archkubi_0> i don't know how i fix all error but thanks again |
06:03:17 | NimEventer | New 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:06 | FromDiscord | <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:12 | FromDiscord | <Phil> I mean, if you want I can give you a step-by-step explainer. Just say the word. |
07:50:18 | FromDiscord | <Phil> <@1037987236840488980> |
07:51:54 | FromDiscord | <Phil> You have overall around 5 problems in your code above |
08:00:31 | FromDiscord | <Phil> sent a code paste, see https://play.nim-lang.org/#ix=4K8u |
08:00:51 | FromDiscord | <Phil> (edit) "https://play.nim-lang.org/#ix=4K8u" => "https://play.nim-lang.org/#ix=4K8v" |
08:01:20 | FromDiscord | <Phil> (edit) "https://play.nim-lang.org/#ix=4K8v" => "https://play.nim-lang.org/#ix=4K8w" |
08:03:36 | FromDiscord | <odexine> 4 and 5 may not apply, I was under the impression that it was a snippet of code |
08:07:07 | FromDiscord | <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:23 | FromDiscord | <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:06 | NimEventer | New 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:08 | FromDiscord | <Phil> I wonder what the actual usecase for std/random is |
08:45:52 | FromDiscord | <Phil> Given that for a given range it returns always the same numbers in the same order |
08:48:07 | FromDiscord | <Elegantbeef> @Phil call `randomize`? |
08:48:52 | FromDiscord | <Phil> Huh, given that I tend to always use sysrand I keep forgetting that that is a thing |
08:49:38 | FromDiscord | <Elegantbeef> It's important for when you want to have a replayable rng |
08:50:19 | FromDiscord | <Phil> Ah beef, concept question |
08:51:32 | FromDiscord | <Phil> sent a long message, see http://ix.io/4K8B |
08:52:26 | FromDiscord | <Elegantbeef> sent a code paste, see https://play.nim-lang.org/#ix=4K8C |
08:53:22 | FromDiscord | <Phil> In this scenario, Orm is a placeholder for "any type", right? |
08:53:35 | FromDiscord | <Elegantbeef> No |
08:53:47 | FromDiscord | <Elegantbeef> `Orm` is the type that you're concept is checking for |
08:53:48 | FromDiscord | <Phil> It's kinda like T when declaring a generic with the bracket syntax of `proc x[T](): T` ? |
08:53:51 | FromDiscord | <Elegantbeef> your\ |
08:54:19 | FromDiscord | <Phil> Yeah but it could be the type `Model` from norm, the type `Entity` from another package I just invented etc |
08:54:37 | FromDiscord | <Elegantbeef> It's the type you're attempting to match |
08:54:40 | FromDiscord | <Phil> Check |
08:54:51 | FromDiscord | <Elegantbeef> If you have a `read(int64): string` it'll work |
08:56:28 | FromDiscord | <Phil> sent a code paste, see https://play.nim-lang.org/#ix=4K8D |
08:56:48 | FromDiscord | <Phil> Wait, could I just... `Orm().id is int`? |
08:57:01 | FromDiscord | <Elegantbeef> You could, but that is the exact same |
08:57:52 | FromDiscord | <Phil> Wait so I could `Orm.id is int`? |
08:58:06 | FromDiscord | <Elegantbeef> No my point is `Orm().id` is redundant |
08:58:16 | FromDiscord | <Elegantbeef> it's the same as your example |
08:59:01 | FromDiscord | <Phil> sent a code paste, see https://play.nim-lang.org/#ix=4K8E |
08:59:41 | FromDiscord | <Phil> Though it doesn't compile at the moment, hmmm |
09:00:22 | FromDiscord | <Elegantbeef> So have both? |
09:00:27 | FromDiscord | <Elegantbeef> `concept entity, type Orm` |
09:03:23 | FromDiscord | <Phil> sent a code paste, see https://play.nim-lang.org/#ix=4K8F |
09:04:06 | FromDiscord | <Elegantbeef> `entity` introduces a instance |
09:04:12 | FromDiscord | <Elegantbeef> `type Orm` introduces a alias for type |
09:04:48 | FromDiscord | <Phil> Could you even make a Concept that defines how 2 types interact with one another? |
09:05:01 | FromDiscord | <Elegantbeef> https://nim-lang.org/docs/manual_experimental.html#concepts |
09:05:02 | FromDiscord | <Phil> Like a Concept encompassing 2 types that are both generic? |
09:05:12 | FromDiscord | <Elegantbeef> Not really |
09:05:23 | FromDiscord | <Phil> I'd imagine so, I can't even properly visualize it in my head |
09:05:25 | FromDiscord | <Elegantbeef> It's a type match |
09:05:45 | FromDiscord | <Elegantbeef> You can only say that "For a match to happen this list must be true" |
09:06:02 | FromDiscord | <Phil> 👍 |
09:06:29 | FromDiscord | <Phil> The fact that generic concepts exist is kind of wild to me |
09:07:28 | FromDiscord | <Elegantbeef> Eh most people use them wrong |
09:08:31 | FromDiscord | <Elegantbeef> sent a code paste, see https://play.nim-lang.org/#ix=4K8G |
09:09:08 | FromDiscord | <Elegantbeef> `true` is just a placeholder |
09:11:00 | FromDiscord | <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:20 | FromDiscord | <Elegantbeef> I'd like to imagine it caches matches, but who knows |
09:24:40 | FromDiscord | <Phil> sent a code paste, see https://play.nim-lang.org/#ix=4K8K |
09:27:26 | FromDiscord | <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:59 | NimEventer | New 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:22 | FromDiscord | <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:39 | FromDiscord | <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:36 | NimEventer | New 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:16 | FromDiscord | <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:17 | FromDiscord | <Phil> (edit) "nim=" => "nim?" |
09:47:26 | FromDiscord | <Phil> (edit) "topics.↵Like" => "topics?↵Like" |
09:49:44 | FromDiscord | <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:00 | FromDiscord | <Phil> Beeeeeeef |
09:56:04 | FromDiscord | <Phil> Concepts are being mean again! |
09:57:08 | FromDiscord | <Phil> sent a code paste, see https://play.nim-lang.org/#ix=4K8P |
09:57:33 | FromDiscord | <Phil> (edit) "https://play.nim-lang.org/#ix=4K8P" => "https://play.nim-lang.org/#ix=4K8Q" |
09:58:51 | FromDiscord | <Phil> (edit) "https://play.nim-lang.org/#ix=4K8Q" => "https://play.nim-lang.org/#ix=4K8R" |
10:19:17 | * | junaid_ joined #nim |
10:21:24 | FromDiscord | <Chronos [She/Her]> From my limited knowledge of concepts, maybe because `EntityTyp` isn't a concrete type? |
10:21:39 | FromDiscord | <Chronos [She/Her]> So you can't have a seq of it? |
10:27:34 | * | xet7 quit (Quit: Leaving) |
10:36:02 | FromDiscord | <vindaar> sent a code paste, see https://play.nim-lang.org/#ix=4K8V |
10:40:46 | FromDiscord | <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:26 | FromDiscord | <Phil> sent a code paste, see https://play.nim-lang.org/#ix=4K8Y |
10:42:06 | FromDiscord | <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:08 | FromDiscord | <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:31 | FromDiscord | <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:30 | FromDiscord | <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:46 | FromDiscord | <Phil> Sidenote, specific reason you prefer typeof over type ? 😛 |
11:07:41 | * | junaid_ quit (Remote host closed the connection) |
11:09:17 | FromDiscord | <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:06 | FromDiscord | <vindaar> (he's mentioned that multiple times over the years in different places) |
11:15:48 | FromDiscord | <vindaar> In reply to @vindaar "see recent Araq comments": here: https://discord.com/channels/371759389889003530/768367394547957761/1166807095761440920 |
11:29:14 | FromDiscord | <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:23 | FromDiscord | <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:04 | FromDiscord | <Chronos [She/Her]> Hm... For some reason mysql doesn't like `sqlDump` |
12:23:09 | FromDiscord | <Chronos [She/Her]> For comparing objects |
12:23:23 | FromDiscord | <Chronos [She/Her]> The issue is though... How else do I compare them :/ |
12:28:02 | FromDiscord | <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:44 | FromDiscord | <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:54 | FromDiscord | <Phil> (edit) "-cc:clang" => "--cc:clang" | "clang," => "clang like they do on macOs," |
12:54:59 | FromDiscord | <Phil> (edit) "apple-style" => "macOs-style" |
12:55:11 | FromDiscord | <Chronos [She/Her]> In reply to @chronos.vitaqua "Hm... Anyone able to": Hmm test seems to work on PostgreSQL |
12:55:16 | FromDiscord | <Chronos [She/Her]> Time to test on my SQL then |
12:57:03 | FromDiscord | <Chronos [She/Her]> (edit) "my SQL" => "MySQL" |
13:01:03 | FromDiscord | <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:52 | FromDiscord | <Chronos [She/Her]> Rip |
13:03:14 | FromDiscord | <Chronos [She/Her]> Just bundle your application with Wine or smth smh |
13:07:29 | FromDiscord | <odexine> In reply to @isofruit "Which flags can I": own a mac |
13:07:58 | FromDiscord | <Chronos [She/Her]> Run Darwin yourself :yeet: |
13:08:02 | FromDiscord | <odexine> sure |
13:09:19 | FromDiscord | <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:56 | FromDiscord | <Chronos [She/Her]> In reply to @chronos.vitaqua "Time to test on": Yep this is a fucking MySQL bug |
13:24:44 | FromDiscord | <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:37 | FromDiscord | <michaelb.eth> In reply to @isofruit "Just kinda sucks when": what version of Nim? |
13:38:45 | FromDiscord | <Phil> nim 2.0 |
13:41:05 | FromDiscord | <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:24 | FromDiscord | <michaelb.eth> let me find a link… |
13:41:49 | FromDiscord | <michaelb.eth> (edit) "thouth" => "thought" |
13:42:00 | FromDiscord | <Phil> I mean, mind you I don't know jack about compiling |
13:42:16 | FromDiscord | <Phil> I can use them and have mediocre usage knowledge |
13:44:08 | FromDiscord | <michaelb.eth> https://github.com/nim-lang/Nim/issues/15589#issuecomment-709536971 |
13:44:26 | FromDiscord | <michaelb.eth> try that workaround with llvm-ar |
13:45:17 | FromDiscord | <Phil> I'll forward that to the issue at hand where this cropped up:↵https://github.com/can-lehmann/owlkettle/issues/130 |
13:48:26 | FromDiscord | <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:13 | FromDiscord | <michaelb.eth> i was running into it and figured out the workaround |
13:49:21 | FromDiscord | <michaelb.eth> the/a |
13:51:23 | FromDiscord | <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:46 | FromDiscord | <michaelb.eth> (edit) "itself" => "it" |
14:21:21 | FromDiscord | <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:18 | FromDiscord | <Chronos [She/Her]> Huh... My newer test that isn't using bytes is still broken |
15:24:20 | * | CO2 joined #nim |
15:30:36 | FromDiscord | <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:54 | FromDiscord | <takemichihanagaki3129> sent a code paste, see https://play.nim-lang.org/#ix=4Kap |
16:12:04 | FromDiscord | <takemichihanagaki3129> Have I done smt wrong? |
16:12:54 | FromDiscord | <takemichihanagaki3129> (edit) "https://play.nim-lang.org/#ix=4Kap" => "https://play.nim-lang.org/#ix=4Kar" |
16:14:44 | FromDiscord | <Phil> That's typically just a hint, you sure that's the entire stacktrace you get in your terminal? |
16:16:36 | FromDiscord | <takemichihanagaki3129> In reply to @isofruit "That's typically just a": Fixed! 😅 |
16:16:49 | FromDiscord | <takemichihanagaki3129> Wrong indentation... |
16:17:39 | FromDiscord | <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:46 | FromDiscord | <Chronos [She/Her]> Should just be `UncheckedArray[cfloat]`, since arrays in C are always pointers |
16:20:37 | FromDiscord | <Chronos [She/Her]> `ptr UncheckedArray[cfloat]` would be `float` |
16:20:42 | FromDiscord | <Chronos [She/Her]> @summarity |
16:21:44 | FromDiscord | <summarity> I see. Makes sense from `char` == `cstringArray` == `ptr UncheckedArray[cstring]` |
16:25:20 | FromDiscord | <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:47 | FromDiscord | <Phil> So double pointer char array is ptr cstring |
16:26:01 | Amun-Ra | summarity: yes, ptr UncheckedArray[cfloat] |
16:26:40 | Amun-Ra | Chronos: no, arrays in C are different type than pointers |
16:28:01 | Amun-Ra | but that's a common misconception because it's not possible to pass an array to a function and retain the type |
16:29:54 | FromDiscord | <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:55 | Amun-Ra | for example, char (*)[100] becomes char * |
16:31:37 | Amun-Ra | I did something similar in my gtk library |
16:32:19 | Amun-Ra | type Widget {.incompletestruct.}: Object; type WidgetPtr* = ptr Widget |
16:33:32 | FromDiscord | <Phil> type toast = distinct pointer |
16:33:50 | FromDiscord | <Phil> (edit) "toast" => "AdwToast" |
16:34:00 | Amun-Ra | yes, different approach, same result |
16:34:32 | FromDiscord | <Phil> What does your syntax do? I'm curious since I've never seen that pragma |
16:35:18 | Amun-Ra | it's used for opaque types, when the real size of the object is hidden |
16:35:42 | Amun-Ra | I have to push my libs to gh someday… ;> |
16:36:38 | FromDiscord | <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:17 | Amun-Ra | let's say you have in a header: struct foo; void somefunc(struct foo *f); |
16:38:04 | Amun-Ra | the function operates on pointer to foo, size of a pointer is known |
16:38:16 | Amun-Ra | size of a struct isn't know but is not needed |
16:39:07 | Amun-Ra | another example of such a struct is VLA (variable length array) - struct foo { int x; int y; int arr[]; }; |
16:39:26 | FromDiscord | <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:07 | FromDiscord | <Phil> Curious about the nuances the the two approaches differ in |
16:41:12 | Amun-Ra | I 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:34 | FromDiscord | <Chronos [She/Her]> In reply to @Amun-Ra "Chronos: no, arrays in": Really? Huh |
16:42:58 | FromDiscord | <Phil> Doing the distinct pointer approach introduces a new pointer? |
16:43:38 | FromDiscord | <Phil> When I'm home I'll have to do an image |
16:43:48 | Amun-Ra | I mean GtkWidget is a struct, that's why I have GtkWidget = object |
16:44:39 | Amun-Ra | and because gtk always operates on GtkWidget* I don't really have to implement all the fields |
16:45:16 | Amun-Ra | Phil: this is how I implemented object hierarchy: https://dpaste.com/5Y8PZX58S |
16:46:11 | Amun-Ra | create_object_ptr is a macro that creates type ObjectName {.final, incompletestruct, pure.} = object; ObjectNamePtr* = ptr ObjectName |
16:48:36 | Amun-Ra | it's just a different approach, both methods are fine |
16:49:04 | FromDiscord | <demotomohiro> sent a code paste, see https://play.nim-lang.org/#ix=4KaC |
16:51:45 | FromDiscord | <Chronos [She/Her]> Looking through the usages seems to show it's essentially the same `cstringArray {.importc: "char", nodecl.} = ptr UncheckedArray[cstring]` |
16:52:05 | FromDiscord | <Chronos [She/Her]> That's frm https://github.com/nim-lang/Nim/blob/fbc801d1d15aa2c5f12a3f3bc1e35aad185dafb1/lib/system/ctypes.nim#L68 |
16:54:14 | FromDiscord | <demotomohiro> `cstring` in Nim is `char` in C, and `ptr UncheckedArray[cstring]` is `char`. |
16:54:28 | Amun-Ra | ptr UncheckedArray[cstring] is an equivalent of const char ** |
16:55:52 | Amun-Ra | or, when represented as array type, as const char * (*)[] |
16:56:33 | FromDiscord | <Chronos [She/Her]> Aah alright then, thanks y'all |
16:57:18 | Amun-Ra | simply put: it signals the type is a pointer to an array of [type] with unknown lenght |
16:57:35 | Amun-Ra | and it allows to get a value via [] |
16:57:51 | Amun-Ra | however ordinary ptr type does not |
16:58:16 | Amun-Ra | s/to get/getting/ |
16:58:32 | FromDiscord | <Chronos [She/Her]> Ah |
17:32:33 | FromDiscord | <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:20 | arkanoid | in "let mystring = $mycstring", mystring is a full GCed copy of mycstring? |
18:52:40 | arkanoid | or better, ORCed copy of mycstring |
18:54:35 | FromDiscord | <Elegantbeef> Yes |
18:54:45 | arkanoid | thanks |
18:54:50 | FromDiscord | <Elegantbeef> `string` is a pascal string where len and capacity are stored |
18:56:51 | arkanoid | sure, but I did not know if the buffer was copied or just re-liked |
18:57:15 | FromDiscord | <Elegantbeef> You cannot safely point to a cstring given you cannot know where it came from or who allocated it |
18:57:24 | FromDiscord | <Elegantbeef> So deallocating it is impossible |
18:57:31 | FromDiscord | <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:52 | NimEventer | New 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:16 | FromDiscord | <cephonaltera> is it possible to compile and dynamically load a module? |
19:13:58 | FromDiscord | <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:31 | FromDiscord | <Chronos [She/Her]> A better question is what are you trying to do? |
19:18:57 | FromDiscord | <cephonaltera> sent a code paste, see https://play.nim-lang.org/#ix=4Kbj |
19:24:12 | FromDiscord | <Phil> That just means that said lib wasn't on the path where binaries look for shared object files |
19:24:25 | FromDiscord | <Phil> Which is something I have to google every time where that is |
19:28:06 | FromDiscord | <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:41 | FromDiscord | <Phil> All you youngins and your fancy colored terminals with those fancy non-black backgrounds 😛 |
19:35:59 | FromDiscord | <Phil> But yeah, looks like the C code is blowing up for some reason |
19:36:40 | FromDiscord | <Phil> Which I'm not sure where that's from, but try again without hotcodereloading and without the nimcache flag ? |
19:36:53 | FromDiscord | <Phil> basically just nim c main.nim? |
19:37:04 | FromDiscord | <cephonaltera> it happened without the cache flag, i added it in case cache fucked up |
19:37:16 | FromDiscord | <cephonaltera> it also compiled before i added the .so files |
19:37:21 | FromDiscord | <Phil> Ah check, does it also occur with --mm:refc? |
19:39:40 | FromDiscord | <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:07 | FromDiscord | <Phil> I mean, do as it suggests and maybe it'll spit out more info ^^ |
19:40:46 | FromDiscord | <cephonaltera> `libnimhcr.so: cannot open shared object file: No such file or directory`↵the plot thickens |
19:41:01 | FromDiscord | <cephonaltera> maybe this dlopen does not look in the executable directory? |
19:41:56 | FromDiscord | <cephonaltera> looks like that was the case |
19:42:12 | FromDiscord | <cephonaltera> `could not import: nimrtl_nimGC_setStackBottom` based |
19:42:31 | FromDiscord | <cephonaltera> maybe i need to compile them with --mm:refc too? |
19:45:05 | FromDiscord | <cephonaltera> OK i got it working |
19:45:08 | FromDiscord | <cephonaltera> sick |
19:46:48 | FromDiscord | <Phil> 👍 ↵And now you know more about DLLs and loading them than me 😄 |
20:10:17 | Amun-Ra | cephonaltera: you have to compile lib/nimhcr.nim iirc |
20:10:47 | FromDiscord | <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:58 | FromDiscord | <cephonaltera> i copied them to /usr/lib and they got loaded |
20:11:12 | Amun-Ra | add "./" to the path |
20:11:12 | FromDiscord | <cephonaltera> kinda dirty though, stinky even id say, id need to figure that out |
20:11:43 | FromDiscord | <cephonaltera> im not calling dlopen manually. std/hotcodereloading does |
20:12:21 | Amun-Ra | strace it and check |
20:13:36 | FromDiscord | <cephonaltera> im reading the dlopen manpage, maybe checking the executable directory is specifically a C++ thing? theres no mention of it |
20:14:13 | FromDiscord | <cephonaltera> https://media.discordapp.net/attachments/371759389889003532/1167919266939543642/image.png?ex=654fe094&is=653d6b94&hm=cce0cbcd2ac13502e192a10c868adbf07a5159c9087aa1ad2f65e68c6819bc1b& |
20:15:13 | Amun-Ra | see ld.so(8) |
20:15:40 | FromDiscord | <cephonaltera> https://media.discordapp.net/attachments/371759389889003532/1167919631193874584/image.png?ex=654fe0ea&is=653d6bea&hm=ccf228aeec4da0d25e8a550d3e544fff4704162d0a79bb21ac69029d14992975& |
20:15:49 | FromDiscord | <cephonaltera> weird first 2 locations to check but ok |
20:16:26 | Amun-Ra | man ld.so lists all the paths shared library are searched in |
20:17:05 | Amun-Ra | you can use for example: LD_LIBRARY_PATH=. ./prog |
20:17:21 | Amun-Ra | assuming that .so is in . |
20:17:50 | FromDiscord | <cephonaltera> i could yeah |
20:20:11 | Amun-Ra | btw, you don't have to generate strace.log, you can grep it directly when redirected, ie: strace ./foo 2>&1|grep ^open |
20:20:25 | Amun-Ra | or ^access |
20:20:44 | FromDiscord | <cephonaltera> yes true, however i never remember the fancy 2>&1| combination |
20:20:59 | Amun-Ra | :) |
20:21:46 | Amun-Ra | stderr (fileno 2) redirected to stdout (fileno 1) |
20:43:33 | * | neceve quit (Ping timeout: 258 seconds) |
20:57:45 | FromDiscord | <nordgaren> sent a code paste, see https://play.nim-lang.org/#ix=4KbF |
20:59:42 | FromDiscord | <Phil> I think consts get inlined |
20:59:58 | FromDiscord | <nordgaren> I mean, even if it does, it still has to ve in memory, somewhere |
21:00:03 | FromDiscord | <nordgaren> (edit) "ve" => "be" |
21:01:20 | FromDiscord | <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:38 | FromDiscord | <nordgaren> Okay, so it just won't let me get the address of the static resource? |
21:02:23 | FromDiscord | <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:53 | FromDiscord | <nordgaren> Well, it's just a static resource that I need to copy data out of. |
21:05:12 | FromDiscord | <Phil> I mean best I can do here is recommend `let x = myResource; x.addr` |
21:05:25 | FromDiscord | <Phil> It's the solution I'd know off the top of my head at least |
21:08:55 | FromDiscord | <helwastaken> im pretty sure it's cause const evaluates code in a vm |
21:09:08 | FromDiscord | <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:23 | FromDiscord | <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:49 | FromDiscord | <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:35 | FromDiscord | <nordgaren> Well, a whole file would probably be done differently. |
21:11:49 | FromDiscord | <helwastaken> if you know the best :Shrug: |
21:12:02 | FromDiscord | <nordgaren> Most langs will just take anything smaller than the architecture pointer size and inline it in the ASM. |
21:12:22 | FromDiscord | <nordgaren> But ofc you can't do that with a large file. |
21:13:55 | FromDiscord | <Chronos [She/Her]> May be that Nim can't guarantee it won't be inlined so it doesn't allow it |
21:14:12 | FromDiscord | <Chronos [She/Her]> In this case, doing as Phil suggested or I said earlier will do the job |
21:14:28 | FromDiscord | <nordgaren> Yea, gonna try that in a sec. |
21:17:29 | FromDiscord | <Chronos [She/Her]> In reply to @chronos.vitaqua "Does anyone know how": `nimsuggest` worked! |
21:32:02 | FromDiscord | <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:33 | FromDiscord | <Chronos [She/Her]> Okay |
21:32:34 | FromDiscord | <Chronos [She/Her]> So |
21:32:35 | FromDiscord | <Phil> That sounds like jtv territory |
21:32:54 | FromDiscord | <Chronos [She/Her]> Let me draw a diagram actually |
21:33:19 | FromDiscord | <Chronos [She/Her]> Cuz I understand it in my mind, words are just a mess tho |
21:38:49 | Amun-Ra | Chronos: https://play.nim-lang.org/#ix=4KbN |
21:41:43 | FromDiscord | <Chronos [She/Her]> Oh useful! Thanks! |
21:45:41 | Amun-Ra | :) |
21:50:31 | FromDiscord | <Chronos [She/Her]> Hm... |
21:51:03 | FromDiscord | <Chronos [She/Her]> Ugh, not sure how I'm supposed to structure this flow |
21:54:28 | FromDiscord | <TӨMΛ ☠> In reply to @cephonaltera "just an idea i": I see fellow plugin systems enjoyer 🥰 |
21:55:13 | FromDiscord | <cephonaltera> hell yeah |
22:00:01 | FromDiscord | <Phil> Write docs on plugin systems in nim for the next person 😛 |
22:00:23 | arkanoid | if 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:58 | FromDiscord | <Elegantbeef> annotate it `{.nimcall.}` to see |
22:01:05 | FromDiscord | <Elegantbeef> If it fails compilation it was a closure |
22:01:12 | FromDiscord | <Elegantbeef> If it passes compilation it was a nimcall 😄 |
22:02:02 | arkanoid | Elegantbeef, 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:27 | FromDiscord | <Elegantbeef> It only makes it a closure if it needs to be one |
22:02:29 | FromDiscord | <Elegantbeef> Is my point |
22:02:40 | arkanoid | good! |
22:02:42 | arkanoid | thanks |
22:05:14 | FromDiscord | <wick3dr0se> sent a code paste, see https://play.nim-lang.org/#ix=4KbP |
22:13:39 | FromDiscord | <Elegantbeef> sent a code paste, see https://play.nim-lang.org/#ix=4KbR |
22:14:11 | FromDiscord | <Elegantbeef> whoops should be `ch.setMode` and `ch.removeMode` |
22:28:17 | FromDiscord | <wick3dr0se> sent a code paste, see https://play.nim-lang.org/#ix=4KbT |
22:29:24 | FromDiscord | <Chronos [She/Her]> My idea does jackshit... Lol |
22:30:06 | FromDiscord | <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:17 | NimEventer | New thread by choltreppe: Map, mapIt for arrays, see https://forum.nim-lang.org/t/10575 |
22:42:07 | FromDiscord | <wick3dr0se> sent a code paste, see https://play.nim-lang.org/#ix=4KbU |
22:55:18 | FromDiscord | <cyberlis (cyber_lis)> Hi. Is it possible to Move variable to thread ? |
22:56:41 | FromDiscord | <cyberlis (cyber_lis)> When I use `createThread(aThread, printer, move myStr)`↵I still get `=dup(myStr)` |
22:56:41 | FromDiscord | <Elegantbeef> Make a union around the types and then use that 😄 |
22:57:50 | FromDiscord | <Elegantbeef> You should be able to move data across threads that's what `std/isolation` is for afterall |
22:58:55 | FromDiscord | <cyberlis (cyber_lis)> I see. I should use `Thread[Isolated[MyStr]]` |
23:01:12 | FromDiscord | <cyberlis (cyber_lis)> sent a code paste, see https://paste.rs/GcUof |
23:01:57 | FromDiscord | <Elegantbeef> did you attempt to `createThread` on a `Thread[void]`? |
23:02:13 | FromDiscord | <Elegantbeef> Might need a `when T is void` inside thread |
23:02:27 | FromDiscord | <Elegantbeef> Or you didnt update the thread proc |
23:03:35 | FromDiscord | <cyberlis (cyber_lis)> I just tried to change it inside my local copy of nim |
23:05:05 | FromDiscord | <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:07 | FromDiscord | <Elegantbeef> `sink void` is likely causing the issue |
23:05:08 | FromDiscord | <Elegantbeef> As `sink` likely hides the void type |
23:05:09 | FromDiscord | <Elegantbeef> sent a code paste, see https://play.nim-lang.org/#ix=4KbY |
23:07:03 | FromDiscord | <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:22 | FromDiscord | <Elegantbeef> Well the issue is that if you move a resource that contains other references you might attempt to deallocate twice |
23:13:37 | FromDiscord | <Elegantbeef> Isolated prevents that by ensuring no references escape |
23:17:12 | FromDiscord | <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:22 | FromDiscord | <choltreppe> sent a code paste, see https://play.nim-lang.org/#ix=4Kc0 |
23:19:23 | FromDiscord | <Elegantbeef> Probably |
23:23:51 | FromDiscord | <cyberlis (cyber_lis)> Doesn't work with isolate too |
23:24:50 | FromDiscord | <cyberlis (cyber_lis)> sent a code paste, see https://play.nim-lang.org/#ix=4Kc5 |
23:28:25 | FromDiscord | <Elegantbeef> Right Nim's threads are not made with it in mind |
23:28:43 | FromDiscord | <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 |