<< 18-04-2024 >>

02:25:51*SchweinDeBurg quit (Quit: WeeChat 4.3.0-dev)
02:26:15*SchweinDeBurg joined #nim
03:31:55*krux02_ quit (Remote host closed the connection)
04:42:24*ttkap quit (Ping timeout: 260 seconds)
04:44:29*ttkap joined #nim
05:01:46*rockcavera quit (Remote host closed the connection)
05:36:30FromDiscord<TӨMΛ ☠> In reply to @chronos.vitaqua "Probably because of this": I still doesn't understand, sorry 😢
05:37:07FromDiscord<TӨMΛ ☠> But dang, now tried this out in my old structs, where I defaulted to `""`...... it also doesn't work out-of-the-box
05:37:16FromDiscord<TӨMΛ ☠> (edit) "But dang, now tried this out in my old structs, where I defaulted to `""`...... it also doesn't work out-of-the-box ... " added "if I change the default value"
05:37:41*ntat joined #nim
05:37:43FromDiscord<Robyn [She/Her]> Oh huh... Sorry then, no clue Toma
05:37:54FromDiscord<TӨMΛ ☠> This is so annoying, I haven't noticed that because of using empty values as default, but this means I need to double check so much of my code now ;-;
05:38:04FromDiscord<TӨMΛ ☠> (edit) "code" => "projects"
05:38:08FromDiscord<TӨMΛ ☠> (edit) "much" => "many"
05:39:56FromDiscord<TӨMΛ ☠> Imo if someone puts default values, `T()` should be run automatically before constructor (even though I kinda get why you would have "proc does what you see", this is not Python and bless Nim for that), but this is kinda counterintuitive imo
05:40:26FromDiscord<TӨMΛ ☠> (edit) "Imo if someone puts default values, `T()` should be run automatically before constructor ... (even" added "proc"
05:54:48*PMunch joined #nim
06:00:25FromDiscord<ieltan> In reply to @toma400 "This is so annoying,": `strictDefs` may help you with the double checking
06:31:49FromDiscord<Robyn [She/Her]> Does Nim have a simple function for returning the index for an item you add to a seq?
06:32:09FromDiscord<Robyn [She/Her]> Would be more convenient even if though not actually necessary for what I'm doing
06:32:17Amun-Raseqvar.high?
06:32:39FromDiscord<Elegantbeef> It takes 2 seconds to make that proc 🙂
06:32:57FromDiscord<Robyn [She/Her]> In reply to @Elegantbeef "It takes 2 seconds": It does, was just wondering if that already existed
06:34:14*def- quit (Quit: -)
06:36:24*def- joined #nim
07:01:27FromDiscord<aryzen> is `echo` not needing to use parenthesis because of ufcs? If I created a proc that took one argument, I'd be able to do `myProc "let's say it takes a string"` and it'll work?
07:03:13PMunch@aryzen, yup
07:06:09FromDiscord<Elegantbeef> It's not because of UFCS
07:06:24FromDiscord<Elegantbeef> It's cause nim also has command syntax which allows you to drop parenthesis
07:07:33PMunchYes, but command syntax is part of UFCS no?
07:07:41FromDiscord<Elegantbeef> Nope
07:08:09FromDiscord<Elegantbeef> Ufcs is just being able to do `f(arg)` or `arg.f()` it has no barring on dropping `()`
07:08:15FromDiscord<Elegantbeef> bearing\
07:08:26PMunchOoh, it's only the method-call style
07:08:28PMunchHuh
07:08:50PMunchUnfortunately the command syntax support is a bit weak..
07:09:09PMunchLike `let x = myProc "hello", "world", "!"` doesn't work
07:09:54FromDiscord<Elegantbeef> We can argue that's by design
07:10:03FromDiscord<Elegantbeef> A command arguably should not return anything
07:10:47FromDiscord<Elegantbeef> But that's more likely than non just a parser issue 😄
07:12:39PMunchFair argument, but judging by the error message it definitely seems like just a parser issue :P
07:19:55FromDiscord<nnsee> huh, bridged people no longer show up as BOT
07:20:00FromDiscord<nnsee> but rather, APP
07:20:21FromDiscord<nnsee> https://media.discordapp.net/attachments/371759389889003532/1230417619409043466/Screenshot_20240418-102002_Firefox2.png?ex=66333eb4&is=6620c9b4&hm=acaec25d13cb1e54df249e00d6eb1d952faf850b22741697d0f10a41ff48ae19&
07:20:28FromDiscord<nnsee> meant to post this in offtopic
07:21:03FromDiscord<Robyn [She/Her]> Oh damn I didn't notice that until you brought it up
07:22:11FromDiscord<Elegantbeef> I'm a real boy!
07:23:08FromDiscord<nnsee> well, no, you're an app
07:23:19FromDiscord<nnsee> which i'd say is arguably even worse than being a bot
07:24:54FromDiscord<Robyn [She/Her]> XD
07:32:25FromDiscord<morgan> what's the easiest way to get a string that uses the bits of an int? i'm working on saving/loading and i decided to do json for saves, as it should let me handle missing parameters more gracefully, but it has the downside of being an inconsistent size. i'm not sure if it would work well to request data until it looks finished, so im thinking putting the number of bytes at the beginning and use that to read the save data
07:32:58FromDiscord<Elegantbeef> `toBin`
07:33:03FromDiscord<morgan> thanks
07:36:13FromDiscord<aryzen> awesome, so, I was actually just testing it out myself right after I asked and this does work https://media.discordapp.net/attachments/371759389889003532/1230421615225995265/image.png?ex=6633426d&is=6620cd6d&hm=85641d9519307f95c0a8c65af7b1956938efa16f87c8e3ed194ad379a87778de&
07:39:33FromDiscord<morgan> In reply to @Elegantbeef "`toBin`": ah so that makes a string with 1s and 0s, i suppose that could work, i was thinking like just a faster way to get chars that represent each byte
07:40:05FromDiscord<Elegantbeef> `cast[ptr array[sizeof(val), char]](myInt.addr)[]`
07:41:13*redj quit (Ping timeout: 246 seconds)
07:41:46FromDiscord<morgan> thanks
07:41:50*redj joined #nim
07:42:00FromDiscord<TӨMΛ ☠> In reply to @nnsee "which i'd say is": Unless the app is written in Nim, let's be precise
07:42:31FromDiscord<morgan> i might actually not bother doing it with json, im not sure it's gaining me anything
07:46:43FromDiscord<Elegantbeef> protobuf is probably ideal
07:46:45FromDiscord<Elegantbeef> Or something similar
07:52:52FromDiscord<destrix12> Hi🫨
07:53:02*ntat quit (Quit: Leaving)
07:55:37FromDiscord<morgan> i think part of the reason im leaning away from json is im not sure it'll be structured at all
07:56:38FromDiscord<morgan> mainly just a list of pairs of data points, with a little metadata at the top
08:03:43FromDiscord<Elegantbeef> This reminds me I should publish my "very simple binary format" which is totally not just messagepack rewritten 😄
08:27:59FromDiscord<m4ul3r> I'll mention this in main, incase someone has ran into this before: https://discord.com/channels/371759389889003530/756920870525730947/1230425264866070630↵Trying to get functions to be aligned to the byte and not 16 bytes
09:10:30*PMunch_ joined #nim
09:13:27*PMunch quit (Ping timeout: 256 seconds)
10:03:32*PMunch__ joined #nim
10:06:09*PMunch_ quit (Ping timeout: 255 seconds)
10:06:35*def- quit (Quit: -)
10:06:48*def- joined #nim
10:20:58FromDiscord<pk.kyle> uh im doing some really stupid things. i want to output a `proc` that only outputs boolean and takes nothing as inputs in a proc, how do i type that
10:21:21FromDiscord<pk.kyle> `proc thatoutputsproc(anotherproc: proc():bool)`?
10:28:15FromDiscord<odexine> yes
10:29:09FromDiscord<pk.kyle> dam
10:29:11FromDiscord<pk.kyle> thx
10:32:41FromDiscord<nnsee> sent a code paste, see https://play.nim-lang.org/#pasty=KpPuOdRZBJXt
10:34:03FromDiscord<pk.kyle> \:o
10:34:59FromDiscord<nnsee> of course naming it something that actually describes what you're returning
10:35:15FromDiscord<nnsee> makes the proc signature a bit more self documenting maybe
10:41:12*PMunch__ is now known as PMunch
10:47:14*PMunch_ joined #nim
10:50:29*PMunch quit (Ping timeout: 256 seconds)
10:56:37FromDiscord<albassort> hello i forgot how to make a async proc work with createThread
10:56:46FromDiscord<albassort> i presume createThread doesn't like it because it returns something
10:56:51FromDiscord<albassort> (edit) "something" => "something, Future[void]"
10:57:59PMunch_You'll have to wrap it in something which deals with the async part
10:58:13FromDiscord<albassort> oh yeah
10:58:20FromDiscord<albassort> or is this a nim 2.o thing
10:58:24FromDiscord<albassort> (edit) "2.o" => "2.0"
11:06:39*PMunch_ is now known as PMunch
11:06:48PMunchI think this has always been the case
11:17:56*def- quit (Quit: -)
11:18:12*def- joined #nim
11:25:58*def- quit (Quit: -)
11:26:19*def- joined #nim
11:38:23*dtomato quit (Ping timeout: 264 seconds)
11:39:03*dtomato joined #nim
11:48:06FromDiscord<Robyn [She/Her]> In reply to @albassort "i presume createThread doesn't": `createThread waitFor(myAsyncProc())` I assume...?
11:48:37FromDiscord<albassort> is that real
11:48:38FromDiscord<albassort> :O
11:48:39FromDiscord<albassort> woa
11:48:52FromDiscord<Robyn [She/Her]> Try it, maybe?
11:50:03FromDiscord<Robyn [She/Her]> I've never used the createThread proc so can't help there
11:50:35FromDiscord<Robyn [She/Her]> In reply to @chronos.vitaqua "`createThread waitFor(myAsyncProc())` I assume...?": This'll probably crash, thinking about it
11:51:18FromDiscord<Robyn [She/Her]> Since asyncdispatch has a separate dispatcher per thread, iirc?
11:51:30FromDiscord<Robyn [She/Her]> And you can't await futures created on another thread
12:08:20FromDiscord<takemichihanagaki3129> Is there a way to use Vs Code's debug to debug Nim code?↵I'm having issues with segfaults, and I'm not getting where...
12:11:37Amun-Rahmm… c_cpp_settings.json + nim-gdb
12:16:42FromDiscord<takemichihanagaki3129> In reply to @Amun-Ra "hmm… c_cpp_settings.json + nim-gdb": I will have a look on it.
12:26:59FromDiscord<pk.kyle> do i convert integers to strings by `repr`?
12:27:58FromDiscord<demotomohiro> You can use `$` operator to convert ints to string.
12:31:13*disso-peach joined #nim
12:33:08FromDiscord<pk.kyle> ohh
12:36:23FromDiscord<pk.kyle> how do i round a number to 3 significant figures
12:37:18*ntat joined #nim
12:46:38FromDiscord<nnsee> In reply to @pk.kyle "how do i round": my cursed solution https://play.nim-lang.org/#pasty=lLsqVmtxuWdh
12:47:16FromDiscord<pk.kyle> In reply to @nnsee "my cursed solution https://play.nim-lang.org/#pasty": 🫶
12:47:23FromDiscord<pk.kyle> do you allow me to copy your code and paste it into mine
12:47:30FromDiscord<nnsee> go for it
12:47:33FromDiscord<pk.kyle> thanksss
12:47:37FromDiscord<nnsee> its not very good code, though
12:47:44FromDiscord<pk.kyle> working code is good code
13:10:14FromDiscord<pk.kyle> sent a code paste, see https://play.nim-lang.org/#pasty=wuFZxxSZuWAR
13:10:24FromDiscord<pk.kyle> or is there another better method
13:27:36*MacDefender joined #nim
13:42:20*rockcavera joined #nim
13:55:12FromDiscord<threefour> How would I go about returning the result of a synchronous proc from an asynchronous procedure? I know the operation would end up being synchronous, but I need to do it for API consistency.
13:55:26FromDiscord<threefour> (edit) "procedure?" => "proc?"
13:55:56FromDiscord<odexine> just return it normally?
13:58:48FromDiscord<threefour> Maybe more detail is needed: I have multiple procs that are truly asynchronous, but one that has a similar function but without any asynchronous operations done inside it. I'd like them all to be called the same way (with `await`), but when I do that, it expects a future from the "asynchronous" proc that returns the synchronous proc's result, and then errors.
14:00:19FromDiscord<threefour> If it was just me touching the code, I wouldn't care as much about call consistency, but this is for a library, and it looks pretty ugly having some procs require `await`, while other functionally similar ones do not.
14:01:27FromDiscord<odexine> sent a code paste, see https://play.nim-lang.org/#pasty=ldJDwmwvHNNb
14:01:43FromDiscord<nnsee> In reply to @threefour "If it was just": hmm
14:01:52FromDiscord<nnsee> maybe the `multisync` pragma does what you want?
14:03:10FromDiscord<odexine> i dont think so
14:03:50FromDiscord<odexine> multisync applies if you want two versions:↵- async function calling asyncs↵- sync function calling syncs
14:04:26FromDiscord<nnsee> isn't that basically what they're describing?
14:04:28FromDiscord<odexine> no
14:05:12FromDiscord<odexine> theyre describing that they have two functions:↵- async calling asyncs↵- async (important, they want both functions to be called with await, i assume because of limitations) calling syncs
14:05:31FromDiscord<odexine> i guess it does apply but its not exactly whats wanted
14:05:38FromDiscord<threefour> In reply to @nnsee "maybe the `multisync` pragma": I just realized after sending all of that, that I missed an obvious refactoring step that solves the problem for me. All of the functions actually need to be sync, and the async part now happens one level higher than it was before. My brain got mixed up. It's early 🥲
14:05:41FromDiscord<odexine> i think its probably better to go with using multisync
14:06:05FromDiscord<odexine> oh
14:06:29FromDiscord<nnsee> i re-read the message. if you truly just want all procs to be called with await, why not just make your fully-synchronous procs async _anyways_ as well?
14:09:20FromDiscord<threefour> Because I'm dumb. The synchronous proc being called would be uglier if it needed to be called via `await` every time it was used, but only needed it for this one particular spot. Basically I thought I had a problem when I really don't. This is why I rarely ask for help. Every time I do, it's right before I realize the obvious. Thanks for the help though!
14:11:45FromDiscord<threefour> (I learned that multisync existed, and I can already see situations where knowing about it would be helpful)
14:11:58FromDiscord<nnsee> In reply to @threefour "Because I'm dumb. The": sure! i don't think any of us have a problem with being your rubber ducky :)
14:17:02*PMunch quit (Quit: Leaving)
14:26:10FromDiscord<pk.kyle> how do i curry in nim
14:27:27FromDiscord<pk.kyle> sent a code paste, see https://play.nim-lang.org/#pasty=TxfcUFtZbGyf
14:28:21*technical_dept joined #nim
14:33:40*technical_dept quit (Ping timeout: 260 seconds)
14:39:20FromDiscord<leorize> curry is painful and slow in any language not explicitly made for it
14:42:38FromDiscord<pk.kyle> wat are the differences e https://media.discordapp.net/attachments/371759389889003532/1230528925650911283/image.png?ex=6633a65d&is=6621315d&hm=cc4fa0f57fb62687adb722812e6c84bd8c330c474659ac2c5f457a481900abec&
14:43:06FromDiscord<nnsee> the nim-lang.org one is maintained
14:43:08FromDiscord<nnsee> the others aren't
14:44:04FromDiscord<pk.kyle> ic
14:49:12*def- quit (Quit: -)
14:50:07*def- joined #nim
14:53:44*def- quit (Client Quit)
14:54:06*def- joined #nim
14:57:10*def- quit (Client Quit)
14:57:41*def- joined #nim
15:00:40*def- quit (Client Quit)
15:01:22*def- joined #nim
15:12:46FromDiscord<Robyn [She/Her]> Do `fieldPairs` work with case objects?
15:45:42*def- quit (Quit: -)
15:45:54*def- joined #nim
15:55:21*krux02 joined #nim
17:04:55*def- quit (Quit: -)
17:05:24*def- joined #nim
17:18:44*def- quit (Quit: -)
17:19:42*def- joined #nim
17:29:06*KhazAkar quit (Remote host closed the connection)
17:39:24FromDiscord<that_dude.> Is there a simple way to get the next value of an enum without mutating the current variable? Right now I'm using `PolyClipStage(int(b) + 1)` in my code.
17:55:53FromDiscord<nervecenter> That's about it, though `ord()` would be more explicit than `int()`
17:56:10FromDiscord<nervecenter> In reply to @that_dude. "Is there a simple": That's about it, though `ord()` would be more explicit than `int()`
17:57:28FromDiscord<nervecenter> Maybe write custom `next(e: PolyClipStage)` and `prev(e: PolyClipStage)` procs to make it more clear what's happening throughout your code base
17:57:54FromDiscord<nervecenter> (edit) "Maybe write custom `next(e: PolyClipStage)` and `prev(e: PolyClipStage)` procs to make it more ... clear" added "concise and"
17:58:25*def- quit (Quit: -)
17:59:46FromDiscord<that_dude.> Maybe I should see if I could pr some kind of next()
18:01:13*MacDefender quit (Quit: WeeChat 4.2.2)
18:03:17*def- joined #nim
18:06:36*def- quit (Client Quit)
18:06:48*def- joined #nim
18:10:32FromDiscord<morgan> i think inc and dec work for that
18:10:37FromDiscord<morgan> tho idk if it handles holes
18:10:57FromDiscord<morgan> or maybe im misremembering the names
18:11:18*def- quit (Client Quit)
18:11:43*def- joined #nim
18:12:06FromDiscord<Elegantbeef> `succ` and `pred` exist
18:12:22FromDiscord<morgan> ah i was also remembering those names but forgetting what they did
18:12:45FromDiscord<that_dude.> Ah
18:13:00FromDiscord<morgan> ok so i can do `myptr[] = whatever`, but i got that pointer from alloc0, is there a nice way to do that with an offset? or will i need to make a proc to wrap some pointer math and casts
18:17:06*def- quit (Quit: -)
18:17:28*def- joined #nim
18:22:08FromDiscord<stoneface86> nope, you have to cast to an int, do math then cast back to ptr. I just use a template that defines a bunch of arithmetic operators for pointers for a given block of code
18:23:43FromDiscord<morgan> yeah i just did that, tho just with +
18:23:51FromDiscord<morgan> i found code to copy
18:26:12FromDiscord<m4ul3r> sent a code paste, see https://play.nim-lang.org/#pasty=aPSqCxbGjnfK
18:27:00FromDiscord<m4ul3r> (edit) "https://play.nim-lang.org/#pasty=mqnQXmItMclT" => "https://play.nim-lang.org/#pasty=KpQrqceRrVoH"
18:27:08FromDiscord<m4ul3r> sent a code paste, see https://play.nim-lang.org/#pasty=fDjmMqvTcvjU
18:36:26*def- quit (Quit: -)
18:36:48*def- joined #nim
18:47:37*def- quit (Quit: -)
18:48:29*def- joined #nim
18:57:59FromDiscord<morgan> how do i get the bits of some float as an int of the same size?
18:58:16FromDiscord<morgan> im assuming a cast tries to preserve value
18:58:21FromDiscord<morgan> but maybe im wrong on that
18:59:20*ntat quit (Quit: Leaving)
19:01:12FromDiscord<nervecenter> cast reinterprets raw bits
19:01:29FromDiscord<morgan> ah cool
19:07:20*def- quit (Quit: -)
19:09:20*def- joined #nim
19:11:53FromDiscord<morgan> :havinganormalone: https://media.discordapp.net/attachments/371759389889003532/1230596681972715600/image.png?ex=6633e578&is=66217078&hm=53323a95c1b1e0c022310fcaef4167b8c0b1084fe9c9463c0dc114d5a8af1b84&
19:12:48FromDiscord<huantian> i needs to be a `var uint`
19:12:59FromDiscord<morgan> oohhhh
19:13:09FromDiscord<morgan> i swear i make that mistake about once a day
19:15:40FromDiscord<morgan> one of those things where you think so hard you miss the obvious stuff
19:28:03*krux02_ joined #nim
19:31:00*krux02 quit (Ping timeout: 268 seconds)
19:36:58*def- quit (Quit: -)
19:37:42*def- joined #nim
20:17:19FromDiscord<nervecenter> Yeah just remember that `var`, `ref`, and `ptr` are type qualifiers that are included in a type signature. Anytime you're dealing with mutability or references it must be explicitly passed between contexts, no implicit.
20:17:44FromDiscord<nervecenter> (edit) "references it" => "references, they"
20:17:53FromDiscord<nervecenter> (edit) "no" => "never"
20:18:00FromDiscord<nervecenter> (edit) "implicit." => "implicitly."
20:41:10*def- quit (Quit: -)
20:41:23*def- joined #nim
20:56:24*leehbi joined #nim
20:56:30*leehbi quit (Client Quit)
21:27:54*def- quit (Quit: -)
21:30:11*def- joined #nim
21:33:06*def- quit (Client Quit)
21:34:56*def- joined #nim
22:04:55FromDiscord<System64 ~ Flandre Scarlet> https://github.com/Stephane-D/SGDK↵Hi, do you think it is possible to make a binding for that to Nim?
22:06:10FromDiscord<saint.___.> In reply to @sys64 "https://github.com/Stephane-D/SGDK Hi, do you": I don't see why not since it's C
22:06:16FromDiscord<saint.___.> Futhark could probably get you a long way
22:06:43FromDiscord<saint.___.> Do you know why people are developing for the mega drive as compared to other systems
22:07:58FromDiscord<System64 ~ Flandre Scarlet> In reply to @saint.___. "Do you know why": Making homebrew games (and even commercial ones!!)↵Also, the Motorola 68000 is quite C-friendly
22:09:17*def- quit (Quit: -)
22:14:05FromDiscord<System64 ~ Flandre Scarlet> Now seems it's quite difficult with those makefiles and all
22:36:45FromDiscord<saint.___.> In reply to @sys64 "Making homebrew games (and": Yeah! I get that, I mean like why mega drive compared to snes
22:36:58FromDiscord<saint.___.> And ah yeah I've done some 68k asm stuff
22:37:04FromDiscord<saint.___.> Didn't know the mega drive used that
22:51:03*def- joined #nim
22:52:26FromDiscord<System64 ~ Flandre Scarlet> In reply to @saint.___. "Yeah! I get that,": The SNES hardware is a mess, even if I love the SNES
22:54:28*def- quit (Client Quit)
22:54:40*def- joined #nim
22:57:44*def- quit (Client Quit)
23:16:54FromDiscord<saint.___.> In reply to @sys64 "The SNES hardware is": Ah interesting
23:18:50*def- joined #nim
23:21:54*def- quit (Client Quit)
23:22:10*def- joined #nim
23:24:20FromDiscord<morgan> In reply to @morganalyssa "another idea is that": thinking about this some more, sokol has functions to get the window handle, so i could use that with the reparent functions used in the clap example
23:24:31FromDiscord<morgan> i think that might just work
23:29:44FromDiscord<Elegantbeef> It might
23:36:50*SchweinDeBurg quit (Quit: WeeChat 4.3.0-dev)
23:37:16*SchweinDeBurg joined #nim