<< 28-12-2022 >>

00:07:52*ltriant joined #nim
00:14:23*ltriant quit (Ping timeout: 246 seconds)
00:14:57*ltriant joined #nim
00:25:35*ltriant quit (Ping timeout: 246 seconds)
00:30:23FromDiscord<c4ulmu> sent a code paste, see https://play.nim-lang.org/#ix=4jJV
00:31:36FromDiscord<Elegantbeef> sent a code paste, see https://play.nim-lang.org/#ix=4jJX
00:31:44PMunchNew version of autotemplates out supporting case objects and inheritance :)
00:31:54PMunchhttps://github.com/PMunch/autotemplate
00:32:06*PMunch quit (Quit: leaving)
00:33:12FromDiscord<Elegantbeef> sent a code paste, see https://play.nim-lang.org/#ix=4jJY
00:34:21FromDiscord<c4ulmu> Yes, thank you. Both examples are working
00:34:59FromDiscord<c4ulmu> Second is easier, I agree. I will use it. But first is very helpful too
00:35:16FromDiscord<c4ulmu> I didn't know about `default`
01:01:00FromDiscord<sOkam!> sent a code paste, see https://paste.rs/0Ms
01:01:43FromDiscord<sOkam!> (edit) "https://play.nim-lang.org/#ix=4jK2" => "https://play.nim-lang.org/#ix=4jK1"
01:02:08FromDiscord<jtv> Sequences have copy semantics by default, and by using object instead of ref object, so do your data types.
01:02:34FromDiscord<sOkam!> i see, kk
01:03:14FromDiscord<jtv> sent a code paste, see https://play.nim-lang.org/#ix=
01:04:20FromDiscord<sOkam!> whats the difference between ref and ptr in this case?
01:04:35FromDiscord<sOkam!> i get that ptr is just an adress, like in C. but what is ref in this context?
01:04:52FromDiscord<jtv> In nim, pointers are for references unmanaged memory, generally to external C
01:04:58FromDiscord<Elegantbeef> `ref` in Nim is garuenteed to be heap allocated and is automatically managed
01:05:22FromDiscord<sOkam!> ic, then target for this should be using ref, yeah
01:05:26FromDiscord<jtv> Yes
01:05:28FromDiscord<Elegantbeef> Likely
01:05:36FromDiscord<Elegantbeef> Remember they're nilable though
01:06:04FromDiscord<sOkam!> what do you mean? that a ref could be pointing to nil, so you have to check for that case?
01:06:55FromDiscord<Elegantbeef> The default value of `ref T` is nil
01:07:07FromDiscord<sOkam!> kk
01:07:45FromDiscord<sOkam!> sent a code paste, see https://play.nim-lang.org/#ix=4jK6
01:08:49FromDiscord<jtv> Generally yes. As Elegantbeef said, as long as you are sure that you can't have nil values. A lot of people make heavy use of the options module to help add static checking for nil state
01:09:06FromDiscord<jtv> And there's some experimental not-nil tracking you could look at
01:09:39FromDiscord<sOkam!> oh so you cannot check for nil without the options module?
01:10:01FromDiscord<jtv> You can, but you're not going to catch such errors at compile time that way
01:12:49FromDiscord<sOkam!> ah, by static you meant compile time. kk, makes sense
01:13:34FromDiscord<jtv> Yeah, that's generally going to be what people mean by static here
01:16:15FromDiscord<sOkam!> how do you define the data or a ref object? just like a regular object?
01:16:20FromDiscord<jtv> Yes
01:16:44FromDiscord<jtv> You can instantiate with: x = MyObject(field: value, field2: value2, ...)
01:17:17FromDiscord<sOkam!> what do you mean?
01:17:44FromDiscord<jtv> What language are you coming from?
01:17:48FromDiscord<sOkam!> C
01:17:56FromDiscord<sOkam!> and also translating C
01:18:04FromDiscord<sOkam!> (edit) "and also translating C ... " added "for this usecase"
01:18:13FromDiscord<jtv> So it's essentially going to malloc your object on the heap, and initialize any fields you do pass in
01:18:27FromDiscord<jtv> x = MyObject() is fine, and will set all values to the default value
01:19:03FromDiscord<sOkam!> so it behaves like `ref object of RootObj`, where you need to first say `new` so that it works?
01:19:37FromDiscord<jtv> You don't need to say new. Convention is often to add a constructor-style function called newWhatevertype()
01:20:06FromDiscord<sOkam!> yeah, but inside that newThing proc... you do create the output with new, right? at least that's what i've been doing
01:20:09FromDiscord<jtv> And adding "of RootObj" is really just adding the inheritance relationship
01:20:20FromDiscord<sOkam!> I just didn't catch that `ref object of ...` is the same as a`ref object`
01:20:52FromDiscord<jtv> Well, I'm only about 6 weeks into nim myself, but I'm pretty sure you don't need the new keyword in either circumstance
01:21:11FromDiscord<Elegantbeef> you can do `new result`
01:21:20FromDiscord<sOkam!> yeah, that's what I've been using
01:22:02FromDiscord<sOkam!> sent a code paste, see https://play.nim-lang.org/#ix=4jK9
01:22:05FromDiscord<Elegantbeef> That's the same as `result = TypeThing()`
01:22:15FromDiscord<Elegantbeef> you can also just do `TypeThing(blabla: 1)`
01:22:51FromDiscord<sOkam!> yeah, i just didn't catch that ref object is just the exact same as ref object of
01:23:22FromDiscord<jtv> Well, w/o inheritance of any sort 🙂
01:23:31FromDiscord<Elegantbeef> Well it's not the "Exact same"
01:23:50FromDiscord<Elegantbeef> They're both heap allocated but one lacks runtime type information or atleast should
01:24:01FromDiscord<sOkam!> well, but in practice you declare the thing with the same syntax, that's what i meant
01:24:27FromDiscord<Elegantbeef> Safe Nim is nice in that regard since you know all `ref T`s are heap allocated and all `T`s are stack
01:24:55FromDiscord<Elegantbeef> IE you know you shouldnt stack allocate `array[100000, int]` 😄
01:27:17FromDiscord<sOkam!> Does nimsuggest crash all the time for you guys too?
01:29:03FromDiscord<jtv> I don't actually use it, am an old emacs greybeard :/
01:29:25FromDiscord<Elegantbeef> Code by feel
01:39:13FromDiscord<sOkam!> how do arc/orc know when to release an object with no references left? (in simple terms, in know it must be complex)
01:40:00FromDiscord<sOkam!> i know its not the classic "stop the world" idea, but my vague understanding stops there 🙈
01:42:21FromDiscord<Elegantbeef> reference count
01:42:22FromDiscord<jtv> My understanding, without having dug into the implementation yet, is that it's generally reference counting heap objects, but also running a collector, but only where there are cycles in those references
01:42:56FromDiscord<Elegantbeef> Arc doesnt do cyclical types
01:42:57FromDiscord<Elegantbeef> so it just checks if ref == 0
01:42:57FromDiscord<Elegantbeef> If so it deallocs
01:43:26FromDiscord<jtv> Ah, must have confused it w/ orc.
01:44:03FromDiscord<Elegantbeef> Yea orc uses a mark and sweep algo for the deallocation of cycles
01:44:05FromDiscord<sOkam!> whats a cycle? i never understood that 🤔
01:44:13FromDiscord<Elegantbeef> A ref that references itself
01:44:22FromDiscord<jtv> Or when objects mutually refer to each other
01:44:27FromDiscord<sOkam!> ic
01:44:30FromDiscord<Elegantbeef> sent a code paste, see https://paste.rs/BRs
01:44:57FromDiscord<sOkam!> why would you use something like that, in practical use?
01:45:00FromDiscord<jtv> A doubly linked list
01:45:03FromDiscord<jtv> etc
01:45:06FromDiscord<jtv> It's common
01:45:47FromDiscord<jtv> I wonder how much pain it's going to cause w/ people having memory leaks they don't notice?
01:45:59FromDiscord<Elegantbeef> Orc is deafault and suggested
01:46:42FromDiscord<jtv> Cool, I thought it was going to be arc in 2.0, but given that understanding I'm glad it's orc 🙂
01:46:50FromDiscord<Elegantbeef> And orc could be turned into a cycle collector
01:46:58FromDiscord<Elegantbeef> detector\
01:48:58FromDiscord<jtv> I was impressed at the numbers I looked at on relative performance, especially since the CW has always been reference counting is higher overhead but amortized somewhat better since you don't have a big stop-the-world event, or what have you.
01:52:47FromDiscord<Elegantbeef> Yea though Nim generally uses less GC than javaj and firends
01:57:58FromDiscord<jtv> Yes, that's not tough, and expected given how much Nim leaves on the stack!
01:59:05FromDiscord<jtv> Hey, with concepts, do they imply mixin? I just realized I've got a case where I'm calling a function defined elsewhere that should be declared as mixin per the docs, but not getting an error (it's working)
01:59:40FromDiscord<Elegantbeef> Overloaded symbols are mixin'd by default
02:00:13FromDiscord<gabreal> Hey all, getting the following error `/Library/Developer/CommandLineTools/SDKs/MacOSX13.1.sdk/usr/include/machine/_types.h:36:2: error: architecture not supported` because of the following is failing `#if defined (i386) || defined(x86_64)` not sure how to make nim say that it wants i386 though
02:00:29FromDiscord<jtv> Ah, did that change at some point? I saw a forum thread from 3 years ago that indicated the opposite
02:01:55FromDiscord<gabreal> to add a bit of context for my issue, I am passing `--cpu:i386` so I would've thought it would've just worked
02:06:46FromDiscord<jtv> I've never tried cross-compiling w/ nim, but it's calling down to Apple's C compiler, which is going to require -target=... passed to it to. cross-compile. So def make sure you're doing whatever needs to happen for that. Just defining i386 wouldn't be enough
02:07:51FromDiscord<jtv> Generally, I haven't cross-compiled in years. It's a bit of an anti-pattern given the availability of cheap ephemeral cloud resources that are easily available from any CI/CD pipeline...
02:13:52FromDiscord<gabreal> Yeah I realize but I'm actually targeting wasm haha
02:17:01FromDiscord<sOkam!> is it good practice to use `var thing = MyType()` even for non-ref objects?
02:20:57FromDiscord<gabreal> @jtv thanks btw you got me in a better direction atm
02:25:01FromDiscord<jtv> It's always good to initialize fields of objects before you use them, instead of the implicit default initialization
02:25:40FromDiscord<jtv> In fact, I think nim 2.0 use before explicit initialization is at least going to be a warning
02:31:45*rlitp joined #nim
02:59:30FromDiscord<Bung> but that would make default constructor un available ?
03:01:05FromDiscord<Bung> it works most of time, if it dont work for you, you can add `requiresInit` pragma to the type
03:19:04FromDiscord<sOkam!> I was thinking for the "default" case, where you don't need an explicit constructor but the type might become a ref in the future... creating the variable with `var thing = MyType()`, instead of `var thing: MyType`, would avoid having to refactor any spot where the variable of that type is initialized
03:21:18*ehmry quit (Ping timeout: 272 seconds)
03:21:28FromDiscord<Elegantbeef> Well also with strict def in 2.0 it's saner
03:21:36*ehmry joined #nim
03:31:00FromDiscord<IsaacPaul> sent a code paste, see https://play.nim-lang.org/#ix=4jKj
03:31:24FromDiscord<IsaacPaul> (edit) "https://play.nim-lang.org/#ix=4jKj" => "https://paste.rs/dDD"
03:45:35FromDiscord<gabreal> Beef
03:45:43FromDiscord<gabreal> Wanna help me figure out why Nim is lying to my clang
03:46:15FromDiscord<gabreal> On Linux I can build to wasm fine but if I use the c headers that macos has then there are issues :p
03:48:48FromDiscord<Elegantbeef> `--listCmd`
03:49:24FromDiscord<<She>Horizon</Her>> Maybe you need `--platform:linux` too? Since it's like a weird linux target
03:49:35FromDiscord<<She>Horizon</Her>> But really, standalone should be used iirc
03:49:53FromDiscord<Elegantbeef> https://github.com/beef331/wasm3/blob/master/wasmsources/config.nims
03:49:56FromDiscord<Elegantbeef> Is what my config is
03:50:12FromDiscord<Elegantbeef> This is for emscripten
03:50:59FromDiscord<<She>Horizon</Her>> Ah neay
03:51:30FromDiscord<<She>Horizon</Her>> Oh wait yeah also iirc `proc main() {.importc: "NimMain()".}` needs to be done too
03:51:47FromDiscord<Elegantbeef> With orc/arc it's only needed for top level intialisation
03:51:58FromDiscord<gabreal> I can't have a main method
03:52:06FromDiscord<gabreal> I'm trying to compile for straight standalone wasm
03:52:45FromDiscord<Elegantbeef> My config removes the main
03:53:14FromDiscord<gabreal> Yeah but emscripten provides all the shimlib stuff I thought
03:53:55FromDiscord<<She>Horizon</Her>> Yeah that's what i was thinking
03:54:06FromDiscord<<She>Horizon</Her>> Emscripten doesn't like the Nim provided main for some reason
03:54:34FromDiscord<Elegantbeef> It doesnt mind it afaik
03:54:58FromDiscord<Elegantbeef> The thing is it doesnt make much since given the wasm runtime doesnt call main, and you need to explicitly do it
03:54:58FromDiscord<<She>Horizon</Her>> Remember it cried when i did it?
03:55:15FromDiscord<Elegantbeef> I really dont think emcc cares
03:55:18FromDiscord<Elegantbeef> I could be wrong
03:55:34FromDiscord<<She>Horizon</Her>> Fair, in my code i called it explicitly (to pretend it was in a shell or something)
03:56:30FromDiscord<gabreal> I've been trying to get https://github.com/yglukhov/wasmrt this working but that is a struggle lol
03:57:13FromDiscord<Elegantbeef> If you're targetting a web browser i'm mostly useless
03:57:21FromDiscord<gabreal> I'm targeting server 😉
03:57:27FromDiscord<Elegantbeef> I only know using wasm as a portable runtime and nothing related to browser
03:57:46FromDiscord<gabreal> The portable environment I'm targeting doesn't support WASI afaik
03:58:03FromDiscord<gabreal> I'm literally just trying to make a little nim wasm binary where I export 3 methods for the vm to call into haha
03:58:13FromDiscord<Elegantbeef> So then copy my config
03:58:45FromDiscord<Elegantbeef> https://github.com/beef331/wasm3/blob/master/wasmsources/hooks.nim
03:58:50FromDiscord<Elegantbeef> Compiles with that config
03:59:11FromDiscord<Elegantbeef> https://github.com/beef331/wasm3/blob/master/tests/test1.nim#L81-L87
03:59:18FromDiscord<Elegantbeef> Works just fine in my experience
04:00:02FromDiscord<gabreal> Going to try and get that config working 🙂
04:00:08FromDiscord<gabreal> Do you know how I can disable all floats ?
04:00:11FromDiscord<gabreal> in nim ^
04:00:21FromDiscord<gabreal> I can't use them in the environment I'm going for
04:00:28FromDiscord<Elegantbeef> Dont think you can
04:00:38FromDiscord<gabreal> Welp
04:00:43FromDiscord<gabreal> Praying something doesn't use it 😄
04:01:10FromDiscord<Elegantbeef> Well most of the stdlib should work where a FPU doesnt exist
04:01:28FromDiscord<gabreal> Yeah I need to look through the stdlib to see what I can realistically use
04:01:29FromDiscord<Elegantbeef> Fairly certain araq is concerned about that but idk
04:02:04FromDiscord<gabreal> Thanks beef btw
04:05:14*arkurious quit (Quit: Leaving)
04:14:48FromDiscord<Elegantbeef> Will also note you could look at nlvm @gabreal it's stdlib doesnt support WASI presently, but it can generate wasm binaries
04:15:07FromDiscord<gabreal> unfortunately I can't do nlvm it wont compile for me I can't figure out why
04:15:11FromDiscord<gabreal> Mostly a macos issue
04:19:03*rlitp quit (Ping timeout: 260 seconds)
04:29:02*genpaku quit (Remote host closed the connection)
04:32:06*rlitp joined #nim
04:32:42*genpaku joined #nim
05:03:07*nick2 quit (Quit: WeeChat 3.7.1)
05:31:45*ltriant joined #nim
05:38:31FromDiscord<dizzyliam [they/them]> can one tell nimble to build a file using the js backend?
05:41:37*ltriant quit (Ping timeout: 268 seconds)
05:47:42FromDiscord<albassort> is there a library with more anon compatible functions
05:48:07FromDiscord<albassort> In reply to @karma_corrections "can one tell nimble": -defined js
05:49:37FromDiscord<albassort> e.g
05:49:39FromDiscord<albassort> some in js
05:49:53NimEventerNew thread by archnim: Is setControlCHook still supported ?, see https://forum.nim-lang.org/t/9770
05:49:53FromDiscord<albassort> in the nim stdlib we only have map and filter?
05:51:12FromDiscord<albassort> oh ok we have anyIt and allIt
05:53:52*rlitp left #nim (#nim)
05:54:29*ltriant joined #nim
06:01:13*ltriant quit (Ping timeout: 252 seconds)
06:02:05*rockcavera quit (Remote host closed the connection)
06:17:29FromDiscord<ronaldinio> I recently came across Nimskull, and was given the impression core maintainers are ditching in support of Nimskull -↵before realizing that was mostly misinformation. I do mean to speak ill of anyone, but it's rather ambitious and I don't↵currently see directive beyond modernization. To what capacity the efforts are worthwhile, I don't know.↵Anyone have a relationship or insight?
06:17:44FromDiscord<ronaldinio> (edit) "ill of anyone," => "ill,"
06:31:35termerI saw nimskulll as well and I think the point is to make it more community and standard driven than nim
06:32:01termerthat's the impression I get anyway
06:44:02FromDiscord<JeysonFlores> What is the "effect system" in Nim and what exactly does?
06:46:50FromDiscord<Elegantbeef> The effect tracking system tracks effects, these can be user defined or compiler inferred like `raises: []`
06:46:58FromDiscord<Elegantbeef> This allows you to disallow procedures with effects or that lack effects
07:32:39FromDiscord<voidwalker> sent a code paste, see https://play.nim-lang.org/#ix=4jKX
07:33:02FromDiscord<voidwalker> 90gb file, no space taken on disk
07:39:25FromDiscord<Prestige> neat
07:47:58FromDiscord<sOkam!> If I have a ref object containing other objects, because I want the data to be heap-alloc.... do I need to mark the containing objects also as ref, or is that done auto?
07:48:36FromDiscord<Elegantbeef> Well they're heap allocated of course, but they're not references
07:48:38FromDiscord<sOkam!> Also, does Nim heap alloc big data objects when they should be, or do they need to be marked ref instead?
07:48:38FromDiscord<Rika> Anything within the reference is gonna be stored on the heap
07:48:42FromDiscord<Elegantbeef> Think `seq[T]` it heap allocates
07:48:51FromDiscord<Rika> But will be value semantics
07:49:00FromDiscord<Elegantbeef> Nim doesnt heap allocate anything automatically
07:49:27FromDiscord<Elegantbeef> `ref int` is a heap allocated int
07:49:32FromDiscord<Elegantbeef> For instance
07:49:37FromDiscord<sOkam!> even if the data block is big?
07:49:45FromDiscord<Elegantbeef> correct
07:49:54FromDiscord<sOkam!> interesting, didn't know that
07:49:57FromDiscord<Elegantbeef> `var a: array[10000, int]` will attempt to allocate `a` on the stack\`
07:51:02FromDiscord<sOkam!> so if I have `type MyHeapType = ref object`, everything contained will be heap alloc, just by being part of the other, right?
07:51:23FromDiscord<Elegantbeef> Correct the entire point of `ref T` is to say "this is a heap allocated version of X"
07:51:36FromDiscord<sOkam!> kk makes sense
07:51:42FromDiscord<Elegantbeef> Value types will be stored at the pointer, ref types stored at their pointer
07:52:27FromDiscord<Elegantbeef> If you just think of `ref` as a pointer this is all easier
07:53:00FromDiscord<sOkam!> yeah, i guess. but i just didn't know if the contents would be also treated the same
07:56:14FromDiscord<sOkam!> what happens if I create a non-ref object inside a function that returns it, and assign the result to the contents of another ref object?↵Is the data copied or is the pointer to the data moved instead?
07:56:49FromDiscord<Elegantbeef> Non ref types are values
07:56:50FromDiscord<Rika> Copied
07:56:58FromDiscord<Rika> There are no pointers for value types
07:56:59FromDiscord<Elegantbeef> More likely moved
07:57:13FromDiscord<Rika> I guess with newer Nim it’s moved
07:57:33FromDiscord<sOkam!> starting to see the importance of move semantics, i guess
07:58:00FromDiscord<Rika> How moving
07:58:11FromDiscord<sOkam!> 😄
07:58:53FromDiscord<Elegantbeef> Worth noting that moving value types still copies all values
07:59:21FromDiscord<Elegantbeef> Like `array[10, int]` is the same as copying
08:00:24FromDiscord<enthus1ast> That's great I had pretty much the same issues that you had with proper error lines, that's one reason nimja does not report errors↵(<@709044657232936960_=50=4dunch=5b=49=52=43=5d>)
09:03:54FromDiscord<sOkam!> Do you think this is creating the equivalent of a `ref object`, or is it actually creating a copy instead?↵https://github.com/heysokam/idtech3-modules/blob/a5cd0d55a32f27fc97799ac46095933d1453f013/src/col/c/load.c#L41-L50↵Struggling to understand if I should translate as two sequences containing ref types _(the data is already stored somewhere else in the container object)_ or if I should duplicate the data instead in some way🤔
09:05:57FromDiscord<Elegantbeef> It's copying afaict
09:06:15FromDiscord<Elegantbeef> I could be wrong it's horribly formatted and very unreadable
09:06:48FromDiscord<sOkam!> og wasn't too much better. but let me find it just in case
09:07:47FromDiscord<Elegantbeef> Aslong as you properly use `ref` where it uses `T` it should be fine if you copy their impl
09:07:54FromDiscord<sOkam!> https://github.com/heysokam/kua/blob/c9e9220edd98daedf1f558346a1d5e25bc7e0b27/src/engine/qcommon/cm_load.c#L155-L167
09:08:19FromDiscord<sOkam!> (edit) "https://github.com/heysokam/kua/blob/c9e9220edd98daedf1f558346a1d5e25bc7e0b27/src/engine/qcommon/cm_load.c#L155-L167" => "This is the unmodified code. I only changed the formatting↵https://github.com/heysokam/kua/blob/c9e9220edd98daedf1f558346a1d5e25bc7e0b27/src/engine/qcommon/cm_load.c#L155-L167"
09:08:30FromDiscord<sOkam!> (edit) "formatting↵https://github.com/heysokam/kua/blob/c9e9220edd98daedf1f558346a1d5e25bc7e0b27/src/engine/qcommon/cm_load.c#L155-L167" => "formatting for my other link↵https://github.com/heysokam/kua/blob/c9e9220edd98daedf1f558346a1d5e25bc7e0b27/src/engine/qcommon/cm_load.c#L155-L167"
09:08:39FromDiscord<sOkam!> (edit) "my" => "they"
09:08:43FromDiscord<sOkam!> (edit) "they" => "the"
09:09:10FromDiscord<sOkam!> In reply to @Elegantbeef "Aslong as you properly": so you mean storing a reference instead of a copy?
09:09:44FromDiscord<Elegantbeef> I mean if they use `T` you use `ref`
09:09:58FromDiscord<Elegantbeef> Or `seq` depending on whether it's an collection or pointer type
09:11:33FromDiscord<sOkam!> yeah but in this case they are using cLeaf instead of cLeaf inside the cModel type↵https://github.com/heysokam/kua/blob/c9e9220edd98daedf1f558346a1d5e25bc7e0b27/src/engine/qcommon/cm_local.h#L92-L95
09:12:19FromDiscord<Elegantbeef> So then you use a non reference version
09:12:54FromDiscord<sOkam!> how do you ask nim to create a copy of a reference type? I have the others stored as ref
09:12:58FromDiscord<Elegantbeef> C is extremely hard to understand, so I cannot really say much
09:13:05FromDiscord<Elegantbeef> There are a few ways
09:13:33FromDiscord<Elegantbeef> sent a code paste, see https://play.nim-lang.org/#ix=4jLi
09:13:41FromDiscord<sOkam!> In reply to @Elegantbeef "C is extremely hard": that's the essence of why im porting the code. I really don't want to deal with a whole engine full of this stuff anymore 😔
09:13:57FromDiscord<Elegantbeef> sent a code paste, see https://play.nim-lang.org/#ix=4jLj
09:14:57FromDiscord<Elegantbeef> sent a code paste, see https://paste.rs/rOJ
09:15:53FromDiscord<Elegantbeef> Then on assignment you can do `myVal = myRef[]`
09:16:07FromDiscord<Elegantbeef> Or `myRef[] = myVal`
09:16:17FromDiscord<Elegantbeef> since dereferencing a reference is an LValue
09:16:23FromDiscord<sOkam!> kk
09:16:42FromDiscord<sOkam!> I like the latter, I guess i just need to find a good name for the non-ref type
09:17:16FromDiscord<Elegantbeef> The Nim convention is to prefix it with T
09:17:32FromDiscord<Elegantbeef> Or if the value is more common prefix the ref with P
09:17:34FromDiscord<sOkam!> T standing for type, i guess?
09:17:51FromDiscord<Elegantbeef> Yea
09:18:03FromDiscord<Elegantbeef> I know status says "always suffix a type with `ref`"
09:18:03FromDiscord<sOkam!> problem is TypeMyType doesn't make sense in my brain
09:18:18FromDiscord<Elegantbeef> Could do VMyType
09:18:29FromDiscord<Elegantbeef> or MyTypeV
09:19:03FromDiscord<sOkam!> what does V stand for?
09:19:05FromDiscord<sOkam!> value?
09:19:10FromDiscord<Elegantbeef> Yes
09:19:39FromDiscord<sOkam!> i guess the opposite of a pointer is a value... i just never thought about that i think
09:20:10FromDiscord<Elegantbeef> Well they're Value Types and Reference Types
09:20:22FromDiscord<Elegantbeef> Value Types conventionally are stack allocated and as such are copy by value
09:20:36FromDiscord<sOkam!> makes sense, yeah
09:20:41FromDiscord<Elegantbeef> Reference Types are conventionally heap allocated and as such the stack allocated part is a pointer that is copied on value
09:22:36FromDiscord<Elegantbeef> "copied on value" ah yes brain
09:23:49FromDiscord<sOkam!> Maybe I don't need to do the explicit ref type, since its only stored in the container and the container is already a ref
09:24:33FromDiscord<sOkam!> that type specifically is currently not a ref, i thought it was but seems like this one might not need to be
09:45:01*ltriant joined #nim
09:54:49*ltriant quit (Ping timeout: 252 seconds)
10:30:18*ltriant joined #nim
10:35:03*ltriant quit (Ping timeout: 260 seconds)
11:08:31FromDiscord<stisa> I'm trying to update some code I wrote a year ago or so to work with latest nim, but I am getting "Error\: system module needs\: programResult", anyone knows if something changed there? I do see a `var programResult` with some note about it being deprecated in system.nim so it should not complain about it missing
11:20:13FromDiscord<ringabout> In reply to @stisa "I'm trying to update": Have you tried "--mm:refc"?
11:23:22FromDiscord<stisa> mmh nope, I'll give that a try. I'm running 1.9.1 btw
11:25:42FromDiscord<stisa> @ringabout\: tried with refc and also threads\:off, still erroring out
11:26:29FromDiscord<stisa> sent a code paste, see https://play.nim-lang.org/#ix=4jLI
11:29:27FromDiscord<ringabout> I have no idea, It is weird.
11:30:35*jmdaemon quit (Ping timeout: 246 seconds)
11:42:08*blami joined #nim
11:44:04*PMunch joined #nim
11:45:06*xet7 quit (Quit: Leaving)
12:04:59FromDiscord<Phil> So I have a script with a nice proc inside of it for users of my library.↵`imports.nims` with the proc `testSetup()`.↵I want users to install my library and be able to execute that testSetup as part of their config.nims or their nimble tasks or whatever.↵Apparently `import myLibrary/imports` doesn't do it though, is my goal achieveable?
12:06:08FromDiscord<Phil> The script is supposed to copy all code from `/src`, modify the exported procs inside nim files to add a pragma and store it in a separate folder, from which tests then import said modified code to run tests on it (instead of directly on the source-code)
12:06:26FromDiscord<kaddkaka> sent a code paste, see https://play.nim-lang.org/#ix=4jLS
12:06:33FromDiscord<Phil> (edit) "store" => "write" | "writeit ... infolder" added "to new files" | "folder," => "folder (same folder hierarchy as `/src`),"
12:07:13FromDiscord<Phil> In reply to @kaddkaka "Do others also get": Not on the current devel branch
12:07:26FromDiscord<Phil> Neither on 1.6.10
12:07:43FromDiscord<Phil> Neither on 1.6.0
12:07:51FromDiscord<Phil> Oh wait, nimsuggest
12:07:52FromDiscord<Phil> Never mind
12:08:04FromDiscord<Phil> I tend to only look at the compiler and its output
12:08:08FromDiscord<kaddkaka> I get lint warning on 1.6.6 from my vim plugin
12:09:22FromDiscord<kaddkaka> How can I run nimsuggest or the linter part of it standalone?
12:13:04FromDiscord<ringabout> `nimsuggest file`
12:14:57*koltrast quit (Quit: ZNC - http://znc.in)
12:15:05FromDiscord<sOkam!> In reply to @kaddkaka "Do others also get": nimsuggest freaks out a lot for generics
12:15:18*koltrast joined #nim
12:16:32FromDiscord<sOkam!> https://media.discordapp.net/attachments/371759389889003532/1057633146255966228/image.png
12:17:03FromDiscord<kaddkaka> sent a code paste, see https://play.nim-lang.org/#ix=4jLW
12:17:32FromDiscord<kaddkaka> (edit) "https://play.nim-lang.org/#ix=4jLW" => "https://paste.rs/RaW"
12:17:52FromDiscord<kaddkaka> In reply to @sOkam! "nimsuggest freaks out a": Unfortunately 😒
12:18:02FromDiscord<sOkam!> Code compiles and runs just fine
12:18:20FromDiscord<kaddkaka> Yes I know
12:18:38FromDiscord<sOkam!> I had a situation like this with a generic type before. Just ignore those warns I guess, since the compiler works
12:22:14PMunch@Phil, I had to do the exact same thing for Ratel
12:23:20PMunchBasically you need to make it a normal `.nim` file in your `src` directory, then you can import it into your Nimscript and use it there
12:24:36FromDiscord<Phil> In reply to @PMunch "Basically you need to": The issue I'm running into there is that I need to use stuff from the nimscript module to create directories and copy files at compile time
12:24:47FromDiscord<Phil> Can't do that with STD os
12:26:00FromDiscord<Phil> So I require access to mkdir etc in whatever file in my library that ends up containing the procs to execute all this copying etc
12:26:50FromDiscord<Phil> But I take it from that, that you can't import Nims files from a lib into Nims files from the current project?
12:28:43*ltriant joined #nim
12:31:14FromDiscord<Phil> I'm forced to do all the things at compile time because I'm parsing Nim code and that does not work otherwise
12:32:32PMunchYou should be able to just have those things in your .nim file
12:33:00PMunchI don't think Nim actually does anything different with .nim and .nims file while importing them
12:33:00FromDiscord<Phil> Can I access the nimscript module in a .Nim file?
12:33:15PMunchAs long as it is imported from a .nims file I believe so
12:33:37*ltriant quit (Ping timeout: 256 seconds)
12:33:40FromDiscord<Phil> It's the mkdir and cpFile procs that I really need for the most part
12:33:43PMunchI use `switch` in my Ratel imported script
12:33:58FromDiscord<Phil> Alrighty, I'll look at it later, omw to lunch
12:58:52FromDiscord<vindaar> well, you can at runtime, if you use the compiler API. So if you're really running into trouble that's going to be the way to do it. It's just quite the learning required to get to where you're currently, as it's a bit rough around the edges for a newcomer↵(@Phil)
13:01:33FromDiscord<vindaar> an alternative is to call out to your terminal to do work for you using `execCmd` or whatever it was called in nimscript (or just using `shell`, which also works in nimscript, but iirc not within `nimvm` contexts, ugh)
13:08:22FromDiscord<vindaar> right, just tested. using `shell` in a macro results in annoying "cannot importc variable at compile time" errors, sigh. I tried to fix that at some point, but couldn't figure it out
13:08:43FromDiscord<vindaar> there's even an issue about it already https://github.com/Vindaar/shell/issues/18 🤣
13:30:04PMunchHmm, I have completed my wind speed/direction interpolation, but to be sure I don't have any crazy values I'd like to generate a series of data and animate it or something. Any ideas for how to do this easily?
13:38:39FromDiscord<vindaar> did you see my gist about that the other day btw?
13:38:53PMunchAbout the wind direction stuff?
13:38:55PMunchNo I did not
13:38:58FromDiscord<vindaar> yeah
13:39:17FromDiscord<vindaar> https://gist.github.com/Vindaar/1e50a8515e87058033de30b2ceb92fa5#file-weather_wind_interpolation-nim
13:39:21FromDiscord<vindaar> I pinged you about it, but guess you were offline
13:41:09FromDiscord<vindaar> for animation you could either create multiple plots like I do there for example & the create a gif or use plotly and create an animated plot. Me I usually just plot data as a PDF and use evince to view the PDF. then overwriting the plot just means evince autoloads the new PDF
13:41:20FromDiscord<vindaar> for simple stuff that's enough (but of course not if you want a real animation of something)
13:41:54PMunchRight
13:42:06PMunchBut cool, that's essentially the same I ended up doing
13:42:54FromDiscord<vindaar> nice 👍️ I'm not really sure this is the best way to go about it, but it's certainly simple enough and should work well enough
13:43:23PMunchI'm using cubic spline and not 1D though
13:43:38FromDiscord<vindaar> that's fair enough of course
13:44:05PMunchYeah, but I'm not sure how the forecast is done
13:44:34PMunchFor example is wind speed the max of the next hour, the medium, or the wind speed at the top of the hour
13:44:49PMunchCurrently it's treated as the last option
13:45:11PMunchBut if it's e.g. max then cubic spline would be able to overshoot that value
13:45:46PMunchBut it's a forecast, so it shouldn't be relied upon anyways *shrugs*
13:49:10FromDiscord<kaddkaka> Hmm, every 2nd time I reload my buffer in vim, nimsuggest seem to crash o.O `nimsuggest instance for project /home/david/projects/advent2022_nim/day12 stopped with exitcode: 139`↵How would I troubleshoot this?
13:53:10FromDiscord<Bung> https://media.discordapp.net/attachments/371759389889003532/1057657465820418068/images.jpg
13:53:13FromDiscord<Bung> for wind speed you can use a fan icon and rotate it, for direction you can use mark like this
13:53:45FromDiscord<Bung> sorry I can only find the mark with chinese
13:54:44PMunchOh I wasn't thinking of actually using this for anything but verifying if the data was somewhat sound
13:55:05PMunchSo I was more imagining just a white canvas with a black line growing in size and rotating from the center
13:55:16*blami quit (Quit: Client closed)
13:55:27PMunchJust wanted to know if there was some trivial way of making something like that in Nim nowadays
13:56:55FromDiscord<vindaar> yeah, not sure. I guess there's literature about what's commonly done in meteorology↵(<@709044657232936960_=50=4dunch=5b=49=52=43=5d>)
13:56:57FromDiscord<Bung> ok then
13:57:22FromDiscord<vindaar> I hope you came away thinking "yes, it's amazing nowadays" 🤣↵(<@709044657232936960_=50=4dunch=5b=49=52=43=5d>)
13:58:43FromDiscord<Bung> I was thought you already to display your data on LCD or other display.
14:04:02FromDiscord<Phil> sent a code paste, see https://play.nim-lang.org/#ix=4jMi
14:04:34FromDiscord<Phil> In reply to @PMunch "You should be able": (PMunch , I forgot to post my response as a response to this message)
14:05:41PMunch@vindaar, I was talking about the drawing thing :P But yes, the scientific Nim community has really put some nice packages together! Could possibly be slightly better documented though, but I guess maybe there is documentation in the doc comments that I didn't read.
14:06:46PMunchHmm, maybe it has to be done via a macro..
14:06:51PMunchThat's what I did in Ratel
14:06:55PMunch@Phil ^
14:07:18FromDiscord<ringabout> `include` may work.
14:08:09PMunchI have a `board "boardname"` macro which expands to some includes and other stuff
14:08:27FromDiscord<Phil> sent a code paste, see https://play.nim-lang.org/#ix=4jMj
14:09:01FromDiscord<Phil> In reply to @PMunch "Hmm, maybe it has": Which of your files should I be looking at to initiate operation "Blatant theft"?
14:09:06FromDiscord<Phil> (edit) "In reply to @PMunch "Hmm, maybe it has": Which of your ... files" added "ratel"
14:09:26FromDiscord<ringabout> sent a code paste, see https://play.nim-lang.org/#ix=4jMk
14:09:32PMunchThis is the file a user would import: https://github.com/PMunch/ratel/blob/master/src/boardConf.nim
14:10:01PMunchAnd if you look here you can see how that is used: https://ratel.peterme.net/gettingstarted.html
14:10:14FromDiscord<vindaar> happy to hear it. Yeah, documentation is always a challenge of course, but possibly also discovery of it. not sure if you're aware of https://scinim.github.io/getting-started/ for example (which itself needs more content!)↵(<@709044657232936960_=50=4dunch=5b=49=52=43=5d>)
14:10:27FromDiscord<ringabout> In reply to @ringabout "rename?": In `test2.nims`, I included `test.nim`, which works.
14:10:50FromDiscord<Phil> In reply to @ringabout "In `test2.nims`, I included": The clue is that playground.nim uses mkdir, which is only available in the nimscript module
14:11:00PMunch@vindaar, I was not aware of that
14:11:45FromDiscord<ringabout> In reply to @Isofruit "The clue is that": https://media.discordapp.net/attachments/371759389889003532/1057662139717931059/image.png
14:11:58FromDiscord<ringabout> Yeah, making it a template works too.
14:12:13FromDiscord<ringabout> (edit) "Yeah, making it a template ... works" added "(imports)"
14:12:32*kenran joined #nim
14:12:49*kenran quit (Remote host closed the connection)
14:13:00FromDiscord<Phil> In reply to @ringabout "In `test2.nims`, I included": The overarching problem I'm trying to solve is I want to provide a script to users to copy all their source-code into another folder, but that source-code gets manipulated so that all exported procs have the `mockable` pragma attached.↵All tests then import that modified source-code and test it (with the ability to mock) instead of the actual source-code.
14:13:07FromDiscord<Phil> Hmmm I'll try template
14:13:27FromDiscord<Phil> (edit) "source-code." => "source-code.↵↵Said script should only execute upon the user demanding it."
14:14:05FromDiscord<Phil> In reply to @ringabout "": Works only as a template for me, macro throws the same issue, huh
14:14:45FromDiscord<ringabout> How did you run it?
14:14:51FromDiscord<Phil> But okay, so template does it... let's see if that makes what I actually want to do feasible
14:15:21FromDiscord<Phil> sent a code paste, see https://play.nim-lang.org/#ix=4jMn
14:15:54FromDiscord<ringabout> What about the command to run the program?
14:16:22FromDiscord<Phil> You mean the script that does the copying (including source-code modification) ?
14:16:48FromDiscord<ringabout> Did you use `nim e` to execute the nimscript?
14:17:25FromDiscord<Phil> ohhhh that might be it
14:17:28*LuxuryMode joined #nim
14:17:56FromDiscord<ringabout> sent a code paste, see https://play.nim-lang.org/#ix=4jMp
14:18:11FromDiscord<ringabout> (edit) "https://play.nim-lang.org/#ix=4jMp" => "https://play.nim-lang.org/#ix=4jMq"
14:18:15FromDiscord<Phil> sent a code paste, see https://paste.rs/SZy
14:18:52FromDiscord<Phil> both `nim c src/blubber.nims` and `nim e src/blubber.nims` works when using template, both break when using macro or proc
14:18:55FromDiscord<ringabout> (edit) "https://play.nim-lang.org/#ix=4jMq" => "https://play.nim-lang.org/#ix=4jMs"
14:19:13FromDiscord<vindaar> @Phil\: not sure if you are interested, but I just added support for `shell` in macros.
14:19:22FromDiscord<ringabout> sent a code paste, see https://play.nim-lang.org/#ix=4jMt
14:19:36FromDiscord<Phil> Why the quote do magic?
14:20:20FromDiscord<Phil> In reply to @vindaar "<@180601887916163073>\: not sure if": Nice!... What does it do though ^^' ?
14:20:34FromDiscord<vindaar> well, using `quote do` like that results in the directory being created at runtime though
14:21:52FromDiscord<vindaar> sent a code paste, see https://play.nim-lang.org/#ix=4jMw
14:21:53FromDiscord<ringabout> procs work for me too.
14:22:01FromDiscord<ringabout> procs work for me.
14:22:21FromDiscord<Phil> ... with `nim e` procs work for me as well
14:23:41FromDiscord<ringabout> If you are using `nim c`, the Nimscript file will be regarded as a Nim file.
14:33:17FromDiscord<encyclopaedia> sent a code paste, see https://play.nim-lang.org/#ix=4jMB
14:34:13NimEventerNew thread by sls1005: The meaning of `do`, see https://forum.nim-lang.org/t/9772
14:34:29FromDiscord<Phil> ~~Personally, testament is the stuff I pull out when I want to do some serious in-depth testing, not for small projects~~
14:35:27FromDiscord<encyclopaedia> 😄 doesnt every project starts small
14:35:40FromDiscord<Phil> But as for general megatest stuff I think your best chance here is ringabout, I actually know nobody else that deals with it
14:35:57FromDiscord<Phil> Actually, Vindaar, you contributed to the Compiler, did you not? So you are also familiar with testament I bet !
14:37:22FromDiscord<enthus1ast> does "familiar with testament" means that one uses it?
14:37:38FromDiscord<encyclopaedia> sorry, what is `ringabout` ?
14:37:41FromDiscord<Phil> In reply to @encyclopaedia "😄 doesnt every project": While that's true, it also is the kind of thing I feel like it's overkill for a decent chunk of folks.↵Every project I contributed to so far mostly uses std/unittest
14:38:12FromDiscord<enthus1ast> there is stuff that just is not possible with std/unittest
14:38:17FromDiscord<Phil> But that's in the webdev space so take it with a chunk of salt
14:38:28FromDiscord<enthus1ast> for example check for compiler errors
14:38:36FromDiscord<enthus1ast> macro error messages etc
14:38:46FromDiscord<Phil> Yeh, that's the kind of stuff I typically do not have to deal with
14:38:46FromDiscord<vindaar> only partially. I only ever run individual categories. Running all tests has never worked for me due to all sorts of dependencies (e.g. nodejs and stuff) so many tests always fail↵(@Phil)
14:39:21FromDiscord<enthus1ast> but you can totally use both unittest AND testament
14:39:29FromDiscord<Phil> sent a code paste, see https://paste.rs/Poe
14:39:30FromDiscord<encyclopaedia> In reply to @Isofruit "While that's true, it": got it. I will give a shot to unittest. The official manual states this, so I was just following that https://media.discordapp.net/attachments/371759389889003532/1057669123028570242/image.png
14:39:35FromDiscord<vindaar> testament is too clunky for me to use in normal projects anyways
14:40:09FromDiscord<ringabout> @encyclopaedia What's inside test_main?
14:41:02FromDiscord<encyclopaedia> sent a code paste, see https://play.nim-lang.org/#ix=4jMD
14:41:13FromDiscord<ringabout> Did you set the path in configs?
14:41:43FromDiscord<ringabout> Or you should use ralative imports like import ../../main
14:41:44FromDiscord<encyclopaedia> In reply to @ringabout "Did you set the": yes `switch("path", "$projectDir/../../src")`
14:42:08FromDiscord<encyclopaedia> like I said, running them individually passes the tests
14:42:22PMunchUgh, why is the asyncdispatch module so poorly documented?
14:44:23PMunchAll I want to do is run something every ten minutes..
14:46:16FromDiscord<Phil> sent a code paste, see https://play.nim-lang.org/#ix=4jME
14:46:36FromDiscord<Phil> Does the `config.nims` file get executed before the tests of a `nimble test` command get executed?
14:47:32PMunchBy the way, when you write long messages or paste code then the bridge turns it into a link and I no longer get pinged when you mention me
14:48:03PMunchBut yes, that sounds right
14:48:15FromDiscord<Phil> I shall... errr.... ping you in a secondary message after I write the long one in the future then!
14:48:26FromDiscord<Phil> Problem solving in action 😎
14:48:41PMunchAnd config.nims should be executed before the actual test is run, yes
14:49:13FromDiscord<Phil> Sweet!↵So in config.nims I write all the setup stuff I want to happen before all of the tests are run
14:50:03PMunchYup
14:50:25PMunchIs this still for the mocking thing?
14:50:50*rockcavera joined #nim
14:51:12FromDiscord<ringabout> In reply to @encyclopaedia "like I said, running": Did you put your repo at the GitHub? I can investigate it a bit if it is public.
14:55:20FromDiscord<Phil> In reply to @PMunch "Is this still for": Yeah, I plan to enable 2 ways of usage
14:55:29FromDiscord<Phil> Number one is: Basically just use the pragma directly in your source code
14:56:07FromDiscord<Phil> Number two is: I copy all your source code, add the pragma myself and you test the modified copy of your source-code instead of your actual source code.↵That way you won't have to ever touch your source code to make it testable that way
14:56:37FromDiscord<encyclopaedia> In reply to @ringabout "Did you put your": here you go ↵https://gitlab.com/encyclopaedia/dir-serve-nim/-/tree/main/
14:58:59*ltriant joined #nim
15:01:35FromDiscord<voidwalker> can I somehow "peek" at the first few bytes of a (async) socket.recv without actually consuming/removing those bytes from the buffer ?
15:04:18*ltriant quit (Ping timeout: 272 seconds)
15:16:37FromDiscord<voidwalker> first few bytes is the message length, which I need to know, to get the proper size of the rest of the message. If I read/recv those separately, I need to put it back in the message stream, for future prasing
15:16:42FromDiscord<voidwalker> (edit) "prasing" => "parsing"
15:19:36FromDiscord<ringabout> In reply to @encyclopaedia "here you go ": I don't know why the previous config doesn't work for imported modules but `switch("path", "../src")` works.
15:22:27*arkurious joined #nim
15:22:30FromDiscord<encyclopaedia> sent a code paste, see https://play.nim-lang.org/#ix=4jMV
15:23:27FromDiscord<ringabout> In reply to @encyclopaedia "that's interesting. That reverses": Works for me on Linux.
15:23:38FromDiscord<ringabout> (edit) "Linux." => "Windows."
15:23:54FromDiscord<enthus1ast> sent a code paste, see https://play.nim-lang.org/#ix=4jMX
15:25:15FromDiscord<encyclopaedia> In reply to @ringabout "Works for me on": ahh I see what you did there - there's no longer a `$projectDir` in config.nims. Yes, that seems to work for me as well. ↵Curious why the previous setup didnt work. Was it resolving `$projectDir` differently? But it was running from the same path both the times 😖
15:40:57FromDiscord<Phil> sent a code paste, see https://play.nim-lang.org/#ix=4jN5
15:41:46FromDiscord<Phil> Wait a sec.... can I not use the db_connector thingy with 1.6.10?
15:42:32FromDiscord<Phil> Hm
15:42:52FromDiscord<Phil> So I have to enable a when switch then for my db connection pool package to support both nim 1 and nim 2
15:44:03FromDiscord<ringabout> In reply to @Isofruit "Wait a sec.... can": Btw db has moved to nimble packages on the devel branch
15:44:21FromDiscord<Phil> In reply to @ringabout "Btw db has moved": That one I understand
15:44:36FromDiscord<Phil> I was more confused that I can't use the `db_connector` package that now contains all this stuff in 1.6.10
15:44:47FromDiscord<@thatrandomperson5-6310e3b26da03> Anyne have some good documentaion form https://nim-lang.org/docs/asyncdispatch.html ? The one provided really is not very helpful, like how would i even make and event?
15:45:06FromDiscord<ringabout> In reply to @Isofruit "I was more confused": Perhaps the version rerquirement, feel free to make a PR
15:45:10FromDiscord<Phil> Would make my life easier if I could because then I wouldn't need a `when nim version larger 1.6.10 then import db_connector, else import db_ directly"
15:45:14FromDiscord<Phil> (edit) "directly"" => "directly`"
15:45:17FromDiscord<ringabout> (edit) "rerquirement," => "requirement,"
15:46:12FromDiscord<ringabout> In reply to @ringabout "Perhaps the version requirement,": https://github.com/nim-lang/db_connector/blob/e8bf89c30ead2b7fc9569469d5b572121909d13d/db_connector.nimble#L12
15:46:32FromDiscord<ringabout> It should be changed into >= 1.6.0 I guess
15:48:35PMunchIs there an async interface for running a program and getting its output?
15:49:07PMunchI know I can probably spawn it and use addProcess or something, but I was wondering if there was a ready-made solution
15:54:02PMunchOooh, seems like cheatfate/asynctools has asyncproc!
15:56:33FromDiscord<kaddkaka> sent a code paste, see https://play.nim-lang.org/#ix=4jN9
15:57:40FromDiscord<Phil> sent a code paste, see https://play.nim-lang.org/#ix=4jNb
15:57:54FromDiscord<Phil> (edit) "https://play.nim-lang.org/#ix=4jNb" => "https://play.nim-lang.org/#ix=4jNc"
15:58:11FromDiscord<Phil> (edit) "https://play.nim-lang.org/#ix=4jNc" => "https://paste.rs/3ig"
16:10:40FromDiscord<Phil> Son of a strangled angry noises
16:11:07FromDiscord<Phil> `nimble test` will execute the code in your `config.nims` more akin to `nim c config.nims` than `nim e config.nims`
16:13:28FromDiscord<Phil> Wait no, the error message is different, it's just not finding the `testSetup.nim` file again
16:13:41FromDiscord<Phil> Importing nim files from a package shouldn't be this aggravating
16:13:51FromDiscord<Phil> (edit) "Importing nim files from a package ... shouldn't" added "into a `.nims` file"
16:14:39FromDiscord<Phil> sent a code paste, see https://play.nim-lang.org/#ix=4jNn
16:14:39FromDiscord<Phil> This works
16:14:56FromDiscord<Phil> (edit) "https://play.nim-lang.org/#ix=4jNn" => "https://play.nim-lang.org/#ix=4jNo"
16:15:09FromDiscord<Phil> Now when I run `nimble test` I get `Error: cannot open file: mockingbird/testSetup`
16:15:18FromDiscord<Phil> I don't understand
16:26:36NimEventerNew thread by Isofruit: Test/config.nims can't import nim file from package when executed as part of `nimble test`, see https://forum.nim-lang.org/t/9773
16:34:26FromDiscord<kaddkaka> sent a code paste, see https://paste.rs/HYS
16:37:24FromDiscord<kaddkaka> Hmm, maybe it's not doing that ... I'm so lost T.T
16:51:54FromDiscord<Bung> try change proc to template ?
17:06:39FromDiscord<kaddkaka> @Bung I'll give it a shot
17:22:11FromDiscord<@thatrandomperson5-6310e3b26da03> What does this mean? `segmentation fault (core dumped)`
17:22:48FromDiscord<jtv> Generally it's probably going to be a null pointer dereference at runtime
17:22:59FromDiscord<jtv> i.e., you tried to use a nil value
17:26:27FromDiscord<jtv> At the OS level, a "segmentation fault" is when you attempt to access memory from your process that you don't have access to. That's generally not going to happen much in Nim, since you don't have unrestricted pointers. But there's no checking around nil because it would be a bunch of overhead, so when you've got an object that's nil you try to access, under the hood you end up trying to access memory address 0, which is what the OS is sayin
17:46:07FromDiscord<kaddkaka> In reply to @Bung "try change proc to": The proc/template didn't make a difference. Actually having a condition before adding nodes to my heapqueue made a difference! >.< 😄
17:49:16FromDiscord<Bung> That’s good to hear
18:04:38FromDiscord<Phil> sent a code paste, see https://play.nim-lang.org/#ix=4jOd
18:36:29FromDiscord<Phil> sent a code paste, see https://paste.rs/xh1
19:00:33*ltriant joined #nim
19:02:44PMunchIs there a way to get the Nim version in a machine-readable way?
19:03:03PMunchI know there's `dump` and `--dump.format:json`, but that still requires me to pass a Nim file..
19:05:36*ltriant quit (Ping timeout: 272 seconds)
19:45:24FromDiscord<Solitude> In reply to @PMunch "Is there a way": ▲ ~ echo 'echo NimVersion' | nim e - 2>/dev/null↵1.9.1
19:46:06FromDiscord<guttural666> anybody know why a lot of these bad boys were not written for in place mutation with pls(s: var string)? should be more efficient no? https://media.discordapp.net/attachments/371759389889003532/1057746285089796226/image.png
19:47:26FromDiscord<guttural666> I think most of the string manipulation procedures were written to give an output and leave the source alone, certainly more flexible but idunno
19:47:29FromDiscord<voidwalker> https://nim-lang.org/docs/sequtils.html#concat%2Cvarargs%5Bseq%5BT%5D%5D - anything like this that works on a seq[seq[T]] ?
19:47:31FromDiscord<Phil> In reply to @Solitude "▲ ~ echo": Solitude !
19:47:42FromDiscord<Phil> Good to see you again!
19:48:38FromDiscord<Phil> In reply to @guttural666 "I think most of": It's following the functional style a bit more:↵Take stuff in, spit stuff out
19:48:57FromDiscord<voidwalker> need to unpack seq[seq[T]] in a single sequence with all elements
19:49:01FromDiscord<guttural666> In reply to @Isofruit "It's following the functional": yeah
19:49:24FromDiscord<Phil> In reply to @voidwalker "need to unpack seq[seq[T]]": Basically you just want to flatten the seq?
19:49:30FromDiscord<voidwalker> yes
19:50:09FromDiscord<Phil> Dangit I know I've seen something for this somewhere
19:50:14PMunch@Solitude, no way to get the hash though it seems..
19:50:52FromDiscord<voidwalker> It seems like an obvious thing to have in sequtils.. it just has that concat thingie, which works on varargs
19:51:14FromDiscord<voidwalker> maybe I am missing something and I can expand seq[seq[T]] in varargs of seq[T] ?
19:51:55FromDiscord<guttural666> In reply to @PMunch "<@104136074569211904>, no way to": like your videos man, you should do more
19:52:15FromDiscord<Phil> In reply to @voidwalker "maybe I am missing": Actually, it does work
19:52:27PMunchThank you @guttural666 :) What kind do you like the best?
19:52:31FromDiscord<Phil> sent a code paste, see https://paste.rs/Waq
19:52:53FromDiscord<Phil> I swore I saw something that called it what it is though: A flatten operator
19:52:55FromDiscord<voidwalker> oh then I am missing something in my code.. sigh
19:53:15FromDiscord<Phil> In reply to @voidwalker "oh then I am": Look at it on the bright side
19:53:21FromDiscord<Phil> You don't have weird macro bugs on generics
19:53:36FromDiscord<guttural666> In reply to @PMunch "Thank you <@375727321958580228> :)": these ones, really high quality, I really want to see CppCon level stuff on youtube https://media.discordapp.net/attachments/371759389889003532/1057748170140033104/image.png
19:53:37FromDiscord<Phil> Your life could be so much worse!
19:53:40FromDiscord<@thatrandomperson5-6310e3b26da03> Do all threads from threading close with the main thread?
19:53:59FromDiscord<guttural666> (edit) "youtube" => "youtube; think Nim needs this kinda stuff"
20:03:51PMunch@guttural666, oh right, yeah those are recorded for various conferences
20:04:21FromDiscord<guttural666> In reply to @PMunch "<@375727321958580228>, oh right, yeah": yeah, the professional ones are the best, really enjoy those and the more high level / general ones
20:05:21FromDiscord<guttural666> In reply to @PMunch "<@375727321958580228>, oh right, yeah": that's why I like CppCons stuff so much and dislike what the Zig people do all of the time, something super detailed and specific which nobody can relate to
20:06:04PMunchAnything in particular you'd like to hear such a talk on? I kinda ran out of easy topics
20:06:53FromDiscord<guttural666> anything in the back to basics track of cppcon and in the same quality, that would really help Nim imo
20:07:07FromDiscord<guttural666> in the vein of that track
20:07:09FromDiscord<Phil> In reply to @PMunch "Anything in particular you'd": Testing Strategies in nim to spread that knowledge far and wide, as apparently its somewhat of a dark "Everybody do their own" kinda thing
20:07:42PMunchWell that's the problem, I can't really talk about stuff that don't have consensus :P
20:07:55PMunchWell I guess I could do a "state of things" talk
20:08:03FromDiscord<Phil> You can give an overview over the different views and things that exist
20:08:07PMunch@guttural666, do you have a link to that track?
20:08:13FromDiscord<Phil> Or at least the more prominent ones
20:08:31PMunchThe prevalent one seems to be "tests? what tests?"
20:08:38FromDiscord<Phil> When is the next talk thingy again?
20:08:44FromDiscord<guttural666> In reply to @PMunch "Well that's the problem,": https://www.youtube.com/watch?v=Bt3zcJZIalk&list=PLHTh1InhhwT4TJaHBVWzvBOYhp27UO7mI
20:08:48PMunchTalk thingy? You mean NimConf?
20:08:56FromDiscord<Phil> Yeah
20:09:07PMunchThere is FOSDEM in early February, but I don't think there's any Nim talks this year :(
20:09:42PMunchAnd there was just a NimConf in the end of October, so you'd have to wait about another year for that :P
20:09:43FromDiscord<Phil> I would be surprised, this year lasts only for 3 more days
20:10:03PMunchHaha, I meant the next iteration of FOSDEM
20:10:44FromDiscord<Phil> Check! Okay that gives me time to hopefully to push out a first release for mockingbird and hijack your talk for propaganda of my package!
20:10:51FromDiscord<guttural666> your keyboard videos were super cool though
20:11:04FromDiscord<guttural666> although very specific, but really entertaining
20:12:07FromDiscord<voidwalker> Blah I figured out why the concat() doesn't work for my case. I got not a seq[seq[T]], but a seq[bObject], and one of the fields of bObject is the seq
20:13:34FromDiscord<Phil> what is bObject?
20:13:41FromDiscord<Phil> A variant?
20:13:51FromDiscord<voidwalker> bencodedObject. has .l field which is a seq
20:14:11FromDiscord<Phil> Ahhhh in that case you'll need to do a map call first then
20:14:14FromDiscord<voidwalker> variant, but in this specific case it's just kind: list, and.l : seq
20:14:43FromDiscord<Phil> `yourseq.map(proc-that-unpacks-seq-from-bObject).concat`
20:16:20FromDiscord<voidwalker> not sure that will work...
20:16:22PMunch@guttural666, glad you liked those. That reminds me, I completely forgot to edit down the last ones..
20:16:25FromDiscord<Phil> Okay, time to throw myself at beefs macro to understand it and see whether I can make it work for generics
20:17:07FromDiscord<guttural666> In reply to @PMunch "<@375727321958580228>, glad you liked": Nim needs some serious video content, let's goooo
20:17:47FromDiscord<jtv> Beef''s macro for what?
20:21:46FromDiscord<Phil> sent a code paste, see https://play.nim-lang.org/#ix=4jOG
20:22:46FromDiscord<voidwalker> sent a code paste, see https://paste.rs/GJn
20:23:18FromDiscord<Phil> Don't let more experienced users of sequtils catch you, the above does a lot of copying and that will be frowned upon!
20:23:20FromDiscord<voidwalker> not sure if I can ever be a good programmer if stuff like this overflows my stack 😄
20:23:47FromDiscord<Phil> Not by me, but I've seen people use the evil I word. "Inefficient"
20:23:57FromDiscord<voidwalker> @Phil I am writing a very naive and minimal line of code torrent library. Iteration 2, if ever, will be low level optimized.. for now I don't care, I have no idea what i am doing anyway : P
20:24:20FromDiscord<Phil> I agree with this approach, first optimize for readability, then optimize for performance as needed
20:24:32FromDiscord<voidwalker> I just care about getting to a good overall design, not implementation of specific pieces
20:24:57FromDiscord<voidwalker> trust me, I have thought about low level optimizations, and I have to ditch most used libraries for that, lol
20:24:57FromDiscord<Phil> In reply to @jtv "Beef''s macro for what?": Just posted it above. In effect (as far as I understand) it turns a proc definition into a proc being assigned to a mutable variable
20:26:04FromDiscord<guttural666> In reply to @voidwalker "<@180601887916163073> I am writing": "for now I don't care, I have no idea what i am doing anyway" that's the spirit! hahaha that's how you learn a shit load
20:27:13FromDiscord<Phil> Continuing my bit aobut the macro:↵And I'm not sure how to fix that one. I guess instead of turning it into a mutable variable it could be turned into a template that generates a mutable variable (if none already exists) and assigns it an iteration of the generic proc ?
20:27:36FromDiscord<Phil> That's just a conceptual idea, I know neither if it's feasible, nor if it's insane and how to syntactically do it I don't know either =/
20:28:29FromDiscord<voidwalker> In reply to @guttural666 ""for now I don't": I am waiting to reach v0.1 so i can publish code, and beg everyone for help. Can't really do that before I have at least a sketch of the thing : P
20:28:45FromDiscord<voidwalker> It's taking forever though
20:29:43FromDiscord<guttural666> In reply to @voidwalker "I am waiting to": then you're far ahead of my, I'm writing a CD database app for the command line rn with a metal-archives API
20:30:11FromDiscord<guttural666> not more than 1000 LOC rn in Nim xD
20:30:15FromDiscord<voidwalker> username checks out : P
20:31:19FromDiscord<guttural666> my YAML database reading and writing from disk and searching local and metal archives databases works, so I am proud haha
20:31:35FromDiscord<voidwalker> 1000 loc for that sounds like a lot lol
20:31:44FromDiscord<voidwalker> I plan to have a whole torrent client in 1000 Loc or less
20:31:46PMunchNew version of NimLSP if anyone wants to check it out. Just a tiny one, but should have some improvements :)
20:32:11*PMunch quit (Quit: leaving)
20:32:16FromDiscord<guttural666> it's 400 or so rn, I have querying local + MA db rn, saving to disk, writing to disk etc.
20:32:36FromDiscord<guttural666> lots of pretty stuff for the console, which is half of my code, formatting for console etc.
20:33:16FromDiscord<guttural666> In reply to @PMunch "New version of NimLSP": yeah and thanks for that one, totally forgot, Nim in Vim is such a great exp
20:34:00FromDiscord<guttural666> (edit) "writing to" => "loading from"
20:35:38FromDiscord<jtv> @voidwalker you need something like this?
20:35:50FromDiscord<jtv> sent a code paste, see https://paste.rs/ZSd
20:36:02FromDiscord<jtv> (edit)
20:37:51NimEventerNew thread by DougT: Question about taskpools, see https://forum.nim-lang.org/t/9774
20:39:13FromDiscord<EyeCon> sent a code paste, see https://paste.rs/k8x
20:39:29FromDiscord<voidwalker> sent a code paste, see https://play.nim-lang.org/#ix=4jON
20:39:39*pro joined #nim
20:41:16FromDiscord<jtv> Then you need a second type parameter and have to worry about how nested you are
20:44:00FromDiscord<voidwalker> well it was all 1 level nesting here, by design, so I got away with concat()
20:49:53NimEventerNew thread by DougT: Nim 2.0 RC1 taskpools error, see https://forum.nim-lang.org/t/9775
21:05:18*ltriant joined #nim
21:26:10FromDiscord<lenis> I wonder
21:26:19FromDiscord<lenis> what happens when you inline a recursive procedure
21:26:23FromDiscord<lenis> is that even possible?
21:37:12*LuxuryMode quit (Quit: Connection closed for inactivity)
21:41:09FromDiscord<<She>Horizon</Her>> Does Nim have a way for me to probe fields of types, and procs + their params and return type?
21:43:29FromDiscord<Phil> In reply to @Event Horizon "Does Nim have a": Define "probe", because you can iterate over the fields on a type at compile-time
21:44:17FromDiscord<Phil> As for procs, I think that may land you in macro-land
21:45:07FromDiscord<Phil> Well, "macro land" as in you'll likely need to deal with NimNodes and the like at compile-time
21:45:16FromDiscord<<She>Horizon</Her>> I'd be fine with compile time
21:45:19FromDiscord<Phil> (edit) "compile-time" => "compile-time, which can also be done in procs"
21:47:26FromDiscord<Phil> sent a code paste, see https://play.nim-lang.org/#ix=4jP2
21:47:46FromDiscord<Phil> sent a code paste, see https://play.nim-lang.org/#ix=4jP3
21:49:21FromDiscord<<She>Horizon</Her>> Thanks Phil!
21:51:56FromDiscord<Phil> sent a code paste, see https://paste.rs/Bev
21:52:11FromDiscord<luteva> is there any example for (nim-)lmdb or nimdbx using (ref) objects? i can't find one. a simple example would be enough....
21:52:27FromDiscord<Phil> I'm tagging out on that one, don't even know what lmdb is
21:52:47FromDiscord<luteva> memory mapped db
21:53:15FromDiscord<ezquerra> In reply to @PMunch "New version of NimLSP": @PMunch, can nimlsp be used with VSCode?
21:53:35FromDiscord<luteva> so a (really fast!) ACID persistence storage
21:53:59FromDiscord<Phil> ... I think I'd just use sqlite in memory
21:54:31FromDiscord<Bung> @ezquerra that's for sure
21:54:37FromDiscord<luteva> it is a key value store, not an sql db. so bit like redis etc. but just the base system.
21:55:08FromDiscord<Phil> I likely would still throw up sqlite just for ease of use ^^'
21:55:19FromDiscord<ezquerra> In reply to @Bung "<@974046326088163438> that's for sure": How? Does it work in tandem with any of the existing nim extensions? Or does they replace them?
21:55:24FromDiscord<Phil> That or just use a global hashmap or sth
21:55:35FromDiscord<luteva> and yeah i think there's even a batch for sqlite to use lmdb as the storage backend to get more performance into sqlite
21:55:38FromDiscord<Bung> install vscode-nim-lsp, nimble install nimlsp, that's all
21:56:39FromDiscord<Bung> vscode-nim-lsp is a simple vscode lsp client that start nimlsp
21:56:40FromDiscord<luteva> In reply to @Isofruit "That or just use": hashmap is not a storage (and especially not an acid storage)
21:58:00FromDiscord<luteva> (edit) "In reply to @Isofruit "That or just use": hashmap is not a ... storage" added "persistant"
21:58:30FromDiscord<luteva> (edit) "In reply to @Isofruit "That or just use": hashmap is not a persistant storage (and especially not an acid storage) ... " added "sqlite in memory isn't either."
22:04:12*ltriant quit (Ping timeout: 272 seconds)
22:08:51*pro quit (Quit: pro)
22:21:59FromDiscord<jvsg> when do I need to call `NimMain` and when not? The documentation isn't really clear about this, except for it says NimMain is used to initalize internals.
22:23:38FromDiscord<Ricky Spanish> sent a code paste, see https://play.nim-lang.org/#ix=4jPa
22:24:04FromDiscord<Ricky Spanish> (edit) "https://play.nim-lang.org/#ix=4jPa" => "https://play.nim-lang.org/#ix=4jPb"
22:26:05FromDiscord<Phil> I assume that's a package outside of the stdlib?
22:27:11FromDiscord<Ricky Spanish> from here no? https://github.com/nim-lang/zip/blob/master/zip/zipfiles.nim i just want to parse a zip file withouut extracting the contents
22:28:00FromDiscord<Phil> Ah checked, can't replicate in inim on linux so not sure what the issue is there.
22:28:26FromDiscord<Ricky Spanish> ah ok atleast if its just specific to my machine can build it in docker or something so its still helpful thanks
22:30:41FromDiscord<Phil> In reply to @jvsg "when do I need": Why do you assume you ever need to call NimMain? It's not necessary for typical usecases
22:32:52*PMunch joined #nim
22:34:17NimEventerNew post on r/nim by His_son: Sleep equivalent, see https://reddit.com/r/nim/comments/zxn8zh/sleep_equivalent/
22:47:35FromDiscord<jvsg> This[0] example makes it look like calling NimMain is almost mandatory.↵[0] https://nim-lang.org/docs/backends.html#backend-code-calling-nim-nim-invocation-example-from-c↵(@Phil)
22:48:31PMunchNimMain isn't mandatory when using ARC/ORC, but it's where global variables are initialised, so it's a good idea to call it anyways
22:48:34FromDiscord<jvsg> maybe it is a relic of the past and needs to be updated?
22:48:55FromDiscord<Elegantbeef> You're not wrong↵(@Phil)
22:48:56PMunchIf you don't have any global variables it is optimised away to nothing (at least in my testing on embedded devices)
22:49:54FromDiscord<jvsg> the thing is I want to pass a nim function to a certain framework written in C. So I cannot call NimMain in the framework.
22:50:08PMunchOh right, in normal Nim code you shouldn't ever have to call it. It's only if you're doing things like being loaded from a dynamic library or have a weird entry-point
22:51:01FromDiscord<Elegantbeef> It's not the smartest but you could call a function that calls nimmain in all your code wrapped with `once`
22:51:28PMunch@jvsg how does this C framework load your code?
22:51:55FromDiscord<Phil> In reply to @Elegantbeef "You're not wrong (<@180601887916163073>)": That's not what I wanna hear beef =/↵Shit... is there maybe hope with an approach that instead of a variable turns the generic proc into a template that creates these variables?
22:51:57PMunchDo you compile your Nim code together with the framework, or is it dynamically loaded?
22:51:59FromDiscord<jvsg> dynamic library↵(<@709044657232936960_=50=4dunch=5b=49=52=43=5d>)
22:52:23FromDiscord<Phil> Like, generate a template from a macro or sth
22:52:34FromDiscord<Phil> Which I'm aware sounds incredibly cursed
22:52:45PMunchRight, most dynamic library frameworks I've seen have init/deinit procedures that they will call in your library
22:52:59PMunch@Phil, oh sweet summer child
22:53:17*ltriant joined #nim
22:53:20FromDiscord<Elegantbeef> You might be able to use a macro to do what you want
22:53:30FromDiscord<Elegantbeef> But in reality mocking/replacing generics is just pretty much impossible
22:53:54FromDiscord<Phil> I don't wanna mock the generic, I wanna mock the implementation that it spawns!
22:54:00FromDiscord<Elegantbeef> That's a generic
22:54:08FromDiscord<Elegantbeef> How would you even replace the generic
22:54:16FromDiscord<Elegantbeef> `myGenericIntInt`?
22:54:45FromDiscord<Elegantbeef> So what you could do phil is replace the procedure with a macro that has the same signature, and everytime you call that you check a macro cache for the arguements you passed
22:54:59FromDiscord<Elegantbeef> But this is dumb since it doesnt work
22:55:16FromDiscord<Elegantbeef> An overload means it falls apart
22:57:15PMunchHmm, I should do some more work on superlog..
22:57:19PMunchSuch a promising idea
22:57:26FromDiscord<Phil> Now that just depresses me
22:57:40PMunchHad another weird idea today by the way, if anyone feels called
22:58:36FromDiscord<Phil> Trying to think my way around the problem, but I just can't quite grasp it.↵I strongly dislike the idea of this not being possible, but it looks way too much like it is 😐
22:58:42PMunchBasically a web server router which requires that you specify the query parameters and headers and such you require and adds them to the type definition of the Request object. This way you can write more type-safe web application
22:59:09PMunch@Phil, are you still stuck on mocking things?
22:59:27FromDiscord<Phil> In reply to @PMunch "<@180601887916163073>, are you still": Same general area, different problem
22:59:58FromDiscord<Phil> Turns out the entire idea of "replace proc with a mutable variable that has been assigned a proc" dies for generics because generics are stupid and I use them a ton and I actually like them but they are still stupid
23:00:06FromDiscord<Elegantbeef> I mean it's not overly impossible
23:00:14FromDiscord<Elegantbeef> It's just that it falls apart easily
23:00:51PMunchAh right..
23:01:19*ltriant quit (Ping timeout: 268 seconds)
23:01:26PMunchWhat if you require your mocks to be registered first?
23:01:39FromDiscord<Elegantbeef> bleh we can do better
23:02:26FromDiscord<Phil> In reply to @PMunch "What if you require": At what particular point in time?↵Within the source-code?↵Within the copy of the source-code for testing?
23:02:40PMunchJust a sec
23:02:47FromDiscord<Phil> Like, if your approach is to actually write a {.mockable.} pragma into your source-code generics, that's workable
23:03:04FromDiscord<Phil> Just provide the mockable pragma with types and then you just generate explicit procs for all the specified types
23:05:20FromDiscord<Phil> sent a code paste, see https://paste.rs/qiU
23:10:08PMunchNah, I want to do it the other way around
23:13:47FromDiscord<Elegantbeef> Here you go phil
23:13:50FromDiscord<Elegantbeef> https://play.nim-lang.org/#ix=4jPr
23:14:23FromDiscord<Elegantbeef> Basically for a generic procedure you need to generate what i hardcoded into the macro
23:18:14PMunchI was thinking something like this: http://ix.io/4jPs
23:18:58FromDiscord<Elegantbeef> Well phil wants to mock all their code
23:19:04*ltriant joined #nim
23:19:08PMunchAll of it?
23:19:14FromDiscord<Elegantbeef> all of it
23:19:18PMunchWhat would you do that for?
23:19:26FromDiscord<Elegantbeef> Fuck if i know
23:19:30FromDiscord<Elegantbeef> I dont even get wanting to mock any code
23:19:49*derpydoo joined #nim
23:19:54PMunchThat's like taking one car for a drive and then say you've tested a completely different car
23:20:10FromDiscord<Phil> It's wanting the ability to mock whatever piece of code I want
23:20:16PMunchWell I can see mocking something like calls to an external API or something
23:20:21FromDiscord<Phil> So that I can swap out parts as I desire for individual tests
23:20:26PMunchAh right
23:20:31PMunchThat makes more sense
23:20:37PMunchMy sample would achieve that
23:21:07PMunchObviously that sample is pretty dumb, it can only read modules in the same folder, and only read top level procs, but hopefully you get the idea
23:21:45PMunchI guess you'd actually want a Table from the signature to the mocked body, and then instead of not outputting the body simply replace it
23:27:01PMunchSomething along the lines of http://ix.io/4jPv
23:33:51FromDiscord<Phil> sent a long message, see http://ix.io/4jPx
23:36:02PMunchAh right..
23:36:08PMunchForgot about the other modules part..
23:36:58FromDiscord<Phil> Like, coming back to the example I wrote up yesterday (https://discord.com/channels/371759389889003530/371759389889003532/1057313408061538385):↵↵This manipulates the proc `OtherModule.otherProc` in `TestModule.nim`.↵Does this affect the code that's going to run when the proc under test in `ModuleUnderTest` will call `OtherModule.otherProc`?
23:37:29PMunchI guess for that you'd need to completely copy your project and replace them in files..
23:37:41PMunchBecause I don't think there is a way to override imports..
23:40:00PMunchWell, I guess you could go through their imports and find the project-local ones and rewrite those on the fly..
23:42:41FromDiscord<Phil> sent a long message, see http://ix.io/4jPy
23:44:15FromDiscord<Phil> Because you have access to an imported proc's body, right? So you should be able to rewrite that, store the rewritten `proc-under-test` in a variable and then call that stored variable in your tests
23:44:30FromDiscord<Emily Brown> https://t.me/+UcYGEjBQwa7gIPN1↵(@Phil)
23:44:47FromDiscord<Phil> In reply to @Emily Brown "https://t.me/+UcYGEjBQwa7gIPN1 (<@18060188791616307": <@&371760044473319454> scumbags
23:44:48FromDiscord<Emily Brown> https://t.me/+UcYGEjBQwa7gIPN1↵(<@709044657232936960_=50=4dunch=5b=49=52=43=5d>)
23:44:52FromDiscord<Phil> (edit) "In reply to @Emily Brown "https://t.me/+UcYGEjBQwa7gIPN1 (<@18060188791616307": <@&371760044473319454> ... scumbags" added "we got"
23:46:19PMunch@Phil, in general it's bad practice to try and parse Nim code in macros, it just never ends well
23:46:39PMunchAnd you'd need to handle overloading, indirection etc. etc.
23:56:55FromDiscord<Phil> I'll look deeper at all possibilities again tomorrow, bedtime has arrived