<< 23-01-2023 >>

00:02:52*rockcavera joined #nim
00:03:52FromDiscord<sa-code> maybe I should just interop with go instead of cpp
00:14:26FromDiscord<4zv4l> sent a code paste, see https://play.nim-lang.org/#ix=4lYc
00:14:33FromDiscord<4zv4l> and when I'm on the server trying a slash command well↵it doesn't work
00:16:04FromDiscord<that_dude> In reply to @sa-code "I'm looking at the": https://scripter.co/binding-nim-to-c-plus-plus-std-list/ This article/blog may be of use to you
00:16:29FromDiscord<sa-code> thanks I'll have a look!
00:34:39*azimut joined #nim
01:04:24FromDiscord<Hourglass [She/Her]> In reply to @sa-code "maybe I should just": Good luck- I have a very terrible example of it actually
01:04:38FromDiscord<Hourglass [She/Her]> https://github.com/Mythical-Forest-Collective/GoNim
01:04:46FromDiscord<Hourglass [She/Her]> Is that not the repo?
01:05:15FromDiscord<Hourglass [She/Her]> Yep it is
01:05:31FromDiscord<Hourglass [She/Her]> But either way, it'll probably be a pain for bigger libraries aha
01:47:01FromDiscord<Gumbercules> Garbage collection might be an issue
01:47:16FromDiscord<Gumbercules> Depending on what you're attempting to do...
02:09:17FromDiscord<ajusa> getting a little philosophical here, but how do folks feel about exceptions vs options vs results? Eg, you have some function that has an edge case that it cannot handle, and that the caller should handle. Should that function return an Option with the return type wrapped, throw an exception and expect the parent to catch it, or return a Result (https://github.com/arnetheduck/nim-result) with a string error message?
02:12:09FromDiscord<Elegantbeef> It's down to your preference really. Results/Options allocate less and are conventionally faster, but enforce handling of errors. Exceptions do not enforce handling errors, and in my view have better semantics.
02:13:32FromDiscord<ajusa> I thought with arc/orc/goto exceptions that those were actually faster?
02:14:16FromDiscord<ajusa> I did rewrite some code to use Option[T] instead of exceptions and found that it became more difficult to reason about, though there is a function that propagates an exception which isn't explicit
02:16:20FromDiscord<Rika> I personally think options aren’t for error handling
02:16:31FromDiscord<Elegantbeef> Exceptions are generally slower due to how they work. They heap allocate and also require unwinding of the stack
02:16:31FromDiscord<Elegantbeef> I personally prefer using exceptions due to not forcing handling of errors and having better semantics
02:17:38FromDiscord<Elegantbeef> I agree with options
02:17:38FromDiscord<Elegantbeef> They're not error handling, they're whether a value is some or not 😄
02:17:53FromDiscord<Rika> Bridge is slow today huh
02:18:03FromDiscord<Rika> Some significant delay there
02:20:51FromDiscord<demotomohiro> If exceptions allocate heap, how they work when out of memory?
02:22:25arkanoidit's funny how my head keeps fighting about using or not let/var blocks
02:22:36FromDiscord<Elegantbeef> oom causes a panci
02:23:27FromDiscord<demotomohiro> So exceptions are not used for oom?
02:24:26arkanoidoom is an OS thing, not application level thing, iirc
02:24:33arkanoid*if iirc
02:24:49FromDiscord<Elegantbeef> It's a program specific thing
02:26:03FromDiscord<Elegantbeef> `malloc` can return `nil` iirc which means "no memory left to allocate to"
02:27:31arkanoidnot sure if that counts as oom. If that is so, how is called when memory pressure is too high and kernel goes killer-frenzy an shoots at processes. Dmesg shows OOM in that context
02:27:35arkanoidalso android
02:28:45FromDiscord<pyolyokh> get rid of the this term 'oom' that you're using, and refer separately to the operation of the linux oomkiller and to allocators running out of memory.
02:29:34FromDiscord<pyolyokh> or talk about 'low memory conditions', because on I/O-overutilized servers, as you run dry on filesystem cache things are catching fire and dying well before you run out of memory
02:32:45FromDiscord<jtv> Wow, converters have an infinite recursion bug. And I was just so excited to learn that I could convert values to Options automatically, only to find it will fail in some external libraries, like Json 🙂
02:33:03FromDiscord<sOkam!> sent a code paste, see https://play.nim-lang.org/#ix=4lYt
02:33:30FromDiscord<pyolyokh> `new(int)`
02:33:47FromDiscord<sOkam!> and the value? how do you assign it?
02:34:00FromDiscord<pyolyokh> `let v = new(int); v[] = 1`
02:34:08FromDiscord<sOkam!> kk ty
02:34:30FromDiscord<pyolyokh> you have another example right there, `new[int](1)`
02:37:04FromDiscord<sOkam!> but that is not working
02:37:17FromDiscord<sOkam!> hence I asked, because it wasn't compiling
02:38:14FromDiscord<sOkam!> sent a code paste, see https://play.nim-lang.org/#ix=4lYu
02:39:11FromDiscord<Elegantbeef> `new[int](2)` isnt a thing
02:39:15FromDiscord<Elegantbeef> you can make it if you want
02:39:24FromDiscord<pyolyokh> sent a code paste, see https://play.nim-lang.org/#ix=4lYv
02:39:59FromDiscord<Elegantbeef> Much easier 😄
02:40:00FromDiscord<Elegantbeef> sent a code paste, see https://play.nim-lang.org/#ix=4lYw
02:40:56FromDiscord<sOkam!> is there not a simpler way of doing things?
02:41:24FromDiscord<sOkam!> all i wanted is to store the same value in different objects, and be able to modify one to modify the others
02:41:25FromDiscord<pyolyokh> yeah, don't use refs
02:42:09FromDiscord<Elegantbeef> A ref is simple
02:42:36FromDiscord<Rika> What’s the issue with references
02:43:09FromDiscord<pyolyokh> the issue is that it's not that simple, apparently
02:43:52FromDiscord<jtv> Syntactically it's confusing to people because of the overloading of the square brackets I think.
02:43:55FromDiscord<sOkam!> by simpler i meant standard in the lang, without having to hack new functionality that doesn't exist for a basic type
02:44:16FromDiscord<Elegantbeef> is it really a hack
02:44:30FromDiscord<Elegantbeef> To be fair you can use pyo's method
02:44:36FromDiscord<pyolyokh> the two-line function isn't a hacked, or even needed. `new(int)` works well enough. And it even makes more sense than the 'hack' in your case of wanting to create multiple refs and assign them all to the same value
02:44:36FromDiscord<Elegantbeef> and just do `new 1`
02:44:42FromDiscord<sOkam!> well, if its not already there, i assume there is another standard way
02:45:05FromDiscord<Rika> Yes, the two liner is the standard way
02:45:16FromDiscord<sOkam!> kk
02:46:06FromDiscord<pyolyokh> rather, create one ref that's then copied to all these different places
02:47:46FromDiscord<tfp> is there a way to pass a preamble you'd like appended to all of your source files
02:48:05FromDiscord<tfp> like i want one file to be imported by default
02:48:13FromDiscord<Elegantbeef> `--import:...`
02:48:19FromDiscord<Elegantbeef> or `--include`
02:48:50FromDiscord<tfp> epic
02:48:51FromDiscord<tfp> thanks
02:49:01FromDiscord<tfp> will that work with nimsuggest
02:50:46FromDiscord<jtv> Can have everything refer to one ref object instance
02:54:19FromDiscord<pyolyokh> In reply to @jos "will that work with": if you put the flag in an appropriate nim.cfg, maybe
02:55:00FromDiscord<Elegantbeef> or config.nims
02:55:55FromDiscord<tfp> is nim a single pass compiler?
02:56:04FromDiscord<Elegantbeef> Yes
02:56:26FromDiscord<tfp> :gurasip:
02:56:31FromDiscord<tfp> really makes u think
02:57:40FromDiscord<Elegantbeef> Does it?
02:57:54FromDiscord<Rika> ?
03:19:03*rockcavera quit (Remote host closed the connection)
03:20:41*byanka joined #nim
03:25:22FromDiscord<tfp> https://media.discordapp.net/attachments/371759389889003532/1066921557194186834/Screenshot_2023-01-22_at_10.24.16_PM.png
03:25:27FromDiscord<tfp> is there a way to make this error show up here
03:25:47FromDiscord<tfp> i guess i can make my own diagnostics in the macro itself
03:25:51FromDiscord<Elegantbeef> Not using quote do
03:25:57FromDiscord<Elegantbeef> or `line` pragma
03:26:29FromDiscord<tfp> mmm
03:26:33FromDiscord<tfp> so i can like push line pragma
03:26:54FromDiscord<Elegantbeef> Actually line only works on exceptions
03:27:36FromDiscord<tfp> hmm
03:27:56FromDiscord<tfp> is there any other way to proxy it that u can think of or will i have to make my own diagnostic
03:28:30FromDiscord<tfp> maybe i can just make a macro that expands to project root? like import $root/whatever
03:28:49FromDiscord<tfp> import absify(/whatever)
03:29:46FromDiscord<tfp> nvm the macro doesn't expand there
03:51:54FromDiscord<pyolyokh> sent a code paste, see https://play.nim-lang.org/#ix=4lYC
03:59:05FromDiscord<tfp> u can just add the project to its own path?
03:59:28FromDiscord<tfp> i dont actually understand the example that well-- can u import user from foo/bar/example?
03:59:33FromDiscord<pyolyokh> nim has a list of search paths. You can add anything to them that works for you
03:59:37FromDiscord<tfp> or do u have to do ../../user
03:59:49FromDiscord<pyolyokh> you can 'import user' if b is in your search paths
03:59:55FromDiscord<tfp> why does nobody bring this up in like the 10 different discussions online about importing from absolute paths
04:00:10FromDiscord<tfp> is there some massive downside like duplicate symbols or something
04:00:15FromDiscord<pyolyokh> no.
04:00:29FromDiscord<tfp> that's weird man
04:00:37FromDiscord<tfp> why would nobody bring that up in those discussions
04:00:42FromDiscord<tfp> really makes u think
04:00:52FromDiscord<tfp> thanks
04:03:50FromDiscord<Tuatarian> when writing a custom destructor
04:03:50FromDiscord<pyolyokh> sent a long message, see http://ix.io/4lYF
04:04:11FromDiscord<Tuatarian> is there a way to destroy only certain fields?
04:04:16FromDiscord<Tuatarian> at the moment I have this
04:04:27FromDiscord<Tuatarian> sent a code paste, see https://play.nim-lang.org/#ix=4lYH
04:04:39FromDiscord<Tuatarian> but I only want to destroy certain fields atm
04:04:50FromDiscord<Elegantbeef> `for name, field in n[].fieldPairs`
04:05:00FromDiscord<Elegantbeef> and `when name == "bleh"`
04:05:14FromDiscord<Elegantbeef> Though `fields` doesnt work with object variants
04:19:14*arkurious quit (Ping timeout: 246 seconds)
04:28:02*rockcavera joined #nim
05:36:56*byanka quit (Ping timeout: 252 seconds)
05:41:54*byanka_ joined #nim
05:45:20FromDiscord<avarez> Thank me later 👉↵https://t.me/+OuATQxCrsLkwY2Y0
05:52:25FromDiscord<sOkam!> <@&371760044473319454> ^ spam
06:08:31*xet7 quit (Quit: Leaving)
06:29:09*xet7 joined #nim
06:45:18FromDiscord<lithiumfrost> Can anyone tell me how to get to the field of an underlying object given a ptr to a ptr array of obj?
06:45:43FromDiscord<lithiumfrost> (C API)
06:45:44FromDiscord<Elegantbeef> `myArray[index].field`
06:46:07FromDiscord<Elegantbeef> or `myPtr[][index].field`
06:46:10FromDiscord<Elegantbeef> Depends on your Nim type def
06:47:00FromDiscord<lithiumfrost> var data : ptr ptr PCREDENTIALW
06:47:06FromDiscord<lithiumfrost> So that second would be it
06:48:10FromDiscord<Elegantbeef> `let b = a.addr` i guess makes it more like what you have
06:48:14FromDiscord<Elegantbeef> sent a code paste, see https://play.nim-lang.org/#ix=4lZ1
06:48:56FromDiscord<Elegantbeef> You will need to cast it to a `ptr UncheckedArray[PCredentialW]` i assume
06:49:16FromDiscord<Elegantbeef> Guessing that name means winim so dont know if they have `[]` for ptrs there
06:49:17FromDiscord<lithiumfrost> Ok, that's the piece that I was missing
06:49:27FromDiscord<lithiumfrost> And it is winim
06:49:36FromDiscord<Elegantbeef> Yea Nim unlike C differentiates arrays from single elements
06:49:52FromDiscord<lithiumfrost> If they don't, how do I deference the ptr?
06:50:03FromDiscord<Elegantbeef> Cast it like i showed
06:50:11FromDiscord<lithiumfrost> Ah, ok, thanks
06:50:43FromDiscord<lithiumfrost> A little shaky on the C interop stuff yet
06:56:56*rockcavera quit (Remote host closed the connection)
07:35:38FromDiscord<Hourglass [She/Her]> In reply to @Gumbercules "Garbage collection might be": Yep, it sucks
07:37:36FromDiscord<Hourglass [She/Her]> But either way, if you're gonna use Go, might as well go the full way
07:37:46FromDiscord<Hourglass [She/Her]> It'll already add a lot of bloat
07:39:41*PMunch joined #nim
07:53:53*azimut quit (Ping timeout: 255 seconds)
08:31:23FromDiscord<abisxir> In reply to @abisxir "Guys I have a": Any easy solution for this dudes?
08:32:09FromDiscord<Elegantbeef> As leo said you have to use manual `x of Y` checks
08:32:39FromDiscord<Elegantbeef> Typedescs do not exist at runtime, so you either make manual `of` branches or use the typeinfo module to extract what you need
08:36:29FromDiscord<abisxir> Humm, thanks @ElegantBeef but I do not need typedesc actually, I need the type name and I do not need performance here, but has to be general for the future extended types.
08:37:39FromDiscord<Phil> And methods were out because you don't want your users to have to define them?
08:38:22FromDiscord<Elegantbeef> I actually dont think Nim's RTTI let's fetching of the type name without 'hacks'
08:38:56FromDiscord<Elegantbeef> https://github.com/nim-lang/Nim/blob/version-1-6/lib/core/typeinfo.nim#L87↵https://github.com/nim-lang/Nim/blob/version-1-6/lib/system/hti.nim#L89-L107
08:39:03FromDiscord<Phil> Honestly I think those were your best bets.↵After that all that's left is having a field on your object that contains the typename and then you need constructors that set that typename correctly all the time
08:39:07FromDiscord<Elegantbeef> Use these together and you can get the name 😄
08:39:19FromDiscord<Phil> Which is more effort than just defining a method
08:39:28FromDiscord<Phil> Oh? hti?
08:40:34FromDiscord<Phil> Okay whatever solution that would offer looks darker than the night
08:40:51FromDiscord<Phil> I'd rather suggest going with the method and documenting that your users need to define those
08:41:08FromDiscord<Elegantbeef> Bleh it's not that bad
08:41:58FromDiscord<Phil> OR not bothering with inheritance in the first place, though then you can't do a seq of those models
08:44:24FromDiscord<abisxir> Hummm, so strange that it return B of A true but does know know the name 😁 fortunately I need it for a helper function to debugging, for now I just remove the function 🙂
08:46:26FromDiscord<Elegantbeef> Lol so i was wrong anyway
08:46:57FromDiscord<Elegantbeef> `name` inside HTI still points to the current converted type's name
08:53:05FromDiscord<Phil> In reply to @abisxir "Hummm, so strange that": Note that "X of Y" will be true for all parts of the ancestral chain, so it'll be true for all parent classes AND your child class
08:55:29FromDiscord<Elegantbeef> Yea I dont think there is a runtime way of saying "Only this type, no parent or subtypes"
08:56:39FromDiscord<Phil> Hmm I mean it should be possible to build with x of y... well it would be if you could grasp all parents and sibling classes floating around in the context
08:57:17FromDiscord<Elegantbeef> You cannot do that of course
08:57:53FromDiscord<Phil> Then you can still do that in a specific case where you know the possible types at compiletime.... though I guess in that scenario you can also choose a different approach
08:58:09FromDiscord<Elegantbeef> Yea an object variant would be better there
08:59:35FromDiscord<Elegantbeef> Hmph i have to be wrong about not being able to get the base name
09:00:14FromDiscord<Elegantbeef> @ringabout any hacky way you know to get the name of a object converted to a parent type?
09:00:33FromDiscord<Elegantbeef> Figure given your work on the 2.0 dispatch you might know better than I 😄
09:49:17FromDiscord<ringabout> I don't think there is an easy way. It needs to compile with `nimTypeNames`. Either use `importutils + privateAccess` to access name field or emit C code.
09:50:51FromDiscord<ringabout> Like https://github.com/status-im/nim-stew/blob/447b23d3bf6eb7be6531385e4db9124772c98068/stew/objects.nim#L70
09:50:53*kenran joined #nim
09:52:54FromDiscord<Elegantbeef> Yea but that `name` field still fetches the name of the base not the child
10:00:35FromDiscord<ringabout> sent a code paste, see https://play.nim-lang.org/#ix=4lZA
10:00:58FromDiscord<ringabout> prints "nim.test2.B:ObjectType"
10:05:07FromDiscord<Elegantbeef> @abisxir\: well there's a 'way'
10:35:32*om3ga quit (Read error: Connection reset by peer)
10:36:46*om3ga joined #nim
11:04:48*PMunch quit (Quit: Leaving)
11:40:40FromDiscord<justinn> sent a code paste, see https://play.nim-lang.org/#ix=4lZS
11:41:43FromDiscord<Rika> `p` is immutable; `addr` requires a mutable datatype
11:43:39FromDiscord<justinn> ahhh that does make a lot of sense, thanks!
11:50:26FromDiscord<Phil> nimble c is a thing?↵Huh
11:52:05FromDiscord<htac> salutations, can I have a template create a proc named by a string, or will I have to resort to a macro?
11:56:18FromDiscord<Hourglass [She/Her]> Even with a macro it's not that hard iirc
11:56:24FromDiscord<htac> sent a code paste, see https://play.nim-lang.org/#ix=4lZU
11:56:35FromDiscord<Hourglass [She/Her]> Yeah that'd be the macro code I think
11:57:24FromDiscord<Phil> sent a code paste, see https://play.nim-lang.org/#ix=4lZV
11:57:34FromDiscord<htac> thank you, Hourglass
12:01:13FromDiscord<htac> sent a code paste, see https://play.nim-lang.org/#ix=4lZX
12:02:33FromDiscord<enthus1ast> sent a code paste, see https://paste.rs/1A9
12:02:35FromDiscord<htac> how about this case? Obviously, this code does not work. But can I make it by a rather simple adujstment with quote, without falling back to working rather close to the AST?
12:03:28FromDiscord<htac> sent a code paste, see https://play.nim-lang.org/#ix=4lZZ
12:04:10FromDiscord<htac> (edit) "https://play.nim-lang.org/#ix=4lZZ" => "https://play.nim-lang.org/#ix=4m00"
12:05:55FromDiscord<Phil> In reply to @enthus1ast "<@180601887916163073>\: i think you": I'm wading my way through old jester code from somebody else that works under 1.6.10, just not 1.9.1 because I think the checks have gotten stricter
12:06:46FromDiscord<Phil> So it should work without the locks as well given that it worked before
12:09:20FromDiscord<Phil> God damn there is way too much global state in this code
12:09:29FromDiscord<Phil> Could've at least hidden it away in a separate module
12:15:44FromDiscord<enthus1ast> i think the lock is just for access control, the gcsafe make it compile
12:18:35FromDiscord<Phil> For now I'll focus on making it compile
12:18:57FromDiscord<Phil> It's a separate second step to refactor and in general reduce global state and introduce locks because by god
12:19:10FromDiscord<Rika> block {.gcsafe.} pragma iirc is equivalent to gcsafe cast
12:19:14FromDiscord<Phil> This thing has like 6 global state objects which all should be looked behind modules
12:19:47FromDiscord<Phil> sent a code paste, see https://play.nim-lang.org/#ix=4m02
12:20:28FromDiscord<Rika> no i mean the `{.gcsafe.}: ` is equivalentr to `{.cast(gcsafe).}:` its just an older version
12:20:30FromDiscord<Rika> iirc
12:21:00FromDiscord<Rika> i say block because proc use is different `proc ...(...) {.gcsafe.} =`
12:21:24FromDiscord<Phil> I'll try it out later, I recall having issues with just gcsafe in the past
12:21:32FromDiscord<Phil> first I'll get it to compile with what i know
12:21:44FromDiscord<Phil> (edit) "first I'll get it to compile with what i know ... " added "to work"
12:23:10*PMunch joined #nim
13:04:08*arkurious joined #nim
13:20:06*kenran quit (Remote host closed the connection)
13:41:13*azimut joined #nim
13:42:14*argonica joined #nim
13:51:25FromDiscord<Phil> sent a code paste, see https://play.nim-lang.org/#ix=4m0e
13:51:30FromDiscord<Phil> (edit) "https://play.nim-lang.org/#ix=4m0e" => "https://paste.rs/tuq"
13:53:10*argonica quit (Remote host closed the connection)
13:54:49*argonica joined #nim
14:09:22FromDiscord<Yasuke> when importing a text file and compiling it, it seems the executable still needs to be in the same location as the text file. Is there anyway to compile the project to include the text file so I can use the executable anywhere
14:10:04FromDiscord<Phil> In reply to @Yasuke "when importing a text": Static read is reading in a file at compile time
14:10:12*lumo_e joined #nim
14:10:28FromDiscord<Phil> That effectively causes it to be pulled into the binary into a variable
14:10:38FromDiscord<Yasuke> oooh how do I do this?
14:10:48FromDiscord<Yasuke> oh is ee
14:10:54FromDiscord<Yasuke> (edit) "is ee" => "i see thank you"
14:10:57FromDiscord<Phil> Check out staticRead for that, should be searchable in the docs
14:11:10*rockcavera joined #nim
14:11:16FromDiscord<Yasuke> just found!
14:11:29FromDiscord<Phil> It has the name I just gave as well as a weird alias, slurp I think
14:16:21FromDiscord<Yasuke> ok thank you
14:21:26FromDiscord<auxym> @Yasuke `const fileContents = staticRead("someFile.txt")`
14:31:45FromDiscord<Yasuke> thank you!
15:09:21*PMunch quit (Quit: Leaving)
15:13:09FromDiscord<pyryrin> how do i access the c files generated by nim?
15:18:50FromDiscord<auxym> In reply to @pyryrin "how do i access": They will be in nimcache: https://nim-lang.org/docs/nimc.html#compiler-usage-generated-c-code-directory
15:19:32FromDiscord<auxym> you can compile with eg. `--nimcache:nimcache` to create the files in the `./nimcache` dir inside your project, or something like that
15:24:00FromDiscord<Ntsékees> https://media.discordapp.net/attachments/371759389889003532/1067102408469127179/image.png
15:24:49FromDiscord<Ntsékees> https://media.discordapp.net/attachments/371759389889003532/1067102614187151400/image.png
15:25:43FromDiscord<Ntsékees> https://media.discordapp.net/attachments/371759389889003532/1067102840620863568/image.png
15:26:12FromDiscord<pyryrin> where is nimbase.h located
15:26:16FromDiscord<Ntsékees> In spite of what this answer says, `m.get.captureBounds` doesn't work for me
15:26:20FromDiscord<Ntsékees> (edit) "me" => "me."
15:26:58FromDiscord<Ntsékees> (edit) "In spite of what this ... answer" added "StackOverflow"
15:27:54FromDiscord<Rika> In reply to @Ntsékees "In spite of what": Remove the get
15:28:25FromDiscord<Rika> Or actually the API for replace is completely different from the one on find I assume?
15:33:05FromDiscord<Ntsékees> removing `get` seems to improve things (but now I'm getting another error)
15:33:37FromDiscord<Ntsékees> (namely, ⟪Error: unhandled exception: index 2 not in 0 .. 1 [IndexError]⟫)
15:34:14FromDiscord<Ntsékees> Oj
15:34:19FromDiscord<Ntsékees> (edit) "Oj" => "Oh"
15:34:33FromDiscord<Ntsékees> (edit) "Oh" => "Oh, it was just a silly mistake of mine."
15:34:43FromDiscord<Ntsékees> Yes, removing `get` solves the problem.
15:34:46FromDiscord<Ntsékees> Thanks!
15:43:08*argonica quit (Remote host closed the connection)
15:43:28*argonica joined #nim
15:54:58*argonica quit (Remote host closed the connection)
15:55:14*argonica joined #nim
16:21:17*argonica quit (Quit: Leaving)
16:42:12*rockcavera quit (Remote host closed the connection)
16:51:31FromDiscord<auxym> In reply to @pyryrin "where is nimbase.h located": in the dir returned by this proc: https://github.com/EmbeddedNim/picostdlib/blob/master/src/piconim.nim#L102
17:01:49*argonica joined #nim
17:22:45FromDiscord<Tuatarian> In reply to @Ntsékees "": what vscode theme is this?
17:22:46FromDiscord<Tuatarian> looks nice
17:23:22FromDiscord<Tuatarian> In reply to @Elegantbeef "Though `fields` doesnt work": is there a way to do this kind of thing with obj variants?
17:23:38FromDiscord<Tuatarian> well I guess I can literally just destroy all the fields
17:23:56FromDiscord<Tuatarian> or wait, no i can't right?
17:23:59FromDiscord<Elegantbeef> Use disruptek's assume
17:24:05FromDiscord<Elegantbeef> It has `typeIt` which lets you iterate fields of all objects
17:24:19FromDiscord<Tuatarian> I'd like to avoid external libs
17:24:33FromDiscord<Elegantbeef> Well then manually recreate the case statement
17:25:25FromDiscord<Tuatarian> sent a code paste, see https://play.nim-lang.org/#ix=4m1m
17:25:26FromDiscord<Elegantbeef> Yes
17:25:35FromDiscord<Tuatarian> ok thanks
17:27:08FromDiscord<Tuatarian> and obviously, I should call `=destroy` on the discriminant itself afterwards
17:28:12FromDiscord<Elegantbeef> Is there a reason you're making a destructor?
17:38:56*rockcavera joined #nim
18:00:03FromDiscord<Phil> Anyone here that has developed on the nimforum a little bit?
18:04:02FromDiscord<enthus1ast> Elegantbeef\: in nimscripter, must i copy all the modules to the stblib folder? Or can i use the current installed nimble modules?
18:04:45FromDiscord<Elegantbeef> https://github.com/beef331/nimscripter/blob/master/tests/tgeneral.nim#L150
18:14:52FromDiscord<enthus1ast> then must i exportTo the procs? Or can i import in the script?
18:15:31FromDiscord<Elegantbeef> Search paths are used for the VM's importing
18:15:49FromDiscord<Elegantbeef> It's the nimscripter equivalent to `--nimblePath`
18:16:15FromDiscord<Elegantbeef> Adding nimble should make it so you can `import myNimblePackage`
18:18:47FromDiscord<Elegantbeef> Or not it seems 😄
18:19:45FromDiscord<Elegantbeef> Does work
18:19:47FromDiscord<Elegantbeef> sent a code paste, see https://play.nim-lang.org/#ix=4m1z
18:26:27FromDiscord<enthus1ast> mh
18:28:17FromDiscord<enthus1ast> sent a code paste, see https://play.nim-lang.org/#ix=4m1C
18:29:10FromDiscord<enthus1ast> i want to use the development version in my projects dir
18:30:02FromDiscord<Phil> sent a code paste, see https://play.nim-lang.org/#ix=4m1D
18:30:10FromDiscord<Elegantbeef> `nimja/src`
18:30:40FromDiscord<Phil> sent a code paste, see https://play.nim-lang.org/#ix=4m1E
18:30:59FromDiscord<enthus1ast> ok this changed the error message indeed
18:31:45FromDiscord<Phil> sent a code paste, see https://play.nim-lang.org/#ix=4m1G
18:32:06FromDiscord<Phil> (edit) "https://play.nim-lang.org/#ix=4m1G" => "https://play.nim-lang.org/#ix=4m1H"
18:42:27FromDiscord<enthus1ast> Mh why is this\:`Script Error: c:\users\david\.choosenim\toolchains\nim-1.6.10\lib\system\sets.nim:21:19 undeclared identifier: 'countBits64'`
18:43:58FromDiscord<Elegantbeef> I do not know
18:46:01FromDiscord<Elegantbeef> `countBits64` doesnt exist on the NimVm it seems
18:46:14FromDiscord<enthus1ast> yeah
18:46:49FromDiscord<Elegantbeef> https://github.com/nim-lang/Nim/blob/ebd1c678be5e0acee4fca67e1b7060234821ccf6/lib/system.nim#L2098 yep
18:47:51FromDiscord<federico3> https://blog.deckc.hair/2023-01-18-stop-building-on-corporate-controlled-languages.html
18:50:54FromDiscord<Elegantbeef> So i guess enthus you could make a PR to move that import into a `when notDefined(js)`
18:51:57FromDiscord<Nerve> Is there any way to convert JSON to a Datamancer DataFrame? Assuming a flat object topology of `"key": [array, ...]` pairs, I can't think of a way to switch the seq conversion of the JArray nodes on the data type of the elements.
18:56:57FromDiscord<Phil> In reply to @Nerve "Is there any way": Erm... I mean with jsony you can custom-write handlers that parse specific JSON structures into nim types, I assume a Datamancer DataFrame can be used as such?
19:01:54FromDiscord<enthus1ast> mhpf the nimvm feels much to fragile to be honest
19:02:54FromDiscord<Elegantbeef> Yea i mean wasm is just better 😄
19:07:24FromDiscord<Nerve> In reply to @Isofruit "Erm... I mean with": Never mind, I figured it out. When unmarshalling JSON into a DataFrame, both are dynamic containers which can contain values of various types. The key is to not have an intermediate proc call which must then be typed. All the logic to unwrap the JSON arrays, convert to correctly typed seqs, and drop them into a new DataFrame must be within a single proc so there are no return type issues.
19:08:02FromDiscord<Nerve> I wanted to separate the concern of seq conversion to its own proc, but that may have been unwise, this way is much simpler.
19:09:45FromDiscord<Phil> Okay, so I figure out that the setup_nimforum file is failing with exit code 52 apparently
19:09:57FromDiscord<Phil> (edit) "Okay, so I figure out that the setup_nimforum file is failing with exit code 52 apparently ... " added "when executing"
19:10:00FromDiscord<Phil> No idea what that means
19:10:02FromDiscord<Elegantbeef> Phil always avoiding std/jsonutils 😄
19:10:21FromDiscord<Phil> In reply to @Elegantbeef "Phil always avoiding std/jsonutils": 100% of the time
19:10:28FromDiscord<Phil> Just like I avoid building constructors 100% of the time
19:10:37FromDiscord<Phil> I dodge it like it's made of lethal poison
19:11:07FromDiscord<Phil> Now still, how the fuck is this script exiting with "52" as a returncode
19:16:29FromDiscord<Phil> Okay, this officially makes no sense↵I figured out that the thing that is leading to non zero exit codes is the echo/logging
19:18:07FromDiscord<Phil> sent a code paste, see https://play.nim-lang.org/#ix=4m1U
19:18:22FromDiscord<Phil> How is the exitCode dependant on the text that is being echo'd ?!
19:20:43FromDiscord<Phil> Is there a way to just force a nim binary to return exit code 0 even if this kind of echo nonsens is telling it otherwise?
19:20:52FromDiscord<Phil> Some kind of `setExitCode` ?
19:22:41FromDiscord<Phil> Found it, I can just force nim to shut up with wrong exit codes using `quit()`
19:41:19om3gaHi! how one would set name of thread using system/threads?
19:53:20FromDiscord<Tuatarian> In reply to @Elegantbeef "Is there a reason": yes, the data structure is cyclic (each kid holds ref to parent) and I'd like to not use ARC
19:53:23FromDiscord<Tuatarian> ORC
19:53:31FromDiscord<Tuatarian> I'd like to use ARC
20:01:38FromDiscord<Phil> And just like that, we got a nimforum branch that can run on devel
20:02:09FromDiscord<Ntsékees> In reply to @iWonderAboutTuatara "what vscode theme is": It's not VSCode but Replit
20:03:45FromDiscord<Ntsékees> After a good hour of investigation on why a regexp didn't behave the same between Python and Nim, I concluded that `\s` captures non-breaking spaces with Python's `re` engine, but fails to do so with Nim's `nre`.
20:10:36FromDiscord<Tuatarian> oh I see
20:12:49FromDiscord<Tuatarian> if I have a nested object, and I want to kill the ref but not what it points to, how do I do that?
20:13:02FromDiscord<Tuatarian> sent a code paste, see https://play.nim-lang.org/#ix=4m29
20:13:32FromDiscord<Tuatarian> I would like to delete the ref n.parentalUnit, but not the parentalUnit itself
20:14:22FromDiscord<Tuatarian> if I call `=destroy n.parentalUnit` it will call this function recursively, right?
20:14:32FromDiscord<Tuatarian> I just want the field gone, not the data there (if that makes sense)
20:15:07FromDiscord<Tuatarian> before beef asks, the reason I'm writing a destructor at all is since the references to the children are cyclic and I would like to use ARC instead of ORC for collecting them
20:21:10FromDiscord<demotomohiro> `=destroy` is called when reference count is reached to 0. But if they are cyclic and you dont use ORC, ref count would never reach to 0 and `=destroy` is never called, isn' it?
20:26:00FromDiscord<Tuatarian> Yes, the idea is to kill it manually when I no longer need it
20:26:21FromDiscord<Tuatarian> I guess I don't need to call this thing `=destroy` then though
20:26:35FromDiscord<Tuatarian> Shouldn't make a difference either way right?
20:26:50FromDiscord<Tuatarian> Also, how do I delete the ref without deleting the data lmao
20:32:45FromDiscord<Elegantbeef> What?
20:33:14FromDiscord<Elegantbeef> The ref is heap allocated, if you kill the ref you lose the data, unless you move it to a different value
20:34:36FromDiscord<Elegantbeef> You do not need your own destructor here
20:34:46FromDiscord<Elegantbeef> The default destructor works fine
20:37:24FromDiscord<demotomohiro> I guess what @Tuatarian want is weak pointer so that `ASTNode` can have a reference to parent without cyclic.
20:39:38FromDiscord<Tuatarian> In reply to @Elegantbeef "The ref is heap": What the parentalunit field stores is a pointer to another ASTNode, right?
20:40:12FromDiscord<Tuatarian> How do I delete that pointer without deleting the thing it points to
20:40:26FromDiscord<Tuatarian> Ie, how do I clean up this ASTNode without touching anything else
20:40:27FromDiscord<Elegantbeef> You set the pointer to nil
20:40:35FromDiscord<Elegantbeef> Let Nim manage the memory
20:41:27FromDiscord<Tuatarian> Ok so in the `=destroy`, I do `n.parentalUnit = nil`?
20:41:29FromDiscord<Elegantbeef> That's the entire point of automatic memory management, you set a reference to nil and it cleans up if it's the last reference of it
20:41:48FromDiscord<Elegantbeef> I'm so confused
20:42:07FromDiscord<Tuatarian> The field itself is a pointer, the pointer is being stored somewhere in memory
20:42:18FromDiscord<Tuatarian> I wish to free that memory
20:42:21FromDiscord<Elegantbeef> The field is a reference
20:42:48Amun-RaTuatarian: you need custom =destroy only if you do alloc in init that's not traced by nim itself
20:42:55FromDiscord<Elegantbeef> What added behaviour are you adding to this destructor
20:43:01FromDiscord<Elegantbeef> You're remaking what nim already handles
20:43:49FromDiscord<Tuatarian> I need to also kill the children, which wouldn't happen by default since the parent holds a ref to them, and the parent doesn't get (automatically) freed since their children hold a ref to them
20:43:57FromDiscord<etra> sent a code paste, see https://play.nim-lang.org/#ix=4m2h
20:44:06FromDiscord<Elegantbeef> Orc handles cycle tuatara
20:44:14FromDiscord<Tuatarian> I don't want to use orc
20:44:19FromDiscord<Tuatarian> I know orc handles cycle
20:44:25*dv^_^ quit (*.net *.split)
20:44:25*Lord_Nightmare quit (*.net *.split)
20:44:29*blackbeard420 quit (*.net *.split)
20:44:39Amun-Raso you more of elf's team
20:44:40*blackbeard420_ joined #nim
20:44:43*blackbeard420_ quit (Remote host closed the connection)
20:44:44FromDiscord<Elegantbeef> So then use `{.cursor.}` on the field
20:44:55FromDiscord<Elegantbeef> Since you dont want them incrementing the parent count i guess
20:44:59*blackbeard420 joined #nim
20:45:04FromDiscord<Tuatarian> What is that pragma?
20:45:09*dv^_^ joined #nim
20:45:19*Lord_Nightmare2 joined #nim
20:45:20FromDiscord<Elegantbeef> It's like a weak reference, it doesnt increment the counter of the reference
20:45:33FromDiscord<michaelb.eth> In reply to @iWonderAboutTuatara "What is that pragma?": https://nim-lang.org/docs/destructors.html#the-dotcursor-annotation
20:46:10*blackbeard420 quit (Remote host closed the connection)
20:46:23*blackbeard420 joined #nim
20:46:29FromDiscord<Tuatarian> Wasn't aware of this, thank you
20:47:35FromDiscord<Elegantbeef> I still dont see why you dont want to use orc
20:47:43*Lord_Nightmare2 is now known as Lord_Nightmare
20:48:57FromDiscord<Tuatarian> No good reason
20:49:02FromDiscord<demotomohiro> In reply to @etra "is this safe enough": It probably safe if Message is not ref/seq/string and you dont need to care about endianess.
20:49:08FromDiscord<Tuatarian> Want to get better at managing my memory
20:49:30FromDiscord<Tuatarian> Might be fun, might even be faster, at least in theory
20:50:24FromDiscord<Elegantbeef> Meh orc is plenty fast, it's better to not create cyclical garbage to begin with 😄
20:50:29FromDiscord<Elegantbeef> Whether that's safe depends on what `newMessage` returns
20:50:30FromDiscord<demotomohiro> How about to turn off GC and manage all heap yourself for fun?
20:50:34FromDiscord<Elegantbeef> `newMessage` sounds like a reference
20:50:52FromDiscord<etra> In reply to @demotomohiro "It probably safe if": hmm now I wonder, the socket object receives a string buffer, is there a native way to convert some struct to a string with its bytes?
20:50:56FromDiscord<Tuatarian> Cyclical stuff is usually the best way to do trees
20:51:52FromDiscord<Tuatarian> Arrays/seqs might be faster, but they're much more painful and not really better when the size of the tree can change enormously, which is the case for what I'm doing
20:51:53FromDiscord<Elegantbeef> There is a send variant that uses `pointer, len`
20:51:59FromDiscord<Elegantbeef> so you can just do `send(myData.addr, sizeof(myData))`
20:52:55FromDiscord<Tuatarian> Just to confirm, I have a `var n = ASTNode(...)` as long as n is in scope, that's not going to ever get freed right?
20:53:10FromDiscord<Elegantbeef> Yes
20:53:15FromDiscord<Tuatarian> Ok thanks
20:53:24FromDiscord<Elegantbeef> It'd be dumb if it did get freed 😄
20:56:01FromDiscord<Elegantbeef> sent a code paste, see https://play.nim-lang.org/#ix=4m2m
20:57:14FromDiscord<demotomohiro> In reply to @etra "hmm now I wonder,": There are `recv` and `send` that takes pointer and size:↵https://nim-lang.org/docs/net.html#recv%2CSocket%2Cpointer%2Cint↵https://nim-lang.org/docs/net.html#send,Socket,pointer,int↵So you can write `socket.recv(addr myObj, sizeof(myObj))`.
21:07:17FromDiscord<Tuatarian> In reply to @Elegantbeef "It'd be dumb if": Yeah it would, was just doing a sanity check lmao
21:34:12arkanoidI've ranamed my whole project folder and now I'm getting "Error: unhandled exception: packageparser.nim(344, 10) `fileExists(nf)` [AssertionDefect]". I've already edited nimble file accordingly, and deleted old cache folder. I don't know what else is missing
21:34:40*lumo_e quit (Ping timeout: 252 seconds)
21:40:33arkanoidI land here. I've renamed my nimble file too, so don''t know where is the problem https://github.com/nim-lang/nimble/blob/d13f3b8ce288b4dc8c34c219a4e050aaeaf43fc9/src/nimblepkg/packageparser.nim#L344
21:53:50arkanoidgot it, it was due to "Warning: The .nimble-link file is pointing to a missing file"
22:33:42*lumo_e joined #nim
23:18:51*argonica quit (Read error: Connection reset by peer)
23:53:38FromDiscord<hackeryarn> Hi, I am just starting out with nim. I got emacs mostly setup, but `flycheck-numsuggest`, the default checker always throws the above error. I've tried both stable and devel versions of nim with the same result. Has anyone else run into this? https://media.discordapp.net/attachments/371759389889003532/1067230659942289438/Screenshot_from_2023-01-23_17-44-00.png