00:00:05 | FromDiscord | <Elegantbeef> First usage is stretch, but you get the point |
00:01:45 | FromDiscord | <inv> I would like special edition of the book from @ElegantBeef ๐ |
00:04:52 | * | nyeaa492842301 quit (Quit: Ping timeout (120 seconds)) |
00:05:10 | * | nyeaa492842301 joined #nim |
00:05:57 | FromDiscord | <Elegantbeef> Too much work to write a book, I do not have enough shitty jokes |
00:10:14 | FromDiscord | <Elegantbeef> This reminds me that I should work on my website a bit to make my writeups accessible |
00:46:08 | * | derpydoo joined #nim |
01:03:21 | * | oldpcuser_ joined #nim |
01:04:06 | * | xet7 joined #nim |
01:05:52 | * | oldpcuser quit (Ping timeout: 265 seconds) |
01:16:11 | FromDiscord | <SkynWalker> Hey guys kinda programming related question here. How do I go about storing huge numbers. Iโm trying to factor two 4 digit ints and itโs obviously not working. |
01:18:37 | * | oldpcuser_ is now known as oldpcuser |
01:19:46 | FromDiscord | <Arathanis> can't store a 4 digit int??? only have 14 bit integers? ๐ |
01:20:00 | FromDiscord | <Arathanis> (edit) "14" => "13" |
01:21:41 | FromDiscord | <Prestige> I think he means factorial of a 4 digit int |
01:22:42 | * | via_ is now known as via |
01:22:45 | FromDiscord | <Prestige> maybe |
01:26:42 | FromDiscord | <Arathanis> that woudl do it! |
01:26:52 | FromDiscord | <Arathanis> factorial of a 4 digit int makes a lot more sense |
01:27:08 | FromDiscord | <SkynWalker> Yes |
01:27:16 | FromDiscord | <SkynWalker> Like 9999 ^ 9999 |
01:27:17 | FromDiscord | <Prestige> that's going to be a veeerrrrry large number lol |
01:27:25 | FromDiscord | <SkynWalker> I am aware lol |
01:27:28 | FromDiscord | <Arathanis> well that is just extremely high powers |
01:27:34 | FromDiscord | <SkynWalker> Yes |
01:27:37 | FromDiscord | <Prestige> I thought he meant !9999 |
01:27:39 | FromDiscord | <Arathanis> yummy tasty RAM |
01:27:51 | FromDiscord | <SkynWalker> Ikr |
01:28:30 | FromDiscord | <Arathanis> ... https://media.discordapp.net/attachments/371759389889003532/1115452120250994688/image.png |
01:28:37 | FromDiscord | <SkynWalker> Is there any way to do it. Iโm fine with not storing it as is. I thought about dividing several times and having that division be a key to get back to the number |
01:28:44 | FromDiscord | <Arathanis> thats about 1/3 of the digits |
01:28:49 | FromDiscord | <SkynWalker> XD |
01:29:01 | FromDiscord | <Arathanis> not gonna take 3 more screen shots lol |
01:29:06 | FromDiscord | <SkynWalker> Lmaoo |
01:29:19 | FromDiscord | <SkynWalker> But any suggestions like I said Iโm open to doing things a different way |
01:29:33 | FromDiscord | <Arathanis> do it in a language that supports it out of the box? |
01:29:46 | FromDiscord | <Arathanis> or find some kind of BigInt lib |
01:29:51 | FromDiscord | <Arathanis> or roll your own |
01:30:01 | FromDiscord | <SkynWalker> I only know nim lol |
01:30:15 | FromDiscord | <SkynWalker> Iโm find rolling my own lib I just need a start on where to look |
01:30:24 | FromDiscord | <Arathanis> if you can do Nim syntax, you can do Python syntax and Python supports infinite precision ints out of the box |
01:30:50 | FromDiscord | <SkynWalker> I like compiled |
01:30:59 | FromDiscord | <SkynWalker> And sunk cost |
01:31:02 | FromDiscord | <SkynWalker> Iโve come this far |
01:31:04 | FromDiscord | <Arathanis> https://media.discordapp.net/attachments/371759389889003532/1115452766203170896/image.png |
01:31:13 | FromDiscord | <Prestige> yeah write your own library for it |
01:31:22 | FromDiscord | <SkynWalker> How would one go about that |
01:31:33 | FromDiscord | <SkynWalker> Not asking for a tutorial just a start on where to look |
01:31:38 | FromDiscord | <Arathanis> In reply to @SkynWalker "How would one go": basically you store your big ints as a sequence of ints |
01:31:54 | FromDiscord | <Arathanis> and each in in the sequence represents a different set of the digits |
01:32:02 | * | via is now known as via_ |
01:32:10 | FromDiscord | <Arathanis> since digits in binary are bits |
01:32:38 | FromDiscord | <SkynWalker> Yes? |
01:32:43 | FromDiscord | <Arathanis> a len 4 seq is enough to store 256 binary digits |
01:33:00 | FromDiscord | <Arathanis> and so on and so forth |
01:33:11 | FromDiscord | <SkynWalker> How would I perform math on that such that it still acts as a full number |
01:33:24 | FromDiscord | <Arathanis> 1 int at a time, adjusting for potential carry |
01:33:41 | FromDiscord | <Arathanis> you my friend are one of today's luck 10,000 that get to look up how the adder in a CPU works |
01:33:51 | FromDiscord | <Arathanis> and then make one in software to support infinite precision integers |
01:34:02 | FromDiscord | <SkynWalker> That seems really fucking hard |
01:34:07 | FromDiscord | <Arathanis> not as hard as you think |
01:34:17 | FromDiscord | <SkynWalker> Aight |
01:34:18 | FromDiscord | <Arathanis> its all boolean logic under the hood |
01:34:28 | FromDiscord | <SkynWalker> This is becoming harder and harder by the day |
01:34:37 | FromDiscord | <SkynWalker> โItโll be done by lunchโ four days later |
01:34:51 | FromDiscord | <Arathanis> at the core of it, CPU adders are just a chain of 1 bit adders |
01:35:01 | FromDiscord | <Arathanis> 1 bit adders have 2 inputs and 2 outputs |
01:35:09 | FromDiscord | <Arathanis> the 2 inputs are the bits to add |
01:35:13 | * | via_ is now known as via |
01:35:18 | FromDiscord | <Arathanis> and the outputs are a result digit and a carry |
01:35:19 | FromDiscord | <SkynWalker> Wait could I wrap Python code in nim |
01:35:36 | FromDiscord | <Arathanis> 0 + 0 = 0,0โต0 + 1 = 1,0โต1 + 0 = 1,0โต1 + 1 = 0,1 |
01:35:50 | FromDiscord | <Arathanis> the combine them, you include a 3rd input that is the previous carry bit |
01:35:52 | FromDiscord | <Arathanis> and chain them together |
01:35:57 | FromDiscord | <Arathanis> and that is how computers add |
01:36:01 | FromDiscord | <SkynWalker> Gotcha |
01:36:14 | FromDiscord | <Arathanis> In reply to @SkynWalker "Wait could I wrap": if you are going to wrap Python in Nim, just use Python |
01:36:31 | FromDiscord | <SkynWalker> But I wanna compile and not have to rewrite all my code |
01:36:33 | FromDiscord | <Arathanis> because you won't be able to bring your huge ints outside of Python without a big int library |
01:36:44 | FromDiscord | <Arathanis> so you are just going to be writing a bunch of nim code that statically compiles |
01:36:49 | FromDiscord | <Arathanis> and then just runs in the python interpreter |
01:36:55 | FromDiscord | <Arathanis> so you are basically going to do it all in python anyway |
01:36:59 | FromDiscord | <SkynWalker> Well shit |
01:37:13 | FromDiscord | <Arathanis> with the additional complexity of actually running it through Nim |
01:37:26 | FromDiscord | <SkynWalker> Damn |
01:37:44 | FromDiscord | <Arathanis> Python syntax and expressiveness is extremely similar to Nim |
01:37:52 | FromDiscord | <Arathanis> or more accuratly, Nim syntax is extremely similar to Python |
01:37:55 | FromDiscord | <Arathanis> you will gt it super fast |
01:38:19 | FromDiscord | <Arathanis> and im totally willing to help, I am a professional Python dev so I've got you, if you want it |
01:38:31 | FromDiscord | <Arathanis> (edit) "accuratly," => "accurately," |
01:38:34 | FromDiscord | <Prestige> write your own library so we could all use it and avoid python |
01:38:46 | FromDiscord | <Arathanis> nothing is wrong with either language ๐ |
01:38:55 | FromDiscord | <SkynWalker> How bout someone else write cause Iโm an idiot |
01:39:48 | FromDiscord | <SkynWalker> Alright boys |
01:39:55 | FromDiscord | <SkynWalker> Thanks for the lead imma see what I can do |
01:40:02 | FromDiscord | <Arathanis> GL |
01:40:08 | FromDiscord | <SkynWalker> Thank you |
01:40:18 | FromDiscord | <SkynWalker> See you in a couple hours when I get stuck again lol |
01:46:33 | FromDiscord | <Elegantbeef> Oh that explains it! ๐โต(@Arathanis) |
01:47:31 | FromDiscord | <Arathanis> In reply to @Elegantbeef "Oh that explains it!": you can't hurt me when I was expecting your condescension ๐ |
01:48:09 | FromDiscord | <Arathanis> some of my coworkers clown on me about Nim lol |
01:49:25 | FromDiscord | <Elegantbeef> Sure but if they could code they'd maybe understand what they were insulting |
01:49:58 | FromDiscord | <Arathanis> oh its not just Python devs. |
01:50:14 | FromDiscord | <Arathanis> they clown on me about it because I always bring it. |
01:50:14 | FromDiscord | <Elegantbeef> "Also JS devs" |
01:50:23 | FromDiscord | <Arathanis> C/C++/C# mostly |
01:50:28 | FromDiscord | <etra> In reply to @SkynWalker "Not asking for a": Crystal binds to GMP which seems to handle arbitrarily large numbers |
01:50:39 | FromDiscord | <Arathanis> no JS devs we all hate JS |
01:50:52 | FromDiscord | <Arathanis> is anyone a JS dev by choice? |
01:51:08 | FromDiscord | <Arathanis> (edit) "it." => "it up." |
01:54:14 | FromDiscord | <Arathanis> so to be clear everyone ive shown Nim to is interested and asks me for some links and direction which i do as best I can. The clowning comes cause I won't stop bringing it up ๐ |
01:54:45 | FromDiscord | <Arathanis> > Hmm, looks like we need something to do X, might be a significant lift...โตโตme:โต> well if we just did it in Nim... |
01:59:08 | * | xet7 quit (Ping timeout: 246 seconds) |
02:07:45 | * | def- quit (Quit: -) |
02:08:31 | * | def- joined #nim |
02:12:26 | * | xet7 joined #nim |
02:14:05 | FromDiscord | <Graveflo> In reply to @Arathanis "C/C++/C# mostly": A python dev that shits on C is not a python dev they are a python apprentice |
02:16:09 | FromDiscord | <Arathanis> Where did I shit on C? |
02:16:13 | FromDiscord | <Graveflo> that being said I hate writing C especially for the build systems |
02:16:21 | FromDiscord | <Elegantbeef> How about a Nim dev that shits on C? |
02:16:32 | FromDiscord | <Graveflo> I didn't say you did. Didn't you say that your co-workers do? |
02:16:42 | FromDiscord | <Arathanis> no they arent shitting on anything |
02:16:48 | FromDiscord | <Arathanis> they are clowning on me for always bringing Nim up |
02:16:54 | FromDiscord | <Arathanis> except for maybe JS |
02:17:01 | FromDiscord | <Arathanis> but shitting on JS is part of being a SWE |
02:17:04 | FromDiscord | <Graveflo> well thats ok. I think Nim's posture is more overbearing on Cs existence then python is |
02:17:37 | * | rockcavera quit (Remote host closed the connection) |
02:18:22 | FromDiscord | <Graveflo> its not like python where eventually you will come crawling back to C when you need to. Nim is more like an attempt to bury C under itself instead of outgrow it |
02:18:45 | FromDiscord | <Arathanis> I replaced going to C when I need to with going to Nim when I need to ๐ |
02:19:24 | FromDiscord | <Graveflo> Yea that and embedded is why I am here. I think I might be in for more then I bargained for though |
02:20:08 | FromDiscord | <Arathanis> In reply to @Elegantbeef "How about a Nim": Wouldn't that be like praising the virtues of your brick and hard wood house and shitting on the inelgance of concrete while your house's foundation is indeed built upon concrete? |
02:20:12 | FromDiscord | <Graveflo> I hated python for a very long time when I first started using it. I don't think I would ever let it go now that I actually understand how to use it, but muh |
02:20:44 | FromDiscord | <Arathanis> I was part of the Python hate train until I actually gave it a chance, then it rapidly became my favorite language and I've made a career out of it. |
02:20:59 | FromDiscord | <Arathanis> turns out I was listening to idiots and taking their word for it when I should have formed my own opinions |
02:21:01 | FromDiscord | <Arathanis> who knew? |
02:27:29 | FromDiscord | <Elegantbeef> Nah @Arathanis you can rely on something but still say it's shit |
02:28:12 | FromDiscord | <Graveflo> words to live by the beef way |
02:28:18 | * | deadmarshal_ quit (Ping timeout: 250 seconds) |
02:29:37 | FromDiscord | <Arathanis> In reply to @Elegantbeef "Nah <@136570191038513152> you can": i dont disagree |
02:29:55 | FromDiscord | <Arathanis> like healthcare in the usa |
02:44:13 | FromDiscord | <Prestige> usa has great health care but you have to spend one leg to save the other |
02:44:31 | FromDiscord | <Prestige> Just like python |
02:50:58 | * | krux02 quit (Remote host closed the connection) |
03:19:40 | * | boxuser joined #nim |
03:28:18 | FromDiscord | <SkynWalker> Gentlemen |
03:29:14 | FromDiscord | <Graveflo> ๐ถ |
03:29:41 | FromDiscord | <!&luke> I'm using owlkettle to create some apps, I came back to it after a couple weeks, but now it is taking much longer than usual to launch the app, is there any fix. I am on the head version |
03:38:06 | FromDiscord | <Elegantbeef> The program is slower or compilation is slower? |
03:40:29 | * | deadmarshal_ joined #nim |
03:45:34 | FromDiscord | <!&luke> Both actually although the compile time isn't that big of a problem for my usecase |
03:46:32 | FromDiscord | <Elegantbeef> Is your program doing anything that would slow the time between program start and the window being created? |
03:50:04 | FromDiscord | <!&luke> No I can send you my code if that would help |
03:50:19 | FromDiscord | <Elegantbeef> Sure |
03:52:18 | FromDiscord | <!&luke> https://media.discordapp.net/attachments/371759389889003532/1115488308479397888/message.txt |
03:54:57 | FromDiscord | <Elegantbeef> It's instant |
03:55:40 | FromDiscord | <Elegantbeef> Have you updated your packages, could it perhaps be an issue with some upstream gtk/adwaita? |
03:55:58 | FromDiscord | <Graveflo> In reply to @ripluke "": are you using XFCE4 on arch? |
03:57:00 | FromDiscord | <Graveflo> bc I've had gtk windows lag for a long ass time before opening in that environment. In kde and gnome they work fine |
03:57:21 | FromDiscord | <Arathanis> In reply to @ripluke "": you are making sure to compile with `-d:release` right? |
04:05:48 | * | deadmarshal_ quit (Ping timeout: 250 seconds) |
04:10:54 | FromDiscord | <!&luke> In reply to @Arathanis "you are making sure": yup |
04:11:09 | FromDiscord | <!&luke> In reply to @Elegantbeef "Have you updated your": ill try that |
04:11:38 | FromDiscord | <!&luke> In reply to @Graveflo "are you using XFCE4": i am on arch but dont even have xfce installed, im using a tiling wm |
04:12:22 | FromDiscord | <Graveflo> ok well xfce is the only wm I use with x11 and recently I've had some startup lag on certain gtk apps there. Prob not related but js |
04:14:00 | FromDiscord | <demotomohiro> In reply to @SkynWalker "Like 9999 ^ 9999": Doesn't this work for it? https://nimdocs.com/nim-lang/bigints/bigints.html#pow%2CBigInt%2CNatural |
04:26:35 | * | m5zs7k quit (Ping timeout: 250 seconds) |
04:27:04 | * | m5zs7k joined #nim |
04:32:09 | FromDiscord | <Stuffe> Does anyone have an idea why nim wont compile my project with the error `error: call to undeclared function 'NimMain';` |
04:32:20 | FromDiscord | <Stuffe> only when I compile with -d:release |
04:32:28 | FromDiscord | <Arathanis> compiling to c++? |
04:32:39 | FromDiscord | <Arathanis> is it a dll? |
04:32:46 | FromDiscord | <Stuffe> yes it is a dll |
04:33:02 | FromDiscord | <Arathanis> and cpp? |
04:33:13 | FromDiscord | <Stuffe> sent a code paste, see https://play.nim-lang.org/#ix=4xzj |
04:33:19 | FromDiscord | <Stuffe> (tried without the noMain thing) |
04:33:29 | FromDiscord | <Stuffe> In reply to @Arathanis "and cpp?": I thought nim used C? |
04:33:36 | FromDiscord | <Arathanis> it defaults to C |
04:33:44 | FromDiscord | <Arathanis> but it can do obj-c, cpp, and js |
04:33:56 | FromDiscord | <Arathanis> your best bet is to have a proc called "initialize" or "init" |
04:34:00 | FromDiscord | <Arathanis> for your lib |
04:34:01 | FromDiscord | <Arathanis> your choice |
04:34:01 | FromDiscord | <Arathanis> that you export |
04:34:05 | FromDiscord | <Arathanis> and inside it do |
04:34:14 | FromDiscord | <Arathanis> sent a code paste, see https://play.nim-lang.org/#ix=4xzk |
04:34:25 | FromDiscord | <Arathanis> this is how ive always done it |
04:34:48 | FromDiscord | <Stuffe> i am confused why it didn't happen before |
04:34:53 | FromDiscord | <Stuffe> but anyway let me try that |
04:35:40 | FromDiscord | <Arathanis> sent a code paste, see https://play.nim-lang.org/#ix=4xzl |
04:35:48 | FromDiscord | <Stuffe> ok thanks |
04:35:51 | FromDiscord | <Arathanis> yup |
04:36:03 | FromDiscord | <Arathanis> and if it still complains wait for beef to get back ๐ |
04:36:13 | FromDiscord | <Elegantbeef> Back |
04:36:16 | FromDiscord | <Elegantbeef> I never leave! |
04:36:42 | FromDiscord | <Arathanis> In reply to @Stuffe "i am confused why": might be choice of GC? |
04:36:57 | FromDiscord | <Arathanis> NimMain is still a bit of a mystery to me, my understanding is it inits all the nim runtime stuff like the GC |
04:37:10 | FromDiscord | <Stuffe> I have no choice because I am using godot-nim |
04:37:19 | FromDiscord | <Stuffe> but it was working for like a year |
04:37:22 | FromDiscord | <Stuffe> until an hour ago |
04:37:56 | FromDiscord | <Stuffe> In reply to @Arathanis "your best bet is": sorry I didn't get it to work, could you show exactly what you mean so I can try and copy paste just in case |
04:38:48 | FromDiscord | <Arathanis> sent a code paste, see https://play.nim-lang.org/#ix=4xzn |
04:38:55 | FromDiscord | <Arathanis> and before you do anything else with the lib you need to call that function |
04:39:26 | FromDiscord | <Arathanis> oh sorry, needs `exportc` pragma too |
04:39:28 | FromDiscord | <Stuffe> https://media.discordapp.net/attachments/371759389889003532/1115500176111587358/Screenshot_2023-06-06_at_11.39.07_AM.png |
04:39:40 | FromDiscord | <Stuffe> In reply to @Arathanis "and before you do": but it doesn't even compile |
04:39:49 | FromDiscord | <Arathanis> what is it complaining about? |
04:39:53 | FromDiscord | <Arathanis> still nim main? |
04:40:04 | FromDiscord | <Graveflo> i see an importc on nimmain |
04:40:10 | FromDiscord | <Stuffe> sent a code paste, see https://play.nim-lang.org/#ix=4xzo |
04:40:15 | FromDiscord | <Stuffe> sent a code paste, see https://play.nim-lang.org/#ix= |
04:40:40 | FromDiscord | <Arathanis> ive had to exportc on NimMain as well for mysterious reasons... could also try that |
04:40:51 | * | boxuser quit (Read error: Connection reset by peer) |
04:41:09 | FromDiscord | <Arathanis> but ive only had to do that with cpp |
04:41:11 | FromDiscord | <Arathanis> (edit) "but ive only had to do that with cpp ... " added "backend" |
04:41:17 | FromDiscord | <Arathanis> so i imagine that is not the issue here |
04:42:07 | FromDiscord | <Stuffe> sent a code paste, see https://play.nim-lang.org/#ix=4xzp |
04:42:15 | FromDiscord | <Stuffe> it didn't work either |
04:42:16 | FromDiscord | <Arathanis> you dont want to override what NimMain does |
04:42:36 | FromDiscord | <Stuffe> the thing is that it is a dynamic library, it isn't even supposed to have a main |
04:42:46 | FromDiscord | <Elegantbeef> Right but NimMain isnt main |
04:42:55 | FromDiscord | <Elegantbeef> It's the top level code that you need to call and things to intialise |
04:42:58 | FromDiscord | <Arathanis> yes but all of Nim's GC and runtime has to init |
04:43:04 | FromDiscord | <Arathanis> if you dont call it your app will explode |
04:43:04 | FromDiscord | <Stuffe> I see |
04:43:10 | FromDiscord | <Elegantbeef> "all of Nim's gc an runtime" isnt accurate |
04:43:18 | FromDiscord | <Elegantbeef> arc/orc do not require intialisation |
04:43:22 | FromDiscord | <Arathanis> please make it accurate |
04:43:31 | FromDiscord | <Arathanis> i just know it needs to happen for init reasons at some point |
04:43:39 | FromDiscord | <Arathanis> what exactly does it init so I can be accurate here |
04:43:51 | FromDiscord | <Arathanis> some point being: first thing lol |
04:43:51 | FromDiscord | <Elegantbeef> With arc/orc the only reason you need to call NimMain is to call top level code |
04:43:53 | FromDiscord | <Stuffe> In reply to @Arathanis "you dont want to": could you explain exactly what I should try then? |
04:44:03 | FromDiscord | <Elegantbeef> Use `--gc:orc` |
04:44:13 | FromDiscord | <Arathanis> ive given you how i solved my struggle, try what beef is suggesting. use the orc mm |
04:44:25 | FromDiscord | <Arathanis> In reply to @Elegantbeef "Use `--gc:orc`": isn't it technically `--mm:orc` |
04:44:27 | FromDiscord | <Elegantbeef> Ensure you're using modern nim and not nim 0.18.x |
04:44:28 | FromDiscord | <Stuffe> i can't, the library I am using is forcing me to use the real time gc thing :/ |
04:44:29 | FromDiscord | <Arathanis> i always get deprecation complaints |
04:44:40 | FromDiscord | <Elegantbeef> it's mm now |
04:44:46 | FromDiscord | <Stuffe> In reply to @Elegantbeef "Ensure you're using modern": I am on 1.6.10 |
04:44:54 | FromDiscord | <Elegantbeef> Go to stable nim |
04:45:05 | FromDiscord | <Arathanis> which one is realtime gc? |
04:45:08 | FromDiscord | <Elegantbeef> People will do anything but update their software |
04:45:19 | FromDiscord | <Arathanis> In reply to @Elegantbeef "People will do anything": i get pissed off when someone wont let me update |
04:45:24 | FromDiscord | <Arathanis> and will look for replacements |
04:45:36 | FromDiscord | <Arathanis> (edit) "someone" => "someone/something" |
04:46:07 | FromDiscord | <Elegantbeef> How to say you use arch without saying it |
04:46:10 | FromDiscord | <Elegantbeef> Or maybe gentoo |
04:47:05 | FromDiscord | <Stuffe> I am on version 1.6.12 now |
04:47:09 | FromDiscord | <Stuffe> still having the same issue |
04:47:18 | FromDiscord | <Elegantbeef> Compile with `-f` |
04:47:23 | FromDiscord | <Stuffe> ok |
04:47:41 | FromDiscord | <Elegantbeef> If that doesnt work, what godot library are you using? |
04:47:57 | FromDiscord | <Stuffe> it didn't work :/ |
04:48:01 | FromDiscord | <Stuffe> I am using godot-nim |
04:48:15 | FromDiscord | <Elegantbeef> That doesnt require realtimegc iirc |
04:48:30 | FromDiscord | <Stuffe> it does, I guarantee you |
04:48:36 | FromDiscord | <Arathanis> which gc are you relying on? |
04:48:37 | FromDiscord | <Stuffe> I have been working with it for a year |
04:48:37 | FromDiscord | <Stuffe> every day |
04:48:59 | FromDiscord | <Elegantbeef> that's refc with some magic schtuffโต(@Arathanis) |
04:49:00 | FromDiscord | <Stuffe> -d:useRealtimeGc |
04:49:11 | FromDiscord | <Elegantbeef> I swear i've used godot-nim with orc before |
04:49:15 | FromDiscord | <Elegantbeef> Might be a fever dream |
04:49:18 | FromDiscord | <Arathanis> ah got it so its refc + that flag |
04:49:48 | FromDiscord | <Stuffe> In reply to @Elegantbeef "I swear i've used": I think there are some hard coded hacks to get the 2 gcs to work |
04:50:04 | FromDiscord | <Stuffe> I really want to upgrade to godot 4 and use the new library being worked on here |
04:50:25 | FromDiscord | <Stuffe> and then switch to orc as well |
04:50:35 | FromDiscord | <Stuffe> but it isn't quite ready yet I think |
04:50:58 | FromDiscord | <Stuffe> however, its quite strange that this stopped working all of a sudden |
04:51:02 | FromDiscord | <Elegantbeef> Yea I do not know what to say there isnt any reason for this issue |
04:51:06 | FromDiscord | <Elegantbeef> Is the code open? |
04:52:02 | FromDiscord | <Stuffe> you mean open source? no sorry its a game |
04:52:19 | FromDiscord | <Stuffe> maybe the mac udpate updated clang or something, really have no idea |
04:52:26 | FromDiscord | <Elegantbeef> Meanwhile my game is open ๐ |
04:52:37 | FromDiscord | <Stuffe> which game is that? |
04:52:41 | FromDiscord | <Elegantbeef> Yea no clue aside from clang changes really |
04:52:48 | FromDiscord | <Elegantbeef> Nothing as good as turing complete |
04:53:01 | FromDiscord | <Stuffe> thanks ๐ |
04:53:01 | FromDiscord | <Elegantbeef> My in development gameplay lacking game |
04:53:37 | FromDiscord | <Stuffe> its quite hard to make a full time living with an open source game i think |
04:53:58 | FromDiscord | <Elegantbeef> You know you can still sell the game ๐ |
04:54:15 | FromDiscord | <Stuffe> true I guess |
04:54:23 | FromDiscord | <Elegantbeef> mindustry for instance has a free java release but the steam release exists with steam api |
04:54:25 | FromDiscord | <Arathanis> just because you share the source doesn't mean you can't have a "fuck you pay me" license |
04:54:37 | FromDiscord | <Elegantbeef> barony is fully FOSS but the assets are paid on steam |
04:54:45 | FromDiscord | <Arathanis> i love barony |
04:54:49 | FromDiscord | <Elegantbeef> Meh arth that's not even the point |
04:55:00 | FromDiscord | <spotlightkid> I'm on Manjaro and after the latest round of package updates, suddenly all GTK programs (e.g. thunderbird and firefox) took \>20s to start up. After some online research, this turns out to be some problem/conflict with flatpack dbus "portals". I was able to fix the problem by de-installing the package `xdg-desktop-portal-gnome`.โต(@!&luke) |
04:55:13 | FromDiscord | <huantian> I love beans |
04:55:17 | FromDiscord | <Elegantbeef> Even a gpl3 game like barony can be fully OSS cause it doesnt ship the assets |
04:55:48 | FromDiscord | <Elegantbeef> But mindustry ships precompiled java builds just without steam intergration on their github |
04:56:12 | FromDiscord | <Elegantbeef> So open source games can exist and sell, I'm just not a good metric since I do not have any finished games that I think are worth selling |
04:56:46 | FromDiscord | <Arathanis> the day beef decides they can make money by selling their Nim help is the day we are all collectively sent to back to the stoneage. |
04:56:55 | FromDiscord | <Elegantbeef> Lol |
04:57:21 | FromDiscord | <Elegantbeef> If only I had something marketable |
04:57:21 | FromDiscord | <Arathanis> > the nim help is free, the condescending remarks will cost you |
04:57:39 | FromDiscord | <Arathanis> ๐ |
04:57:59 | FromDiscord | <Graveflo> if you tip him he might even throw in some sarcasm |
04:58:11 | FromDiscord | <Elegantbeef> I'd never |
04:59:30 | * | ntat joined #nim |
05:04:57 | * | derpydoo quit (Ping timeout: 268 seconds) |
05:21:55 | FromDiscord | <Graveflo> when I try to pass something into a macro in the same way you would specify a type for a generic I just get something that equates to "GenericParam" whatever that is. I can't seem to inspect it's type. It doesn't have an obvious way of utilizing the type that I used when calling the macro. What is that? |
05:24:42 | FromDiscord | <Elegantbeef> Best to just pass the type in as a parameter |
05:25:18 | FromDiscord | <Graveflo> its already way uglier then I would have hoped. I think it might be hideous if I do that |
05:26:28 | * | boxuser joined #nim |
05:32:09 | FromDiscord | <HitBlast> Is it possible to have multiple return types inside a Nim procedure? |
05:32:41 | FromDiscord | <Arathanis> you could use an object variant |
05:32:43 | FromDiscord | <demotomohiro> How about to use a tuple as return type. |
05:33:37 | FromDiscord | <demotomohiro> Multiple return types means you want to return them at same time or one of them at a time? |
05:33:54 | FromDiscord | <HitBlast> one of them at a time |
05:34:01 | FromDiscord | <Arathanis> object variant |
05:34:48 | FromDiscord | <demotomohiro> Or use type class like `string or int` if return type can be determined at compile time. |
05:35:36 | * | deadmarshal_ joined #nim |
05:36:54 | FromDiscord | <Arathanis> though usually wanting multiple return types is a sign you need to reconsider your design |
05:36:57 | FromDiscord | <Arathanis> but not every time |
05:50:39 | * | xaltsc quit (Ping timeout: 250 seconds) |
06:04:11 | NimEventer | New thread by hunterbr: End of function in Nim binary, see https://forum.nim-lang.org/t/10250 |
06:07:23 | FromDiscord | <Rika> :thinkDrops: |
06:09:38 | FromDiscord | <demotomohiro> Why they want end of function? |
06:29:59 | FromDiscord | <that_dude> sent a code paste, see https://play.nim-lang.org/#ix=4xzD |
06:32:17 | * | boxuser quit (Read error: Connection reset by peer) |
06:32:28 | FromDiscord | <Arathanis> you dont like SIGSEGV |
06:32:32 | FromDiscord | <Arathanis> (edit) "SIGSEGV" => "SIGSEGV?" |
06:33:13 | FromDiscord | <that_dude> It makes me try |
06:33:16 | FromDiscord | <that_dude> (edit) "try" => "cry" |
06:33:46 | FromDiscord | <Arathanis> yeah its not the best, but with experience you get used to it and can quickly pick out what happened |
06:34:09 | FromDiscord | <Elegantbeef> I mean I'm a bit lost at what the issue is ๐ |
06:34:19 | FromDiscord | <Elegantbeef> You asked for a stack object, then changed it to a ref and it errored no? |
06:34:40 | FromDiscord | <Arathanis> In reply to @Elegantbeef "I mean I'm a": some people want the error message to be something like "you didnt init a Thing!" |
06:34:47 | FromDiscord | <that_dude> Bro I don't even care about stack vs heap. I just want it to work lol |
06:35:11 | FromDiscord | <Elegantbeef> For that to work would imply all references defaulting to allocated |
06:35:23 | FromDiscord | <Arathanis> with a little experience they will learn that SigSegV means "you tried to access memory that isn't yours" and that in turn means they forgot to init something (or access something that was already destroyed) |
06:35:44 | FromDiscord | <Elegantbeef> sent a code paste, see https://play.nim-lang.org/#ix=4xzG |
06:36:05 | FromDiscord | <Arathanis> im not arguing that it should work this way, its just what some people expect. |
06:36:11 | FromDiscord | <that_dude> ^ |
06:36:19 | FromDiscord | <Elegantbeef> They said "I just want it to work" |
06:36:20 | FromDiscord | <Arathanis> i think SigSegV is totally fine |
06:36:36 | FromDiscord | <that_dude> Nah it's fine, you just have to understand the internals better |
06:36:38 | FromDiscord | <Arathanis> you foot gun yourself like this once and either choose to learn, or decide not too ๐ |
06:36:59 | FromDiscord | <Arathanis> (edit) "too" => "to" |
06:37:33 | FromDiscord | <that_dude> The thing was that the type was much more complex and I was initially getting the sigsegv when trying to iterate a seq |
06:37:36 | FromDiscord | <Arathanis> some people didn't learn staring with C and it shows ๐ |
06:37:41 | FromDiscord | <Arathanis> (edit) "staring" => "starting" |
06:37:53 | FromDiscord | <that_dude> batch -> python -> nim bb |
06:37:58 | FromDiscord | <Elegantbeef> Wait you can tell I have never wrote C? |
06:37:59 | FromDiscord | <Arathanis> batch |
06:38:01 | FromDiscord | <Arathanis> you poor soul |
06:38:14 | FromDiscord | <Arathanis> im so sorry |
06:38:39 | FromDiscord | <that_dude> I was in elementary lol. I never got to for loops, I wrote a pokemon battle sim-ish thing with nothing but global vars and gotos |
06:38:43 | FromDiscord | <Arathanis> In reply to @Elegantbeef "Wait you can tell": C as a stand in for "languages that make/let you do manual memory" |
06:38:58 | FromDiscord | <Elegantbeef> I've only seriously written C# and Nim |
06:39:33 | FromDiscord | <Arathanis> C# is interesting |
06:41:26 | FromDiscord | <Arathanis> wait, beef you did C#??? |
06:41:32 | FromDiscord | <Arathanis> Did you use Visual Studio????? |
06:41:38 | FromDiscord | <Elegantbeef> No |
06:42:02 | FromDiscord | <Arathanis> whata toolchain did you use? |
06:42:07 | FromDiscord | <Elegantbeef> Yes my entry into programming was Unity, so I learned C# |
06:43:02 | FromDiscord | <Arathanis> ahhhhh |
06:43:09 | FromDiscord | <Arathanis> gotcha |
06:44:11 | FromDiscord | <Arathanis> exit |
06:44:20 | FromDiscord | <Arathanis> oops |
06:44:22 | FromDiscord | <Rika> heres your missing slash / |
06:48:22 | FromDiscord | <Graveflo> I loved C# when I found it, but at that time I only new vb6 well and I was reading about java |
06:48:56 | * | PMunch joined #nim |
06:50:32 | FromDiscord | <Arathanis> for every 2 or 3 things about C# I love |
06:50:36 | FromDiscord | <Arathanis> it has some horrible blemish |
06:52:10 | FromDiscord | <Graveflo> I ditched it before I knew enough to heavily scrutinize it |
06:52:59 | * | boxuser joined #nim |
06:53:39 | FromDiscord | <Graveflo> and also it's such a weird language. I think I can excuse C++s confused nature by the environment/time it was built for. A little bit of that with C# but honestly they should have known better |
06:57:54 | * | ntat_ joined #nim |
06:58:07 | * | ntat quit (Ping timeout: 240 seconds) |
07:07:32 | PMunch | Weren't they just desperately copying Java at the time it was created? |
07:08:30 | FromDiscord | <Graveflo> I've heard people say that. I guess its the jit and it heavily object oriented |
07:10:20 | FromDiscord | <Elegantbeef> C# started off as J# |
07:10:24 | FromDiscord | <Elegantbeef> It was microsoft's java |
07:10:41 | FromDiscord | <Graveflo> oh so it was literally |
07:11:09 | FromDiscord | <Elegantbeef> Yes but now it's in a much better place than java |
07:11:21 | FromDiscord | <Elegantbeef> Having structs and non 32bit sized primitives ๐ |
07:11:57 | FromDiscord | <Graveflo> that's not saying much. I think js is my most disliked language I've ever had the displeasure of spending a lot of time in, but id say modern js is better then C# |
07:12:36 | FromDiscord | <Elegantbeef> I disagree, C# is statically typed and can be fast ๐ |
07:12:51 | FromDiscord | <Graveflo> but there are better languages for that |
07:14:26 | FromDiscord | <Graveflo> and I would be very surprised if it does that better then C, Rust or Nim |
07:22:18 | PMunch | "can be fast" |
07:23:21 | PMunch | It's mostly all the cruft that's built on top for you typical OO/C# application which is the issue for speed. It also makes the codebase really hard to read.. |
07:26:01 | FromDiscord | <Graveflo> I'm curious how a nim codebase could be considered easy to read when procs can bind in so many places? To be clear no one likes tangled inheritance spaghetti but at least it does a good job of keeping things in predictable places... usually. I would like to get a tip for reading nim code if you have one ๐ |
07:28:24 | FromDiscord | <Elegantbeef> It's very easy to read you import modules then just read code, does it really matter where a proc comes from when you're reading? |
07:30:23 | FromDiscord | <Graveflo> well if you are reading it you know where it is bc ur looking at it. I'm saying its hard to know exactly where a proc call will jump to in a given scenario |
07:30:41 | FromDiscord | <Graveflo> or it can be |
07:30:42 | FromDiscord | <Elegantbeef> That's where tooling is supposed to be |
07:30:48 | FromDiscord | <Graveflo> I KNOW T>T |
07:30:55 | FromDiscord | <lyhokia> sent a code paste, see https://play.nim-lang.org/#ix=4xzS |
07:31:15 | FromDiscord | <Elegantbeef> Generate an entire type section in your macro |
07:31:33 | FromDiscord | <lyhokia> I'm not the writer of the libirary so probably that's hard to do as well |
07:32:01 | FromDiscord | <leorize> alternatively you can use generics |
07:32:36 | FromDiscord | <lyhokia> The type is actually recursive in the real use case so I can't strip one type out to be a generic |
07:33:00 | FromDiscord | <Elegantbeef> Then the solution is to PR the library |
07:33:25 | FromDiscord | <lyhokia> Okay looks like I have to abandon the library in favor of something else |
07:33:29 | FromDiscord | <lyhokia> Thank you tho |
07:33:34 | FromDiscord | <Elegantbeef> What library is it? |
07:35:12 | FromDiscord | <lyhokia> andreaferretti/patty |
07:35:42 | FromDiscord | <lyhokia> They have an [issue](https://github.com/andreaferretti/patty/issues/14) already opened, seeems interesting, I may take a look at it |
07:36:27 | FromDiscord | <lyhokia> Is there any alternative that works well with the type block? |
07:37:27 | FromDiscord | <Elegantbeef> Nope my variant library explicitly doesnt use a typesection due to how that works |
07:37:33 | FromDiscord | <Elegantbeef> You can use a generic like leo said though |
07:38:14 | FromDiscord | <leorize> plugging my library\: https://github.com/alaviss/union |
07:38:45 | FromDiscord | <lyhokia> Thanks, I'll take a look |
07:38:49 | FromDiscord | <Elegantbeef> Going to have 30 different variant libraries soon |
07:39:45 | FromDiscord | <leorize> not that I've ever tested recursion with my library |
07:39:54 | FromDiscord | <lyhokia> Why the language doesn't have variant built in if this is useful? |
07:40:06 | FromDiscord | <Elegantbeef> It does have variant built in |
07:40:15 | FromDiscord | <leorize> it doesn't have ADTs |
07:40:15 | FromDiscord | <Elegantbeef> Object variants exist and are how all of these libraries work |
07:40:33 | FromDiscord | <lyhokia> I am aware of that but that's cumbersome to use |
07:40:33 | FromDiscord | <Elegantbeef> Well actually it does have ADTs just not the one people want ๐ |
07:40:36 | FromDiscord | <leorize> and the only thing ever talked about in RFCs are pattern matching, which is never the point of ADT |
07:40:53 | FromDiscord | <leorize> variants are not ADTs |
07:41:08 | FromDiscord | <Elegantbeef> ADTs are a generic term that can mean just structs |
07:41:17 | FromDiscord | <lyhokia> Yeah I actually need ADT but for now I'm just simulating it with variants |
07:41:35 | PMunch | Graveflo, wait, that's exactly the thing I like about Nim. You know where the program flows, because it says right there |
07:41:41 | FromDiscord | <Elegantbeef> https://github.com/beef331/fungus |
07:42:03 | FromDiscord | <Elegantbeef> Closest Nim has to "ADT"s |
07:42:07 | FromDiscord | <Elegantbeef> God i hate that term |
07:42:22 | FromDiscord | <Graveflo> In reply to @PMunch "<@200775012796334081>, wait, that's exactly": you speak in riddles. I'll figure it out I guess LOL |
07:42:30 | PMunch | Unlike something like C# which pseudo-magically registers a bunch of random files and the main part of your program is just "runProgram()" and somehow that ruffles through your code and finds something to run |
07:42:34 | FromDiscord | <leorize> you just have to embrace the algebraic nature of it beef |
07:42:42 | FromDiscord | <Elegantbeef> Lol |
07:42:54 | FromDiscord | <Elegantbeef> It's such a pointless term cause it includes product and sum types |
07:43:00 | FromDiscord | <Elegantbeef> As such tuples and records are ADTs |
07:43:09 | FromDiscord | <Elegantbeef> But no one means those when they write ADTs for some reason |
07:43:17 | FromDiscord | <leorize> only tuples tbh |
07:43:21 | FromDiscord | <leorize> records are identified by name |
07:43:36 | FromDiscord | <Elegantbeef> They're a product type |
07:43:40 | FromDiscord | <lyhokia> @ElegantBeef your lib also doesn't work if I need recursive variants, because it's generating a whole type block as well right? |
07:43:54 | FromDiscord | <Elegantbeef> It works with recursive if you use generics |
07:43:56 | FromDiscord | <leorize> yea but the identity is the name, not the product |
07:44:12 | FromDiscord | <Elegantbeef> Dont argue with me argue with wikipedia |
07:44:38 | FromDiscord | <lyhokia> Don't understand... Could you make an example? |
07:44:44 | FromDiscord | <leorize> I'm so gonna call mine ADTS where S stands for strict lol |
07:45:17 | FromDiscord | <leorize> and like strictFuncs, it also doesn't work |
07:45:33 | FromDiscord | <Elegantbeef> Should compile |
07:45:35 | FromDiscord | <Elegantbeef> sent a code paste, see https://paste.rs/G6hCq |
07:45:46 | FromDiscord | <Graveflo> In reply to @PMunch "Unlike something like C#": I don't remember what C# was like, but I guess there could be a similar issue with finding base classes or something. Other than that methods are stuck to their defining classes and classes explicitly tell you where their super-classes logic is. In nim all that depends on context. I don't dislike it but it really does need tooling to direct you to the proper control flow unless you are al |
07:46:15 | FromDiscord | <Elegantbeef> How is that different with C# where interfaces exist |
07:46:30 | FromDiscord | <Elegantbeef> You do not know what type something is just that it implements X |
07:46:34 | FromDiscord | <lyhokia> That looks interesting, thank you Elegantbeef |
07:46:49 | FromDiscord | <Elegantbeef> The same might work with patty aswell, no clue |
07:47:54 | FromDiscord | <Elegantbeef> Compiles |
07:47:57 | FromDiscord | <Elegantbeef> sent a code paste, see https://play.nim-lang.org/#ix=4xzU |
07:48:06 | FromDiscord | <Elegantbeef> No clue if you want it `ref T` inside `MyName` or wherever |
07:48:20 | FromDiscord | <Graveflo> In reply to @Elegantbeef "How is that different": I'm not worried about which objects are being subjected to the code. I would worry about "given this type of object at this call where do I go" the point of abstraction is that you don't have to care about specifics like that unless you are tracking a particular instance |
07:48:40 | FromDiscord | <leorize> beef I think nimnode is a good one as an example |
07:48:59 | FromDiscord | <Elegantbeef> What do you mean? |
07:49:08 | FromDiscord | <leorize> it's recursive |
07:49:24 | FromDiscord | <leorize> oh wait it's not an issue with your style of nodes |
07:49:24 | FromDiscord | <Elegantbeef> Right |
07:51:15 | FromDiscord | <Elegantbeef> Who knows, it'd be nice if JJ's RFC is accepted and fungus can be axed |
07:52:05 | FromDiscord | <leorize> I like union style more but I'm too tired to make an RFC for it |
07:52:07 | PMunch | Graveflo, when I first started using C# commercially I had an engineer come over to try and explain the program to me. I asked him where the logic was hidden, because all I could find was orchestration stuff. He looked at me like I had asked him where the narwhales bacons at midnight. I tried another way saying where does the program start, he cheered up and told me in Startup.cs. Looking at Startup.cs there was still no trace of any actual programming logic, |
07:52:07 | PMunch | so I asked him where stuff was happening in this program, and although slightly confused looking he told me that the program continues from Startup.cs to Program.cs. I thought fine, I guess we'll go through the entire flow then. Program.cs turned out to be just more orchestration stuff, and after having gone through 5 more files we finally found a tiny piece of actual logic, starting a webserver! You see my problem with this? |
07:52:19 | FromDiscord | <Elegantbeef> Well they're two different solutions |
07:52:38 | FromDiscord | <Elegantbeef> To two different problems i'd say |
07:52:54 | FromDiscord | <Elegantbeef> "narwhales bacon at midnight" |
07:53:03 | FromDiscord | <Elegantbeef> Frying some bacon in the ocean like the chads they are |
07:53:22 | PMunch | With Nim you open the file with the same name as the binary you produced (unless your Nimble file or other build system says otherwise) and it more often than not contains the actual program |
07:53:27 | FromDiscord | <Graveflo> In reply to @PMunch "so I asked him": xD I most certainly do. Not advocating for that |
07:54:07 | FromDiscord | <Elegantbeef> I mean the only difference is that Nim's implementations can be in any file you import, which is a non issue with properly named code |
07:54:22 | FromDiscord | <Graveflo> I get that. Yea... idk I'm a worry wart. I always think of the worst case scenario |
07:54:23 | FromDiscord | <Elegantbeef> If you see someone do`import truss3D/instancemodels` and then do `loadInstancedModel[T](...)` you probably can reason that procedure is inside that module |
07:54:25 | PMunch | If you find a function you wonder where comes from (and it isn't obvious from the name) look at the first type it takes, this will typically belong to a certain module. |
07:54:42 | FromDiscord | <Elegantbeef> You can arguably do the same with C# since it has extension methods |
07:54:54 | FromDiscord | <Elegantbeef> So you have to look in two places for static methods |
07:55:03 | FromDiscord | <Elegantbeef> actually N places |
07:55:10 | FromDiscord | <Elegantbeef> since you can implement an extension method in any file |
07:55:35 | FromDiscord | <Graveflo> wanna talk about stuff like that lets not forget that python is basically modular programming with OOP built on top of it without restrictions |
07:55:39 | PMunch | Graveflo, that's a great way to preemptively optimise for problems that don't actual exist, and then end up in a scenario where you've built the most entangled system you could imagine to solve a trivial non-problem |
07:55:48 | FromDiscord | <Elegantbeef> The only real difference between Nim and C# here is that Nim says "extension methods can be applied to instances and not just static types" |
07:56:12 | FromDiscord | <Elegantbeef> I've never seriously used python so i cannot say anything about it's actual usage |
07:56:18 | FromDiscord | <Graveflo> but theres always a bad way to do it. I'm just imagining properly made logic that is scaling in complexity out of necessity. Perhaps like the compiler |
07:56:29 | * | boxuser quit (Read error: Connection reset by peer) |
07:56:44 | FromDiscord | <Elegantbeef> Bad code will always be bad code |
07:57:02 | PMunch | Granted sometimes you end up greping through files, but it's not often. And tools like nimsuggest/nimlsp helps as well |
07:57:10 | FromDiscord | <Elegantbeef> Thinking that bad code can exist is a fools errand it'll always exist |
07:57:27 | FromDiscord | <Graveflo> In reply to @PMunch "<@200775012796334081>, that's a great": I'm not trying to solve anything. I'm just wondering how people wrap their head around the compiler tbh. I havent tried much but I need to either triple my memory IQ or figure out some tooling or I might be cooked |
07:58:17 | PMunch | Haha, well the compiler is probably about the most complex piece of Nim code out there. So you've chosen a rough place to start |
07:58:27 | FromDiscord | <Elegantbeef> The modules are named after what they do |
07:58:30 | FromDiscord | <Elegantbeef> It's not too bad |
07:58:35 | PMunch | It's easy to get lost in the weeds in there though |
07:58:45 | FromDiscord | <Elegantbeef> It's bad code but the organisation of modules and procedures is fine |
07:58:54 | PMunch | Like trying to find the implementation of a magic which takes you across a couple different files |
08:00:21 | FromDiscord | <leorize> the compiler is also written using the worst style of nim possible so there's that |
08:01:12 | FromDiscord | <Graveflo> LOL this turned into a compiler roast |
08:02:27 | * | boxuser joined #nim |
08:02:56 | FromDiscord | <leorize> the best tool for nim compiler dev is `grep` |
08:05:37 | * | m5zs7k quit (Ping timeout: 240 seconds) |
08:06:06 | * | m5zs7k joined #nim |
08:15:26 | FromDiscord | <ieltan> Why can't you do `dirname/[some, module] except symbol` ? |
08:15:51 | FromDiscord | <ieltan> (edit) "`dirname/[some," => "`import dirname/[some," |
08:17:19 | FromDiscord | <Graveflo> maybe because its not specific which module the symbol is redacted from.. idk why it doesn't just do both |
08:20:07 | FromDiscord | <ieltan> hmm |
08:21:00 | FromDiscord | <lyhokia> Hello all, is it possble to add a git repo as my dependency rather than letting nimble resolve it for me? I'm forking a repo and I want to test it |
08:22:04 | FromDiscord | <lyhokia> For example in crystal shards they have this: |
08:22:34 | FromDiscord | <lyhokia> sent a code paste, see https://play.nim-lang.org/#ix=4xA4 |
08:23:17 | FromDiscord | <ieltan> In reply to @Graveflo "maybe because its not": what about `except some.symbol` |
08:23:39 | FromDiscord | <ieltan> well this probably doesn't help if there are overloaded functions |
08:23:41 | FromDiscord | <ieltan> hmm |
08:24:02 | FromDiscord | <ieltan> wait how does it work with overloaded functions anyways does it yeet them all ? |
08:24:21 | FromDiscord | <demotomohiro> iirc, you can specify git repo url as dependency in nimble. |
08:24:49 | FromDiscord | <Graveflo> In reply to @lyhokia "For example in crystal": try running `nimble setup` after having the right configuration |
08:25:25 | PMunch | ieltan, yes it removes all of the overloads |
08:25:35 | FromDiscord | <Graveflo> also I think it helps to make sure you are running the main module in case you are not doing that. like `nim r src/mypkg.nim` |
08:26:06 | FromDiscord | <lyhokia> @demotomohiro could you write a simple example please? I don't find the spec for nimble file so it would also help if someone know if there is one |
08:26:39 | FromDiscord | <lyhokia> Oh I find this: https://github.com/nim-lang/nimble/blob/7484582e52b3201d3c0a510ed2feeb5d7a8c3491/tests/issue432/issue432.nimble#L12 |
08:26:40 | FromDiscord | <lyhokia> Thanks |
08:27:22 | FromDiscord | <demotomohiro> In reply to @lyhokia "<@288750616510201856> could you write": here is another example: https://github.com/nim-lang/nimble#creating-packages |
08:27:51 | * | ntat_ is now known as ntat |
09:14:21 | * | junaid_ joined #nim |
09:16:50 | * | junaid__ joined #nim |
09:21:50 | * | junaid__ quit (Quit: leaving) |
09:40:26 | * | boxuser quit (Ping timeout: 246 seconds) |
09:42:25 | * | boxuser joined #nim |
09:53:07 | * | boxuser quit (Ping timeout: 240 seconds) |
09:54:59 | * | boxuser joined #nim |
09:55:43 | * | deadmarshal_ quit (Ping timeout: 256 seconds) |
09:56:00 | FromDiscord | <voidwalker> can anyone experienced parsing html give me a hand ? just wasted a few hours trying to find elements by tags, then I did `html[2][1][3][1][9][2][1][17][0][0][5][10]` only to find out this doesn't hold true for the next html file with the same structure :\ |
09:56:28 | FromDiscord | <Graveflo> woa there |
09:57:03 | FromDiscord | <Graveflo> you need to do just a little bit of land marking if you are trying to get something slightly more robust |
09:57:24 | FromDiscord | <voidwalker> I'm thinking I should look into xpath or css selectors |
09:57:50 | FromDiscord | <Graveflo> do the html elements not have ids? |
09:58:58 | FromDiscord | <voidwalker> https://media.discordapp.net/attachments/371759389889003532/1115580584203390976/image.png |
09:59:46 | FromDiscord | <voidwalker> It's a text element, interestingly firefox doesn't have any css/xpath selector option right clicking on it |
09:59:57 | FromDiscord | <Graveflo> so things like <b>Uploaded by</b> and maybe a css class or html id or distinct patterns of tags. These are things you can use to landmark the html |
10:01:08 | FromDiscord | <voidwalker> I was hoping I can get away with parsehtml unit, I managed so far, this is the last one I have to do. But it doesn't have recursive traversal of elements |
10:02:16 | FromDiscord | <Graveflo> you can't just recurse them with recursion? |
10:02:25 | FromDiscord | <Graveflo> or even a while loop would work |
10:02:47 | FromDiscord | <Graveflo> you are just going through them until you find a pattern that you recognize |
10:03:59 | FromDiscord | <voidwalker> indeed what I need is to get the distinctive element location in the tree, and then what I want is relative to that |
10:04:52 | FromDiscord | <Graveflo> lets say you wanted to get that image at the bottom. You could write a loop that looks for a `div` in a `div` that has `<b>Uploaded by</b>` in it and then return the next `img` tag. I would get some sample html strings and use them to test the loop while you are writing it |
10:06:28 | FromDiscord | <voidwalker> I think I'm going to switch to `parsexml`, that one has a `.next` operator |
10:06:59 | FromDiscord | <Graveflo> alright |
10:07:43 | FromDiscord | <voidwalker> findAll from html gets me the distinctive elements I want, but it filters out the "next" data I need |
10:07:47 | FromDiscord | <voidwalker> so it's useless |
10:08:42 | FromDiscord | <Graveflo> in the xml parser? |
10:08:54 | FromDiscord | <voidwalker> in `parsehtml` |
10:10:28 | FromDiscord | <voidwalker> img is (one of) the distinctive tag I have, all the data has a little icon next to it. But if I findall("img"), I lose the data. If I findAll("div"), then I am completely lost how to search downwards, too many divs |
10:18:19 | * | boxuser quit (Ping timeout: 265 seconds) |
10:19:43 | * | boxuser joined #nim |
10:22:12 | FromDiscord | <voidwalker> Ah I think I got it |
10:22:15 | FromDiscord | <voidwalker> `for i, x in html.findAll("div").filterIt(it.attr("style") == "width:25%;float:left;"):` |
10:22:33 | FromDiscord | <voidwalker> now much easier to dig in |
10:25:02 | FromDiscord | <voidwalker> I'd like to find the "best" way to do this crap in the future though |
10:26:08 | FromDiscord | <voidwalker> https://github.com/weskerfoot/NimPath - this one looks like the only way to use xpath in nim, but it needs .so (.dll works also maybe?) |
10:26:17 | FromDiscord | <voidwalker> and there's this : https://github.com/cyluxx/robula-plus |
10:26:17 | FromDiscord | <Graveflo> yea there are libraries for stuff like this. I don't know the nim ones. I usually just write a custom loop or recursion and do the detection the old fashioned way |
10:43:34 | FromDiscord | <ricky> In reply to @Graveflo "yea there are libraries": as it should be |
11:04:20 | FromDiscord | <voidwalker> https://media.discordapp.net/attachments/371759389889003532/1115597033038958652/image.png |
11:05:41 | FromDiscord | <voidwalker> shouldn't all this block be in the same XmlNode ? in nim it gets cut before the <form, and I cant' access data below it. It seems it parsed that one as part of the higher parent div for some reason :\ |
11:08:30 | * | deadmarshal_ joined #nim |
11:16:22 | FromDiscord | <spotlightkid> What is the syntax for `nimble install`ing from the HEAD of a remote git repo (without manually checking it out)? |
11:18:15 | * | boxuser quit (Ping timeout: 265 seconds) |
11:20:04 | FromDiscord | <voidwalker> I think `nimble install https://github.com/ying32/nim-vcl@#head` |
11:20:10 | FromDiscord | <Rika> Yes |
11:20:25 | * | boxuser joined #nim |
11:21:39 | FromDiscord | <spotlightkid> Right, thanks! Tried different things but didn't think of adding a `#`. |
11:34:17 | * | boxuser quit (Ping timeout: 250 seconds) |
11:36:01 | * | boxuser joined #nim |
11:42:22 | FromDiscord | <chmod222> Fun, my segfault goes away when I use the C++ backend as well as when I compile with debug infos |
11:42:24 | FromDiscord | <chmod222> This keeps getting weirder |
11:52:07 | * | PMunch quit (Quit: Leaving) |
11:55:14 | FromDiscord | <Rika> valgrind/asan time it sounds like |
11:56:09 | FromDiscord | <chmod222> Valgrind doesn't tell me anything new except that something is nil but it cannot tell me what that thing is, and everything apparently is not nil from what I'm logging |
11:57:01 | FromDiscord | <chmod222> Can I instruct nim to pass -fsanitize=address to gcc? |
11:57:10 | FromDiscord | <chmod222> Apparently I can, let's see |
11:58:45 | FromDiscord | <Rika> In reply to @chmod222 "Valgrind doesn't tell me": add -g to nim's args maybe? debugger info |
11:58:49 | FromDiscord | <Rika> (edit) "In reply to @chmod222 "Valgrind doesn't tell me": add -g to nim's args maybe? ... debugger" added "for" |
11:59:21 | FromDiscord | <chmod222> Once I include debug infos, the segfault disappears |
11:59:30 | FromDiscord | <chmod222> Which is why this is yanking my chain so much |
12:00:30 | FromDiscord | <Rika> mmmmmmmmmmm |
12:00:30 | FromDiscord | <chmod222> It works in C -d\:danger, in C with debug symbols, in C++ no matter what but in default C development debug mode without debug symbols, it dies |
12:00:31 | FromDiscord | <Rika> fun |
12:00:43 | FromDiscord | <chmod222> Very fun |
12:03:02 | FromDiscord | <chmod222> Also goes away with asan \:) |
12:03:14 | FromDiscord | <chmod222> Of course |
12:05:58 | FromDiscord | <chmod222> I think that's the most heisenbug I've ever had, it literally goes away when you want to observe it |
12:12:59 | FromDiscord | <voidwalker> so parsehtml seems to use parsexml under the hood, which doesn't correctly parse my html. What hope do I have ? :\ |
12:15:15 | FromDiscord | <chmod222> Writing an HTML parser if you're up for a 5 minute adventure that may take you 4 years |
12:15:38 | FromDiscord | <voidwalker> yeah, I'm pretty much more than a day now at this |
12:15:48 | * | lucasta joined #nim |
12:16:03 | FromDiscord | <chmod222> Binding a preexisting HTML parser may be less painful |
12:16:05 | FromDiscord | <chmod222> https://curl.se/libcurl/c/htmltidy.html |
12:16:18 | * | lucasta quit (Remote host closed the connection) |
12:16:57 | FromDiscord | <voidwalker> I don't know how to bindings, it will probably take me a few days just to figure that out |
12:17:04 | * | lucasta joined #nim |
12:17:56 | FromDiscord | <voidwalker> maybe I will go string/regex way for this ;\ |
12:18:29 | FromDiscord | <chmod222> As long as it's a self contained snippet you want to extract, that's completely fine imo |
12:19:24 | FromDiscord | <chmod222> Just don't try to write an HTML parser in regex, lest someone copy pastes the infamous stackoverflow comment |
12:26:10 | FromDiscord | <chmod222> By god, I found the segfault |
12:26:16 | FromDiscord | <chmod222> I can sleep again |
12:26:24 | * | boxuser quit (Ping timeout: 265 seconds) |
12:27:02 | FromDiscord | <sOkam!> In reply to @voidwalker "I don't know how": its not difficult. its just a lot of `importc` |
12:27:16 | FromDiscord | <voidwalker> this is already a rabbit hole, i'd rather not open another one |
12:27:21 | FromDiscord | <sOkam!> fair |
12:27:55 | FromDiscord | <voidwalker> if someone familiar with the xml parser is here to take a look, this might be a nim bug |
12:28:21 | * | boxuser joined #nim |
12:29:18 | FromDiscord | <voidwalker> Might be related to this: https://github.com/nim-lang/Nim/pull/12205 |
12:29:19 | FromDiscord | <sOkam!> to give some perspective on the bindings thing (for future reference), if you have ever done any type of C buildsystem, bindings a lot easier. much easier than cmake even. just different and takes a bit to grasp how, but once you do the tools are really easy and clean to use |
12:29:25 | FromDiscord | <voidwalker> that pull request was not merged, right ? |
12:30:49 | FromDiscord | <Rika> In reply to @chmod222 "I think that's the": schrodinbug |
12:31:21 | FromDiscord | <chmod222> It was of course completely unrelated to what I was actually looking for, all my pointers were in fact valid |
12:31:30 | FromDiscord | <spotlightkid> sent a code paste, see https://play.nim-lang.org/#ix=4xAZ |
12:31:35 | FromDiscord | <chmod222> But buffer overflows don't care and will tear through anything |
12:31:37 | FromDiscord | <Rika> wait so what happened |
12:31:38 | FromDiscord | <Rika> oh |
12:31:50 | FromDiscord | <Rika> buffer overflow, maybe msan would have caught that |
12:32:09 | FromDiscord | <chmod222> It crossed the FFI boundary so I'm not entirely sure |
12:32:12 | FromDiscord | <chmod222> Raw pointers subvert everything |
12:32:37 | FromDiscord | <chmod222> A method that I believe would write an int32 wrote in fact int64 |
12:35:36 | * | krux02 joined #nim |
12:36:34 | FromDiscord | <sOkam!> In reply to @spotlightkid "Is there a nicer": you could make it a template |
12:36:36 | FromDiscord | <that_dude> Spotlight kid, look into result or options? May be what your looking for |
12:36:36 | FromDiscord | <chmod222> What would interest me is why it fails now and not a week ago |
12:36:40 | FromDiscord | <chmod222> But buffer overflows are cheeky |
12:38:00 | FromDiscord | <that_dude> (edit) "result" => "nim-results" |
12:42:20 | FromDiscord | <spotlightkid> @that_dude\: ok, I'll read up on those. A template would be overkill, since it's only one function, |
12:43:59 | * | junaid_ quit (Remote host closed the connection) |
13:04:32 | * | junaid_ joined #nim |
13:06:05 | * | beholders_eye joined #nim |
13:17:03 | * | beholders_eye quit (Ping timeout: 268 seconds) |
13:18:30 | * | lucasta quit (Remote host closed the connection) |
13:18:46 | * | PMunch joined #nim |
13:18:53 | * | lucasta joined #nim |
13:25:36 | om3ga | have you used GoLang-s GC? resulting binary reported there is no libgo.so in the sys |
13:25:58 | om3ga | ofc I installed go's compiler :) |
13:26:38 | om3ga | oh I found it, please ignore |
13:27:30 | om3ga | why, why they choose such paths : /usr/lib/gcc/x86_64-linux-gnu/11/libgo.so |
13:28:51 | om3ga | /usr/lib/gcc/x86_64-linux-gnu/11/libgo.so: undefined symbol: __go_init_main |
13:31:38 | FromDiscord | <Chronos [She/Her]> Why are you using Go's Gc? |
13:32:21 | FromDiscord | <Chronos [She/Her]> Isn't refc much more suitable than the outputted binary size because of the Go GC? |
13:32:30 | FromDiscord | <Chronos [She/Her]> Unless you're doing some funky interop with Go? |
13:35:12 | om3ga | Chronos: For test |
13:35:31 | * | ntat quit (Ping timeout: 265 seconds) |
13:36:19 | om3ga | I have issues with the memory management, seems I will have to use no GC at all |
13:50:37 | FromDiscord | <mratsim> In reply to @om3ga "I have issues with": what issues? |
13:57:48 | * | FromDiscord quit (Remote host closed the connection) |
13:58:00 | * | FromDiscord joined #nim |
13:59:16 | om3ga | mratsim: https://forum.nim-lang.org/t/10243 |
13:59:32 | FromDiscord | <Chronos [She/Her]> In reply to @om3ga "I have issues with": Is arc not suitable? |
14:00:36 | FromDiscord | <Chronos [She/Her]> In reply to @om3ga "<@570268431522201601>: https://forum.nim-lang.org/t": That seems unrelated...? |
14:01:01 | om3ga | Chronos, unfortunately no. Growing heap holding is dangerous in my case |
14:01:24 | om3ga | oh sorry, wrong link |
14:01:33 | om3ga | mratsim: https://forum.nim-lang.org/t/10248 |
14:01:35 | FromDiscord | <Chronos [She/Her]> It's also possible to release memory back to the OS iirc, can't remember who talked about it |
14:01:52 | om3ga | Chronos, please check the ling above |
14:02:57 | FromDiscord | <mratsim> In reply to @om3ga "<@570268431522201601>: https://forum.nim-lang.org/t": is your real final use-case with strings? |
14:02:58 | om3ga | Chronos, it seems was me, but I was wrong. once I used properly sharedRam, all heap allocated inside the thread being hold by gc |
14:03:05 | * | PMunch quit (Quit: Leaving) |
14:03:31 | FromDiscord | <mratsim> like if heap is an issue, it's weird to use strings. |
14:03:36 | FromDiscord | <Chronos [She/Her]> In reply to @om3ga "Chronos, please check the": Ah hm |
14:03:54 | om3ga | mratsim, it's just example. In real program there is a lot of stuff going |
14:04:20 | om3ga | objects, seq[char]'s, ref seq[char]'s, ref obj |
14:05:18 | FromDiscord | <mratsim> In reply to @om3ga "<@570268431522201601>, it's just example.": that's why I'm asking, if you don't give use the real types we can tell you anything about memory management because memory management in Nim is per-type |
14:05:23 | om3ga | I did ref things to optimize gc, it saved a lot of ram (reduced usage from 21GB to 11.2), but still |
14:05:42 | FromDiscord | <mratsim> ref doesn't optimize, it stresses the GC more |
14:06:07 | om3ga | mratsim: example code I posted on the forum recreates the issue |
14:06:14 | FromDiscord | <mratsim> it might remove copies but it only makes sense if you know if you want value or reference semantics |
14:06:38 | FromDiscord | <mratsim> The issue is that the code doesn't match what you want to do in the end and you didn't give use enough context |
14:06:50 | FromDiscord | <mratsim> why are you using threads? |
14:06:55 | om3ga | mratsim, but it has same issue |
14:06:58 | FromDiscord | <mratsim> why do you use a shared table? |
14:07:06 | FromDiscord | <mratsim> doesn't matter. |
14:07:16 | om3ga | shared table used because I have to share data between threads |
14:07:36 | om3ga | I doubt we have other option here |
14:07:48 | FromDiscord | <mratsim> what kind of relationship do your threads have? producer-consumer? are they long-running? is it scientific data? strings? |
14:07:50 | om3ga | and I don't want to use channel |
14:08:10 | om3ga | mratsim, it's not related to the issue with GC |
14:08:24 | om3ga | gc not returns back the allocated ram |
14:08:26 | om3ga | to the os |
14:08:56 | FromDiscord | <mratsim> it does for large alloc, under a certain threshold it keeps it, like Java, Python, javascript and all GC-ed language |
14:08:58 | om3ga | the example code exactly recreates this issue |
14:09:23 | om3ga | mratsim, 11.2GB of allocs, can be considered as large amount |
14:09:32 | FromDiscord | <mratsim> returning to the OS would slow down significantly small allocs/deallocs |
14:09:33 | om3ga | or you mean one large alloc? |
14:09:45 | FromDiscord | <mratsim> over a couble MB should be returned to the OS |
14:09:51 | FromDiscord | <mratsim> couple |
14:09:57 | om3ga | mratsim, not returning alloc'd heap to the os can destroy working server |
14:10:36 | om3ga | I think you will agree, performance here is not the main thing |
14:10:48 | * | boxuser quit (Ping timeout: 265 seconds) |
14:11:29 | FromDiscord | <mratsim> In reply to @om3ga "<@570268431522201601>, not returning alloc'd": C++ or Rust would not return the allocated memory in this situation either |
14:11:47 | om3ga | my program processes the data from file, with intense alloc (dynamic seq[char]) It holds three times more heap than input file |
14:11:51 | om3ga | this is ridiculous |
14:11:51 | FromDiscord | <mratsim> seauences/vectors (which are what the tables are built on) never shrink |
14:12:02 | FromDiscord | <mratsim> they only grow in size. |
14:12:19 | om3ga | mratsim, I understand that other collectors can not do that too |
14:12:27 | * | boxuser joined #nim |
14:12:28 | om3ga | but who needs such dynamic MM? |
14:12:49 | om3ga | GC should be not only fast, but secure too |
14:13:11 | om3ga | for example why there is not max heap limit option? |
14:13:18 | om3ga | java's GC has such |
14:13:46 | FromDiscord | <mratsim> just create your own container that counts the number of items and blocks if there is too much |
14:13:59 | FromDiscord | <mratsim> security is different |
14:14:00 | om3ga | also in my personal opinion, some kin of forceCollectAndReturnToOs() proc should exist |
14:14:22 | om3ga | mratsim, this is workaround not the solution |
14:14:29 | om3ga | mratsim, secure == safe |
14:15:14 | FromDiscord | <mratsim> also how are you measuring the GC usage?โตbecause in your link `size` is the number of items before you use `GC_fullCollect` |
14:15:33 | om3ga | imagine mission critical server where a lot of data processors work, and some process eats more than 2/3 of the ram? |
14:15:55 | om3ga | mratsim: I measure Resident ram usage in OS |
14:16:13 | om3ga | all that explained in forum theme I opened |
14:16:47 | FromDiscord | <mratsim> In reply to @om3ga "imagine mission critical server": you use queues and channels with limited size and backpressure to slowdown the producer? |
14:16:51 | om3ga | none of existing GC's return back used chunks of ram |
14:17:15 | om3ga | mratsim, I use standard lang tools only |
14:17:39 | FromDiscord | <mratsim> They do, I've been developping deep learning code that uses multiple gigabytes of RAM that was returned. |
14:18:12 | FromDiscord | <mratsim> In reply to @om3ga "<@570268431522201601>, I use standard": `import std/deque` will give you a queue that you can use to implement backpressure |
14:18:15 | om3ga | mratsim, but I posted the case where GC not does that |
14:18:51 | om3ga | mratsim, I don't want to use queues and other extra stuff in the real code |
14:19:04 | FromDiscord | <mratsim> In reply to @om3ga "<@570268431522201601>, but I posted": and your example lacks context because you also use threading and a shared table |
14:19:19 | om3ga | context is clear |
14:19:25 | om3ga | I can explain here too |
14:19:37 | FromDiscord | <mratsim> In reply to @om3ga "<@570268431522201601>, I don't want": If you don't want to learn proper architecture and give context i can't help you |
14:19:47 | om3ga | thread has seq[string], sharedRam used in global |
14:20:00 | FromDiscord | <mratsim> no, your real app doesn't use strings |
14:20:17 | om3ga | all that allocs remain even if I free shared ram and threads exits, even if I call GcFullCollect |
14:20:19 | FromDiscord | <mratsim> you use sharedTable which are explicitly mentioned has being discouraged and just an unblocker |
14:20:32 | FromDiscord | <mratsim> you use raw threads and don't explain why and what for |
14:20:45 | * | boxuser quit (Ping timeout: 240 seconds) |
14:20:56 | om3ga | mratsim, my real app uses seq[char] and has the same issue with it |
14:21:32 | om3ga | mratsim I use threads to achieve better performance of data processing in parallell |
14:21:52 | FromDiscord | <mratsim> what algorithm are you trying to parallelize? What kind of processing? |
14:22:06 | om3ga | I doubt re-arranging my code design will help to solve issues by freeing alloc'd chings to the os |
14:22:13 | om3ga | freeing == releasing |
14:22:27 | om3ga | mratsim: still not related to the issue |
14:22:39 | FromDiscord | <mratsim> that's what you think |
14:22:55 | FromDiscord | <mratsim> do you know if your algorithm is memory bound or compute-bound? |
14:22:57 | * | boxuser joined #nim |
14:23:26 | om3ga | mratsim: what you suggest? to match my processing to the possible workaround where GC will work little bit better? |
14:24:35 | om3ga | I think this is conterproductive |
14:25:02 | FromDiscord | <mratsim> What can I suggest, I have not enough data. I only know that you use SharedTable, which is the worst performance decision you can have for a multithreading algorithm |
14:25:33 | om3ga | mratsim, you can try to solve example on the forum |
14:25:54 | om3ga | but I doubt such exists |
14:26:20 | om3ga | if it would exist, I believe Araq would mention it |
14:26:56 | FromDiscord | <mratsim> I'm not going to spend more time on your issues if you don't give me more context.โตโตI can help you on optimization, I can help you on multithreading, reducing memory usage, but I can't help you if you don't tell me what you're trying to do. |
14:30:47 | om3ga | mratsim, I can tell that the issue is the same as in example provided on the forum |
14:31:37 | om3ga | I can't share my code, for some reasons, but the issue described couple of times will persist |
14:37:55 | * | beholders_eye joined #nim |
14:39:25 | FromDiscord | <mratsim> I'm not asking for the code, but the end problem you are trying to solve, the constraint and the approach you are taking. |
14:39:31 | FromDiscord | <!&luke> In reply to @spotlightkid "I'm on Manjaro and": Oh thx |
14:40:24 | * | krux02_ joined #nim |
14:43:19 | om3ga | mratsim the flow of my code is absolutely the same. only there is many threads in parallel |
14:43:49 | om3ga | types can differ, but the same sequences, and other stuff in heap |
14:44:55 | om3ga | for convinience, I use dynamic MM to not have all that pain with static buffers |
14:45:13 | om3ga | and it turns that this comvinience cost too much :) |
14:46:35 | om3ga | still, if you will manage to solve the issue with saving the flow used in example on the forum, it will solve all other possible issues too |
14:48:17 | FromDiscord | <chmod222> Does casting a pointer to a reference increase the reference count? |
14:48:23 | FromDiscord | <chmod222> I suppose not, but supposing isn't knowing sadly |
14:49:27 | FromDiscord | <mratsim> In reply to @chmod222 "Does casting a pointer": don't do it |
14:49:40 | FromDiscord | <chmod222> Well I have to |
14:49:49 | FromDiscord | <mratsim> the GC assumes specific things about references that don't hold for pointers and your program will crash |
14:50:09 | FromDiscord | <mratsim> you don't have to crash, there is another way |
14:50:09 | FromDiscord | <chmod222> I'm working with FFI so I have no choice but to subvert the GC temporarily |
14:50:31 | FromDiscord | <mratsim> no there is no need |
14:50:54 | FromDiscord | <mratsim> you can use destructors or finalizers if you want to ensure garbage collection |
14:52:11 | FromDiscord | <chmod222> The issue is not memory management, the issue is that with refs I cannot use dynamic dispatch |
14:52:26 | FromDiscord | <mratsim> for example if you wrap your pointer in a ref you can ensure it's freed when out of scope even if it's GPU mem: https://github.com/mratsim/Arraymancer/blob/e297e6d5dcad70f3a39c44d8c79e2bb171fc2bd6/src/arraymancer/tensor/backend/opencl_backend.nim#L34-L52 |
14:52:33 | FromDiscord | <chmod222> ptr objects don't play well |
14:52:55 | FromDiscord | <Nerve> How much of the standard library is dependent on memory management being enabled? I've been able to write a fairly large application without touching any `ref`s or `ptr`s so I'm curious if it's really been necessary for `std`. |
14:53:04 | FromDiscord | <mratsim> the wrapped lib has dynamic dispatch or you want to add that on top? |
14:53:24 | FromDiscord | <mratsim> In reply to @Nerve "How much of the": everything that uses sequences or strings need memory management |
14:53:28 | om3ga | in my opinion, ref shoild be less memory-vise expensive |
14:53:57 | om3ga | it's like ponter that links to another pointer that links to the data |
14:54:11 | om3ga | and you have only one data allocation |
14:54:16 | FromDiscord | <mratsim> ref only points to the data directly, it's a single indirection |
14:54:42 | om3ga | hmm, and ref ptr string? |
14:55:18 | FromDiscord | <mratsim> don't mix ptr and seq or strings and ref, only point to plain old data |
14:55:24 | om3ga | anyway if it points to the real data, then it;s beter |
14:55:35 | om3ga | mratsim, but I can do that? |
14:55:40 | om3ga | why I should not to do so? |
14:55:41 | FromDiscord | <mratsim> yes you can |
14:56:01 | FromDiscord | <chmod222> I'm wrapping Godot and Godot exposes its class hierarchy over FFI, so I need to generate a bunch of dummy classes that dispatch the correct pointers and yada yada, but the issue is that they expose virtual methods that I would like to actually expose as virtual methods and that cannot be done without ref because without ref I cannot use dynamic dispatch |
14:56:30 | FromDiscord | <chmod222> I have done all the working around I can without ref by generated my own vtables but it's just terrible user experience |
14:56:45 | FromDiscord | <mratsim> because ptr means manual memory management, and seq and strings are automatically managed. The compiler will not take into account your `ptr` to evaluate those seq/strigns lifetimes and you will end up with a use-after-free |
14:56:48 | FromDiscord | <chmod222> So I want to get actual references working |
14:56:48 | FromDiscord | <Nerve> In reply to @mratsim "everything that uses sequences": But Andreas already confirmed to me that seqs and strings, when not allocated via a ref, are basically just stack pointers to the heap memory; so when the stack frame pops the memory should be freed. So I guess, does it not deallocate immediately? It just leaves the reference for the memory manager to handle? |
14:57:33 | FromDiscord | <mratsim> In reply to @Nerve "But Andreas already confirmed": the stack frame frees the stack not the heap |
14:57:59 | FromDiscord | <chmod222> And Godot gives me the proper callbacks to notify me if I should increase or decrease my reference count, so in theory all is well |
14:57:59 | FromDiscord | <chmod222> So I just need to know if casting a pointer to a ref increases its reference count and need to compensate for that |
14:58:18 | FromDiscord | <mratsim> the compiler inserts a call to free it it it was the last reference or move it where it's needed before the function returns |
14:58:42 | FromDiscord | <mratsim> In reply to @chmod222 "So I just need": it doesn't and it's wrong and you'll get bugs |
14:58:56 | * | boxuser quit (Ping timeout: 246 seconds) |
14:59:07 | FromDiscord | <mratsim> In reply to @chmod222 "I'm wrapping Godot and": is it C++ or C? |
14:59:07 | FromDiscord | <Nerve> That's what I mean then, if the compiler frees the memory after the stack frame is popped, then it shouldn't require a GC or RC to clean up after it. If anything that's an optimization that should be guaranteed. |
14:59:16 | FromDiscord | <Nerve> (edit) "That's what I mean then, if the compiler frees the ... memory" added "heap" |
14:59:46 | FromDiscord | <mratsim> In reply to @chmod222 "I'm wrapping Godot and": If it's C you can emulate any dynamic dispatch with a closure tuple (function, env) |
14:59:57 | FromDiscord | <chmod222> It doesn't matter because I don't bind to actual class instances but a flattened C ABI |
15:00:47 | FromDiscord | <mratsim> In reply to @Nerve "That's what I mean": yes it is guaranteed |
15:01:11 | FromDiscord | <mratsim> it only involves the allocator, no MM/GC except for seq tagged `{.shallow.}` |
15:02:10 | FromDiscord | <Nerve> Right on. So I guess back to my original question, I guess I'm wondering just how much of the standard library has to be dependent on explicit heap allocation. |
15:03:35 | FromDiscord | <mratsim> sent a long message, see http://ix.io/4xBZ |
15:05:06 | FromDiscord | <Nerve> That's a pretty constrained subset of the standard library |
15:06:57 | FromDiscord | <mratsim> thing is, networking is a big chunk of interesting libraries. |
15:06:59 | om3ga | the problem with threads is also with mandatory usage of shared heap. You need somehow to share the data between the thread |
15:07:44 | FromDiscord | <mratsim> And go is popular in part due to its async/networking focus |
15:08:10 | FromDiscord | <mratsim> but you need workaround when that's not your interest (say numerical/scientific computing) |
15:08:26 | FromDiscord | <Nerve> I guess I should frame my question: I'm wondering how much of `std` needs memory management for embedded, without networking and without lots of dynamic data structures being thrown around. How much of `std` would a small-chip device have access to with GC/RC disabled? |
15:08:47 | FromDiscord | <Nerve> (edit) "for embedded," => "in an embedded context," |
15:09:11 | FromDiscord | <mratsim> because their multithreading is IO first, because no generics, because `interface` are fine when your data is polymorphic most of the time (i.e. serialized for networking) but meh otherwise. |
15:10:42 | om3ga | Unpdate GoLang compiler, and it still returns /lib/x86_64-linux-gnu/libgo.so: undefined symbol: __go_init_main |
15:11:01 | FromDiscord | <mratsim> In reply to @Nerve "I guess I should": iirc there is a blog post about recommendations, and the #embedded channel and the awesome-nim section about embedded.โตโตAnd even though sequtils/strutils only use seq or strings, the way they use it introduces too much temporaries for embedded |
15:11:04 | om3ga | seems nim code points to the non existing symbol |
15:30:50 | * | FromDiscord quit (Remote host closed the connection) |
15:31:03 | * | FromDiscord joined #nim |
15:32:47 | * | zgasma quit (Quit: leaving) |
15:49:08 | * | lucasta quit (Ping timeout: 240 seconds) |
15:51:53 | * | oldpcuser quit (Remote host closed the connection) |
15:57:28 | FromDiscord | <windowsboy111> is nim 1.9.3 even a thing |
15:57:56 | FromDiscord | <windowsboy111> this can't get more confusing https://media.discordapp.net/attachments/371759389889003532/1115670922221846629/apPSqHL.png |
16:01:00 | * | boxuser joined #nim |
16:01:23 | FromDiscord | <Kermithos> In reply to @windowsboy111 "this can't get more": afaik its the current dev version |
16:03:22 | FromDiscord | <windowsboy111> interesting |
16:03:29 | FromDiscord | <windowsboy111> I can't find the tag for it |
16:04:22 | NimEventer | New thread by Ivansete: Nim library interoperability with other GC languages (NodeJs, Golang), see https://forum.nim-lang.org/t/10251 |
16:06:16 | FromDiscord | <Kermithos> In reply to @windowsboy111 "I can't find the": the version should be defined hereโตโตhttps://github.com/nim-lang/Nim/blob/2e4ba4ad93c6d9021b6de975cf7ac78e67acba26/lib/system/compilation.nim |
16:06:29 | FromDiscord | <Kermithos> (edit) "hereโตโตhttps://github.com/nim-lang/Nim/blob/2e4ba4ad93c6d9021b6de975cf7ac78e67acba26/lib/system/compilation.nim" => "hereโตโตhttps://github.com/nim-lang/Nim/blob/devel/lib/system/compilation.nim" |
16:06:49 | FromDiscord | <windowsboy111> :O |
16:11:34 | FromDiscord | <sOkam!> In reply to @windowsboy111 "is nim 1.9.3 even": 2.0rc2 version was accidentally published to choosenim as stable. that's when that got introduced |
16:13:15 | FromDiscord | <windowsboy111> In reply to @sOkam! "2.0rc2 version was accidentally": I see |
16:19:05 | * | beholders_eye quit (Ping timeout: 246 seconds) |
16:19:58 | * | junaid_ quit (Remote host closed the connection) |
16:20:31 | * | boxuser quit (Ping timeout: 240 seconds) |
16:28:54 | * | cedb joined #nim |
16:30:06 | * | beholders_eye joined #nim |
16:47:38 | * | rockcavera joined #nim |
16:54:10 | FromDiscord | <System64 ~ Flandre Scarlet> Is there a way to turn an array of bytes into a string? |
17:04:22 | FromDiscord | <voidwalker> maybe in a few years: https://github.com/nim-lang/Nim/issues/14810 |
17:07:49 | * | ntat joined #nim |
17:12:37 | * | beholders_eye quit (Ping timeout: 268 seconds) |
17:12:38 | FromDiscord | <juan_carlos> In reply to @System64 "Is there a way": func that takes openArray[char] also takes string directly too, if thats what you need. |
17:19:01 | FromDiscord | <voidwalker> wouldn't it be nice to be able to have a separate incrementable int variable when running a for loop ? Without needing a pairs iterator |
17:19:13 | FromDiscord | <voidwalker> save 2 lines of code declaring and then incrementing it |
17:21:07 | FromDiscord | <juan_carlos> In reply to @voidwalker "wouldn't it be nice": `enumerate` ? |
17:22:11 | FromDiscord | <Chronos [She/Her]> In reply to @System64 "Is there a way": I'm trying to think of a way that doesn't involve casting aha |
17:22:43 | FromDiscord | <Chronos [She/Her]> Well, for super quick method |
17:22:48 | FromDiscord | <Chronos [She/Her]> But you can easily just do: |
17:22:54 | FromDiscord | <voidwalker> hm ok, didn't know of enumerate, but that takes importing std/enumerate, and it yield a tuple, which must be unpacked ;\ |
17:24:04 | FromDiscord | <Chronos [She/Her]> sent a code paste, see https://paste.rs/ksvhc |
17:25:31 | FromDiscord | <chmod222> You don't really need to unpack it yourself, what with the whole `for i, elem in enumerate(something)` thing |
17:27:02 | FromDiscord | <that_dude> I thought I read somewhere that you don't even need the enumerate part? |
17:27:22 | FromDiscord | <that_dude> I might be still asleep tho |
17:27:52 | FromDiscord | <that_dude> `for I, elem in thing` |
17:27:57 | * | cm_ joined #nim |
17:28:20 | * | cm quit (Ping timeout: 250 seconds) |
17:28:20 | * | cm_ is now known as cm |
17:29:05 | FromDiscord | <chmod222> That sounds fantastical and I will test it right now |
17:29:23 | FromDiscord | <chmod222> It absolutely works |
17:29:32 | FromDiscord | <chmod222> At least for string |
17:29:56 | FromDiscord | <chmod222> But it's defined for everything else as well, fancy that |
17:30:53 | FromDiscord | <that_dude> I jest tested it too lol. Never typing code on phone again |
17:31:37 | FromDiscord | <chmod222> I have quite some code to clean up then, I use it a few times in my project |
17:31:47 | FromDiscord | <that_dude> Actually, why does enumerate exist when that works? |
17:31:57 | FromDiscord | <chmod222> For custom Iterators I recon |
17:32:14 | FromDiscord | <that_dude> Ig |
17:32:27 | FromDiscord | <chmod222> It's not a magical property of for, system.nim just defines a couple of `iterator mpairs(a: var string): tuple[key: int, val: var char]` overloads |
17:32:41 | FromDiscord | <System64 ~ Flandre Scarlet> In reply to @juan_carlos "func that takes openArray[char]": BruhโตWhen I write a seq of bytes...โตI expect it to write it byte to byte, not a string representation of it https://media.discordapp.net/attachments/371759389889003532/1115694761999863808/image.png |
17:32:59 | FromDiscord | <that_dude> LOL |
17:33:41 | FromDiscord | <that_dude> Hope you don't need cast |
17:34:15 | FromDiscord | <chmod222> It did what you told it to, not what you meant |
17:34:15 | FromDiscord | <chmod222> Malicious compliance if I've ever seen it |
17:35:06 | FromDiscord | <that_dude> I would love to see a lang designed around malicious compliance |
17:48:20 | * | krux02_ quit (Remote host closed the connection) |
17:48:33 | * | krux02_ joined #nim |
18:07:40 | * | beholders_eye joined #nim |
18:11:13 | FromDiscord | <chmod222> I think that's C |
18:12:02 | FromDiscord | <chmod222> It will helpfully assume that once you triggered undefined behaviour it is free to completely ignore your invariants because nothing is real anymore |
18:12:46 | FromDiscord | <chmod222> Will it do so or will it wait until the perfect moment to do so? Who knows! That's part of the experience. |
18:13:13 | * | cedb quit (Quit: WeeChat 3.8) |
18:19:29 | * | beholders_eye quit (Ping timeout: 256 seconds) |
18:43:52 | FromDiscord | <dlesnoff> There this compilation of bad designs in programming languages in one programmin language https://m.youtube.com/watch%3Fv%3DvcFBwt1nu2U&ved=2ahUKEwio5cXxn6AhUEUKQEHX4UDa4QwqsBegQIERAE&usg=AOvVaw2h4wFDN3wHiuK2z3ExKkd2โตโตIt lacked malicious compliance though |
18:47:41 | * | ced2 joined #nim |
18:47:45 | * | ced2 is now known as cedb |
19:15:42 | * | oldpcuser joined #nim |
19:37:45 | * | beholders_eye joined #nim |
19:45:30 | * | ntat quit (Quit: Leaving) |
20:05:18 | FromDiscord | <voidwalker> how can I merge a literal json node made with % to another one ? |
20:05:32 | FromDiscord | <voidwalker> (edit) "to" => "with" |
20:15:32 | FromDiscord | <guttural666> any automatic way to find out what has to be public in a module and what doesn't have to be? |
20:19:46 | FromDiscord | <Elegantbeef> That makes 0 sense |
20:19:52 | FromDiscord | <Graveflo> In reply to @guttural666 "any automatic way to": that's not possible without knowing how the client code wants to use it |
20:19:54 | FromDiscord | <Elegantbeef> How does any automated tool know what's required to expose |
20:20:11 | FromDiscord | <Graveflo> just hide anything that would be bad if used from the outside. everything else public |
20:20:59 | FromDiscord | <guttural666> sure it does, check what internal other modules rely on proc X to be public, if that number is zero, it doesn't have to be public |
20:21:51 | FromDiscord | <Graveflo> thats not a good idea because you shouldn't me minimally public you should be minimally private |
20:21:51 | FromDiscord | <guttural666> In reply to @Graveflo "just hide anything that": obviously, but with heavy refactoring you might have a lot of stuff exposed that doesn't have to be |
20:21:59 | FromDiscord | <Elegantbeef> But what if it's like sequtils |
20:22:08 | FromDiscord | <Elegantbeef> Where all the procedures are utillities |
20:22:21 | FromDiscord | <Elegantbeef> You cannot automatically reason the accessibility of anything |
20:22:32 | FromDiscord | <Graveflo> wait why do you think something being public when it doesn't have to be is bad? |
20:22:32 | FromDiscord | <guttural666> strictly talking about the files in my project folder |
20:23:01 | FromDiscord | <guttural666> In reply to @Graveflo "wait why do you": potential collisions and LSP confusion |
20:23:17 | FromDiscord | <Elegantbeef> neither of those are reasonable |
20:23:25 | FromDiscord | <Elegantbeef> `import x except collision` |
20:23:35 | FromDiscord | <Elegantbeef> Lsp confusion makes 0 sense |
20:23:37 | FromDiscord | <Graveflo> yea I figured you would say that. I cant argue with that because its kinda true but you should instead adjust your import mechanisms and organization |
20:23:39 | FromDiscord | <guttural666> okay, then why not make everything public in the language by default |
20:23:48 | FromDiscord | <Graveflo> I wish they did |
20:24:03 | FromDiscord | <Elegantbeef> Cause accessibility controls implementation |
20:24:04 | FromDiscord | <Elegantbeef> You should only export the parts you want users to touch |
20:24:08 | FromDiscord | <voidwalker> sent a code paste, see https://play.nim-lang.org/#ix=4xDB |
20:24:34 | FromDiscord | <Elegantbeef> void on the quest for making the most unreadable code |
20:24:44 | FromDiscord | <voidwalker> (edit) "https://play.nim-lang.org/#ix=4xDB" => "https://play.nim-lang.org/#ix=4xDC" |
20:24:45 | FromDiscord | <guttural666> In reply to @Elegantbeef "You should only export": that is what I want and that is why I am asking if there are any ways to clean that up, apparently not |
20:25:01 | FromDiscord | <Elegantbeef> How can any tooling know what should be exported though is my question |
20:25:17 | FromDiscord | <Elegantbeef> Just cause a procedure isnt used does not mean it shouldnt be exported |
20:25:19 | FromDiscord | <voidwalker> Elegantbeef feel free to rewrite as long as it keeps the intent |
20:25:37 | FromDiscord | <Graveflo> he gave mechanics for it. Im sure that is not implemented anywhere guttual sry |
20:25:42 | FromDiscord | <guttural666> where-used analysis |
20:25:58 | FromDiscord | <Elegantbeef> sent a code paste, see https://paste.rs/p5wKO |
20:26:13 | FromDiscord | <Graveflo> It's hard enough to find a simple hack that makes everything public let alone conditionally across the scope of a project |
20:26:21 | FromDiscord | <Elegantbeef> That analysis fails to work on like 99% of code ๐ |
20:26:48 | FromDiscord | <voidwalker> so it's not possible to keep the same syntax ? I'm willing to assing it to a variable if needed, but having two kinds of syntax for fields doesn't feel right :\ |
20:26:58 | FromDiscord | <guttural666> In reply to @Elegantbeef "How can any tooling": tooling can look at the files in your project, detect that no file relies on proc X in module A being public -> doesn't have to be public |
20:27:04 | FromDiscord | <Elegantbeef> No clue I do not use json |
20:27:16 | FromDiscord | <Elegantbeef> Sure but that only works if you have 100% code coverage |
20:27:26 | FromDiscord | <voidwalker> I don't either, but this db lib I picked does, so I have no choice |
20:27:27 | FromDiscord | <guttural666> but it's fine was just asking out of curiousity |
20:27:29 | FromDiscord | <Elegantbeef> You might have a utility function that is public and only used conditionally |
20:27:46 | * | oldpcuser_ joined #nim |
20:28:07 | FromDiscord | <guttural666> then it would be required, anything that is compile time known to be potentially used is used |
20:28:21 | FromDiscord | <guttural666> anyway, not that important |
20:28:31 | FromDiscord | <Elegantbeef> To be clear I'm not dismissing the idea, just do not see how it'd actually work |
20:28:41 | FromDiscord | <Graveflo> so then before this check everything is public? because the binding rules would have to be greedy |
20:28:46 | FromDiscord | <guttural666> just like reference counting ๐ |
20:28:54 | * | oldpcuser quit (Killed (NickServ (GHOST command used by oldpcuser_))) |
20:28:58 | * | oldpcuser_ is now known as oldpcuse |
20:29:00 | * | oldpcuse is now known as oldpcuser |
20:29:40 | FromDiscord | <Graveflo> youll get your name clashing problem internally before what is to be make public or private is hashed out by the automation |
20:29:42 | FromDiscord | <Elegantbeef> That just doesnt seem sensible any utillity library would make procedures private |
20:30:06 | FromDiscord | <Elegantbeef> I feel like exporting is an explicit action anyway |
20:30:15 | FromDiscord | <guttural666> In reply to @Elegantbeef "That just doesnt seem": I know you can reason about this yourself obviously ๐ |
20:30:42 | FromDiscord | <guttural666> forget it ๐ |
20:31:10 | FromDiscord | <Elegantbeef> Well the reason I can reason it, is cause I'm the one defining the public API of my code |
20:32:42 | FromDiscord | <Graveflo> What I don't understand is that what guttural is saying... could would albeit with weirdness on a personal use only project, but for public facing APIs I dont understand why private is implicit and pbulic is explicit. Shouldn't a public facing API be able to handle most of its procs and data being manipulated without it shitting the bed? It just encourages bad APIs |
20:33:10 | FromDiscord | <Graveflo> (edit) "would" => "work" |
20:33:31 | FromDiscord | <guttural666> think private, const, compile time if possible etc. is de way |
20:35:02 | FromDiscord | <guttural666> (meaning should be the default) |
20:39:52 | FromDiscord | <Graveflo> well I agree with compile time and const but private is more like "dont touch that its not finished" or namespace pollution I guess. Pollution should be solved with module org though. It is what it is though, there isn't anything special that I know of that can manipulate how we define access control |
20:41:03 | FromDiscord | <guttural666> I think it also has compiler implications in terms of performance doesn't it? |
20:41:33 | FromDiscord | <Graveflo> no it doesn't matter if things are public or private. The compiler takes only what it needs. Except when you use method |
20:41:39 | FromDiscord | <Graveflo> those always get compiled no matter what |
20:41:48 | FromDiscord | <guttural666> ah okay |
20:47:11 | FromDiscord | <Elegantbeef> Nim has dead code elimination, only what is used is what is included |
20:48:08 | FromDiscord | <Graveflo> Is library compilation an exception to this? |
20:48:16 | FromDiscord | <Elegantbeef> Nope |
20:48:19 | FromDiscord | <Elegantbeef> `exportC` is used |
20:48:26 | FromDiscord | <Graveflo> oh that makes sense |
20:48:35 | FromDiscord | <Graveflo> you just saved me 20 min of testing thx |
20:48:53 | FromDiscord | <guttural666> In reply to @Elegantbeef "Nim has dead code": that is what I was thinking of |
20:49:32 | FromDiscord | <Elegantbeef> Who knew `nm -gD` took 20 mins ๐ |
20:49:53 | FromDiscord | <Graveflo> you underestimate my dumbness |
20:50:30 | FromDiscord | <Elegantbeef> You were going to use `std/dynlib`? |
20:50:48 | FromDiscord | <Graveflo> I was going to try everything under the sun bc I dont know what I'm doing |
20:55:38 | FromDiscord | <guttural666> does slicing and passing that to an OpenArray ever make sense if you're just reading if you don't need the specific bounds from outside? doesn't seem to save anything in terms of memory or performance |
20:56:48 | FromDiscord | <guttural666> for regex it would matter I guess |
20:56:57 | FromDiscord | <guttural666> maybe not even that |
20:57:11 | FromDiscord | <Graveflo> slicing a string? |
20:57:15 | FromDiscord | <guttural666> yeah |
20:57:37 | FromDiscord | <Graveflo> I think there are no-copy slices and copy slices |
20:59:25 | FromDiscord | <Graveflo> it should be more performant to pass an immutable view to the outside as opposed to copying the slice |
20:59:35 | FromDiscord | <huantian> you said the word openarray and beef didn't immediately answer? the bridge must be down or something |
20:59:49 | FromDiscord | <Graveflo> or copying the slice-of I guess the slice is technically its own entity |
20:59:54 | FromDiscord | <guttural666> ๐คฃ |
21:01:31 | FromDiscord | <Graveflo> also make sure you are measuring performance in release mode and you can always test stuff like that by looking at the addresses.... except for the fact that `seq` and `string` can make it a little difficult to get their actual heap address but I have complained enough about that here |
21:20:02 | FromDiscord | <voidwalker> `Exception message: assignment to discriminant changes object branch` |
21:20:33 | FromDiscord | <voidwalker> what could be wrong ? All I am doing is set `result.kind = list` on the first page of a proc that returns that object type |
21:22:02 | FromDiscord | <Graveflo> what type is `result` what type is `list` |
21:22:04 | FromDiscord | <voidwalker> and that proc is called by another that returns a seq[] of that object type |
21:22:34 | FromDiscord | <voidwalker> `list` is enum, result is object variant with kind of that enum type |
21:23:15 | FromDiscord | <Graveflo> okay I've never seen this error before but typically `kind` is reserved for an enum that often interacts with an "object variant" after the variable is initialized it cannot change it's type |
21:23:40 | FromDiscord | <voidwalker> ohhh maybe result initialized it to a default (the first enum) ? |
21:24:01 | FromDiscord | <Graveflo> You have to set that when it's being initialized |
21:24:01 | FromDiscord | <voidwalker> although this would be a bug i'd say |
21:24:21 | FromDiscord | <voidwalker> well it is created in the proc.. and I set it on the first line, where I get the error |
21:24:46 | FromDiscord | <voidwalker> it doesn't have to be a ref, no ? |
21:25:10 | FromDiscord | <Graveflo> no that is the main advantage to that form I believe: https://nim-lang.org/docs/tut2.html#object-oriented-programming-object-variants |
21:25:39 | FromDiscord | <voidwalker> ` echo result.kind` : media |
21:25:52 | FromDiscord | <voidwalker> hah so it does initialize it with the first enum.. how do I get around this ? |
21:26:28 | FromDiscord | <Graveflo> in the example I posted there is a `var n = Node(kind: nkFloat, floatVal: 1.0)` replace `kind` with what you want when the object is being created |
21:26:40 | FromDiscord | <voidwalker> so I can't use result ? |
21:27:15 | FromDiscord | <Graveflo> yea that might not work because it's going to be setup in a place you can't control |
21:27:33 | FromDiscord | <Graveflo> or at least I dont know how to control `result`s initialization |
21:28:09 | * | xet7 quit (Remote host closed the connection) |
21:28:13 | FromDiscord | <Graveflo> and ofc you can just say `result = n` |
21:29:14 | FromDiscord | <voidwalker> object types should generally start with capital letter, right ? |
21:30:00 | FromDiscord | <Graveflo> yes |
21:39:18 | * | oldpcuser quit (Quit: "mIRC sucks because is non-free software" Richard Stallman) |
21:40:57 | * | xet7 joined #nim |
21:42:19 | * | oldpcuser joined #nim |
21:43:14 | FromDiscord | <Elegantbeef> @huantian\: i was too busy doing real life things |
21:43:39 | FromDiscord | <Elegantbeef> Fixing a free electric mower, watering my plants, playing with my dogs, all more important than openArrays! ๐ |
21:44:28 | FromDiscord | <Elegantbeef> Right this is what `toOpenArray` isโต(@Graveflo) |
21:48:49 | * | oldpcuser quit (Remote host closed the connection) |
21:51:14 | * | oldpcuser joined #nim |
22:03:12 | * | oldpcuser quit (Remote host closed the connection) |
22:03:54 | * | oldpcuser joined #nim |
22:15:25 | * | beholders_eye quit (Ping timeout: 240 seconds) |
22:20:35 | FromDiscord | <guttural666> shouldn't the compiler be able to deduce the type on the right? it's find to do it on the left https://media.discordapp.net/attachments/371759389889003532/1115767217410293890/image.png |
22:27:03 | FromDiscord | <Graveflo> missing a `:` ? |
22:28:15 | FromDiscord | <Graveflo> I also dont see how it finds it on the left |
22:33:13 | FromDiscord | <guttural666> don't think so case doesn't need a : (although it accepts writing one weirdly enough) |
22:34:01 | FromDiscord | <Graveflo> idk it just seems like `move` isnt a valid name in `TokenKind` I dont see how the left implies that it is |
22:34:05 | FromDiscord | <guttural666> this will force it and this compile, but sometimes the compiler will see this which is very strange https://media.discordapp.net/attachments/371759389889003532/1115770615937384538/image.png |
22:34:24 | FromDiscord | <Graveflo> oh then move is shadowed |
22:34:31 | FromDiscord | <guttural666> maybe move shadows something ๐ฎ |
22:34:59 | FromDiscord | <Graveflo> yea thats actually a documented thing. I dont remember why I read it. I just use pre enums all the time anyways |
22:35:09 | FromDiscord | <Graveflo> but yea you can only do that when there is no conflict of names |
22:35:51 | FromDiscord | <guttural666> I always {.pure.} my enums but maybe there is something in std/re or std/strutils |
22:36:22 | FromDiscord | <Elegantbeef> `move` is a keyword |
22:36:25 | FromDiscord | <Elegantbeef> Or a procedure i guess |
22:36:34 | FromDiscord | <Elegantbeef> It forces movement of memory |
22:37:02 | FromDiscord | <guttural666> interesting, probably is system move https://nim-lang.org/docs/system.html#move%2CT |
22:37:20 | FromDiscord | <guttural666> compiler error was shite tho |
22:37:47 | * | void09 quit (Remote host closed the connection) |
22:38:55 | FromDiscord | <guttural666> https://media.discordapp.net/attachments/371759389889003532/1115771828103807056/image.png |
22:38:55 | FromDiscord | <guttural666> meh |
22:39:02 | * | void09 joined #nim |
22:39:26 | FromDiscord | <Graveflo> yea not great but it did tell you that move is a proc |
22:39:44 | FromDiscord | <guttural666> I guess it did |
22:39:50 | FromDiscord | <Graveflo> I put this in `nim.cf` for projects to get more info `declaredLocs:on` |
22:40:01 | FromDiscord | <Graveflo> (edit) "`nim.cf`" => "`nim.cfg`" |
22:40:22 | om3ga | mratsim: scroll at the bottom of the page https://forum.nim-lang.org/t/10248 |
22:40:54 | FromDiscord | <guttural666> In reply to @Graveflo "I put this in": what does that do? |
22:42:16 | FromDiscord | <Graveflo> in some instances itll tell you where things are. I might have told you that `move` was declared in `system.nim` |
22:42:27 | om3ga | mratsim, understanding how OS works is more important than high level abstractions. So I was right in this case. |
22:42:47 | FromDiscord | <Graveflo> and I add to local `.cfg` not the global one for that. You can also just use a CLI switch if you have a good memory |
22:59:33 | FromDiscord | <Elegantbeef> @Verdagon Zoom just Pr'd to your site, but if you have any question about Nim concepts, feel free to ask ๐ |
23:01:37 | FromDiscord | <Elegantbeef> Wait it was an issue ๐ |
23:01:38 | FromDiscord | <Zoom> I was so rude I haven't even PR a fix, just complained. |
23:01:38 | FromDiscord | <Elegantbeef> Eh no big deal I got them to update to reference how Nim does cyclical collection in one of their posts |
23:01:39 | FromDiscord | <Elegantbeef> Always fun to talk about this stuff |
23:01:43 | FromDiscord | <Zoom> I don't think a public apology written by me would have been merged. |
23:01:59 | FromDiscord | <Zoom> (I'm kidding) |
23:03:33 | FromDiscord | <Elegantbeef> "I was wrong and promise to never be wrong again" |
23:19:43 | * | oldpcuser quit (Remote host closed the connection) |
23:20:07 | * | oldpcuser joined #nim |
23:20:10 | * | oldpcuser quit (Remote host closed the connection) |
23:20:31 | * | oldpcuser joined #nim |
23:32:16 | * | jmd_ joined #nim |
23:33:19 | * | krux02_ quit (Quit: Leaving) |
23:55:30 | * | derpydoo joined #nim |