00:46:21 | * | lucasta quit (Quit: Leaving) |
00:54:15 | * | lucasta joined #nim |
01:13:01 | * | lucasta quit (Quit: Leaving) |
01:22:05 | * | xet7 joined #nim |
02:14:49 | * | rockcavera quit (Remote host closed the connection) |
02:33:19 | FromDiscord | <.tokyovigilante> Dumb question, but how do I return early from a function? |
02:34:47 | FromDiscord | <.tokyovigilante> Or more accurately a template, maybe that's why `return` isn't working |
02:40:43 | FromDiscord | <Elegantbeef> You use a block and do `break blockname` |
02:40:48 | FromDiscord | <Elegantbeef> Then you question whether you need a template |
02:45:16 | FromDiscord | <.tokyovigilante> ta, thanks. It's for a conditional log, ie if level < loglevel: return, but if level >= log: doLog() works as well |
02:45:34 | FromDiscord | <.tokyovigilante> (edit) "if" => "`if" | "return," => "return`," | "level" => "`level" | "doLog()" => "doLog()`" |
02:47:30 | * | xutaxkamay quit (Ping timeout: 246 seconds) |
02:48:03 | * | xutaxkamay joined #nim |
02:51:23 | FromDiscord | <Elegantbeef> What is the full template? |
03:31:25 | FromDiscord | <.tokyovigilante> sent a code paste, see https://play.nim-lang.org/#pasty=oPxtoqbx |
03:32:39 | FromDiscord | <Elegantbeef> Ah the instantiation info is needed, carry on |
05:21:08 | * | SchweinDeBurg quit (Quit: WeeChat 4.5.0-dev) |
05:25:04 | * | SchweinDeBurg joined #nim |
06:41:04 | FromDiscord | <riku5543> sent a code paste, see https://play.nim-lang.org/#pasty=ZjXchhTx |
06:42:02 | FromDiscord | <odexine> where is this await placed |
06:42:40 | FromDiscord | <riku5543> sent a code paste, see https://play.nim-lang.org/#pasty=EnQorpTL |
06:42:53 | FromDiscord | <odexine> how do you then call connect |
06:43:28 | FromDiscord | <riku5543> sent a code paste, see https://play.nim-lang.org/#pasty=eLDjFBiF |
06:43:57 | FromDiscord | <Elegantbeef> Do you have a `runForever()` or similar blocking call? |
06:44:16 | FromDiscord | <riku5543> Yeah I'm using webui and there's a proc called wait() that waits for the window to be closed |
06:44:36 | FromDiscord | <odexine> does it call `poll()` from asyncdispatch |
06:44:53 | FromDiscord | <odexine> because if it doesnt then that means your futures arent actually being run |
06:45:44 | FromDiscord | <riku5543> Hm it's in C land so I have no idea what it does.. |
06:45:51 | FromDiscord | <Elegantbeef> So yes it doesn't |
06:46:13 | FromDiscord | <riku5543> Is there a way to get them to work together? |
06:46:34 | FromDiscord | <Elegantbeef> Is there a bool or similar you could use instead? |
06:47:08 | FromDiscord | <riku5543> Hm for what? |
06:47:32 | FromDiscord | <Elegantbeef> sent a code paste, see https://play.nim-lang.org/#pasty=kVBUegFE |
06:49:40 | FromDiscord | <riku5543> Does poll block forever? |
06:49:48 | FromDiscord | <riku5543> I'm trying to figure out where to put it |
06:50:03 | FromDiscord | <odexine> poll has to run inside a loop |
06:50:09 | Amun-Ra | no |
06:50:28 | FromDiscord | <odexine> well, "has to" in the sense that it would be most useful if it were... |
06:51:03 | FromDiscord | <riku5543> sent a code paste, see https://play.nim-lang.org/#pasty=OVIhYGrp |
06:51:05 | FromDiscord | <odexine> it just runs "one increment" of a future: aka if there are futures ready now it works on those then stops, so it blocks a little at a time |
06:51:19 | FromDiscord | <odexine> you need to somehow modify wait to include poll inside it |
06:51:36 | FromDiscord | <odexine> or replicate the function of wait and add poll inside it |
06:53:26 | FromDiscord | <riku5543> I think I could replace it with a check to see if the window is running and call poll in the meantime. Can I use os.sleep with this or should I just let it run real fast? |
06:53:40 | FromDiscord | <Elegantbeef> Never use sleep in your main loop |
06:53:52 | FromDiscord | <Elegantbeef> What webui library are you using? |
06:53:59 | FromDiscord | <odexine> let it run real fast or change the timeout on poll i guess? |
06:54:13 | FromDiscord | <riku5543> In reply to @Elegantbeef "What webui library are": https://github.com/webui-dev/nim-webui this one |
06:54:59 | FromDiscord | <riku5543> Alright I'll try that, thanks for the help, I never knew poll was required for await. (I'm guessing runForever calls it already, huh? \:P) |
06:55:23 | FromDiscord | <odexine> it does |
06:55:33 | FromDiscord | <Elegantbeef> sent a code paste, see https://play.nim-lang.org/#pasty=RkMwqLHq |
06:55:39 | FromDiscord | <odexine> `pol()` |
06:55:40 | FromDiscord | <odexine> lol |
06:55:42 | FromDiscord | <_.heartlove._> pol() |
06:55:55 | FromDiscord | <riku5543> p o l a n d |
06:56:01 | FromDiscord | <Elegantbeef> I swear I'm not a greentexter |
06:57:28 | FromDiscord | <riku5543> sent a code paste, see https://play.nim-lang.org/#pasty=FLXWiNAI |
06:57:40 | FromDiscord | <Elegantbeef> Why |
06:57:54 | FromDiscord | <Elegantbeef> sent a code paste, see https://play.nim-lang.org/#pasty=OcSJKejz |
06:58:08 | FromDiscord | <riku5543> Oh yeah that's how you can use braincells |
06:58:12 | FromDiscord | <riku5543> Mine are rusty |
06:59:17 | FromDiscord | <odexine> uh oh |
07:03:40 | FromDiscord | <riku5543> Hm it says "No handles or timers registered in dispatcher." even if it reaches the await later in the program |
07:04:14 | FromDiscord | <Elegantbeef> If only the try except was shown |
07:04:23 | FromDiscord | <Elegantbeef> Too bad someone removed it cause they thought they knew better š |
07:04:51 | FromDiscord | <riku5543> sent a code paste, see https://play.nim-lang.org/#pasty=kxYggEUK |
07:05:00 | FromDiscord | <riku5543> But it's just the same message no matter what lol |
07:06:40 | FromDiscord | <riku5543> I'm going to try a smaller program to see if I can figure stuff out |
07:06:56 | FromDiscord | <Elegantbeef> Well it should work now |
07:07:07 | FromDiscord | <Elegantbeef> That exception is to be expected if there are no futures to complete |
07:08:04 | FromDiscord | <Elegantbeef> There is `hasPendingOperations` you might be able to defend `poll` with |
07:08:31 | FromDiscord | <riku5543> Ooh good to know |
07:08:33 | FromDiscord | <riku5543> Thanks |
07:09:41 | FromDiscord | <Elegantbeef> To explain further about async. Since it's just a cpu time share, you have to explicitly give up your cpu to process futures that are ready. As such you need to use `poll` `await` `drain` `waitfor` to say "ok look at the futures in the pool and finish any that are ready" |
07:23:15 | * | PMunch joined #nim |
07:43:35 | FromDiscord | <riku5543> sent a code paste, see https://play.nim-lang.org/#pasty=PzACqjTP |
07:48:21 | FromDiscord | <Elegantbeef> Are you sure `window.shown` is true? |
07:48:54 | FromDiscord | <riku5543> Yeah heh, I placed a plain `echo` there with no conditions and it constantly runs until the window is closed |
07:49:23 | FromDiscord | <Elegantbeef> So then just do the try except and call it a day |
07:52:43 | FromDiscord | <riku5543> sent a code paste, see https://play.nim-lang.org/#pasty=AOOCIICP |
08:00:20 | FromDiscord | <riku5543> Does the regular `net` library work with multiple threads? I might try that instead |
08:01:30 | * | fallback quit (Ping timeout: 260 seconds) |
08:05:35 | FromDiscord | <Elegantbeef> Of course it does, were you attempting to use async with threads? |
08:05:46 | FromDiscord | <Elegantbeef> Cause each thread gets it's own event pool |
08:07:34 | FromDiscord | <riku5543> No it was all on one thread, I think something is incompatible though so I'm trying out malebolgia |
08:17:23 | * | fallback joined #nim |
08:26:19 | FromDiscord | <enthus1ast.> I would not use async network in the main gui thread. It kinda works but not good, at least I would use one network thread |
08:27:06 | FromDiscord | <enthus1ast.> If you nevertheless want/try this, make the poll timeout very small (25?!l |
08:29:01 | FromDiscord | <riku5543> sent a code paste, see https://play.nim-lang.org/#pasty=xRPSAbtZ |
08:36:48 | FromDiscord | <enthus1ast.> Never do network code without try except, it can fail in many ways (I get it, it's debugging code). I don't know the webgui lib you're using, but I guess it runs its own event loop, so in case of async networking you should call poll in an timer/timeout (or something similar). Or directly in a thread. I also don't know malbolgia ^^ but it could be that it spawns stuff also on the main thread |
08:37:43 | FromDiscord | <enthus1ast.> To be honest, I still like to use the boring old threads |
08:37:54 | FromDiscord | <enthus1ast.> Threads and channels |
08:42:03 | FromDiscord | <riku5543> sent a code paste, see https://play.nim-lang.org/#pasty=KJWgqfSi |
09:15:52 | FromDiscord | <enthus1ast.> When you use async you would have async handlers for the network, so there would be stuff pending. In your debug code there is none after you connect, so to avoid this you can asyncCheck a sleepAsync loop |
09:23:21 | * | Jjp137 quit (Ping timeout: 246 seconds) |
09:26:39 | * | Jjp137 joined #nim |
10:13:47 | FromDiscord | <riku5543> I figured out a working combo. I have to use blocking networking and have the ui start a new thread for it. If exceptions aren't caught here, the proc will hang, but if I use try/except, it actually works fine surprisingly |
10:18:30 | FromDiscord | <riku5543> And now that I think about it, I'm not sure if it's hanging per se or if the proc just stops executing entirely since it encountered an error, honestly that seems more reasonable lol. |
10:18:48 | FromDiscord | <riku5543> Coding late at night while sick is fun |
10:20:48 | FromDiscord | <riku5543> (Oh yeah I couldn't use async stuff cause it seems to not work on the main thread while using webui, and since I have to make a new thread anyway, using regular net works fine) |
10:52:34 | FromDiscord | <enthus1ast.> yes, i just had a look at the webui (it looks quite cool ngl) |
10:53:02 | FromDiscord | <enthus1ast.> but it seems to miss a function where you can create a reoccuring task on the backend |
10:53:35 | FromDiscord | <enthus1ast.> so so far the only option i see to use the async stuff in the main thread is to drive the poll from the js, but this is kinda weird š |
10:53:59 | FromDiscord | <enthus1ast.> or just not do it |
10:54:14 | FromDiscord | <enthus1ast.> you can even create a networking thread and setup the async networking there |
10:54:20 | FromDiscord | <enthus1ast.> (edit) "even" => "" |
12:13:34 | FromDiscord | <konan_5> hello, hereāµis there any opportunity to work with you/ |
12:14:43 | PMunch | There is a jobs channel on Discord |
12:15:10 | PMunch | Not sure if that is what you're looking for |
12:15:16 | PMunch | Also a 90% chance this is just spam.. |
12:36:22 | * | beholders_eye joined #nim |
12:43:15 | * | beholders_eye quit (Ping timeout: 276 seconds) |
12:43:42 | * | beholders_eye joined #nim |
13:39:40 | * | ntat joined #nim |
13:41:08 | FromDiscord | <Jack> Yeah, they've spammed this in other rooms too.āµ(<@709044657232936960_=50=4dunch=5b=49=52=43=5d>) |
13:49:22 | FromDiscord | <Jack> If anybody is looking to start contributing towards Nim itself, the project's repository can be found [here](https://github.com/nim-lang/Nim). If you looking for something else, a variety of Nim projects can be found [here](https://github.com/topics/nim). |
14:20:47 | FromDiscord | <Jack> If anybody is looking to start contributing towards Nim itself, the project's repository can be found [here](https://github.com/nim-lang/Nim). If you are looking for something else, a variety of Nim projects can be found [here](https://github.com/topics/nim). |
14:34:58 | PMunch | Why are you telling the Nim community where to find Nim stuff? We already know.. |
14:35:03 | * | beholders_eye quit (Ping timeout: 276 seconds) |
14:36:19 | * | beholders_eye joined #nim |
14:40:27 | FromDiscord | <grumblygibson> In reply to @enthus1ast. "so so far the": I have also been looking for this. Maybe the abandoned Neel? webui and webGui and nimview all have some internal event loop that prevents the backend from being the driver. It's possible that interacting with the js layer is a way around this: server sends a js call, the page refreshes, and actually displays. |
14:42:14 | FromDiscord | <odexine> In reply to @PMunch "Why are you telling": im assuming that was to konan_5 |
14:42:48 | PMunch | Oh right |
15:01:50 | * | ntat quit (Quit: Leaving) |
15:12:42 | FromDiscord | <enthus1ast.> In reply to @grumblygibson "I have also been": I guess that's the way for this lib. I did not see any API in the c code. But I might have missed it |
15:17:48 | * | PMunch quit (Quit: Leaving) |
17:06:20 | * | coldfeet joined #nim |
17:11:39 | * | coldfeet quit (Remote host closed the connection) |
17:51:11 | * | lx12ucy joined #nim |
17:52:26 | lx12ucy | hi! i'm a bit confused as to why I'm not able to access fields of a custom type initialized in a seperate file and returned by a proc |
17:53:12 | lx12ucy | I'm able to echo the variable for the type correctly, but it gives me an error if i try to echo anything more specific |
17:53:32 | lx12ucy | echo(configuration) gives (nerdfonts: true, box: true, boxLogo: true, roundCorners: true, login: true, logo: "auto", separator: " ā ", colorSymbol: "ā", titleColor: "cyan", dataColor: "blue", otherColor: "magenta") |
17:53:55 | lx12ucy | but echo(configuration.nerdfonts) is an error, is this an intended behavior? |
17:54:59 | lx12ucy | says "Error: undeclared field: 'nerdfonts' for type config.Config" |
17:55:09 | FromDiscord | <planetis_m> In reply to @lx12ucy "but echo(configuration.nerdfonts) is an": You need to export the fields first, using the marker |
17:55:55 | lx12ucy | ohh |
17:57:21 | lx12ucy | where does that go? |
17:59:08 | FromDiscord | <odexine> after the field name before the colon |
17:59:33 | FromDiscord | <demotomohiro> https://nim-lang.org/docs/manual.html#modules |
18:00:12 | FromDiscord | <demotomohiro> sent a code paste, see https://play.nim-lang.org/#pasty=yUzolXnH |
18:01:56 | lx12ucy | yay! thank you! |
18:03:18 | * | coldfeet joined #nim |
18:04:12 | * | lx12ucy quit (Quit: application quit, bye!) |
18:13:31 | * | coldfeet quit (Remote host closed the connection) |
18:20:10 | * | lx12ucy joined #nim |
18:21:41 | * | lx12ucy quit (Client Quit) |
18:30:36 | * | coldfeet joined #nim |
18:37:00 | * | coldfeet quit (Remote host closed the connection) |
18:51:24 | FromDiscord | <k0ts> We need to rustify our error messages |
18:51:33 | FromDiscord | <k0ts> Hint: did you forget to export it? |
19:14:35 | FromDiscord | <guttural666> is there a way to specify the type of an enum? say uint8? |
19:25:38 | FromDiscord | <demotomohiro> For wrapping C enum types: https://nim-lang.org/docs/manual.html#implementation-specific-pragmas-size-pragma |
19:31:23 | * | ntat joined #nim |
19:33:32 | FromDiscord | <guttural666> sent a code paste, see https://play.nim-lang.org/#pasty=ccDZtnRJ |
19:36:34 | FromDiscord | <guttural666> In reply to @demotomohiro "For wrapping C enum": sorry, this actually does what I want |
19:36:35 | FromDiscord | <guttural666> thanks |
20:01:53 | * | beholders_eye quit (Ping timeout: 248 seconds) |
20:22:23 | FromDiscord | <aethrvmn_32073> Hey guys, is this expected behaviour?āµāµhttps://play.nim-lang.org/#pasty=MrwnTteR |
20:22:36 | FromDiscord | <aethrvmn_32073> If so, what am I missing? |
20:25:26 | FromDiscord | <bubbly_avocado_86424> nim documentation is almost great really |
20:25:29 | FromDiscord | <bubbly_avocado_86424> yet, not |
20:26:43 | FromDiscord | <Jack> Not necessarily them, but people like them.āµ(@odexine) |
20:26:47 | FromDiscord | <Elegantbeef> @aethrvmn_32073 seems the playground is having issues, throw it somewhere else I guess |
20:29:46 | FromDiscord | <aethrvmn_32073> In reply to @Elegantbeef "<@1292739848053981250> seems the playground": https://pastebin.com/bdteDX4U |
20:33:24 | FromDiscord | <solitudesf> In reply to @aethrvmn_32073 "https://pastebin.com/bdteDX4U": this is expected. defaults are assigned with `ObjectConstructor()` (which tuples dont have) or with `default` |
20:34:13 | FromDiscord | <aethrvmn_32073> In reply to @solitudesf "this is expected. defaults": what part of the docs has gone completely over my head? |
20:34:23 | FromDiscord | <aethrvmn_32073> aka where do I learn more about this? |
20:34:33 | FromDiscord | <solitudesf> In reply to @aethrvmn_32073 "what part of the": https://nim-lang.org/docs/manual.html#types-default-values-for-object-fields |
20:35:13 | FromDiscord | <Elegantbeef> Use objects then your life is better |
20:36:03 | FromDiscord | <Elegantbeef> https://nim-lang.org/docs/manual.html#types-tuples-and-object-types aswell as here |
20:36:25 | FromDiscord | <Elegantbeef> Tuples are structurally typed which means `var a: tuple[a, b: int] = (10, 20)` is valid |
20:37:56 | FromDiscord | <Elegantbeef> If you wanted a named tuple you can of course do `var a = (a: 10, b: 20)` but use an object š |
20:38:16 | FromDiscord | <aethrvmn_32073> In reply to @Elegantbeef "If you wanted a": I'm trying to figure all these out rn hahaha |
20:38:27 | FromDiscord | <aethrvmn_32073> thanks alot! |
20:41:25 | FromDiscord | <Elegantbeef> Objects are nominally typed if you want to understand the difference |
20:43:22 | FromDiscord | <bubbly_avocado_86424> In reply to @k0ts "We need to rustify": i just spent over one hour to find out āµvar webb = newHttpClient(sslContext=(newContext(verifyMode=CVerifyNone))āµāµis not working because i had to import the std/net module also |
20:47:38 | FromDiscord | <bubbly_avocado_86424> makes sense now but hey, i guess this is what i takes to learn by doing |
20:48:41 | FromDiscord | <Elegantbeef> Nim is very adhoc so how would it error more |
20:48:42 | FromDiscord | <solitudesf> it takes two seconds to see which module has `newContext`. what error are you expecting there |
20:48:48 | FromDiscord | <Elegantbeef> Iterate all modules in your nimble path searching for `newContext`? |
20:49:09 | FromDiscord | <bubbly_avocado_86424> well, that not how i went about |
20:51:19 | FromDiscord | <bubbly_avocado_86424> i started search in the httpclient module and did not notice i ended up in the net module (sigh) |
20:59:53 | * | lucasta joined #nim |
21:10:44 | FromDiscord | <TFed> i want to make function, that updates object's contentāµāµlike set function, clean and init functions |
21:12:41 | FromDiscord | <TFed> sent a code paste, see https://play.nim-lang.org/#pasty=KCjeiDiT |
21:12:59 | FromDiscord | <TFed> sent a code paste, see https://play.nim-lang.org/#pasty=EDmpvvSc |
21:13:10 | FromDiscord | <TFed> sent a code paste, see https://play.nim-lang.org/#pasty=PgmluXRl |
21:13:51 | FromDiscord | <TFed> sent a code paste, see https://play.nim-lang.org/#pasty=OnuQyBFP |
21:13:59 | FromDiscord | <TFed> [Edit](https://discord.com/channels/371759389889003530/371759389889003532/1306003271361761363): i want to make function, that updates object's contentāµāµlike does set, clean and init functions |
21:14:42 | * | ftajhii joined #nim |
21:14:59 | FromDiscord | <TFed> sent a code paste, see https://play.nim-lang.org/#pasty=sXZNBmgK |
21:15:07 | FromDiscord | <TFed> sent a code paste, see https://play.nim-lang.org/#pasty=prUaFftL |
21:17:11 | FromDiscord | <Elegantbeef> Discord is really loving all the edits |
21:17:25 | FromDiscord | <Elegantbeef> if `Pack` is an `object` you need to take in `var Pack` |
21:18:35 | ftajhii | I've decided to tinker with Nim, what would be a good repo to follow for someone wanting to learn the language? |
21:27:41 | * | zgasma joined #nim |
21:37:59 | * | ntat quit (Quit: Leaving) |
21:38:05 | FromDiscord | <bubbly_avocado_86424> In reply to @ftajhii "I've decided to tinker": here ? https://nim-lang.org/docs/lib.html |
22:43:11 | FromDiscord | <aethrvmn_32073> In reply to @TFed "i want to make": if you're messing around with the object it might be better to use `ref object` instead |
22:43:35 | FromDiscord | <aethrvmn_32073> so you dont have to carry the `var` on every proc you define |
22:48:52 | * | disso-peach joined #nim |
22:51:55 | FromDiscord | <bosinski2023> sent a code paste, see https://play.nim-lang.org/#pasty=kDCGVoBn |
22:52:33 | FromDiscord | <Elegantbeef> This is a bad suggestionāµ(@aethrvmn_32073) |
22:52:52 | FromDiscord | <aethrvmn_32073> doesn't it depend on the usecase? |
22:52:53 | FromDiscord | <Elegantbeef> You need to put it in another macro |
22:53:07 | FromDiscord | <Elegantbeef> Exactly only use `ref` if you need ref semantics |
22:53:09 | FromDiscord | <Elegantbeef> Not cause you're lazy |
22:53:58 | FromDiscord | <Elegantbeef> sent a code paste, see https://play.nim-lang.org/#pasty=SQpJUtVp |
23:15:46 | * | rockcavera joined #nim |
23:47:57 | * | disso-peach quit (Quit: Leaving) |