00:00:07 | FromDiscord | <sOkam!> Obv wrong... but common sense makes me think that |
00:00:14 | FromDiscord | <Elegantbeef> Nim's for loops work on iterators they dont only handle ints |
00:00:52 | FromDiscord | <Elegantbeef> you can do `for(string i = "hello"; i.Length < 100; i + "a")` in C# |
00:01:10 | FromDiscord | <Elegantbeef> In nim you define `iterator`s which `yield` a value |
00:03:05 | FromDiscord | <sOkam!> i see, makes sense |
00:03:17 | FromDiscord | <sOkam!> I like nim's way a lot more (unsurprisingly) |
00:03:26 | FromDiscord | <sOkam!> (edit) "I like nim's way a lot more (unsurprisingly) ... " added "🙂" |
00:08:08 | FromDiscord | <sOkam!> Oh, I just noticed this inside godot-cpp...↵https://github.com/godotengine/godot-cpp/blob/master/binding_generator.py |
00:08:33 | FromDiscord | <sOkam!> Could it be worth it to modify that for nim, or not at all? |
00:09:07 | FromDiscord | <Elegantbeef> I mean we have the NimVM which can generate code, so there isnt much reason to use python |
00:09:36 | FromDiscord | <Elegantbeef> You're going to be doing the same thing but instead of using python using Nim's macros preferablly |
00:12:03 | FromDiscord | <sOkam!> In reply to @Elegantbeef "I mean we have": modifying that file could be a reason |
00:12:35 | FromDiscord | <sOkam!> its massive, though |
00:19:11 | FromDiscord | <qb> How can I avoid that some matches won't be grouped on `scanf`? I don't want to use a json library there because that json string is really long. https://play.nim-lang.org/#ix=3Jo1 |
00:23:07 | FromDiscord | <Elegantbeef> You might have to use your own matchers |
00:23:09 | FromDiscord | <qb> Like this works but I wan't to skip that `t` variables https://play.nim-lang.org/#ix=3Jo2 |
00:25:28 | FromDiscord | <Elegantbeef> Alternatively use `scanp` |
01:22:41 | FromDiscord | <qb> sent a code paste, see https://play.nim-lang.org/#ix=3Jod |
01:22:46 | FromDiscord | <qb> Umm? |
01:30:34 | FromDiscord | <Yardanico> sent a code paste, see https://play.nim-lang.org/#ix=3Jof |
01:30:42 | FromDiscord | <Yardanico> idk really |
01:30:51 | FromDiscord | <qb> just deleted it and let nimble make a new one. Same |
01:30:57 | FromDiscord | <Yardanico> are you sure your github api token has write access to that repo? |
01:30:59 | FromDiscord | <Yardanico> (edit) "that" => "your packages" |
01:31:05 | FromDiscord | <Yardanico> (edit) "are you sure your github api token ... has" added "that you're using for nimble publish" |
01:31:38 | FromDiscord | <qb> Guess thats fine huh https://media.discordapp.net/attachments/371759389889003532/924112116099711036/Bildschirmfoto_von_2021-12-25_02-31-09.png |
01:53:23 | * | xet7 quit (Ping timeout: 268 seconds) |
01:56:28 | * | Colt quit (Remote host closed the connection) |
01:57:04 | * | Colt joined #nim |
01:58:17 | FromDiscord | <TryAngle> is there a good way to compare floating point numbers in unit tests? |
02:06:35 | * | neceve quit (Ping timeout: 256 seconds) |
02:08:11 | FromDiscord | <Yardanico> https://nim-lang.org/docs/math.html#almostEqual%2CT%2CT%2CNatural |
02:24:18 | FromDiscord | <TryAngle> In reply to @Yardanico "https://nim-lang.org/docs/math.html#almostEqual%2CT": thx |
02:39:16 | FromDiscord | <retkid> feels like nothing works today |
02:39:20 | FromDiscord | <retkid> hate threading in nim |
02:39:34 | FromDiscord | <retkid> passed a channel created on shared and it segfaults |
02:39:47 | FromDiscord | <retkid> is this expected? |
02:39:49 | nrds | <Prestige99> Can you share an example? |
02:39:58 | FromDiscord | <retkid> not easily, no |
02:40:08 | FromDiscord | <retkid> uh |
02:40:13 | FromDiscord | <retkid> gimme a minute |
02:43:51 | FromDiscord | <Yardanico> if you use a channel you don't need to use shared types |
02:44:00 | FromDiscord | <Yardanico> you send/receive normal types through the channel |
02:44:05 | FromDiscord | <Yardanico> and they're just always deep copied |
02:45:17 | FromDiscord | <retkid> or something like that |
02:45:18 | FromDiscord | <retkid> sent a code paste, see https://play.nim-lang.org/#ix=3Joo |
02:45:47 | FromDiscord | <retkid> ah ill try that, so i dont share the pointer? |
02:47:59 | FromDiscord | <Rika> I think you don’t need to use shared memory on the channel itself |
02:48:33 | FromDiscord | <Yardanico> as @Rika said |
02:48:47 | FromDiscord | <Yardanico> also you don't need to send the channel itself to the thread |
02:48:52 | FromDiscord | <Yardanico> ah maybe you do, I forgot |
02:49:04 | FromDiscord | <Rika> Ah wait you do I think |
02:49:06 | FromDiscord | <Rika> https://nim-lang.org/docs/channels_builtin.html |
02:49:09 | FromDiscord | <Rika> Yeah here it says you do |
02:49:30 | FromDiscord | <Rika> In which case I do not know the reason for the segfault |
02:49:55 | FromDiscord | <retkid> yea ive used them quite a bit |
02:50:04 | FromDiscord | <retkid> i think its just the god spitting me |
02:50:07 | FromDiscord | <Rika> Do you get a trace after the fault? |
02:50:10 | FromDiscord | <retkid> (edit) "god" => "gods" |
02:50:13 | FromDiscord | <retkid> uhh |
02:50:20 | FromDiscord | <Rika> If you do it would be nice if you sent it as well |
02:50:26 | FromDiscord | <retkid> read from nil |
02:50:28 | FromDiscord | <Rika> A stack trace |
02:50:41 | FromDiscord | <Rika> Stuff like function names and stuff show on it |
02:50:46 | FromDiscord | <Rika> Line numbers too |
02:50:57 | FromDiscord | <Rika> Only shows if you have them on, so not on release |
02:51:57 | FromDiscord | <Yardanico> ah right @retkid |
02:52:00 | FromDiscord | <Yardanico> or not right |
02:52:13 | FromDiscord | <Yardanico> hmmmmm |
02:52:14 | FromDiscord | <retkid> ah left? |
02:52:44 | FromDiscord | <Rika> Lol |
02:52:46 | FromDiscord | <Yardanico> ah right you forgot to open the damn channel |
02:52:50 | FromDiscord | <retkid> the stack strace comes from storeAux |
02:52:54 | FromDiscord | <retkid> :P: |
02:52:55 | FromDiscord | <retkid> pesogjfgjg |
02:52:57 | FromDiscord | <retkid> LOL |
02:53:01 | FromDiscord | <Rika> Lol |
02:53:13 | FromDiscord | <Yardanico> no need for your `ptr` stuff |
02:53:14 | FromDiscord | <Yardanico> sent a code paste, see https://play.nim-lang.org/#ix=3Jop |
02:53:17 | FromDiscord | <Yardanico> this works just fine and it's just like in the docs |
02:53:17 | FromDiscord | <Rika> Why do you need to open channels |
02:53:24 | FromDiscord | <Yardanico> to initialize them |
02:53:42 | FromDiscord | <retkid> or well |
02:53:42 | FromDiscord | <retkid> sent a code paste, see https://play.nim-lang.org/#ix=3Joq |
02:53:43 | FromDiscord | <retkid> example |
03:06:13 | * | vicfred joined #nim |
03:06:16 | FromDiscord | <retkid> so uh you were wrong |
03:06:23 | FromDiscord | <retkid> you do need the pointers |
03:06:30 | FromDiscord | <retkid> at least for some reason whatever im doing |
03:09:12 | FromDiscord | <Yardanico> show the code? |
03:26:01 | * | vicfred quit (Quit: Leaving) |
03:29:04 | NimEventer | New thread by Niminem: Using the Compiler lib without needing the devel version of Nim, see https://forum.nim-lang.org/t/8739 |
04:00:40 | * | vicfred joined #nim |
04:19:21 | * | arkurious quit (Quit: Leaving) |
04:31:48 | * | brocc joined #nim |
04:34:01 | * | vicfred quit (Quit: Leaving) |
04:35:02 | * | vicfred joined #nim |
04:48:49 | FromDiscord | <TryAngle> sent a code paste, see https://play.nim-lang.org/#ix=3JoI |
04:50:24 | FromDiscord | <Rika> [0] |
04:50:28 | FromDiscord | <Yardanico> result[0] |
04:50:30 | FromDiscord | <Rika> Like an array |
04:50:37 | FromDiscord | <Yardanico> it's no different from normal tuple index access |
04:50:48 | FromDiscord | <TryAngle> lol |
04:51:04 | FromDiscord | <TryAngle> I thought I did that and it didn't work |
04:51:06 | FromDiscord | <Rika> We all have these moments |
04:51:12 | FromDiscord | <TryAngle> in my head |
04:51:15 | FromDiscord | <TryAngle> o_O |
04:51:26 | FromDiscord | <Yardanico> `result` doesn't have some special syntax, it's the same as with normal variables |
04:52:05 | FromDiscord | <TryAngle> In reply to @Yardanico "`result` doesn't have some": yes but I don't know how to index normal tuples either 😅 ↵this was just the example where I needed it |
04:52:12 | FromDiscord | <TryAngle> (edit) "needed" => ""needed"" |
04:57:23 | * | tinytim is now known as tinystoat |
05:34:47 | FromDiscord | <Elegantbeef> oh and @TryAngle if you get tired of repeating yourself https://github.com/beef331/constructor#constructor-1 |
05:35:27 | FromDiscord | <TryAngle> In reply to @Elegantbeef "oh and <@147447489316913152> if": I already reexport your constructure library in my "utility" lirbary XD |
05:35:35 | FromDiscord | <TryAngle> (edit) "constructure" => "constructor" |
05:35:37 | FromDiscord | <Elegantbeef> Oh |
05:35:53 | FromDiscord | <Elegantbeef> I just updated/removed a bunch of shit so have fun getting brokey stuff |
05:36:24 | FromDiscord | <TryAngle> 👍 |
05:43:49 | * | vicfred quit (Quit: Leaving) |
05:53:27 | FromDiscord | <codic> so I'm refactoring my wm from one >1k loc file to lots of separate files, and I've run into a issue with recursive dependencies |
05:53:57 | FromDiscord | <codic> sent a code paste, see https://play.nim-lang.org/#ix=3JoV |
05:54:16 | FromDiscord | <codic> sent a code paste, see https://play.nim-lang.org/#ix=3JoW |
05:54:16 | FromDiscord | <codic> the compiler does not like this pattern |
05:54:28 | FromDiscord | <codic> `` |
05:54:35 | FromDiscord | <codic> how do I fix it? |
05:54:37 | FromDiscord | <codic> sent a code paste, see https://play.nim-lang.org/#ix=3JoX |
05:57:07 | FromDiscord | <Elegantbeef> Hard to say without seeing where the recursion comes from |
05:58:54 | FromDiscord | <TryAngle> In reply to @Elegantbeef "Hard to say without": looks like Wm is defined in wm.nim↵and he imports wm.nim in configurerequest.nim↵but also imports configurerequest.nim in wm.nim |
05:59:13 | FromDiscord | <TryAngle> same with XConfigureRequestEvent maybe? |
05:59:20 | FromDiscord | <TryAngle> (edit) "maybe?" => "maybe but other way around with the modules?" |
05:59:39 | FromDiscord | <Elegantbeef> Well it's hard to fix the import order without the entire file to reason where it's at |
05:59:54 | FromDiscord | <Elegantbeef> Depending on what's going on this just needs a delayed import |
06:00:07 | FromDiscord | <Elegantbeef> Otherwise the structure needs reorganized |
06:03:22 | FromDiscord | <Elegantbeef> So codic in typical fashion push a branch is the easier thing for me |
06:16:00 | FromDiscord | <TryAngle> can I add a ↵`T.doSomething()`↵for one type only somehow? |
06:16:24 | FromDiscord | <impbox [ftsf]> `proc doSomething(a: TheType) =` |
06:16:35 | FromDiscord | <TryAngle> 😳 |
06:16:55 | FromDiscord | <Elegantbeef> you mean `proc doSomething(_: typedesc[TheType])` |
06:17:07 | FromDiscord | <impbox [ftsf]> is T a type or a variable of the type? |
06:17:22 | FromDiscord | <TryAngle> sent a code paste, see https://play.nim-lang.org/#ix=3Jp4 |
06:17:47 | FromDiscord | <Elegantbeef> Yea my example |
06:17:49 | FromDiscord | <impbox [ftsf]> yeah, what beef said |
06:17:53 | FromDiscord | <TryAngle> ok ty guys |
06:18:13 | arkanoid | Do you thing is worth converting a python project into a nim one while keeping all the python libs and so make it a project completely based on nimpy? |
06:18:30 | FromDiscord | <codic> In reply to @TryAngle "same with XConfigureRequestEvent maybe": no XConfigureRequestEvent is defined in the x11 package |
06:18:33 | FromDiscord | <Rika> What is the "worth" you're seekibg |
06:18:37 | FromDiscord | <codic> In reply to @Elegantbeef "So codic in typical": what do you mean? |
06:18:38 | FromDiscord | <Elegantbeef> Given my disdain towards python i'm not qualified to answer this |
06:18:41 | FromDiscord | <Rika> (edit) "seekibg" => "seeking" |
06:18:45 | FromDiscord | <impbox [ftsf]> or you are |
06:18:52 | FromDiscord | <codic> do replies work through matrix? |
06:18:54 | FromDiscord | <impbox [ftsf]> leave python in the wind |
06:18:57 | FromDiscord | <Elegantbeef> Yes |
06:19:05 | FromDiscord | <codic> so wdym by push a branch? |
06:19:17 | FromDiscord | <Rika> Make a branch on your repo so we can see the whole thing |
06:19:20 | FromDiscord | <Elegantbeef> Push the current non compiling code to a branch i can checkout |
06:19:58 | FromDiscord | <codic> oh |
06:19:59 | FromDiscord | <codic> sure |
06:20:10 | arkanoid | "Worth" to me is putting static typing wherever possibile, also adding distinct PyObjects types |
06:20:14 | FromDiscord | <codic> it doesn't do anything useful right now, and will not compile anyways, but I just want to fix this recursion error for now |
06:20:24 | FromDiscord | <TryAngle> In reply to @arkanoid "Do you thing is": I've rewrittine 2 rust projects of mine in nim already lmao↵and with python I can imagine that copy pasting 90% works |
06:20:26 | FromDiscord | <codic> (not compile because none of event handlers are implemented) |
06:20:37 | FromDiscord | <codic> > and with python I can imagine that copy pasting 90% works↵lmao no |
06:20:53 | FromDiscord | <impbox [ftsf]> maybe if python had types |
06:21:03 | FromDiscord | <codic> still probably no, but would bring it closer |
06:21:11 | FromDiscord | <impbox [ftsf]> the hardest bit about porting python code is trying to figure out what types things should be |
06:21:16 | FromDiscord | <Elegantbeef> Maybeeif python was nim |
06:21:20 | FromDiscord | <TryAngle> really? with rust for example I could copy paste almost all non-library specific code |
06:21:39 | FromDiscord | <TryAngle> like ofc. I had to change some things but it was really not much |
06:21:55 | FromDiscord | <Leonardo da Vinci> In reply to @Elegantbeef "Given my disdain towards": Why do you dislike python? |
06:22:04 | arkanoid | I'm perfectly fine with converting my own python code to nim. I already favor nim whenever possibile. The struggle is when I heavily depend on python libs |
06:22:18 | FromDiscord | <impbox [ftsf]> sounds like a topic for #languagewars |
06:22:22 | FromDiscord | <Elegantbeef> Do i really need to make a list 😀 |
06:22:44 | FromDiscord | <TryAngle> In reply to @arkanoid "I'm perfectly fine with": I feel that↵that's why I'm putting an almost numpy copy on Neo right now XD |
06:23:08 | FromDiscord | <Elegantbeef> Suffice to say lack of portable programs and unenforced static typing drive me up the wall |
06:23:13 | FromDiscord | <Rika> Dynamic typing makes everything hairy and you don't realise how heavily it is used in Python until you try to convert it into Nim |
06:24:16 | FromDiscord | <codic> In reply to @codic "it doesn't do anything": with this in mind |
06:24:18 | FromDiscord | <codic> https://github.com/codic12/worm/tree/refactor |
06:24:32 | FromDiscord | <Elegantbeef> Yea i want to fix the recursion error 😛 |
06:24:58 | arkanoid | Numpy copy? Are you aware the shitload of complex problems already solved in numpy code? You think you can replace it easily? |
06:25:03 | FromDiscord | <codic> In C++ I could do this just fine by using a header but not sure how to do it in nim |
06:25:09 | arkanoid | Also pandas and many scientific stacks |
06:27:23 | FromDiscord | <Elegantbeef> First `WM` isnt exported |
06:27:32 | FromDiscord | <Elegantbeef> Secondly you have a bunch of forward declarations but no implementations |
06:27:47 | FromDiscord | <Elegantbeef> Thirdly is there any real reason WM needs to `import configurerequest`? |
06:28:10 | FromDiscord | <Just Jasmine, Please> Hey! I was wondering what would be good resources for learning how to make a website in nim? I know some gdscript so learning about variables is kind of grating, and usually looking at nim code my only issue is when to use self. Thank you for any resources! |
06:28:33 | FromDiscord | <Elegantbeef> "when to use self" inotherwords never 😜 |
06:29:00 | FromDiscord | <Elegantbeef> https://github.com/karaxnim/karax is a good place to look |
06:29:03 | arkanoid | Elegantbeef lucky you that successfully get rid of python. My anger with python is driven by the same problems you've been listing. The problem is that if you need to work on tabular data, strings, graphs, scientific representations, guis and dashboard, nim is not helping at all |
06:29:13 | FromDiscord | <Elegantbeef> Also https://github.com/karaxnim/awesome-karax |
06:29:20 | FromDiscord | <Elegantbeef> I never relied on python |
06:29:50 | FromDiscord | <Elegantbeef> Nim works well with strings |
06:30:02 | FromDiscord | <Just Jasmine, Please> You're awesome! thank you! |
06:30:13 | FromDiscord | <Elegantbeef> Dont say that i might develop an ego |
06:30:31 | FromDiscord | <Elegantbeef> I'm already an asshole, an asshole with an ego is just worse |
06:30:35 | FromDiscord | <Rika> "Might develop an ego" says the one with a massive ego |
06:30:43 | arkanoid | Eleganfbeef, try working with large string tables with array/datamancer |
06:31:09 | FromDiscord | <Just Jasmine, Please> I'm getting an ego as I learn to love myself, lol |
06:31:11 | FromDiscord | <codic> In reply to @Elegantbeef "First `WM` isnt exported": Ok, just realized that, but exporting it doesn't change anything |
06:31:13 | FromDiscord | <Elegantbeef> arkanoid you're challenging me, but havent given me any data |
06:31:22 | FromDiscord | <Elegantbeef> Like i said |
06:31:28 | FromDiscord | <codic> In reply to @Elegantbeef "Secondly you have a": Yeah like I said I'll copy-paste them after I fix this recursion error for the first implementation (configurerequest) |
06:31:30 | FromDiscord | <Elegantbeef> You dont need to import configure request in WM afaict currently |
06:31:38 | FromDiscord | <codic> oh? |
06:31:55 | FromDiscord | <Elegantbeef> Like when you have a reason to import it comeback |
06:32:38 | FromDiscord | <codic> ok first of all I just switched to my other monitor and now my editor is 4x bigger, wtf |
06:32:49 | FromDiscord | <codic> but anyways, let me try that |
06:32:52 | FromDiscord | <Elegantbeef> worm.diff https://media.discordapp.net/attachments/371759389889003532/924187924034117682/worm.diff |
06:32:55 | FromDiscord | <Elegantbeef> Here's my diff |
06:33:02 | FromDiscord | <Elegantbeef> Save you a few seconds |
06:33:10 | arkanoid | Just generate your own random/constant strings and build large tables. Then you can try to do string operations on them and/or move/serialize it and check memory usage. |
06:33:47 | FromDiscord | <Elegantbeef> I mean if i'm making a bunch of large strings and concerned of memory i'm doing `ref string` |
06:33:52 | FromDiscord | <Rika> I assume this is the mutable/immutable string difference |
06:33:54 | FromDiscord | <codic> In reply to @Elegantbeef "worm.diff": thanks |
06:34:03 | FromDiscord | <TryAngle> when using `std/random.gauss` do I need to call randomize() everytime I use it or just once? |
06:34:04 | FromDiscord | <Elegantbeef> Indeed rika |
06:34:17 | FromDiscord | <Elegantbeef> You just need to initialized the global random state |
06:34:32 | FromDiscord | <Elegantbeef> Do edits from matrix -\> discord still duplicate? |
06:34:55 | FromDiscord | <TryAngle> edit something |
06:35:00 | FromDiscord | <Elegantbeef> Oh nevermind they just dont even propagate |
06:35:02 | FromDiscord | <Just Jasmine, Please> These resources are amazing so far, thank you |
06:35:12 | * | elph quit (Quit: Connection closed for inactivity) |
06:35:14 | FromDiscord | <codic> In reply to @Elegantbeef "worm.diff": wait why did you remove all the event handlers |
06:35:17 | FromDiscord | <codic> i was going to implement them |
06:35:17 | FromDiscord | <Elegantbeef> You get thanked multiple times just for linking something |
06:35:31 | FromDiscord | <Elegantbeef> Cause they're all forward declares without implementations meaning i couldnt compile |
06:35:41 | FromDiscord | <TryAngle> In reply to @Elegantbeef "You just need to": so I just need to call it once the program starts? |
06:35:48 | FromDiscord | <Elegantbeef> Yep |
06:35:53 | FromDiscord | <codic> In your diff you did import events/configurerequest |
06:36:02 | FromDiscord | <Elegantbeef> Yep |
06:36:05 | FromDiscord | <codic> Oh I don't actually need the forward declarations there |
06:36:09 | FromDiscord | <codic> Cool |
06:36:12 | FromDiscord | <codic> One benefit to using multiple files |
06:36:23 | FromDiscord | <codic> Thanks |
06:36:37 | FromDiscord | <Elegantbeef> Without using the configure request i cannot be certain the delayed import will work for you |
06:36:45 | FromDiscord | <Elegantbeef> But that's basically the pattern you'll want to follow iirc |
06:36:50 | arkanoid | There's nothing like good string data manipulation in nim scientific stack. Real stacks handles strings like a database does, kinda, so the memory layout of them is handled accordingly. Nim ref strings are not ok to move string data |
06:37:15 | FromDiscord | <Elegantbeef> Yea i dont do scientific computing, i do game dev mostly |
06:37:25 | FromDiscord | <Elegantbeef> So my idea of what needs to be done is nowhere near yours |
06:37:59 | FromDiscord | <Elegantbeef> I need an actual problem proposed/solution in front of me to actually understand the issues |
06:38:04 | arkanoid | Apache arrow project is the good representation on what has to be done in nim |
06:38:08 | * | vicfred joined #nim |
06:38:35 | arkanoid | In particular the memory layout for strings |
06:38:38 | FromDiscord | <TryAngle> sent a code paste, see https://play.nim-lang.org/#ix=3Jp5 |
06:39:16 | FromDiscord | <Elegantbeef> Reread try |
06:39:26 | FromDiscord | <Elegantbeef> "first usage of the procs from this module" |
06:39:40 | arkanoid | I mean this https://arrow.apache.org/ |
06:40:17 | FromDiscord | <Elegantbeef> Yea i found it |
06:40:27 | FromDiscord | <Elegantbeef> I've got a basis of what it is |
06:40:39 | arkanoid | If nim data stacks would use this memory layout, it would be ready to be views as numpy data or R data or whatever data and use FFI accordingly |
06:41:05 | FromDiscord | <TryAngle> In reply to @Elegantbeef ""first usage of the": I'm stupid >.<,↵so `this` is the rand module? |
06:41:12 | FromDiscord | <Elegantbeef> Yes |
06:41:15 | FromDiscord | <evoalg> In reply to @Elegantbeef "<@900872397224280125>\: here's you're weekly": Thank you for my xmas present! |
06:41:16 | FromDiscord | <TryAngle> ok ty |
06:41:42 | FromDiscord | <Elegantbeef> I removed some of the mess mentioned before, any more things i should add evo? |
06:42:13 | FromDiscord | <evoalg> gosh I dunno! |
06:44:08 | FromDiscord | <Elegantbeef> I looked at sequtils and didnt see anything else that made sense |
06:44:24 | FromDiscord | <Elegantbeef> I still wish i could have `zip` work as an iterator |
06:44:48 | arkanoid | Elegantbeer, here you can find some experiments made by me to share data between nim and numpy via arrow, but making this work for strings requires much more work https://github.com/SciNim/scinim/issues/8#issuecomment-991844883 |
06:44:54 | FromDiscord | <Elegantbeef> There's just no way without making closures of the iterator |
06:45:47 | FromDiscord | <Elegantbeef> arkanoid we have metaprogramming so imagine we can do a 0 cost abstraction ontop of the arrow buffer to a sequence |
06:45:54 | FromDiscord | <evoalg> a good thing about python is that it has loads of iterators / generators ... it has to because it's already slow and it doesn't want to be any slower ... and when I use nim and it's really fast, it leaves a bad taste in my mouth if it's doing wasteful copies (which is bad for both memory and speed) ... so I really appreciate slicerator, thank you @ElegantBeef 😄 😄 |
06:45:58 | FromDiscord | <Elegantbeef> I'll have to look at the code to see if i can reason it |
06:46:51 | FromDiscord | <evoalg> In reply to @Elegantbeef "I still wish i": but slicerator zip ... is it still less overhead? |
06:47:07 | FromDiscord | <Elegantbeef> It emits a sequence so nope |
06:47:37 | FromDiscord | <Elegantbeef> It's capable of zipping N number of iterators though |
06:48:33 | FromDiscord | <evoalg> indeed it's impressive ... it even takes as arguments the results of zip'ed up lists |
06:50:05 | FromDiscord | <Elegantbeef> God damn it arkanoid, you dont mention stuff like this to me, this sounds like a fun thing to write code for |
06:50:36 | FromDiscord | <evoalg> arrays, lists, strings ... anything iterable ... and any amount of them ... I was missing that in python as pythons zip can take any number of args, but you've provided that so thank you! ... one of the benefits of nim being a small community is I can talk people who can actually change nim |
06:51:52 | FromDiscord | <evoalg> ... and Yards is fixing sugar's collect scope ... impressive that things get looked at so fast and it's not all bogged down |
06:52:20 | arkanoid | I know, but I very far from your capacity in writing nim code with low overhead and macros. I've been thinking about doing it on my own but not sure as writing scientific stack requires some low level knowledge of the source data buffers |
06:53:14 | FromDiscord | <Elegantbeef> Yea i'm just looking at https://arrow.apache.org/docs/format/Columnar.html and my mind is going "hmm `ArrowBuffer[T]` can be done, just requires codifing this spec" |
06:55:01 | arkanoid | Elegantbeef, please have a look at the C abi too https://arrow.apache.org/docs/format/CDataInterface.html |
06:55:03 | FromDiscord | <Elegantbeef> I mean if you tak a whirl at it i dont mind helping |
06:55:10 | FromDiscord | <Elegantbeef> I'm nothing if not helpful |
06:57:05 | arkanoid | Thanks, I'll consider it. If I will ever find time to develop this |
07:00:02 | FromDiscord | <Elegantbeef> It's an interesting spec |
07:00:38 | FromDiscord | <Elegantbeef> And we can do some fun things like making it so we can interact with it like actual objects for instance `myArrBuffer[index].field = 300` can be 100% valid 😀 |
07:01:14 | FromDiscord | <Elegantbeef> The C ABI seems simpler |
07:04:09 | FromDiscord | <Elegantbeef> Wait until you run into a simple compiler bug that i can fix 😛↵(@evoalg) |
07:05:16 | FromDiscord | <evoalg> yea I want play with slicerator with some tests now that aoc is over (nearly) |
07:06:07 | FromDiscord | <Elegantbeef> Still keeping with AOC, nice |
07:06:17 | arkanoid | Elegantbeef, and the best part is that this would make a bridge with a lot of stuff https://arrow.apache.org/img/shared.png |
07:08:31 | FromDiscord | <Elegantbeef> Isnt that with all the API support not just the minimal CABI |
07:08:37 | FromDiscord | <Elegantbeef> I might misunderstand how this is structured |
07:08:39 | arkanoid | The problem is it is not sufficient to be capable of reading or writing buffer in this format, it would be required to implement this straight into arraymancer and its logic |
07:08:45 | FromDiscord | <evoalg> In reply to @Elegantbeef "Still keeping with AOC,": there are large gaps where I just give up ... sometimes not even being about to do part 1 😉 |
07:09:29 | FromDiscord | <Elegantbeef> Yea pretty much me, havent done any since like the 7th |
07:10:27 | FromDiscord | <Elegantbeef> I just dont have much interest some problems, plus i was generally unmotivated to code anything for a bit |
07:11:46 | arkanoid | A starting point could be just to copy the approach of others https://arrow.apache.org/powered_by/ |
07:12:57 | arkanoid | I'm not a rust programmer, but I'd look into rust's datamancer https://github.com/pola-rs/polars |
07:13:35 | FromDiscord | <Elegantbeef> I mean afaict this would give you a 0 cost communication to languages, so just being able to use it would allow you to then use python and stuff and petition arraymancer to support it 😀 |
07:14:40 | arkanoid | And bonus it seems actually to be the fastest approach, too https://h2oai.github.io/db-benchmark/ |
07:15:00 | FromDiscord | <Elegantbeef> Atleast that's how i understand it i could be wrong |
07:15:09 | FromDiscord | <Elegantbeef> Like i said i'm not anywhere near data science |
07:15:10 | arkanoid | Not sure how datamancer would display in that benchmark |
07:21:03 | arkanoid | I've also already tested automatic wrapping of arrow c-api (via gobject) using futhark and it worked out nicely |
07:21:27 | arkanoid | Problem is strings, again |
07:22:13 | arkanoid | Let's say that reading and writing arrow from/to memory is not a big deal. Manipulating it in memory with algos made in nim is another story |
07:23:06 | arkanoid | But I'd be happy to have a zero copy datamancer to pandas with strings |
07:23:59 | FromDiscord | <that_dude> sent a code paste, see https://play.nim-lang.org/#ix=3Jpe |
07:24:29 | FromDiscord | <Elegantbeef> `obj()` means size is `0` |
07:24:30 | FromDiscord | <Rika> Other thing is a copy of thing |
07:24:42 | FromDiscord | <that_dude> Yeah I do get both of those |
07:24:48 | FromDiscord | <Rika> Because you stored a deference of location |
07:25:04 | FromDiscord | <Rika> Hence thing does not become 1 when you make other thing 1 |
07:25:24 | FromDiscord | <Elegantbeef> sent a code paste, see https://play.nim-lang.org/#ix=3Jpg |
07:25:42 | FromDiscord | <Elegantbeef> `[]` dereferences a pointer so as rika said `var otherThing = location[]` is storing a copy |
07:25:49 | FromDiscord | <that_dude> shouldn't a dereference embody the original object as well? I guess that's where I got hung up |
07:25:56 | FromDiscord | <Elegantbeef> It doesnt point back |
07:25:58 | FromDiscord | <Elegantbeef> it copies |
07:26:01 | FromDiscord | <Rika> If you directly do it like what beef does yes |
07:26:06 | FromDiscord | <Rika> If you store it further it copies |
07:26:12 | FromDiscord | <Elegantbeef> `location[]` is an l-value which is asignable |
07:26:37 | FromDiscord | <Elegantbeef> but if you do `var a = location[]` it's an l-value being assigned which is a copy since l-values cannot safely outlive where they're created |
07:26:44 | FromDiscord | <that_dude> Is there a way to store it in a new variable without the additional copy, or would I need to use a template thing |
07:26:48 | FromDiscord | <Rika> No |
07:26:50 | FromDiscord | <Rika> Just use the pointer |
07:26:58 | FromDiscord | <Rika> Keep the pointer and do what beef does |
07:27:01 | FromDiscord | <Elegantbeef> or a `ref` |
07:27:08 | FromDiscord | <Rika> Either works |
07:27:26 | FromDiscord | <that_dude> I could never get refs to work lol and pointers are easier for me to understand. |
07:27:43 | FromDiscord | <Elegantbeef> sent a code paste, see https://play.nim-lang.org/#ix=3Jph |
07:27:44 | FromDiscord | <Elegantbeef> References are pointers |
07:27:52 | FromDiscord | <Elegantbeef> If you understand one you understand the other |
07:28:00 | FromDiscord | <Elegantbeef> The only difference is they're garbage collected |
07:28:16 | FromDiscord | <Rika> References are easier than pointers |
07:28:19 | FromDiscord | <that_dude> Wait I think I understand what wasn't working |
07:28:22 | FromDiscord | <Elegantbeef> A pointer is just an address in memory, a reference is the same |
07:28:32 | FromDiscord | <Rika> You only think they’re harder because you think you know how pointers work |
07:28:37 | FromDiscord | <that_dude> true |
07:28:50 | FromDiscord | <Rika> Now do you actually know how pointers work is the question |
07:28:58 | FromDiscord | <that_dude> I guess the thing is that I can get the pointer after initializing the object, but how would I get the ref? |
07:29:10 | FromDiscord | <Elegantbeef> You cant get a reference to a stack allocated object |
07:29:21 | FromDiscord | <that_dude> That's prob what messes with me |
07:29:40 | FromDiscord | <Rika> You need to make a new reference and store the initialised object in it |
07:29:45 | FromDiscord | <Rika> Then stop using the regular object |
07:29:49 | FromDiscord | <Rika> And just use the red |
07:29:51 | FromDiscord | <Rika> Ref |
07:29:56 | FromDiscord | <Elegantbeef> `pointer` is unsafe due to this behaviour |
07:30:16 | FromDiscord | <Elegantbeef> You an take a pointer to a stack object, which means you can have a pointer to memory that isnt in use |
07:30:16 | FromDiscord | <Rika> No you’re unsafe because of your behaviour smh |
07:30:26 | FromDiscord | <Rika> Hello segfault |
07:30:30 | FromDiscord | <that_dude> Lol |
07:30:30 | FromDiscord | <Elegantbeef> You cannot take a reference to a stack object so they cannot be dangling |
07:30:38 | FromDiscord | <that_dude> haven't gotten that once yet tho |
07:30:47 | FromDiscord | <Elegantbeef> Nah dangling pointers dont tend to segfault afaik |
07:30:48 | FromDiscord | <Rika> You would have if you continued using a pointer |
07:31:14 | FromDiscord | <Rika> ~~not that you can’t if you use a reference~~ |
07:33:55 | FromDiscord | <Elegantbeef> sent a code paste, see https://play.nim-lang.org/#ix=3Jpj |
07:34:00 | FromDiscord | <that_dude> I guess I never understood what makes refs so special that I would want to default to them over normal objects |
07:34:26 | FromDiscord | <Elegantbeef> sent a code paste, see https://play.nim-lang.org/#ix=3Jpk |
07:34:28 | FromDiscord | <Elegantbeef> You want their semantics |
07:35:08 | FromDiscord | <Elegantbeef> So you want the abillity to have multiple variables point at them, you want to not copy the object on assignment, |
07:35:24 | FromDiscord | <Elegantbeef> My forum post i spam whenever this comes up https://forum.nim-lang.org/t/8426#54529 |
07:35:57 | FromDiscord | <Rika> In reply to @that_dude "I guess I never": You can’t put an object in itself |
07:36:35 | FromDiscord | <that_dude> Yeah I bet this concept has been beaten to death lol. It just that I come from python and a lot of the points don't mean anything to me. |
07:36:42 | FromDiscord | <Rika> If you want to make a graph (naively) then you default to pointer or ref semantics |
07:37:15 | FromDiscord | <Elegantbeef> Ref vs. non ref is all about what do you want the object to act like |
07:37:56 | FromDiscord | <Elegantbeef> Do you want it to behave like a value(primitives) or a reference(class in most languages) |
07:38:02 | FromDiscord | <that_dude> From my point of view, probably because I don't know enough, but I don't really care about heap/stack, and I haven't planned far enough ahead to understand which type I need until I'm ~500 lines into my code |
07:38:42 | FromDiscord | <that_dude> Like I try to plan things, but concept vs Implementation hits me hard |
07:38:43 | FromDiscord | <Elegantbeef> That's not really the question, what does the design require, does it require many views into a single object, does it require possible cyclical structures |
07:39:19 | FromDiscord | <Elegantbeef> Some people view refs as "I dont need `var` in procedures", so there are many views about when to use ref |
07:39:26 | FromDiscord | <Elegantbeef> There is sadly no emprical answer 😀 |
07:39:44 | FromDiscord | <Rika> There are things you literally cannot do with a regular object but can with a ref so |
07:40:10 | FromDiscord | <that_dude> I guess I'll reformat stuff to try to make sure ref works with the stuff instead |
07:40:12 | FromDiscord | <impbox [ftsf]> in python pretty much everything behaves like a ref |
07:40:28 | FromDiscord | <Elegantbeef> What are you working on dude? |
07:40:30 | FromDiscord | <impbox [ftsf]> (probably a simplication) |
07:40:33 | FromDiscord | <that_dude> well |
07:40:51 | FromDiscord | <Elegantbeef> If you describe the project or share the use case it might make it easier to suggest |
07:40:58 | FromDiscord | <Elegantbeef> I generally default to object |
07:41:03 | FromDiscord | <that_dude> sent a code paste, see https://play.nim-lang.org/#ix=3Jpl |
07:41:09 | FromDiscord | <Rika> In reply to @impbox "in python pretty much": Super oversimplification |
07:41:32 | FromDiscord | <Rika> Pythonistas use “label semantics” to describe it afaik |
07:41:53 | FromDiscord | <that_dude> Let me upload my main project to github real quick |
07:42:49 | FromDiscord | <impbox [ftsf]> like refs in that they're allocated on the heap and are garbage collected and such and can't dangle |
07:42:58 | FromDiscord | <Elegantbeef> Quick everyone belittle them for a minor thing so they never come back! 😀 |
07:43:23 | FromDiscord | <Elegantbeef> Being on the heap prevents dangling 😛↵(@impbox [ftsf]) |
07:43:34 | FromDiscord | <that_dude> https://github.com/XDEmer0r-L0rd-360-G0d-SlayerXD/Hydris Is the main project, where board is a lib for sim which is a lib for game and finesse trainer. I am using raylib, but excluded the files |
07:43:36 | FromDiscord | <impbox [ftsf]> does it? |
07:43:47 | FromDiscord | <Rika> What is that username… |
07:43:48 | FromDiscord | <impbox [ftsf]> if you delete something on the heap you can have dangling pointers to it |
07:43:58 | FromDiscord | <impbox [ftsf]> (but not in python) |
07:43:59 | FromDiscord | <that_dude> https://github.com/XDEmer0r-L0rd-360-G0d-SlayerXD/simple_inject Is the most recent thing I was working on and as to why I'm asking all these questions |
07:44:08 | FromDiscord | <Elegantbeef> I might be wrong with the semantics of dangling, though it was only to the stack 😛 |
07:44:16 | FromDiscord | <Rika> I’d immediately die if I had that username ngl |
07:44:21 | FromDiscord | <that_dude> Back in highschool a teacher said to make a professional name and I thought It would be funny to make the xboxy name I could think uf |
07:44:23 | FromDiscord | <that_dude> of |
07:44:31 | FromDiscord | <Rika> I see |
07:44:36 | FromDiscord | <Rika> So it’s ironic |
07:44:39 | FromDiscord | <that_dude> Yeah |
07:44:57 | FromDiscord | <that_dude> I made sure to get as close to the name length cap as I could lol |
07:45:38 | FromDiscord | <Elegantbeef> `is cast[ptr A] and cast[ref A] the same` no |
07:46:06 | FromDiscord | <that_dude> Right I was trying to keep a log of things I wanted to look up or remember when I'm done with this |
07:46:07 | FromDiscord | <Rika> Don’t do the second one lol |
07:46:23 | FromDiscord | <that_dude> In a test I did I think both worked the same |
07:46:28 | FromDiscord | <Rika> They don’t |
07:46:31 | FromDiscord | <Rika> Don’t do the second one |
07:46:37 | FromDiscord | <that_dude> That's why I was wondering about that |
07:46:42 | FromDiscord | <TryAngle> In reply to @Elegantbeef "`is cast[ptr A] and": because of pointers, I've been sitting since 02:00 at the same issue.... It's almost 09:00 for me now..............↵but I finally just got it, in the exact moment u posted that |
07:46:57 | FromDiscord | <Elegantbeef> I mean it'll work, and it'll behave the same but you arent getting a reference |
07:47:07 | FromDiscord | <Elegantbeef> You're getting a fake reference the GC doesnt care about |
07:47:49 | FromDiscord | <Rika> I’d just say “UB” |
07:47:53 | FromDiscord | <Elegantbeef> Congrats what was the issue?↵(@TryAngle) |
07:47:57 | FromDiscord | <Rika> No fuckin clue what that would do |
07:48:02 | FromDiscord | <Rika> So just don’t do it |
07:48:08 | FromDiscord | <that_dude> Lol |
07:48:09 | FromDiscord | <Elegantbeef> Indeed |
07:49:39 | FromDiscord | <that_dude> Btw simple_inject was my solution to https://forum.nim-lang.org/t/8652#56305. I wanted a wanted a way to inject code from an outside module without impacting the way the main module runs |
07:50:04 | FromDiscord | <that_dude> I just probably explained the my constrains very poorly |
07:50:18 | FromDiscord | <Elegantbeef> I mean we understand but it's just a whacky desire |
07:50:39 | FromDiscord | <that_dude> Yes, but it was needed for they way I have hydris structured |
07:53:00 | FromDiscord | <that_dude> Because I want to be able to repurpose the different layers of module for different projects. I had the highest level for game implementation, sim was for creating a general game loop and different function I care about for any version of the game I wanted to make, and board was to be the lowest level to let me build the sim file, and use it for computation purposes such as creating bots or creating solvers |
07:53:25 | FromDiscord | <Elegantbeef> I mean that's why you make the code modular |
07:54:31 | FromDiscord | <that_dude> I tried to make board to be context free with procs you can plop in anywhere, while sim has an actual game loop with context in it that you need to work with. |
07:54:45 | FromDiscord | <Elegantbeef> you have 4 different game loops procedures declare |
07:54:51 | FromDiscord | <TryAngle> In reply to @Elegantbeef "Congrats what was the": it's bit long, sorry for the bloat u'll see now XD |
07:54:58 | FromDiscord | <Rika> Context free sounds like “globals” to me |
07:55:42 | FromDiscord | <that_dude> I've been trying to avoid globals because that limits the amount of instances I can have afaik |
07:55:59 | FromDiscord | <impbox [ftsf]> context free sounds like pure functions to me |
07:56:07 | FromDiscord | <Elegantbeef> What do the game loops do differently, they're so large it's hard to see |
07:56:29 | FromDiscord | <TryAngle> sent a code paste, see https://play.nim-lang.org/#ix=3Jpq |
07:56:57 | FromDiscord | <TryAngle> because prior to that, I was just taking the data of the vector |
07:58:03 | FromDiscord | <Elegantbeef> That's a fun issue |
07:58:18 | FromDiscord | <that_dude> It's different tetris game modes. One is to clear as many lines as quickly as possible, another is timed where you want want the highest score in a set amount of time, another is to survive as long as you can, and the last one is to clean up your board as fast as possible |
07:58:34 | FromDiscord | <Elegantbeef> And they require 4 functions why? |
07:59:29 | FromDiscord | <that_dude> Because I thought it would lighten the mental load if I keep the seperate. I could just collapse the procs. All of them use different systems in different orders |
07:59:58 | FromDiscord | <TryAngle> In reply to @Elegantbeef "That's a fun issue": and I never checked the follow up code because I thought the whole time that the randomSpiral() code was wrong, when I was just using the row() proc in the code after that wrong .... |
08:00:05 | FromDiscord | <that_dude> That way I wouldn't have to worry about accidentally introducing a bug in one mode without a decent way to test it |
08:02:40 | FromDiscord | <Elegantbeef> I guess i'll just shush |
08:03:32 | FromDiscord | <that_dude> Lol you're fine |
08:04:11 | FromDiscord | <impbox [ftsf]> just don't introduce bugs and you'll be fine |
08:04:31 | FromDiscord | <that_dude> That's the dream |
08:04:56 | FromDiscord | <Elegantbeef> having 4 separate procedures with repeated logic makes it harder to reason about and introduce more errors |
08:06:30 | FromDiscord | <Elegantbeef> Like you have this 4 times https://github.com/XDEmer0r-L0rd-360-G0d-SlayerXD/Hydris/blob/master/Game0_2.nim#L130-L148 and the only difference is `cheeseMode` so adding a `sim.gameMode` seems like it'd make your life simpler |
08:06:49 | FromDiscord | <Elegantbeef> `if sim.gameMode == cheeseMode: doCheeseLogic()` |
08:07:30 | FromDiscord | <that_dude> Well I have a few defenses, mainly that once it works I don't have to worry about it again, but also that these were the first implementations I made more as a test to make sure the underlying modules work properly. I will note that down tho |
08:08:12 | FromDiscord | <Elegantbeef> And for the larger states i'd suggest making a procedure for them, to reduce the code in this procedure |
08:08:50 | FromDiscord | <Elegantbeef> The same applies to all that logic imo, really `sim.gameMode` could be `set[GameOptions]` then you could selectively toggle these for customization 😀 |
08:09:39 | FromDiscord | <that_dude> I do think I was slowly moving to sets and a way from enums for some of my settings |
08:10:03 | FromDiscord | <that_dude> At least for my history settings in sim |
08:10:57 | FromDiscord | <that_dude> The funny thing is that I think this is my 3rd rewrite of this code because I was unhappy with the shape and how messy the previous versions were |
08:11:28 | FromDiscord | <that_dude> I do appreciate you taking a look at my stuff though. :) |
08:11:53 | FromDiscord | <impbox [ftsf]> remember, messy code that works is better than clean code that doesn't work |
08:12:14 | FromDiscord | <that_dude> Exactly. The only condition is that the messy code works too |
08:12:39 | FromDiscord | <impbox [ftsf]> once you get it working, you can clean it up... or you could leave it and do something more productive |
08:12:48 | FromDiscord | <Elegantbeef> Messy code that is hard to maintain is bad for my sanity 😛 |
08:13:03 | FromDiscord | <impbox [ftsf]> fortunately, most code doesn't need to be maintained |
08:13:07 | FromDiscord | <that_dude> I really do want to clean this up, but I want it to be done first |
08:13:18 | FromDiscord | <Elegantbeef> Extending code is maintained imo 😛 |
08:13:47 | FromDiscord | <impbox [ftsf]> well most code gets thrown out, at least in gamedev |
08:14:31 | FromDiscord | <impbox [ftsf]> as long as it works, if it's really important to clean it up, you can do it when you need to |
08:15:02 | FromDiscord | <Rika> I would argue it is always important to clean it up unless you want a one hit wonder or to spend a lot of time refactoring |
08:15:02 | FromDiscord | <Elegantbeef> Yea i let my personal idea that i hate writing code get in the way of things 😀 |
08:15:21 | FromDiscord | <impbox [ftsf]> or you move on to the next project because that one sucked |
08:15:33 | FromDiscord | <impbox [ftsf]> you can write it cleaner on the next project |
08:15:35 | FromDiscord | <Rika> Like okay duh of course make a working shitty version but leaving it shitty is an awful idea |
08:16:17 | FromDiscord | <Rika> In reply to @impbox "or you move on": Yeah |
08:16:21 | FromDiscord | <Rika> That’s fine too |
08:16:28 | FromDiscord | <impbox [ftsf]> (i leave my code shitty, it still works) |
08:16:56 | FromDiscord | <that_dude> I think I have pretty big plans for this project so I really do need to clean it. |
08:17:11 | FromDiscord | <Elegantbeef> my view is generally if you're repeating yourself you're writing bad code |
08:17:23 | FromDiscord | <Elegantbeef> I said my view is if you're repeating yourself it's bad |
08:17:36 | FromDiscord | <that_dude> I say that when you hit a 3rd time, you've done something wrong |
08:17:52 | FromDiscord | <Elegantbeef> I dont even like the second time |
08:18:00 | FromDiscord | <Elegantbeef> It just shows to me there is a reason to write a procedure |
08:18:19 | FromDiscord | <Elegantbeef> or template/macro/iteraotr |
08:18:21 | FromDiscord | <Elegantbeef> iterator even |
08:18:27 | FromDiscord | <that_dude> Well I think it's not worth spending the brainpower to properly make that abstraction |
08:18:47 | FromDiscord | <that_dude> Unless the two sections have to really be searched for |
08:18:50 | FromDiscord | <Elegantbeef> I think it generally is as it makes the code easier to read |
08:22:36 | FromDiscord | <TryAngle> hmmm the values between `std/random/gauss` and `np.random.randn` seem to be a lot different?↵mainly gauss seems to be a lot more linear? |
08:22:40 | FromDiscord | <Elegantbeef> But i'm also the odd guy that does `type Reset = distinct void` |
08:22:57 | FromDiscord | <TryAngle> (edit) "linear?" => "linear?↵would there be a better approximation for nim for np.random.randn?" |
08:25:03 | FromDiscord | <Elegantbeef> If the stdlib doesnt tickle your fancy maybe one of these will? https://nimble.directory/search?query=random |
08:25:24 | FromDiscord | <satoro.tadziri> sent a long message, see http://ix.io/3JpE |
08:26:15 | FromDiscord | <satoro.tadziri> (edit) "http://ix.io/3JpE" => "http://ix.io/3JpG" |
08:26:37 | FromDiscord | <Elegantbeef> Man we're using Nim and people still make their own reesult variables |
08:28:11 | FromDiscord | <Elegantbeef> Seems the issue is with the old runtime |
08:28:22 | FromDiscord | <Elegantbeef> try `--gc:arc` |
08:28:43 | FromDiscord | <Elegantbeef> Even with `--newRuntime` `let` works properly |
08:29:09 | FromDiscord | <Elegantbeef> So yea seems it's a case of the compiler thinking it's smart |
08:29:17 | FromDiscord | <Elegantbeef> But infact it was being dumb |
08:29:43 | FromDiscord | <Solitude> thats cringe |
08:29:56 | FromDiscord | <Elegantbeef> Solitude as usual being fucking weird |
08:30:21 | FromDiscord | <satoro.tadziri> In reply to @Elegantbeef "Man we're using Nim": I actually used `result` but after pulling my hair for a few minutes I decided to split the func to find the problem. What you see is just copying it back into single place 🙂 |
08:32:17 | FromDiscord | <Elegantbeef> Yea i was just joking 😛 |
08:32:50 | FromDiscord | <Elegantbeef> I wonder if i can duplicate this |
08:33:36 | FromDiscord | <satoro.tadziri> In reply to @Elegantbeef "Even with `--newRuntime` `let`": It seems to solve the problem but it is very unexpected for me.↵↵When can I read about `--newRuntime` and what it actually does behind the scenes? |
08:33:58 | FromDiscord | <Elegantbeef> You arent supposed to use it alone, i just thought i'd test it |
08:34:06 | FromDiscord | <Elegantbeef> You should use `arc/orc` instead |
08:34:38 | FromDiscord | <Elegantbeef> I'm going to see if i can repro it and use that to reason why it happens |
08:36:20 | FromDiscord | <Ricky Spanish> would it be difficult to make a portable version of nim? iv compiled from scratch but the install script seems to require nimble and a few other things to be in specific locations on the host os, is there a simple way to modify/overwrite those locations in terms of where nim will look for them |
08:38:01 | FromDiscord | <Solitude> nim doesnt require nimble. what install script? |
08:38:33 | FromDiscord | <Rika> You can install Nim anywhere just as long as you change your path variable as well |
08:38:52 | FromDiscord | <Ricky Spanish> sent a code paste, see https://play.nim-lang.org/#ix=3JpJ |
08:39:41 | FromDiscord | <Ricky Spanish> ah so all i need is to add the nim folder to my path and should be fine? |
08:39:48 | FromDiscord | <Solitude> yes |
08:39:55 | FromDiscord | <Ricky Spanish> ah ok great thanks |
08:46:43 | FromDiscord | <Elegantbeef> I get a min reproduce of this bug sadly |
08:46:46 | FromDiscord | <Elegantbeef> i cannot\ |
08:58:35 | * | xet7 joined #nim |
11:34:26 | FromDiscord | <tbrekalo> is there something as `std::ref` in nim? And object which takes a reference to a non reference type |
11:34:47 | FromDiscord | <tbrekalo> (edit) "type" => "type;↵↵btw. happy Christmas everyone" |
11:34:50 | FromDiscord | <tbrekalo> (edit) "is there something as `std::ref` in nim? And object which takes a reference to a non reference type;↵↵btw. happy Christmas everyone ... " added "🙂" |
12:05:38 | * | sidro joined #nim |
12:06:06 | * | sidro left #nim (#nim) |
12:15:17 | FromDiscord | <Rika> what is the difference of that and Nim "ref"? |
12:24:15 | FromDiscord | <pmunch> You should be able to simply do \`ref MyNonRefObject\` and then create the object with \`new\` to allocate it on the heap and get a reference to it |
12:40:14 | FromDiscord | <tbrekalo> that's the issue; I have to create a new reference object |
12:40:32 | FromDiscord | <tbrekalo> I want to make a reference to an existing object that isn't of type `ref object` |
12:47:32 | FromDiscord | <Rika> Pointer; you cannot safely reference stack memory |
12:47:48 | FromDiscord | <Rika> Or do you mean you want to make a reference of a type that isn't |
12:48:08 | FromDiscord | <Rika> Just put "ref TheType", you don't need to make a new one |
12:48:14 | FromDiscord | <Rika> A new type I mean |
12:51:22 | * | neceve joined #nim |
13:09:59 | FromDiscord | <alfa> is there a way to get more verbose compiler output? rn it it just says SIGSEGV |
13:14:59 | FromDiscord | <Zajt> sent a code paste, see https://play.nim-lang.org/#ix=3Jqw |
13:15:42 | FromDiscord | <Zajt> (edit) "https://play.nim-lang.org/#ix=3Jqw" => "https://play.nim-lang.org/#ix=3Jqx" |
13:16:10 | FromDiscord | <Zajt> Because I guess I can't do like that, or should I change `when isMainModule` to like `proc main():` and then call main() inside DLL_PROCESS_ATTACH? |
13:16:39 | FromDiscord | <Zajt> (edit) "https://play.nim-lang.org/#ix=3Jqx" => "https://play.nim-lang.org/#ix=3Jqy" |
13:20:06 | FromDiscord | <sOkam!> Any clue what's the mistake here? 🤔 https://media.discordapp.net/attachments/371759389889003532/924290406391357460/unknown.png |
13:22:56 | FromDiscord | <Solitude> you didnt export your fields |
13:23:10 | FromDiscord | <Rosen> In reply to @sOkam! "Any clue what's the": Don't you have to export the members of the object that you want to use outside of the module with ? |
13:23:56 | FromDiscord | <sOkam!> hmm where do I export them? in the functions? |
13:24:04 | FromDiscord | <Solitude> in the type declaration |
13:25:18 | FromDiscord | <sOkam!> That fixed it, yep. tyty! 🙂 https://media.discordapp.net/attachments/371759389889003532/924291718172532746/unknown.png |
13:48:54 | * | neurocyte0132889 joined #nim |
13:48:54 | * | neurocyte0132889 quit (Changing host) |
13:48:54 | * | neurocyte0132889 joined #nim |
13:54:01 | FromDiscord | <qb> In reply to @Zajt "Hey, I have one": Are you coding an injectable library? |
13:58:41 | FromDiscord | <Zajt> In reply to @qb "Are you coding an": How do you mean? |
13:59:38 | FromDiscord | <qb> Nevermind. Why do you create a custom dllmain at all? The nim compiler already handles that. just use `when isMainModule: launch()` aswell |
14:00:16 | FromDiscord | <Zajt> How would I compile it to a dll? |
14:00:23 | FromDiscord | <qb> `--app:lib` |
14:00:31 | FromDiscord | <Zajt> and then what is the export function? |
14:02:48 | FromDiscord | <Zajt> because if you add code like the above, I specify the export function to call myself |
14:42:30 | * | arkurious joined #nim |
14:54:25 | NimEventer | New post on r/nim by TheDarkMode: Best training read though for Nim, see https://reddit.com/r/nim/comments/rob4cr/best_training_read_though_for_nim/ |
15:13:05 | FromDiscord | <tbrekalo> In reply to @Rika "Or do you mean": I wanted to have non-gc reference to a field of a sequence. I ended up creating a new type which holds an index of an element I wanna access and made a closure for quick access. ↵↵Wanted some syntax sugar instead of writing `someSeq[idx]` |
17:27:01 | NimEventer | New thread by Mantielero: Solvespace.nim - WiP, see https://forum.nim-lang.org/t/8740 |
17:42:55 | FromDiscord | <Professor Actual Factual> Perhaps a naive question but why not just use `var` for all parameters in procs? I get that immutability has its place in certain applications and side effects can be a problem, but surely passing pointers rather than copies of values is faster? Or is the line of thought here, that yes immutability is slower, but we are willing to incure a small allocation penalty to avoid possible unintended side effects down the road. |
18:00:30 | * | xiamx[m]1 quit (Quit: Reconnecting) |
18:00:42 | FromDiscord | <demotomohiro> Passing arguments to a proc without var is not slower because Nim automatically generates the code pass pointer if sizeof argument is large enough. |
18:00:43 | * | xiamx[m]1 joined #nim |
18:01:59 | * | xiamx[m]1 quit (Client Quit) |
18:02:12 | * | xiamx[m]1 joined #nim |
18:04:00 | * | vicfred quit (Quit: Leaving) |
18:08:04 | * | xiamx[m]1 is now known as xiamx |
18:22:55 | FromDiscord | <Professor Actual Factual> In reply to @demotomohiro "Passing arguments to a": Wow i never knew this. Is there somewhere in the docs that states this or has more about it? |
18:35:09 | FromDiscord | <Solitude> In reply to @Professor Actual Factual "Wow i never knew": https://nim-lang.org/docs/manual.html#procedures-var-parameters end of this paragraph |
18:59:23 | FromDiscord | <Fish-Face> sent a code paste, see https://play.nim-lang.org/#ix=3JuD |
19:01:59 | FromDiscord | <Fish-Face> I suppose `enumval.ord+1` and then convert the integer index you get back (from `.pairs`) with `.EnumType`? |
19:21:50 | FromDiscord | <Solitude> In reply to @Fish-Face "Often you need to": you `succ` instead of `.ord + 1` |
19:21:54 | FromDiscord | <Solitude> you can |
19:26:36 | * | vicfred joined #nim |
19:46:51 | FromDiscord | <Forest> Does anyone know if Nimpy has a way to make an exported function asynchronous? |
19:58:51 | FromDiscord | <Fish-Face> In reply to @Solitude "you `succ` instead of": ah thank you! |
20:19:51 | FromDiscord | <deech> Using `owner` I can work back to the module. Is there a way to use the module node to traverse procs and types owned by the module? |
20:30:31 | FromDiscord | <TryAngle> sent a code paste, see https://play.nim-lang.org/#ix=3Jv2 |
20:37:41 | * | brocc left #nim (#nim) |
20:55:54 | FromDiscord | <retkid> what exactly is nim 2.0 |
20:56:31 | FromDiscord | <retkid> how big of a chaange is it |
20:56:37 | FromDiscord | <retkid> is it just stdlib stuf? |
21:04:43 | FromDiscord | <Goel> @retkid https://github.com/nim-lang/RFCs/issues/437 |
21:14:41 | * | vicfred quit (Quit: Leaving) |
21:25:12 | FromDiscord | <retkid> we're switching to orc? |
21:25:58 | FromDiscord | <retkid> thats good but ive noticed orc isn't as memory efficient currently, hopefully thats resolved because, that one is a big time saver with threading |
21:27:56 | FromDiscord | <retkid> gonna miss Spawn |
21:28:52 | FromDiscord | <retkid> i dont like the extra type safeties planning to be added. Reminds me of java. |
21:29:57 | FromDiscord | <retkid> package level objects are very cool |
21:30:09 | FromDiscord | <el__maco> why is 0x7f000000 a good uint32 constant literal, but 0x80000000 is not |
21:30:30 | FromDiscord | <el__maco> how do I express the latter without a cast, or do I have to cast |
21:32:02 | FromDiscord | <retkid> In reply to @el__maco "why is 0x7f000000 a": 0x8..... is 1 over the maximum value a 32 bit int can handle |
21:32:36 | FromDiscord | <retkid> (edit) "0x8....." => "0x8. 10^7" |
21:32:42 | FromDiscord | <el__maco> its not over the maximum value an 32 bit unsigned integer can have |
21:33:01 | FromDiscord | <el__maco> (edit) "an" => "a" |
21:33:18 | FromDiscord | <retkid> well is it specified as a uint |
21:33:49 | FromDiscord | <retkid> why not just make it a float64 |
21:33:54 | FromDiscord | <retkid> (edit) "float64" => "float64, no fuss" |
21:33:57 | FromDiscord | <el__maco> how do you specify unsigned constant literal |
21:34:49 | FromDiscord | <retkid> presumubly |
21:34:54 | FromDiscord | <retkid> uint32(x) |
21:35:00 | FromDiscord | <retkid> (edit) "presumubly" => "presumably" |
21:35:01 | FromDiscord | <retkid> but |
21:35:05 | FromDiscord | <el__maco> yea so you cast |
21:35:07 | FromDiscord | <retkid> i need to look fur unsigned |
21:35:13 | FromDiscord | <retkid> yes you can lol |
21:35:19 | FromDiscord | <retkid> might be wrong |
21:35:33 | FromDiscord | <retkid> that stuff isn't worth the fuss |
21:35:57 | FromDiscord | <el__maco> a C compiler would accept the hex literal, or you could postfix with `u` to make it unsigned |
21:36:31 | FromDiscord | <retkid> uint is already unsigned |
21:36:36 | FromDiscord | <retkid> pretty sure |
21:36:56 | FromDiscord | <retkid> maybe a smarty pants like @Rika can give more details |
21:37:08 | FromDiscord | <retkid> i am unreliable. |
21:37:45 | FromDiscord | <el__maco> yes it is. C does not have type inference, so the literals have self contained types and thus they need a way to specify the type in detail. In my nim case I'm giving an argument to a proc that takes an uint32 |
21:37:50 | FromDiscord | <el__maco> (edit) "an" => "a" |
21:38:47 | FromDiscord | <retkid> well |
21:38:52 | FromDiscord | <retkid> C does not have types really |
21:39:01 | FromDiscord | <retkid> c is the wildwest |
21:39:01 | FromDiscord | <el__maco> I could take uint64 too in this particular case. But I want to learn what I can do so that's why I'm asking 🙂 |
21:39:15 | FromDiscord | <el__maco> of course C has types |
21:39:35 | FromDiscord | <retkid> not cool ones like C++ |
21:40:07 | FromDiscord | <el__maco> I wonder what constitutes a cool type 🤔 |
21:43:32 | FromDiscord | <el__maco> wait now I'm actually confused. The proc takes `uint` now and even that doesn't accept 0x80000000 |
21:44:37 | FromDiscord | <el__maco> https://play.nim-lang.org/#ix=3Jvf |
21:46:24 | FromDiscord | <el__maco> `0x80000000'u64` works but that's ugly, why do I have to do that |
21:46:30 | FromDiscord | <el__maco> (edit) "`0x80000000'u64`" => "`0x80000000'u64`" |
21:55:27 | FromDiscord | <Elegantbeef> Think it's just an issue with literals |
21:55:39 | FromDiscord | <Elegantbeef> They dont always properly reason the type |
21:56:07 | FromDiscord | <el__maco> I need to pass an rgba color to a function, almost always it will be a literal |
21:56:14 | FromDiscord | <Elegantbeef> 32bit + literals i think cause this issue |
21:56:27 | FromDiscord | <el__maco> I wonder how one should go about this in Nim |
21:56:34 | FromDiscord | <Elegantbeef> You could do `array[4, byte]` |
21:56:41 | FromDiscord | <Elegantbeef> It's easier to read anyway |
21:57:16 | FromDiscord | <el__maco> also this behavior seems really odd, give the default 64 bit integer size. Why is the integer literal semantics somehow 32 bit |
21:57:20 | FromDiscord | <Elegantbeef> Why are you using uint64 anyway, more than 1 byte per channel? |
21:57:40 | FromDiscord | <el__maco> I'm not. I switched because I thought that was the problem |
21:57:59 | FromDiscord | <el__maco> originally I had `proc SetPen(color:uint32)` |
21:58:04 | FromDiscord | <Elegantbeef> sent a code paste, see https://play.nim-lang.org/#ix=3Jvl |
21:58:19 | FromDiscord | <Elegantbeef> Oh damn i only have 7 nibbles |
21:58:21 | FromDiscord | <Elegantbeef> I cant count |
21:59:34 | FromDiscord | <el__maco> sent a code paste, see https://play.nim-lang.org/#ix=3Jvn |
21:59:41 | FromDiscord | <Elegantbeef> `1u8` |
21:59:53 | FromDiscord | <Elegantbeef> sent a code paste, see https://play.nim-lang.org/#ix=3Jvo |
22:00:02 | FromDiscord | <Elegantbeef> Or you can do the above if you must have the intlit work |
22:01:24 | FromDiscord | <Elegantbeef> I think there are issues made for the way int lits work |
22:01:54 | FromDiscord | <el__maco> sent a code paste, see https://play.nim-lang.org/#ix=3Jvq |
22:01:57 | FromDiscord | <el__maco> but u:int64 does work |
22:02:47 | FromDiscord | <el__maco> I guess I can change the prototype to expect an int64, but yea, its kinda confusing |
22:04:24 | FromDiscord | <Elegantbeef> sent a code paste, see https://play.nim-lang.org/#ix=3Jvr |
22:05:32 | FromDiscord | <Elegantbeef> Personally I imagine the above is more sensible anyway since Color isnt just an uint32, but ymmv |
22:06:15 | FromDiscord | <Elegantbeef> But i also use `distinct void` for actual things so i'm a weirdo |
22:07:15 | FromDiscord | <el__maco> sent a code paste, see https://play.nim-lang.org/#ix=3Jvs |
22:07:31 | FromDiscord | <Elegantbeef> No point using a union |
22:07:42 | FromDiscord | <Elegantbeef> You can get the same behaviour from a literal |
22:09:31 | FromDiscord | <el__maco> like if you have texture:array[256256,rgba8] you can read and write all channels at once, or one channel at a time. Not sure you can do that without the union |
22:09:50 | FromDiscord | <el__maco> in fact it would be cool if you could have anonymous unions |
22:10:57 | FromDiscord | <Elegantbeef> For instance |
22:11:00 | FromDiscord | <Elegantbeef> sent a code paste, see https://play.nim-lang.org/#ix=3Jvv |
22:11:30 | FromDiscord | <Elegantbeef> https://github.com/alaviss/union ? |
22:11:49 | FromDiscord | <Elegantbeef> Or do you want anonymous untagged unions? |
22:13:36 | FromDiscord | <el__maco> I don't know what an untagged union is, but basically getting rid of the field `u` in my previous snipped would have been nice |
22:14:01 | FromDiscord | <Elegantbeef> an untagged union is like what you were doing |
22:14:11 | FromDiscord | <Elegantbeef> Where there is not a discriminator |
22:14:29 | FromDiscord | <Elegantbeef> A tagged union holds an discriminator so you can access the correct union without issues |
22:14:37 | FromDiscord | <Elegantbeef> It's an issue when they're different sized |
22:14:41 | FromDiscord | <el__maco> sent a code paste, see https://play.nim-lang.org/#ix=3Jvw |
22:15:19 | FromDiscord | <el__maco> now I must remember what was the name of the tuple and say `color.u.r` |
22:15:27 | FromDiscord | <Elegantbeef> Ah |
22:15:31 | FromDiscord | <Elegantbeef> Or you can just do what i showed you |
22:15:38 | FromDiscord | <Elegantbeef> And dont have to remember the name of the tuple |
22:16:03 | FromDiscord | <el__maco> no offense but that looks kinda complicated for what it is 🤔 |
22:16:37 | FromDiscord | <Elegantbeef> I mean you can do bitwise ops if you prefer |
22:16:41 | FromDiscord | <Elegantbeef> It's the same thing |
22:20:17 | FromDiscord | <Ricky Spanish> Anyone know where in the "nim niggets: systems programming and mets programming magic" by Aditya siram he got the idea that nims native code is 2x slower than c? He doesent really clarify what statistics this is based on or compiler options I'm assuming it was just nim build with no flags but maybe I'm wrong? |
22:21:23 | FromDiscord | <Elegantbeef> Isnt that deech? |
22:21:24 | FromDiscord | <demotomohiro> You can implement RGBA8 object like this: |
22:21:36 | FromDiscord | <demotomohiro> sent a code paste, see https://play.nim-lang.org/#ix=3Jvy |
22:21:58 | FromDiscord | <Elegantbeef> There's the bitwise ops i didnt want to do 😀 |
22:24:15 | FromDiscord | <el__maco> I guess, but I'm a bit concerned about the possibility that the compiler will actually emit this procedure call |
22:24:30 | FromDiscord | <demotomohiro> sent a code paste, see https://play.nim-lang.org/#ix=3Jvz |
22:25:07 | FromDiscord | <el__maco> like if I fill a big texture in a for loop using toRGBA8, I don't want the program to invoke a million function calls |
22:25:14 | FromDiscord | <Elegantbeef> We're in 2021 99% of cpus are LE↵(@demotomohiro) |
22:25:16 | FromDiscord | <Elegantbeef> 😛 |
22:25:39 | FromDiscord | <Elegantbeef> Then jusut cast the int to uint32↵(@elmaco) |
22:26:24 | FromDiscord | <el__maco> a sane C compiler backend might inline that call, but idk |
22:26:25 | FromDiscord | <Elegantbeef> disregard me |
22:26:47 | FromDiscord | <Elegantbeef> It almost certainly will, you can also make it a template for 100% inline |
22:27:09 | FromDiscord | <el__maco> seems complicated when all you want to do is to write 4 bytes of memory |
22:27:24 | FromDiscord | <el__maco> 🤷♂️ |
22:27:35 | FromDiscord | <Elegantbeef> All this to avoid writing `u32` 😛 |
22:28:25 | * | Guest66 joined #nim |
22:28:32 | FromDiscord | <el__maco> I mean int64 seems to work, so I'm okay with this |
22:32:07 | Guest66 | Hi, I've got a simple q. I've got an array of n objects, where each object itself is just a series of 7 floats, in a group of 3, and a group of 4 |
22:32:19 | * | Guest66 is now known as jphdotam |
22:33:59 | jphdotam | In C++ I can pass that array directly to opengl, but in nim that doesn't seem to work. Instead of passing an array of n sets of object of 4+3 floats, I seem to need to cast it to an array. e.g. so if n is 4, I have to recast my variable to an array of 28 floats |
22:34:19 | jphdotam | see line #16 here https://pastebin.com/WRbnGRn2 |
22:34:38 | jphdotam | It's not a problem, I just thought it was a bit weird. as I can clarify the sizeof() for both of them is the same |
22:35:17 | FromDiscord | <Elegantbeef> I mean Nim is statically typed, so yes |
22:35:55 | NimEventer | New thread by Batsking: Rust's dbg! macro equivalent in nim, see https://forum.nim-lang.org/t/8741 |
22:36:54 | jphdotam | But in C++ I can feed in any old struct it seems |
22:37:09 | FromDiscord | <Elegantbeef> Sure C++ doesnt mind implicit conversions |
22:38:15 | * | xet7 quit (Remote host closed the connection) |
22:38:17 | FromDiscord | <Elegantbeef> You can annotate the type with `{.packed.}` then do `myObject[0].addr` and it should behave the same |
22:39:19 | * | xet7 joined #nim |
22:40:23 | FromDiscord | <Elegantbeef> Oh you already had it packed 😀 |
22:41:10 | jphdotam | Yeah I already figured out packed, but yeah in C++ I can do variable.data() to get a pointer to element 0 |
22:41:38 | jphdotam | but if I do what you said, which is variable[0].addr (see line 53) it doesn't work |
22:41:46 | FromDiscord | <Elegantbeef> Well the data is sequential so `myObject.addr` sorry |
22:42:16 | FromDiscord | <Elegantbeef> the first element will be at the first byte of the object when it's packed, so taking the address of that is fine |
22:42:25 | FromDiscord | <Elegantbeef> If you want the first element of an array you do `myObject.color[0].addr` for instance |
22:42:41 | FromDiscord | <Elegantbeef> `.data` is an obscure way of getting the addr of an element 😀 |
22:42:42 | jphdotam | myObj.addr (nor myObj[0].addr) doesn't work weirdly - it doesn't error, but it just doesn't plot anything |
22:43:08 | jphdotam | It's as if it knows it's a reference/pointer to somethign that isnt technically an array of GLfloats |
22:43:17 | jphdotam | Even if the data layout is identical |
22:43:48 | FromDiscord | <Elegantbeef> You are doing `vertssep.addr`? |
22:44:37 | FromDiscord | <Elegantbeef> unrelated but in nim we do `initT` for value type objects |
22:45:04 | jphdotam | Ok um now it's working... I must have made a stupid mistake.... I am stupid, and you are an elegant beef |
22:45:19 | FromDiscord | <Elegantbeef> Cheers |
22:45:43 | jphdotam | What do you mean by the initT bit sorry? |
22:46:05 | FromDiscord | <Elegantbeef> `initVertex` vs. `newVertex` |
22:46:18 | FromDiscord | <Elegantbeef> `object` in Nim is a struct in C++ |
22:47:19 | jphdotam | Ahh ok |
22:47:33 | FromDiscord | <el__maco> what does the {.packed.} pragma do btw. Does Nim follow the same packing rules with C or something else |
22:47:44 | FromDiscord | <Elegantbeef> It tightly packs the fields |
22:47:48 | jphdotam | Am I right in saying that is purely aesthetic, the term new and init don't actually impact? |
22:47:53 | FromDiscord | <Elegantbeef> https://nim-lang.org/docs/manual.html#foreign-function-interface-packed-pragma |
22:48:07 | FromDiscord | <Elegantbeef> Well `new` implies heap allocations and `init` implies stack allocation |
22:48:15 | FromDiscord | <Elegantbeef> So it does impact what the read expects |
22:48:26 | FromDiscord | <Elegantbeef> When i read `newVector` i assumed you were using references and that was an issue |
22:48:43 | jphdotam | Ah I see, thanks |
22:49:11 | FromDiscord | <Elegantbeef> It's just a convention, so if you're not expecting others to use your code it doesnt matter |
22:49:35 | FromDiscord | <Elegantbeef> But in nim `var a = new int` does heap allocated an `int` so there are some "reasons" why one would expect `new` to heap alloc |
22:50:18 | FromDiscord | <retkid> ``new`` |
22:50:26 | FromDiscord | <retkid> sweats in java |
22:50:40 | jphdotam | Makes sense |
22:50:47 | jphdotam | Does everyone use discord rather than IRC, now? |
22:50:54 | FromDiscord | <Elegantbeef> I'm on matrix |
22:51:03 | FromDiscord | <retkid> take that back I like the new operator and it feels weird without it in kt |
22:51:05 | FromDiscord | <retkid> i use discord |
22:51:23 | FromDiscord | <retkid> im not a boomer |
22:51:40 | FromDiscord | <retkid> thought i might use IRC because well, too much ram usage |
22:52:45 | FromDiscord | <el__maco> discord is only 350MB, could be worse 😔 |
22:52:56 | FromDiscord | <evoalg> @ElegantBeef I tried to make a minimal example of that "replacing var with let" issue someone was having yesterday: https://play.nim-lang.org/#ix=3JvE |
22:53:18 | FromDiscord | <Elegantbeef> You crazy fool you did it! |
22:53:37 | FromDiscord | <evoalg> hehe 😉 |
22:54:32 | FromDiscord | <Elegantbeef> Any reasoning to why it happens now? |
22:55:46 | FromDiscord | <evoalg> it seems that with "let" the compiler makes a ref instead of a copy (or something like that)? ... and when tried to make a minimal example outside a proc, it didn't have this issue |
22:56:06 | FromDiscord | <evoalg> arg and orc work fine just as you said |
22:57:58 | FromDiscord | <Solitude> https://github.com/nim-lang/Nim/issues/13771 |
22:59:37 | FromDiscord | <Elegantbeef> Ah thanks solitude |
23:00:25 | FromDiscord | <evoalg> gosh I might add `--gc=orc` to my default config |
23:00:27 | FromDiscord | <Elegantbeef> Without move semantics analysis it doesnt copy it |
23:00:44 | FromDiscord | <Elegantbeef> Depending on what you're doing it's faster |
23:01:02 | FromDiscord | <Elegantbeef> Though it's almost always more memory efficient |
23:01:43 | FromDiscord | <evoalg> I can override with arc when I feel the need right? |
23:02:05 | FromDiscord | <Elegantbeef> You should be able to |
23:04:57 | FromDiscord | <Elegantbeef> IIRC the CLI is raised to the highest level of control |
23:05:04 | FromDiscord | <Elegantbeef> So it overrides everything else |
23:05:15 | FromDiscord | <Elegantbeef> Also i realized evo that given the use case of `zip` it doesnt make sense as an iterator 😛 |
23:05:52 | FromDiscord | <Elegantbeef> Though i might try an impl using closure iterators to see how well it works |
23:06:05 | FromDiscord | <Elegantbeef> And if it's any more memory/speed performant to a normal zip |
23:06:12 | NimEventer | New Nimble package! ogham - Convert Ogham inscriptions to latin text & vice versa., see https://github.com/stscoundrel/ogham-nim |
23:06:40 | * | jphdotam quit (Quit: Textual IRC Client: www.textualapp.com) |
23:08:05 | FromDiscord | <JamesH> Would arraymancer be the closest thing to numpy in nim? It obviously can do more with its cuda support etc., but I wondered if that was the best thing for straight forward n-dimensional array maths? |
23:08:20 | FromDiscord | <Yardanico> you should ask around in #science and check https://github.com/SciNim/ :) |
23:08:48 | FromDiscord | <JamesH> Ah thank you |
23:46:31 | FromDiscord | <JamesH> In reply to @Elegantbeef "*unrelated but in nim": BTW I just wanted to ask 1 more q about my code sample - is my constructor for initVertex the right format? It feels quite verbose to initialise a struct with 2 properties |
23:46:41 | FromDiscord | <retkid> ive never had to do bitwise stuff |
23:47:00 | FromDiscord | <retkid> trying to think of a use |
23:47:18 | FromDiscord | <retkid> has there been uses that i just never foresaw and have been solving problems less efficiently |
23:50:45 | FromDiscord | <Elegantbeef> It's conventional but if you find it tedious i have a package which makes it a bit eaasier↵(@JamesH) |
23:50:59 | FromDiscord | <Elegantbeef> https://github.com/beef331/constructor |
23:52:14 | FromDiscord | <Elegantbeef> @evoalg\: do you have an example of code which uses `zip` then operates on the data? |
23:53:01 | FromDiscord | <Elegantbeef> sent a code paste, see https://play.nim-lang.org/#ix=3JvS |
23:59:40 | FromDiscord | <Elegantbeef> It uses a little less memory but is 80 times slower in my test |
23:59:52 | FromDiscord | <Elegantbeef> So what i expected a vastly slower impl |