| 00:04:28 | FromDiscord | <ElegantBeef> @Bung i know exactly what i need to do just need to implement it |
| 00:05:07 | FromDiscord | <ElegantBeef> A few thugs attacked my dogs, so i have to go break their house apart and kill their children which delayed me |
| 00:05:25 | FromDiscord | <ElegantBeef> talking about killing wasps |
| 00:08:17 | FromDiscord | <geekrelief> What's a reliable to convert a table's keys to a seq? I tried `toSeq(t.keys)` and that worked fine till I imported `dik` now I'm getting an error because `proc keys(self: Dictionary): Array` is defined and nim is complaining about a type mismatch. |
| 00:08:23 | FromDiscord | <ElegantBeef> cynahc you may want to use `GC_Ref` and `GC_Unref` for that |
| 00:09:17 | FromDiscord | <cynahc> @ElegantBeef\: Thanks! I'll look into it. |
| 00:09:40 | FromDiscord | <ElegantBeef> Well the `toSeq` method is right you probably want to do `toSeq(table.keys(t))` to get around that |
| 00:09:52 | FromDiscord | <ElegantBeef> You could also use `sugar.collect` |
| 00:11:08 | FromDiscord | <geekrelief> hmm `toSeq(table.keys(t))` didn't work |
| 00:11:30 | FromDiscord | <geekrelief> I'll try `sugar.collect` |
| 00:11:43 | FromDiscord | <geekrelief> thx |
| 00:13:31 | FromDiscord | <geekrelief> cool collect worked @ElegantBeef thanks! |
| 00:46:02 | * | mjsir911 quit (Quit: Goodbye, World!) |
| 00:46:17 | * | mjsir911 joined #nim |
| 02:02:23 | FromDiscord | <cynahc> Hmm still no luck with GC\_ref or reset. Here's the full code if anyone wants to take a crack at fixing the leak\: https://gist.github.com/chancyk/d5d7f36ab3f1386362d15430347a2de2#file-sdl_leak-nim-L59 |
| 02:03:21 | FromDiscord | <cynahc> A pointer to a seq is being stored under a C pointer of SDL2, and it seems to never get properly cleaned up despite my various attempts at properly using dealloc, reset, GC\_ref, destroy (from SDL), etc. |
| 02:10:57 | FromDiscord | <ElegantBeef> Wait why would you have to dealloc that ptr |
| 02:20:03 | FromDiscord | <cynahc> The seq that's stored in `image.data` is coming from Pixie, so it's being attached to the Surface for SDL2, but it seems like it's never being freed and results in a pretty large memory leak. |
| 02:22:47 | FromDiscord | <cynahc> It's kind of bizarre because it's based on an example from Pixie that has a leak because it's lacking a destroy, but once you add it's fine.↵https://github.com/treeform/pixie/blob/master/examples/realtime_sdl.nim |
| 02:23:20 | FromDiscord | <cynahc> However, in my slightly different version it doesn't seem to clean up properly. 🤔 |
| 02:29:15 | * | arkurious quit (Quit: Leaving) |
| 02:59:55 | * | rockcavera joined #nim |
| 03:03:23 | FromDiscord | <Quibono> What would be the best way to instrument Nim to measure how long a program loop takes? |
| 03:04:11 | FromDiscord | <cynahc> @Quibono\: You can use the times module\: https://nim-lang.org/docs/times.html |
| 03:04:20 | FromDiscord | <ElegantBeef> monotimes is better for percise timing |
| 03:04:43 | FromDiscord | <Quibono> Monotimes are in ns? |
| 03:05:18 | FromDiscord | <ElegantBeef> > The MonoTime type stores the timestamp in nanosecond resolution, but note that the actual supported time resolution differs for different systems. |
| 03:06:39 | FromDiscord | <treeform> In reply to @cynahc "It's kind of bizarre": Sorry I don't use SDL, I wanted and example for people here because many seem to use it. I made a mistake I'll fix it when I get back. You might not need to create a texture every time, but just copy it. I don't know SDL that well... |
| 03:07:03 | FromDiscord | <ElegantBeef> The best way to use `monotimes` is to import `times` with it and use it's stringification for durations |
| 03:08:37 | FromDiscord | <ElegantBeef> https://play.nim-lang.org/#ix=3sIS to see monotimes in action 😄 |
| 03:09:03 | FromDiscord | <cynahc> @treeform\: I'm not sure it's related to the lack of a destroy. I'm just learning SDL also, but some kind of interplay between the Nim GC and SDL is behaving strangely. To my anyway. 😅 |
| 03:09:23 | FromDiscord | <Quibono> In reply to @ElegantBeef "https://play.nim-lang.org/#ix=3sIS to see monotimes": Ooh that's nice. |
| 03:09:48 | FromDiscord | <ElegantBeef> You can also of course turn that into a template and then time whatever you want inside a block |
| 04:06:02 | * | supakeen quit (Quit: WeeChat 3.2) |
| 04:06:39 | * | supakeen joined #nim |
| 04:09:07 | FromDiscord | <Jasmine and Don't Forget!~> Hi everyone! What's up? |
| 04:57:24 | FromDiscord | <whyy cant i install choosenim> In reply to @Quibono "Lol so Choosenim doesn't": doesnt support arm anyways |
| 05:06:13 | * | mikko quit (*.net *.split) |
| 05:06:13 | * | Ekho quit (*.net *.split) |
| 05:06:13 | * | systemdsucks quit (*.net *.split) |
| 05:06:13 | * | Onionhammer quit (*.net *.split) |
| 05:06:29 | * | Onionhammer joined #nim |
| 05:06:32 | * | systemds1cks joined #nim |
| 05:06:35 | * | mikko joined #nim |
| 05:11:26 | * | crem quit (*.net *.split) |
| 05:11:26 | * | oprypin quit (*.net *.split) |
| 05:11:27 | * | lain quit (*.net *.split) |
| 05:11:38 | * | oprypin joined #nim |
| 05:11:43 | * | crem joined #nim |
| 05:12:27 | * | lain joined #nim |
| 05:14:58 | * | DrWhax quit (*.net *.split) |
| 05:14:58 | * | euantorano quit (*.net *.split) |
| 05:14:58 | * | robertmeta quit (*.net *.split) |
| 05:15:09 | * | DrWhax joined #nim |
| 05:15:51 | * | euantorano joined #nim |
| 05:16:02 | * | robertmeta joined #nim |
| 05:16:04 | * | robertmeta quit (Changing host) |
| 05:16:04 | * | robertmeta joined #nim |
| 05:16:07 | * | Ekho joined #nim |
| 06:01:16 | * | rockcavera quit (Remote host closed the connection) |
| 06:08:26 | * | Vladar joined #nim |
| 06:23:34 | fn | <ForumUpdaterBot99> New thread by Halloleo: How can I tell Nim that a JsObject has some certain attributes?, see https://forum.nim-lang.org/t/8222 |
| 06:25:36 | fn | <ForumUpdaterBot99> New Nimble package! macroplus - a collection of useful macro functionalities, see https://github.com/hamidb80/macroplus |
| 06:25:37 | fn | <R2D299> itHub: 7"<No Description>" |
| 06:26:20 | FromDiscord | <sealmove> Is there a web dev tutorial or something that doesn't treat readers/watchers as complete beginners in programming? |
| 06:27:10 | FromDiscord | <Rika> Web dev starting from where? |
| 06:27:17 | FromDiscord | <Rika> Like rather what are you making |
| 06:27:24 | FromDiscord | <Rika> The server itself or just a website? |
| 06:27:58 | FromDiscord | <Rika> If it’s just a website I feel like the docs for whatever web server should suffice? |
| 06:29:00 | FromDiscord | <sealmove> Ideally I want to build a full stack pet project (as small as possible) to get the big picture. |
| 06:29:39 | FromDiscord | <Rika> Let me try searching as well |
| 06:31:01 | FromDiscord | <Rika> I’m still kinda unsure what you want, do you already have the documents to serve to the user, are you making a single page site (using something like karax) |
| 06:31:39 | FromDiscord | <Rika> Most tutorials for full stack are specific to a certain stack |
| 06:31:46 | FromDiscord | <Rika> Stuff like LAMP MEAN etc |
| 06:31:50 | * | PMunch joined #nim |
| 06:32:07 | FromDiscord | <sealmove> I am fine with picking one stack, just to get my feet wet |
| 06:34:04 | FromDiscord | <Rika> Perhaps https://thinkster.io/tutorials/fullstack ? You will need to adapt it to Nim if you plan on using Nim libraries |
| 06:34:17 | FromDiscord | <Rika> And likely there are components that do not exist yet on Nim |
| 06:34:27 | FromDiscord | <Rika> So you might need to create some stuff from scratch |
| 06:38:21 | PMunch | LAMP can quite easily switch out the P(HP) for Nim |
| 06:38:28 | PMunch | I've done it on my server :) |
| 06:38:54 | FromDiscord | <enthus1ast> with reverse proxy? or with (fast) cgi? |
| 06:39:01 | FromDiscord | <enthus1ast> wsgi |
| 06:39:08 | PMunch | Reverse proxy via Apache |
| 06:39:55 | FromDiscord | <Rika> Most people opt for nginx nowadays though heh |
| 06:40:48 | PMunch | Yeah I know, but I was already running Apache |
| 06:42:29 | FromDiscord | <sealmove> would be cool to use Nim but I need "marketable" skills :< my github account only has Nim xD |
| 06:43:27 | FromDiscord | <Bung> you can change gitattribute tell github show as python |
| 06:43:44 | FromDiscord | <sealmove> cool idea :> |
| 06:45:00 | FromDiscord | <Bung> think you only need read some framework document and its source code. |
| 06:45:12 | FromDiscord | <enthus1ast> my one stop shop for professional websites\: php bolt cms; for web application\: python flask or nim; but in my opinion it does not really matter, master css, a web framework like bootstrap is more important for a website |
| 06:49:19 | * | max22- joined #nim |
| 06:51:38 | fn | <ForumUpdaterBot99> New Nimble package! isocodes - ISO codes for Nim that allows to embed its data within the executable (or load it automatically at runtime)., see https://github.com/kraptor/isocodes |
| 06:51:39 | fn | <R2D299> itHub: 7"ISO codes for Nim that allows to embed the data within the executable (or load it automatically at runtime)." |
| 06:55:48 | FromDiscord | <planetis> How about https://m.youtube.com/watch?v=KH_-vhsfxjg&list=PLlRFEj9H3Oj5e-EH0t3kXrcdygrL9-u-Z&index=1↵(@sealmove) |
| 06:55:51 | fn | <R2D299> outube: 7"Why Teach Django?" |
| 06:56:27 | FromDiscord | <sealmove> In reply to @planetis "How about https://m.youtube.com/watch?v=KH_-vhsfxjg": looks good |
| 06:56:29 | fn | <R2D299> outube: 7"Why Teach Django?" |
| 07:01:10 | FromDiscord | <planetis> The d is silent |
| 07:12:38 | PMunch | @enthus1ast, hadn't heard of FastCGI before. Interesting concept |
| 07:14:51 | * | max22- quit (Ping timeout: 276 seconds) |
| 07:31:42 | * | beshr quit (Remote host closed the connection) |
| 07:32:59 | * | max22- joined #nim |
| 07:35:06 | FromDiscord | <Bung> https://github.com/mrhdias/fastkiss there one in nim |
| 07:35:08 | fn | <R2D299> itHub: 7"FastKISS - Nim's FastCGI Flexible Web Framework" |
| 07:48:30 | FromDiscord | <Rika> Oh wow nice I’ll use this |
| 07:48:56 | FromDiscord | <enthus1ast> Not sure if fastcgi actually gives a win. Also unsure if websocket works with fastcgi |
| 07:50:02 | FromDiscord | <enthus1ast> And with nginx you also must start your application by yourself (afaik) |
| 07:51:29 | FromDiscord | <Rika> It works for me because I need to use http 2 |
| 08:01:34 | FromDiscord | <Bung> you use http2 ? does the backend program handle the stream like http1? |
| 08:35:55 | fn | <ForumUpdaterBot99> New thread by Elcritch: Arena memory support?, see https://forum.nim-lang.org/t/8225 |
| 08:42:11 | * | neceve joined #nim |
| 09:28:23 | * | max22- quit (Remote host closed the connection) |
| 09:29:12 | * | max22- joined #nim |
| 09:53:02 | * | Vladar quit (Quit: Leaving) |
| 10:28:43 | FromDiscord | <dom96> fastcgi is pointless |
| 10:28:57 | FromDiscord | <dom96> just another protocol when http can be used instead |
| 10:29:32 | PMunch | I mean it might be nice if you have a language without a HTTP library |
| 10:29:44 | FromDiscord | <dom96> just implement http then lol |
| 10:30:06 | PMunch | As I understand it FastCGI is easier to implement |
| 10:30:48 | PMunch | And if you need to run your HTTP server behind a reverse proxy anyways it's starting to look quite similar architecturally |
| 10:32:58 | FromDiscord | <dom96> I really doubt FastCGI is easier to implement |
| 10:33:23 | FromDiscord | <dom96> You still need to implement all the HTTP concepts for your framework anyway |
| 10:34:59 | FromDiscord | <haxscramper> sent a code paste, see https://paste.rs/gVs |
| 10:35:40 | FromDiscord | <haxscramper> sent a code paste, see https://play.nim-lang.org/#ix=3sJU |
| 10:35:48 | FromDiscord | <dom96> (there is also simple CGI btw which implies fast cgi isn't simple at all :)) |
| 10:36:02 | FromDiscord | <haxscramper> Also `proc toFlatty(str: var string, cstr: cstring) = toFlatty(str, $cstr)` as default implementation for cstring. |
| 10:36:14 | FromDiscord | <haxscramper> I can make a PR that adds this to flatty if you are ok with the idea |
| 10:36:38 | FromDiscord | <haxscramper> and `fromFlatty` implementation as well |
| 10:37:15 | FromDiscord | <haxscramper> btw, I've decided to use flatty/supersnappy for haxdoc database serialization after your post https://forum.nim-lang.org/t/8214 |
| 10:37:39 | FromDiscord | <haxscramper> so far works great, though (as usual with any serialization) it is having troubles with `.requiresinit.` |
| 10:39:05 | FromDiscord | <Rika> In reply to @dom96 "just implement http then": Have you implemented http2 yet then? |
| 10:39:32 | FromDiscord | <dom96> no, because I don't need it |
| 10:39:50 | FromDiscord | <dom96> nginx/cloudflare can do http2 for me |
| 10:43:25 | FromDiscord | <Rika> In reply to @dom96 "nginx/cloudflare can do http2": Hm? nginx can do 1.1->2? |
| 10:44:10 | FromDiscord | <dom96> I think so, cloudflare can so I don't see why nginx can't |
| 11:12:01 | * | iortega joined #nim |
| 11:19:56 | FromDiscord | <Aiz> sent a code paste, see https://play.nim-lang.org/#ix=3sK7 |
| 11:20:21 | FromDiscord | <Aiz> (edit) "https://paste.rs/AnG" => "https://play.nim-lang.org/#ix=3sK8" |
| 11:20:21 | FromDiscord | <Aiz> (edit) "https://play.nim-lang.org/#ix=3sK8" => "https://play.nim-lang.org/#ix=3sK9" |
| 11:21:12 | FromDiscord | <Rika> you want `ptr AtlasPage` i assume? |
| 11:22:01 | FromDiscord | <Aiz> sent a code paste, see https://play.nim-lang.org/#ix=3sKb |
| 11:22:33 | FromDiscord | <Rika> i assume the issue is in the C side? likely because cstring -> char and not const char |
| 11:24:04 | FromDiscord | <haxscramper> @Aiz\: you can use combination of `.codegendecl: "...".`, `.emit` and `.exportc` |
| 11:24:16 | FromDiscord | <Aiz> sent a code paste, see https://play.nim-lang.org/#ix=3sKd |
| 11:24:27 | FromDiscord | <haxscramper> `.constructor.` to avoid implicit `return` initalization |
| 11:25:41 | FromDiscord | <haxscramper> `.codegendecl.` would allow you to manually overide argument list with required types |
| 11:25:55 | FromDiscord | <haxscramper> so you could do `const char` explicitly |
| 11:26:34 | FromDiscord | <Aiz> let me try |
| 11:41:54 | FromDiscord | <Aiz> it compiled successfully |
| 11:42:25 | FromDiscord | <whyy cant i install choosenim> :nimble3: |
| 12:03:22 | * | jfinkhaeuser quit (Ping timeout: 240 seconds) |
| 12:03:36 | * | jfinkhaeuser joined #nim |
| 12:06:01 | * | supakeen quit (Quit: WeeChat 3.2) |
| 12:06:35 | * | supakeen joined #nim |
| 12:07:00 | * | Vladar joined #nim |
| 12:19:17 | FromDiscord | <System64 ~ Flandre Scarlet> Do you know how can I fix theses errors please? https://media.discordapp.net/attachments/371759389889003532/864118718749474856/unknown.png |
| 12:21:13 | FromDiscord | <Rika> `var time = (↵sample_nr[].float / 96000.float)` |
| 12:21:16 | FromDiscord | <Rika> (edit) "(↵sample_nr[].float" => "(sample_nr[].float" |
| 12:22:10 | FromDiscord | <System64 ~ Flandre Scarlet> ah thanks and for the buf? |
| 12:22:40 | FromDiscord | <Rika> dont use a pointer |
| 12:22:45 | FromDiscord | <Rika> nim pointers are not c pointers |
| 12:22:55 | PMunch | UncheckedArray is probably what you want |
| 12:22:58 | FromDiscord | <Rika> well more accurately nim `[]` is not c `[]` |
| 12:23:22 | PMunch | ptr UncheckedArray[cshort] |
| 12:23:47 | FromDiscord | <System64 ~ Flandre Scarlet> sent a code paste, see https://play.nim-lang.org/#ix=3sKt |
| 12:30:06 | * | max22- quit (Ping timeout: 276 seconds) |
| 12:37:01 | FromDiscord | <arnetheduck> thoughts on projects that want to support both chronos and asyncdispatch? https://github.com/status-im/nim-chronos/issues/207 - using `async_backend` is nice because it opens the door for other backends as well, in the future, but happy to hear opinions |
| 12:43:29 | FromDiscord | <Aiz> sent a code paste, see https://play.nim-lang.org/#ix=3sKy |
| 12:43:50 | FromDiscord | <dom96> In reply to @arnetheduck "thoughts on projects that": sounds good to me |
| 12:44:40 | FromDiscord | <Aiz> (edit) "https://play.nim-lang.org/#ix=3sKy" => "https://play.nim-lang.org/#ix=3sKz" |
| 12:57:02 | * | TakinOver quit (Ping timeout: 268 seconds) |
| 12:58:57 | arkanoid | where I can read state-of-the-art nim code that covers idioms, patterns, defensive programming and nim program architecture? |
| 13:03:13 | fn | <ForumUpdaterBot99> New thread by Rb3: A regex-based linter for Nim in vscode, see https://forum.nim-lang.org/t/8226 |
| 13:03:46 | * | TakinOver joined #nim |
| 13:07:34 | * | arkurious joined #nim |
| 13:10:06 | * | rockcavera joined #nim |
| 13:10:06 | * | rockcavera quit (Changing host) |
| 13:10:06 | * | rockcavera joined #nim |
| 13:12:09 | arkanoid | well, I bet there's none |
| 13:12:26 | arkanoid | new question: what about tainted strings? what's the point? |
| 13:13:10 | arkanoid | by default tainted strings is off and string == TaintedString, but what's the adventage in turining it on? |
| 13:13:36 | arkanoid | manual says "If the taint mode is turned on (via the --taintMode:on command line option) it is a distinct string type which helps to detect input validation errors" |
| 13:17:09 | FromDiscord | <arnetheduck> arkanoid, we use nim for a few larger projects and have written some notes down in https://status-im.github.io/nim-style-guide/ |
| 13:17:37 | arkanoid | thanks arnetheduck |
| 13:19:50 | FromDiscord | <whyy cant i install choosenim> the nlvm dev |
| 13:19:59 | FromDiscord | <whyy cant i install choosenim> i was like 🤔 |
| 13:22:34 | FromDiscord | <Rika> arkanoid arq recently considered removing taint (i believe it already is in devel?) |
| 13:22:40 | FromDiscord | <Rika> but he thinks its not helpful |
| 13:23:02 | FromDiscord | <Rika> so basically its a feature that hasnt been removed yet |
| 13:25:59 | arkanoid | Rika: I also don't see the purpose of it, but surely I'm now super sayan 3 like araq is on these topics |
| 13:26:25 | FromDiscord | <Rika> i do not watch dragon ball so i do not understand the reference |
| 13:26:49 | FromDiscord | <Rika> i do not see the use for taint as well so i do not pay notice to it |
| 13:37:03 | FromDiscord | <Aiz> sent a code paste, see https://play.nim-lang.org/#ix=3sKT |
| 13:38:58 | FromDiscord | <Aiz> (edit) "https://play.nim-lang.org/#ix=3sKT" => "https://play.nim-lang.org/#ix=3sKU" |
| 13:46:24 | FromDiscord | <@bracketmaster-5a708063d73408ce4> @kaushalmodi\_gitlab - had you considered hooking up verilator and nim? |
| 13:54:25 | PMunch | Can anyone tell me what the actual type mismatch here is? http://ix.io/3sKX/ |
| 13:55:19 | fn | <ForumUpdaterBot99> New thread by FabienPRI: Zip error code, see https://forum.nim-lang.org/t/8227 |
| 13:55:34 | FromDiscord | <Rika> pmunch do the two procs match incl. pragmas? |
| 13:56:07 | FromDiscord | <dom96> In reply to @Rika "arkanoid ar*q recently considered": he's on Discord now, you don't need to censor his name anymore |
| 13:56:19 | FromDiscord | <Rika> okay |
| 13:56:25 | FromDiscord | <Rika> nice to know lmao |
| 14:02:39 | PMunch | Hmm, they should |
| 14:02:48 | * | PMunch quit (Quit: Leaving) |
| 14:19:46 | * | max22- joined #nim |
| 14:27:28 | FromDiscord | <konsumlamm> In reply to @arkanoid "new question: what about": tainted strings have been deprecated, the point was to force input validation, but that didn't really work out |
| 14:28:21 | FromDiscord | <Rika> I believe it’s because nothing really prevented people from just converting from one to the other |
| 14:32:02 | FromDiscord | <konsumlamm> https://github.com/nim-lang/RFCs/issues/24 |
| 14:38:32 | FromDiscord | <Bung> how to prevent compiler ouput `template/generic instantiation` message ? |
| 14:41:36 | nixfreak_nim[m] | Probably a dumb question , related to type , but why do you have to use the actual type name even when you assign a new variable ? |
| 14:41:37 | FromDiscord | <kaushalmodi> In reply to @@bracketmaster-5a708063d73408ce4 "@kaushalmodi\_gitlab - had you": I happened to notice this message, but it didn't ping me as I am on Discord.↵↵No, I haven't used Verilator yet. |
| 14:42:13 | nixfreak_nim[m] | like type User name: string , var user = User |
| 14:42:37 | nixfreak_nim[m] | is it because there is not inheritance ? |
| 14:42:43 | FromDiscord | <Rika> Initialisation |
| 14:42:49 | nixfreak_nim[m] | * is it because there is no inheritance ? |
| 14:43:03 | FromDiscord | <Rika> No, inheritance has nothing to do with that |
| 14:43:21 | nixfreak_nim[m] | oh ok , I didn't know just curious |
| 14:43:47 | nixfreak_nim[m] | so your initializing the type |
| 14:44:14 | FromDiscord | <Rika> The variable |
| 14:46:02 | FromDiscord | <Bung> nim is static type language |
| 14:46:46 | nixfreak_nim[m] | sorry I meant that thanks |
| 14:50:36 | * | xet7 quit (Remote host closed the connection) |
| 15:01:46 | * | pro joined #nim |
| 15:02:35 | * | xet7 joined #nim |
| 15:19:19 | FromDiscord | <dimspith> sent a code paste, see https://play.nim-lang.org/#ix=3sLL |
| 15:32:56 | FromDiscord | <hugogranstrom> First one is more readable and easier to reason about so I'd go with it no matter what (unless `i` is some huge stack-allocated type or crazy stuff like that)↵(@dimspith) |
| 15:33:51 | FromDiscord | <pointystick> You've used 'i' for both variables. If that's intention, I'd suggest trying to avoid changing loop variables as it could get very confusing |
| 15:34:24 | FromDiscord | <pointystick> sent a code paste, see https://paste.rs/e75 |
| 15:34:43 | FromDiscord | <pointystick> (edit) "https://play.nim-lang.org/#ix=3sLS" => "https://paste.rs/5TL" |
| 15:35:51 | FromDiscord | <pointystick> Damn, discord mangled that. 😦 There's meant to be an underscore there: https://play.nim-lang.org/#ix=3sLT |
| 15:38:16 | FromDiscord | <dimspith> In reply to @pointystick "You've used 'i' for": oh whoops, i didn't notice. this was just an example though so that wasn't my intention |
| 15:39:35 | FromDiscord | <dimspith> In reply to @hugogranstrom "First one is more": Oh ok thanks a lot! |
| 15:43:28 | fn | <ForumUpdaterBot99> New post on r/nim by Ver0ty: What can I use Nim for?, see https://reddit.com/r/nim/comments/oitvuh/what_can_i_use_nim_for/ |
| 15:43:58 | * | pro quit (Ping timeout: 272 seconds) |
| 15:59:51 | * | stkrdknmibalz quit (Quit: WeeChat 3.0.1) |
| 16:18:06 | * | stkrdknmibalz joined #nim |
| 16:25:28 | * | max22- quit (Remote host closed the connection) |
| 16:25:46 | * | max22- joined #nim |
| 16:30:23 | FromDiscord | <dimspith> On another note, is there an equivalent to python's `os.sysconf()` in nim? |
| 16:31:10 | FromDiscord | <aleclarson> sent a code paste, see https://play.nim-lang.org/#ix=3sM8 |
| 16:32:19 | FromDiscord | <aleclarson> is there some kind of "opaque type" in nim? |
| 16:33:54 | FromDiscord | <theangryepicbanana> In reply to @aleclarson "is there some kind": `distinct`? |
| 16:34:21 | FromDiscord | <dimspith> yeah distinct is the way i think. https://nim-lang.org/docs/manual.html#types-distinct-type |
| 16:34:46 | FromDiscord | <aleclarson> sweet thx ^^ |
| 16:51:48 | FromDiscord | <System64 ~ Flandre Scarlet> sent a code paste, see https://play.nim-lang.org/#ix=3sMc |
| 17:13:50 | fn | <ForumUpdaterBot99> New thread by Protium: Newbie: Mock object for assert when field not exported, see https://forum.nim-lang.org/t/8228 |
| 17:14:02 | FromDiscord | <aleclarson> is `not nil` reversible? |
| 17:15:04 | FromDiscord | <aleclarson> oh i suppose i can wrap a `not nil` type with a `ref` to make it nilable again |
| 17:27:29 | FromDiscord | <dom96> that sounds like a bad idea |
| 17:28:06 | FromDiscord | <Rika> sounds like a double indirection |
| 17:28:08 | arkanoid | for an x86_64 pure nim application, is there any difference in using C or C++ backend? C is now default one so I'm sticking with it and it's working, but I'm quite curious about this topic. I though that C++ could bring more advanced features for the compiler |
| 17:29:39 | FromDiscord | <Rika> the C backend is more heavily tested |
| 17:29:55 | FromDiscord | <Rika> afaik the two backends share a lot with each other but not everything |
| 17:30:41 | arkanoid | I'd guess that exceptions are thing where C++ shines |
| 17:31:26 | FromDiscord | <Rika> which goto exceptions beat anyway from what ive heard |
| 17:32:43 | arkanoid | and what about effect tracking? |
| 17:32:58 | arkanoid | (I'm just guessing here) |
| 17:35:16 | FromDiscord | <aleclarson> In reply to @dom96 "that sounds like a": why? |
| 17:35:42 | FromDiscord | <Rika> nim already has effect tracking built in |
| 17:35:55 | FromDiscord | <Rika> i dont understand what you mean about "effect tracking" |
| 17:36:09 | FromDiscord | <dom96> In reply to @aleclarson "why?": because you're working around a limitation in the type system by creating yet another reference |
| 17:36:44 | FromDiscord | <aleclarson> yeah it's not ideal, i'd prefer to negate the `not nil` part with `or nil` or something |
| 17:37:20 | FromDiscord | <dom96> is the `not nil` type one you've defined? |
| 17:38:08 | FromDiscord | <dom96> sent a code paste, see https://play.nim-lang.org/#ix=3sMv |
| 17:39:10 | FromDiscord | <aleclarson> no it's not \:) |
| 17:39:25 | FromDiscord | <Rika> why do you want it to be nilable? |
| 17:40:50 | arkanoid | Rika, I though effect tracking was a runtime feature too, not just compile time (you can print effects at point in code) |
| 17:41:33 | FromDiscord | <Rika> what does that have in relation to the C vs C++ backend? i fail to see |
| 17:41:37 | FromDiscord | <konsumlamm> In reply to @aleclarson "is `not nil` reversible?": the point of `not nil` is that it can't be `nil`, it would be dumb if it was "reversible" |
| 17:42:32 | FromDiscord | <konsumlamm> this sounds more like you want an `Option` tbh, see the `std/options` module |
| 17:43:43 | FromDiscord | <Rika> do ref objects not nil work with Option? i thought Option relied on refs being nilabel |
| 17:43:44 | FromDiscord | <Rika> (edit) "nilabel" => "nilable" |
| 17:44:28 | FromDiscord | <konsumlamm> umm, no |
| 17:44:46 | FromDiscord | <konsumlamm> oh wait, hmm |
| 17:44:53 | FromDiscord | <Rika> xd |
| 17:44:56 | FromDiscord | <konsumlamm> ye, the optimization might break that |
| 17:45:09 | arkanoid | I though it was leveraging on backend feature to achive effect tracking. If not, nevermind (I was just wild guessing) |
| 17:45:12 | FromDiscord | <konsumlamm> which is another reason why it's a dumb idea, but muh breaking change |
| 17:46:21 | FromDiscord | <Rika> arkanoid the nim compiler only uses backend features when theyre available; nim does not restrict features to certain backends if it can help it |
| 17:46:44 | FromDiscord | <aleclarson> In reply to @konsumlamm "the point of `not": the library i'm using is abusing `not nil` imo. `not nil` shouldn't be used in a `type` declaration. save it for parameter types |
| 17:47:05 | FromDiscord | <Rika> i think there are valid reasons to use not nil in a type |
| 17:47:07 | FromDiscord | <konsumlamm> imo every `ref` type should be `not nil` tbh |
| 17:47:16 | FromDiscord | <aleclarson> who are they to say what my object types must contain? |
| 17:47:16 | FromDiscord | <konsumlamm> so i wouldn't say there's such a thing as abusing it |
| 17:47:19 | FromDiscord | <Rika> almost the same opinion as kon here |
| 17:47:32 | FromDiscord | <Rika> theyre not your types, theyre theirs |
| 17:48:06 | FromDiscord | <aleclarson> sent a code paste, see https://play.nim-lang.org/#ix=3sMA |
| 17:48:14 | FromDiscord | <aleclarson> they shouldn't have influence over whether `MyType.foo` is nil or not |
| 17:48:22 | FromDiscord | <Rika> why |
| 17:48:32 | FromDiscord | <aleclarson> it doesn't matter to them in my case |
| 17:48:40 | FromDiscord | <Rika> it does |
| 17:48:48 | arkanoid | Rika, sure but considering the fact that nim strikes for the performance and not for the "moltitude of backends", it was easier to assume that if a backend feature could be leveraged for better performance, just go for it |
| 17:48:54 | FromDiscord | <aleclarson> i ensure `MyType.foo` is not nil when i pass it into the library procs |
| 17:49:00 | FromDiscord | <Rika> if you use their library and pass that nil'ed not nil type to a proc? |
| 17:49:04 | FromDiscord | <dom96> I think you do want just an Option. |
| 17:49:05 | FromDiscord | <Rika> you ensure it |
| 17:49:08 | FromDiscord | <Rika> but not everyone will |
| 17:49:14 | FromDiscord | <Rika> if given the opportunity |
| 17:49:31 | FromDiscord | <aleclarson> they can protect against that by using `not nil` in the proc type signature |
| 17:50:02 | FromDiscord | <Rika> arkanoid yeah thats what i mean, when the feature is there in the backend (and is the same in behavior) nim would use it i believe |
| 17:51:03 | FromDiscord | <Rika> In reply to @aleclarson "they can protect against": okay ill think about this |
| 17:51:37 | FromDiscord | <Rika> then what's the point of having a nil value then? |
| 17:51:48 | FromDiscord | <aleclarson> optional property |
| 17:51:53 | FromDiscord | <Rika> THEN USE OPTION |
| 17:51:59 | FromDiscord | <aleclarson> that works with `ref` types? |
| 17:52:02 | FromDiscord | <Rika> YES |
| 17:52:07 | FromDiscord | <Rika> well |
| 17:52:10 | FromDiscord | <Rika> actually |
| 17:52:14 | FromDiscord | <Rika> it works with ref types |
| 17:52:19 | FromDiscord | <aleclarson> lol |
| 17:52:24 | FromDiscord | <Rika> In reply to @konsumlamm "ye, the optimization might": but as mentioned here |
| 17:52:38 | FromDiscord | <Rika> ive never checked if the way it's implemented works with ref not nil |
| 17:53:17 | FromDiscord | <konsumlamm> depends on wether or not the `ref` wildcard type includes `not nil` types |
| 17:55:07 | FromDiscord | <Rika> it works it seems |
| 17:55:13 | FromDiscord | <Rika> i just tested it |
| 17:55:16 | FromDiscord | <Rika> seems to work |
| 17:55:18 | FromDiscord | <aleclarson> is there a way to get my `object` type to call `new` for `ref` properties automatically? |
| 17:55:45 | FromDiscord | <Rika> no |
| 17:55:50 | FromDiscord | <Rika> (i wish) |
| 17:55:54 | FromDiscord | <Rika> (edit) "wish)" => "wish it was yes)" |
| 17:56:05 | FromDiscord | <Rika> but not now no |
| 17:57:00 | * | vicfred joined #nim |
| 17:57:13 | FromDiscord | <haxscramper> Maybe they decided to save up time and not insert `assert not isNil()` checks everywher |
| 17:57:31 | FromDiscord | <konsumlamm> ye, the reason it works is actually that `not nil` is broken |
| 17:57:36 | FromDiscord | <haxscramper> Also if argument is guaranteed to be not nil procedure returning things can also always return not nil instead of failing |
| 17:57:44 | FromDiscord | <konsumlamm> because `not nil` types are in fact considered to be `ref` |
| 17:57:55 | FromDiscord | <haxscramper> so `nil` values happen to propagate all over the place or raise things |
| 17:57:57 | FromDiscord | <Rika> In reply to @konsumlamm "ye, the reason it": it's broken??? huhhhhhhhh https://media.discordapp.net/attachments/371759389889003532/864203941990629387/unknown.png |
| 17:58:00 | FromDiscord | <konsumlamm> so what's happening under the hood is that we have a `not nil` type that is `nil` |
| 17:58:23 | arkanoid | what's more idiomatic: "proc initMyFoo(...): MyFoo" or "proc init(T: type MyFoo, ...): T" |
| 17:58:30 | FromDiscord | <konsumlamm> In reply to @Rika "it's broken??? huhhhhhhhh": last i checked it didn't complain about uninitialized variables |
| 17:58:32 | FromDiscord | <Rika> i guess i did call "new test" |
| 17:58:42 | FromDiscord | <Rika> lets see with an uninit var |
| 17:58:56 | * | mahlon quit (Ping timeout: 265 seconds) |
| 17:59:06 | FromDiscord | <Rika> huh |
| 17:59:10 | FromDiscord | <Rika> its just an assertion lmao |
| 17:59:16 | FromDiscord | <Rika> ah wait no |
| 17:59:20 | FromDiscord | <Rika> yeah it seems broken lmao |
| 18:00:15 | FromDiscord | <haxscramper> Most commonly used one is `initT`↵(<@709044657232936960_arkanoid=5b=49=52=43=5d>) |
| 18:00:43 | FromDiscord | <Rika> but there are a few people using init(T) nowadays i think |
| 18:00:50 | FromDiscord | <Rika> (i'm about to move to such) |
| 18:00:51 | FromDiscord | <aleclarson> is `Option` cheaper than a `ref`? |
| 18:00:54 | FromDiscord | <konsumlamm> sent a code paste, see https://play.nim-lang.org/#ix=3sMF |
| 18:00:56 | FromDiscord | <Rika> yes |
| 18:01:08 | FromDiscord | <konsumlamm> it doesn't allocate anything |
| 18:01:31 | FromDiscord | <konsumlamm> it's just an extra `bool` flag in the normal case |
| 18:01:39 | FromDiscord | <aleclarson> why are `Option` properties required to be initialized? i'd expect it to default to `none` |
| 18:01:45 | FromDiscord | <konsumlamm> and if you have some pointer type, it's the exact same layout |
| 18:01:56 | FromDiscord | <haxscramper> Yes, it works better with generics↵(@Rika) |
| 18:01:58 | FromDiscord | <konsumlamm> In reply to @aleclarson "why are `Option` properties": wdym? |
| 18:02:05 | FromDiscord | <haxscramper> Poor man's default initalization support |
| 18:02:13 | FromDiscord | <haxscramper> And we also have `default(T)` and `new(T)` |
| 18:02:26 | FromDiscord | <Rika> overridable inserted default calls when |
| 18:02:28 | FromDiscord | <haxscramper> very consitent |
| 18:03:05 | FromDiscord | <haxscramper> 1.5 RFCs about that |
| 18:03:16 | FromDiscord | <konsumlamm> honestly i feel like most uses of `typedesc` are workarounds for Nim's bad type inference |
| 18:03:35 | FromDiscord | <Rika> it pretty much is |
| 18:03:57 | FromDiscord | <Rika> im pretty sure return type inference would solve a lot (but it prolly adds a fucktonne of complexity so...) |
| 18:04:03 | FromDiscord | <haxscramper> I don't think so, or at least I wound't qualify it as 'bad type inference' |
| 18:04:06 | FromDiscord | <aleclarson> In reply to @konsumlamm "wdym?": https://play.nim-lang.org/#ix=3sMH |
| 18:04:21 | FromDiscord | <aleclarson> `Option` with `not nil` type needs to be initialized |
| 18:04:42 | FromDiscord | <aleclarson> which makes `Option` useless in my case, it seems |
| 18:04:44 | FromDiscord | <haxscramper> Though local HM inference would simply some use cases |
| 18:04:47 | FromDiscord | <haxscramper> Just not that global trash |
| 18:04:53 | FromDiscord | <aleclarson> (edit) "seems" => "seems?" |
| 18:05:18 | FromDiscord | <konsumlamm> In reply to @aleclarson "https://play.nim-lang.org/#ix=3sMH": calling a constructor without initializing all fields isn't a thing, is it? |
| 18:05:34 | FromDiscord | <konsumlamm> anyway, what's the problem with setting it to `none()`? |
| 18:05:44 | FromDiscord | <Rika> In reply to @haxscramper "Just not that global": sorry, idk the diff, what is the diff? |
| 18:06:05 | FromDiscord | <Rika> In reply to @konsumlamm "calling a constructor without": but shouldnt it already default to none? |
| 18:06:30 | FromDiscord | <konsumlamm> idk if that's how constructors are supposed to work |
| 18:06:37 | FromDiscord | <konsumlamm> i always initialize everything anyway |
| 18:09:25 | * | xet7 quit (Remote host closed the connection) |
| 18:34:45 | * | max22- quit (Ping timeout: 276 seconds) |
| 18:52:49 | * | lain quit (Quit: kthxbai) |
| 18:53:30 | * | lain joined #nim |
| 19:01:03 | * | xet7 joined #nim |
| 19:06:31 | * | supakeen quit (Remote host closed the connection) |
| 19:06:55 | * | supakeen joined #nim |
| 19:09:09 | FromDiscord | <System64 ~ Flandre Scarlet> is c2nim a good method for interop? |
| 19:10:09 | * | max22- joined #nim |
| 19:10:33 | FromDiscord | <haxscramper> it is a reasonably good start |
| 19:12:09 | FromDiscord | <System64 ~ Flandre Scarlet> interesting↵'cause I try to inspect where does the crash come from, I'm wondering if there isn't an interop problem |
| 19:13:02 | FromDiscord | <System64 ~ Flandre Scarlet> I did the same program in C, no crash |
| 19:15:25 | FromDiscord | <konsumlamm> maybe your C program silently has UB? |
| 19:15:40 | FromDiscord | <System64 ~ Flandre Scarlet> what does it mean UB? |
| 19:16:12 | FromDiscord | <konsumlamm> undefined behaviour |
| 19:16:55 | FromDiscord | <System64 ~ Flandre Scarlet> and what does it do? |
| 19:19:50 | FromDiscord | <konsumlamm> being undefined |
| 19:20:17 | FromDiscord | <haxscramper> welcome to C |
| 19:20:28 | FromDiscord | <konsumlamm> for example dereferencing an invalid pointer is UB |
| 19:20:47 | FromDiscord | <konsumlamm> and the fun thing about UB is, the program can technically do anything |
| 19:20:58 | FromDiscord | <System64 ~ Flandre Scarlet> OOOOF |
| 19:21:13 | FromDiscord | <System64 ~ Flandre Scarlet> so that means I potentially created a malware?? |
| 19:21:52 | FromDiscord | <konsumlamm> very unlikely |
| 19:22:18 | FromDiscord | <System64 ~ Flandre Scarlet> yeah I overexagerated a bit↵But my program can corrupt a file for exemple? |
| 19:22:27 | FromDiscord | <System64 ~ Flandre Scarlet> or crashing another process? |
| 19:22:43 | FromDiscord | <konsumlamm> if it has UB, in theory, yes, but in practice it probably won't |
| 19:22:59 | FromDiscord | <System64 ~ Flandre Scarlet> if the OS is secure I think it wont |
| 19:23:37 | FromDiscord | <System64 ~ Flandre Scarlet> but Nim stops the program instead of letting UBs? |
| 19:29:12 | FromDiscord | <System64 ~ Flandre Scarlet> and that's why it doesn't crash when I'm in Danger mode? |
| 19:37:01 | FromDiscord | <konsumlamm> your Nim program crashes in debug mode but not in danger mode? |
| 19:37:17 | FromDiscord | <System64 ~ Flandre Scarlet> exactly |
| 19:38:58 | FromDiscord | <konsumlamm> then the danger version probably has UB |
| 19:40:25 | FromDiscord | <System64 ~ Flandre Scarlet> aaaalright!↵But I dunno if the UB comes from SDL2 or Tilengine |
| 19:41:49 | FromDiscord | <System64 ~ Flandre Scarlet> And I put some try except at suspicious places https://media.discordapp.net/attachments/371759389889003532/864230086932824086/message.nim |
| 19:42:57 | FromDiscord | <System64 ~ Flandre Scarlet> even with that it crashes without stacktrace |
| 19:45:06 | FromDiscord | <haxscramper> Run in debugger |
| 19:45:58 | FromDiscord | <System64 ~ Flandre Scarlet> how can I do that? I think it's debug by default |
| 19:46:26 | FromDiscord | <haxscramper> It is build in debug mode, not the same is running in debugger |
| 19:46:52 | FromDiscord | <haxscramper> On Linux you could do `gdb <options> ./program` |
| 19:47:23 | FromDiscord | <haxscramper> I usually do `gdb -batch -ex "run" -ex "bt" ./program` |
| 19:47:27 | FromDiscord | <System64 ~ Flandre Scarlet> I'm on Windows |
| 19:47:31 | FromDiscord | <haxscramper> well, |
| 19:48:30 | FromDiscord | <haxscramper> Maybe vscode can run nim with debugger |
| 19:50:16 | FromDiscord | <System64 ~ Flandre Scarlet> how can I do that? |
| 19:51:36 | FromDiscord | <jfmonty2> quick q: Is there a way to declare that a proc parameter should get the default value for its type if not explicitly specified?↵Like say I have `proc doSomething(a: array[5, int] = [0, 0, 0, 0, 0]) =`, is there a way to avoid writing out the whole array? |
| 19:52:29 | FromDiscord | <haxscramper> `default(<your type>)` |
| 19:52:38 | FromDiscord | <jfmonty2> ah perfect, thanks |
| 19:52:58 | FromDiscord | <haxscramper> We need to add counter for 'how to default init' things |
| 19:53:14 | FromDiscord | <haxscramper> Questions |
| 19:53:21 | FromDiscord | <System64 ~ Flandre Scarlet> ah I have gdb on Windows |
| 19:54:16 | FromDiscord | <System64 ~ Flandre Scarlet> https://media.discordapp.net/attachments/371759389889003532/864233214658740234/unknown.png |
| 19:59:25 | * | vicfred quit (Quit: Leaving) |
| 19:59:47 | FromDiscord | <haxscramper> You are running debug build? |
| 20:01:12 | FromDiscord | <System64 ~ Flandre Scarlet> I do ``nim compile -r myprogram.nim`` so yeah |
| 20:01:17 | * | iortega left #nim ("") |
| 20:01:34 | FromDiscord | <System64 ~ Flandre Scarlet> Since default is debug https://media.discordapp.net/attachments/371759389889003532/864235049397125200/unknown.png |
| 20:07:23 | FromDiscord | <System64 ~ Flandre Scarlet> the only things I understand are Segfault and corrupt stack |
| 20:23:27 | FromDiscord | <System64 ~ Flandre Scarlet> So I have a segfault but where |
| 20:27:52 | FromDiscord | <dom96> @System64 ~ Flandre Scarlet this might help https://nim-lang.org/blog/2017/10/02/documenting-profiling-and-debugging-nim-code.html |
| 20:28:49 | FromDiscord | <PressF> sent a code paste, see https://play.nim-lang.org/#ix=3sNi |
| 20:29:00 | FromDiscord | <PressF> (edit) "https://play.nim-lang.org/#ix=3sNi" => "https://paste.rs/5q3" |
| 20:37:54 | * | neceve quit (Ping timeout: 256 seconds) |
| 20:39:30 | * | LyndsySimon joined #nim |
| 20:39:39 | LyndsySimon | Oh, good. #nim is still alive. |
| 20:40:34 | FromDiscord | <haxscramper> Probably `foldl(1 .. n, a b)`↵(@PressF) |
| 20:41:00 | FromDiscord | <haxscramper> !eval import std/sequtils; echo fold(1 .. 20, a \ b) |
| 20:41:03 | NimBot | Compile failed: /usercode/in.nim(1, 44) Error: invalid token: (\29) |
| 20:41:46 | FromDiscord | <haxscramper> !eval import std/sequtils; echo fold(1 .. 20, a + b) |
| 20:41:50 | NimBot | Compile failed: /usercode/in.nim(1, 27) Error: undeclared identifier: 'fold' |
| 20:41:52 | FromDiscord | <System64 ~ Flandre Scarlet> alright segfault https://media.discordapp.net/attachments/371759389889003532/864245197570703410/unknown.png |
| 20:42:08 | FromDiscord | <System64 ~ Flandre Scarlet> segfault = null pointer right? |
| 20:42:18 | FromDiscord | <haxscramper> Ffs, anyway, we have folds in sequtils |
| 20:47:29 | FromDiscord | <kaushalmodi> !eval import std/sequtils; echo foldl(toSeq(1 .. 20), a b) |
| 20:47:31 | NimBot | Compile failed: /usercode/in.nim(1, 51) Error: invalid token: (\29) |
| 20:48:49 | FromDiscord | <System64 ~ Flandre Scarlet> the only problem I have is it doesn't say where |
| 20:48:51 | * | supakeen quit (Remote host closed the connection) |
| 20:49:15 | * | supakeen joined #nim |
| 20:49:25 | FromDiscord | <kaushalmodi> In reply to @PressF "Is it possible to": well.. in any case `foldl` works on Nim Playground: https://play.nim-lang.org/#ix=3sNv |
| 20:52:42 | FromDiscord | <kaushalmodi> @PressF And here's another approach, without using `sequtils`: https://play.nim-lang.org/#ix=3sNw |
| 20:52:52 | FromDiscord | <haxscramper> Well, time for one true debugging technique then↵(@System64 ~ Flandre Scarlet) |
| 20:53:00 | FromDiscord | <haxscramper> Dump crapload of prints into the code |
| 20:54:51 | FromDiscord | <System64 ~ Flandre Scarlet> In reply to @haxscramper "Dump crapload of prints": so the good old echo method? |
| 20:55:16 | FromDiscord | <haxscramper> https://nim-lang.org/docs/manual.html#implementation-specific-pragmas-injectstmt-pragma |
| 20:55:53 | FromDiscord | <haxscramper> Paired with instantiationInfo().line you can construct a template |
| 20:56:22 | FromDiscord | <System64 ~ Flandre Scarlet> In reply to @haxscramper "Paired with instantiationInfo().line you": for me? |
| 21:00:02 | FromDiscord | <haxscramper> No, seems like this doesn't quite woke as I expected https://play.nim-lang.org/#ix=3sNx |
| 21:00:55 | FromDiscord | <System64 ~ Flandre Scarlet> nothing displayed |
| 21:04:10 | FromDiscord | <haxscramper> https://github.com/nim-lang/Nim/blob/devel/tests/pragmas/tinjectstmt.nim |
| 21:06:47 | FromDiscord | <Ayy Lmao> sent a code paste, see https://play.nim-lang.org/#ix=3sNB |
| 21:10:32 | FromDiscord | <Ayy Lmao> If I tag the MSG struct with `{.importc.}` it seems to work, but is that what I should be doing? |
| 21:13:11 | FromDiscord | <System64 ~ Flandre Scarlet> Humm crashed at the 1865th iteration of my callback https://media.discordapp.net/attachments/371759389889003532/864253076163395594/unknown.png |
| 21:21:39 | FromDiscord | <haxscramper> If you don't tag MSG object nim would of course generate definition for it, and this would be a different type from the compiler perspective↵(@Ayy Lmao) |
| 21:21:59 | FromDiscord | <haxscramper> So you need to importc(pp) thigs |
| 21:23:11 | mst | note also that if in doubt, I've done pretty well via the approach of "make a tiny tiny file that just has the struct and one function and then read the code the nim compiler generates" |
| 21:23:23 | FromDiscord | <haxscramper> Different from the C compiler perspective\ |
| 21:23:24 | mst | I'm not particularly good at C/C++ but I can often figure stuff out from there |
| 21:24:07 | FromDiscord | <Ayy Lmao> In reply to @haxscramper "If you don't tag": I noticed in the generated code when you add `importc` it uses the actual type. So I need to make a windows API wrapper that has all structs with `importc` on them. |
| 21:24:32 | FromDiscord | <Ayy Lmao> Since the wrappers I've found seem to just label them with `{.pure.}` |
| 21:27:18 | FromDiscord | <haxscramper> Is that so? We have two windows API wrappers - they don't use importc? |
| 21:29:20 | FromDiscord | <Ayy Lmao> sent a code paste, see https://play.nim-lang.org/#ix=3sNC |
| 21:30:31 | FromDiscord | <Ayy Lmao> All I see in the Nim lib is `winlean.nim` which doesn't seem to have MSG defined |
| 21:31:27 | FromDiscord | <Ayy Lmao> I don't know my way around Nim that well though so I might be missing something |
| 21:33:01 | FromDiscord | <System64 ~ Flandre Scarlet> why do I have several errors? https://media.discordapp.net/attachments/371759389889003532/864258068584857651/unknown.png |
| 21:33:07 | FromDiscord | <haxscramper> It is quite strange winim uses pure |
| 21:33:18 | FromDiscord | <haxscramper> But you almost always want to use importc (pp) |
| 21:33:47 | * | Vladar quit (Quit: Leaving) |
| 21:33:47 | FromDiscord | <haxscramper> Maybe there is some extreme edge case where pure is needed, but I'm not aware of it |
| 21:36:13 | FromDiscord | <Ayy Lmao> I don't even know what pure does in the context of an object. It doesn't work in my case though whatever it does |
| 21:54:58 | FromDiscord | <Ayy Lmao> sent a code paste, see https://play.nim-lang.org/#ix=3sNI |
| 22:15:25 | * | max22- quit (Quit: Leaving) |
| 22:35:05 | * | mahlon joined #nim |
| 22:56:19 | FromDiscord | <theangryepicbanana> huh, found a thingy for interfaces <https://github.com/zielmicha/collections.nim/blob/master/collections/iface.nim> |
| 23:23:25 | FromDiscord | <Ayy Lmao> How do you link the windows API with `--cc:vcc`? I'm getting linker errors while using it and no errors when I don't |
| 23:33:49 | FromDiscord | <demotomohiro> --passL:"kernel32.lib"? |
| 23:40:11 | * | rockcavera quit (Remote host closed the connection) |
| 23:40:20 | FromDiscord | <Ayy Lmao> --passL:"user32.lib" seems to work for me |