<< 21-03-2022 >>

00:00:16*tk quit (Quit: Well, this is unexpected.)
00:00:38FromDiscord<Elegantbeef> You can
00:00:43*tk joined #nim
00:01:10FromDiscord<Elegantbeef> for their case `proc doThing[T, Y: static int](arr: array[T,array[Y, char]])` would work \:d
00:17:00FromDiscord<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:48FromDiscord<Elegantbeef> Nim doesnt allow double underscores
00:17:52FromDiscord<Elegantbeef> What are you trying to do
00:20:03FromDiscord<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:30FromDiscord<Elegantbeef> the suffix would do what?
00:21:19FromDiscord<wsantos> in this case will create a sql `created >= now()` without it `.filter(create=DATETIME)` would generate sql`created = now()`
00:22:09FromDiscord<congusbongus> Sounds like you should use a string to represent the operation
00:22:28FromDiscord<Elegantbeef> why not just support `filter(create'gte = DateTime)` or `filter(gte(created) = DateTime)`?
00:22:48FromDiscord<wsantos> Yeah it seems like :/ I'm trying to keep as close as possible from django
00:22:56FromDiscord<wsantos> what is `'` there ?
00:23:07FromDiscord<Elegantbeef> It's' used for literals
00:23:34FromDiscord<Elegantbeef> Ah nvm doesnt work heree
00:23:52FromDiscord<congusbongus> Well there are filters like createdtimegte which can do a time of day comparison
00:23:52FromDiscord<Elegantbeef> Actually i guess it could
00:24:13FromDiscord<congusbongus> (edit) "createdtimegte" => "‘createdtimegte’"
00:24:45FromDiscord<congusbongus> (edit) "‘createdtimegte’" => "“createdtimegte”"
00:25:40FromDiscord<Elegantbeef> I dont get why you dont just pass it as an arg, it's much cleaner imo
00:25:47FromDiscord<wsantos> In reply to @Elegantbeef "Actually i guess it": Would you mind to show one example in the playground ?
00:25:59FromDiscord<Elegantbeef> Nah it didnt i looked into it
00:26:01FromDiscord<Elegantbeef> I was wrong
00:26:21FromDiscord<Elegantbeef> `filter(created = DateTime, gte)` is the cleanest imo
00:26:29FromDiscord<Elegantbeef> Better than using literals to determine comparison
00:26:33FromDiscord<Elegantbeef> Or identifiers
00:27:03FromDiscord<wsantos> Another example `.filter(pub_dateyear=current_year, question_textstartswith='What')`
00:27:40FromDiscord<wsantos> that would generate sql`pub_date = XXXX and question like "What%"`
00:27:56FromDiscord<wsantos> In reply to @Elegantbeef "`filter(created = DateTime, gte)`": Filter can receive n arguments
00:28:35FromDiscord<Elegantbeef> Final offer `filter((pubDate: currentYear, year), (questionText: "what", startWith))`
00:29:38FromDiscord<wsantos> I think this is the only option and I really liked it, thank you
00:30:23FromDiscord<Elegantbeef> You could also do `year(pubData, currentYear)` but eh you do you 😛
00:32:06FromDiscord<wsantos> Nice, I think this is simpler, thank you.
00:32:44FromDiscord<wsantos> In reply to @Elegantbeef "Final offer `filter((pubDate: currentYear,": Question is `(pubDate: currentYear, year)` a tuple ?
00:32:51FromDiscord<Elegantbeef> Yes
00:33:18FromDiscord<wsantos> Hmm can you have an "unnamed" parameter ? how do you access it ? index ?
00:33:26FromDiscord<Elegantbeef> `[1]`
00:34:03FromDiscord<Elegantbeef> In nim named tuples are just sugar for `[]`
00:35:32FromDiscord<Elegantbeef> Where's the ansiwave author, he has an odd affinity for tuples
00:36:08FromDiscord<Elegantbeef> I half believe he counts tuples to fall asleep
00:36:39FromDiscord<Elegantbeef> "int tuple, int float tuple, int float string tuple ..."
00:37:32FromDiscord<wsantos> lol
00:37:40FromDiscord<sheldon> How to initialise seq[seq[string]]
00:38:29FromDiscord<Elegantbeef> `import std/sequtils; var mySeq = newSeqWith(10, newSeq[string](100))`
00:39:16FromDiscord<sheldon> Have to specify a length?
00:39:25FromDiscord<Elegantbeef> You dont have to
00:39:37FromDiscord<Elegantbeef> `var mySeq: seq[seq[string]]` is a empty sequence
00:40:41FromDiscord<sheldon> Is it possible to index mySeq[0][0] without specifying the length?
00:41:06FromDiscord<Elegantbeef> If it doesnt have a length it'd have an error
00:43:25FromDiscord<sheldon> What if the length of nested container is dynamically changed and unknown?
00:44:22FromDiscord<Elegantbeef> If you have nested seqs that's not possible
00:44:53FromDiscord<Elegantbeef> `mySeq.len` and `mySeq[index].len` work
00:45:28FromDiscord<Elegantbeef> Sequences arent fixed length, so you can still grow and remove them
00:45:38FromDiscord<Elegantbeef> Those procedures dont make them stick at a given length
00:52:16FromDiscord<Alea> where does nimble grab the author bit from during nimble init?
00:52:26FromDiscord<Elegantbeef> The nimble file
00:52:32FromDiscord<Alea> it grabbed another username and I've got no clue how it did that
00:52:46FromDiscord<Elegantbeef> Oh nimble init
00:52:48FromDiscord<Elegantbeef> I cant read
00:52:59FromDiscord<Elegantbeef> It should be the active account
00:53:07FromDiscord<Alea> active what account
00:53:17FromDiscord<Elegantbeef> \`\`$USER\`
00:53:28FromDiscord<Elegantbeef> on \nix, no clue on windows
00:53:32FromDiscord<Alea> huh
00:53:53FromDiscord<Alea> cause it grabbed by school username, which I don't remember ever adding on this pc
00:55:33FromDiscord<Alea> that username isn't in my env variables either :EmotiHmmm:
00:55:46FromDiscord<Elegantbeef> I could be wrong
00:56:09*arkanoid joined #nim
00:56:41arkanoidwhat is C++ "void (*)(long, char *, int, long)" in nim? (using importcpp)
00:57:17FromDiscord<Elegantbeef> I do not know
00:58:28FromDiscord<Elegantbeef> Where is it used?
00:58:54arkanoidit is callback type
00:59:31FromDiscord<Elegantbeef> Oh it's a pointer to a procedure that takes `clong, cstring, cint, clong)` then
00:59:47FromDiscord<Elegantbeef> That returns void
01:00:03arkanoidok, but how can I create such a type?
01:00:40arkanoidI've already created a nim proc that takes (clong, cstring, cint, clong): void, but how can I pass it as a pointer?
01:01:13arkanoidif I try to do myProc.unsafeAddr nim compiler complains Error: expression has no address
01:01:44FromDiscord<Elegantbeef> `type MyCallback = proc(a: clong, b: cstring, c: cint, d: clong){.cdecl.}`
01:03:50FromDiscord<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:10FromDiscord<Alea> how did this happen dinesh :hmmGe:
01:07:17arkanoidElegantbeef, I was missing {.cdecl.} thanks!
01:07:28arkanoidI'm always puzzled when I should use it or not
01:07:53FromDiscord<Elegantbeef> When interopping with C you generally use it
01:07:58FromDiscord<Elegantbeef> Or C++ for this case
01:08:11FromDiscord<Elegantbeef> Otherwise you just let Nim decide or specify what the proceedure is annotated with
01:14:02FromDiscord<kevin> Do you guys know how to use function pointers in Nim?
01:14:13FromDiscord<Elegantbeef> Yes
01:14:22FromDiscord<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:39FromDiscord<Elegantbeef> Those are for closures
01:15:05FromDiscord<kevin> There are no closures in my code
01:15:12FromDiscord<Elegantbeef> sent a code paste, see https://paste.rs/Djl
01:15:13FromDiscord<Elegantbeef> there we go we used function pointers
01:17:37FromDiscord<Elegantbeef> Ah sorry i thought you were using `rawProc`
01:17:47FromDiscord<Elegantbeef> What are you doing presently?
01:18:12FromDiscord<Elegantbeef> Proc pointers are first class in Nim so unless you're interoping you can just manually grab them
01:18:31FromDiscord<kevin> I am trying to run a function that i grabbed from `GetProcAddress` with Winim
01:18:34FromDiscord<kevin> sent a code paste, see https://play.nim-lang.org/#ix=
01:18:36FromDiscord<kevin> something like that?
01:18:58FromDiscord<kevin> (edit)
01:19:17FromDiscord<Elegantbeef> `cast[proc(rclsid: REFCLSID, riid: REFIID, ppv: LPVOID)](GetProcAddress(hDLL, "DllGetClassObject"))`
01:19:27FromDiscord<Elegantbeef> You have a pointer and need to convert it to the proc
01:19:49FromDiscord<kevin> that makes sense
01:20:06FromDiscord<Elegantbeef> You may need `{.cdecl.}` or `{.stdcall.}`
01:20:17FromDiscord<Elegantbeef> Depending on what the procedure is annotated with
01:21:15FromDiscord<kevin> `Error: expression cannot be cast to proc (rclsid: REFCLSID, riid: REFIID, ppv: LPVOID){.closure.}` 😦
01:21:21FromDiscord<kevin> hmm 🤔
01:21:31FromDiscord<Elegantbeef> you need the calling convention
01:21:41FromDiscord<Elegantbeef> Nim defaults typedefs to `closure`
01:21:58FromDiscord<Elegantbeef> Knowing windows it's going to need `{.stdcall.}`
01:22:43FromDiscord<Elegantbeef> For instance
01:22:46FromDiscord<Elegantbeef> sent a code paste, see https://play.nim-lang.org/#ix=3T2b
01:24:32FromDiscord<kevin> `expression 'lpGetClassObject has no type or is ambiguous`
01:24:56FromDiscord<Elegantbeef> You are casting \`GetProcAddress(hDLL, "DllGetClassObject") right?
01:25:04FromDiscord<kevin> yep
01:25:31FromDiscord<kevin> This is terrible, but:
01:25:39FromDiscord<kevin> sent a code paste, see https://play.nim-lang.org/#ix=3T2c
01:26:04FromDiscord<kevin> (edit) "https://play.nim-lang.org/#ix=3T2c" => "https://play.nim-lang.org/#ix=3T2d"
01:26:29FromDiscord<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:55FromDiscord<kevin> sent a code paste, see https://play.nim-lang.org/#ix=3T2e
01:28:25FromDiscord<Elegantbeef> Dont annotate the type
01:28:25FromDiscord<Elegantbeef> Or if you do put it in parenthesis
01:29:34FromDiscord<Elegantbeef> `var lpGetClassObject = cast[proc(rclsid: REFCLSID, riid: REFIID, ppv: LPVOID){.stdcall.}](GetProcAddress(hDLL, "DllGetClassObject"))` should work
01:30:06FromDiscord<kevin> sent a code paste, see https://play.nim-lang.org/#ix=3T2f
01:30:52FromDiscord<Elegantbeef> Can i see the entire block?
01:31:47FromDiscord<kevin> sent a code paste, see https://play.nim-lang.org/#ix=3T2g
01:32:35FromDiscord<kevin> clearly i dont actually want to be writing Windows COM code in Nim at 8:30 on a sunday night 😭
01:32:48FromDiscord<kevin> save me lmfao
01:32:57FromDiscord<Elegantbeef> I'd love to but i need the entire file
01:33:33FromDiscord<kevin> https://media.discordapp.net/attachments/371759389889003532/955277957927170068/comproxy.nim
01:33:45FromDiscord<kevin> That's the whole thing
01:34:24FromDiscord<Elegantbeef> You hid the error
01:34:30FromDiscord<Elegantbeef> The issue is you dont have a return type
01:34:36FromDiscord<Elegantbeef> Add the return type
01:36:07arkanoidwhen 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:28FromDiscord<Elegantbeef> You have to define the fields
01:36:40arkanoidall of them or just what I need?
01:37:16FromDiscord<Elegantbeef> You might be able to only add what you need, but no clue if that's unsafe
01:38:20FromDiscord<kevin> So I guess I just needed to add `HRESULT` to the cast
01:38:21arkanoidI wonder what's the header pragma is used for, if I have to type fields manually
01:38:31FromDiscord<Elegantbeef> Yes you need to add it to the cast
01:38:40FromDiscord<Elegantbeef> The header pragma is to add to the include section
01:41:49arkanoidElegantbeef, so if I add -I to passc can I avoid typing {.header: myvar.} on every binding line?
01:42:06FromDiscord<Elegantbeef> No clue i dont do C compilation
01:43:09FromDiscord<Elegantbeef> You can just do `{.push: header: myVar.} #code here {.pop.}`
01:44:40FromDiscord<Elegantbeef> obviously the code would be everything you want to import
01:45:26arkanoidok
01:45:40arkanoidjust curious, you don't do C compilation?
01:46:14FromDiscord<Elegantbeef> What do you mean by that question?
01:49:40FromDiscord<Elegantbeef> I dont talk to the C compiler pretty much ever
01:55:08arkanoidyou use nim without touching C?
01:55:28FromDiscord<Elegantbeef> Pretty much
01:55:31arkanoidI mean, you're a nim expert, I hardly believe you manage to avoid C stuff
01:55:38FromDiscord<Elegantbeef> I also dont write software
01:55:39FromDiscord<Elegantbeef> 😛
01:55:43arkanoid:|
01:56:08FromDiscord<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:09arkanoidnext: I'm a professional pilot, I never touch the weel. Also, I'm a cook
01:56:42FromDiscord<Elegantbeef> I mean i'm not a professional developer, so most of what i make i make for fun
01:57:53FromDiscord<Bubblie> Im a professional programmer, I don’t touch grass for a living
01:58:46arkanoidand this is what makes me feel a shitty programmer
02:02:01FromDiscord<Elegantbeef> Why do you feel like a shitty programmer?
02:04:33arkanoidnevermind, 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:18arkanoidwhat's the nim way to do what C++ does with `static char userName[64] = "admin"` ?
02:07:00FromDiscord<Elegantbeef> sent a code paste, see https://paste.rs/9iI
02:07:44FromDiscord<Elegantbeef> I'm actually surprised `res[0..4] = "admin"` worked, must take in an `openArray[T]`
02:10:44arkanoidand what if "admin" is already into a nim string?
02:10:58arkanoidres[0..4] = myNimString doesn't work
02:11:14FromDiscord<Elegantbeef> What do you mean?
02:12:00FromDiscord<Elegantbeef> sent a code paste, see https://play.nim-lang.org/#ix=3T2m
02:15:03arkanoidexactly. Thanks!
02:15:51FromDiscord<Elegantbeef> sent a code paste, see https://play.nim-lang.org/#ix=3T2o
02:16:24FromDiscord<Elegantbeef> Guess that could be `var openArray[char]`
02:38:02*neurocyte0917090 quit (Ping timeout: 240 seconds)
02:39:47arkanoidapparently, a stack allocated array[64, char] is not zeroed
02:40:18FromDiscord<Elegantbeef> It is too
02:43:15arkanoidor maybe "loginInParam.szUserName[0..username.len-1] = username" where "szUserName: array[64, char]" is not doing the right thing
02:45:53arkanoidor maybe it doesn't zero for types with importcpp pragma?
02:46:16FromDiscord<Elegantbeef> It zeroes memory if you instantiated it inside nim
02:46:21FromDiscord<Elegantbeef> If it's instantiated outside of Nim it's not
02:49:28arkanoidI 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:58arkanoidactually not sure if this counts as C++ or nim instantiated
02:51:31arkanoidbut 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:09FromDiscord<Elegantbeef> It's no big deal just set `username.len` to `\0`
02:53:52FromDiscord<Elegantbeef> Like i'd personally have a `func username=(loginParam: var NetInLoginParam, str: string) = ...`
02:56:14arkanoidyou mean set szUserName to 0?
02:56:30arkanoidI'm not following your "set `username.len` to `\0`"
02:56:55FromDiscord<Elegantbeef> `loginParams.szUserName[username.len] = '\0'`
02:57:24FromDiscord<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:51FromDiscord<Elegantbeef> But like i said a setter makes the most sense
03:00:03*cyraxjoe joined #nim
03:00:45FromDiscord<Elegantbeef> sent a code paste, see https://play.nim-lang.org/#ix=3T2u
03:02:57FromDiscord<Elegantbeef> I messed up the last check i think
03:03:00FromDiscord<Elegantbeef> Should be \<63
03:04:47FromDiscord<Elegantbeef> A genius would use the field
03:05:27FromDiscord<Elegantbeef> so `assert str.len <= loginParam.szUserName.len` and `if str.len < strloginParam.szUserName.high`
03:16:25arkanoidelegantbeef, I don't need just a null terminated string, I need a zeroed array where first N chars are the username
03:17:20arkanoidthe last char is already \0, and also the char just next the last char of the username
03:17:31arkanoidbut all the chars in between are somewhat random
03:18:13arkanoidbut the real question here is why my array is not initialized to zero
03:23:16FromDiscord<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:36arkanoidI can confirm that an object with importcpp wont initialize to zero
03:36:53pchlovely, my the api is horrendously slow at rendering the stanford ply cow
03:37:45pchstanford ply cow is about 6k faces btw
03:38:31pchso 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:18FromDiscord<Bubblie> can I use meson with nim?
03:48:20FromDiscord<Bubblie> I absolutely love meson
03:48:30FromDiscord<Bubblie> so I was wondering If I could use this buildtool
03:48:46FromDiscord<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:37FromDiscord<Bubblie> also can I have un used empty procs?
03:59:27FromDiscord<Bubblie> kinda like void in C++
03:59:42FromDiscord<Bubblie> where I don't have to have anything in it
04:00:44FromDiscord<Bubblie> also, are blocks like classes in a way?
04:04:54FromDiscord<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:12FromDiscord<Elegantbeef> Blocks arent like clasess
04:07:16FromDiscord<Elegantbeef> `proc doThing = discard`
04:07:21FromDiscord<Elegantbeef> pch that's a release build?
04:07:43pchnope! just put up a video of debug mode then thought "wait I should compile this release"
04:08:02pchso uploaded a second video immediately in release build and 100fps instead xd
04:08:07pchhttps://twitter.com/kinkinkijkin/status/1505756653475536896 final of two videos
04:08:52FromDiscord<Bubblie> In reply to @Elegantbeef "`proc doThing = discard`": oh perfect
04:09:03FromDiscord<Bubblie> but when I do add things I would remove the discard right
04:09:11FromDiscord<Bubblie> also how does the void keyword work in nim exactly?
04:09:49pchvoid in nim is for when you want to have something, but want it to be nothing
04:10:03pchie use in proc types to force returnless procs
04:11:24pchor as a return type to return things that return... void
04:11:35FromDiscord<Bubblie> sent a code paste, see https://play.nim-lang.org/#ix=3T2E
04:11:45FromDiscord<Elegantbeef> void isnt a keyword it's a type
04:11:45FromDiscord<Bubblie> (edit) "https://play.nim-lang.org/#ix=3T2E" => "https://paste.rs/3Ml"
04:11:48pchidk it's not part of the "usual standard programming" in nim so i dont know much about it in nime specifically
04:11:57FromDiscord<Elegantbeef> Void means "nothing" in the type system
04:12:04FromDiscord<Bubblie> ah okay
04:12:24FromDiscord<Elegantbeef> In nim `proc doThing = discard` is a `void` proc
04:12:32FromDiscord<Elegantbeef> you can also do `proc doThing: void = discard`
04:12:54FromDiscord<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:00FromDiscord<Elegantbeef> Are you using GC much pch? wonder if arc changes
04:13:13FromDiscord<Elegantbeef> it's the return type it's not anything else
04:13:28pchI'm not directly invoking GC in anything I make
04:13:40pchI just let GC do its work on its own in all of my nim stuff cause I'm lazy as shit
04:13:46FromDiscord<Elegantbeef> I mean are you using `seq` or GC'd stuff much?
04:13:50pchoh
04:14:11FromDiscord<Bubblie> In reply to @Elegantbeef "it's the return type": ah okay
04:14:22FromDiscord<Elegantbeef> If so you can try `--gc:arc` it sometimes creates faster code
04:14:22pchyeah new ver replaces all the openArrays with seq cause the nim on my debian computer bitches about `var thing: openArray`
04:14:57FromDiscord<Elegantbeef> you can also pass `-d:lto`(if your compiler likes it otherwise `--passL:"-flto"`
04:15:11pchalmost the entire thing is inline procs
04:15:18FromDiscord<Elegantbeef> Well you cannot hold onto openarrays atm pch, so that's to be expected
04:15:24pchvery few things are actually linked per se
04:15:35FromDiscord<Elegantbeef> Eh it still generally helps
04:15:51FromDiscord<Bubblie> does nim have a class system?
04:15:56FromDiscord<Bubblie> of sorts
04:15:56FromDiscord<Elegantbeef> No
04:16:05FromDiscord<Elegantbeef> You have single parent OOP and methods
04:16:06pchclassism is no thing to wish for, bubblie
04:16:15pch=]
04:16:21FromDiscord<Bubblie> well uh, its just what im use to lmao I work with classes a lot
04:16:25FromDiscord<Bubblie> that's why I asked
04:16:30FromDiscord<Elegantbeef> You dont need classes in Nim
04:16:34FromDiscord<Bubblie> yeah
04:16:35FromDiscord<Elegantbeef> Procedures can be used like methods
04:16:37FromDiscord<Bubblie> it makes sense
04:16:42termernim has classes but as far as I can tell they're just fancy wrappers for methods and objects
04:16:53FromDiscord<Elegantbeef> Well it 'has' classes
04:16:56termerin most cases you wanna use procs anyway
04:16:57pchthe closest equiv to class programming is using ref objects plus methods
04:17:09FromDiscord<Elegantbeef> They're just block macros ontop of methods and type decls
04:17:11pchwhich is... not really how nim likes to be used
04:17:27FromDiscord<Elegantbeef> Just write it procedurally and use it like OOP and it's fine
04:17:35FromDiscord<Elegantbeef> Free standing functions are not scary 😛
04:17:40termerif 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:48termerand you're gonna realize it's unnecessary
04:17:55*slowButPresent quit (Quit: leaving)
04:18:10termerespecially with how dynamic generic procs can be
04:18:22pchthere's a point to doing it but it is not how nim likes to be programmed
04:18:24termeras long as a proc CAN handle your inputs, it's ok
04:18:29pchso there's no benefit to doing it in nim
04:18:32FromDiscord<Bubblie> In reply to @termer "if you came from": of course
04:18:40FromDiscord<Equinox> In reply to @Bubblie "well uh, its just": Come to the light
04:18:45FromDiscord<Bubblie> I didn't mean to start something lmao
04:19:04FromDiscord<Equinox> In reply to @Equinox "Come to the light": No more classes
04:19:17termerclasses kinda suck
04:19:53pchclassism is boring, we should start making code based around optimizing async with intentional race conditions
04:20:01termerexactly
04:20:03pchjust go all-out and call it Racism-Oriented Code
04:20:13termerI've been saying this for years
04:20:33FromDiscord<Bubblie> what
04:20:51termerand make sure our procs are all properly given pragmas
04:20:52pcha joke, I say things like this in derision of racists
04:21:00termercall it Pragmatic Racism-Oriented programming
04:21:03FromDiscord<Bubblie> LMAO
04:21:32FromDiscord<Bubblie> yeah its all good I just didn't understand it for a second
04:22:14FromDiscord<Elegantbeef> Anyway modules and generic polymorphism work just lovely
04:22:19termeryeah
04:22:30termerit feels like programming in a dynamic language but without all the stupid runtime error shit
04:22:37termerbest of both worlds
04:22:54termersometimes the compiler errors are vague though
04:23:39FromDiscord<Elegantbeef> Hey that's what i'm here for
04:23:54termeryou're always online
04:23:54pchgenerics 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:59termerdo you do anything besides post here
04:23:59FromDiscord<Elegantbeef> I speak for the compiler errors
04:24:14FromDiscord<Elegantbeef> I play games, and write code occasionally
04:24:21pchyou need to think of it like C with generics instead of better JIT lang
04:24:40FromDiscord<Elegantbeef> I'm the definition of a unproductive person
04:24:45termerI imagine it just creates versions of the functions for the specific types
04:24:56FromDiscord<Elegantbeef> That's how it works
04:25:00termerhah I was right
04:25:13termerthat's how the V8 javascript engine does it
04:25:25FromDiscord<Elegantbeef> That's how 99% of language do it
04:25:28termerif 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:34pchyeah 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:35termerit makes plenty of sense
04:25:59FromDiscord<Elegantbeef> Nim's generics have a bunch of magic you can add to them to make them pretty sound
04:26:10FromDiscord<Elegantbeef> Though the first usage is where instantiation occurs
04:26:19FromDiscord<Elegantbeef> So that can carry problems depending on what you're doing
04:26:26FromDiscord<Elegantbeef> But we have templates so that's fine
04:26:27termerit's not done at compile time, what?
04:26:38FromDiscord<Elegantbeef> What?
04:26:48termerThough the first usage is where instantiation occurs
04:26:52pchmodern VM langs that redesign type sureness are my preferred thing for any sort of programming with generics
04:26:53termerthat's what you said
04:27:00FromDiscord<Elegantbeef> Yes the first usage at compile time
04:27:05termeroh right
04:27:09termerJava generics are decent
04:27:15termerI never had a problem with those
04:27:24FromDiscord<Bubblie> Java generics are,,, ok
04:27:33FromDiscord<Elegantbeef> the hell does type sureness even mean
04:27:39FromDiscord<Bubblie> as someone who uses java frequently it can be VERY VERY annoying
04:27:51termerbut 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:52FromDiscord<Bubblie> in Minecraft's code, generics are used A LOT so it ends up just being hell
04:27:59FromDiscord<Elegantbeef> `MyClassThatDoesThing.DoSpecificThingthat'sNameLongToPissBeefOff(a, b)`
04:28:07termerlol minecraft code
04:28:07FromDiscord<Bubblie> Minecraft: Java Edition's code is fucking cursed in a ton of areas
04:28:12FromDiscord<Bubblie> oh my god
04:28:19pchtype sureness is my quick trying to explain the thing where The Compiler Must Know in order for he code to work
04:28:19termerI only ever worked with Bukkit
04:28:24FromDiscord<Bubblie> Modding if fun though
04:28:30FromDiscord<Bubblie> (edit) "if" => "is"
04:28:30FromDiscord<Equinox> In reply to @Bubblie "Minecraft: Java Edition's code": It’s true
04:28:38FromDiscord<Bubblie> I still love modding the game
04:28:40FromDiscord<Equinox> I’ve only read the 1.8 code
04:28:49FromDiscord<Equinox> And even that was not ideal
04:28:49FromDiscord<Bubblie> Im so sorry you had to read 1.8 code
04:28:49termer1.8 is where I stopped making plugins
04:28:56FromDiscord<Bubblie> 1.7.10 is actually the worst code
04:29:03FromDiscord<Equinox> I’m not surprised
04:29:12FromDiscord<Equinox> I’m sure they got there and realized they couldn’t move forward
04:29:15FromDiscord<Bubblie> I mean, other than the versions before it
04:29:28FromDiscord<Equinox> No offense to notch but he’s one guy
04:29:32FromDiscord<Bubblie> Its mostly because of notch really that the code for the game is still spahgetti
04:29:37pchC 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:54FromDiscord<Bubblie> He kinda wrote java like it was C
04:29:54termerI'd hate to write a game in Java
04:29:56FromDiscord<Bubblie> Notch
04:30:08FromDiscord<Equinox> In reply to @pch "C does it in": C does most things in a very awful way imo
04:30:09termerGC alone scares me off
04:30:14FromDiscord<Equinox> In reply to @termer "I'd hate to write": I’ve done it
04:30:14pchnotch wrote java like he was talking, and just happened to talk like he was writing C
04:30:17termerGC freezes the game for sometimes a second at the time
04:30:36FromDiscord<Bubblie> java edition kinda runs like shit at times because the code is horrendous in a lot of areas
04:30:39termerfucking stop the world GC
04:30:47FromDiscord<Bubblie> I don't think it is purely java's fault here
04:30:51FromDiscord<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:53termerit's not purely maybe
04:30:56termerbut it's a bad introduction
04:31:01termerand the memory usage is through the roof
04:31:10FromDiscord<Equinox> OOP isn’t even good for games anymore in my opinion
04:31:14pchthe reason GC in minecraft is awful is because minecraft uses a wonderful "industry standard coding" system based around avoiding mutables
04:31:14termerI can't run a minecraft server without a machine with at least 2GB RAM
04:31:21FromDiscord<Bubblie> Usually people use ECS or entity component systems
04:31:27FromDiscord<Equinox> Data oriented approaches seem to far exceed OOP
04:31:29FromDiscord<Bubblie> In reply to @termer "I can't run a": thats kinda standard
04:31:46FromDiscord<Bubblie> ECS is the best for games
04:31:49FromDiscord<Equinox> Yeah
04:31:56termermemory usage is my #1 gripe with JVM
04:31:56FromDiscord<Equinox> It’s easier and faster
04:32:03FromDiscord<Bubblie> might write an ECS in nim for the game I make
04:32:09FromDiscord<Equinox> In reply to @termer "memory usage is my": It’s bad but consistent
04:32:15FromDiscord<Elegantbeef> Welcome to the wacky world were everyone says ECS is the best simultaneously not making projects that benefit from ECS 😀
04:32:15termerit's consistent yes
04:32:21termerbut it costs me money
04:32:26FromDiscord<Bubblie> In the newer versions of java a lot of that is definitely better regarding memory
04:32:29termerI have to pay for more expensive VMs for simple things
04:32:32FromDiscord<Bubblie> and have you all heard of GraalVM?
04:32:35termeryes
04:32:42FromDiscord<Bubblie> its great
04:32:47termerdon't use native-image if you're gonna mention that
04:32:48pchand 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:58pchwell gc has to do a lot
04:33:00termerAAAAAAAA
04:33:01FromDiscord<Bubblie> In reply to @termer "don't use native-image if": already did 😈
04:33:04termerfucking passing by copy
04:33:11termernative-image is slow
04:33:16FromDiscord<Bubblie> depends
04:33:23pchthere's not a single mutable in the entirety of minecraft code afaik
04:33:27termerit provides worse performance
04:33:31FromDiscord<Bubblie> In reply to @pch "there's not a single": no there is lmao
04:33:33termerI only use it for short-lived things
04:33:42pchit's written like a corporate data security code
04:33:42FromDiscord<Bubblie> from a modder I can tell you that
04:33:50FromDiscord<Bubblie> that, is true
04:34:00FromDiscord<Elegantbeef> Arent we talking about a language where you cannot define your own value type 😛
04:34:11FromDiscord<Bubblie> I mean I like java regardless
04:34:18termerJava is ok
04:34:20termerI like Kotlin more
04:34:24FromDiscord<Equinox> In reply to @Bubblie "I mean I like": I like java as well
04:34:27termerthat's what I've been using for years
04:34:31FromDiscord<Bubblie> Kotlinc is the bane of my existence
04:34:35FromDiscord<Equinox> I’ve never tried Kotlin
04:34:38termerworks for me
04:34:39FromDiscord<Bubblie> the compiler for kotlin scares the fuck out of me
04:34:45FromDiscord<Bubblie> kotlin is a great language
04:34:50termerI only use kotlin through gradle
04:34:55FromDiscord<Bubblie> you mean kts?
04:34:56termerKotlin is like Java but better
04:35:01termerusually
04:35:04pchpeople say they like JVM languages until someone who knows JVM internals explains invokedynamic
04:35:04FromDiscord<Equinox> I here a lot of people say Kotlin is their favorite
04:35:05termerbut gradle build system
04:35:14termerI mean I don't interact with the compiler directly
04:35:19termerI write kotlin applications
04:35:26FromDiscord<Bubblie> In reply to @Equinox "I here a lot": I use both
04:35:29termerwhat sold me on the lang was coroutines
04:35:30pchinvokedynamic is uh
04:35:36FromDiscord<Bubblie> its a good language, it sometimes doesn't suit my needs other times it does
04:35:37termercause I use async java
04:35:42FromDiscord<Bubblie> it really depends on what you are doing in my experience
04:35:45termerand callbacks for everything was TERRIBLE
04:35:57termerby the way Vert.x is a great framework
04:36:10pchI 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:14FromDiscord<Bubblie> I have done java bytecode analysis lmao
04:36:21pchi wish i were exaggerating tbh
04:36:31FromDiscord<Bubblie> In reply to @pch "I had a friend": 💀
04:36:59pchused to be an engineer at intel until the pandemic
04:37:17termerI've considered moving to Go before cause JVM memory usage pisses me off too much
04:37:17pchdont remember why they had to leave but i probably shouldnt share even if i knew lol
04:37:28FromDiscord<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:38termerI rewrote a few things in fucking node cause the memory usage was lower
04:37:47pchp much every VM lang has some horrifying part
04:37:55FromDiscord<Bubblie> that's true
04:37:57termerJava is fine. It works
04:38:01FromDiscord<Bubblie> VM langs can be horrifying in their own right
04:38:17pchcause they're all made either as derivs from java or by hobbyists trying to kill java because of how awfully it works
04:38:35FromDiscord<Bubblie> nim doesn't have a virtual machine right? or does it
04:38:35termerthe need for one binary for all platforms has basically disappeared except on embedded systems like things that run arm
04:38:46termernimvm is the thing that runs nimscripts
04:38:49FromDiscord<Elegantbeef> Ah i see the matrix bridge shat the bed again
04:38:51termerI don't know how much of a VM it is
04:38:58pchnim has... a pseudoVM in the compiler and the nimscript vm
04:39:14FromDiscord<Bubblie> whats nimscript exactly
04:39:18termernim as scripts
04:39:23FromDiscord<Elegantbeef> A subset of Nim that runs i nVM
04:39:25termerit's used in nimble files
04:39:28FromDiscord<Elegantbeef> on a vm\
04:39:34pcha reduced version of nim meant for use in making config scripts
04:39:38FromDiscord<Bubblie> oh 👀
04:39:40FromDiscord<Elegantbeef> It's also fully usable for scripting nim programs
04:39:48FromDiscord<Equinox> Interpreted nim?
04:39:48FromDiscord<Bubblie> that is very neat
04:39:48termerBubblie You wanna know what's cursed? A scripting language with a runtime written in Java
04:39:54FromDiscord<Bubblie> LMAO
04:39:56FromDiscord<Bubblie> Oh lord
04:39:59termert. author of one
04:40:02FromDiscord<Elegantbeef> Surprisingly the NimVm even runs in wasm
04:40:17pchyou can write full programs in nimscript but you lack many features from the native form of nim
04:40:19FromDiscord<Bubblie> I could possibly embed nimvm in other langs right
04:40:25pchyes
04:40:32FromDiscord<Bubblie> holy shit this gives me a cursed idea
04:40:34FromDiscord<Elegantbeef> If you wanted to do the interop yes
04:40:36FromDiscord<Elegantbeef> It's not setup for it presently
04:40:36termerBubblie https://github.com/termermc/rtflc
04:40:39termercheck this shit out
04:40:47FromDiscord<Bubblie> In reply to @termer "Bubblie https://github.com/termermc/rtflc": help
04:40:50FromDiscord<Bubblie> this is horrid
04:40:54termerthe sad thing is this actually runs a few things
04:40:58termerI built a PHP clone with it
04:41:15FromDiscord<Elegantbeef> Pch that's why you dont use the normal NimVM but use the compiiler API to make the VM actually usable
04:41:16termerand it has a memory leak somewhere
04:41:27termerit's one of the worst things in the world
04:41:48termerI used to run an IRC bot with it as well
04:41:56FromDiscord<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:56FromDiscord<Elegantbeef> Though i'm just biased since I have a lot of work put into easy Nim \<-\> Nimscript interop
04:41:56termerbut it would keep crashing because of the leak
04:42:01pchsomeone should build a php vm in javascript that only runs on node
04:42:08termerHAHAHAHA
04:42:14FromDiscord<Bubblie> In reply to @Bubblie "I am actually releasing": minecraft's gui system was trash so like
04:42:23FromDiscord<Bubblie> I just found this one and implemented it while battling opengl state
04:42:27FromDiscord<Bubblie> seriously fuck opengl state
04:42:44termerI don't wanna ever touch opengl directly
04:42:51termerthank god I'm not a games developer :)
04:42:59pchnon-ES opengl is... ugh
04:43:02pchespecially older versions
04:43:09FromDiscord<Elegantbeef> Eh it's not that bad
04:43:28FromDiscord<Elegantbeef> I use 4.5+ with DSA and it's not terrible
04:43:28FromDiscord<Elegantbeef> I've written more tedious code elsewhere
04:43:33pchit's not that bad unless you've used GLES in depth or Vulkan in depth or DX12 in depth or
04:44:02termerBubble Oh yeah I should also mention that my scripting lang's latest interpreter is a sort of bytecode interpreter
04:44:02FromDiscord<Elegantbeef> I mean I'm also doing simple shit
04:44:07termerinside of the JVM....
04:44:12FromDiscord<Elegantbeef> So it's like 300 loc total wrapper ontop of opengl
04:44:28pchand 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:57termerhas anyone used vulkan directly
04:45:04pchI did a bit
04:45:04termerI heard vulkan has better multi-core performance
04:45:11pchnever got to a renderer
04:45:20pchbut I have used it
04:45:47pchquite a bit more pipework than dOGL but for a pretty good reason
04:46:10FromDiscord<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:13pchVulkan is based on an experimental version of AMD's internal API in 2011
04:46:18FromDiscord<Bubblie> But im really happy with what I did
04:46:25FromDiscord<Elegantbeef> last i checked lwjgl isnt opengl
04:46:29FromDiscord<Bubblie> Yeah I know
04:46:31FromDiscord<Bubblie> I said bindings
04:46:35FromDiscord<Bubblie> Bindings to opengl
04:46:37FromDiscord<Bubblie> For java
04:46:45pchlwjgl is pain
04:46:54FromDiscord<Bubblie> Couldn’t agree with you more
04:46:59pchlike 100x more painful than any other GL bindings
04:47:03FromDiscord<Bubblie> Lwjgl has a FUCKED build system
04:47:06pchespecially how it's used in minecraft
04:47:07FromDiscord<Bubblie> A FUCKED one im telling you
04:47:18FromDiscord<Bubblie> Horrid
04:47:37pchtbh 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:53FromDiscord<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:07FromDiscord<Elegantbeef> Imagine using Java instead of Nim
04:48:12FromDiscord<Elegantbeef> What a wacky tedious world
04:48:14nrds<Prestige99> ikr
04:48:22FromDiscord<Bubblie> C++ is also just insanely verbose
04:48:35FromDiscord<Bubblie> And hard to even use at times
04:48:37termerI don't know anyone who likes C++
04:48:37FromDiscord<Bubblie> And then
04:48:38nrds<Prestige99> decorators; decorators everywhere
04:48:39FromDiscord<Bubblie> Memory leakage
04:48:43FromDiscord<Bubblie> Decorators
04:48:54FromDiscord<Bubblie> Stop decorating challenge 5 second IMPOSSIBLE
04:48:58pchC++ is even hated by the people who like it
04:49:00termerJava is great for servers
04:49:04nrds<Prestige99> Every c/c++ dev I've spoken to says they never write memory leaks. It's fun
04:49:04FromDiscord<Bubblie> In reply to @pch "C++ is even hated": Exactly
04:49:05termerat least HTTP shit
04:49:11FromDiscord<Valdar> I know way too many people who like c++, or at least claim to
04:49:11FromDiscord<Bubblie> Java is amazing for servers yeah
04:49:28FromDiscord<Bubblie> Java was pretty much designed for servers tbh
04:49:34FromDiscord<Bubblie> Its why banks still use it for that
04:49:52pchsomeone 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:52termermultithreading in Java is also great
04:49:58termerI never worried about it
04:49:58FromDiscord<Bubblie> Oh yeah definitely
04:50:00pchbut >not updated since 2019
04:50:14FromDiscord<Bubblie> In reply to @pch "someone was porting bindings": Holy shit nim bindings to godot???
04:50:19FromDiscord<Bubblie> That would be fucking insane I love godot
04:50:27FromDiscord<Elegantbeef> They already exist
04:50:28FromDiscord<Elegantbeef> So have at 'er
04:50:36pchthey're not up-to-date
04:50:39pchnot updated in years
04:50:44FromDiscord<Bubblie> Oh shit
04:50:45FromDiscord<Elegantbeef> They still work
04:50:46pchdont work anymore and were never finished
04:50:47FromDiscord<Bubblie> Pain
04:50:51termerI'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:53FromDiscord<Elegantbeef> They do so work
04:50:54pchsome parts work
04:50:59termerso much for garbage collector
04:51:04termeralthough maybe I'm retarded
04:51:20FromDiscord<Elegantbeef> Termer gib code
04:51:33termerhttps://github.com/llstreamer/llstreamer-server
04:51:40termerexplore away
04:51:45termerit's a work in progress
04:52:14termerI haven't pushed the client code yet cause it's in a very debug state
04:53:07termerthe fun shit happens in src/llstreamer_server/server.nim
04:53:16FromDiscord<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:30arkanoidI'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:13FromDiscord<Elegantbeef> Yes teh seq data will be on the heap
04:54:28FromDiscord<Elegantbeef> Implement a `$` for `openArray[char]` ark
04:54:28termerseqs are pointers to the real data so yeah it'll be on the heap
04:54:39FromDiscord<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:58FromDiscord<Elegantbeef> Yes
04:55:10FromDiscord<Valdar> 👍 thx
04:55:56FromDiscord<Elegantbeef> Termer how much memory are you leaking?
04:56:08nrds<Prestige99> Elegantbeef https://play.nim-lang.org/#ix=3T2M
04:56:12FromDiscord<Elegantbeef> \Compile with `-d:useMalloc` and use `valgrind` to see
04:56:22FromDiscord<Elegantbeef> Prestige that's my name!
04:56:27termerit seems like there's ~40mb of memory per 1k clients connecting, but that memory never seems to be freed when they disconnect
04:56:44termermaybe a little less or more
04:56:52termerit very well could be something not being removed from a seq
04:56:59FromDiscord<Elegantbeef> Well valgrind will give you all your important information
04:57:01termerbut I can't find where if that's the issue
04:57:50FromDiscord<Valdar> Is there some kind of profiler to see when Nim's GC runs, how often, what is freed, etc.?
04:57:50termerok so use valgrind then?
04:57:57FromDiscord<Elegantbeef> Yes
04:58:00termerI'll have to test that some other time
04:58:05FromDiscord<Elegantbeef> Depends on what GC you have valdar
04:58:13FromDiscord<Valdar> ARC
04:58:13FromDiscord<Elegantbeef> You can use `-d:useMalloc` to see what is freed
04:58:15termerwish I had a whole team to deal with this project lol
04:58:23FromDiscord<Elegantbeef> Arc doesnt have a conventional GC
04:58:25termerbuilding something is one thing, but optimizing and debugging is another
04:58:31FromDiscord<Elegantbeef> It is scoped based inserted destructors
04:58:41termerarc is cool
04:58:49FromDiscord<Elegantbeef> so you can do `--expandArc:procName` to see
04:58:55FromDiscord<Valdar> ah, ok, i need to read more on it then
04:58:56FromDiscord<demotomohiro> Arc do something only when you copy ref or it go out of scope
04:59:12FromDiscord<Elegantbeef> you can also overide `=destroy` and use that to trace objects destructions
04:59:46FromDiscord<Valdar> Arc is still considered GC tho, or not?
05:00:10FromDiscord<Elegantbeef> Technically yes
05:00:11FromDiscord<Elegantbeef> Not what most people mean when they say "GC" though
05:00:39FromDiscord<demotomohiro> If reference counting is a GC, we can say rust have GC :p
05:00:48FromDiscord<Elegantbeef> It technically is and does
05:01:06FromDiscord<Elegantbeef> Garbage collection is a general term for automatic memory management
05:01:14FromDiscord<Elegantbeef> Which it so happens RC falls under
05:01:20FromDiscord<Valdar> yeah, i thought that as well when i was trying out Rust
05:01:22termerisn't orc closer to what someone would consider a traditional GC
05:01:27termersince it has some sort of active collector
05:01:31FromDiscord<Elegantbeef> Not really
05:01:59FromDiscord<Elegantbeef> `refc` is a garbage collector, `orc` is arc + cycle breaker, so maybe but it's still not the same
05:02:44FromDiscord<Valdar> I'll read more on it. so I can at least ask intelligent questions 🙂
05:03:19FromDiscord<Elegantbeef> Eh i usually attempt to answer even the unintelligent ones
05:03:26FromDiscord<Elegantbeef> Do you have a link to the Nim page?
05:03:58FromDiscord<Elegantbeef> https://nim-lang.org/docs/mm.html and https://nim-lang.org/docs/destructors.html
05:04:44FromDiscord<Bubblie> also, about the bot tags, you all are talking from gitter right?
05:05:13termerI'm from IRC
05:05:19termerI don't know how many people use Gitter
05:05:25FromDiscord<Bubblie> whats IRC
05:05:28termerLOL
05:05:40termeroldest continuously used chat protocol in the world
05:05:51termeralso the best in terms of support
05:06:00FromDiscord<Elegantbeef> Prestige i think the issue is the same thing
05:06:01FromDiscord<Bubblie> oh internet relay chat
05:06:06termeryes
05:06:30FromDiscord<Elegantbeef> nope nevermind
05:06:39FromDiscord<Bubblie> I didn't think people still used it tbh they usually just use chatting platforms
05:06:55termerthere are a ton of people who still use it but not many normal people
05:07:01FromDiscord<Bubblie> LMAO
05:07:01termeralmost exclusively tech literates
05:07:27termerhigh barrier to entry tends to keep people out
05:07:34FromDiscord<Bubblie> I kinda like being able to chat through a ui so I'll stick to discord
05:07:34nrds<Prestige99> Beef: oh that's too bad
05:07:38nrds<Prestige99> seems similar in nature
05:07:45termernot really high per se, but it sucks to use without extra tools
05:07:49termerlike you don't get chat history
05:08:02termerunless you've setup a bouncer like ZNC to keep you connected and relay it to you when you connect
05:08:03FromDiscord<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:22FromDiscord<Bubblie> all this for chatting with programmers on the internet?
05:08:29FromDiscord<Bubblie> I mean
05:08:32FromDiscord<Bubblie> you do you Ig
05:08:39termerit works and I like it more than discord
05:08:47FromDiscord<Bubblie> fair
05:08:47termerplus you can't get banned from IRC
05:08:55termeryou can get banned from a server
05:08:58termeror a channel
05:09:00termerbut not IRC
05:09:09termerit's a lot more free
05:09:13FromDiscord<Bubblie> I think thats both a pro and a con
05:09:16termerit's a pro
05:09:31termerit's also """federated""" aka you setup a server and connect
05:09:33FromDiscord<Bubblie> I mean, if there is a very annoying individual how do you get rid of them
05:09:35termernot really federated
05:09:43termerhow do you get rid of them? ban their IP
05:09:53FromDiscord<Valdar> yeah, looks like a Con to me.
05:09:57FromDiscord<Bubblie> so, you can ban them, just not from using IRC
05:10:03termeryeah of course
05:10:08termercause IRC is just a protocol
05:10:21FromDiscord<Bubblie> id hope they wouldn't be using a vpn then
05:10:38FromDiscord<Bubblie> cause then it would probably be hard to ip ban them right
05:10:42termeryou can block VPNs if you want but this is the same situation with discord alt accounts
05:10:43FromDiscord<Bubblie> unless you track the vpn end point
05:10:49termeranyone who wants to can get alt accounts
05:11:09termerI've got like 10 discord accounts lol it's not hard to do
05:11:19FromDiscord<Bubblie> why do you have 10...
05:11:26termerfor fun
05:11:33FromDiscord<Bubblie> I have no words
05:11:47termerbut my point is that IRC is free as in freedom
05:11:51termerand you can run all your own stuff
05:11:58termerlike I have an IRC server for friends
05:12:10FromDiscord<Elegantbeef> Insert matrix comments here
05:12:18termermatrix takes a billion gigs of RAM to run
05:12:22termerand is slow as shit
05:12:28FromDiscord<huantian> pc issue
05:12:31FromDiscord<Elegantbeef> Blame the servers 😛
05:12:36termeryeah the servers suck
05:12:47termeryou shouldn't need several gigs of ram to run a chat server
05:13:02FromDiscord<Elegantbeef> Synapse is written in python iirc
05:13:06termeryeah
05:13:11FromDiscord<Elegantbeef> They're not exactly aiming for performance
05:13:12termeraka the worst choice
05:13:12FromDiscord<Bubblie> cython is pretty cool
05:13:14FromDiscord<Bubblie> I like cython
05:13:21termerI tried using matrix but it was just so slow
05:13:25termerespecially the main homeserver
05:13:38termerI still use it but only via a bot
05:13:43termerand for one channel
05:13:48FromDiscord<huantian> I might setup my own matrix homeserver just for funsies
05:13:58termerit won't be fun
05:14:07FromDiscord<huantian> why not
05:14:12termerthat's like saying you're gonna setup an email server for funsies
05:14:24FromDiscord<Bubblie> im trying to figure out where nimgl put EXIT_SUCCESS for vulkan
05:14:32FromDiscord<huantian> In reply to @termer "that's like saying you're": I did that once
05:14:35termertons of configuration and huge ability to fuck things up
05:14:35FromDiscord<huantian> it took like 2 hours
05:14:39FromDiscord<Bubblie> ill just return 0
05:14:49FromDiscord<huantian> idk I might just copy this nixos config
05:15:04termerwhat's the point
05:15:18termernobody ends up running a homeserver for long unless they're dedicated
05:16:16termerBubblies oh yeah also, about not being able to be banned on IRC, it's not just a benefit for people fucking around
05:16:25termerI've gotten warned on discord before for what other people in a discord did
05:16:39termercause I had admin privs in the guild
05:16:50termerthe fact that you can get banned for what others do is a problem
05:17:08FromDiscord<Bubblie> sent a code paste, see https://play.nim-lang.org/#ix=3T2R
05:17:13termerit'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:15FromDiscord<Bubblie> cause this doesn't work
05:17:15FromDiscord<Elegantbeef> Yes this isnt C
05:17:21FromDiscord<Bubblie> LMAO
05:17:28FromDiscord<Elegantbeef> you need to call `main`
05:17:33FromDiscord<Elegantbeef> Nim doesnt have a `main`
05:17:35termerhahahaha
05:17:37FromDiscord<Bubblie> yeah I called it
05:17:43FromDiscord<Bubblie> underneath
05:17:43termeryou can check something like isMainModule or something
05:17:54FromDiscord<Bubblie> sent a code paste, see https://play.nim-lang.org/#ix=
05:18:00FromDiscord<Elegantbeef> `discard main()`
05:18:01termernice link
05:18:05FromDiscord<Elegantbeef> Nim doesnt allow you to have unhandled values
05:18:20termerthe unhandled values thing was annoying to me at first
05:18:20FromDiscord<Bubblie> ah okay, so instead of using return id use discard
05:18:26FromDiscord<Elegantbeef> No
05:18:31termernot sure if it's really all that decent of a feature
05:18:34FromDiscord<Elegantbeef> you use `discard` when you dont want a value
05:18:47FromDiscord<Elegantbeef> It's a very good feature when you have every statement can be an expression
05:18:52FromDiscord<Elegantbeef> It's pretty much needed for that imo
05:19:25termerevery statement being an expression is just weird
05:19:33FromDiscord<Elegantbeef> It's so lovely
05:19:44FromDiscord<Bubblie> oh so like, it would still be returning 0, but id be discarding
05:19:55FromDiscord<Elegantbeef> you discard it at the call sitee
05:19:59FromDiscord<Bubblie> yeah
05:20:00FromDiscord<Elegantbeef> I mean why are you even making a main proc
05:20:02FromDiscord<Bubblie> discard main()
05:20:10FromDiscord<Bubblie> In reply to @Elegantbeef "I mean why are": idk im insane
05:20:18FromDiscord<Elegantbeef> sent a code paste, see https://play.nim-lang.org/#ix=3T2T
05:20:19FromDiscord<Bubblie> alright
05:20:25termerc brainwashing
05:20:27termerpay no heed
05:20:39FromDiscord<Bubblie> so what is isMainModule
05:20:41FromDiscord<Bubblie> is it like
05:20:44FromDiscord<Bubblie> a main method like thing ig
05:20:46FromDiscord<huantian> isMainModule is so much easier to type than pythons name main
05:21:07FromDiscord<Bubblie> In reply to @termer "pay no heed": it is C brainwashing
05:21:11FromDiscord<Elegantbeef> `isMainModule` is a boolean that's true if the scope owner is the module you're compiling
05:21:13FromDiscord<Bubblie> and like, every other lang that has a main method
05:21:15FromDiscord<Elegantbeef> It's not rocket science
05:21:21FromDiscord<Elegantbeef> Nim files are called `modules`
05:21:35*rockcavera quit (Remote host closed the connection)
05:21:37termerpublic static void main(String[] args) {}
05:21:47termernever got over how verbose java main was
05:21:58FromDiscord<huantian> It’s the same as pythons `if name == “main”`
05:22:07FromDiscord<Bubblie> In reply to @Elegantbeef "It's not rocket science": no need to be rude about it lmao mb
05:22:09termerNo. You WILL use a class to start your program
05:22:23FromDiscord<Elegantbeef> I'm not being rude, i'm joking around
05:22:25FromDiscord<Elegantbeef> It's all banter
05:22:35termerlearn to bant, my friend
05:22:41FromDiscord<Bubblie> I cant really tell through text a lot of the time
05:22:51FromDiscord<Bubblie> so im just gonna assume its banter from now on
05:22:51*joshbaptiste quit (Ping timeout: 245 seconds)
05:23:03FromDiscord<Elegantbeef> It's akin, not the same 😛↵(@huantian)
05:23:44FromDiscord<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:46FromDiscord<Elegantbeef> when bodies that are false arent semantically checked!
05:23:52FromDiscord<Bubblie> (edit) "In reply to @termer "No. You WILL use": yes, I will make an entire class just ... run" added "to"
05:24:02FromDiscord<Elegantbeef> Kotlin and C# both now have the abillity for atleast some top level statements
05:24:04FromDiscord<Bubblie> In reply to @Bubblie "yes, I will make": I'm totally sane
05:24:08FromDiscord<Elegantbeef> Cmon java be modern
05:24:10FromDiscord<Bubblie> In reply to @Elegantbeef "Kotlin and C# both": yeah it's great
05:24:16FromDiscord<Bubblie> java might have this feature soon actually
05:24:22FromDiscord<Bubblie> java is sorta picking up pace
05:24:31FromDiscord<Bubblie> they added sealed classes
05:24:42FromDiscord<Bubblie> but uh
05:24:46FromDiscord<Bubblie> yeah
05:24:58FromDiscord<Bubblie> oracle kinda cringe ngl
05:25:43FromDiscord<Bubblie> oh shit I forgot to import glfw
05:26:00FromDiscord<Bubblie> I removed it to test something
05:26:04FromDiscord<Bubblie> (edit) "import" => "reimport"
05:26:26FromDiscord<Bubblie> ive met people who don't use glfw
05:26:32FromDiscord<Bubblie> for vulkan
05:26:39FromDiscord<Bubblie> just straight up do it by hand
05:26:43FromDiscord<Bubblie> absolutely insane individuals
05:27:47FromDiscord<Bubblie> yall gonna hate this
05:27:47FromDiscord<Bubblie> https://github.com/jjv360/nim-classes
05:27:58FromDiscord<Elegantbeef> I've seen it before
05:28:07FromDiscord<Elegantbeef> Hell I helped impbox with some fixes to oolib iirc
05:28:57FromDiscord<Bubblie> is it possible to keep procedures in groups so it looks neater ig
05:29:07FromDiscord<Elegantbeef> Yea you write them that way
05:29:16FromDiscord<Elegantbeef> Odd concept i know
05:29:20*joshbaptiste joined #nim
05:30:09FromDiscord<Bubblie> no like, could I stick the procedures in a block or something
05:30:38FromDiscord<Elegantbeef> You could
05:30:56FromDiscord<Bubblie> just to be like "these are where the specific procedures for the triangle take place" something like that ig
05:31:03FromDiscord<Elegantbeef> sent a code paste, see https://play.nim-lang.org/#ix=3T2U
05:31:03FromDiscord<Bubblie> ooo
05:31:15FromDiscord<Bubblie> I completely forgot about templates
05:31:18FromDiscord<Elegantbeef> You know what i like is you can just do `## These are procedures for the triangle`
05:31:29FromDiscord<Bubblie> yeah that works too
05:31:32FromDiscord<Bubblie> ill just do a doc
05:32:03FromDiscord<Elegantbeef> This is a fun bug prestige
05:32:25FromDiscord<Bubblie> git just shit itself thanks git
05:33:27FromDiscord<Bubblie> okay I think im writing nim like its C++ let me try to fix this
05:33:44FromDiscord<Bubblie> what C++ does to a mf
05:33:50FromDiscord<Equinox> lmao
05:34:00FromDiscord<Equinox> tbf there are about 50 different ways to write C++ code
05:34:04FromDiscord<Elegantbeef> Perhaps that's a good idea
05:36:21nrds<Prestige99> Elegantbeef I'm glad you find these bugs fun :P
05:36:47FromDiscord<Elegantbeef> Lol, it's an odd one
05:38:32FromDiscord<Elegantbeef> It's another `==` issue i think
05:38:53FromDiscord<Bubblie> sent a code paste, see https://play.nim-lang.org/#ix=
05:39:09FromDiscord<Elegantbeef> Compiler errors generally give answers
05:39:17FromDiscord<Elegantbeef> Yea it's another pointer issue prestige
05:39:52FromDiscord<Bubblie> sent a code paste, see https://play.nim-lang.org/#ix=
05:40:05FromDiscord<Bubblie> so window != nil
05:40:15FromDiscord<Bubblie> the assert is failing
05:41:00nrds<Prestige99> nice beef
05:41:15FromDiscord<Elegantbeef> Who knew pointers comparison sucks
05:52:49FromDiscord<Bubblie> The hell is going on with NimGL this is odd
05:54:45FromDiscord<Elegantbeef> PEBKAC
05:55:30FromDiscord<Bubblie> LOL
05:56:27FromDiscord<Bubblie> Usually when you create a glfw window its glfwCreateWindow(width,height, null null) but here its just the width and height
05:56:49FromDiscord<Elegantbeef> https://nimgl.dev/docs/glfw.html#glfwCreateWindow%2Cint32%2Cint32%2Ccstring%2CGLFWMonitor%2CGLFWWindow%2Cbool the rest are optional
05:57:28FromDiscord<Bubblie> Weird… maybe im calling it in the wrong place
05:57:33FromDiscord<Bubblie> Ill figure it out in the morning
05:58:11FromDiscord<Elegantbeef> sent a code paste, see https://play.nim-lang.org/#ix=3T2Y
05:59:07FromDiscord<Equinox> I don't mean to interrupt but do you guys know of any nim tui libraries like tui in rust?
05:59:14FromDiscord<Elegantbeef> illwill?
06:00:44*ltriant quit (Ping timeout: 252 seconds)
06:01:37FromDiscord<Bubblie> Whats tui,
06:01:40FromDiscord<Bubblie> (edit) "tui," => "tui?"
06:01:48FromDiscord<Elegantbeef> Text user interface
06:02:07FromDiscord<Bubblie> Oh okay
06:02:59FromDiscord<Equinox> In reply to @Bubblie "Oh okay": basically just an app that runs in the terminal
06:03:33FromDiscord<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:44FromDiscord<Equinox> otherwise I was just gonna go back to rust
06:04:57FromDiscord<demotomohiro> In reply to @Bubblie "Usually when you create": Example code in nimgl repo doesn't work for you?
07:06:15FromDiscord<Phil> Alright, so I have this generic proc to generate procs to handle specific HTTP requests for creating entries in a database
07:06:40FromDiscord<Phil> I've got a solution, but I don't comprehend why it works
07:09:12FromDiscord<Phil> sent a code paste, see https://play.nim-lang.org/#ix=3T39
07:09:44FromDiscord<Phil> (edit) "https://play.nim-lang.org/#ix=3T39" => "https://paste.rs/xRu"
07:10:14FromDiscord<Phil> (edit) "https://play.nim-lang.org/#ix=3T3c" => "https://play.nim-lang.org/#ix=3T3b"
07:10:54FromDiscord<Elegantbeef> You override the GCsafe checking
07:11:14FromDiscord<Phil> What I don't get is why I have to for a proc that only fires select statements to a database
07:11:27FromDiscord<Phil> None of this does actual data manipulation outside of the application
07:11:39FromDiscord<Phil> So that proc should be absolutely gc-safe
07:11:43FromDiscord<Elegantbeef> It does something that isnt gcsafe
07:12:43FromDiscord<Elegantbeef> https://nim-lang.org/docs/manual.html#effect-system-gc-safety-effect
07:12:51*Gustavo6046 joined #nim
07:17:26FromDiscord<Phil> Figured it out
07:17:44FromDiscord<Phil> It wasn't necessarily that the proc that I passed in there was actually unsafe
07:17:56FromDiscord<Phil> It was that the compiler couldn't guarantee that `getSerializedArticleData` would always be safe
07:18:50FromDiscord<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:10FromDiscord<Elegantbeef> You can force the proc to be `GcSafe`
07:21:24FromDiscord<Elegantbeef> I mean the passed in one
07:21:33FromDiscord<Phil> sent a code paste, see https://paste.rs/Xrf
07:21:38*PMunch joined #nim
07:21:57FromDiscord<Phil> (edit) "https://play.nim-lang.org/#ix=3T3i" => "https://play.nim-lang.org/#ix=3T3h"
07:24:21FromDiscord<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:26FromDiscord<Phil> (edit) "above?↵What" => "above?↵↵What"
07:25:15FromDiscord<Elegantbeef> It sounded like the issue with gcsafety was a passed in procedure to another proceedure
07:25:17FromDiscord<Elegantbeef> Am i wrong?
07:26:24FromDiscord<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:35FromDiscord<Elegantbeef> What does `getSerializedArticleData` do?
07:27:39FromDiscord<Phil> sent a code paste, see https://play.nim-lang.org/#ix=3T3k
07:29:25FromDiscord<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:43FromDiscord<Phil> None of these things modify the database
07:29:50FromDiscord<Elegantbeef> Does it use any global variables?
07:30:09FromDiscord<Elegantbeef> If so are any of them GC'd?
07:30:12FromDiscord<Phil> A connection pool, which is a global seq of DbConn objects with a lock associated
07:30:29FromDiscord<Elegantbeef> Well there you go
07:30:31FromDiscord<Phil> And the procs that make use of that have a notorious amount of cast gcsafe
07:30:54FromDiscord<Elegantbeef> You seemed to have miss something then
07:31:46FromDiscord<Elegantbeef> Wish the gcsafe messages were as informative as the func messages
07:31:48FromDiscord<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:33FromDiscord<Elegantbeef> sent a code paste, see https://play.nim-lang.org/#ix=3T3l
07:32:57FromDiscord<Elegantbeef> Without `gcsafe` `proc (){.locks: 0.}`
07:33:02FromDiscord<Phil> sent a code paste, see https://paste.rs/73m
07:33:04FromDiscord<Elegantbeef> You're forcing it to be gcsafe
07:33:40FromDiscord<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:55FromDiscord<Phil> (edit) "it?" => "it (and blocks compilation if that check is violated)?"
07:33:59FromDiscord<Elegantbeef> `gcSafe` is just a type safety feature it doesnt change anything
07:34:23FromDiscord<Elegantbeef> > The gcsafe annotation can be used to mark a proc to be gcsafe, otherwise this property is inferred by the compiler
07:34:47FromDiscord<Elegantbeef> The pragma overrides the GC safety checker and just says "yep it's safe"
07:35:35FromDiscord<Elegantbeef> It works opposite as you'd expect given the other annotations
07:35:51FromDiscord<Elegantbeef> You'd expect it'd error and say "Hey this isnt safe due to X", but nope it just forces it
07:36:35FromDiscord<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:48FromDiscord<Elegantbeef> It does the same thing but just with a block
07:37:55FromDiscord<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:26FromDiscord<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:04FromDiscord<Elegantbeef> Nope it's not the same as `noSideEffect` or `raises: []`
07:39:09FromDiscord<Elegantbeef> Which is weird
07:40:51FromDiscord<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:53FromDiscord<Phil> (edit) "way" => "away"
07:40:55FromDiscord<Phil> And it does
07:41:02FromDiscord<Phil> And now I feel like my life is crumbling down around me
07:41:03FromDiscord<Phil> Wtf
07:41:07FromDiscord<Elegantbeef> Lol
07:41:23FromDiscord<Elegantbeef> Reading the docs is your weakness eh?
07:41:34FromDiscord<Phil> WAIT
07:41:48FromDiscord<Elegantbeef> Waiting
07:41:56FromDiscord<Phil> I do all my stuff in a custom template that grabs me a connection from the pool and opens a transaction
07:42:16FromDiscord<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:05FromDiscord<Phil> HAH! Yes that was the case
07:43:07FromDiscord<Elegantbeef> Perhaps it does
07:44:02FromDiscord<Elegantbeef> Your homework for tomorrow will be to read the manual, i'll then have a small quiz for you 😛
07:50:32pchgreat i fixed the edge function just to find out ive got something wrong with edge bias
07:50:38pchwell, at least there's no more weird blocks
07:50:59FromDiscord<Phil> sent a long message, see http://ix.io/3T3o
07:51:02pchdecided to be a cheeky shit and detect winding order on the fly
07:51:43pchgcsafe means a few thing
07:51:45pchthings
07:51:53pch1 it's safe for gc
07:51:56pch2 it's safe from gc
07:52:07pchi will not elaborate
07:52:09FromDiscord<Elegantbeef> Their issue is mainly just the annotation part
07:52:19FromDiscord<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:24FromDiscord<Elegantbeef> It also means it's threadsafe
07:52:41FromDiscord<Elegantbeef> It forces it
07:52:43FromDiscord<Elegantbeef> And it says so
07:53:04FromDiscord<Elegantbeef> > mark a proc to be gcsafe, otherwise this property is inferred
07:54:22FromDiscord<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:50FromDiscord<Elegantbeef> It's dumb that it overrides it imo, but it's what it does
07:57:05FromDiscord<Phil> And to be triply sure, by "overrides it" you mean that the pragma overrides the compilers gcsafe check?
07:57:14FromDiscord<Elegantbeef> It seems so
07:57:20FromDiscord<Elegantbeef> I say it's a bug but what do i know
07:57:51FromDiscord<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:22FromDiscord<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:37PMunchHmm, 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:37FromDiscord<Elegantbeef> Yea it doesnt work like any other annotation
08:34:22FromDiscord<Elegantbeef> I actually forgot it warns
08:34:59FromDiscord<Elegantbeef> If you want to enforce the behaviour @Phil compile with `--warningAsError[GcUnsafe2]: on`
08:35:35PMunchBut this is weird: https://forum.nim-lang.org/t/6846#42793
08:35:51PMunchThere Araq shows it as throwing an error
08:36:12PMunchBut when I try to run that on the playground (even with older versions), it just shows a warning..
08:36:30FromDiscord<Elegantbeef> Perhaps he enables the warning as error
08:37:02PMunchBut I've definitely had code error out on GC-unsafe errors
08:38:09FromDiscord<Elegantbeef> sent a code paste, see https://paste.rs/VcJ
08:38:27FromDiscord<Elegantbeef> Or similar
08:38:48PMunchAh yes, that's probably it
08:39:35FromDiscord<Elegantbeef> sent a code paste, see https://paste.rs/4qC
09:14:14FromDiscord<Phil> In reply to @Elegantbeef "If you want to": I'll try that out, though I'm marginally confused, why GcUnsafe2?
09:17:21FromDiscord<Rika> theres another GcUnsafe that i assume was deprecated
09:50:16PMunchHmm, 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:42PMunchI 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:03FromDiscord<Phil> Easy
09:54:04FromDiscord<Phil> I don't use vim
09:54:43FromDiscord<Phil> ~~And there are no new great vscode plugins so that takes some difficulty away from me~~
09:55:17FromDiscord<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:32FromDiscord<enthus1ast> I comment them out as soon as possible
10:06:31PMunchI mean I don't only mean vim plug-ins
10:07:25PMunchEven 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:07FromDiscord<Rika> The binds of the plugins I get are memorable
10:08:22FromDiscord<Rika> And so what if you don’t use all features?
10:08:56FromDiscord<enthus1ast> i often read tool documentation when i eat lunch on my desk at work \:D
10:09:07FromDiscord<enthus1ast> just for fun
10:09:59FromDiscord<enthus1ast> so instead of browsing etc i read documentation of the tools i use often \:)
10:10:08FromDiscord<enthus1ast> strange i know
10:10:11FromDiscord<Rika> Sounds like me
10:10:24FromDiscord<Rika> Except it’s docs for things I’m planning on using to make things
10:13:28FromDiscord<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:11FromDiscord<enthus1ast> import randomGnomeRant
10:19:04PMunchWell of course, there's nothing wrong with not using 100% of the features you have available
10:19:29PMunchBut 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:42PMunchBut 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:39FromDiscord<Rika> Okay
11:18:33PMunchMaybe 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:55FromDiscord<Phil> In reply to @enthus1ast "import randomGnomeRant": That'll be a very small rant
11:40:10FromDiscord<Phil> (edit) "In reply to @enthus1ast "import randomGnomeRant": That'll be a very small rant ... " added "😛"
11:41:37FromDiscord<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:29FromDiscord<hmmm> something like python xrange maybe
11:42:39FromDiscord<Phil> `x in 0..bla.len()`
11:42:47FromDiscord<hmmm> perfect
11:48:57FromDiscord<Generic> ranges are inclusive, so most of the time you probably want 0..<bla.len
11:49:20FromDiscord<Generic> or `low(bla)..high(bla)`, which works for every container
11:49:26FromDiscord<Generic> which is indexable
12:05:04*neurocyte0917090 joined #nim
12:11:55FromDiscord<ajusa> In reply to @Generic "or `low(bla)..high(bla)`, which works": And also for stuff like ints
12:21:23FromDiscord<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:24FromDiscord<wsantos> https://media.discordapp.net/attachments/371759389889003532/955440993304469514/unknown.png
12:21:51FromDiscord<wsantos> This macro works, but I'm not sure how to do this inside another macro.
12:25:32FromDiscord<Rika> A macro creating another macro doesn’t really sound like good design
12:25:56FromDiscord<Rika> Might be better if you can expound for us to think of a better design?
12:27:16FromDiscord<wsantos> This is not a good design for sure, but I need this so I can "simulate" kwargs on all object function
12:27:39FromDiscord<wsantos> (edit) "function" => "functions"
12:28:51FromDiscord<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:58FromDiscord<wsantos> sent a code paste, see https://paste.rs/Pk6
12:30:18*xet7 quit (Remote host closed the connection)
12:30:24FromDiscord<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:53FromDiscord<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:25FromDiscord<Rika> You could probably make it a pragma yes, it would likely be better as well
12:32:48FromDiscord<Rika> A function pragma receives the definition of the function and should return the modified definition
12:33:50FromDiscord<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:34FromDiscord<Rika> You can probably create two definitions, it’s just a “should do this”
12:37:10FromDiscord<Rika> It’s like calling the macro with the function definition, you can ultimately return anything, even nothing
12:41:04FromDiscord<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:32FromDiscord<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:01FromDiscord<Rika> theMacro: ...indent and newline... All the function definitions
12:43:06FromDiscord<Rika> Something like that
12:49:40FromDiscord<wsantos> I'll play around with it, thank you
12:52:40FromDiscord<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:33FromDiscord<wsantos> what is push and pop 🤔 ?
12:57:26FromDiscord<Rika> https://nim-lang.org/docs/manual.html#pragmas-push-and-pop-pragmas
13:00:35FromDiscord<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:07FromDiscord<wsantos> 100%, thank you
13:38:27*joshbaptiste quit (Quit: WeeChat 3.4)
13:41:45FromDiscord<mratsim> In reply to @Rika "For those wondering why": but checks:off contaminates the whole project
13:42:15FromDiscord<mratsim> we had a surprise where checks where turned off where we expected them
13:43:18FromDiscord<Rika> Really huh
13:51:20FromDiscord<Phil> Naming question, what do you call a proc that returns another proc? "FactoryProc"?
13:54:52FromDiscord<Rika> No
13:54:55FromDiscord<Rika> That’s Java
13:55:02FromDiscord<Rika> It’s just a proc
14:01:12FromDiscord<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:34FromDiscord<Phil> (edit) "God damn, not even JS has a ... convention" added "naming"
14:10:44FromDiscord<mratsim> In reply to @Isofruit "Naming question, what do": HOF?
14:11:17FromDiscord<Phil> Do people use HOF as an acronym inside function names? I was under the impression in general acronyms were highly discouraged
14:11:24FromDiscord<mratsim> ah no not exactly, HOF have a proc input.
14:11:24*arkurious joined #nim
14:11:51FromDiscord<mratsim> HOF is higher_order_function, no one sane (discounting Java) will use that in a function name.
14:13:54FromDiscord<Rika> im not sure why you chose nim given that your views seem to align best with java
14:16:33FromDiscord<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:54FromDiscord<konsumlamm> higher order functions are functions that either take a function as argument or return one
14:17:07FromDiscord<konsumlamm> so calling it HOF would be correct
14:17:41FromDiscord<konsumlamm> not that that's how you should name your function, but that's how it's called
14:18:06FromDiscord<konsumlamm> i suggest naming it something that says what it does, rather than what its type is
14:18:49FromDiscord<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:15FromDiscord<Phil> So a controller-creating-proc, or handler-creating-proc
14:21:04FromDiscord<mratsim> In reply to @Isofruit "If you're familiar with": generic name is handler.
14:21:24FromDiscord<mratsim> but then your repo becomes littered with "tools", "utils" and "helpers".
14:22:07FromDiscord<Rika> createNNNNHandler?
14:22:17FromDiscord<Rika> verbs not nouns for proc names
14:22:34FromDiscord<Rika> wheres that hammer article thing
14:23:36FromDiscord<Rika> https://steve-yegge.blogspot.com/2006/03/execution-in-kingdom-of-nouns.html i think this is it
14:23:47FromDiscord<Rika> good read
14:25:13FromDiscord<Phil> sent a long message, see https://paste.rs/gQC
14:25:55FromDiscord<Rika> i'm under the impression that that is the chaos itself, so you do you ig
14:25:58FromDiscord<Phil> In reply to @Rika "createNNNNHandler?": Actually, right, think more verb and it makes more sense
14:26:19FromDiscord<Phil> In reply to @Rika "i'm under the impression": I've seen the alternative, imo that is way worse
14:26:52FromDiscord<Phil> That alternative being one folder for all modules, one folder for all controllers, one folder for all services etc.
14:26:54FromDiscord<Rika> you do you then really
14:27:05FromDiscord<Phil> (edit) "modules," => "modeols,"
14:27:11FromDiscord<Phil> (edit) "modeols," => "models,"
14:29:54FromDiscord<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:23FromDiscord<wsantos> Is there a place in the manual with a list where pragma can be used ? and what it could affect ?
14:35:30FromDiscord<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:40FromDiscord<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:23FromDiscord<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:52FromDiscord<Phil> Am I understanding that right?
14:37:55FromDiscord<Daan Breur> Thats what we are doing now, but that results in memoryleaks.
14:38:04FromDiscord<Phil> Why multi-thread at all?
14:38:13FromDiscord<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:15FromDiscord<Daan Breur> Read it singlethreaded into a seq. Then pass it onto the threads
14:38:28FromDiscord<Rika> why is what theyre asking
14:38:36FromDiscord<Rika> there doesnt seem to be a reason to do that
14:39:28FromDiscord<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:49FromDiscord<Daan Breur> The code processes whats in the file. Thats why multithreaded.
14:39:57FromDiscord<mratsim> otherwise open the file with memory-map and pass the ptr UncheckedArray to other threads.
14:40:22FromDiscord<d4rckh> we are writing a web fuzzer used to identify security vulnerabilities in websites
14:40:27FromDiscord<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:34FromDiscord<Daan Breur> Yes it is
14:40:44FromDiscord<mratsim> (edit) "s" => "Is"
14:41:27FromDiscord<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:08FromDiscord<d4rckh> it just takes words from a file and makes a HTTP request with it
14:42:17FromDiscord<Daan Breur> And some other stuff
14:42:19FromDiscord<d4rckh> usually these wordlists are very large and it takes a long time
14:42:40FromDiscord<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:43FromDiscord<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:50FromDiscord<d4rckh> In reply to @Isofruit "Why does it take": we wait for a call to finish before we start the next one
14:44:25FromDiscord<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:47FromDiscord<Phil> Which would mean working with Futures, which I haven't done in nim yet, mratsim have you?
14:44:52ehmryfor the os its async all the way down, even with mmap
14:48:45FromDiscord<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:19ehmryi 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:23ehmrywell 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:22FromDiscord<Phil> Ahhh check
14:57:54FromDiscord<mratsim> In reply to @d4rckh "it just takes words": use async, not multithreading
14:58:36FromDiscord<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:09FromDiscord<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:15FromDiscord<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:20FromDiscord<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:18FromDiscord<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:58FromDiscord<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:18FromDiscord<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:33FromDiscord<mratsim> In reply to @Isofruit "Thanks for that link": I love that essay
15:04:12FromDiscord<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:54FromDiscord<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:56FromDiscord<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:35FromDiscord<mratsim> https://media.discordapp.net/attachments/371759389889003532/955482311317655632/unknown.png
15:08:28FromDiscord<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:18FromDiscord<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:23FromDiscord<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:55FromDiscord<Rika> isnt there a third party mpmc queue being worked on
15:21:08FromDiscord<Rika> https://github.com/nim-works/loony
15:21:31FromDiscord<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:35FromDiscord<Jakraes> Kinda like this
15:22:10FromDiscord<Rika> only if its a ref/ptr?
15:22:54FromDiscord<Jakraes> sent a code paste, see https://play.nim-lang.org/#ix=3T5r
15:23:03FromDiscord<Jakraes> Would that change the object itself?
15:23:05FromDiscord<Rika> definition of `Object` required
15:23:11FromDiscord<Rika> if its not a ref then it will not change
15:24:00FromDiscord<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:06FromDiscord<Jakraes> Gotcha, how can I make a ref out of it?
15:24:25FromDiscord<Rika> `ref object` instead of only `object`
15:24:46FromDiscord<Jakraes> Should I do that when I add it to the seq?
15:24:53FromDiscord<Jakraes> Like seq.add(ref object)?
15:25:01FromDiscord<mratsim> In reply to @auxym "oh yeah forgot about": if it works with arc it works with orc
15:25:11FromDiscord<Rika> no what
15:25:22FromDiscord<Jakraes> I'm sorry I'm a lil bit new to this
15:25:23FromDiscord<mratsim> In reply to @auxym "wish nim had an": https://github.com/nim-lang/threading/blob/master/threading/channels.nim
15:25:23FromDiscord<Rika> sent a code paste, see https://play.nim-lang.org/#ix=
15:25:49FromDiscord<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:39FromDiscord<auxym> In reply to @mratsim "https://github.com/nim-lang/threading/blob/master/t": neat, is this experimental?
15:26:59FromDiscord<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:27FromDiscord<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:45FromDiscord<mratsim> I mean, it could handle billions of Fibonacci task thefts
15:28:03FromDiscord<mratsim> across 36 threads in a couple hundres ms
15:28:10FromDiscord<mratsim> (edit) "ms" => "µs"
15:28:17FromDiscord<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:05FromDiscord<planetis> it's creator complain before that there are thread safety issues
16:47:32FromDiscord<planetis> and blamed it on isolated which i think it's not true
16:54:05FromDiscord<System64 ~ Flandre Scarlet> Hi, is there fixed point types on Nim?
16:54:46FromDiscord<Rika> third party
16:55:02*vicfred joined #nim
16:55:29FromDiscord<System64 ~ Flandre Scarlet> ah alright↵And can I use this library flawlessly like floats?
16:55:53FromDiscord<Rika> depends on the librayr
16:55:55FromDiscord<Rika> (edit) "librayr" => "library"
16:56:22FromDiscord<planetis> what's the use case?
16:57:12FromDiscord<System64 ~ Flandre Scarlet> In reply to @planetis "what's the use case?": DSP
16:57:19FromDiscord<System64 ~ Flandre Scarlet> I'm making an FM Synthesizer
16:57:47FromDiscord<planetis> i was porting a rust library but haven't finished all of it
16:58:01FromDiscord<auxym> on a MCU that doesn't have fpu? otherwise just use floats tbh
16:58:12FromDiscord<System64 ~ Flandre Scarlet> In reply to @auxym "on a MCU that": It's as fast?
16:58:33FromDiscord<planetis> https://github.com/planetis-m/dumpster/blob/master/fixed_point.nim
16:58:46FromDiscord<planetis> pretty sure it's slow
16:58:47FromDiscord<auxym> probably not, but on a modern cpu probably plenty fast enough
16:58:58FromDiscord<auxym> @System64 ~ Flandre Scarlet
16:59:03FromDiscord<planetis> if you can use floats
16:59:20FromDiscord<System64 ~ Flandre Scarlet> so I should go on floats I guess
16:59:34FromDiscord<auxym> yeah. use float32
17:00:13FromDiscord<System64 ~ Flandre Scarlet> alright
17:01:13FromDiscord<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:16FromDiscord<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:43FromDiscord<treeform> Your solution is very cool allow you to choose the base type and the fractional part.
17:17:10FromDiscord<treeform> do you plan to add sqrt and sin/cos?
17:24:06FromDiscord<System64 ~ Flandre Scarlet> Creating a fixed point thing gives me headaches lol
18:08:29NimEventerNew 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:50FromDiscord<Require Support> `char ` = `ptr cstring` ? c to nim
18:21:01FromDiscord<demotomohiro> `char` = `cstring`
18:23:26FromDiscord<planetis> @treeform no, at first I planned to use it but then I decided against it and it fell through
18:23:36FromDiscord<planetis> but feel free to borrow it and make a package
18:32:14FromDiscord<planetis> note there is a nimble package that allows for more options like operation between different representations of fixed point
18:33:50FromDiscord<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:26FromDiscord<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:22FromDiscord<planetis> cast it to an int and call strutils toHex
19:04:17FromDiscord<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:08nrds<Prestige99> What's their guide on exceptions
19:16:56FromDiscord<Ayy Lmao> They go into detail here https://status-im.github.io/nim-style-guide/errors.exceptions.html
19:21:40nrds<Prestige99> ah, why do they not have syntax highlighting. Lol
19:24:01nrds<Prestige99> https://github.com/status-im/nim-stew/blob/master/stew/results.nim this is the Result object they're talking about
19:24:14nrds<Prestige99> seems particular to status-im, I've never seen it before
19:30:35FromDiscord<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:19FromDiscord<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:47FromDiscord<Ayy Lmao> Thanks for the forum link, I hadn't seen that discussion yet.
19:57:07*anddam joined #nim
20:10:49FromDiscord<Bubblie> Semi colons in nim 😈
20:14:29FromDiscord<spoon> useful for code golfing
20:15:28FromDiscord<hmmm> result error seems neater than try except but I wouldn't want it forced on me 🤔
20:15:53FromDiscord<hmmm> we must be free like 🦋 😃
20:16:47FromDiscord<Rika> You can wrap result functions to make them exceptions
20:17:04FromDiscord<Rika> I’d say similarly for the reverse
20:33:44FromDiscord<Patitotective> how do i convert an int to an int32?
20:34:26FromDiscord<spoon> think you can just cast it with `int32 varname`
20:35:07FromDiscord<Patitotective> yea nvm
20:36:04*acidsys quit (Excess Flood)
20:36:37*acidsys joined #nim
21:13:53FromDiscord<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:22FromDiscord<Phil> It's not the <projectName>.nimble file is it? That one's only used for nimble install, right?
21:14:35FromDiscord<Bubblie> Can nim use meson
21:15:04FromDiscord<creikey> In reply to @Bubblie "Can nim use meson": you can build the generated C with meson
21:15:06FromDiscord<Bubblie> I asked this question previously but I didnt get an answer so im just asking again
21:15:18FromDiscord<Bubblie> Oh
21:15:19FromDiscord<Bubblie> I see
21:15:44FromDiscord<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:22FromDiscord<demotomohiro> How about to configure meson to build Nim project?
21:30:08FromDiscord<demotomohiro> Or call meson from .nims file
21:38:12FromDiscord<demotomohiro> !eval echo cast[int32](int.high), ",", cast[int32](-1)
21:38:14NimBot-1,-1
21:38:39FromDiscord<demotomohiro> !evall
21:39:12FromDiscord<demotomohiro> !eval echo (var x = int.high; x).int32
21:39:14NimBot/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:56FromDiscord<demotomohiro> Explicitly conveting int to int32 is safer than casting int to int32 as explicit type convertion do range check.
21:43:17FromDiscord<Elegantbeef> You use the type converters unless you want the same bit signature
21:45:02nrds<Prestige99> Am I the only one bothered by unittest requiring test file names to start with `t` ?
21:45:10FromDiscord<Elegantbeef> Yep
21:45:21nrds<Prestige99> ACTION flips a table
21:45:37FromDiscord<Elegantbeef> It's an ok idea that means you dont compile files that shouldnt be tested
21:45:49FromDiscord<Elegantbeef> say you have a module your tests depend upon that you import in them
21:46:15nrds<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:28FromDiscord<Elegantbeef> You dont name it with a t
21:46:34nrds<Prestige99> :(
21:46:37FromDiscord<Elegantbeef> What kinda question is that
21:47:07FromDiscord<Elegantbeef> Tests arent user facing code, aslong as you can discern the test i dont see the isssue
21:47:32nrds<Prestige99> maybe I'm a bit ocd
21:47:38FromDiscord<Elegantbeef> We disagree on a lot though so clearly disregard me
21:47:50nrds<Prestige99> I like my file names to be what I want them to be, not dictated by a framework
21:47:52nrds<Prestige99> true
21:48:36FromDiscord<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:42FromDiscord<Rika> In reply to @Elegantbeef "You dont name it": How is that reasonable I cannot see
21:49:14FromDiscord<Elegantbeef> No clue
21:49:21FromDiscord<Elegantbeef> It seems fine to me
21:49:31nrds<Prestige99> Elegantbeef I'd like them to be merged as a fix, maybe backported if Nim does that sorta thing for bugs
21:49:48nrds<Prestige99> Who do I have to sweet talk to make that a thing?
21:49:49FromDiscord<Elegantbeef> Yea i'd also like them to but it works around the bug instead of fixing it
21:51:43nrds<Prestige99> perhaps I should work on my own mini testing framework
21:52:29FromDiscord<Elegantbeef> Or you know just fork unittest and make it search for the `test` part of the path
21:52:33FromDiscord<Elegantbeef> Or you know use balls
21:53:59FromDiscord<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:00nrds<Prestige99> wasn't a huge fan of either tbh
21:57:16*ltriant joined #nim
21:58:10FromDiscord<Elegantbeef> Well i guess write your own
22:05:07*wyrd joined #nim
22:29:59FromDiscord<creikey> I think Ijust found a compiler error
22:30:03FromDiscord<creikey> compiler bug
22:30:05FromDiscord<creikey>
22:30:12FromDiscord<creikey> ` d.texture(tex, transform translate(snappedBounds.wh/2.0))` if I have this it compiles
22:30:35FromDiscord<creikey> ` d.texture(tex, transform translate(snappedBounds.wh /2.0))` if I have this it doesn't
22:30:45FromDiscord<Elegantbeef> no bug
22:30:50FromDiscord<creikey> no bug?
22:31:02FromDiscord<Elegantbeef> operators bound tightly as unary if touching
22:31:02FromDiscord<creikey> is /2.0 a different expression or so mething
22:31:12FromDiscord<Elegantbeef> `1 +2.0` is parsed as `1 (+2.0)`
22:31:17FromDiscord<creikey> interseting
22:31:21FromDiscord<creikey> (edit) "interseting" => "interesting"
22:31:28FromDiscord<creikey> so nim cares about whitespace in every sense of the word
22:31:29FromDiscord<Elegantbeef> Spacing is important for operators
22:32:02FromDiscord<Elegantbeef> There used to be some whitespace overriding of precedence so it used to be even weirder
22:32:13FromDiscord<Elegantbeef> `2+2 3` used to equal 12 not 8
22:33:04FromDiscord<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:55FromDiscord<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:01FromDiscord<demotomohiro> !eval import macros; dumpTree(6 /3)
22:41:03NimBot<no output>
22:41:53FromDiscord<demotomohiro> Bot does't shows compile time outputs :(
22:51:16*noeontheend joined #nim
22:53:19FromDiscord<hmmm> hmm very interesting, I just created two 0k undeletable files trying to write a file with nim 🧐
22:53:38FromDiscord<hmmm> I think it has to do with special chars windows filesystem doesn't allow
23:06:39nrds<Prestige99> Why would I be getting an error about alloc0 not existing when using osproc?
23:08:31nrds<Prestige99> ah some weird recursive import issue
23:15:17*noeontheend quit (Ping timeout: 240 seconds)