00:21:04 | * | Guest7620 is now known as Stink |
00:39:03 | * | vicfred quit (Quit: Leaving) |
00:40:34 | * | krux02 quit (Remote host closed the connection) |
00:59:11 | FromDiscord | <retkid> so like |
00:59:24 | FromDiscord | <retkid> if im loading a 89 gb file into the xml parser |
00:59:29 | FromDiscord | <retkid> will it chunk it at all? |
00:59:59 | FromDiscord | <retkid> or do i have to make my own or does someone already have a library which buffer reads it |
01:04:05 | FromDiscord | <californiatokens> I'll help 10 people on how to earn $12,000 within 72 hours but you will pay me 10% of your profit when you receive it.↵Note\: only interested people should apply, drop a message let's get started or via WhatsApp\: +1 (216 315 7686 |
01:05:58 | FromDiscord | <huantian> more of em |
01:06:01 | FromDiscord | <!Patitotective> In reply to @californiatokens "I'll help 10 people": @Yardanico ban? |
01:33:22 | FromDiscord | <Elegantbeef> it takes a string so nope↵(@retkid) |
01:33:46 | FromDiscord | <retkid> In reply to @Elegantbeef "it takes a string": think of a more painful sentince |
01:33:51 | FromDiscord | <retkid> (edit) "sentince" => "sentience" |
01:33:59 | FromDiscord | <Elegantbeef> sentence even 😄 |
01:34:13 | FromDiscord | <retkid> ;/kn mcvb ncvb ? |
01:34:18 | FromDiscord | <retkid> setence |
01:34:23 | FromDiscord | <retkid> all sentience is painful |
01:34:26 | FromDiscord | <Elegantbeef> Wait nevermind xmlparser does actualy stream |
01:34:31 | FromDiscord | <retkid> sentence |
01:34:38 | FromDiscord | <retkid> typing is hard |
01:34:49 | FromDiscord | <Elegantbeef> https://nim-lang.org/docs/parsexml.html#example-1colon-retrieve-html-title |
01:35:29 | FromDiscord | <retkid> I dont think that will be enough to stop my ram from being filled |
01:36:07 | FromDiscord | <Elegantbeef> What do you mean |
01:36:10 | FromDiscord | <Elegantbeef> it uses streams |
01:38:19 | FromDiscord | <retkid> In reply to @Elegantbeef "it uses streams": well it depends how it works but what if the tree itself is enough to fill 8 gb |
01:38:39 | FromDiscord | <retkid> or if im able to issue operations without loading too much into ram |
01:56:58 | FromDiscord | <Zectbumo> sent a code paste, see https://play.nim-lang.org/#ix=3Y2x |
01:57:24 | FromDiscord | <Elegantbeef> `let myEnv = getEnv("MY_ENV", "default")` |
02:00:42 | FromDiscord | <Zectbumo> why I didn't see that, who knows |
02:01:00 | FromDiscord | <Rika> Reminder that Nim does not have truthy values |
02:01:58 | FromDiscord | <Zectbumo> yeah :/ I eventually will be making \`??\` I imagine |
02:03:32 | FromDiscord | <Rika> You do you |
02:03:38 | FromDiscord | <Rika> Most of us don’t want it |
02:03:56 | FromDiscord | <Zectbumo> and most of you do yous |
02:04:06 | FromDiscord | <Rika> Yes |
02:04:40 | FromDiscord | <huantian> I think it'd be better just to wrap things like `getEnv` in `Option` |
02:05:00 | FromDiscord | <Zectbumo> instead of using the builtin default parameter? |
02:05:31 | FromDiscord | <Rika> Yes, default does not mean “nothing” |
02:05:44 | FromDiscord | <Rika> They’re valid values that may be received from input |
02:06:19 | FromDiscord | <Zectbumo> In reply to @huantian "I think it'd be": what would be the example in my case using Option? |
02:06:31 | FromDiscord | <huantian> or do something like↵`getEnv(env: string): Option[String]` and `getEnv(env: string, default: string): string` |
02:07:13 | FromDiscord | <Zectbumo> I'll try that on for size and see how the crotch fits |
02:07:46 | FromDiscord | <Rika> That is the strangest figure of speech I’ve heard recently |
02:08:02 | FromDiscord | <Elegantbeef> The first half is common |
02:08:08 | FromDiscord | <Elegantbeef> The latter half is very much uncommon |
02:08:29 | FromDiscord | <huantian> sent a code paste, see https://paste.rs/hrN |
02:09:20 | FromDiscord | <huantian> (edit) "https://play.nim-lang.org/#ix=3Y2A" => "https://play.nim-lang.org/#ix=3Y2B" |
02:09:21 | FromDiscord | <Zectbumo> ah that's nice ?| that's that ?? I've been looking for |
02:09:31 | FromDiscord | <huantian> (edit) "https://play.nim-lang.org/#ix=3Y2B" => "https://play.nim-lang.org/#ix=3Y2C" |
02:09:43 | FromDiscord | <Zectbumo> well, sheesh, how come getEnv didn't do that in the first place? |
02:09:49 | FromDiscord | <huantian> (edit) "https://play.nim-lang.org/#ix=3Y2C" => "https://play.nim-lang.org/#ix=3Y2D" |
02:10:00 | FromDiscord | <Elegantbeef> Old API that could not have drastic changes due to 1.0 |
02:10:00 | FromDiscord | <Rika> Because the standard library doesn’t integrate with options |
02:10:15 | FromDiscord | <Zectbumo> oh year, getEnv would be as old as it gets I imagine |
02:10:23 | FromDiscord | <Zectbumo> (edit) "year," => "yeah," |
02:10:54 | FromDiscord | <Elegantbeef> at the very least it should've returned `(bool, string)` where the bool is if it existed |
02:12:01 | FromDiscord | <Zectbumo> it would be cool to have std lib flavors. Everything rewritten with (bool, string) returns and another flavor with everything Options |
02:12:32 | FromDiscord | <Rika> Combinational explosion, that would be |
02:12:43 | FromDiscord | <Elegantbeef> No point in flavours you can convert between both really |
02:14:34 | FromDiscord | <Zectbumo> Rika, I don't think you would want to combine them all |
02:16:28 | FromDiscord | <Rika> That’s not what I mean |
02:16:49 | FromDiscord | <Rika> The amount of options would multiply how many things that would need attention |
02:17:09 | FromDiscord | <Rika> You could say of course to implement this via a macro |
02:18:02 | FromDiscord | <Zectbumo> oh I was thinking more like fork the std/ |
02:18:37 | FromDiscord | <Zectbumo> maybe later when nim2 has a huge user base |
02:18:43 | FromDiscord | <Elegantbeef> Smarter to just build ontop of it |
02:19:12 | FromDiscord | <Zectbumo> I dunno, some of the lib APIs are bad |
02:19:38 | FromDiscord | <Elegantbeef> Sure but 2.0 is explicitly dealing with bad stdlib |
02:20:29 | FromDiscord | <Zectbumo> I want to get used to std/ so I'm using as much std/ as possible. I'll branch out once I start forming my opinions. I imagine there are full nim environments out there waiting for me |
02:25:29 | FromDiscord | <Zectbumo> wait, so where is this nim2? and can I clone it? |
02:25:58 | FromDiscord | <Elegantbeef> If you have choosenim it's `choosenim devel` afaik |
02:26:07 | FromDiscord | <Elegantbeef> It's not a concrete thing as of yet |
02:26:15 | FromDiscord | <Elegantbeef> Just a bunch of goals that need to be met really |
02:26:45 | FromDiscord | <Zectbumo> so this has the works for the rebuilding of the std lib? |
02:27:02 | FromDiscord | <Elegantbeef> One of the goals is addressing issues of the stdlib |
02:27:08 | FromDiscord | <Elegantbeef> So if you want to change things time to get in there |
02:27:19 | FromDiscord | <Zectbumo> this devel branch would be non-backwards compatible then |
02:27:30 | FromDiscord | <that_dude> In reply to @Zectbumo "wait, so where is": https://forum.nim-lang.org/t/9132↵https://github.com/nim-lang/RFCs/issues/437↵This may be of interest? |
02:28:44 | FromDiscord | <Zectbumo> threads:on huh, well there goes everyone's easy Windows experience. missing pthread |
02:29:03 | FromDiscord | <Elegantbeef> The implication they dont address that |
02:29:23 | FromDiscord | <spoon> whats going on in nim 2 with std? |
02:29:37 | * | noeontheend quit (Ping timeout: 260 seconds) |
02:30:05 | FromDiscord | <Elegantbeef> It can change |
02:30:39 | FromDiscord | <Zectbumo> In reply to @Elegantbeef "So if you want": I should have taken notes as I've been going through the API |
02:30:47 | FromDiscord | <spoon> only thing on my wishlist for nim 2 is better multidimensional array syntax |
02:31:22 | FromDiscord | <Elegantbeef> That can be done with a `[]` macro |
02:32:07 | FromDiscord | <spoon> i guess, still learning macros |
02:38:29 | * | cyraxjoe joined #nim |
03:03:19 | FromDiscord | <Elegantbeef> @spoon\: it's not too hard https://play.nim-lang.org/#ix=3Y2O |
03:03:54 | FromDiscord | <Elegantbeef> actually that's wrong |
03:04:00 | FromDiscord | <Elegantbeef> `a[0]` doesnt work for enum indexed arrays |
03:06:00 | FromDiscord | <Elegantbeef> https://play.nim-lang.org/#ix=3Y2P there we go |
03:06:52 | FromDiscord | <spoon> ah |
03:07:06 | FromDiscord | <Elegantbeef> This could be generalize for all collections if one really wanted to |
03:09:07 | FromDiscord | <spoon> how would assigning a type look? |
03:09:11 | FromDiscord | <spoon> without dynamic typing |
03:10:49 | FromDiscord | <spoon> (and woah, didn't know something like c could happen, does it convert the boolean to 0 or 1 value to index it?) |
03:11:17 | FromDiscord | <Elegantbeef> It's an enum indexed array it works just like `array[-10..10, int]` |
03:13:43 | FromDiscord | <Elegantbeef> https://play.nim-lang.org/#ix=3Y2R |
03:15:37 | FromDiscord | <spoon> what about manually defining the type instead of inferring it? |
03:15:46 | FromDiscord | <Elegantbeef> What? |
03:15:59 | FromDiscord | <spoon> as in `let b: <type>` |
03:16:13 | FromDiscord | <Elegantbeef> `array[bool, int]` |
03:16:51 | FromDiscord | <Zectbumo> how does or-ing types work? I see things like `(array or seq)` it makes sense reading it but I can't make sense of it under the hood. nim doesn't support stuff like `myInt == (1 or 3)` does it? |
03:17:32 | FromDiscord | <spoon> don't multidimensional arrays have to be defined by `let a: array[4, array[4, int]]` |
03:17:32 | FromDiscord | <Elegantbeef> array's take ranges as the index, the accept integers/values and convert them to ranges |
03:17:34 | FromDiscord | <TechnoRazor> In reply to @Zectbumo "how does or-ing types": it's a shorthand for generics, which is why that can only be used for function parameters |
03:18:10 | FromDiscord | <Zectbumo> but it was used like this `oa[oa.low] is (array or seq)` https://play.nim-lang.org/#ix=3Y2P |
03:18:15 | FromDiscord | <Elegantbeef> No you can define them as literals↵(@spoon) |
03:18:20 | FromDiscord | <Elegantbeef> Thats a concept↵(@Zectbumo) |
03:18:43 | FromDiscord | <Elegantbeef> Or'd types are constraints or can be checked against |
03:19:03 | FromDiscord | <Zectbumo> okay I haven't gotten to concepts yet |
03:19:22 | FromDiscord | <Elegantbeef> sent a code paste, see https://play.nim-lang.org/#ix=3Y2T |
03:19:27 | FromDiscord | <TechnoRazor> i didn't know that was possible, that's cool |
03:19:38 | FromDiscord | <Elegantbeef> Concepts are experimental but rather lovely |
03:20:05 | FromDiscord | <Zectbumo> is that proc example a concept too or a separate example on how type or can be used? |
03:20:14 | FromDiscord | <TechnoRazor> i used concepts for something kind of funny a while back |
03:20:14 | FromDiscord | <Elegantbeef> That's a generic procedure |
03:20:19 | FromDiscord | <Elegantbeef> If it doesnt say `concept` it's not a concept |
03:21:09 | FromDiscord | <spoon> how would manually defining a 3 or 4 dimensional array work then? |
03:21:36 | FromDiscord | <Elegantbeef> `var a = [[[[1]]][[[[2]]]]` |
03:21:46 | FromDiscord | <huantian> mmm syntax |
03:21:48 | FromDiscord | <Elegantbeef> with a comma |
03:22:04 | FromDiscord | <huantian> I feel like i'm writing lisp |
03:22:09 | FromDiscord | <Elegantbeef> If you're manually defining a 4D array you have bigger problems |
03:23:21 | FromDiscord | <Zectbumo> I would macro that to `var a = [4x4]` |
03:23:51 | FromDiscord | <spoon> right, was just saying if i wanted a 3-dimensional grid of objects, seq or otherwise, and i wanted to fill it in algorithmically after assigning it, wouldn't that require using `var b: array[3, array[3, array[3, int]]]` |
03:23:57 | FromDiscord | <Elegantbeef> I'd just make a procedure `matrix[4](myVec4, myVec4, myVec4, myVec4)` |
03:24:14 | FromDiscord | <Elegantbeef> Yes it'd |
03:24:24 | FromDiscord | <Elegantbeef> That is the type afterall |
03:24:59 | FromDiscord | <Elegantbeef> You could also just do `array[27, int]` like most would |
03:25:59 | FromDiscord | <TechnoRazor> sent a code paste, see https://play.nim-lang.org/#ix=3Y2U |
03:26:01 | FromDiscord | <Elegantbeef> Then make your own `[a, b]` and `[a, b, c]` |
03:26:06 | FromDiscord | <TechnoRazor> (edit) "https://play.nim-lang.org/#ix=3Y2U" => "https://paste.rs/qh1" |
03:26:51 | FromDiscord | <Elegantbeef> Jeez that's silly |
03:26:59 | FromDiscord | <TechnoRazor> it works ¯\_(ツ)_/¯ |
03:27:01 | FromDiscord | <spoon> lol |
03:27:06 | FromDiscord | <Elegantbeef> Just use distinct |
03:27:19 | FromDiscord | <huantian> that's gonna be the words on your gravestone beef |
03:27:26 | FromDiscord | <Elegantbeef> Indeed |
03:27:26 | FromDiscord | <TechnoRazor> but then i'd have to borrow every seq & openArray function i wanted to use? no thanks |
03:27:33 | FromDiscord | <Elegantbeef> No you dont |
03:27:49 | FromDiscord | <Elegantbeef> You can use converters or make a template |
03:28:01 | FromDiscord | <TechnoRazor> that's just as frustrating |
03:28:25 | FromDiscord | <TechnoRazor> i messed around with templates & converters, and they did not work as well as that concept |
03:28:43 | FromDiscord | <Elegantbeef> QED |
03:28:46 | FromDiscord | <Elegantbeef> sent a code paste, see https://play.nim-lang.org/#ix=3Y2V |
03:29:45 | FromDiscord | <Elegantbeef> you can of course even make it `a` |
03:29:55 | FromDiscord | <Elegantbeef> Then internally you lose all that typing |
03:30:06 | FromDiscord | <TechnoRazor> `distinctBase` returns a typedesc |
03:31:05 | FromDiscord | <Elegantbeef> No it doesnt |
03:31:20 | FromDiscord | <TechnoRazor> https://media.discordapp.net/attachments/371759389889003532/976326094930214962/unknown.png |
03:31:36 | FromDiscord | <Elegantbeef> Test it before you spepak |
03:31:37 | FromDiscord | <Elegantbeef> speak even |
03:32:23 | FromDiscord | <Elegantbeef> sent a code paste, see https://play.nim-lang.org/#ix=3Y2W |
03:32:52 | FromDiscord | <Elegantbeef> sent a code paste, see https://play.nim-lang.org/#ix=3Y2X |
03:32:58 | FromDiscord | <Elegantbeef> When on a variable it returns the type converted variable |
03:33:03 | FromDiscord | <Elegantbeef> When used on a type it returns the base type |
03:33:11 | FromDiscord | <TechnoRazor> is the documentation wrong then? |
03:33:15 | FromDiscord | <TechnoRazor> oh |
03:33:18 | FromDiscord | <Elegantbeef> Well the above works |
03:33:30 | FromDiscord | <TechnoRazor> right, i didn't notice the template at the bottom |
03:33:32 | FromDiscord | <TechnoRazor> my bad |
03:33:37 | FromDiscord | <TechnoRazor> (edit) "right, i didn't notice the template at the bottom ... " added "of the documentation" |
03:33:47 | FromDiscord | <Elegantbeef> Ah ok |
03:34:16 | FromDiscord | <Elegantbeef> I've been using it a shit ton with my wasm wrapping so it's a bit funny to hear it doesnt do what i know it does 😄 |
03:34:35 | FromDiscord | <TechnoRazor> yeah i get that, i was just confused |
03:35:08 | FromDiscord | <huantian> In reply to @Elegantbeef "I've been using it": no beef we're not gaslighting you |
03:35:30 | FromDiscord | <Elegantbeef> Good i'm to be flame broiled |
03:38:15 | FromDiscord | <TechnoRazor> sent a code paste, see https://play.nim-lang.org/#ix=3Y2Z |
03:38:17 | FromDiscord | <TechnoRazor> (edit) "https://play.nim-lang.org/#ix=3Y2Z" => "https://paste.rs/CEL" |
03:38:22 | FromDiscord | <Elegantbeef> Like i said you can use a converter |
03:38:37 | FromDiscord | <TechnoRazor> i think converters didn't work with functions that take `openArray`s |
03:38:40 | FromDiscord | <TechnoRazor> im not certain |
03:38:44 | FromDiscord | <Elegantbeef> Correct |
03:38:51 | FromDiscord | <TechnoRazor> so it's still frustrating |
03:39:31 | FromDiscord | <TechnoRazor> i really feel like my concept solution was the neatest for my case, as silly as it is |
03:40:43 | FromDiscord | <TechnoRazor> In reply to @TechnoRazor "going back to this;": and i don't know the answer to this: would converting types like this, or using converters, slow things down at all? |
03:41:02 | FromDiscord | <TechnoRazor> (edit) "would" => "wouldn't" |
03:42:32 | FromDiscord | <Elegantbeef> the conversion for distincts are free so the converter proc call would be a cost, but it'd probably be inlined in most builds |
03:42:51 | FromDiscord | <TechnoRazor> right |
03:43:14 | FromDiscord | <TechnoRazor> in any case im sticking with my silly little solution |
03:48:22 | FromDiscord | <retkid> what the fuck is =?= |
03:48:33 | FromDiscord | <Elegantbeef> an opeprator |
03:48:34 | FromDiscord | <huantian> probably someone's custom operator |
03:48:39 | FromDiscord | <Elegantbeef> operoeproepreorator |
03:48:48 | FromDiscord | <huantian> orpororatoerorotor? |
03:48:58 | FromDiscord | <retkid> In reply to @huantian "probably someone's custom operator": ye im stupid i didn't see the definition until right after i typed it |
03:49:08 | FromDiscord | <retkid> return cmpIgnoreCase(a, b) == 0 |
03:49:17 | FromDiscord | <retkid> (edit) "return cmpIgnoreCase(a, b) == 0" => "sent a code paste, see https://play.nim-lang.org/#ix=" |
03:49:17 | FromDiscord | <retkid> fair |
04:15:31 | * | slowButPresent quit (Quit: ERC 5.4 (IRC client for GNU Emacs 28.1)) |
05:55:02 | FromDiscord | <everyone> In reply to @huantian "orpororatoerorotor?": orpotatoporteratororpotator |
05:58:58 | * | ltriant_ joined #nim |
06:01:03 | * | ltriant quit (Ping timeout: 246 seconds) |
06:01:24 | * | Ekho quit (Ping timeout: 246 seconds) |
06:01:24 | * | NimEventer quit (Ping timeout: 246 seconds) |
06:01:36 | * | NimEventer joined #nim |
06:06:57 | * | Ekho- joined #nim |
06:18:05 | * | Ekho- is now known as Ekho |
06:39:04 | * | wallabra quit (Quit: ZNC 1.8.2 - https://znc.in - Stopping for maintenance... Leave messages at my XMPP ([email protected]), or my Discord (Gustavo6046#9009), or possibly my Mastodon [email protected]), or email ([email protected]).) |
06:39:35 | FromDiscord | <Zectbumo> @ElegantBeef , now you have me thinking when I spot stuff in the stdlib. So for example, os.lastPathPart says it's "aka: baseName" but basename would return empty string "" when passed "foo/bar/" so no, it's not like basename. I think it should act like basename as they actually thought they were doing |
06:40:18 | FromDiscord | <Zectbumo> https://nim-lang.org/docs/os.html#lastPathPart%2Cstring |
06:41:08 | FromDiscord | <Zectbumo> this is the proc that should be saying that it's like basename:↵https://nim-lang.org/docs/os.html#extractFilename%2Cstring |
06:43:21 | FromDiscord | <that_dude> In reply to @Zectbumo "<@145405730571288577> , now you": I've been looking into starting to participate in pr's so it would be awesome if you could collect a list of various things like this |
06:44:01 | FromDiscord | <that_dude> At least to look at |
06:44:01 | FromDiscord | <Zectbumo> sounds good. I just started. this is my first note |
06:44:22 | FromDiscord | <that_dude> :) |
06:45:09 | * | wallabra joined #nim |
06:58:14 | * | PMunch joined #nim |
07:37:24 | FromDiscord | <everyone> can somebody give me an example code of a simple hello world cli made with std/parseopts? I am having a hard time understanding it from the docs. |
07:50:56 | PMunch | @everyone, isn't there one in the docs? |
07:51:07 | PMunch | https://nim-lang.org/docs/parseopt.html |
07:52:37 | FromDiscord | <everyone> In reply to @PMunch "<@856412455507984404>, isn't there one": ik but it's A BIT confusing |
07:52:58 | PMunch | Which part is confusing to you? |
07:53:10 | FromDiscord | <everyone> In reply to @PMunch "Which part is confusing": basically everything |
07:53:37 | PMunch | Well that certainly makes it harder to try and explain what's going on.. |
07:53:39 | FromDiscord | <everyone> like, what is in the `initOptParser` |
07:53:55 | PMunch | initOptParser is called with the string you want to parse as options |
07:54:05 | FromDiscord | <everyone> `cmdShortOption, cmdLongOption` |
07:54:18 | FromDiscord | <everyone> `cmdArgument` |
07:54:24 | FromDiscord | <everyone> `cmdEnd` |
07:54:59 | PMunch | Typically this would be commandLineParams |
07:55:53 | PMunch | cmdShortOption and cmdLongOption corresponds to -a and --argument respectively |
07:56:49 | PMunch | cmdArgument are arguments like file.txt without any dashes |
07:57:04 | PMunch | And cmdEnd just tells you that you've reached the end of the options |
07:57:06 | FromDiscord | <everyone> In reply to @PMunch "cmdShortOption and cmdLongOption corresponds": isn't the `--argument` called flag? |
07:57:43 | PMunch | Well flags are options without a value |
07:58:17 | FromDiscord | <everyone> sooo how do we run this? |
07:58:40 | PMunch | Plop it in a file and do `nim c -r myfile.nim <any arguments here>` |
07:58:58 | PMunch | Or of course do `nim c myfile.nim` and then `./myfile <arguments>` |
07:59:06 | FromDiscord | <everyone> hmmm |
08:01:16 | FromDiscord | <everyone> and what is this ` p.next()` |
08:01:45 | PMunch | That selects the next argument |
08:02:19 | FromDiscord | <everyone> In reply to @PMunch "That selects the next": which is..... |
08:02:37 | PMunch | Whatever the next argument in your input is.. |
08:02:58 | PMunch | If you leave it out you will just get the same argument forever in the loop there |
08:03:01 | FromDiscord | <everyone> oh |
08:03:17 | PMunch | So it would just say "Option: a" over and over again |
08:04:05 | * | sagax quit (Remote host closed the connection) |
08:11:07 | FromDiscord | <choltreppe> sent a code paste, see https://play.nim-lang.org/#ix=3Y3y |
08:11:28 | FromDiscord | <Yardanico> In reply to @choltreppe "I noticed something: this": the first one working is actually a bug |
08:11:38 | FromDiscord | <choltreppe> ah ok |
08:11:44 | FromDiscord | <Yardanico> lemme reference the manual on this |
08:13:10 | FromDiscord | <Yardanico> In reply to @choltreppe "ah ok": but basically IIRC there's a rule that if you've used `result` in the proc body, then a return like that won't work |
08:15:59 | FromDiscord | <choltreppe> ok thx |
08:16:18 | FromDiscord | <Yardanico> In reply to @choltreppe "ok thx": actually doesn't look like it's in the manual (or I missed it), but it is in the first tutorial |
08:16:23 | FromDiscord | <Yardanico> "A procedure that does not have any return statement and does not use the special result variable returns the value of its last expression." |
08:20:12 | * | ltriant_ quit (Ping timeout: 260 seconds) |
08:20:34 | * | ltriant joined #nim |
08:24:30 | * | krux02 joined #nim |
08:28:01 | FromDiscord | <Yardanico> hah, realised that `nil` is still not deprecated but not also documented regarding its use instead of `discard` in procedure bodies :) |
08:35:33 | * | xet7 quit (Remote host closed the connection) |
08:36:50 | * | xet7 joined #nim |
08:37:28 | FromDiscord | <everyone> sent a code paste, see https://play.nim-lang.org/#ix=3Y3F |
08:39:06 | FromDiscord | <Yardanico> @everyone it's .key not .val |
08:39:14 | FromDiscord | <Yardanico> .key is the name, .val is the value of the argument |
08:39:22 | FromDiscord | <everyone> In reply to @Yardanico ".key is the name,": hmmmm |
08:40:29 | FromDiscord | <everyone> In reply to @Yardanico "<@856412455507984404> it's .key not": i changed .val to .key, still not working |
08:40:34 | FromDiscord | <Yardanico> because you have a space in the string |
08:40:40 | FromDiscord | <Yardanico> it's `"version"` not `" version"` |
08:40:43 | FromDiscord | <everyone> bruh |
08:41:31 | FromDiscord | <m4ul3r> sent a code paste, see https://play.nim-lang.org/#ix=3Y3H |
08:44:09 | FromDiscord | <everyone> ok so now it is working when i use `.\main.exe --version`, but it is also working when i use `.\main.exe --joe` |
08:44:14 | FromDiscord | <Elegantbeef> check the kind of `j` then use the proper accessor |
08:47:09 | FromDiscord | <Yardanico> In reply to @m4ul3r "I'm planning on iterating": why not https://nim-lang.org/docs/json.html#pairs.i%2CJsonNode ? it'll be more efficient |
08:47:18 | FromDiscord | <Yardanico> since getFields has to store everything in a seq first, while pairs is an iterator |
08:50:09 | FromDiscord | <m4ul3r> that's much easier, thanks! |
08:52:30 | * | jmdaemon quit (Ping timeout: 260 seconds) |
08:59:29 | * | krux02 quit (Remote host closed the connection) |
09:33:34 | * | firq quit (Ping timeout: 250 seconds) |
09:37:14 | * | firq joined #nim |
09:41:05 | FromDiscord | <Zectbumo> sent a code paste, see https://play.nim-lang.org/#ix=3Y3V |
09:42:42 | FromDiscord | <Rika> I didn’t know that |
09:43:00 | FromDiscord | <Rika> That’s one way to do a cursed different-value-assign |
09:43:10 | FromDiscord | <Rika> Just have a proc that’s stateful |
09:43:46 | FromDiscord | <m4ul3r> sent a code paste, see https://play.nim-lang.org/#ix=3Y3W |
09:43:56 | FromDiscord | <Yardanico> not sure I understand the question |
09:43:57 | FromDiscord | <Rika> I don’t get it |
09:44:01 | FromDiscord | <Yardanico> you just construct an object normally and add it to the sequence |
09:44:05 | FromDiscord | <Yardanico> there's nothing unusual about that |
09:44:08 | FromDiscord | <m4ul3r> (edit) "https://play.nim-lang.org/#ix=3Y3W" => "https://play.nim-lang.org/#ix=3Y3X" |
09:44:31 | FromDiscord | <Yardanico> sent a code paste, see https://play.nim-lang.org/#ix=3Y3Y |
09:45:45 | FromDiscord | <m4ul3r> would all objects in the sequence not have variable names? |
09:45:55 | FromDiscord | <Yardanico> there's no concept of "variable name" at runtime |
09:46:04 | FromDiscord | <Yardanico> because that's just an abstraction for the compiler and developer |
09:46:07 | FromDiscord | <Yardanico> maybe you actually want a table? |
09:46:12 | FromDiscord | <Yardanico> https://nim-lang.org/docs/tables.html |
09:46:14 | FromDiscord | <Rika> Do you mean reference |
09:46:36 | FromDiscord | <Yardanico> tables is what you should use if you want to have some strings (or other types) as keys to refer to some objects in memory |
09:47:27 | FromDiscord | <m4ul3r> That might be what I need for this case, i'll check it out |
10:08:38 | * | kenran joined #nim |
10:08:51 | * | kenran quit (Client Quit) |
10:39:56 | om3ga | https://0bin.net/paste/t14fcr-7#5IT7760z3UzdOc4tfls2eNCeBxPpICza3Xjq-Z5icJd <---- I have fun time |
10:40:36 | om3ga | the ridiculous thing, that code worked before |
10:40:54 | om3ga | and it works if I disable --opt:speed |
10:42:16 | om3ga | What I want to ask, is the allocShared0 "stable" function? Can I use it with any GC? |
10:45:40 | FromDiscord | <oliverwilliams> I'll help 10 people on how to earn $20,000 within 72 hours but you will pay me 10% of your profit when you receive it.↵Note\: only interested people should apply, drop a message let's get started↵https://t.me/Tradewitholiver01 |
10:46:24 | om3ga | hmm, spam? :) |
10:46:25 | FromDiscord | <Yardanico> [federico3](https://matrix.to/#/@federico.ceratto:matrix.org)\: can you remove the message on matrix though? |
10:46:26 | FromDiscord | <Yardanico> i can't for some reason |
10:46:42 | PMunch | om3ga, yes, spam |
10:56:39 | PMunch | Hmm, looking at V-USB I don't think it should be too hard to part it to Nim |
10:57:09 | PMunch | Probably re-use the assembly files for the timing critical parts |
10:59:20 | PMunch | And create a shared interface with the USB chip on the Atmega32u4 |
11:17:36 | om3ga | Another question, can binary from subcatalog for example : modulemodule_name affect final result, if that module was imported from upper level : import module/module_name ? |
11:18:53 | FromDiscord | <Rika> I don’t understand the question |
11:18:56 | om3ga | Geany IDE puts binary, after compilation in the same catalog, so I press accidentally that button sometimes |
11:19:36 | om3ga | for example I have main.nim, which imports module from ./module/modulename |
11:20:25 | om3ga | if I compile ./module/modulename.nim, geany puts binary here > ./module/modulename |
11:21:07 | PMunch | That shouldn't affect anything |
11:21:17 | om3ga | thanks |
11:21:30 | PMunch | Or to put it this way, if you aren't sure if it affects anything, it probably doesn't |
11:21:48 | om3ga | I removed it, and that errors gone |
11:21:48 | FromDiscord | <enthus1ast> only if you have a folder called "modulename" and are on linux that has no executable suffix |
11:21:50 | PMunch | You could of course write a macro which detects the presence of that file and does something with it |
11:22:02 | om3ga | strange things I have here, trying to debug that |
11:22:17 | PMunch | om3ga, what error did you get |
11:22:24 | om3ga | undefined behavior somewhere, looks like something tries to read from null |
11:22:43 | om3ga | here is example with gcc https://0bin.net/paste/t14fcr-7#5IT7760z3UzdOc4tfls2eNCeBxPpICza3Xjq-Z5icJd |
11:24:16 | om3ga | I should try to compact the code which gives the same err, and maybe that will help to understand |
11:25:32 | PMunch | Yes, creating a minimal reproduction is always a good idea |
11:27:03 | om3ga | https://0bin.net/paste/toW0F87v#ePdBScO-/n44OjuwF9OHIa3djjLtIPZLZBK985e9Jo1 |
11:27:21 | om3ga | that's what now it says, after I deleted all leftover binaries |
11:28:15 | om3ga | #7 and #6 - strange |
11:29:53 | PMunch | Hard to tell without seeing any code |
11:30:41 | om3ga | yes, of course, I will copy minimal non-working example |
11:31:01 | om3ga | or maybe I will find the error by myself during that process :) |
11:31:46 | FromDiscord | <d4rckh> which nim web server runs best in a thread? |
11:32:16 | FromDiscord | <d4rckh> or asynchronously |
11:32:21 | PMunch | @d4rckh, benchmark and find out :) |
11:32:38 | FromDiscord | <d4rckh> haha |
11:32:59 | om3ga | d4rckh, you can use httperf for benchmarking |
11:33:45 | FromDiscord | <d4rckh> i think ill go with jester |
11:35:28 | FromDiscord | <enthus1ast> think most of the time this actually does not matter, since you might have a caching reverse proxy, and application logic that takes a while, database connection, etc, i think most importantly is having a correct webserver \:)↵(@d4rckh) |
11:36:20 | FromDiscord | <enthus1ast> and also stuff like\: authentication etc must be doable |
11:36:22 | FromDiscord | <enthus1ast> and websocket |
11:36:33 | FromDiscord | <d4rckh> hmm, i see |
11:36:41 | FromDiscord | <enthus1ast> maybe even compression (but this is often also done in the proxy) |
11:36:58 | FromDiscord | <d4rckh> how would i run jester in async? |
11:37:17 | FromDiscord | <d4rckh> and call this using `asyncCheck startHttpAPI()` |
11:37:18 | FromDiscord | <d4rckh> sent a code paste, see https://play.nim-lang.org/#ix=3Y4j |
11:38:00 | FromDiscord | <Rika> Looks wrong, doesn’t serve run the async loop? |
11:38:27 | om3ga | I continue to use fcgi lib for that reasons. Exactly that's what I'm doing right now |
11:39:05 | om3ga | 3000 requests per second <=1000 requests in parallel with lighttpd |
11:39:32 | FromDiscord | <d4rckh> In reply to @Rika "Looks wrong, doesn’t serve": should i run server using asyncCheck? |
11:39:57 | FromDiscord | <d4rckh> ok that didnt work |
11:44:16 | FromDiscord | <enthus1ast> is jester the only thing that should run async in your code? |
11:44:45 | FromDiscord | <d4rckh> nah, there are multiple things that run in async |
11:45:07 | FromDiscord | <enthus1ast> https://github.com/dom96/jester/blob/2551a8cfce7faa7a60500bf25acc2cc81b79d1b0/jester.nim#L515 |
11:45:15 | FromDiscord | <enthus1ast> serve calls runForever |
11:45:29 | FromDiscord | <enthus1ast> which is just a while loop that calls poll |
11:45:49 | FromDiscord | <enthus1ast> so serve drives the async loop |
11:45:56 | FromDiscord | <d4rckh> ah yes |
11:45:58 | FromDiscord | <d4rckh> fixed it |
11:46:02 | FromDiscord | <enthus1ast> what you could do is to run other stuff before that |
11:46:08 | FromDiscord | <d4rckh> yup |
11:46:15 | FromDiscord | <enthus1ast> with asyncCheck |
11:46:17 | FromDiscord | <enthus1ast> kk |
11:46:50 | PMunch | There really should be a version without runForever.. |
11:46:57 | FromDiscord | <enthus1ast> yeas |
11:47:02 | FromDiscord | <enthus1ast> yeah/yes |
11:47:35 | FromDiscord | <d4rckh> ok, now my other things are slow :\( |
11:48:13 | FromDiscord | <enthus1ast> just slow all the time? Or when you do stuff in your http routes? |
11:48:16 | FromDiscord | <d4rckh> for example i read stdin in a thread and `await asyncdispatch.sleepAsync(100)` |
11:48:28 | FromDiscord | <d4rckh> and it takes like 1 second to read what i typed |
11:49:27 | FromDiscord | <d4rckh> ok sometimes its faster |
11:49:28 | FromDiscord | <d4rckh> its weird |
11:49:31 | FromDiscord | <d4rckh> heh |
11:50:12 | PMunch | That sounds like a weird way of doing it.. |
11:50:18 | FromDiscord | <enthus1ast> first thing i would try is to change the poll timeout (but you cant easily because jester drives the async loop \:) ) |
11:50:28 | FromDiscord | <d4rckh> yup |
11:52:05 | FromDiscord | <enthus1ast> `await asyncdispatch.sleepAsync(100)` you call in a loop to wait for the flow var to complete right? |
11:52:15 | FromDiscord | <d4rckh> exactly |
11:53:31 | FromDiscord | <enthus1ast> yeah, i would just fork jester, copy and paste the serve and remove the waitForever (if this code path is taken at all, since it also could be httpbeast, which i do not know), or use something else |
11:53:50 | FromDiscord | <enthus1ast> ahm runForever i mean |
11:54:35 | FromDiscord | <enthus1ast> depending on what you wanna do with http, asynchttp server might be enough already |
11:54:45 | FromDiscord | <enthus1ast> must do the routing yourself though |
11:56:37 | FromDiscord | <enthus1ast> for this i've used code from that repo in the past\: https://github.com/enthus1ast/nimAsyncHttpTools/tree/master/src |
11:58:56 | FromDiscord | <d4rckh> got it |
11:58:59 | FromDiscord | <d4rckh> will probably do this later |
11:59:55 | FromDiscord | <d4rckh> is there any way to pass paramters to a jester router? |
12:00:14 | FromDiscord | <d4rckh> I'd like to access server props in myrouter |
12:00:38 | FromDiscord | <d4rckh> sent a code paste, see https://paste.rs/5aS |
12:00:54 | FromDiscord | <enthus1ast> globals maybe? |
12:01:31 | FromDiscord | <enthus1ast> but idk really, would have a look how router is implemented, guess its a macro |
12:06:58 | FromDiscord | <d4rckh> okay, globals worked |
12:07:08 | FromDiscord | <enthus1ast> but are ugly af |
12:08:18 | FromDiscord | <d4rckh> i guess |
12:08:29 | FromDiscord | <d4rckh> now i want to send over a sequence using json |
12:08:54 | FromDiscord | <enthus1ast> mh ok the macro generates procs\: |
12:09:15 | FromDiscord | <d4rckh> In reply to @d4rckh "now i want to": this does not really work `$(toJson server.clients)` |
12:09:16 | FromDiscord | <enthus1ast> sent a code paste, see https://paste.rs/cfW |
12:09:38 | FromDiscord | <enthus1ast> $(%\ server.clients) |
12:09:43 | FromDiscord | <d4rckh> sent a code paste, see https://play.nim-lang.org/#ix=3Y4q |
12:09:57 | FromDiscord | <enthus1ast> or is it jsony? |
12:10:08 | FromDiscord | <d4rckh> that worked |
12:10:24 | FromDiscord | <d4rckh> except now it complains about an attribute of a client |
12:10:31 | FromDiscord | <d4rckh> a tuple, actually |
12:10:39 | FromDiscord | <d4rckh> cant it convert it to a json object? |
12:11:10 | FromDiscord | <d4rckh> sent a code paste, see https://play.nim-lang.org/#ix= |
12:13:33 | FromDiscord | <enthus1ast> mh could be that you must define a proc `%`(mytype)\: JsonNode = for it |
12:14:23 | FromDiscord | <d4rckh> ouch |
12:14:50 | FromDiscord | <enthus1ast> but then the parsing is the issue, i THINK you can define a parsing proc as well nowadays but not done it for std/json yet |
12:21:18 | FromDiscord | <d4rckh> `Error: 'myrouterIter' is not GC-safe as it accesses 'server' which is a global using GC'ed memory` |
12:21:20 | FromDiscord | <d4rckh> god |
12:22:49 | * | vicecea joined #nim |
12:24:18 | FromDiscord | <enthus1ast> Can try to wrap it in a gcsafe cast |
12:25:32 | FromDiscord | <enthus1ast> But when you use threads (or http east which uses threads imho, you must secure the access via locks |
12:26:13 | FromDiscord | <d4rckh> its just a damn object reference... |
12:27:44 | FromDiscord | <enthus1ast> https://nim-lang.org/docs/manual.html#effect-system-gc-safety-effect |
12:28:02 | FromDiscord | <enthus1ast> This one |
12:28:25 | FromDiscord | <enthus1ast> proc setPerThread() = {.cast(gcsafe).}\: deepCopy(perThread, someGlobal) |
12:33:57 | * | lumo_e joined #nim |
12:42:30 | FromDiscord | <billykin> https://t.me/Tradewitholiver01 |
12:43:09 | FromDiscord | <d4rckh> In reply to @enthus1ast "proc setPerThread() = {.cast(gcsafe).}\:": i see, thanks |
12:47:00 | * | lumo_e quit (Ping timeout: 272 seconds) |
12:54:54 | PMunch | WARNING: The message from @billykin is a SCAM, do not click the link |
13:02:49 | FromDiscord | <enthus1ast> "trade" in the url == "scam" or "stupid nft" |
13:13:37 | FromDiscord | <Zoom> Well, [Matt Rader](https://www.mattrader.com/) wants a word with you. |
13:14:05 | FromDiscord | <enthus1ast> What is Matt Rader? |
13:14:36 | FromDiscord | <sheerluck> my trader |
13:15:35 | FromDiscord | <sheerluck> like Saul Goodman and "it's all good, man!" |
13:16:05 | FromDiscord | <enthus1ast> ah ok "t Rade" ic |
13:16:17 | FromDiscord | <enthus1ast> took longer than i would like to admit |
13:19:13 | * | dithpri joined #nim |
13:25:30 | * | genpaku quit (Ping timeout: 276 seconds) |
13:25:39 | * | dithpri quit (Quit: '); DROP TABLE Users;--) |
13:32:00 | * | genpaku joined #nim |
13:33:49 | * | vicfred joined #nim |
13:45:00 | * | LuxuryMode joined #nim |
14:11:19 | * | lumo_e joined #nim |
14:30:58 | FromDiscord | <Xzayler> I'm having a very basic problem...↵I have norm installed through nimble and when I compile `import norm` I get a `cannot open file` error.... |
14:31:13 | FromDiscord | <Xzayler> what directory is supposed to be in my $PATH? |
14:31:17 | FromDiscord | <Xzayler> or is that even the problem? |
14:36:35 | * | piapiac quit (Remote host closed the connection) |
14:46:23 | FromDiscord | <demotomohiro> Which file `cannot open file`? |
14:48:06 | FromDiscord | <jmiven> do you have the `requires "norm"` line in your_project.nimble? |
14:52:59 | FromDiscord | <Xzayler> In reply to @demotomohiro "Which file `cannot open": norm |
14:53:18 | FromDiscord | <Xzayler> In reply to @jmiven "do you have the": not sure? I installed norm with nimble |
14:54:02 | FromDiscord | <Xzayler> I don't have a file like thta |
14:54:04 | FromDiscord | <Xzayler> (edit) "thta" => "that" |
14:54:30 | NimEventer | New thread by Stoneface86: Problem with doc gen and runnableExamples, see https://forum.nim-lang.org/t/9161 |
14:54:31 | FromDiscord | <Xzayler> AH wait I do |
14:55:45 | FromDiscord | <Xzayler> In reply to @jmiven "do you have the": Ok that fixed it, thanks |
15:08:40 | FromDiscord | <choltreppe> Is there any way to define/overload default values of types? |
15:12:23 | FromDiscord | <huantian> Could you elaborate? |
15:17:01 | FromDiscord | <choltreppe> sent a code paste, see https://play.nim-lang.org/#ix=3Y5s |
15:17:04 | FromDiscord | <choltreppe> for the type |
15:18:13 | FromDiscord | <huantian> If you wanna differentiate between a value and no value |
15:18:20 | FromDiscord | <huantian> You should use std/options |
15:18:36 | FromDiscord | <stoneface> don't think so, I know you can overload `default` but it will still zero initialize the type |
15:19:22 | FromDiscord | <huantian> options will default to none(int), and if you want a value you just set it to some(10). Just using int as an example, other types work too |
15:19:24 | * | noeontheend joined #nim |
15:21:13 | om3ga | PMunch, could you please check this https://drive.google.com/file/d/1L614Lroc7oJahPmCXRrVvgNyCokouuZB/view?usp=sharing |
15:21:32 | om3ga | minimal version of the code |
15:22:27 | FromDiscord | <choltreppe> Yea I Bad that idea aswell was abit disapointed that dient work |
15:24:00 | FromDiscord | <choltreppe> Had |
15:25:46 | FromDiscord | <stoneface> relevant RFC - https://github.com/nim-lang/RFCs/issues/233 |
15:42:39 | om3ga | good idea, I hate to initialize each time |
15:56:01 | FromDiscord | <ambient> sent a code paste, see https://play.nim-lang.org/#ix=3Y5H |
15:56:18 | FromDiscord | <ambient> (edit) "https://play.nim-lang.org/#ix=3Y5H" => "https://play.nim-lang.org/#ix=3Y5I" |
15:56:39 | FromDiscord | <ambient> without writing a separate function that is |
16:11:33 | * | noeontheend quit (Ping timeout: 252 seconds) |
16:34:40 | FromDiscord | <d4rckh> what's wrong with this proc? |
16:34:43 | FromDiscord | <d4rckh> sent a code paste, see https://play.nim-lang.org/#ix=3Y5U |
16:34:49 | FromDiscord | <d4rckh> it prints `1` every time i run it |
16:34:52 | FromDiscord | <d4rckh> and then `hi` |
16:34:59 | FromDiscord | <d4rckh> but if i call it a second time |
16:35:10 | FromDiscord | <d4rckh> it only prints `1` |
16:35:13 | FromDiscord | <d4rckh> but nothing is sent |
16:35:18 | FromDiscord | <d4rckh> (edit) "but" => "and" |
16:35:53 | FromDiscord | <d4rckh> https://media.discordapp.net/attachments/371759389889003532/976523529254211644/unknown.png |
16:38:01 | FromDiscord | <d4rckh> ok, if i completely restart the server, connect my websocket client it works, until i reconnect the client |
16:38:30 | * | smvg joined #nim |
16:38:46 | FromDiscord | <d4rckh> this is very weird |
16:39:11 | * | jmdaemon joined #nim |
16:44:47 | * | LuxuryMode quit (Quit: Connection closed for inactivity) |
16:48:18 | * | lumo_e quit (Ping timeout: 272 seconds) |
16:50:13 | FromDiscord | <d4rckh> sometimes it sends data sometimes it doesnt |
16:56:36 | FromDiscord | <d4rckh> okay i see the problem, once i sent something, the socket closes for some reason |
16:56:41 | FromDiscord | <d4rckh> (edit) "sent" => "send" |
17:14:48 | NimEventer | New thread by Jmgomez: NimForUE , see https://forum.nim-lang.org/t/9162 |
17:32:07 | * | krux02 joined #nim |
17:39:36 | FromDiscord | <Xzayler> sent a code paste, see https://play.nim-lang.org/#ix=3Y68 |
17:40:09 | FromDiscord | <Xzayler> I'm just trying to iterate through all objects within the sequence regardless of how many objects are inside of it |
17:40:28 | FromDiscord | <Xzayler> (edit) "https://play.nim-lang.org/#ix=3Y68" => "https://play.nim-lang.org/#ix=3Y69" |
17:41:17 | FromDiscord | <Xzayler> sent a code paste, see https://play.nim-lang.org/#ix=3Y6a |
17:41:18 | FromDiscord | <Xzayler> just the iterator version doesn't |
17:48:30 | FromDiscord | <demotomohiro> It seems that `insert` proc requires `var T` but `plant` in your for loop is not mutable. |
17:49:17 | FromDiscord | <demotomohiro> `for plant in plants.mitems:` would work. |
17:50:48 | FromDiscord | <d4rckh> ok i am trying this now |
17:50:59 | FromDiscord | <d4rckh> sent a code paste, see https://play.nim-lang.org/#ix=3Y6b |
17:51:04 | FromDiscord | <d4rckh> even tho the state is `Open`, I don't receive any data |
17:51:07 | FromDiscord | <d4rckh> (edit) "even tho the state is `Open`, I don't receive any data ... " added "on my websocket client" |
17:52:53 | FromDiscord | <Rika> What library is this |
17:53:16 | FromDiscord | <d4rckh> ws |
17:53:19 | FromDiscord | <d4rckh> im using it in combination with jester |
17:54:58 | FromDiscord | <geekrelief> for nimble to install dependencies via `requires` it seems I have to run `nimble build`, but for a custom task, is there a way I can get nimble to pull the dependencies? |
18:16:17 | * | dtomato quit (Quit: The Lounge - https://thelounge.chat) |
18:17:20 | * | dtomato joined #nim |
18:18:44 | * | dtomato quit (Client Quit) |
18:19:35 | * | dtomato joined #nim |
18:21:38 | * | dtomato quit (Client Quit) |
18:22:00 | * | dtomato joined #nim |
18:23:21 | * | vicfred quit (Quit: Leaving) |
18:32:33 | * | lumo_e joined #nim |
18:35:11 | * | lumo_e quit (Read error: Connection reset by peer) |
18:52:21 | * | kenran joined #nim |
18:56:12 | * | PMunch quit (Quit: leaving) |
19:00:19 | FromDiscord | <Recruit_main707> ignoring implicit passes by reference, does it make sense to use `seq[ref Car]` when Car is a pretty big object? Or since its a seq its not useful? |
19:00:20 | * | haliucinas quit (Ping timeout: 260 seconds) |
19:02:47 | FromDiscord | <Rika> It will consume the same amount memory, but not contiguous which can be good or bad |
19:02:54 | FromDiscord | <Rika> Depending on your situation |
19:03:04 | FromDiscord | <Rika> In reply to @Rika "It will consume the": Roughly the same |
19:03:27 | FromDiscord | <Rika> The ref version is larger by Npointer size |
19:03:36 | FromDiscord | <Recruit_main707> thats what i thought |
19:04:32 | FromDiscord | <Recruit_main707> i guess since ill be creating a lot of them with not so many cars inside id rahter have them without the ref |
19:04:56 | FromDiscord | <Rika> Contiguity is good for cache |
19:05:43 | FromDiscord | <Recruit_main707> yeah, ok thanks rika |
19:08:05 | FromDiscord | <Rika> In constrained memory situations fragmented memory makes it difficult to allocate contiguous blocks |
19:08:32 | FromDiscord | <Rika> Further fragmenting memory by using indirection isn’t a good solution though |
19:11:10 | FromDiscord | <Recruit_main707> https://tenor.com/view/the-more-you-know-gif-10358303 |
19:17:20 | FromDiscord | <ynfle> In reply to @Xzayler "any idea why this": Try |
19:17:39 | FromDiscord | <ynfle> sent a code paste, see https://play.nim-lang.org/#ix=3Y6o |
19:17:49 | FromDiscord | <ynfle> (edit) "https://play.nim-lang.org/#ix=3Y6o" => "https://paste.rs/Djd" |
19:17:53 | FromDiscord | <ynfle> You need the mutable version of the iterator |
19:23:15 | * | vicfred joined #nim |
19:26:35 | FromDiscord | <planetis> In reply to @Recruit_main707 "**ignoring implicit passes by": ref would be faster when mutating the seq, sorting, etc but ref semantics are also more error prone |
19:27:29 | FromDiscord | <planetis> but yes when updating all cars in a loop, seq[car] might be better |
19:44:40 | FromDiscord | <demotomohiro> `setLen` or `add` to `seq[Car]` can reallocate internal heap and need to copy all new elements to new heap.↵`insert` to `seq[Car]` can copy elements after the inserted position.↵Does Nim use moves instead of copies for these operations? |
19:48:10 | FromDiscord | <Zectbumo> this doesn't make sense to me↵!eval for (x, y) in [[1,2,3], [4,5,6]]: echo x, ' ', y |
19:48:20 | FromDiscord | <Zectbumo> !eval for (x, y) in [[1,2,3], [4,5,6]]: echo x, ' ', y |
19:48:23 | NimBot | 1 2↵4 5 |
19:48:27 | FromDiscord | <Zectbumo> (edit) "me↵!eval for (x, y) in [[1,2,3], [4,5,6]]: echo x, ' ', y" => "me" |
19:48:49 | FromDiscord | <Zectbumo> !eval for (x, y, z) in [[1,2,3], [4,5,6]]: echo x, ' ', y, ' ', z |
19:48:51 | NimBot | Compile failed: /usercode/in.nim(1, 5) Error: wrong number of variables |
19:49:34 | FromDiscord | <Zectbumo> how does (x,y) work perfectly as expected, and then (x,y,z) not |
19:50:33 | FromDiscord | <Rika> !eval for (x, y) in [[9,5,3], [4,7,0]]: echo x, ' ', y |
19:50:35 | NimBot | 9 5↵4 7 |
19:50:36 | FromDiscord | <Rika> Just making sure |
19:50:43 | FromDiscord | <Rika> Hm |
19:51:10 | FromDiscord | <Rika> I don’t understand how this works |
19:51:56 | FromDiscord | <Zectbumo> if anything, it should be the other way right? wrong number of variables in the first case, and then correct number in the other |
19:55:53 | FromDiscord | <Recruit_main707> smells like a compiler bug, if i had to gamble it some check like `>` instead of `>=` |
19:56:25 | FromDiscord | <Recruit_main707> if this is the expected behaviour i dont understand it |
19:59:36 | FromDiscord | <demotomohiro> `for (x, y) in [[9,5,3], [4,7,0]]: ` looks like it doing tuple unpacking but it is not tuple but array. |
20:00:32 | FromDiscord | <demotomohiro> !eval for (x, y, z) in [(9,5,3), (4,7,0)]: echo x, ' ', y, ' ', z |
20:00:34 | NimBot | 9 5 3↵4 7 0 |
20:03:01 | FromDiscord | <Zectbumo> tuples work fine, just array is weird |
20:29:54 | om3ga | I think compiler optimises out needed parts of code |
20:30:28 | om3ga | othervise I don't know what to look |
20:31:12 | * | kenran quit (Quit: WeeChat info:version) |
20:32:11 | om3ga | the code should work, but when I enable --opt:speed it receives sigabort sent by system, and caused by a READ memory access. |
20:32:39 | om3ga | any suggestions? |
20:35:49 | FromDiscord | <Yardanico> no real suggestions there, --opt:speed affects the C compiler |
20:35:55 | FromDiscord | <Yardanico> what's your compiler version? |
20:36:19 | FromDiscord | <demotomohiro> Your code might have undefined behavior. Is your code have `addr`, `cast` or call C functions? |
20:36:27 | FromDiscord | <Yardanico> I mean C compiler version |
20:36:42 | FromDiscord | <Yardanico> and yeah, can you reproduce it without --opt:speed but with -O2 manually passed? |
20:38:07 | om3ga | Yardanico, I tried different versions, clang 10, clang 11 |
20:38:13 | om3ga | gcc11, gcc12 |
20:38:29 | FromDiscord | <Yardanico> well, then maybe something's up in your code? demotomohiro's suggestion is good |
20:39:20 | om3ga | demotomohiro, you are correct, I use unsafe pointer passing to the functions |
20:39:34 | om3ga | but that's how fcgi lib works |
20:39:37 | FromDiscord | <Yardanico> what GC are you using? |
20:39:50 | om3ga | Yardanico, tried all available :) |
20:40:00 | FromDiscord | <Yardanico> well, and do you pass GC'd types through pointers? |
20:40:49 | om3ga | you mean gc'd objects? |
20:40:53 | FromDiscord | <Yardanico> yes |
20:41:01 | FromDiscord | <Yardanico> anything that is a `ref` or a string or a sequence |
20:41:07 | om3ga | they are in stack |
20:41:14 | FromDiscord | <Bubblie> Do you all know where nim’s import module code is located in the nim-lang repository? |
20:41:17 | om3ga | other ones stored in shared mem |
20:41:19 | FromDiscord | <Bubblie> Sorry if Im interrupting |
20:41:21 | FromDiscord | <Recruit_main707> on the heap |
20:42:03 | FromDiscord | <Yardanico> @Bubblie for similar questions we generally use #internals , but it's fine asking here of course |
20:42:15 | FromDiscord | <Bubblie> Sorry 😅 |
20:42:26 | FromDiscord | <Yardanico> In reply to @om3ga "other ones stored in": sorry, then I can't suggest anything, it's really just a guessing game without the code to try :( |
20:42:29 | FromDiscord | <Bubblie> Ill ask there next time |
20:42:39 | FromDiscord | <Bubblie> Or if its okay can I repaste my message there? |
20:43:00 | om3ga | Yardanico, could you please check this https://drive.google.com/file/d/1L614Lroc7oJahPmCXRrVvgNyCokouuZB/view?usp=sharing |
20:43:32 | om3ga | I tried to make smallest possible code |
20:44:46 | om3ga | the problem I think is with request: FCGX_Request, or with fastcgi/fcgi_lib.nim |
20:44:59 | FromDiscord | <Xzayler> sent a code paste, see https://play.nim-lang.org/#ix=3Y6y |
20:45:18 | FromDiscord | <Yardanico> and how do I test it? just make a request to the ip:port I bind it to? |
20:45:36 | FromDiscord | <ynfle> In reply to @Xzayler "Yes it's working. Thanks": It's probably an issue with `with` not allowing the compiler to automatically use the mutable version |
20:45:38 | om3ga | just edit main.nim, enter there 127.0.0.1 |
20:45:44 | om3ga | compile and run |
20:45:54 | om3ga | it should throw err immidiately |
20:46:07 | om3ga | also libfcgi is required |
20:46:08 | FromDiscord | <Xzayler> In reply to @ynfle "It's probably an issue": tbh I have no idea what `with` does at all. I was just following the docs for `norm` |
20:46:26 | om3ga | if you're on linux, it is in the repo in arch for example |
20:46:27 | FromDiscord | <Xzayler> tutorials, not docs |
20:46:39 | FromDiscord | <Yardanico> In reply to @om3ga "it should throw err": Hm, weird, it didn't for me in WSL (arch), will try on native arch now |
20:46:57 | FromDiscord | <Yardanico> Oh right, and your Nim version is 1.6.6? |
20:47:00 | om3ga | yes! that's what I saw before |
20:47:11 | om3ga | Yardanico, yes, I tried dev and stable branches |
20:48:05 | om3ga | oh, pls check config.nims, if there --opt:speed is enabled |
20:48:18 | om3ga | first 2 lines should be commented out |
20:48:41 | FromDiscord | <Yardanico> opt speed is enabled there |
20:48:49 | om3ga | that's strange |
20:49:09 | FromDiscord | <Yardanico> latest clang on arch is 13.0.1 |
20:49:53 | om3ga | https://0bin.net/paste/XW405Fuu#1-BwN04mtrVHeZwbw5psKFCtkqYdAGWtdGEifv+56SW |
20:50:06 | om3ga | that's what I get with te same code on Mac |
20:50:23 | FromDiscord | <Yardanico> well, clang on macOS is apple's version with some apple patches |
20:50:28 | FromDiscord | <ynfle> In reply to @Xzayler "tbh I have no": Look at https://nim-lang.org/docs/with.html |
20:51:26 | om3ga | https://0bin.net/paste/hikQmzfE#Wvify0iU1WsHRtZn6BSw0X-rrEqJB64rOJUHNAZk1KU |
20:51:29 | om3ga | from arch |
20:51:42 | om3ga | crazy isn't? |
20:52:24 | FromDiscord | <Yardanico> but maybe i should do some request? |
20:52:30 | FromDiscord | <Yardanico> it doesn't crash for me when I just start it |
20:52:40 | FromDiscord | <Yardanico> and yeah, i'm trying on nim devel |
20:53:03 | om3ga | maybe my house bombed with high energy particles from space, and computers experience constant single events |
20:53:33 | om3ga | Yardanico, I tried with both branches, the same effect |
20:53:50 | om3ga | something is wrong here in the system maybe, or with lib |
20:54:12 | om3ga | <Yardanico> but maybe i should do some request? - that requires lighttpd or nginx |
20:54:27 | FromDiscord | <Bubblie> how is nim threading btw? |
20:54:33 | om3ga | if you have one I can upload simple config |
20:54:36 | FromDiscord | <Bubblie> I heard some mixed things about it |
20:54:46 | om3ga | threading works just great |
20:54:49 | FromDiscord | <Yardanico> In reply to @om3ga "if you have one": sure, I can try I guess |
20:54:58 | FromDiscord | <Elegantbeef> It's got lock primitives and channels |
20:55:01 | FromDiscord | <Elegantbeef> So it works |
20:56:04 | om3ga | Yardanico, https://0bin.net/paste/2tljvo60#tcs1mbmcvzPkHJU06S4K83kfpBInSYU-cdQWuS+d39s |
20:58:04 | om3ga | if you have web servers for other uses, just edit root path, set it to unique one |
20:58:26 | om3ga | and it should forward requests to the app server |
20:58:27 | FromDiscord | <Xzayler> In reply to @ynfle "Look at https://nim-lang.org/docs/with.html": ok I see, pretty simple. So it's completely useless in the context I used it in |
20:58:43 | FromDiscord | <Yardanico> In reply to @Xzayler "ok I see, pretty": maybe you want https://github.com/zevv/with ? |
21:01:02 | FromDiscord | <Yardanico> yeah @om3ga it just works without any errors from the sanitizer 🤷 |
21:01:10 | om3ga | :( |
21:01:51 | om3ga | Yardanico, thank you very much for the help |
21:01:59 | FromDiscord | <Yardanico> I didn't really "help" :) |
21:02:06 | om3ga | no, you did |
21:02:13 | om3ga | I will scan hdd on errors now |
21:02:26 | om3ga | something should be the reason |
21:02:27 | FromDiscord | <Yardanico> but yeah, it works for me and just gives out http code 404 with 404 in the body |
21:02:42 | FromDiscord | <Yardanico> @om3ga can you try installing nim devel the manual way on some updated arch installation? |
21:02:48 | om3ga | yeah, custom 404 header with text |
21:02:55 | FromDiscord | <Yardanico> git clone https://github.com/nim-lang/nim |
21:02:56 | FromDiscord | <Yardanico> cd nim |
21:02:58 | FromDiscord | <Yardanico> sh build_all.sh |
21:03:07 | om3ga | Yardanico, I will try now |
21:03:07 | FromDiscord | <Yardanico> and then put nim/bin folder to PATH |
21:03:51 | FromDiscord | <Yardanico> oh @om3ga gcc thread sanitizer indeed errors for me |
21:03:54 | FromDiscord | <Yardanico> but not the clang one |
21:04:22 | om3ga | Yardanico, yes! Interesting |
21:04:34 | om3ga | that's what I mentioned about gcc11 errs |
21:04:49 | om3ga | after I upgraded gcc |
21:07:10 | FromDiscord | <Yardanico> it seems that it's triggered by --stacktrace:on specifically |
21:07:18 | FromDiscord | <Yardanico> without stacktrace (so with -d:release or -d:danger) it works fine |
21:07:26 | FromDiscord | <Yardanico> most other options don't matter at all |
21:08:49 | FromDiscord | <Yardanico> it specifically crashes in nim stack frame handling code |
21:10:45 | om3ga | hmm |
21:11:00 | om3ga | great! how you find that? |
21:11:20 | FromDiscord | <Yardanico> just experimenting with flags, and I just enabled -g to see where it crashes in Nim code |
21:11:32 | FromDiscord | <Yardanico> https://media.discordapp.net/attachments/371759389889003532/976592898160218162/unknown.png |
21:11:38 | FromDiscord | <Yardanico> and --nimcache to check the compiled C code |
21:11:54 | om3ga | exactrly the same |
21:12:02 | om3ga | *the same err |
21:12:38 | om3ga | previously it crashed on FCGX_Finish_r |
21:13:33 | om3ga | but now, seems it fails on FCGX_Accept_r |
21:14:17 | * | vicfred quit (Remote host closed the connection) |
21:14:31 | * | vicfred joined #nim |
21:15:41 | FromDiscord | <Yardanico> well, it could really be just a bug in gcc 11 :) |
21:16:28 | om3ga | looks like there is more |
21:17:13 | om3ga | Now it fails with clang 13.0.1 If profiler option is set |
21:17:40 | om3ga | or --opt:speed |
21:17:43 | FromDiscord | <Yardanico> `profiler` Nim option is deprecated anyway |
21:17:49 | FromDiscord | <Yardanico> it shouldn't really be used anymore |
21:17:51 | om3ga | oh! |
21:18:13 | FromDiscord | <planetis> you need llvm package on arch to get line info |
21:18:14 | FromDiscord | <planetis> llvm-symbolizer |
21:18:26 | FromDiscord | <Yardanico> i already have it |
21:18:29 | FromDiscord | <Yardanico> and it already works |
21:18:40 | FromDiscord | <planetis> or addr2line on gcc |
21:18:47 | FromDiscord | <Yardanico> not exactly sure what message you wanted to reply to :D |
21:18:50 | om3ga | and what enables lgcov in nim now? |
21:19:04 | FromDiscord | <planetis> cool yardanico |
21:19:35 | FromDiscord | <Yardanico> I think we should disable thread sanitizer for now @om3ga |
21:19:45 | FromDiscord | <Yardanico> i think it's erroring because nim is trying to raise an exception in the thread and deallocates it |
21:20:39 | om3ga | Yardanico, that might be the reason indeed |
21:21:53 | om3ga | I added try: except: to that code right before the strange stuff appeared |
21:21:58 | FromDiscord | <Yardanico> and it should be worth actually checking error codes returned by FCGI functions instead of just discarding stuff |
21:23:24 | om3ga | yeah, so I will try that now |
21:24:04 | om3ga | I want to had modern looking code, but now it will be like C |
21:24:06 | om3ga | :) |
21:24:32 | FromDiscord | <Yardanico> i'm really not sure why do you want to use fcgi even though you want modern stuff :) |
21:24:45 | FromDiscord | <Yardanico> you can just run a http server with nim and host it behind lighttpd/nginx |
21:25:48 | om3ga | It's still very powerfull |
21:26:02 | FromDiscord | <Yardanico> eh, i don't really think so |
21:26:07 | FromDiscord | <Yardanico> you can replicate what it does and more with usual http stuff |
21:26:45 | om3ga | but on each call web server will exec binary |
21:26:55 | FromDiscord | <Yardanico> no? |
21:27:06 | FromDiscord | <Yardanico> that's not the case with fcgi, and it's not the case with http servers |
21:27:08 | om3ga | or what you mean |
21:27:19 | FromDiscord | <Yardanico> with a normal http server you just start a http server that accepts requests |
21:27:30 | FromDiscord | <Yardanico> then host it behind nginx/lighttpd as a reverse proxy for SSL and other stuff (optional) |
21:27:40 | FromDiscord | <Yardanico> it's a single binary, it's not started for each request |
21:27:51 | om3ga | I mean backend |
21:27:53 | FromDiscord | <Yardanico> yes |
21:28:01 | FromDiscord | <Yardanico> backend is the http server |
21:28:02 | om3ga | all dynamic stuff, db requests etc |
21:28:06 | FromDiscord | <Yardanico> yes |
21:28:12 | FromDiscord | <Yardanico> you don't need to start a binary on each request |
21:28:21 | FromDiscord | <Yardanico> and you don't need to open the DB on each request either |
21:28:28 | om3ga | but how it will be executed? :) |
21:28:33 | FromDiscord | <Yardanico> wdym? |
21:28:38 | FromDiscord | <planetis> In reply to @Zectbumo "!eval for (x, y)": that stupid for loop tuple sugar strikes again |
21:28:40 | FromDiscord | <Yardanico> you just make an HTTP request and your server handles it |
21:28:49 | FromDiscord | <planetis> so many bugs |
21:28:58 | om3ga | Yardanico, sorry I don't understand |
21:29:10 | FromDiscord | <Zectbumo> In reply to @planetis "that stupid for loop": should I file a bug or bring it up in #internals? |
21:29:11 | om3ga | for static data transfer - sure |
21:29:23 | FromDiscord | <Yardanico> In reply to @om3ga "for static data transfer": I don't understand what you don't understand, you don't need multiple processes for DB or anything else |
21:29:24 | om3ga | but I have here dynamic pages |
21:29:36 | FromDiscord | <Yardanico> In reply to @om3ga "but I have here": ??? you easily do that with http servers |
21:29:39 | FromDiscord | <planetis> I think a bug report is better |
21:29:44 | FromDiscord | <Yardanico> forum.nim-lang.org runs as a single binary for example |
21:29:52 | FromDiscord | <Yardanico> with dynamic pages and whatnot (although in this case it's more of frontend) |
21:30:07 | FromDiscord | <Yardanico> you can easily make "dynamic" stuff with nim and http, see for example https://github.com/planety/prologue |
21:30:21 | FromDiscord | <Zectbumo> In reply to @planetis "I think a bug": also, which is the bug? that (x,y) works or that (x,y,z) doesn't work, or throwing wrong error |
21:30:24 | FromDiscord | <Yardanico> http server isn't just "static stuff", you can construct responses on the fly |
21:30:35 | FromDiscord | <Elegantbeef> It's a bug that the first works↵(@Zectbumo) |
21:30:46 | om3ga | Yardanico, thanks, interesting |
21:30:54 | FromDiscord | <Elegantbeef> `for (x, y) in z` tuple unpacks the `z` it does not do array destructuring |
21:31:10 | FromDiscord | <Yardanico> In reply to @om3ga "<@177365113899057152>, thanks, interesting": anything can do dynamic responses, even https://github.com/dom96/jester |
21:31:10 | om3ga | Yardanico, and it also can do load balancing? |
21:31:22 | om3ga | or it requires vip address? |
21:31:39 | FromDiscord | <Yardanico> yes, you can either use multiple threads or use multiple binaries with SO_REUSEPORT |
21:31:46 | FromDiscord | <planetis> In reply to @Zectbumo "also, which is the": none of them work, compare the output with for x,y (no parenthesis) |
21:31:54 | FromDiscord | <Yardanico> but again, you don't need to rely on any libraries like fcgi, you just get http requests and answer with http responses |
21:32:04 | FromDiscord | <Yardanico> and you can construct them at runtime easily, since it's just strings in the end |
21:32:06 | om3ga | hmm, I should try that definitely |
21:32:10 | FromDiscord | <Zectbumo> In reply to @planetis "none of them work,": no parenthesis makes sense because that's the index form |
21:32:13 | FromDiscord | <Elegantbeef> Those are different semantics↵(@planetis) |
21:32:35 | FromDiscord | <planetis> why do you explicitly call the items iterator? |
21:32:37 | FromDiscord | <Elegantbeef> `for x, y` is not equivlent to `for (x, y)` |
21:32:39 | om3ga | Yardanico, why I like fcgi, is - resource management, load balancing, etc... |
21:32:49 | FromDiscord | <planetis> I am pretty sure it is |
21:32:53 | FromDiscord | <Elegantbeef> The first calls pairs and the latter still calls items |
21:32:54 | FromDiscord | <Yardanico> wdym by "resource management" ? |
21:32:56 | FromDiscord | <Elegantbeef> They're not equivlent |
21:33:00 | FromDiscord | <planetis> really |
21:33:02 | FromDiscord | <planetis> wtf |
21:33:05 | om3ga | I use it for years, maybe that;s why I like it |
21:33:09 | FromDiscord | <Yardanico> also, we can probably move to #webdev (#nim-webdev on IRC) |
21:33:13 | FromDiscord | <planetis> man that seriously sucks |
21:33:29 | FromDiscord | <Yardanico> In reply to @om3ga "I use it for": yeah i think that's the only reason :) with http servers you can do anything you can with fcgi and more |
21:33:40 | FromDiscord | <Elegantbeef> Second one errors |
21:33:42 | FromDiscord | <Elegantbeef> sent a code paste, see https://play.nim-lang.org/#ix=3Y6I |
21:33:52 | FromDiscord | <Elegantbeef> They're not equivlent for a point |
21:34:01 | FromDiscord | <Elegantbeef> You can have an iterator that isnt `pairs` or `items` and unpack it nicely |
21:34:38 | FromDiscord | <planetis> I just tried the same... |
21:34:43 | FromDiscord | <huantian> Huh does for x, (y, z) work for seq[tuple[A, B]] |
21:34:49 | FromDiscord | <Elegantbeef> sent a code paste, see https://play.nim-lang.org/#ix=3Y6J |
21:34:53 | FromDiscord | <Elegantbeef> Should↵(@huantian) |
21:35:22 | FromDiscord | <planetis> when I was making collect stuff like for (x, (y, z)) didn't parse |
21:36:00 | FromDiscord | <planetis> someone needs to add it Nim v2 wishlist |
21:36:09 | FromDiscord | <planetis> either fix it or kill it with fire |
21:36:50 | FromDiscord | <planetis> also implicitly calling items or pairs seems a bad idea |
21:37:19 | FromDiscord | <ambient> sent a code paste, see https://play.nim-lang.org/#ix=3Y6K |
21:37:38 | FromDiscord | <Elegantbeef> Of course it wouldnt |
21:37:41 | FromDiscord | <Elegantbeef> That's not a valid nim structure |
21:37:51 | FromDiscord | <Elegantbeef> Add what? |
21:38:02 | FromDiscord | <Elegantbeef> It is a bad idea |
21:38:18 | FromDiscord | <Elegantbeef> Especially since it presently doesnt work with generics |
21:38:27 | FromDiscord | <planetis> (edit) "also implicitly calling items or pairs seems ... a" added "like" |
21:38:47 | FromDiscord | <Elegantbeef> sent a code paste, see https://play.nim-lang.org/#ix=3Y6L |
21:39:06 | FromDiscord | <Elegantbeef> and even `mixin items` doesnt resolve it since the magic expansion doesnt respect mixin'd |
21:39:57 | FromDiscord | <Elegantbeef> Probably making more modules imported doesnt make nim any better↵(@ambient) |
21:40:20 | FromDiscord | <ambient> I like writing small anonymous functions with a simple syntax |
21:48:22 | * | noeontheend joined #nim |
21:51:11 | FromDiscord | <Zoom> Wtf is ` type mismatch: got <Alias, typedesc[BackwardsIndex]>` |
21:51:23 | FromDiscord | <Elegantbeef> Using concept? |
21:51:28 | FromDiscord | <Zoom> Yep |
21:51:37 | FromDiscord | <Elegantbeef> What's your concept? |
21:51:48 | FromDiscord | <Zoom> sent a code paste, see https://play.nim-lang.org/#ix=3Y6M |
21:52:17 | FromDiscord | <Zoom> Don't laugh\: `proc hasKey[T](a: array[char, T]; key: char): bool = true` |
21:52:34 | FromDiscord | <Elegantbeef> sent a code paste, see https://play.nim-lang.org/#ix=3Y6N |
21:53:23 | FromDiscord | <Elegantbeef> sent a code paste, see https://play.nim-lang.org/#ix=3Y6O |
21:54:51 | FromDiscord | <Elegantbeef> Generic parameters are aliases in concepts which is what the error message is about |
21:55:01 | FromDiscord | <Elegantbeef> You need to bind it explicitly to a variable to reason it |
21:55:28 | * | noeontheend quit (Ping timeout: 272 seconds) |
21:57:41 | FromDiscord | <Zoom> > invalid type\: 'T' in this context\: 'inferred[T]' for var |
21:57:59 | FromDiscord | <Elegantbeef> Code? |
21:58:43 | FromDiscord | <Zoom> sent a code paste, see https://play.nim-lang.org/#ix=3Y6S |
22:02:48 | FromDiscord | <Elegantbeef> Havent really used inferred generics with concepts so this seems to be an issue with them |
22:03:44 | FromDiscord | <Zoom> Kind of a silly code, but looks reasonable. Just wanted to see if it works at all. |
22:03:57 | FromDiscord | <Zoom> looks like concepts aren't ready for Zoom |
22:08:24 | om3ga | Yardanico, I fixed! |
22:08:33 | FromDiscord | <Yardanico> what way? |
22:08:37 | om3ga | it was not ontly try: exept |
22:08:43 | om3ga | but also withLock: |
22:08:54 | FromDiscord | <Yardanico> okay |
22:09:05 | FromDiscord | <Yardanico> but I really strongly suggest you to try https://github.com/dom96/jester or https://github.com/planety/prologue/ anyway |
22:09:22 | FromDiscord | <Yardanico> doing typical http DB stuff with dynamic pages will be much easier since you don't need to interface with C at all |
22:09:25 | FromDiscord | <Yardanico> it's all written in Nim |
22:09:43 | om3ga | I removed all that withLock's and used old pthread mutex stuff |
22:10:04 | om3ga | Yardanico, I will try that for sure, but it requires studying |
22:10:16 | FromDiscord | <Yardanico> well, not a lot |
22:10:24 | om3ga | I need at least ability to manage requests, load balancing, etc |
22:10:27 | FromDiscord | <Yardanico> it's the same http requests, just you don't have any middle layer like FCGI |
22:10:32 | FromDiscord | <Yardanico> In reply to @om3ga "I need at least": of course it's all there |
22:10:34 | FromDiscord | <Yardanico> and even more |
22:10:40 | FromDiscord | <Yardanico> prologue is quite a complete web framework |
22:10:41 | * | krux02 quit (Remote host closed the connection) |
22:10:47 | FromDiscord | <Yardanico> https://planety.github.io/prologue/ |
22:10:53 | om3ga | then it's great! |
22:10:59 | om3ga | tthanks, awesome |
22:11:08 | om3ga | and what about DOS? |
22:11:13 | FromDiscord | <Yardanico> what about it? |
22:11:18 | * | krux02 joined #nim |
22:11:21 | om3ga | I mean queue management |
22:11:34 | om3ga | or it depends how I will implement it? |
22:11:51 | FromDiscord | <Yardanico> not sure what you mean at all, prologue is async |
22:12:03 | om3ga | aha, ok. I understand |
22:12:23 | om3ga | I use tables with dynamics per ip |
22:12:39 | om3ga | if rate is high, then client will be blocked |
22:13:05 | FromDiscord | <Yardanico> yeah you can do that easily with prologue |
22:13:25 | FromDiscord | <Yardanico> and async nim web frameworks are generally really fast |
22:13:56 | FromDiscord | <Yardanico> prologue hello world (just http 200 hello world) does ~70-80k reqs/second on my 3700X on a single thread |
22:14:33 | FromDiscord | <Yardanico> with threads enabled (so with all 16 threads) that hello world does ~440k requests/second |
22:14:38 | om3ga | it's pretty fast |
22:14:49 | FromDiscord | <Yardanico> so you'll be really only constrained by the speed of your DB access and stuff and don't need to worry about the actual underlying stuff |
22:14:57 | FromDiscord | <Yardanico> like sockets or whatever |
22:15:04 | om3ga | yeah, fd's |
22:15:41 | FromDiscord | <Elegantbeef> Yea Zoom i dont know how this is capable of working |
22:15:58 | FromDiscord | <Elegantbeef> There is no way to in fer the `[T, U]` |
22:16:09 | FromDiscord | <Elegantbeef> infer even |
22:17:07 | FromDiscord | <Elegantbeef> Consider a user defined non generic type like `type MyType = object` |
22:18:04 | FromDiscord | <Elegantbeef> The only way to know what the `T` is and the `U` is is to work from the definitions |
22:18:21 | FromDiscord | <Elegantbeef> That doesnt really work well |
22:19:24 | FromDiscord | <Elegantbeef> Atleast i presently think it's quite difficult to impossible to infer a concepts generics |
22:19:41 | FromDiscord | <Elegantbeef> Atleast in this case |
22:20:16 | FromDiscord | <Zoom> Well, before the addition of `var t: T` it worked on tables. |
22:20:27 | FromDiscord | <Elegantbeef> Hmph |
22:23:45 | FromDiscord | <Elegantbeef> Ok so i'm just being dumb as usual it seems it's attempting to bind to the backwards index for `[]` |
22:24:56 | FromDiscord | <Elegantbeef> sent a code paste, see https://play.nim-lang.org/#ix=3Y6X |
22:29:32 | FromDiscord | <Zoom> Why do you add mixin there? |
22:29:39 | FromDiscord | <Elegantbeef> Cause it's a generic and that's how you properly make sure nothing goes astray 😄 |
22:30:05 | FromDiscord | <Elegantbeef> You always want the scope of the callsite to be considered for this type of user defined interface |
22:30:44 | FromDiscord | <Zoom> Thanks. You've been very helpful as always. Too bad I have no use for this code at all. \:P |
22:31:06 | FromDiscord | <Elegantbeef> No problem |
22:31:41 | FromDiscord | <Elegantbeef> If not evident the issue is that `[]` matches `BackwardsIndex` first and as such `T` was bound to it |
22:32:25 | FromDiscord | <Zoom> This is evident, post factum |
22:32:56 | FromDiscord | <Elegantbeef> Hey doesnt harm to explain the problem 😛 |
22:33:30 | FromDiscord | <Zoom> I meant it's become evident to me after I saw the solution \:) |
22:33:48 | FromDiscord | <Elegantbeef> Yea it's odd that it bounded like that |
22:34:07 | FromDiscord | <Elegantbeef> It makes a ton of sense given the way they variables are unconstrained |
22:34:08 | FromDiscord | <Elegantbeef> I'd argue it's correct 😄 |
22:34:42 | FromDiscord | <Elegantbeef> Thought it makes more sense to find the exact match over a partial match |
22:35:48 | FromDiscord | <mendykin> I'll help 10 people on how to earn $20,000 within 72 hours but you will pay me 10% of your profit when you receive it.↵Note\: only interested people should apply, drop a message let's get started↵https://t.me/Tradewitholiver01 |
22:35:52 | FromDiscord | <Zoom> I agree with [krux02 (Arne Döring)](https://matrix.to/#/@krux02-562fccc916b6c7089cb87897:gitter.im) , tableimpl should go. It's not much DRY and lots of untyped templates for a critical module. |
22:36:05 | FromDiscord | <Elegantbeef> Fucking matrix bots |
22:36:29 | FromDiscord | <Elegantbeef> I mean most things should go |
22:36:47 | FromDiscord | <Zoom> Hash proc and defaults should be parametrizable |
22:37:07 | FromDiscord | <Elegantbeef> What do you mean? |
22:38:11 | * | smvg quit (Quit: smvg) |
22:38:12 | FromDiscord | <Zoom> I should have an option to tell which hash function tables module should use for a basic type |
22:38:46 | FromDiscord | <Zoom> And the whole possible rework is blocked by> First we should get view types into the state where Option[var T] and Option[lent T] do work reliably |
22:39:43 | FromDiscord | <Elegantbeef> Yea i've personally never really needed to custom hash primitives but i can see why would want it |
22:39:50 | FromDiscord | <Elegantbeef> Luckily though it's not too difficult to bodge |
22:45:51 | * | tiorock joined #nim |
22:45:51 | * | tiorock quit (Changing host) |
22:45:52 | * | tiorock joined #nim |
22:45:52 | * | rockcavera quit (Killed (calcium.libera.chat (Nickname regained by services))) |
22:45:52 | * | tiorock is now known as rockcavera |
22:50:19 | * | cyraxjoe quit (Ping timeout: 240 seconds) |
22:51:09 | * | cyraxjoe joined #nim |
23:06:39 | * | noeontheend joined #nim |
23:20:06 | * | noeontheend quit (Ping timeout: 244 seconds) |
23:28:00 | FromDiscord | <!Patitotective> sent a code paste, see https://play.nim-lang.org/#ix=3Y74 |
23:28:15 | FromDiscord | <!Patitotective> (edit) "https://play.nim-lang.org/#ix=3Y74" => "https://play.nim-lang.org/#ix=3Y75" |
23:30:02 | FromDiscord | <Elegantbeef> cstringarray |
23:32:25 | FromDiscord | <!Patitotective> sent a code paste, see https://play.nim-lang.org/#ix=3Y78 |
23:32:41 | FromDiscord | <Elegantbeef> `list = [cstring"a", cstring"b"]` |
23:33:44 | FromDiscord | <Elegantbeef> then pass the `addr` |
23:35:36 | FromDiscord | <!Patitotective> sent a code paste, see https://play.nim-lang.org/#ix=3Y79 |
23:35:49 | FromDiscord | <Elegantbeef> yes cstringarray is a `ptr` type |
23:35:57 | FromDiscord | <!Patitotective> (edit) "https://play.nim-lang.org/#ix=3Y79" => "https://play.nim-lang.org/#ix=3Y7a" |
23:36:00 | FromDiscord | <Elegantbeef> Read the error message |
23:36:18 | FromDiscord | <Elegantbeef> you can pass `filterPatts.addr` to the procedure |
23:36:25 | FromDiscord | <Elegantbeef> As such it needs to be `let` |
23:37:21 | FromDiscord | <!Patitotective> In reply to @Elegantbeef "you can pass `filterPatts.addr`": i cant because it is of type `ptr array[0..1, cstring]` and not `ptr ptr cschar` (?) |
23:37:32 | FromDiscord | <Elegantbeef> cast is a hell of a drug |
23:47:31 | FromDiscord | <retkid> is there anyway to read from a specific byte to specific byte in a filestream without making my own function |
23:49:13 | FromDiscord | <Elegantbeef> `setPosition` follow by `readData(myData.addr, len)` |
23:52:09 | FromDiscord | <retkid> In reply to @Elegantbeef "`setPosition` follow by `readData(myData.addr,": readData is like read but it doesn't remove the bytes from the file stream i presume |
23:52:40 | FromDiscord | <Elegantbeef> read doesnt remove the data it moves the position |
23:52:40 | FromDiscord | <Elegantbeef> all read procedures move the position |
23:54:07 | FromDiscord | <retkid> In reply to @Elegantbeef "all read procedures move": why would i use readData and not read |
23:54:22 | FromDiscord | <Elegantbeef> You want to read a specific amount of data |
23:54:59 | FromDiscord | <retkid> but i do the same thing with just reading a buffer? |
23:55:22 | FromDiscord | <Elegantbeef> If you have an amount of data to read and it's not to an array you use read data |
23:55:40 | FromDiscord | <Elegantbeef> `read` is a basic procedure that doesnt know types it just reads `sizeof(T)` |
23:57:24 | FromDiscord | <Elegantbeef> so if you do `read(mySeq)` you'll just get an arbitrary sequence and not the data you want |