<< 07-07-2021 >>

00:13:22*riceman quit (Ping timeout: 240 seconds)
01:50:32FromDiscord<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:21FromDiscord<Goat> sent a code paste, see https://play.nim-lang.org/#ix=3sb3
02:04:35FromDiscord<ElegantBeef> Is this a quiz? 😄
02:04:47FromDiscord<exithead> Some extra ifs? They all have the potential to be extra unlucky
02:04:58FromDiscord<ElegantBeef> well the first is different flow to the last two
02:05:10FromDiscord<ElegantBeef> the last two echo once the first echoes 3 times
02:06:20FromDiscord<exithead> Aww I failed, I missed the assignment on example 1. What portion of my grade was this test?
02:06:38FromDiscord<ElegantBeef> No grade, just shame
02:07:30FromDiscord<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:43FromDiscord<reilly> sent a code paste, see https://play.nim-lang.org/#ix=3sb9
02:51:38FromDiscord<reilly> (edit) "https://play.nim-lang.org/#ix=3sb9" => "https://play.nim-lang.org/#ix=3sbb"
02:54:17FromDiscord<Rika> So it doesn’t matter in the long run until you see that it affects you a lot
02:56:36FromDiscord<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:51FromDiscord<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:02FromDiscord<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:51FromDiscord<aleclarson> sent a code paste, see https://play.nim-lang.org/#ix=3sbA
04:40:09FromDiscord<aleclarson> (edit) "https://play.nim-lang.org/#ix=3sbA" => "https://play.nim-lang.org/#ix=3sbB"
04:41:17FromDiscord<aleclarson> oo found this: https://github.com/technicallyagd/unpack
04:41:19fn<R2D299> itHub: 7"sequence/object unpacking/destructuring for nim"
04:43:32FromDiscord<aleclarson> i think i'll just do the unpacking manually for now. was hoping for builtin syntax
04:54:23FromDiscord<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:41FromDiscord<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:12FromDiscord<timotheecour> (edit) "it's" => "i'm sure that'd be" | "bad" => "good"
04:58:49FromDiscord<leorize> not really, we just need a guard for the length
05:09:01FromDiscord<ElegantBeef> Yep an assertion that the len is >= unpacked variables
05:16:31fn<ForumUpdaterBot99> New Nimble package! unrolled - Unroll for-loops at compile-time., see https://github.com/schneiderfelipe/unrolled
05:16:32fn<R2D299> itHub: 7"Unroll for-loops at compile-time."
05:17:15FromDiscord<Rika> Isn’t that just a static block and a compile time variable
05:17:43FromDiscord<Rika> Ah no I get it
05:55:35FromDiscord<@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:37FromDiscord<@bracketmaster-5a708063d73408ce4> anyway to do this?
05:58:59FromDiscord<Rika> term rewriting macr
05:59:00FromDiscord<Rika> o
05:59:53FromDiscord<@bracketmaster-5a708063d73408ce4> are you saying to pattern match on =+ and rewrite?
06:01:41*aeverr_ joined #nim
06:04:33FromDiscord<Bung> search manual, there's term rewrite section
06:07:05FromDiscord<@bracketmaster-5a708063d73408ce4> I know
06:07:12FromDiscord<@bracketmaster-5a708063d73408ce4> I've done macros before
06:08:12FromDiscord<ElegantBeef> Then yes they're saying use the pattern you want to rewrite to the desired type
06:10:03FromDiscord<Rika> Or you can always not define the + operator
06:11:04FromDiscord<@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:23FromDiscord<@bracketmaster-5a708063d73408ce4> Often times in digital logic circuits, adders will add two bitvectors
06:12:06FromDiscord<@bracketmaster-5a708063d73408ce4> If I'm going 1 millions bitvector adds a second, it's rather wasteful to copy assign on every add
06:12:18FromDiscord<@bracketmaster-5a708063d73408ce4> also, the + operator seems reasonable to use for add
06:12:30FromDiscord<@bracketmaster-5a708063d73408ce4> doing -\> going
06:12:37FromDiscord<@bracketmaster-5a708063d73408ce4> other way around
06:13:31FromDiscord<@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:24FromDiscord<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:53FromDiscord<@bracketmaster-5a708063d73408ce4> a.equalSum(a,b) also seems to be ok
06:22:16FromDiscord<Rika> `+=` is a definable operator in nim
06:23:55FromDiscord<Rika> i dont understand how you can transform `a = b + c` into `a += ???` given `a != b`
06:24:18FromDiscord<Rika> rather, how you would do that without a copy
06:24:22FromDiscord<Rika> or a move
06:35:41FromDiscord<leorize> [BracketMaster (Yehowshua Immanuel)](https://matrix.to/#/@bracketmaster-5a708063d73408ce4f8ad7ee:gitter.im)\: nvro is available as long as you use result
06:36:20FromDiscord<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:15fn<ForumUpdaterBot99> New thread by Halloleo: Compiler sysFatal when I include nashorn.nim, see https://forum.nim-lang.org/t/8208
07:36:25FromDiscord<Clonkk> Assuming b and a aare 2 different variables with no pre-existing relations, then you can't.↵(@Rika)
07:36:35FromDiscord<Rika> yeah
07:36:38FromDiscord<Rika> thats what i mean yes
07:36:57FromDiscord<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:49FromDiscord<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:41FromDiscord<Rika> i dont think thats possible
08:43:55FromDiscord<haxscramper> You can't silence requiresinit either
08:43:56FromDiscord<Rika> you have to use the obj construction syntax for that single field
08:44:51FromDiscord<haxscramper> ^ you need to do what it thinks is necessary, and there is no way around except for initializing the field
08:44:58FromDiscord<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:42FromDiscord<haxscramper> yes
08:45:51FromDiscord<haxscramper> that's how it works, and there is no way around it
08:46:52FromDiscord<haxscramper> I mean that's exactly what it was made for - to force you to `object(mustInit: <expr>)`
08:47:59FromDiscord<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:59FromDiscord<haxscramper> Are you avare of the fact `.field=` can be anything?
08:48:00FromDiscord<Zoom> Even though it knows initFoo is ok
08:48:11FromDiscord<haxscramper> For example `.field=` can raise, quit, do network calls and god-knows-what else?
08:48:13FromDiscord<Zoom> Eh...
08:48:22FromDiscord<haxscramper> yes, you can override `.field=`
08:48:50FromDiscord<haxscramper> So the prover must then provide absolutely random function sets field value correctly
08:48:52FromDiscord<ElegantBeef> Called properties 😄
08:48:52FromDiscord<Rika> like proc `field=`(obj: var Obj, val: Val) = ...
08:49:16FromDiscord<haxscramper> Though there are plans for control flow analysis
08:50:10FromDiscord<haxscramper> https://github.com/nim-lang/RFCs/issues/378
08:50:13FromDiscord<haxscramper> Or at least some form of it
08:51:53FromDiscord<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:12FromDiscord<haxscramper> Prover knows you didn `object(field: <expr>)` and that's all it cares about
08:55:26FromDiscord<haxscramper> I don't really understand how `initFoo` is related
08:56:47FromDiscord<Zoom> Crap. That's a lot of complexity just to dance around init-by-default
08:57:02FromDiscord<Rika> just silence the warning
08:58:53FromDiscord<Zoom> Because it's the proc `.requiresInit.` should enforce?
08:59:41FromDiscord<haxscramper> no, it is not. Requiresinit must enforce field or object inialization
08:59:59FromDiscord<haxscramper> Doesn't matter whether it is `iniFoo()`, or `cast[ptr T](nil)[]`
09:00:50FromDiscord<haxscramper> how you do it is up do you
09:00:57FromDiscord<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:22FromDiscord<haxscramper> By parent object you mean?
09:01:52FromDiscord<haxscramper> sent a code paste, see https://play.nim-lang.org/#ix=3scj
09:01:56FromDiscord<Zoom> An object which has a field of `T {.reuiresInit.}`
09:02:32FromDiscord<haxscramper> You need to create this object using `object(field: <expr>)` OR get it from some other expression
09:02:45FromDiscord<haxscramper> But this expression (proc call etc) must internally construct object as weell
09:03:04FromDiscord<haxscramper> `var withMustInit = initFoo()` would work
09:03:07FromDiscord<Zoom> Which `this`, parent or field?
09:03:15FromDiscord<Rika> parent
09:04:03FromDiscord<Rika> basically the prover isnt very sophisticated
09:05:10FromDiscord<Zoom> Yeah, that sad. The hook haxscramper suggested would be very useful to deal with this in a non-fussy way
09:06:33FromDiscord<haxscramper> yes, it is really strange it wasn't added from the start
09:09:17FromDiscord<haxscramper> Or `default(T)`
09:09:22FromDiscord<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:33FromDiscord<Zoom> yeah \:)
09:09:42FromDiscord<Rika> you cant override default(T) i believe?
09:09:44FromDiscord<Rika> or did nim change
09:09:52FromDiscord<haxscramper> you can
09:09:59FromDiscord<haxscramper> but it is not substituted by default anywhere
09:10:02FromDiscord<haxscramper> so it is kind of useless
09:10:03FromDiscord<Rika> you can now? since when damn
09:10:04FromDiscord<Rika> ah
09:10:07FromDiscord<Rika> thats what i mean lol
09:10:15FromDiscord<haxscramper> https://github.com/nim-lang/RFCs/issues/378#issuecomment-846554090
09:10:25FromDiscord<Rika> still rfc 😦
09:10:26FromDiscord<haxscramper> what's the point of it then
09:10:40FromDiscord<Rika> waiting for custom logic for constructor syntax as well 😛
09:10:47FromDiscord<Rika> point of what?
09:11:09FromDiscord<Zoom> That's a bummer
09:11:10FromDiscord<haxscramper> what is the point of `default(T)` if it is not used to default init anything
09:11:43FromDiscord<Rika> i dont think we're on the same page
09:11:58FromDiscord<Rika> i would like it to do so, is my opinion
09:21:27FromDiscord<Zoom> The only reasonable option is to silence the warning which feels dirty
09:22:16FromDiscord<Bung> for comparing values.
09:22:40FromDiscord<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:53FromDiscord<Rika> why not?
09:28:29FromDiscord<Zoom> For the reasons mentioned in the issue. Adds complexity for a not the most frequent case
09:30:12FromDiscord<Rika> ill reread it
09:30:17FromDiscord<Rika> i feel like i misunderstood something somewhere
09:30:47*max22- quit (Ping timeout: 252 seconds)
09:32:04FromDiscord<Rika> okay i dont think i like it
09:35:06FromDiscord<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:03FromDiscord<Rika> yes, the prover just needs to be smarter i assume
09:42:33FromDiscord<Zoom> sent a code paste, see https://play.nim-lang.org/#ix=3scs
09:43:45FromDiscord<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:41FromDiscord<Zoom> Why do I want to write `var x = (var y; y.mutate(); y)`? Am I going off the rails?
10:08:51FromDiscord<haxscramper> No, I do this all the time
10:09:05FromDiscord<haxscramper> sent a code paste, see https://play.nim-lang.org/#ix=3scz
10:09:17FromDiscord<haxscramper> Well, almost this, but still close
10:11:16FromDiscord<Zoom> I mean, I have a tidy block of var initss and that line allows me not to break it
10:11:48FromDiscord<haxscramper> yes, that is certainly fine
10:12:03FromDiscord<haxscramper> it does incur some unnecessary copying, but if you are fine wit it
10:12:31FromDiscord<haxscramper> You can also do `var x = T().withIt((it.mutate()))`
10:25:24FromDiscord<Zoom> This happens exactly once in the init proc in the code behind me so copying is fine
10:26:01FromDiscord<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:42FromDiscord<Tahal> Hello!
11:29:14FromDiscord<Tahal> I'm new to programming, is C a good language to begin?
11:29:24FromDiscord<Tahal> And then to learn Nim?
11:30:25FromDiscord<Rika> C is difficult to start with but it's IMO one of the better bases to start with programming
11:32:29FromDiscord<Tahal> Yeah, I tried to learn python, but I heard that is too abstract.
11:32:43FromDiscord<Tahal> Thanks for the advice
11:33:20FromDiscord<Rika> yes its a bit too abstract
11:34:48FromDiscord<hotdog> @Tahal what kind of programming are you interested in?
11:34:54FromDiscord<hotdog> Like what do you want to make?
11:34:56FromDiscord<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:02FromDiscord<StefanSalewski (StefanSalewski)> salewski quit
11:40:07FromDiscord<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:19FromDiscord<hotdog> Looks like freecad is a mix of C++ and Python
11:41:34FromDiscord<hotdog> Learning C is still a good base
11:42:42FromDiscord<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:01FromDiscord<Tahal> Yeah, but Nim seems to have a ton of potential, and already seems to be a good language.
11:45:37FromDiscord<Rika> its not perfect
11:45:52FromDiscord<Rika> theres still plenty of rough edges
11:46:28FromDiscord<hotdog> In reply to @Tahal "Yeah, but Nim seems": Absolutely
11:47:55FromDiscord<Tahal> Metaprogramming is good at making AI?
11:48:42FromDiscord<Tahal> Or I'm wrong here?
11:49:15FromDiscord<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:25FromDiscord<planetis> You can express stuff like finite state machines and other ai techniques with macro DSLs so why not↵(@Tahal)
11:58:15FromDiscord<Tahal> @planetis#0000 Thank you
12:00:33FromDiscord<System64 ~ Flandre Scarlet> Where can I find instelled modules please?
12:01:32FromDiscord<Bung> nimble path yourlibname
12:06:01*supakeen quit (Quit: WeeChat 3.2)
12:06:36*supakeen joined #nim
12:09:23FromDiscord<konsumlamm> In reply to @Tahal "Metaprogramming is good at": i don't think that has much to do with each other
12:17:30arkanoidis it possible to create anonymous noSideEffect proc types using sugar shorthand? I'm using "type Fn = proc(p: pointer): pointer {.noSideEffect.}" now
12:23:52PMunchHmm, I'm unable to cast a pointer to a uint32 (a C-style array of uint32s) to ptr UncheckedArray[UncheckedArray[uint32]]
12:24:01PMunchOh right..
12:24:04PMunchOf course not..
12:24:07PMunchI'm an idiot
12:25:08PMunchBecause it doesn't know the width of the inner array
12:52:44FromDiscord<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:34FromDiscord<Heav> hello.
13:44:58FromDiscord<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:10PMunchHmm, strange. Does that happen when you just get to that question, or do you hit enter?
13:57:49FromDiscord<Heav> just when i get to that question.
13:58:04FromDiscord<Heav> i've actually fixed it though. this is apparently broken in powershell 7. i just launched cmd.exe instead
13:59:03FromDiscord<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:11FromDiscord<Heav> there's already one
13:59:17FromDiscord<Heav> https://github.com/nim-lang/nimble/issues/816
14:05:49*PMunch quit (Quit: leaving)
14:08:18FromDiscord<SamPro> Hello, everyone!↵↵Is the JetBrains plugin good?
14:08:46FromDiscord<SamPro> Like, as good as java in intellij?
14:10:48fn<Prestige99> https://plugins.jetbrains.com/plugin/15128-nim for details on what's supported (but I'd guess the answer is no)
14:10:55FromDiscord<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:08FromDiscord<Clonkk> But it's alright
14:11:20FromDiscord<Clonkk> Although I've never liked JetBrains IDE and didn't use them much
14:11:55FromDiscord<SamPro> How are you two bots??
14:12:10FromDiscord<SamPro> How the...
14:12:15FromDiscord<vindaar> AI has advanced significantly 😎
14:12:22FromDiscord<SamPro> Dafuq
14:12:28fn<Prestige99> My father was a thinkpad
14:12:41FromDiscord<SamPro> K....
14:12:48FromDiscord<SamPro> Confuse
14:13:20FromDiscord<SamPro> 🤔
14:13:29FromDiscord<vindaar> (we're on matrix & irc and these two are bridged to discord)
14:13:35FromDiscord<SamPro> Ik
14:14:29FromDiscord<Clonkk> I'm a captcha who became sentient. I can recognize any bycicle on any pictures with sufficient quality↵(@SamPro)
14:15:04FromDiscord<SamPro> Ok, so after that weird thing, what level is the nim LSP's autocomplete on?
14:15:39FromDiscord<SamPro> Cuz I can't stand vscode and im either neovim or jetbrains
14:15:46FromDiscord<Clonkk> Nimlsp is quite complete, on Neovim I have auto-complete follu working even with docstring directly in it.↵(@SamPro)
14:16:23FromDiscord<SamPro> Amazing! My totally not yoinked from github config will finally shine!
14:16:26FromDiscord<Rika> the neovim plugin is actually at a better state than the vscode one i believe
14:16:47FromDiscord<Clonkk> Here's my neovim config file if you're interested \: https://github.com/Clonkk/bashrc/blob/master/nvim/init.vim
14:17:08FromDiscord<SamPro> I mean im using neovim 5(native lsp!!) not looking for a plugin
14:18:42FromDiscord<SamPro> So I can do some beautiful neovim coding for once
14:18:49*fredrikhr quit (Quit: Disconnecting)
14:19:27FromDiscord<SamPro> Currently on vacation, tried nim out on phone(repl.it), seems great!
14:20:04FromDiscord<SamPro> I know, #offtopic
14:22:13FromDiscord<Clonkk> I don't use neovim native lsp client, but I hear others used it without complaint
14:23:14FromDiscord<SamPro> @Clonkk ew gruvbox in your config
14:24:01FromDiscord<SamPro> Best theme is either Dracula or Palenight because....
14:24:08FromDiscord<SamPro> They are good
14:25:28FromDiscord<Clonkk> Can't argue with that ;). This is subjective↵(@SamPro)
14:27:12FromDiscord<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:38FromDiscord<SamPro> Like most nord themes have 3 colours
14:32:00FromDiscord<Rika> ~~me using solarized: 👀 ~~
14:46:04FromDiscord<Heav> h https://media.discordapp.net/attachments/371759389889003532/862343714918498304/unknown.png
14:49:09FromDiscord<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:28FromDiscord<Heav> i did `sudo apt install libsdl2-dev` beforehand.
14:50:08FromDiscord<vindaar> maybe you only installed the devel files, which are usually the C headers?
14:50:22FromDiscord<Heav> okay, installing more packages...
14:50:24FromDiscord<vindaar> so did it install `libsdl2` as well?
14:50:40FromDiscord<arnetheduck> https://github.com/nim-lang/Nim/blob/devel/changelog.md#changes-affecting-backward-compatibility 😲
14:50:54FromDiscord<@bracketmaster-5a708063d73408ce4> @leorize\:envs.net thx
14:51:13FromDiscord<@bracketmaster-5a708063d73408ce4> for the nvro tip
14:51:47FromDiscord<Heav> In reply to @vindaar "so did it install": that's not a package
14:53:52FromDiscord<Heav> what packages do i need to install to make sdl2 work.
14:54:51FromDiscord<vindaar> uhm, not sure what it's called. just `sdl2` ? I neither use ubuntu, nor have I used sdl2 a lot, sorry
14:55:00FromDiscord<Heav> despite having this, it continues to not work https://media.discordapp.net/attachments/371759389889003532/862345964178374686/unknown.png
15:01:25FromDiscord<@bracketmaster-5a708063d73408ce4> @leorize\:envs.net - how can I force NVRO to be used?
15:02:54FromDiscord<@bracketmaster-5a708063d73408ce4> I would expect the last statement to echo 3, but it echoes 0
15:02:55FromDiscord<leorize> I believe the compiler bar for "large object" is size \>= 3x float
15:02:55FromDiscord<@bracketmaster-5a708063d73408ce4> oh
15:02:55FromDiscord<@bracketmaster-5a708063d73408ce4> So I can't force NVRO - not even with a pragma?
15:03:03FromDiscord<@bracketmaster-5a708063d73408ce4> sent a long message, see http://ix.io/3sei
15:03:36FromDiscord<leorize> ofc it will return 0, even if nvro is enabled
15:03:49FromDiscord<leorize> the result variable is always zero-initialized
15:04:06FromDiscord<@bracketmaster-5a708063d73408ce4> from the link you sent - it says
15:04:16FromDiscord<@bracketmaster-5a708063d73408ce4> proc p()\: BigT =IS ROUGHLY TURNED INTO\:↵proc p(result\: var BigT) =
15:04:38FromDiscord<@bracketmaster-5a708063d73408ce4> if BigT is passed as var, then how would it go back to 0?
15:04:44FromDiscord<leorize> yes, however the semantics of result doesn't change
15:04:49FromDiscord<leorize> so zero-ing still happens
15:05:00FromDiscord<@bracketmaster-5a708063d73408ce4> ah - ok fair
15:05:30FromDiscord<leorize> `{.noinit.}` can be used to stop zero-ing, but use it at your own risk
15:06:05FromDiscord<@bracketmaster-5a708063d73408ce4> what's the risk in using it? concerns about my code be broken in the future?
15:06:26FromDiscord<leorize> it interacts poorly with destructors
15:06:48FromDiscord<Rika> do you think the pragma will be removed in the future?
15:08:19FromDiscord<leorize> https://github.com/nim-lang/Nim/issues/14425 \<- here's an example of noinit + destructors = horror
15:08:45FromDiscord<@bracketmaster-5a708063d73408ce4> you can do `{.nodestroy}`
15:08:46FromDiscord<leorize> nodestroy have it's implications too
15:09:00FromDiscord<leorize> @Rika\: maybe, assuming that we have good analysis to remove unnecessary zero-ing
15:09:18FromDiscord<leorize> we do have first-read and first-write analysis iirc
15:10:15FromDiscord<leorize> not sure if it's hooked in the compiler for initialization yet but it can easily optimize out unnecessary zero-ing
15:10:27FromDiscord<@bracketmaster-5a708063d73408ce4> I think I'll stick with `proc sumEquals(a, b, c : var SomeType)`
15:10:51FromDiscord<@bracketmaster-5a708063d73408ce4> sumEquals -\> equalsSum
15:11:59FromDiscord<Heav> i still can't get sdl2 to work
15:12:26FromDiscord<vindaar> see if you can get any normal SDL2 example running
15:12:34FromDiscord<vindaar> if those work, the nim ones should work fine
15:14:01FromDiscord<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:29FromDiscord<leorize> maintainable code that works should be the basis of your project
15:15:15FromDiscord<leorize> if you really want to micro-optimize, you can ask @mratsim for what in Nim that should be micro-optimized
15:18:14FromDiscord<Heav> i can't find any SDL2 examples really
15:32:35*neceve quit (Ping timeout: 252 seconds)
15:33:02arkanoidwhat's wrong with this use of sugar and function types? https://play.nim-lang.org/#ix=3sen
15:43:08arkanoidhello?
15:44:28fn<Prestige99> What are you trying to do here?
15:45:34fn<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:54arkanoidPrestige, compile that thing
15:50:55arkanoidI 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:09fn<Prestige99> I don't know what you're trying to do with your code
15:51:29FromDiscord<Rika> sugar `=>` uses generics
15:52:14FromDiscord<Rika> LHS type cannot coerce RHS side if RHS is a generic proc
15:52:31FromDiscord<Rika> sorry for saying RHS side please dont kill me
15:52:33FromDiscord<Rika> brain no work
15:56:54*stkrdknmibalz quit (Quit: WeeChat 3.0.1)
16:11:34FromDiscord<@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:39arkanoidRika: thanks. Why is RHS a generic proc, in my case? I'm just writing an identity function
16:13:57FromDiscord<Rika> because thats how the `=>` macro works
16:15:01FromDiscord<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:09FromDiscord<Rika> but i dont know why it doesnt really
16:16:01FromDiscord<juan_carlos> It uses `auto` as return type.
16:16:23FromDiscord<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:49arkanoidstill 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:04arkanoidI mean, template is ignoring the declared types
16:20:07FromDiscord<Rika> again, `=>` generates an auto type
16:20:09FromDiscord<Rika> (edit) "type" => "proc"
16:20:26FromDiscord<juan_carlos> arrow makes auto
16:20:36FromDiscord<Rika> its like saying `let a: proc(x:int):int = proc(x:auto):auto = x`
16:20:59FromDiscord<juan_carlos> Just run expandMacro on it and see what it expands to...
16:21:27FromDiscord<Rika> no i dont know why it doesnt work, it seems like it would
16:22:00FromDiscord<ajusa> sent a code paste, see https://play.nim-lang.org/#ix=3sex
16:22:24arkanoidI got that arrow makes auto, but point it that "auto" seems not working her
16:22:44arkanoid*here
16:22:50FromDiscord<Rika> maybe its time to call the creator or a core dev
16:23:05FromDiscord<Rika> In reply to @ajusa "Are there any ways": other than a macro? i feel like
16:25:36FromDiscord<juan_carlos> For a func `TypeA or TypeB` should work I think...
16:25:42FromDiscord<juan_carlos> auto too.
16:26:35FromDiscord<Rika> they meant for a variant type
16:27:11arkanoidjuan_carlos, how can I expand macro of code that doesn't compile?
16:28:15arkanoidnim c --expandMacro:=> identity.nim returns error
16:29:01FromDiscord<vindaar> the short answer is\: no, there is no return type overloading↵(@ajusa)
16:29:05FromDiscord<juan_carlos> expandMacros: code here indented block
16:30:05FromDiscord<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:26FromDiscord<vindaar> But yea, in practice it can lead to many case statements in many procs
16:30:38arkanoidjuan_carlos: like this? https://play.nim-lang.org/#ix=3sez doesn't compile
16:32:18FromDiscord<juan_carlos> You are trying to use the arrow as a concrete type.
16:33:03FromDiscord<juan_carlos> `int->int` can not be a type.
16:33:28FromDiscord<Rika> it can?
16:33:29FromDiscord<Rika> it is
16:33:35FromDiscord<Rika> what do you mean
16:33:38FromDiscord<juan_carlos> I do not understand the code.
16:33:59FromDiscord<Rika> int->int : proc type↵x => x : proc
16:34:10*greyrat joined #nim
16:34:52*lucerne joined #nim
16:35:01FromDiscord<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:27FromDiscord<Rika> its meant to further coerce the type
16:35:30FromDiscord<Rika> the proc i mean
16:35:33FromDiscord<Rika> supposedly;.
16:35:35FromDiscord<Rika> (edit) "supposedly;." => "supposedly."
16:36:54FromDiscord<juan_carlos> let foo = (arg0, arg1, result) => code here; result = doStuff()
16:37:03arkanoid"let identity: int -> int = x => x" is a perfectly logical line. Maps an anonymous procedure to a variable with compatible procedure type
16:37:10FromDiscord<juan_carlos> Then it returns void, and you get result on the var result.
16:37:39FromDiscord<Rika> what?
16:37:55FromDiscord<juan_carlos> But the macro do not use it currently...
16:38:11FromDiscord<Rika> it's akin to `let identity = proc(x: int): int = x` except it's not working
16:38:25FromDiscord<Rika> where it seems like it shoud
16:38:26FromDiscord<Rika> (edit) "shoud" => "should"
16:39:39*lucerne quit (Quit: Bye)
16:39:43FromDiscord<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:14FromDiscord<Rika> i know that it is auto
16:40:23FromDiscord<Rika> i know that it isnt working because of it
16:40:36FromDiscord<Rika> what i mean is that shouldnt the compiler be smarter about this?
16:40:43arkanoidto 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:43FromDiscord<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:55FromDiscord<Rika> which is roughly the same to the let expression arkanoid sent
16:42:33FromDiscord<juan_carlos> No idea, I am not compiler dev.
16:42:59FromDiscord<juan_carlos> Maybe if signature of func is kinda complex use a normal proc.
16:43:30arkanoidthis works: "let identity: int -> int = proc(x: int): auto = x", it's the auto of the parameter type causing issues
16:43:51arkanoidkinda complex? an identity function?!
16:44:07*lucerne joined #nim
16:44:26FromDiscord<Rika> nim does not use the same type system as haskell
16:44:45FromDiscord<Rika> nim is not especially focused on having the same declaration system as haskell
16:45:15FromDiscord<Rika> yes, i still think this should be fixed
16:45:16arkanoidmy haskell LOC count is zero
16:45:35FromDiscord<Rika> well i assumed it was haskell because it looked a lot like it
16:45:41FromDiscord<Rika> anyway, functional languages
16:45:52FromDiscord<Rika> use roughly the same type system
16:45:57arkanoidI was just refactoring some working nim code and I drilled down to that minimal example, that's it
16:46:43arkanoiddo you think it should be issued in GH?
16:47:04arkanoidI don't even know how to name this to search existing issues
16:47:34FromDiscord<Rika> i feel like it should, though i do not know what to search either
16:56:58arkanoidI don't even know the correct title to address this
16:57:22arkanoidshould I blame "auto" straight, or just talk about simple sugar composition fails
17:04:13*rockcavera quit (Remote host closed the connection)
17:16:55FromDiscord<PressF> How do you convert a string provided by readLine(stdin) to an integer?
17:17:32FromDiscord<haxscramper> `.parseInt()`
17:17:45FromDiscord<haxscramper> https://nim-lang.org/docs/parseutils.html#parseInt%2Cstring%2Cint%2Cint
17:17:51FromDiscord<vindaar> https://nim-lang.github.io/Nim/strutils.html#parseInt%2Cstring
17:17:55FromDiscord<vindaar> better that one ;)
17:18:13FromDiscord<haxscramper> ah, yes
17:18:23FromDiscord<haxscramper> I'm still getting confused by the fact they are in different modules
17:18:59FromDiscord<kaushalmodi> I think `strutils.parseInt` calls `parseutils.parseInt` but also raises an exception if needed.
17:19:30FromDiscord<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:02FromDiscord<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:19FromDiscord<PressF> thx guys
17:20:23FromDiscord<PressF> I'll test it
17:21:24FromDiscord<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:58FromDiscord<talaing> What is the best way to cut off last 2 characters of a string?
19:46:25FromDiscord<talaing> `now().format("HH:mm:ss'.'ffffff")`
19:46:37FromDiscord<talaing> `21:44:57.967640`
19:46:41FromDiscord<talaing> (edit)
19:46:53FromDiscord<talaing> I only need `21:44:57.9676`
19:46:59FromDiscord<timotheecour> setLen
19:47:16FromDiscord<timotheecour> (edit) "setLen ... " added "and see also rfidn"
19:47:20FromDiscord<timotheecour> (edit) "rfidn" => "rfind"
19:49:03FromDiscord<vindaar> or just the plain and simple slice `mystring[0..<^2]`
19:51:28*max22- joined #nim
19:54:17FromDiscord<talaing> `mystring[0..<^2]` doesn't seem to work
19:54:30FromDiscord<vindaar> huh?
19:54:43FromDiscord<talaing> `Error: undeclared identifier: '..^<'`
19:54:48FromDiscord<vindaar> ah
19:54:49FromDiscord<vindaar> damn
19:54:51FromDiscord<vindaar> space
19:55:22FromDiscord<vindaar> https://play.nim-lang.org/#ix=3sfm
19:57:40FromDiscord<talaing> Now it works, thanks 🙂
19:59:37FromDiscord<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:21FromDiscord<vindaar> this is "including the 3rd last character" and the one before is "up to less than the 2nd last"
20:05:31FromDiscord<runciter> sent a long message, see http://ix.io/3sfp
20:05:54FromDiscord<runciter> apologies my Matrix client removed the newlines in my message
20:06:12FromDiscord<vindaar> @treeform ^ can help you best
20:06:31FromDiscord<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:13FromDiscord<vindaar> Thanks, that's certainly true, but I feel like people asking such a thing probably don't care about that.
20:07:34FromDiscord<ElegantBeef> Probably true, but always good thing to note
20:07:46FromDiscord<vindaar> indeed 👌
20:08:43FromDiscord<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:47FromDiscord<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:51FromDiscord<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:23FromDiscord<treeform> @runciter: https://play.nim-lang.org/#ix=3sfr
20:14:40FromDiscord<treeform> I think you are overcomplicating your life with types
20:16:32FromDiscord<treeform> oh maybe this is a better version: https://play.nim-lang.org/#ix=3sft
20:22:12FromDiscord<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:22FromDiscord<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:50FromDiscord<treeform> so you want all of your types to have `errcode` and `error` just with more indirection?
20:29:48FromDiscord<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:45FromDiscord<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:49FromDiscord<treeform> if you want your results to be nested still you probably want to use parse hook inside parse hook
20:32:52FromDiscord<runciter> oh wow this is exactly what I wanted to do, apologies if I explained it poorly
20:33:03FromDiscord<runciter> true, I'll see where it goes when I get there↵↵thanks a lot for the help with this
20:34:22FromDiscord<treeform> This code is better: https://play.nim-lang.org/#ix=3sfB
20:34:42FromDiscord<treeform> I needed to use parseHook in side parseHook so that it can nest
20:34:48FromDiscord<treeform> probably does not matter in your case though
20:35:34FromDiscord<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:52FromDiscord<treeform> you got to handle them some place, why pipe them around?
20:40:55FromDiscord<runciter> sent a long message, see http://ix.io/3sfC
20:43:20FromDiscord<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:31FromDiscord<vindaar> oh damn, you're writing a matrix library? that's awesome!
20:53:25FromDiscord<runciter> hoping to haha - ty
20:55:00FromDiscord<tandy> excited to see a Nim mention in This Week In Matrix \:)
20:56:40FromDiscord<ElegantBeef> Aw hell yea, i was going to try it, but couldnt indulge myself in self abuse 😛
20:57:42fn<Prestige99> Ah that's exciting stuff
20:58:31fn<Prestige99> I'd like to make a matrix client when that api is ready
21:06:22FromDiscord<runciter> aha I wasn't expecting any interest - I'll drop a msg in here when it's ready \<3
21:06:46FromDiscord<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:47FromDiscord<@bracketmaster-5a708063d73408ce4> can I iterate over an array in reverse?
22:04:58*max22- quit (Quit: Leaving)
22:32:00FromDiscord<ElegantBeef> There isnt a way in the stdlib but you can make an iterator relatively quickly
22:35:15FromDiscord<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)