00:11:37 | * | krux02 quit (Remote host closed the connection) |
00:17:31 | * | krux02 joined #nim |
00:24:36 | * | jmdaemon quit (Ping timeout: 240 seconds) |
00:26:09 | * | jmdaemon joined #nim |
00:27:57 | girvo | Hah "using in anger" is a turn of phrase, no actual anger, just means "for real" :) |
00:28:21 | girvo | Using it to build our IoT platforms firmware on the ESP32 platform with our custom boards |
00:29:32 | FromDiscord | <Elegantbeef> Ah sounds fun |
00:30:09 | girvo | Challenging for sure, as ESP-IDF's compilers are... um... not great haha. But beats the crap out of doing it in raw C or god forbid C++ |
00:43:06 | girvo | Fun challenge. So nimbase.h for 1.6.4 seems to complain when I'm trying to use it within ESP-IDF |
00:43:13 | girvo | // Test to see if Nim and the C compiler agree on the size of a pointer. |
00:43:16 | girvo | NIM_STATIC_ASSERT(sizeof(NI) == sizeof(void*) && NIM_INTBITS == sizeof(NI)*8, ""); |
00:45:58 | girvo | Nim/this C compiles int size doesn't match the pointer size I guess? Can I fix that somehow? |
00:46:32 | FromDiscord | <Elegantbeef> are you compiling with the right flags? |
00:46:46 | FromDiscord | <Elegantbeef> inotherwords is your `arch` set properly? |
00:47:18 | girvo | Great question actually, let me check |
00:47:43 | girvo | Though in this case, Nim isn't delegating to the toolchain, PlatformIO runs the C toolchain -- I'm outputting compileOnly C files instead |
00:48:20 | FromDiscord | <Elegantbeef> Sure but if Nim assumes the arch you're compiling for is 64bit but the target is 32bit that'll cause the issue afaik |
00:49:19 | girvo | Yeah bang on :) |
00:49:23 | girvo | I'm looking into that now, cheers |
00:50:20 | girvo | Hah thank the guy who added --cpu:esp -- its working :) |
00:50:34 | girvo | Cheers mate! |
00:51:04 | FromDiscord | <Elegantbeef> Cant tell if aussie or brit, either no problem 😛 |
00:52:50 | girvo | Aussie ;) |
00:53:08 | girvo | My firmware built, deployed, and is now yelling "another test" at me over serial lol |
00:55:15 | FromDiscord | <Elegantbeef> Test failed successfully |
01:01:54 | * | Gustavo6046 quit (Ping timeout: 252 seconds) |
01:03:27 | * | Gustavo6046 joined #nim |
01:12:42 | girvo | So I'm currently trying to write a dodgy build task, to make the constant "cd src/ && nim c main.nim (now repeat for every nim file)" but its been a long while since I tried to |
01:13:10 | girvo | I've quickly attempted to within the `project.nimble` file as a task build_example -- but getParams, and other nimscript API things I expected are apparently not there? |
01:14:46 | FromDiscord | <Elegantbeef> sent a code paste, see https://paste.rs/Bhn |
01:15:12 | FromDiscord | <Elegantbeef> https://nim-lang.org/docs/nimscript.html will have the api you need to use |
01:16:07 | girvo | I can write an `import` within the core project.nimble no worries? per-task, or above it? |
01:16:14 | girvo | And yeah that's the API I was trying to use :) |
01:16:26 | FromDiscord | <Elegantbeef> you will need to write it at top level |
01:16:29 | FromDiscord | <Elegantbeef> Imports have to be top level |
01:18:59 | * | jmdaemon quit (Ping timeout: 272 seconds) |
01:20:42 | * | jmdaemon joined #nim |
01:24:53 | girvo | Okay sweet |
01:25:01 | girvo | Been ages since I did any Nimble/nimscript work |
01:30:37 | * | jmdaemon quit (Ping timeout: 240 seconds) |
01:32:30 | FromDiscord | <Patitotective> I don't know why but when I try to generate the documentation for my code there's an error with the `runnableExamples` saying that `toOrderedTable` identifier is not defined and I'm not sure why since if I run the "example" in that file it works and it is importing `std/tables`↵(Not sure if the error message is helpful, here it is https://play.nim-lang.org/#ix=3R35) |
01:33:19 | FromDiscord | <Elegantbeef> sent a code paste, see https://paste.rs/KTE |
01:33:26 | FromDiscord | <Patitotective> sent a code paste, see https://play.nim-lang.org/#ix=3R36 |
01:33:54 | FromDiscord | <Patitotective> sent a code paste, see https://play.nim-lang.org/#ix=3R37 |
01:33:58 | FromDiscord | <Elegantbeef> It very much should |
01:34:00 | FromDiscord | <Patitotective> (edit) "https://play.nim-lang.org/#ix=3R37" => "https://paste.rs/Hbv" |
01:34:12 | FromDiscord | <Elegantbeef> `bindSym"toOrderedTable"` |
01:34:23 | FromDiscord | <Elegantbeef> make sure that file with that macro imports tables |
01:37:14 | FromDiscord | <Patitotective> sent a code paste, see https://paste.rs/C2k |
01:37:28 | FromDiscord | <Elegantbeef> Nice private repo |
01:37:42 | FromDiscord | <Patitotective> LOL |
01:37:42 | FromDiscord | <Patitotective> sorry |
01:37:45 | FromDiscord | <Patitotective> 😢 |
01:38:26 | FromDiscord | <Patitotective> done 🙃 |
01:39:07 | FromDiscord | <Patitotective> oh, and here is the line https://github.com/Patitotective/niprefs/blob/main/src/niprefs/prefsnode.nim#L151↵sorry |
01:40:02 | FromDiscord | <Elegantbeef> What does teh file it generate look like? |
01:40:12 | FromDiscord | <Elegantbeef> `/home/cristobal/.cache/nim/niprefs_d/runnableExamples/prefsnode_examples_1.nim` |
01:41:03 | FromDiscord | <Patitotective> sent a code paste, see https://play.nim-lang.org/#ix=3R38 |
01:47:57 | * | ltriant quit (Ping timeout: 256 seconds) |
01:49:29 | FromDiscord | <Elegantbeef> No clue why it's erroring then, perhaps just use codeblock |
01:50:03 | girvo | Hah I just realised my mistake. I was trying to call a non-exported proc from nimscriptapi |
01:50:28 | * | jjido quit (Quit: My MacBook Air has gone to sleep. ZZZzzz…) |
01:52:52 | FromDiscord | <Patitotective> sent a code paste, see https://play.nim-lang.org/#ix=3R3a |
01:53:14 | FromDiscord | <Elegantbeef> No there is proper codeblocks |
01:53:17 | FromDiscord | <Patitotective> (edit) "https://play.nim-lang.org/#ix=3R3a" => "https://paste.rs/a8N" |
01:53:45 | FromDiscord | <Patitotective> 😕 |
01:53:56 | FromDiscord | <Patitotective> (edit) "😕" => "+😕" |
01:55:14 | FromDiscord | <Patitotective> how? |
01:55:55 | FromDiscord | <Elegantbeef> How what |
01:56:28 | FromDiscord | <Patitotective> what are codeblocks? |
01:56:39 | FromDiscord | <Elegantbeef> What i just showed you |
01:57:09 | FromDiscord | <Patitotective> huh? what did you show me 😕 |
01:57:17 | FromDiscord | <Elegantbeef> https://github.com/nim-lang/Nim/blob/devel/lib/system.nim#L2325-L2333 |
01:57:22 | FromDiscord | <Elegantbeef> Matrix bridge didnt like it |
01:58:18 | FromDiscord | <Patitotective> sent a code paste, see https://play.nim-lang.org/#ix=3R3b |
01:58:24 | FromDiscord | <Patitotective> (edit) "https://play.nim-lang.org/#ix=3R3b" => "https://paste.rs/rGr" |
01:58:28 | FromDiscord | <Elegantbeef> No codeblocks like i showed render like runnable examples |
01:58:45 | FromDiscord | <Elegantbeef> What you showed shows as a doc comment not rendered code |
02:11:43 | FromDiscord | <Patitotective> worked thanks 🙃 |
02:15:32 | FromDiscord | <Patitotective> the search section in the generated docs needs something to work? it's not working for me locally 😕 |
02:15:35 | girvo | Hooray. PlatformIO integration is now working wonderfully. Can in theory work with _any_ arch that Nim supports for embedded work. Bit of extra stuff to add and wrap up but its working well |
02:31:20 | * | jmdaemon joined #nim |
02:40:10 | * | vicfred quit (Quit: Leaving) |
02:40:42 | * | krux02 quit (Remote host closed the connection) |
03:04:38 | * | ltriant joined #nim |
03:05:31 | * | girvo quit (Remote host closed the connection) |
03:06:37 | * | girvo joined #nim |
04:06:02 | * | supakeen quit (Quit: WeeChat 3.4) |
04:06:32 | * | supakeen joined #nim |
04:19:11 | * | arkurious quit (Quit: Leaving) |
04:19:49 | * | jmdaemon quit (Ping timeout: 256 seconds) |
04:31:47 | * | cornfeedhobo quit (Quit: ZNC - https://znc.in) |
04:52:17 | * | jmdaemon joined #nim |
05:41:53 | * | slowButPresent quit (Quit: leaving) |
05:42:53 | * | ltriant quit (Ping timeout: 256 seconds) |
05:43:09 | * | ltriant joined #nim |
05:43:42 | * | wyrd quit (Read error: Connection reset by peer) |
05:48:54 | * | wyrd joined #nim |
06:17:41 | * | ltriant quit (Ping timeout: 256 seconds) |
06:20:37 | * | wyrd quit (Remote host closed the connection) |
06:20:51 | * | wyrd joined #nim |
06:44:39 | * | kenran joined #nim |
06:54:18 | * | ltriant joined #nim |
07:00:20 | * | ltriant quit (Ping timeout: 272 seconds) |
07:07:16 | FromDiscord | <Sense> I wish Nim docs were a bit better. |
07:11:03 | FromDiscord | <Elegantbeef> Do they have you stymied ? |
07:11:35 | FromDiscord | <congusbongus> I usually learn new languages by asking dumb questions on stack overflow |
07:30:01 | * | ltriant joined #nim |
07:34:37 | * | ltriant quit (Ping timeout: 240 seconds) |
07:35:42 | * | icebattle quit (Ping timeout: 252 seconds) |
07:35:55 | * | icebattle joined #nim |
07:45:24 | FromDiscord | <retkid> hey so |
07:45:46 | FromDiscord | <retkid> whats happening with my async? |
07:46:04 | FromDiscord | <retkid> its automatically waiting for it to complete which is making its asyncness completely irrelevant |
07:46:16 | * | girvo quit (Read error: Connection reset by peer) |
07:46:22 | FromDiscord | <Elegantbeef> Ah looking at your code the issue is clear |
07:46:25 | FromDiscord | <Rika> On first call the async is run until the first yield |
07:46:45 | FromDiscord | <Rika> I don’t know why exactly that is done but it is |
07:47:37 | FromDiscord | <retkid> In reply to @Rika "On first call the": no but all of them in the loop are |
07:47:46 | FromDiscord | <Rika> What |
07:48:11 | FromDiscord | <enthus1ast> i dont see his code \:/ |
07:48:18 | FromDiscord | <Elegantbeef> That's the joke |
07:48:24 | FromDiscord | <enthus1ast> ah ok |
07:48:32 | FromDiscord | <retkid> not in an async proc |
07:48:32 | FromDiscord | <Rika> Your joke is not obvious that it is |
07:48:34 | FromDiscord | <retkid> sent a code paste, see https://paste.rs/PMx |
07:48:37 | FromDiscord | <retkid> No i got it |
07:49:18 | FromDiscord | <retkid> between the echo it does not wait |
07:49:27 | FromDiscord | <retkid> (edit) "it does not wait" => "waits" |
07:49:29 | FromDiscord | <enthus1ast> but sleep there |
07:49:32 | FromDiscord | <enthus1ast> pu |
07:49:32 | FromDiscord | <enthus1ast> t |
07:49:37 | FromDiscord | <retkid> thats not............ |
07:49:45 | FromDiscord | <Rika> What is the async proc |
07:49:59 | FromDiscord | <Rika> If there’s a lot of code before the first time you await in the proc, then that’s why |
07:50:01 | FromDiscord | <retkid> some http stuff |
07:50:02 | FromDiscord | <enthus1ast> or↵for idx in 0..10000\: shasum("troll?") |
07:50:06 | FromDiscord | <Rika> That part before the first await is still run |
07:50:22 | FromDiscord | <enthus1ast> thats called busy wait ya know |
07:50:41 | FromDiscord | <Rika> I do not know what your point is enthusiast |
07:51:00 | FromDiscord | <retkid> no theres no code between each execution apart form the async function itself |
07:51:10 | FromDiscord | <retkid> thats literally the entire loop |
07:51:24 | FromDiscord | <Rika> Yes what is the async proc |
07:51:25 | FromDiscord | <retkid> sent a code paste, see https://paste.rs/7Y1 |
07:51:41 | FromDiscord | <retkid> http code |
07:51:46 | FromDiscord | <retkid> just fetches websites |
07:51:48 | FromDiscord | <retkid> nothing big |
07:51:57 | FromDiscord | <retkid> though there is time to wait |
07:51:58 | FromDiscord | <Rika> From the top of that proc down to the first time you await in the proc, that is still run in the loop |
07:52:58 | FromDiscord | <retkid> if all the code is being run in a completely non parallel way then why am i doing async at all |
07:53:00 | * | PMunch joined #nim |
07:53:05 | FromDiscord | <Rika> It’s not parallel |
07:53:08 | FromDiscord | <Rika> Async is not parallel |
07:53:22 | FromDiscord | <retkid> im aware its not parallel i just dont know the word of the top of my head to describe it |
07:53:26 | FromDiscord | <Rika> Concurrent? |
07:53:27 | FromDiscord | <enthus1ast> @Rika\: i think the bridge did not work, i just don't see any code |
07:53:32 | * | icebattle quit (Ping timeout: 240 seconds) |
07:53:35 | FromDiscord | <retkid> yes |
07:53:46 | FromDiscord | <Rika> It won’t make any difference if the code above the await was run in the loop or not really |
07:53:46 | * | icebattle joined #nim |
07:53:53 | FromDiscord | <Rika> in this case |
07:54:10 | FromDiscord | <Rika> It will still run one by one until each proc awaits |
07:54:42 | FromDiscord | <retkid> well, I dont want it to run in a loop obviously, i want it to que up the procs then wait for all of them to be complete |
07:54:45 | FromDiscord | <Rika> It’s still concurrent |
07:54:57 | FromDiscord | <Rika> Yes it’s still gonna be concurrent in the end |
07:55:16 | PMunch | As long as the http fetching code is done correctly* |
07:55:33 | FromDiscord | <Rika> I assumed that was a given |
07:55:34 | FromDiscord | <enthus1ast> loop through the futures, check if theire done, if done await the result; in an endless loop |
07:55:44 | FromDiscord | <Rika> You don’t need to do that |
07:55:55 | FromDiscord | <enthus1ast> this way you can always add new stuff |
07:56:18 | FromDiscord | <retkid> In reply to @Rika "I assumed that was": even though instead of just adding the future to the sequence then continuing, its waiting for the code to return to then move onto the next one, it is somehow still concurrent? |
07:56:20 | FromDiscord | <Rika> If that’s what is desired then sure |
07:56:29 | FromDiscord | <Rika> In reply to @retkid "even though instead of": Yes |
07:56:39 | FromDiscord | <Rika> It isn’t waiting to return |
07:56:43 | FromDiscord | <Rika> It’s waiting to yield |
07:57:19 | FromDiscord | <retkid> so this is suppose to make any difference to my code in any way how? |
07:57:34 | FromDiscord | <retkid> sorry i might just be to dumb to understand how this isn't sequential |
07:57:51 | FromDiscord | <Rika> I’d draw if I could but I do not have my tablet |
07:58:09 | PMunch | Have you seen this @retkid https://peterme.net/asynchronous-programming-in-nim.html |
07:58:52 | FromDiscord | <Elegantbeef> Who's this peterme guy, probably a weirdo |
07:59:03 | FromDiscord | <retkid> i wonder |
07:59:04 | FromDiscord | <retkid> hmmmmm |
07:59:57 | FromDiscord | <retkid> alright I'm never touching async again and I'll just thread it |
08:00:07 | PMunch | @retkid, the way async works is that when you call `helloRika` it will run all the code until the first `await`. |
08:00:17 | FromDiscord | <Rika> That’s what I have been saying |
08:00:30 | * | krux02 joined #nim |
08:00:32 | PMunch | Multi-threading this kind of network access won't really give you much of a benefit though |
08:00:40 | FromDiscord | <Rika> I think you just need to understand the difference between concurrency and parallelism |
08:00:43 | PMunch | So you'd rather learn how to use both |
08:01:17 | FromDiscord | <fbpyr> sent a code paste, see https://play.nim-lang.org/#ix=3R4h |
08:01:34 | PMunch | Once it hits the first await, it takes the handle of the thing it is awaiting, adds it to the async dispatcher, and yields the control back to the caller. |
08:01:42 | FromDiscord | <retkid> In reply to @PMunch "Multi-threading this kind of": I dunno man, every single other language I have had no problems grasping asynchronous tasks,. |
08:01:53 | FromDiscord | <Elegantbeef> The first example shows how fbpyr https://github.com/disruptek/gittyup#usage |
08:02:02 | FromDiscord | <Rika> In reply to @retkid "I dunno man, every": And I assure you this is the same behaviour |
08:02:09 | PMunch | @retkid, asynchronous != multi-threaded |
08:02:09 | FromDiscord | <fbpyr> the example does not compile here. |
08:02:10 | FromDiscord | <retkid> even with pythons funky language shenanigans I was able to grasp it |
08:02:16 | FromDiscord | <retkid> In reply to @PMunch "<@217459674700578816>, asynchronous != multi-thread": I am aware of this |
08:02:17 | FromDiscord | <Elegantbeef> well `.get` |
08:02:19 | FromDiscord | <fbpyr> as in issue 2. |
08:02:31 | FromDiscord | <Rika> In reply to @retkid "even with pythons funky": Then I am unsure what the issue is here |
08:02:53 | FromDiscord | <Rika> Nothing major changed here |
08:03:04 | PMunch | @retkid, I'm not sure what you find particularly challenging with Nims async system, it works pretty much the same way as every other such system |
08:03:33 | FromDiscord | <fbpyr> sry, as in this issue\: https://github.com/disruptek/gittyup/issues/17 |
08:03:44 | FromDiscord | <retkid> I am as well because I dont quite understand why an asynchronous function would need to wait to complete a procs function before continuing in the host proc even though I've never encountered that in any other asynchronous situation |
08:04:12 | FromDiscord | <Elegantbeef> gittyup is using https://github.com/disruptek/badresults fbpyr |
08:04:17 | FromDiscord | <fbpyr> ..maybe I also misunderstood the "walrus opreator" there.. |
08:04:20 | FromDiscord | <retkid> that soungs much less like async and much more like a then b then c then d rather than a then b then a then c |
08:04:27 | FromDiscord | <Rika> It is just a slight difference in Nim. It is the same behaviour otherwise in Python and other languages |
08:04:33 | FromDiscord | <fbpyr> ahh thank you for the pointer [Elegantbeef](https://matrix.to/#/@elegantbeef:matrix.org) ! 🙂 |
08:04:49 | FromDiscord | <Rika> In reply to @Rika "It is just a": The behaviour is equivalent, I mean |
08:04:50 | FromDiscord | <Rika> Wholly |
08:04:57 | FromDiscord | <Elegantbeef> the `:=` afaict handles the error and assignment |
08:05:26 | PMunch | @retkid, try to throw in a small `await sleepAsync(0)` at the beginning of your `helloRika` procedure |
08:05:29 | FromDiscord | <Rika> There is no difference between running the first part of an async proc in the loop versus running the parts in the dispatcher |
08:05:46 | FromDiscord | <Rika> Since they will run one by one either way |
08:05:54 | FromDiscord | <Rika> And there is no time benefit |
08:06:04 | PMunch | That should make your procedure return control immediately, before running any more code |
08:06:18 | PMunch | I guess some frameworks might do this by default, but that seems a bit odd |
08:06:34 | FromDiscord | <Rika> It is |
08:06:38 | FromDiscord | <Rika> I found it odd at first |
08:07:01 | PMunch | That Nim doesn't do it, or that some languages do it? |
08:07:13 | FromDiscord | <Rika> Former |
08:07:41 | PMunch | Ah, I guess it all depends on what you're expecting |
08:08:38 | FromDiscord | <retkid> In reply to @PMunch "<@217459674700578816>, try to throw": that works however they are still returning separately with no cpu usage meaning that even though it skipped everything its still being executed sequentially |
08:08:43 | FromDiscord | <retkid> though |
08:08:45 | FromDiscord | <retkid> i can be wrong |
08:08:47 | FromDiscord | <Rika> ? |
08:08:55 | FromDiscord | <Rika> Of course they are you’re making them sequentially |
08:08:57 | FromDiscord | <Rika> I don’t get it |
08:08:59 | FromDiscord | <Elegantbeef> fbpyr i'd probably suggest using the walrus op given the conventions |
08:09:27 | FromDiscord | <retkid> In reply to @Rika "Of course they are": then how would i cause them to execute concurrently and not sequentially? |
08:09:37 | FromDiscord | <Rika> Those are not mutually exclusive. |
08:09:39 | PMunch | @retkid, again I'm not 100% sure you actually understand the difference between async and threading. Async will only run on a single thread, and if it is waiting for IO bound tasks it can easily end up just idling your CPU |
08:09:47 | FromDiscord | <retkid> yes |
08:09:57 | PMunch | If you don't have work to do for the CPU there is no reason for it to do anything |
08:10:24 | FromDiscord | <retkid> In reply to @PMunch "<@217459674700578816>, again I'm not": > waiting for IO bound tasks it can easily end up just idling your CPU↵Unless it is an OS / cpu level issue there should be no IO level bottleneck but i will check top |
08:10:30 | FromDiscord | <Rika> What? |
08:10:34 | FromDiscord | <fbpyr> walrus op, it looked elegant in the example(and I like it in python, too),↵but this is where I get the compile error - so trying it now with badresults.. 🙂 |
08:10:39 | FromDiscord | <Rika> A network call is an IO bottleneck |
08:11:05 | PMunch | If you don't have an IO bottleneck then async isn't what you're supposed to do |
08:11:06 | FromDiscord | <Elegantbeef> The walrus op is apart of gittyup |
08:11:18 | FromDiscord | <Rika> I’m confused |
08:11:21 | PMunch | The whole point of async is getting around IO bottlenecks |
08:11:39 | FromDiscord | <retkid> In reply to @Rika "A network call is": But didn't you tell me a while ago that I shouldn't crawl with threads? |
08:11:54 | FromDiscord | <retkid> if a network call is an io bottleneck shouldn't it be a threaded task? |
08:11:55 | PMunch | And by IO bottleneck I mean everything from file reads to network access |
08:11:59 | PMunch | No? |
08:12:05 | FromDiscord | <Rika> No? |
08:12:10 | FromDiscord | <Rika> IO -> async |
08:12:12 | PMunch | Again, the entire point of async is to get around IO bottlenecks |
08:12:21 | PMunch | Threads are for getting around CPU bottlenecks |
08:12:24 | FromDiscord | <retkid> alright this is going in circles and is completely pointless ¯\_(ツ)_/¯ |
08:12:32 | FromDiscord | <Rika> Well |
08:12:38 | FromDiscord | <Rika> If you say so, I guess |
08:12:39 | PMunch | Throwing more CPU power onto an IO bound problem will do nothing more than heat up your room |
08:12:58 | FromDiscord | <Rika> In reply to @PMunch "Throwing more CPU power": Not just your own room when it’s a network call 😄 |
08:13:00 | FromDiscord | <retkid> In reply to @PMunch "Throwing more CPU power": I dont know why you're telling me this when i explicitly said my cpu usage is low meaning that is not the bottleneck |
08:13:01 | FromDiscord | <Elegantbeef> It's a win win, i get my information at the same speed and my room is warm |
08:13:16 | FromDiscord | <Elegantbeef> You do know it's a single threaded operation |
08:13:20 | FromDiscord | <retkid> REALLY |
08:13:21 | FromDiscord | <Rika> In reply to @Elegantbeef "It's a win win,": True, sometimes that’s a win lol |
08:13:23 | FromDiscord | <retkid> you dont say? |
08:13:29 | FromDiscord | <Rika> In reply to @Elegantbeef "It's a win win,": But power usage isn’t |
08:13:30 | FromDiscord | <Elegantbeef> Meaning at most you can use 1 core, and in my case it's 12.5% of the entire cpu |
08:13:34 | FromDiscord | <retkid> holy shit |
08:13:37 | FromDiscord | <retkid> i never knew that |
08:13:43 | FromDiscord | <Elegantbeef> Nice sarcasm |
08:13:51 | FromDiscord | <Rika> Okay |
08:13:56 | FromDiscord | <Elegantbeef> Now just maybe channel it to someone else that actually wants to take it |
08:14:00 | FromDiscord | <Rika> This is getting a bit heated heh |
08:14:01 | FromDiscord | <Rika> But really |
08:14:04 | PMunch | Okay, let's take a step back here |
08:14:20 | FromDiscord | <Rika> You’re making a network call right? CPU isn’t the bottleneck here, as you say |
08:14:22 | FromDiscord | <retkid> my point was is that if the tasks are executing together at once on 1 cpu i'd be able to see the botlte neck by looking for any CPU being above like 75% |
08:14:27 | FromDiscord | <Elegantbeef> Nah i never retreat, into the breach is what i say |
08:14:30 | FromDiscord | <Rika> It’s IO right? Can we agree on this at least |
08:14:37 | PMunch | Not really |
08:15:00 | FromDiscord | <Rika> In reply to @retkid "my point was is": If the code isn’t saturating a single core then no |
08:15:06 | PMunch | Basically your OS gets interrupts from the network card when packets come in |
08:15:11 | FromDiscord | <Rika> Which is usually the case when doing networking stuff |
08:15:28 | FromDiscord | <Rika> In reply to @PMunch "Basically your OS gets": Oh man here we go semi-low-level stuff |
08:15:31 | FromDiscord | <retkid> https://media.discordapp.net/attachments/371759389889003532/948131357152911370/unknown.png |
08:15:32 | PMunch | So if all you're doing is sitting there waiting for network traffic the CPU will sit idle until the network card pings it with new data |
08:16:06 | FromDiscord | <Rika> In reply to @retkid "": What is your point with this image |
08:16:07 | PMunch | @retkid, not quite sure what you wanted to show with that screenshot |
08:16:12 | FromDiscord | <Rika> Me neither.. |
08:16:40 | PMunch | Okay, let me type up a long-winded explanation for how all this works which will hopefully help us all get on the same page. |
08:17:02 | FromDiscord | <retkid> The os has to delegate packs, and sometimes this results in waiting on a single cpu? correcty |
08:17:03 | FromDiscord | <Elegantbeef> Ah nifty he's going to write a book so we can all get on the same page |
08:17:04 | FromDiscord | <retkid> (edit) "correcty" => "correct?" |
08:17:13 | FromDiscord | <Rika> Sorry if anything was rude lol I have been told by many that I speak like a robot half of the time |
08:17:37 | FromDiscord | <retkid> https://www.youtube.com/watch?v=JxlZ4i3VjXY |
08:17:43 | FromDiscord | <Rika> In reply to @retkid "The os has to": Waiting means the CPU isn’t being overwhelmed meaning it is not a CPU bottleneck? |
08:17:46 | FromDiscord | <retkid> this is pretty much how this conversation feels |
08:18:20 | * | jjido joined #nim |
08:18:48 | FromDiscord | <fbpyr> sent a long message, see http://ix.io/3R4m |
08:19:01 | FromDiscord | <retkid> In reply to @Rika "Waiting means the CPU": yes |
08:19:03 | FromDiscord | <retkid> it is idle |
08:19:08 | FromDiscord | <fbpyr> so is there a wa to ask for `Some()` ? |
08:19:15 | FromDiscord | <Rika> Yes so the bottleneck is elsewhere |
08:19:27 | FromDiscord | <retkid> this has been the entire point of my conversation, its not a cpu issue |
08:19:31 | FromDiscord | <Rika> Yes |
08:19:59 | FromDiscord | <Rika> And threads is a CPU bottleneck solver, so it isn’t appropriate for this issue |
08:20:22 | FromDiscord | <retkid> as is why im not using threads |
08:20:28 | FromDiscord | <retkid> because thats way overkill |
08:20:32 | FromDiscord | <Rika> Okay honestly I have to stop speaking I have no idea what we are arguing about anymore |
08:20:42 | FromDiscord | <Rika> What are you arguing against |
08:21:28 | FromDiscord | <retkid> why am I calling an asynchronous function, and they are executing in the order in which they were received rather than returning (yielding) in clumps |
08:22:07 | FromDiscord | <retkid> it is the same speed as me executing it in serial |
08:22:25 | FromDiscord | <retkid> ~~specifically cinnamon toast crunch~~ |
08:22:31 | FromDiscord | <Rika> Perhaps because your IO is quick |
08:22:35 | FromDiscord | <Elegantbeef> No fbpyr the issue is that you dont have `import std/[uri, logging]` |
08:22:38 | FromDiscord | <Rika> And you aren’t having internet issues |
08:22:52 | FromDiscord | <Elegantbeef> `error` there is to write to the stdout and close the program "gracefully" |
08:23:16 | FromDiscord | <fbpyr> [Elegantbeef](https://matrix.to/#/@elegantbeef:matrix.org)\: thanks! uri I added, but not logging - let ..me try |
08:23:39 | FromDiscord | <Elegantbeef> There might be another `error` procedure that does it, i dont know |
08:23:44 | FromDiscord | <Rika> The best that async can get in terms of speed is the speed of sequential sync code with the IO delay removed |
08:23:49 | FromDiscord | <Rika> It cannot get any quicker than that |
08:24:05 | FromDiscord | <Rika> Because single core |
08:24:09 | FromDiscord | <fbpyr> ahaa! now the complaints are gone! 😀 |
08:24:24 | FromDiscord | <retkid> so async cannot get any faster than a single core |
08:24:25 | FromDiscord | <fbpyr> [Elegantbeef](https://matrix.to/#/@elegantbeef:matrix.org)\: thank you so much! |
08:24:40 | FromDiscord | <Rika> If for some reason (you probably do have a good reason since this is a scraper) you need quicker speeds then I assume threads are now appropriate |
08:25:06 | FromDiscord | <retkid> yes im doing this soley for speed |
08:25:10 | FromDiscord | <Rika> By the way you can run threads AND async combined |
08:25:13 | FromDiscord | <Elegantbeef> So i'd say leave the issue but with the added information |
08:25:18 | FromDiscord | <retkid> In reply to @Rika "By the way you": im aware of this |
08:25:26 | FromDiscord | <Rika> Making sure |
08:25:26 | FromDiscord | <retkid> its in the asyncserver module |
08:25:29 | FromDiscord | <Rika> Some people aren’t |
08:25:36 | FromDiscord | <retkid> whats the proper name uh |
08:25:45 | FromDiscord | <retkid> asynchttpserver |
08:26:19 | FromDiscord | <retkid> somewhere it is (was?) "theoretically you can use this with threads and async" |
08:26:20 | FromDiscord | <retkid> etc |
08:27:11 | FromDiscord | <Rika> I remember having this problem now |
08:27:23 | FromDiscord | <Rika> The http client is kind of slow setting up its code |
08:27:26 | FromDiscord | <Rika> From what I recall |
08:27:40 | FromDiscord | <Rika> Might need optimisation in some way |
08:28:16 | FromDiscord | <retkid> im the women for the job |
08:28:21 | FromDiscord | <retkid> time to butcher the code >:) |
08:32:06 | * | Gustavo6046 quit (Quit: Leaving) |
08:46:56 | * | ltriant joined #nim |
08:48:26 | FromDiscord | <retkid> https://media.discordapp.net/attachments/371759389889003532/948139637837271060/unknown.png |
08:49:02 | PMunch | @retkid, ready for wall-of-text time? |
08:49:05 | PMunch | http://ix.io/3R4o |
08:52:08 | * | ltriant quit (Ping timeout: 252 seconds) |
09:04:53 | * | jjido quit (Quit: My MacBook Air has gone to sleep. ZZZzzz…) |
09:49:20 | FromDiscord | <fbpyr> hmm.. 🤔 ↵now trying to compile some nim that uses gittyup on a windows box (it compiles fine on debian after installing libgit2-dev). on windows though, it understandably complains about the missing gitlib headers (which do not seem to be included in portable git). ↵is there somewhere where I can read up on how to get the git headers for win and get them to be recognized by nim compiler? ↵or would cross-compiling from linux to win |
09:52:08 | * | acidsys quit (Excess Flood) |
09:52:41 | * | acidsys joined #nim |
09:54:44 | FromDiscord | <Elegantbeef> I do not know where to get the windows headers |
09:59:48 | PMunch | I'd guess the libgit website is a good way to start: https://libgit2.org/ |
09:59:58 | FromDiscord | <fbpyr> so far for the solutions for git on windows, I have only seen it either via mingw (portable git) or via this .net library libgt2sharp.dll ↵the latter I successfully used at some earlier point from python via pythonnet. ↵maybe I should look into using it, and if it works figure out how I can bundle the dll with the nim program. |
10:00:09 | PMunch | You should be able to just download them from there and hand them to Windows by using --passL I guess |
10:02:13 | * | shalokshalom joined #nim |
10:05:19 | * | ltriant joined #nim |
10:08:06 | FromDiscord | <fbpyr> oh wow - https://github.com/libgit2/libgit2 just built - I take that as a good sign.. 🙂 |
10:10:23 | FromDiscord | <0ffh> In your opinion, what's the best ressource/tutorial on how to make/generate bindings for a C++ library?↵I've found some stuff, but I'm not sure there's nothing better out there. |
10:13:04 | * | ltriant quit (Ping timeout: 250 seconds) |
10:13:52 | NimEventer | New thread by Flajr: Static musl compilation with db_mysql module and external libraries mysqlclient and openssl, see https://forum.nim-lang.org/t/8966 |
10:23:54 | FromDiscord | <fbpyr> sent a long message, see http://ix.io/3R4G |
10:26:02 | FromDiscord | <fbpyr> nvm I found `--cincludes` with that it finds the headers. but now complains about `could not load: libgit2.so` |
10:35:58 | FromDiscord | <retkid> i need to make thread arrays that are not of a set compile time size |
10:36:01 | FromDiscord | <retkid> how can i do that? |
10:36:01 | FromDiscord | <fbpyr> hmm.. 🤔 even when passing cincludes and clibdir like this\:↵`nim c -d:release --cincludes:c:/tools/libgit2/include --clibdir:c:/tools/libgit2/lib -r installer.nim`↵it still insists\: `could not load: libgit2.so` (even when I tried to copy `git2.dll` to `git2.so`) .. so close.. 🙁 |
10:36:15 | FromDiscord | <Elegantbeef> seq↵(@retkid) |
10:36:30 | FromDiscord | <retkid> In reply to @Elegantbeef "seq (<@217459674700578816>)": i can initiate a seq the same way i can an array? |
10:36:42 | FromDiscord | <Elegantbeef> What do you mean? |
10:37:08 | FromDiscord | <retkid> sent a code paste, see https://play.nim-lang.org/#ix= |
10:37:30 | FromDiscord | <Elegantbeef> `seq[Thread[...]]` |
10:38:11 | FromDiscord | <retkid> In reply to @Elegantbeef "`seq[Thread[...]]`": but then its not of any size? |
10:38:22 | FromDiscord | <Elegantbeef> What? |
10:38:33 | FromDiscord | <retkid> its not defined to a size like the array |
10:38:44 | FromDiscord | <retkid> i cant iterate over it |
10:38:55 | FromDiscord | <retkid> to use in create thread |
10:39:01 | FromDiscord | <retkid> createThread |
10:39:02 | FromDiscord | <Elegantbeef> `var myColl = newSeq[Thread[void]](10)` |
10:39:51 | FromDiscord | <retkid> thank you :3 |
10:43:22 | * | ltriant joined #nim |
10:48:13 | * | ltriant quit (Ping timeout: 240 seconds) |
10:53:37 | * | jjido joined #nim |
11:35:42 | * | jmdaemon quit (Read error: Connection reset by peer) |
11:36:52 | * | jmdaemon joined #nim |
11:40:03 | * | jmdaemon quit (Excess Flood) |
11:44:08 | * | jmdaemon joined #nim |
11:54:12 | * | icebattle quit (Ping timeout: 240 seconds) |
11:55:58 | PMunch | Hmm, is there a way to parse timestamps with variable sub-second precision |
11:56:56 | PMunch | I have a format that sometimes returns things like both: 12:54:18.5062643 and 12:54:04.253155 |
11:57:06 | PMunch | So either 6 or 7 characters |
11:59:56 | * | jjido quit (Quit: My MacBook Air has gone to sleep. ZZZzzz…) |
12:01:27 | * | icebattle joined #nim |
12:06:02 | * | supakeen quit (Quit: WeeChat 3.4) |
12:06:32 | * | supakeen joined #nim |
12:23:52 | * | jjido joined #nim |
12:25:23 | FromDiscord | <fbpyr> ghaa.. that is frustrating\: after adjusting PATH for a while, to prevent mingw-confusion.↵it finally compiled with\: `nim c -d:release --cincludes:c:/tools/libgit2/include --verbosity:3 installer.nim`↵...BUT\: when I try to run it, it says\: `could not load: libgit2.so` 😦↵there is a way to instead statically compile this, right? |
12:31:55 | FromDiscord | <retkid> I've completely forgotton how to make objects with sequences |
12:32:10 | PMunch | I think you then first need to make the static library `cmake -DBUILD_SHARED_LIBS=OFF` or something like that |
12:32:13 | PMunch | And then link with that |
12:32:24 | PMunch | @retkid, objects with sequences? |
12:33:00 | FromDiscord | <retkid> thats sounds weird, its not the sequences in the type thats the problem |
12:33:02 | FromDiscord | <retkid> 🤔 |
12:33:30 | FromDiscord | <retkid> cant compile when i have these sequences in there but if i remove the other ones they're fine |
12:33:59 | FromDiscord | <auxym> can you make a minimal example that reproduces the problem? |
12:34:30 | * | ltriant joined #nim |
12:34:40 | FromDiscord | <whisperdev> Hi. What is that lib which I can use for ssl so I dont have to ship (libcrypto-1_1-x64|libeay64).dll with the binary? |
12:36:13 | FromDiscord | <retkid> In reply to @auxym "can you make a": its unrelated to that |
12:36:17 | FromDiscord | <retkid> its a compiler problem? |
12:36:24 | FromDiscord | <retkid> sent a code paste, see https://play.nim-lang.org/#ix=3R4X |
12:36:52 | FromDiscord | <retkid> I found it |
12:36:52 | FromDiscord | <retkid> lol |
12:36:54 | FromDiscord | <auxym> In reply to @whisperdev "Hi. What is that": Assuming you mean "for https", this? https://github.com/treeform/puppy |
12:36:55 | FromDiscord | <retkid> typo |
12:42:25 | FromDiscord | <retkid> https://media.discordapp.net/attachments/371759389889003532/948198521423679558/unknown.png |
12:42:43 | FromDiscord | <retkid> the things that you think should be really resource light always are the most intensive |
12:44:15 | FromDiscord | <whisperdev> In reply to @auxym "Assuming you mean "for": Oh I think so. |
12:44:22 | FromDiscord | <whisperdev> How do I download a file with this? |
12:45:53 | FromDiscord | <retkid> In reply to @retkid "": 😔 had 500 chromiums running |
12:47:33 | FromDiscord | <auxym> In reply to @whisperdev "How do I download": never used it, but I assume the raw bytes would be in the `Response.body` string, then you can just dump them to a file. Hoping you're not downloading from multi-gb files |
12:47:56 | * | FromDiscord quit (Remote host closed the connection) |
12:48:09 | * | FromDiscord joined #nim |
12:50:07 | FromDiscord | <ShalokShalom> Who here tried Nim > LLVM > GraalVM already? |
12:50:22 | FromDiscord | <whisperdev> In reply to @auxym "never used it, but": Ah thanks I guess i can just do what downloadFile does from httpclient |
12:59:04 | * | jjido quit (Quit: My MacBook Air has gone to sleep. ZZZzzz…) |
12:59:27 | * | jmdaemon quit (Ping timeout: 256 seconds) |
13:18:21 | * | shalokshalom quit (Quit: https://quassel-irc.org - Chat comfortably. Anywhere.) |
13:24:01 | FromDiscord | <fbpyr> sent a long message, see https://paste.rs/Mvf |
13:51:12 | FromDiscord | <0ffh> In reply to @0ffh "In your opinion, what's": Okay this one seems to be the nicest guide I've found so far.↵https://gist.github.com/zacharycarter/846869eb3423e20af04dea226b65c18f |
14:07:37 | FromDiscord | <Sense> hej, dudes can anyone give me compiler args for nim which are compressing to the smallest size |
14:08:26 | FromDiscord | <ynfle> In reply to @Sense "hej, dudes can anyone": `--opt:size -d:danger`? Not sure what you mean |
14:09:12 | FromDiscord | <Sense> In reply to @ynfle "`--opt:size -d:danger`? Not sure": this is what i use actually xd |
14:11:17 | Amun-Ra | -d=release --passL=-flto etc. |
14:11:46 | PMunch | @retkid, what are you doing now? If those numbers are from a web scraper you are probably doing something wrong.. Higher CPU != more good |
14:12:12 | FromDiscord | <retkid> In reply to @PMunch "<@217459674700578816>, what are you": nah im pretty sure bigger is always bette |
14:12:12 | FromDiscord | <retkid> (edit) "bette" => "better" |
14:12:16 | FromDiscord | <retkid> anyway |
14:12:21 | PMunch | @Sense, what kind of target are you compiling for? |
14:12:25 | FromDiscord | <retkid> no i just had like 500 chrome tabs open because selenium |
14:12:35 | * | kenran quit (Quit: WeeChat info:version) |
14:13:00 | FromDiscord | <Sense> In reply to @PMunch "<@790153860130799616>, what kind of": I am compiling for Windows x64, my aim is to make the most tiny executable which could work without any issues. |
14:13:08 | FromDiscord | <Sense> Let me put my current args rn |
14:13:16 | PMunch | In general `-d:danger --gc:arc --opt:size --passL:"-flto" would give a fairly low size |
14:14:02 | PMunch | @retkid, `while true: echo "No it's not"` run that and watch it 100% peg a CPU core without getting anything done :P |
14:14:04 | FromDiscord | <ynfle> danger removes all runtime checks though |
14:14:13 | FromDiscord | <Sense> `nim c -d:danger --gc:arc --debuginfo:off --opt:size --passc=-flto --passl=-flto --app:gui --panics:on <file>.nim` |
14:14:30 | PMunch | But yeah 500 chrome tabs will do that to your CPU :P |
14:14:30 | FromDiscord | <retkid> why are panics on? |
14:14:33 | Amun-Ra | and -passl=-s |
14:15:00 | PMunch | And --app:gui? |
14:15:23 | PMunch | --debuginfo:off should be on when compiling with -d:danger |
14:15:36 | PMunch | By the way, once it's done you might also want to strip the executable |
14:15:46 | FromDiscord | <0ffh> In reply to @PMunch "<@217459674700578816>, `while true: echo": Well if you pay the CPU, then according to Keynsianism, economic value is created. |
14:15:57 | PMunch | @Sense, this might interest you: https://hookrace.net/blog/nim-binary-size/ |
14:15:58 | FromDiscord | <Sense> In reply to @PMunch "By the way, once": Does stripping breaks executables no? |
14:16:04 | PMunch | No? |
14:16:16 | PMunch | If it broke executable why would anyone do it :P |
14:16:18 | FromDiscord | <Sense> Uh... OK? |
14:16:45 | FromDiscord | <Sense> Also, I found out that when I try to build to `cpp` instead of `c` it seems that executable doesn't work afterwards xD |
14:16:57 | PMunch | @0ffh, haha yay capitalism! |
14:17:11 | PMunch | @Sense, then you probably did something else wrong |
14:17:32 | PMunch | Building with C++ should work just fine |
14:18:15 | PMunch | By the way they use `-d:release` in that article, that switch was renamed to `-d:danger` and a new slightly less aggressive switch was introduced and called `-d:release` |
14:19:07 | PMunch | Of course if you want the smallest program you quite possibly need to do some things with your program as well |
14:19:13 | PMunch | Switches will only get you so far |
14:20:49 | FromDiscord | <A_Person> is there any implementations of rdp/vnc in nim? |
14:21:43 | * | arkurious joined #nim |
14:25:54 | FromDiscord | <Sense> In reply to @PMunch "Building with C++ should": Hehe, what I meant here is that C++ binary works on Windows, but if you try to run through Wine on Linux it will not just work. |
14:28:44 | FromDiscord | <auxym> that might be more of an issue with WINE configuration... Why are you not compiling natively for linux? |
14:29:37 | FromDiscord | <Sense> In reply to @auxym "that might be more": My software is unironically Windows only. And I test it on my Windows 10 VM and through Wine to ensure everything works. |
14:31:22 | FromDiscord | <auxym> from what I know about wine (very little), it has a thousand compatibility settings that you have to tweak just right for each executable |
14:32:04 | FromDiscord | <Sense> well by default winecfg is on win 10 |
14:36:20 | PMunch | @auxym, haha it's not quite that bad |
14:37:34 | FromDiscord | <Sense> In reply to @PMunch "<@882793909246369864>, haha it's not": Btw, I checked the compiler guide and I have seen three things. ARC, ORC, and useMalloc. What these means? |
14:37:44 | FromDiscord | <Sense> Also, what's difference between these? |
14:39:22 | PMunch | Well useMalloc is just a general thing for all the garbage collectors |
14:39:45 | PMunch | It basically tells the compiler to just use malloc and the other basic memory allocation calls and not try to do anything fancy |
14:40:04 | PMunch | By default Nim will grab a chunk of memory and then handle that chunk itself |
14:40:23 | PMunch | Which leads to better performance, but it makes it harder to profile, and might not work on all platforms (e.g. an Arduino) |
14:41:01 | PMunch | ARC and ORC are memory management siblings meant to replace the current deferred reference counting algorithm |
14:41:46 | PMunch | ARC is automatic reference counting, ORC is ARC but with a cycle collector added in (by default ARC will leak cyclic data). |
14:43:01 | FromDiscord | <Sense> Hm... so it's doesn't really matter what to choose right? |
14:43:14 | PMunch | Well, it definitely matters |
14:43:23 | PMunch | But in the end they all do sort of the same thing |
14:43:28 | * | shalokshalom joined #nim |
14:43:42 | FromDiscord | <Sense> Just as I said my main aim is to have a very tiny executable |
14:44:06 | PMunch | I mean if you really want to have a tiny executable --gc:none is what you want |
14:44:26 | PMunch | But --gc:arc turns into --gc:none if you don't have any garbage collected memory |
14:44:53 | PMunch | Why are you aiming for tiny executables exactly? |
14:45:27 | PMunch | Apart from viruses and microcontrollers being very aggressive about program size doesn't really make much sense nowadays |
14:45:40 | FromDiscord | <Sense> When I was doing some programming on Rust and Golang they were both producing pretty large executables. |
14:45:44 | FromDiscord | <Sense> Ever heard of demoscene? |
14:46:15 | PMunch | Oh right, well Nim should by default be quite a bit smaller than either of those |
14:46:40 | PMunch | demoscene, that's the keygen music/cool visualisation thingies right? |
14:46:47 | FromDiscord | <Sense> In reply to @PMunch "demoscene, that's the keygen": Das right |
14:47:06 | FromDiscord | <Sense> I think that Nim will be the best choice for this kind of stuff |
14:47:16 | PMunch | Should certainly be a good fit |
14:49:06 | FromDiscord | <Sense> In reply to @PMunch "Should certainly be a": It will not pain in the ass to write, and will not produce large executables. |
14:54:02 | FromDiscord | <fbpyr> is there a good place to read up on using c# .net dll in from nim? |
14:54:07 | PMunch | I guess that's why Nim is so popular with virus creators. Easy to work with, tiny standalone binaries |
14:54:51 | PMunch | @fbpyr, this might be a good start: https://forum.nim-lang.org/t/7265 |
14:56:00 | FromDiscord | <fbpyr> looks very good - thank you so much! 🙂 |
14:56:07 | PMunch | Oh well, I've gotta go |
14:56:09 | * | PMunch quit (Quit: Leaving) |
15:29:00 | FromDiscord | <mratsim> In reply to @PMunch "Well useMalloc is just": useMalloc is only available for arc/orc iirc |
15:29:23 | FromDiscord | <mratsim> I opened a feature request a year ago or so to have it on the classic GC |
15:29:55 | * | icebattle quit (Ping timeout: 256 seconds) |
15:31:58 | * | Guest71 joined #nim |
15:38:28 | FromDiscord | <dom96> In reply to @Sense "Ever heard of demoscene?": I love the Demoscene, plz make some Nim demos 😄 |
15:42:53 | FromDiscord | <0ffh> In reply to @Sense "Ever heard of demoscene?": As a demo only has limited time to allocate garbage you might get away with no GC. But then you should test what the minimum free memory requirement is and make sure it's below free memory on the presentation machine. |
15:49:34 | FromDiscord | <Sense> In reply to @dom96 "I love the Demoscene,": Same, but I dumbass in terms of graphics xD |
15:51:42 | * | icebattle joined #nim |
15:52:30 | FromDiscord | <Waldecir Santos> Can someone help me with generics I'm doing this https://play.nim-lang.org, but for some reason the add inside `solve` is expecting string 🤔 |
16:07:29 | * | Guest71 quit (Quit: Client closed) |
16:12:58 | * | shalokshalom quit (Quit: https://quassel-irc.org - Chat comfortably. Anywhere.) |
16:28:43 | FromDiscord | <ynfle> In reply to @Waldecir Santos "Can someone help me": The link doesn't have code |
16:28:57 | FromDiscord | <Waldecir Santos> Sorry https://play.nim-lang.org/#ix=3R5M |
16:29:36 | FromDiscord | <ynfle> I needs to be var |
16:31:14 | FromDiscord | <Phil> In reply to @Elegantbeef "<@180601887916163073>\: there are multiple": I'm starting to believe that templates might actually be a better call for making essentially entirely generic modules, as long as your parameters are very limited. ↵What were the limitations you ran into while using templates, since you noted you played around with that approach |
16:31:37 | FromDiscord | <Waldecir Santos> In reply to @ynfle "I needs to be": what is `I`. ? can you show me ? |
16:37:37 | * | Gustavo6046 joined #nim |
16:52:38 | FromDiscord | <ynfle> it |
16:53:06 | FromDiscord | <ynfle> It can't be generic, because you are adding an int to a seq that may not be of int |
16:54:44 | FromDiscord | <ynfle> In reply to @Waldecir Santos "what is `I`. ?": https://play.nim-lang.org/#ix=3R69 |
16:57:34 | FromDiscord | <Waldecir Santos> Oh my example was also wrong it needs to be `obj.list.add` and not `obj.add` too, https://play.nim-lang.org/#ix=t%20wr without var, not sure if this is right tho |
16:59:48 | * | jjido joined #nim |
17:00:00 | * | slowButPresent joined #nim |
17:01:15 | FromDiscord | <ynfle> In reply to @Waldecir Santos "Oh my example was": I'm pretty sure that's not the link you intended |
17:01:24 | FromDiscord | <ynfle> But yes, you don't need var because it's a ref object |
17:01:37 | FromDiscord | <Waldecir Santos> generated it again https://play.nim-lang.org/#ix=3xc6 |
17:01:40 | FromDiscord | <ynfle> I personally would avoid something like that and enable strictFuncs |
17:03:14 | FromDiscord | <Waldecir Santos> Got it for that I just add this `{.experimental: "strictFuncs".}` to the top of the file, right ? |
17:03:55 | FromDiscord | <ynfle> Ya and use a func instead of a proc. I'm sure many would be ok with that, and I'm definitely not an expert programmer |
17:05:51 | FromDiscord | <Waldecir Santos> Got it, I did the example to show the same issue I'm having with my code, but the still failing on my code, not sure how to create a small reproducible project |
17:06:15 | FromDiscord | <ynfle> In reply to @Waldecir Santos "Got it, I did": Is the code online? |
17:06:33 | FromDiscord | <Waldecir Santos> nope |
17:06:50 | FromDiscord | <Waldecir Santos> let me see if I can share one file |
17:09:59 | FromDiscord | <ynfle> What is the error? |
17:10:10 | FromDiscord | <Waldecir Santos> https://play.nim-lang.org/#ix=3R6j |
17:10:22 | FromDiscord | <Waldecir Santos> sent a code paste, see https://play.nim-lang.org/#ix=3R6k |
17:12:00 | FromDiscord | <Waldecir Santos> I'm using this project to also learn nim so pardon any dumb mistake 😄 |
17:12:05 | FromDiscord | <ynfle> It's not var |
17:18:59 | FromDiscord | <Waldecir Santos> I'm not sure how exactly convert this to use `var` could you show me ? |
17:25:19 | FromDiscord | <ynfle> In reply to @Waldecir Santos "I'm not sure how": I can't see you code |
17:25:35 | FromDiscord | <Waldecir Santos> https://play.nim-lang.org/#ix=3R6j this ? |
17:28:20 | FromDiscord | <ynfle> sent a code paste, see https://play.nim-lang.org/#ix=3R6p |
17:28:21 | FromDiscord | <ynfle> See the 2 above changes |
17:30:36 | * | jjido quit (Quit: My MacBook Air has gone to sleep. ZZZzzz…) |
17:31:05 | FromDiscord | <Waldecir Santos> Oh it worked, thank you, what was the culprit to you based on the error message ? |
17:33:10 | FromDiscord | <ynfle> `but expression 'queryset.result_cache' is immutable, not 'var'` |
17:33:40 | FromDiscord | <ynfle> `.add` modifies the seq. Seqs can't be modified if that aren't var |
17:37:13 | FromDiscord | <Waldecir Santos> queryset being var is enough to make `result_cache` mutable ? |
17:52:10 | FromDiscord | <auxym> the default `result` is always var, so `result.result_cache` is mutable |
17:58:11 | FromDiscord | <ynfle> In reply to @auxym "the default `result` is": That's not what we are talking about |
17:58:21 | FromDiscord | <ynfle> In reply to @Waldecir Santos "queryset being var is": Yes. The whole object is now mutable |
17:59:32 | FromDiscord | <auxym> oh, I ctrl-f'd in that playground link for `result_cache`, and the first one that came up is `result.result_cache` |
18:03:03 | * | ehmry quit (Quit: https://quassel-irc.org - Chat comfortably. Anywhere.) |
18:04:05 | * | ehmry joined #nim |
18:10:20 | FromDiscord | <Waldecir Santos> Thank you guys I'm back on track ! |
18:10:27 | FromDiscord | <ynfle> 👍 |
18:15:02 | FromDiscord | <Sense> wtf https://media.discordapp.net/attachments/371759389889003532/948282231636525136/unknown.png |
18:15:21 | FromDiscord | <Sense> i compiled the executable as cpp one and have this |
18:18:27 | FromDiscord | <Sense> solution: pass `--passl="-static-libgcc -static-libstdc++ -flto"` |
18:26:28 | * | neurocyte0917090 joined #nim |
18:30:58 | * | jjido joined #nim |
18:37:30 | FromDiscord | <ynfle> Interesting |
19:03:00 | FromDiscord | <Sense> just fucking great... https://media.discordapp.net/attachments/371759389889003532/948294302071660564/unknown.png |
19:03:37 | * | kayabaNerve_ quit (Ping timeout: 240 seconds) |
19:06:04 | FromDiscord | <ynfle> Compile without -d:release or dange |
19:12:35 | FromDiscord | <Sense> In reply to @ynfle "Compile without -d:release or": ok |
19:13:44 | NimEventer | New thread by Dlesnoff: Factorial computation in Nim, see https://forum.nim-lang.org/t/8967 |
19:19:06 | FromDiscord | <Sense> hm... thanks it seems to be issues with regex library |
19:19:09 | FromDiscord | <Sense> ffs |
19:40:29 | FromDiscord | <Waldecir Santos> Is it possible to make a property of a object be iterable through the object like in here ? |
19:40:35 | FromDiscord | <Waldecir Santos> sent a code paste, see https://play.nim-lang.org/#ix=3R6U |
19:40:48 | FromDiscord | <Waldecir Santos> (edit) "https://play.nim-lang.org/#ix=3R6U" => "https://play.nim-lang.org/#ix=3R6V" |
19:40:53 | FromDiscord | <Waldecir Santos> (edit) |
19:41:23 | FromDiscord | <Sense> ??? https://media.discordapp.net/attachments/371759389889003532/948303959368544306/unknown.png |
19:41:39 | FromDiscord | <ynfle> sent a code paste, see https://play.nim-lang.org/#ix=3R6W |
19:41:54 | FromDiscord | <Waldecir Santos> so the for loop calls items internally, right ? |
19:42:14 | FromDiscord | <ynfle> In reply to @Waldecir Santos "so the for loop": Yup |
19:42:17 | FromDiscord | <Waldecir Santos> Ty @ynfle I'll try out |
19:42:26 | FromDiscord | <ynfle> and pairs if there are two variables |
19:44:00 | * | jjido quit (Quit: My MacBook Air has gone to sleep. ZZZzzz…) |
19:59:11 | * | nrds quit (Remote host closed the connection) |
19:59:33 | * | madprops quit (Ping timeout: 250 seconds) |
20:04:12 | * | madprops joined #nim |
20:04:12 | * | madprops quit (Changing host) |
20:04:12 | * | madprops joined #nim |
20:04:22 | * | xaltsc joined #nim |
20:09:06 | * | Gustavo6046_ joined #nim |
20:10:01 | * | neurocyte0917090 quit (Quit: The Lounge - https://thelounge.chat) |
20:11:06 | * | Gustavo6046 quit (Ping timeout: 268 seconds) |
20:12:55 | * | neurocyte0917090 joined #nim |
20:20:06 | * | dtomato quit (Quit: Ping timeout (120 seconds)) |
20:20:25 | * | dtomato joined #nim |
20:22:32 | * | Gustavo6046_ quit (Quit: Leaving) |
20:22:52 | * | Gustavo6046 joined #nim |
20:27:06 | FromDiscord | <b4mbus> What is the nim way of defining an abstract (interface) type, that cannot be instantiated in any way, but it can be referenced in function parameters and derived from so I have some kind of virtual functions? |
20:30:09 | FromDiscord | <demotomohiro> https://nim-lang.org/docs/manual.html#methods |
20:35:51 | FromDiscord | <konsumlamm> i'd say concepts are a better fit for that (methods are rarely used), albeit still being experimental: https://nim-lang.github.io/Nim/manual_experimental.html#concepts |
20:36:36 | FromDiscord | <konsumlamm> for new-styled concepts (which are even more experimental), see https://github.com/nim-lang/RFCs/issues/168 |
20:38:07 | FromDiscord | <demotomohiro> But concept doesn't work like virtual function. |
20:39:05 | FromDiscord | <konsumlamm> they're the right tool for defining abstract interfaces though |
20:39:16 | FromDiscord | <konsumlamm> i'm not sure they actually need virtual functions |
20:41:45 | FromDiscord | <demotomohiro> Concept determines which procedure is called at compile time but `method` determines at runtime. |
20:47:32 | * | jjido joined #nim |
21:01:45 | FromDiscord | <ynfle> They doesn't want that. They want some way to refer to types with out haven't to specify too much. |
21:07:44 | * | fowl9 joined #nim |
21:09:38 | * | fowl quit (Ping timeout: 272 seconds) |
21:09:39 | * | fowl9 is now known as fowl |
21:13:45 | * | Gustavo6046_ joined #nim |
21:16:28 | * | Gustavo6046 quit (Ping timeout: 268 seconds) |
21:24:30 | * | vicfred joined #nim |
21:32:00 | * | Gustavo6046__ joined #nim |
21:34:27 | * | Gustavo6046_ quit (Ping timeout: 252 seconds) |
21:38:07 | * | Gustavo6046__ is now known as Gustavo6046 |
21:39:04 | * | nrds joined #nim |
21:42:15 | * | wyrd quit (Ping timeout: 240 seconds) |
21:44:14 | * | Gustavo6046_ joined #nim |
21:46:41 | * | Gustavo6046 quit (Ping timeout: 268 seconds) |
21:49:21 | * | wyrd joined #nim |
21:53:32 | * | jjido quit (Quit: My MacBook Air has gone to sleep. ZZZzzz…) |
21:56:26 | * | jjido joined #nim |
22:00:44 | * | jjido quit (Client Quit) |
22:22:12 | * | Gustavo6046_ is now known as Gustavo6046 |
22:29:25 | * | Gustavo6046_ joined #nim |
22:30:01 | * | Gustavo6046_ quit (Client Quit) |
22:31:42 | * | Gustavo6046 quit (Ping timeout: 268 seconds) |
22:48:16 | * | tinytoast joined #nim |
22:49:16 | * | blackbeard420_ joined #nim |
22:49:28 | * | ltriant_ joined #nim |
22:49:36 | * | flynn8 joined #nim |
22:50:13 | * | syl_ joined #nim |
22:50:13 | * | lumidify quit (Ping timeout: 256 seconds) |
22:50:47 | * | ltriant quit (Ping timeout: 256 seconds) |
22:50:47 | * | systemdsucks quit (Ping timeout: 256 seconds) |
22:50:47 | * | blackbeard420 quit (Ping timeout: 256 seconds) |
22:50:47 | * | syl quit (Ping timeout: 256 seconds) |
22:50:47 | * | tinystoat quit (Ping timeout: 256 seconds) |
22:50:47 | * | flynn quit (Ping timeout: 256 seconds) |
22:50:51 | * | flynn8 is now known as flynn |
22:51:53 | * | lumidify joined #nim |
22:52:19 | * | systemdsucks joined #nim |
22:52:28 | * | def- quit (Quit: -) |
22:52:39 | * | def- joined #nim |
23:05:42 | * | blackbeard420_ quit (Quit: ZNC 1.8.2 - https://znc.in) |
23:05:53 | * | blackbeard420 joined #nim |
23:07:00 | FromDiscord | <Nick.> Is there something in nim to open a binary file, seek the address and get x bytes. When I open it in a hex editor I know that I need to jump to 0x1006F921 |
23:07:19 | FromDiscord | <Nick.> Or can point me in the right direction? |
23:07:55 | FromDiscord | <Elegantbeef> you can use the stream api or the file api in Nim |
23:08:09 | FromDiscord | <Elegantbeef> Both have the abillity to seek to a specific position |
23:08:51 | FromDiscord | <Elegantbeef> for streams you'd use `setPosition` for the fileApi you'd use `setFilePos` |
23:09:07 | * | neurocyte0917090 quit (Read error: Connection reset by peer) |
23:09:38 | * | neurocyte0917090 joined #nim |
23:10:42 | FromDiscord | <Nick.> that I've figured but the address 0x1006F921 its in int and I get no results back. |
23:10:56 | FromDiscord | <Elegantbeef> Is it perhaps in big endian and you're going too far? |
23:11:33 | FromDiscord | <Nick.> Hmm, how would I do that? Not really familiar with that. |
23:12:36 | FromDiscord | <Elegantbeef> Try `0x21F90610` instead |
23:15:41 | FromDiscord | <Nick.> doesnt work |
23:17:29 | FromDiscord | <Nick.> echo(fmt"{a:x}") trying to get the hex value but just returning nothing |
23:23:55 | FromDiscord | <Elegantbeef> Could i see the code and the file? |
23:25:47 | FromDiscord | <Nick.> sent a code paste, see https://play.nim-lang.org/#ix=3R7J |
23:27:11 | FromDiscord | <Elegantbeef> `0x21F90610` is not 4091 |
23:27:14 | FromDiscord | <Nick.> So im trying to jump to that address and get get 4091 bytes |
23:27:41 | FromDiscord | <Elegantbeef> sure and what you're doing now is jumpoing to position `1` and reading 7 bytes |
23:28:04 | FromDiscord | <Nick.> Yes, I was testing |
23:29:07 | FromDiscord | <Elegantbeef> so you should be doing `strm.setPosition` then `strm.readData` or `strm.readStr` |
23:29:35 | * | Gustavo6046 joined #nim |
23:31:58 | FromDiscord | <Nick.> With strm.readData how would I work with the buffer pointer? |
23:32:00 | FromDiscord | <Rika> I’m confused |
23:32:18 | FromDiscord | <Rika> You two seem to not understand each other, it reads like |
23:32:42 | FromDiscord | <Elegantbeef> sent a code paste, see https://play.nim-lang.org/#ix=3R7L |
23:33:01 | FromDiscord | <Elegantbeef> My understanding rika is they want to offset a file position and read a buffer of data to an array |
23:33:23 | FromDiscord | <Rika> Okay |
23:34:34 | FromDiscord | <Nick.> I'm trying to read a malicious file read the 4019 bytes at a position and grab the data to xor to get the config. In python I would import pefile. |
23:34:39 | FromDiscord | <Nick.> that's basically it. |
23:34:50 | FromDiscord | <Elegantbeef> So seems what i said should be fine |
23:34:53 | FromDiscord | <Nick.> (edit) "file" => "file." |
23:35:39 | FromDiscord | <Rika> Just change the array size lol |
23:35:51 | FromDiscord | <Rika> Make it a byte array too |
23:36:58 | FromDiscord | <Elegantbeef> ^ |
23:37:47 | FromDiscord | <Nick.> Error: expression 'readData(strm, unsafeAddr(buff[0]), len(buff))' is of type 'int' and has to be used (or discarded); |
23:37:58 | FromDiscord | <Rika> Discard it too |
23:38:34 | FromDiscord | <Elegantbeef> Nim forces handling of returned values unless the procedure is marked discardable |
23:38:39 | FromDiscord | <Elegantbeef> It's an nice feature imo |
23:39:28 | FromDiscord | <Nick.> How would I make it a byte array? |
23:39:34 | FromDiscord | <Rika> Change char for byte |
23:39:39 | FromDiscord | <Elegantbeef> `array[4019, byte]` |
23:39:46 | FromDiscord | <Elegantbeef> Cmon it's right there 😛 |
23:39:54 | NimEventer | New question by nimlang: PTR DWORD in nim lang, see https://stackoverflow.com/questions/71315840/ptr-dword-in-nim-lang |
23:40:58 | FromDiscord | <Elegantbeef> Damn matrix bridge making me look siilly |
23:43:30 | FromDiscord | <Rika> Haha dum |
23:43:31 | FromDiscord | <Elegantbeef> Damn yardanico beat me |
23:43:39 | FromDiscord | <Rika> What |
23:43:48 | FromDiscord | <Elegantbeef> Yardanico responded to the SO post |
23:43:58 | FromDiscord | <Elegantbeef> Somehow the person lied about their runtime eitherway |
23:44:36 | FromDiscord | <Elegantbeef> passing `cast[pointer](zeroInitedInt)` to a procedure didnt result in a nil error is just a plain lie, i refuse to believe otherwise |