00:47:18 | FromDiscord | <ynfle> In reply to @Elegantbeef "I'm going to start": Pointers on pointers? |
00:48:13 | FromDiscord | <Elegantbeef> Pretty much, i was thinking more "Pointers? Point who I hardly know her" 😛 |
01:23:28 | FromDiscord | <Patitotective> @ElegantBeef is there a way to check the stack trace of the cimgui functions called? cause im haven't been able to find anything lol |
01:23:47 | FromDiscord | <Elegantbeef> What do you mean? |
01:24:36 | FromDiscord | <Patitotective> like to see which files (`.h`) are being used by which functions in which lines |
01:25:03 | FromDiscord | <Elegantbeef> C doesnt have a stack trace |
01:25:04 | FromDiscord | <Elegantbeef> So nope |
01:25:28 | FromDiscord | <Elegantbeef> Not easily |
01:25:41 | FromDiscord | <Elegantbeef> You might be able to use debug tools to do it |
01:25:50 | FromDiscord | <Patitotective> In reply to @Elegantbeef "You might be able": like? |
01:26:06 | FromDiscord | <Elegantbeef> You're a windows user so no clue |
01:26:19 | FromDiscord | <Elegantbeef> callgrind might work, gdb might work |
01:26:23 | FromDiscord | <Patitotective> im an ubuntu user LOL |
01:26:29 | FromDiscord | <Elegantbeef> Oh |
01:26:34 | FromDiscord | <Elegantbeef> Why did i think you used windows |
01:27:43 | FromDiscord | <Elegantbeef> Well i have a writeup for the basic of pointers, it's fucking useless methinks |
01:27:58 | FromDiscord | <Elegantbeef> Doesnt explain anything so time well spent |
01:28:24 | FromDiscord | <Elegantbeef> If anyone wants to take a peak at it https://www.jasonbeetham.com/pointerexplaination.html |
01:45:44 | FromDiscord | <Patitotective> In reply to @Elegantbeef "C doesnt have a": and cpp? |
01:45:57 | FromDiscord | <Elegantbeef> No clue |
01:46:31 | FromDiscord | <Elegantbeef> Doubt it |
01:47:15 | FromDiscord | <michaelb.eth> sent a code paste, see https://paste.rs/NCN |
01:47:27 | FromDiscord | <Elegantbeef> `for _ in 0..<someInt` |
01:47:32 | FromDiscord | <michaelb.eth> (edit) "https://play.nim-lang.org/#ix=3Tzq" => "https://paste.rs/byj" |
01:48:10 | FromDiscord | <michaelb.eth> (edit) "https://play.nim-lang.org/#ix=3Tzs" => "https://play.nim-lang.org/#ix=3Tzr" |
01:50:16 | FromDiscord | <michaelb.eth> In reply to @Elegantbeef "If anyone wants to": I like it 🙂 |
01:51:03 | FromDiscord | <ElegantBeef> Thanks |
01:52:03 | FromDiscord | <Elegantbeef> Uh oh the matrix bridge machine borkeded |
01:52:03 | FromDiscord | <Elegantbeef> Hmm this bridge likes dying randomly |
01:52:23 | FromDiscord | <michaelb.eth> probably a bad pointer |
01:52:41 | FromDiscord | <Elegantbeef> It happened after you edited your message so i blame you |
01:53:34 | FromDiscord | <michaelb.eth> I'm pretty sure someone didn't have their fingers crossed and their lips twisted in just the right way to keep it from crashing |
01:53:53 | FromDiscord | <Elegantbeef> Ah my bad, i'll get the glue |
02:11:44 | FromDiscord | <huantian> It is unfortunate that edits don’t transfer perfectly with the bridge |
02:12:01 | FromDiscord | <Elegantbeef> They do sometimes but for some reason the bridge removes the message |
02:12:16 | FromDiscord | <Elegantbeef> Probably a case of no one fed up enough to fix it |
02:13:39 | FromDiscord | <Elegantbeef> Dont even know which bridge they use |
02:34:46 | * | mal`` quit (Quit: Leaving) |
02:37:06 | FromDiscord | <huantian> Maybe we should make our own bridge in Nim |
02:37:33 | FromDiscord | <Elegantbeef> Well the matrix API is being wrapped, no clue if it supports bots |
02:42:36 | * | wyrd quit (Quit: Lost terminal) |
02:52:11 | * | mal`` joined #nim |
03:24:21 | * | wyrd joined #nim |
03:28:07 | FromDiscord | <Patitotective> how do i know which compiler nim is using? |
03:28:18 | FromDiscord | <Patitotective> (edit) "using?" => "using (gcc or clang)?" |
03:28:31 | FromDiscord | <Elegantbeef> by default on linux it uses `gcc` |
03:29:22 | FromDiscord | <Elegantbeef> `defined(gcc)` is atleast for gcc check |
03:30:06 | FromDiscord | <Patitotective> In reply to @Patitotective "<@!145405730571288577> is there a": i couldn't find anything lol↵i created an issue https://github.com/nimgl/nimgl/issues/77 |
03:32:43 | FromDiscord | <Elegantbeef> The issue is your string |
03:32:43 | FromDiscord | <creikey> something I'm just now considering, if the bulk of my SE work is in nim how will I even get hired? |
03:33:29 | FromDiscord | <Elegantbeef> sent a code paste, see https://paste.rs/QvV |
03:33:30 | FromDiscord | <Elegantbeef> There you go how you're supposed to do it |
03:33:46 | FromDiscord | <Elegantbeef> Wait people hire software devs?↵(@creikey) |
03:33:58 | FromDiscord | <Elegantbeef> It's a system programming language I'd imagine if you have good projects it doesnt matter |
03:34:08 | FromDiscord | <creikey> In reply to @Elegantbeef "It's a system programming": even if everybody uses C++? |
03:34:17 | FromDiscord | <creikey> In reply to @Elegantbeef "Wait people hire software": not even sure at this point tbh |
03:35:06 | FromDiscord | <Patitotective> sent a code paste, see https://paste.rs/Tz8 |
03:35:15 | FromDiscord | <Elegantbeef> No clue, i'd imagine application of knowledge is more important than language |
03:35:23 | FromDiscord | <creikey> sent a code paste, see https://play.nim-lang.org/#ix=3TzI |
03:35:38 | FromDiscord | <Elegantbeef> Shouldnt matter |
03:36:03 | FromDiscord | <Elegantbeef> sent a code paste, see https://play.nim-lang.org/#ix=3TzJ |
03:37:14 | FromDiscord | <Elegantbeef> Dont take my view as gospel anyway, i'm not a software developer |
03:39:30 | FromDiscord | <Elegantbeef> Anyway the 64 is the length of the string without a null terminator, it's what imgui will draw up to or input up to |
03:42:17 | FromDiscord | <Patitotective> :O |
03:42:19 | FromDiscord | <Patitotective> it worked |
03:42:35 | FromDiscord | <Patitotective> In reply to @Elegantbeef "Dont take my view": are you sure you're not a software developer? lol |
03:43:47 | FromDiscord | <Elegantbeef> In an ideal world there is a `proc igInputText(label: string, buff: var openArray[char], ...)` |
03:43:47 | FromDiscord | <Elegantbeef> Also patito you do realize `igInputText` returns true if the buffer has been changed right? |
03:43:48 | FromDiscord | <Elegantbeef> You dont need to use the callback/userdata for what you were doing |
03:44:19 | FromDiscord | <Elegantbeef> I'm not a professional one |
03:44:45 | * | fowl joined #nim |
03:45:20 | FromDiscord | <creikey> In reply to @Elegantbeef "I'm not a professional": I'm curious do you have a day job? |
03:45:56 | FromDiscord | <Patitotective> In reply to @Elegantbeef "You dont need to": I thought the same but if you see `IgInputText` https://nimgl.dev/docs/imgui.html#igInputText%2Ccstring%2Ccstring%2Cuint%2CImGuiInputTextFlags%2CImGuiInputTextCallback%2Cpointer↵`buf` is not `var` and the only way to get the `buf` is by using the `callback` |
03:46:02 | FromDiscord | <Patitotective> (edit) "In reply to @Elegantbeef "You dont need to": I thought the same but if you see ... `IgInputText`" added "in" |
03:48:18 | FromDiscord | <Elegantbeef> uhh |
03:48:29 | FromDiscord | <Elegantbeef> It mutates `buf` |
03:49:11 | FromDiscord | <Patitotective> :O how? |
03:49:18 | FromDiscord | <Elegantbeef> It's a cstring |
03:49:28 | FromDiscord | <Elegantbeef> that `buf` is the `buf` you get back |
03:49:42 | FromDiscord | <Patitotective> time to stop living LMAO |
03:52:51 | FromDiscord | <Patitotective> 🌃 |
03:52:54 | FromDiscord | <Patitotective> good night everyone |
03:53:34 | FromDiscord | <Elegantbeef> @Patitotective\: goodnight, but take this https://play.nim-lang.org/#ix=3TzO |
04:08:10 | * | arkurious quit (Quit: Leaving) |
04:34:07 | * | slowButPresent quit (Quit: leaving) |
05:39:01 | FromDiscord | <Mikerah (Mikerah)> I'm trying to cross-compile a simple nim program (just a hello world for testing purposes) to C and I'm missing a nimbase.h file. |
05:39:45 | FromDiscord | <Elegantbeef> depends on your install path if using choosenim it's `.choosenim/toolchains/version/lib/nimbase.h` |
05:39:47 | FromDiscord | <Mikerah (Mikerah)> I noticed that within the choosenim folder, I can find it but I have a feeling that this is somewhat unnecessary and the nim compiler probably has an option for this somewhere |
05:40:09 | FromDiscord | <Elegantbeef> Are you compiling Nim, or using nim to output C? |
05:40:22 | FromDiscord | <Mikerah (Mikerah)> The latter |
05:40:47 | FromDiscord | <Mikerah (Mikerah)> I guess it's inaccurate to say nim compiler even though I'm running `nim cc ...` ? |
05:41:06 | FromDiscord | <Elegantbeef> If you're doing `nim c ./myNim.nim` it's the former |
05:41:25 | FromDiscord | <Elegantbeef> If you're doing `nim c -c --nimcache:someDir myNim.nim` it's the latter |
05:41:38 | FromDiscord | <Mikerah (Mikerah)> Okay. I see |
05:41:58 | FromDiscord | <Elegantbeef> If nim is doing everything you shouldnt need to do anything with the nimbase |
05:42:05 | FromDiscord | <Elegantbeef> So what's the exact command you're using/process |
05:42:29 | FromDiscord | <Mikerah (Mikerah)> I'm running `nim cc --nimcache:. --cpu:amd64 --os:linux mininimbus.nim`. |
05:42:37 | FromDiscord | <Mikerah (Mikerah)> My goal is to get c code |
05:42:49 | FromDiscord | <Elegantbeef> Ok so then yes you need to copy the nimbase manually afaik |
05:42:57 | FromDiscord | <Elegantbeef> It'd be nice if you didnt, but it's a one time thing |
05:43:22 | FromDiscord | <Mikerah (Mikerah)> I see. |
05:43:36 | FromDiscord | <Mikerah (Mikerah)> Might a good first contribution to automate this process |
05:43:49 | FromDiscord | <Mikerah (Mikerah)> Anyways, thank you @elegantbeef\:matrix.org for the clarification |
05:44:02 | FromDiscord | <Elegantbeef> Perhaps, though might be a bit odd if you change your compiler |
05:45:01 | FromDiscord | <Elegantbeef> Guess it can always compare the two |
05:45:45 | FromDiscord | <Mikerah (Mikerah)> I need a specific version of the nim compiler though. Otherwise it doesn't build |
05:47:32 | FromDiscord | <Elegantbeef> Sounds like great software 😛 |
05:48:04 | FromDiscord | <Mikerah (Mikerah)> I'm just trying to write a quick-ish prototype for something and nim was the best option given its ability to compile to MIPS and C |
05:48:41 | FromDiscord | <Elegantbeef> Yea i'm just joking, manually copying is what we have |
06:21:20 | * | Zectbumo joined #nim |
07:01:48 | * | jmdaemon quit (Ping timeout: 240 seconds) |
07:47:03 | * | pro joined #nim |
08:34:37 | * | Zectbumo quit (Remote host closed the connection) |
09:23:56 | FromDiscord | <iencec> how would I convert a `seq[Rune]` to `string`? |
09:24:38 | FromDiscord | <Elegantbeef> `$` |
09:24:56 | FromDiscord | <iencec> ah - forgot about that one - thanks! |
09:26:42 | FromDiscord | <Rika> Maybe we should have a proc called to string that’s literally just an alias to that |
09:26:43 | FromDiscord | <Rika> Lol |
09:27:57 | FromDiscord | <iencec> I indeed was trying `toString` earlier.. \:-D |
10:24:07 | * | PMunch joined #nim |
10:39:12 | FromDiscord | <Require Support> is there a way to get type of var in nim? |
10:41:45 | FromDiscord | <Require Support> sent a code paste, see https://play.nim-lang.org/#ix=3TAz |
10:42:07 | FromDiscord | <Solitude> yes, you just did it |
10:42:14 | FromDiscord | <Require Support> wait no way LOL |
10:42:50 | FromDiscord | <Require Support> omg its actually right, im dumb |
10:46:19 | * | xet7 joined #nim |
10:48:30 | FromDiscord | <Rika> lol |
11:41:25 | * | xet7 quit (Remote host closed the connection) |
11:49:33 | FromDiscord | <Patitotective> sent a code paste, see https://paste.rs/w9j |
11:58:00 | PMunch | Hmm, anyone here used plotly? |
11:59:25 | PMunch | I have a Raspberry Pi which reads a temperature/humidity sensor and outputs the data to a file in a cron-job. Now I want to display that data on a website, I was initially thinking of using some JavaScript library like Chart.js, but Plotly looks really nice, and since it outputs HTML there is (hopefully) a way to get that HTML and embed it into a site? |
12:04:26 | PMunch | Aha, so the Plotly library only generates the JSON required for the Plotly JS library |
12:05:19 | PMunch | So I should be able to make a HTML file with the Plotly library and then use the `toPlotJson` to get the JSON I need for the library? |
12:08:09 | FromDiscord | <hotdog> In reply to @PMunch "So I should be": Sounds about right |
12:08:15 | FromDiscord | <hotdog> Are there no examples? |
12:08:39 | PMunch | Not of this particular use-case, no |
12:08:47 | PMunch | Hmm, there is a `save` function |
12:08:59 | PMunch | But I want to embed this into another site |
12:11:44 | PMunch | Hmm, there is `fillHtmlTemplate` |
12:11:50 | PMunch | But it's not exported by default |
12:20:30 | pro | can't you just generate svg and embedd svg ? |
12:22:20 | PMunch | pro, I could, but that sounds like more work for me |
12:22:52 | pro | honestly, I enjoy creating simple graphics with simple elements, so I thought you would too :P |
12:23:20 | PMunch | Oh, don't get me wrong, I'd love to do it. But sometimes you just need things done fast .) |
12:23:50 | pro | I remmember that I had some sqlite or .csv files I needed to visualize, and I used some software that generated .png's, which scaled nicely to any res |
12:24:01 | pro | gnuplot iirc |
12:24:07 | PMunch | Yeah I could use something like gnuplot |
12:25:06 | FromDiscord | <Recruit_main707> at that point you may also use matplotlib and generate a png file, from the little ive seen of gnuplot its worse than it |
12:25:10 | pro | if it's production or critical sensor, then I'd self host graylog or something like that, which has several notifications of data stopping to come |
12:25:29 | PMunch | Oh it's nothing like that |
12:25:41 | PMunch | It's just a small Raspberry Pi chilling behind my TV :P |
12:27:11 | FromDiscord | <auxym> ggplotnim can probably generate svg? |
12:28:21 | pro | I want to get into hardware projects now... |
12:28:42 | * | slowButPresent joined #nim |
12:47:09 | FromDiscord | <auxym> join us in embedded 😉 |
12:47:52 | pro | us? |
12:58:01 | FromDiscord | <Rika> there is a channel `nim-embedded` i believe |
12:59:06 | PMunch | Yes, it's #nim-embedded on IRC |
13:02:36 | FromDiscord | <auxym> us 😏 |
13:02:38 | FromDiscord | <hmmm> sent a code paste, see https://play.nim-lang.org/#ix=3TB5 |
13:02:43 | FromDiscord | <hmmm> basically this fails because seq grows while iterating |
13:03:01 | FromDiscord | <hmmm> but I still need to do it, the objective is to add test 3 times to that seq |
13:03:12 | FromDiscord | <hmmm> how do I get around dat |
13:03:23 | FromDiscord | <Rika> `for _ in 0..a.high:` since you dont need i |
13:03:26 | FromDiscord | <auxym> iterate with an index index? |
13:03:33 | FromDiscord | <auxym> yeah that |
13:03:39 | FromDiscord | <hmmm> what does the underscore do |
13:03:43 | FromDiscord | <Rika> nothing |
13:03:43 | FromDiscord | <auxym> nothing |
13:03:44 | FromDiscord | <Rika> its a variable name |
13:03:46 | FromDiscord | <hmmm> wot |
13:03:48 | FromDiscord | <Rika> but not really |
13:04:08 | FromDiscord | <Rika> you could name it i but you dont use it anyway |
13:04:24 | FromDiscord | <hmmm> nununu this was a simple example lol I need to use it |
13:04:55 | FromDiscord | <hmmm> basically I use a.high and it will lock it |
13:04:56 | FromDiscord | <Rika> then put that in the damn example] |
13:04:58 | FromDiscord | <hmmm> ok I'll try |
13:06:05 | FromDiscord | <auxym> or something like that |
13:06:05 | FromDiscord | <auxym> sent a code paste, see https://play.nim-lang.org/#ix=3TB7 |
13:12:17 | * | BEST_Flibra_Gaia joined #nim |
13:16:06 | PMunch | Man, running Nim on the Raspberry Pi really makes me appreciate how fast my computer is :P |
13:16:52 | pro | man I wish I had RPI when I grew up |
13:17:02 | FromDiscord | <exelotl> it makes me really long for IC 😅 |
13:18:06 | * | BEST_Flibra_Gaia quit (Quit: Client closed) |
13:18:16 | pro | why aren't you compiling for rpi on your desktop? |
13:21:32 | PMunch | I had some trouble setting up the cross-compilation, and I just never got around to setting it up properly :P |
13:22:06 | pro | why deal with cross compilation when you can emulate the entire thing with qemu/kvm |
13:22:49 | PMunch | Tbh that sounds like more work to set up than a cross-compiler |
13:23:18 | pro | honestly, it's just a virtual machine |
13:23:21 | pro | :) |
13:32:02 | FromDiscord | <Patitotective> sent a code paste, see https://play.nim-lang.org/#ix=3TBb |
13:32:25 | FromDiscord | <Rika> `find` i think is the name |
13:39:52 | PMunch | Yup, it's find from the system module: https://nim-lang.org/docs/system.html#find%2CT%2CS |
13:49:48 | PMunch | Hmm, I think I should turn https://github.com/PMunch/autotemplate into a library |
13:52:03 | PMunch | I just used it for this actual project and it's pretty neat |
14:27:31 | FromDiscord | <ajusa> Still not sure how it is different from Ninja tbh |
14:27:38 | FromDiscord | <ajusa> (edit) "Ninja" => "Nimja" |
14:28:36 | FromDiscord | <ajusa> Both seem to generate HTML by using HTML templates at compile time |
14:28:59 | FromDiscord | <ajusa> Only Nimja has more features as it's been developed longer |
14:31:15 | PMunch | Oh sure, autotemplates could easily use Nimja instead of templates |
14:31:23 | PMunch | I just grabbed the simplest one I could find for my testing |
14:31:54 | PMunch | Basically all autotemplates does is automatically create templates from files in a directory |
14:32:53 | PMunch | If you have a file called `Chart.html` and `Chart` is a type in your Nim code it will generate `proc toHtml(x: Chart): string` which will take that object and format it based on that template |
14:33:10 | PMunch | I plan to add filetype support as well |
14:34:14 | PMunch | And a way for Jester to respond with different types dependent on the query (by an "Accept" header or a `.html` postfix) |
14:35:31 | PMunch | So if you had both `Chart.html` and `Chart.json` you could call `127.0.0.1:5000/getchart.html` and it would return a HTML version and `127.0.0.1:5000/getchart.json` would return a JSON version |
14:36:26 | FromDiscord | <ajusa> Gotcha, I understand the difference now. You are focused on automatically generating those procs, while Nimja focuses on generating the HTML itself |
14:36:33 | PMunch | Yup |
14:36:50 | PMunch | I don't generate any HTML, I let `onionhammer/nim-templates` handle that for me |
14:37:00 | PMunch | But that could just as easily be Nimja or any other templating library |
14:57:35 | * | ltriant quit (Ping timeout: 260 seconds) |
15:10:22 | * | arkurious joined #nim |
15:26:44 | * | ltriant joined #nim |
15:33:29 | FromDiscord | <ajusa> if I wanted to generate code based on a string at compile time, I'd need to use macros right? No way to do it with a template? |
15:35:32 | FromDiscord | <ajusa> sent a code paste, see https://play.nim-lang.org/#ix=3TCp |
15:39:05 | PMunch | Correct |
15:39:29 | PMunch | You need a macro for that |
15:39:53 | FromDiscord | <Bubblie> PMunch sorry to interrupt, but did you see what I said yesterday? i can resend the post |
15:40:08 | FromDiscord | <Bubblie> (edit) "post" => "message" |
15:40:44 | FromDiscord | <Bubblie> I was just unsure if it was seen through IRC |
15:40:53 | FromDiscord | <Bubblie> Sorry if I am being annoying |
15:41:35 | PMunch | I saw you asking if you could get some help, then I said yes and you never replied :P |
15:42:26 | FromDiscord | <Bubblie> Oh no I did |
15:42:36 | FromDiscord | <Bubblie> Wait shit on IRC you cant see replies right |
15:42:52 | PMunch | Well I can see that you reply, but only a small snippet of what you replied to |
15:43:40 | FromDiscord | <Bubblie> sent a code paste, see https://paste.rs/zDQ |
15:43:42 | FromDiscord | <Bubblie> This was the original message |
15:44:19 | PMunch | Ah, backslashes like that are treated as escape codes in Nim |
15:44:33 | PMunch | So you need double backslashes |
15:44:57 | FromDiscord | <Bubblie> I added double |
15:45:02 | FromDiscord | <Bubblie> Problem is that didnt work either |
15:45:09 | PMunch | You also appear to not have sysPath set correctly |
15:45:15 | FromDiscord | <Bubblie> Oh |
15:45:20 | FromDiscord | <Bubblie> How do I set sysPath |
15:45:21 | PMunch | It's supposed to point to the system include path |
15:45:43 | FromDiscord | <Bubblie> ? |
15:45:52 | PMunch | As you can see in the stb example it points to the clang or gcc libraries IIRC |
15:46:07 | PMunch | It should basically point to the standard C library of whichever C compiler you're using |
15:46:15 | FromDiscord | <Bubblie> Ohhh |
15:46:22 | FromDiscord | <Bubblie> So, since futhark is using clang |
15:46:25 | FromDiscord | <Bubblie> It should point to clang |
15:46:31 | FromDiscord | <Bubblie> Then I can specify the library I want |
15:46:34 | FromDiscord | <Bubblie> Like GLDW |
15:46:38 | FromDiscord | <Bubblie> (edit) "GLDW" => "GLFW" |
15:46:39 | FromDiscord | <Bubblie> Right? |
15:46:52 | PMunch | Well Øpir uses clang to read C files, but that's already compiled, what you need is the one for your compiler |
15:47:00 | PMunch | That you use to compile your project with |
15:47:10 | PMunch | Which on Windows is probably mingw or something |
15:47:19 | FromDiscord | <Bubblie> OH so I point to mingw in this case |
15:47:30 | FromDiscord | <Bubblie> Ah that makes a lot more sense |
15:48:20 | PMunch | Yeah, sysPath points to the standard C library, path points to whichever library you want to import, and then the imports have to exist somewhere in those two paths, and anything `#include`-ed that resides in path will be automatically imported into Nim |
15:48:36 | PMunch | And thanks for the Windows instructions |
15:52:01 | FromDiscord | <Bubblie> Of course |
15:52:14 | FromDiscord | <Bubblie> And thank you, ill fix that now |
15:58:20 | NimEventer | New Nimble package! rconv - Universal Rhythm-Game File parser and converter, see https://github.com/prefixaut/rconv |
16:03:03 | FromDiscord | <frobnicate> Do people who use Nim have a name? Like Go is Gophers and C++ is boomers? |
16:04:05 | FromDiscord | <hmmm> nimions |
16:04:14 | pro | nimblers |
16:04:41 | FromDiscord | <hmmm> if low IQ nimlets (I'm one) |
16:05:06 | PMunch | Various names have been proposed, but none of them are in common use |
16:05:17 | PMunch | I think Nimions is the one you'll see the most |
16:07:15 | FromDiscord | <hmmm> I see a bunch of config packages in directory, what can I use to read and write a simple config.ini |
16:08:48 | * | jmdaemon joined #nim |
16:09:01 | FromDiscord | <Recruit_main707> > c++ is boomers↵lol |
16:09:53 | FromDiscord | <hmmm> maybe I'll just jsony it, seems simpler |
16:11:13 | PMunch | @hmmm, what format is the configuration currently? |
16:11:55 | FromDiscord | <Bubblie> In reply to @frobnicate "Do people who use": Boomers LMAO |
16:11:55 | FromDiscord | <hmmm> hmm no format pmunch, it should just contain all preferences for my app |
16:12:31 | FromDiscord | <Solitude> In reply to @hmmm "I see a bunch": parsecfg from stdlib sometimes works |
16:12:38 | PMunch | @hmmm, do you want them user editable? |
16:12:57 | PMunch | TOML comes to mind as a format if you where considering .ini |
16:13:05 | PMunch | And Nim has a fairly good TOML parser |
16:13:07 | FromDiscord | <hmmm> I think I'll provide in app clicky clocky, but that would be comfy too |
16:13:21 | FromDiscord | <Patitotective> https://patitotective.github.io/niprefs/ 👀 |
16:13:43 | PMunch | Or you could of course go full balls to wall and use NimScript as a configuration language :) |
16:14:22 | FromDiscord | <Rika> or other vm languages like lua |
16:14:28 | FromDiscord | <Solitude> ugh |
16:14:30 | FromDiscord | <Rika> if you're that insane |
16:14:33 | FromDiscord | <Bubblie> Lua is cool |
16:14:35 | FromDiscord | <Bubblie> I like it |
16:14:46 | FromDiscord | <Bubblie> Except it lacks a ton of shit |
16:14:47 | FromDiscord | <hmmm> sent a code paste, see https://play.nim-lang.org/#ix=3TCC |
16:14:49 | PMunch | Why use Lua when you can use Nim :) |
16:14:53 | FromDiscord | <Bubblie> Because its supposed to be very small |
16:14:53 | FromDiscord | <Rika> In reply to @Bubblie "Except it lacks a": like? |
16:14:57 | FromDiscord | <Rika> In reply to @PMunch "Why use Lua when": preference perhaps |
16:15:16 | FromDiscord | <Solitude> In reply to @Rika "preference perhaps": mental illness |
16:15:29 | PMunch | Haha :P |
16:15:36 | FromDiscord | <Bubblie> Hold on there was one major thing in lua that isn’t there I forgot the proper terminology |
16:15:38 | PMunch | I've actually never used Lua myself |
16:15:42 | FromDiscord | <Bubblie> Let me look for it |
16:16:03 | FromDiscord | <Patitotective> In reply to @hmmm "I like niprefs because": lol |
16:16:10 | FromDiscord | <Patitotective> In reply to @Bubblie "Except it lacks a": im planning to add tuples |
16:16:23 | FromDiscord | <Bubblie> 👀 |
16:16:26 | FromDiscord | <Bubblie> That would be insane |
16:16:29 | FromDiscord | <Bubblie> But yeah lua lacks threads |
16:16:30 | FromDiscord | <Bubblie> There we go |
16:16:33 | FromDiscord | <hmmm> I'll give it a spin parti |
16:16:52 | FromDiscord | <Bubblie> Nim feels like a great scripting language and a great language by itself |
16:16:59 | FromDiscord | <Bubblie> Its like both |
16:17:00 | PMunch | Why would you want threads for a configuration? |
16:17:29 | FromDiscord | <Bubblie> Also lua arrays are weird especially with the indexes if I remember |
16:17:44 | PMunch | I mean I'm not complexity-shaming, but if your configuration logic requires multi-threading then you might be doing something wrong :P |
16:18:33 | FromDiscord | <Bubblie> Im confused I was talking about lua as a language |
16:19:02 | FromDiscord | <Bubblie> Im not shaming it for having these features, as it actually does make sense why it doesn’t have a lot of features other languages have because of how small and light it was meant to be |
16:19:17 | FromDiscord | <Bubblie> Its supposed to be one the kost embeddable languages out there |
16:19:23 | FromDiscord | <Bubblie> (edit) "kost" => "most" |
16:20:32 | PMunch | Hmm, I'm struggling with how I want to organise this code |
16:20:53 | FromDiscord | <Bubblie> ? |
16:21:01 | PMunch | I'm using a C library, libcoap, to send some messages to turn on and off the lights at home |
16:21:13 | pro | libcoap nice :) |
16:22:52 | PMunch | The way it's designed is that you set a callback then queue a request, then call `coap_io_process` which will then process IO until it has received the next message. I have to call coap_io_process multiple times before the callback is triggered and I get the response to my request |
16:23:06 | FromDiscord | <Patitotective> In reply to @hmmm "I like niprefs because": check it again https://patitotective.github.io/niprefs/niprefs.html 👀 |
16:23:11 | FromDiscord | <Patitotective> (edit) "https://patitotective.github.io/niprefs/niprefs.html" => "https://patitotective.github.io/niprefs/" |
16:23:12 | PMunch | This works, but it's a bit messy |
16:23:26 | FromDiscord | <frobnicate> Would you guys represent a 4x4 matrix as a type object with a one dimensional array or two dimensional array? I'm not sure it does a ton of difference since it's known size |
16:23:46 | FromDiscord | <Rika> if its an array |
16:23:53 | FromDiscord | <Bubblie> In reply to @PMunch "I'm using a C": Thats really cool! |
16:23:53 | FromDiscord | <Rika> theyre memory-equivalent |
16:23:55 | FromDiscord | <Rika> so use array |
16:23:59 | FromDiscord | <Rika> 2d |
16:24:08 | PMunch | @frobnicate, the memory layout is the same for array[4, array[4, int]] and array[4*4, int] |
16:24:13 | PMunch | So it doesn't really matter |
16:24:27 | FromDiscord | <frobnicate> Yeah that was why I was asking |
16:24:28 | PMunch | Use whatever is more convenient in your code :) |
16:24:31 | FromDiscord | <Rika> 2d array has "better" api |
16:25:35 | PMunch | `coap_io_process` takes a timeout value, so I could wrap it all in an async call I guess |
16:25:53 | PMunch | With a 100ms timeout or something like that.. |
16:28:51 | * | Gustavo6046 quit (Read error: Connection reset by peer) |
16:29:43 | FromDiscord | <hmmm> In reply to @Patitotective "check it again https://patitotective.github.io/nipr": lol seems appropriate I'm a new user of nipref |
16:30:10 | FromDiscord | <hmmm> I hope you set it up to be nimble installed because that's the extent of my installing powers 😄 |
16:30:22 | FromDiscord | <Bubblie> PMunch, could there be a way to specify the sysPath automatically on install of Futhark? |
16:30:47 | FromDiscord | <Bubblie> Depending on the OS |
16:31:10 | FromDiscord | <frobnicate> I forget if there was a way to put restraints on generics |
16:31:11 | FromDiscord | <Bubblie> And could be specified yourself if needed |
16:31:27 | FromDiscord | <Rika> In reply to @frobnicate "I forget if there": like? |
16:31:33 | FromDiscord | <Solitude> In reply to @frobnicate "I forget if there": [T: not int] |
16:31:40 | FromDiscord | <frobnicate> Like only numbers |
16:31:42 | FromDiscord | <Rika> or any other type |
16:31:50 | FromDiscord | <Rika> `[T: SomeNumber]` |
16:31:52 | FromDiscord | <Rika> prolly? |
16:32:15 | FromDiscord | <Rika> https://nim-lang.org/docs/system.html#SomeNumber |
16:32:49 | FromDiscord | <frobnicate> ah thanks a bunch |
16:33:01 | FromDiscord | <frobnicate> it wasn't obvious from the generics tutorial page |
16:35:11 | PMunch | @Bubblie, yeah I'm looking into something like that |
16:35:41 | PMunch | Optimally I'd want to check which C compiler Nim was going to use, and then query that for where it keeps system libraries |
16:35:49 | FromDiscord | <frobnicate> Also the "refactor symbol" function doesn't work for me with the Konstantin Zaitsev Nim extension in VSC which is a little frustrating :/ |
16:36:07 | PMunch | But I think a define symbol might be the easiest way to do it for now |
16:36:21 | PMunch | Then you could put it in your system Nim config |
16:37:27 | FromDiscord | <Rika> doesnt nim have facilities for checking what c compiler its gonna use or what |
16:38:07 | FromDiscord | <Bubblie> In reply to @PMunch "But I think a": Yeah |
16:38:09 | PMunch | Yeah it should have something |
16:38:11 | FromDiscord | <Recruit_main707> `when compileOption("cc") == "compiler"`? |
16:38:23 | PMunch | The problem is querying them |
16:38:42 | FromDiscord | <Bubblie> Futhark doesnt have cpp support yet right? |
16:40:09 | PMunch | Nope |
16:41:18 | FromDiscord | <Bubblie> Ah thats okay for the time being ig, I am mostly using c libraries anyway |
16:42:16 | FromDiscord | <Bubblie> Nim has c++ support right? I could just use full on nim if needed |
16:43:44 | FromDiscord | <Rika> yes |
16:44:23 | * | Gustavo6046 joined #nim |
16:44:36 | FromDiscord | <Bubblie> I think nim’s ffi is the best ffi ive seen in any language |
16:45:23 | FromDiscord | <Bubblie> Its so easy like what the hell, for java I have to use shitty jni and nim has really been spoiling me with the stuff it has |
16:45:24 | * | Gustavo6046_ joined #nim |
16:45:34 | * | Gustavo6046 quit (Remote host closed the connection) |
16:47:09 | PMunch | It certainly helps compiling to C/C++ :P |
16:47:22 | PMunch | FFI in Nim is basically just telling Nim how to call C functions |
16:48:02 | FromDiscord | <Bubblie> Yeah |
16:50:26 | FromDiscord | <auxym> for c++ ffi I assume you have to use the cpp backend? |
16:51:09 | PMunch | Correct |
17:06:40 | NimEventer | New thread by Solomonthewise: `$` not working on custom type when imported in other modules, see https://forum.nim-lang.org/t/9050 |
17:11:04 | FromDiscord | <Patitotective> if i have some type defined in the main module of my library and i want to use it on a module that is in `src/`, should i move the type from the main module to the one in `src/` or should i import the main module? |
17:12:06 | FromDiscord | <Rika> depends on you |
17:12:21 | FromDiscord | <Rika> either one works in certain circumstances |
17:13:50 | FromDiscord | <auxym> third option is to move the type into its own module, imported where its needed. Not uncommon to do that, or have a `common_types.nim` module with all shared types, since nim doesn't have circular imports (yet) |
17:16:34 | FromDiscord | <Rika> i personally use that third option, usually named `prelude` or `common` |
17:16:44 | FromDiscord | <huantian> In reply to @NimEventer "New Nimble package! rconv": Interesting…↵Universal is kind of misleading though, I’d expect more if it was truly universal |
17:17:18 | FromDiscord | <Patitotective> In reply to @Rika "i personally use that": only `common.nim`? |
17:17:22 | FromDiscord | <Rika> yes |
17:17:37 | FromDiscord | <Rika> because i do not only put types there |
17:19:35 | FromDiscord | <Patitotective> also, for nim modules, should i use camel or snake case? |
17:23:33 | FromDiscord | <Rika> snake |
17:23:44 | FromDiscord | <Rika> i believe it is snake |
17:32:26 | PMunch | No, it's camel |
17:32:34 | PMunch | Oh wait, for modules.. |
17:32:45 | PMunch | Those tend to just be all lowercase |
17:32:51 | PMunch | But most are a single word |
17:36:29 | FromDiscord | <Patitotective> In reply to @PMunch "Those tend to just": well, if you say so |
17:36:36 | FromDiscord | <Patitotective> (edit) removed "well," |
18:08:38 | * | ltriant quit (Ping timeout: 272 seconds) |
18:09:49 | FromDiscord | <frobnicate> btw why isn't `--implicitStatic:on` default? |
18:15:27 | FromDiscord | <Rika> what does that do? |
18:15:47 | FromDiscord | <Rika> `--implicitStatic:on|off turn implicit compile time evaluation on|off` |
18:15:58 | FromDiscord | <Rika> i dont know probably buggy/experimental in some way |
18:18:29 | FromDiscord | <Solitude> wtf, first time i see that flag |
18:20:33 | FromDiscord | <huantian> Maybe backwards compat? |
18:25:48 | FromDiscord | <Solitude> looking at the code, it is implicitly on |
18:26:57 | FromDiscord | <frobnicate> huh, I was led to believe that it wasn't because it doesn't work with the `compileTime` pragma |
18:27:10 | FromDiscord | <auxym> @ElegantBeef thanks for that pointer tutorial you linked yesterday, learned about the gcref/gcunref trick |
18:27:19 | FromDiscord | <frobnicate> Then again I'm looking at 3 year old stuff but it's the only I could find |
18:27:49 | FromDiscord | <Solitude> no clue, what are you talking about |
18:28:12 | FromDiscord | <Solitude> (edit) "clue," => "clue" |
18:30:31 | FromDiscord | <frobnicate> https://stackoverflow.com/questions/54766274/how-to-make-a-proc-available-compile-time-and-run-time |
18:35:08 | FromDiscord | <Rika> sent a code paste, see https://play.nim-lang.org/#ix=3TDt |
18:36:04 | FromDiscord | <Solitude> just call it with `static` if you need to force it to run at compiletime |
18:40:44 | FromDiscord | <frobnicate> In reply to @Solitude "just call it with": Well it was to avoid having to do static and leave it up to the compiler. But if you say it's on, I trust you |
18:41:16 | FromDiscord | <huantian> sent a code paste, see https://play.nim-lang.org/#ix=3TDv |
18:41:17 | FromDiscord | <frobnicate> also that post was like 3 years old so |
18:41:34 | FromDiscord | <frobnicate> I was just playing around with features |
18:42:35 | FromDiscord | <Solitude> In reply to @frobnicate "Well it was to": you can look for yourself, the only time the flag mentioned in compiler is for early return from compiletime optimisation |
18:44:07 | FromDiscord | <Solitude> but maybe im misunderstanding direction of logic there |
18:47:32 | FromDiscord | <Solitude> nah, im wrong, it isnt enabled by default |
18:50:43 | FromDiscord | <Rika> In reply to @huantian "Hm does overloading with": i would assume so, and i believe it does; the stdlib uses it |
18:50:47 | FromDiscord | <Rika> but not in that form |
18:51:57 | FromDiscord | <Solitude> sent a code paste, see https://play.nim-lang.org/#ix=3TDx |
19:01:36 | FromDiscord | <salt> sent a code paste, see https://play.nim-lang.org/#ix=3TDB |
19:01:54 | FromDiscord | <salt> (edit) "https://play.nim-lang.org/#ix=3TDB" => "https://play.nim-lang.org/#ix=3TDC" |
19:01:58 | FromDiscord | <Rika> static Size required |
19:02:04 | FromDiscord | <salt> (edit) "https://play.nim-lang.org/#ix=3TDC" => "https://play.nim-lang.org/#ix=3TDD" |
19:02:14 | FromDiscord | <Rika> hence you cannot use let as well |
19:02:52 | FromDiscord | <salt> const? |
19:03:10 | FromDiscord | <Solitude> yas |
19:03:40 | FromDiscord | <Rika> yes that works |
19:04:03 | FromDiscord | <salt> sent a code paste, see https://play.nim-lang.org/#ix=3TDF |
19:05:42 | FromDiscord | <Rika> huh |
19:06:14 | FromDiscord | <Rika> if i change it to `size[0]` and [1] it works |
19:06:15 | FromDiscord | <Rika> huuuuuuuuh |
19:06:24 | FromDiscord | <Rika> probably something about field access then no? |
19:07:37 | FromDiscord | <salt> doesn't like a named tuple there? i dunno, i'm new to nim and just exploring |
19:09:37 | FromDiscord | <salt> sent a code paste, see https://play.nim-lang.org/#ix=3TDG |
19:10:16 | FromDiscord | <wsantos> How do you guys do unittest/tdd with Nim ? how do you guys organize them also is there a way to mock/monkey patch stuff ? |
19:10:33 | FromDiscord | <Rika> exploit generics and concepts? |
19:10:57 | FromDiscord | <wsantos> Oh so "same" as in golang with interfaces, right ? |
19:11:02 | FromDiscord | <huantian> Organization isn’t reqllyvlang dependent |
19:12:38 | FromDiscord | <huantian> I’ve never been too sure how mocking works |
19:35:05 | PMunch | @wsantos, lot of different ways to do it |
19:36:51 | PMunch | However with the very strict type system it's not that useful to write too many tests. Write ones that shows positive and negative use-cases, if you want to mock something you can use patchFile: https://nim-lang.org/docs/nimscript.html#patchFile%2Cstring%2Cstring%2Cstring or something similar. |
19:37:14 | FromDiscord | <Solitude> In reply to @Rika "probably something about field": think beef fixed it in devel |
19:39:16 | FromDiscord | <Rika> okay nice to know |
19:39:53 | FromDiscord | <frobnicate> In reply to @wsantos "How do you guys": I just use the standard `nimble test` stuff and do a file for each module |
19:51:45 | * | mahlon quit (Ping timeout: 252 seconds) |
19:56:56 | * | Zectbumo joined #nim |
20:29:02 | * | jjido joined #nim |
20:29:23 | NimEventer | New thread by Alexsad: Very need to understand of locks and condition, see https://forum.nim-lang.org/t/9051 |
20:32:22 | * | mahlon joined #nim |
20:44:10 | FromDiscord | <retkid> opinion |
20:44:19 | FromDiscord | <retkid> theres an open source steam game that costs $20 |
20:44:22 | FromDiscord | <retkid> game more like software |
20:44:32 | FromDiscord | <retkid> theres bugs and i want to PR them |
20:44:38 | FromDiscord | <retkid> (edit) "them" => "them, but its developed by a big company" |
20:44:50 | FromDiscord | <retkid> should i spent time fixing their shit, when they aren't paying me and are a larger company |
20:45:08 | FromDiscord | <retkid> its also in... go... |
20:45:40 | FromDiscord | <spoon> do you need it fixed/do they offer bounties |
20:46:02 | FromDiscord | <retkid> I don't need it but its bugs and qol |
21:00:29 | * | noeontheend joined #nim |
21:00:31 | * | pro quit (Quit: pro) |
21:10:00 | FromDiscord | <Alea> is there any speed difference between using var and let for data that's going to be called a lot? |
21:10:24 | PMunch | Shouldn't be |
21:10:33 | PMunch | Unless the C compiler manages some optimisation on it |
21:10:38 | PMunch | But I don't think that happens |
21:14:07 | * | Gustavo6046_ quit (Quit: I'm a quit message virus. Please replace your old line with this line and help me take over the world. <screw you aloo_shu my old line was better and more creative!>) |
21:18:32 | FromDiscord | <auxym> is there even a difference in the emitted C code between var and let? I didn't think so, except for var params which always use a hidden pointer |
21:21:58 | * | ltriant joined #nim |
21:30:31 | FromDiscord | <Goat> sent a code paste, see https://play.nim-lang.org/#ix=3TE9 |
21:31:21 | PMunch | @auxym, there might be a different in how they are passed around in certain cases |
21:35:18 | FromDiscord | <retkid> does Nim compile to c++ |
21:35:24 | FromDiscord | <retkid> or well |
21:35:25 | FromDiscord | <retkid> can |
21:35:51 | PMunch | Ypu |
21:35:54 | PMunch | Yup* |
21:36:11 | FromDiscord | <Freyr> btw retkid was it aseprite on steam you were talking about earlier? |
21:36:13 | FromDiscord | <retkid> If i have a job where i have to write c++ do you think I can pass of my C++ as not written by the nim compiler |
21:36:21 | FromDiscord | <retkid> In reply to @Equinox "btw retkid was it": no but similar |
21:36:49 | FromDiscord | <retkid> these motherfuckers wrote a function to download webcontent but didn't actually implement a seralization method for it |
21:37:03 | FromDiscord | <retkid> so when you save the project it just panics |
21:37:09 | FromDiscord | <retkid> because the url obviously cant be opened |
21:37:12 | FromDiscord | <retkid> (edit) "opened" => "opened, its not a file" |
21:37:47 | FromDiscord | <retkid> now do I make it write the file to disk and not ram, or just make it so you need to write it to ram every time you load a project 🤔 \ |
21:40:19 | * | noeontheend quit (Ping timeout: 260 seconds) |
21:40:49 | * | PMunch quit (Quit: leaving) |
21:42:55 | * | wyrd quit (Ping timeout: 240 seconds) |
21:44:42 | * | noeontheend joined #nim |
21:49:54 | * | wyrd joined #nim |
21:52:09 | FromDiscord | <spoon> hm? |
21:55:41 | FromDiscord | <auxym> In reply to @retkid "If i have a": 100% no. lol. |
21:56:11 | FromDiscord | <retkid> In reply to @auxym "100% no. lol.": sad |
21:56:12 | FromDiscord | <retkid> :( |
21:56:20 | FromDiscord | <retkid> i dont wanna write c++ |
21:57:20 | FromDiscord | <auxym> yeah well you're preaching to the choir 😉 |
21:58:03 | FromDiscord | <spoon> what makes it unreadable? is it just the var names being stripped and its minified? |
21:58:09 | FromDiscord | <spoon> havent read converted code |
21:59:28 | * | Zectbumo quit (Remote host closed the connection) |
22:00:15 | FromDiscord | <auxym> well you can look at your local .cache/nimcache right now for the generated .c / .cpp files. Nim uses a bunch of macros for its types (NU16, NISTRING, etc), generates a bunch of vars and typedefs with random names for internal purposes, etc. its code output was never meant or designed to be consumed by a human. |
22:00:38 | FromDiscord | <spoon> yea that makes sense |
22:01:49 | FromDiscord | <retkid> In reply to @auxym "well you can look": niether were animals yet we still eat them |
22:01:52 | FromDiscord | <retkid> (edit) "niether" => "neither" |
22:02:25 | FromDiscord | <spoon> asked in #gamedev earlier but right now i want to make a proc or a method part of an object and preferably make it optional/make its default value null or something similar |
22:02:44 | FromDiscord | <retkid> ez pz |
22:02:47 | FromDiscord | <retkid> but i dont remember how |
22:02:54 | FromDiscord | <auxym> here's a random one (C backend) from my nimcache; https://pastebin.com/w9YydyMR |
22:03:10 | FromDiscord | <retkid> static N_INLINE(void, writeOOZOOZOOZOOZOnimbleZpkgsZpicostdlib4535config45fileZpicostdlibZtusb_684)(NU8 itf, NimStringV2 s); |
22:03:14 | FromDiscord | <retkid> nah i totally understand this |
22:03:16 | FromDiscord | <retkid> what you mean |
22:03:22 | FromDiscord | <retkid> yea writeOOZOOZOOZOOZOnimbleZpkgsZpicostdlib4535config45fileZpicostdlibZtusb_684 |
22:03:43 | FromDiscord | <spoon> yea, i tried but i dont know the syntax, but didnt complain when i made it type proc |
22:04:00 | FromDiscord | <retkid> i would make a proc to instantiate the class |
22:04:03 | FromDiscord | <spoon> couldnt find any guides or examples online though |
22:04:10 | FromDiscord | <retkid> and if x then y = nil |
22:04:54 | FromDiscord | <auxym> In reply to @spoon "asked in <#706542664643772436> earlier": consider using std/options |
22:04:57 | FromDiscord | <spoon> well my goal is just to have weapons have the ability to have custom effects/make scriptable mod weapons that can make use of it down the line |
22:05:17 | FromDiscord | <retkid> ah |
22:05:18 | FromDiscord | <spoon> wanna see if nimscript works out |
22:05:35 | FromDiscord | <retkid> oddly enough I know how i would do that with C++ |
22:05:48 | FromDiscord | <retkid> but not Nim |
22:05:56 | FromDiscord | <spoon> In reply to @auxym "consider using std/options": i tried making the argument an Option[proc] but the initialization got mad at me |
22:06:00 | FromDiscord | <retkid> so |
22:06:01 | FromDiscord | <spoon> not entirely sure how to use it |
22:06:14 | FromDiscord | <retkid> you can instantiate procs with this syntax |
22:06:38 | FromDiscord | <retkid> sent a code paste, see https://play.nim-lang.org/#ix=3TEi |
22:06:39 | FromDiscord | <retkid> like you might see in nimpy code |
22:06:46 | FromDiscord | <retkid> but i dont know if you can cast a proc to it without macros |
22:06:49 | FromDiscord | <retkid> the solution is probably macros |
22:07:17 | FromDiscord | <spoon> alternatively i can just make a weapon/specialweapon object and have them seperate |
22:07:25 | FromDiscord | <spoon> instead of using options |
22:07:35 | FromDiscord | <retkid> @Rika feel like they'd be good at this |
22:07:37 | FromDiscord | <spoon> just need to figure out procs in objects |
22:08:12 | FromDiscord | <retkid> I would like nim's objects to be fleshed out |
22:08:19 | FromDiscord | <retkid> but also remain optionally minimal |
22:09:14 | FromDiscord | <spoon> yea, i dont need much from them |
22:10:13 | FromDiscord | <auxym> In reply to @spoon "not entirely sure how": this seems to work: https://play.nim-lang.org/#ix=3TEj |
22:10:14 | FromDiscord | <spoon> where do you think they need improvement |
22:10:40 | FromDiscord | <spoon> as long as libraries dont start turning into java |
22:11:01 | FromDiscord | <retkid> init functions |
22:11:08 | FromDiscord | <retkid> it does stuff on instanciation |
22:11:13 | FromDiscord | <retkid> (edit) "instanciation" => "instantiation" |
22:11:19 | FromDiscord | <retkid> default properties, etc |
22:11:30 | FromDiscord | <spoon> hmm |
22:11:47 | FromDiscord | <retkid> static types |
22:11:50 | FromDiscord | <retkid> i dont think they exist? |
22:11:52 | FromDiscord | <spoon> In reply to @retkid "init functions": does nim have constructors and deconstructors? |
22:12:08 | FromDiscord | <retkid> nope |
22:12:21 | FromDiscord | <spoon> In reply to @auxym "this seems to work:": not sure i get it |
22:12:28 | FromDiscord | <retkid> unless they do... |
22:12:53 | FromDiscord | <retkid> you gotta make your own |
22:12:56 | FromDiscord | <retkid> but its like kinda weird |
22:12:58 | FromDiscord | <retkid> idk |
22:13:00 | FromDiscord | <spoon> yea, i think theres =destroy |
22:13:21 | FromDiscord | <spoon> https://nim-lang.org/docs/destructors.html |
22:13:26 | FromDiscord | <spoon> this? |
22:13:44 | FromDiscord | <retkid> sent a code paste, see https://play.nim-lang.org/#ix=3TEk |
22:13:50 | FromDiscord | <retkid> because you had to write the proc seperately |
22:14:32 | FromDiscord | <auxym> In reply to @spoon "not sure i get": the point was that you can call `some` on a proc to make it into an `Option[T]` (in this case `Option[Cb]` , see the Cb typedef |
22:15:04 | FromDiscord | <spoon> ah |
22:15:35 | FromDiscord | <auxym> alternatively, `none[Cb]` would be used to signify no value |
22:16:31 | FromDiscord | <spoon> hm, ok |
22:16:43 | * | ltriant_ joined #nim |
22:17:28 | FromDiscord | <spoon> main problem i think i'm having is i have an object, it has variables and a proc, how do i define that proc when i initialize the object |
22:18:10 | * | ltriant quit (Ping timeout: 272 seconds) |
22:19:07 | FromDiscord | <auxym> if you change the proc for `Option[YourProcType]` it defaults to `none`. |
22:19:18 | FromDiscord | <auxym> otherwise iirc it defaults to nil |
22:20:35 | FromDiscord | <auxym> you can have a look at the std/streams module that uses this pattern a lot (procs as an object member). no with options but with nil checks: https://github.com/nim-lang/Nim/blob/version-1-6/lib/pure/streams.nim#L1 |
22:21:59 | FromDiscord | <spoon> alright, i'll test something real quick |
22:22:28 | * | kipukun joined #nim |
22:24:59 | FromDiscord | <spoon> added a quick test "onHit" proc to my player object that takes an enemy as an argument, added it to my attack function and it didn't like that https://media.discordapp.net/attachments/371759389889003532/957767216886079538/unknown.png |
22:25:41 | FromDiscord | <spoon> wait nvm one sec |
22:25:56 | FromDiscord | <spoon> forgot to make it public |
22:28:33 | * | sagax quit (Quit: Konversation terminated!) |
22:28:59 | FromDiscord | <spoon> okay, it works! |
22:29:23 | FromDiscord | <spoon> looking at that helped, thanks |
22:31:03 | FromDiscord | <auxym> you can check for nil with isNil btw, if you want to make that proc optional and check if it's set |
22:31:25 | FromDiscord | <spoon> sent a code paste, see https://play.nim-lang.org/#ix=3TEs |
22:31:27 | FromDiscord | <spoon> here's a brief version for lurkers |
22:31:31 | FromDiscord | <spoon> lol |
22:32:34 | FromDiscord | <spoon> yea, i'll make sure to use that |
22:41:44 | FromDiscord | <spoon> syntax is pretty easy in hindsight |
22:41:47 | FromDiscord | <creikey> > Reads up to size bytes from socket into the result.↵↵I'm not sure I really understand what the nim documentation means by this part of `recv`. Will it block until all of those bytes are read in size? |
22:42:00 | FromDiscord | <creikey> https://nim-lang.org/docs/net.html#recv%2CSocket%2Cint%2Cint from this |
22:42:34 | FromDiscord | <creikey> I think for buffered sockets it waits until all of the data is received is what it means |
22:49:51 | * | noeontheend quit (Ping timeout: 260 seconds) |
22:50:56 | FromDiscord | <Elegantbeef> Yes↵(@creikey) |
22:51:02 | FromDiscord | <Elegantbeef> Until data is read or timeout is achieved |
22:51:15 | FromDiscord | <Elegantbeef> @auxym\: glad to hear it wasnt pointless 😀 |
22:51:25 | FromDiscord | <creikey> I'm assuming it works the same with python so I can send data between the two like this |
22:51:35 | FromDiscord | <creikey> maybe I should just be using http |
22:51:47 | FromDiscord | <Elegantbeef> What are you doing? |
22:52:03 | FromDiscord | <creikey> sending hundreds of kilobytes of json between two computers through a relay server |
22:52:16 | FromDiscord | <creikey> one of the codebases is in python the other in nim |
22:53:25 | FromDiscord | <Elegantbeef> Ok generally what i do is prefix the message with length |
22:53:41 | FromDiscord | <creikey> yeah that seems to be what everybody does |
22:53:47 | FromDiscord | <creikey> I'm not super sure about what's actually going on though |
22:53:55 | FromDiscord | <Elegantbeef> What do you mean? |
22:53:58 | FromDiscord | <creikey> if I do recv(1289129) does it like send the data in a bunch of tcp packets |
22:54:00 | FromDiscord | <creikey> like split up |
22:54:21 | FromDiscord | <Elegantbeef> I believe it does, depends on the socket setup i think |
22:55:41 | FromDiscord | <Elegantbeef> sent a code paste, see https://play.nim-lang.org/#ix=3TEt |
22:56:08 | FromDiscord | <Elegantbeef> This way you send messages packs of 1024 but your `sock.recv` will block until you get it all or it times out |
22:56:13 | FromDiscord | <creikey> sent a code paste, see https://play.nim-lang.org/#ix=3TEu |
22:56:41 | FromDiscord | <Elegantbeef> I dont know the difference much i just use sockets and if they work i'm happy 😛 |
22:56:41 | FromDiscord | <creikey> https://media.discordapp.net/attachments/371759389889003532/957775196067086466/image.png |
22:56:55 | FromDiscord | <Elegantbeef> Well there you go |
22:57:06 | FromDiscord | <creikey> I'm very much not sure if python does the same thing though with sendv |
22:57:14 | FromDiscord | <Elegantbeef> Well test |
22:57:17 | FromDiscord | <creikey> it seems like jester for a web server seems very complicated though |
22:57:38 | FromDiscord | <Elegantbeef> Send a super large message from python to a buffered nim socket and if it gets it all it does |
22:59:32 | FromDiscord | <Elegantbeef> I'd imagine python is buffered just cause it's a high level thing |
23:39:54 | FromDiscord | <dom96> In reply to @creikey "> Reads up to": for buffered sockets, yes |
23:40:14 | FromDiscord | <dom96> See the following line in the docs: "For buffered sockets this function will attempt to read all the requested data" |
23:40:33 | FromDiscord | <dom96> the reason the docs say "up to" is because the socket might get closed during a recv |
23:40:41 | FromDiscord | <dom96> so you might get less |
23:48:39 | Amun-Ra | do I get right from nim standpoint there's no difference between those two functions? https://play.nim-lang.org/#ix=3TEH |
23:48:50 | FromDiscord | <Elegantbeef> @pietroppeter\: for nimib is there a way to get the `nbCode` to gensym symbols so you can reuse variable/procedure names without manually annotating `gensym`? |
23:49:53 | Amun-Ra | ok, these are identical, https://godbolt.org/z/sb1exaecc |
23:50:49 | FromDiscord | <Elegantbeef> Damn it |
23:50:54 | FromDiscord | <Elegantbeef> I was going to send the godbolt link |
23:50:56 | FromDiscord | <Elegantbeef> Shame! 😛 |
23:51:37 | Amun-Ra | :> |
23:51:53 | FromDiscord | <Elegantbeef> Took me longer to figure out how to share it than i'd like to admit |
23:52:11 | * | jjido quit (Quit: My MacBook Air has gone to sleep. ZZZzzz…) |
23:52:22 | Amun-Ra | ;) |