<< 25-07-2021 >>

00:02:03FromDiscord<@bracketmaster-5a708063d73408ce4> has anyone tried nimedit?
00:02:05FromDiscord<@bracketmaster-5a708063d73408ce4> thoughts so far?
00:08:10FromDiscord<@bracketmaster-5a708063d73408ce4> I'm thinking I'll try it
00:18:36*vicfred joined #nim
00:27:28FromDiscord<carmysilna> When I looked at it, it looked like development has stalled
01:04:03*bkay joined #nim
01:04:21*beshr quit (Ping timeout: 258 seconds)
01:36:58FromDiscord<creonico> How can I do conditional compilation when defining -d:debug?
01:38:04FromDiscord<leorize> `when defined(debug): <code here>`
01:38:21FromDiscord<creonico> Thank you πŸ˜…
01:58:33*arkurious quit (Quit: Leaving)
02:58:41FromDiscord<Jakraes> Does anyone know if there's a way to temporarily open a port with nim?
02:59:32FromDiscord<Jakraes> I tried using netty to connect with a friend and apparently, even if specify a port in netty and he uses my ip and we're connected through hamachi, he can't connect with the server
03:34:01*ecs joined #nim
03:45:40*TakinOver joined #nim
04:06:02*supakeen quit (Quit: WeeChat 3.2)
04:06:37*supakeen joined #nim
05:22:09*TejasAgarwal joined #nim
05:27:30*fputs_ quit (Remote host closed the connection)
05:27:49*fputs joined #nim
05:28:04*fputs quit (Remote host closed the connection)
05:28:52*fputs joined #nim
05:34:39*TejasAgarwal quit (Quit: The Lounge - https://thelounge.chat)
06:16:18*max22- joined #nim
06:29:32*max22- quit (Remote host closed the connection)
06:30:25*max22- joined #nim
06:34:05*aeverr quit (Ping timeout: 255 seconds)
06:36:38FromDiscord<j-james> Are there best practices for wrapping C libraries?
07:02:15FromDiscord<Rika> Example?
07:44:01FromDiscord<ynfle (ynfle)> @\_discord\_572634810917322773\:t2bot.io try c2nim or nimterop
07:57:11mstj-james, my (limited) experience is that nim talks to C libraries nicely enough that you kinda just do it and it works
08:01:07FromDiscord<generic linux user> guys can i know how much is uint64 range?
08:01:22FromDiscord<generic linux user> its taking a long time than int64, concern
08:02:26fn<Prestige99> you mean the highest number for uint64?
08:02:38FromDiscord<generic linux user> yes
08:02:51fn<Prestige99> !eval echo uint64.high
08:02:53NimBot18446744073709551615
08:02:54fn<R2D299> 18446744073709551615
08:03:09FromDiscord<generic linux user> i wrote a smol bin for checking on if n(n+1) returns even for all naturals
08:03:28FromDiscord<generic linux user> i first used int64 , it lasted 1.20mins until i got overflow
08:03:37FromDiscord<generic linux user> i changed it to uint64 and its been 20 mins
08:03:44FromDiscord<generic linux user> thanks for the number tho
08:03:54FromDiscord<zidsal> All naturals is an infinite set
08:04:06FromDiscord<generic linux user> but my phone is 64bit
08:04:09FromDiscord<ElegantBeef> Also did you build `-d:release` πŸ˜„
08:04:13FromDiscord<generic linux user> yes
08:04:22FromDiscord<ElegantBeef> still going to take forever, but have fun
08:04:38FromDiscord<generic linux user> i think by that numver it takes 1.28hours
08:04:44FromDiscord<zidsal> But generic how do you know that, it works for any naturals larger then uint64.max
08:04:49FromDiscord<generic linux user> (edit) "numver" => "number"
08:05:07FromDiscord<generic linux user> me?
08:05:08FromDiscord<generic linux user> lol
08:05:30FromDiscord<generic linux user> In reply to @zidsal "But generic how do": just checking on if law is true, have nothing seroius to do tho
08:06:01FromDiscord<zidsal> My point is generally you would use a mathematical proof for such a thing rather then write a program for it :P
08:06:31FromDiscord<generic linux user> yes, principal of mathematical induction, i got this from there
08:07:51FromDiscord<generic linux user> how?
08:07:52FromDiscord<generic linux user> sent a code paste, see https://play.nim-lang.org/#ix=2tJ9
08:08:17FromDiscord<Rika> Unsigned numbers do not have overflow errors
08:08:28FromDiscord<Rika> You will never terminate if you do not manually check for overflow
08:08:38FromDiscord<generic linux user> waaat
08:08:56FromDiscord<generic linux user> In reply to @Rika "You will never terminate": so it will keep on running?
08:09:21FromDiscord<Rika> Unless you check for last number < current number
08:09:27FromDiscord<generic linux user> but then isnt there a limit that causes overflow
08:09:39FromDiscord<Rika> Not for unsigned numbers
08:09:50FromDiscord<generic linux user> that is possible?
08:10:08FromDiscord<ElegantBeef> Unsigned doesnt overflow
08:10:11FromDiscord<ElegantBeef> (edit) "Unsigned doesnt overflow ... " added "error"
08:10:13FromDiscord<Rika> Because it is a common idiom to use unsigned numbers for modulo math or something I forgot what it’s called
08:10:37FromDiscord<ElegantBeef> !eval echo 255u8 + 1u8
08:10:39NimBot0
08:10:42FromDiscord<generic linux user> but still there is a max on any data type right?
08:10:54FromDiscord<Rika> Yes
08:11:04FromDiscord<generic linux user> so we should get a overflow
08:11:18FromDiscord<Rika> Yes, but not an error
08:11:25FromDiscord<Rika> It overflows silently
08:11:28FromDiscord<generic linux user> atleast will it exit?, or will it keep doing smg after it runs out of max
08:11:40FromDiscord<generic linux user> In reply to @Rika "It overflows silently": and then what will it do?
08:11:44FromDiscord<Rika> No it just rolls back to 0
08:11:48FromDiscord<ElegantBeef> No unsigned integers will silently overflow and continue
08:11:49FromDiscord<Rika> And continues again up to max
08:11:53FromDiscord<Rika> Then back to 0
08:11:54FromDiscord<ElegantBeef> Look what i showed with the eval
08:12:01FromDiscord<generic linux user> if it rolls back to zero , it will exitπŸ™‚
08:12:11FromDiscord<ElegantBeef> !eval echo 255u8 + 127u8
08:12:13NimBot126
08:12:22FromDiscord<generic linux user> In reply to @ElegantBeef "Look what i showed": okkke
08:12:43FromDiscord<Rika> sent a code paste, see https://paste.rs/DrF
08:12:55FromDiscord<generic linux user> it n is 0 , then the law gets false
08:13:02FromDiscord<Rika> Why
08:13:07FromDiscord<generic linux user> 0 is even?
08:13:14FromDiscord<Rika> Yes
08:13:16FromDiscord<Rika> What
08:13:25FromDiscord<generic linux user> it will retrun 0
08:13:27FromDiscord<generic linux user> :|
08:13:29FromDiscord<Rika> 0 is even
08:13:35FromDiscord<ElegantBeef> the remainder of 0 / 2 is 0
08:13:39FromDiscord<generic linux user> yes
08:13:46FromDiscord<generic linux user> so it will loop infinite
08:13:52FromDiscord<Rika> Yes as we said indeed
08:14:11FromDiscord<generic linux user> thank you guys
08:14:17FromDiscord<generic linux user> i am mad:)
08:14:34FromDiscord<Rika> Lol blame C I guess
08:14:47FromDiscord<generic linux user> else it wouldnt have happend?
08:14:58FromDiscord<generic linux user> there is cpp tho
08:15:54FromDiscord<Rika> No it’s complicated to explain
08:16:15FromDiscord<generic linux user> okei
08:18:32FromDiscord<generic linux user> sent a code paste, see https://paste.rs/vO7
08:21:05FromDiscord<generic linux user> then it will echo 0,0 after 2 hours
08:21:09FromDiscord<generic linux user> which is pointless
08:21:11FromDiscord<ElegantBeef> Could just check `if n != uint64.high` before `loop`
08:21:49FromDiscord<generic linux user> else it would put it to 0 and that doesnt make sense
08:33:17*max22- quit (Remote host closed the connection)
08:36:12FromDiscord<j-james> In reply to @Rika "Example?": Wrapping wlroots, which has functions split across multiple header files - is it standard to merge these all into one Nim file?
08:37:48FromDiscord<haxscramper> just do what seems suitable for you, there is no set standard
08:38:11FromDiscord<haxscramper> can merge everything into one huge file
08:40:02*max22- joined #nim
08:41:26FromDiscord<j-james> Good to know, thanks
09:24:52fn<Prestige99> Is there a way to do this properly? https://play.nim-lang.org/#ix=2S8a
09:30:40FromDiscord<ElegantBeef> I dont think there is any nice way around not having a closure here
09:31:41FromDiscord<ElegantBeef> I assume the cdecl is to interact with xlib?
09:32:00fn<Prestige99> actually staticglfw this time
09:32:40fn<Prestige99> So this could be done somehow with a closure you think?
09:32:50FromDiscord<ElegantBeef> Well that's what the error is talking about
09:33:00FromDiscord<ElegantBeef> Cdecl and closure are incompatible
09:33:29FromDiscord<ElegantBeef> It's explictly stating that it cannot capture `this` due to using the cdecl calling convention
09:34:05fn<Prestige99> Right - I don't know how I could ever use this callback to manipulate data in my program, then
09:34:29FromDiscord<ElegantBeef> Welcome to glfw fun! πŸ˜„
09:34:34fn<Prestige99> unless it were just global, maybe
09:34:44FromDiscord<ElegantBeef> Yea if it was global you could
09:35:15FromDiscord<ElegantBeef> SDL2 doesnt do this callback based stuff if you care about that at all
09:35:36FromDiscord<ElegantBeef> also i hate your mouse state
09:35:55FromDiscord<ElegantBeef> How hard is it to use a button state man! clear, pressed, held, released πŸ˜›
09:36:58fn<Prestige99> mocking godot's system atm
09:37:30fn<Prestige99> well it doesn't compile yet lol so I've yet to test out what I'd like
09:37:41FromDiscord<ElegantBeef> Working on a 2D or 3D project?
09:37:53fn<Prestige99> a 2d engine
09:38:32FromDiscord<ElegantBeef> Ah i recently started on a 3D "engine" that i'll probably soon throw in a dumpster
09:38:56fn<Prestige99> that sounds like fun tbh, but a lot of work
09:39:16fn<Prestige99> how in hell can these callbacks be used..
09:39:19FromDiscord<ElegantBeef> Well i have the important shader/model loading so i can actually toy with it
09:39:22FromDiscord<ElegantBeef> Global variables
09:39:36fn<Prestige99> hmm maybe a singleton?
09:39:36FromDiscord<ElegantBeef> You basically get to do stuff like https://github.com/beef331/truss3d/blob/master/src/truss3D/inputs.nim#L46
09:39:52FromDiscord<ElegantBeef> Well do you really need a singleton in Nim?
09:40:07FromDiscord<ElegantBeef> It's just a global variable here
09:40:24fn<Prestige99> for my inputhandler, would be nice
09:41:02FromDiscord<ElegantBeef> I guess if you must you could have an instantiated object for it, seems quite simple to just import inputs if you need them if you ask me πŸ˜„
09:42:08fn<Prestige99> yeah a singleton works out quite well actually
09:42:27fn<Prestige99> I'm avoiding allowing the user to change the state of the inputhandler
09:43:25FromDiscord<ElegantBeef> Sure but if the input procedures exist in the inputs module you just expose the inputs with getters and you've got a singleton like system with the user not being able to modify them
09:43:48fn<Prestige99> yep that's what I'm doing currently
09:44:11FromDiscord<ElegantBeef> Does it need to capture the global variable?
09:45:50fn<Prestige99> well it seems to work, idk
09:46:07fn<Prestige99> dont know what goes on under the hood
10:02:44*Arrrrrrrrr joined #nim
10:13:54ArrrrrrrrrWhat is Araq working on nowadays? I've been out of the loop for a while
10:16:08ArrrrrrrrrTHe overloadable enums looks promising, this was a (minor) pain for me
10:17:16FromDiscord<fajjida> Is there a way to use globbing in pure Nimsript or at least iterate over them? walkFiles and walkPattern from "os" do not work on Nimscript. I can probably find a workaround but this seems weird.
10:20:09FromDiscord<haxscramper> https://github.com/treeform/globby
10:20:11fn<R2D299> itHub: 7"Glob pattern matching for Nim."
10:20:32FromDiscord<haxscramper> Most likely it works with nimscript
10:58:53*vicfred quit (Quit: Leaving)
10:59:11arkanoidis nim compatible with the intel C compiler? I'm curious about trying the auto-parallelization tool and https://software.intel.com/content/www/us/en/develop/tools/oneapi/components/advisor.html
11:04:20*luis_ joined #nim
11:22:13arkanoidwhere is a "const x = @[1,2,3,4,5]" allocated? is it still on the heap no matter of const?
11:37:03*xet7 quit (Remote host closed the connection)
11:37:40*xet7 joined #nim
11:39:31*luis_ quit (Quit: luis_)
11:40:10*luis_ joined #nim
11:43:27FromDiscord<haxscramper> Yes, IIRC `const` values are directly inlined when they are used
11:44:23FromDiscord<haxscramper> There might be an optimization for that, so I think the best way to figure that out would be to look at generated C code
11:50:37*Arrrrrrrrr quit (Quit: Arrrrrrrrr)
11:55:50*max22- quit (Ping timeout: 256 seconds)
12:06:01*supakeen quit (Quit: WeeChat 3.2)
12:06:35*supakeen joined #nim
12:12:25FromDiscord<generic linux user> https://media.discordapp.net/attachments/371759389889003532/868828030271901696/Screenshot_2021-07-25-17-42-06.jpeg
12:39:48*luis_ quit (Quit: luis_)
12:40:09*luis_ joined #nim
12:46:10*aeverr joined #nim
13:00:01*arkurious joined #nim
13:01:50FromDiscord<shampee (Hampus O)> !help
13:06:30*supakeen quit (Remote host closed the connection)
13:06:53*supakeen joined #nim
13:25:28*max22- joined #nim
13:28:53FromDiscord<generic linux user> eh?
13:36:28FromDiscord<generic linux user> sent a code paste, see https://paste.rs/JhV
13:36:30FromDiscord<generic linux user> it was 9 afaik
13:37:04fn<Prestige99> What do you mean?
13:39:12*ming joined #nim
13:39:52*luis_ quit (Quit: luis_)
13:42:49FromDiscord<generic linux user> sent a code paste, see https://play.nim-lang.org/#ix=3u2R
13:43:03FromDiscord<generic linux user> you roll until 7 then the error comes
13:44:02FromDiscord<generic linux user> i wrote that into a file and readed it, now i call it csv :|
13:45:44FromDiscord<Rika> ??
13:45:52FromDiscord<Rika> Roll???
13:46:00FromDiscord<generic linux user> go on until
13:46:15FromDiscord<Rika> Go on where
13:46:22FromDiscord<generic linux user> upto 7th index
13:47:12FromDiscord<Rika> The code only has two indices though what do you mean
13:49:05FromDiscord<generic linux user> sent a code paste, see https://play.nim-lang.org/#ix=3u2U
13:49:15FromDiscord<Rika> It should error by 3
13:49:24*max22- quit (Ping timeout: 272 seconds)
13:49:53FromDiscord<generic linux user> it doesnt
13:49:56FromDiscord<generic linux user> it returns nil
13:50:05FromDiscord<generic linux user> ok
13:50:18fn<Prestige99> Can you paste a full example?
13:50:36FromDiscord<generic linux user> sent a code paste, see https://paste.rs/XZA
13:50:49FromDiscord<generic linux user> i was trying out this method , i dont have any example
13:52:34FromDiscord<Rika> That should error by index 10
13:54:52FromDiscord<generic linux user> sorry , it somehow worked now
14:04:11FromDiscord<generic linux user> it was tje problem of the csv file that i wrote
14:04:17FromDiscord<generic linux user> i didnt put 11 commas
14:04:24FromDiscord<generic linux user> also why only 10?
14:11:30FromDiscord<Rika> index starts with 0?
14:11:36FromDiscord<generic linux user> yes
14:11:44FromDiscord<Rika> yeah so it errors on index 10
14:11:51FromDiscord<Rika> 0 to 9 is 10 strings
14:11:56FromDiscord<generic linux user> but why only till 10 tho
14:12:26FromDiscord<Rika> sent a code paste, see https://play.nim-lang.org/#ix=3u2X
14:12:26FromDiscord<Rika> therefore on index 10 it will error
14:12:37FromDiscord<generic linux user> no , like if i add more
14:12:53FromDiscord<Rika> then the index where it errors will change too
14:14:12FromDiscord<generic linux user> yep , it works
14:23:20*xet7 quit (Remote host closed the connection)
14:24:12*xet7 joined #nim
14:30:20*max22- joined #nim
15:35:07FromDiscord<carmysilna> Can I, at compile-time, read a file and do computation on its contents, and then have the result of the computation available at runtime?
15:37:13FromDiscord<no name fits> Yes
15:39:59fn<ForumUpdaterBot99> New thread by Arnetheduck: What makes the nim compiler slow, see https://forum.nim-lang.org/t/8267
15:43:16FromDiscord<carmysilna> In reply to @no name fits "Yes": Can you elaborate? I've tried doing the computation in a `static` block, but then I can't access the results at runtime, outside of the `static` block
15:43:54FromDiscord<no name fits> Wait, then I misunderstand you
15:44:17*max22- quit (Remote host closed the connection)
15:44:41FromDiscord<no name fits> If you do any computations at compile time, what is it you then want to access at runtime?
15:44:55FromDiscord<carmysilna> sent a code paste, see https://play.nim-lang.org/#ix=3u3z
15:45:08FromDiscord<carmysilna> But I get an error that `prelude` isn't in scope, and I can't export from within the `static` block
15:47:02FromDiscord<carmysilna> In reply to @no name fits "If you do any": the result of the computation, which won't change during runtime, hence the desire to run just once at compile-time
15:47:09FromDiscord<no name fits> right
15:48:09FromDiscord<carmysilna> so is `static` not the right way to do this?
15:48:26FromDiscord<carmysilna> or can I declare a `const` that's the result of a static block?
15:48:43FromDiscord<no name fits> You need the variable to be outside of the static scope
15:50:54FromDiscord<no name fits> I'm not sure how you would lift a variable out of a scope otherwise
15:51:03*max22- joined #nim
15:53:32FromDiscord<carmysilna> sent a code paste, see https://play.nim-lang.org/#ix=3u3D
15:54:05FromDiscord<SolitudeSF> yes
15:54:40FromDiscord<SolitudeSF> you just need to change readFile to staticRead
15:59:13FromDiscord<carmysilna> thanks
16:02:22FromDiscord<zetashift> Did IC land yet? I saw the an issue closed a few weeks ago and presumed it's already in?
16:23:58FromDiscord<haxscramper> I tried to compile my project with latest devel&IC, and it immediately led to internal compiler crash
16:23:58FromDiscord<haxscramper> Like 1.6
16:23:59FromDiscord<haxscramper> And IIRC it was planned for some release version
16:24:31FromDiscord<haxscramper> And there was no mention of it being ready & fully usable for everyday code
16:48:42*ming quit (Ping timeout: 240 seconds)
16:49:11*ming joined #nim
17:00:24FromDiscord<leorize> I think IC is lifted from 1.6 roadmap
17:00:34FromDiscord<leorize> gotta ask @Araq to be sure though
17:23:59*flynn quit (Read error: Connection reset by peer)
17:25:05*flynn joined #nim
17:36:56*ming quit (Remote host closed the connection)
17:40:47FromDiscord<zetashift> Ah I see, I was just curious, so I'm in no pressing hurry to know πŸ˜›
18:20:59FromDiscord<haxscramper> So 1.6 roadmap is switching to ARC/ORC as default GC?
18:21:00FromDiscord<haxscramper> I've seen discussion about orc being 2.0 feature https://forum.nim-lang.org/t/7983
18:21:00FromDiscord<haxscramper> > ↡> Once Nim can bootstrap via --gc\:orc we should make this the default GC as it works best with destructor based custom memory management. Since this is all based on the "new runtime" which isn't ABI compatible this deserves the 2.0 version. This should also be our next LTS version.↡>
18:29:54FromDiscord<timotheecour> @carmysilna did you see the update for osenv?
18:30:38FromDiscord<carmysilna> yeah, my preference would be for option 1 but I want to hear what Araq thinks
18:31:25FromDiscord<timotheecour> ya, that'd be the simplest to do it in 1 shot
18:33:45*flynn quit (Read error: Connection reset by peer)
18:34:53*flynn joined #nim
18:50:02*flynn quit (Remote host closed the connection)
18:51:08*flynn joined #nim
19:07:48*supakeen quit (Remote host closed the connection)
19:08:12*supakeen joined #nim
19:13:55*max22- quit (Read error: Connection reset by peer)
19:16:23FromDiscord<lamersc.com 🐧> What’s the difference between arc and orc?
19:20:36*max22- joined #nim
19:29:20*bkay quit (Quit: Leaving)
19:29:35*beshr joined #nim
19:29:35*beshr quit (Changing host)
19:29:35*beshr joined #nim
19:45:15*vicfred joined #nim
20:20:58*max22- quit (Ping timeout: 240 seconds)
20:20:59FromDiscord<SirOlaf> Are there Nim bindings for https://github.com/ocornut/imgui_club/blob/master/imgui_memory_editor/imgui_memory_editor.h and if not, how would I go about creating them?
20:40:55*max22- joined #nim
20:43:30*vicfred_ joined #nim
20:45:56*vicfred__ joined #nim
20:46:46*vicfred quit (Ping timeout: 272 seconds)
20:48:27*vicfred_ quit (Ping timeout: 245 seconds)
20:52:02*vicfred__ quit (Quit: Leaving)
20:52:12*vicfred joined #nim
21:09:59FromDiscord<lamersc.com 🐧> In reply to @SirOlaf "Are there Nim bindings": Seems pretty niche of a usage, so I don’t think there’d be binding yet
21:12:34FromDiscord<SirOlaf> Damn. Any good way of binding it or something?
22:58:29*vicfred_ joined #nim
23:01:14*vicfred quit (Ping timeout: 252 seconds)
23:16:55FromDiscord<demotomohiro> nimgl contains imgui binding
23:16:56FromDiscord<demotomohiro> https://github.com/nimgl/nimgl
23:16:58fn<R2D299> itHub: 7"NimGL is a Nim library that offers bindings for popular libraries used in computer graphics"
23:17:11FromDiscord<@bracketmaster-5a708063d73408ce4> any idiomatic and elegant ways to remove a certain character from a string?
23:18:53FromDiscord<exelotl> you mean remove all occurrences, or remove a certain index?
23:19:05FromDiscord<@bracketmaster-5a708063d73408ce4> all occurences
23:22:48FromDiscord<exelotl> good question lol
23:23:21FromDiscord<exelotl> I'd have thought `filterIt` would have worked but I think I'm doing something wrong
23:29:04FromDiscord<exelotl> I guess `s = s.replace("x", "")` is the easiest way, but if you're intending to modify `s` like that it's gonna be a pretty slow / wasteful solution
23:31:15FromDiscord<carmysilna> `s.keepItIf(it != 'x')`
23:32:54*vicfred_ quit (Ping timeout: 265 seconds)
23:34:25FromDiscord<exelotl> jank https://play.nim-lang.org/#ix=3u5i
23:34:40*max22- quit (Remote host closed the connection)
23:36:03FromDiscord<exelotl> oh it's just cause `s` isn't a seq
23:37:42FromDiscord<exelotl> `filterIt` failed for the same reason, well it would work but return a `seq[char]` rather than a `string`
23:38:52FromDiscord<exelotl> if you change the signature of `keepItIf` to accept `seq|string` it works fine
23:41:22FromDiscord<Elegantbeef> https://play.nim-lang.org/#ix=3u5j
23:41:28FromDiscord<Elegantbeef> Probably the simplest solution
23:42:01FromDiscord<carmysilna> sent a code paste, see https://play.nim-lang.org/#ix=3u5k
23:42:34FromDiscord<Elegantbeef> well forgot the characters to remove in the parameter list and `s: var string` πŸ˜›
23:43:55FromDiscord<Elegantbeef> Also why are you using inject in a procedure?