00:00:30 | FromDiscord | <mattrb> In reply to @Elegantbeef "Yea <@221832495367323648> https://wandbox.org": I was mostly saying I couldn't see the code you shared on play.nim-lang.org :p |
00:00:52 | FromDiscord | <Elegantbeef> Ah just replace it with ix.io |
00:01:08 | FromDiscord | <Elegantbeef> http://ix.io/3SHT |
00:10:53 | * | pch quit (Remote host closed the connection) |
00:14:53 | * | pch joined #nim |
00:29:44 | * | ltriant_ joined #nim |
00:30:37 | * | ltriant quit (Ping timeout: 240 seconds) |
00:32:01 | * | arkanoid quit (Ping timeout: 256 seconds) |
00:45:45 | FromDiscord | <Girvo> Is a returned seq[byte] from a proc by copy? or is it by ref as its managed? Dumb question I know |
00:48:55 | pch | seq is refferential |
00:49:00 | pch | openarray is copied |
00:49:01 | pch | iirc |
00:50:30 | pch | however seqs are also like, they're a reference to a copy usually |
00:50:40 | pch | it's just the direct storage in the seq is not the copy |
00:50:40 | FromDiscord | <abdu> sent a code paste, see https://play.nim-lang.org/#ix=3SIh |
00:52:30 | FromDiscord | <Girvo> Awesome |
00:52:39 | FromDiscord | <Girvo> Thats what I was expecting, cheers 🙂 |
00:55:08 | FromDiscord | <Girvo> I'm having to pass around a lot of `seq[byte]` for the work I'm doing. Good fun, but nice to work with honestly |
00:56:45 | FromDiscord | <Elegantbeef> what do you mean?↵(@abdu) |
00:57:33 | FromDiscord | <Elegantbeef> sent a code paste, see https://play.nim-lang.org/#ix=3SIk |
01:06:08 | FromDiscord | <abdu> sent a code paste, see https://paste.rs/rw9 |
01:08:34 | FromDiscord | <Elegantbeef> sent a code paste, see https://play.nim-lang.org/#ix=3SIm |
01:18:16 | FromDiscord | <abdu> Works great.. so what insight on quote do, should `var l = newLit 6` be better put inside it or just that ? |
01:18:55 | FromDiscord | <Elegantbeef> sent a code paste, see https://play.nim-lang.org/#ix=3SIq |
01:18:58 | FromDiscord | <abdu> Thanks for useful contribution |
01:19:06 | FromDiscord | <Elegantbeef> In this case there is 0 reason to use a macro |
01:19:48 | FromDiscord | <Elegantbeef> sent a code paste, see https://play.nim-lang.org/#ix=3SIr |
01:21:42 | FromDiscord | <Girvo> Whats the current workflow for working on Nim itself, say if I wanted to try and fix `createThread` etc. for FreeRTOS on the ESP32? |
01:22:23 | FromDiscord | <Elegantbeef> Fork the git repo, follow the build instructions, modify the file, make a PR, profit |
01:22:48 | FromDiscord | <Elegantbeef> https://nim-lang.github.io/Nim/contributing.html is useful aswell |
01:27:16 | * | kayabaNerve joined #nim |
01:31:21 | FromDiscord | <Elegantbeef> Oh also @Girvo `openArray`s are slices so even if they're copied they're just a pointer and len so it's cheap |
01:32:02 | FromDiscord | <Elegantbeef> You generally want to use them instead of index slicing if you care about memory usage |
01:33:36 | FromDiscord | <Elegantbeef> sent a code paste, see https://play.nim-lang.org/#ix=3SIC |
01:36:21 | FromDiscord | <Girvo> Ohhhhhhh neat |
01:36:42 | FromDiscord | <Girvo> Alright I might swap the nesper stuff to work with openarray instead. I think it'll be superior for what I'm after, I'll have a play though |
01:36:54 | FromDiscord | <Girvo> Cheers! (now drink) |
01:37:14 | FromDiscord | <Elegantbeef> Drinky drinky is bad for the health |
01:37:55 | FromDiscord | <Girvo> Like _incredibly_ bad lol. I've never understood the "Ballmer Peak" stuff, alcohol makes programming way too difficult for me |
01:38:26 | FromDiscord | <Elegantbeef> I've never drank so no clue for me, i do know that alcohol can be a stimulant though |
01:39:02 | FromDiscord | <Girvo> Not missing much. I'm stoked that the no-alcohol gins are easily available where I am now. All the taste, none of the downside |
01:40:26 | FromDiscord | <Elegantbeef> I'm like the completely wrong person for this area, rural Canada yet I dont drink or do drugs |
01:40:53 | FromDiscord | <Girvo> Haha yeah |
01:41:01 | FromDiscord | <creikey> https://github.com/treeform/windy/blob/master/src/windy.nim#L10 windy exports vmath here, can I `import windy` but just the exported vmath as I don't want the whole library imported? |
01:42:26 | FromDiscord | <Girvo> `vmath` appears to be a separate library, no? |
01:43:29 | FromDiscord | <Girvo> Though its not in the nimble requirements list. Likely a sub-req of one of its dependencies? |
01:43:47 | FromDiscord | <creikey> In reply to @Girvo "Though its not in": it is yes |
01:43:56 | FromDiscord | <creikey> it's a requirement of `windy` and exported from it |
01:44:05 | FromDiscord | <creikey> I guess I could just do `requries vmath` |
01:44:09 | FromDiscord | <creikey> and import vmath |
01:44:12 | FromDiscord | <creikey> and it doesn't install it twice |
01:44:14 | FromDiscord | <Girvo> Yeah thats what I'd do if thats what you're after |
01:44:52 | FromDiscord | <Girvo> As long as the version requirement matches, it will use the same one |
01:45:08 | FromDiscord | <creikey> just checked and it didn't even have a requires vmath in the nimble file so I opened an issue |
01:46:30 | FromDiscord | <Girvo> Yeah thats what threw me off |
01:46:42 | FromDiscord | <Girvo> And I can't see it in the other requires so far |
01:47:28 | FromDiscord | <Girvo> Can you see `vmath` in your `.nimble/pkgs` folder after installing `windy`? |
01:53:55 | FromDiscord | <Elegantbeef> Seems it's a forgetten dependancy |
01:54:26 | FromDiscord | <Girvo> Yeah, most likely because its by the same author so they've `nimble develop`-ed it |
01:54:47 | FromDiscord | <Girvo> I made the same mistake with `nesper` initially lol |
01:58:31 | FromDiscord | <Elegantbeef> Yea i've done similar |
02:01:43 | FromDiscord | <creikey> I feel like that should be linted for |
02:47:57 | NimEventer | New thread by Mardiyah: The 'for i in ...' loop inside parsing macro , see https://forum.nim-lang.org/t/9020 |
03:32:29 | FromDiscord | <Kiwids> hi guys. I am coding a small webapp that connected to the backend SQLite DB and using jester to get the request from client. But it seems like somewhere in the thread that is blocking( i have to press `Enter` in console to make the data parse thru). I tried to make all function async, but seems like its still unstable sometimes. I wonder if theres a way for me to find out where exactly the blockage is at |
03:34:07 | FromDiscord | <Kiwids> https://media.discordapp.net/attachments/371759389889003532/954221135459921950/unknown.png |
03:34:23 | FromDiscord | <Kiwids> this is the API that I was testing and getting stuck... |
03:42:30 | FromDiscord | <Kiwids> reduced the code to, still getting a block https://media.discordapp.net/attachments/371759389889003532/954223241986191370/unknown.png |
03:43:39 | FromDiscord | <Kiwids> 🤔 could it be the decode |
03:45:48 | FromDiscord | <Kiwids> nope... |
03:46:35 | FromDiscord | <Kiwids> literaly this gets blocked. might be a console app issue on windows? im sorry guys i am so noob at this... https://media.discordapp.net/attachments/371759389889003532/954224272392478720/unknown.png |
03:48:09 | nrds | <Prestige99> You think the echo is blocking execution? |
03:49:16 | FromDiscord | <Kiwids> oh lord |
03:49:26 | FromDiscord | <Kiwids> 😢 |
03:50:54 | FromDiscord | <Kiwids> I needa a way to see if the request is actually coming in tho.. 🤔 |
03:51:24 | nrds | <Prestige99> echo should work fine afaik |
03:52:26 | FromDiscord | <Kiwids> hmmm that's so weird... I have two bots just sending get request and it gets blocked. but maybe let me try something to see if its the echo |
03:53:01 | FromDiscord | <Kiwids> if its blocked without echoing. I should be able to see it if I send the 3rd request on top of my 2 bots, the server should hang |
03:53:58 | FromDiscord | <Kiwids> nope.. it still blocking. |
03:57:59 | FromDiscord | <Elegantbeef> Do you have a `readline` somewhere? |
03:58:20 | FromDiscord | <Kiwids> yes |
03:58:34 | FromDiscord | <Kiwids> everytime when program starts. it asks me if I want to reinitiate the DB |
03:58:37 | FromDiscord | <Elegantbeef> Well there is you blocking |
03:58:38 | FromDiscord | <Kiwids> you think that's the problem? |
03:58:53 | FromDiscord | <Elegantbeef> If it's not in the loop, no |
03:59:04 | FromDiscord | <Kiwids> its not |
03:59:10 | FromDiscord | <Elegantbeef> But you're describing a `readLine` inside your programs loop |
03:59:20 | FromDiscord | <Elegantbeef> Needing to hit enter sounds exactly like a readline in the loop |
03:59:26 | FromDiscord | <Kiwids> https://media.discordapp.net/attachments/371759389889003532/954227505680777226/unknown.png |
03:59:34 | FromDiscord | <Kiwids> this function I create calls a readLine() |
04:00:06 | FromDiscord | <Elegantbeef> Can i see the entire program? |
04:00:07 | FromDiscord | <Kiwids> In reply to @Elegantbeef "Needing to hit enter": yeah i know haha. sometimes I need to press `Enter` after 5 get request. sometimes is 2 |
04:00:31 | FromDiscord | <Kiwids> I am so sorry can't really share the source code. |
04:00:37 | FromDiscord | <Kiwids> (edit) "I am so sorry can't really share the ... source" added "full" |
04:01:08 | FromDiscord | <Elegantbeef> Cant say much then aside from make sure your stdinIO isnt done in the main loope |
04:02:32 | FromDiscord | <Kiwids> yeah! my code looks just like this one https://github.com/dom96/nim-in-action-code/tree/master/Chapter7/Tweeter |
04:02:41 | FromDiscord | <Kiwids> as I was reading the book and want to start a small project |
04:04:23 | FromDiscord | <Kiwids> https://media.discordapp.net/attachments/371759389889003532/954228751619727390/unknown.png |
04:04:46 | FromDiscord | <Elegantbeef> `nim -v`? |
04:05:35 | FromDiscord | <Kiwids> https://media.discordapp.net/attachments/371759389889003532/954229055102783578/unknown.png |
04:06:04 | FromDiscord | <Kiwids> `nim c --gc:boehm --threads:on -d:windows --app:console -o:Server.exe ` |
04:06:08 | FromDiscord | <Kiwids> and this is my compiler falg |
04:06:12 | FromDiscord | <Kiwids> (edit) "falg" => "flag" |
04:06:21 | FromDiscord | <Elegantbeef> What does `renderMain`, `renderTimeline` and `renderLogin` do? |
04:06:43 | FromDiscord | <Kiwids> it copies the sql data and put them into a hardcoded html page |
04:06:53 | FromDiscord | <Kiwids> and just feed it back to the client iirc |
04:07:19 | FromDiscord | <Elegantbeef> So there is 100% no stdin io there in your case? |
04:08:19 | FromDiscord | <Kiwids> ` let ok = readLineFromStdin("Previous database file found, do you want to start fresh? [Y/N] ", line)` in createDatbase() I have one. but that's it |
04:09:12 | FromDiscord | <Kiwids> and if the previous database file is not there. it won't even promot for user input, I wrapped the readLine under a fileExist() |
04:09:17 | FromDiscord | <Kiwids> (edit) "readLine" => "`readLine`" | "fileExist()" => "`fileExist()`" |
04:09:50 | FromDiscord | <Elegantbeef> If thats the case this shouldnt be happening |
04:09:56 | FromDiscord | <Elegantbeef> But without code i cant say anything |
04:10:10 | FromDiscord | <Kiwids> sure thanks! i am also very confused hah |
04:10:31 | FromDiscord | <Kiwids> I tried spawn new threads to handle some db tasks. but still no luck |
04:10:39 | FromDiscord | <Kiwids> (edit) "tasks." => "tasks(previous async)." |
04:10:44 | FromDiscord | <Elegantbeef> Well it will never fix the actual problem |
04:10:51 | FromDiscord | <Kiwids> yep |
04:11:50 | * | slowButPresent quit (Quit: leaving) |
04:12:45 | FromDiscord | <Kiwids> like if I press `Enter`, the server will be working fine for a solid minute https://media.discordapp.net/attachments/371759389889003532/954230855352606741/unknown.png |
04:13:07 | FromDiscord | <Kiwids> but it will eventually get block, where no debug info is displayed until the next `Enter` |
04:19:05 | FromDiscord | <Elegantbeef> I can suggest going to the nearest well and throw a penny and wish for a solution |
04:19:17 | FromDiscord | <Kiwids> sounds like a plan! |
04:24:19 | FromDiscord | <Kiwids> `customOverlapped.data.fd == lpCompletionKey.AsyncFD` [AssertionDefect] |
04:24:26 | FromDiscord | <Kiwids> got a error and program crashed 🤔 |
04:24:38 | FromDiscord | <Kiwids> could it be this? https://media.discordapp.net/attachments/371759389889003532/954233846054924308/unknown.png |
04:24:55 | FromDiscord | <Kiwids> since I reopen the db file everytime the API gets called? |
04:26:05 | FromDiscord | <Elegantbeef> You arent closing the dbconnection |
04:26:13 | FromDiscord | <Kiwids> oh fk |
04:26:22 | FromDiscord | <Kiwids> I commented some of those line out... |
04:26:25 | FromDiscord | <Elegantbeef> So if you open a new one then dont close it that could be an isssue |
04:26:37 | FromDiscord | <Kiwids> ye |
04:26:54 | FromDiscord | <Kiwids> let me try that |
04:27:27 | FromDiscord | <Kiwids> still blocked. let me try to pass as ref |
04:27:33 | FromDiscord | <Elegantbeef> Doesnt make sense that `enter` would continue |
04:28:02 | FromDiscord | <Kiwids> hmm yeah. it crashed again with db.close() |
04:28:06 | FromDiscord | <Elegantbeef> Are you 1000% certain the pressing of enter moves it and it's not just a coincidence? |
04:28:20 | FromDiscord | <Kiwids> nvm |
04:28:34 | FromDiscord | <Kiwids> In reply to @Elegantbeef "Are you 1000% certain": yeah no haha I can screenshare the flow haha |
04:29:13 | FromDiscord | <Elegantbeef> That'd mean to me atleast something is getting your stdin as a file descriptor which would be a very odd bug |
04:29:35 | FromDiscord | <Kiwids> 🤔 |
04:31:06 | FromDiscord | <Bubblie> how do I convert nim code to c++ code? |
04:31:27 | FromDiscord | <Elegantbeef> You rewrite it but with 20% more brainpower |
04:31:55 | FromDiscord | <Bubblie> I mean like, since nim compiles to c/c++/js I was wondering where to get the output |
04:32:10 | FromDiscord | <Elegantbeef> Ah |
04:32:14 | FromDiscord | <Kiwids> you can |
04:32:21 | FromDiscord | <Kiwids> there is a compiler flag for it i think |
04:32:26 | FromDiscord | <Elegantbeef> it's in your `.cache/nim/` or you can do `--nimcache:someDir` |
04:33:03 | FromDiscord | <Bubblie> I wonder how neat the output would be... I just started with nim and I love it so far because let me tell you c/c++ is awful |
04:33:16 | FromDiscord | <Elegantbeef> It's not meant to be human read |
04:33:22 | FromDiscord | <Bubblie> yeah |
04:33:24 | FromDiscord | <Elegantbeef> You can do `-d:danger` to make it a bit more readable |
04:33:29 | FromDiscord | <Bubblie> I would assume so since its compiling to it |
04:33:47 | FromDiscord | <Bubblie> In reply to @Elegantbeef "You can do `-d:danger`": ah okay |
04:33:49 | FromDiscord | <Bubblie> thank you |
04:34:06 | FromDiscord | <Elegantbeef> Also can use `--gc:arc` or `orc` which will help a bit |
04:34:16 | FromDiscord | <Bubblie> I like that I can use c/c++ libraries in nim without having to use c/c++ LOL |
04:34:21 | FromDiscord | <Elegantbeef> Dont suggest danger unless you want somewhat clean IR, otherwise use `release` |
04:34:35 | FromDiscord | <Bubblie> In reply to @Elegantbeef "Dont suggest danger unless": ah okay, thank you so much |
04:34:41 | FromDiscord | <Bubblie> Ill keep that in mind |
04:35:24 | FromDiscord | <Bubblie> is there vulkan graphics bindings for nim? |
04:35:31 | FromDiscord | <Elegantbeef> Yes |
04:35:39 | FromDiscord | <Bubblie> oh wow, that's awesome |
04:36:30 | FromDiscord | <Bubblie> There is also NimGL 👀 |
04:36:34 | FromDiscord | <Bubblie> sick |
04:36:52 | FromDiscord | <Elegantbeef> You're a gamedev? |
04:37:51 | FromDiscord | <Bubblie> sorta, my main language is java and I mostly make mods for minecraft and applications and I have dabbled with web dev a bit but I really disliked JS |
04:38:01 | FromDiscord | <Bubblie> I was going into vulkan to make my own engine of sorts |
04:38:03 | FromDiscord | <Bubblie> using C++ |
04:38:24 | FromDiscord | <Bubblie> but uh well, it wasn't enjoyable using C++ |
04:38:34 | FromDiscord | <Elegantbeef> Of course not it's C++ 😛 |
04:38:51 | FromDiscord | <Bubblie> my second option is rust but I don't do well with symbol soup languages |
04:38:56 | FromDiscord | <Bubblie> then I found nim yesterday |
04:39:21 | FromDiscord | <Elegantbeef> I also use Nim for gamedev, though i also just make macros for arbitrary things for fun |
04:39:35 | FromDiscord | <Bubblie> that's awesome! |
04:39:51 | FromDiscord | <Bubblie> I hope to use nim for gamedev because of how actually readable things are |
04:40:19 | FromDiscord | <Elegantbeef> It's very good for gamedev imo since it has nice macros and a good type system |
04:40:28 | FromDiscord | <Bubblie> Nim vulkan has no issues right? Or is there something I need to look out for |
04:40:35 | FromDiscord | <Bubblie> In reply to @Elegantbeef "It's very good for": yeah I definitely love the type system here |
04:40:51 | FromDiscord | <Elegantbeef> What do you mean vulkan issues? |
04:42:05 | FromDiscord | <Elegantbeef> I dont use vulkan, so no clue how nice it is to use with Nim |
04:46:58 | FromDiscord | <Bubblie> In reply to @Elegantbeef "What do you mean": as in like, there aren't many problems with the bindings |
04:47:00 | FromDiscord | <Bubblie> is my question |
04:47:10 | FromDiscord | <Elegantbeef> It should be like using it in C |
04:56:33 | FromDiscord | <Equinox> In reply to @Bubblie "my second option is": Symbol soup |
04:56:45 | FromDiscord | <Equinox> What does that mean |
04:57:01 | FromDiscord | <Elegantbeef> `std::<vector<SomeType<int>>` |
04:57:22 | FromDiscord | <huantian> I like my <> |
04:57:47 | FromDiscord | <Equinox> In reply to @Elegantbeef "`std::<vector<SomeType<int>>`": That’s not so bad |
04:58:00 | FromDiscord | <Equinox> How else would you convey that? |
04:58:05 | FromDiscord | <Equinox> What’s the nim way |
04:58:05 | FromDiscord | <Elegantbeef> sorry it's `std::vector<std::variant<int, SomeType<int, float>` |
04:58:11 | FromDiscord | <Elegantbeef> `seq[SomeType[int]` |
04:58:21 | FromDiscord | <Elegantbeef> Perhaps closing both brackets |
04:58:37 | FromDiscord | <Equinox> Yeah but that rust is not correct |
04:58:40 | FromDiscord | <Elegantbeef> It also uses `` and `&` so it gets fucky |
04:58:43 | FromDiscord | <Equinox> You don’t need the std |
04:58:50 | FromDiscord | <Equinox> Vector is just vec |
04:58:53 | FromDiscord | <Elegantbeef> That's not rust |
04:59:08 | FromDiscord | <Equinox> Oh ok |
04:59:13 | FromDiscord | <Equinox> We’re doing C++ |
04:59:35 | FromDiscord | <Equinox> I don’t write C++ I have no reason to defend it |
04:59:39 | FromDiscord | <Equinox> Too many things |
05:01:57 | FromDiscord | <Elegantbeef> Rust and C++ both have similar symbol noise imo |
05:03:06 | FromDiscord | <Equinox> The rust version of that is a bit smaller |
05:03:15 | FromDiscord | <Elegantbeef> I mean in general |
05:03:33 | FromDiscord | <Equinox> Vec<sometype<i32>> |
05:04:03 | FromDiscord | <Equinox> In reply to @Elegantbeef "I mean in general": Probably true |
05:05:59 | FromDiscord | <treeform> Crazy Nim bug causing me to pull hair out, I get a segfault in reading and writing to some UncheckedArrays, but if I add some dummy code to slow down to loop it works fine... in fact! just doing 17 inc'ers `for z in 0 ..< 17: counter += 1` works but 16 inc'ers `for z in 0 ..< 16: counter += 1` not enough slow down. What kind of crazy things is this! |
05:06:30 | FromDiscord | <Elegantbeef> Code causing the issue? |
05:08:36 | FromDiscord | <treeform> sent a code paste, see https://play.nim-lang.org/#ix=3SIV |
05:08:44 | FromDiscord | <treeform> its a simple copy loop |
05:09:05 | FromDiscord | <treeform> Can C cause undefined behavior when copying two overlapping 64 bit numbers? |
05:09:10 | FromDiscord | <Elegantbeef> It's syncronous code? |
05:09:18 | FromDiscord | <treeform> yes, no threads, no async |
05:09:32 | FromDiscord | <treeform> fine in orc and arc, but not refc or none |
05:09:52 | FromDiscord | <treeform> if uncomment the `for z in 0 ..` it works |
05:10:15 | FromDiscord | <Elegantbeef> Is `dst` or `dst2` a seq? |
05:10:35 | FromDiscord | <treeform> no its a `ptr UncheckedArray[uint8]` |
05:10:47 | FromDiscord | <Elegantbeef> And it doesnt point to a sequence? |
05:11:01 | FromDiscord | <treeform> yes |
05:11:04 | FromDiscord | <treeform> it comes from a seq |
05:11:16 | FromDiscord | <treeform> I though it was getting moved or something |
05:11:20 | FromDiscord | <Elegantbeef> `gcref` and `gcunref` the see before and after the op |
05:12:01 | FromDiscord | <treeform> I keep the seq around so it does not get collected |
05:12:45 | FromDiscord | <treeform> but I could GCref it so it stays in memory always for ever |
05:14:45 | FromDiscord | <treeform> `GC_ref(dst)` does not help |
05:22:40 | FromDiscord | <Kiwids> aight. just spend some time reading the nim-forum source code.. |
05:22:44 | FromDiscord | <Elegantbeef> You do ensure the size is the same or less than right? |
05:22:58 | FromDiscord | <Kiwids> I willl try to adjust my db : dbConn to see if that's the problem |
05:24:55 | FromDiscord | <Elegantbeef> sent a code paste, see https://play.nim-lang.org/#ix=3SIX |
05:25:51 | FromDiscord | <Kiwids> also I tried to search for `runForever()` in the source code for Nim-Forum but I couldn't find an |
05:25:52 | FromDiscord | <Kiwids> (edit) "an" => "any" |
05:25:55 | FromDiscord | <Kiwids> (edit) "also I tried to search for `runForever()` in the source code for Nim-Forum but I couldn't find any ... " added "🤔" |
05:26:29 | FromDiscord | <Elegantbeef> @treeform\: does the above behave differently? |
05:29:09 | FromDiscord | <treeform> dst is not len is mod 8 |
05:29:29 | FromDiscord | <treeform> we need to be able to access any index not just the uint64 steps |
05:29:39 | FromDiscord | <Elegantbeef> Well there you go if dst's len isnt mod 8 you're doing unsafe memory access |
05:29:41 | FromDiscord | <treeform> with bytes |
05:29:42 | FromDiscord | <treeform> sent a code paste, see https://paste.rs/MrG |
05:30:06 | FromDiscord | <treeform> we just want to do it faster |
05:30:11 | FromDiscord | <treeform> by going 8 bytes at a time |
05:30:14 | FromDiscord | <Elegantbeef> If you're writing 8 bytes to a seq that only has allocated 3 bytes you're going to destroy it |
05:30:24 | FromDiscord | <treeform> we make sure its long enough |
05:30:39 | FromDiscord | <Elegantbeef> You should figure out what size fits the best IE `8 -> 4 -> 2 -> 1` |
05:30:51 | FromDiscord | <treeform> the byte works |
05:31:04 | FromDiscord | <treeform> but uin16, uint32, uint64 does not |
05:31:14 | FromDiscord | <Elegantbeef> How does the above code make sure it's long enough |
05:31:17 | FromDiscord | <Elegantbeef> It's offsetting it by 8 bytes writing the 8 bytes from the right |
05:31:35 | FromDiscord | <Elegantbeef> Any remainder will be writing after the sequence |
05:31:52 | FromDiscord | <Bubblie> does nim have algebraic data types? |
05:32:03 | FromDiscord | <Elegantbeef> So if you dont use the largest size that is smaller than dest length it's going to fail |
05:32:13 | FromDiscord | <Elegantbeef> It has object variants which are manually declared tagged unions |
05:32:23 | FromDiscord | <Elegantbeef> There are also things like https://github.com/alaviss/union |
05:33:01 | FromDiscord | <Elegantbeef> In the above case you said the length is not mod 8 which means you write 8 bytes then you attempt to write 8 more and say it's 15 bytes, you have 1 byte going onto some other heap memory |
05:33:35 | FromDiscord | <Elegantbeef> Atleast given what you've explained, what you're doing is wildly unsafe |
05:34:48 | FromDiscord | <treeform> @ElegantBeef I think you helped me out! I was going to link you the file https://github.com/guzba/zippy/blob/master/src/zippy/inflate.nim#L216-L224 but turns out it has a newer version that fixes the issues that I did not see. Thanks! |
05:35:16 | FromDiscord | <treeform> The `if copyTo < 0` is strange but its a cheap way to make it work. |
05:37:11 | FromDiscord | <Elegantbeef> I mean i clearly didnt help out at all, i just made you look at it 😛 |
05:40:01 | FromDiscord | <Elegantbeef> I still dont think `copy64` is actually safe, but i'm a fool |
06:05:12 | FromDiscord | <treeform> We been using copy64 in a ton of places. But maybe it some sort of unsafe behavior which works 99.999% of the time. |
06:05:18 | FromDiscord | <Bubblie> Can you have nim without garbage collection? |
06:05:27 | FromDiscord | <treeform> This is very strange for us. |
06:05:30 | FromDiscord | <Bubblie> And manually memory manage |
06:05:37 | FromDiscord | <Elegantbeef> You can but there isnt much point to |
06:05:54 | FromDiscord | <Elegantbeef> Arc/Orc give you a good memory management system and isnt a typical GC |
06:06:04 | FromDiscord | <Elegantbeef> Orc is RAII like memory management with a cycle collector |
06:06:12 | FromDiscord | <treeform> We do manually memory manage in tight loops... |
06:06:20 | FromDiscord | <treeform> (edit) "manage" => "management" |
06:06:39 | FromDiscord | <Bubblie> Is there any docs on nim’s memory management system? |
06:06:49 | FromDiscord | <Elegantbeef> I mean you wont really notice if what i think is happening is happening, since you're writing to random spots on the heap |
06:06:56 | FromDiscord | <Rika> https://nim-lang.github.io/Nim/mm.html |
06:07:34 | FromDiscord | <Elegantbeef> Since you're writing in blocks of 8 i think you're accidently ruining data after the sequence, though i'm not 100% certain |
06:08:06 | FromDiscord | <Elegantbeef> Like the `<=` 16 here is very very suspect to me https://github.com/guzba/zippy/blob/master/src/zippy/inflate.nim#L204-L206 |
06:08:45 | FromDiscord | <Elegantbeef> I know it's min size is 16 based off line 200, but i dont see anything smaller than 8 bytes being written |
06:09:13 | FromDiscord | <Bubblie> I was just wondering how memory management would play out in nim if I needed it, like if I wanted to run nim in something relatively old and I couldn’t use a gc in it |
06:09:16 | FromDiscord | <Elegantbeef> So like what happens if your source is not divisible by 8 |
06:09:51 | FromDiscord | <Elegantbeef> You'd use it like c with `alloc` and `dealloc` but Nim's `arc` is RAIII like so is generally very low overhead |
06:09:52 | FromDiscord | <treeform> In reply to @Elegantbeef "Since you're writing in": I am pretty sure we don't write beyond the allocated memory. We have asserted that to death. |
06:10:05 | FromDiscord | <Rika> In reply to @Bubblie "I was just wondering": As many people have already told you ARC isn’t a “GC” exactly |
06:10:34 | FromDiscord | <Elegantbeef> I've used arc on the rpi pico, it's quite easy and lovely to use |
06:11:02 | FromDiscord | <Elegantbeef> It's a deterministic memory mangement system that cannot handle cycles so pretty ideal for embedded |
06:12:00 | FromDiscord | <treeform> I also like arc for games and such |
06:12:26 | FromDiscord | <Elegantbeef> I'd say use orc by default, if you dont need it it's not going to cost you anything |
06:12:27 | FromDiscord | <treeform> I wish I could run my stuff with orc enable that only tells me when it finds cycles I forgot about, and then release with arc. |
06:13:11 | FromDiscord | <Bubblie> In reply to @Rika "As many people have": Yeah |
06:13:15 | FromDiscord | <Elegantbeef> Probably could add a `--nimDebugOrc` which echos some info for cycles |
06:13:28 | FromDiscord | <Elegantbeef> Dont know how hard that'd be to add to the compiler |
06:13:32 | FromDiscord | <Bubblie> So ORC is more manual than ARC right? |
06:13:35 | FromDiscord | <Elegantbeef> I've not touched memory related stuff |
06:13:36 | FromDiscord | <Elegantbeef> No |
06:13:49 | FromDiscord | <Elegantbeef> Arc is RAII, so it doesnt have a cycle collector |
06:13:53 | FromDiscord | <Bubblie> OH |
06:13:55 | FromDiscord | <Elegantbeef> Orc is Arc + Cycle collector |
06:13:56 | FromDiscord | <Bubblie> Alright |
06:14:02 | FromDiscord | <Bubblie> yeah got it |
06:14:35 | FromDiscord | <Elegantbeef> So arc will insert RC destroy calls into your program and your entire GC will be a static placement of decrements and calls to destroy |
06:14:43 | FromDiscord | <Elegantbeef> So with arc you know where things are going to be destructed |
06:15:14 | FromDiscord | <Bubblie> Thats really cool |
06:15:16 | FromDiscord | <Elegantbeef> Worth noting that the GCs only effect `ref`, `seq` and `string` |
06:15:30 | FromDiscord | <Bubblie> This language is great oml |
06:15:57 | FromDiscord | <Elegantbeef> `ptr` is always manually managed which can point to the GC'd stuff if you know it's safe(It's a system programming language afterall, need unsafe features) |
06:16:25 | FromDiscord | <Elegantbeef> You havent even experienced the best part, introspective macros which allow you to abstract low level code to a high level api 😛 |
06:16:52 | FromDiscord | <Rika> Beef here tends to go overkill on those though so practice moderation |
06:17:01 | FromDiscord | <Elegantbeef> What's moderation? |
06:17:11 | FromDiscord | <Elegantbeef> Everything is a nail and i have a macro hammer |
06:19:42 | FromDiscord | <Elegantbeef> To be fair rika my largest Nim package requires macros heavily, so.... uhhh it'd be a disservice if i wasnt proficient in macros! |
06:22:10 | FromDiscord | <Bubblie> Lol |
06:27:49 | FromDiscord | <Rika> thats not my point |
06:27:56 | FromDiscord | <Rika> its fine do be proficient but you're trigger happy |
06:28:22 | FromDiscord | <Elegantbeef> Did someone say macro |
06:29:41 | FromDiscord | <Elegantbeef> Jokes aside, i do try to use the least complex tool |
06:30:11 | FromDiscord | <Bubblie> Im gonna try nim-vulkan tommorow |
06:30:26 | FromDiscord | <Elegantbeef> Have fun writing 10000 loc for a single triangle |
06:30:33 | FromDiscord | <Bubblie> Try to render a triangle without having to type 10000 lines |
06:30:41 | FromDiscord | <Bubblie> LMAO |
06:30:52 | FromDiscord | <Bubblie> We said the same thing kinda |
06:31:03 | FromDiscord | <Bubblie> Yeah to render a triangle it takes a literal bible |
06:31:06 | FromDiscord | <Elegantbeef> https://github.com/beef331/truss3d/blob/master/src/truss3D.nim#L99-L131 cube is easy 😛 |
06:31:27 | FromDiscord | <Elegantbeef> Yea my opengl/sdl2/assimp abstraction is like 1k loc so far i think |
06:31:43 | FromDiscord | <Bubblie> Vulkan java vulkan rust vulkan C++ arent all that better in verbosity |
06:31:47 | FromDiscord | <Bubblie> So like |
06:32:20 | FromDiscord | <Elegantbeef> Vulkan is just verbose, so it's just going to be getting that to a point you can happily use it |
06:32:33 | FromDiscord | <Elegantbeef> Personally i can barely stand the opengl API so i dont know how people write vulkan |
06:33:09 | FromDiscord | <Bubblie> Well, I hate OpenGL because of opengl’s state machine |
06:33:11 | FromDiscord | <Bubblie> It drives me mad |
06:33:26 | FromDiscord | <Bubblie> The reason people use vulkan is to avoid gl’s state |
06:33:46 | FromDiscord | <Bubblie> Because oh my god, I had to deal with opengl state before for one of my projects |
06:33:48 | FromDiscord | <Bubblie> Horrible |
06:34:26 | FromDiscord | <Elegantbeef> My present API is more like raylib so it's hardly an issue |
06:39:14 | * | def- quit (*.net *.split) |
06:39:14 | * | ssiyad quit (*.net *.split) |
06:39:14 | * | tinystoat quit (*.net *.split) |
06:44:34 | * | def- joined #nim |
06:44:34 | * | ssiyad joined #nim |
06:44:34 | * | tinystoat joined #nim |
06:44:58 | * | ssiyad quit (Max SendQ exceeded) |
06:45:05 | * | ssiyad joined #nim |
07:04:01 | NimEventer | New post on r/nim by thindil: Binding Nim to C++ std::list ❚ A Scripter's Notes, see https://reddit.com/r/nim/comments/tgvhjy/binding_nim_to_c_stdlist_a_scripters_notes/ |
07:19:48 | * | arkurious joined #nim |
07:27:06 | * | vicecea quit (Remote host closed the connection) |
07:27:36 | * | vicecea joined #nim |
07:42:28 | FromDiscord | <Schelz> Anyone know how to bind to nim a cpp interface M |
07:42:35 | FromDiscord | <Schelz> (edit) "M" => "?" |
08:18:44 | * | PMunch joined #nim |
08:36:22 | * | jjido joined #nim |
09:05:51 | PMunch | Hmm, why is httpclient.Response.status a string and not a HttpCode? |
09:07:14 | FromDiscord | <Elegantbeef> It perhaps carries the extended message like "- page not found"? |
09:07:45 | FromDiscord | <Rika> https://nim-lang.org/docs/httpclient.html#code |
09:20:40 | FromDiscord | <abdu> How do we pre-allocate a string to avoid reallocation expense ? |
09:20:59 | FromDiscord | <Elegantbeef> `newStringOfCap` |
09:29:15 | * | jjido quit (Quit: My MacBook Air has gone to sleep. ZZZzzz…) |
10:18:35 | * | lumo_e joined #nim |
10:20:02 | * | PMunch quit (Quit: Leaving) |
10:30:29 | FromDiscord | <abdu> How NIm's syntax a=b=c=5 , just like of it in C ? |
10:40:13 | Amun-Ra | a=5; b=5; etc. |
10:43:12 | FromDiscord | <Generic> Nim does not have a multiple assignment syntax like this |
10:43:21 | FromDiscord | <abdu> real RHS is about 30 characters |
10:43:32 | FromDiscord | <Generic> in Nim assignments are statements and not expressions |
10:46:14 | Amun-Ra | abdu: this is a call for refactoring |
10:47:10 | FromDiscord | <mratsim> In reply to @abdu "How NIm's syntax a=b=c=5": If you want you can create a template `:=` that assigns and return the assignment. |
10:48:24 | FromDiscord | <mratsim> sent a code paste, see https://play.nim-lang.org/#ix=3SJP |
10:52:07 | * | Lord_Nightmare quit (Quit: ZNC - http://znc.in) |
10:53:10 | FromDiscord | <Generic> doesn't this need a discard or a discardable somewhere? |
10:53:43 | FromDiscord | <Rika> Yes I assume so |
10:56:11 | * | Lord_Nightmare joined #nim |
11:05:04 | * | NeoCron joined #nim |
11:17:55 | FromDiscord | <exelotl> (please don't actually do this though) 😅 |
11:20:58 | FromDiscord | <Rika> Well it’s your choice and you should know the downsides or consequences of using such pattern |
11:23:22 | FromDiscord | <0ffh> sent a code paste, see https://play.nim-lang.org/#ix=3SJW |
11:24:51 | FromDiscord | <0ffh> sent a code paste, see https://paste.rs/HiJ |
12:06:11 | FromDiscord | <Daan B> image.png https://media.discordapp.net/attachments/371759389889003532/954350002174582804/image.png |
12:06:27 | FromDiscord | <Daan B> image.png https://media.discordapp.net/attachments/371759389889003532/954350064321568818/image.png |
12:07:29 | FromDiscord | <Rika> Tried running under valgrind with malloc? |
12:31:44 | FromDiscord | <Forest> 👀 https://github.com/jjv360/nim-classes |
12:33:37 | FromDiscord | <Forest> Any reasons why this shouldn't be used? |
12:34:48 | FromDiscord | <Forest> Or does anyone know of a more complete implementation |
12:34:55 | FromDiscord | <Forest> Yes i haven't given up on classes in Nim |
12:36:56 | FromDiscord | <auxym> I don't see anything any reason not to use that style, other than the usual caveats of OOP |
12:37:23 | FromDiscord | <auxym> summed up here: https://boxbase.org/entries/2020/aug/3/case-against-oop/ |
12:37:39 | FromDiscord | <Daan Breur> In reply to @Rika "Tried running under valgrind": Nope. What's that? |
12:38:28 | Amun-Ra | Forest: method is one of the reasons |
12:42:42 | FromDiscord | <Forest> In reply to @auxym "summed up here: https://boxbase.org/entries/2020/au": Hm, doesn't seem like anything that limits me in Python |
12:42:46 | FromDiscord | <Forest> In reply to @Amun-Ra "<@909883978717204561>: method is one": Wdym? |
12:53:57 | FromDiscord | <auxym> deep, opaque class hierarchies and lots of hidden mutable state are things that OOP tend to migrate towards, but I can guess can be avoided if you are careful |
12:55:56 | FromDiscord | <auxym> methods use dynamic dispatch, which is a slight performance disadvantage but can also make it harder to reason about which overload will be called |
13:01:11 | FromDiscord | <DevNugget> how do I delete the last value from a sequence?↵using ^1 or -1 gives an error |
13:07:49 | FromDiscord | <konsumlamm> https://nim-lang.github.io/Nim/system.html#pop%2Cseq%5BT%5D |
13:26:28 | * | slowButPresent joined #nim |
13:39:49 | * | jjido joined #nim |
13:50:30 | FromDiscord | <mratsim> In reply to @Forest "Or does anyone know": https://github.com/yglukhov/iface |
13:51:06 | FromDiscord | <Forest> In reply to @auxym "methods use dynamic dispatch,": Ah fair |
13:51:12 | FromDiscord | <Forest> In reply to @mratsim "https://github.com/yglukhov/iface": Thanks! |
14:15:49 | NimEventer | New thread by Markus_gritsch: NewSeq() named inconsistently?, see https://forum.nim-lang.org/t/9021 |
14:24:58 | * | jjido quit (Quit: My MacBook Air has gone to sleep. ZZZzzz…) |
14:25:59 | * | robertmeta quit (Ping timeout: 250 seconds) |
14:27:36 | * | robertmeta joined #nim |
14:27:40 | * | jjido joined #nim |
14:28:57 | * | 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!>) |
15:10:01 | * | jjido quit (Quit: My MacBook Air has gone to sleep. ZZZzzz…) |
15:23:18 | FromDiscord | <DevNugget> how can I insert a value into the second last position of a sequence? |
15:26:17 | FromDiscord | <Tanguy> sent a code paste, see https://play.nim-lang.org/#ix=3SKZ |
15:27:09 | FromDiscord | <Tanguy> (edit) "https://play.nim-lang.org/#ix=3SKZ" => "https://play.nim-lang.org/#ix=3SL1" |
15:27:26 | NimEventer | New Nimble package! ftd2xx - Nim wrapper for FTDI ftd2xx library, see https://github.com/leeooox/ftd2xx |
15:27:33 | FromDiscord | <Tanguy> (edit) "https://play.nim-lang.org/#ix=3SL1" => "https://play.nim-lang.org/#ix=3SL3" |
15:38:41 | FromDiscord | <Eshoe> I think I'm too used to dynamic languages. Just the sheer need to convert types. Say an int seq to a string seq is tripping me up. |
15:39:35 | FromDiscord | <Tanguy> sent a code paste, see https://play.nim-lang.org/#ix=3SL6 |
15:40:20 | FromDiscord | <Eshoe> 😯 awesome |
15:42:10 | FromDiscord | <Eshoe> Is there a documentation style that's I want to do X, here are the functions you might want to use? Or is the only option right now is to go through libraries until you find something nice? |
15:43:50 | FromDiscord | <demotomohiro> https://nim-lang.org/docs/lib.html↵https://internet-of-tomohiro.netlify.app/nim/faq.en.html |
15:44:54 | FromDiscord | <demotomohiro> If you want to searcch for libraries: https://internet-of-tomohiro.netlify.app/nim/faq.en.html#libraries-is-there-list-of-libraries-or-packages-for-nimqmark |
15:45:38 | FromDiscord | <Eshoe> The FAQ looks interesting, thanks! |
15:49:58 | FromDiscord | <Require Support> is there a better way to include a header file other than `{.emit: """#include "../some_header.h"""".}` |
15:53:38 | FromDiscord | <demotomohiro> Header pragma: https://nim-lang.org/docs/manual.html#implementation-specific-pragmas-header-pragma |
16:17:21 | FromDiscord | <Shinyzenith> How do I specify that a function parameter should be a pointer |
16:17:37 | FromDiscord | <Rika> Pointer to what |
16:17:44 | FromDiscord | <Rika> Void pointer? Typed pointer? |
16:17:52 | FromDiscord | <Rika> Do you really want a pointer? |
16:17:58 | FromDiscord | <Shinyzenith> In reply to @Rika "Do you really want": I do |
16:18:00 | FromDiscord | <Shinyzenith> sent a code paste, see https://play.nim-lang.org/#ix=3SLj |
16:18:06 | FromDiscord | <Shinyzenith> wayland callbacks depend heavily on pointers |
16:18:10 | FromDiscord | <Rika> Void pointer is ‘pointer’ |
16:18:15 | FromDiscord | <Shinyzenith> oke |
16:18:51 | FromDiscord | <Shinyzenith> not sure what I'm doing wrong but I think it wants me to give the function a type too↵I'm not sure if that's even possible https://media.discordapp.net/attachments/371759389889003532/954413582987186176/unknown.png |
16:18:57 | FromDiscord | <Shinyzenith> this is after I changed it to just `pointer` ^ |
16:20:28 | FromDiscord | <Rika> Add a cdecl pragma |
16:20:33 | FromDiscord | <Shinyzenith> I did |
16:20:44 | FromDiscord | <Shinyzenith> https://media.discordapp.net/attachments/371759389889003532/954414057165828198/unknown.png |
16:20:52 | FromDiscord | <Shinyzenith> dk how to remove gcsafe |
16:20:57 | FromDiscord | <Shinyzenith> or locks:0 |
16:21:13 | Amun-Ra | you lack a ptr in 1st argument |
16:21:58 | FromDiscord | <Shinyzenith> Oh yes |
16:22:38 | FromDiscord | <Shinyzenith> should I just change it to listener: pointer <mytype> ? https://media.discordapp.net/attachments/371759389889003532/954414537614975046/unknown.png |
16:22:48 | FromDiscord | <Rika> No |
16:22:51 | Amun-Ra | pass 1st argument via ddr |
16:22:54 | Amun-Ra | addr* |
16:22:54 | FromDiscord | <Rika> “ptr” for typed |
16:23:06 | FromDiscord | <Rika> So ‘ptr type’ |
16:23:15 | FromDiscord | <Shinyzenith> ok |
16:23:38 | FromDiscord | <Shinyzenith> yep ptr worked |
16:23:45 | FromDiscord | <Shinyzenith> addr asked me to change it to unsafeAddr |
16:23:54 | FromDiscord | <Shinyzenith> and that complained about a possible null pointer |
16:37:01 | * | lumo_e quit (Ping timeout: 240 seconds) |
16:59:49 | Amun-Ra | Shinyzenith: either use unsafeAddr or make that thing 'var' |
17:01:20 | FromDiscord | <Shinyzenith> ptr works fine :D |
18:17:52 | * | jjido joined #nim |
18:55:05 | * | jjido quit (Quit: My MacBook Air has gone to sleep. ZZZzzz…) |
19:22:11 | * | pro joined #nim |
19:26:01 | FromDiscord | <guzba> In reply to @Elegantbeef "I know it's min": there is no check for that, it is all set up to work even if you only actually want eg 12 of the 16 bytes written |
19:50:34 | * | pch quit (Read error: Connection reset by peer) |
20:07:48 | FromDiscord | <Eshoe> sent a code paste, see https://play.nim-lang.org/#ix=3SMF |
20:23:11 | FromDiscord | <Bubblie> Nim has pointers |
20:23:13 | FromDiscord | <Bubblie> Right |
20:24:47 | FromDiscord | <Bubblie> Since pointers are technically memory management, they cannot be gc’d right? |
20:31:41 | FromDiscord | <Generic> In reply to @Eshoe "I'm so confused. Trying": the issue is `arr: array[`len`, int])` |
20:31:52 | FromDiscord | <Generic> (edit) "In reply to @Eshoe "I'm so confused. Trying": the issue is `arr: array[`len`, int])`" => "sent a code paste, see https://play.nim-lang.org/#ix=3SMP" |
20:32:03 | FromDiscord | <Generic> if you just want to zero initialise the array, leave it away entirely |
20:32:45 | FromDiscord | <Generic> otherwise use an array initialiser, i.e. [as, many, values, as, the, array, is, long] |
20:33:46 | FromDiscord | <Generic> In reply to @Bubblie "Since pointers are technically": yes, though they can be wrapped in objects with destructors so they can be used like smart pointers in C++ |
20:35:14 | FromDiscord | <Generic> In reply to @Eshoe "I'm so confused. Trying": also unless you plan on doing some other things in that macro, using a macro for that is a bit of an overkill |
20:38:54 | FromDiscord | <auxym> In reply to @Bubblie "Since pointers are technically": this might be relevant: https://forum.nim-lang.org/t/9006 |
20:45:40 | FromDiscord | <Eshoe> sent a code paste, see https://play.nim-lang.org/#ix=3SMU |
20:56:17 | FromDiscord | <Bubblie> In reply to @auxym "this might be relevant:": thanks! |
20:56:42 | FromDiscord | <Bubblie> I am dealing with something that requires pointers so using nim pointers would help |
20:57:15 | FromDiscord | <Bubblie> or in this case |
20:57:38 | FromDiscord | <Bubblie> wrapped in objects |
20:58:42 | FromDiscord | <Bubblie> can nim be used with rust? |
20:58:59 | * | dtomato quit (Read error: Connection reset by peer) |
20:59:10 | * | dtomato joined #nim |
21:03:07 | * | pch joined #nim |
21:07:42 | FromDiscord | <Bubblie> https://github.com/yglukhov/jnim |
21:07:49 | FromDiscord | <Bubblie> this is awesome |
21:07:56 | FromDiscord | <Bubblie> java and nim 👀 |
21:10:16 | * | kenran joined #nim |
21:15:46 | FromDiscord | <Daan Breur> Java 👀 |
21:16:40 | FromDiscord | <Generic> Java 😱 |
21:22:44 | * | def- quit (Quit: -) |
21:22:56 | * | def- joined #nim |
21:31:57 | FromDiscord | <Bubblie> Java is the main language I use so |
21:32:04 | FromDiscord | <Bubblie> this offers some possibilities 😈 |
21:42:15 | * | wyrd quit (Ping timeout: 240 seconds) |
21:42:18 | FromDiscord | <treeform> In reply to @Bubblie "Java is the main": My condolences |
21:44:35 | * | wyrd joined #nim |
21:46:17 | FromDiscord | <m4ul3r> Does nim's base64 module only support utf8? |
21:47:00 | FromDiscord | <Bubblie> In reply to @treeform "My condolences": LMAO |
21:48:49 | FromDiscord | <Bubblie> is nim and rust a thing? |
21:48:54 | FromDiscord | <Bubblie> Can I use rust and nim together somehow |
21:50:58 | FromDiscord | <TennisBowling> sent a code paste, see https://play.nim-lang.org/#ix=3SNc |
21:52:40 | FromDiscord | <Elegantbeef> @TennisBowling\: you're using `await` in a non async proc |
21:52:50 | FromDiscord | <Elegantbeef> https://play.nim-lang.org/#ix=3SNd should work |
21:53:09 | FromDiscord | <TennisBowling> i-↵↵thank you |
21:54:08 | FromDiscord | <Elegantbeef> Really someone needs to PR to the async macro to ensure it's in a procedure that can await |
21:55:16 | FromDiscord | <Elegantbeef> That error occurs so much |
21:56:47 | FromDiscord | <TennisBowling> it should give a clearer message - although a stupid error on my part |
21:57:01 | FromDiscord | <Elegantbeef> Yes like i said |
21:58:03 | FromDiscord | <TennisBowling> sent a code paste, see https://paste.rs/Pru |
21:58:16 | FromDiscord | <TennisBowling> oh |
21:58:19 | FromDiscord | <TennisBowling> is r.body none then |
22:02:29 | FromDiscord | <Elegantbeef> Guess today is my "attempt to add a good error message to the `await` macro day" |
22:16:01 | FromDiscord | <DeltaPHC> In reply to @Bubblie "Can I use rust": Maybe if you go through the C ABI, which is generally how most languages interoperate these days |
22:16:23 | FromDiscord | <Bubblie> C ABI 😭 |
22:16:39 | FromDiscord | <Elegantbeef> Why would you even use both |
22:16:57 | FromDiscord | <Bubblie> idk it would be cool to interop both though |
22:17:07 | FromDiscord | <DeltaPHC> Alternatively: poke around with wasm |
22:17:09 | FromDiscord | <Elegantbeef> There is a project for it though |
22:17:33 | FromDiscord | <Bubblie> Sometimes coding doesn't need to have a purpose, it can just be cursed |
22:17:44 | FromDiscord | <Elegantbeef> https://github.com/arnetheduck/nbindgen |
22:17:45 | FromDiscord | <Bubblie> In reply to @DeltaPHC "Alternatively: poke around with": 👀 |
22:17:55 | FromDiscord | <Bubblie> In reply to @Elegantbeef "https://github.com/arnetheduck/nbindgen": 👁️👁️ |
22:18:02 | FromDiscord | <Bubblie> I will take a look at this |
22:18:08 | FromDiscord | <Bubblie> 62 stars |
22:18:09 | FromDiscord | <Bubblie> woah |
22:18:15 | FromDiscord | <Bubblie> oh wait |
22:18:19 | FromDiscord | <Bubblie> 61 contributers |
22:18:33 | FromDiscord | <Bubblie> now 63 stars |
22:19:13 | FromDiscord | <DeltaPHC> Still goes through the C ABI. It just automates some of it for you |
22:20:16 | FromDiscord | <Bubblie> thats still great |
22:22:58 | FromDiscord | <Bubblie> also why do anti viruses hate nim exactly |
22:23:52 | FromDiscord | <Elegantbeef> Viruses are written in Nim is what some people think |
22:23:58 | FromDiscord | <Elegantbeef> So they found a pattern and it's the nim code 😜 |
22:26:16 | FromDiscord | <Bubblie> damn |
22:26:28 | FromDiscord | <Bubblie> I mean, arent viruses commonly made in C and C++ to though |
22:26:33 | FromDiscord | <Bubblie> (edit) "to" => "too" |
22:26:59 | FromDiscord | <Bubblie> people really using the nim lang for evil ig |
22:27:24 | FromDiscord | <Elegantbeef> Well Nim is a high level language that's nice to write and creates small self contained binaries |
22:27:54 | FromDiscord | <Bubblie> yeah makes total sense |
22:27:56 | FromDiscord | <Bubblie> but damn |
22:39:59 | FromDiscord | <Phil> Ah, we on the topic of how Antiviruses are somewhat bs sometimes? |
22:41:41 | FromDiscord | <Phil> sent a long message, see http://ix.io/3SNr |
22:42:33 | * | kenran quit (Quit: WeeChat info:version) |
22:43:03 | FromDiscord | <Phil> I'm semi certain that the details are a bit more complicated than I laid them out here but afaik the gist is correct |
22:43:59 | FromDiscord | <Phil> In reply to @Bubblie "Java is the main": Oh hey, a fellow java drinker |
22:45:27 | FromDiscord | <Bubblie> In reply to @Isofruit "Think of it more": yeah |
22:45:35 | FromDiscord | <Bubblie> but it is definitely saddening to have nim's name tarnished like this |
22:45:46 | FromDiscord | <Bubblie> I was talking about nim in a server today |
22:45:55 | FromDiscord | <Bubblie> and one of the first things brought up about it is the anti viruses made for it |
22:46:06 | FromDiscord | <Bubblie> (edit) removed "anti" | "for it" => "with ti" |
22:46:09 | FromDiscord | <Bubblie> (edit) "ti" => "it" |
22:46:21 | FromDiscord | <Bubblie> In reply to @Isofruit "Oh hey, a fellow": YOOO you develop in java as well? Lets go |
22:47:05 | FromDiscord | <Phil> Webdev, Spring, Elasticsearch, Mysql, mongo etc. |
22:48:02 | FromDiscord | <Bubblie> I use java for backend dev, and for minecraft mods |
22:48:10 | FromDiscord | <Bubblie> Also for like |
22:48:22 | FromDiscord | <Bubblie> software dev too but |
22:48:33 | FromDiscord | <Bubblie> for game dev I kind of felt as if I shouldn't use it as much |
22:48:36 | FromDiscord | <Bubblie> especially with graphics |
22:48:48 | FromDiscord | <Bubblie> lwjgl can be a real pain |
22:48:54 | FromDiscord | <Phil> I think the java GC makes consistent framerates near impossible |
22:48:58 | FromDiscord | <Bubblie> fr |
22:49:00 | FromDiscord | <Bubblie> it does |
22:49:16 | FromDiscord | <Bubblie> don't get me wrong java has never failed me with software development and servers and such |
22:49:17 | FromDiscord | <Bubblie> but |
22:49:22 | FromDiscord | <Bubblie> graphics? uh |
22:49:26 | FromDiscord | <Bubblie> not the BEST per say |
22:49:28 | FromDiscord | <Bubblie> its doable |
22:49:29 | FromDiscord | <Bubblie> but |
22:49:36 | FromDiscord | <Phil> Not great, yeah |
22:49:39 | FromDiscord | <Phil> I dabbled in swing once |
22:49:39 | FromDiscord | <Bubblie> yeah |
22:49:41 | FromDiscord | <Phil> I ran screaming |
22:49:43 | FromDiscord | <Bubblie> oh no swing |
22:49:45 | FromDiscord | <Bubblie> Im so sorry |
22:50:32 | FromDiscord | <Phil> Since then I've learned the joys of just using browser-tech for GUIs and the backend just as a REST API |
22:51:27 | FromDiscord | <Phil> As apparently the gnome desktop also uses JS for a lot of stuff I'm starting to feel tempted to find a gnome-project though |
22:51:35 | FromDiscord | <creikey> sent a code paste, see https://play.nim-lang.org/#ix=3SNt |
22:51:53 | FromDiscord | <creikey> sent a code paste, see https://play.nim-lang.org/#ix=3SNu |
22:51:58 | FromDiscord | <Bubblie> In reply to @Isofruit "As apparently the": I didnt know gnome used js a lot |
22:52:07 | FromDiscord | <Elegantbeef> dont convert to GVec2 |
22:52:35 | FromDiscord | <Phil> In reply to @Bubblie "I didnt know gnome": Me neither, I was very surprised to find JS and CSS files in gnome extension folders. You can google GJS, it's essentially a node-like thingy with a lot of bindings to gnome libs |
22:52:50 | FromDiscord | <creikey> In reply to @Elegantbeef "dont convert to GVec2": without it there's still an error |
22:53:13 | FromDiscord | <creikey> sent a code paste, see https://play.nim-lang.org/#ix=3SNv |
22:53:22 | FromDiscord | <Elegantbeef> vec2 is float32 |
22:53:26 | FromDiscord | <creikey> ahhhh |
22:53:39 | FromDiscord | <Elegantbeef> do `rotate(120.0f...` |
22:53:50 | FromDiscord | <creikey> float64 to float32 converter? |
22:54:01 | FromDiscord | <creikey> the worst idea of all time |
22:54:11 | FromDiscord | <Elegantbeef> That wouldnt solve it |
22:54:18 | FromDiscord | <Elegantbeef> The issue is the `mat3` is a float64 |
22:54:27 | FromDiscord | <creikey> In reply to @Elegantbeef "The issue is the": mat3 float 64 to mat3 float 32 converter |
22:54:35 | FromDiscord | <Elegantbeef> There you go 😛 |
22:54:43 | FromDiscord | <Elegantbeef> Or you know just write `d` instead of `.0` |
22:54:46 | FromDiscord | <Elegantbeef> or `f` |
22:55:45 | * | lumo_e joined #nim |
22:58:44 | FromDiscord | <TennisBowling> In reply to @TennisBowling "wait this throws this": bump |
22:59:11 | FromDiscord | <Elegantbeef> I dont use async so cannot say much |
23:00:09 | FromDiscord | <huantian> In reply to @Elegantbeef "Guess today is my": oh yeah I remember trying this and then forgetting about it!↵that was fun |
23:00:24 | FromDiscord | <Elegantbeef> Doesnt seem to hard so why didnt you finish it?! |
23:00:33 | FromDiscord | <huantian> uhhh I forgot about it |
23:00:44 | FromDiscord | <Elegantbeef> Well get at it |
23:01:58 | * | pro quit (Quit: pro) |
23:07:09 | FromDiscord | <huantian> oh yeah I do remember something about mulitsync errors but I guess that's an issue with mulitsync and not await |
23:10:50 | * | Lord_Nightmare quit (Quit: ZNC - http://znc.in) |
23:13:34 | * | Lord_Nightmare joined #nim |
23:20:13 | FromDiscord | <Equinox> Hey does anyone know what the naming conventions in nim are? |
23:20:42 | FromDiscord | <Elegantbeef> lower camel case procedures, pascal cased types |
23:22:36 | FromDiscord | <Equinox> In reply to @Elegantbeef "lower camel case procedures,": Thank you |
23:22:54 | FromDiscord | <Elegantbeef> https://nim-lang.org/docs/nep1.html for all your conventional needs |
23:23:16 | FromDiscord | <Elegantbeef> Nim has style insensitivity so aslong as you start procedures with lower case and types with uppercase you'll be fine in my books |
23:25:35 | * | Gustavo6046 joined #nim |
23:25:48 | * | jjido joined #nim |
23:26:46 | * | Gustavo6046 quit (Remote host closed the connection) |
23:27:06 | * | Gustavo6046 joined #nim |
23:34:43 | FromDiscord | <luteva> The nim tutorial says that "Usually types with inheritance are also marked as ref types even though this isn't strictly enforced."↵So why is it usual to use a ref type? Why shouldn't you use a value type in inheritance? What is the disadvantage of using a value type in inheritamce? |
23:35:24 | * | Gustavo6046 quit (Ping timeout: 252 seconds) |
23:37:44 | FromDiscord | <Elegantbeef> A value type loses information on conversion |
23:37:59 | FromDiscord | <Elegantbeef> So unless you're ok with that it's highly suggested to use `ref` |
23:39:58 | FromDiscord | <luteva> do you have any example?↵which information is lost on conversion? You mean the runtime type information? |
23:40:12 | FromDiscord | <Elegantbeef> sent a code paste, see https://paste.rs/z1x |
23:40:35 | FromDiscord | <Elegantbeef> In the above case since `A` is a value type, `c` is lost on conversion to `A` |
23:40:54 | FromDiscord | <Elegantbeef> And you cannot convert from `A` to `B` since value type conversion chops fields off |
23:41:20 | FromDiscord | <luteva> ahhh ok! thanks! |
23:41:24 | FromDiscord | <Elegantbeef> This all comes from the fact non refs are stack variables and as such you cannot fit `C` in place of `A` |
23:42:17 | * | Gustavo6046 joined #nim |
23:50:37 | FromDiscord | <Elegantbeef> @huantian\: what was your solution? |
23:50:50 | FromDiscord | <Elegantbeef> https://play.nim-lang.org/#ix=3SND mine is this mess |