00:05:36 | * | tk quit (Quit: Well, this is unexpected.) |
00:06:00 | * | tk joined #nim |
00:25:38 | FromDiscord | <geekrelief> In reply to @ynfle "Why is the signature": If the signature for echo was `varargs[string, ``$``]` then it would only accept strings as parameters. But `varargs[typed]` means it'll match any type. |
00:27:39 | FromDiscord | <ynfle> In reply to @geekrelief "If the signature for": No. `$` converts to string |
00:28:17 | FromDiscord | <geekrelief> This is weird. I'm passing `nil` to a macro taking `varargs[untyped]` and testing it with `.isNil` returns true. https://play.nim-lang.org/#ix=3O5h But if I set the arg type to `untyped`, `.isNil` is false. |
00:28:29 | FromDiscord | <geekrelief> In reply to @ynfle "No. `$` converts to": right |
00:29:01 | FromDiscord | <geekrelief> If the type is not a string it gets converted with `$` |
00:37:20 | FromDiscord | <geekrelief> nvm, I guess I'm mistaken seems like `echo` takes `varargs[typed, ``$``]` as a special case. https://nim-lang.github.io/Nim/manual.html#types-varargs `varargs[typed] is treated specially: It matches a variable list of arguments of arbitrary type but always constructs an implicit array. This is required so that the builtin echo proc does what is expected:` |
00:38:06 | FromDiscord | <geekrelief> sent a code paste, see https://play.nim-lang.org/#ix=3O5n |
00:40:48 | FromDiscord | <ynfle> In reply to @geekrelief "If the type is": Ya |
00:41:04 | FromDiscord | <ynfle> Right |
00:59:06 | * | vicecea quit (Remote host closed the connection) |
00:59:36 | * | vicecea joined #nim |
01:04:59 | * | Mister_Magister quit (Quit: bye) |
01:06:42 | * | Mister_Magister joined #nim |
01:18:06 | FromDiscord | <ajusa> My Nim compile times are getting kind of slow (5-10 seconds), any ideas as to what I can do to speed it up? tcc doesn't compile this code in my case |
01:18:56 | FromDiscord | <Elegantbeef> Fewer macros |
01:19:02 | FromDiscord | <Elegantbeef> Got the code hosted somewhere? |
01:19:28 | FromDiscord | <Patitotective> In reply to @Elegantbeef "Fewer macros": But macros do not affect compiled binary speed, right? |
01:19:41 | FromDiscord | <Elegantbeef> They are compile time only so of course not |
01:19:59 | FromDiscord | <Elegantbeef> They can actually increase runtime as they can do things more optimized than one would want to write by hand |
01:20:19 | FromDiscord | <Elegantbeef> But the macro would have to emit the optimized logic of course 😛 |
01:20:45 | FromDiscord | <ajusa> In reply to @Elegantbeef "Got the code hosted": Nope, it's just a small Jester app. I'll assume the Jester macros are the cause lol, I've seen others complain |
01:20:48 | FromDiscord | <evoalg> so increase the runtime speed (or reduce runtime time) right? |
01:21:28 | FromDiscord | <evoalg> "They can actually increase runtime" |
01:21:32 | FromDiscord | <Elegantbeef> Well you can make macros that allow you to abstract low level optimizations to appear like you'd normally write |
01:21:39 | FromDiscord | <Elegantbeef> increase runtime speed\ |
01:21:51 | FromDiscord | <ajusa> guess I'll wait for incremental compilation. I think the status guys have it worse, they've got builds that take minutes |
01:21:54 | FromDiscord | <Elegantbeef> An example of that is https://github.com/liquidev/datarray |
01:22:30 | FromDiscord | <Elegantbeef> Well a 10% compile speedup can be found by commenting out two checks in Nim if you want a bit faster |
01:22:58 | FromDiscord | <Elegantbeef> Also you can build a danger compiler with lto |
01:23:05 | FromDiscord | <Elegantbeef> You can get a bit faster than stock Nim |
01:23:45 | FromDiscord | <ajusa> Apparently gc orc compiler is faster too, but it didn't work last I checjed |
01:23:50 | FromDiscord | <ajusa> (edit) "checjed" => "checked" |
01:24:02 | FromDiscord | <Elegantbeef> Build a compiler with danger LTO and comment out https://github.com/nim-lang/Nim/blob/devel/compiler/vmgen.nim#L2057-L2062 |
01:24:06 | FromDiscord | <Elegantbeef> You can get a few seconds chopped off |
01:24:27 | FromDiscord | <Elegantbeef> I know with CPS tests with just commenting out those two string checks i got a 10% speed boost |
01:24:37 | FromDiscord | <Elegantbeef> In the case of macro heavy code that'll make you go faster |
01:24:58 | FromDiscord | <Elegantbeef> Yes your compiler wont be able to use marshal at compile time, but find me a person that uses marshal and i'll show you a madman |
01:25:27 | FromDiscord | <Elegantbeef> That 10% speed boost was from like 11 seconds down to 9 seconds |
01:25:41 | FromDiscord | <ajusa> Fair enough lol. I'm also using includes and templates pretty heavily, would that add a ton to compile time? |
01:25:57 | FromDiscord | <Elegantbeef> Templates are cheap, includes will add |
01:26:08 | FromDiscord | <Elegantbeef> templates are not VM based, they're just replace AST |
01:26:50 | FromDiscord | <ajusa> It's probably the includes then, Jester's extend macro just copies the code so the imports it has in a different file aren't copied over. I replaced my imports with includes to get around that but now I have slow compiles |
01:27:33 | FromDiscord | <Elegantbeef> Includes causes resemming of all the included code |
01:27:46 | FromDiscord | <Elegantbeef> Atleast i think it does |
01:28:03 | FromDiscord | <Elegantbeef> `export` exists |
01:28:17 | FromDiscord | <ajusa> In reply to @Elegantbeef "`export` exists": Well uh |
01:28:23 | FromDiscord | <ajusa> I forgot |
01:28:41 | FromDiscord | <Elegantbeef> If you're including imports it's not too bad |
01:28:50 | FromDiscord | <Elegantbeef> But using include a lot is just ugly |
01:28:59 | FromDiscord | <ajusa> Nah I'm including entire files filled with macros |
01:29:06 | FromDiscord | <ajusa> (edit) "Nah I'm including entire files filled with ... macros" added "Jester" |
01:29:10 | FromDiscord | <Elegantbeef> Then yea knock it off |
01:29:48 | FromDiscord | <ajusa> In my defense I thought includes were cheap and templates were expensive. I learned something new today, thanks mr beef |
01:37:19 | FromDiscord | <exelotl> In reply to @Elegantbeef "Build a compiler with": ooh I'll have to try this |
01:37:57 | FromDiscord | <exelotl> (do replies show in matrix?) |
01:42:27 | FromDiscord | <Rika> Kinda afaik |
01:44:06 | FromDiscord | <huantian> this is what it looks like on element https://media.discordapp.net/attachments/371759389889003532/937523601270259782/unknown.png |
01:51:24 | FromDiscord | <Elegantbeef> Depending on what you're doing you might not get much speed increase from commenting out the marshal stuff↵(@exelotl) |
02:00:50 | * | vicfred joined #nim |
02:18:34 | * | neurocyte0917090 quit (Ping timeout: 260 seconds) |
02:36:10 | * | cyraxjoe quit (Quit: I'm out!) |
02:36:18 | * | noeontheend joined #nim |
02:36:24 | * | rienske quit (Ping timeout: 256 seconds) |
02:38:03 | * | cyraxjoe joined #nim |
02:39:43 | * | rienske joined #nim |
02:41:51 | * | noeontheend quit (Ping timeout: 256 seconds) |
03:06:33 | * | arkurious quit (Quit: Leaving) |
03:48:58 | FromDiscord | <ynfle> How do I run testament for one file? `./koch tests filepath` doesn't work |
03:50:24 | FromDiscord | <ynfle> If the current devel is failing the CI, how am I supposed to know if I broke anything? |
03:50:35 | FromDiscord | <ynfle> In reply to @ynfle "How do I run": Beef, do you know? |
03:53:40 | FromDiscord | <Elegantbeef> Comically i do not |
03:57:02 | FromDiscord | <ynfle> It's `./koch tests run filepath` |
03:58:44 | * | Gustavo6046 joined #nim |
04:15:55 | * | cyraxjoe quit (Quit: I'm out!) |
04:17:55 | * | cyraxjoe joined #nim |
04:23:26 | FromDiscord | <ynfle> It's frustrating when the CI is failing |
04:23:47 | FromDiscord | <ynfle> (edit) "It's frustrating when the CI is failing ... " added "before a PR. It's hard to know if the PR breaks anything" |
04:23:54 | * | cyraxjoe quit (Ping timeout: 250 seconds) |
04:24:35 | * | cyraxjoe joined #nim |
04:25:14 | FromDiscord | <Elegantbeef> You generally can look at the logs to see |
04:25:34 | FromDiscord | <Elegantbeef> this could be caused by your changes |
04:26:40 | FromDiscord | <ynfle> Seems similar logs to the previous commit |
04:26:48 | FromDiscord | <ynfle> Anyway |
04:26:49 | FromDiscord | <ynfle> GN |
04:26:55 | FromDiscord | <Elegantbeef> Then possibly just CI issue |
05:07:09 | * | vicfred quit (Quit: Leaving) |
05:42:05 | * | jkl1337 quit (Quit: Gone.) |
05:43:28 | * | jkl joined #nim |
06:27:50 | * | Lord_Nightmare quit (Ping timeout: 250 seconds) |
06:47:52 | * | PMunch joined #nim |
06:48:54 | * | Mister_Magister quit (Read error: Connection reset by peer) |
06:50:37 | * | Mister_Magister joined #nim |
06:50:59 | * | jjido joined #nim |
07:25:49 | * | Mister_Magister quit (Quit: bye) |
07:27:46 | * | Mister_Magister joined #nim |
07:37:26 | * | Mister_Magister quit (Quit: bye) |
07:40:17 | * | Mister_Magister joined #nim |
07:42:39 | FromDiscord | <Bung> why this does |
07:43:02 | FromDiscord | <Bung> not have japanese channel, I see a lot japanese developers use nim |
08:10:56 | PMunch | Like a japanese chat room? |
08:16:11 | * | Mister_Magister quit (Ping timeout: 256 seconds) |
08:16:57 | * | Mister_Magister joined #nim |
08:25:49 | FromDiscord | <Rika> They have their own discord |
08:25:55 | FromDiscord | <Rika> Server I mean |
08:28:42 | FromDiscord | <Bung> in Language-specific |
08:29:45 | FromDiscord | <Rika> Yes I know what you mean |
08:34:13 | * | mjsir911 quit (Ping timeout: 268 seconds) |
08:34:13 | * | oddish quit (Ping timeout: 268 seconds) |
08:34:43 | * | mjsir911 joined #nim |
08:35:27 | * | nixfreaknim[m] quit (Ping timeout: 268 seconds) |
08:35:27 | * | happycorsair[m] quit (Ping timeout: 268 seconds) |
08:35:28 | * | emery quit (Ping timeout: 268 seconds) |
08:35:28 | * | Yardanico quit (Ping timeout: 268 seconds) |
08:35:34 | * | Yardanico joined #nim |
08:36:04 | * | crem1 quit (Ping timeout: 268 seconds) |
08:36:20 | * | ehmry joined #nim |
08:37:38 | * | crem1 joined #nim |
08:39:22 | * | happycorsair[m] joined #nim |
08:46:53 | * | tk quit (Quit: Well, this is unexpected.) |
08:47:20 | * | nixfreaknim[m] joined #nim |
08:57:25 | * | tk joined #nim |
09:07:05 | FromDiscord | <Bung> does github has bug ? diff in pr , I see base master is not new version master |
09:19:56 | * | Gustavo6046 quit (Quit: Leaving) |
09:25:23 | FromDiscord | <Goel> Does Nim have any implementation of a Vector2-SIMD in any of the official Modules? |
09:32:31 | PMunch | You can look into nimsimd, or arraymancer. I don't think there's any such modules in the standard library |
09:33:10 | FromDiscord | <Elegantbeef> Thre isnt anything simd in the stdlib |
09:34:10 | FromDiscord | <Elegantbeef> https://github.com/GaryM-exkage/slam if you just want vectors |
09:39:59 | * | notchris quit (Ping timeout: 250 seconds) |
09:41:17 | FromDiscord | <Rika> Is this the one we helped name I forget |
09:41:55 | FromDiscord | <Elegantbeef> Yea |
09:44:06 | * | notchris joined #nim |
09:47:25 | PMunch | Hmm, all webcams are so crap, I'm seriously considering to start using my old (or new) phone instead.. |
09:47:39 | FromDiscord | <Rika> Well that’s one option |
09:47:46 | FromDiscord | <Rika> Getting the output reliably is difficult |
09:47:58 | PMunch | Eh, DroidCam works fine |
09:48:01 | FromDiscord | <Elegantbeef> droidcam is easy |
09:48:12 | FromDiscord | <Rika> I’m not an Android user so I don’t relate xd |
09:48:50 | FromDiscord | <Rika> Well I mean I am |
09:48:55 | FromDiscord | <Rika> But I don’t daily drive it anymore |
09:49:10 | FromDiscord | <Elegantbeef> Pmunch do you know if the kate text editor supports errors over LSP? |
09:49:22 | FromDiscord | <Elegantbeef> I'm still waiting for a response from the KDE matrix apparently no one knows |
09:49:38 | PMunch | I have no idea |
09:50:28 | FromDiscord | <Rika> Do you use Kate? |
09:50:34 | FromDiscord | <Elegantbeef> Trying it out now |
09:50:44 | * | jjido quit (Quit: My MacBook Air has gone to sleep. ZZZzzz…) |
09:50:48 | FromDiscord | <Rika> It’s okay |
09:50:54 | PMunch | What kind of errors are you thinking of? |
09:52:10 | FromDiscord | <Elegantbeef> Error reporting of any variety |
09:53:12 | FromDiscord | <Elegantbeef> With LSP and the new update it's surprisngly good |
09:53:34 | PMunch | The new update? |
09:53:35 | FromDiscord | <Elegantbeef> But minor issues like tab being accept suggestion and not having any idea if what i'm writing is going to compiler |
09:53:50 | FromDiscord | <Rika> > tab being accept ↵Cursed |
09:53:53 | FromDiscord | <Elegantbeef> Yea kate got some major updates recently |
09:54:05 | FromDiscord | <Elegantbeef> Tell me about it go to indent and it just accepts |
09:54:09 | FromDiscord | <Elegantbeef> I've never liked it |
09:54:49 | FromDiscord | <Elegantbeef> Dont know if i missed a setting but can disable that either |
09:54:54 | FromDiscord | <creikey> In reply to @Elegantbeef "Yea kate got some": vscode lagging makes me sad if kate can do what it can that would be great |
09:55:05 | FromDiscord | <Elegantbeef> So some finicky things but otherwise a good experience |
09:55:17 | FromDiscord | <Elegantbeef> Well try out kate |
09:55:32 | FromDiscord | <creikey> I'm assuming the nim support is over lsp |
09:55:39 | FromDiscord | <Elegantbeef> Yeaa |
09:55:48 | FromDiscord | <creikey> I just need ctrl + click to go to something and then renaming symbols is useful |
09:56:00 | FromDiscord | <Elegantbeef> No clue about the renaming symbols |
09:56:06 | FromDiscord | <Elegantbeef> Dont know if the LSP supports that |
09:56:09 | FromDiscord | <creikey> aw dang |
09:56:16 | FromDiscord | <creikey> I could honestly probably just use a riced out neovim |
09:56:20 | FromDiscord | <Elegantbeef> I know kate does but dont know about nimlsp |
09:56:31 | FromDiscord | <creikey> so annoying to maintain those configs though |
09:57:11 | FromDiscord | <creikey> I guess there's also sublime text editor |
09:57:14 | FromDiscord | <Waldecir Santos> How do you guys run tests within vscode, do we have any test explorer integration ? |
09:57:22 | FromDiscord | <Elegantbeef> `nimble test` |
09:58:25 | FromDiscord | <creikey> if only clion had nim support |
09:58:43 | FromDiscord | <Elegantbeef> Jetbrains has a nim addon |
09:59:13 | FromDiscord | <creikey> oh wow |
09:59:32 | FromDiscord | <creikey> it feels like nim is very unpopular but then stuff like this exists |
10:00:17 | FromDiscord | <Rika> It is not very good, the add on |
10:00:27 | FromDiscord | <Waldecir Santos> In reply to @Elegantbeef "`nimble test`": But no vscode integration right ? also I'm studying with https://exercism.org so they don't have nimble, any advice ? |
10:00:33 | FromDiscord | <Elegantbeef> Yea they're not using nimsuggest or the lsp an doing it all from start |
10:00:50 | FromDiscord | <creikey> Oh there is that other text editor that replicates the vscode api |
10:00:51 | FromDiscord | <Elegantbeef> i dont get why tests need intergration with an editor |
10:00:56 | FromDiscord | <creikey> really why is vscode lagging for me |
10:01:01 | FromDiscord | <Elegantbeef> Just run the code and ensure you get expcted values |
10:01:04 | FromDiscord | <creikey> like half the time when I type it lags by 1-2 seconds |
10:01:04 | FromDiscord | <Bung> rename is defined in lsp |
10:01:15 | FromDiscord | <Elegantbeef> Well it doesnt work with kate |
10:01:34 | FromDiscord | <Phil> Huh, my main gripe with vscode is that sometimes the intellisense just randomly takes >10 seconds to throw suggestions out |
10:01:44 | FromDiscord | <Rika> In reply to @creikey "Oh there is that": Which, onivim? |
10:01:55 | FromDiscord | <creikey> In reply to @Rika "Which, onivim?": yeah I think that's what I'm thinking of |
10:01:55 | FromDiscord | <Phil> (edit) "out" => "out↵That sometimes being 75% of the time" |
10:01:57 | FromDiscord | <Elegantbeef> Onivim2 is the one i know of |
10:02:04 | FromDiscord | <creikey> I looked into that project it seems very strange |
10:02:09 | FromDiscord | <creikey> weird programming language |
10:02:13 | FromDiscord | <creikey> all new ui etc |
10:02:14 | FromDiscord | <Waldecir Santos> In reply to @Elegantbeef "i dont get why": It dosen't it's just to make it "easier", that's all. |
10:02:18 | FromDiscord | <Rika> Really would have liked it more if it based off of neovim than vim |
10:02:23 | FromDiscord | <creikey> when I tried to compile their languages compiler it took 10 minutes on my machine then failed |
10:02:31 | FromDiscord | <Elegantbeef> Hit f6 waldecir |
10:02:37 | FromDiscord | <Elegantbeef> Or is it f5 to run current filee |
10:02:40 | FromDiscord | <Elegantbeef> Dont recall atm |
10:02:47 | FromDiscord | <Bung> the lsp slow because it need compile whole module and its dependencies to graph I think |
10:02:57 | FromDiscord | <creikey> In reply to @Bung "the lsp slow because": I was talking about onivim 2 |
10:03:06 | FromDiscord | <Waldecir Santos> In reply to @Elegantbeef "Hit f6 waldecir": F6 is the key, but it dosen't run the tests just the file |
10:03:21 | FromDiscord | <creikey> well really like |
10:03:23 | FromDiscord | <Elegantbeef> Wait what are you testing? |
10:03:24 | FromDiscord | <creikey> how hard would it be |
10:03:26 | FromDiscord | <creikey> to make a really awesome nim ide |
10:03:28 | FromDiscord | <Waldecir Santos> But I can probably create a task for that |
10:03:29 | FromDiscord | <creikey> in nim |
10:03:48 | FromDiscord | <Waldecir Santos> In reply to @Elegantbeef "Wait what are you": I'm studying nim at the moment, so this |
10:03:50 | FromDiscord | <Waldecir Santos> https://media.discordapp.net/attachments/371759389889003532/937649363633713202/unknown.png |
10:04:11 | FromDiscord | <Bung> I dont know how the IC progress is going |
10:04:25 | FromDiscord | <creikey> In reply to @Waldecir Santos "I'm studying nim at": for vscode I just have ctrl+shift+b run `build.bat` in the project root then put whatever I want to do in ther |
10:04:27 | FromDiscord | <creikey> (edit) "ther" => "there" |
10:04:30 | FromDiscord | <creikey> nice no brain configuration |
10:04:42 | FromDiscord | <Elegantbeef> I mean running the file on the right will test it |
10:05:31 | FromDiscord | <Elegantbeef> Eh i'm weird generally so disregard me |
10:05:38 | FromDiscord | <Waldecir Santos> true but I'll need to switch to that file, but I can probably use @creikey solution or just create a new keybind |
10:06:19 | FromDiscord | <creikey> sent a code paste, see https://play.nim-lang.org/#ix=3O7a |
10:07:17 | * | jmdaemon quit (Ping timeout: 250 seconds) |
10:07:55 | FromDiscord | <Waldecir Santos> Thank you @creikey I'll try that. |
10:16:14 | FromDiscord | <tandy> im iterating over a `Table[string, object]` using `pairs`, how can i do something different for the last iteration? |
10:17:05 | FromDiscord | <Elegantbeef> store the key then do something at the last iteration |
10:17:10 | FromDiscord | <Elegantbeef> after the last\ |
10:17:18 | FromDiscord | <tandy> truu |
10:18:15 | FromDiscord | <tandy> but how will i know when ive reached the last iteration |
10:18:45 | FromDiscord | <Rika> I suddenly have a compulsion to write a Nim formatter that doesn’t use Nim pretty itself |
10:18:56 | FromDiscord | <Elegantbeef> You just always store the key |
10:19:05 | FromDiscord | <Elegantbeef> Then after the iterating you do custom logic |
10:19:24 | FromDiscord | <Elegantbeef> Alternatively you do `keys.toSeq` then iterate over that and |
10:19:36 | FromDiscord | <Michal Maršálek> typedesc arguments in macros are converted to NimNodes, right? Is there a way to acess the type itself? Something like static typedesc? |
10:19:56 | FromDiscord | <Elegantbeef> `myTypeDesc[^1]`.getType\` |
10:19:59 | FromDiscord | <tandy> oh you mean for every item? |
10:20:05 | FromDiscord | <Elegantbeef> Yes |
10:20:33 | FromDiscord | <Elegantbeef> you can also use `len` |
10:21:21 | FromDiscord | <Elegantbeef> sent a code paste, see https://play.nim-lang.org/#ix=3O7f |
10:21:33 | FromDiscord | <tandy> i think this will probably be the best way |
10:21:42 | FromDiscord | <Elegantbeef> I think you can also use \`std/enumerate |
10:22:11 | FromDiscord | <Elegantbeef> sent a code paste, see https://play.nim-lang.org/#ix=3O7g |
10:22:27 | FromDiscord | <Elegantbeef> Dont recall if it works for mutable variables |
10:22:44 | FromDiscord | <Elegantbeef> Actually it's not mutable what am i on about |
10:23:50 | FromDiscord | <tandy> this is nice |
10:24:01 | FromDiscord | <tandy> thanks beefboss |
10:24:15 | FromDiscord | <tandy> join nimskull chat \:)↵(@Rika) |
10:35:36 | Amun-Ra | btw, I didn't know you can reuse argument variable name in function, as in: proc doo(bar: int): var bar = bar |
10:35:50 | FromDiscord | <Elegantbeef> Ah shadowing is lovely |
10:36:42 | FromDiscord | <Michal Maršálek> In reply to @Elegantbeef "`myTypeDesc[^1]`.getType\`": I don't understand. Seems like gettype returns a NimNode? |
10:37:26 | FromDiscord | <Elegantbeef> It does |
10:37:36 | FromDiscord | <Rika> In reply to @tandy "join nimskull chat \:)": I’ve been meaning to |
10:37:55 | FromDiscord | <Elegantbeef> You want the type passed into a macro statically? |
10:37:59 | FromDiscord | <Rika> I’ll join in a bit perhaps |
10:38:00 | * | jjido joined #nim |
10:39:24 | FromDiscord | <Elegantbeef> Depending on waht you're doing but yes |
10:39:24 | FromDiscord | <evoalg> I read somewhere that this is idiomatic for Nim↵(<@709044657232936960_=41mun-=52a=5b=49=52=43=5d>) |
10:39:39 | FromDiscord | <Elegantbeef> Though i think it should emit a hint |
10:41:49 | FromDiscord | <Michal Maršálek> In reply to @Elegantbeef "You want the type": yes |
10:42:40 | FromDiscord | <Elegantbeef> I dont think you can do that without a template that emits the macro in that way |
10:44:07 | FromDiscord | <Michal Maršálek> What does that mean? |
10:46:46 | FromDiscord | <tandy> worth reading this i think↵https://github.com/nim-works/nimskull/discussions/113↵(@Rika) |
10:46:57 | FromDiscord | <Elegantbeef> sent a code paste, see https://play.nim-lang.org/#ix=3O7o |
10:47:08 | FromDiscord | <Michal Maršálek> I thought I could shift the type into a generic param but ig macros cant be generic? |
10:47:48 | FromDiscord | <Elegantbeef> Indeed doesnt make sense |
10:49:30 | FromDiscord | <Michal Maršálek> sent a code paste, see https://play.nim-lang.org/#ix=3O7p |
10:50:58 | FromDiscord | <evoalg> gosh even `for i, x, y in enumerate mytable:` works |
10:58:38 | FromDiscord | <Michal Maršálek> sent a code paste, see https://play.nim-lang.org/#ix=3O7u |
10:59:42 | FromDiscord | <Rika> In reply to @tandy "worth reading this i": That’s a lot already done |
11:08:53 | FromDiscord | <haxscramper> to be more specific it requires https://github.com/nim-works/nimskull/discussions/139, but that is blocked by the VM using AST for it's operation, so the code is really messy all over the place |
11:10:00 | FromDiscord | <haxscramper> right now there is simply not enough information to make formatter useful |
11:10:29 | FromDiscord | <bestman 8> would nim be a good option for deploying ml models for desktop apps |
11:11:29 | PMunch | @bestman_8, I'd say so. It's a systems programming language with great performance so should work well for that |
11:11:37 | PMunch | What kind of deployment are you thinking? |
11:12:36 | FromDiscord | <bestman 8> mostly just making a model with python and importing and running it in nim (the other option is rust and i dont really like rust) |
11:13:58 | PMunch | Are you making it in Python for the library support? |
11:14:01 | FromDiscord | <bestman 8> i just want to know what would be a good way to deploy ml models for desktop |
11:14:30 | FromDiscord | <bestman 8> In reply to @PMunch "Are you making it": yes but it will be converted to .onnx (that is a standard and seems to be the only option for desktop) |
11:16:31 | PMunch | That should work fine then |
11:17:04 | PMunch | You could probably use this to load ONNX and run it in Nim: https://github.com/YesDrX/onnxruntime-nim |
11:19:47 | FromDiscord | <bestman 8> will that also have cuda support |
11:20:00 | PMunch | That seems to be a pretty low-level wrapper for the Onnxruntime written in C++, so not the prettiest Nim code to use it. But it should be easy enough to make it a bit prettier with some Nim templates |
11:20:57 | PMunch | Should do, yes, it is based on this: https://github.com/microsoft/onnxruntime |
11:21:28 | PMunch | And when I say based on I mean that it is literally running that for the actual ONNX stuff |
11:21:48 | FromDiscord | <bestman 8> that is pretty nice it seems like a great option |
11:22:38 | FromDiscord | <bestman 8> i wont have to write c or rust code and dont have to include python so it would be a good option (only issue is amd gpu's but webgl should work for that) |
11:23:48 | FromDiscord | <Phil> Is there a way to log messages in a package and have that respect the log level of the application its compiled into? |
11:24:24 | PMunch | @Phil, depends on how the log level is specified, and how messages are logged |
11:24:32 | FromDiscord | <Phil> E.g. I have my connection pooling package. I want to have it log how many connections are in the pool at various times on the debug log level. I do not care to see those when running normally |
11:25:01 | FromDiscord | <Phil> In reply to @PMunch "<@180601887916163073>, depends on how": Log level is specified in the logger call:↵`logger.log(lvlDebug, "AFTER RECYCLE - Number of connections in pool: " & $pool.connections.len() )` |
11:25:03 | PMunch | I mean the bare-minimum thing is to do "when defined(debug)" |
11:25:21 | PMunch | Oh right, so you use the logging library? |
11:25:30 | FromDiscord | <Phil> Yeah, I thought that was the standard |
11:25:35 | PMunch | This thing? https://nim-lang.org/docs/logging.html |
11:25:41 | FromDiscord | <Phil> Yep |
11:25:47 | PMunch | Well, it's in the standard library |
11:25:50 | FromDiscord | <Phil> the logger you see in there is a global logger |
11:26:01 | FromDiscord | <deeuu> Hey,↵Is it correct that `channels` should not be used when spawning tasks using `std/threadpool`? From [the docs](https://nim-lang.org/docs/channels_builtin.html#Channel) ↵> Note: Channels are designed for the Thread type. They are unstable when used with spawn↵I'm confused because NimInAction (p.178) shows an example of this, and I've seen channels and threadpool used together elsewhere, e.g. [morelogging](https://github.com/Federico |
11:26:02 | FromDiscord | <Phil> `var logger = newConsoleLogger()`↵I call that at the start of the module |
11:26:03 | PMunch | Honestly most people seem to just echo out messages |
11:26:31 | PMunch | I mean the obvious way is to take in a logger object on initialisation |
11:26:35 | FromDiscord | <Phil> ~~I refuse! I want to do my logging cleanly!~~ |
11:26:53 | FromDiscord | <Phil> Hmmm |
11:26:54 | PMunch | Haha, I mean it's a good idea to use a logger :) |
11:27:07 | PMunch | I think status has their own logger as well, which is really nice |
11:27:13 | FromDiscord | <Phil> I don't want to bother users of my library though |
11:27:33 | PMunch | https://github.com/status-im/nim-chronicles |
11:28:09 | PMunch | Ah right, so you add global handlers |
11:28:31 | NimEventer | New thread by Drkameleon: Variable compile-time import paths, see https://forum.nim-lang.org/t/8856 |
11:29:10 | FromDiscord | <Phil> In reply to @PMunch "Ah right, so you": I'm not sure I follow on that one |
11:29:16 | PMunch | So I guess replace all the `logger.log` statements with just `log` and add a `when isMainModule: addHandler(newConsoleLogger())` |
11:29:19 | PMunch | Or something like that |
11:30:27 | PMunch | So if you're not the main module, assume that a logger was added as a handler by the main module and use that |
11:30:49 | FromDiscord | <Phil> Ohhhh that's what that does? Look in the main module for a logger object of some sorts? |
11:31:39 | FromDiscord | <Phil> I think I need to read up a bit on what handlers mean in nim |
11:32:22 | FromDiscord | <Phil> Ohhhhh |
11:32:28 | FromDiscord | <Phil> addHandler builds something like a global logger context |
11:32:37 | FromDiscord | <Phil> And if you call log it just calls all the loggers that you added via "addHandler" |
11:34:22 | PMunch | Yu |
11:34:26 | PMunch | Yup* |
11:35:22 | FromDiscord | <Phil> Yeeeee that's the way I should've done it in the beginning. I just wrapped up a month-long log4j upgrade and that got my brain all primed that it worked similarly in nim |
11:35:51 | FromDiscord | <Phil> I know more about logging than I ever wanted to know |
11:36:01 | PMunch | Handlers aren't a Nim concept, it's just what the logging module calls them. The logger module just have a global variable with log handlers |
11:36:01 | FromDiscord | <Phil> (edit) "I know more about logging ... than" added "now" |
11:36:30 | PMunch | Oh yikes, sorry to hear you got hit by the log4j train :P |
11:37:04 | PMunch | Curiously the global variable is thread-local, so you can configure different threads to have different loggers |
11:37:23 | PMunch | Probably just from the pre-ARC days though |
11:37:46 | FromDiscord | <Phil> is "mapped diagnostic context" something that is a general logging context? |
11:37:50 | FromDiscord | <Phil> (edit) "context?" => "concept?" |
11:37:57 | FromDiscord | <tandy> this sounds cool, what are you going to make? |
11:37:58 | FromDiscord | <tandy> this sounds cool, what are you going to make↵(@bestman 8) |
11:38:10 | FromDiscord | <Phil> The idea that you give every thread a custom hashmap solely for logging that you fill with thread-specific data |
11:38:17 | FromDiscord | <Phil> (edit) "The idea that you give every thread a custom hashmap solely for logging that you fill with thread-specific data ... " added "and can access in log-calls" |
11:39:00 | PMunch | @deeuu, I'm not 100% sure to be honest. I think it might confuse the parallel statement since it does rewriting, but just straight spawn calls should be safe (I think) |
11:39:32 | FromDiscord | <bestman 8> In reply to @tandy "this sounds cool, what": i just want to know how to deploy for desktop and at the end i would like something that could run the ml models on images |
11:39:43 | PMunch | Not 100% sure, but it's probably fine. This is getting a rewrite for ARC/ORC anyways, so everything is a bit muddy at the moment |
11:39:50 | * | jjido quit (Quit: My MacBook Air has gone to sleep. ZZZzzz…) |
11:40:20 | PMunch | @Phil, "mapped diagnostic context"? |
11:41:01 | FromDiscord | <bestman 8> the current ways to deploy ml models on desktop would be to rewrite most of the model in a lower level language or to use the .onnx model with c or rust |
11:41:09 | FromDiscord | <Phil> It's what log4j calls its custom hashmaps that they associate with every thread. You put stuff in there like a thread's name, what task it was currently on (you have to remember to update that if you make use of this) etc. etc. |
11:41:48 | FromDiscord | <bestman 8> (edit) "rust" => "rust↵not that people actually deploy to desktop and when they do they use js" |
11:41:49 | FromDiscord | <Phil> It's... a weird concept. I don't think I've yet seen a proper usecase where that actually helped, you're message just made me wonder whether nims logging has sth like that |
11:41:58 | FromDiscord | <Phil> (edit) "you're" => "your" |
11:42:07 | PMunch | Aha, yes I've seen similar things |
11:42:29 | FromDiscord | <Phil> So far I've only seen it abused |
11:42:41 | PMunch | Chronicles has something similar, and C# also does something similar |
11:42:46 | PMunch | Or .NET I guess |
11:43:06 | FromDiscord | <Phil> Like putting the name of the server you're currently on in a THREAD SPECIFIC hashmap instead of, yknow, putting that into a layout for log messages or sth |
11:43:48 | FromDiscord | <Tanguy> You can probably do something like that with this https://github.com/status-im/nim-chronicles#publiclogscope |
11:44:20 | FromDiscord | <Tanguy> With getServerId being something that returns your thread specific variables |
11:45:58 | FromDiscord | <tandy> cool, i was more wondering what your desktop app is going to do↵(@bestman 8) |
11:47:36 | FromDiscord | <bestman 8> In reply to @tandy "cool, i was more": probably simple things for images like style gan things, image segmentation for selection and upscaling |
11:48:31 | FromDiscord | <bestman 8> i'm planning on only using models that are pretty memory efficient so my poor gpu can train them |
11:51:44 | FromDiscord | <Phil> Ohhh what log4j calls appenders, nim std logging calls ConsoleLogger/FileLogger etc. |
11:52:38 | FromDiscord | <tandy> sounds cool, send me the repo when you have it going↵(@bestman 8) |
11:53:01 | FromDiscord | <tandy> i wanna have a spleeter impl in nim |
11:54:39 | FromDiscord | <bestman 8> In reply to @tandy "sounds cool, send me": if it ever happens |
11:54:49 | FromDiscord | <bestman 8> (edit) "In reply to @tandy "sounds cool, send me": if it ever happens ... " added "and i still remember this" |
11:56:38 | FromDiscord | <tandy> lol |
11:57:16 | FromDiscord | <Phil> In reply to @Tanguy "You can probably do": Hmmm this does tempt me, I might include nim-chronicles in my main project. I'd not want to include it in a super tiny package of merely 200 lines of code though, does it somewhat integrate with the std logging lib? |
11:57:37 | FromDiscord | <Phil> (edit) "though," => "though (my tinypool package for sqlite connection pooling)," |
11:58:00 | FromDiscord | <Phil> I'm mostly contemplating on how it'd interact if I had the package use stdlib and my main project (which makes use of the package) use nim-chronicles |
12:03:26 | FromDiscord | <Phil> ... okay, dumb question, but I would like to update my package |
12:03:34 | FromDiscord | <Phil> Do I just do nimble publish again? |
12:05:22 | FromDiscord | <Rika> no |
12:05:44 | FromDiscord | <Rika> you commit a version bump on the .nimble file then tag that commit with a version number |
12:06:42 | FromDiscord | <dom96> Or just commit. You don’t need to tag after every commit 🙂 |
12:07:06 | FromDiscord | <dom96> Although Nimble will always install the latest tagged version implicitly |
12:08:53 | PMunch | @Phil, I guess you could implement a log handler which logged the message via chronicles if you wanted. But I'm not sure if anything like that is officially supported in chronicles |
12:20:17 | FromDiscord | <Phil> In reply to @Rika "you commit a version": Thanks (to you as well @dom96 )!↵Finally made the package's log messages respect the global log level |
12:23:52 | * | jjido joined #nim |
12:59:38 | FromDiscord | <Goel> Is there any difference between `type()` and `typeof()`? Is one deprecated and one not or something similar? |
13:00:30 | FromDiscord | <Rika> yes |
13:00:36 | FromDiscord | <Rika> type is deprecated afaik |
13:43:45 | FromDiscord | <demotomohiro> IIRC, type was deprecated because "type" is harder to google than "typeof". |
13:44:54 | FromDiscord | <Rika> also got confusing when type != type != type; typeof/typedesc/type |
13:46:12 | FromDiscord | <Phil> type is deprecated? huh |
13:53:21 | PMunch | @Phil, for getting the type of a variable |
13:53:42 | PMunch | You should still use types :P |
13:54:42 | FromDiscord | <demotomohiro> !eval echo 1.typeof |
13:54:44 | NimBot | int |
13:57:09 | FromDiscord | <Rika> hm i do actually wonder why int isnt an alias determined by when statements |
14:00:57 | PMunch | Instead of being a magic? |
14:03:24 | FromDiscord | <Phil> In reply to @PMunch "You should still use": Watch me make an entire medium sized web application without any types whatsoever! |
14:03:52 | FromDiscord | <Phil> (edit) "whatsoever!" => "whatsoever outside of Hashmaps!" |
14:04:04 | PMunch | *shudders* |
14:04:28 | FromDiscord | <Rika> watch me make a program with nothing other than strings and pointers |
14:04:36 | FromDiscord | <Rika> and strings as pointers |
14:05:59 | FromDiscord | <Phil> So TIL Rika is very competitive |
14:07:27 | FromDiscord | <Rika> oh watch me make a program with nothing but pointers |
14:07:40 | FromDiscord | <Phil> Easy there Satan |
14:12:25 | FromDiscord | <ynfle> PMunch, can you look at this run? `nimlsp` is failing the CI https://github.com/ynfle/Nim-1/runs/5005825672?check_suite_focus=true. Is it a nimlsp issue? |
14:13:43 | * | jjido quit (Quit: My MacBook Air has gone to sleep. ZZZzzz…) |
14:14:17 | * | rockcavera joined #nim |
14:14:17 | * | rockcavera quit (Changing host) |
14:14:17 | * | rockcavera joined #nim |
14:16:26 | PMunch | Ah yes, that is a nimlsp issue |
14:16:31 | PMunch | That test is outdated |
14:20:10 | FromDiscord | <yumi> how can I improve https://github.com/redplane? |
14:20:22 | FromDiscord | <yumi> (edit) "https://github.com/redplane?" => "https://github.com/egor4ka/redplane?" |
14:20:38 | FromDiscord | <yumi> (edit) "https://github.com/egor4ka/redplane?" => "https://github.com/egor4ka/redplane ?" |
14:22:13 | PMunch | @yumi, replace it with Pakku? |
14:22:23 | FromDiscord | <yumi> uh |
14:22:29 | FromDiscord | <yumi> thats my own project |
14:22:34 | FromDiscord | <yumi> i made it for fun |
14:22:36 | PMunch | Oh, sorry |
14:22:45 | FromDiscord | <yumi> yeah pakku is nice |
14:22:50 | FromDiscord | <mratsim> Pakku is unmaintained |
14:22:55 | PMunch | No it's not |
14:23:00 | FromDiscord | <mratsim> I switched to paru/Rust ¯\_(ツ)_/¯ |
14:23:09 | FromDiscord | <yumi> i use yay |
14:23:13 | PMunch | It got forked and is actively maintained here: https://github.com/zqqw/pakku |
14:23:21 | PMunch | Last commit 4 days ago |
14:23:26 | FromDiscord | <yumi> because pakku wouldn't compile on my arch arm chroot |
14:23:37 | FromDiscord | <mratsim> oh |
14:23:43 | FromDiscord | <yumi> but yeah how can I improve my project? |
14:23:46 | FromDiscord | <xx_ns> fyi, the lead yay developer created and moved on to paru |
14:24:06 | FromDiscord | <ynfle> In reply to @PMunch "That test is outdated": Does something need to be changed in the nim CI? |
14:24:09 | FromDiscord | <yumi> paru doesn't let me get further than reading the pkgbuild |
14:24:12 | PMunch | @yumi, do you mean improve the code, or improve the project? |
14:24:20 | FromDiscord | <yumi> improve the code |
14:24:28 | FromDiscord | <yumi> im quite new to nim |
14:24:29 | FromDiscord | <xx_ns> In reply to @yumi "paru doesn't let me": what do you mean? |
14:24:41 | FromDiscord | <xx_ns> you know you have to quit the pager, right? `less` does that with the key `q` |
14:24:41 | PMunch | @ynfle, probably not, that test just got broken by https://github.com/PMunch/nimlsp/pull/109, I've asked @Bung to fix it |
14:24:45 | FromDiscord | <mratsim> you need to say "yes" in paru |
14:25:04 | FromDiscord | <yumi> In reply to @xx_ns "you know you have": tried it, it just exits |
14:25:08 | FromDiscord | <yumi> i just use yay |
14:25:19 | PMunch | One thing the CI could do is only pull in the latest tagged version of packages, so you get the same behaviour of a Nimble install and not a bunch of development branches |
14:26:20 | FromDiscord | <yumi> but still, how can I improve my project? |
14:26:31 | PMunch | @yumi, you don't have to initialise your variables like that |
14:26:36 | PMunch | You can just define their type |
14:26:49 | FromDiscord | <yumi> like var1: string? |
14:26:52 | PMunch | Yup |
14:26:57 | FromDiscord | <yumi> ill do that ig |
14:27:01 | PMunch | And allPkgs: seq[string] |
14:27:11 | PMunch | I mean it's mostly just a preference thing |
14:27:11 | FromDiscord | <yumi> not newseq? |
14:27:43 | PMunch | newSeq is typically used to initialise a sequence to a given length |
14:27:47 | FromDiscord | <yumi> oh |
14:27:48 | FromDiscord | <yumi> okay |
14:27:57 | FromDiscord | <yumi> lemme do that real quick... |
14:28:05 | PMunch | You should also add newlines between your procs |
14:28:13 | PMunch | And why do they all return 0? |
14:28:29 | FromDiscord | <Goel> sent a code paste, see https://play.nim-lang.org/#ix=3O8D |
14:28:38 | PMunch | 0 is the default, so you don't really need to return it explicitly, but why do they even have a return type if they always just return 0? |
14:29:00 | PMunch | That way you wouldn't have to discard all those zeros either |
14:29:31 | FromDiscord | <yumi> how do i make a proc without a return type? |
14:29:40 | PMunch | @Goel, {.error.} is a compile-time thing |
14:29:58 | FromDiscord | <yumi> In reply to @PMunch "You should also add": okay |
14:29:58 | PMunch | If it exists in code that will be compiled it throws a compilation error |
14:30:17 | PMunch | @Goel, what you want to do is throw an exception |
14:31:10 | FromDiscord | <yumi> In reply to @yumi "how do i make": nim basics never said anything about that lol |
14:31:24 | FromDiscord | <Goel> Yeah i suppose i was doing it the wrong way, i'll for "Thow an exception". Or even better if there is a single keyword that i can use in that case.↵(In Zig that would be `else: unreacheable;` to trigger the compiler warning only IN CASE it evaluates that line) |
14:31:33 | PMunch | {.error.} is used to do things like `when not defined(linux): {.error: "This module only supports linux".}` |
14:31:58 | PMunch | @yumi, you just omit the `: int` part of the signature |
14:32:02 | FromDiscord | <yumi> oh |
14:32:11 | FromDiscord | <yumi> and i wont have to return? |
14:32:16 | PMunch | Correct |
14:32:17 | FromDiscord | <yumi> ok thnks |
14:32:24 | PMunch | You technically never _have_ to return in Nim |
14:32:29 | FromDiscord | <yumi> oh |
14:32:29 | FromDiscord | <yumi> ok |
14:32:34 | FromDiscord | <yumi> thanks a lot |
14:32:48 | PMunch | Because by default a procedure will return the default value of a type at the end |
14:33:01 | FromDiscord | <yumi> also how do i make readline(stdin) not start on a newline? |
14:33:12 | PMunch | So `proc test(): int = discard` will return 0 and `proc test(): string = discard` will return an empty string |
14:33:29 | FromDiscord | <yumi> oh ok |
14:33:58 | PMunch | @Goel, I mean you could create a template called `unreachable`.. |
14:34:12 | PMunch | But if it is truly unreachable you can just put a discard in there |
14:34:19 | PMunch | Or a `quit 1` |
14:34:37 | FromDiscord | <ynfle> In reply to @Goel "Yeah i suppose i": You can do `error("Some error message")` |
14:34:59 | FromDiscord | <ynfle> The `{.error.}` means if this part compiles throw an error |
14:35:00 | PMunch | @yumi, do you mean like `readChar`? |
14:35:14 | FromDiscord | <yumi> yeah |
14:35:23 | FromDiscord | <yumi> for the y/n thing |
14:35:38 | PMunch | @yumi, yeah you can use https://nim-lang.org/docs/io.html#readChar%2CFile |
14:35:46 | FromDiscord | <yumi> ok thanks |
14:37:04 | PMunch | And by the way, in `pacmanInstall` you return 1 when it succeeds, or 0 (as the default value), when it doesn't |
14:37:25 | PMunch | This is really just a bool, so you could change the return type to bool and `return true` instead. |
14:38:44 | PMunch | @yumi, instead of `commandLineParams().len` you can use `paramCount()` |
14:39:05 | FromDiscord | <yumi> oh wait yeah |
14:39:07 | FromDiscord | <yumi> thanks |
14:39:27 | FromDiscord | <yumi> damn you guys really are helpful |
14:39:31 | PMunch | This is a syntax error (missing paren) not sure how that would even compile: https://github.com/egor4ka/redplane/blob/main/redplane.nim#L60 |
14:39:52 | PMunch | I mean things like `yesToAll` could also be a boolean |
14:39:54 | FromDiscord | <Goel> @ynfle But that won't tell me which line code triggered it |
14:40:15 | FromDiscord | <yumi> In reply to @PMunch "This is a syntax": didnt even compile |
14:40:24 | FromDiscord | <yumi> im editing it currently |
14:40:33 | PMunch | And then you could just do `if yesToAll:` instead of comparing it to `"yes"` or `true` |
14:41:07 | FromDiscord | <yumi> yeah |
14:41:09 | FromDiscord | <yumi> thanks |
14:41:55 | PMunch | Apart from that it looks pretty good code-wise |
14:43:01 | PMunch | @narimiran, maybe mention that procs don't need to have a return type in Nim basics? ^ |
14:43:43 | FromDiscord | <narimiran> In reply to @PMunch "<@719992187890434069>, maybe mention that": as in: when they return void? |
14:45:06 | FromDiscord | <narimiran> In reply to @yumi "nim basics never said": oh, now i see what is the mention about 🙂 @yumi, please open an issue in nimbasics repo if you want; i can add this in some future version of the book |
14:45:07 | FromDiscord | <ynfle> In reply to @Goel "<@!767093711112241162> But that won't": It should. Does it not? |
14:45:26 | PMunch | It seems like @yumi followed Nim basics and ended up writing code like this: https://github.com/egor4ka/redplane/blob/main/redplane.nim because they didn't understand that you didn't have to return something |
14:45:26 | FromDiscord | <ynfle> PMunch, tests fixed https://github.com/PMunch/nimlsp/pull/116 |
14:46:03 | FromDiscord | <yumi> dont mind the broken commit i was editing it on github and wanted to save it to download and continue editing |
14:47:03 | FromDiscord | <narimiran> wait, we have the example without a return type!! 😄 |
14:47:28 | FromDiscord | <narimiran> look at the second and third example here: https://narimiran.github.io/nim-basics/#_declaring_a_procedure |
14:47:34 | FromDiscord | <yumi> oh |
14:47:38 | FromDiscord | <yumi> i didnt notice that |
14:47:43 | FromDiscord | <narimiran> "The echoLanguageRating procedure just echoes the given name, it doesn’t return anything, so the return type is not declared" |
14:47:57 | FromDiscord | <yumi> very nice guide though |
14:48:01 | FromDiscord | <yumi> nim is my first lang |
14:48:14 | FromDiscord | <narimiran> In reply to @yumi "very nice guide though": thanks! i'm really glad to hear that 🙂 |
14:48:38 | FromDiscord | <yumi> don't know what i would do without it |
14:49:02 | FromDiscord | <yumi> can't get away from nim now 😄 |
14:49:24 | FromDiscord | <narimiran> In reply to @yumi "nim is my first": then you are exactly who is this guide aimed for 🙂 if you have any complaints and/or ideas how to improve it to make it easier for first-timers, please let me know |
14:49:37 | FromDiscord | <yumi> okay |
14:50:06 | FromDiscord | <yumi> how about a little section on how to parse command line parameters? |
14:50:55 | FromDiscord | <yumi> i was using commandLineParams().contains because the first result for flag parsing was a stackoverflow question |
14:51:14 | FromDiscord | <yumi> but then it turned out parseOpt existed |
14:51:46 | PMunch | @ynfle, thanks a lot for the PR :) |
14:52:57 | FromDiscord | <narimiran> In reply to @yumi "how about a little": i've added an issue (https://github.com/narimiran/nim-basics/issues/21) so i don't forget about it, but i can't promise you when it will be published |
14:53:05 | FromDiscord | <yumi> okay |
14:53:06 | FromDiscord | <yumi> thanks |
14:54:45 | FromDiscord | <ynfle> In reply to @PMunch "<@757977788056600719>, thanks a lot": Pleasure. Copied most of the code from the Original PR and osproc. Never used async, especially with streams. Happy To help. |
14:55:03 | FromDiscord | <ynfle> I hate failing CIs. I'm 1/2 OCD about them |
14:57:55 | FromDiscord | <ynfle> I was suprised when `zippy` wasn't made by @treeform |
14:58:39 | PMunch | Huh, I just assumed it was :P |
14:59:23 | FromDiscord | <ynfle> In reply to @PMunch "Huh, I just assumed": Lol. it's made by guzba |
14:59:35 | FromDiscord | <ynfle> Off to fix the other failing CI |
15:01:29 | FromDiscord | <yumi> btw is it fine to space out the of statements in case? |
15:03:42 | FromDiscord | <demotomohiro> https://nim-lang.org/docs/manual.html#statements-and-expressions-case-statement |
15:04:30 | FromDiscord | <demotomohiro> There is example code that indent of branch. |
15:07:18 | PMunch | @yumi, space out? |
15:07:30 | FromDiscord | <yumi> yeah |
15:07:42 | PMunch | What do you mean by space out? |
15:08:10 | FromDiscord | <yumi> sent a code paste, see https://play.nim-lang.org/#ix=3O96 |
15:08:16 | FromDiscord | <yumi> like this |
15:08:17 | FromDiscord | <yumi> (edit) "https://play.nim-lang.org/#ix=3O96" => "https://paste.rs/JLy" |
15:08:38 | * | arkurious joined #nim |
15:10:19 | FromDiscord | <demotomohiro> You dont want to put space between `of` and the expression? |
15:10:25 | FromDiscord | <yumi> no |
15:10:38 | FromDiscord | <yumi> look at the gap between the first of and second of |
15:10:42 | FromDiscord | <yumi> like this |
15:10:48 | FromDiscord | <yumi> just wondering |
15:11:44 | FromDiscord | <Rika> its ok |
15:11:47 | FromDiscord | <Rika> it will work |
15:11:50 | FromDiscord | <yumi> ok |
15:11:52 | FromDiscord | <yumi> cool |
15:12:00 | FromDiscord | <yumi> just wondering, not actually gonna do it |
15:17:27 | * | jjido joined #nim |
15:42:13 | * | noeontheend joined #nim |
15:44:11 | FromDiscord | <Michal Maršálek> Can my proc pretend it's free of side effects similar to how debugEcho does it? |
15:47:46 | PMunch | Yes |
15:48:15 | PMunch | {.cast(gcsafe).} |
15:48:31 | PMunch | That will make the compiler think your code is gc safe |
15:50:16 | FromDiscord | <yumi> what is gc? |
15:50:46 | FromDiscord | <yumi> nevermind |
15:50:55 | FromDiscord | <yumi> garbage collection |
15:56:17 | FromDiscord | <konsumlamm> that's for `gcsafe`, for side effects there is `{.cast(noSideEffect).}` |
15:57:53 | FromDiscord | <Michal Maršálek> Error: 'cast' pragma only allowed in a statement context |
15:57:57 | FromDiscord | <Michal Maršálek> where do i put it? |
15:58:25 | FromDiscord | <Rika> {.cast(...).} |
15:58:26 | FromDiscord | <Rika> ? |
15:58:28 | FromDiscord | <konsumlamm> you use it like `block`, i.e. by putting `:` after it and indenting the rest |
15:58:42 | FromDiscord | <Rika> oh i didnt read enough |
15:58:42 | FromDiscord | <Rika> xd |
15:58:52 | FromDiscord | <Michal Maršálek> ah |
16:02:32 | FromDiscord | <Michal Maršálek> I must be stupid but it doesn't seem to change anything |
16:05:10 | FromDiscord | <Michal Maršálek> ok, i got It |
16:05:25 | FromDiscord | <Michal Maršálek> one must put it inside the procedure not outside |
16:05:35 | FromDiscord | <Michal Maršálek> thanks |
16:44:36 | FromDiscord | <apahl> sent a long message, see https://paste.rs/7pT |
16:47:24 | PMunch | @apahl, values is declared in the global scope, so it's a global variable and probably will be treated differently |
16:47:54 | PMunch | https://play.nim-lang.org/#ix=3Oap |
16:48:06 | PMunch | Simply wrapping it in a main procedure makes the hint disappear |
16:49:02 | FromDiscord | <apahl> Nice!! Thanks a lot, that's it. |
16:58:05 | * | noeontheend quit (Ping timeout: 256 seconds) |
17:09:45 | * | noeontheend joined #nim |
17:14:22 | * | neurocyte0917090 joined #nim |
17:27:49 | * | sagax joined #nim |
17:39:17 | * | PMunch quit (Quit: leaving) |
17:49:35 | * | jmdaemon joined #nim |
17:54:07 | * | krux02 joined #nim |
17:54:11 | * | noeontheend quit (Ping timeout: 256 seconds) |
17:55:36 | * | jjido quit (Quit: My MacBook Air has gone to sleep. ZZZzzz…) |
17:59:26 | * | jjido joined #nim |
18:20:49 | * | jmdaemon quit (Ping timeout: 256 seconds) |
18:40:33 | FromDiscord | <ajusa> Has anyone used jnim here? Any examples of interop other than the provided tests? |
18:40:59 | * | jmdaemon joined #nim |
18:51:22 | FromDiscord | <Shiba> so how can i get the clock ticks thing in a nim program |
18:51:27 | FromDiscord | <Shiba> (edit) "program" => "program?" |
18:59:26 | FromDiscord | <krisppurg> sent a code paste, see https://play.nim-lang.org/#ix=3ObE |
18:59:46 | FromDiscord | <krisppurg> Any reasons to why this is happening despite linking it to the correct path |
18:59:56 | FromDiscord | <krisppurg> (edit) "path" => "path?" |
19:43:43 | Amun-Ra | krisppurg: --passC:path → --passC:-Ipath |
19:44:56 | FromDiscord | <Phil> Wait a minute, you can use `db.exec(sql"BEGIN")` to effectively get a write-lock to the database up until the point you execute `db.exec(sql"COMMIT")`? |
19:45:04 | FromDiscord | <Phil> Fuck yeah |
19:45:28 | Amun-Ra | welcome to the world of transactions |
19:45:42 | FromDiscord | <Phil> I was desperately looking for some kind of "beginTransaction" proc |
19:45:54 | Amun-Ra | ah |
19:46:30 | FromDiscord | <Phil> My heart went to my trousers when I didn't find it and realized I really need some kind of write lock for when I add search data to an fts5 table after I add an entry to a table |
19:46:58 | FromDiscord | <Phil> (edit) "My heart went to my trousers when I didn't find it and realized I really need some kind of write lock for when I add search data to an fts5 table after I add an entry to a ... table" added "normal" |
19:47:01 | Amun-Ra | I've never used nim and db together - sometimes db engines have autocommit set to true |
19:47:38 | Amun-Ra | and that can be surprising |
19:47:44 | FromDiscord | <Phil> sent a code paste, see https://play.nim-lang.org/#ix=3Oc5 |
19:48:05 | FromDiscord | <Phil> My comment was me letting out a sigh of relief at having found a way to do this |
19:48:12 | Amun-Ra | mhm |
19:48:18 | FromDiscord | <Phil> And now on to making myself a template `withTransaction` |
19:48:45 | FromDiscord | <Phil> Actually |
19:48:46 | FromDiscord | <Phil> Hmmm |
19:49:17 | FromDiscord | <Phil> I have a tiny package whose focus is around being a connection pool for an sqlite database |
19:50:16 | FromDiscord | <Phil> It already has a helper proc `withDbConn` that gives you a connection and recycles it immediately once you leave the code block.↵In a very similar fashion I could do a `withDbTransaction`... but that kind of feels like it's beyond of what the scope of the package should be |
19:50:18 | FromDiscord | <Phil> hmmm |
19:52:25 | FromDiscord | <Waldecir Santos> I've been using https://exercism.org/dashboard to learn nim, do you guys suggest any other idea to pratice and learn more about nim ? |
19:52:39 | FromDiscord | <Waldecir Santos> (edit) "https://exercism.org/dashboard to" => "https://exercism.org/" |
19:53:01 | FromDiscord | <Phil> Do you have a project lying around that you'd be willing to re-implement? |
19:53:42 | FromDiscord | <Phil> I'd recommend implementing a project any day over exercism & co, it forces you very quickly to learn a fair amount about the language |
19:53:53 | FromDiscord | <Waldecir Santos> not really my only idea was to implement a "django-like" framework on nim, but that is for a future project, not something to learn I think. |
19:53:54 | FromDiscord | <Phil> (edit) "I'd recommend implementing a project ... any" added "that you care about" |
19:54:19 | Amun-Ra | or rewrite one of your projects in nim |
19:54:23 | Amun-Ra | to* |
19:54:51 | FromDiscord | <Phil> I have decided, withDbTransaction shall become a database utility proc and not go into the connection pool package |
19:54:54 | FromDiscord | <krisppurg> Now its a different error but it's similar https://media.discordapp.net/attachments/371759389889003532/937798113496813608/message.txt |
19:55:49 | Amun-Ra | empty page |
19:56:03 | FromDiscord | <krisppurg> ? |
19:56:43 | Amun-Ra | krisppurg: I see no contents of message.txt |
19:57:02 | FromDiscord | <krisppurg> sent a code paste, see https://play.nim-lang.org/#ix=3Oca |
19:57:59 | * | fvs joined #nim |
19:58:09 | Amun-Ra | that should be -I as in capital i and not lowercase l |
19:58:36 | FromDiscord | <krisppurg> bruh |
19:58:51 | FromDiscord | <krisppurg> didnt notice that |
19:58:56 | * | jjido quit (Quit: My MacBook Air has gone to sleep. ZZZzzz…) |
20:00:44 | FromDiscord | <krisppurg> still same eror |
20:00:46 | FromDiscord | <krisppurg> (edit) "eror" => "error" |
20:01:45 | Amun-Ra | what directory is opus directory in? |
20:01:58 | * | jjido joined #nim |
20:02:05 | FromDiscord | <Phil> Does `raise` in the except block of a `try-except` construct just reraise the caught exception? |
20:02:24 | FromDiscord | <Phil> (edit) "Does ... `raise`" added "a blank " |
20:02:25 | Amun-Ra | Phil: like in python? good question |
20:02:41 | FromDiscord | <krisppurg> wait nvm its working now |
20:02:43 | FromDiscord | <krisppurg> pog |
20:02:56 | FromDiscord | <Phil> sent a code paste, see https://play.nim-lang.org/#ix=3Oce |
20:03:40 | FromDiscord | <Phil> If it works that way: Good! I'd like to catch an exception, just "rollback" the transaction and then reraise it because I merely want to do a rollback and close the transaction |
20:03:55 | FromDiscord | <Phil> (edit) "transaction" => "transaction, not actually deal with the exception" |
20:04:05 | Amun-Ra | Phil: finally>/ |
20:04:08 | Amun-Ra | ? |
20:04:21 | FromDiscord | <Phil> Finally would also act if the transaction succeeds |
20:04:26 | FromDiscord | <Phil> I don't wanna rollback if it works |
20:04:28 | FromDiscord | <Phil> Only if it doesn't |
20:05:12 | FromDiscord | <krisppurg> sent a long message, see http://ix.io/3Ocf |
20:05:51 | FromDiscord | <krisppurg> (edit) "http://ix.io/3Ocf" => "http://ix.io/3Ocg" |
20:06:49 | Amun-Ra | Phil: seems to be working https://play.nim-lang.org/#ix=3Ocj |
20:07:09 | FromDiscord | <Phil> In reply to @Amun-Ra "<@180601887916163073>: seems to be": Sweet! Thanks a lot! |
20:08:55 | * | vicfred joined #nim |
20:09:38 | Amun-Ra | krisppurg: it should work if the file exists C:\Users\KrispPurg\Desktop\Projects\Programming\nim-lang\discord_bots\dimscord\include\opus\opus_defines.h |
20:10:16 | Amun-Ra | tho I'm not much of a windows user |
20:12:20 | * | tiorock joined #nim |
20:12:20 | * | tiorock quit (Changing host) |
20:12:20 | * | tiorock joined #nim |
20:12:20 | * | rockcavera is now known as Guest3833 |
20:12:20 | * | tiorock is now known as rockcavera |
20:13:10 | * | jjido quit (Quit: My MacBook Air has gone to sleep. ZZZzzz…) |
20:15:59 | * | Guest3833 quit (Ping timeout: 268 seconds) |
21:06:07 | * | jjido joined #nim |
21:30:33 | FromDiscord | <Patitotective> How con I convert the _shared library_ nim outputs to an actual _Linux_ (Ubuntu) executable? |
21:30:44 | FromDiscord | <Patitotective> So I can double-click it to run it |
21:30:54 | * | FromDiscord quit (Remote host closed the connection) |
21:31:08 | * | FromDiscord joined #nim |
21:45:07 | FromDiscord | <exelotl> sent a code paste, see https://play.nim-lang.org/#ix=3OcO |
21:45:55 | FromDiscord | <iffy (Matt Haggard)> I want to export one of the `macros.ident` procs (https://nim-lang.org/docs/macros.html#ident%2Cstring) but not the deprecated one (https://nim-lang.org/docs/macros.html#ident%2CNimNode) How do I do it? `import macros; export ident` is as close as I can get |
21:47:14 | FromDiscord | <iffy (Matt Haggard)> Strike that. This is as close as I can get\: `proc ident(x: string): NimNode = macros.ident(x)` |
22:04:18 | FromDiscord | <Elegantbeef> sent a code paste, see https://play.nim-lang.org/#ix=3OcV |
22:04:44 | FromDiscord | <Elegantbeef> You want wrapping enum logic?↵(@exelotl) |
22:05:15 | FromDiscord | <Elegantbeef> sent a code paste, see https://play.nim-lang.org/#ix=3OcW |
22:12:23 | FromDiscord | <exelotl> hmm yeah I guess something like this is what I need |
22:31:16 | FromDiscord | <Elegantbeef> I do kinda think there should be a `succWrapped` but i guess that's just a module type and whenever the compiler releases with that support is when we'll have it |
22:31:42 | FromDiscord | <Elegantbeef> modulo type\ |
22:33:41 | * | l1x joined #nim |
22:51:09 | FromDiscord | <planetis> It seems that operators ending with \ are special, %{"a"\: [1], "b"\: [1,2]} won't parse but with %\ it will |
22:56:12 | * | jjido quit (Quit: My MacBook Air has gone to sleep. ZZZzzz…) |
23:06:11 | * | jmdaemon quit (Ping timeout: 268 seconds) |
23:06:37 | FromDiscord | <impbox [ftsf]> yeah I made an incWrap and decWrap, super handy |
23:07:15 | FromDiscord | <impbox [ftsf]> sent a code paste, see https://play.nim-lang.org/#ix=3Odd |
23:07:26 | FromDiscord | <impbox [ftsf]> also works for toggling bools |
23:22:54 | FromDiscord | <huantian> does anyone know of a good crossplatorm (mainly win/linux) library for system notifications and task bar icon thingy |
23:23:21 | FromDiscord | <Elegantbeef> sent a code paste, see https://play.nim-lang.org/#ix=3Odi |
23:23:35 | * | oprypin quit (Quit: Bye) |
23:23:44 | * | oprypin joined #nim |
23:24:54 | FromDiscord | <Elegantbeef> For system notifications linux is relatively easy, tasbar is another ordeal |
23:28:32 | * | jmdaemon joined #nim |
23:31:20 | FromDiscord | <huantian> hm yeah↵the most annoying part would be probably having to test on windows myself, if I do do it myself |
23:31:56 | * | vicfred quit (Quit: Leaving) |
23:33:14 | FromDiscord | <Elegantbeef> Wine can work for testing |
23:33:22 | FromDiscord | <Elegantbeef> Though obvious best is the real software |