<< 10-07-2023 >>

00:08:38*lucasta quit (Remote host closed the connection)
00:53:20*ovenpasta quit (Ping timeout: 246 seconds)
01:32:19*Lord_Nightmare quit (Quit: ZNC - http://znc.in)
01:35:02*Lord_Nightmare joined #nim
01:40:04*azimut joined #nim
03:24:37*disso_pch joined #nim
03:26:13FromDiscord<bung8954> is there short way allocate memory without cast the result to `ptr ObjA` ? eg. `cast[ptr ObjA](alloc0(sizeof(ObjA)))`
03:26:38*disso-peach quit (Ping timeout: 246 seconds)
03:34:51FromDiscord<Elegantbeef> `create(ObjA)`
03:42:48FromDiscord<bung8954> ty, works, much simpler
06:57:19*junaid_ joined #nim
06:58:18*PMunch joined #nim
06:58:38*ntat joined #nim
07:24:38*junaid_ quit (Remote host closed the connection)
07:35:51*cyraxjoe quit (Ping timeout: 245 seconds)
07:36:35*cyraxjoe joined #nim
07:38:05*ovenpasta joined #nim
07:42:37*ehmry quit (Quit: https://quassel-irc.org - Chat comfortably. Anywhere.)
07:43:18*ehmry joined #nim
07:44:48*cyraxjoe quit (Ping timeout: 246 seconds)
07:50:25*cyraxjoe joined #nim
08:17:38*ovenpasta quit (Ping timeout: 246 seconds)
08:17:57*ovenpasta joined #nim
09:06:25FromDiscord<bung8954> @jmgomez does the `.pdb` file help debugging a third party dll ? I have a program that call dll function that throw nil access error
09:16:07*junaid_ joined #nim
09:17:35*junaid_ quit (Remote host closed the connection)
09:29:22*jmdaemon quit (Ping timeout: 245 seconds)
09:30:51FromDiscord<ieltan> Can someone explain the semantics of `object of X` vs `ref object of X` ?
09:31:59FromDiscord<ieltan> It's not documented in Nim docs unless i missed it
09:32:26FromDiscord<ambient3332> IIRC object of X can't handle circular reference, therefore ref object
09:35:28FromDiscord<demotomohiro> In reply to @ieltan "Can someone explain the": https://internet-of-tomohiro.netlify.app/nim/faq.en.html#type-when-to-use-ref-object-vs-plain-object-qmark
09:46:41*sagax quit (Ping timeout: 245 seconds)
09:50:11PMunch@ieltan, `object of X` is inheriting from X. Basically it creates a struct with the parent object as a member along with all the fields. Because the object is a member of the struct (and not via a pointer) you can't place a normal object as a field in itself. This is because the size would then be infinite (due to the infinite recursion). `ref object of X` is basically the same thing, but now our type is a ref object. This means that we can also have it as a
09:50:11PMunchfield in our struct, as the size of a pointer is always fixed so we don't get the infinite recursion and size problem.
09:59:46FromDiscord<ieltan> In reply to @PMunch "<@256520101015060480>, `object of X`": I see, so it's fine to use `object of` if i don't have any issue with recursion ?
10:00:01FromDiscord<ieltan> In reply to @demotomohiro "https://internet-of-tomohiro.netlify.app/nim/faq.en": Thanks for the docs 🙂
10:02:52PMunchSure
10:03:07PMunchOf course all the normal things around reference vs. object semantics still hold
10:03:44FromDiscord<System64 ~ Flandre Scarlet> In reply to @ambient3332 "OTFFT is 8x faster": Oh, can it do FFT and inverse FFT?
10:04:10FromDiscord<System64 ~ Flandre Scarlet> Oh yeah it can!
10:05:30FromDiscord<ambient3332> It has a full C API https://github.com/amb/nim_audiobook/blob/no-arraymancer/otfft-simple/otfft_c.nim
10:06:01FromDiscord<System64 ~ Flandre Scarlet> In reply to @ambient3332 "It has a full": https://github.com/amb/nim_audiobook/blob/main/fft.nim↔Oh this thing has the power of 2 thing oof
10:06:30FromDiscord<ambient3332> That's just my homebrew, nothing to do with OTFFT
10:06:47FromDiscord<System64 ~ Flandre Scarlet> Oh alright sorry
10:07:02FromDiscord<ambient3332> http://wwwa.pikara.ne.jp/okojisan/otfft-en/index.html
10:07:27FromDiscord<System64 ~ Flandre Scarlet> oh otfft uses pointer stuff
10:26:13FromDiscord<ambient3332> also (related) a pretty cool explanation of Fourier transform: https://www.youtube.com/watch?v=FjmwwDHT98c
10:47:57ntatDoes anyone have experience with using OpenCV in Nim?
11:27:19FromDiscord<jmgomez> In reply to @bung8954 "<@726017160115126333> does the `.pdb`": the third party must have the symbols. I use them so I can hotreload + debug on win
11:27:21FromDiscord<enthus1ast> aehm
11:27:22FromDiscord<enthus1ast> i access a let from multiple threads, the compiler complains that its not gcsafe, but it should be, can i somehow disable gcsafe for this one proc?
11:27:22FromDiscord<enthus1ast> not proc
11:27:23FromDiscord<enthus1ast> let var
11:27:24FromDiscord<enthus1ast> what i did before was to create a proc that just returns this, and in the proc i cast it gcsafe, but this is lame.
11:27:27FromDiscord<enthus1ast> sent a code paste, see https://play.nim-lang.org/#ix=4Ae7
11:59:37FromDiscord<System64 ~ Flandre Scarlet> In reply to @ambient3332 "also (related) a pretty": Oh pretty interesting!
12:44:27FromDiscord<heysokam> sent a code paste, see https://play.nim-lang.org/#ix=4AgB
13:00:52FromDiscord<odexine> `--warning[HoleEnumConv]:off`? idk
13:18:57FromDiscord<heysokam> In reply to @odexine "`--warning[HoleEnumConv]:off`? idk": `Error: invalid command line option: '--warning[HoleEnumConv]'`
13:19:45FromDiscord<odexine> use two :: instead of =
13:19:53FromDiscord<odexine> `--warning:HoleEnumConv:off` perhaps?
13:19:59FromDiscord<odexine> i'm just wondfering why it would say it doesnt exist
13:20:18FromDiscord<heysokam> that's what the docs say, but it breaks
13:22:32FromDiscord<odexine> it works for me?
13:27:10FromDiscord<heysokam> In reply to @odexine "it works for me?": stable or devel?
13:27:17FromDiscord<odexine> 1.6.14
13:28:07FromDiscord<heysokam> im on devel, don't know if that changes anything
13:28:40FromDiscord<heysokam> and cannot go back to 1.6.14 to test, since this project relies on the new `std/paths` 😩
13:57:09FromDiscord<bung8954> In reply to @jmgomez "the third party must": I've add linker flags that generated myProgram.pdb file after compiling, does that satisfy the requirements?
14:04:57*anddam quit (Quit: WeeChat 3.8)
14:20:56*anddam joined #nim
14:21:09FromDiscord<michaelb.eth> In reply to @enthus1ast "what i did before": depending on the rhs of a global `let foo = ...`, reading `foo` from another thread may mess up the ref counts of the GC in the original thread, and the program may crash later with SIGSEGV
14:28:06FromDiscord<odexine> In reply to @heysokam "and cannot go back": works on latest devel
14:30:45FromDiscord<jmgomez> In reply to @bung8954 "I've add linker flags": Im not sure what are you trying to do, if its to debug a third party lib/app, it isnt enough. For your own app, it should be enough yes. Everything "special" I do for NUE on Windows is in that file that I linked
14:34:12FromDiscord<bung8954> In reply to @jmgomez "Im not sure what": app is my own, linked dll is not, so I dont know why it throw nil acess error when call dll's function
14:35:11FromDiscord<jmgomez> yeah, then you need the debug symbols for the linked dll
14:38:30FromDiscord<bung8954> I see, seems like I should download from there https://learn.microsoft.com/en-us/windows-hardware/drivers/debugger/microsoft-public-symbols
14:53:02FromDiscord<ac1original> How can I run the entire code from another class?
15:02:06FromDiscord<demotomohiro> https://nim-lang.org/docs/manual.html#modules
15:26:57FromDiscord<treeform> In reply to @shad.ow "i'm using `spacy` currently,": You can just create an fake entry to check?
15:29:21FromDiscord<treeform> `findInRange(Entry(pos:...))`
15:29:42FromDiscord<treeform> I should provide overloads that just take a `Vec2`.
15:43:13*lucasta joined #nim
15:44:43*lucasta quit (Max SendQ exceeded)
17:47:59*jmdaemon joined #nim
18:15:23FromDiscord<turtlebasket> asked this in lang dev but no response\: is Nim keeping style insensitivity?
18:16:56FromDiscord<turtlebasket> oh wow look at that it's treeform
18:17:20FromDiscord<turtlebasket> @treeform\: thanks for making istrolid i played the shit out of that game in middle school ;)
18:20:13FromDiscord<shad.ow> In reply to @treeform "You can just create": yeah that's what i did
18:20:19FromDiscord<treeform> Thanks for playing!
18:20:20FromDiscord<shad.ow> and i made the id uint32.max
18:20:32FromDiscord<treeform> In reply to @turtlebasket "<@107140179025735680>\: thanks for making": Thanks for playing!
18:23:44FromDiscord<demotomohiro> @turtlebasket https://github.com/nim-lang/RFCs/issues/456↔https://github.com/nim-lang/RFCs/issues/472
18:29:16FromDiscord<nervecenter> In reply to @turtlebasket "asked this in lang": There is no indication that it is ever going away. And in case you need anything anecdotal, I have a product in production that's small to mediumish with 20k lines of Nim, I do Pythonic snake_case and 4-space indentation (including calling library functions with snake_case), and none of it has ever been a problem.
18:29:39FromDiscord<nervecenter> (edit) "In reply to @turtlebasket "asked this in lang": There is no indication that it is ever going away. And in case you need anything anecdotal, I have a product in production that's small to mediumish with 20k lines of Nim, I do Pythonic snake_case and 4-space indentation (including calling ... library" added "standard"
18:30:55FromDiscord<nervecenter> In reply to @turtlebasket "asked this in lang": There is no indication that it is ever going away. And in case you need anything anecdotal, I have a product in production that's small to mediumish with 20k lines of Nim, I do Pythonic snake_case and 4-space indentation (including calling standard library functions with snake_case), and none of it has ever been a problem.
18:35:53FromDiscord<turtlebasket> the one complaint I've seen that I consider valid is probably the one about CFFI
18:36:07FromDiscord<turtlebasket> I think a pragma or compiler flag could probably fix that though
18:46:38FromDiscord<bostonboston> sent a code paste, see https://play.nim-lang.org/#ix=4Aia
18:48:44FromDiscord<demotomohiro> You can import C variables/functions with `importc` pragma and assign different names so that you import C identifiers like getFoo and get_foo.↔But using different names from C lib might confuse you if you learn about it from the manual or C example code .
18:50:42FromDiscord<nervecenter> I typically wrap my `importc` signatures with a Nim proc that looks and feels like Nim, and internally does all the conversion work necessary. I think I might be paying a price for using an extra stack frame and doing some extra copying, but it makes my FFI calls blend in natively.
18:51:33FromDiscord<nervecenter> Then I can choose exactly what case I want to use and even pick my own name to use in the rest of my code
18:59:33Amun-Ra /fset
18:59:37Amun-Rasorry
19:17:55NimEventerNew post on r/nim by DiscoVoadordeVenus: Why the Nim libraries use GC?, see https://reddit.com/r/nim/comments/14w3co4/why_the_nim_libraries_use_gc/
19:31:40*ntat_ joined #nim
19:31:57*ntat quit (Ping timeout: 250 seconds)
19:32:37*ntat_ is now known as ntat
20:27:49FromDiscord<turtlebasket> is it possible to make an infix operator with a non-2 arity
20:28:26FromDiscord<turtlebasket> ...like `1 `op` 2 3` or something↔or does that require a macro
20:30:25FromDiscord<turtlebasket> ...like `1 `op` 2 3` or something↔or does that require a macro
20:32:39*PMunch quit (Quit: leaving)
20:32:53FromDiscord<Elegantbeef> you'd need to do `1 op (2, 3)` or similar
20:32:58FromDiscord<Elegantbeef> infix operators are binary in Nim
20:34:07FromDiscord<Elegantbeef> `a @! b, c` does not compile you can check with `std/macros.dumptree`
20:41:36FromDiscord<turtlebasket> ah so it works but with the second argument as a collection
20:41:45FromDiscord<Elegantbeef> Right, a tuple is the most sensible way around
20:42:15FromDiscord<turtlebasket> since infix ops are technically functions does this mean that `abc(x, y, z)` is equivalent to `abc((x, y, z))`
20:42:39FromDiscord<Elegantbeef> No a tuple is not the same as x, y, z
20:43:10FromDiscord<Elegantbeef> the first would be `proc abc(x, y, z: T)` the latter `proc abc(tup: YourTupleHere)`
20:43:34FromDiscord<turtlebasket> i see
20:43:34FromDiscord<turtlebasket> so that only applies to infix then
20:43:39FromDiscord<Elegantbeef> What?
20:43:45FromDiscord<Elegantbeef> Tuples are not invocations
20:44:00FromDiscord<Elegantbeef> `echo (1, 2, 3)` and `echo(1, 2, 3)` are two different things
20:44:07FromDiscord<Elegantbeef> One prints a tuple, the other prints the integers alone
20:44:33FromDiscord<yandall> sent a code paste, see https://play.nim-lang.org/#ix=4AiE
20:45:20FromDiscord<yandall> (edit) "https://play.nim-lang.org/#ix=4AiE" => "https://play.nim-lang.org/#ix=4AiF"
20:45:48FromDiscord<Elegantbeef> do you need a header for `Accept:"application/json"`?
20:46:55FromDiscord<yandall> I don't think so
20:47:08FromDiscord<Elegantbeef> Well curl also gets a binary blob
20:48:17FromDiscord<yandall> weird. If I try with postman it gets a json
20:48:47FromDiscord<Elegantbeef> Perhaps it's a user agent related?
20:49:37FromDiscord<yandall> What is the use agent for httpclient module?
20:49:55FromDiscord<Elegantbeef> https://nim-lang.org/docs/httpclient.html#defUserAgent
20:50:49FromDiscord<yandall> It works on postman with this user agent
20:51:02*cyraxjoe quit (Ping timeout: 246 seconds)
20:51:35*cyraxjoe joined #nim
20:52:58FromDiscord<Elegantbeef> Cause I only get binary data with curl even with user agent and accepting json
20:53:48*LyndsySimon joined #nim
20:54:12FromDiscord<yandall> I have never seen this behavior before
20:55:59FromDiscord<Elegantbeef> Wait the response header says it's gzipped
20:57:32FromDiscord<Elegantbeef> Yep
20:57:34FromDiscord<spotlightkid> With `http -j` I get a JSON response. Are you quoting the URL correctly when using curl?
20:57:47FromDiscord<spotlightkid> `http` = HTTPie
20:58:03FromDiscord<Elegantbeef> I get a gzipped response that if i run `gzip -d` on it gets the right information
20:58:14FromDiscord<spotlightkid> yeah
20:58:26FromDiscord<yandall> Ok, that makes sense
20:58:58FromDiscord<yandall> How do I unziped on nim?
20:59:00FromDiscord<Elegantbeef> Well I guess you check the response header if it's gzipped you use zippy on it
20:59:42FromDiscord<Elegantbeef> Zippy is the easiest way as it's pure Nim, there are bindings for C libraries you can use aswell
21:00:50FromDiscord<yandall> I'll try that
21:01:43FromDiscord<yandall> The only thing that still confuses me is that this other store uses the same api but doesn't have that problem "https://www.exito.com/Lentejas?_q=Lentejas&map=ft&pickRuntime=queryData"
21:01:45Amun-Raand you can set Accept-Encoding: identity not to get gzipped content
21:03:33FromDiscord<Elegantbeef> I don't think this particular server cares
21:06:32FromDiscord<yandall> I just try zippy. I got my json, thanks @elegantbeef
21:06:57FromDiscord<Elegantbeef> no problem
21:07:19FromDiscord<Elegantbeef> Given my lack of web experience I'm amazed I reasoned this one
21:12:43FromDiscord<JJ> beef remind me why do you hate rust enums
21:12:49FromDiscord<JJ> or rather that they're called enums
21:13:31FromDiscord<Elegantbeef> They're not ordinals
21:13:45FromDiscord<JJ> ah got it
21:13:49FromDiscord<Elegantbeef> There is no order to them
21:14:11FromDiscord<Elegantbeef> Having it be `None -> Circle -> Square` is the same as `Square -> None -> Circle`
21:14:26FromDiscord<Elegantbeef> An enumeration by definition is ordered 😄
21:14:58*azimut quit (Ping timeout: 240 seconds)
21:15:00FromDiscord<Elegantbeef> I can see with like Odin style Unions where order matters, calling the branches enums
21:15:13FromDiscord<Elegantbeef> cause they're an ordered set of valid types
21:16:01FromDiscord<Elegantbeef> Ie `union{f32, u32}` can convert to `union{f32, u32, string}` but cannot convert to `union{u32, f32}`
21:16:01FromDiscord<Elegantbeef> Atleast from my understanding they can convert that way
21:16:29FromDiscord<Elegantbeef> But with Rust enums the tag is hidden and they're order independant
21:16:39FromDiscord<JJ> oh that's interesting
21:16:48FromDiscord<JJ> i gotta read up on odin sounds like
21:16:57FromDiscord<Elegantbeef> Odin's unions are so close to being good
21:17:25FromDiscord<Elegantbeef> Been looking into it a bit recently and seen(really forced myself into) a conversation about the conversions
21:17:46FromDiscord<Elegantbeef> Sadly gingerbill does not want to enable conversions from a union to a superset or order invariant
21:17:54FromDiscord<JJ> oh they have a union/enum distinction? hmm
21:17:59FromDiscord<Elegantbeef> So that means any union conversion is manual, cause fuck you
21:18:04FromDiscord<JJ> i actually like that a lot i think
21:18:06FromDiscord<Elegantbeef> Unions are tagged unions, enums are enums
21:18:26FromDiscord<JJ> In reply to @Elegantbeef "So that means any": that's a shame structural typing is so nice
21:18:46FromDiscord<Elegantbeef> The nice thing is that unions are first classed and work for whenever you just want to a easy tagged union a lot like leorize's union
21:18:48FromDiscord<JJ> you can model multiple inheritance super well with structural typing of structs
21:19:09FromDiscord<Elegantbeef> Well we're talking about a type conversion from like `union{f32, u32}` to `union{u32, f32}`
21:19:20FromDiscord<Elegantbeef> There is just no language feature for that cause "what if the tag is invalid"
21:19:36FromDiscord<JJ> ah
21:19:49FromDiscord<Elegantbeef> Quite a dumb argument imo for disallowing it, but meh odin is very odd
21:20:09FromDiscord<Elegantbeef> Odin already has bound checks and allows you to assert a union is a specific branch
21:20:51FromDiscord<Elegantbeef> But yea Odin has some interesting design for some builtins
21:21:02FromDiscord<Elegantbeef> Like it has SOA and AOS syntax built into the language, same with swizzling
21:21:20FromDiscord<Elegantbeef> It's aimed towards gamedev/graphics programming so it's interesting in that regard
21:23:01FromDiscord<Elegantbeef> Sadly though it's all about no hidden flow control and manual memory control, so it's not very interesting to me
21:23:36FromDiscord<Elegantbeef> https://odin-lang.org/docs/overview/#soa-data-types if interested about the SOA stuff
21:24:22FromDiscord<Elegantbeef> https://odin-lang.org/docs/overview/#using-statement is also pretty interesting
21:24:51FromDiscord<Elegantbeef> Instead of making the programmer write properties you can just say on the struct "Hey this has a position, but i'd like to have .x, .y, .z work on it"
21:29:38FromDiscord<etra> lol, just checking the site, this statement is uh, something↔`In general, self hosting before a stable language and compiler exists is masturbatory pleasure.`
21:29:55FromDiscord<Elegantbeef> Yea I disagree with gingerbill there
21:30:06*ntat quit (Quit: Leaving)
21:30:37FromDiscord<Elegantbeef> The main benefit of self hosting is that you have a way for your community to contribute to the language without having to learn a new language
23:52:56*ovenpasta quit (Ping timeout: 245 seconds)