<< 12-08-2021 >>

00:03:41FromDiscord<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:58FromDiscord<Ayy Lmao> sent a code paste, see https://play.nim-lang.org/#ix=3vHN
00:19:56FromDiscord<undersquire> your changing the {.compile: "somelib/somelib.cpp".} right?
00:20:08FromDiscord<undersquire> as well as the file itself name from somelib.c to somelib.cpp
00:21:02FromDiscord<Ayy Lmao> @undersquire yes
00:23:46FromDiscord<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:02FromDiscord<Ayy Lmao> I'm guessing this has to do with name mangling in the compiler.
01:04:56FromDiscord<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:57FromDiscord<treeform> have you tried `nim cpp` instead of `nim c`?
01:31:15FromDiscord<treeform> Then nim would generate C++ code that should work with your other C++ code.
01:36:43FromDiscord<Ayy Lmao> In reply to @treeform "have you tried `nim": I have, it doesn't seem to help.
01:36:49FromDiscord<Jakraes> Is there a way to completely delete a variable from memory manually?
01:36:50FromDiscord<treeform> ok
01:40:09FromDiscord<Elegantbeef> What do you mean by delete from memory?↵(@Jakraes)
01:41:01FromDiscord<Jakraes> Like, delete a huge var from the ram
01:41:25FromDiscord<Jakraes> Pretty much manual garbage collection
01:42:06FromDiscord<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:27FromDiscord<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:11FromDiscord<Elegantbeef> Well if it's a pointer you need to manually free using `dealloc`
02:12:25FromDiscord<Rika> unless it is not a pointer you allocated
02:57:58FromDiscord<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:11FromDiscord<lamersc.com 🐧> Just been curious while looking into a few languages
03:10:39FromDiscord<Nim 👺> Idk how to code I’m just here cuz my name’s Nim :sunglas:
03:10:59FromDiscord<Elegantbeef> Well the act of not coding is the first step to learning to code
03:11:51FromDiscord<Nim 👺> Words of wisdom
03:15:37FromDiscord<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:57FromDiscord<undersquire> I just like the fact that the stdlib has memory leaks if you dont use a GC 😂
03:16:27FromDiscord<Elegantbeef> Atleast it tells you
03:17:49FromDiscord<codic> if you are using the stdlib memory is still being allocated its just that a function is doing it for you
03:18:49FromDiscord<Elegantbeef> Would be nice if strings had a dealloc proc
03:34:18FromDiscord<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:10FromDiscord<lamersc.com 🐧> In reply to @Nim 👺 "Idk how to code": Perfect start on your programming journey 😉
03:47:19FromDiscord<Nim 👺> Awesome
03:47:39FromDiscord<Nim 👺> Might learn just for shits and giggles
03:48:07FromDiscord<lamersc.com 🐧> I think you’d enjoy it, the language is quite friendly to use
03:48:15FromDiscord<Nim 👺> Awesome
03:48:48FromDiscord<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:59FromDiscord<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:25FromDiscord<Elegantbeef> Very good for automating tasks
04:41:34FromDiscord<codic> Das ist ja mal ein lebhafter Channel ^^
05:25:43FromDiscord<undersquire> what is the purpose of the export keyword in nim?
05:26:10FromDiscord<undersquire> can it be used to create like a prelude for a librarY?
05:26:12FromDiscord<undersquire> (edit) "librarY?" => "library?"
05:29:25FromDiscord<Elegantbeef> export is to export specific things such as an imported type or a module
05:29:55FromDiscord<undersquire> so u can do like
05:30:33FromDiscord<Elegantbeef> sent a code paste, see https://play.nim-lang.org/#ix=3vIB
05:31:23FromDiscord<undersquire> sent a code paste, see https://play.nim-lang.org/#ix=3vIC
05:32:05FromDiscord<Elegantbeef> yes
05:32:11FromDiscord<undersquire> ok thats pretty nice
05:32:17FromDiscord<Elegantbeef> alternatively `export entity, scene`
05:32:28FromDiscord<undersquire> ah ok i meant to do that 😉
05:32:57FromDiscord<undersquire> sent a code paste, see https://play.nim-lang.org/#ix=3vID
05:33:15FromDiscord<undersquire> sent a code paste, see https://play.nim-lang.org/#ix=3vIE
05:33:18FromDiscord<Elegantbeef> Indeed
05:33:32FromDiscord<undersquire> and is the static keyword just for compile time scripts?
05:33:39FromDiscord<undersquire> or can it be used for variables?
05:33:59FromDiscord<undersquire> i see its used in macros but im not sure what it really does there
05:34:01FromDiscord<Elegantbeef> It can be used for compile time logic that is stored to consts or as a generic type
05:34:11FromDiscord<undersquire> a hok
05:34:46FromDiscord<Elegantbeef> Like `proc someThing(v: static bool)` is a generic that is instantiated based off the value passed
05:34:54FromDiscord<Clonkk> The equivalent of C `static` variable in Nim is the global pragma↵(@undersquire)
05:35:06FromDiscord<Elegantbeef> So in this case it can generate max 2 procedures
05:35:07FromDiscord<undersquire> In reply to @Clonkk "The equivalent of C": yeah ik about that
05:35:43FromDiscord<undersquire> In reply to @Elegantbeef "Like `proc someThing(v: static": wait so how does this differ from just a bool type parameter
05:36:05FromDiscord<Elegantbeef> It generates a procedure for each value given at compile time so you can do specific logic `when v`
05:36:08FromDiscord<undersquire> does it affect overloading? or the actual procedure
05:36:21FromDiscord<undersquire> In reply to @Elegantbeef "It generates a procedure": ah ok
05:37:57FromDiscord<Elegantbeef> sent a code paste, see https://play.nim-lang.org/#ix=3vIG
05:38:09FromDiscord<undersquire> Oh i see
05:38:40FromDiscord<undersquire> so using static basically means the parameter must be a literal? (or some value that can be determined at compiel time)
05:39:00FromDiscord<Elegantbeef> Yea it's a compile time value
05:39:07FromDiscord<undersquire> oh nice thats pretty useful
05:39:07FromDiscord<Elegantbeef> that's what `static` means in nim
05:39:10FromDiscord<undersquire> yeah
06:11:00FromDiscord<Cark> question : how come i can call params.len without parenthesis, but i have to put parenthesis for initTable[A,B]() ?
06:11:11FromDiscord<Cark> maybe is it bad form to call len without these ?
06:11:29FromDiscord<Elegantbeef> Nah it's actually pretty idiomatic, it's due to not having the first parameter
06:11:50FromDiscord<undersquire> you cannot call a proc by itself without () unless you have at least a parameter
06:12:04FromDiscord<Cark> ah ok i see !
06:12:04FromDiscord<Elegantbeef> Procedures without parameters need `()` otherwise you're retrieving the procedure pointer
06:12:22FromDiscord<undersquire> sent a code paste, see https://play.nim-lang.org/#ix=3vIM
06:12:24FromDiscord<Elegantbeef> to expand on the above `let a = print1` is valid
06:12:29FromDiscord<Cark> in params.len , params is the parameter
06:12:38FromDiscord<undersquire> ye
06:12:47FromDiscord<Cark> bad choice for an example =)
06:12:49FromDiscord<Cark> ok thanks !
06:12:55FromDiscord<Elegantbeef> yes, though you can also drop the `()` for command syntax `echo 1` for instance
06:13:01FromDiscord<undersquire> u can also do len params, len(params)
06:13:13FromDiscord<undersquire> i really love the way nim does that 😂
06:13:33FromDiscord<Elegantbeef> Command syntax has the rule that using it inside another statement means you can only have 1 parameter passed that way
06:14:01FromDiscord<Elegantbeef> so like `doThing 1, 2.doThing 20, 40` is `doThing(1, doThing(2, 20), 40)`
06:14:32FromDiscord<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:50FromDiscord<Cark> it becomes somewhat harder to follow otherwise
06:14:56FromDiscord<Paupi woodberg> sent a code paste, see https://play.nim-lang.org/#ix=3vIN
06:15:04*Vladar joined #nim
06:15:25FromDiscord<Elegantbeef> Depends on what the procedures are and how you're using them, i often remove `()` when doing changed procedures
06:15:28FromDiscord<undersquire> In reply to @Paupi woodberg "I don't think these": ?
06:16:27FromDiscord<Elegantbeef> No paupi the above code is right
06:16:30FromDiscord<Elegantbeef> Well right for the example
06:16:52FromDiscord<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:39FromDiscord<Elegantbeef> Some people use emacs with it, but i do not so cannot give any guidance \:D
06:17:59FromDiscord<Cark> you already helped, so we'll let it slide =)
06:17:59FromDiscord<undersquire> In reply to @Elegantbeef "Some people use emacs": waht editor do you use?
06:18:12FromDiscord<Elegantbeef> I use vscodium
06:18:20FromDiscord<undersquire> oh nice same
06:18:28FromDiscord<Elegantbeef> I'm a heathen i know, though onivim2 was looking good 😛
06:18:45FromDiscord<undersquire> which nim extension do you use, cause there are like 4 of them
06:18:52FromDiscord<Elegantbeef> nimsaem's
06:18:54FromDiscord<undersquire> im using the one written in nim
06:19:00FromDiscord<Elegantbeef> yea that's it
06:19:01FromDiscord<undersquire> yeah
06:19:06FromDiscord<undersquire> i think its the only actively developed one
06:19:15FromDiscord<undersquire> the original one hasnt updated since 2020
06:19:37FromDiscord<Paupi woodberg> In reply to @undersquire "?": Am sorry man am new to Nim I was kinda writing in another language!
06:19:49FromDiscord<undersquire> lol its fine
06:20:08FromDiscord<Paupi woodberg> In reply to @undersquire "lol its fine": Thanks!
06:20:14FromDiscord<undersquire> 👍
06:20:54FromDiscord<Paupi woodberg> Where did y'all learn Nim cause for a new language y'all seem to know it pretty much!
06:21:13FromDiscord<Elegantbeef> Manual, here, using it, it's not that new 😀
06:21:14FromDiscord<undersquire> I just starting using it a little over a week ago
06:21:22FromDiscord<undersquire> I just learned it from the docs
06:21:41FromDiscord<undersquire> In reply to @Elegantbeef "Manual, here, using it,": how long have you been using nim?
06:22:49FromDiscord<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:00FromDiscord<Rika> Hey that means I’ve been using it for longer than beef
06:24:22FromDiscord<Elegantbeef> Congrats?!
06:25:02FromDiscord<Elegantbeef> should be lower than C#, like rust. But whatever bridge sucks
06:25:18FromDiscord<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:47FromDiscord<Elegantbeef> Nim isnt a scripting language
06:26:04FromDiscord<undersquire> lol
06:26:05FromDiscord<undersquire> well
06:26:09FromDiscord<undersquire> nimscript is
06:26:12FromDiscord<undersquire> 😉
06:26:18FromDiscord<Elegantbeef> lol
06:26:59FromDiscord<Paupi woodberg> O!↵Anyway I guess am doing Nim now😹
06:27:08FromDiscord<Paupi woodberg> O Thanks
06:27:45FromDiscord<undersquire> nim is my favorite C alternative, and I might move to it fully permenantly
06:27:56FromDiscord<undersquire> I tried zig and rust and neither really appealed to me
06:28:13FromDiscord<Elegantbeef> Someone somewhere a person is saying "Nim isnt a C alternative cause of X"
06:28:41FromDiscord<Cark> aren't we headed for a more rust like situation with orc ?
06:29:01FromDiscord<Cark> or you know unique_ptr headache
06:29:06FromDiscord<Elegantbeef> Well without the always in your face borrow checker
06:29:36FromDiscord<Elegantbeef> Though nim does have a borrow checker in experimental
06:29:48FromDiscord<Cark> i would argue that the borrow checker actually helps if you go that direction, which i don't personally like
06:30:22FromDiscord<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:03FromDiscord<undersquire> In reply to @Elegantbeef "Someone somewhere a person": lol
06:31:21FromDiscord<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:35FromDiscord<Paupi woodberg> And sadly Nim isn't available!
06:31:53FromDiscord<Paupi woodberg> I guess I'll start off learning c
06:32:04FromDiscord<Cark> it's a good place to start
06:32:56FromDiscord<Elegantbeef> Nim is on excercism.io
06:32:57FromDiscord<Cark> simple and just annoying enough to understand why you want better
06:33:27FromDiscord<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:37FromDiscord<Elegantbeef> Especially if you want to use libraries that already exist
06:35:08FromDiscord<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:18FromDiscord<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:46FromDiscord<Paupi woodberg> https://media.discordapp.net/attachments/371759389889003532/875266538335240222/Screenshot_20210812-073629.png
06:36:46FromDiscord<Paupi woodberg> Doing some research
06:36:49FromDiscord<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:02FromDiscord<Rika> In reply to @Elegantbeef "Someone somewhere a person": Well technically everything is a C alternative if you squeeze in enough reasons
06:38:53FromDiscord<Elegantbeef> If you cannot reason it yet grab a shoe horn and push more in
06:41:06FromDiscord<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:07FromDiscord<Elegantbeef> Wirth likes with people on C/C++ style languages in the minority
06:42:34FromDiscord<Elegantbeef> More languages with sensible bitsets, and fancier type systems
06:42:46FromDiscord<Rika> I’m sorry but that first message doesn’t read like English to me
06:43:06FromDiscord<Elegantbeef> There'd be more withlikes, with people on C/C++ in the minority\
06:43:11FromDiscord<leorize> i'd not recommend learning pascal aa transition to nim
06:43:14FromDiscord<leorize> as\
07:21:20FromDiscord<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:55FromDiscord<Clonkk> sent a long message, see http://ix.io/3vIX
07:41:05*PMunch joined #nim
07:53:46FromDiscord<Paupi woodberg> Thanks man!
07:53:52FromDiscord<Paupi woodberg> Ial use them!
08:03:13PMunch@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:59FromDiscord<Cark> i'd love to help, though it's pretty hard pinpointing the actual bug
08:04:33FromDiscord<Cark> also, maybe lsp-mode is the cause, or interoperate poorly with nimlsp specifically
08:04:39FromDiscord<Cark> (edit) "interoperate" => "interoperates"
08:05:23FromDiscord<Cark> couple years ago i resorted to use VSCode because of this, and it worked great there
08:06:27PMunchYou 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:00FromDiscord<Cark> i'll investigate, and thanks for your work btw =)
08:10:46PMunchSimultaneously happy that a lot of people use NimLSP, but also a bit sad about how much of a mess it is :P
08:12:38FromDiscord<Cark> we would all be out of work if everything came out perfect on the first try =)
08:32:17PMunchFair point
08:37:48FromDiscord<gogolxdong (liuxiaodong)> https://chialisp.com/
08:38:03*max22- joined #nim
09:27:51FromDiscord<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:10FromDiscord<Elegantbeef> varargs accepts seqs
09:28:14FromDiscord<fwsgonzo> what's the best way to take in a buffer, length from a C function?
09:28:20FromDiscord<fwsgonzo> that is, I'm going to call a Nim function from C
09:28:48FromDiscord<fwsgonzo> sent a code paste, see https://play.nim-lang.org/#ix=3vJj
09:28:55FromDiscord<Elegantbeef> `ptr[UnCheckedArray[T]], len`?
09:29:24FromDiscord<fwsgonzo> well, in C you can specify the length of the array with another argument, like size_t len, char array[len]
09:30:28FromDiscord<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:34FromDiscord<fwsgonzo> so, given a cstring, int what is the best Nim type I should convert that to?
09:38:46FromDiscord<fwsgonzo> some kind of bounds-checked slice type?
09:45:53FromDiscord<Rika> A string? Are you avoiding a copy
09:46:18FromDiscord<Rika> If you are then I think a custom data type would be needed I think
09:57:06FromDiscord<fwsgonzo> I want to implement a function that matches a prototype, is that possible?
09:57:44FromDiscord<fwsgonzo> sent a code paste, see https://play.nim-lang.org/#ix=3vJo
10:00:31FromDiscord<Rika> Just make a function that does? If it doesn’t the code will not compile
10:00:44FromDiscord<fwsgonzo> it will compile just fine because this function is called from C
10:01:08FromDiscord<fwsgonzo> (edit) "it will compile just fine because this function is called ... from" added "indirectly"
10:01:11FromDiscord<Rika> No? It’s a type, if Nim sees it’s the wrong type it won’t compile
10:01:28FromDiscord<fwsgonzo> sent a code paste, see https://play.nim-lang.org/#ix=3vJr
10:01:44FromDiscord<fwsgonzo> the function is callback, which is provided from C by externing it
10:02:08FromDiscord<fwsgonzo> Nim ends up calling it, but doesn't really know about it
10:02:49FromDiscord<Rika> Oh so the callback is from C
10:03:03FromDiscord<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:10FromDiscord<Rika> Or what? I don’t exactly understand
10:03:26FromDiscord<fwsgonzo> sent a code paste, see https://play.nim-lang.org/#ix=3vJs
10:04:01FromDiscord<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:35FromDiscord<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:40FromDiscord<bolino> In reply to @Elegantbeef "varargs accepts seqs": Oh great
10:04:56FromDiscord<bolino> (edit) "great" => "great, didn't know. Thanks for quick and efficient answer, as usual!"
10:05:17FromDiscord<fwsgonzo> sent a code paste, see https://play.nim-lang.org/#ix=3vJt
10:05:53FromDiscord<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:56FromDiscord<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:36FromDiscord<Ayy Lmao> Is there a way to get `importc` to use just `extern` and not `extern "C"` for the function prototype?
14:42:15FromDiscord<levovix> importcpp?
14:43:02FromDiscord<Ayy Lmao> In reply to @levovix "importcpp?": I've tried, it doesn't seem to generate a function prototype.
14:43:38FromDiscord<levovix> codegenDecl?
14:45:23FromDiscord<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:32FromDiscord<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:54FromDiscord<tbrekalo> How can I change nible dstBuildDir for tests?
16:13:05FromDiscord<haxscramper> Or maybe nim has a built-in support for dealing with that kind of things
16:30:00FromDiscord<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:29FromDiscord<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:26FromDiscord<haxscramper> define "good"
16:33:05FromDiscord<haxscramper> If it doesn't error at compile/ library load time then it is probably doing everything correctly
16:33:27FromDiscord<haxscramper> If you are still looking for something where error occurs I sugest you to compare generated C code to handwritten
16:33:33FromDiscord<System64 ~ Flandre Scarlet> so if it do everything correctly, it shouldn't crash but it crash
16:33:59FromDiscord<haxscramper> have you run debugger, checked for error codes, checked for generated C code?
16:34:17FromDiscord<haxscramper> Are you sure the nim version is 1:1 mapping
16:35:05FromDiscord<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:42FromDiscord<System64 ~ Flandre Scarlet> I also tried the callbacks with only an echo statement inside, still crash
16:39:18FromDiscord<System64 ~ Flandre Scarlet> Alright the app completely freeze with the Frame Callback (not the raster one)
16:40:20FromDiscord<System64 ~ Flandre Scarlet> Just have the sound
16:49:21FromDiscord<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:13FromDiscord<enthus1ast> only -f compiles it then, but all the other stuff as well
16:52:28FromDiscord<enthus1ast> something like a "customMustRecompileProc"
16:58:06FromDiscord<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:54FromDiscord<haxscramper> And nim recompiles everything if even one module has changed
16:59:07FromDiscord<haxscramper> Nim recompiles all nim modules if one has changed
16:59:18FromDiscord<haxscramper> C files are not recompiled on each run
16:59:21FromDiscord<haxscramper> At least not all of them
16:59:43FromDiscord<enthus1ast> mh i see
17:00:44FromDiscord<enthus1ast> then i guess i should look into useing the compiler as a library
17:01:15*xet7 joined #nim
17:11:25FromDiscord<haxscramper> You are working on https://github.com/enthus1ast/nimja
17:11:26FromDiscord<haxscramper> ?
17:11:27nrds<prestigebot99> itHub: 7"typed and compiled template engine inspired by jinja2, twig and onionhammer/nim-templates for Nim."
17:11:44FromDiscord<haxscramper> I would literally die if it worked with nimscript
17:11:50FromDiscord<haxscramper> Or rather I would use it for haxdoc
17:12:11FromDiscord<haxscramper> So yes, if you need any help with compiler API I would be glad go help
17:14:04FromDiscord<haxscramper> I myself considered writing jinja template, though I was leaning more towards adding custom embedded scripting language for that one↵(@haxscramper)
17:15:13FromDiscord<haxscramper> sent a code paste, see https://play.nim-lang.org/#ix=3vLq
17:15:28FromDiscord<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:44FromDiscord<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:17FromDiscord<haxscramper> `sleep(high(int))`
17:32:17FromDiscord<System64 ~ Flandre Scarlet> I don't have that
17:36:57FromDiscord<haxscramper> sent a long message, see http://ix.io/3vLw
17:39:16FromDiscord<System64 ~ Flandre Scarlet> the thing is this code interacts with a library
17:40:47FromDiscord<haxscramper> Does C version that interacts with a library work fine?
17:41:55FromDiscord<System64 ~ Flandre Scarlet> But Tilengine IS the library
17:43:23FromDiscord<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:49FromDiscord<System64 ~ Flandre Scarlet> yeah, freeze with the Framecallback (music still play) and CRASH with Raster Callback (the program close, music included)
17:46:16FromDiscord<haxscramper> so you do have working C code that you wrote yourself/copied from somewhere?
17:47:43FromDiscord<System64 ~ Flandre Scarlet> Coded myself
17:48:53FromDiscord<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:59FromDiscord<System64 ~ Flandre Scarlet> This is my C code https://media.discordapp.net/attachments/371759389889003532/875435712365875220/main.c
17:50:37FromDiscord<haxscramper> Well, ~70 lines, it should not be particularly hard to minimize nim vesion and compare implementations
17:51:29FromDiscord<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:24FromDiscord<System64 ~ Flandre Scarlet> sent a code paste, see https://play.nim-lang.org/#ix=3vLG
18:14:51FromDiscord<haxscramper> well, now compare generated C code
18:15:08FromDiscord<System64 ~ Flandre Scarlet> where can I find it?
18:17:12FromDiscord<haxscramper> In reply to @haxscramper "Which means you have": You can specify `--nimcache:myDir` and it would output code there
18:20:40FromDiscord<System64 ~ Flandre Scarlet> sent a code paste, see https://play.nim-lang.org/#ix=3vLN
18:21:40FromDiscord<haxscramper> What do you mean "doesn't output". No directory is created?
18:22:00FromDiscord<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:22FromDiscord<System64 ~ Flandre Scarlet> I created the dir, but nothing inside the dir
18:22:36FromDiscord<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:06FromDiscord<haxscramper> Not using built-in iterators such as `fieldPairs`.
18:23:30FromDiscord<ynfle (ynfle)> They are all the same type
18:23:33FromDiscord<ynfle (ynfle)> Any suggestions?
18:24:34FromDiscord<haxscramper> What exactly do you mean by field of 3 tuples ... like `field: (int, int, int)`, or what
18:25:14FromDiscord<ynfle (ynfle)> No
18:25:20FromDiscord<ynfle (ynfle)> (a\: 1, b\: 2)
18:25:56FromDiscord<System64 ~ Flandre Scarlet> This is the generated code https://media.discordapp.net/attachments/371759389889003532/875445010978463784/output.c
18:25:56FromDiscord<haxscramper> so you have three tuples with fields `(a: 1, b: 2)` and you want to iterate in paralel?
18:26:54FromDiscord<ynfle (ynfle)> Yup
18:27:12FromDiscord<ynfle (ynfle)> I did it when nested loops and `when` statements because it's unrolled and compile time
18:28:07FromDiscord<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:58FromDiscord<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:13FromDiscord<haxscramper> And internally `fieldPairs` does the same unrolling
18:29:24FromDiscord<System64 ~ Flandre Scarlet> > --stacktrace:off --linetrace:off --embedsrc:off↵What does it do?
18:29:31FromDiscord<haxscramper> `nim --fullhelp`
18:29:32FromDiscord<haxscramper> read docs
18:29:35FromDiscord<ynfle (ynfle)> Don't really need a macro, it's not really worth the effort yet at at least
18:31:06FromDiscord<haxscramper> sent a code paste, see https://play.nim-lang.org/#ix=3vLP
18:32:14FromDiscord<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:19FromDiscord<ynfle (ynfle)> ?
18:32:22FromDiscord<ynfle (ynfle)> I'm confused
18:32:47FromDiscord<haxscramper> That's what I meant
18:33:06FromDiscord<ynfle (ynfle)> This is what I did↵\`\`\`nim
18:33:18FromDiscord<ynfle (ynfle)> sent a code paste, see https://play.nim-lang.org/#ix=3vLQ
18:33:49FromDiscord<System64 ~ Flandre Scarlet> Ah alright I understand now
18:34:12FromDiscord<System64 ~ Flandre Scarlet> Now I'll add more features to my program until it crashes
18:35:44FromDiscord<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:12FromDiscord<haxscramper> `for name, a, b, val in fieldPairs(x, y, result): ...`
18:37:14FromDiscord<ynfle (ynfle)> It is in parallel, the inner loop is really just one at run time
18:40:59FromDiscord<enthus1ast> Yes↵(@haxscramper)
18:45:29FromDiscord<mlokis> sent a code paste, see https://play.nim-lang.org/#ix=3vLT
18:47:36FromDiscord<haxscramper (haxscramper)> This happens for gitter -\> matrix -\> discord
18:48:01FromDiscord<haxscramper> sent a code paste, see https://play.nim-lang.org/#ix=3vLU
18:48:08FromDiscord<haxscramper> hm
18:48:08FromDiscord<haxscramper (haxscramper)> sent a code paste, see https://play.nim-lang.org/#ix=3vLV
18:48:27FromDiscord<haxscramper (haxscramper)> sent a code paste, see https://play.nim-lang.org/#ix=3vLW
18:48:39FromDiscord<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:54audiophile_oh nice nim exists
19:14:59audiophile_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:19FromDiscord<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:45FromDiscord<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:36FromDiscord<undersquire> In reply to @j-james "What is the equivalent": why is there a `static` in the first one
20:05:25FromDiscord<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:12FromDiscord<undersquire> sent a code paste, see https://play.nim-lang.org/#ix=3vMh
20:06:13FromDiscord<undersquire> {.global.} is the equivelent of static in C
20:07:11FromDiscord<j-james> Ah, here's it in context
20:07:23FromDiscord<j-james> sent a code paste, see https://play.nim-lang.org/#ix=3vMi
20:07:56FromDiscord<undersquire> ive never seen static used like that before
20:09:21FromDiscord<undersquire> sent a code paste, see https://play.nim-lang.org/#ix=3vMj
20:09:26FromDiscord<undersquire> just a guess based on the C code, but that should be the equivelent
20:14:28FromDiscord<j-james> I see, thank you
20:15:03FromDiscord<j-james> What is `const` doing in the original C code? I'm not familiar with it on parameters
20:20:39FromDiscord<undersquire> its useless there
20:20:47FromDiscord<undersquire> i dont think it actually does anything in that code there
20:21:47*auxym_ quit (Ping timeout: 245 seconds)
20:31:25FromDiscord<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:56FromDiscord<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:27FromDiscord<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:53FromDiscord<haxscramper> sent a code paste, see https://play.nim-lang.org/#ix=3vMo
20:44:48FromDiscord<haxscramper> sent a code paste, see https://play.nim-lang.org/#ix=3vMp
20:45:27FromDiscord<haxscramper> In reply to @j-james "What is the equivalent": Direct equvalent (not wrapper equvalent) would be just `array[4, float]`
20:45:48FromDiscord<haxscramper> Nim arguments are immutable by default, so you don't need to add anything here
20:48:47FromDiscord<System64 ~ Flandre Scarlet> @haxscramper alright I added sound player (both OPL3 emulation and GameMusicEmu), it works as expected, no crashes for now
20:48:57FromDiscord<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:41FromDiscord<System64 ~ Flandre Scarlet> > No stack traceback available↵> SIGSEGV: Illegal storage access. (Attempt to read from nil?)↵Ah it crashed
21:43:04FromDiscord<System64 ~ Flandre Scarlet> null pointer it seems
22:00:51*max22- quit (Quit: Leaving)
22:02:51FromDiscord<lamersc.com 🐧> Anyone know how to limit available memory to program in windows?
22:03:07FromDiscord<lamersc.com 🐧> I’m trying to simulate an out of memory and attempt to handle it accordingly
22:03:14FromDiscord<lamersc.com 🐧> (edit) removed "an"
22:03:32FromDiscord<lamersc.com 🐧> I know how to do it on Ubuntu, but windows would be more convenient atm
22:20:01FromDiscord<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:13FromDiscord<undersquire> there might be tools available for doing what your trying to test however
22:33:45madpropswhat's the point of "method" and why are they limited to be used with objects?
22:35:14FromDiscord<undersquire> yeah i personally see no point to having the keyword `method`
22:36:07FromDiscord<undersquire> wait actually i think `method`s in nim relate to the type
22:36:49FromDiscord<undersquire> idk
22:39:42FromDiscord<zidsal> If you use method you get dynamic dispatch, which I think is the only reason to have it over a proc
22:42:03FromDiscord<undersquire> wdym dynamic dispatch
22:42:15FromDiscord<undersquire> like it calls the right one based on the type of object it is?
22:45:17FromDiscord<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:36FromDiscord<zidsal> https://play.nim-lang.org/#ix=3vMV
22:48:59FromDiscord<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:26FromDiscord<undersquire> yeah
22:50:37FromDiscord<undersquire> ok then that makes sense
23:19:15FromDiscord<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:41madpropsweird, 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:02madpropsoh I guess var means mutate the original var outside the function
23:49:11madpropsi thought it just allowed to change it inside the function
23:50:26FromDiscord<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)