<< 13-04-2024 >>

00:00:11FromDiscord<vagous> Would nim work well with game dev?
00:00:21FromDiscord<vagous> Like for creating vulkan abstractions for a game
00:00:31FromDiscord<sOkam! 🫐> In reply to @vagous "Like for creating vulkan": yes, just like C would
00:00:34FromDiscord<vagous> k
00:00:37FromDiscord<sOkam! 🫐> except its MUCH faster to write
00:00:46FromDiscord<sOkam! 🫐> like 3x or 4x faster to prototype with nim than with C
00:00:51FromDiscord<sOkam! 🫐> (i use both daily)
00:01:02FromDiscord<vagous> And i'm assuming that it writes better C than anyone could ever
00:01:31FromDiscord<vagous> /c++
00:01:32FromDiscord<sOkam! 🫐> don't understimate the developer time
00:01:44FromDiscord<vagous> I'm just asking
00:01:48FromDiscord<sOkam! 🫐> computer time is cheap and repeatable, developer time is invaluable
00:02:39FromDiscord<sOkam! 🫐> yeah I know. im just pointing to the fact that, whether it is better C, the prototyping speed is so fast that it would make it worth it even if it was slower (it isnt' but just to give perspective)
00:02:42FromDiscord<Elegantbeef> I use opengl, but yes
00:02:43FromDiscord<Elegantbeef> It's a system language you can do whatever your little heart desires
00:03:30FromDiscord<sOkam! 🫐> Nim is somewhere, in terms of speed, between C and C++... and c/cpp are so close together that the differences don't really matter at that point
00:03:42FromDiscord<vagous> I understand
00:04:00FromDiscord<Mike> I think nimlsp is just failing quietly.
00:04:07FromDiscord<vagous> where do I import from for createThread?
00:04:15FromDiscord<Elegantbeef> Nowhere
00:04:16FromDiscord<vagous> good
00:04:25FromDiscord<Elegantbeef> It's already imported if you have `--threads:on`
00:04:28FromDiscord<Elegantbeef> That was a big thing with Nim 2.0
00:05:05FromDiscord<vagous> So I did a test once
00:05:07FromDiscord<vagous> with nico
00:05:26FromDiscord<vagous> It wasn't threaded, but I used a for x for y loop to render a bunch of sprites in a square
00:05:51FromDiscord<vagous> When I switched to using a for item in array loop it went from slow speed to wouldn't even load speed
00:06:04FromDiscord<vagous> Why is that?
00:06:18FromDiscord<Elegantbeef> Debug build with range checks in hotpath
00:06:32FromDiscord<Robyn [She/Her]> In reply to @vagous "Like for creating vulkan": There's actually a wrapper for Vulkan in Nim
00:06:32FromDiscord<Elegantbeef> If it was a release build you still have range checks in hotpath
00:06:33FromDiscord<vagous> This was in release
00:06:50FromDiscord<vagous> what is hotpath?
00:07:08FromDiscord<Elegantbeef> The meat and gravy part of your code
00:07:12FromDiscord<Elegantbeef> Where work is actually being done
00:07:35FromDiscord<Elegantbeef> You probably had range checks inside your code and where benchmarking with those enabled
00:07:49FromDiscord<Elegantbeef> You can either disable bound checks globally or for blocks of code
00:08:24FromDiscord<Elegantbeef> sent a code paste, see https://play.nim-lang.org/#pasty=YOODKVYXesBr
00:08:39FromDiscord<sOkam! 🫐> In reply to @chronos.vitaqua "There's actually a wrapper": don't send them to nimgl/vulkan, please
00:08:44FromDiscord<sOkam! 🫐> its beyond old 🙈
00:08:46FromDiscord<Elegantbeef> Guess that should be `@[1]`
00:08:53FromDiscord<sOkam! 🫐> Daniel's version is way better
00:08:56FromDiscord<vagous> sent a code paste, see https://play.nim-lang.org/#pasty=iCDylliAzChO
00:08:57FromDiscord<Robyn [She/Her]> In reply to @heysokam "don't send them to": There's others too
00:09:00FromDiscord<Elegantbeef> And since it's top level it don't work
00:09:09FromDiscord<Robyn [She/Her]> In reply to @heysokam "Daniel's version is way": Oh? Could you send that repo? Idk who Daniel is
00:09:28FromDiscord<Robyn [She/Her]> I do know a friend of mine forked an old Vulkan repo and updated it a few months back
00:09:30FromDiscord<vagous> In reply to @heysokam "Daniel's version is way": send
00:09:34FromDiscord<sOkam! 🫐> In reply to @chronos.vitaqua "Oh? Could you send": https://github.com/DanielBelmes/vulkan
00:09:48FromDiscord<Elegantbeef> sent a code paste, see https://play.nim-lang.org/#pasty=AsHkMmezSton
00:10:17FromDiscord<sOkam! 🫐> (edit) "https://github.com/DanielBelmes/vulkan" => "https://github.com/DanielBelmes/vulkan↵the generator actually generates the entire API, unlike the nimgl's version which stops at 1XXsomething"
00:10:24FromDiscord<sOkam! 🫐> (edit) "1XXsomething" => "1XX or 2XX something"
00:11:50FromDiscord<Robyn [She/Her]> In reply to @heysokam "https://github.com/DanielBelmes/vulkan the generato": Oh damn that's epic!
00:12:14FromDiscord<vagous> sent a code paste, see https://play.nim-lang.org/#pasty=ICYgcVvwlOgI
00:12:32FromDiscord<Elegantbeef> I feel like that's self explanatory, but yes
00:13:01FromDiscord<vagous> A lot of things in life seem self explanatory, that' why I ask "obvious" questions
00:19:17FromDiscord<vagous> How would yall compare odin syntax productivity to nim? Would nim be better?
00:19:33FromDiscord<Elegantbeef> Odin lacks automatic memory management so who cared about syntax
00:19:58FromDiscord<Elegantbeef> As soon as a proper program relies on the programmer remembering to free resources you lost productivity
00:20:26FromDiscord<vagous> Gotcha
00:21:39*beholders_eye quit (Read error: Connection reset by peer)
00:27:22*beholders_eye joined #nim
00:28:34FromDiscord<demotomohiro> https://github.com/demotomohiro/littlesugar/blob/main/src/littlesugar/reinterpretPtr.nim↵I think procs like this is better than using cast to convert pointer types.↵It is more explicit and safter than cast.↵`cast` accepts any types but `reinterpretPtr` accepts only pointer types.
00:29:56FromDiscord<Elegantbeef> It is nicer but for things like `cast[uint32]({range[0..31](10)}` it means you have to take an addr 😄
00:30:18FromDiscord<Elegantbeef> Though arguably sets should be convertible to their implementation size
00:30:30FromDiscord<Elegantbeef> `uint32({range[0..31](10)})` should compile
00:31:39FromDiscord<sOkam! 🫐> sent a code paste, see https://play.nim-lang.org/#pasty=kZkuXHXuMTTJ
00:33:54FromDiscord<Elegantbeef> Oh hey Odin now ties with my Nim ftree implementation
00:33:54FromDiscord<Elegantbeef> They did it!
00:33:55FromDiscord<Elegantbeef> fractal tree\ for anyone curios
00:33:58FromDiscord<Elegantbeef> curious even
00:35:28*def- quit (Quit: -)
00:36:32*def- joined #nim
00:37:19FromDiscord<demotomohiro> Why does `cast[uint32]({range[0..31](10)}` have to take an addr?
00:39:53FromDiscord<Elegantbeef> It doesn't I just meant if everyone stopped using `cast`
00:53:41*def- quit (Quit: -)
00:54:31*def- joined #nim
01:04:28*lucasta quit (Quit: Leaving)
01:08:51*beholders_eye quit (Read error: Connection reset by peer)
01:14:43*beholders_eye joined #nim
02:15:19*beholders_eye quit (Ping timeout: 256 seconds)
02:24:20*def- quit (Quit: -)
02:24:47*def- joined #nim
03:00:45*def- quit (Quit: -)
03:19:55*def- joined #nim
03:25:36*def- quit (Quit: -)
03:25:59*def- joined #nim
03:44:28FromDiscord<pk.kyle> any quick and smol projects to copy from that showcases how i can use nim as js on the web? thx 🙏
03:44:41FromDiscord<pk.kyle> uh by copy i mean take reference of
04:12:28*def- quit (Quit: -)
04:14:30*def- joined #nim
04:18:33NimEventerNew thread by Tina: A strange behavior in seq, see https://forum.nim-lang.org/t/11425
04:24:03*fallback quit (Read error: Connection reset by peer)
04:27:38*fallback joined #nim
04:28:37*def- quit (Quit: -)
04:29:26*def- joined #nim
04:44:04*def- quit (Quit: -)
05:09:09*def- joined #nim
05:16:58*def- quit (Quit: -)
05:18:00*def- joined #nim
05:32:57*xet7 quit (Quit: Leaving)
05:36:23*def- quit (Quit: -)
05:37:26*def- joined #nim
06:27:51*def- quit (Quit: -)
06:45:48*def- joined #nim
07:41:51*KhazAkar joined #nim
07:59:15FromDiscord<queebee> Isn't there a all function somewhere? if all(for sub in strings: sub in line)
08:00:16FromDiscord<bung8954> how to do multiple `except A,B as err` ?
08:00:37FromDiscord<morgan> i just finally tonight figured out the bug that's been driving me crazy on my clap api stuff, and got working parameters in bitwig and reaper. im really happy to be able to make progress on it again
08:12:25FromDiscord<kots> In reply to @queebee "Isn't there a all": std/sequtils has all and allIt
08:40:14*def- quit (Quit: -)
08:41:06*def- joined #nim
09:21:52*def- quit (Quit: -)
09:22:48*def- joined #nim
09:34:34*def- quit (Quit: -)
09:41:44FromDiscord<jaar23> How to conditionally import when certain feature is enable?↵If user have install this lib or this lib is available, then import x.
09:42:11FromDiscord<jaar23> Can this be done during compile time checks?
09:45:57*coldfeet joined #nim
09:52:19FromDiscord<pmunch> You could try: `when compiles(import X): import x`
09:53:33FromDiscord<pmunch> Otherwise like I recommend for Futhark `when defined(useLibX): import x` enabled with `-d:useLibX`
09:56:07*def- joined #nim
09:59:13*def- quit (Client Quit)
10:17:00FromDiscord<jaar23> So when build, user should pass `- d:useLibX`?
10:18:02FromDiscord<jaar23> Can you point me some example for both? Very much appreciated
10:39:19*def- joined #nim
11:10:22FromDiscord<queebee> sent a code paste, see https://play.nim-lang.org/#pasty=voEIKElOBXPu
11:26:02*def- quit (Quit: -)
11:36:10*def- joined #nim
11:45:56*def- quit (Quit: -)
11:46:10*def- joined #nim
12:22:32*def- quit (Quit: -)
12:24:13*def- joined #nim
12:27:11*def- quit (Client Quit)
12:27:34*def- joined #nim
13:07:16FromDiscord<sOkam! 🫐> In reply to @pk.kyle "uh by copy i": `MIT`, `GPL` and friends literally mean "you can copy this"↵that mindset from school does not work in the real world
13:08:18FromDiscord<sOkam! 🫐> Sadly I don't know any↵But its honestly as simple as `nim js yourfile.nim` and adding the resulting `.js` file into your html as usual
13:25:04*coldfeet quit (Remote host closed the connection)
13:30:23FromDiscord<pk.kyle> In reply to @heysokam "`MIT`, `GPL` and friends": ah ic, i didn't get my head up to that stage, i thought ai wouldn't have much data on nim but turns out it works fine
13:30:51FromDiscord<pk.kyle> thanks
13:32:11FromDiscord<sOkam! 🫐> not gpt, GPL, lol 🙈
13:32:34FromDiscord<odexine> In reply to @heysokam "not gpt, GPL, lol": ChatGPL
13:32:45FromDiscord<sOkam! 🫐> In reply to @pk.kyle "ah ic, i didn't": not refering to any form of AI. i meant licenses
13:32:55FromDiscord<sOkam! 🫐> licenses are made to allow copying
13:33:00FromDiscord<pk.kyle> wait oops
13:33:02FromDiscord<pk.kyle> lolz
13:33:12FromDiscord<odexine> In reply to @heysokam "licenses are made to": Copying with terms mind you
13:33:54FromDiscord<sOkam! 🫐> In reply to @odexine "Copying with terms mind": sure thing, but definitely against the school mindset of "Do NOT COPY EVER OMG YOU ARE EEVIL STUDENT"
13:33:59FromDiscord<pk.kyle> hehe time to copy yes
13:34:40FromDiscord<odexine> In reply to @heysokam "sure thing, but definitely": I mean yeah, but the reasons are different as why copy or not
13:34:49FromDiscord<sOkam! 🫐> definitely
13:35:12FromDiscord<odexine> (edit) "as why copy" => "for “why copy”"
13:36:02FromDiscord<_nenc> In reply to @odexine "ChatGPL": what if chatgpt is really under gpl↵sadly it is not real
13:37:54FromDiscord<sOkam! 🫐> you might need to visit an alternate timeline to know if the "sadly" truly is accurate
13:47:25*fallback quit (Read error: Connection reset by peer)
13:51:02*fallback joined #nim
14:07:05*def- quit (Quit: -)
14:07:41*def- joined #nim
14:11:52FromDiscord<pk.kyle> how do i write a cstring string
14:11:57FromDiscord<pk.kyle> im new to dis dom thingy
14:14:58*def- quit (Quit: -)
14:15:38FromDiscord<pk.kyle> oh i figured it out `cstring"stuff"` but how do i make it shorter so i dont have to type `cstring` everytime
14:16:25FromDiscord<odexine> `type cs = cstring`↵`cs"test"` ↵Maybe
14:17:22FromDiscord<pk.kyle> ah thanks
14:33:07*def- joined #nim
14:40:16FromDiscord<pk.kyle> are there advantages to use func over procs?
14:40:39FromDiscord<pk.kyle> if so, should i just use `func` if there's no side effects for my function?
14:40:46FromDiscord<pk.kyle> (edit) "there's" => "there are"
14:43:32FromDiscord<odexine> In reply to @pk.kyle "are there advantages to": If you want to avoid bugs caused by side effects sure
15:35:31*def- quit (Quit: -)
15:35:56*def- joined #nim
15:38:50*def- quit (Client Quit)
15:39:09*def- joined #nim
15:48:38FromDiscord<pk.kyle> are there better ways to generate 2 unique random samples than shuffling the list and getting the first twos?
15:50:08*MacDefender joined #nim
15:51:13FromDiscord<Robyn [She/Her]> In reply to @pk.kyle "are there better ways": You could use a random number generator that has the max value set as the length of the list?
15:55:47FromDiscord<sOkam! 🫐> In reply to @pk.kyle "if so, should i": nim tags procs without sideeffects automatically as nosideffects↵but by using `func` you would enforce it on yourself, so you can catch things that you don't want to do
16:01:10FromDiscord<pk.kyle> In reply to @chronos.vitaqua "You could use a": wouldn't that repeat a random number?
16:02:03FromDiscord<pk.kyle> In reply to @heysokam "nim tags procs without": oh, cool. i thought it wouldn't optimize for me
16:02:52FromDiscord<sOkam! 🫐> In reply to @pk.kyle "oh, cool. i thought": optimization is not the usecase of func, in the case of nim↵its more for yourself, so you don't shoot yourself in the foot by a typo or mistake
16:02:52FromDiscord<Robyn [She/Her]> In reply to @pk.kyle "wouldn't that repeat a": It could have repeats yeah
16:03:30FromDiscord<sOkam! 🫐> I'm creating an object that is passed around the code into 20+ recursive functions↵Is there any benefit to passing it as a `proc thing(obj :var MyObj) ...` instead of returning the modified object from the function by `result = obj; result.thing = newthing`?
16:15:01FromDiscord<Robyn [She/Her]> In reply to @heysokam "I'm creating an object": Probably cleanliness, what would you prefer?
16:15:01FromDiscord<Robyn [She/Her]> `var Obj` could pair nicely with std/with too
16:16:36FromDiscord<sOkam! 🫐> In reply to @chronos.vitaqua "Probably cleanliness, what would": returns definitely
16:16:44FromDiscord<sOkam! 🫐> but im worried about duplicating all of that data around
16:16:48FromDiscord<sOkam! 🫐> (edit) "duplicating" => "duplicating/moving"
16:17:02FromDiscord<sOkam! 🫐> In reply to @chronos.vitaqua "`var Obj` could pair": how would that work?
16:20:37FromDiscord<Robyn [She/Her]> In reply to @heysokam "but im worried about": Could look into lent in Nim
16:20:37FromDiscord<Robyn [She/Her]> In reply to @heysokam "how would that work?": https://nim-lang.org/docs/with.html
16:21:33FromDiscord<Robyn [She/Her]> In reply to @chronos.vitaqua "https://nim-lang.org/docs/with.html": https://github.com/khchen/chain improves on this, too
16:25:33FromDiscord<sOkam! 🫐> In reply to @chronos.vitaqua "https://nim-lang.org/docs/with.html": I'm trying to unfuck the confusion cycle. i feel like this is going to worsen it by at least 2x or 3x
16:25:59FromDiscord<sOkam! 🫐> the code is already difficult to follow. that macro feels like its going to make that even worse 😦
16:26:36FromDiscord<Robyn [She/Her]> How so?
16:27:19FromDiscord<sOkam! 🫐> yeah definitely a big no https://media.discordapp.net/attachments/371759389889003532/1228743325595598889/image.png?ex=662d2765&is=661ab265&hm=02a9f6d1751af7e533c58d3c4860db061acf39ca3a269262dfe4623e9edd74ac&
16:27:27FromDiscord<sOkam! 🫐> that looks next level confusing
16:27:38FromDiscord<Robyn [She/Her]> sent a long message, see https://pasty.ee/YdkXxXHwKAMD
16:27:46FromDiscord<sOkam! 🫐> In reply to @chronos.vitaqua "How so?": because its a compiler. and compilers are already difficult to reason about and find their edge cases
16:28:12FromDiscord<sOkam! 🫐> it turned crazy confusing with just func/proc... imagine getting macros into the mix ⚰️ 🙈
16:28:49FromDiscord<Robyn [She/Her]> In reply to @heysokam "yeah definitely a big": That's fair, I'm planning on avoiding this type of syntax personally but chains seem nice
16:29:00FromDiscord<Robyn [She/Her]> In reply to @heysokam "it turned crazy confusing": Fair enough :p
16:29:04FromDiscord<sOkam! 🫐> the look great for simple logic, definitely
16:29:27FromDiscord<sOkam! 🫐> or for the usecase it was created, GUIs
16:35:37FromDiscord<polylokh_39446> In reply to @heysokam "I'm creating an object": if you go with `var MyObj` parameters and only occasionally don't want that, you can use https://nim-lang.org/docs/sugar.html#dup.m%2CT%2Cvarargs%5Buntyped%5D in the other case.
16:49:52FromDiscord<sOkam! 🫐> In reply to @polylokh_39446 "if you go with": loos interesting. but don't know how to use this so it is intuitive whats happening behind it 🤔
16:50:05FromDiscord<sOkam! 🫐> what would be an example you were thinking of?
17:01:16*def- quit (Quit: -)
17:20:31*def- joined #nim
17:55:57FromDiscord<nervecenter> sent a code paste, see https://play.nim-lang.org/#pasty=IAqUrmoilOyQ
17:56:22FromDiscord<nervecenter> (edit) "https://play.nim-lang.org/#pasty=gwXhlKNbaJOF" => "https://play.nim-lang.org/#pasty=IFelLIxZEcln"
17:58:37FromDiscord<sOkam! 🫐> In reply to @nervecenter "It might be what": correct, I understand this↵the question is not about UFCS, its about recursive usage of the `.dup` function he mentioned
17:59:39*def- quit (Quit: -)
18:00:55*def- joined #nim
18:04:02*def- quit (Client Quit)
18:05:12*MacDefender quit (Quit: WeeChat 4.2.2)
18:13:53FromDiscord<pax_audiogamer> hey, anyone can tell me how do I can cross compile from macOS to windows? I'm using an m1 mac.
18:16:15FromDiscord<Robyn [She/Her]> In reply to @nervecenter "It might be what": Wait you can return variables? Damn!
18:20:02FromDiscord<sOkam! 🫐> In reply to @pax_audiogamer "hey, anyone can tell": zigcc is the easiest by far
18:23:12*def- joined #nim
18:29:39FromDiscord<pax_audiogamer> In reply to @heysokam "zigcc is the easiest": how to use that?
18:29:47FromDiscord<sOkam! 🫐> In reply to @pax_audiogamer "how to use that?": https://github.com/enthus1ast/zigcc
18:30:57FromDiscord<nervecenter> In reply to @chronos.vitaqua "Wait you can return": Yup. I am ONLY use it here for chaining purposes, I'd otherwise never do it, even in an "OO" module
18:31:13FromDiscord<nervecenter> I like that Nim prefers referential transparency and I stick to it
18:31:29FromDiscord<nervecenter> (edit) removed "am" | "here" => "in the example"
18:35:41*def- quit (Quit: -)
18:36:04*def- joined #nim
18:41:08FromDiscord<Robyn [She/Her]> In reply to @nervecenter "Yup. I ONLY use": That's fair enough honestly
19:13:50FromDiscord<whisperecean> How does one clean nimble cache without deleting all the pkgs?
19:27:47FromDiscord<demotomohiro> Random number generater in Nim's stdlib has 2^128 - 1 period, and it would take years to generate so many random numbers.
19:28:52FromDiscord<demotomohiro> In reply to @pk.kyle "wouldn't that repeat a": Random number generater in Nim's stdlib has 2^128 - 1 period, and it would take years to generate so many random numbers.
20:00:29FromDiscord<sOkam! 🫐> In reply to @whisperecean "How does one clean": is that not the answer to the question itself?
20:01:00FromDiscord<sOkam! 🫐> what does "clean cache" mean without "deleting packages"?
20:49:31FromDiscord<planetis_m> How do you benchmark a macro?
20:52:38FromDiscord<Phil> As in you want to compare multiple different kinds of macros to see how they affect compile-time?
20:53:25FromDiscord<planetis_m> no I just want to see how long does it take to run a single macro
20:53:36FromDiscord<planetis_m> wait cpuTime seems to work at compile time?
20:54:25FromDiscord<Phil> Could just write a mini-program that uses the macro once, write a second mini-program that looks similar but does not use the macro, write a third program that triggers compile commands on the source code of the first and second, measures the cpuTime before and after triggering said command both times and subtract one from the other.
20:55:10FromDiscord<planetis_m> ok, sounds complicated but I will see what I can do
20:55:31FromDiscord<planetis_m> cpuTime - start in the macro outputs 0.0
20:56:39*def- quit (Quit: -)
20:58:08FromDiscord<Phil> I'd do the cpuTime calls entirely in the third program that triggers compile-commands to the other two
20:59:32FromDiscord<planetis_m> It works with --benchmarkVM https://forum.nim-lang.org/t/5261#52440
21:01:42FromDiscord<planetis_m> Also --profileVM
21:16:35*def- joined #nim
21:24:16*dv^_^ quit (Ping timeout: 268 seconds)
21:30:52*dv^_^ joined #nim
21:33:12*dv^_^ quit (Client Quit)
21:35:09*dv^_^ joined #nim
21:50:11*def- quit (Quit: -)
21:51:01*def- joined #nim
21:55:17*def- quit (Client Quit)
22:01:26*def- joined #nim
22:43:14*def- quit (Quit: -)
22:43:41*def- joined #nim
22:50:40*def- quit (Quit: -)
22:51:04*def- joined #nim
23:16:15*def- quit (Quit: -)
23:17:30*def- joined #nim
23:24:23FromDiscord<art.tyom> sent a code paste, see https://play.nim-lang.org/#pasty=ZUeHDKylBMWy
23:24:30FromDiscord<art.tyom> I read docs and it says that it automatically reads the file when I use addfiles
23:24:40FromDiscord<art.tyom> but when I check the site im uploading to the file is 0 bytes
23:26:23*def- quit (Quit: -)
23:26:56FromDiscord<art.tyom> nvm
23:26:59FromDiscord<art.tyom> just the site being weird
23:27:55*krux02 joined #nim
23:29:28*def- joined #nim
23:32:31*def- quit (Client Quit)
23:33:54*def- joined #nim