<< 17-10-2021 >>

00:37:27*audiophile_ quit (Remote host closed the connection)
00:37:44*audiophile_ joined #nim
00:38:22*audiophile_ quit (Client Quit)
01:25:21nrds<Prestige99> Some of these definitions don't seem to exist.. I wonder if they're all required in a wrapper, anyway.
01:26:34nrds<Prestige99> I'm not sure how types are used in C if there's no definition, I grep'd the whole chipmunk2d project
01:54:06nrds<Prestige99> Wonder if I need to change how this is wrapped https://github.com/slembcke/Chipmunk2D/blob/master/include/chipmunk/chipmunk_structs.h#L226 not sure about this whole `ptr object of Shape` business is correct: https://github.com/avahe-kellenberger/nim-chipmunk/blob/master/src/chipmunk7.nim#L93
01:54:32nrds<Prestige99> in the c def, these structs wrap a "cpShape"
01:55:06nrds<Prestige99> (I hate working with c libraries now)
02:32:29*arkurious quit (Quit: Leaving)
04:06:01*supakeen quit (Quit: WeeChat 3.3)
04:06:31*supakeen joined #nim
05:55:08FromDiscord<acek7> why dont programming books have audio books
06:05:47FromDiscord<Rika> its hard to represent code in audio
06:26:04FromDiscord<Smarc> Could anyone explain me why nvim is not recognizing the imported module/procedure? The main.nim file is compiling fine, so it has to be some local nvim issue. You can find my .vimrc here: https://gist.github.com/Smarcy/a39bddf17c8dd0dcb2c59bde60fe219e https://media.discordapp.net/attachments/371759389889003532/899181446621700127/Screenshot_20211016_145604.png
06:27:15FromDiscord<Smarc> Also nvim tells me that "piece_factory" would be an unusedImport
06:44:27FromDiscord<Rika> reopen
06:51:13FromDiscord<Smarc> My god, that fixed it .. Thank you first of all. How do I avoid that behaviour?
06:59:57FromDiscord<Rika> It just happens lol
07:00:14FromDiscord<Rika> It’s to do with how nimsuggest works I guess
08:12:30*max22- joined #nim
08:57:17FromDiscord<leorize> you can't, unfortunately. It usually clears up after typing for awhile on the problematic file, but there is no concrete way to fix this other than restarting nimsuggest↵(@Smarc)
09:05:20*Gustavo6046 quit (Quit: ZNC 1.8.2 - https://znc.in)
09:16:31FromDiscord<Fancy> In reply to @Gumber "have a good night!": Oh just coincidence then. I saw some engines that utilised data orientated design I think it was Orx and Heaps, but it was a long time ago so I could be wrong. I think you have mentioned Unity and Godot a couple times now, I am guessing that you have used them before.
09:23:44FromDiscord<Fancy> @Gumber https://discord.com/channels/371759389889003530/706542664643772436/899226028852006914
09:24:19FromDiscord<Fancy> In reply to @Gumber "have a good night!": https://discord.com/channels/371759389889003530/706542664643772436/899226028852006914
10:08:48FromDiscord<levovix> how to cast seq to seq of type with different size?↵for example seq[byte] to seq[int]
10:09:20FromDiscord<haxscramper> `cast[seq[int]](<seq[byte>)`
10:09:36FromDiscord<haxscramper> This is of course unsafe, but assuming you know what you are doing it is the only solution I know of
10:11:11FromDiscord<levovix> In reply to @haxscramper "`cast[seq[int]](<seq[byte>)`": len will be incorrect
10:12:40FromDiscord<haxscramper> Then convert things manually, read four bytes into `array[4, byte]` cast to int and append to the sequence
10:13:11FromDiscord<levovix> ok
10:35:56FromDiscord<walter248_gitlab (Walter Mulder)> Hi, I have executed "nimble install minwc" for WebSiteCreator, no error messages. This follows instructions (1a) for Install with Nimble. But when I type "./minwc" I get a series of messages\:
10:36:05FromDiscord<walter248_gitlab (Walter Mulder)> sent a long message, see http://ix.io/3BZf
10:36:49FromDiscord<walter248_gitlab (Walter Mulder)> I imagine nim.cfg must be set up differently... does anyone have information on what is needed?
11:11:18*rusua joined #nim
11:55:32*max22- quit (Ping timeout: 268 seconds)
12:06:01*supakeen quit (Quit: WeeChat 3.3)
12:06:31*supakeen joined #nim
12:57:26FromDiscord<Fancy> Can someone tell me what I shouldn't use Nim for?
12:58:18FromDiscord<haxscramper> malware
12:58:34FromDiscord<Fancy> haha nice
12:58:38FromDiscord<haxscramper> and on more serious note, I don't think there is something you should not use nim for
12:58:58FromDiscord<haxscramper> there are of course things that nim is better for, but as far as I'm concerned it is even suitable for hardcore cryptography
12:59:20FromDiscord<haxscramper> I use it for CLI scripts, compiler development
12:59:26FromDiscord<Fancy> Seriously I have been looking for ages and I can't find any reason I shouldn't use it
12:59:36FromDiscord<Fancy> Nice to meet you btw
12:59:42FromDiscord<haxscramper> There are web frameworks, GUI etc. pretty much whole spectrum
13:02:24FromDiscord<Fancy> Oh I always wanted to have a look into cryptography.
13:02:31FromDiscord<Fancy> Ohh
13:02:40FromDiscord<Fancy> I wanted to ask someone about this..
13:02:50FromDiscord<Fancy> compiler development
13:03:26FromDiscord<Fancy> Do you have much friction when doing compiler development in Nim?
13:03:38FromDiscord<enthus1ast> the nim compiler is build IN nim
13:03:38FromDiscord<haxscramper> No, not really
13:03:48FromDiscord<haxscramper> That does not really say much tbh
13:03:48FromDiscord<Fancy> Ohh so it is
13:04:08FromDiscord<haxscramper> Yes, but it is a large codebase with some technical debt etc.
13:04:08FromDiscord<Fancy> I just opened up github and yeah you're right
13:04:10FromDiscord<Fancy> cool
13:04:15FromDiscord<haxscramper> More than a decade of nim
13:04:22FromDiscord<haxscramper> But yes, it is 100% nim
13:04:42FromDiscord<haxscramper> First converted from pascal
13:04:48FromDiscord<Fancy> Ahhh
13:04:55FromDiscord<haxscramper> But usually there is not a lot of friction when developing compilers in nim
13:04:56FromDiscord<Fancy> Yeah I just watched a talk
13:05:17FromDiscord<haxscramper> I guess you just need to accept some code patterns like object variants and stuff
13:05:20FromDiscord<haxscramper> And then it becomes very easy yo do
13:05:37FromDiscord<haxscramper> there is a lot of stuff https://gist.github.com/haxscramper/3562fa8fee4726d7a30a013a37977df6
13:07:44FromDiscord<Fancy> In reply to @haxscramper "But usually there is": This is really good to know because this is something I would like to have a go at in the future. I might have a go at implementing a brainfuck interpreter first from the link on the Nim site.
13:09:07FromDiscord<Fancy> In reply to @haxscramper "I guess you just": Alright thanks for the tip. I really appreciate it.
13:09:41FromDiscord<Fancy> Ahh this link is to your project?
13:10:13FromDiscord<haxscramper> no, most of them are not mine
13:10:23FromDiscord<haxscramper> actually only htsparse in this list is my project
13:13:27FromDiscord<Fancy> Don't belittle yourself. 🙂 It is very impressive. I don't even have anything up on github yet at all. 🙂
13:14:47FromDiscord<Fancy> I have one concern about Nim, but I believe it is probably a non issue
13:16:16*arkurious joined #nim
13:19:02FromDiscord<Fancy> I created a tiny wrapper for the canvas api yesterday and the javascript file was about 1000 lines
13:20:27FromDiscord<xflywind> Have you tried `-d:danger` option?
13:20:27FromDiscord<Fancy> Is there a reason for this?
13:20:35FromDiscord<Fancy> Me?
13:20:41FromDiscord<xflywind> yeah
13:20:46FromDiscord<Fancy> No not yet
13:20:48FromDiscord<xflywind> `nim js -d:danger`
13:21:02FromDiscord<Fancy> I have just got into the Nim language
13:21:05*max22- joined #nim
13:21:07FromDiscord<Fancy> What does it do?
13:21:11FromDiscord<xflywind> (edit) "`nim js -d:danger` ... " added "or `nim js -d:release`."
13:22:36FromDiscord<xflywind> `-d:release` remove debug information and reduce the lines of code generated.
13:22:41FromDiscord<Rika> In reply to @Fancy "Can someone tell me": distributed computing?
13:23:54FromDiscord<Rika> In reply to @Fancy "I created a tiny": nim compilation artifacts are not meant to be readable
13:24:07FromDiscord<Rika> they can be though, as flywind sayds
13:24:09FromDiscord<Rika> (edit) "sayds" => "says"
13:24:48FromDiscord<Fancy> In reply to @flywind "`-d:release` remove debug information": Ohhhh I would have never known this even existed if you didn't tell me. thank you
13:25:12FromDiscord<xflywind> no problem
13:26:13FromDiscord<Rika> In reply to @Rika "distributed computing?": or anything that requires utmost stability, perhaps
13:26:30FromDiscord<Fancy> In reply to @Rika "distributed computing?": Ahh I read somewhere that elixir was good for distributed computing which I believe discord uses
13:26:32FromDiscord<Rika> though even then you can use nim for that, youll just have much more work
13:26:45FromDiscord<haxscramper> isn't status a prime example of such system
13:26:53FromDiscord<Rika> yes
13:26:58FromDiscord<Fancy> In reply to @flywind "no problem": I seriously really appreciate the help.
13:27:02FromDiscord<haxscramper> distributed computing, extreme requirements for stablitiy etc
13:27:04FromDiscord<Rika> but as i mentioned it's a lot of work needed
13:27:30FromDiscord<haxscramper> Yes, but the problem itself means there is a lot of wokr
13:27:31FromDiscord<Rika> i mean i guess you can argue that it's a lot of work in any language
13:27:57FromDiscord<haxscramper> yes, you said it just as I typed
13:28:10FromDiscord<haxscramper> ecosystem is weaker for this sort of thing
13:28:15FromDiscord<Rika> well then i guess the nutshell here is that if you're not up to write a lot of code (or you want a batteries included ecosystem) then yeah
13:28:19FromDiscord<Rika> nim isnt really well suited
13:28:26FromDiscord<Rika> god damn it
13:28:27FromDiscord<haxscramper> you can't just go, pick random library from top of hackernews praise list and go with it
13:28:35FromDiscord<Rika> yeah
13:28:41FromDiscord<haxscramper> hivemind
13:28:42FromDiscord<Rika> we dont even have a praise list do we
13:29:32FromDiscord<Rika> well thats the gist then, be ready to write serious amounts of code otherwise you'll cry
13:29:38FromDiscord<Fancy> In reply to @Rika "though even then you": Oh I see. I am not sure if it is something I will be using so should be fine. 🙂
13:30:04FromDiscord<enthus1ast> stable distributed system are hard, even more so when the environment is hostile (eg the internet)
13:30:43FromDiscord<Rika> ~~do yall have books regarding such systems and how to make them btw~
13:30:44FromDiscord<Rika> (edit) "btw~" => "btw~~"
13:34:14FromDiscord<Fancy> If I needed to build a distributed system for some reason, couldn't I just use node.js?
13:34:19FromDiscord<Fancy> Or nah
13:35:24FromDiscord<Rika> you can use any language
13:35:29FromDiscord<Fancy> I saw some book on creating distributed systems with node.js
13:35:31FromDiscord<Rika> its just a matter of how much effort itll take on such language
13:35:51FromDiscord<Fancy> I was meaning to say would it be more suitable
13:36:31FromDiscord<dom96> Nim is pretty good for distributed systems
13:36:57FromDiscord<dom96> we've got a good set of networking libraries which is the primary thing you need
13:37:13FromDiscord<Fancy> A language like elixir would be more suitable though right?
13:37:50FromDiscord<Fancy> In reply to @dom96 "we've got a good": Would you be able to send a link to them?
13:38:00FromDiscord<dom96> Not too familiar with Elixir. Why do you think it would be more suitable?
13:38:23FromDiscord<Fancy> I think it might of said on their site.
13:38:28FromDiscord<Fancy> I will go and check
13:38:29FromDiscord<Rika> elixir is afaik either a compiles-to-erlang or uses erlang vm
13:38:31FromDiscord<Fancy> one moment
13:38:36FromDiscord<Rika> and you know erlang
13:38:38FromDiscord<Rika> i hope
13:39:19FromDiscord<Fancy> "Elixir is a dynamic, functional language for building scalable and maintainable applications.↵Elixir leverages the Erlang VM, known for running low-latency, distributed, and fault-tolerant systems. Elixir is successfully used in web development, embedded software, data ingestion, and multimedia processing, across a wide range of industries."
13:39:47FromDiscord<dom96> Yes, I know those buzz words. I think it's important to dig deeper 🙂
13:40:09FromDiscord<dom96> A distributed system is already a very overloaded term
13:40:41FromDiscord<Rika> yeah pretty much just as specific as saying something "utilises the internet" like ???
13:46:28FromDiscord<retsyo (retsyo)> since I can't receive my password recovery mail from https://forum.nim-lang.org/. Is there any other way to log in?
13:47:14FromDiscord<xflywind> what's you username?
13:47:30*max22- quit (Ping timeout: 260 seconds)
13:47:40FromDiscord<retsyo (retsyo)> oyster
13:48:10FromDiscord<xflywind> In reply to @retsyo (retsyo) "oyster": @dom96 ^
13:48:49FromDiscord<dom96> hm, can't do much other than resend the password recovery email
13:48:52FromDiscord<dom96> why can't you receive it?
13:49:38FromDiscord<dom96> I just reset mine and received the email (was in my spam folder though)
13:50:00FromDiscord<Fancy> In reply to @dom96 "Yes, I know those": Alright I will have a bit more of a look.
13:51:08FromDiscord<Fancy> In reply to @dom96 "A distributed system is": I have found an article about different kinds of distributed systems, so I will read up on that.
13:51:55FromDiscord<Fancy> In reply to @Rika "yeah pretty much just": I guess it is pretty broad. haha! sorry haha
13:52:53FromDiscord<Fancy> @dom96 What is something that you would use another language for over Nim?
13:56:21FromDiscord<Fancy> I really appreciate your guys feedback a lot as I have only been using this language for a couple of days so far, so having people with more experience to answer my questions really helps clears things up for me. 🙂
13:56:59FromDiscord<Fancy> (edit) "clears" => "clear"
13:58:23FromDiscord<retsyo (retsyo)> sorry, please ignore my above question. I can't recieve any recovery email days(weeks?) ago. But I tried few minutes ago, now I can log in the forum again \:)
13:58:32FromDiscord<dom96> great 🙂
13:58:37FromDiscord<Fancy> I would really like to know what got you guys into the language and what your experiences have been like so far.
13:59:47FromDiscord<haxscramper> Interop with Cxx is good
13:59:50FromDiscord<haxscramper> And macros
14:00:00FromDiscord<haxscramper> Basically this caught my attention at first
14:00:06FromDiscord<dom96> In reply to @Fancy "<@!132595483838251008> What is something": I would personally try to use Nim for everything. I guess an exception would be where another language has a well established library for what I want to do and I don't have time to implement it in Nim myself (or to even wrap it if it's implemented in C/C++)
14:00:30FromDiscord<dom96> Example could be Pandas in Python
14:00:31FromDiscord<haxscramper> There are some rough edges if you get into somewhat advanced stuff though, especially deep into typed macros/generics
14:00:51*rusua quit (Quit: Connection closed for inactivity)
14:01:23FromDiscord<dom96> or specialised stuff like backtesting financial algorithms I would grab Python since there is a big ecosystem for that there
14:02:14FromDiscord<Fancy> In reply to @haxscramper "Interop with Cxx is": From CMake?
14:03:02FromDiscord<Fancy> In reply to @haxscramper "There are some rough": So in general macros and generics caught your eye, right?
14:05:39*max22- joined #nim
14:06:14FromDiscord<Fancy> In reply to @dom96 "I would personally try": If you feel that way it must be pretty damn flexible. That makes sense it is probably better to just use the tools you already have at your disposal sometimes instead of trying to recreate an entire toolset.
14:10:29FromDiscord<Fancy> In reply to @dom96 "or specialised stuff like": Definitely. For a financial things in general I have seen a lot of recommendations for using Python, or Java.
14:20:49FromDiscord<haxscramper> In reply to @Fancy "So in general macros": macros and Cxx interop
14:21:14FromDiscord<Fancy> Nice
14:22:03FromDiscord<Fancy> So can you tell me what is so good about the macros in Nim?
14:24:54FromDiscord<haxscramper> They are procedural, which means you can put arbitrarily complex logic in them, they operate on the syntax level (not like C text substitution preprocessor) so you can create own DSLs when needed
14:25:25FromDiscord<haxscramper> https://nim-lang.org/blog/2021/03/10/fusion-and-pattern-matching.html for example this is a macro
14:26:13FromDiscord<haxscramper> And for `typed` macros you can also get access to types, so you can for example accept a type symbol into macro and then iterate over all fields in this symbol
14:27:26FromDiscord<haxscramper> for example here I pull out type information from tuple type https://stackoverflow.com/a/69462862/6086513
14:29:28FromDiscord<haxscramper> https://forum.nim-lang.org/t/6753#41973 largely talks about nim AST macros are better than other alternatives (it was a discussion about the language comparison with nim, so the response is also A vs B)
14:31:33FromDiscord<Fancy> In reply to @haxscramper "They are procedural, which": Damn I definitely didn't know that. I just got into it because of the amazing interop with other languages. That is actually really useful for me because as a person who is obsessed with these things in general I can get a lot out of it. Besides that that is wicked cool.
14:33:40FromDiscord<retsyo (retsyo)> It is a pity that there is no python-pandas-like module (with the ability to reader/writer excel's XLS and XLSX via other packages) for nim, which I often treate in my work. And I think it is impossible to develop such a module for static language.
14:34:45FromDiscord<Fancy> In reply to @haxscramper "And for `typed` macros": What really? I think I am going to have to look into this a lot more damn that's cool. I can't think of any other language that does this but I could be wrong.
14:35:42FromDiscord<haxscramper> You mean full excel compute engine features, or just using it as a static data frame?
14:36:09FromDiscord<haxscramper> i.e. just for dumb static excel generation
14:39:22FromDiscord<Fancy> In reply to @haxscramper "https://forum.nim-lang.org/t/6753#41973 largely tal": I will give it a read. I am having a bit of a look into the macros right now and I don't know if I have seen anything this fantastic. seriously
14:42:53FromDiscord<retsyo (retsyo)> read data in excel files(both XLS and XLSX format, because some colleagues always supply XLS) into pandas DataFrame, then I perform the operations(sort/filter/pivot-table/...) in pandas
14:45:20FromDiscord<Fancy> @haxscramper Hey man I just want to let you know that you sharing your love and knowledge of the language has really motivated me to continue on using it
14:47:39FromDiscord<Fancy> I can't believe a language like this exists
14:47:56FromDiscord<retsyo (retsyo)> any step-by-step macros tutorial with more explanation for an amateur programmer? I think it is hard for me to understand official https://nim-lang.org/docs/macros.html
14:49:17FromDiscord<Fancy> I believe fullstack webdev could be possible with the interop capabilities
14:51:38FromDiscord<Fancy> In reply to @retsyo (retsyo) "any step-by-step macros tutorial": Maybe it would be helpful to go through some of the basics of Nim, if you haven't already. I don't know your experience, but if it is hard it is probably because there are some gaps in your knowledge.
14:52:03FromDiscord<Rika> In reply to @Fancy "I believe fullstack webdev": and it is
14:53:23FromDiscord<Fancy> dayumm
14:55:33FromDiscord<Fancy> In reply to @Rika "and it is": I am so sold on this language
14:55:36FromDiscord<Fancy> seriously
14:56:02FromDiscord<Fancy> I know it is just a tool, but it is an amazing one at that
14:57:42FromDiscord<haxscramper> https://dev.to/beef331/demystification-of-macros-in-nim-13n8 this one is good I suppose? At this point I don't really remember basic stuff to be honest, so I can't really recommend anything
15:02:17FromDiscord<Fancy> I saw some people saying they used c++ in parts of their game where performance was critical. I am guessing I could achieve this with nim too right?
15:08:09FromDiscord<haxscramper> correct
15:08:22FromDiscord<haxscramper> well, you can write games entirely in nim
15:08:36FromDiscord<haxscramper> I guess C++ was used only in parts because it is very painful to write in
15:09:05FromDiscord<haxscramper> was not used for the whole game because it is painful
15:10:16FromDiscord<Fancy> I think C++ is not too bad if you are only doing simple things, but I have tried to do more complicated things in it and I felt like I was in a special kind of hell haha
15:10:57FromDiscord<Fancy> In reply to @haxscramper "well, you can write": That is absolutely fantastic
15:11:57FromDiscord<Fancy> In reply to @haxscramper "well, you can write": I have wanted a language like this for quite some time now. Something that doesn't get in my way and just allows me to do what I want to do.
15:14:11FromDiscord<Fancy> In reply to @haxscramper "was not used for": C++ in small doses is the only approach that should be taken in my books unless you really know what you are doing. It is just by opinion but I kept on feeling like the language was trying to fight me.
15:20:09FromDiscord<retsyo (retsyo)> thank you for the macros article. I will try to read it carefully.
15:45:51*Gustavo6046 joined #nim
17:09:45*Gustavo6046 quit (Remote host closed the connection)
17:09:48*Gustavo6046_ joined #nim
17:12:34*Gustavo6046_ is now known as Gustavo6046
17:21:05*Gustavo6046_ joined #nim
17:21:40*Gustavo6046 quit (Ping timeout: 252 seconds)
17:23:50*Gustavo6046_ is now known as Gustavo6046
17:40:48Amun-RaI have p: ptr cchar, how to write to p[1]?
17:41:23FromDiscord<haxscramper> u need to cast it to `ptr UncheckedArray[cchar]`
17:41:30FromDiscord<haxscramper> Nim pointers are never arrays
17:41:43FromDiscord<haxscramper> `UncheckedArray` has all the necessary operations
17:42:00Amun-Raah, thanks
17:57:19Amun-Rawhat would be the best way of passing chunk of an array to a function (I need to write to the chunk inside it)
17:58:53Amun-Rahmm, passing array and start index…
17:59:39*xet7 quit (Remote host closed the connection)
18:00:43*xet7 joined #nim
18:03:37FromDiscord<ynfle (ynfle)> Is it an unchecked array?
18:03:58FromDiscord<ynfle (ynfle)> for a seq, seq[start..stop] (FYI it's inclusive)
18:06:07*max22- quit (Ping timeout: 240 seconds)
18:11:36Amun-Rawoudn't that seq be immutable?
18:18:31*max22- joined #nim
18:24:44Amun-Ra(I'm writing a small embedded project and I have to operate in gcless world)
18:25:20FromDiscord<haxscramper> `seq[a..b]` copies a sequence
18:25:37FromDiscord<haxscramper> your best solution would be to pass seq+ranges to the proc
18:34:22Amun-Raor openArray with start offset
18:44:55FromDiscord<ynfle (ynfle)> Not if it's a `var`
18:45:03FromDiscord<ynfle (ynfle)> It's mutable then
18:45:15FromDiscord<ynfle (ynfle)> Do you want a mutable view?
18:49:29Amun-Rayes
18:58:54FromDiscord<exelotl> how efficient are tables in nimscript?
19:18:39FromDiscord<haxscramper> just as any nimscript object
19:18:46FromDiscord<haxscramper> there is not table-specific overhead for nimscript
19:19:23FromDiscord<haxscramper> they use nim implementation from `std/tables.nim`
19:22:07FromDiscord<exelotl> ah, I was hoping there might be some efficient "soft object" built into nimscript
19:22:48FromDiscord<exelotl> well really I just need to map strings to ints
19:28:41FromDiscord<Elegantbeef> Time for CoW strings that are pre hashed 😛
20:41:21*mahlon quit (Ping timeout: 245 seconds)
21:13:20*neurocyte0132889 joined #nim
21:13:20*neurocyte0132889 quit (Changing host)
21:13:20*neurocyte0132889 joined #nim
21:18:20FromDiscord<Elegantbeef> @impbox [ftsf]\: @geekrelief we've now got state reload capabilities for exported global symbols!(Needs latest Nim commit though) https://streamable.com/9zr8w4
21:19:18FromDiscord<geekrelief> In reply to @Elegantbeef "<@309937753699778561>\: <@109484839480107008> we've": whoa! sweet!
21:19:51FromDiscord<Elegantbeef> uses `loadState` and `saveState` from `nimscripter`
21:20:05FromDiscord<Elegantbeef> Soon enough i'll have to document/test all this stuff
21:23:33FromDiscord<geekrelief> is it correct to pass a `{.cdecl.}` proc to C via a pointer parameter?
21:24:49FromDiscord<Elegantbeef> Possibly, dont recall how cdecl gens code
21:25:43FromDiscord<geekrelief> On another note, anyone know how to resolve a `too many initializers` error from generated C? I'm creating an array of structs and passing it into a C function via (myarray[0].unsafeAddr).
21:26:12FromDiscord<geekrelief> The weird part is each struct looks like it's code gen'ed correctly
21:28:47FromDiscord<geekrelief> sent a code paste, see https://play.nim-lang.org/#ix=3C4F
21:29:42FromDiscord<geekrelief> sent a code paste, see https://play.nim-lang.org/#ix=3C4G
21:31:57FromDiscord<geekrelief> The weird part is this error only appears when I define this variable: `let p: pointer = truthCreateTypes` where `trutCreateTypes` is a `{.cdecl.}` proc I pass to C.
21:32:38FromDiscord<geekrelief> this is so weird
21:33:32FromDiscord<impbox [ftsf]> In reply to @Elegantbeef "<@309937753699778561>\: <@109484839480107008> we've": Exciting!!
21:34:31FromDiscord<geekrelief> oh crap.. it' must be a template!
21:35:06FromDiscord<geekrelief> nvm
21:35:39FromDiscord<geekrelief> time to take a break I guess..
21:38:35*mahlon joined #nim
21:39:08*neurocyte0132889 quit (Read error: Connection reset by peer)
21:39:46*neurocyte0132889 joined #nim
21:39:46*neurocyte0132889 quit (Changing host)
21:39:46*neurocyte0132889 joined #nim
21:47:06*max22- quit (Quit: Leaving)
22:04:08nrds<Prestige99> I'm storing a ref object with a pointer, and trying to bring it back later for modification. But I think the object might not be the same? https://play.nim-lang.org/#ix=3C4P as an example
22:04:30nrds<Prestige99> @Elegantbeef I think this may be the problem with the code I've been sharing with you ^ (in part)
22:08:16FromDiscord<geekrelief> lol, nimterop wasn't able to convert `tm_the_truth_property_definition_t` properly because there's a union in the struct.
22:10:59FromDiscord<Elegantbeef> No prestige the issue with that code is you're doing stuff wrong
22:11:25nrds<Prestige99> Yeah that's what I mean, it seems I can do the above
22:11:28nrds<Prestige99> cant*
22:11:47FromDiscord<Elegantbeef> Well of course not `foo.addr` != `cast[ptr Foo](foo)`
22:12:04FromDiscord<Elegantbeef> https://play.nim-lang.org/#ix=3C4Q
22:12:33FromDiscord<Elegantbeef> Like look at https://play.nim-lang.org/#ix=3C4R
22:13:08nrds<Prestige99> oh so addr is a pointer to a ref? 🤔
22:13:16FromDiscord<Elegantbeef> Well yea
22:13:26FromDiscord<Elegantbeef> you're getting the address of the variable
22:13:37FromDiscord<Elegantbeef> Which is a pointer
22:13:41FromDiscord<Elegantbeef> It's the same with pointers
22:14:01nrds<Prestige99> hm I always thought refs were essentially pointers
22:14:12FromDiscord<Elegantbeef> They are
22:14:13FromDiscord<Elegantbeef> https://play.nim-lang.org/#ix=3C4S
22:14:15FromDiscord<Elegantbeef> They behave identically in this case
22:14:35FromDiscord<Elegantbeef> `addr` of a variable returns the address of that variable regardless if it's a pointer or not
22:14:51FromDiscord<Elegantbeef> It does not return the address of where it points at
22:16:01nrds<Prestige99> Alright, so this might get me closer..
22:16:28FromDiscord<Elegantbeef> Hopefully that explanation makes sense 😀
22:16:40nrds<Prestige99> so if you look here https://git.einheit.tech/EinheitTechnologies/shade/src/branch/example/platformer/src/shadepkg/game/physicsbody.nim#L73 `userData` is a `pointer`
22:16:54nrds<Prestige99> then it's being used here https://git.einheit.tech/EinheitTechnologies/shade/src/branch/example/platformer/src/shadepkg/game/physicsbody.nim#L106
22:17:24nrds<Prestige99> but I believe I should be saying cast[ptr PhysicsBody](body.userData)
22:17:40FromDiscord<Elegantbeef> Indeed
22:17:43nrds<Prestige99> but I still get an illegal storage access error in that case. Unless ptr != pointer
22:17:56FromDiscord<Elegantbeef> pointer is a `void`
22:18:03FromDiscord<Elegantbeef> well physicsbody is a ref object no?
22:18:09nrds<Prestige99> Yes it is
22:19:56FromDiscord<Elegantbeef> so you should be doing `physicsBody.body.userData = cast[pointer](physicsBody)` ?
22:21:23nrds<Prestige99> oh wow I think that worked (at least it didn't crash)
22:21:44nrds<Prestige99> Thanks; this whole thing is a bit confusing, need to read about refs..
22:22:13FromDiscord<Elegantbeef> Refs are just pointers which are managed by the GC
22:22:24nrds<Prestige99> ah, alright cool. Thanks!
22:24:28FromDiscord<Elegantbeef> Of course casting to ptr is unsafe and can result in bad behaviour if you dont manage the C side code
22:24:37FromDiscord<Elegantbeef> But we have destructors now, so use those where applicable
22:24:50nrds<Prestige99> only available with arc/orc yeah?
22:25:07FromDiscord<Elegantbeef> They work everywhere but work better with rcs
22:25:21FromDiscord<Elegantbeef> with refc you dont have them deterministically so they behave oddly
22:25:27nrds<Prestige99> Been stuck on this for days, thanks for helping :)
22:25:40FromDiscord<Elegantbeef> No problem
22:43:39*rockcavera joined #nim
22:43:39*rockcavera quit (Changing host)
22:43:39*rockcavera joined #nim
22:47:04*User11 joined #nim
23:28:35FromDiscord<KimJongUnstoppable> Does anyone know if there's a way to specify a specific virtual offset when loading a DLL with loadLib and/or trying to call the process with symAddr?
23:57:11FromDiscord<Elegantbeef> @KimJongUnstoppable\: is the offset just offset from the symaddr pointer?