<< 28-01-2024 >>

00:23:23*jmdaemon joined #nim
01:00:02*nazgulsenpai quit (Quit: ZNC 1.8.2 - https://znc.in)
01:03:28*nazgulsenpai joined #nim
01:04:04*Goodbye_Vincent quit (Ping timeout: 256 seconds)
01:14:14*Goodbye_Vincent joined #nim
01:20:41*Goodbye_Vincent quit (Ping timeout: 252 seconds)
01:32:55*raynei quit (Ping timeout: 276 seconds)
01:34:32*khazakar quit (Quit: Connection closed for inactivity)
01:57:45FromDiscord<ricky> i aint done much compile time nim but can u do reflection for minimal dynamic alloc @ runtime json deserde of objs
01:58:17FromDiscord<ricky> (edit) "do" => "use" | "usereflection ... for" added "@ compile time"
02:05:44*raynei joined #nim
02:06:13FromDiscord<Elegantbeef> Sure
02:06:38FromDiscord<Elegantbeef> Look at disruptek/frosty
02:06:50FromDiscord<Elegantbeef> It's like the ideal 'serde' api
03:42:35*raynei quit (Ping timeout: 252 seconds)
04:33:19FromDiscord<piman_discriminator_1010> templates are like C macros right?
04:35:39FromDiscord<Elegantbeef> Sorta, but not really
04:36:22FromDiscord<nnsee> In reply to @piman_discriminator_1010 "templates are like C": they're smarter, more powerful, and more ergonomic to use
04:36:25FromDiscord<Elegantbeef> They're both code substitution but Nim templates are overloadable
04:36:42FromDiscord<nnsee> they feel like an actual part of the language instead of an afterthought
04:37:14FromDiscord<leorize> nim templates are nothing like C macros
04:37:34FromDiscord<piman_discriminator_1010> undeclared identifier `&&` :unamused: why must Nim keep doing this to me
04:37:51FromDiscord<leorize> maybe you just have to learn the language \:p
04:38:27FromDiscord<piman_discriminator_1010> it would be a lot easier if Nim didn't seemingly randomly change things that have already been standardized :mood:
04:38:37FromDiscord<piman_discriminator_1010> also if it didn't take 3 minutes for this to compile
04:38:50FromDiscord<leorize> nim doesn't change standardized stuff
04:38:58FromDiscord<leorize> it's different standards
04:38:59FromDiscord<piman_discriminator_1010> && seems pretty standard to me
04:39:06FromDiscord<leorize> nim hail from the writh language family
04:39:22FromDiscord<leorize> where words are used
04:39:44FromDiscord<Elegantbeef> `&&` is standard in C style languages
04:39:48FromDiscord<Elegantbeef> But there are more fish in the sea
04:42:03FromDiscord<nnsee> `and` is also standard as per the 1998 C++ standard
04:42:47FromDiscord<nnsee> i think it's fairly reasonable to expect that not every language you learn is going to have the exact same syntax
04:43:44FromDiscord<takemichihanagaki3129> In reply to @piman_discriminator_1010 "&& seems pretty standard": I never used this, even when programming in C.
04:43:48FromDiscord<takemichihanagaki3129> Lol
04:44:32FromDiscord<takemichihanagaki3129> I always import the iso646.h.
04:44:50FromDiscord<piman_discriminator_1010> I don't even know what header that is lol
04:45:04FromDiscord<nnsee> i prefer the `and` keyword since && is often very fucking clumsy to write on a non-us keyboard layout
04:45:14FromDiscord<nnsee> although these days I've given up and just use US
04:46:55FromDiscord<piman_discriminator_1010> welp, time to google templates again
04:47:04FromDiscord<Elegantbeef> Quit googling
04:47:09FromDiscord<Elegantbeef> Just read the manual/tutorials
04:47:49FromDiscord<piman_discriminator_1010> I am, I google to get there
04:49:21FromDiscord<takemichihanagaki3129> In reply to @piman_discriminator_1010 "I don't even know": Basically this header brings the keywords and, or...
04:52:16*raynei joined #nim
05:11:50FromDiscord<piman_discriminator_1010> can templates not return values? (or substitute the call for an expression?)
05:15:32FromDiscord<Elegantbeef> They can but they need a return type
05:15:36FromDiscord<Elegantbeef> be it `untyped` or the expression
05:19:53FromDiscord<piman_discriminator_1010> yep, untyped return type worked, return keyword however kept expecting a string for some reason though
05:21:53FromDiscord<Elegantbeef> cause you called it in a proc
05:22:04FromDiscord<Elegantbeef> templates expand at callsite and do not have a `result` or return
05:24:24FromDiscord<piman_discriminator_1010> In reply to @Elegantbeef "templates expand at callsite": ok, makes sense, but also didn't seem work until I added `: untyped` so I got a bit confused
05:44:12*Goodbye_Vincent joined #nim
05:49:45*raynei quit (Ping timeout: 256 seconds)
06:30:57NimEventerNew Nimble package! awsSigV4 - Simple package for creating AWS Signature Version 4 (SigV4), see https://github.com/ThomasTJdev/nim_awsSigV4
07:59:08*zgasma quit (Quit: Lost terminal)
08:16:59*cnx quit (Remote host closed the connection)
08:17:47*cnx joined #nim
08:51:00*advesperacit joined #nim
09:20:17*wheatengineer joined #nim
09:32:11*wheatengineer quit (Ping timeout: 268 seconds)
10:32:32FromDiscord<albassort> is there anyway to request a memory block from the OS that is NOT swap
10:32:42FromDiscord<albassort> (edit) "is there anyway to request a memory block from the OS that is ... NOT" added "specifically"
10:33:30FromDiscord<albassort> i guess i can put it into vram
10:33:42FromDiscord<albassort> no that can leak into swap too
10:41:41*jmdaemon quit (Ping timeout: 240 seconds)
10:44:45FromDiscord<odexine> in unix there is pinning
10:45:37FromDiscord<odexine> check man pages for mlock(2)
10:47:20FromDiscord<Phil> What exactly does the move proc do?
10:47:33FromDiscord<Phil> https://nim-lang.org/docs/system.html#move%2CT
10:49:18FromDiscord<Phil> Does it just nil the var T you put in there (or reset the memory of var T) and that's it?
11:17:39FromDiscord<nnsee> In reply to @albassort "no that can leak": besides mlock I also suggest looking into madvise https://man7.org/linux/man-pages/man2/madvise.2.html
13:04:38*raynei joined #nim
13:50:40*raynei quit (Ping timeout: 276 seconds)
14:03:14*raynei joined #nim
14:38:23FromDiscord<jtiai> Hello, as trying to build OS with nim and trying to compile my old code I encountered issue with having some file (ssystem.nim?) generatong `#include "setjmp.h"`. I tried to add `--exceptions:quirky` but still getting the same error. Do I need to add some other flag(s) too?
14:43:33FromDiscord<odexine> this was a recently reported issue
14:44:23FromDiscord<odexine> i dont know if its in the tracker
14:46:37FromDiscord<_fcn_> sent a long message, see https://pasty.ee/oNyfkylLwQKD
14:47:10FromDiscord<_fcn_> Anyone knows how to avoid that?
14:47:27FromDiscord<demotomohiro> In reply to @jtiai "Hello, as trying to": This PR might related to your problem.↵https://github.com/nim-lang/Nim/pull/23259
14:50:13FromDiscord<jtiai> In reply to @demotomohiro "This PR might related": Right, I was looking into that.
14:52:26FromDiscord<demotomohiro> In reply to @_fcn_ "Hi there! I am": If typeof(CPlayer_Data)` is cstring, it returns a pointer to heap that is freed.
14:53:59FromDiscord<demotomohiro> If `CPlayer_Data` is string, it will be fine.
14:54:50FromDiscord<demotomohiro> As long as CPlayer_Data is not local variable.
14:56:22Amun-Ra_fcn_: add explicit cstring conversion
15:00:05FromDiscord<_fcn_> In reply to @Amun-Ra "<@491734096620421120>: add explicit cstring": A simple "cstring(pd_from_disk)" solved the issue... Thanks!
15:02:15FromDiscord<demotomohiro> In reply to @_fcn_ "A simple "cstring(pd_from_disk)" solved": But cstring is a pointer to the heap in `pd_from_disk` and `pd_from_disk` is freed when you return from the proc.
15:02:56FromDiscord<demotomohiro> `cstring(pd_from_disk)` is invalid code.
15:09:19*raynei quit (Ping timeout: 260 seconds)
15:10:21FromDiscord<_fcn_> In reply to @demotomohiro "`cstring(pd_from_disk)` is invalid code.": When you say "invalid code", you mean, could lead to an unexpected behavior?
15:11:31FromDiscord<_fcn_> Because it is still working for my study case (Unity native plugin)...
15:13:57FromDiscord<_fcn_> One info not informed in the code I supply, CPlayer_Data is a global var, that (supposedly) will remain available until the lib is unloaded, I presume.
15:14:16Amun-Rait's true that the way it works is undefined behavior
15:14:34Amun-Rait'd be safer to alloc cstring and free after use
15:15:16NimEventerNew thread by xTrayambak: Librng - a simple and fast PRNG library, see https://forum.nim-lang.org/t/10925
15:17:30Amun-Ra…or store the string somewhere for gc not to free it
15:23:52FromDiscord<demotomohiro> In reply to @_fcn_ "Because it is still": If `pd_from_disk` is a `string` type and local variable, its heap is freed when return and `return cstring(pd_from_disk)` returns freed pointer.↵If you use returned pointer, it is so called 'use after free`.↵If you do `CPlayer_Data = pd_from_disk; return cstring(CPlayer_Data)`, it is fine as long as `CPlayer_Data` is global and `string` type.
15:26:49*raynei joined #nim
15:58:56FromDiscord<nnsee> looks like nitter is shutting down
15:59:01FromDiscord<nnsee> rip to a real one
15:59:38FromDiscord<␀ Array 🇵🇸 🍉> the most popular nim project is now dead [\:sob-cry\: https://mau.lu/lkxiq5 ]
16:00:09systemdsucksthat's sad
16:08:31FromDiscord<exelotl> :(
16:11:39FromDiscord<jaar23> Hi, anyone try to read clipboard from illwill (the terminal ui library) before?
16:14:59*raynei quit (Ping timeout: 264 seconds)
16:17:02FromDiscord<saint.___.> Too bad invidious wasn't made with nim instead!
16:17:16FromDiscord<saint.___.> Although there seems to be efforts in place to shut down invidious too
16:48:49FromDiscord<whisperecean> Why is nitter shutting down?
16:57:10FromDiscord<␀ Array 🇵🇸 🍉> twitter changed their stuff so you cant see tweets without an account. nitter has a login option now but public instamces are getting rate limited↵(@whisperecean)
17:00:45FromDiscord<␀ Array 🇵🇸 🍉> twitter changed their stuff so you cant see tweets without an account. nitter has a login option now but public instances using them are getting rate limited or banned
17:01:04FromDiscord<␀ Array 🇵🇸 🍉> twitter changed their stuff so you cant see tweets without an account. nitter has a login option now but public instances using them are getting rate limited and may possibly grt banned
17:03:03FromDiscord<␀ Array 🇵🇸 🍉> twitter's changes is not just killing nitter but also all alternative frontends
18:27:14FromDiscord<piman_discriminator_1010> I thought nitter died months ago
18:49:08FromDiscord<␀ Array 🇵🇸 🍉> the dev found a work around making it work for a bit longer i think↵(@piman_discriminator_1010)
18:49:25FromDiscord<piman_discriminator_1010> huh
19:15:37FromDiscord<piman_discriminator_1010> sent a code paste, see https://play.nim-lang.org/#pasty=wVHnlalZQEMt
19:18:12FromDiscord<piman_discriminator_1010> sent a code paste, see https://play.nim-lang.org/#pasty=wKsIymCntlfN
19:20:04FromDiscord<piman_discriminator_1010> sent a code paste, see https://play.nim-lang.org/#pasty=cLUuPEVZOvfM
19:25:47FromDiscord<odexine> what is \`string\`?
19:26:01FromDiscord<piman_discriminator_1010> field of BACnetProperty
19:27:11*khazakar joined #nim
19:27:24FromDiscord<piman_discriminator_1010> derp, field of Data sorry
19:27:29FromDiscord<odexine> sent a code paste, see https://play.nim-lang.org/#pasty=GCIKPDTUBSqK
19:27:53FromDiscord<piman_discriminator_1010> In reply to @piman_discriminator_1010 "I'm trying to do": so there's no way to do this?
19:28:35FromDiscord<odexine> not in that form id say
19:29:06FromDiscord<odexine> definitely in macro form, not entirely sure if it is possible in template form
19:36:58FromDiscord<ambient3332> How do I log errors in a multithreaded environment with many callbacks etc? Seems something just eats the error messages like indexing out of range etc
20:28:11*advesperacit quit ()
20:31:17FromDiscord<ambient3332> The program simply freezes when there's some illegal memory access in another thread
20:31:32FromDiscord<ambient3332> So I have to debug completely blind
20:33:32FromDiscord<Elegantbeef> Ensure all your top level thread procs are annotated `{.raises: [].}` and handle the exceptions, cry about the defects
21:35:34*khazakar quit (Quit: Connection closed for inactivity)
22:04:54FromDiscord<norax.2> does someone have a guide for illwill,im trying to use it but i cant really understand
22:05:03FromDiscord<norax.2> (edit) "illwill,im" => "illwill(library),im" | "understand" => "understand?"
22:05:53FromDiscord<Elegantbeef> https://github.com/johnnovak/illwill/tree/master/examples
22:06:33FromDiscord<norax.2> will check that thx
22:07:19FromDiscord<Elegantbeef> https://github.com/ansiwave/nimwave also might work for you
22:10:15*khazakar joined #nim
22:17:48*jmdaemon joined #nim
23:03:52FromDiscord<bubblie> sent a code paste, see https://play.nim-lang.org/#pasty=MetpIzacfmfI
23:03:56FromDiscord<piman_discriminator_1010> is there a way to clear a sequence so that the elements can be garbage collected, but without creating an entirely new sequence?
23:04:09FromDiscord<bubblie> (edit) "https://play.nim-lang.org/#pasty=eXrfdCPrbzOw" => "https://play.nim-lang.org/#pasty=fCeHkXHVJsHP"
23:04:35FromDiscord<piman_discriminator_1010> sent a code paste, see https://play.nim-lang.org/#pasty=dDfpHzeBtVzx
23:04:41FromDiscord<bubblie> thanks
23:04:51FromDiscord<Elegantbeef> `setLen(0)`
23:05:06FromDiscord<piman_discriminator_1010> In reply to @Elegantbeef "`setLen(0)`": does that allow the old elements to be garbage collected?
23:05:42FromDiscord<piman_discriminator_1010> (I originally assumed no, but since you answered with it, I assume now yes?)
23:06:14FromDiscord<Elegantbeef> https://play.nim-lang.org/#pasty=MsgnnImxGIoE check for yourself
23:06:40FromDiscord<piman_discriminator_1010> I'm not sure how to actually check what the GC is doing
23:06:57FromDiscord<Elegantbeef> Nim's Arc/Orc just calls `=destroy`
23:07:08FromDiscord<Elegantbeef> So just put in an object with a custom destructor
23:07:21FromDiscord<Elegantbeef> If it's called it's decrementing the ref count
23:10:17FromDiscord<piman_discriminator_1010> `proc =destroy() =`
23:10:35FromDiscord<piman_discriminator_1010> (edit) "`proc =destroy() =`" => "sent a code paste, see https://play.nim-lang.org/#pasty=kwvHWxjwmStc"
23:10:41FromDiscord<piman_discriminator_1010> like that?
23:10:55FromDiscord<Elegantbeef> What?
23:12:59FromDiscord<piman_discriminator_1010> nvm, I googled custom destructor
23:13:19FromDiscord<Elegantbeef> https://nim-lang.org/docs/theindex.html is better than google
23:13:20FromDiscord<piman_discriminator_1010> oh you already did it lol
23:13:49FromDiscord<piman_discriminator_1010> oh that's neat (though googling just takes me to the nim docs anyways)
23:15:51FromDiscord<bubblie> is there a way to obtain the access value of a variable in nim
23:17:48FromDiscord<bubblie> kinda like with C pointers where you just the asterick
23:18:02FromDiscord<Elegantbeef> what?
23:19:46FromDiscord<piman_discriminator_1010> is setLen part of sequtils?
23:19:58FromDiscord<bubblie> sent a code paste, see https://play.nim-lang.org/#pasty=TttPXFcyYqhF
23:21:52FromDiscord<Elegantbeef> `[]`
23:21:58FromDiscord<Elegantbeef> But just use `var T` inside your proc
23:22:03FromDiscord<Elegantbeef> It's called dereferencing a pointer
23:22:45FromDiscord<bubblie> yeah sorry
23:22:48FromDiscord<bubblie> thank you
23:28:25FromDiscord<piman_discriminator_1010> 🤔 https://media.discordapp.net/attachments/371759389889003532/1201307824039407716/image.png?ex=65c95818&is=65b6e318&hm=3adc62817bb893722f3735a5f6fca497e855737cee440e257270b19f0a5b621c&
23:28:52FromDiscord<Elegantbeef> `getChildren` does not return `var seq[wWindow]`
23:29:42FromDiscord<piman_discriminator_1010> return of `seq[Type]` is not the same as a return of `var seq[Type]`?
23:30:53FromDiscord<piman_discriminator_1010> I know parameters are immutable by default, are return parameters also immutable by default?
23:31:20FromDiscord<leorize> yes
23:33:30FromDiscord<piman_discriminator_1010> oh, I probably never noticed because I rarely work with ref types so they usually just copy to a variable I already declared as mutable
23:39:08FromDiscord<Elegantbeef> where's the ref type?! 😄
23:41:39FromDiscord<luteva> sent a code paste, see https://play.nim-lang.org/#pasty=oHeYXhrxrqnS
23:43:25*raynei joined #nim
23:48:49FromDiscord<Elegantbeef> Make a macro to convert a tuple typedesc to or'd types
23:50:46FromDiscord<luteva> ok 🙂