00:00:16 | * | tk quit (Quit: Well, this is unexpected.) |
00:00:38 | FromDiscord | <Elegantbeef> You can |
00:00:43 | * | tk joined #nim |
00:01:10 | FromDiscord | <Elegantbeef> for their case `proc doThing[T, Y: static int](arr: array[T,array[Y, char]])` would work \:d |
00:17:00 | FromDiscord | <wsantos> I'd like to have a variable name with `` is that possible ? I'm receiving `"invalid token: trailing underscore"`, the idea it to have a "suffix" so I can do some magic depending on the suffix |
00:17:48 | FromDiscord | <Elegantbeef> Nim doesnt allow double underscores |
00:17:52 | FromDiscord | <Elegantbeef> What are you trying to do |
00:20:03 | FromDiscord | <wsantos> Well I still on my django Fight, and my filter function receive the field and the value that needs to be filtered, so I'd like to do `.filter(createdgte=DATETIME)` as example |
00:20:30 | FromDiscord | <Elegantbeef> the suffix would do what? |
00:21:19 | FromDiscord | <wsantos> in this case will create a sql `created >= now()` without it `.filter(create=DATETIME)` would generate sql`created = now()` |
00:22:09 | FromDiscord | <congusbongus> Sounds like you should use a string to represent the operation |
00:22:28 | FromDiscord | <Elegantbeef> why not just support `filter(create'gte = DateTime)` or `filter(gte(created) = DateTime)`? |
00:22:48 | FromDiscord | <wsantos> Yeah it seems like :/ I'm trying to keep as close as possible from django |
00:22:56 | FromDiscord | <wsantos> what is `'` there ? |
00:23:07 | FromDiscord | <Elegantbeef> It's' used for literals |
00:23:34 | FromDiscord | <Elegantbeef> Ah nvm doesnt work heree |
00:23:52 | FromDiscord | <congusbongus> Well there are filters like createdtimegte which can do a time of day comparison |
00:23:52 | FromDiscord | <Elegantbeef> Actually i guess it could |
00:24:13 | FromDiscord | <congusbongus> (edit) "createdtimegte" => "‘createdtimegte’" |
00:24:45 | FromDiscord | <congusbongus> (edit) "‘createdtimegte’" => "“createdtimegte”" |
00:25:40 | FromDiscord | <Elegantbeef> I dont get why you dont just pass it as an arg, it's much cleaner imo |
00:25:47 | FromDiscord | <wsantos> In reply to @Elegantbeef "Actually i guess it": Would you mind to show one example in the playground ? |
00:25:59 | FromDiscord | <Elegantbeef> Nah it didnt i looked into it |
00:26:01 | FromDiscord | <Elegantbeef> I was wrong |
00:26:21 | FromDiscord | <Elegantbeef> `filter(created = DateTime, gte)` is the cleanest imo |
00:26:29 | FromDiscord | <Elegantbeef> Better than using literals to determine comparison |
00:26:33 | FromDiscord | <Elegantbeef> Or identifiers |
00:27:03 | FromDiscord | <wsantos> Another example `.filter(pub_dateyear=current_year, question_textstartswith='What')` |
00:27:40 | FromDiscord | <wsantos> that would generate sql`pub_date = XXXX and question like "What%"` |
00:27:56 | FromDiscord | <wsantos> In reply to @Elegantbeef "`filter(created = DateTime, gte)`": Filter can receive n arguments |
00:28:35 | FromDiscord | <Elegantbeef> Final offer `filter((pubDate: currentYear, year), (questionText: "what", startWith))` |
00:29:38 | FromDiscord | <wsantos> I think this is the only option and I really liked it, thank you |
00:30:23 | FromDiscord | <Elegantbeef> You could also do `year(pubData, currentYear)` but eh you do you 😛 |
00:32:06 | FromDiscord | <wsantos> Nice, I think this is simpler, thank you. |
00:32:44 | FromDiscord | <wsantos> In reply to @Elegantbeef "Final offer `filter((pubDate: currentYear,": Question is `(pubDate: currentYear, year)` a tuple ? |
00:32:51 | FromDiscord | <Elegantbeef> Yes |
00:33:18 | FromDiscord | <wsantos> Hmm can you have an "unnamed" parameter ? how do you access it ? index ? |
00:33:26 | FromDiscord | <Elegantbeef> `[1]` |
00:34:03 | FromDiscord | <Elegantbeef> In nim named tuples are just sugar for `[]` |
00:35:32 | FromDiscord | <Elegantbeef> Where's the ansiwave author, he has an odd affinity for tuples |
00:36:08 | FromDiscord | <Elegantbeef> I half believe he counts tuples to fall asleep |
00:36:39 | FromDiscord | <Elegantbeef> "int tuple, int float tuple, int float string tuple ..." |
00:37:32 | FromDiscord | <wsantos> lol |
00:37:40 | FromDiscord | <sheldon> How to initialise seq[seq[string]] |
00:38:29 | FromDiscord | <Elegantbeef> `import std/sequtils; var mySeq = newSeqWith(10, newSeq[string](100))` |
00:39:16 | FromDiscord | <sheldon> Have to specify a length? |
00:39:25 | FromDiscord | <Elegantbeef> You dont have to |
00:39:37 | FromDiscord | <Elegantbeef> `var mySeq: seq[seq[string]]` is a empty sequence |
00:40:41 | FromDiscord | <sheldon> Is it possible to index mySeq[0][0] without specifying the length? |
00:41:06 | FromDiscord | <Elegantbeef> If it doesnt have a length it'd have an error |
00:43:25 | FromDiscord | <sheldon> What if the length of nested container is dynamically changed and unknown? |
00:44:22 | FromDiscord | <Elegantbeef> If you have nested seqs that's not possible |
00:44:53 | FromDiscord | <Elegantbeef> `mySeq.len` and `mySeq[index].len` work |
00:45:28 | FromDiscord | <Elegantbeef> Sequences arent fixed length, so you can still grow and remove them |
00:45:38 | FromDiscord | <Elegantbeef> Those procedures dont make them stick at a given length |
00:52:16 | FromDiscord | <Alea> where does nimble grab the author bit from during nimble init? |
00:52:26 | FromDiscord | <Elegantbeef> The nimble file |
00:52:32 | FromDiscord | <Alea> it grabbed another username and I've got no clue how it did that |
00:52:46 | FromDiscord | <Elegantbeef> Oh nimble init |
00:52:48 | FromDiscord | <Elegantbeef> I cant read |
00:52:59 | FromDiscord | <Elegantbeef> It should be the active account |
00:53:07 | FromDiscord | <Alea> active what account |
00:53:17 | FromDiscord | <Elegantbeef> \`\`$USER\` |
00:53:28 | FromDiscord | <Elegantbeef> on \nix, no clue on windows |
00:53:32 | FromDiscord | <Alea> huh |
00:53:53 | FromDiscord | <Alea> cause it grabbed by school username, which I don't remember ever adding on this pc |
00:55:33 | FromDiscord | <Alea> that username isn't in my env variables either :EmotiHmmm: |
00:55:46 | FromDiscord | <Elegantbeef> I could be wrong |
00:56:09 | * | arkanoid joined #nim |
00:56:41 | arkanoid | what is C++ "void (*)(long, char *, int, long)" in nim? (using importcpp) |
00:57:17 | FromDiscord | <Elegantbeef> I do not know |
00:58:28 | FromDiscord | <Elegantbeef> Where is it used? |
00:58:54 | arkanoid | it is callback type |
00:59:31 | FromDiscord | <Elegantbeef> Oh it's a pointer to a procedure that takes `clong, cstring, cint, clong)` then |
00:59:47 | FromDiscord | <Elegantbeef> That returns void |
01:00:03 | arkanoid | ok, but how can I create such a type? |
01:00:40 | arkanoid | I've already created a nim proc that takes (clong, cstring, cint, clong): void, but how can I pass it as a pointer? |
01:01:13 | arkanoid | if I try to do myProc.unsafeAddr nim compiler complains Error: expression has no address |
01:01:44 | FromDiscord | <Elegantbeef> `type MyCallback = proc(a: clong, b: cstring, c: cint, d: clong){.cdecl.}` |
01:03:50 | FromDiscord | <Alea> bruh I'm so confused↵I looked into the nimble code, and it just get's my git name which isn't my school username |
01:04:10 | FromDiscord | <Alea> how did this happen dinesh :hmmGe: |
01:07:17 | arkanoid | Elegantbeef, I was missing {.cdecl.} thanks! |
01:07:28 | arkanoid | I'm always puzzled when I should use it or not |
01:07:53 | FromDiscord | <Elegantbeef> When interopping with C you generally use it |
01:07:58 | FromDiscord | <Elegantbeef> Or C++ for this case |
01:08:11 | FromDiscord | <Elegantbeef> Otherwise you just let Nim decide or specify what the proceedure is annotated with |
01:14:02 | FromDiscord | <kevin> Do you guys know how to use function pointers in Nim? |
01:14:13 | FromDiscord | <Elegantbeef> Yes |
01:14:22 | FromDiscord | <kevin> I have a value I get back from `GetProcAddress()` but haven't figured out how to use that pointer as a function in Nim |
01:14:39 | FromDiscord | <Elegantbeef> Those are for closures |
01:15:05 | FromDiscord | <kevin> There are no closures in my code |
01:15:12 | FromDiscord | <Elegantbeef> sent a code paste, see https://paste.rs/Djl |
01:15:13 | FromDiscord | <Elegantbeef> there we go we used function pointers |
01:17:37 | FromDiscord | <Elegantbeef> Ah sorry i thought you were using `rawProc` |
01:17:47 | FromDiscord | <Elegantbeef> What are you doing presently? |
01:18:12 | FromDiscord | <Elegantbeef> Proc pointers are first class in Nim so unless you're interoping you can just manually grab them |
01:18:31 | FromDiscord | <kevin> I am trying to run a function that i grabbed from `GetProcAddress` with Winim |
01:18:34 | FromDiscord | <kevin> sent a code paste, see https://play.nim-lang.org/#ix= |
01:18:36 | FromDiscord | <kevin> something like that? |
01:18:58 | FromDiscord | <kevin> (edit) |
01:19:17 | FromDiscord | <Elegantbeef> `cast[proc(rclsid: REFCLSID, riid: REFIID, ppv: LPVOID)](GetProcAddress(hDLL, "DllGetClassObject"))` |
01:19:27 | FromDiscord | <Elegantbeef> You have a pointer and need to convert it to the proc |
01:19:49 | FromDiscord | <kevin> that makes sense |
01:20:06 | FromDiscord | <Elegantbeef> You may need `{.cdecl.}` or `{.stdcall.}` |
01:20:17 | FromDiscord | <Elegantbeef> Depending on what the procedure is annotated with |
01:21:15 | FromDiscord | <kevin> `Error: expression cannot be cast to proc (rclsid: REFCLSID, riid: REFIID, ppv: LPVOID){.closure.}` 😦 |
01:21:21 | FromDiscord | <kevin> hmm 🤔 |
01:21:31 | FromDiscord | <Elegantbeef> you need the calling convention |
01:21:41 | FromDiscord | <Elegantbeef> Nim defaults typedefs to `closure` |
01:21:58 | FromDiscord | <Elegantbeef> Knowing windows it's going to need `{.stdcall.}` |
01:22:43 | FromDiscord | <Elegantbeef> For instance |
01:22:46 | FromDiscord | <Elegantbeef> sent a code paste, see https://play.nim-lang.org/#ix=3T2b |
01:24:32 | FromDiscord | <kevin> `expression 'lpGetClassObject has no type or is ambiguous` |
01:24:56 | FromDiscord | <Elegantbeef> You are casting \`GetProcAddress(hDLL, "DllGetClassObject") right? |
01:25:04 | FromDiscord | <kevin> yep |
01:25:31 | FromDiscord | <kevin> This is terrible, but: |
01:25:39 | FromDiscord | <kevin> sent a code paste, see https://play.nim-lang.org/#ix=3T2c |
01:26:04 | FromDiscord | <kevin> (edit) "https://play.nim-lang.org/#ix=3T2c" => "https://play.nim-lang.org/#ix=3T2d" |
01:26:29 | FromDiscord | <Goat> My `aqcalc` program uses a sqlite database to store values. The only problem with this is that if you want to open the db to see and edit the contents yourself you'll have to use an external viewer. Should I 1) add options to export/import this DB to/from a plain text file or 2) work with a plain text DB model with CSV or JSON? |
01:27:55 | FromDiscord | <kevin> sent a code paste, see https://play.nim-lang.org/#ix=3T2e |
01:28:25 | FromDiscord | <Elegantbeef> Dont annotate the type |
01:28:25 | FromDiscord | <Elegantbeef> Or if you do put it in parenthesis |
01:29:34 | FromDiscord | <Elegantbeef> `var lpGetClassObject = cast[proc(rclsid: REFCLSID, riid: REFIID, ppv: LPVOID){.stdcall.}](GetProcAddress(hDLL, "DllGetClassObject"))` should work |
01:30:06 | FromDiscord | <kevin> sent a code paste, see https://play.nim-lang.org/#ix=3T2f |
01:30:52 | FromDiscord | <Elegantbeef> Can i see the entire block? |
01:31:47 | FromDiscord | <kevin> sent a code paste, see https://play.nim-lang.org/#ix=3T2g |
01:32:35 | FromDiscord | <kevin> clearly i dont actually want to be writing Windows COM code in Nim at 8:30 on a sunday night 😭 |
01:32:48 | FromDiscord | <kevin> save me lmfao |
01:32:57 | FromDiscord | <Elegantbeef> I'd love to but i need the entire file |
01:33:33 | FromDiscord | <kevin> https://media.discordapp.net/attachments/371759389889003532/955277957927170068/comproxy.nim |
01:33:45 | FromDiscord | <kevin> That's the whole thing |
01:34:24 | FromDiscord | <Elegantbeef> You hid the error |
01:34:30 | FromDiscord | <Elegantbeef> The issue is you dont have a return type |
01:34:36 | FromDiscord | <Elegantbeef> Add the return type |
01:36:07 | arkanoid | when I do `type ImportedType {.header: cppHeader, importCpp: "structName".} = object` do I have to define the struct fields manually to use them in nim, or header is expected to do that for me? |
01:36:28 | FromDiscord | <Elegantbeef> You have to define the fields |
01:36:40 | arkanoid | all of them or just what I need? |
01:37:16 | FromDiscord | <Elegantbeef> You might be able to only add what you need, but no clue if that's unsafe |
01:38:20 | FromDiscord | <kevin> So I guess I just needed to add `HRESULT` to the cast |
01:38:21 | arkanoid | I wonder what's the header pragma is used for, if I have to type fields manually |
01:38:31 | FromDiscord | <Elegantbeef> Yes you need to add it to the cast |
01:38:40 | FromDiscord | <Elegantbeef> The header pragma is to add to the include section |
01:41:49 | arkanoid | Elegantbeef, so if I add -I to passc can I avoid typing {.header: myvar.} on every binding line? |
01:42:06 | FromDiscord | <Elegantbeef> No clue i dont do C compilation |
01:43:09 | FromDiscord | <Elegantbeef> You can just do `{.push: header: myVar.} #code here {.pop.}` |
01:44:40 | FromDiscord | <Elegantbeef> obviously the code would be everything you want to import |
01:45:26 | arkanoid | ok |
01:45:40 | arkanoid | just curious, you don't do C compilation? |
01:46:14 | FromDiscord | <Elegantbeef> What do you mean by that question? |
01:49:40 | FromDiscord | <Elegantbeef> I dont talk to the C compiler pretty much ever |
01:55:08 | arkanoid | you use nim without touching C? |
01:55:28 | FromDiscord | <Elegantbeef> Pretty much |
01:55:31 | arkanoid | I mean, you're a nim expert, I hardly believe you manage to avoid C stuff |
01:55:38 | FromDiscord | <Elegantbeef> I also dont write software |
01:55:39 | FromDiscord | <Elegantbeef> 😛 |
01:55:43 | arkanoid | :| |
01:56:08 | FromDiscord | <Elegantbeef> I mean if you look at my github the most C related stuff i have is my fork of nimassimp to make me happier |
01:56:09 | arkanoid | next: I'm a professional pilot, I never touch the weel. Also, I'm a cook |
01:56:42 | FromDiscord | <Elegantbeef> I mean i'm not a professional developer, so most of what i make i make for fun |
01:57:53 | FromDiscord | <Bubblie> Im a professional programmer, I don’t touch grass for a living |
01:58:46 | arkanoid | and this is what makes me feel a shitty programmer |
02:02:01 | FromDiscord | <Elegantbeef> Why do you feel like a shitty programmer? |
02:04:33 | arkanoid | nevermind, I was just considering the fact that I'm a full time developer (not nim, nor C/C++) but I feel lacking behind a lot your "hobbyst" level knowledge of nim |
02:05:18 | arkanoid | what's the nim way to do what C++ does with `static char userName[64] = "admin"` ? |
02:07:00 | FromDiscord | <Elegantbeef> sent a code paste, see https://paste.rs/9iI |
02:07:44 | FromDiscord | <Elegantbeef> I'm actually surprised `res[0..4] = "admin"` worked, must take in an `openArray[T]` |
02:10:44 | arkanoid | and what if "admin" is already into a nim string? |
02:10:58 | arkanoid | res[0..4] = myNimString doesn't work |
02:11:14 | FromDiscord | <Elegantbeef> What do you mean? |
02:12:00 | FromDiscord | <Elegantbeef> sent a code paste, see https://play.nim-lang.org/#ix=3T2m |
02:15:03 | arkanoid | exactly. Thanks! |
02:15:51 | FromDiscord | <Elegantbeef> sent a code paste, see https://play.nim-lang.org/#ix=3T2o |
02:16:24 | FromDiscord | <Elegantbeef> Guess that could be `var openArray[char]` |
02:38:02 | * | neurocyte0917090 quit (Ping timeout: 240 seconds) |
02:39:47 | arkanoid | apparently, a stack allocated array[64, char] is not zeroed |
02:40:18 | FromDiscord | <Elegantbeef> It is too |
02:43:15 | arkanoid | or maybe "loginInParam.szUserName[0..username.len-1] = username" where "szUserName: array[64, char]" is not doing the right thing |
02:45:53 | arkanoid | or maybe it doesn't zero for types with importcpp pragma? |
02:46:16 | FromDiscord | <Elegantbeef> It zeroes memory if you instantiated it inside nim |
02:46:21 | FromDiscord | <Elegantbeef> If it's instantiated outside of Nim it's not |
02:49:28 | arkanoid | I think it is instantiated into nim. I have type defined as "type NetInLoginParams {.importcpp: "NET_IN_LOGIN_PARAMS".} = object <fields>", then instantiated as "var loginInParam = NetInLoginParams()" |
02:49:58 | arkanoid | actually not sure if this counts as C++ or nim instantiated |
02:51:31 | arkanoid | but what I know is that "loginInParam.szUserName[0..username.len-1] = username" and "echo loginInParam.szUserName" results in a char array starting with correct string but then other chars not zero following that |
02:53:09 | FromDiscord | <Elegantbeef> It's no big deal just set `username.len` to `\0` |
02:53:52 | FromDiscord | <Elegantbeef> Like i'd personally have a `func username=(loginParam: var NetInLoginParam, str: string) = ...` |
02:56:14 | arkanoid | you mean set szUserName to 0? |
02:56:30 | arkanoid | I'm not following your "set `username.len` to `\0`" |
02:56:55 | FromDiscord | <Elegantbeef> `loginParams.szUserName[username.len] = '\0'` |
02:57:24 | FromDiscord | <Elegantbeef> I assume atleast that it's a fixed sized 64 byte null terminated string |
02:57:44 | * | rockcavera joined #nim |
02:57:44 | * | rockcavera quit (Changing host) |
02:57:44 | * | rockcavera joined #nim |
02:58:01 | * | cyraxjoe quit (Quit: I'm out!) |
02:58:51 | FromDiscord | <Elegantbeef> But like i said a setter makes the most sense |
03:00:03 | * | cyraxjoe joined #nim |
03:00:45 | FromDiscord | <Elegantbeef> sent a code paste, see https://play.nim-lang.org/#ix=3T2u |
03:02:57 | FromDiscord | <Elegantbeef> I messed up the last check i think |
03:03:00 | FromDiscord | <Elegantbeef> Should be \<63 |
03:04:47 | FromDiscord | <Elegantbeef> A genius would use the field |
03:05:27 | FromDiscord | <Elegantbeef> so `assert str.len <= loginParam.szUserName.len` and `if str.len < strloginParam.szUserName.high` |
03:16:25 | arkanoid | elegantbeef, I don't need just a null terminated string, I need a zeroed array where first N chars are the username |
03:17:20 | arkanoid | the last char is already \0, and also the char just next the last char of the username |
03:17:31 | arkanoid | but all the chars in between are somewhat random |
03:18:13 | arkanoid | but the real question here is why my array is not initialized to zero |
03:23:16 | FromDiscord | <Goat> How do I get a list of all the tables in a database with db_sqlite? `PRAGMA table_list` and `SELECT name FROM sqlite_schema` aren't working for me. |
03:24:36 | arkanoid | I can confirm that an object with importcpp wont initialize to zero |
03:36:53 | pch | lovely, my the api is horrendously slow at rendering the stanford ply cow |
03:37:45 | pch | stanford ply cow is about 6k faces btw |
03:38:31 | pch | so getting 7fps rendering the cow is pretty nice for something ive put 5 days into so far |
03:45:08 | * | Gustavo6046 quit (Remote host closed the connection) |
03:48:18 | FromDiscord | <Bubblie> can I use meson with nim? |
03:48:20 | FromDiscord | <Bubblie> I absolutely love meson |
03:48:30 | FromDiscord | <Bubblie> so I was wondering If I could use this buildtool |
03:48:46 | FromDiscord | <Bubblie> I like nim's package management but I would appreciate if I could use meson with it as well |
03:54:13 | * | krux02_ quit (Remote host closed the connection) |
03:58:37 | FromDiscord | <Bubblie> also can I have un used empty procs? |
03:59:27 | FromDiscord | <Bubblie> kinda like void in C++ |
03:59:42 | FromDiscord | <Bubblie> where I don't have to have anything in it |
04:00:44 | FromDiscord | <Bubblie> also, are blocks like classes in a way? |
04:04:54 | FromDiscord | <Bubblie> blocks are called regardless right? So you don't need to specifically call the block like proc |
04:05:18 | * | arkurious quit (Quit: Leaving) |
04:07:12 | FromDiscord | <Elegantbeef> Blocks arent like clasess |
04:07:16 | FromDiscord | <Elegantbeef> `proc doThing = discard` |
04:07:21 | FromDiscord | <Elegantbeef> pch that's a release build? |
04:07:43 | pch | nope! just put up a video of debug mode then thought "wait I should compile this release" |
04:08:02 | pch | so uploaded a second video immediately in release build and 100fps instead xd |
04:08:07 | pch | https://twitter.com/kinkinkijkin/status/1505756653475536896 final of two videos |
04:08:52 | FromDiscord | <Bubblie> In reply to @Elegantbeef "`proc doThing = discard`": oh perfect |
04:09:03 | FromDiscord | <Bubblie> but when I do add things I would remove the discard right |
04:09:11 | FromDiscord | <Bubblie> also how does the void keyword work in nim exactly? |
04:09:49 | pch | void in nim is for when you want to have something, but want it to be nothing |
04:10:03 | pch | ie use in proc types to force returnless procs |
04:11:24 | pch | or as a return type to return things that return... void |
04:11:35 | FromDiscord | <Bubblie> sent a code paste, see https://play.nim-lang.org/#ix=3T2E |
04:11:45 | FromDiscord | <Elegantbeef> void isnt a keyword it's a type |
04:11:45 | FromDiscord | <Bubblie> (edit) "https://play.nim-lang.org/#ix=3T2E" => "https://paste.rs/3Ml" |
04:11:48 | pch | idk it's not part of the "usual standard programming" in nim so i dont know much about it in nime specifically |
04:11:57 | FromDiscord | <Elegantbeef> Void means "nothing" in the type system |
04:12:04 | FromDiscord | <Bubblie> ah okay |
04:12:24 | FromDiscord | <Elegantbeef> In nim `proc doThing = discard` is a `void` proc |
04:12:32 | FromDiscord | <Elegantbeef> you can also do `proc doThing: void = discard` |
04:12:54 | FromDiscord | <Bubblie> but I can still do things in that method right? Kinda like how I can still add things to an empty public void |
04:13:00 | FromDiscord | <Elegantbeef> Are you using GC much pch? wonder if arc changes |
04:13:13 | FromDiscord | <Elegantbeef> it's the return type it's not anything else |
04:13:28 | pch | I'm not directly invoking GC in anything I make |
04:13:40 | pch | I just let GC do its work on its own in all of my nim stuff cause I'm lazy as shit |
04:13:46 | FromDiscord | <Elegantbeef> I mean are you using `seq` or GC'd stuff much? |
04:13:50 | pch | oh |
04:14:11 | FromDiscord | <Bubblie> In reply to @Elegantbeef "it's the return type": ah okay |
04:14:22 | FromDiscord | <Elegantbeef> If so you can try `--gc:arc` it sometimes creates faster code |
04:14:22 | pch | yeah new ver replaces all the openArrays with seq cause the nim on my debian computer bitches about `var thing: openArray` |
04:14:57 | FromDiscord | <Elegantbeef> you can also pass `-d:lto`(if your compiler likes it otherwise `--passL:"-flto"` |
04:15:11 | pch | almost the entire thing is inline procs |
04:15:18 | FromDiscord | <Elegantbeef> Well you cannot hold onto openarrays atm pch, so that's to be expected |
04:15:24 | pch | very few things are actually linked per se |
04:15:35 | FromDiscord | <Elegantbeef> Eh it still generally helps |
04:15:51 | FromDiscord | <Bubblie> does nim have a class system? |
04:15:56 | FromDiscord | <Bubblie> of sorts |
04:15:56 | FromDiscord | <Elegantbeef> No |
04:16:05 | FromDiscord | <Elegantbeef> You have single parent OOP and methods |
04:16:06 | pch | classism is no thing to wish for, bubblie |
04:16:15 | pch | =] |
04:16:21 | FromDiscord | <Bubblie> well uh, its just what im use to lmao I work with classes a lot |
04:16:25 | FromDiscord | <Bubblie> that's why I asked |
04:16:30 | FromDiscord | <Elegantbeef> You dont need classes in Nim |
04:16:34 | FromDiscord | <Bubblie> yeah |
04:16:35 | FromDiscord | <Elegantbeef> Procedures can be used like methods |
04:16:37 | FromDiscord | <Bubblie> it makes sense |
04:16:42 | termer | nim has classes but as far as I can tell they're just fancy wrappers for methods and objects |
04:16:53 | FromDiscord | <Elegantbeef> Well it 'has' classes |
04:16:56 | termer | in most cases you wanna use procs anyway |
04:16:57 | pch | the closest equiv to class programming is using ref objects plus methods |
04:17:09 | FromDiscord | <Elegantbeef> They're just block macros ontop of methods and type decls |
04:17:11 | pch | which is... not really how nim likes to be used |
04:17:27 | FromDiscord | <Elegantbeef> Just write it procedurally and use it like OOP and it's fine |
04:17:35 | FromDiscord | <Elegantbeef> Free standing functions are not scary 😛 |
04:17:40 | termer | if you came from a lang like Java that's full of OOP then you're gonna try to use Nim that way but you're not gonna be happy doing it |
04:17:48 | termer | and you're gonna realize it's unnecessary |
04:17:55 | * | slowButPresent quit (Quit: leaving) |
04:18:10 | termer | especially with how dynamic generic procs can be |
04:18:22 | pch | there's a point to doing it but it is not how nim likes to be programmed |
04:18:24 | termer | as long as a proc CAN handle your inputs, it's ok |
04:18:29 | pch | so there's no benefit to doing it in nim |
04:18:32 | FromDiscord | <Bubblie> In reply to @termer "if you came from": of course |
04:18:40 | FromDiscord | <Equinox> In reply to @Bubblie "well uh, its just": Come to the light |
04:18:45 | FromDiscord | <Bubblie> I didn't mean to start something lmao |
04:19:04 | FromDiscord | <Equinox> In reply to @Equinox "Come to the light": No more classes |
04:19:17 | termer | classes kinda suck |
04:19:53 | pch | classism is boring, we should start making code based around optimizing async with intentional race conditions |
04:20:01 | termer | exactly |
04:20:03 | pch | just go all-out and call it Racism-Oriented Code |
04:20:13 | termer | I've been saying this for years |
04:20:33 | FromDiscord | <Bubblie> what |
04:20:51 | termer | and make sure our procs are all properly given pragmas |
04:20:52 | pch | a joke, I say things like this in derision of racists |
04:21:00 | termer | call it Pragmatic Racism-Oriented programming |
04:21:03 | FromDiscord | <Bubblie> LMAO |
04:21:32 | FromDiscord | <Bubblie> yeah its all good I just didn't understand it for a second |
04:22:14 | FromDiscord | <Elegantbeef> Anyway modules and generic polymorphism work just lovely |
04:22:19 | termer | yeah |
04:22:30 | termer | it feels like programming in a dynamic language but without all the stupid runtime error shit |
04:22:37 | termer | best of both worlds |
04:22:54 | termer | sometimes the compiler errors are vague though |
04:23:39 | FromDiscord | <Elegantbeef> Hey that's what i'm here for |
04:23:54 | termer | you're always online |
04:23:54 | pch | generics are wonderful until you try to use em how they work in wholly VM-based languages, then the fact that nim is direct-to-native and C-compatible becomes obvious |
04:23:59 | termer | do you do anything besides post here |
04:23:59 | FromDiscord | <Elegantbeef> I speak for the compiler errors |
04:24:14 | FromDiscord | <Elegantbeef> I play games, and write code occasionally |
04:24:21 | pch | you need to think of it like C with generics instead of better JIT lang |
04:24:40 | FromDiscord | <Elegantbeef> I'm the definition of a unproductive person |
04:24:45 | termer | I imagine it just creates versions of the functions for the specific types |
04:24:56 | FromDiscord | <Elegantbeef> That's how it works |
04:25:00 | termer | hah I was right |
04:25:13 | termer | that's how the V8 javascript engine does it |
04:25:25 | FromDiscord | <Elegantbeef> That's how 99% of language do it |
04:25:28 | termer | if you pass in the same kind of params to a function a few times, it compiles a version of that function for those params |
04:25:34 | pch | yeah and it's kind of clunky at some times because of that, because of C-style type sureness being a pain in the ass |
04:25:35 | termer | it makes plenty of sense |
04:25:59 | FromDiscord | <Elegantbeef> Nim's generics have a bunch of magic you can add to them to make them pretty sound |
04:26:10 | FromDiscord | <Elegantbeef> Though the first usage is where instantiation occurs |
04:26:19 | FromDiscord | <Elegantbeef> So that can carry problems depending on what you're doing |
04:26:26 | FromDiscord | <Elegantbeef> But we have templates so that's fine |
04:26:27 | termer | it's not done at compile time, what? |
04:26:38 | FromDiscord | <Elegantbeef> What? |
04:26:48 | termer | Though the first usage is where instantiation occurs |
04:26:52 | pch | modern VM langs that redesign type sureness are my preferred thing for any sort of programming with generics |
04:26:53 | termer | that's what you said |
04:27:00 | FromDiscord | <Elegantbeef> Yes the first usage at compile time |
04:27:05 | termer | oh right |
04:27:09 | termer | Java generics are decent |
04:27:15 | termer | I never had a problem with those |
04:27:24 | FromDiscord | <Bubblie> Java generics are,,, ok |
04:27:33 | FromDiscord | <Elegantbeef> the hell does type sureness even mean |
04:27:39 | FromDiscord | <Bubblie> as someone who uses java frequently it can be VERY VERY annoying |
04:27:51 | termer | but when you have data that's not related to something else but has a field that other things have, you'd really like to make methods that can take it as an argument |
04:27:52 | FromDiscord | <Bubblie> in Minecraft's code, generics are used A LOT so it ends up just being hell |
04:27:59 | FromDiscord | <Elegantbeef> `MyClassThatDoesThing.DoSpecificThingthat'sNameLongToPissBeefOff(a, b)` |
04:28:07 | termer | lol minecraft code |
04:28:07 | FromDiscord | <Bubblie> Minecraft: Java Edition's code is fucking cursed in a ton of areas |
04:28:12 | FromDiscord | <Bubblie> oh my god |
04:28:19 | pch | type sureness is my quick trying to explain the thing where The Compiler Must Know in order for he code to work |
04:28:19 | termer | I only ever worked with Bukkit |
04:28:24 | FromDiscord | <Bubblie> Modding if fun though |
04:28:30 | FromDiscord | <Bubblie> (edit) "if" => "is" |
04:28:30 | FromDiscord | <Equinox> In reply to @Bubblie "Minecraft: Java Edition's code": It’s true |
04:28:38 | FromDiscord | <Bubblie> I still love modding the game |
04:28:40 | FromDiscord | <Equinox> I’ve only read the 1.8 code |
04:28:49 | FromDiscord | <Equinox> And even that was not ideal |
04:28:49 | FromDiscord | <Bubblie> Im so sorry you had to read 1.8 code |
04:28:49 | termer | 1.8 is where I stopped making plugins |
04:28:56 | FromDiscord | <Bubblie> 1.7.10 is actually the worst code |
04:29:03 | FromDiscord | <Equinox> I’m not surprised |
04:29:12 | FromDiscord | <Equinox> I’m sure they got there and realized they couldn’t move forward |
04:29:15 | FromDiscord | <Bubblie> I mean, other than the versions before it |
04:29:28 | FromDiscord | <Equinox> No offense to notch but he’s one guy |
04:29:32 | FromDiscord | <Bubblie> Its mostly because of notch really that the code for the game is still spahgetti |
04:29:37 | pch | C does it in a very, very awful way imo in that it's extremely strict, designed around stack machines with teeny tiny stacks, and disobeying the type assurance strictness actively slows down your program in most cases |
04:29:54 | FromDiscord | <Bubblie> He kinda wrote java like it was C |
04:29:54 | termer | I'd hate to write a game in Java |
04:29:56 | FromDiscord | <Bubblie> Notch |
04:30:08 | FromDiscord | <Equinox> In reply to @pch "C does it in": C does most things in a very awful way imo |
04:30:09 | termer | GC alone scares me off |
04:30:14 | FromDiscord | <Equinox> In reply to @termer "I'd hate to write": I’ve done it |
04:30:14 | pch | notch wrote java like he was talking, and just happened to talk like he was writing C |
04:30:17 | termer | GC freezes the game for sometimes a second at the time |
04:30:36 | FromDiscord | <Bubblie> java edition kinda runs like shit at times because the code is horrendous in a lot of areas |
04:30:39 | termer | fucking stop the world GC |
04:30:47 | FromDiscord | <Bubblie> I don't think it is purely java's fault here |
04:30:51 | FromDiscord | <Equinox> In reply to @Equinox "I’ve done it": It’s not fun, after about 50 classes the game code is like a swamp to wade through |
04:30:53 | termer | it's not purely maybe |
04:30:56 | termer | but it's a bad introduction |
04:31:01 | termer | and the memory usage is through the roof |
04:31:10 | FromDiscord | <Equinox> OOP isn’t even good for games anymore in my opinion |
04:31:14 | pch | the reason GC in minecraft is awful is because minecraft uses a wonderful "industry standard coding" system based around avoiding mutables |
04:31:14 | termer | I can't run a minecraft server without a machine with at least 2GB RAM |
04:31:21 | FromDiscord | <Bubblie> Usually people use ECS or entity component systems |
04:31:27 | FromDiscord | <Equinox> Data oriented approaches seem to far exceed OOP |
04:31:29 | FromDiscord | <Bubblie> In reply to @termer "I can't run a": thats kinda standard |
04:31:46 | FromDiscord | <Bubblie> ECS is the best for games |
04:31:49 | FromDiscord | <Equinox> Yeah |
04:31:56 | termer | memory usage is my #1 gripe with JVM |
04:31:56 | FromDiscord | <Equinox> It’s easier and faster |
04:32:03 | FromDiscord | <Bubblie> might write an ECS in nim for the game I make |
04:32:09 | FromDiscord | <Equinox> In reply to @termer "memory usage is my": It’s bad but consistent |
04:32:15 | FromDiscord | <Elegantbeef> Welcome to the wacky world were everyone says ECS is the best simultaneously not making projects that benefit from ECS 😀 |
04:32:15 | termer | it's consistent yes |
04:32:21 | termer | but it costs me money |
04:32:26 | FromDiscord | <Bubblie> In the newer versions of java a lot of that is definitely better regarding memory |
04:32:29 | termer | I have to pay for more expensive VMs for simple things |
04:32:32 | FromDiscord | <Bubblie> and have you all heard of GraalVM? |
04:32:35 | termer | yes |
04:32:42 | FromDiscord | <Bubblie> its great |
04:32:47 | termer | don't use native-image if you're gonna mention that |
04:32:48 | pch | and since you're running around a gigabyte of live data at all times in minecraft, sometimes more, and how minecraft keeps things alive and provides mandatory modifications to them is passing-by-copy the entirety of world data multiple times per frame and then just leaving it to die |
04:32:58 | pch | well gc has to do a lot |
04:33:00 | termer | AAAAAAAA |
04:33:01 | FromDiscord | <Bubblie> In reply to @termer "don't use native-image if": already did 😈 |
04:33:04 | termer | fucking passing by copy |
04:33:11 | termer | native-image is slow |
04:33:16 | FromDiscord | <Bubblie> depends |
04:33:23 | pch | there's not a single mutable in the entirety of minecraft code afaik |
04:33:27 | termer | it provides worse performance |
04:33:31 | FromDiscord | <Bubblie> In reply to @pch "there's not a single": no there is lmao |
04:33:33 | termer | I only use it for short-lived things |
04:33:42 | pch | it's written like a corporate data security code |
04:33:42 | FromDiscord | <Bubblie> from a modder I can tell you that |
04:33:50 | FromDiscord | <Bubblie> that, is true |
04:34:00 | FromDiscord | <Elegantbeef> Arent we talking about a language where you cannot define your own value type 😛 |
04:34:11 | FromDiscord | <Bubblie> I mean I like java regardless |
04:34:18 | termer | Java is ok |
04:34:20 | termer | I like Kotlin more |
04:34:24 | FromDiscord | <Equinox> In reply to @Bubblie "I mean I like": I like java as well |
04:34:27 | termer | that's what I've been using for years |
04:34:31 | FromDiscord | <Bubblie> Kotlinc is the bane of my existence |
04:34:35 | FromDiscord | <Equinox> I’ve never tried Kotlin |
04:34:38 | termer | works for me |
04:34:39 | FromDiscord | <Bubblie> the compiler for kotlin scares the fuck out of me |
04:34:45 | FromDiscord | <Bubblie> kotlin is a great language |
04:34:50 | termer | I only use kotlin through gradle |
04:34:55 | FromDiscord | <Bubblie> you mean kts? |
04:34:56 | termer | Kotlin is like Java but better |
04:35:01 | termer | usually |
04:35:04 | pch | people say they like JVM languages until someone who knows JVM internals explains invokedynamic |
04:35:04 | FromDiscord | <Equinox> I here a lot of people say Kotlin is their favorite |
04:35:05 | termer | but gradle build system |
04:35:14 | termer | I mean I don't interact with the compiler directly |
04:35:19 | termer | I write kotlin applications |
04:35:26 | FromDiscord | <Bubblie> In reply to @Equinox "I here a lot": I use both |
04:35:29 | termer | what sold me on the lang was coroutines |
04:35:30 | pch | invokedynamic is uh |
04:35:36 | FromDiscord | <Bubblie> its a good language, it sometimes doesn't suit my needs other times it does |
04:35:37 | termer | cause I use async java |
04:35:42 | FromDiscord | <Bubblie> it really depends on what you are doing in my experience |
04:35:45 | termer | and callbacks for everything was TERRIBLE |
04:35:57 | termer | by the way Vert.x is a great framework |
04:36:10 | pch | I had a friend for a while who knew very well how it worked but they went mad from knowing too much about java and have regressed to a little corner of the internet involving like 3 people |
04:36:14 | FromDiscord | <Bubblie> I have done java bytecode analysis lmao |
04:36:21 | pch | i wish i were exaggerating tbh |
04:36:31 | FromDiscord | <Bubblie> In reply to @pch "I had a friend": 💀 |
04:36:59 | pch | used to be an engineer at intel until the pandemic |
04:37:17 | termer | I've considered moving to Go before cause JVM memory usage pisses me off too much |
04:37:17 | pch | dont remember why they had to leave but i probably shouldnt share even if i knew lol |
04:37:28 | FromDiscord | <Bubblie> Im still going to use java because I like it, people can have their opinions on it it's fine, I know how cursed the language itself can be but as someone who uses it on a constant basis there are good things about it still, otherwise im pretty sure many like myself wouldn't still be using it |
04:37:38 | termer | I rewrote a few things in fucking node cause the memory usage was lower |
04:37:47 | pch | p much every VM lang has some horrifying part |
04:37:55 | FromDiscord | <Bubblie> that's true |
04:37:57 | termer | Java is fine. It works |
04:38:01 | FromDiscord | <Bubblie> VM langs can be horrifying in their own right |
04:38:17 | pch | cause they're all made either as derivs from java or by hobbyists trying to kill java because of how awfully it works |
04:38:35 | FromDiscord | <Bubblie> nim doesn't have a virtual machine right? or does it |
04:38:35 | termer | the need for one binary for all platforms has basically disappeared except on embedded systems like things that run arm |
04:38:46 | termer | nimvm is the thing that runs nimscripts |
04:38:49 | FromDiscord | <Elegantbeef> Ah i see the matrix bridge shat the bed again |
04:38:51 | termer | I don't know how much of a VM it is |
04:38:58 | pch | nim has... a pseudoVM in the compiler and the nimscript vm |
04:39:14 | FromDiscord | <Bubblie> whats nimscript exactly |
04:39:18 | termer | nim as scripts |
04:39:23 | FromDiscord | <Elegantbeef> A subset of Nim that runs i nVM |
04:39:25 | termer | it's used in nimble files |
04:39:28 | FromDiscord | <Elegantbeef> on a vm\ |
04:39:34 | pch | a reduced version of nim meant for use in making config scripts |
04:39:38 | FromDiscord | <Bubblie> oh 👀 |
04:39:40 | FromDiscord | <Elegantbeef> It's also fully usable for scripting nim programs |
04:39:48 | FromDiscord | <Equinox> Interpreted nim? |
04:39:48 | FromDiscord | <Bubblie> that is very neat |
04:39:48 | termer | Bubblie You wanna know what's cursed? A scripting language with a runtime written in Java |
04:39:54 | FromDiscord | <Bubblie> LMAO |
04:39:56 | FromDiscord | <Bubblie> Oh lord |
04:39:59 | termer | t. author of one |
04:40:02 | FromDiscord | <Elegantbeef> Surprisingly the NimVm even runs in wasm |
04:40:17 | pch | you can write full programs in nimscript but you lack many features from the native form of nim |
04:40:19 | FromDiscord | <Bubblie> I could possibly embed nimvm in other langs right |
04:40:25 | pch | yes |
04:40:32 | FromDiscord | <Bubblie> holy shit this gives me a cursed idea |
04:40:34 | FromDiscord | <Elegantbeef> If you wanted to do the interop yes |
04:40:36 | FromDiscord | <Elegantbeef> It's not setup for it presently |
04:40:36 | termer | Bubblie https://github.com/termermc/rtflc |
04:40:39 | termer | check this shit out |
04:40:47 | FromDiscord | <Bubblie> In reply to @termer "Bubblie https://github.com/termermc/rtflc": help |
04:40:50 | FromDiscord | <Bubblie> this is horrid |
04:40:54 | termer | the sad thing is this actually runs a few things |
04:40:58 | termer | I built a PHP clone with it |
04:41:15 | FromDiscord | <Elegantbeef> Pch that's why you dont use the normal NimVM but use the compiiler API to make the VM actually usable |
04:41:16 | termer | and it has a memory leak somewhere |
04:41:27 | termer | it's one of the worst things in the world |
04:41:48 | termer | I used to run an IRC bot with it as well |
04:41:56 | FromDiscord | <Bubblie> I am actually releasing a gui library implementation I made for minecraft it uses a lwjgl gui lib I found which is really good |
04:41:56 | FromDiscord | <Elegantbeef> Though i'm just biased since I have a lot of work put into easy Nim \<-\> Nimscript interop |
04:41:56 | termer | but it would keep crashing because of the leak |
04:42:01 | pch | someone should build a php vm in javascript that only runs on node |
04:42:08 | termer | HAHAHAHA |
04:42:14 | FromDiscord | <Bubblie> In reply to @Bubblie "I am actually releasing": minecraft's gui system was trash so like |
04:42:23 | FromDiscord | <Bubblie> I just found this one and implemented it while battling opengl state |
04:42:27 | FromDiscord | <Bubblie> seriously fuck opengl state |
04:42:44 | termer | I don't wanna ever touch opengl directly |
04:42:51 | termer | thank god I'm not a games developer :) |
04:42:59 | pch | non-ES opengl is... ugh |
04:43:02 | pch | especially older versions |
04:43:09 | FromDiscord | <Elegantbeef> Eh it's not that bad |
04:43:28 | FromDiscord | <Elegantbeef> I use 4.5+ with DSA and it's not terrible |
04:43:28 | FromDiscord | <Elegantbeef> I've written more tedious code elsewhere |
04:43:33 | pch | it's not that bad unless you've used GLES in depth or Vulkan in depth or DX12 in depth or |
04:44:02 | termer | Bubble Oh yeah I should also mention that my scripting lang's latest interpreter is a sort of bytecode interpreter |
04:44:02 | FromDiscord | <Elegantbeef> I mean I'm also doing simple shit |
04:44:07 | termer | inside of the JVM.... |
04:44:12 | FromDiscord | <Elegantbeef> So it's like 300 loc total wrapper ontop of opengl |
04:44:28 | pch | and what sucks about trying to use GLES instead of OGL is... you can't assure your optimized data structures aren't horribly mangled |
04:44:57 | termer | has anyone used vulkan directly |
04:45:04 | pch | I did a bit |
04:45:04 | termer | I heard vulkan has better multi-core performance |
04:45:11 | pch | never got to a renderer |
04:45:20 | pch | but I have used it |
04:45:47 | pch | quite a bit more pipework than dOGL but for a pretty good reason |
04:46:10 | FromDiscord | <Bubblie> In reply to @Elegantbeef "Eh it's not that": Its not that bad until you have to literally fork lwjgl bindings and see where the problem is, and then proceed to see why the gui lib is fucking up, and then proceed to fix the state, and then it just piles and piles it absolute pain |
04:46:13 | pch | Vulkan is based on an experimental version of AMD's internal API in 2011 |
04:46:18 | FromDiscord | <Bubblie> But im really happy with what I did |
04:46:25 | FromDiscord | <Elegantbeef> last i checked lwjgl isnt opengl |
04:46:29 | FromDiscord | <Bubblie> Yeah I know |
04:46:31 | FromDiscord | <Bubblie> I said bindings |
04:46:35 | FromDiscord | <Bubblie> Bindings to opengl |
04:46:37 | FromDiscord | <Bubblie> For java |
04:46:45 | pch | lwjgl is pain |
04:46:54 | FromDiscord | <Bubblie> Couldn’t agree with you more |
04:46:59 | pch | like 100x more painful than any other GL bindings |
04:47:03 | FromDiscord | <Bubblie> Lwjgl has a FUCKED build system |
04:47:06 | pch | especially how it's used in minecraft |
04:47:07 | FromDiscord | <Bubblie> A FUCKED one im telling you |
04:47:18 | FromDiscord | <Bubblie> Horrid |
04:47:37 | pch | tbh if there's a good java build system that isn't obsolete every 3 months I'd be surprised |
04:47:50 | * | joshbaptiste joined #nim |
04:47:53 | FromDiscord | <Bubblie> Im glad I found nim for game dev 😭 I swear to god I didnt want to use java, im sticking to using java for servers and general programs |
04:48:07 | FromDiscord | <Elegantbeef> Imagine using Java instead of Nim |
04:48:12 | FromDiscord | <Elegantbeef> What a wacky tedious world |
04:48:14 | nrds | <Prestige99> ikr |
04:48:22 | FromDiscord | <Bubblie> C++ is also just insanely verbose |
04:48:35 | FromDiscord | <Bubblie> And hard to even use at times |
04:48:37 | termer | I don't know anyone who likes C++ |
04:48:37 | FromDiscord | <Bubblie> And then |
04:48:38 | nrds | <Prestige99> decorators; decorators everywhere |
04:48:39 | FromDiscord | <Bubblie> Memory leakage |
04:48:43 | FromDiscord | <Bubblie> Decorators |
04:48:54 | FromDiscord | <Bubblie> Stop decorating challenge 5 second IMPOSSIBLE |
04:48:58 | pch | C++ is even hated by the people who like it |
04:49:00 | termer | Java is great for servers |
04:49:04 | nrds | <Prestige99> Every c/c++ dev I've spoken to says they never write memory leaks. It's fun |
04:49:04 | FromDiscord | <Bubblie> In reply to @pch "C++ is even hated": Exactly |
04:49:05 | termer | at least HTTP shit |
04:49:11 | FromDiscord | <Valdar> I know way too many people who like c++, or at least claim to |
04:49:11 | FromDiscord | <Bubblie> Java is amazing for servers yeah |
04:49:28 | FromDiscord | <Bubblie> Java was pretty much designed for servers tbh |
04:49:34 | FromDiscord | <Bubblie> Its why banks still use it for that |
04:49:52 | pch | someone was porting bindings to Godot, the game engine I use, to Nim, which would've let me shove my render API into a real game without having to roll my own engine |
04:49:52 | termer | multithreading in Java is also great |
04:49:58 | termer | I never worried about it |
04:49:58 | FromDiscord | <Bubblie> Oh yeah definitely |
04:50:00 | pch | but >not updated since 2019 |
04:50:14 | FromDiscord | <Bubblie> In reply to @pch "someone was porting bindings": Holy shit nim bindings to godot??? |
04:50:19 | FromDiscord | <Bubblie> That would be fucking insane I love godot |
04:50:27 | FromDiscord | <Elegantbeef> They already exist |
04:50:28 | FromDiscord | <Elegantbeef> So have at 'er |
04:50:36 | pch | they're not up-to-date |
04:50:39 | pch | not updated in years |
04:50:44 | FromDiscord | <Bubblie> Oh shit |
04:50:45 | FromDiscord | <Elegantbeef> They still work |
04:50:46 | pch | dont work anymore and were never finished |
04:50:47 | FromDiscord | <Bubblie> Pain |
04:50:51 | termer | I'm currently building a server in Nim and there's a memory leak somewhere, and I never had that issue with Java lol |
04:50:53 | FromDiscord | <Elegantbeef> They do so work |
04:50:54 | pch | some parts work |
04:50:59 | termer | so much for garbage collector |
04:51:04 | termer | although maybe I'm retarded |
04:51:20 | FromDiscord | <Elegantbeef> Termer gib code |
04:51:33 | termer | https://github.com/llstreamer/llstreamer-server |
04:51:40 | termer | explore away |
04:51:45 | termer | it's a work in progress |
04:52:14 | termer | I haven't pushed the client code yet cause it's in a very debug state |
04:53:07 | termer | the fun shit happens in src/llstreamer_server/server.nim |
04:53:16 | FromDiscord | <Valdar> Beef, help me out with this bit of logic (or lack of it)↵I have an object type that I’ll be using often, and I need speed.↵My understanding of the Nim memory model is that the object will be created on the stack (NOT a Ref object). ↵But…. If the object contains a seq, that seq will live on the heap. Correct so far? |
04:53:30 | arkanoid | I've an UncheckedArray[byte] (or char) from C + len that I want to print. I can do myUncheckedArray.toOpenArray(0, myLen) but it still prints it to console as an ['a','r','r','a','y'] and not as an "array" |
04:54:13 | FromDiscord | <Elegantbeef> Yes teh seq data will be on the heap |
04:54:28 | FromDiscord | <Elegantbeef> Implement a `$` for `openArray[char]` ark |
04:54:28 | termer | seqs are pointers to the real data so yeah it'll be on the heap |
04:54:39 | FromDiscord | <Valdar> k, so, since a seq carries its own length info, just checking if the object’s seq is empty will require going to the heap, right? |
04:54:58 | FromDiscord | <Elegantbeef> Yes |
04:55:10 | FromDiscord | <Valdar> 👍 thx |
04:55:56 | FromDiscord | <Elegantbeef> Termer how much memory are you leaking? |
04:56:08 | nrds | <Prestige99> Elegantbeef https://play.nim-lang.org/#ix=3T2M |
04:56:12 | FromDiscord | <Elegantbeef> \Compile with `-d:useMalloc` and use `valgrind` to see |
04:56:22 | FromDiscord | <Elegantbeef> Prestige that's my name! |
04:56:27 | termer | it seems like there's ~40mb of memory per 1k clients connecting, but that memory never seems to be freed when they disconnect |
04:56:44 | termer | maybe a little less or more |
04:56:52 | termer | it very well could be something not being removed from a seq |
04:56:59 | FromDiscord | <Elegantbeef> Well valgrind will give you all your important information |
04:57:01 | termer | but I can't find where if that's the issue |
04:57:50 | FromDiscord | <Valdar> Is there some kind of profiler to see when Nim's GC runs, how often, what is freed, etc.? |
04:57:50 | termer | ok so use valgrind then? |
04:57:57 | FromDiscord | <Elegantbeef> Yes |
04:58:00 | termer | I'll have to test that some other time |
04:58:05 | FromDiscord | <Elegantbeef> Depends on what GC you have valdar |
04:58:13 | FromDiscord | <Valdar> ARC |
04:58:13 | FromDiscord | <Elegantbeef> You can use `-d:useMalloc` to see what is freed |
04:58:15 | termer | wish I had a whole team to deal with this project lol |
04:58:23 | FromDiscord | <Elegantbeef> Arc doesnt have a conventional GC |
04:58:25 | termer | building something is one thing, but optimizing and debugging is another |
04:58:31 | FromDiscord | <Elegantbeef> It is scoped based inserted destructors |
04:58:41 | termer | arc is cool |
04:58:49 | FromDiscord | <Elegantbeef> so you can do `--expandArc:procName` to see |
04:58:55 | FromDiscord | <Valdar> ah, ok, i need to read more on it then |
04:58:56 | FromDiscord | <demotomohiro> Arc do something only when you copy ref or it go out of scope |
04:59:12 | FromDiscord | <Elegantbeef> you can also overide `=destroy` and use that to trace objects destructions |
04:59:46 | FromDiscord | <Valdar> Arc is still considered GC tho, or not? |
05:00:10 | FromDiscord | <Elegantbeef> Technically yes |
05:00:11 | FromDiscord | <Elegantbeef> Not what most people mean when they say "GC" though |
05:00:39 | FromDiscord | <demotomohiro> If reference counting is a GC, we can say rust have GC :p |
05:00:48 | FromDiscord | <Elegantbeef> It technically is and does |
05:01:06 | FromDiscord | <Elegantbeef> Garbage collection is a general term for automatic memory management |
05:01:14 | FromDiscord | <Elegantbeef> Which it so happens RC falls under |
05:01:20 | FromDiscord | <Valdar> yeah, i thought that as well when i was trying out Rust |
05:01:22 | termer | isn't orc closer to what someone would consider a traditional GC |
05:01:27 | termer | since it has some sort of active collector |
05:01:31 | FromDiscord | <Elegantbeef> Not really |
05:01:59 | FromDiscord | <Elegantbeef> `refc` is a garbage collector, `orc` is arc + cycle breaker, so maybe but it's still not the same |
05:02:44 | FromDiscord | <Valdar> I'll read more on it. so I can at least ask intelligent questions 🙂 |
05:03:19 | FromDiscord | <Elegantbeef> Eh i usually attempt to answer even the unintelligent ones |
05:03:26 | FromDiscord | <Elegantbeef> Do you have a link to the Nim page? |
05:03:58 | FromDiscord | <Elegantbeef> https://nim-lang.org/docs/mm.html and https://nim-lang.org/docs/destructors.html |
05:04:44 | FromDiscord | <Bubblie> also, about the bot tags, you all are talking from gitter right? |
05:05:13 | termer | I'm from IRC |
05:05:19 | termer | I don't know how many people use Gitter |
05:05:25 | FromDiscord | <Bubblie> whats IRC |
05:05:28 | termer | LOL |
05:05:40 | termer | oldest continuously used chat protocol in the world |
05:05:51 | termer | also the best in terms of support |
05:06:00 | FromDiscord | <Elegantbeef> Prestige i think the issue is the same thing |
05:06:01 | FromDiscord | <Bubblie> oh internet relay chat |
05:06:06 | termer | yes |
05:06:30 | FromDiscord | <Elegantbeef> nope nevermind |
05:06:39 | FromDiscord | <Bubblie> I didn't think people still used it tbh they usually just use chatting platforms |
05:06:55 | termer | there are a ton of people who still use it but not many normal people |
05:07:01 | FromDiscord | <Bubblie> LMAO |
05:07:01 | termer | almost exclusively tech literates |
05:07:27 | termer | high barrier to entry tends to keep people out |
05:07:34 | FromDiscord | <Bubblie> I kinda like being able to chat through a ui so I'll stick to discord |
05:07:34 | nrds | <Prestige99> Beef: oh that's too bad |
05:07:38 | nrds | <Prestige99> seems similar in nature |
05:07:45 | termer | not really high per se, but it sucks to use without extra tools |
05:07:49 | termer | like you don't get chat history |
05:08:02 | termer | unless you've setup a bouncer like ZNC to keep you connected and relay it to you when you connect |
05:08:03 | FromDiscord | <Valdar> In reply to @Elegantbeef "https://nim-lang.org/docs/mm.html and https://nim-l": I skimmed that one, or a similar one when I started with Nim. I need a refresher tho. Frankly, I've had not one hiccup related to GC since I've been using Nim, so I've kinda been letting it do it's thang |
05:08:22 | FromDiscord | <Bubblie> all this for chatting with programmers on the internet? |
05:08:29 | FromDiscord | <Bubblie> I mean |
05:08:32 | FromDiscord | <Bubblie> you do you Ig |
05:08:39 | termer | it works and I like it more than discord |
05:08:47 | FromDiscord | <Bubblie> fair |
05:08:47 | termer | plus you can't get banned from IRC |
05:08:55 | termer | you can get banned from a server |
05:08:58 | termer | or a channel |
05:09:00 | termer | but not IRC |
05:09:09 | termer | it's a lot more free |
05:09:13 | FromDiscord | <Bubblie> I think thats both a pro and a con |
05:09:16 | termer | it's a pro |
05:09:31 | termer | it's also """federated""" aka you setup a server and connect |
05:09:33 | FromDiscord | <Bubblie> I mean, if there is a very annoying individual how do you get rid of them |
05:09:35 | termer | not really federated |
05:09:43 | termer | how do you get rid of them? ban their IP |
05:09:53 | FromDiscord | <Valdar> yeah, looks like a Con to me. |
05:09:57 | FromDiscord | <Bubblie> so, you can ban them, just not from using IRC |
05:10:03 | termer | yeah of course |
05:10:08 | termer | cause IRC is just a protocol |
05:10:21 | FromDiscord | <Bubblie> id hope they wouldn't be using a vpn then |
05:10:38 | FromDiscord | <Bubblie> cause then it would probably be hard to ip ban them right |
05:10:42 | termer | you can block VPNs if you want but this is the same situation with discord alt accounts |
05:10:43 | FromDiscord | <Bubblie> unless you track the vpn end point |
05:10:49 | termer | anyone who wants to can get alt accounts |
05:11:09 | termer | I've got like 10 discord accounts lol it's not hard to do |
05:11:19 | FromDiscord | <Bubblie> why do you have 10... |
05:11:26 | termer | for fun |
05:11:33 | FromDiscord | <Bubblie> I have no words |
05:11:47 | termer | but my point is that IRC is free as in freedom |
05:11:51 | termer | and you can run all your own stuff |
05:11:58 | termer | like I have an IRC server for friends |
05:12:10 | FromDiscord | <Elegantbeef> Insert matrix comments here |
05:12:18 | termer | matrix takes a billion gigs of RAM to run |
05:12:22 | termer | and is slow as shit |
05:12:28 | FromDiscord | <huantian> pc issue |
05:12:31 | FromDiscord | <Elegantbeef> Blame the servers 😛 |
05:12:36 | termer | yeah the servers suck |
05:12:47 | termer | you shouldn't need several gigs of ram to run a chat server |
05:13:02 | FromDiscord | <Elegantbeef> Synapse is written in python iirc |
05:13:06 | termer | yeah |
05:13:11 | FromDiscord | <Elegantbeef> They're not exactly aiming for performance |
05:13:12 | termer | aka the worst choice |
05:13:12 | FromDiscord | <Bubblie> cython is pretty cool |
05:13:14 | FromDiscord | <Bubblie> I like cython |
05:13:21 | termer | I tried using matrix but it was just so slow |
05:13:25 | termer | especially the main homeserver |
05:13:38 | termer | I still use it but only via a bot |
05:13:43 | termer | and for one channel |
05:13:48 | FromDiscord | <huantian> I might setup my own matrix homeserver just for funsies |
05:13:58 | termer | it won't be fun |
05:14:07 | FromDiscord | <huantian> why not |
05:14:12 | termer | that's like saying you're gonna setup an email server for funsies |
05:14:24 | FromDiscord | <Bubblie> im trying to figure out where nimgl put EXIT_SUCCESS for vulkan |
05:14:32 | FromDiscord | <huantian> In reply to @termer "that's like saying you're": I did that once |
05:14:35 | termer | tons of configuration and huge ability to fuck things up |
05:14:35 | FromDiscord | <huantian> it took like 2 hours |
05:14:39 | FromDiscord | <Bubblie> ill just return 0 |
05:14:49 | FromDiscord | <huantian> idk I might just copy this nixos config |
05:15:04 | termer | what's the point |
05:15:18 | termer | nobody ends up running a homeserver for long unless they're dedicated |
05:16:16 | termer | Bubblies oh yeah also, about not being able to be banned on IRC, it's not just a benefit for people fucking around |
05:16:25 | termer | I've gotten warned on discord before for what other people in a discord did |
05:16:39 | termer | cause I had admin privs in the guild |
05:16:50 | termer | the fact that you can get banned for what others do is a problem |
05:17:08 | FromDiscord | <Bubblie> sent a code paste, see https://play.nim-lang.org/#ix=3T2R |
05:17:13 | termer | it's not great to have your account banned and then have to track down people again to readd them on a new account |
05:17:15 | FromDiscord | <Bubblie> cause this doesn't work |
05:17:15 | FromDiscord | <Elegantbeef> Yes this isnt C |
05:17:21 | FromDiscord | <Bubblie> LMAO |
05:17:28 | FromDiscord | <Elegantbeef> you need to call `main` |
05:17:33 | FromDiscord | <Elegantbeef> Nim doesnt have a `main` |
05:17:35 | termer | hahahaha |
05:17:37 | FromDiscord | <Bubblie> yeah I called it |
05:17:43 | FromDiscord | <Bubblie> underneath |
05:17:43 | termer | you can check something like isMainModule or something |
05:17:54 | FromDiscord | <Bubblie> sent a code paste, see https://play.nim-lang.org/#ix= |
05:18:00 | FromDiscord | <Elegantbeef> `discard main()` |
05:18:01 | termer | nice link |
05:18:05 | FromDiscord | <Elegantbeef> Nim doesnt allow you to have unhandled values |
05:18:20 | termer | the unhandled values thing was annoying to me at first |
05:18:20 | FromDiscord | <Bubblie> ah okay, so instead of using return id use discard |
05:18:26 | FromDiscord | <Elegantbeef> No |
05:18:31 | termer | not sure if it's really all that decent of a feature |
05:18:34 | FromDiscord | <Elegantbeef> you use `discard` when you dont want a value |
05:18:47 | FromDiscord | <Elegantbeef> It's a very good feature when you have every statement can be an expression |
05:18:52 | FromDiscord | <Elegantbeef> It's pretty much needed for that imo |
05:19:25 | termer | every statement being an expression is just weird |
05:19:33 | FromDiscord | <Elegantbeef> It's so lovely |
05:19:44 | FromDiscord | <Bubblie> oh so like, it would still be returning 0, but id be discarding |
05:19:55 | FromDiscord | <Elegantbeef> you discard it at the call sitee |
05:19:59 | FromDiscord | <Bubblie> yeah |
05:20:00 | FromDiscord | <Elegantbeef> I mean why are you even making a main proc |
05:20:02 | FromDiscord | <Bubblie> discard main() |
05:20:10 | FromDiscord | <Bubblie> In reply to @Elegantbeef "I mean why are": idk im insane |
05:20:18 | FromDiscord | <Elegantbeef> sent a code paste, see https://play.nim-lang.org/#ix=3T2T |
05:20:19 | FromDiscord | <Bubblie> alright |
05:20:25 | termer | c brainwashing |
05:20:27 | termer | pay no heed |
05:20:39 | FromDiscord | <Bubblie> so what is isMainModule |
05:20:41 | FromDiscord | <Bubblie> is it like |
05:20:44 | FromDiscord | <Bubblie> a main method like thing ig |
05:20:46 | FromDiscord | <huantian> isMainModule is so much easier to type than pythons name main |
05:21:07 | FromDiscord | <Bubblie> In reply to @termer "pay no heed": it is C brainwashing |
05:21:11 | FromDiscord | <Elegantbeef> `isMainModule` is a boolean that's true if the scope owner is the module you're compiling |
05:21:13 | FromDiscord | <Bubblie> and like, every other lang that has a main method |
05:21:15 | FromDiscord | <Elegantbeef> It's not rocket science |
05:21:21 | FromDiscord | <Elegantbeef> Nim files are called `modules` |
05:21:35 | * | rockcavera quit (Remote host closed the connection) |
05:21:37 | termer | public static void main(String[] args) {} |
05:21:47 | termer | never got over how verbose java main was |
05:21:58 | FromDiscord | <huantian> It’s the same as pythons `if name == “main”` |
05:22:07 | FromDiscord | <Bubblie> In reply to @Elegantbeef "It's not rocket science": no need to be rude about it lmao mb |
05:22:09 | termer | No. You WILL use a class to start your program |
05:22:23 | FromDiscord | <Elegantbeef> I'm not being rude, i'm joking around |
05:22:25 | FromDiscord | <Elegantbeef> It's all banter |
05:22:35 | termer | learn to bant, my friend |
05:22:41 | FromDiscord | <Bubblie> I cant really tell through text a lot of the time |
05:22:51 | FromDiscord | <Bubblie> so im just gonna assume its banter from now on |
05:22:51 | * | joshbaptiste quit (Ping timeout: 245 seconds) |
05:23:03 | FromDiscord | <Elegantbeef> It's akin, not the same 😛↵(@huantian) |
05:23:44 | FromDiscord | <Bubblie> In reply to @termer "No. You WILL use": yes, I will make an entire class just run a print statement in the main method |
05:23:46 | FromDiscord | <Elegantbeef> when bodies that are false arent semantically checked! |
05:23:52 | FromDiscord | <Bubblie> (edit) "In reply to @termer "No. You WILL use": yes, I will make an entire class just ... run" added "to" |
05:24:02 | FromDiscord | <Elegantbeef> Kotlin and C# both now have the abillity for atleast some top level statements |
05:24:04 | FromDiscord | <Bubblie> In reply to @Bubblie "yes, I will make": I'm totally sane |
05:24:08 | FromDiscord | <Elegantbeef> Cmon java be modern |
05:24:10 | FromDiscord | <Bubblie> In reply to @Elegantbeef "Kotlin and C# both": yeah it's great |
05:24:16 | FromDiscord | <Bubblie> java might have this feature soon actually |
05:24:22 | FromDiscord | <Bubblie> java is sorta picking up pace |
05:24:31 | FromDiscord | <Bubblie> they added sealed classes |
05:24:42 | FromDiscord | <Bubblie> but uh |
05:24:46 | FromDiscord | <Bubblie> yeah |
05:24:58 | FromDiscord | <Bubblie> oracle kinda cringe ngl |
05:25:43 | FromDiscord | <Bubblie> oh shit I forgot to import glfw |
05:26:00 | FromDiscord | <Bubblie> I removed it to test something |
05:26:04 | FromDiscord | <Bubblie> (edit) "import" => "reimport" |
05:26:26 | FromDiscord | <Bubblie> ive met people who don't use glfw |
05:26:32 | FromDiscord | <Bubblie> for vulkan |
05:26:39 | FromDiscord | <Bubblie> just straight up do it by hand |
05:26:43 | FromDiscord | <Bubblie> absolutely insane individuals |
05:27:47 | FromDiscord | <Bubblie> yall gonna hate this |
05:27:47 | FromDiscord | <Bubblie> https://github.com/jjv360/nim-classes |
05:27:58 | FromDiscord | <Elegantbeef> I've seen it before |
05:28:07 | FromDiscord | <Elegantbeef> Hell I helped impbox with some fixes to oolib iirc |
05:28:57 | FromDiscord | <Bubblie> is it possible to keep procedures in groups so it looks neater ig |
05:29:07 | FromDiscord | <Elegantbeef> Yea you write them that way |
05:29:16 | FromDiscord | <Elegantbeef> Odd concept i know |
05:29:20 | * | joshbaptiste joined #nim |
05:30:09 | FromDiscord | <Bubblie> no like, could I stick the procedures in a block or something |
05:30:38 | FromDiscord | <Elegantbeef> You could |
05:30:56 | FromDiscord | <Bubblie> just to be like "these are where the specific procedures for the triangle take place" something like that ig |
05:31:03 | FromDiscord | <Elegantbeef> sent a code paste, see https://play.nim-lang.org/#ix=3T2U |
05:31:03 | FromDiscord | <Bubblie> ooo |
05:31:15 | FromDiscord | <Bubblie> I completely forgot about templates |
05:31:18 | FromDiscord | <Elegantbeef> You know what i like is you can just do `## These are procedures for the triangle` |
05:31:29 | FromDiscord | <Bubblie> yeah that works too |
05:31:32 | FromDiscord | <Bubblie> ill just do a doc |
05:32:03 | FromDiscord | <Elegantbeef> This is a fun bug prestige |
05:32:25 | FromDiscord | <Bubblie> git just shit itself thanks git |
05:33:27 | FromDiscord | <Bubblie> okay I think im writing nim like its C++ let me try to fix this |
05:33:44 | FromDiscord | <Bubblie> what C++ does to a mf |
05:33:50 | FromDiscord | <Equinox> lmao |
05:34:00 | FromDiscord | <Equinox> tbf there are about 50 different ways to write C++ code |
05:34:04 | FromDiscord | <Elegantbeef> Perhaps that's a good idea |
05:36:21 | nrds | <Prestige99> Elegantbeef I'm glad you find these bugs fun :P |
05:36:47 | FromDiscord | <Elegantbeef> Lol, it's an odd one |
05:38:32 | FromDiscord | <Elegantbeef> It's another `==` issue i think |
05:38:53 | FromDiscord | <Bubblie> sent a code paste, see https://play.nim-lang.org/#ix= |
05:39:09 | FromDiscord | <Elegantbeef> Compiler errors generally give answers |
05:39:17 | FromDiscord | <Elegantbeef> Yea it's another pointer issue prestige |
05:39:52 | FromDiscord | <Bubblie> sent a code paste, see https://play.nim-lang.org/#ix= |
05:40:05 | FromDiscord | <Bubblie> so window != nil |
05:40:15 | FromDiscord | <Bubblie> the assert is failing |
05:41:00 | nrds | <Prestige99> nice beef |
05:41:15 | FromDiscord | <Elegantbeef> Who knew pointers comparison sucks |
05:52:49 | FromDiscord | <Bubblie> The hell is going on with NimGL this is odd |
05:54:45 | FromDiscord | <Elegantbeef> PEBKAC |
05:55:30 | FromDiscord | <Bubblie> LOL |
05:56:27 | FromDiscord | <Bubblie> Usually when you create a glfw window its glfwCreateWindow(width,height, null null) but here its just the width and height |
05:56:49 | FromDiscord | <Elegantbeef> https://nimgl.dev/docs/glfw.html#glfwCreateWindow%2Cint32%2Cint32%2Ccstring%2CGLFWMonitor%2CGLFWWindow%2Cbool the rest are optional |
05:57:28 | FromDiscord | <Bubblie> Weird… maybe im calling it in the wrong place |
05:57:33 | FromDiscord | <Bubblie> Ill figure it out in the morning |
05:58:11 | FromDiscord | <Elegantbeef> sent a code paste, see https://play.nim-lang.org/#ix=3T2Y |
05:59:07 | FromDiscord | <Equinox> I don't mean to interrupt but do you guys know of any nim tui libraries like tui in rust? |
05:59:14 | FromDiscord | <Elegantbeef> illwill? |
06:00:44 | * | ltriant quit (Ping timeout: 252 seconds) |
06:01:37 | FromDiscord | <Bubblie> Whats tui, |
06:01:40 | FromDiscord | <Bubblie> (edit) "tui," => "tui?" |
06:01:48 | FromDiscord | <Elegantbeef> Text user interface |
06:02:07 | FromDiscord | <Bubblie> Oh okay |
06:02:59 | FromDiscord | <Equinox> In reply to @Bubblie "Oh okay": basically just an app that runs in the terminal |
06:03:33 | FromDiscord | <Equinox> I've been needing a music player for a while now and I thought maybe that would be a good project for nim |
06:03:44 | FromDiscord | <Equinox> otherwise I was just gonna go back to rust |
06:04:57 | FromDiscord | <demotomohiro> In reply to @Bubblie "Usually when you create": Example code in nimgl repo doesn't work for you? |
07:06:15 | FromDiscord | <Phil> Alright, so I have this generic proc to generate procs to handle specific HTTP requests for creating entries in a database |
07:06:40 | FromDiscord | <Phil> I've got a solution, but I don't comprehend why it works |
07:09:12 | FromDiscord | <Phil> sent a code paste, see https://play.nim-lang.org/#ix=3T39 |
07:09:44 | FromDiscord | <Phil> (edit) "https://play.nim-lang.org/#ix=3T39" => "https://paste.rs/xRu" |
07:10:14 | FromDiscord | <Phil> (edit) "https://play.nim-lang.org/#ix=3T3c" => "https://play.nim-lang.org/#ix=3T3b" |
07:10:54 | FromDiscord | <Elegantbeef> You override the GCsafe checking |
07:11:14 | FromDiscord | <Phil> What I don't get is why I have to for a proc that only fires select statements to a database |
07:11:27 | FromDiscord | <Phil> None of this does actual data manipulation outside of the application |
07:11:39 | FromDiscord | <Phil> So that proc should be absolutely gc-safe |
07:11:43 | FromDiscord | <Elegantbeef> It does something that isnt gcsafe |
07:12:43 | FromDiscord | <Elegantbeef> https://nim-lang.org/docs/manual.html#effect-system-gc-safety-effect |
07:12:51 | * | Gustavo6046 joined #nim |
07:17:26 | FromDiscord | <Phil> Figured it out |
07:17:44 | FromDiscord | <Phil> It wasn't necessarily that the proc that I passed in there was actually unsafe |
07:17:56 | FromDiscord | <Phil> It was that the compiler couldn't guarantee that `getSerializedArticleData` would always be safe |
07:18:50 | FromDiscord | <Phil> Because the the annotation `proc(entryId: int64): M` could be unsafe and apparently the compiler doesn't infer that from the proc you pass in (?) |
07:21:10 | FromDiscord | <Elegantbeef> You can force the proc to be `GcSafe` |
07:21:24 | FromDiscord | <Elegantbeef> I mean the passed in one |
07:21:33 | FromDiscord | <Phil> sent a code paste, see https://paste.rs/Xrf |
07:21:38 | * | PMunch joined #nim |
07:21:57 | FromDiscord | <Phil> (edit) "https://play.nim-lang.org/#ix=3T3i" => "https://play.nim-lang.org/#ix=3T3h" |
07:24:21 | FromDiscord | <Phil> In reply to @Elegantbeef "You can force the": You mean with cast-gcsafe to `getSerializedArticleData` ? Or just by annotating `getSerializedArticleData` with the gcsafe pragma as above?↵What I found interesting was that annotating `getDiaryEntryById` (which was the proc I passed in as `getSerializedArticleData`) with the gcsafe pragma did not suffice, the parameter itself had to be annotated or it refused to compile |
07:24:26 | FromDiscord | <Phil> (edit) "above?↵What" => "above?↵↵What" |
07:25:15 | FromDiscord | <Elegantbeef> It sounded like the issue with gcsafety was a passed in procedure to another proceedure |
07:25:17 | FromDiscord | <Elegantbeef> Am i wrong? |
07:26:24 | FromDiscord | <Phil> I think? I don't really understand the error message I get when it isn't gcsafe annotated ( `Error: 'anonymousIter' is not GC-safe as it performs an indirect call via 'getSerializedArticleData'`), like, is it complaining that the proc might be unsafe? Is the act of calling that proc itself unsafe? I don't get the error |
07:27:35 | FromDiscord | <Elegantbeef> What does `getSerializedArticleData` do? |
07:27:39 | FromDiscord | <Phil> sent a code paste, see https://play.nim-lang.org/#ix=3T3k |
07:29:25 | FromDiscord | <Phil> In reply to @Elegantbeef "What does `getSerializedArticleData` do?": Fetch an entry from the database and all its related entries that I want, combine all of these objects into one "serialized" object that contains all the data I want(in `jsonyResponse` that object gets converted to a json string).. |
07:29:43 | FromDiscord | <Phil> None of these things modify the database |
07:29:50 | FromDiscord | <Elegantbeef> Does it use any global variables? |
07:30:09 | FromDiscord | <Elegantbeef> If so are any of them GC'd? |
07:30:12 | FromDiscord | <Phil> A connection pool, which is a global seq of DbConn objects with a lock associated |
07:30:29 | FromDiscord | <Elegantbeef> Well there you go |
07:30:31 | FromDiscord | <Phil> And the procs that make use of that have a notorious amount of cast gcsafe |
07:30:54 | FromDiscord | <Elegantbeef> You seemed to have miss something then |
07:31:46 | FromDiscord | <Elegantbeef> Wish the gcsafe messages were as informative as the func messages |
07:31:48 | FromDiscord | <Phil> But if that were the case, why would it all compile solely because I put `{.gcsafe.}` into the parameter-type-defintion of `getSerializedArticleData` ?↵That doesn't change the proc that I pass in afaik |
07:32:33 | FromDiscord | <Elegantbeef> sent a code paste, see https://play.nim-lang.org/#ix=3T3l |
07:32:57 | FromDiscord | <Elegantbeef> Without `gcsafe` `proc (){.locks: 0.}` |
07:33:02 | FromDiscord | <Phil> sent a code paste, see https://paste.rs/73m |
07:33:04 | FromDiscord | <Elegantbeef> You're forcing it to be gcsafe |
07:33:40 | FromDiscord | <Phil> But that only adds a check to the proc I pass in as `getSerializedArticleData` doesn't it? It doesn't manipulate the proc itself ?↵Or am I missunderstanding something there? |
07:33:55 | FromDiscord | <Phil> (edit) "it?" => "it (and blocks compilation if that check is violated)?" |
07:33:59 | FromDiscord | <Elegantbeef> `gcSafe` is just a type safety feature it doesnt change anything |
07:34:23 | FromDiscord | <Elegantbeef> > The gcsafe annotation can be used to mark a proc to be gcsafe, otherwise this property is inferred by the compiler |
07:34:47 | FromDiscord | <Elegantbeef> The pragma overrides the GC safety checker and just says "yep it's safe" |
07:35:35 | FromDiscord | <Elegantbeef> It works opposite as you'd expect given the other annotations |
07:35:51 | FromDiscord | <Elegantbeef> You'd expect it'd error and say "Hey this isnt safe due to X", but nope it just forces it |
07:36:35 | FromDiscord | <Phil> Wait so the compiler itself goes over this and says "this isn't safe".↵If I go {.gcsafe.} I disable that check and tell the compiler "no need to check, it's safe"↵What does `{.cast(gcsafe).}` then do different? I thought the job of telling the compiler "No need to check, I know this is safe" was for that cast thing? |
07:36:48 | FromDiscord | <Elegantbeef> It does the same thing but just with a block |
07:37:55 | FromDiscord | <Elegantbeef> Personally i'd prefer `gcSafe` to do just error where the unsafe part was, and then use the cast to override it |
07:38:26 | FromDiscord | <Phil> Hmmm then you're right,I had a fundamental missunderstanding there on how that pragma works.↵That leaves me puzzled in another case which is the one that made me assume that {.gcsafe.} told the compiler "This proc should definitely be gcsafe, check that for me please" |
07:39:04 | FromDiscord | <Elegantbeef> Nope it's not the same as `noSideEffect` or `raises: []` |
07:39:09 | FromDiscord | <Elegantbeef> Which is weird |
07:40:51 | FromDiscord | <Phil> I'm currently checking if all the code I wrote originally with copious amounts of cast gcsafe compiles if I take that pragma way |
07:40:53 | FromDiscord | <Phil> (edit) "way" => "away" |
07:40:55 | FromDiscord | <Phil> And it does |
07:41:02 | FromDiscord | <Phil> And now I feel like my life is crumbling down around me |
07:41:03 | FromDiscord | <Phil> Wtf |
07:41:07 | FromDiscord | <Elegantbeef> Lol |
07:41:23 | FromDiscord | <Elegantbeef> Reading the docs is your weakness eh? |
07:41:34 | FromDiscord | <Phil> WAIT |
07:41:48 | FromDiscord | <Elegantbeef> Waiting |
07:41:56 | FromDiscord | <Phil> I do all my stuff in a custom template that grabs me a connection from the pool and opens a transaction |
07:42:16 | FromDiscord | <Phil> I'm sure that still has cast gcsafe or something and thus invalidates the extra cast-gcsafe-stuff I have on the delete/create operations |
07:43:05 | FromDiscord | <Phil> HAH! Yes that was the case |
07:43:07 | FromDiscord | <Elegantbeef> Perhaps it does |
07:44:02 | FromDiscord | <Elegantbeef> Your homework for tomorrow will be to read the manual, i'll then have a small quiz for you 😛 |
07:50:32 | pch | great i fixed the edge function just to find out ive got something wrong with edge bias |
07:50:38 | pch | well, at least there's no more weird blocks |
07:50:59 | FromDiscord | <Phil> sent a long message, see http://ix.io/3T3o |
07:51:02 | pch | decided to be a cheeky shit and detect winding order on the fly |
07:51:43 | pch | gcsafe means a few thing |
07:51:45 | pch | things |
07:51:53 | pch | 1 it's safe for gc |
07:51:56 | pch | 2 it's safe from gc |
07:52:07 | pch | i will not elaborate |
07:52:09 | FromDiscord | <Elegantbeef> Their issue is mainly just the annotation part |
07:52:19 | FromDiscord | <Phil> Though I guess my main problem is that it doesn't explicitly state what the gcsafe pragma itself does (if it's just a hint for the compiler that a check must have a specific outcome or if it actually circumvents checks by the compiler) |
07:52:24 | FromDiscord | <Elegantbeef> It also means it's threadsafe |
07:52:41 | FromDiscord | <Elegantbeef> It forces it |
07:52:43 | FromDiscord | <Elegantbeef> And it says so |
07:53:04 | FromDiscord | <Elegantbeef> > mark a proc to be gcsafe, otherwise this property is inferred |
07:54:22 | FromDiscord | <Phil> Yeah but I don't know if "marks it to be safe" means "compiler, don't check this proc! I, the human, have asserted this is safe, you do not need to check" or if it means "compiler, check this proc! I, the human, have asserted that this should be safe, if your check says otherwise then explode!" |
07:54:50 | FromDiscord | <Elegantbeef> It's dumb that it overrides it imo, but it's what it does |
07:57:05 | FromDiscord | <Phil> And to be triply sure, by "overrides it" you mean that the pragma overrides the compilers gcsafe check? |
07:57:14 | FromDiscord | <Elegantbeef> It seems so |
07:57:20 | FromDiscord | <Elegantbeef> I say it's a bug but what do i know |
07:57:51 | FromDiscord | <Phil> I'll keep working with the assumption that that is true and if I stumble over stuff that contradicts it I'll see what I misunderstood |
07:58:22 | FromDiscord | <Elegantbeef> Well it goes back to 0.13.0 so it's not a real bug, but i feel it's a bug in design |
08:32:37 | PMunch | Hmm, I thought it would error out when you set {.gcsafe.} but it isn't actually GC-safe, but it only appears to be a warning.. |
08:33:37 | FromDiscord | <Elegantbeef> Yea it doesnt work like any other annotation |
08:34:22 | FromDiscord | <Elegantbeef> I actually forgot it warns |
08:34:59 | FromDiscord | <Elegantbeef> If you want to enforce the behaviour @Phil compile with `--warningAsError[GcUnsafe2]: on` |
08:35:35 | PMunch | But this is weird: https://forum.nim-lang.org/t/6846#42793 |
08:35:51 | PMunch | There Araq shows it as throwing an error |
08:36:12 | PMunch | But when I try to run that on the playground (even with older versions), it just shows a warning.. |
08:36:30 | FromDiscord | <Elegantbeef> Perhaps he enables the warning as error |
08:37:02 | PMunch | But I've definitely had code error out on GC-unsafe errors |
08:38:09 | FromDiscord | <Elegantbeef> sent a code paste, see https://paste.rs/VcJ |
08:38:27 | FromDiscord | <Elegantbeef> Or similar |
08:38:48 | PMunch | Ah yes, that's probably it |
08:39:35 | FromDiscord | <Elegantbeef> sent a code paste, see https://paste.rs/4qC |
09:14:14 | FromDiscord | <Phil> In reply to @Elegantbeef "If you want to": I'll try that out, though I'm marginally confused, why GcUnsafe2? |
09:17:21 | FromDiscord | <Rika> theres another GcUnsafe that i assume was deprecated |
09:50:16 | PMunch | Hmm, how do you people remember to learn and use new plug-ins in your editor? |
09:50:42 | * | 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!>) |
09:51:42 | PMunch | I decided to have a vimrc cleanup and as I went through my installed plug-ins I realised that there are some really useful ones that I've forgotten to use |
09:54:03 | FromDiscord | <Phil> Easy |
09:54:04 | FromDiscord | <Phil> I don't use vim |
09:54:43 | FromDiscord | <Phil> ~~And there are no new great vscode plugins so that takes some difficulty away from me~~ |
09:55:17 | FromDiscord | <Phil> Though I'm grateful for what we do have, at least gives you a decent baseline for getting to work with nim |
10:03:32 | FromDiscord | <enthus1ast> I comment them out as soon as possible |
10:06:31 | PMunch | I mean I don't only mean vim plug-ins |
10:07:25 | PMunch | Even something like i3, I only use a small subset of the features it provides, because I never taught myself to use the rest of the features |
10:08:07 | FromDiscord | <Rika> The binds of the plugins I get are memorable |
10:08:22 | FromDiscord | <Rika> And so what if you don’t use all features? |
10:08:56 | FromDiscord | <enthus1ast> i often read tool documentation when i eat lunch on my desk at work \:D |
10:09:07 | FromDiscord | <enthus1ast> just for fun |
10:09:59 | FromDiscord | <enthus1ast> so instead of browsing etc i read documentation of the tools i use often \:) |
10:10:08 | FromDiscord | <enthus1ast> strange i know |
10:10:11 | FromDiscord | <Rika> Sounds like me |
10:10:24 | FromDiscord | <Rika> Except it’s docs for things I’m planning on using to make things |
10:13:28 | FromDiscord | <Phil> In that case I'm likely not a good point of comparison, I act if I have a need for something or notice something neat.↵Like, I have gnome, I'm not aware of even 80% of all the things I can configure of it. |
10:15:11 | FromDiscord | <enthus1ast> import randomGnomeRant |
10:19:04 | PMunch | Well of course, there's nothing wrong with not using 100% of the features you have available |
10:19:29 | PMunch | But take me for example, I use Vim and Git a lot, which is fine, I'm in the terminal and switching between the two is easy |
10:20:42 | PMunch | But apparently I had Fugitive installed, and after reading through the bullet list of features there's a bunch of stuff there I have definitely wanted to have in the past |
10:27:39 | FromDiscord | <Rika> Okay |
11:18:33 | PMunch | Maybe I need to program myself a clippy :P |
11:31:24 | * | xet7 quit (Remote host closed the connection) |
11:35:50 | * | xet7 joined #nim |
11:39:55 | FromDiscord | <Phil> In reply to @enthus1ast "import randomGnomeRant": That'll be a very small rant |
11:40:10 | FromDiscord | <Phil> (edit) "In reply to @enthus1ast "import randomGnomeRant": That'll be a very small rant ... " added "😛" |
11:41:37 | FromDiscord | <hmmm> broskis how do I auto create a range from something.len() so that I can comily check if something else is "in" that range |
11:42:29 | FromDiscord | <hmmm> something like python xrange maybe |
11:42:39 | FromDiscord | <Phil> `x in 0..bla.len()` |
11:42:47 | FromDiscord | <hmmm> perfect |
11:48:57 | FromDiscord | <Generic> ranges are inclusive, so most of the time you probably want 0..<bla.len |
11:49:20 | FromDiscord | <Generic> or `low(bla)..high(bla)`, which works for every container |
11:49:26 | FromDiscord | <Generic> which is indexable |
12:05:04 | * | neurocyte0917090 joined #nim |
12:11:55 | FromDiscord | <ajusa> In reply to @Generic "or `low(bla)..high(bla)`, which works": And also for stuff like ints |
12:21:23 | FromDiscord | <wsantos> I'm playing with macros and I need a macro that creates a macro, now my Problem is how to escape a `quote do` inside `quote do`, how can I solve for this ? |
12:21:24 | FromDiscord | <wsantos> https://media.discordapp.net/attachments/371759389889003532/955440993304469514/unknown.png |
12:21:51 | FromDiscord | <wsantos> This macro works, but I'm not sure how to do this inside another macro. |
12:25:32 | FromDiscord | <Rika> A macro creating another macro doesn’t really sound like good design |
12:25:56 | FromDiscord | <Rika> Might be better if you can expound for us to think of a better design? |
12:27:16 | FromDiscord | <wsantos> This is not a good design for sure, but I need this so I can "simulate" kwargs on all object function |
12:27:39 | FromDiscord | <wsantos> (edit) "function" => "functions" |
12:28:51 | FromDiscord | <Rika> I can imagine it not working though since you’re generating code that’s supposed to process in the same pass as the current pass |
12:28:58 | FromDiscord | <wsantos> sent a code paste, see https://paste.rs/Pk6 |
12:30:18 | * | xet7 quit (Remote host closed the connection) |
12:30:24 | FromDiscord | <wsantos> Yeah I'll play around with it, but I really got curious if anyone did a macro that creates a macro with quote do, we should have a way to escape right ? |
12:31:53 | FromDiscord | <wsantos> Or do you know if I can convert this pragma to be a function pragma and make this work ? at the end of the day, this project is more a way to touch on every part of nim-lang so I can learn it |
12:32:25 | FromDiscord | <Rika> You could probably make it a pragma yes, it would likely be better as well |
12:32:48 | FromDiscord | <Rika> A function pragma receives the definition of the function and should return the modified definition |
12:33:50 | FromDiscord | <wsantos> I understand what you are saying but I don't see how to implement it, can I still call the original ? follow the idea I have in the example ? |
12:34:04 | * | xet7 joined #nim |
12:36:34 | FromDiscord | <Rika> You can probably create two definitions, it’s just a “should do this” |
12:37:10 | FromDiscord | <Rika> It’s like calling the macro with the function definition, you can ultimately return anything, even nothing |
12:41:04 | FromDiscord | <wsantos> That is what I did in the example above, but now I need this to work with a lot of functions I don't want to keep coping past, hence the macro inside a macro |
12:42:32 | FromDiscord | <Rika> If you can make your macro work with multiple function definitions you could just call the macro with all the function definitions |
12:43:01 | FromDiscord | <Rika> theMacro: ...indent and newline... All the function definitions |
12:43:06 | FromDiscord | <Rika> Something like that |
12:49:40 | FromDiscord | <wsantos> I'll play around with it, thank you |
12:52:40 | FromDiscord | <Rika> For those wondering why I don’t suggest push and pop, it’s that I don’t know if they work with user supplied macros (afaik they do not) and they’re pretty much big hacks anyway |
12:54:33 | FromDiscord | <wsantos> what is push and pop 🤔 ? |
12:57:26 | FromDiscord | <Rika> https://nim-lang.org/docs/manual.html#pragmas-push-and-pop-pragmas |
13:00:35 | FromDiscord | <Rika> It’s always helpful reading the manual from time to time |
13:01:57 | * | kayabaNerve_ quit (Remote host closed the connection) |
13:02:06 | * | kayabaNerve joined #nim |
13:06:30 | * | rockcavera joined #nim |
13:06:30 | * | rockcavera quit (Changing host) |
13:06:30 | * | rockcavera joined #nim |
13:08:07 | FromDiscord | <wsantos> 100%, thank you |
13:38:27 | * | joshbaptiste quit (Quit: WeeChat 3.4) |
13:41:45 | FromDiscord | <mratsim> In reply to @Rika "For those wondering why": but checks:off contaminates the whole project |
13:42:15 | FromDiscord | <mratsim> we had a surprise where checks where turned off where we expected them |
13:43:18 | FromDiscord | <Rika> Really huh |
13:51:20 | FromDiscord | <Phil> Naming question, what do you call a proc that returns another proc? "FactoryProc"? |
13:54:52 | FromDiscord | <Rika> No |
13:54:55 | FromDiscord | <Rika> That’s Java |
13:55:02 | FromDiscord | <Rika> It’s just a proc |
14:01:12 | FromDiscord | <Phil> God damn, not even JS has a convention for functions that return functions, I dislike not having an "official" way to mark that sort of behaviour within a procName |
14:01:34 | FromDiscord | <Phil> (edit) "God damn, not even JS has a ... convention" added "naming" |
14:10:44 | FromDiscord | <mratsim> In reply to @Isofruit "Naming question, what do": HOF? |
14:11:17 | FromDiscord | <Phil> Do people use HOF as an acronym inside function names? I was under the impression in general acronyms were highly discouraged |
14:11:24 | FromDiscord | <mratsim> ah no not exactly, HOF have a proc input. |
14:11:24 | * | arkurious joined #nim |
14:11:51 | FromDiscord | <mratsim> HOF is higher_order_function, no one sane (discounting Java) will use that in a function name. |
14:13:54 | FromDiscord | <Rika> im not sure why you chose nim given that your views seem to align best with java |
14:16:33 | FromDiscord | <Phil> This is more a matter of work-java-habits bleeding over than anything else, since that's the stuff I know.↵Either way, the stuff I'm working on is mainly just making things generic in order to save myself the hassle of typing out the same things 15 times.↵I'm pretty sure that's not a "java" specific thing |
14:16:54 | FromDiscord | <konsumlamm> higher order functions are functions that either take a function as argument or return one |
14:17:07 | FromDiscord | <konsumlamm> so calling it HOF would be correct |
14:17:41 | FromDiscord | <konsumlamm> not that that's how you should name your function, but that's how it's called |
14:18:06 | FromDiscord | <konsumlamm> i suggest naming it something that says what it does, rather than what its type is |
14:18:49 | FromDiscord | <Phil> If you're familiar with web development, it returns a controller proc, a proc that receives a HTTP request and returns a response |
14:19:15 | FromDiscord | <Phil> So a controller-creating-proc, or handler-creating-proc |
14:21:04 | FromDiscord | <mratsim> In reply to @Isofruit "If you're familiar with": generic name is handler. |
14:21:24 | FromDiscord | <mratsim> but then your repo becomes littered with "tools", "utils" and "helpers". |
14:22:07 | FromDiscord | <Rika> createNNNNHandler? |
14:22:17 | FromDiscord | <Rika> verbs not nouns for proc names |
14:22:34 | FromDiscord | <Rika> wheres that hammer article thing |
14:23:36 | FromDiscord | <Rika> https://steve-yegge.blogspot.com/2006/03/execution-in-kingdom-of-nouns.html i think this is it |
14:23:47 | FromDiscord | <Rika> good read |
14:25:13 | FromDiscord | <Phil> sent a long message, see https://paste.rs/gQC |
14:25:55 | FromDiscord | <Rika> i'm under the impression that that is the chaos itself, so you do you ig |
14:25:58 | FromDiscord | <Phil> In reply to @Rika "createNNNNHandler?": Actually, right, think more verb and it makes more sense |
14:26:19 | FromDiscord | <Phil> In reply to @Rika "i'm under the impression": I've seen the alternative, imo that is way worse |
14:26:52 | FromDiscord | <Phil> That alternative being one folder for all modules, one folder for all controllers, one folder for all services etc. |
14:26:54 | FromDiscord | <Rika> you do you then really |
14:27:05 | FromDiscord | <Phil> (edit) "modules," => "modeols," |
14:27:11 | FromDiscord | <Phil> (edit) "modeols," => "models," |
14:29:54 | FromDiscord | <Daan Breur> So I found the issue that causes the memory leaks, It is that we are reading the file into an array/sequence and splitting that across the threads.↵Now what is a better way of doing this? |
14:34:23 | FromDiscord | <wsantos> Is there a place in the manual with a list where pragma can be used ? and what it could affect ? |
14:35:30 | FromDiscord | <mratsim> In reply to @Daan Breur "So I found the": why use multithreading for reading a file? The bottleneck will be IO and a single CPU is enough to use all IO bandwidth |
14:36:40 | FromDiscord | <Phil> I am fascinated that apparently you can somehow read the same file with multiple threads in a way that they work together |
14:37:23 | FromDiscord | <Phil> No wait, the reading is done single-thread at first and the seq that results out of this is then split across threads |
14:37:52 | FromDiscord | <Phil> Am I understanding that right? |
14:37:55 | FromDiscord | <Daan Breur> Thats what we are doing now, but that results in memoryleaks. |
14:38:04 | FromDiscord | <Phil> Why multi-thread at all? |
14:38:13 | FromDiscord | <mratsim> In reply to @Isofruit "I am fascinated that": It only work if they read independent part of the file or the processing is heavy and non-sequential. Otherwise the synchronization overhead is not worth it |
14:38:15 | FromDiscord | <Daan Breur> Read it singlethreaded into a seq. Then pass it onto the threads |
14:38:28 | FromDiscord | <Rika> why is what theyre asking |
14:38:36 | FromDiscord | <Rika> there doesnt seem to be a reason to do that |
14:39:28 | FromDiscord | <mratsim> In reply to @Daan Breur "Read it singlethreaded into": if you are using a builtin seq, you need to use --gc:arc |
14:39:49 | FromDiscord | <Daan Breur> The code processes whats in the file. Thats why multithreaded. |
14:39:57 | FromDiscord | <mratsim> otherwise open the file with memory-map and pass the ptr UncheckedArray to other threads. |
14:40:22 | FromDiscord | <d4rckh> we are writing a web fuzzer used to identify security vulnerabilities in websites |
14:40:27 | FromDiscord | <mratsim> In reply to @Daan Breur "The code processes whats": but what kind of process is it? s it heavy enough to be multithreaded? |
14:40:34 | FromDiscord | <Daan Breur> Yes it is |
14:40:44 | FromDiscord | <mratsim> (edit) "s" => "Is" |
14:41:27 | FromDiscord | <Phil> Hmm, so under the assumption you already crossed out any chance of there being a different algorithm that does the same thing faster |
14:42:08 | FromDiscord | <d4rckh> it just takes words from a file and makes a HTTP request with it |
14:42:17 | FromDiscord | <Daan Breur> And some other stuff |
14:42:19 | FromDiscord | <d4rckh> usually these wordlists are very large and it takes a long time |
14:42:40 | FromDiscord | <Phil> Why does it take very long? Do you do the HTTP calls async or do you wait for a call to finish before you start the next one? |
14:42:43 | FromDiscord | <Daan Breur> In reply to @mratsim "if you are using": This only takes it so far if the files can be a few thousand lines |
14:43:50 | FromDiscord | <d4rckh> In reply to @Isofruit "Why does it take": we wait for a call to finish before we start the next one |
14:44:25 | FromDiscord | <Phil> First recommendation would definitely then be to make the calls async rather than going multi-threading because you're wasting a lot of time waiting for a call to finish |
14:44:47 | FromDiscord | <Phil> Which would mean working with Futures, which I haven't done in nim yet, mratsim have you? |
14:44:52 | ehmry | for the os its async all the way down, even with mmap |
14:48:45 | FromDiscord | <Phil> In reply to @ehmry "for the os its": I think I'm stuck putting that one into context, was that more a general hint that on the systems level a lot of code works in an async manner or was that hinting at me that I'm misunderstanding something? |
14:50:19 | ehmry | i just mean that blocking reads are always an illusion, and if the application can do it async, then it meshes with what the OS has to do internally |
14:51:23 | ehmry | well if you read something that is cached outside your address space, then its a simple blocking operation, but otherwise there has to be some async going on |
14:52:22 | FromDiscord | <Phil> Ahhh check |
14:57:54 | FromDiscord | <mratsim> In reply to @d4rckh "it just takes words": use async, not multithreading |
14:58:36 | FromDiscord | <mratsim> In reply to @Daan Breur "This only takes it": It's not about speed, it's about memory safety and memory leaks |
14:59:09 | FromDiscord | <mratsim> The default GC is thread-local, so if you want to share a seq between threads you need a custom type or another GC like boehm or arc that is not thread-local |
14:59:15 | FromDiscord | <Phil> IIRC multi threading and keeping memory safety while doing so is pretty much one of the hardest things you can do period. |
14:59:20 | FromDiscord | <Daan Breur> In reply to @mratsim "It's not about speed,": Im not talking about that, that flag does work. Kinda. With thousand lines it still crashes due to memoryleaks |
15:00:18 | FromDiscord | <mratsim> In reply to @Daan Breur "Im not talking about": in any case, if you are trying to do multiple http requests, you are using the wrong architecture. Use async, and read up on "C10k problem" |
15:00:58 | FromDiscord | <Phil> In reply to @Rika "https://steve-yegge.blogspot.com/2006/03/execution-": Thanks for that link btw, I actually hadn't realized how nouns were creeping more and more into my proc names |
15:01:18 | FromDiscord | <mratsim> We can handle thousands of P2P streams/queries/RPC/REST on a single-thread without any leaks and using less memory than Go/Rust/Java in our Ethereum client. |
15:01:33 | FromDiscord | <mratsim> In reply to @Isofruit "Thanks for that link": I love that essay |
15:04:12 | FromDiscord | <Phil> In reply to @mratsim "I love that essay": It's striking a pretty true core. It's a smidge of a long read for the core idea that java naming conventions due to forced OOP almost always go "go noun or go home" where verbs are a better way to express actions |
15:04:54 | FromDiscord | <mratsim> In reply to @d4rckh "it just takes words": Also important read: https://ep2019.europython.eu/media/conference/slides/KNhQYeQ-downloading-a-billion-files-in-python.pdf |
15:04:56 | FromDiscord | <Phil> But I only read the first.... 20% of it so far, so chances are there's more I havent reached yet (judging by the placement of my scrollbar) |
15:05:35 | FromDiscord | <mratsim> https://media.discordapp.net/attachments/371759389889003532/955482311317655632/unknown.png |
15:08:28 | FromDiscord | <Phil> In reply to @mratsim "": A classic, the first time I stumbled over the WTF effect of "There's more threads, why does it go slower?" was when I watched a talk about when multi-threading is sensible for.... C++ I think? I'd have to dig the video up again. |
15:10:18 | FromDiscord | <Phil> No wait, it was about how your algorithm doesn't matter if it fits into L1 cache it's fast |
15:11:27 | * | PMunch quit (Quit: Leaving) |
15:16:23 | FromDiscord | <auxym> wish nim had an easier method than channels and copies for inter-thread communication, like a thread-safe multi-consumer queue. guess arc might make that possible now? |
15:20:55 | FromDiscord | <Rika> isnt there a third party mpmc queue being worked on |
15:21:08 | FromDiscord | <Rika> https://github.com/nim-works/loony |
15:21:31 | FromDiscord | <Jakraes> Quick question, if I add an object to a seq and change it by referring to the seq, does it change the original object? |
15:21:35 | FromDiscord | <Jakraes> Kinda like this |
15:22:10 | FromDiscord | <Rika> only if its a ref/ptr? |
15:22:54 | FromDiscord | <Jakraes> sent a code paste, see https://play.nim-lang.org/#ix=3T5r |
15:23:03 | FromDiscord | <Jakraes> Would that change the object itself? |
15:23:05 | FromDiscord | <Rika> definition of `Object` required |
15:23:11 | FromDiscord | <Rika> if its not a ref then it will not change |
15:24:00 | FromDiscord | <auxym> In reply to @Rika "https://github.com/nim-works/loony": oh yeah forgot about that, pretty cool. ref-only is a reasonable constraint. orc-compatibility would be cool though |
15:24:06 | FromDiscord | <Jakraes> Gotcha, how can I make a ref out of it? |
15:24:25 | FromDiscord | <Rika> `ref object` instead of only `object` |
15:24:46 | FromDiscord | <Jakraes> Should I do that when I add it to the seq? |
15:24:53 | FromDiscord | <Jakraes> Like seq.add(ref object)? |
15:25:01 | FromDiscord | <mratsim> In reply to @auxym "oh yeah forgot about": if it works with arc it works with orc |
15:25:11 | FromDiscord | <Rika> no what |
15:25:22 | FromDiscord | <Jakraes> I'm sorry I'm a lil bit new to this |
15:25:23 | FromDiscord | <mratsim> In reply to @auxym "wish nim had an": https://github.com/nim-lang/threading/blob/master/threading/channels.nim |
15:25:23 | FromDiscord | <Rika> sent a code paste, see https://play.nim-lang.org/#ix= |
15:25:49 | FromDiscord | <auxym> In reply to @mratsim "if it works with": https://github.com/nim-works/loony/issues/4 apparently there's a bug in orc? |
15:26:39 | FromDiscord | <auxym> In reply to @mratsim "https://github.com/nim-lang/threading/blob/master/t": neat, is this experimental? |
15:26:59 | FromDiscord | <mratsim> In reply to @auxym "https://github.com/nim-works/loony/issues/4 apparen": curious, but loony is lock-free so it's very possible that there is a double-free going on |
15:27:27 | FromDiscord | <mratsim> In reply to @auxym "neat, is this experimental?": no. Those channels were used in Weave during the first iteration and are very solid and efficient despite using locks. |
15:27:45 | FromDiscord | <mratsim> I mean, it could handle billions of Fibonacci task thefts |
15:28:03 | FromDiscord | <mratsim> across 36 threads in a couple hundres ms |
15:28:10 | FromDiscord | <mratsim> (edit) "ms" => "µs" |
15:28:17 | FromDiscord | <mratsim> (edit) "hundres" => "hundred" |
15:37:09 | * | slowButPresent joined #nim |
15:53:57 | * | joshbaptiste joined #nim |
16:03:24 | * | tiorock joined #nim |
16:03:24 | * | tiorock quit (Changing host) |
16:03:24 | * | tiorock joined #nim |
16:03:24 | * | rockcavera is now known as Guest5209 |
16:03:24 | * | Guest5209 quit (Killed (osmium.libera.chat (Nickname regained by services))) |
16:03:24 | * | tiorock is now known as rockcavera |
16:07:27 | * | zgasma joined #nim |
16:32:22 | * | noeontheend joined #nim |
16:32:36 | * | zgasma quit (Quit: nyaa~) |
16:33:04 | * | zgasma joined #nim |
16:47:05 | FromDiscord | <planetis> it's creator complain before that there are thread safety issues |
16:47:32 | FromDiscord | <planetis> and blamed it on isolated which i think it's not true |
16:54:05 | FromDiscord | <System64 ~ Flandre Scarlet> Hi, is there fixed point types on Nim? |
16:54:46 | FromDiscord | <Rika> third party |
16:55:02 | * | vicfred joined #nim |
16:55:29 | FromDiscord | <System64 ~ Flandre Scarlet> ah alright↵And can I use this library flawlessly like floats? |
16:55:53 | FromDiscord | <Rika> depends on the librayr |
16:55:55 | FromDiscord | <Rika> (edit) "librayr" => "library" |
16:56:22 | FromDiscord | <planetis> what's the use case? |
16:57:12 | FromDiscord | <System64 ~ Flandre Scarlet> In reply to @planetis "what's the use case?": DSP |
16:57:19 | FromDiscord | <System64 ~ Flandre Scarlet> I'm making an FM Synthesizer |
16:57:47 | FromDiscord | <planetis> i was porting a rust library but haven't finished all of it |
16:58:01 | FromDiscord | <auxym> on a MCU that doesn't have fpu? otherwise just use floats tbh |
16:58:12 | FromDiscord | <System64 ~ Flandre Scarlet> In reply to @auxym "on a MCU that": It's as fast? |
16:58:33 | FromDiscord | <planetis> https://github.com/planetis-m/dumpster/blob/master/fixed_point.nim |
16:58:46 | FromDiscord | <planetis> pretty sure it's slow |
16:58:47 | FromDiscord | <auxym> probably not, but on a modern cpu probably plenty fast enough |
16:58:58 | FromDiscord | <auxym> @System64 ~ Flandre Scarlet |
16:59:03 | FromDiscord | <planetis> if you can use floats |
16:59:20 | FromDiscord | <System64 ~ Flandre Scarlet> so I should go on floats I guess |
16:59:34 | FromDiscord | <auxym> yeah. use float32 |
17:00:13 | FromDiscord | <System64 ~ Flandre Scarlet> alright |
17:01:13 | FromDiscord | <auxym> if you want to try FXP and do a few quick benchmarks vs floats this is a good resource: https://vanhunteradams.com/FixedPoint/FixedPoint.html |
17:16:16 | FromDiscord | <treeform> In reply to @planetis "https://github.com/planetis-m/dumpster/blob/master/": wow thats pretty cool, another reason why I have used fixed point in the past was to provide absolute determinism between code generated by different compilers (gcc/vcc). |
17:16:43 | FromDiscord | <treeform> Your solution is very cool allow you to choose the base type and the fractional part. |
17:17:10 | FromDiscord | <treeform> do you plan to add sqrt and sin/cos? |
17:24:06 | FromDiscord | <System64 ~ Flandre Scarlet> Creating a fixed point thing gives me headaches lol |
18:08:29 | NimEventer | New thread by Mardiyah: The macro being as part of recursive function body multiply, see https://forum.nim-lang.org/t/9026 |
18:09:49 | * | noeontheend quit (Ping timeout: 240 seconds) |
18:16:50 | FromDiscord | <Require Support> `char ` = `ptr cstring` ? c to nim |
18:21:01 | FromDiscord | <demotomohiro> `char` = `cstring` |
18:23:26 | FromDiscord | <planetis> @treeform no, at first I planned to use it but then I decided against it and it fell through |
18:23:36 | FromDiscord | <planetis> but feel free to borrow it and make a package |
18:32:14 | FromDiscord | <planetis> note there is a nimble package that allows for more options like operation between different representations of fixed point |
18:33:50 | FromDiscord | <planetis> hmm can't find it on nimble, but I found https://gitlab.com/lbartoletti/fpn |
18:45:56 | * | noeontheend joined #nim |
18:50:29 | * | noeontheend quit (Ping timeout: 256 seconds) |
18:54:26 | FromDiscord | <Require Support> how do i echo the memory address of a `HANDLE` in string or hex, tried addr() but errored and told to use unsafeAddr then says expression has no address |
18:57:22 | FromDiscord | <planetis> cast it to an int and call strutils toHex |
19:04:17 | FromDiscord | <Ayy Lmao> I recently stumbled across the status-im nim style guide and it's kind of made me confused about error handling. Is there a practice that's emerging among nim users using a Result type instead of exceptions? |
19:05:27 | * | anddam quit (Quit: WeeChat 3.4) |
19:13:08 | nrds | <Prestige99> What's their guide on exceptions |
19:16:56 | FromDiscord | <Ayy Lmao> They go into detail here https://status-im.github.io/nim-style-guide/errors.exceptions.html |
19:21:40 | nrds | <Prestige99> ah, why do they not have syntax highlighting. Lol |
19:24:01 | nrds | <Prestige99> https://github.com/status-im/nim-stew/blob/master/stew/results.nim this is the Result object they're talking about |
19:24:14 | nrds | <Prestige99> seems particular to status-im, I've never seen it before |
19:30:35 | FromDiscord | <Ayy Lmao> Yeah I tried it out and it seems cool, they have some utilities here for dealing with them more elegantly https://github.com/status-im/questionable↵↵I'm just curious if anyone has had the issues with exceptions they describe. They say some spooky sounding stuff. |
19:44:19 | FromDiscord | <deeuu> This comes up every now and again; there's some discussion at https://forum.nim-lang.org/t/8759#57136↵I think it boils down to the degree of error handling you want/need to enforce. The `{.raises.}` pragma can help a bit, but from my limited experience you end up with try/except heavy code, which is, arguably, somewhat less elegant than working with a `Result` type.↵Also see the pros/cons discussed here https://github.com/arnetheduck/n |
19:52:47 | FromDiscord | <Ayy Lmao> Thanks for the forum link, I hadn't seen that discussion yet. |
19:57:07 | * | anddam joined #nim |
20:10:49 | FromDiscord | <Bubblie> Semi colons in nim 😈 |
20:14:29 | FromDiscord | <spoon> useful for code golfing |
20:15:28 | FromDiscord | <hmmm> result error seems neater than try except but I wouldn't want it forced on me 🤔 |
20:15:53 | FromDiscord | <hmmm> we must be free like 🦋 😃 |
20:16:47 | FromDiscord | <Rika> You can wrap result functions to make them exceptions |
20:17:04 | FromDiscord | <Rika> I’d say similarly for the reverse |
20:33:44 | FromDiscord | <Patitotective> how do i convert an int to an int32? |
20:34:26 | FromDiscord | <spoon> think you can just cast it with `int32 varname` |
20:35:07 | FromDiscord | <Patitotective> yea nvm |
20:36:04 | * | acidsys quit (Excess Flood) |
20:36:37 | * | acidsys joined #nim |
21:13:53 | FromDiscord | <Phil> Erm... how did you tell your project again to use a specific different version for compiling than it did before?↵I'm playing around with that one and just installed prologue@#head (previously prologue 0.5.4), now I'm trying to compile but the compiler just searches for 0.5.4, not accepting anything else |
21:14:22 | FromDiscord | <Phil> It's not the <projectName>.nimble file is it? That one's only used for nimble install, right? |
21:14:35 | FromDiscord | <Bubblie> Can nim use meson |
21:15:04 | FromDiscord | <creikey> In reply to @Bubblie "Can nim use meson": you can build the generated C with meson |
21:15:06 | FromDiscord | <Bubblie> I asked this question previously but I didnt get an answer so im just asking again |
21:15:18 | FromDiscord | <Bubblie> Oh |
21:15:19 | FromDiscord | <Bubblie> I see |
21:15:44 | FromDiscord | <Bubblie> I love nim’s package management but it would be nice to be able to use seperate build tools as well |
21:20:24 | * | noeontheend joined #nim |
21:29:22 | FromDiscord | <demotomohiro> How about to configure meson to build Nim project? |
21:30:08 | FromDiscord | <demotomohiro> Or call meson from .nims file |
21:38:12 | FromDiscord | <demotomohiro> !eval echo cast[int32](int.high), ",", cast[int32](-1) |
21:38:14 | NimBot | -1,-1 |
21:38:39 | FromDiscord | <demotomohiro> !evall |
21:39:12 | FromDiscord | <demotomohiro> !eval echo (var x = int.high; x).int32 |
21:39:14 | NimBot | /usercode/in.nim(1) in↵/playground/nim/lib/system/fatal.nim(53) sysFatal↵Error: unhandled exception: value out of range: 9223372036854775807 notin -2147483648 .. 2147483647 [RangeDefect] |
21:42:35 | * | wyrd quit (Ping timeout: 240 seconds) |
21:42:56 | FromDiscord | <demotomohiro> Explicitly conveting int to int32 is safer than casting int to int32 as explicit type convertion do range check. |
21:43:17 | FromDiscord | <Elegantbeef> You use the type converters unless you want the same bit signature |
21:45:02 | nrds | <Prestige99> Am I the only one bothered by unittest requiring test file names to start with `t` ? |
21:45:10 | FromDiscord | <Elegantbeef> Yep |
21:45:21 | nrds | <Prestige99> ACTION flips a table |
21:45:37 | FromDiscord | <Elegantbeef> It's an ok idea that means you dont compile files that shouldnt be tested |
21:45:49 | FromDiscord | <Elegantbeef> say you have a module your tests depend upon that you import in them |
21:46:15 | nrds | <Prestige99> I prefer having like, foo.test.nim or something. Like what if you had a file you _didn't_ want to test but it started with a t? |
21:46:28 | FromDiscord | <Elegantbeef> You dont name it with a t |
21:46:34 | nrds | <Prestige99> :( |
21:46:37 | FromDiscord | <Elegantbeef> What kinda question is that |
21:47:07 | FromDiscord | <Elegantbeef> Tests arent user facing code, aslong as you can discern the test i dont see the isssue |
21:47:32 | nrds | <Prestige99> maybe I'm a bit ocd |
21:47:38 | FromDiscord | <Elegantbeef> We disagree on a lot though so clearly disregard me |
21:47:50 | nrds | <Prestige99> I like my file names to be what I want them to be, not dictated by a framework |
21:47:52 | nrds | <Prestige99> true |
21:48:36 | FromDiscord | <Elegantbeef> Also dont know if you seen but if you want to run nimsuggest without false errors i can fix them with a few lines of code, though dont know if it'd be accepted as a PR |
21:48:42 | FromDiscord | <Rika> In reply to @Elegantbeef "You dont name it": How is that reasonable I cannot see |
21:49:14 | FromDiscord | <Elegantbeef> No clue |
21:49:21 | FromDiscord | <Elegantbeef> It seems fine to me |
21:49:31 | nrds | <Prestige99> Elegantbeef I'd like them to be merged as a fix, maybe backported if Nim does that sorta thing for bugs |
21:49:48 | nrds | <Prestige99> Who do I have to sweet talk to make that a thing? |
21:49:49 | FromDiscord | <Elegantbeef> Yea i'd also like them to but it works around the bug instead of fixing it |
21:51:43 | nrds | <Prestige99> perhaps I should work on my own mini testing framework |
21:52:29 | FromDiscord | <Elegantbeef> Or you know just fork unittest and make it search for the `test` part of the path |
21:52:33 | FromDiscord | <Elegantbeef> Or you know use balls |
21:53:59 | FromDiscord | <Elegantbeef> I feel like making your own test framework due to a disagreement is quite silly when you could just fork a feature of `searchPath = .test.nim` |
21:54:00 | nrds | <Prestige99> wasn't a huge fan of either tbh |
21:57:16 | * | ltriant joined #nim |
21:58:10 | FromDiscord | <Elegantbeef> Well i guess write your own |
22:05:07 | * | wyrd joined #nim |
22:29:59 | FromDiscord | <creikey> I think Ijust found a compiler error |
22:30:03 | FromDiscord | <creikey> compiler bug |
22:30:05 | FromDiscord | <creikey> |
22:30:12 | FromDiscord | <creikey> ` d.texture(tex, transform translate(snappedBounds.wh/2.0))` if I have this it compiles |
22:30:35 | FromDiscord | <creikey> ` d.texture(tex, transform translate(snappedBounds.wh /2.0))` if I have this it doesn't |
22:30:45 | FromDiscord | <Elegantbeef> no bug |
22:30:50 | FromDiscord | <creikey> no bug? |
22:31:02 | FromDiscord | <Elegantbeef> operators bound tightly as unary if touching |
22:31:02 | FromDiscord | <creikey> is /2.0 a different expression or so mething |
22:31:12 | FromDiscord | <Elegantbeef> `1 +2.0` is parsed as `1 (+2.0)` |
22:31:17 | FromDiscord | <creikey> interseting |
22:31:21 | FromDiscord | <creikey> (edit) "interseting" => "interesting" |
22:31:28 | FromDiscord | <creikey> so nim cares about whitespace in every sense of the word |
22:31:29 | FromDiscord | <Elegantbeef> Spacing is important for operators |
22:32:02 | FromDiscord | <Elegantbeef> There used to be some whitespace overriding of precedence so it used to be even weirder |
22:32:13 | FromDiscord | <Elegantbeef> `2+2 3` used to equal 12 not 8 |
22:33:04 | FromDiscord | <Elegantbeef> The tightly bounding operator makes sense though given command syntax `myProc $someValue` only makes sense as `myProc $(someValue)` |
22:35:32 | * | noeontheend quit (Ping timeout: 240 seconds) |
22:39:55 | FromDiscord | <demotomohiro> If you get a compiler error and don't understand why your code cause that error, `dumpTree` macro in macros module might helps you by showig how Nim parse your code. |
22:41:01 | FromDiscord | <demotomohiro> !eval import macros; dumpTree(6 /3) |
22:41:03 | NimBot | <no output> |
22:41:53 | FromDiscord | <demotomohiro> Bot does't shows compile time outputs :( |
22:51:16 | * | noeontheend joined #nim |
22:53:19 | FromDiscord | <hmmm> hmm very interesting, I just created two 0k undeletable files trying to write a file with nim 🧐 |
22:53:38 | FromDiscord | <hmmm> I think it has to do with special chars windows filesystem doesn't allow |
23:06:39 | nrds | <Prestige99> Why would I be getting an error about alloc0 not existing when using osproc? |
23:08:31 | nrds | <Prestige99> ah some weird recursive import issue |
23:15:17 | * | noeontheend quit (Ping timeout: 240 seconds) |