<< 25-12-2021 >>

00:00:07FromDiscord<sOkam!> Obv wrong... but common sense makes me think that
00:00:14FromDiscord<Elegantbeef> Nim's for loops work on iterators they dont only handle ints
00:00:52FromDiscord<Elegantbeef> you can do `for(string i = "hello"; i.Length < 100; i + "a")` in C#
00:01:10FromDiscord<Elegantbeef> In nim you define `iterator`s which `yield` a value
00:03:05FromDiscord<sOkam!> i see, makes sense
00:03:17FromDiscord<sOkam!> I like nim's way a lot more (unsurprisingly)
00:03:26FromDiscord<sOkam!> (edit) "I like nim's way a lot more (unsurprisingly) ... " added "🙂"
00:08:08FromDiscord<sOkam!> Oh, I just noticed this inside godot-cpp...↵https://github.com/godotengine/godot-cpp/blob/master/binding_generator.py
00:08:33FromDiscord<sOkam!> Could it be worth it to modify that for nim, or not at all?
00:09:07FromDiscord<Elegantbeef> I mean we have the NimVM which can generate code, so there isnt much reason to use python
00:09:36FromDiscord<Elegantbeef> You're going to be doing the same thing but instead of using python using Nim's macros preferablly
00:12:03FromDiscord<sOkam!> In reply to @Elegantbeef "I mean we have": modifying that file could be a reason
00:12:35FromDiscord<sOkam!> its massive, though
00:19:11FromDiscord<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:07FromDiscord<Elegantbeef> You might have to use your own matchers
00:23:09FromDiscord<qb> Like this works but I wan't to skip that `t` variables https://play.nim-lang.org/#ix=3Jo2
00:25:28FromDiscord<Elegantbeef> Alternatively use `scanp`
01:22:41FromDiscord<qb> sent a code paste, see https://play.nim-lang.org/#ix=3Jod
01:22:46FromDiscord<qb> Umm?
01:30:34FromDiscord<Yardanico> sent a code paste, see https://play.nim-lang.org/#ix=3Jof
01:30:42FromDiscord<Yardanico> idk really
01:30:51FromDiscord<qb> just deleted it and let nimble make a new one. Same
01:30:57FromDiscord<Yardanico> are you sure your github api token has write access to that repo?
01:30:59FromDiscord<Yardanico> (edit) "that" => "your packages"
01:31:05FromDiscord<Yardanico> (edit) "are you sure your github api token ... has" added "that you're using for nimble publish"
01:31:38FromDiscord<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:17FromDiscord<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:11FromDiscord<Yardanico> https://nim-lang.org/docs/math.html#almostEqual%2CT%2CT%2CNatural
02:24:18FromDiscord<TryAngle> In reply to @Yardanico "https://nim-lang.org/docs/math.html#almostEqual%2CT": thx
02:39:16FromDiscord<retkid> feels like nothing works today
02:39:20FromDiscord<retkid> hate threading in nim
02:39:34FromDiscord<retkid> passed a channel created on shared and it segfaults
02:39:47FromDiscord<retkid> is this expected?
02:39:49nrds<Prestige99> Can you share an example?
02:39:58FromDiscord<retkid> not easily, no
02:40:08FromDiscord<retkid> uh
02:40:13FromDiscord<retkid> gimme a minute
02:43:51FromDiscord<Yardanico> if you use a channel you don't need to use shared types
02:44:00FromDiscord<Yardanico> you send/receive normal types through the channel
02:44:05FromDiscord<Yardanico> and they're just always deep copied
02:45:17FromDiscord<retkid> or something like that
02:45:18FromDiscord<retkid> sent a code paste, see https://play.nim-lang.org/#ix=3Joo
02:45:47FromDiscord<retkid> ah ill try that, so i dont share the pointer?
02:47:59FromDiscord<Rika> I think you don’t need to use shared memory on the channel itself
02:48:33FromDiscord<Yardanico> as @Rika said
02:48:47FromDiscord<Yardanico> also you don't need to send the channel itself to the thread
02:48:52FromDiscord<Yardanico> ah maybe you do, I forgot
02:49:04FromDiscord<Rika> Ah wait you do I think
02:49:06FromDiscord<Rika> https://nim-lang.org/docs/channels_builtin.html
02:49:09FromDiscord<Rika> Yeah here it says you do
02:49:30FromDiscord<Rika> In which case I do not know the reason for the segfault
02:49:55FromDiscord<retkid> yea ive used them quite a bit
02:50:04FromDiscord<retkid> i think its just the god spitting me
02:50:07FromDiscord<Rika> Do you get a trace after the fault?
02:50:10FromDiscord<retkid> (edit) "god" => "gods"
02:50:13FromDiscord<retkid> uhh
02:50:20FromDiscord<Rika> If you do it would be nice if you sent it as well
02:50:26FromDiscord<retkid> read from nil
02:50:28FromDiscord<Rika> A stack trace
02:50:41FromDiscord<Rika> Stuff like function names and stuff show on it
02:50:46FromDiscord<Rika> Line numbers too
02:50:57FromDiscord<Rika> Only shows if you have them on, so not on release
02:51:57FromDiscord<Yardanico> ah right @retkid
02:52:00FromDiscord<Yardanico> or not right
02:52:13FromDiscord<Yardanico> hmmmmm
02:52:14FromDiscord<retkid> ah left?
02:52:44FromDiscord<Rika> Lol
02:52:46FromDiscord<Yardanico> ah right you forgot to open the damn channel
02:52:50FromDiscord<retkid> the stack strace comes from storeAux
02:52:54FromDiscord<retkid> :P:
02:52:55FromDiscord<retkid> pesogjfgjg
02:52:57FromDiscord<retkid> LOL
02:53:01FromDiscord<Rika> Lol
02:53:13FromDiscord<Yardanico> no need for your `ptr` stuff
02:53:14FromDiscord<Yardanico> sent a code paste, see https://play.nim-lang.org/#ix=3Jop
02:53:17FromDiscord<Yardanico> this works just fine and it's just like in the docs
02:53:17FromDiscord<Rika> Why do you need to open channels
02:53:24FromDiscord<Yardanico> to initialize them
02:53:42FromDiscord<retkid> or well
02:53:42FromDiscord<retkid> sent a code paste, see https://play.nim-lang.org/#ix=3Joq
02:53:43FromDiscord<retkid> example
03:06:13*vicfred joined #nim
03:06:16FromDiscord<retkid> so uh you were wrong
03:06:23FromDiscord<retkid> you do need the pointers
03:06:30FromDiscord<retkid> at least for some reason whatever im doing
03:09:12FromDiscord<Yardanico> show the code?
03:26:01*vicfred quit (Quit: Leaving)
03:29:04NimEventerNew 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:49FromDiscord<TryAngle> sent a code paste, see https://play.nim-lang.org/#ix=3JoI
04:50:24FromDiscord<Rika> [0]
04:50:28FromDiscord<Yardanico> result[0]
04:50:30FromDiscord<Rika> Like an array
04:50:37FromDiscord<Yardanico> it's no different from normal tuple index access
04:50:48FromDiscord<TryAngle> lol
04:51:04FromDiscord<TryAngle> I thought I did that and it didn't work
04:51:06FromDiscord<Rika> We all have these moments
04:51:12FromDiscord<TryAngle> in my head
04:51:15FromDiscord<TryAngle> o_O
04:51:26FromDiscord<Yardanico> `result` doesn't have some special syntax, it's the same as with normal variables
04:52:05FromDiscord<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:12FromDiscord<TryAngle> (edit) "needed" => ""needed""
04:57:23*tinytim is now known as tinystoat
05:34:47FromDiscord<Elegantbeef> oh and @TryAngle if you get tired of repeating yourself https://github.com/beef331/constructor#constructor-1
05:35:27FromDiscord<TryAngle> In reply to @Elegantbeef "oh and <@147447489316913152> if": I already reexport your constructure library in my "utility" lirbary XD
05:35:35FromDiscord<TryAngle> (edit) "constructure" => "constructor"
05:35:37FromDiscord<Elegantbeef> Oh
05:35:53FromDiscord<Elegantbeef> I just updated/removed a bunch of shit so have fun getting brokey stuff
05:36:24FromDiscord<TryAngle> 👍
05:43:49*vicfred quit (Quit: Leaving)
05:53:27FromDiscord<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:57FromDiscord<codic> sent a code paste, see https://play.nim-lang.org/#ix=3JoV
05:54:16FromDiscord<codic> sent a code paste, see https://play.nim-lang.org/#ix=3JoW
05:54:16FromDiscord<codic> the compiler does not like this pattern
05:54:28FromDiscord<codic> ``
05:54:35FromDiscord<codic> how do I fix it?
05:54:37FromDiscord<codic> sent a code paste, see https://play.nim-lang.org/#ix=3JoX
05:57:07FromDiscord<Elegantbeef> Hard to say without seeing where the recursion comes from
05:58:54FromDiscord<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:13FromDiscord<TryAngle> same with XConfigureRequestEvent maybe?
05:59:20FromDiscord<TryAngle> (edit) "maybe?" => "maybe but other way around with the modules?"
05:59:39FromDiscord<Elegantbeef> Well it's hard to fix the import order without the entire file to reason where it's at
05:59:54FromDiscord<Elegantbeef> Depending on what's going on this just needs a delayed import
06:00:07FromDiscord<Elegantbeef> Otherwise the structure needs reorganized
06:03:22FromDiscord<Elegantbeef> So codic in typical fashion push a branch is the easier thing for me
06:16:00FromDiscord<TryAngle> can I add a ↵`T.doSomething()`↵for one type only somehow?
06:16:24FromDiscord<impbox [ftsf]> `proc doSomething(a: TheType) =`
06:16:35FromDiscord<TryAngle> 😳
06:16:55FromDiscord<Elegantbeef> you mean `proc doSomething(_: typedesc[TheType])`
06:17:07FromDiscord<impbox [ftsf]> is T a type or a variable of the type?
06:17:22FromDiscord<TryAngle> sent a code paste, see https://play.nim-lang.org/#ix=3Jp4
06:17:47FromDiscord<Elegantbeef> Yea my example
06:17:49FromDiscord<impbox [ftsf]> yeah, what beef said
06:17:53FromDiscord<TryAngle> ok ty guys
06:18:13arkanoidDo 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:30FromDiscord<codic> In reply to @TryAngle "same with XConfigureRequestEvent maybe": no XConfigureRequestEvent is defined in the x11 package
06:18:33FromDiscord<Rika> What is the "worth" you're seekibg
06:18:37FromDiscord<codic> In reply to @Elegantbeef "So codic in typical": what do you mean?
06:18:38FromDiscord<Elegantbeef> Given my disdain towards python i'm not qualified to answer this
06:18:41FromDiscord<Rika> (edit) "seekibg" => "seeking"
06:18:45FromDiscord<impbox [ftsf]> or you are
06:18:52FromDiscord<codic> do replies work through matrix?
06:18:54FromDiscord<impbox [ftsf]> leave python in the wind
06:18:57FromDiscord<Elegantbeef> Yes
06:19:05FromDiscord<codic> so wdym by push a branch?
06:19:17FromDiscord<Rika> Make a branch on your repo so we can see the whole thing
06:19:20FromDiscord<Elegantbeef> Push the current non compiling code to a branch i can checkout
06:19:58FromDiscord<codic> oh
06:19:59FromDiscord<codic> sure
06:20:10arkanoid"Worth" to me is putting static typing wherever possibile, also adding distinct PyObjects types
06:20:14FromDiscord<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:24FromDiscord<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:26FromDiscord<codic> (not compile because none of event handlers are implemented)
06:20:37FromDiscord<codic> > and with python I can imagine that copy pasting 90% works↵lmao no
06:20:53FromDiscord<impbox [ftsf]> maybe if python had types
06:21:03FromDiscord<codic> still probably no, but would bring it closer
06:21:11FromDiscord<impbox [ftsf]> the hardest bit about porting python code is trying to figure out what types things should be
06:21:16FromDiscord<Elegantbeef> Maybeeif python was nim
06:21:20FromDiscord<TryAngle> really? with rust for example I could copy paste almost all non-library specific code
06:21:39FromDiscord<TryAngle> like ofc. I had to change some things but it was really not much
06:21:55FromDiscord<Leonardo da Vinci> In reply to @Elegantbeef "Given my disdain towards": Why do you dislike python?
06:22:04arkanoidI'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:18FromDiscord<impbox [ftsf]> sounds like a topic for #languagewars
06:22:22FromDiscord<Elegantbeef> Do i really need to make a list 😀
06:22:44FromDiscord<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:08FromDiscord<Elegantbeef> Suffice to say lack of portable programs and unenforced static typing drive me up the wall
06:23:13FromDiscord<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:16FromDiscord<codic> In reply to @codic "it doesn't do anything": with this in mind
06:24:18FromDiscord<codic> https://github.com/codic12/worm/tree/refactor
06:24:32FromDiscord<Elegantbeef> Yea i want to fix the recursion error 😛
06:24:58arkanoidNumpy copy? Are you aware the shitload of complex problems already solved in numpy code? You think you can replace it easily?
06:25:03FromDiscord<codic> In C++ I could do this just fine by using a header but not sure how to do it in nim
06:25:09arkanoidAlso pandas and many scientific stacks
06:27:23FromDiscord<Elegantbeef> First `WM` isnt exported
06:27:32FromDiscord<Elegantbeef> Secondly you have a bunch of forward declarations but no implementations
06:27:47FromDiscord<Elegantbeef> Thirdly is there any real reason WM needs to `import configurerequest`?
06:28:10FromDiscord<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:33FromDiscord<Elegantbeef> "when to use self" inotherwords never 😜
06:29:00FromDiscord<Elegantbeef> https://github.com/karaxnim/karax is a good place to look
06:29:03arkanoidElegantbeef 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:13FromDiscord<Elegantbeef> Also https://github.com/karaxnim/awesome-karax
06:29:20FromDiscord<Elegantbeef> I never relied on python
06:29:50FromDiscord<Elegantbeef> Nim works well with strings
06:30:02FromDiscord<Just Jasmine, Please> You're awesome! thank you!
06:30:13FromDiscord<Elegantbeef> Dont say that i might develop an ego
06:30:31FromDiscord<Elegantbeef> I'm already an asshole, an asshole with an ego is just worse
06:30:35FromDiscord<Rika> "Might develop an ego" says the one with a massive ego
06:30:43arkanoidEleganfbeef, try working with large string tables with array/datamancer
06:31:09FromDiscord<Just Jasmine, Please> I'm getting an ego as I learn to love myself, lol
06:31:11FromDiscord<codic> In reply to @Elegantbeef "First `WM` isnt exported": Ok, just realized that, but exporting it doesn't change anything
06:31:13FromDiscord<Elegantbeef> arkanoid you're challenging me, but havent given me any data
06:31:22FromDiscord<Elegantbeef> Like i said
06:31:28FromDiscord<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:30FromDiscord<Elegantbeef> You dont need to import configure request in WM afaict currently
06:31:38FromDiscord<codic> oh?
06:31:55FromDiscord<Elegantbeef> Like when you have a reason to import it comeback
06:32:38FromDiscord<codic> ok first of all I just switched to my other monitor and now my editor is 4x bigger, wtf
06:32:49FromDiscord<codic> but anyways, let me try that
06:32:52FromDiscord<Elegantbeef> worm.diff https://media.discordapp.net/attachments/371759389889003532/924187924034117682/worm.diff
06:32:55FromDiscord<Elegantbeef> Here's my diff
06:33:02FromDiscord<Elegantbeef> Save you a few seconds
06:33:10arkanoidJust 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:47FromDiscord<Elegantbeef> I mean if i'm making a bunch of large strings and concerned of memory i'm doing `ref string`
06:33:52FromDiscord<Rika> I assume this is the mutable/immutable string difference
06:33:54FromDiscord<codic> In reply to @Elegantbeef "worm.diff": thanks
06:34:03FromDiscord<TryAngle> when using `std/random.gauss` do I need to call randomize() everytime I use it or just once?
06:34:04FromDiscord<Elegantbeef> Indeed rika
06:34:17FromDiscord<Elegantbeef> You just need to initialized the global random state
06:34:32FromDiscord<Elegantbeef> Do edits from matrix -\> discord still duplicate?
06:34:55FromDiscord<TryAngle> edit something
06:35:00FromDiscord<Elegantbeef> Oh nevermind they just dont even propagate
06:35:02FromDiscord<Just Jasmine, Please> These resources are amazing so far, thank you
06:35:12*elph quit (Quit: Connection closed for inactivity)
06:35:14FromDiscord<codic> In reply to @Elegantbeef "worm.diff": wait why did you remove all the event handlers
06:35:17FromDiscord<codic> i was going to implement them
06:35:17FromDiscord<Elegantbeef> You get thanked multiple times just for linking something
06:35:31FromDiscord<Elegantbeef> Cause they're all forward declares without implementations meaning i couldnt compile
06:35:41FromDiscord<TryAngle> In reply to @Elegantbeef "You just need to": so I just need to call it once the program starts?
06:35:48FromDiscord<Elegantbeef> Yep
06:35:53FromDiscord<codic> In your diff you did import events/configurerequest
06:36:02FromDiscord<Elegantbeef> Yep
06:36:05FromDiscord<codic> Oh I don't actually need the forward declarations there
06:36:09FromDiscord<codic> Cool
06:36:12FromDiscord<codic> One benefit to using multiple files
06:36:23FromDiscord<codic> Thanks
06:36:37FromDiscord<Elegantbeef> Without using the configure request i cannot be certain the delayed import will work for you
06:36:45FromDiscord<Elegantbeef> But that's basically the pattern you'll want to follow iirc
06:36:50arkanoidThere'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:15FromDiscord<Elegantbeef> Yea i dont do scientific computing, i do game dev mostly
06:37:25FromDiscord<Elegantbeef> So my idea of what needs to be done is nowhere near yours
06:37:59FromDiscord<Elegantbeef> I need an actual problem proposed/solution in front of me to actually understand the issues
06:38:04arkanoidApache arrow project is the good representation on what has to be done in nim
06:38:08*vicfred joined #nim
06:38:35arkanoidIn particular the memory layout for strings
06:38:38FromDiscord<TryAngle> sent a code paste, see https://play.nim-lang.org/#ix=3Jp5
06:39:16FromDiscord<Elegantbeef> Reread try
06:39:26FromDiscord<Elegantbeef> "first usage of the procs from this module"
06:39:40arkanoidI mean this https://arrow.apache.org/
06:40:17FromDiscord<Elegantbeef> Yea i found it
06:40:27FromDiscord<Elegantbeef> I've got a basis of what it is
06:40:39arkanoidIf 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:05FromDiscord<TryAngle> In reply to @Elegantbeef ""first usage of the": I'm stupid >.<,↵so `this` is the rand module?
06:41:12FromDiscord<Elegantbeef> Yes
06:41:15FromDiscord<evoalg> In reply to @Elegantbeef "<@900872397224280125>\: here's you're weekly": Thank you for my xmas present!
06:41:16FromDiscord<TryAngle> ok ty
06:41:42FromDiscord<Elegantbeef> I removed some of the mess mentioned before, any more things i should add evo?
06:42:13FromDiscord<evoalg> gosh I dunno!
06:44:08FromDiscord<Elegantbeef> I looked at sequtils and didnt see anything else that made sense
06:44:24FromDiscord<Elegantbeef> I still wish i could have `zip` work as an iterator
06:44:48arkanoidElegantbeer, 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:54FromDiscord<Elegantbeef> There's just no way without making closures of the iterator
06:45:47FromDiscord<Elegantbeef> arkanoid we have metaprogramming so imagine we can do a 0 cost abstraction ontop of the arrow buffer to a sequence
06:45:54FromDiscord<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:58FromDiscord<Elegantbeef> I'll have to look at the code to see if i can reason it
06:46:51FromDiscord<evoalg> In reply to @Elegantbeef "I still wish i": but slicerator zip ... is it still less overhead?
06:47:07FromDiscord<Elegantbeef> It emits a sequence so nope
06:47:37FromDiscord<Elegantbeef> It's capable of zipping N number of iterators though
06:48:33FromDiscord<evoalg> indeed it's impressive ... it even takes as arguments the results of zip'ed up lists
06:50:05FromDiscord<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:36FromDiscord<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:52FromDiscord<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:20arkanoidI 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:14FromDiscord<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:01arkanoidElegantbeef, please have a look at the C abi too https://arrow.apache.org/docs/format/CDataInterface.html
06:55:03FromDiscord<Elegantbeef> I mean if you tak a whirl at it i dont mind helping
06:55:10FromDiscord<Elegantbeef> I'm nothing if not helpful
06:57:05arkanoidThanks, I'll consider it. If I will ever find time to develop this
07:00:02FromDiscord<Elegantbeef> It's an interesting spec
07:00:38FromDiscord<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:14FromDiscord<Elegantbeef> The C ABI seems simpler
07:04:09FromDiscord<Elegantbeef> Wait until you run into a simple compiler bug that i can fix 😛↵(@evoalg)
07:05:16FromDiscord<evoalg> yea I want play with slicerator with some tests now that aoc is over (nearly)
07:06:07FromDiscord<Elegantbeef> Still keeping with AOC, nice
07:06:17arkanoidElegantbeef, 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:31FromDiscord<Elegantbeef> Isnt that with all the API support not just the minimal CABI
07:08:37FromDiscord<Elegantbeef> I might misunderstand how this is structured
07:08:39arkanoidThe 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:45FromDiscord<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:29FromDiscord<Elegantbeef> Yea pretty much me, havent done any since like the 7th
07:10:27FromDiscord<Elegantbeef> I just dont have much interest some problems, plus i was generally unmotivated to code anything for a bit
07:11:46arkanoidA starting point could be just to copy the approach of others https://arrow.apache.org/powered_by/
07:12:57arkanoidI'm not a rust programmer, but I'd look into rust's datamancer https://github.com/pola-rs/polars
07:13:35FromDiscord<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:40arkanoidAnd bonus it seems actually to be the fastest approach, too https://h2oai.github.io/db-benchmark/
07:15:00FromDiscord<Elegantbeef> Atleast that's how i understand it i could be wrong
07:15:09FromDiscord<Elegantbeef> Like i said i'm not anywhere near data science
07:15:10arkanoidNot sure how datamancer would display in that benchmark
07:21:03arkanoidI've also already tested automatic wrapping of arrow c-api (via gobject) using futhark and it worked out nicely
07:21:27arkanoidProblem is strings, again
07:22:13arkanoidLet'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:06arkanoidBut I'd be happy to have a zero copy datamancer to pandas with strings
07:23:59FromDiscord<that_dude> sent a code paste, see https://play.nim-lang.org/#ix=3Jpe
07:24:29FromDiscord<Elegantbeef> `obj()` means size is `0`
07:24:30FromDiscord<Rika> Other thing is a copy of thing
07:24:42FromDiscord<that_dude> Yeah I do get both of those
07:24:48FromDiscord<Rika> Because you stored a deference of location
07:25:04FromDiscord<Rika> Hence thing does not become 1 when you make other thing 1
07:25:24FromDiscord<Elegantbeef> sent a code paste, see https://play.nim-lang.org/#ix=3Jpg
07:25:42FromDiscord<Elegantbeef> `[]` dereferences a pointer so as rika said `var otherThing = location[]` is storing a copy
07:25:49FromDiscord<that_dude> shouldn't a dereference embody the original object as well? I guess that's where I got hung up
07:25:56FromDiscord<Elegantbeef> It doesnt point back
07:25:58FromDiscord<Elegantbeef> it copies
07:26:01FromDiscord<Rika> If you directly do it like what beef does yes
07:26:06FromDiscord<Rika> If you store it further it copies
07:26:12FromDiscord<Elegantbeef> `location[]` is an l-value which is asignable
07:26:37FromDiscord<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:44FromDiscord<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:48FromDiscord<Rika> No
07:26:50FromDiscord<Rika> Just use the pointer
07:26:58FromDiscord<Rika> Keep the pointer and do what beef does
07:27:01FromDiscord<Elegantbeef> or a `ref`
07:27:08FromDiscord<Rika> Either works
07:27:26FromDiscord<that_dude> I could never get refs to work lol and pointers are easier for me to understand.
07:27:43FromDiscord<Elegantbeef> sent a code paste, see https://play.nim-lang.org/#ix=3Jph
07:27:44FromDiscord<Elegantbeef> References are pointers
07:27:52FromDiscord<Elegantbeef> If you understand one you understand the other
07:28:00FromDiscord<Elegantbeef> The only difference is they're garbage collected
07:28:16FromDiscord<Rika> References are easier than pointers
07:28:19FromDiscord<that_dude> Wait I think I understand what wasn't working
07:28:22FromDiscord<Elegantbeef> A pointer is just an address in memory, a reference is the same
07:28:32FromDiscord<Rika> You only think they’re harder because you think you know how pointers work
07:28:37FromDiscord<that_dude> true
07:28:50FromDiscord<Rika> Now do you actually know how pointers work is the question
07:28:58FromDiscord<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:10FromDiscord<Elegantbeef> You cant get a reference to a stack allocated object
07:29:21FromDiscord<that_dude> That's prob what messes with me
07:29:40FromDiscord<Rika> You need to make a new reference and store the initialised object in it
07:29:45FromDiscord<Rika> Then stop using the regular object
07:29:49FromDiscord<Rika> And just use the red
07:29:51FromDiscord<Rika> Ref
07:29:56FromDiscord<Elegantbeef> `pointer` is unsafe due to this behaviour
07:30:16FromDiscord<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:16FromDiscord<Rika> No you’re unsafe because of your behaviour smh
07:30:26FromDiscord<Rika> Hello segfault
07:30:30FromDiscord<that_dude> Lol
07:30:30FromDiscord<Elegantbeef> You cannot take a reference to a stack object so they cannot be dangling
07:30:38FromDiscord<that_dude> haven't gotten that once yet tho
07:30:47FromDiscord<Elegantbeef> Nah dangling pointers dont tend to segfault afaik
07:30:48FromDiscord<Rika> You would have if you continued using a pointer
07:31:14FromDiscord<Rika> ~~not that you can’t if you use a reference~~
07:33:55FromDiscord<Elegantbeef> sent a code paste, see https://play.nim-lang.org/#ix=3Jpj
07:34:00FromDiscord<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:26FromDiscord<Elegantbeef> sent a code paste, see https://play.nim-lang.org/#ix=3Jpk
07:34:28FromDiscord<Elegantbeef> You want their semantics
07:35:08FromDiscord<Elegantbeef> So you want the abillity to have multiple variables point at them, you want to not copy the object on assignment,
07:35:24FromDiscord<Elegantbeef> My forum post i spam whenever this comes up https://forum.nim-lang.org/t/8426#54529
07:35:57FromDiscord<Rika> In reply to @that_dude "I guess I never": You can’t put an object in itself
07:36:35FromDiscord<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:42FromDiscord<Rika> If you want to make a graph (naively) then you default to pointer or ref semantics
07:37:15FromDiscord<Elegantbeef> Ref vs. non ref is all about what do you want the object to act like
07:37:56FromDiscord<Elegantbeef> Do you want it to behave like a value(primitives) or a reference(class in most languages)
07:38:02FromDiscord<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:42FromDiscord<that_dude> Like I try to plan things, but concept vs Implementation hits me hard
07:38:43FromDiscord<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:19FromDiscord<Elegantbeef> Some people view refs as "I dont need `var` in procedures", so there are many views about when to use ref
07:39:26FromDiscord<Elegantbeef> There is sadly no emprical answer 😀
07:39:44FromDiscord<Rika> There are things you literally cannot do with a regular object but can with a ref so
07:40:10FromDiscord<that_dude> I guess I'll reformat stuff to try to make sure ref works with the stuff instead
07:40:12FromDiscord<impbox [ftsf]> in python pretty much everything behaves like a ref
07:40:28FromDiscord<Elegantbeef> What are you working on dude?
07:40:30FromDiscord<impbox [ftsf]> (probably a simplication)
07:40:33FromDiscord<that_dude> well
07:40:51FromDiscord<Elegantbeef> If you describe the project or share the use case it might make it easier to suggest
07:40:58FromDiscord<Elegantbeef> I generally default to object
07:41:03FromDiscord<that_dude> sent a code paste, see https://play.nim-lang.org/#ix=3Jpl
07:41:09FromDiscord<Rika> In reply to @impbox "in python pretty much": Super oversimplification
07:41:32FromDiscord<Rika> Pythonistas use “label semantics” to describe it afaik
07:41:53FromDiscord<that_dude> Let me upload my main project to github real quick
07:42:49FromDiscord<impbox [ftsf]> like refs in that they're allocated on the heap and are garbage collected and such and can't dangle
07:42:58FromDiscord<Elegantbeef> Quick everyone belittle them for a minor thing so they never come back! 😀
07:43:23FromDiscord<Elegantbeef> Being on the heap prevents dangling 😛↵(@impbox [ftsf])
07:43:34FromDiscord<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:36FromDiscord<impbox [ftsf]> does it?
07:43:47FromDiscord<Rika> What is that username…
07:43:48FromDiscord<impbox [ftsf]> if you delete something on the heap you can have dangling pointers to it
07:43:58FromDiscord<impbox [ftsf]> (but not in python)
07:43:59FromDiscord<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:08FromDiscord<Elegantbeef> I might be wrong with the semantics of dangling, though it was only to the stack 😛
07:44:16FromDiscord<Rika> I’d immediately die if I had that username ngl
07:44:21FromDiscord<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:23FromDiscord<that_dude> of
07:44:31FromDiscord<Rika> I see
07:44:36FromDiscord<Rika> So it’s ironic
07:44:39FromDiscord<that_dude> Yeah
07:44:57FromDiscord<that_dude> I made sure to get as close to the name length cap as I could lol
07:45:38FromDiscord<Elegantbeef> `is cast[ptr A] and cast[ref A] the same` no
07:46:06FromDiscord<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:07FromDiscord<Rika> Don’t do the second one lol
07:46:23FromDiscord<that_dude> In a test I did I think both worked the same
07:46:28FromDiscord<Rika> They don’t
07:46:31FromDiscord<Rika> Don’t do the second one
07:46:37FromDiscord<that_dude> That's why I was wondering about that
07:46:42FromDiscord<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:57FromDiscord<Elegantbeef> I mean it'll work, and it'll behave the same but you arent getting a reference
07:47:07FromDiscord<Elegantbeef> You're getting a fake reference the GC doesnt care about
07:47:49FromDiscord<Rika> I’d just say “UB”
07:47:53FromDiscord<Elegantbeef> Congrats what was the issue?↵(@TryAngle)
07:47:57FromDiscord<Rika> No fuckin clue what that would do
07:48:02FromDiscord<Rika> So just don’t do it
07:48:08FromDiscord<that_dude> Lol
07:48:09FromDiscord<Elegantbeef> Indeed
07:49:39FromDiscord<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:04FromDiscord<that_dude> I just probably explained the my constrains very poorly
07:50:18FromDiscord<Elegantbeef> I mean we understand but it's just a whacky desire
07:50:39FromDiscord<that_dude> Yes, but it was needed for they way I have hydris structured
07:53:00FromDiscord<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:25FromDiscord<Elegantbeef> I mean that's why you make the code modular
07:54:31FromDiscord<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:45FromDiscord<Elegantbeef> you have 4 different game loops procedures declare
07:54:51FromDiscord<TryAngle> In reply to @Elegantbeef "Congrats what was the": it's bit long, sorry for the bloat u'll see now XD
07:54:58FromDiscord<Rika> Context free sounds like “globals” to me
07:55:42FromDiscord<that_dude> I've been trying to avoid globals because that limits the amount of instances I can have afaik
07:55:59FromDiscord<impbox [ftsf]> context free sounds like pure functions to me
07:56:07FromDiscord<Elegantbeef> What do the game loops do differently, they're so large it's hard to see
07:56:29FromDiscord<TryAngle> sent a code paste, see https://play.nim-lang.org/#ix=3Jpq
07:56:57FromDiscord<TryAngle> because prior to that, I was just taking the data of the vector
07:58:03FromDiscord<Elegantbeef> That's a fun issue
07:58:18FromDiscord<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:34FromDiscord<Elegantbeef> And they require 4 functions why?
07:59:29FromDiscord<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:58FromDiscord<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:05FromDiscord<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:40FromDiscord<Elegantbeef> I guess i'll just shush
08:03:32FromDiscord<that_dude> Lol you're fine
08:04:11FromDiscord<impbox [ftsf]> just don't introduce bugs and you'll be fine
08:04:31FromDiscord<that_dude> That's the dream
08:04:56FromDiscord<Elegantbeef> having 4 separate procedures with repeated logic makes it harder to reason about and introduce more errors
08:06:30FromDiscord<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:49FromDiscord<Elegantbeef> `if sim.gameMode == cheeseMode: doCheeseLogic()`
08:07:30FromDiscord<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:12FromDiscord<Elegantbeef> And for the larger states i'd suggest making a procedure for them, to reduce the code in this procedure
08:08:50FromDiscord<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:39FromDiscord<that_dude> I do think I was slowly moving to sets and a way from enums for some of my settings
08:10:03FromDiscord<that_dude> At least for my history settings in sim
08:10:57FromDiscord<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:28FromDiscord<that_dude> I do appreciate you taking a look at my stuff though. :)
08:11:53FromDiscord<impbox [ftsf]> remember, messy code that works is better than clean code that doesn't work
08:12:14FromDiscord<that_dude> Exactly. The only condition is that the messy code works too
08:12:39FromDiscord<impbox [ftsf]> once you get it working, you can clean it up... or you could leave it and do something more productive
08:12:48FromDiscord<Elegantbeef> Messy code that is hard to maintain is bad for my sanity 😛
08:13:03FromDiscord<impbox [ftsf]> fortunately, most code doesn't need to be maintained
08:13:07FromDiscord<that_dude> I really do want to clean this up, but I want it to be done first
08:13:18FromDiscord<Elegantbeef> Extending code is maintained imo 😛
08:13:47FromDiscord<impbox [ftsf]> well most code gets thrown out, at least in gamedev
08:14:31FromDiscord<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:02FromDiscord<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:02FromDiscord<Elegantbeef> Yea i let my personal idea that i hate writing code get in the way of things 😀
08:15:21FromDiscord<impbox [ftsf]> or you move on to the next project because that one sucked
08:15:33FromDiscord<impbox [ftsf]> you can write it cleaner on the next project
08:15:35FromDiscord<Rika> Like okay duh of course make a working shitty version but leaving it shitty is an awful idea
08:16:17FromDiscord<Rika> In reply to @impbox "or you move on": Yeah
08:16:21FromDiscord<Rika> That’s fine too
08:16:28FromDiscord<impbox [ftsf]> (i leave my code shitty, it still works)
08:16:56FromDiscord<that_dude> I think I have pretty big plans for this project so I really do need to clean it.
08:17:11FromDiscord<Elegantbeef> my view is generally if you're repeating yourself you're writing bad code
08:17:23FromDiscord<Elegantbeef> I said my view is if you're repeating yourself it's bad
08:17:36FromDiscord<that_dude> I say that when you hit a 3rd time, you've done something wrong
08:17:52FromDiscord<Elegantbeef> I dont even like the second time
08:18:00FromDiscord<Elegantbeef> It just shows to me there is a reason to write a procedure
08:18:19FromDiscord<Elegantbeef> or template/macro/iteraotr
08:18:21FromDiscord<Elegantbeef> iterator even
08:18:27FromDiscord<that_dude> Well I think it's not worth spending the brainpower to properly make that abstraction
08:18:47FromDiscord<that_dude> Unless the two sections have to really be searched for
08:18:50FromDiscord<Elegantbeef> I think it generally is as it makes the code easier to read
08:22:36FromDiscord<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:40FromDiscord<Elegantbeef> But i'm also the odd guy that does `type Reset = distinct void`
08:22:57FromDiscord<TryAngle> (edit) "linear?" => "linear?↵would there be a better approximation for nim for np.random.randn?"
08:25:03FromDiscord<Elegantbeef> If the stdlib doesnt tickle your fancy maybe one of these will? https://nimble.directory/search?query=random
08:25:24FromDiscord<satoro.tadziri> sent a long message, see http://ix.io/3JpE
08:26:15FromDiscord<satoro.tadziri> (edit) "http://ix.io/3JpE" => "http://ix.io/3JpG"
08:26:37FromDiscord<Elegantbeef> Man we're using Nim and people still make their own reesult variables
08:28:11FromDiscord<Elegantbeef> Seems the issue is with the old runtime
08:28:22FromDiscord<Elegantbeef> try `--gc:arc`
08:28:43FromDiscord<Elegantbeef> Even with `--newRuntime` `let` works properly
08:29:09FromDiscord<Elegantbeef> So yea seems it's a case of the compiler thinking it's smart
08:29:17FromDiscord<Elegantbeef> But infact it was being dumb
08:29:43FromDiscord<Solitude> thats cringe
08:29:56FromDiscord<Elegantbeef> Solitude as usual being fucking weird
08:30:21FromDiscord<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:17FromDiscord<Elegantbeef> Yea i was just joking 😛
08:32:50FromDiscord<Elegantbeef> I wonder if i can duplicate this
08:33:36FromDiscord<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:58FromDiscord<Elegantbeef> You arent supposed to use it alone, i just thought i'd test it
08:34:06FromDiscord<Elegantbeef> You should use `arc/orc` instead
08:34:38FromDiscord<Elegantbeef> I'm going to see if i can repro it and use that to reason why it happens
08:36:20FromDiscord<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:01FromDiscord<Solitude> nim doesnt require nimble. what install script?
08:38:33FromDiscord<Rika> You can install Nim anywhere just as long as you change your path variable as well
08:38:52FromDiscord<Ricky Spanish> sent a code paste, see https://play.nim-lang.org/#ix=3JpJ
08:39:41FromDiscord<Ricky Spanish> ah so all i need is to add the nim folder to my path and should be fine?
08:39:48FromDiscord<Solitude> yes
08:39:55FromDiscord<Ricky Spanish> ah ok great thanks
08:46:43FromDiscord<Elegantbeef> I get a min reproduce of this bug sadly
08:46:46FromDiscord<Elegantbeef> i cannot\
08:58:35*xet7 joined #nim
11:34:26FromDiscord<tbrekalo> is there something as `std::ref` in nim? And object which takes a reference to a non reference type
11:34:47FromDiscord<tbrekalo> (edit) "type" => "type;↵↵btw. happy Christmas everyone"
11:34:50FromDiscord<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:17FromDiscord<Rika> what is the difference of that and Nim "ref"?
12:24:15FromDiscord<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:14FromDiscord<tbrekalo> that's the issue; I have to create a new reference object
12:40:32FromDiscord<tbrekalo> I want to make a reference to an existing object that isn't of type `ref object`
12:47:32FromDiscord<Rika> Pointer; you cannot safely reference stack memory
12:47:48FromDiscord<Rika> Or do you mean you want to make a reference of a type that isn't
12:48:08FromDiscord<Rika> Just put "ref TheType", you don't need to make a new one
12:48:14FromDiscord<Rika> A new type I mean
12:51:22*neceve joined #nim
13:09:59FromDiscord<alfa> is there a way to get more verbose compiler output? rn it it just says SIGSEGV
13:14:59FromDiscord<Zajt> sent a code paste, see https://play.nim-lang.org/#ix=3Jqw
13:15:42FromDiscord<Zajt> (edit) "https://play.nim-lang.org/#ix=3Jqw" => "https://play.nim-lang.org/#ix=3Jqx"
13:16:10FromDiscord<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:39FromDiscord<Zajt> (edit) "https://play.nim-lang.org/#ix=3Jqx" => "https://play.nim-lang.org/#ix=3Jqy"
13:20:06FromDiscord<sOkam!> Any clue what's the mistake here? 🤔 https://media.discordapp.net/attachments/371759389889003532/924290406391357460/unknown.png
13:22:56FromDiscord<Solitude> you didnt export your fields
13:23:10FromDiscord<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:56FromDiscord<sOkam!> hmm where do I export them? in the functions?
13:24:04FromDiscord<Solitude> in the type declaration
13:25:18FromDiscord<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:01FromDiscord<qb> In reply to @Zajt "Hey, I have one": Are you coding an injectable library?
13:58:41FromDiscord<Zajt> In reply to @qb "Are you coding an": How do you mean?
13:59:38FromDiscord<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:16FromDiscord<Zajt> How would I compile it to a dll?
14:00:23FromDiscord<qb> `--app:lib`
14:00:31FromDiscord<Zajt> and then what is the export function?
14:02:48FromDiscord<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:25NimEventerNew 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:05FromDiscord<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:01NimEventerNew thread by Mantielero: Solvespace.nim - WiP, see https://forum.nim-lang.org/t/8740
17:42:55FromDiscord<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:42FromDiscord<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:55FromDiscord<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:09FromDiscord<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:23FromDiscord<Fish-Face> sent a code paste, see https://play.nim-lang.org/#ix=3JuD
19:01:59FromDiscord<Fish-Face> I suppose `enumval.ord+1` and then convert the integer index you get back (from `.pairs`) with `.EnumType`?
19:21:50FromDiscord<Solitude> In reply to @Fish-Face "Often you need to": you `succ` instead of `.ord + 1`
19:21:54FromDiscord<Solitude> you can
19:26:36*vicfred joined #nim
19:46:51FromDiscord<Forest> Does anyone know if Nimpy has a way to make an exported function asynchronous?
19:58:51FromDiscord<Fish-Face> In reply to @Solitude "you `succ` instead of": ah thank you!
20:19:51FromDiscord<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:31FromDiscord<TryAngle> sent a code paste, see https://play.nim-lang.org/#ix=3Jv2
20:37:41*brocc left #nim (#nim)
20:55:54FromDiscord<retkid> what exactly is nim 2.0
20:56:31FromDiscord<retkid> how big of a chaange is it
20:56:37FromDiscord<retkid> is it just stdlib stuf?
21:04:43FromDiscord<Goel> @retkid https://github.com/nim-lang/RFCs/issues/437
21:14:41*vicfred quit (Quit: Leaving)
21:25:12FromDiscord<retkid> we're switching to orc?
21:25:58FromDiscord<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:56FromDiscord<retkid> gonna miss Spawn
21:28:52FromDiscord<retkid> i dont like the extra type safeties planning to be added. Reminds me of java.
21:29:57FromDiscord<retkid> package level objects are very cool
21:30:09FromDiscord<el__maco> why is 0x7f000000 a good uint32 constant literal, but 0x80000000 is not
21:30:30FromDiscord<el__maco> how do I express the latter without a cast, or do I have to cast
21:32:02FromDiscord<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:36FromDiscord<retkid> (edit) "0x8....." => "0x8. 10^7"
21:32:42FromDiscord<el__maco> its not over the maximum value an 32 bit unsigned integer can have
21:33:01FromDiscord<el__maco> (edit) "an" => "a"
21:33:18FromDiscord<retkid> well is it specified as a uint
21:33:49FromDiscord<retkid> why not just make it a float64
21:33:54FromDiscord<retkid> (edit) "float64" => "float64, no fuss"
21:33:57FromDiscord<el__maco> how do you specify unsigned constant literal
21:34:49FromDiscord<retkid> presumubly
21:34:54FromDiscord<retkid> uint32(x)
21:35:00FromDiscord<retkid> (edit) "presumubly" => "presumably"
21:35:01FromDiscord<retkid> but
21:35:05FromDiscord<el__maco> yea so you cast
21:35:07FromDiscord<retkid> i need to look fur unsigned
21:35:13FromDiscord<retkid> yes you can lol
21:35:19FromDiscord<retkid> might be wrong
21:35:33FromDiscord<retkid> that stuff isn't worth the fuss
21:35:57FromDiscord<el__maco> a C compiler would accept the hex literal, or you could postfix with `u` to make it unsigned
21:36:31FromDiscord<retkid> uint is already unsigned
21:36:36FromDiscord<retkid> pretty sure
21:36:56FromDiscord<retkid> maybe a smarty pants like @Rika can give more details
21:37:08FromDiscord<retkid> i am unreliable.
21:37:45FromDiscord<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:50FromDiscord<el__maco> (edit) "an" => "a"
21:38:47FromDiscord<retkid> well
21:38:52FromDiscord<retkid> C does not have types really
21:39:01FromDiscord<retkid> c is the wildwest
21:39:01FromDiscord<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:15FromDiscord<el__maco> of course C has types
21:39:35FromDiscord<retkid> not cool ones like C++
21:40:07FromDiscord<el__maco> I wonder what constitutes a cool type 🤔
21:43:32FromDiscord<el__maco> wait now I'm actually confused. The proc takes `uint` now and even that doesn't accept 0x80000000
21:44:37FromDiscord<el__maco> https://play.nim-lang.org/#ix=3Jvf
21:46:24FromDiscord<el__maco> `0x80000000'u64` works but that's ugly, why do I have to do that
21:46:30FromDiscord<el__maco> (edit) "`0x80000000'u64`" => "`0x80000000'u64`"
21:55:27FromDiscord<Elegantbeef> Think it's just an issue with literals
21:55:39FromDiscord<Elegantbeef> They dont always properly reason the type
21:56:07FromDiscord<el__maco> I need to pass an rgba color to a function, almost always it will be a literal
21:56:14FromDiscord<Elegantbeef> 32bit + literals i think cause this issue
21:56:27FromDiscord<el__maco> I wonder how one should go about this in Nim
21:56:34FromDiscord<Elegantbeef> You could do `array[4, byte]`
21:56:41FromDiscord<Elegantbeef> It's easier to read anyway
21:57:16FromDiscord<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:20FromDiscord<Elegantbeef> Why are you using uint64 anyway, more than 1 byte per channel?
21:57:40FromDiscord<el__maco> I'm not. I switched because I thought that was the problem
21:57:59FromDiscord<el__maco> originally I had `proc SetPen(color:uint32)`
21:58:04FromDiscord<Elegantbeef> sent a code paste, see https://play.nim-lang.org/#ix=3Jvl
21:58:19FromDiscord<Elegantbeef> Oh damn i only have 7 nibbles
21:58:21FromDiscord<Elegantbeef> I cant count
21:59:34FromDiscord<el__maco> sent a code paste, see https://play.nim-lang.org/#ix=3Jvn
21:59:41FromDiscord<Elegantbeef> `1u8`
21:59:53FromDiscord<Elegantbeef> sent a code paste, see https://play.nim-lang.org/#ix=3Jvo
22:00:02FromDiscord<Elegantbeef> Or you can do the above if you must have the intlit work
22:01:24FromDiscord<Elegantbeef> I think there are issues made for the way int lits work
22:01:54FromDiscord<el__maco> sent a code paste, see https://play.nim-lang.org/#ix=3Jvq
22:01:57FromDiscord<el__maco> but u:int64 does work
22:02:47FromDiscord<el__maco> I guess I can change the prototype to expect an int64, but yea, its kinda confusing
22:04:24FromDiscord<Elegantbeef> sent a code paste, see https://play.nim-lang.org/#ix=3Jvr
22:05:32FromDiscord<Elegantbeef> Personally I imagine the above is more sensible anyway since Color isnt just an uint32, but ymmv
22:06:15FromDiscord<Elegantbeef> But i also use `distinct void` for actual things so i'm a weirdo
22:07:15FromDiscord<el__maco> sent a code paste, see https://play.nim-lang.org/#ix=3Jvs
22:07:31FromDiscord<Elegantbeef> No point using a union
22:07:42FromDiscord<Elegantbeef> You can get the same behaviour from a literal
22:09:31FromDiscord<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:50FromDiscord<el__maco> in fact it would be cool if you could have anonymous unions
22:10:57FromDiscord<Elegantbeef> For instance
22:11:00FromDiscord<Elegantbeef> sent a code paste, see https://play.nim-lang.org/#ix=3Jvv
22:11:30FromDiscord<Elegantbeef> https://github.com/alaviss/union ?
22:11:49FromDiscord<Elegantbeef> Or do you want anonymous untagged unions?
22:13:36FromDiscord<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:01FromDiscord<Elegantbeef> an untagged union is like what you were doing
22:14:11FromDiscord<Elegantbeef> Where there is not a discriminator
22:14:29FromDiscord<Elegantbeef> A tagged union holds an discriminator so you can access the correct union without issues
22:14:37FromDiscord<Elegantbeef> It's an issue when they're different sized
22:14:41FromDiscord<el__maco> sent a code paste, see https://play.nim-lang.org/#ix=3Jvw
22:15:19FromDiscord<el__maco> now I must remember what was the name of the tuple and say `color.u.r`
22:15:27FromDiscord<Elegantbeef> Ah
22:15:31FromDiscord<Elegantbeef> Or you can just do what i showed you
22:15:38FromDiscord<Elegantbeef> And dont have to remember the name of the tuple
22:16:03FromDiscord<el__maco> no offense but that looks kinda complicated for what it is 🤔
22:16:37FromDiscord<Elegantbeef> I mean you can do bitwise ops if you prefer
22:16:41FromDiscord<Elegantbeef> It's the same thing
22:20:17FromDiscord<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:23FromDiscord<Elegantbeef> Isnt that deech?
22:21:24FromDiscord<demotomohiro> You can implement RGBA8 object like this:
22:21:36FromDiscord<demotomohiro> sent a code paste, see https://play.nim-lang.org/#ix=3Jvy
22:21:58FromDiscord<Elegantbeef> There's the bitwise ops i didnt want to do 😀
22:24:15FromDiscord<el__maco> I guess, but I'm a bit concerned about the possibility that the compiler will actually emit this procedure call
22:24:30FromDiscord<demotomohiro> sent a code paste, see https://play.nim-lang.org/#ix=3Jvz
22:25:07FromDiscord<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:14FromDiscord<Elegantbeef> We're in 2021 99% of cpus are LE↵(@demotomohiro)
22:25:16FromDiscord<Elegantbeef> 😛
22:25:39FromDiscord<Elegantbeef> Then jusut cast the int to uint32↵(@elmaco)
22:26:24FromDiscord<el__maco> a sane C compiler backend might inline that call, but idk
22:26:25FromDiscord<Elegantbeef> disregard me
22:26:47FromDiscord<Elegantbeef> It almost certainly will, you can also make it a template for 100% inline
22:27:09FromDiscord<el__maco> seems complicated when all you want to do is to write 4 bytes of memory
22:27:24FromDiscord<el__maco> 🤷‍♂️
22:27:35FromDiscord<Elegantbeef> All this to avoid writing `u32` 😛
22:28:25*Guest66 joined #nim
22:28:32FromDiscord<el__maco> I mean int64 seems to work, so I'm okay with this
22:32:07Guest66Hi, 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:59jphdotamIn 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:19jphdotamsee line #16 here https://pastebin.com/WRbnGRn2
22:34:38jphdotamIt'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:17FromDiscord<Elegantbeef> I mean Nim is statically typed, so yes
22:35:55NimEventerNew thread by Batsking: Rust's dbg! macro equivalent in nim, see https://forum.nim-lang.org/t/8741
22:36:54jphdotamBut in C++ I can feed in any old struct it seems
22:37:09FromDiscord<Elegantbeef> Sure C++ doesnt mind implicit conversions
22:38:15*xet7 quit (Remote host closed the connection)
22:38:17FromDiscord<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:23FromDiscord<Elegantbeef> Oh you already had it packed 😀
22:41:10jphdotamYeah I already figured out packed, but yeah in C++ I can do variable.data() to get a pointer to element 0
22:41:38jphdotambut if I do what you said, which is variable[0].addr (see line 53) it doesn't work
22:41:46FromDiscord<Elegantbeef> Well the data is sequential so `myObject.addr` sorry
22:42:16FromDiscord<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:25FromDiscord<Elegantbeef> If you want the first element of an array you do `myObject.color[0].addr` for instance
22:42:41FromDiscord<Elegantbeef> `.data` is an obscure way of getting the addr of an element 😀
22:42:42jphdotammyObj.addr (nor myObj[0].addr) doesn't work weirdly - it doesn't error, but it just doesn't plot anything
22:43:08jphdotamIt's as if it knows it's a reference/pointer to somethign that isnt technically an array of GLfloats
22:43:17jphdotamEven if the data layout is identical
22:43:48FromDiscord<Elegantbeef> You are doing `vertssep.addr`?
22:44:37FromDiscord<Elegantbeef> unrelated but in nim we do `initT` for value type objects
22:45:04jphdotamOk um now it's working... I must have made a stupid mistake.... I am stupid, and you are an elegant beef
22:45:19FromDiscord<Elegantbeef> Cheers
22:45:43jphdotamWhat do you mean by the initT bit sorry?
22:46:05FromDiscord<Elegantbeef> `initVertex` vs. `newVertex`
22:46:18FromDiscord<Elegantbeef> `object` in Nim is a struct in C++
22:47:19jphdotamAhh ok
22:47:33FromDiscord<el__maco> what does the {.packed.} pragma do btw. Does Nim follow the same packing rules with C or something else
22:47:44FromDiscord<Elegantbeef> It tightly packs the fields
22:47:48jphdotamAm I right in saying that is purely aesthetic, the term new and init don't actually impact?
22:47:53FromDiscord<Elegantbeef> https://nim-lang.org/docs/manual.html#foreign-function-interface-packed-pragma
22:48:07FromDiscord<Elegantbeef> Well `new` implies heap allocations and `init` implies stack allocation
22:48:15FromDiscord<Elegantbeef> So it does impact what the read expects
22:48:26FromDiscord<Elegantbeef> When i read `newVector` i assumed you were using references and that was an issue
22:48:43jphdotamAh I see, thanks
22:49:11FromDiscord<Elegantbeef> It's just a convention, so if you're not expecting others to use your code it doesnt matter
22:49:35FromDiscord<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:18FromDiscord<retkid> ``new``
22:50:26FromDiscord<retkid> sweats in java
22:50:40jphdotamMakes sense
22:50:47jphdotamDoes everyone use discord rather than IRC, now?
22:50:54FromDiscord<Elegantbeef> I'm on matrix
22:51:03FromDiscord<retkid> take that back I like the new operator and it feels weird without it in kt
22:51:05FromDiscord<retkid> i use discord
22:51:23FromDiscord<retkid> im not a boomer
22:51:40FromDiscord<retkid> thought i might use IRC because well, too much ram usage
22:52:45FromDiscord<el__maco> discord is only 350MB, could be worse 😔
22:52:56FromDiscord<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:18FromDiscord<Elegantbeef> You crazy fool you did it!
22:53:37FromDiscord<evoalg> hehe 😉
22:54:32FromDiscord<Elegantbeef> Any reasoning to why it happens now?
22:55:46FromDiscord<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:06FromDiscord<evoalg> arg and orc work fine just as you said
22:57:58FromDiscord<Solitude> https://github.com/nim-lang/Nim/issues/13771
22:59:37FromDiscord<Elegantbeef> Ah thanks solitude
23:00:25FromDiscord<evoalg> gosh I might add `--gc=orc` to my default config
23:00:27FromDiscord<Elegantbeef> Without move semantics analysis it doesnt copy it
23:00:44FromDiscord<Elegantbeef> Depending on what you're doing it's faster
23:01:02FromDiscord<Elegantbeef> Though it's almost always more memory efficient
23:01:43FromDiscord<evoalg> I can override with arc when I feel the need right?
23:02:05FromDiscord<Elegantbeef> You should be able to
23:04:57FromDiscord<Elegantbeef> IIRC the CLI is raised to the highest level of control
23:05:04FromDiscord<Elegantbeef> So it overrides everything else
23:05:15FromDiscord<Elegantbeef> Also i realized evo that given the use case of `zip` it doesnt make sense as an iterator 😛
23:05:52FromDiscord<Elegantbeef> Though i might try an impl using closure iterators to see how well it works
23:06:05FromDiscord<Elegantbeef> And if it's any more memory/speed performant to a normal zip
23:06:12NimEventerNew 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:05FromDiscord<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:20FromDiscord<Yardanico> you should ask around in #science and check https://github.com/SciNim/ :)
23:08:48FromDiscord<JamesH> Ah thank you
23:46:31FromDiscord<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:41FromDiscord<retkid> ive never had to do bitwise stuff
23:47:00FromDiscord<retkid> trying to think of a use
23:47:18FromDiscord<retkid> has there been uses that i just never foresaw and have been solving problems less efficiently
23:50:45FromDiscord<Elegantbeef> It's conventional but if you find it tedious i have a package which makes it a bit eaasier↵(@JamesH)
23:50:59FromDiscord<Elegantbeef> https://github.com/beef331/constructor
23:52:14FromDiscord<Elegantbeef> @evoalg\: do you have an example of code which uses `zip` then operates on the data?
23:53:01FromDiscord<Elegantbeef> sent a code paste, see https://play.nim-lang.org/#ix=3JvS
23:59:40FromDiscord<Elegantbeef> It uses a little less memory but is 80 times slower in my test
23:59:52FromDiscord<Elegantbeef> So what i expected a vastly slower impl