00:02:11 | * | Lord_Nightmare joined #nim |
00:28:01 | arkanoid | is the first argument always the king of the argument army? https://play.nim-lang.org/#ix=4j4v |
00:42:28 | FromDiscord | <arkanoid> in this example here, with `convert` you mean runtime conversion, or compile time conversion |
00:51:26 | FromDiscord | <Elegantbeef> CT |
00:54:13 | FromDiscord | <arkanoid> thanks |
00:55:04 | FromDiscord | <arkanoid> can I consider a rule that the first argument in a generic function fixes the size in case multiple compatible real types are passed?↵(<@709044657232936960_arkanoid=5b=49=52=43=5d>) |
00:57:40 | FromDiscord | <Elegantbeef> Ah typeclasses |
00:57:52 | FromDiscord | <Elegantbeef> In nim if you use a named typeclass the first bound value applies to all |
00:58:09 | FromDiscord | <Elegantbeef> If you want it not to you need to do `distinct NamedTypeClass` |
00:58:48 | FromDiscord | <Elegantbeef> https://play.nim-lang.org/#ix=4j4B |
01:08:09 | FromDiscord | <Elegantbeef> I will say that feature is extremely unintiutive at first but if you ever need it it's grand 😄 |
01:09:19 | FromDiscord | <auxym> also, that's an implicit generic |
01:50:38 | FromDiscord | <arkanoid> wait, what's happening here |
01:52:54 | * | wallabra joined #nim |
01:55:25 | FromDiscord | <auxym> it's basically equivalent to `proc foo[U: SomeFloat, V: SomeFloat](x: U, y: V) = ...`, I think |
02:04:20 | * | wallabra quit (Ping timeout: 272 seconds) |
02:19:34 | * | xet7 quit (Remote host closed the connection) |
02:21:07 | * | xet7 joined #nim |
02:46:15 | * | v9fk quit (Remote host closed the connection) |
02:59:43 | FromDiscord | <basilajith> Can someone kindly point me to a good resource to help me set up an environment for Nim in Emacs? |
03:03:10 | * | v9fk joined #nim |
03:05:49 | * | v9fk quit (Remote host closed the connection) |
03:06:03 | * | v9fk joined #nim |
03:25:25 | * | v9fk left #nim (#nim) |
04:17:49 | FromDiscord | <Bung> anyone here has privilege to push tag in httpbeast? |
04:37:16 | * | arkurious quit (Quit: Leaving) |
06:31:54 | FromDiscord | <ambient> is there a better way of using an int to index an array than foo[(i + foo.len) mod foo.len] ? |
06:32:37 | FromDiscord | <ambient> i basically want to use whatever integer value to limit itself inside the array indices, even negative integer values |
06:36:34 | FromDiscord | <Bung> there's `Natural = range[0 .. high(int)]` |
06:36:51 | FromDiscord | <ambient> i basically want a simple way to wrap around an array |
06:38:15 | FromDiscord | <Bung> could you elaborate more "wrap around an array" |
06:39:23 | FromDiscord | <Elegantbeef> Saturated indexing array |
06:39:29 | FromDiscord | <Elegantbeef> What you suggest is the best |
06:40:23 | FromDiscord | <ambient> sent a code paste, see https://play.nim-lang.org/#ix=4j5q |
06:41:24 | FromDiscord | <Rika> In reply to @Elegantbeef "Saturated indexing array": No they want modular |
06:41:37 | FromDiscord | <Rika> Saturated is clamp, modular is mod |
06:42:20 | FromDiscord | <Rika> https://nim-lang.org/docs/math.html#floorMod,T,T |
06:42:28 | FromDiscord | <Rika> This is akin to Python mod |
06:43:44 | FromDiscord | <Bung> I guess better give pseudo code explain what you want to do, now am confusing why topic change from array index to mod ... |
06:44:27 | FromDiscord | <Rika> He wants to index an array with an arbitrary size integer, which should be bounded back into the array size by using mod |
06:44:33 | FromDiscord | <ambient> when i have an index that goes down or up, i can just put a floorMod around it to not worry about going out of bounds |
06:45:46 | FromDiscord | <Elegantbeef> sent a code paste, see https://play.nim-lang.org/#ix=4j5s |
06:47:01 | FromDiscord | <ambient> that doesn't work if index goes negative |
06:47:40 | FromDiscord | <Elegantbeef> So handle it |
06:56:23 | FromDiscord | <ezquerra> I’ve seen people (eg @ElegantBeef) mention OpenArray many times lately. What’s the deal with that? Are there changes related to that in nim 2.0? |
06:59:00 | FromDiscord | <Elegantbeef> Nope i just want people to use them |
07:00:34 | FromDiscord | <Bung> https://github.com/nim-lang/Nim/pulls?q=is%3Apr+author%3Abeef331+openarray these are the in coming changes beef made |
07:05:42 | FromDiscord | <ezquerra> In reply to @Elegantbeef "Nope i just want": Is there some doc I can read to understand them and when to use them? |
07:06:52 | FromDiscord | <Bung> sent a code paste, see https://play.nim-lang.org/#ix=4j5v |
07:12:16 | FromDiscord | <Elegantbeef> Literally wherever you want either `seq` or `array` and dont care which↵(@ezquerra) |
07:12:33 | FromDiscord | <Elegantbeef> https://nim-lang.org/docs/manual.html#types-open-arrays |
07:14:57 | FromDiscord | <Elegantbeef> The benefit of them is you can without copying take a slice using `toOpenArray` |
07:15:02 | NimEventer | New thread by jasonfi: Proposed method of writing filters in Nexus v2, see https://forum.nim-lang.org/t/9741 |
07:15:06 | FromDiscord | <Elegantbeef> Which means without any allocating you can slice up a collection and operate on it |
07:17:20 | FromDiscord | <ezquerra> Like a “view”? |
07:17:33 | FromDiscord | <Elegantbeef> Yes but it must be consumed directly |
07:17:54 | FromDiscord | <Elegantbeef> WIthout a borrow checker you can do `myCollection.toOpenArray(3, 5)` and not copy |
07:17:55 | FromDiscord | <Elegantbeef> It's easy to get speed |
07:27:04 | NimEventer | New thread by nospher: Converting C++ typedef to nim-lang, see https://forum.nim-lang.org/t/9742 |
08:56:58 | Amun-Ra | is there a switch for nim not to use mmap at all? |
09:00:57 | Amun-Ra | hmm, or is there a way to provide own system/osalloc.nim or dyncalls.nim without modifying default one? |
09:02:21 | FromDiscord | <ezquerra> In reply to @Elegantbeef "Yes but it must": I don't understand what you mean by that |
09:02:46 | FromDiscord | <ezquerra> In reply to @Elegantbeef "WIthout a borrow checker": Nor what a borrow checker has to do with it? |
09:03:15 | FromDiscord | <Elegantbeef> you must feed `openArray` into a procedure |
09:03:24 | FromDiscord | <Elegantbeef> you cannot do `let a = myCollection.toOpenArray(3, 5)` |
09:03:31 | FromDiscord | <Elegantbeef> as that requires a borrow checker to be memory safe |
09:06:44 | FromDiscord | <Elegantbeef> amun-ra with `--mm:orc` or `--mm:arc` you can do `-d:useMalloc` |
09:07:23 | FromDiscord | <Elegantbeef> Otherwise you can copy what yardanico has done here https://github.com/Yardanico/mimalloc_nim |
09:08:03 | Amun-Ra | ah, right |
09:08:15 | Amun-Ra | I only had -d=usemalloc |
09:09:29 | Amun-Ra | I don't think I can override dyncall's nimLoadLibrary, nimGetProcAddr etc. |
09:09:36 | Amun-Ra | (via command line) |
09:10:07 | FromDiscord | <Elegantbeef> Well 'technically' you can use patchfile inside a nimconfigs so you kinda can |
09:10:12 | FromDiscord | <luteva> Hi!↵Is it possible to use a compiled (c/c++) library and use it within a wasm app? If yes, is there an example? I mean instead of using e.g. FFMPEG.WASM, use a precompiled version of ffmpeg and call/use it in a nim app. This app should then be compiled to wasm (using ffmpeg as a static lib) and run in a browser. |
09:10:46 | Amun-Ra | Elegantbeef: I didn't know such thing exist |
09:10:49 | FromDiscord | <Elegantbeef> Assuming you generated the static library for wasm it should work fine |
09:11:11 | Amun-Ra | I'm targetting non-posix system |
09:11:28 | FromDiscord | <Elegantbeef> Yea amun that repo i provided replaces Nim's allocator with mimalloc using it |
09:11:28 | FromDiscord | <Elegantbeef> It's a bit hacky to do but it works |
09:11:53 | FromDiscord | <Elegantbeef> Like sdl2 and opengl work with wasm with the proper emscripten configs, but wasm ships sdl2 iirc |
09:12:21 | Amun-Ra | I'll check how it's done, thanks |
09:14:09 | FromDiscord | <Elegantbeef> Two conversations at once is always fun 😄 |
09:14:56 | FromDiscord | <luteva> 😖 |
09:14:59 | FromDiscord | <luteva> 😄 |
09:16:22 | Amun-Ra | the other way to get around that problem is to create C wrappers for mmap (it's used exctlusively with MAP_ANONYMOUS), signal, flockfile and funclockfile |
09:16:28 | FromDiscord | <Elegantbeef> Luteva you should follow https://stackoverflow.com/a/66955188 |
09:17:00 | FromDiscord | <Elegantbeef> You might be able to use https://github.com/momeemt/ffmpeg.nim |
09:18:31 | FromDiscord | <Elegantbeef> Though those bindings use dynlib so you'll need to use `dynLibOverride` and make a long list of them |
09:19:17 | FromDiscord | <luteva> thx a lot @ElegantBeef |
09:19:19 | FromDiscord | <luteva> ! |
09:19:51 | FromDiscord | <Elegantbeef> You obviously have to statically link all libraries you use if they're not shipped with the browser wasm runtime |
09:21:28 | Amun-Ra | Elegantbeef: I can't use the method used in mimmalloc |
09:22:08 | Amun-Ra | he is patching calls on compiler level, I'd have to do this on nim one |
09:22:30 | FromDiscord | <Elegantbeef> What? |
09:23:44 | Amun-Ra | I'd have to modify the code in https://github.com/nim-lang/Nim/blob/devel/lib/system/dyncalls.nim#L197-L198 or provide my own dyncalls.nim |
09:24:02 | FromDiscord | <Elegantbeef> That's how patchfile would work |
09:24:16 | FromDiscord | <Elegantbeef> You'd override `dyncalls` for your own variant that doesnt have that error there |
09:24:20 | Amun-Ra | hmm |
09:24:41 | FromDiscord | <Elegantbeef> https://github.com/Yardanico/mimalloc_nim/blob/master/src/main.nims#L32 |
09:24:41 | Amun-Ra | hmm, I missed patchFile… :/ |
09:26:51 | FromDiscord | <Elegantbeef> Yea just tested it indeed works |
09:27:04 | Amun-Ra | thanks, I'm blind |
09:27:20 | FromDiscord | <Elegantbeef> though it's' `patchFile("stdlib", "dyncalls", ...)` afaict |
09:28:17 | FromDiscord | <Elegantbeef> I'd also say after you get the port functioning a PR would be best 😄 |
09:28:53 | Amun-Ra | sure :> |
09:29:06 | Amun-Ra | I have one patch for intel compiler almost ready |
09:29:34 | Amun-Ra | (missing _popcnt) |
09:57:15 | FromDiscord | <fabricio> sent a code paste, see https://play.nim-lang.org/#ix=4j6l |
09:57:47 | FromDiscord | <Rika> your iterator is not a closure |
09:57:49 | FromDiscord | <fabricio> (edit) "https://play.nim-lang.org/#ix=4j6l" => "https://play.nim-lang.org/#ix=4j6m" |
09:58:21 | FromDiscord | <Elegantbeef> sent a code paste, see https://play.nim-lang.org/#ix=4j6n |
09:59:08 | FromDiscord | <Elegantbeef> First class iterators(closures) require opt in through `closure`, otherwise it's an inline iterator |
10:00:57 | FromDiscord | <fabricio> yeah I know but forgot to write it, I have made it a closure already |
10:08:50 | FromDiscord | <Rika> what is the issue |
10:10:45 | FromDiscord | <fabricio> oh wait nvm I think it was because I was trying to pass a closure that takes a union type to a function |
10:10:52 | FromDiscord | <fabricio> sorry for bothering |
10:47:28 | * | ltriant quit (Ping timeout: 272 seconds) |
10:49:12 | NimEventer | New Nimble package! openai - Basic API handling for openAI, see https://github.com/ThomasTJdev/nim_openai |
11:06:59 | * | ltriant joined #nim |
12:15:51 | FromDiscord | <HitBlast> In reply to @Isofruit "If you figure something": Following yesterday's screenshot, I ran into some problems. Say I have some arrays with the `string, string` pattern but what if I want a `string, array` pattern inside it too? https://media.discordapp.net/attachments/371759389889003532/1054733868776816661/Screenshot_2022-12-20_at_6.14.34_PM.png |
12:16:14 | FromDiscord | <HitBlast> (edit) "but" => "inside the sequence. But" |
12:19:28 | FromDiscord | <Phil> sent a long message, see http://ix.io/4j71 |
12:19:52 | FromDiscord | <Phil> (edit) "http://ix.io/4j71" => "https://paste.rs/VSa" |
12:20:37 | FromDiscord | <HitBlast> In reply to @Isofruit "Ahhh now you're running": Ah sho what if I could solve this problem by implementing a bunch of objects inside the sequence with the same attributes as the arrays I would've put in the first place? |
12:20:42 | FromDiscord | <HitBlast> (edit) "sho" => "so" |
12:22:14 | FromDiscord | <Phil> Could you throw out a pseudo-code example? |
12:22:27 | FromDiscord | <Phil> Doesn't have to run, I'm just not quite getting what you're thinking |
12:22:40 | FromDiscord | <Phil> So expressing that in some pseudo-code might help me |
13:39:30 | * | kenran joined #nim |
13:55:50 | FromDiscord | <0x454d505459> Just found my first ever nim code (made in 1.4.1 I think) turns it was a shell, So I guess it's comes full cirlce |
13:55:54 | FromDiscord | <0x454d505459> (edit) "cirlce" => "circle" |
13:56:00 | * | kenran quit (Remote host closed the connection) |
13:56:34 | FromDiscord | <0x454d505459> (edit) "Just found my first ever nim code (made in 1.4.1 I think) turns ... it" added "out" |
13:59:13 | FromDiscord | <luteva> @HitBlast you could also write a converter |
13:59:51 | FromDiscord | <luteva> sent a code paste, see https://play.nim-lang.org/#ix=4j7t |
14:00:36 | FromDiscord | <luteva> (edit) "https://play.nim-lang.org/#ix=4j7t" => "https://play.nim-lang.org/#ix=4j7v" |
14:11:38 | FromDiscord | <luteva> but you will then ofcourse have an object of type Ab in the seq. Not of type Bc. So if you need the type to be Bc in this case, this won't work |
14:22:17 | FromDiscord | <Phil> sent a code paste, see https://play.nim-lang.org/#ix=4j7D |
14:22:59 | FromDiscord | <Phil> How did I manage to skirt past this for an entire year or sth |
14:23:25 | FromDiscord | <Rika> what |
14:23:26 | FromDiscord | <Rika> how |
14:24:15 | FromDiscord | <Phil> In my defense, I've never seen a language that had a keyword set aside solely for type-conversion relationships |
14:26:14 | FromDiscord | <luteva> it is nice, as you do not have the toBlabla call all over in the code! |
14:26:38 | FromDiscord | <Phil> Basically this then does implicit type conversions all over the place I take it? |
14:26:41 | FromDiscord | <Phil> God damn that's useful |
14:26:57 | FromDiscord | <Phil> Somewhat implicit magic on the other hand |
14:27:20 | FromDiscord | <Phil> But I could see that being pretty neat for some other stuff |
14:28:38 | FromDiscord | <Phil> I am honestly somewhat shocked this just has never come up while I was in this chat, I do try to at least skim what happens and I've never seen it brought up |
14:29:29 | FromDiscord | <luteva> i know that from this chat as far as i remember.... so it should be here |
14:29:39 | FromDiscord | <luteva> some time ago... can't remember |
14:30:32 | * | jmdaemon quit (Ping timeout: 252 seconds) |
14:30:42 | FromDiscord | <Phil> It is either way very useful to know there's a language standard when it comes to procs that define type conversions |
14:34:07 | FromDiscord | <luteva> @Phil here it is:↵https://discord.com/channels/371759389889003530/371759389889003532/1052196129569259520 |
14:34:30 | FromDiscord | <luteva> it is basically the same, i wrote. just one week ago |
14:34:58 | FromDiscord | <luteva> (edit) "same," => "same" | "wrote." => "wrote her." | "ago" => "ago, by amadan" |
14:35:06 | FromDiscord | <luteva> (edit) "her." => "here." |
14:36:41 | FromDiscord | <ieltan> In reply to @Isofruit "It is either way": I can only find it deep inside the gigormous Nim manual (so it easily get skipped by if you're not looking explicitly for type convertions there) |
14:44:29 | FromDiscord | <luteva> yeah and the doc only says that a converter is "similar to procs". this is just why i was asking here in the chat, one week ago:↵https://discord.com/channels/371759389889003530/371759389889003532/1052195443427266600 |
14:45:57 | FromDiscord | <luteva> but thanks to the community we now all know what it is 😄 |
14:45:59 | FromDiscord | <ambient> If I'm doing multithreaded code I should be using --mm:orc, and for single threaded --mm:arc? |
14:50:44 | * | arkurious joined #nim |
14:53:20 | FromDiscord | <auxym> shouldn't make a difference wrt threads, the only difference is the cycle collector (in ORC) |
15:15:22 | FromDiscord | <Phil> sent a long message, see http://ix.io/4j7W |
15:15:51 | FromDiscord | <ambient> sent a code paste, see https://play.nim-lang.org/#ix=4j7X |
15:17:40 | FromDiscord | <Phil> I think the typical example is if you have a node type that can have a ref to other node types and then you have 2 nodes a and b where a references b and vice versa |
15:18:39 | FromDiscord | <Phil> Orc and refc are both pretty safe defaults |
15:19:31 | FromDiscord | <ambient> I'm just wondering how can I determine when ARC leaks memory |
15:20:21 | FromDiscord | <auxym> sent a code paste, see https://play.nim-lang.org/#ix=4j7Z |
15:20:44 | FromDiscord | <ieltan> In reply to @ambient "I'm just wondering how": I think Araq mentioned a checkCycles flag or something i dont really remember |
15:21:38 | FromDiscord | <auxym> In reply to @ambient "I'm just wondering how": Araq has mentioned that it should in principle be possible to modify ORC to use it as a "cycle detector". Would be a cool feature to have in a future nim version: compile and run your program with ORC, if no cycles detected, then you are safe to use ARC. |
15:22:13 | FromDiscord | <auxym> the overhead from ORC is really not that bad though, unless you are micro-optimizing for some reason, just use ORC and be happy |
15:22:33 | FromDiscord | <ambient> sometimes my entire program is the inner loop |
15:22:46 | FromDiscord | <ambient> (doing the heavy part of the calculation) |
15:23:09 | FromDiscord | <Phil> Anyway, I wouldn't worry unless I was writing a game engine, other such high performance code or my environment was low on resources like in embeded |
15:23:24 | FromDiscord | <ieltan> If you know for sure you will have cycles just use orc |
15:25:39 | FromDiscord | <ambient> I would rather use ARC is it's not too much of a hassle to structure my program in that way if the perf improvement is more than 20% |
15:26:03 | FromDiscord | <ambient> (edit) "is" => "if" |
15:29:25 | FromDiscord | <Yepoleb> There's a guy around here who punishes people for premature optimization |
15:29:30 | FromDiscord | <Phil> Difference in philosophy, 20% speed up wouldn't be worth it to be typically if I had to start worrying about yet another thing in exchange |
15:29:39 | FromDiscord | <Phil> I support that guy |
15:30:28 | FromDiscord | <auxym> In reply to @ambient "I would rather use": benchmark it, I'd be surprised if you get 20%... |
15:32:36 | FromDiscord | <ambient> of course it's always a bunch of tradeoffs and everyone makes their own |
15:33:31 | FromDiscord | <Yepoleb> Value your time and don't waste it on decisions that don't matter |
15:33:42 | FromDiscord | <ShalokShalom> If anybody missed it |
15:34:18 | FromDiscord | <ShalokShalom> Oracle is spending huge amounts of resources |
15:34:22 | FromDiscord | <ShalokShalom> https://www.oracle.com/cloud/free/ |
15:34:27 | FromDiscord | <Phil> On? |
15:34:48 | FromDiscord | <ambient> "always free" (until further notice) |
15:34:50 | FromDiscord | <ShalokShalom> 250 gig space, 4 virtual ARM cores, 2 AMD cores and 24 GB RAM |
15:35:11 | FromDiscord | <ShalokShalom> In reply to @ambient ""always free" (until further": No, there is also 100 free credits for the first 30 days |
15:35:20 | FromDiscord | <ShalokShalom> You can spend that on AI training and stuff |
15:35:33 | FromDiscord | <ShalokShalom> They try to tackle into that space |
15:35:45 | FromDiscord | <ambient> the thing about cloud services I don't like is they always have an API lock-in |
15:35:51 | FromDiscord | <ShalokShalom> And I found APEX quite interesting |
15:35:58 | FromDiscord | <ShalokShalom> Seems rather simple to build a website |
15:36:02 | FromDiscord | <ShalokShalom> https://apex.oracle.com/de/ |
15:36:18 | FromDiscord | <ShalokShalom> In reply to @ambient "the thing about cloud": You host your own software? |
15:36:21 | FromDiscord | <Phil> Look, I can host my website on a shared CPU that is secretly a potato and 1gb ram and still get sub 100ms responses!↵2 CPUs is too much power! |
15:36:41 | FromDiscord | <ShalokShalom> Sure 😅 |
15:36:44 | FromDiscord | <ShalokShalom> Welcome |
15:37:42 | FromDiscord | <ambient> can I set a price cap that I can be 100% sure is honored? |
15:37:48 | FromDiscord | <ambient> with AWS it's like walking on land mines |
15:40:38 | FromDiscord | <ieltan> In reply to @ShalokShalom "https://www.oracle.com/cloud/free/": Wtf lol |
15:40:56 | FromDiscord | <ieltan> thanks man |
15:46:04 | FromDiscord | <Rika> In reply to @ambient "with AWS it's like": mm i love accidentally spending 5000 bucks because i clicked the wrong thing and didnt notice until the next day |
15:58:57 | FromDiscord | <ShalokShalom> In reply to @ieltan "thanks man": Sure |
15:59:18 | FromDiscord | <ShalokShalom> In reply to @Rika "mm i love accidentally": Wow↵Actually? |
15:59:35 | FromDiscord | <Rika> not actually but ive seen people say theyve done it a |
15:59:37 | FromDiscord | <Rika> (edit) removed "a" |
15:59:41 | FromDiscord | <ShalokShalom> In reply to @ambient "can I set a": Free tier is free |
15:59:49 | FromDiscord | <ShalokShalom> You spend explicitly |
16:00:02 | FromDiscord | <Rika> i'm always scared shitless trying to navigate aws because of that |
16:00:03 | FromDiscord | <ShalokShalom> I use a prepaid credit card |
16:00:14 | FromDiscord | <ShalokShalom> So they couldn't charge me much more |
16:00:18 | FromDiscord | <ShalokShalom> Bunq or N26 |
16:42:58 | * | Phytolizer joined #nim |
16:56:26 | FromDiscord | <Yepoleb> I like the second core for the background tasks↵(@Phil) |
16:58:53 | FromDiscord | <Rika> me when the rp2040 came out: |
17:10:50 | * | wallabra joined #nim |
17:19:07 | * | pro joined #nim |
17:20:58 | * | pro quit (Client Quit) |
17:37:34 | arkanoid | do know know some examples how to create types at compile time running iterators.fieldPairs, typetraits.arity, typetraits.genericParams ? |
18:03:25 | * | pro joined #nim |
18:07:26 | * | pro left #nim (#nim) |
18:12:18 | FromDiscord | <Yandall> Hey @Phil I was starting to make something but it is really necessary to make a library for this? Or there is something I'am missing? https://media.discordapp.net/attachments/371759389889003532/1054823573681881169/image.png |
18:16:23 | FromDiscord | <Phil> sent a long message, see http://ix.io/4j8D |
18:18:06 | FromDiscord | <Phil> Ultimately the goal is less to provide a package that checks the HTML, but does so in the context of simplifying unit-tests that need to do so, so ideally it also does some of the syntax you'd otherwise need to write for said unittest for you |
18:24:00 | FromDiscord | <Phil> sent a code paste, see https://play.nim-lang.org/#ix=4j8F |
18:24:42 | FromDiscord | <Phil> Or alternatively ` assertContainsElementNTimes(html, ".potato", 5)`, both are equivalent anyway |
18:25:32 | FromDiscord | <Yandall> Ok, so the idea is to create a library to help removing some boiler plate when making this types of tests |
18:25:48 | FromDiscord | <Phil> Aye, that and make it so I don't have to actually think about HTML parsing and the like |
18:25:59 | FromDiscord | <Phil> The less I have to think about that, the more I can focus on actual tests related to that |
18:27:16 | FromDiscord | <Phil> The core essence of a test related to HTML is "Do I have this element", "Does it have these attributes/classes/ids/whatever", "Do I have this text" and for all of these question the variations of "Do I have 'it' once/not at all/N times/more than N times/less than N times/more or equal to N times/less or equal to N times" |
18:27:56 | FromDiscord | <Phil> So the problem at large to solve is how can that be tested for as conveniently as possible |
18:28:09 | FromDiscord | <Phil> (edit) "conveniently" => "conveniently, concisely and accurately" |
18:28:31 | FromDiscord | <Phil> while still being easily understandable |
18:35:02 | FromDiscord | <Yandall> Got it |
18:38:08 | FromDiscord | <Phil> Don't be discouraged by it potentially being tiny (though given the various test cases I'd assume you'll end up either with >20 tiny and very simple templates or less than a dozen more complex templates that deal with multiple usecases in nice ways.↵And with you focussing on HTML at large this will be nicely testable for any server side rendering lib (and maybe client-side-rendering libs like karax as well ? I don't know enough about karax |
18:38:22 | FromDiscord | <Phil> (edit) "ways.↵And" => "ways).↵And" |
18:38:58 | FromDiscord | <Phil> (for hotdog when he shows up: Does karax pump out an HTML string somewhere or can you koax karax easily to do that for testing purposes?) |
18:39:52 | * | wallabra quit (Ping timeout: 252 seconds) |
18:42:12 | FromDiscord | <hotdog> I have been summoned 🙂 |
18:42:38 | FromDiscord | <hotdog> In reply to @Isofruit "(for hotdog when he": Yes you can, you can use `$` on a VNode to get html out |
18:42:57 | FromDiscord | <hotdog> You can use this for SSR, or for testing |
18:44:08 | FromDiscord | <hotdog> To fully test a dynamic app you'd probably want to check event handlers etc in the browser, but this would work for more straightforward templating |
18:48:53 | * | wallabra joined #nim |
19:11:25 | * | krux02 joined #nim |
19:42:09 | FromDiscord | <0x454d505459> Reading the experimental features manual, somes features seems cool↵https://nim-lang.org/docs/manual_experimental.html |
19:42:17 | FromDiscord | <0x454d505459> like the concept one |
19:42:46 | FromDiscord | <0x454d505459> I don't see where I would use yet but it will for sure be usefull for someone |
19:44:25 | FromDiscord | <Phil> In reply to @0x454d505459 "I don't see where": Generics that you want to specify based on capability (e.g. are specific procs within scope for the used datatype) |
19:44:37 | FromDiscord | <0x454d505459> the manual goes far beyond my understanding lol |
19:45:05 | FromDiscord | <Phil> It's sort of kind of like duck typing in that sense, you accept any type that has a "quack" proc defined, no matter whether it's an object, or a distinct bool alias |
19:45:07 | FromDiscord | <0x454d505459> In reply to @Isofruit "Generics that you want": I understood what they are, just that I don't where I would use them im my current workflow |
19:45:19 | FromDiscord | <0x454d505459> (edit) "In reply to @Isofruit "Generics that you want": I understood what they are, just that I don't ... where" added "know" |
19:45:26 | FromDiscord | <0x454d505459> (edit) "workflow" => "way of programming" |
19:46:14 | FromDiscord | <Phil> In reply to @0x454d505459 "I understood what they": Ahhh check.↵I really like the idea and know where I'd use it, e.g. in Snorlogue to ensure "You can only use this proc with Models that have a `$` proc defined" |
19:46:21 | FromDiscord | <Phil> (edit) "In reply to @0x454d505459 "I understood what they": Ahhh check.↵I really like the idea and know where I'd use it, e.g. in Snorlogue to ensure "You can only use this proc with ... Models" added "norm" |
19:47:00 | FromDiscord | <0x454d505459> true, would be usefull in this ~~context~~ concept |
19:47:41 | FromDiscord | <Phil> 👉 👉 |
19:51:28 | * | Phytolizer quit (Remote host closed the connection) |
19:51:47 | * | Phytolizer joined #nim |
19:53:46 | FromDiscord | <0x454d505459> I see strict functions may be useful to ensure memory safety in a low level environment (ig) |
19:54:23 | FromDiscord | <0x454d505459> reach end of manual |
19:54:56 | FromDiscord | <0x454d505459> the do notation seems like a fun way to write procedures |
19:55:31 | FromDiscord | <0x454d505459> though it's kinda hard to understand at first |
19:59:47 | FromDiscord | <0x454d505459> Phil (Isofruit), mind checking this crap I made with your help on running processes ? `https://github.com/0x454d505459/nimSh/blob/main/nimSh.nim` |
20:16:12 | FromDiscord | <Phil> What exactly is it doing again? |
20:17:03 | FromDiscord | <Phil> At first glance, too many in-proc comments |
20:17:18 | FromDiscord | <Phil> Doc-comments for procs are fine, making every second line a comment less so 😛 |
20:17:55 | FromDiscord | <0x454d505459> In reply to @Isofruit "Doc-comments for procs are": true |
20:18:05 | FromDiscord | <0x454d505459> In reply to @Isofruit "What exactly is it": just a basic shell |
20:18:28 | FromDiscord | <0x454d505459> In reply to @Isofruit "Doc-comments for procs are": I need them to be sure I remember what I wrote |
20:18:32 | Amun-Ra | and never comments that act as direct code translation |
20:18:39 | FromDiscord | <Phil> sent a code paste, see https://play.nim-lang.org/#ix=4j9k |
20:18:51 | Amun-Ra | place* |
20:18:57 | FromDiscord | <0x454d505459> I would like to avoid strformat |
20:19:36 | FromDiscord | <Phil> Why? In terms of readability it blows 11 string concats out of the water |
20:20:21 | FromDiscord | <0x454d505459> If I ever need to move it in a template or anything that need to be expended I can't |
20:20:29 | FromDiscord | <0x454d505459> (edit) removed "I can't" |
20:20:44 | FromDiscord | <kaddkaka> sum all entries in seq fulfilling a predicate? what are alternatives to `sum(filterIt(it > N))` ? |
20:20:58 | FromDiscord | <auxym> In reply to @0x454d505459 "I can't If I": you can use `%` in strutils |
20:21:18 | FromDiscord | <0x454d505459> In reply to @auxym "you can use `%`": true, never thought of that |
20:21:19 | FromDiscord | <4zv4l> does anyone have an example of `aes enc/dec` in Nim with openssl ? |
20:21:20 | FromDiscord | <Phil> Strformat does not run in templates? |
20:21:38 | FromDiscord | <0x454d505459> `fmt` and `&` are macros |
20:21:46 | FromDiscord | <Phil> In reply to @kaddkaka "sum all entries in": As in, you want something that does `@[1,2,3,4] --> 10`? |
20:21:53 | FromDiscord | <0x454d505459> In reply to @0x454d505459 "`fmt` and `&` are": that's tend to not work in templates |
20:22:10 | FromDiscord | <0x454d505459> gonna fix some stuff in it ig |
20:22:28 | FromDiscord | <kaddkaka> In reply to @Isofruit "As in, you want": That doesn't capture the predicate/filter part, but yes |
20:23:11 | FromDiscord | <kaddkaka> as in `assert @[1, 2, 3, 4].sum(filterIt(it > 2)) == 7` |
20:29:07 | FromDiscord | <Phil> sent a long message, see http://ix.io/4j9q |
20:29:13 | FromDiscord | <Phil> it's in sequtils, same as filterIt |
20:31:31 | * | kenran joined #nim |
20:32:11 | * | kenran quit (Remote host closed the connection) |
20:32:13 | FromDiscord | <kaddkaka> sum seems simpler though? |
20:32:35 | FromDiscord | <kaddkaka> also, why would this approach be slower than for loop? |
20:33:04 | FromDiscord | <Phil> In reply to @kaddkaka "also, why would this": You create interim sequences and nim does not optimize those away, so you're iterating over your sequence twice |
20:38:33 | FromDiscord | <Phil> In reply to @kaddkaka "sum seems simpler though?": As for adding this stuff, I agree that sum is simpler but you asked for alternatives 😛 |
20:39:07 | FromDiscord | <kaddkaka> ok 👍 |
20:40:00 | FromDiscord | <Boston> If I have this UDP packet, how do I receive it in Nim https://media.discordapp.net/attachments/371759389889003532/1054860744501493780/IMG_20221220_143934.jpg |
20:40:15 | FromDiscord | <kaddkaka> `sumIt(it > N)` would have been useful and could avoid interim sequence I guess? 🤔 |
20:40:33 | FromDiscord | <Phil> In reply to @kaddkaka "`sumIt(it > N)` would": Anything in sequtils shares this issue |
20:40:53 | FromDiscord | <Phil> Basically the second you are chaining operators you will be slower than just doing a single forloop |
20:41:21 | FromDiscord | <Phil> Depends on if that matters to you though |
20:41:27 | FromDiscord | <kaddkaka> In reply to @Isofruit "Basically the second you": has there been effort to "understand" the chaining and actually generate more effective output? |
20:41:32 | FromDiscord | <Phil> Because while yeah, it is "wasteful", it's also arguably more readable |
20:42:50 | FromDiscord | <Phil> Generally nim is mostly optimized towards procedural programming so typically functional-programming optimizations aren't in there |
20:43:02 | FromDiscord | <kaddkaka> I see |
20:44:07 | FromDiscord | <auxym> In reply to @Boston "If I have this": https://nim-lang.org/docs/net.html create a socket, bind, listen, accept, recv |
20:45:17 | FromDiscord | <auxym> Found a full example here: https://github.com/mashingan/nim-etc/blob/master/udp-server/server.nim |
20:45:24 | FromDiscord | <Boston> In reply to @auxym "https://nim-lang.org/docs/net.html create a socket,": Am I binding the sending address, my address or the broadcast address, source port or rec port |
20:53:51 | FromDiscord | <Boston> Copied the example exact and still not reading the packet |
20:57:58 | FromDiscord | <auxym> In reply to @Boston "Am I binding the": you are binding a local port. the client, who sends the packet, will need to send it to your IP address + the port you bound |
20:58:24 | FromDiscord | <auxym> In the same git repo there's an example of a client who sends data to that server. you could start by running these examples. |
20:58:31 | FromDiscord | <Boston> Not an option, the "client" will and always will send to the broadcast address |
20:58:59 | FromDiscord | <auxym> I've never worked with UDP broadcast, no idea how that works |
21:00:05 | FromDiscord | <Boston> I have the code in c#, but can't seem to figure out how to port it to Nim |
21:00:23 | FromDiscord | <Boston> It's easy enough to send to the broadcast address with nim |
21:08:58 | FromDiscord | <Phil> In reply to @0x454d505459 "that's tend to not": Further feedback from me will have to wait due to it being dnd time |
21:09:13 | FromDiscord | <0x454d505459> In reply to @Isofruit "Further feedback from me": no issue |
21:10:43 | FromDiscord | <0x454d505459> i'll go sleep so yeah |
21:37:55 | FromDiscord | <kaddkaka> is there anything like pythons `else:` on for loops, to run if a for loop was not `break`ed? |
21:38:13 | FromDiscord | <kaddkaka> (edit) "was" => "exhausts (was" | "`break`ed?" => "`break`ed)?" |
21:41:16 | FromDiscord | <huantian> unfortunately not |
21:41:21 | FromDiscord | <huantian> there isnt' anything built in |
21:45:26 | FromDiscord | <4zv4l> what's the equivalent of `RAND_bytes` in nim ? |
21:48:50 | FromDiscord | <huantian> https://nim-lang.org/docs/sysrand.html might be good enough |
21:52:10 | FromDiscord | <4zv4l> thanks ! |
21:52:17 | FromDiscord | <4zv4l> a bit sad it returns a seq tho |
21:52:27 | FromDiscord | <4zv4l> but it's alright I guess |
21:53:31 | FromDiscord | <amadan> sent a code paste, see https://paste.rs/wH6 |
21:53:36 | FromDiscord | <huantian> what format did you want your random bytes in? |
21:54:36 | FromDiscord | <kaddkaka> @amadan thanks! |
21:55:32 | FromDiscord | <huantian> if you wanted an array you can use the other overload |
21:56:29 | * | ltriant quit (Ping timeout: 246 seconds) |
21:57:10 | FromDiscord | <LazyGamer111> How can i get the libmysql.dll file? |
21:58:14 | FromDiscord | <huantian> https://nim-lang.org/download/dlls.zip |
21:58:35 | FromDiscord | <LazyGamer111> thanks |
21:59:12 | FromDiscord | <LazyGamer111> but there isnt a libmysql dll in there |
21:59:32 | FromDiscord | <huantian> oh sorry I thought you were asking for sqlite for some reason |
21:59:38 | FromDiscord | <LazyGamer111> ah np |
22:01:16 | FromDiscord | <huantian> not sure then |
22:03:44 | FromDiscord | <4zv4l> In reply to @huantian "if you wanted an": I'll check that ^^ |
22:04:52 | FromDiscord | <LazyGamer111> In reply to @huantian "not sure then": i found it, for other people looking for it, it's in this with the zip https://downloads.mysql.com/archives/c-c/ |
22:14:25 | * | jmdaemon joined #nim |
22:15:23 | * | sagax quit (Ping timeout: 260 seconds) |
22:26:44 | FromDiscord | <jtv> sent a code paste, see https://paste.rs/VCm |
22:27:38 | FromDiscord | <4zv4l> yeah thanks ! |
22:27:42 | FromDiscord | <4zv4l> I think I am a bit lost because |
22:27:47 | FromDiscord | <4zv4l> I have issue with my key size xD |
22:28:32 | FromDiscord | <4zv4l> does it seem correct ? |
22:28:33 | FromDiscord | <4zv4l> sent a code paste, see https://play.nim-lang.org/#ix=4j9N |
22:28:53 | FromDiscord | <vindaar> there's https://github.com/zero-functional/zero-functional for that↵(@kaddkaka) |
22:31:42 | FromDiscord | <4zv4l> when I print `iv` right after that I get↵`59161207197201192222381191972615290196164105` |
22:31:50 | FromDiscord | <4zv4l> which is 44 bytes |
22:31:53 | FromDiscord | <4zv4l> not 16 |
22:32:02 | FromDiscord | <4zv4l> and seems to be only numbers |
22:35:32 | FromDiscord | <kaddkaka> In reply to @vindaar "there's https://github.com/zero-functional/zero-fun": awesome 🙂 |
22:38:48 | FromDiscord | <4zv4l> sent a code paste, see https://play.nim-lang.org/#ix=4j9R |
22:39:42 | FromDiscord | <4zv4l> sent a code paste, see https://play.nim-lang.org/#ix=4j9S |
22:40:16 | FromDiscord | <4zv4l> it's a different number each time |
22:40:44 | FromDiscord | <kaddkaka> How can I supply a generic function like `(a, b) => (a, inc b)` to a function that expects a typed function like `(int, int) -> (int, int)`? |
22:42:18 | FromDiscord | <4zv4l> sent a code paste, see https://play.nim-lang.org/#ix=4j9T |
22:42:42 | FromDiscord | <kaddkaka> Let me rephrase: `func dostuff(f: (int, int) -> (int, int))` how can I supply `(a, b) => (a, inc b)` to it? Do I need to explicitly type my generic? |
22:42:55 | FromDiscord | <kaddkaka> (edit) "it?" => "`f` argument?" |
22:46:51 | FromDiscord | <4zv4l> you give a proc to dostuff ? |
22:47:44 | FromDiscord | <4zv4l> I don't know much, I usually just pass `f: proc` |
22:49:54 | * | Phytolizer quit (Remote host closed the connection) |
22:52:40 | FromDiscord | <auxym> In reply to @Boston "I have the code": link the c#, maybe someone can |
22:52:56 | FromDiscord | <auxym> figure out how to port it to nim |
22:53:42 | FromDiscord | <kaddkaka> sent a code paste, see https://play.nim-lang.org/#ix=4j9W |
22:55:18 | FromDiscord | <Elegantbeef> The `->` expands `(a, b)` into `proc(a: int, b: int)` |
22:55:24 | FromDiscord | <Elegantbeef> And it only works on untyped AST |
22:55:33 | FromDiscord | <Elegantbeef> So yes `Pair` will not work |
22:55:49 | FromDiscord | <Elegantbeef> Sorry expands `(int, int)` |
23:01:05 | FromDiscord | <kaddkaka> hmm, not sure I get it, but I guess => is unusable in this case then |
23:02:00 | FromDiscord | <kaddkaka> it feels strange, since I thought `Pair` was somewhat of a synonym to `(int, int)` after the type declaration. |
23:02:36 | FromDiscord | <Elegantbeef> Sure but the `->` doesnt operate on typed ast |
23:02:37 | FromDiscord | <Elegantbeef> So all it sees is a literal named `Pair` |
23:03:14 | FromDiscord | <kaddkaka> oh, hmm |
23:05:11 | FromDiscord | <kaddkaka> so, how do I resolve this elegantly? `->` seems to be the problem, but perhaps I should just ditch the anonymous function with `=>` and name and type it? |
23:05:22 | FromDiscord | <Elegantbeef> Rewrite the `->` macro |
23:06:13 | FromDiscord | <kaddkaka> How come -> isn't already operating on typed ast? Does such a version of `->` have other limitations? |
23:06:26 | FromDiscord | <Elegantbeef> No clue i didnt implement -\> |
23:06:30 | FromDiscord | <Elegantbeef> It can work on typed ast |
23:08:57 | FromDiscord | <kaddkaka> Rewriting `->`, I have no idea if that is easy or not, feels like big task 🙈 |
23:09:12 | FromDiscord | <Elegantbeef> It's really not that bad |
23:14:41 | FromDiscord | <Elegantbeef> https://play.nim-lang.org/#ix=4ja0 |
23:14:54 | FromDiscord | <Elegantbeef> Whoops that `noSide` pragma is pointless |
23:15:13 | FromDiscord | <Elegantbeef> The only limitation this has is you cannot define a `func` this way |
23:18:15 | FromDiscord | <Elegantbeef> https://play.nim-lang.org/#ix=4ja1 but that's easy to support with a `asFunc` |
23:19:07 | FromDiscord | <Elegantbeef> It's also a simpler macro than the stdlib one |
23:19:53 | FromDiscord | <kaddkaka> To me it's bad 😂 |
23:20:38 | FromDiscord | <kaddkaka> So, should that `->` be upstreamed? |
23:21:24 | FromDiscord | <Elegantbeef> No clue i dont use the arrow operators |
23:24:04 | FromDiscord | <Elegantbeef> https://play.nim-lang.org/#ix=4ja2 though one can also use even more macros to add more functionality |
23:24:28 | FromDiscord | <Elegantbeef> All of this is still less complex than the stdlibs 😛 |
23:24:45 | FromDiscord | <Elegantbeef> https://github.com/nim-lang/Nim/blob/version-1-6/lib/pure/sugar.nim#L22-L53 I mostly joke |
23:30:42 | * | jmdaemon quit (Quit: ZNC 1.8.2 - https://znc.in) |
23:31:17 | FromDiscord | <brendo-m> sent a code paste, see https://play.nim-lang.org/#ix=4ja3 |
23:33:27 | * | jmdaemon joined #nim |
23:35:52 | FromDiscord | <Elegantbeef> ` header = "libaws-c-common.a",` .a isnt a header file |
23:37:13 | FromDiscord | <Elegantbeef> I've not used nimterop though so i dont knowanything else |
23:44:49 | FromDiscord | <Elegantbeef> Damn term rewriting macros now respect `noRewrite` which means we now have easy user defined linters |
23:47:47 | FromDiscord | <brendo-m> In reply to @Elegantbeef "` ": hmm maybe it's not intended to be used this way, I got the idea to use the built archive from https://github.com/nimterop/nimterop/blob/bf088be9e925fb16d664d092afad4ab6019a78c7/nimterop/build/getheader.nim#L452 |
23:53:57 | * | krux02 quit (Remote host closed the connection) |