00:13:22 | * | riceman quit (Ping timeout: 240 seconds) |
01:50:32 | FromDiscord | <exithead> I have a tree of objects and want to pass them by reference into a local variable. How for I do that? Or how do I restructure my tree to get the desired result. |
01:58:21 | FromDiscord | <Goat> sent a code paste, see https://play.nim-lang.org/#ix=3sb3 |
02:04:35 | FromDiscord | <ElegantBeef> Is this a quiz? 😄 |
02:04:47 | FromDiscord | <exithead> Some extra ifs? They all have the potential to be extra unlucky |
02:04:58 | FromDiscord | <ElegantBeef> well the first is different flow to the last two |
02:05:10 | FromDiscord | <ElegantBeef> the last two echo once the first echoes 3 times |
02:06:20 | FromDiscord | <exithead> Aww I failed, I missed the assignment on example 1. What portion of my grade was this test? |
02:06:38 | FromDiscord | <ElegantBeef> No grade, just shame |
02:07:30 | FromDiscord | <exithead> Hahaha you're "permanent record" isn't a real thing! He said on the internet unironically |
02:45:26 | * | arkurious quit (Quit: Leaving) |
02:50:43 | FromDiscord | <reilly> sent a code paste, see https://play.nim-lang.org/#ix=3sb9 |
02:51:38 | FromDiscord | <reilly> (edit) "https://play.nim-lang.org/#ix=3sb9" => "https://play.nim-lang.org/#ix=3sbb" |
02:54:17 | FromDiscord | <Rika> So it doesn’t matter in the long run until you see that it affects you a lot |
02:56:36 | FromDiscord | <reilly> Yeah, I should clarify that all three of these should finish execution pretty much instantly, even the first one. You shouldn't notice a performance difference between them. Still, it's helpful to keep in mind when you're making the CPU do more work than it needs to, even if it's just a little bit; it's good practice. |
02:56:51 | FromDiscord | <reilly> (edit) "Yeah, I should clarify that all three of these should finish execution pretty much instantly, even the first one. You shouldn't notice a performance difference between ... them." added "any of" |
02:58:02 | FromDiscord | <Rika> Yes but it is also important to be able to identify the more major possible bottlenecks, make sure to check the profiler before doing optimisations etc |
03:47:04 | * | TakinOver quit (Ping timeout: 272 seconds) |
03:49:21 | * | TakinOver joined #nim |
03:56:44 | * | rockcavera quit (Remote host closed the connection) |
04:06:02 | * | supakeen quit (Quit: WeeChat 3.2) |
04:06:37 | * | supakeen joined #nim |
04:39:51 | FromDiscord | <aleclarson> sent a code paste, see https://play.nim-lang.org/#ix=3sbA |
04:40:09 | FromDiscord | <aleclarson> (edit) "https://play.nim-lang.org/#ix=3sbA" => "https://play.nim-lang.org/#ix=3sbB" |
04:41:17 | FromDiscord | <aleclarson> oo found this: https://github.com/technicallyagd/unpack |
04:41:19 | fn | <R2D299> itHub: 7"sequence/object unpacking/destructuring for nim" |
04:43:32 | FromDiscord | <aleclarson> i think i'll just do the unpacking manually for now. was hoping for builtin syntax |
04:54:23 | FromDiscord | <timotheecour> unpacking works for tuples, not seq's, because it'd require knowing at CT how many elements there are, but a seq has a dynamic number. It can be made to work using `let [a, b, c] {.unpack.} = @[1, 2, 3]` but it's a bad idea |
04:54:41 | FromDiscord | <timotheecour> (edit) "unpacking works for tuples, not seq's, because it'd require knowing at CT how many elements there are, but a seq has a dynamic number. It can be made to work using `let [a, b, c] {.unpack.} = @[1, 2, 3]` ... but" added "(using a var macro)" |
04:55:12 | FromDiscord | <timotheecour> (edit) "it's" => "i'm sure that'd be" | "bad" => "good" |
04:58:49 | FromDiscord | <leorize> not really, we just need a guard for the length |
05:09:01 | FromDiscord | <ElegantBeef> Yep an assertion that the len is >= unpacked variables |
05:16:31 | fn | <ForumUpdaterBot99> New Nimble package! unrolled - Unroll for-loops at compile-time., see https://github.com/schneiderfelipe/unrolled |
05:16:32 | fn | <R2D299> itHub: 7"Unroll for-loops at compile-time." |
05:17:15 | FromDiscord | <Rika> Isn’t that just a static block and a compile time variable |
05:17:43 | FromDiscord | <Rika> Ah no I get it |
05:55:35 | FromDiscord | <@bracketmaster-5a708063d73408ce4> I'm overriding the addition operator and realized that it would be beneficial to mutate a directly in a = lhs + rhs instead doing copy assignment |
05:55:37 | FromDiscord | <@bracketmaster-5a708063d73408ce4> anyway to do this? |
05:58:59 | FromDiscord | <Rika> term rewriting macr |
05:59:00 | FromDiscord | <Rika> o |
05:59:53 | FromDiscord | <@bracketmaster-5a708063d73408ce4> are you saying to pattern match on =+ and rewrite? |
06:01:41 | * | aeverr_ joined #nim |
06:04:33 | FromDiscord | <Bung> search manual, there's term rewrite section |
06:07:05 | FromDiscord | <@bracketmaster-5a708063d73408ce4> I know |
06:07:12 | FromDiscord | <@bracketmaster-5a708063d73408ce4> I've done macros before |
06:08:12 | FromDiscord | <ElegantBeef> Then yes they're saying use the pattern you want to rewrite to the desired type |
06:10:03 | FromDiscord | <Rika> Or you can always not define the + operator |
06:11:04 | FromDiscord | <@bracketmaster-5a708063d73408ce4> I've got a type call BitVector which is sort of like BigInt, but is closer to how bits are represented in hardware |
06:11:23 | FromDiscord | <@bracketmaster-5a708063d73408ce4> Often times in digital logic circuits, adders will add two bitvectors |
06:12:06 | FromDiscord | <@bracketmaster-5a708063d73408ce4> If I'm going 1 millions bitvector adds a second, it's rather wasteful to copy assign on every add |
06:12:18 | FromDiscord | <@bracketmaster-5a708063d73408ce4> also, the + operator seems reasonable to use for add |
06:12:30 | FromDiscord | <@bracketmaster-5a708063d73408ce4> doing -\> going |
06:12:37 | FromDiscord | <@bracketmaster-5a708063d73408ce4> other way around |
06:13:31 | FromDiscord | <@bracketmaster-5a708063d73408ce4> under the hood nim may not be copying - but I'm not sure whether it does or not - I'm looking at Nim's move and sink rules |
06:14:24 | FromDiscord | <haxscramper> Short answer - you can't deal with it. Requiresinit is viral and once added you have to code around it all all layers - e.g. provide explicit init |
06:21:53 | FromDiscord | <@bracketmaster-5a708063d73408ce4> a.equalSum(a,b) also seems to be ok |
06:22:16 | FromDiscord | <Rika> `+=` is a definable operator in nim |
06:23:55 | FromDiscord | <Rika> i dont understand how you can transform `a = b + c` into `a += ???` given `a != b` |
06:24:18 | FromDiscord | <Rika> rather, how you would do that without a copy |
06:24:22 | FromDiscord | <Rika> or a move |
06:35:41 | FromDiscord | <leorize> [BracketMaster (Yehowshua Immanuel)](https://matrix.to/#/@bracketmaster-5a708063d73408ce4f8ad7ee:gitter.im)\: nvro is available as long as you use result |
06:36:20 | FromDiscord | <leorize> http://nim-lang.github.io/Nim/manual.html#procedures-nrvo |
07:07:59 | * | PMunch joined #nim |
07:10:18 | * | Vladar joined #nim |
07:32:15 | fn | <ForumUpdaterBot99> New thread by Halloleo: Compiler sysFatal when I include nashorn.nim, see https://forum.nim-lang.org/t/8208 |
07:36:25 | FromDiscord | <Clonkk> Assuming b and a aare 2 different variables with no pre-existing relations, then you can't.↵(@Rika) |
07:36:35 | FromDiscord | <Rika> yeah |
07:36:38 | FromDiscord | <Rika> thats what i mean yes |
07:36:57 | FromDiscord | <Rika> In reply to @@bracketmaster-5a708063d73408ce4 "I'm overriding the addition": i just mean what he said made it sound like he wanted what i said |
07:49:38 | * | PMunch quit (Ping timeout: 272 seconds) |
07:57:08 | * | max22- joined #nim |
07:57:26 | * | max22- quit (Remote host closed the connection) |
07:57:48 | * | max22- joined #nim |
08:01:12 | * | PMunch joined #nim |
08:19:11 | * | neceve joined #nim |
08:42:49 | FromDiscord | <Zoom> Huh, that's reasonable. Is there a way to satisfy the prover without explicit object construction statement (and without silencing pragma)? I'd like to not explicitly set all the fields which are initialized by default just to silence the warning caused by a single field. |
08:43:41 | FromDiscord | <Rika> i dont think thats possible |
08:43:55 | FromDiscord | <haxscramper> You can't silence requiresinit either |
08:43:56 | FromDiscord | <Rika> you have to use the obj construction syntax for that single field |
08:44:51 | FromDiscord | <haxscramper> ^ you need to do what it thinks is necessary, and there is no way around except for initializing the field |
08:44:58 | FromDiscord | <Zoom> What I mean, I use multiple `result.field = foo` in an init proc but this one field makes me rewrite them into `object(a: x, b:y ...)` |
08:45:42 | FromDiscord | <haxscramper> yes |
08:45:51 | FromDiscord | <haxscramper> that's how it works, and there is no way around it |
08:46:52 | FromDiscord | <haxscramper> I mean that's exactly what it was made for - to force you to `object(mustInit: <expr>)` |
08:47:59 | FromDiscord | <Zoom> That's silly. init proc for a parent object has an explicit initialization of that one `requiresInit` field with the appropriate init function (in the form of `result.field = initFoo()`) but that doesn't satisfy he prover \:( |
08:47:59 | FromDiscord | <haxscramper> Are you avare of the fact `.field=` can be anything? |
08:48:00 | FromDiscord | <Zoom> Even though it knows initFoo is ok |
08:48:11 | FromDiscord | <haxscramper> For example `.field=` can raise, quit, do network calls and god-knows-what else? |
08:48:13 | FromDiscord | <Zoom> Eh... |
08:48:22 | FromDiscord | <haxscramper> yes, you can override `.field=` |
08:48:50 | FromDiscord | <haxscramper> So the prover must then provide absolutely random function sets field value correctly |
08:48:52 | FromDiscord | <ElegantBeef> Called properties 😄 |
08:48:52 | FromDiscord | <Rika> like proc `field=`(obj: var Obj, val: Val) = ... |
08:49:16 | FromDiscord | <haxscramper> Though there are plans for control flow analysis |
08:50:10 | FromDiscord | <haxscramper> https://github.com/nim-lang/RFCs/issues/378 |
08:50:13 | FromDiscord | <haxscramper> Or at least some form of it |
08:51:53 | FromDiscord | <Zoom> Still don't get it. But the prover already knows `initFoo` is enough. And the only access to the field which needs it is the assignment. |
08:55:12 | FromDiscord | <haxscramper> Prover knows you didn `object(field: <expr>)` and that's all it cares about |
08:55:26 | FromDiscord | <haxscramper> I don't really understand how `initFoo` is related |
08:56:47 | FromDiscord | <Zoom> Crap. That's a lot of complexity just to dance around init-by-default |
08:57:02 | FromDiscord | <Rika> just silence the warning |
08:58:53 | FromDiscord | <Zoom> Because it's the proc `.requiresInit.` should enforce? |
08:59:41 | FromDiscord | <haxscramper> no, it is not. Requiresinit must enforce field or object inialization |
08:59:59 | FromDiscord | <haxscramper> Doesn't matter whether it is `iniFoo()`, or `cast[ptr T](nil)[]` |
09:00:50 | FromDiscord | <haxscramper> how you do it is up do you |
09:00:57 | FromDiscord | <Zoom> Yes, but if I make a proc which as a result has a proven initialized object and then I use it to construct a parent object this should be it, right? |
09:01:22 | FromDiscord | <haxscramper> By parent object you mean? |
09:01:52 | FromDiscord | <haxscramper> sent a code paste, see https://play.nim-lang.org/#ix=3scj |
09:01:56 | FromDiscord | <Zoom> An object which has a field of `T {.reuiresInit.}` |
09:02:32 | FromDiscord | <haxscramper> You need to create this object using `object(field: <expr>)` OR get it from some other expression |
09:02:45 | FromDiscord | <haxscramper> But this expression (proc call etc) must internally construct object as weell |
09:03:04 | FromDiscord | <haxscramper> `var withMustInit = initFoo()` would work |
09:03:07 | FromDiscord | <Zoom> Which `this`, parent or field? |
09:03:15 | FromDiscord | <Rika> parent |
09:04:03 | FromDiscord | <Rika> basically the prover isnt very sophisticated |
09:05:10 | FromDiscord | <Zoom> Yeah, that sad. The hook haxscramper suggested would be very useful to deal with this in a non-fussy way |
09:06:33 | FromDiscord | <haxscramper> yes, it is really strange it wasn't added from the start |
09:09:17 | FromDiscord | <haxscramper> Or `default(T)` |
09:09:22 | FromDiscord | <Zoom> I think I can fix my problem by making a new type for that one field of that object by overriding its↵`default` |
09:09:33 | FromDiscord | <Zoom> yeah \:) |
09:09:42 | FromDiscord | <Rika> you cant override default(T) i believe? |
09:09:44 | FromDiscord | <Rika> or did nim change |
09:09:52 | FromDiscord | <haxscramper> you can |
09:09:59 | FromDiscord | <haxscramper> but it is not substituted by default anywhere |
09:10:02 | FromDiscord | <haxscramper> so it is kind of useless |
09:10:03 | FromDiscord | <Rika> you can now? since when damn |
09:10:04 | FromDiscord | <Rika> ah |
09:10:07 | FromDiscord | <Rika> thats what i mean lol |
09:10:15 | FromDiscord | <haxscramper> https://github.com/nim-lang/RFCs/issues/378#issuecomment-846554090 |
09:10:25 | FromDiscord | <Rika> still rfc 😦 |
09:10:26 | FromDiscord | <haxscramper> what's the point of it then |
09:10:40 | FromDiscord | <Rika> waiting for custom logic for constructor syntax as well 😛 |
09:10:47 | FromDiscord | <Rika> point of what? |
09:11:09 | FromDiscord | <Zoom> That's a bummer |
09:11:10 | FromDiscord | <haxscramper> what is the point of `default(T)` if it is not used to default init anything |
09:11:43 | FromDiscord | <Rika> i dont think we're on the same page |
09:11:58 | FromDiscord | <Rika> i would like it to do so, is my opinion |
09:21:27 | FromDiscord | <Zoom> The only reasonable option is to silence the warning which feels dirty |
09:22:16 | FromDiscord | <Bung> for comparing values. |
09:22:40 | FromDiscord | <Zoom> I don't think I like #378, even though I don't get all the implications... |
09:22:43 | * | snowolf quit (Ping timeout: 256 seconds) |
09:22:53 | FromDiscord | <Rika> why not? |
09:28:29 | FromDiscord | <Zoom> For the reasons mentioned in the issue. Adds complexity for a not the most frequent case |
09:30:12 | FromDiscord | <Rika> ill reread it |
09:30:17 | FromDiscord | <Rika> i feel like i misunderstood something somewhere |
09:30:47 | * | max22- quit (Ping timeout: 252 seconds) |
09:32:04 | FromDiscord | <Rika> okay i dont think i like it |
09:35:06 | FromDiscord | <Zoom> Explicit initialization by default is not so bad. I don't think It ever gets in my way in Rust, for example |
09:39:03 | FromDiscord | <Rika> yes, the prover just needs to be smarter i assume |
09:42:33 | FromDiscord | <Zoom> sent a code paste, see https://play.nim-lang.org/#ix=3scs |
09:43:45 | FromDiscord | <Rika> In reply to @Rika "yes, the prover just": this might incur significant compile time cost so im not sure if this is the way to go though |
10:04:41 | FromDiscord | <Zoom> Why do I want to write `var x = (var y; y.mutate(); y)`? Am I going off the rails? |
10:08:51 | FromDiscord | <haxscramper> No, I do this all the time |
10:09:05 | FromDiscord | <haxscramper> sent a code paste, see https://play.nim-lang.org/#ix=3scz |
10:09:17 | FromDiscord | <haxscramper> Well, almost this, but still close |
10:11:16 | FromDiscord | <Zoom> I mean, I have a tidy block of var initss and that line allows me not to break it |
10:11:48 | FromDiscord | <haxscramper> yes, that is certainly fine |
10:12:03 | FromDiscord | <haxscramper> it does incur some unnecessary copying, but if you are fine wit it |
10:12:31 | FromDiscord | <haxscramper> You can also do `var x = T().withIt((it.mutate()))` |
10:25:24 | FromDiscord | <Zoom> This happens exactly once in the init proc in the code behind me so copying is fine |
10:26:01 | FromDiscord | <Zoom> I personally don't personally like `T().foo()` because it goes against the mutability intuition. `withIt(T(), it.mutate())` is fine though. |
10:40:19 | * | max22- joined #nim |
11:17:51 | * | Vladar quit (Remote host closed the connection) |
11:24:45 | * | Vladar joined #nim |
11:28:42 | FromDiscord | <Tahal> Hello! |
11:29:14 | FromDiscord | <Tahal> I'm new to programming, is C a good language to begin? |
11:29:24 | FromDiscord | <Tahal> And then to learn Nim? |
11:30:25 | FromDiscord | <Rika> C is difficult to start with but it's IMO one of the better bases to start with programming |
11:32:29 | FromDiscord | <Tahal> Yeah, I tried to learn python, but I heard that is too abstract. |
11:32:43 | FromDiscord | <Tahal> Thanks for the advice |
11:33:20 | FromDiscord | <Rika> yes its a bit too abstract |
11:34:48 | FromDiscord | <hotdog> @Tahal what kind of programming are you interested in? |
11:34:54 | FromDiscord | <hotdog> Like what do you want to make? |
11:34:56 | FromDiscord | <StefanSalewski (StefanSalewski)> Tatal, you can still use http://ssalewski.de/nimprogramming.html for free, so no need to start with C any more. |
11:37:19 | * | lucerne quit (Read error: Connection reset by peer) |
11:37:20 | * | greyrat quit (Read error: Connection reset by peer) |
11:40:02 | FromDiscord | <StefanSalewski (StefanSalewski)> salewski quit |
11:40:07 | FromDiscord | <Tahal> In reply to @hotdog "<@!825243073809350666> what kind of": I would like to modify Freecad source code, and to make GUI in general. |
11:41:19 | FromDiscord | <hotdog> Looks like freecad is a mix of C++ and Python |
11:41:34 | FromDiscord | <hotdog> Learning C is still a good base |
11:42:42 | FromDiscord | <hotdog> And everyone here would probably recommend Nim. Though the Nim GUI libraries are not as mature and widely used as ones for other languages |
11:45:01 | FromDiscord | <Tahal> Yeah, but Nim seems to have a ton of potential, and already seems to be a good language. |
11:45:37 | FromDiscord | <Rika> its not perfect |
11:45:52 | FromDiscord | <Rika> theres still plenty of rough edges |
11:46:28 | FromDiscord | <hotdog> In reply to @Tahal "Yeah, but Nim seems": Absolutely |
11:47:55 | FromDiscord | <Tahal> Metaprogramming is good at making AI? |
11:48:42 | FromDiscord | <Tahal> Or I'm wrong here? |
11:49:15 | FromDiscord | <System64 ~ Flandre Scarlet> In reply to @Rika "its not perfect": no language is perfect |
11:49:46 | * | max22- quit (Ping timeout: 240 seconds) |
11:51:08 | * | arkurious joined #nim |
11:57:25 | FromDiscord | <planetis> You can express stuff like finite state machines and other ai techniques with macro DSLs so why not↵(@Tahal) |
11:58:15 | FromDiscord | <Tahal> @planetis#0000 Thank you |
12:00:33 | FromDiscord | <System64 ~ Flandre Scarlet> Where can I find instelled modules please? |
12:01:32 | FromDiscord | <Bung> nimble path yourlibname |
12:06:01 | * | supakeen quit (Quit: WeeChat 3.2) |
12:06:36 | * | supakeen joined #nim |
12:09:23 | FromDiscord | <konsumlamm> In reply to @Tahal "Metaprogramming is good at": i don't think that has much to do with each other |
12:17:30 | arkanoid | is it possible to create anonymous noSideEffect proc types using sugar shorthand? I'm using "type Fn = proc(p: pointer): pointer {.noSideEffect.}" now |
12:23:52 | PMunch | Hmm, I'm unable to cast a pointer to a uint32 (a C-style array of uint32s) to ptr UncheckedArray[UncheckedArray[uint32]] |
12:24:01 | PMunch | Oh right.. |
12:24:04 | PMunch | Of course not.. |
12:24:07 | PMunch | I'm an idiot |
12:25:08 | PMunch | Because it doesn't know the width of the inner array |
12:52:44 | FromDiscord | <Zoom> Anyone here uses GH actions for building releases? |
13:21:07 | * | rockcavera joined #nim |
13:21:08 | * | rockcavera quit (Changing host) |
13:21:08 | * | rockcavera joined #nim |
13:27:52 | * | fredrikhr joined #nim |
13:44:27 | * | max22- joined #nim |
13:44:34 | FromDiscord | <Heav> hello. |
13:44:58 | FromDiscord | <Heav> i am attempting to use `nimble`. i am performing `nimble init`, however this happens consistently. what do i do https://media.discordapp.net/attachments/371759389889003532/862328341029060629/unknown.png |
13:53:10 | PMunch | Hmm, strange. Does that happen when you just get to that question, or do you hit enter? |
13:57:49 | FromDiscord | <Heav> just when i get to that question. |
13:58:04 | FromDiscord | <Heav> i've actually fixed it though. this is apparently broken in powershell 7. i just launched cmd.exe instead |
13:59:03 | FromDiscord | <kaushalmodi> In reply to @Heav "i've actually fixed it": If you have a recipe to always cause that issue in powershell 7, please open a bug report with that recipe. |
13:59:11 | FromDiscord | <Heav> there's already one |
13:59:17 | FromDiscord | <Heav> https://github.com/nim-lang/nimble/issues/816 |
14:05:49 | * | PMunch quit (Quit: leaving) |
14:08:18 | FromDiscord | <SamPro> Hello, everyone!↵↵Is the JetBrains plugin good? |
14:08:46 | FromDiscord | <SamPro> Like, as good as java in intellij? |
14:10:48 | fn | <Prestige99> https://plugins.jetbrains.com/plugin/15128-nim for details on what's supported (but I'd guess the answer is no) |
14:10:55 | FromDiscord | <Clonkk> As good as, the answer is definitly not for a simple pragmatic reason called \: "Nim plugin doesn't bring as much money as Java plugin" |
14:11:08 | FromDiscord | <Clonkk> But it's alright |
14:11:20 | FromDiscord | <Clonkk> Although I've never liked JetBrains IDE and didn't use them much |
14:11:55 | FromDiscord | <SamPro> How are you two bots?? |
14:12:10 | FromDiscord | <SamPro> How the... |
14:12:15 | FromDiscord | <vindaar> AI has advanced significantly 😎 |
14:12:22 | FromDiscord | <SamPro> Dafuq |
14:12:28 | fn | <Prestige99> My father was a thinkpad |
14:12:41 | FromDiscord | <SamPro> K.... |
14:12:48 | FromDiscord | <SamPro> Confuse |
14:13:20 | FromDiscord | <SamPro> 🤔 |
14:13:29 | FromDiscord | <vindaar> (we're on matrix & irc and these two are bridged to discord) |
14:13:35 | FromDiscord | <SamPro> Ik |
14:14:29 | FromDiscord | <Clonkk> I'm a captcha who became sentient. I can recognize any bycicle on any pictures with sufficient quality↵(@SamPro) |
14:15:04 | FromDiscord | <SamPro> Ok, so after that weird thing, what level is the nim LSP's autocomplete on? |
14:15:39 | FromDiscord | <SamPro> Cuz I can't stand vscode and im either neovim or jetbrains |
14:15:46 | FromDiscord | <Clonkk> Nimlsp is quite complete, on Neovim I have auto-complete follu working even with docstring directly in it.↵(@SamPro) |
14:16:23 | FromDiscord | <SamPro> Amazing! My totally not yoinked from github config will finally shine! |
14:16:26 | FromDiscord | <Rika> the neovim plugin is actually at a better state than the vscode one i believe |
14:16:47 | FromDiscord | <Clonkk> Here's my neovim config file if you're interested \: https://github.com/Clonkk/bashrc/blob/master/nvim/init.vim |
14:17:08 | FromDiscord | <SamPro> I mean im using neovim 5(native lsp!!) not looking for a plugin |
14:18:42 | FromDiscord | <SamPro> So I can do some beautiful neovim coding for once |
14:18:49 | * | fredrikhr quit (Quit: Disconnecting) |
14:19:27 | FromDiscord | <SamPro> Currently on vacation, tried nim out on phone(repl.it), seems great! |
14:20:04 | FromDiscord | <SamPro> I know, #offtopic |
14:22:13 | FromDiscord | <Clonkk> I don't use neovim native lsp client, but I hear others used it without complaint |
14:23:14 | FromDiscord | <SamPro> @Clonkk ew gruvbox in your config |
14:24:01 | FromDiscord | <SamPro> Best theme is either Dracula or Palenight because.... |
14:24:08 | FromDiscord | <SamPro> They are good |
14:25:28 | FromDiscord | <Clonkk> Can't argue with that ;). This is subjective↵(@SamPro) |
14:27:12 | FromDiscord | <SamPro> Idk i hate gruvbox and nord because sure, they look good, but I have yet to find a theme that does good syntax highlighting |
14:27:38 | FromDiscord | <SamPro> Like most nord themes have 3 colours |
14:32:00 | FromDiscord | <Rika> ~~me using solarized: 👀 ~~ |
14:46:04 | FromDiscord | <Heav> h https://media.discordapp.net/attachments/371759389889003532/862343714918498304/unknown.png |
14:49:09 | FromDiscord | <vindaar> you installed the nim library for SDL2. But that's a wrapper around the C library. The C library is built as a shared library and is loaded at runtime. That's what fails for you. You need to install sdl2 via your package manager |
14:49:28 | FromDiscord | <Heav> i did `sudo apt install libsdl2-dev` beforehand. |
14:50:08 | FromDiscord | <vindaar> maybe you only installed the devel files, which are usually the C headers? |
14:50:22 | FromDiscord | <Heav> okay, installing more packages... |
14:50:24 | FromDiscord | <vindaar> so did it install `libsdl2` as well? |
14:50:40 | FromDiscord | <arnetheduck> https://github.com/nim-lang/Nim/blob/devel/changelog.md#changes-affecting-backward-compatibility 😲 |
14:50:54 | FromDiscord | <@bracketmaster-5a708063d73408ce4> @leorize\:envs.net thx |
14:51:13 | FromDiscord | <@bracketmaster-5a708063d73408ce4> for the nvro tip |
14:51:47 | FromDiscord | <Heav> In reply to @vindaar "so did it install": that's not a package |
14:53:52 | FromDiscord | <Heav> what packages do i need to install to make sdl2 work. |
14:54:51 | FromDiscord | <vindaar> uhm, not sure what it's called. just `sdl2` ? I neither use ubuntu, nor have I used sdl2 a lot, sorry |
14:55:00 | FromDiscord | <Heav> despite having this, it continues to not work https://media.discordapp.net/attachments/371759389889003532/862345964178374686/unknown.png |
15:01:25 | FromDiscord | <@bracketmaster-5a708063d73408ce4> @leorize\:envs.net - how can I force NVRO to be used? |
15:02:54 | FromDiscord | <@bracketmaster-5a708063d73408ce4> I would expect the last statement to echo 3, but it echoes 0 |
15:02:55 | FromDiscord | <leorize> I believe the compiler bar for "large object" is size \>= 3x float |
15:02:55 | FromDiscord | <@bracketmaster-5a708063d73408ce4> oh |
15:02:55 | FromDiscord | <@bracketmaster-5a708063d73408ce4> So I can't force NVRO - not even with a pragma? |
15:03:03 | FromDiscord | <@bracketmaster-5a708063d73408ce4> sent a long message, see http://ix.io/3sei |
15:03:36 | FromDiscord | <leorize> ofc it will return 0, even if nvro is enabled |
15:03:49 | FromDiscord | <leorize> the result variable is always zero-initialized |
15:04:06 | FromDiscord | <@bracketmaster-5a708063d73408ce4> from the link you sent - it says |
15:04:16 | FromDiscord | <@bracketmaster-5a708063d73408ce4> proc p()\: BigT =IS ROUGHLY TURNED INTO\:↵proc p(result\: var BigT) = |
15:04:38 | FromDiscord | <@bracketmaster-5a708063d73408ce4> if BigT is passed as var, then how would it go back to 0? |
15:04:44 | FromDiscord | <leorize> yes, however the semantics of result doesn't change |
15:04:49 | FromDiscord | <leorize> so zero-ing still happens |
15:05:00 | FromDiscord | <@bracketmaster-5a708063d73408ce4> ah - ok fair |
15:05:30 | FromDiscord | <leorize> `{.noinit.}` can be used to stop zero-ing, but use it at your own risk |
15:06:05 | FromDiscord | <@bracketmaster-5a708063d73408ce4> what's the risk in using it? concerns about my code be broken in the future? |
15:06:26 | FromDiscord | <leorize> it interacts poorly with destructors |
15:06:48 | FromDiscord | <Rika> do you think the pragma will be removed in the future? |
15:08:19 | FromDiscord | <leorize> https://github.com/nim-lang/Nim/issues/14425 \<- here's an example of noinit + destructors = horror |
15:08:45 | FromDiscord | <@bracketmaster-5a708063d73408ce4> you can do `{.nodestroy}` |
15:08:46 | FromDiscord | <leorize> nodestroy have it's implications too |
15:09:00 | FromDiscord | <leorize> @Rika\: maybe, assuming that we have good analysis to remove unnecessary zero-ing |
15:09:18 | FromDiscord | <leorize> we do have first-read and first-write analysis iirc |
15:10:15 | FromDiscord | <leorize> not sure if it's hooked in the compiler for initialization yet but it can easily optimize out unnecessary zero-ing |
15:10:27 | FromDiscord | <@bracketmaster-5a708063d73408ce4> I think I'll stick with `proc sumEquals(a, b, c : var SomeType)` |
15:10:51 | FromDiscord | <@bracketmaster-5a708063d73408ce4> sumEquals -\> equalsSum |
15:11:59 | FromDiscord | <Heav> i still can't get sdl2 to work |
15:12:26 | FromDiscord | <vindaar> see if you can get any normal SDL2 example running |
15:12:34 | FromDiscord | <vindaar> if those work, the nim ones should work fine |
15:14:01 | FromDiscord | <leorize> [BracketMaster (Yehowshua Immanuel)](https://matrix.to/#/@bracketmaster-5a708063d73408ce4f8ad7ee:gitter.im)\: unless the other form actually produce a noticable slow down, don't micro optimize |
15:14:29 | FromDiscord | <leorize> maintainable code that works should be the basis of your project |
15:15:15 | FromDiscord | <leorize> if you really want to micro-optimize, you can ask @mratsim for what in Nim that should be micro-optimized |
15:18:14 | FromDiscord | <Heav> i can't find any SDL2 examples really |
15:32:35 | * | neceve quit (Ping timeout: 252 seconds) |
15:33:02 | arkanoid | what's wrong with this use of sugar and function types? https://play.nim-lang.org/#ix=3sen |
15:43:08 | arkanoid | hello? |
15:44:28 | fn | <Prestige99> What are you trying to do here? |
15:45:34 | fn | <ForumUpdaterBot99> New thread by Exoticisotopic: Why do `del` and `pop` procedures of TableRef not guarantee operations in one attempt?, see https://forum.nim-lang.org/t/8209 |
15:49:54 | arkanoid | Prestige, compile that thing |
15:50:55 | arkanoid | I don't understand the error "Error: A nested proc can have generic parameters only when it is used as an operand to another routine and the types of the generic paramers can be inferred from the expected signature." it's way off what I'm doing there. All types are explicit, there's not generic and no call func into func |
15:51:09 | fn | <Prestige99> I don't know what you're trying to do with your code |
15:51:29 | FromDiscord | <Rika> sugar `=>` uses generics |
15:52:14 | FromDiscord | <Rika> LHS type cannot coerce RHS side if RHS is a generic proc |
15:52:31 | FromDiscord | <Rika> sorry for saying RHS side please dont kill me |
15:52:33 | FromDiscord | <Rika> brain no work |
15:56:54 | * | stkrdknmibalz quit (Quit: WeeChat 3.0.1) |
16:11:34 | FromDiscord | <@bracketmaster-5a708063d73408ce4> @\_discord\_160279332454006795\:t2bot.io - here is an example of using SDL2\: https://github.com/BracketMaster/nimRasterizer/blob/main/src/framebuffer.nim#L37 |
16:13:39 | arkanoid | Rika: thanks. Why is RHS a generic proc, in my case? I'm just writing an identity function |
16:13:57 | FromDiscord | <Rika> because thats how the `=>` macro works |
16:15:01 | FromDiscord | <Rika> i think it should have been able to deduce the type from LHS though since it works when passed as parameter into another function... |
16:15:09 | FromDiscord | <Rika> but i dont know why it doesnt really |
16:16:01 | FromDiscord | <juan_carlos> It uses `auto` as return type. |
16:16:23 | FromDiscord | <juan_carlos> You can just not return too, and enforce a cencrete type, like an in-place-ish func. |
16:17:43 | * | stkrdknmibalz joined #nim |
16:19:49 | arkanoid | still can't get why it doesn't work. I have all types statically fixed. Func is int -> int, let has type, nothing is auto |
16:20:04 | arkanoid | I mean, template is ignoring the declared types |
16:20:07 | FromDiscord | <Rika> again, `=>` generates an auto type |
16:20:09 | FromDiscord | <Rika> (edit) "type" => "proc" |
16:20:26 | FromDiscord | <juan_carlos> arrow makes auto |
16:20:36 | FromDiscord | <Rika> its like saying `let a: proc(x:int):int = proc(x:auto):auto = x` |
16:20:59 | FromDiscord | <juan_carlos> Just run expandMacro on it and see what it expands to... |
16:21:27 | FromDiscord | <Rika> no i dont know why it doesnt work, it seems like it would |
16:22:00 | FromDiscord | <ajusa> sent a code paste, see https://play.nim-lang.org/#ix=3sex |
16:22:24 | arkanoid | I got that arrow makes auto, but point it that "auto" seems not working her |
16:22:44 | arkanoid | *here |
16:22:50 | FromDiscord | <Rika> maybe its time to call the creator or a core dev |
16:23:05 | FromDiscord | <Rika> In reply to @ajusa "Are there any ways": other than a macro? i feel like |
16:25:36 | FromDiscord | <juan_carlos> For a func `TypeA or TypeB` should work I think... |
16:25:42 | FromDiscord | <juan_carlos> auto too. |
16:26:35 | FromDiscord | <Rika> they meant for a variant type |
16:27:11 | arkanoid | juan_carlos, how can I expand macro of code that doesn't compile? |
16:28:15 | arkanoid | nim c --expandMacro:=> identity.nim returns error |
16:29:01 | FromDiscord | <vindaar> the short answer is\: no, there is no return type overloading↵(@ajusa) |
16:29:05 | FromDiscord | <juan_carlos> expandMacros: code here indented block |
16:30:05 | FromDiscord | <vindaar> as long as you stay in your "variant object bubble" it's not really much of an issue though. Special casing would happen with regular Nim types as well |
16:30:26 | FromDiscord | <vindaar> But yea, in practice it can lead to many case statements in many procs |
16:30:38 | arkanoid | juan_carlos: like this? https://play.nim-lang.org/#ix=3sez doesn't compile |
16:32:18 | FromDiscord | <juan_carlos> You are trying to use the arrow as a concrete type. |
16:33:03 | FromDiscord | <juan_carlos> `int->int` can not be a type. |
16:33:28 | FromDiscord | <Rika> it can? |
16:33:29 | FromDiscord | <Rika> it is |
16:33:35 | FromDiscord | <Rika> what do you mean |
16:33:38 | FromDiscord | <juan_carlos> I do not understand the code. |
16:33:59 | FromDiscord | <Rika> int->int : proc type↵x => x : proc |
16:34:10 | * | greyrat joined #nim |
16:34:52 | * | lucerne joined #nim |
16:35:01 | FromDiscord | <juan_carlos> Why are you even adding a type?, the macro will not use it, macro can only use return auto, is hardcoded in it. |
16:35:27 | FromDiscord | <Rika> its meant to further coerce the type |
16:35:30 | FromDiscord | <Rika> the proc i mean |
16:35:33 | FromDiscord | <Rika> supposedly;. |
16:35:35 | FromDiscord | <Rika> (edit) "supposedly;." => "supposedly." |
16:36:54 | FromDiscord | <juan_carlos> let foo = (arg0, arg1, result) => code here; result = doStuff() |
16:37:03 | arkanoid | "let identity: int -> int = x => x" is a perfectly logical line. Maps an anonymous procedure to a variable with compatible procedure type |
16:37:10 | FromDiscord | <juan_carlos> Then it returns void, and you get result on the var result. |
16:37:39 | FromDiscord | <Rika> what? |
16:37:55 | FromDiscord | <juan_carlos> But the macro do not use it currently... |
16:38:11 | FromDiscord | <Rika> it's akin to `let identity = proc(x: int): int = x` except it's not working |
16:38:25 | FromDiscord | <Rika> where it seems like it shoud |
16:38:26 | FromDiscord | <Rika> (edit) "shoud" => "should" |
16:39:39 | * | lucerne quit (Quit: Bye) |
16:39:43 | FromDiscord | <juan_carlos> CTRL+F for "auto" on sugar.nim you will see is hardcoded to auto is not going to read the type from the variable if any. |
16:40:14 | FromDiscord | <Rika> i know that it is auto |
16:40:23 | FromDiscord | <Rika> i know that it isnt working because of it |
16:40:36 | FromDiscord | <Rika> what i mean is that shouldnt the compiler be smarter about this? |
16:40:43 | arkanoid | to prove it makes sense, if I replace the right hand side with proc it works "let identity: int -> int = proc(x: int): int = x". Why isn't auto capable of doing its job? |
16:41:43 | FromDiscord | <Rika> and im pretty sure its completely fine when you pass a `=>`'d proc to a function's parameter with type `int -> int` |
16:41:55 | FromDiscord | <Rika> which is roughly the same to the let expression arkanoid sent |
16:42:33 | FromDiscord | <juan_carlos> No idea, I am not compiler dev. |
16:42:59 | FromDiscord | <juan_carlos> Maybe if signature of func is kinda complex use a normal proc. |
16:43:30 | arkanoid | this works: "let identity: int -> int = proc(x: int): auto = x", it's the auto of the parameter type causing issues |
16:43:51 | arkanoid | kinda complex? an identity function?! |
16:44:07 | * | lucerne joined #nim |
16:44:26 | FromDiscord | <Rika> nim does not use the same type system as haskell |
16:44:45 | FromDiscord | <Rika> nim is not especially focused on having the same declaration system as haskell |
16:45:15 | FromDiscord | <Rika> yes, i still think this should be fixed |
16:45:16 | arkanoid | my haskell LOC count is zero |
16:45:35 | FromDiscord | <Rika> well i assumed it was haskell because it looked a lot like it |
16:45:41 | FromDiscord | <Rika> anyway, functional languages |
16:45:52 | FromDiscord | <Rika> use roughly the same type system |
16:45:57 | arkanoid | I was just refactoring some working nim code and I drilled down to that minimal example, that's it |
16:46:43 | arkanoid | do you think it should be issued in GH? |
16:47:04 | arkanoid | I don't even know how to name this to search existing issues |
16:47:34 | FromDiscord | <Rika> i feel like it should, though i do not know what to search either |
16:56:58 | arkanoid | I don't even know the correct title to address this |
16:57:22 | arkanoid | should I blame "auto" straight, or just talk about simple sugar composition fails |
17:04:13 | * | rockcavera quit (Remote host closed the connection) |
17:16:55 | FromDiscord | <PressF> How do you convert a string provided by readLine(stdin) to an integer? |
17:17:32 | FromDiscord | <haxscramper> `.parseInt()` |
17:17:45 | FromDiscord | <haxscramper> https://nim-lang.org/docs/parseutils.html#parseInt%2Cstring%2Cint%2Cint |
17:17:51 | FromDiscord | <vindaar> https://nim-lang.github.io/Nim/strutils.html#parseInt%2Cstring |
17:17:55 | FromDiscord | <vindaar> better that one ;) |
17:18:13 | FromDiscord | <haxscramper> ah, yes |
17:18:23 | FromDiscord | <haxscramper> I'm still getting confused by the fact they are in different modules |
17:18:59 | FromDiscord | <kaushalmodi> I think `strutils.parseInt` calls `parseutils.parseInt` but also raises an exception if needed. |
17:19:30 | FromDiscord | <vindaar> I think in this case it's kind of nice. It separates what new users probably want / what one wants if parsing isn't the main use case |
17:20:02 | FromDiscord | <kaushalmodi> > but also raises the exception if needed↵Yes: https://github.com/nim-lang/Nim/blob/ffce6de84c94348dd5a615c9855a14ed64807449/lib/pure/strutils.nim#L1069-L1072 |
17:20:19 | FromDiscord | <PressF> thx guys |
17:20:23 | FromDiscord | <PressF> I'll test it |
17:21:24 | FromDiscord | <PressF> it worked thx |
18:00:33 | * | rockcavera joined #nim |
18:00:33 | * | rockcavera quit (Changing host) |
18:00:33 | * | rockcavera joined #nim |
18:13:46 | * | max22- quit (Ping timeout: 246 seconds) |
18:22:11 | * | clemens3 joined #nim |
19:10:12 | * | neceve joined #nim |
19:13:22 | * | TakinOver quit (Quit: KVIrc 5.0.0 Aria http://www.kvirc.net/) |
19:45:58 | FromDiscord | <talaing> What is the best way to cut off last 2 characters of a string? |
19:46:25 | FromDiscord | <talaing> `now().format("HH:mm:ss'.'ffffff")` |
19:46:37 | FromDiscord | <talaing> `21:44:57.967640` |
19:46:41 | FromDiscord | <talaing> (edit) |
19:46:53 | FromDiscord | <talaing> I only need `21:44:57.9676` |
19:46:59 | FromDiscord | <timotheecour> setLen |
19:47:16 | FromDiscord | <timotheecour> (edit) "setLen ... " added "and see also rfidn" |
19:47:20 | FromDiscord | <timotheecour> (edit) "rfidn" => "rfind" |
19:49:03 | FromDiscord | <vindaar> or just the plain and simple slice `mystring[0..<^2]` |
19:51:28 | * | max22- joined #nim |
19:54:17 | FromDiscord | <talaing> `mystring[0..<^2]` doesn't seem to work |
19:54:30 | FromDiscord | <vindaar> huh? |
19:54:43 | FromDiscord | <talaing> `Error: undeclared identifier: '..^<'` |
19:54:48 | FromDiscord | <vindaar> ah |
19:54:49 | FromDiscord | <vindaar> damn |
19:54:51 | FromDiscord | <vindaar> space |
19:55:22 | FromDiscord | <vindaar> https://play.nim-lang.org/#ix=3sfm |
19:57:40 | FromDiscord | <talaing> Now it works, thanks 🙂 |
19:59:37 | FromDiscord | <vindaar> just if it isn't clear. The problem in what I wrote first is that the compiler tries to parse `..<^` as a single symbol. But of course that doesn't exist. `..<` and `^` are separate things, so the space is required.↵And btw you could also just do `mystring[0 .. ^3]` instead. `^1` just refers to the last index |
20:00:21 | FromDiscord | <vindaar> this is "including the 3rd last character" and the one before is "up to less than the 2nd last" |
20:05:31 | FromDiscord | <runciter> sent a long message, see http://ix.io/3sfp |
20:05:54 | FromDiscord | <runciter> apologies my Matrix client removed the newlines in my message |
20:06:12 | FromDiscord | <vindaar> @treeform ^ can help you best |
20:06:31 | FromDiscord | <ElegantBeef> Worth noting `mystring[0..< ^2]` will duplicate the data so if you're not ok with more allocations the `setLen` method is better |
20:07:13 | FromDiscord | <vindaar> Thanks, that's certainly true, but I feel like people asking such a thing probably don't care about that. |
20:07:34 | FromDiscord | <ElegantBeef> Probably true, but always good thing to note |
20:07:46 | FromDiscord | <vindaar> indeed 👌 |
20:08:43 | FromDiscord | <treeform> In reply to @runciter "heya i'm learning Nim": I would not design an API this way. I would look at the error code returned from HTTP and parse the error as an object. Otherwise parse the result as a regular object not related to errror. |
20:08:47 | FromDiscord | <talaing> In reply to @ElegantBeef "Worth noting `mystring[0..< ^2]`": Thanks for mentioning it, luckily I'm okay with it 🙂 Also thank you vindaar for explanation 👍 |
20:09:51 | FromDiscord | <treeform> In reply to @runciter "heya i'm learning Nim": If you don't have an error code, you could try parsing it as an error first, failing then parsing it as some thing you expect. |
20:14:23 | FromDiscord | <treeform> @runciter: https://play.nim-lang.org/#ix=3sfr |
20:14:40 | FromDiscord | <treeform> I think you are overcomplicating your life with types |
20:16:32 | FromDiscord | <treeform> oh maybe this is a better version: https://play.nim-lang.org/#ix=3sft |
20:22:12 | FromDiscord | <runciter> ah, the reason i was attempting to use types for it was so that I could define a single `parseHook` to handle this such that it would apply for all my API calls as there are a dozen or more cases and i wanted to avoid defining the same parseHook for each API proc and offload that work to jsony |
20:23:22 | FromDiscord | <runciter> thanks though, i'll just write the parseHook procsor learn the macro system and have a macro write them all for me \:P |
20:25:50 | FromDiscord | <treeform> so you want all of your types to have `errcode` and `error` just with more indirection? |
20:29:48 | FromDiscord | <runciter> i'm writing a tiered API with raw calls and higher-level calls, and i wanted to have all the raw calls return a Result of either the error or their actual type data, so that the logic for detecting and converting to an ApiError didn't have to be written for each type |
20:30:41 | * | max22- quit (Ping timeout: 252 seconds) |
20:30:45 | FromDiscord | <treeform> I don't think you want macros involved, you probably want some thing like this https://play.nim-lang.org/#ix=3sfw |
20:31:49 | FromDiscord | <treeform> if you want your results to be nested still you probably want to use parse hook inside parse hook |
20:32:52 | FromDiscord | <runciter> oh wow this is exactly what I wanted to do, apologies if I explained it poorly |
20:33:03 | FromDiscord | <runciter> true, I'll see where it goes when I get there↵↵thanks a lot for the help with this |
20:34:22 | FromDiscord | <treeform> This code is better: https://play.nim-lang.org/#ix=3sfB |
20:34:42 | FromDiscord | <treeform> I needed to use parseHook in side parseHook so that it can nest |
20:34:48 | FromDiscord | <treeform> probably does not matter in your case though |
20:35:34 | FromDiscord | <treeform> Although I don't think this is a good design, you are better off handing errors as you see them then making it part of your type system. |
20:35:52 | FromDiscord | <treeform> you got to handle them some place, why pipe them around? |
20:40:55 | FromDiscord | <runciter> sent a long message, see http://ix.io/3sfC |
20:43:20 | FromDiscord | <runciter> if the raw api procs handle the errors then the higher level ones can't, but if the higher level ones are responsible for this then the raw api calls have no way of signifying errors |
20:43:43 | * | max22- joined #nim |
20:52:31 | FromDiscord | <vindaar> oh damn, you're writing a matrix library? that's awesome! |
20:53:25 | FromDiscord | <runciter> hoping to haha - ty |
20:55:00 | FromDiscord | <tandy> excited to see a Nim mention in This Week In Matrix \:) |
20:56:40 | FromDiscord | <ElegantBeef> Aw hell yea, i was going to try it, but couldnt indulge myself in self abuse 😛 |
20:57:42 | fn | <Prestige99> Ah that's exciting stuff |
20:58:31 | fn | <Prestige99> I'd like to make a matrix client when that api is ready |
21:06:22 | FromDiscord | <runciter> aha I wasn't expecting any interest - I'll drop a msg in here when it's ready \<3 |
21:06:46 | FromDiscord | <vindaar> please do 🚀 |
21:07:15 | * | max22- quit (Remote host closed the connection) |
21:07:37 | * | max22- joined #nim |
21:13:41 | * | neceve quit (Ping timeout: 252 seconds) |
21:57:47 | FromDiscord | <@bracketmaster-5a708063d73408ce4> can I iterate over an array in reverse? |
22:04:58 | * | max22- quit (Quit: Leaving) |
22:32:00 | FromDiscord | <ElegantBeef> There isnt a way in the stdlib but you can make an iterator relatively quickly |
22:35:15 | FromDiscord | <ElegantBeef> A simple impl here https://play.nim-lang.org/#ix=3sfV |
22:40:30 | * | luis_ joined #nim |
23:05:21 | * | TakinOver joined #nim |
23:07:55 | * | Vladar quit (Remote host closed the connection) |