00:03:41 | FromDiscord | <Ayy Lmao> I seem to be having an issue with FFI with c++ in general actually. Is there no way to link against a cpp file without having a .h file? |
00:05:58 | FromDiscord | <Ayy Lmao> sent a code paste, see https://play.nim-lang.org/#ix=3vHN |
00:19:56 | FromDiscord | <undersquire> your changing the {.compile: "somelib/somelib.cpp".} right? |
00:20:08 | FromDiscord | <undersquire> as well as the file itself name from somelib.c to somelib.cpp |
00:21:02 | FromDiscord | <Ayy Lmao> @undersquire yes |
00:23:46 | FromDiscord | <Ayy Lmao> If I leave it as `importc` the compiler gives me linker errors, and if i change it to `proc plus(vec: Vector2): cint {.importcpp: "plus(@)", cdecl.}` it doesn't generate a declaration, I'm assuming because it thinks the function is a method. |
00:40:13 | * | arkurious quit (Quit: Leaving) |
00:42:02 | FromDiscord | <Ayy Lmao> I'm guessing this has to do with name mangling in the compiler. |
01:04:56 | FromDiscord | <Ayy Lmao> Is there a way to tell `importcpp` to generate a forward declaration for a proc? Or a way to get `importc` to obey cpp name mangling? |
01:29:08 | * | Pyautogui joined #nim |
01:30:57 | FromDiscord | <treeform> have you tried `nim cpp` instead of `nim c`? |
01:31:15 | FromDiscord | <treeform> Then nim would generate C++ code that should work with your other C++ code. |
01:36:43 | FromDiscord | <Ayy Lmao> In reply to @treeform "have you tried `nim": I have, it doesn't seem to help. |
01:36:49 | FromDiscord | <Jakraes> Is there a way to completely delete a variable from memory manually? |
01:36:50 | FromDiscord | <treeform> ok |
01:40:09 | FromDiscord | <Elegantbeef> What do you mean by delete from memory?↵(@Jakraes) |
01:41:01 | FromDiscord | <Jakraes> Like, delete a huge var from the ram |
01:41:25 | FromDiscord | <Jakraes> Pretty much manual garbage collection |
01:42:06 | FromDiscord | <Elegantbeef> Well you can just set it to nil if it's a reference type, otherwise it'll be freed when it leaves the stack |
01:44:27 | FromDiscord | <Jakraes> Nice, I was curious about manual garbage collection in nim, so that's always nice to learn, thank you! |
01:44:42 | * | Pyautogui quit (Ping timeout: 245 seconds) |
01:45:11 | FromDiscord | <Elegantbeef> Well if it's a pointer you need to manually free using `dealloc` |
02:12:25 | FromDiscord | <Rika> unless it is not a pointer you allocated |
02:57:58 | FromDiscord | <lamersc.com 🐧> Curious if anyone knows why zig has more traction than nim, even though it hasn’t reached its 1.0 yet, unless it’s other factors also playing in I’m not aware of |
02:58:11 | FromDiscord | <lamersc.com 🐧> Just been curious while looking into a few languages |
03:10:39 | FromDiscord | <Nim 👺> Idk how to code I’m just here cuz my name’s Nim :sunglas: |
03:10:59 | FromDiscord | <Elegantbeef> Well the act of not coding is the first step to learning to code |
03:11:51 | FromDiscord | <Nim 👺> Words of wisdom |
03:15:37 | FromDiscord | <undersquire> In reply to @Rika "unless it is not": If there is no GC present you must regardless, but I see no reason to not at least use --gc:arc |
03:15:57 | FromDiscord | <undersquire> I just like the fact that the stdlib has memory leaks if you dont use a GC 😂 |
03:16:27 | FromDiscord | <Elegantbeef> Atleast it tells you |
03:17:49 | FromDiscord | <codic> if you are using the stdlib memory is still being allocated its just that a function is doing it for you |
03:18:49 | FromDiscord | <Elegantbeef> Would be nice if strings had a dealloc proc |
03:34:18 | FromDiscord | <Rika> In reply to @undersquire "If there is no": Yes but not via the deallocation procs provided by Nim |
03:47:05 | * | rockcavera quit (Remote host closed the connection) |
03:47:10 | FromDiscord | <lamersc.com 🐧> In reply to @Nim 👺 "Idk how to code": Perfect start on your programming journey 😉 |
03:47:19 | FromDiscord | <Nim 👺> Awesome |
03:47:39 | FromDiscord | <Nim 👺> Might learn just for shits and giggles |
03:48:07 | FromDiscord | <lamersc.com 🐧> I think you’d enjoy it, the language is quite friendly to use |
03:48:15 | FromDiscord | <Nim 👺> Awesome |
03:48:48 | FromDiscord | <Nim 👺> Ig it would be useful to learn some type of code |
04:02:57 | * | flynn quit (Read error: Connection reset by peer) |
04:04:04 | * | flynn joined #nim |
04:06:02 | * | supakeen quit (Quit: WeeChat 3.2) |
04:06:33 | * | supakeen joined #nim |
04:31:59 | FromDiscord | <InventorMatt> Learning to code is useful even if you don't want to be a programmer. It can really augment a lot of things |
04:33:25 | FromDiscord | <Elegantbeef> Very good for automating tasks |
04:41:34 | FromDiscord | <codic> Das ist ja mal ein lebhafter Channel ^^ |
05:25:43 | FromDiscord | <undersquire> what is the purpose of the export keyword in nim? |
05:26:10 | FromDiscord | <undersquire> can it be used to create like a prelude for a librarY? |
05:26:12 | FromDiscord | <undersquire> (edit) "librarY?" => "library?" |
05:29:25 | FromDiscord | <Elegantbeef> export is to export specific things such as an imported type or a module |
05:29:55 | FromDiscord | <undersquire> so u can do like |
05:30:33 | FromDiscord | <Elegantbeef> sent a code paste, see https://play.nim-lang.org/#ix=3vIB |
05:31:23 | FromDiscord | <undersquire> sent a code paste, see https://play.nim-lang.org/#ix=3vIC |
05:32:05 | FromDiscord | <Elegantbeef> yes |
05:32:11 | FromDiscord | <undersquire> ok thats pretty nice |
05:32:17 | FromDiscord | <Elegantbeef> alternatively `export entity, scene` |
05:32:28 | FromDiscord | <undersquire> ah ok i meant to do that 😉 |
05:32:57 | FromDiscord | <undersquire> sent a code paste, see https://play.nim-lang.org/#ix=3vID |
05:33:15 | FromDiscord | <undersquire> sent a code paste, see https://play.nim-lang.org/#ix=3vIE |
05:33:18 | FromDiscord | <Elegantbeef> Indeed |
05:33:32 | FromDiscord | <undersquire> and is the static keyword just for compile time scripts? |
05:33:39 | FromDiscord | <undersquire> or can it be used for variables? |
05:33:59 | FromDiscord | <undersquire> i see its used in macros but im not sure what it really does there |
05:34:01 | FromDiscord | <Elegantbeef> It can be used for compile time logic that is stored to consts or as a generic type |
05:34:11 | FromDiscord | <undersquire> a hok |
05:34:46 | FromDiscord | <Elegantbeef> Like `proc someThing(v: static bool)` is a generic that is instantiated based off the value passed |
05:34:54 | FromDiscord | <Clonkk> The equivalent of C `static` variable in Nim is the global pragma↵(@undersquire) |
05:35:06 | FromDiscord | <Elegantbeef> So in this case it can generate max 2 procedures |
05:35:07 | FromDiscord | <undersquire> In reply to @Clonkk "The equivalent of C": yeah ik about that |
05:35:43 | FromDiscord | <undersquire> In reply to @Elegantbeef "Like `proc someThing(v: static": wait so how does this differ from just a bool type parameter |
05:36:05 | FromDiscord | <Elegantbeef> It generates a procedure for each value given at compile time so you can do specific logic `when v` |
05:36:08 | FromDiscord | <undersquire> does it affect overloading? or the actual procedure |
05:36:21 | FromDiscord | <undersquire> In reply to @Elegantbeef "It generates a procedure": ah ok |
05:37:57 | FromDiscord | <Elegantbeef> sent a code paste, see https://play.nim-lang.org/#ix=3vIG |
05:38:09 | FromDiscord | <undersquire> Oh i see |
05:38:40 | FromDiscord | <undersquire> so using static basically means the parameter must be a literal? (or some value that can be determined at compiel time) |
05:39:00 | FromDiscord | <Elegantbeef> Yea it's a compile time value |
05:39:07 | FromDiscord | <undersquire> oh nice thats pretty useful |
05:39:07 | FromDiscord | <Elegantbeef> that's what `static` means in nim |
05:39:10 | FromDiscord | <undersquire> yeah |
06:11:00 | FromDiscord | <Cark> question : how come i can call params.len without parenthesis, but i have to put parenthesis for initTable[A,B]() ? |
06:11:11 | FromDiscord | <Cark> maybe is it bad form to call len without these ? |
06:11:29 | FromDiscord | <Elegantbeef> Nah it's actually pretty idiomatic, it's due to not having the first parameter |
06:11:50 | FromDiscord | <undersquire> you cannot call a proc by itself without () unless you have at least a parameter |
06:12:04 | FromDiscord | <Cark> ah ok i see ! |
06:12:04 | FromDiscord | <Elegantbeef> Procedures without parameters need `()` otherwise you're retrieving the procedure pointer |
06:12:22 | FromDiscord | <undersquire> sent a code paste, see https://play.nim-lang.org/#ix=3vIM |
06:12:24 | FromDiscord | <Elegantbeef> to expand on the above `let a = print1` is valid |
06:12:29 | FromDiscord | <Cark> in params.len , params is the parameter |
06:12:38 | FromDiscord | <undersquire> ye |
06:12:47 | FromDiscord | <Cark> bad choice for an example =) |
06:12:49 | FromDiscord | <Cark> ok thanks ! |
06:12:55 | FromDiscord | <Elegantbeef> yes, though you can also drop the `()` for command syntax `echo 1` for instance |
06:13:01 | FromDiscord | <undersquire> u can also do len params, len(params) |
06:13:13 | FromDiscord | <undersquire> i really love the way nim does that 😂 |
06:13:33 | FromDiscord | <Elegantbeef> Command syntax has the rule that using it inside another statement means you can only have 1 parameter passed that way |
06:14:01 | FromDiscord | <Elegantbeef> so like `doThing 1, 2.doThing 20, 40` is `doThing(1, doThing(2, 20), 40)` |
06:14:32 | FromDiscord | <Cark> i gave it a try, but i think i'll won't go further than the dot sugar in my own code |
06:14:50 | FromDiscord | <Cark> it becomes somewhat harder to follow otherwise |
06:14:56 | FromDiscord | <Paupi woodberg> sent a code paste, see https://play.nim-lang.org/#ix=3vIN |
06:15:04 | * | Vladar joined #nim |
06:15:25 | FromDiscord | <Elegantbeef> Depends on what the procedures are and how you're using them, i often remove `()` when doing changed procedures |
06:15:28 | FromDiscord | <undersquire> In reply to @Paupi woodberg "I don't think these": ? |
06:16:27 | FromDiscord | <Elegantbeef> No paupi the above code is right |
06:16:30 | FromDiscord | <Elegantbeef> Well right for the example |
06:16:52 | FromDiscord | <Cark> another question : does anyone use emacs at all with nim ? i got lsp working somewhat but it often breaks, with nim specifically, got it working very well with clang |
06:17:39 | FromDiscord | <Elegantbeef> Some people use emacs with it, but i do not so cannot give any guidance \:D |
06:17:59 | FromDiscord | <Cark> you already helped, so we'll let it slide =) |
06:17:59 | FromDiscord | <undersquire> In reply to @Elegantbeef "Some people use emacs": waht editor do you use? |
06:18:12 | FromDiscord | <Elegantbeef> I use vscodium |
06:18:20 | FromDiscord | <undersquire> oh nice same |
06:18:28 | FromDiscord | <Elegantbeef> I'm a heathen i know, though onivim2 was looking good 😛 |
06:18:45 | FromDiscord | <undersquire> which nim extension do you use, cause there are like 4 of them |
06:18:52 | FromDiscord | <Elegantbeef> nimsaem's |
06:18:54 | FromDiscord | <undersquire> im using the one written in nim |
06:19:00 | FromDiscord | <Elegantbeef> yea that's it |
06:19:01 | FromDiscord | <undersquire> yeah |
06:19:06 | FromDiscord | <undersquire> i think its the only actively developed one |
06:19:15 | FromDiscord | <undersquire> the original one hasnt updated since 2020 |
06:19:37 | FromDiscord | <Paupi woodberg> In reply to @undersquire "?": Am sorry man am new to Nim I was kinda writing in another language! |
06:19:49 | FromDiscord | <undersquire> lol its fine |
06:20:08 | FromDiscord | <Paupi woodberg> In reply to @undersquire "lol its fine": Thanks! |
06:20:14 | FromDiscord | <undersquire> 👍 |
06:20:54 | FromDiscord | <Paupi woodberg> Where did y'all learn Nim cause for a new language y'all seem to know it pretty much! |
06:21:13 | FromDiscord | <Elegantbeef> Manual, here, using it, it's not that new 😀 |
06:21:14 | FromDiscord | <undersquire> I just starting using it a little over a week ago |
06:21:22 | FromDiscord | <undersquire> I just learned it from the docs |
06:21:41 | FromDiscord | <undersquire> In reply to @Elegantbeef "Manual, here, using it,": how long have you been using nim? |
06:22:49 | FromDiscord | <Elegantbeef> I first toyed with it on it's 1.0(2019) release since i was wanting to try something lower than rust, but then in early 2020 i started learning/using it semi seriously |
06:24:00 | FromDiscord | <Rika> Hey that means I’ve been using it for longer than beef |
06:24:22 | FromDiscord | <Elegantbeef> Congrats?! |
06:25:02 | FromDiscord | <Elegantbeef> should be lower than C#, like rust. But whatever bridge sucks |
06:25:18 | FromDiscord | <Paupi woodberg> In reply to @undersquire "how long have you": I needed a scripting Language for some bug testing so I needed a language that not many crackers would no about there I found Nim! |
06:25:47 | FromDiscord | <Elegantbeef> Nim isnt a scripting language |
06:26:04 | FromDiscord | <undersquire> lol |
06:26:05 | FromDiscord | <undersquire> well |
06:26:09 | FromDiscord | <undersquire> nimscript is |
06:26:12 | FromDiscord | <undersquire> 😉 |
06:26:18 | FromDiscord | <Elegantbeef> lol |
06:26:59 | FromDiscord | <Paupi woodberg> O!↵Anyway I guess am doing Nim now😹 |
06:27:08 | FromDiscord | <Paupi woodberg> O Thanks |
06:27:45 | FromDiscord | <undersquire> nim is my favorite C alternative, and I might move to it fully permenantly |
06:27:56 | FromDiscord | <undersquire> I tried zig and rust and neither really appealed to me |
06:28:13 | FromDiscord | <Elegantbeef> Someone somewhere a person is saying "Nim isnt a C alternative cause of X" |
06:28:41 | FromDiscord | <Cark> aren't we headed for a more rust like situation with orc ? |
06:29:01 | FromDiscord | <Cark> or you know unique_ptr headache |
06:29:06 | FromDiscord | <Elegantbeef> Well without the always in your face borrow checker |
06:29:36 | FromDiscord | <Elegantbeef> Though nim does have a borrow checker in experimental |
06:29:48 | FromDiscord | <Cark> i would argue that the borrow checker actually helps if you go that direction, which i don't personally like |
06:30:22 | FromDiscord | <Elegantbeef> Well we get a memory management that's based on move semantics without the headaches thanks to the compiler copying when it makes sense |
06:31:03 | FromDiscord | <undersquire> In reply to @Elegantbeef "Someone somewhere a person": lol |
06:31:21 | FromDiscord | <Paupi woodberg> In reply to @undersquire "nim is my favorite": I kinda find it difficult to learn using docs so I kinda only use solo learn and Google product |
06:31:35 | FromDiscord | <Paupi woodberg> And sadly Nim isn't available! |
06:31:53 | FromDiscord | <Paupi woodberg> I guess I'll start off learning c |
06:32:04 | FromDiscord | <Cark> it's a good place to start |
06:32:56 | FromDiscord | <Elegantbeef> Nim is on excercism.io |
06:32:57 | FromDiscord | <Cark> simple and just annoying enough to understand why you want better |
06:33:27 | FromDiscord | <Elegantbeef> Could also learn pascal and have an easier transition to Nim if it's your end goal, but knowing C helps anyway |
06:33:37 | FromDiscord | <Elegantbeef> Especially if you want to use libraries that already exist |
06:35:08 | FromDiscord | <Paupi woodberg> In reply to @Elegantbeef "*Could also learn pascal": Pascal isn't really on solo learn ↵So I'll look into it a bit |
06:36:18 | FromDiscord | <Elegantbeef> It's an older language with shared stuff with Nim so it'd make it easier to get into Nim, but C is probably more sensible due to a high chance of actively needing it eventually |
06:36:46 | FromDiscord | <Paupi woodberg> https://media.discordapp.net/attachments/371759389889003532/875266538335240222/Screenshot_20210812-073629.png |
06:36:46 | FromDiscord | <Paupi woodberg> Doing some research |
06:36:49 | FromDiscord | <Elegantbeef> Be it integrating with a C library or getting Nim to build in an odd environment the need to understand C appears occasionally |
06:38:02 | FromDiscord | <Rika> In reply to @Elegantbeef "Someone somewhere a person": Well technically everything is a C alternative if you squeeze in enough reasons |
06:38:53 | FromDiscord | <Elegantbeef> If you cannot reason it yet grab a shoe horn and push more in |
06:41:06 | FromDiscord | <Rika> I’ve been thinking about this for a few days but I wonder what programming languages would have been like if Pascal was the bigger language versus C |
06:42:07 | FromDiscord | <Elegantbeef> Wirth likes with people on C/C++ style languages in the minority |
06:42:34 | FromDiscord | <Elegantbeef> More languages with sensible bitsets, and fancier type systems |
06:42:46 | FromDiscord | <Rika> I’m sorry but that first message doesn’t read like English to me |
06:43:06 | FromDiscord | <Elegantbeef> There'd be more withlikes, with people on C/C++ in the minority\ |
06:43:11 | FromDiscord | <leorize> i'd not recommend learning pascal aa transition to nim |
06:43:14 | FromDiscord | <leorize> as\ |
07:21:20 | FromDiscord | <Clonkk> In reply to @Paupi woodberg "Where did y'all learn": Best way to learn is to practice. Either do a small project with the language (and yeah the beginning will be a bit rough, you'll have to read the manual / tutorial constantly) or yo ucan go to exercism.io where coding practice are available |
07:23:55 | FromDiscord | <Clonkk> sent a long message, see http://ix.io/3vIX |
07:41:05 | * | PMunch joined #nim |
07:53:46 | FromDiscord | <Paupi woodberg> Thanks man! |
07:53:52 | FromDiscord | <Paupi woodberg> Ial use them! |
08:03:13 | PMunch | @Cark, NimLSP does unfortunately break a bit on every platform.. Please report specific bugs if you find them. I'm working on creating a better tool for testing and debugging LSP stuff so it will be easier to develop it. |
08:03:59 | FromDiscord | <Cark> i'd love to help, though it's pretty hard pinpointing the actual bug |
08:04:33 | FromDiscord | <Cark> also, maybe lsp-mode is the cause, or interoperate poorly with nimlsp specifically |
08:04:39 | FromDiscord | <Cark> (edit) "interoperate" => "interoperates" |
08:05:23 | FromDiscord | <Cark> couple years ago i resorted to use VSCode because of this, and it worked great there |
08:06:27 | PMunch | You could build a debug build of NimLSP and run that while triggering the bug. It's a bit slower, but it logs a lot more and shows better errors in the log. |
08:07:00 | FromDiscord | <Cark> i'll investigate, and thanks for your work btw =) |
08:10:46 | PMunch | Simultaneously happy that a lot of people use NimLSP, but also a bit sad about how much of a mess it is :P |
08:12:38 | FromDiscord | <Cark> we would all be out of work if everything came out perfect on the first try =) |
08:32:17 | PMunch | Fair point |
08:37:48 | FromDiscord | <gogolxdong (liuxiaodong)> https://chialisp.com/ |
08:38:03 | * | max22- joined #nim |
09:27:51 | FromDiscord | <bolino> Hi! Is there any way to convert a sequence of strings to `varargs`, as I need to pass them as arguments of a function that accept `varargs`? |
09:28:10 | FromDiscord | <Elegantbeef> varargs accepts seqs |
09:28:14 | FromDiscord | <fwsgonzo> what's the best way to take in a buffer, length from a C function? |
09:28:20 | FromDiscord | <fwsgonzo> that is, I'm going to call a Nim function from C |
09:28:48 | FromDiscord | <fwsgonzo> sent a code paste, see https://play.nim-lang.org/#ix=3vJj |
09:28:55 | FromDiscord | <Elegantbeef> `ptr[UnCheckedArray[T]], len`? |
09:29:24 | FromDiscord | <fwsgonzo> well, in C you can specify the length of the array with another argument, like size_t len, char array[len] |
09:30:28 | FromDiscord | <fwsgonzo> so, I probably want a trampoline function that takes these arguments from C and converts them to something that is checked, then call the "real" Nim function afterwards |
09:38:34 | FromDiscord | <fwsgonzo> so, given a cstring, int what is the best Nim type I should convert that to? |
09:38:46 | FromDiscord | <fwsgonzo> some kind of bounds-checked slice type? |
09:45:53 | FromDiscord | <Rika> A string? Are you avoiding a copy |
09:46:18 | FromDiscord | <Rika> If you are then I think a custom data type would be needed I think |
09:57:06 | FromDiscord | <fwsgonzo> I want to implement a function that matches a prototype, is that possible? |
09:57:44 | FromDiscord | <fwsgonzo> sent a code paste, see https://play.nim-lang.org/#ix=3vJo |
10:00:31 | FromDiscord | <Rika> Just make a function that does? If it doesn’t the code will not compile |
10:00:44 | FromDiscord | <fwsgonzo> it will compile just fine because this function is called from C |
10:01:08 | FromDiscord | <fwsgonzo> (edit) "it will compile just fine because this function is called ... from" added "indirectly" |
10:01:11 | FromDiscord | <Rika> No? It’s a type, if Nim sees it’s the wrong type it won’t compile |
10:01:28 | FromDiscord | <fwsgonzo> sent a code paste, see https://play.nim-lang.org/#ix=3vJr |
10:01:44 | FromDiscord | <fwsgonzo> the function is callback, which is provided from C by externing it |
10:02:08 | FromDiscord | <fwsgonzo> Nim ends up calling it, but doesn't really know about it |
10:02:49 | FromDiscord | <Rika> Oh so the callback is from C |
10:03:03 | FromDiscord | <fwsgonzo> this is for edge compute (i've done it in many other languages), so I am effectively making a remote function call into Nim code |
10:03:10 | FromDiscord | <Rika> Or what? I don’t exactly understand |
10:03:26 | FromDiscord | <fwsgonzo> sent a code paste, see https://play.nim-lang.org/#ix=3vJs |
10:04:01 | FromDiscord | <fwsgonzo> that's the entry point, it calls the trampoline with "post_backend" as the Nim handling function - Ḯm sure it can be done a better way, but I'm not much of a Nim expert 🙂 |
10:04:35 | FromDiscord | <fwsgonzo> the trampoline converts things (inefficiently) into strings, and then calls the Nim post handler, which is what the user sees, and that handler must return a pair of strings, so it's a question of how to enforce that |
10:04:40 | FromDiscord | <bolino> In reply to @Elegantbeef "varargs accepts seqs": Oh great |
10:04:56 | FromDiscord | <bolino> (edit) "great" => "great, didn't know. Thanks for quick and efficient answer, as usual!" |
10:05:17 | FromDiscord | <fwsgonzo> sent a code paste, see https://play.nim-lang.org/#ix=3vJt |
10:05:53 | FromDiscord | <fwsgonzo> maybe the other way around is better where the user must set a handler function by calling a function that takes the callback type as argument |
10:05:56 | FromDiscord | <Rika> Nah I don’t think you can check the type of C stuff from Nim |
10:15:11 | * | xet7 joined #nim |
10:48:19 | * | xet7 quit (Remote host closed the connection) |
10:49:02 | * | Vladar quit (Quit: Leaving) |
10:52:18 | * | Vladar joined #nim |
11:05:24 | * | Pyautogui joined #nim |
11:12:01 | * | Pyautogui quit (Ping timeout: 248 seconds) |
11:35:12 | * | ethycol joined #nim |
11:38:18 | * | ethycol quit (Remote host closed the connection) |
12:06:02 | * | supakeen quit (Quit: WeeChat 3.2) |
12:06:32 | * | supakeen joined #nim |
12:09:42 | * | max22- quit (Ping timeout: 245 seconds) |
12:50:38 | * | arkurious joined #nim |
13:11:34 | * | max22- joined #nim |
14:27:22 | * | PMunch quit (Quit: Leaving) |
14:35:36 | FromDiscord | <Ayy Lmao> Is there a way to get `importc` to use just `extern` and not `extern "C"` for the function prototype? |
14:42:15 | FromDiscord | <levovix> importcpp? |
14:43:02 | FromDiscord | <Ayy Lmao> In reply to @levovix "importcpp?": I've tried, it doesn't seem to generate a function prototype. |
14:43:38 | FromDiscord | <levovix> codegenDecl? |
14:45:23 | FromDiscord | <Ayy Lmao> That would probably work but would be a huge hassle to pull off for all the functions I have. Is there no other way? |
15:48:21 | * | stkrdknmibalz quit (Quit: WeeChat 3.0.1) |
16:12:32 | FromDiscord | <haxscramper> Does anyone know if it is possible to access `attribute((visibility("default")))` symbol from a shared library? This is not strictly a nim question, but I want to pull in gcc's profiling info out at runtime to maybe integrate profiling and unit tests somehow. Data is stored in the https://code.woboq.org/userspace/glibc/gmon/gmon.c.html#bb_head hidden global variable in GCC, so I can't just `dlsym` it |
16:12:54 | FromDiscord | <tbrekalo> How can I change nible dstBuildDir for tests? |
16:13:05 | FromDiscord | <haxscramper> Or maybe nim has a built-in support for dealing with that kind of things |
16:30:00 | FromDiscord | <System64 ~ Flandre Scarlet> Do you think my binding is good?↵https://github.com/megamarc/Tilengine/blob/master/include/Tilengine.h↵This is the include file https://media.discordapp.net/attachments/371759389889003532/875415832514166804/tilengine.nim |
16:30:29 | FromDiscord | <System64 ~ Flandre Scarlet> (edit) "Do you think my binding is good?↵https://github.com/megamarc/Tilengine/blob/master/include/Tilengine.h↵This is the include file ... https://media.discordapp.net/attachments/371759389889003532/875415832514166804/tilengine.nim" added "⬆️" |
16:32:26 | FromDiscord | <haxscramper> define "good" |
16:33:05 | FromDiscord | <haxscramper> If it doesn't error at compile/ library load time then it is probably doing everything correctly |
16:33:27 | FromDiscord | <haxscramper> If you are still looking for something where error occurs I sugest you to compare generated C code to handwritten |
16:33:33 | FromDiscord | <System64 ~ Flandre Scarlet> so if it do everything correctly, it shouldn't crash but it crash |
16:33:59 | FromDiscord | <haxscramper> have you run debugger, checked for error codes, checked for generated C code? |
16:34:17 | FromDiscord | <haxscramper> Are you sure the nim version is 1:1 mapping |
16:35:05 | FromDiscord | <System64 ~ Flandre Scarlet> it's normally 1:1 mapping↵And also, the crash only occurs when I have an audio callback + Tilengine's Raster Callback |
16:35:42 | FromDiscord | <System64 ~ Flandre Scarlet> I also tried the callbacks with only an echo statement inside, still crash |
16:39:18 | FromDiscord | <System64 ~ Flandre Scarlet> Alright the app completely freeze with the Frame Callback (not the raster one) |
16:40:20 | FromDiscord | <System64 ~ Flandre Scarlet> Just have the sound |
16:49:21 | FromDiscord | <enthus1ast> can i let the compiler know that it needs to recompile a certain module (withouth -f)?↵When i change a compiled template file, which is staticRead then it does not catch the changes, and does not recompile. |
16:50:13 | FromDiscord | <enthus1ast> only -f compiles it then, but all the other stuff as well |
16:52:28 | FromDiscord | <enthus1ast> something like a "customMustRecompileProc" |
16:58:06 | FromDiscord | <haxscramper> I don't think there is any per-module recompilation enforcing. At least looking at the conditions for recompilation - https://github.com/nim-lang/Nim/blob/devel/compiler/cgen.nim#L1940 and https://github.com/nim-lang/Nim/blob/devel/compiler/passes.nim#L110 |
16:58:54 | FromDiscord | <haxscramper> And nim recompiles everything if even one module has changed |
16:59:07 | FromDiscord | <haxscramper> Nim recompiles all nim modules if one has changed |
16:59:18 | FromDiscord | <haxscramper> C files are not recompiled on each run |
16:59:21 | FromDiscord | <haxscramper> At least not all of them |
16:59:43 | FromDiscord | <enthus1ast> mh i see |
17:00:44 | FromDiscord | <enthus1ast> then i guess i should look into useing the compiler as a library |
17:01:15 | * | xet7 joined #nim |
17:11:25 | FromDiscord | <haxscramper> You are working on https://github.com/enthus1ast/nimja |
17:11:26 | FromDiscord | <haxscramper> ? |
17:11:27 | nrds | <prestigebot99> itHub: 7"typed and compiled template engine inspired by jinja2, twig and onionhammer/nim-templates for Nim." |
17:11:44 | FromDiscord | <haxscramper> I would literally die if it worked with nimscript |
17:11:50 | FromDiscord | <haxscramper> Or rather I would use it for haxdoc |
17:12:11 | FromDiscord | <haxscramper> So yes, if you need any help with compiler API I would be glad go help |
17:14:04 | FromDiscord | <haxscramper> I myself considered writing jinja template, though I was leaning more towards adding custom embedded scripting language for that one↵(@haxscramper) |
17:15:13 | FromDiscord | <haxscramper> sent a code paste, see https://play.nim-lang.org/#ix=3vLq |
17:15:28 | FromDiscord | <haxscramper> so compiler API is a right way to go IMO |
17:15:37 | * | rockcavera joined #nim |
17:15:37 | * | rockcavera quit (Changing host) |
17:15:37 | * | rockcavera joined #nim |
17:21:47 | * | xet7 quit (Ping timeout: 245 seconds) |
17:22:44 | FromDiscord | <System64 ~ Flandre Scarlet> In reply to @haxscramper "Are you sure the": It freezes with the other callback, (freeze, not crash)↵I know an infinite loop can be the issue, but is it possible there are other things that can bring a freeze? |
17:30:17 | FromDiscord | <haxscramper> `sleep(high(int))` |
17:32:17 | FromDiscord | <System64 ~ Flandre Scarlet> I don't have that |
17:36:57 | FromDiscord | <haxscramper> sent a long message, see http://ix.io/3vLw |
17:39:16 | FromDiscord | <System64 ~ Flandre Scarlet> the thing is this code interacts with a library |
17:40:47 | FromDiscord | <haxscramper> Does C version that interacts with a library work fine? |
17:41:55 | FromDiscord | <System64 ~ Flandre Scarlet> But Tilengine IS the library |
17:43:23 | FromDiscord | <haxscramper> If I recall correctly, you have a C code that you first tried implementing things in, and it works fine. Then you tried to write the same in nim, and this version freezes randomly, and you are not sure what is the problem. Is my inderstanding correct? |
17:45:49 | FromDiscord | <System64 ~ Flandre Scarlet> yeah, freeze with the Framecallback (music still play) and CRASH with Raster Callback (the program close, music included) |
17:46:16 | FromDiscord | <haxscramper> so you do have working C code that you wrote yourself/copied from somewhere? |
17:47:43 | FromDiscord | <System64 ~ Flandre Scarlet> Coded myself |
17:48:53 | FromDiscord | <haxscramper> Which means you have a working C code, and non-working nim code, that use the same library. And my suggestion - look at the generated C code to figure out what is different. You can compile with `--nimcache:myDir`, and `--stracktrace:off --lineinfos:off --embedsrc:off` to reduce noise in the generated code |
17:48:59 | FromDiscord | <System64 ~ Flandre Scarlet> This is my C code https://media.discordapp.net/attachments/371759389889003532/875435712365875220/main.c |
17:50:37 | FromDiscord | <haxscramper> Well, ~70 lines, it should not be particularly hard to minimize nim vesion and compare implementations |
17:51:29 | FromDiscord | <haxscramper> You can start safely and declare callbacks as regular, `exportc, cdecl` procedures, which would make them pretty much identical to how you pass thigns from C |
18:00:28 | * | xet7 joined #nim |
18:11:24 | FromDiscord | <System64 ~ Flandre Scarlet> sent a code paste, see https://play.nim-lang.org/#ix=3vLG |
18:14:51 | FromDiscord | <haxscramper> well, now compare generated C code |
18:15:08 | FromDiscord | <System64 ~ Flandre Scarlet> where can I find it? |
18:17:12 | FromDiscord | <haxscramper> In reply to @haxscramper "Which means you have": You can specify `--nimcache:myDir` and it would output code there |
18:20:40 | FromDiscord | <System64 ~ Flandre Scarlet> sent a code paste, see https://play.nim-lang.org/#ix=3vLN |
18:21:40 | FromDiscord | <haxscramper> What do you mean "doesn't output". No directory is created? |
18:22:00 | FromDiscord | <ynfle (ynfle)> Is it possible to iterate over the fields of 3 tuples at once or to access the third tuple with the name of the desired field? |
18:22:22 | FromDiscord | <System64 ~ Flandre Scarlet> I created the dir, but nothing inside the dir |
18:22:36 | FromDiscord | <ynfle (ynfle)> @system64, You have to put `--nimcache:"./cache"` before the file name or nim thinks it's supposed to by passed in as arguments at runtime |
18:23:06 | FromDiscord | <haxscramper> Not using built-in iterators such as `fieldPairs`. |
18:23:30 | FromDiscord | <ynfle (ynfle)> They are all the same type |
18:23:33 | FromDiscord | <ynfle (ynfle)> Any suggestions? |
18:24:34 | FromDiscord | <haxscramper> What exactly do you mean by field of 3 tuples ... like `field: (int, int, int)`, or what |
18:25:14 | FromDiscord | <ynfle (ynfle)> No |
18:25:20 | FromDiscord | <ynfle (ynfle)> (a\: 1, b\: 2) |
18:25:56 | FromDiscord | <System64 ~ Flandre Scarlet> This is the generated code https://media.discordapp.net/attachments/371759389889003532/875445010978463784/output.c |
18:25:56 | FromDiscord | <haxscramper> so you have three tuples with fields `(a: 1, b: 2)` and you want to iterate in paralel? |
18:26:54 | FromDiscord | <ynfle (ynfle)> Yup |
18:27:12 | FromDiscord | <ynfle (ynfle)> I did it when nested loops and `when` statements because it's unrolled and compile time |
18:28:07 | FromDiscord | <haxscramper> In reply to @System64 "This is the generated": great, now actually do it with ` --stacktrace:off --linetrace:off --embedsrc:off ` so it wold be clean |
18:28:58 | FromDiscord | <haxscramper> yes, that is the only way basically. You can write macro for that, but `fieldPairs` does not support three elements in paralel |
18:29:13 | FromDiscord | <haxscramper> And internally `fieldPairs` does the same unrolling |
18:29:24 | FromDiscord | <System64 ~ Flandre Scarlet> > --stacktrace:off --linetrace:off --embedsrc:off↵What does it do? |
18:29:31 | FromDiscord | <haxscramper> `nim --fullhelp` |
18:29:32 | FromDiscord | <haxscramper> read docs |
18:29:35 | FromDiscord | <ynfle (ynfle)> Don't really need a macro, it's not really worth the effort yet at at least |
18:31:06 | FromDiscord | <haxscramper> sent a code paste, see https://play.nim-lang.org/#ix=3vLP |
18:32:14 | FromDiscord | <haxscramper> If that's you want, I don't think there is anything in stdlib that would work for that case, or at list I don't know of anything. |
18:32:19 | FromDiscord | <ynfle (ynfle)> ? |
18:32:22 | FromDiscord | <ynfle (ynfle)> I'm confused |
18:32:47 | FromDiscord | <haxscramper> That's what I meant |
18:33:06 | FromDiscord | <ynfle (ynfle)> This is what I did↵\`\`\`nim |
18:33:18 | FromDiscord | <ynfle (ynfle)> sent a code paste, see https://play.nim-lang.org/#ix=3vLQ |
18:33:49 | FromDiscord | <System64 ~ Flandre Scarlet> Ah alright I understand now |
18:34:12 | FromDiscord | <System64 ~ Flandre Scarlet> Now I'll add more features to my program until it crashes |
18:35:44 | FromDiscord | <haxscramper> ynfle (ynfle)\: yes, but what do you want then? I assumed you want to compact two outer loops into a single one that would iterate everything in parallel |
18:36:12 | FromDiscord | <haxscramper> `for name, a, b, val in fieldPairs(x, y, result): ...` |
18:37:14 | FromDiscord | <ynfle (ynfle)> It is in parallel, the inner loop is really just one at run time |
18:40:59 | FromDiscord | <enthus1ast> Yes↵(@haxscramper) |
18:45:29 | FromDiscord | <mlokis> sent a code paste, see https://play.nim-lang.org/#ix=3vLT |
18:47:36 | FromDiscord | <haxscramper (haxscramper)> This happens for gitter -\> matrix -\> discord |
18:48:01 | FromDiscord | <haxscramper> sent a code paste, see https://play.nim-lang.org/#ix=3vLU |
18:48:08 | FromDiscord | <haxscramper> hm |
18:48:08 | FromDiscord | <haxscramper (haxscramper)> sent a code paste, see https://play.nim-lang.org/#ix=3vLV |
18:48:27 | FromDiscord | <haxscramper (haxscramper)> sent a code paste, see https://play.nim-lang.org/#ix=3vLW |
18:48:39 | FromDiscord | <haxscramper> yes, if gitter code has highlighting it is completely destroyed |
18:49:37 | * | stkrdknmibalz joined #nim |
19:07:23 | * | Vladar quit (Quit: Leaving) |
19:14:46 | * | audiophile_ joined #nim |
19:14:54 | audiophile_ | oh nice nim exists |
19:14:59 | audiophile_ | on libera i mean |
19:16:21 | * | rockcavera quit (Remote host closed the connection) |
19:17:28 | * | supakeen quit (Remote host closed the connection) |
19:17:33 | * | rockcavera joined #nim |
19:17:33 | * | rockcavera quit (Changing host) |
19:17:33 | * | rockcavera joined #nim |
19:17:51 | * | supakeen joined #nim |
19:22:02 | * | tiorock joined #nim |
19:22:02 | * | tiorock quit (Changing host) |
19:22:02 | * | tiorock joined #nim |
19:22:02 | * | rockcavera is now known as Guest5963 |
19:22:02 | * | tiorock is now known as rockcavera |
19:25:30 | * | Guest5963 quit (Ping timeout: 272 seconds) |
19:39:14 | * | audiophile_ quit (Quit: Default Quit Message) |
19:59:46 | * | beshr joined #nim |
20:02:19 | FromDiscord | <j-james> What is the equivalent of `const float color[static 4]` in Nim? |
20:02:33 | * | audiophile_ joined #nim |
20:02:33 | * | audiophile_ quit (Client Quit) |
20:02:45 | FromDiscord | <j-james> My best guess is `const color: array[4, float]` but I don't fully understand how `static` carries over |
20:03:39 | * | auxym_ joined #nim |
20:04:36 | FromDiscord | <undersquire> In reply to @j-james "What is the equivalent": why is there a `static` in the first one |
20:05:25 | FromDiscord | <undersquire> your guess is correct, im unsure what the static does in the first one in that spot (is that C? if so ive never seen it used like that before) |
20:06:12 | FromDiscord | <undersquire> sent a code paste, see https://play.nim-lang.org/#ix=3vMh |
20:06:13 | FromDiscord | <undersquire> {.global.} is the equivelent of static in C |
20:07:11 | FromDiscord | <j-james> Ah, here's it in context |
20:07:23 | FromDiscord | <j-james> sent a code paste, see https://play.nim-lang.org/#ix=3vMi |
20:07:56 | FromDiscord | <undersquire> ive never seen static used like that before |
20:09:21 | FromDiscord | <undersquire> sent a code paste, see https://play.nim-lang.org/#ix=3vMj |
20:09:26 | FromDiscord | <undersquire> just a guess based on the C code, but that should be the equivelent |
20:14:28 | FromDiscord | <j-james> I see, thank you |
20:15:03 | FromDiscord | <j-james> What is `const` doing in the original C code? I'm not familiar with it on parameters |
20:20:39 | FromDiscord | <undersquire> its useless there |
20:20:47 | FromDiscord | <undersquire> i dont think it actually does anything in that code there |
20:21:47 | * | auxym_ quit (Ping timeout: 245 seconds) |
20:31:25 | FromDiscord | <Ruggila> I think the original intented to color be unchangeable. In C, array access is just doing pointer arithmentic, so color is actually a pointer inside the clear() callback function. Now, C programmers often confuse how to make the pointer itself const, or the data where the pointer is pointing to const ... |
20:32:56 | FromDiscord | <Ruggila> and about the static in arrays in C99: see https://stackoverflow.com/questions/17559631/what-are-those-strange-array-sizes-and-static-in-c99 for examples and descriptions |
20:34:27 | FromDiscord | <Ruggila> or also here: https://stackoverflow.com/questions/3430315/what-is-the-purpose-of-static-keyword-in-array-parameter-of-function-like-char (basically. color is AT LEAST 4 elements long, and it is therefore also implicitly never NULL) |
20:43:53 | FromDiscord | <haxscramper> sent a code paste, see https://play.nim-lang.org/#ix=3vMo |
20:44:48 | FromDiscord | <haxscramper> sent a code paste, see https://play.nim-lang.org/#ix=3vMp |
20:45:27 | FromDiscord | <haxscramper> In reply to @j-james "What is the equivalent": Direct equvalent (not wrapper equvalent) would be just `array[4, float]` |
20:45:48 | FromDiscord | <haxscramper> Nim arguments are immutable by default, so you don't need to add anything here |
20:48:47 | FromDiscord | <System64 ~ Flandre Scarlet> @haxscramper alright I added sound player (both OPL3 emulation and GameMusicEmu), it works as expected, no crashes for now |
20:48:57 | FromDiscord | <undersquire> ah ok |
20:49:34 | * | ecs quit (Read error: Connection reset by peer) |
20:49:43 | * | ecs joined #nim |
20:49:57 | * | blackbeard420 quit (Quit: ZNC 1.8.2 - https://znc.in) |
20:50:07 | * | ecs is now known as Guest780 |
20:51:59 | * | Guest780 is now known as ecs |
20:52:09 | * | blackbeard420 joined #nim |
20:52:18 | * | ecs quit (Changing host) |
20:52:18 | * | ecs joined #nim |
21:02:18 | * | xet7 quit (Quit: Leaving) |
21:38:41 | FromDiscord | <System64 ~ Flandre Scarlet> > No stack traceback available↵> SIGSEGV: Illegal storage access. (Attempt to read from nil?)↵Ah it crashed |
21:43:04 | FromDiscord | <System64 ~ Flandre Scarlet> null pointer it seems |
22:00:51 | * | max22- quit (Quit: Leaving) |
22:02:51 | FromDiscord | <lamersc.com 🐧> Anyone know how to limit available memory to program in windows? |
22:03:07 | FromDiscord | <lamersc.com 🐧> I’m trying to simulate an out of memory and attempt to handle it accordingly |
22:03:14 | FromDiscord | <lamersc.com 🐧> (edit) removed "an" |
22:03:32 | FromDiscord | <lamersc.com 🐧> I know how to do it on Ubuntu, but windows would be more convenient atm |
22:20:01 | FromDiscord | <undersquire> the only way I know is if you had a VM running windows and its ram set to like 2 GB max or something 😂 |
22:20:13 | FromDiscord | <undersquire> there might be tools available for doing what your trying to test however |
22:33:45 | madprops | what's the point of "method" and why are they limited to be used with objects? |
22:35:14 | FromDiscord | <undersquire> yeah i personally see no point to having the keyword `method` |
22:36:07 | FromDiscord | <undersquire> wait actually i think `method`s in nim relate to the type |
22:36:49 | FromDiscord | <undersquire> idk |
22:39:42 | FromDiscord | <zidsal> If you use method you get dynamic dispatch, which I think is the only reason to have it over a proc |
22:42:03 | FromDiscord | <undersquire> wdym dynamic dispatch |
22:42:15 | FromDiscord | <undersquire> like it calls the right one based on the type of object it is? |
22:45:17 | FromDiscord | <Dumb Dragon> Dynamic dispatch from what I recall means it's not as glitchy with inheritance. It's why in languages like C# you have to specify inheritable functions with "virtual". Let me see if I can find the article I read on it |
22:47:36 | FromDiscord | <zidsal> https://play.nim-lang.org/#ix=3vMV |
22:48:59 | FromDiscord | <zidsal> So in this example you can see that even thought we made a dog type as the variable is typed as animal it uses the method say from animal not dog. This is single dispatch. In dynamic dispatch the same code would call the dog say method not the animal method. dynamic dispatch has a small performance cost which is why it's not automatically enabled |
22:50:26 | FromDiscord | <undersquire> yeah |
22:50:37 | FromDiscord | <undersquire> ok then that makes sense |
23:19:15 | FromDiscord | <Ayy Lmao> What's the best way to deal with one header needing to be included before another? Are you forced to use `emit` in that case? |
23:24:58 | * | auxym_ joined #nim |
23:45:41 | madprops | weird, if I send a number like 5 as an argument, which is received as var int, it complains 5 is not mutable |
23:47:34 | * | auxym_ quit (Ping timeout: 268 seconds) |
23:48:43 | * | auxym_ joined #nim |
23:49:02 | madprops | oh I guess var means mutate the original var outside the function |
23:49:11 | madprops | i thought it just allowed to change it inside the function |
23:50:26 | FromDiscord | <exelotl> nope, var arg affects the value outside the proc too, so you need to pass in something mutable |
23:54:06 | * | Jjp137 quit (Ping timeout: 272 seconds) |
23:54:24 | * | Jjp137 joined #nim |
23:55:06 | * | Helios quit (Ping timeout: 252 seconds) |
23:55:48 | * | happycorsair[m] quit (Ping timeout: 268 seconds) |
23:55:54 | * | nixfreak_nim[m] quit (Ping timeout: 276 seconds) |