<< 31-05-2023 >>

00:01:37FromDiscord<Ayy Lmao> I guess I'm just confused what something like `emscripten_run_script` actually does.
00:02:54FromDiscord<Elegantbeef> Invoke js inside the web browserrs JS runtime?
00:03:03FromDiscord<Ayy Lmao> Are you saying it would be up to the runtime to provide that functionality?
00:03:51FromDiscord<Ayy Lmao> I guess I'm asking what parts of the api are runtimes specifically expected to provide?
00:03:52FromDiscord<Elegantbeef> Of course it's not apart of wasm
00:04:12FromDiscord<Elegantbeef> Anything that's not standard wasm that you want to use natively
00:04:32FromDiscord<Ayy Lmao> In reply to @Elegantbeef "Anything that's not standard": How can I tell what's not standard wasm?
00:04:39FromDiscord<Ayy Lmao> I'm not sure where to go to find out
00:06:09FromDiscord<Ayy Lmao> I'm guessing `emscripten_run_script`, `EM_JS` and `EM_ASM` are all non standard things.
00:08:49FromDiscord<Ayy Lmao> Are things like for instance getting gamepad events browser only?
00:09:33*derpydoo joined #nim
00:18:20FromDiscord<Elegantbeef> Why would one even want to arbitrarily evaluate JS when using wasm natively
00:18:23FromDiscord<Elegantbeef> You can compile js to wasm, so just do that then load that as a wasm module
00:18:57FromDiscord<Elegantbeef> I'm 99% certain that aside from basic things like allocating there is nothing in wasm
00:19:03FromDiscord<Elegantbeef> It's just a VM afterall
00:25:12FromDiscord<Andreas> `1 (32 bytes) ROOT LEAK: <malloc in pushtest95stack_u1344 0x7fc70ec04100> [32]`↵howto find the one-and-only last 32-byte leak ? Is there any tooling or besides valgring - which i can't use on osx, but the `leaks`-tool is ok - or stright to the debugger ?
00:25:28FromDiscord<Andreas> (edit) "valgring" => "valgrind"
00:25:39FromDiscord<Andreas> (edit) "stright" => "straight"
00:25:43FromDiscord<Elegantbeef> did you compile with `--debugger:native --d:useMalloc`?
00:26:10FromDiscord<Andreas> In reply to @Elegantbeef "did you compile with": only `-d:useMalloc`, will try the debugger
00:28:27*jmdaemon quit (Ping timeout: 250 seconds)
00:28:31FromDiscord<Ayy Lmao> In reply to @Elegantbeef "Why would one even": I'm using that and a combination of some other emscripten functions to abstract an operating system window so code that runs in Windows runs in the browser as well. I was just curious how much of that is expected to run in different runtimes but it's seeming like that's something that would need to be implemented on a per runtime basis.
00:28:50FromDiscord<Elegantbeef> Well yea 😄
00:29:16FromDiscord<Ayy Lmao> I just wasn't sure if wasm provided some sort of general interface for events or something.
00:30:28FromDiscord<Elegantbeef> In my usages of wasm I have 0 procedures except those that I want to interact with the host machine
00:31:52FromDiscord<Andreas> In reply to @Elegantbeef "In my usages of": What about WASI - whatever that is - can one compile nim->WASI ?
00:31:58FromDiscord<Ayy Lmao> So basically wasm is a list of abstract computer instructions that the runtime decides what to do with?
00:35:11FromDiscord<Ayy Lmao> In reply to @Andreas "What about WASI -": You'd probably be interested in this https://github.com/beef331/wasm3
00:36:15FromDiscord<Andreas> In reply to @Ayy Lmao "You'd probably be interested": that look freakin awsome 8=))
00:43:25FromDiscord<Elegantbeef> WASI is just the libc of wasm
00:43:36FromDiscord<Elegantbeef> It's a standardisation of procedures one can implement and support
00:44:27FromDiscord<arkanoid> is it possible to get an error when using ARC but importing a lib that would require ORC?
00:44:57FromDiscord<Elegantbeef> With a WASI enabled runtime you can use things like stdout or sockets just fine
00:45:04FromDiscord<Elegantbeef> `when not defined(orc)` i think
00:45:09FromDiscord<Elegantbeef> Or use the `compilersettings` module
00:46:00FromDiscord<arkanoid> no, I need the other way around. I want to stay on ARC, but I'm importing external modules that I don't know if they require ORC or not
00:46:09FromDiscord<Andreas> In reply to @Elegantbeef "It's a standardisation of": its the `exit ticket` from VS-Code to Zed or Lapce -> cos'VS-Code gives me 85-% shit i don't need, but no symbol-view - i mean it 2020. no symbol-outline WTF
00:46:31FromDiscord<Elegantbeef> Kate has symbol view 😛
00:47:00FromDiscord<Andreas> In reply to @Elegantbeef "Kate has symbol view": ohhh, thx , i'll take a look..
00:49:22*hernan_ is now known as hernan
00:54:00*LuxuryMode quit (Quit: Connection closed for inactivity)
00:56:07FromDiscord<Elegantbeef> Do you even own your PCc if you cannot open a program
00:56:49*disso_pch quit (Quit: Leaving)
00:57:15FromDiscord<Andreas> In reply to @Elegantbeef "Do you even own": no, but its ridiculus i mean VS-Code is proven MALWARE - phones home, prbly. uses my camera.. never had any complains fom macOS
00:57:45FromDiscord<Elegantbeef> FOSS has this issue that it cannot pay for that gold star
00:57:53FromDiscord<Elegantbeef> I mostly kid
00:59:02FromDiscord<Andreas> In reply to @Elegantbeef "I mostly kid": ok, some security-setting later my OS-Master allows me to try - but KAte crashes ...
01:02:14FromDiscord<!&luke> How can I get the current time in Unix millis
01:02:26FromDiscord<Andreas> `std/times`
01:02:52FromDiscord<Andreas> (edit) "`std/times`" => "`import std/times`"
01:02:55FromDiscord<!&luke> Yea that was a dumb question
01:03:01FromDiscord<!&luke> I realized after I sent it
01:03:14FromDiscord<Andreas> In reply to @ripluke "Yea that was a": but a quick answer
01:03:19FromDiscord<!&luke> Yea
02:34:48FromDiscord<emanresu3> what are the drawbacks of using `--mm=orc -d:useMalloc` instead of nim's defaults?
02:35:08FromDiscord<Elegantbeef> `-d:useMalloc` uses malloc instead of Nim's allocation strategy which behaves differently
02:35:26FromDiscord<Elegantbeef> Nim's allocator is pretty good afaik
02:35:37FromDiscord<emanresu3> is there an example showcasing this?
02:37:02FromDiscord<Elegantbeef> Huh?
02:39:11FromDiscord<emanresu3> like a snippet of code somewhere that show when one shouldn't use one or the other
02:39:12FromDiscord<Elegantbeef> You should use malloc for embedded or in places you cannot use Nim's default allocator
02:39:12FromDiscord<Elegantbeef> Such as debugging
02:42:03FromDiscord<emanresu3> oh, I found this\: https://github.com/nim-lang/Nim/issues/18612
02:55:35FromDiscord<Elegantbeef> What about it
02:57:22FromDiscord<emanresu3> it's some benchmarks using -d\:useMalloc
03:07:05*Batzy quit (Ping timeout: 240 seconds)
04:09:25*xet7 quit (Ping timeout: 240 seconds)
04:13:08*oldpcuser joined #nim
04:33:17FromDiscord<Graveflo> sent a code paste, see https://play.nim-lang.org/#ix=4x8R
04:36:46FromDiscord<Elegantbeef> `(var MyObject or ref MyObject)`
04:39:35FromDiscord<Graveflo> yep that works thanks
04:55:58*ntat joined #nim
05:08:56NimEventerNew thread by alexeypetrushin: Why fmt doesn't work?, see https://forum.nim-lang.org/t/10237
05:16:55NimEventerNew Nimble package! measures - General purpose measuring units datatypes with integrated conversions and definitions., see https://github.com/energy-nim/measures
05:17:28FromDiscord<mratsim> sent a code paste, see https://play.nim-lang.org/#ix=4x8V
05:20:48*oldpcuser quit (Remote host closed the connection)
05:52:14FromDiscord<Elegantbeef> I swear if they write an forum post then delete their post after I'm going to find them and break their keyboard
06:29:44*PMunch joined #nim
06:30:18*rockcavera quit (Remote host closed the connection)
07:41:05FromDiscord<Andreas> winter
07:58:05FromDiscord<pmunch> The RST parser is a bit silly, you need a line with text on it after the quote.↵(@mratsim)
07:58:44FromDiscord<pmunch> Are you talking about old posts being necro-bumped but without any new comments?
07:59:40FromDiscord<pmunch> That's because bots or spammers post to the topic and their posts are not accepted by a moderator
08:00:53PMunchWe've had a new influx of GPT-fueled spam, stuff that looks more like a real post than "xx6969xx buy my dick bluing pills for ultimate flight control :emojivomit:"
08:01:24PMunchBut they don't seem to quite understand the context of the discussion, and they tend to share links to completely random things
08:08:41PMunchFor example in this thread they helpfully shared a link to an animal care website (or at least one that looked like one, didn't actually click the link): https://forum.nim-lang.org/t/9287
08:09:26PMunchThe text at least seemed to be somewhat related to polymorphism
08:21:24*PMunch quit (Quit: leaving)
08:46:40FromDiscord<Elegantbeef> No pmunch i mean the posts that get created then deleted after either realising their failure or solving the issue
08:49:29FromDiscord<Elegantbeef> like 3/4 of alex's posts there get deleted shortly after posting
09:07:03FromDiscord<voidwalker> What would you use if you need to comply with a rate limiter on a certain website you're building a client for ? Some sort of queue with timers so that all methods that call to that website are put in and executed at the right time so as not to go over the rate limit (i don't know what the rate is yet
09:07:03FromDiscord<voidwalker> (edit) "yet" => "yet)"
09:07:03FromDiscord<voidwalker> this maybe ? https://github.com/jackhftang/taskqueue.nim
09:07:03FromDiscord<chmod222> Really depends on the specific way the rate limit is enforced, but I like the simplicity of token buckets
09:07:03FromDiscord<voidwalker> it's nr. actions per some time window, I don't know the values yet
09:18:58FromDiscord<chmod222> It's almost as annoying as the people who are very obviously and incometently creating malware and asking all the relevant steps to do so as separate threads
09:19:44FromDiscord<Elegantbeef> "How do i write a program that tracks key inputs"↵"How do i send data to a server"
09:20:17FromDiscord<chmod222> "How do I take a screenshot and send it over the network"↵"How do I execute commands and send the response back over a socket"
09:40:19FromDiscord<voidwalker> Haha I noticed those too, but didn't wanna say anything
09:41:34FromDiscord<voidwalker> well since nim is already the "malware" language, we should just make a library for trojans to use : P
09:44:34FromDiscord<chmod222> I'm just waiting for "How do I encrypt all files and display a full screen window"
09:49:22*beholders_eye joined #nim
10:18:09FromDiscord<arkanoid> let's say I want to write Nim software for hard-realtime (bare metal).↵I have two questions\:↵- which compiler options should I pick, in general↵- if I use ORC but a I don't make use of any reference "loop", does it behave 1\:1 like ARC? On the other hand, if I make use of reference loops but I use ARC, will I receive any kind of warning at compilation time?
10:38:12FromDiscord<cmc> sent a long message, see https://paste.rs/AfDv0
10:40:19FromDiscord<cmc> sent a long message, see http://ix.io/4x9K
10:41:48FromDiscord<cmc> Is anyone aware of a utility library for getting sub-sections of tables, similar to `sequtils.filter`?
10:42:56*PMunch joined #nim
10:44:20FromDiscord<arkanoid> interesting! thanks. But it does focus on my questions.↵But it helps me adding two more\:↵- can I disable heap completely to fail compilation if I try to put alloc in my code↵- is there an existing allocator to get the pre-allocated chunk of memory thing
10:47:46FromDiscord<arkanoid> you mean nim tables module, or generic table (like a tensor)
10:58:50FromDiscord<mratsim> In reply to @arkanoid "interesting! thanks. But it": There was "regions" but just use malloc and manual memory management
11:27:16FromDiscord<Andreas> In reply to @arkanoid "interesting! thanks. But it": there is `fusion/pool` which - in the version im working on - is now lock-free, since Nims alligator recently became lock-free, too. I'm working on lock-free versions of Stack/Set/Table which will all use the threadsafe Pool to operate..
11:27:51FromDiscord<Andreas> (edit) "In reply to @arkanoid "interesting! thanks. But it": there is `fusion/pool` which - in the version im working on - is now lock-free, since Nims alligator recently became lock-free, too. I'm working on lock-free versions of Stack/Set/Table which will all use the threadsafe Pool to operate.. ... " added "its all and everything heap-alloced"
11:28:20PMunchI hate when my alligators have locks
11:56:37FromDiscord<cmc> Preferably anything with a table-like interface
11:57:38FromDiscord<cmc> If you use gc\:none, you will receive a warning for all implicit heap allocations.I
11:59:37FromDiscord<arkanoid> what do you have to store into the table? have you considered arraymancer/datamancer?
12:01:22FromDiscord<cmc> [Edit](https://discord.com/channels/371759389889003530/371759389889003532/1113436122383650816): If you use gc\:none, you will receive a warning for all implicit heap allocations. I'm not sure how to convert it to errors but it could be enough.As for a finished memory allocator in Nim, I'm not aware of one- you could look for the SuperCollider audio synthesizer system codebase and search the codebase for the RTAlloc function to have an example
12:01:34FromDiscord<mratsim> In reply to @Andreas "there is `fusion/pool` which": I'm definitely calling my allocator package alligator
12:02:43FromDiscord<mratsim> In reply to @cmc "[Edit](https://discord.com/channels/371759389889003": @cmc#0000 there is an option for warnings as errors
12:03:29FromDiscord<arkanoid> great name, actually↵(@mratsim)
12:09:37FromDiscord<voidwalker> mratsim or anyone else, any suggestions on what async task queuer lib to use ? I want to time http requests to a URL so they don't hit a rate limit
12:25:04FromDiscord<abisxir> Guys is there something like Semaphore in nim?
12:25:20*ntat_ joined #nim
12:25:37*ntat quit (Ping timeout: 240 seconds)
12:27:12FromDiscord<cmc> Thanks!!↵The operations on datamancer are pretty much what I'm looking for- some kind of more minimalistic version would also do fine. But I need it to accept arbitrary table-like objects that support arbitrary keys and values, or at least stack-based ones. The normal use-case would be an int key and an object value, or a string or float key and an int value. Basically bolting a little bit of data access onto key value storage.
12:28:59FromDiscord<arkanoid> datamancer/arraymancer are suited for data science, not sure if they fit your target
12:29:03*ntat_ quit (Client Quit)
12:29:23*ntat joined #nim
12:29:40*ntat quit (Client Quit)
12:29:56*ntat joined #nim
13:06:35*derpydoo quit (Read error: Connection reset by peer)
13:12:18FromDiscord<Andreas> i have a mutual dependency between module-A and module-B - A Pool needs a Stack, which in-turn needs a Pool ? Howto deal with that scenario ? there was a compiler-switch, that i cannot remebr ??
13:18:33FromDiscord<least antisemitic pole> i think this proc is too easy to be confused with strformat's `&` https://media.discordapp.net/attachments/371759389889003532/1113456484358029362/image.png
13:19:23FromDiscord<least antisemitic pole> even worse, the editor coloring assumes `&` to be strformat and colors the string to make it even more surprising
13:23:28FromDiscord<least antisemitic pole> I can't even find information about this "jstrutils" module in the manual
13:29:06FromDiscord<least antisemitic pole> should I expect karax to keep up with calling redraw() every animation frame?
13:29:20FromDiscord<least antisemitic pole> seems like I need to to achieve what I want
13:29:31*derpydoo joined #nim
13:30:36FromDiscord<cmc> Yeah in principle what I want is a sub-set of datamancer, but simpler and usable with any table or table-like.Filter table by callback, in-place, return-copy or iterator- basically sequtils for tables.The basics shouldn't be too hard to roll myself but I'd love something somewhat more widely used, if it exists.
13:32:45FromDiscord<mratsim> In reply to @voidwalker "mratsim or anyone else,": https://github.com/status-im/nim-chronos/blob/master/chronos/ratelimit.nim
13:33:19FromDiscord<mratsim> In reply to @abisxir "Guys is there something": Semaphore? Is that the synchronization object or something else?
13:34:25FromDiscord<mratsim> Async semaphores in 29 lines of code: https://github.com/mratsim/constantine/blob/d996ccd/helpers/pararun.nim#L21-L50
13:45:32*progranner joined #nim
13:46:56FromDiscord<voidwalker> @mratsim thanks but that only works with chronos, right ?
14:00:21*PMunch quit (Quit: Leaving)
14:26:59*rockcavera joined #nim
14:30:34FromDiscord<abisxir> In reply to @mratsim "Semaphore? Is that the": Like a lock with a capacity, lock is a semaphore with capacity one.
14:31:59FromDiscord<abisxir> In reply to @mratsim "Async semaphores in 29": Interesting 🤔
14:56:28*psydruid joined #nim
14:56:48FromDiscord<etra> In reply to @mratsim "Async semaphores in 29": noob question, what is the `_: type AsyncSemaphore` for?
15:00:18FromDiscord<Rika> require that you type `AsyncSemaphore.new` instead of just `new`
15:00:31FromDiscord<etra> aaah I see
15:06:56FromDiscord<sOkam!> @cmc I extracted the memory allocator of id-tech3, which is one of the best I've ever seen.↵Should be easy enough to either port or just wrap with nim https://github.com/heysokam/idtech3-modules/tree/master/src/mem
15:10:33*pharonix71 quit (Remote host closed the connection)
15:11:00*pharonix71 joined #nim
15:20:09FromDiscord<chmod222> Any way to specify / assert that a given "M\: proc" has some specific calling convention?
15:20:22FromDiscord<chmod222> Parameters/return can be anything, but it must be {.nimcall.}
15:23:19FromDiscord<chmod222> Actually, that doesn't seem to be my problem, so nevermind on that front
15:34:22*progranner quit (Quit: My Mac has gone to sleep. ZZZzzz…)
15:34:52*progranner joined #nim
15:35:47FromDiscord<chmod222> Okay, new question\: Is there a way to tell nim explicitely to infer a generic argument? I have a `proc registerMethod[T, M](callable: M)` and for some reason I cannot manage to get my macro to generate the correct `registerMethod[MyType, PType](procToRegister)` because no matter what I do, `PType` and whatever `procToRegister` gets inferred to always contradict, but if I move the `T` into a `typedesc[T]` and call it via `registerMethod(
15:35:59*progranner quit (Client Quit)
15:36:24FromDiscord<chmod222> I'd like to call `registerMethod[T, _](procToRegister)` instead because all other procs already use the `[T]` and I hate inconsistency
15:37:13FromDiscord<chmod222> And `registerMethod[T, typeOf procToRegister](procToRegister)` also doesn't work
15:38:43FromDiscord<mratsim> In reply to @voidwalker "<@570268431522201601> thanks but that": no, that file imports asyncdispatch not chronos
15:39:07FromDiscord<mratsim> In reply to @voidwalker "<@570268431522201601> thanks but that": ah you mean the rate limiter, you can adapt it, there is nothing tied to chronos
15:39:07FromDiscord<voidwalker> huh ? `import ../chronos`
15:39:19FromDiscord<mratsim> In reply to @voidwalker "huh ? `import ../chronos`": I was on the asyncSemaphore stuff
15:39:33FromDiscord<arkanoid> what?!↵(@sOkam!)
15:39:40FromDiscord<arkanoid> impressive
15:39:54FromDiscord<voidwalker> yeah okay, I wanted something ready to use. I'm thinking this is quite a common use case, when one wants to build http/api clients that obey rate limits
15:40:51FromDiscord<voidwalker> I'm thinking if I should maybe start to just use chronos instead of asyncdispatch..
15:41:04FromDiscord<voidwalker> This situation when I need something that depends on chronos comes up far too often lately
15:41:20FromDiscord<mratsim> In reply to @sOkam! "@cmc <@210739784761475072> I extracted": they didn't document the high level algo/features
15:41:28FromDiscord<voidwalker> but then I won't be able to use asyncdispatch stuff :\
15:41:52FromDiscord<voidwalker> this split is not good for nim
15:42:56FromDiscord<mratsim> In reply to @voidwalker "but then I won't": maybe `-d:asyncBackend=chronos` can allow you to use chronos with async lib?
15:43:14FromDiscord<voidwalker> oh I forgot about that thing
15:43:51FromDiscord<arkanoid> what's the difference between importing asyncdispatch/chronos, or using compiler switch?
15:44:40FromDiscord<mratsim> In reply to @voidwalker "this split is not": the issue is that the stdlib should have a way to use your own implementation. Ideally it only standardize interfaces for stuff that are too complex to maintain internally
15:45:21FromDiscord<mratsim> async is a core need of Status, too many stuff to fix and add. The compiler and stdlib are in a totally different timeframe for this.
15:46:15FromDiscord<mratsim> In reply to @arkanoid "what's the difference between": This is pretty old but that explains why we created Chronos back in 2019 after trying to workaround or fix asyncdispatch: https://github.com/status-im/nim-chronos/wiki/AsyncDispatch-comparison
15:50:07FromDiscord<arkanoid> I know chronos as I already use it for some toy project, my question was exclusively about import vs compiler switch
15:54:18FromDiscord<etra> what's the tldr of the difference between chronos and asyncdispatch?
15:55:49FromDiscord<deech> This is probably a tall order but is there any way to define lifetime hooks in a separate module? I can do this with `include` but I'd rather `import`.
16:02:29FromDiscord<demotomohiro> @chmod222 This might help: https://internet-of-tomohiro.netlify.app/nim/faq.en.html#procedures-how-to-get-a-pointer-to-a-generic-procedure-or-a-procedure-with-type-class-parametersqmark
16:03:23FromDiscord<chmod222> Thanks, I'll have a read. I solved it using `callable: auto` for now which also works
16:03:30FromDiscord<chmod222> But of course it leads straight into another problem
16:03:44FromDiscord<chmod222> "cannot cast to a non concrete type\: " \`proc (salad\: typedesc[SomeType], a\: int, b\: float, c\: String)'
16:04:25FromDiscord<chmod222> I have to convert a naked pointer that went through C land back into my function pointer
16:04:37FromDiscord<chmod222> It's not a closure so there's no env to consider, but it simply will not work
16:09:06FromDiscord<demotomohiro> procs with `auto` parameters or return type are generic procs.↵procs with typedesc parameters are also generic procs.↵And you cannot get a pointer to a generic proc.↵You need to instanciate generic proc to get a pointer.
16:11:17FromDiscord<sOkam!> In reply to @mratsim "they didn't document the": they docummented nothing :notlikethis:
16:11:33FromDiscord<sOkam!> its the curse of quake engines, really
16:12:00FromDiscord<chmod222> Thanks, now I know what I need to work around
16:12:01FromDiscord<chmod222> Alright, that is good to know. I knew `auto` implies generic, but I thought `typedesc` would be handled differently, but that makes sense
16:12:13FromDiscord<chmod222> And I was wondering why it was always this particular function that's causing issues and not my other, "non static" one
16:14:56FromDiscord<mratsim> In reply to @deech "This is probably a": i think the compiler creates an error when =destroy is not in the same module as the type,
16:15:14FromDiscord<chmod222> It does, yes
16:16:02FromDiscord<mratsim> In reply to @etra "what's the tldr of": one is "easy" because it's in the stdlib, the other is battle-tested, running on thousands if not 10s of thousands of machines 24/7 with billions at stake and huge reputational risk.
16:17:13FromDiscord<mratsim> And despite having hundreds/thousands futures and timers firing left and right, it manages to use 2x less memory than the Go and Rust softwares that offer the same service.
16:18:17FromDiscord<deech> sent a code paste, see https://play.nim-lang.org/#ix=4xbh
16:19:08FromDiscord<mratsim> can you move the from B import nil below the type declaration?
16:19:18FromDiscord<voidwalker> mratsim, know of any project that can use both asyncdispatch/chronos with compiler flag ? I'm having trouble figuring out how to use this. Do I import just asyncdispatch, or chronos? or both ?
16:19:37FromDiscord<mratsim> In reply to @voidwalker "mratsim, know of any": no idea sorry
16:20:28FromDiscord<sOkam!> are the `=destroy` etc hooks usable with gc:none? or are they an arc/orc exclusive thing?
16:20:58FromDiscord<mratsim> In reply to @sOkam! "are the `=destroy` etc": use gc:destructors if you want =destroy and nothing else.
16:21:11FromDiscord<mratsim> but gc:arc with no ref types is equivalent
16:21:19*progranner joined #nim
16:21:34FromDiscord<sOkam!> In reply to @mratsim "but gc:arc with no": you mean arc but not using refs?
16:21:40FromDiscord<mratsim> yes
16:21:48FromDiscord<sOkam!> oh
16:21:52FromDiscord<mratsim> no refs and no exceptions is like none
16:22:01FromDiscord<sOkam!> oh didnt know that
16:22:12FromDiscord<sOkam!> i guess thats what beef tried to tell me a while back
16:22:12FromDiscord<mratsim> none and destructors are basically superceded by arc
16:22:27FromDiscord<deech> In reply to @mratsim "can you move the": `module B` can't see the `A` type.
16:22:29FromDiscord<mratsim> Nim memory management is per type.
16:22:52FromDiscord<mratsim> In reply to @deech "`module B` can't see": well in that case you need them all in same datatypes.nim file
16:24:12FromDiscord<sOkam!> In reply to @mratsim "Nim memory management is": so i understand gc:destructors are for ref types only?
16:25:36FromDiscord<deech> In reply to @mratsim "well in that case": That's what I'm doing now. Nim also has package objects (https://nim-lang.org/docs/manual_experimental.html#package-level-objects) but they are experimental and I was hoping there was a simpler solution. Thanks for your help!
16:26:48FromDiscord<jmgomez> In reply to @deech "That's what I'm doing": didnt try it out, but include may also work
16:26:50FromDiscord<mratsim> In reply to @sOkam! "so i understand gc:destructors": no, destructors are for value objects, including seq and strings
16:26:54FromDiscord<etra> In reply to @mratsim "one is "easy" because": hmm, if a dependency uses `asyncdispatch`, would that means I'd have some sort of mixed runtimes?
16:27:17FromDiscord<mratsim> if you use destructors I'm not really sure what is done for your ref objects, maybe nothing
16:27:54FromDiscord<mratsim> basically the idea is that when you need absolute control over memory you used none, if you want some control you used destructors
16:28:13FromDiscord<mratsim> but arc gives you that AND ref types.
16:28:31FromDiscord<jmgomez> In reply to @mratsim "one is "easy" because": out of curiosity are you referring to nimbus?
16:29:01FromDiscord<mratsim> In reply to @etra "hmm, if a dependency": maybe not with `-d:asyncBackend=chronos`
16:29:06FromDiscord<mratsim> In reply to @jmgomez "out of curiosity are": yes
16:55:28*beholders_eye quit (Ping timeout: 248 seconds)
17:10:43FromDiscord<voidwalker> is this https://nim-lang.org/docs/db_common.html gone in nim devel ?
17:30:02*progranner quit (Quit: My Mac has gone to sleep. ZZZzzz…)
17:31:47*progranner joined #nim
18:01:28FromDiscord<sOkam!> sent a code paste, see https://play.nim-lang.org/#ix=4xbI
18:01:54FromDiscord<sOkam!> tried {} and [], but they seem to be rejected
18:01:57*progranner quit (Quit: My Mac has gone to sleep. ZZZzzz…)
18:02:54*progranner joined #nim
18:02:55*progranner quit (Client Quit)
18:03:46*beholders_eye joined #nim
18:03:48FromDiscord<demotomohiro> `Groups()`?
18:05:21FromDiscord<chmod222> Doesn't Nim zero initialize anything unless inhibited with {.noinit.}?
18:10:34FromDiscord<sOkam!> In reply to @demotomohiro "`Groups()`?": doesn't work. it says that object constructors require an object type
18:10:45*progranner joined #nim
18:13:31FromDiscord<demotomohiro> sent a code paste, see https://play.nim-lang.org/#ix=4xbN
18:15:46FromDiscord<sOkam!> oh haven't tried `default()` yet, let me check
18:15:58FromDiscord<demotomohiro> In reply to @chmod222 "Doesn't Nim zero initialize": Yes, Nim do so. I think @sOkam! wants simple expression like `[]` that has type `Groups`.
18:16:13FromDiscord<sOkam!> yeah exactly
18:18:19*progranner quit (Quit: My Mac has gone to sleep. ZZZzzz…)
18:19:31FromDiscord<sOkam!> default works, yep, tyty
18:20:42*progranner joined #nim
18:21:14FromDiscord<chmod222> Ahh, I see
18:39:18FromDiscord<deech> Is there a way to have a macro generate import and export statements?
18:41:05FromDiscord<chmod222> sent a code paste, see https://play.nim-lang.org/#ix=4xbS
18:43:13FromDiscord<deech> Huh, thanks! I was looking all around for some kind of `nnkImport` ast type. Does that splice itself into the module scope as though it was written manually?
18:43:27FromDiscord<chmod222> You can also go raw with nnkImportStmt, yes
18:43:34FromDiscord<demotomohiro> sent a code paste, see https://play.nim-lang.org/#ix=4xbT
18:43:44FromDiscord<chmod222> for a/b/c
18:43:46FromDiscord<chmod222> sent a code paste, see https://play.nim-lang.org/#ix=4xbU
18:44:01FromDiscord<chmod222> dumpAstGen is immensly useful, yes
18:44:24*progranner quit (Quit: My Mac has gone to sleep. ZZZzzz…)
18:44:24FromDiscord<deech> Dammit, I could have sworn I tried that and `dumpAstGen` errored out! Sorry for the noise, thanks for the help!
18:45:45*junaid_ joined #nim
18:45:47*beholders_eye quit (Ping timeout: 265 seconds)
18:46:10*progranner joined #nim
18:47:29*beholders_eye joined #nim
18:54:37FromDiscord<chmod222> I believe dumpAstGen is the one function in the world that can never error out
19:06:45FromDiscord<Graveflo> I'm reading some code that I'm sure at one time worked, but for me it doesn't. I seems that they are using `assert` and `==` for comparison of two refs. This only works for me when I de-reference. That is a bit annoying that `==` is so dumb. Is there an explanation for this?
19:07:16FromDiscord<Elegantbeef> refs are pointers, pointer comparison is an integer comparison
19:08:06FromDiscord<Graveflo> I'm reading code from your repo's README. https://github.com/beef331/constructor. Under the section "Modifying implDefaults"
19:10:43FromDiscord<Graveflo> it seems that `is` is reserved for type checks which is fine, but it would be nice to have a equivalence operator and an equality operator for just this sort of thing.
19:11:10FromDiscord<Elegantbeef> Eh, people hardly care about if a references values equal truthfully
19:11:34FromDiscord<chmod222> You could define `proc isnotnot`
19:11:36FromDiscord<Elegantbeef> if you want that you can easily write a `proc internallyEqual(a, b: ref object): bool = a == b or a[] == b[]`
19:12:38FromDiscord<Elegantbeef> For complex types with complex graphs it's a very complex calculation
19:12:46FromDiscord<Graveflo> yea thats always an option
19:13:57FromDiscord<sOkam!> gotta love the flexibility of nim ❤️
19:14:59FromDiscord<chmod222> There is some delicious macro abuse I'm doing right now that you'd be hard pressed to do that neatly in any other language
19:15:29FromDiscord<chmod222> Although, is it abuse when they are used as intended?
19:15:34FromDiscord<Elegantbeef> well I had seen you share astgenRepr, so.... yea
19:15:55FromDiscord<jmgomez> hey @deech, the constructor feature that you wanted was merged today. Here are the docs: https://github.com/nim-lang/Nim/pull/21970↵destructors may take a bit, but in the mean time `codegenDecl` should work just fine 🙂
19:17:29FromDiscord<chmod222> Talk about macros, any fancier way to call a function pointer with a tuple spliced into its arguments without me having to manually emit a nnkCall?
19:18:13FromDiscord<chmod222> As in, I have `proc(some: int; params: float)` and a tuple `(some: 0, params: 1.23)`
19:18:28FromDiscord<Elegantbeef> Nope
19:18:35FromDiscord<Elegantbeef> `nnkCall` is required to call anything
19:18:42FromDiscord<chmod222> Alright, my abomination stays then
19:18:44FromDiscord<chmod222> I'll make it prettier though
19:18:53*progranner quit (Quit: My Mac has gone to sleep. ZZZzzz…)
19:19:05FromDiscord<Elegantbeef> You can make a macro that expands it afterwords if you really wanted to
19:19:15FromDiscord<Elegantbeef> sent a code paste, see https://paste.rs/XsHcm
19:19:22*junaid_ quit (Remote host closed the connection)
19:19:31FromDiscord<Elegantbeef> But it's hardly different
19:19:34FromDiscord<chmod222> I think I really want to, there's some stuff I'd like to do to the params with fieldPairs that would grow too unwiedly inside the macro body
19:20:24FromDiscord<Elegantbeef> You might want a `proc unpackCall(p: proc, t: tuple)` and do type checking inside an internal macro or something similar
19:20:38FromDiscord<chmod222> Some languages have a neat `apply` function for that purpose, I was just wondering if Nim had one too but if I have to build it myself, that's not too bad either
19:28:07*derpydoo quit (Read error: Connection reset by peer)
19:46:19*progranner joined #nim
19:49:28*beholders_eye quit (Ping timeout: 240 seconds)
19:52:32*progranner quit (Ping timeout: 248 seconds)
19:53:50FromDiscord<Graveflo> I've heard people talk about how nimsuggest "randomly" starts hogging CPU. That juts happened to me, but it happened as soon as I introduced a recursive infinite loop to the code. It seems like nimsuggest is missing an infinite recursion check or two
19:55:26FromDiscord<Graveflo> running the code the compiler is smart enough to break it with an error though
19:55:55FromDiscord<chmod222> Maybe it's a punishment for writing buggy code
19:56:45FromDiscord<Graveflo> well I don't make sure that every keystroke is going to be valid or "non-buggy" code. You gotta move stuff around. Not like I'm coding in ink
19:58:10FromDiscord<chmod222> I had to write code in ink in my exams way back, that was painful
19:59:50FromDiscord<Graveflo> yea I had to design a processor with SR latch memory banks and an ALU and write a program in binary that displayed Fibonacci results on on a 7 segment display on paper for an exam once
20:01:31FromDiscord<chmod222> You really learn to appreciate the backspace key
20:02:25FromDiscord<Graveflo> I might aswell be a symbiotic life form to the thing
20:02:59FromDiscord<Elegantbeef> > It seems like nimsuggest is missing an infinite recursion check or two↵Eh Nimsuggest is the compiler but has some heuristic changes internally to make it faster, but also buggier
20:35:16FromDiscord<Graveflo> so beef do you want me to PR that booboo in `constructor`s README?
20:35:54FromDiscord<Elegantbeef> Consider rereading the readme before doing such 😛
20:37:11FromDiscord<Graveflo> i red it. Is it supposed to fail the assertion or something?
20:38:45FromDiscord<Elegantbeef> Huh?
20:39:24FromDiscord<Graveflo> sent a code paste, see https://play.nim-lang.org/#ix=4xcr
20:39:32FromDiscord<Graveflo> pulling your leg a little bit with the last one LOL
20:40:09FromDiscord<Elegantbeef> I'm confused what you're suggesting?
20:40:34FromDiscord<Elegantbeef> Oh nvm i see i'm missing a derefernece
20:40:43FromDiscord<Elegantbeef> just PR a dereference if you want to contribute
20:40:44FromDiscord<Graveflo> this assertion is not true `assert new(Thingy) == Thingy(a: 10, b: "Hmm", c: 10)` should it be this? `assert new(Thingy)[] == Thingy(a: 10, b: "Hmm", c: 10)[]`
20:40:59FromDiscord<Elegantbeef> You're right
20:42:27FromDiscord<Elegantbeef> I probably should use a CI to generate docs and use pages to host it, but I cannot be arsed
20:42:31FromDiscord<Elegantbeef> Seems like a waste of energy if you ask me 😄
20:43:07FromDiscord<Graveflo> yea I'm sure its fine for everyone except noobs like me. Even then only a paranoid maniac would both clarifying it just to be safe
20:43:25FromDiscord<Graveflo> (edit) "both" => "bother"
20:47:10*ntat quit (Quit: Leaving)
21:07:56FromDiscord<Marcus> is it possible to set an env variable before you do a import with putEnv? Or are all the imports resolved first?
21:12:16FromDiscord<Graveflo> you could make a file that reads a variable and then another file that imports that file and try writing the variable before to see what happens
21:15:47FromDiscord<mratsim> In reply to @Graveflo "well I don't make": You should consider moving to punch cards
21:16:35FromDiscord<Graveflo> I'm not old enough to have experienced those, but I always like a good story from an old head. They all have at least one
21:20:31FromDiscord<Graveflo> In reply to @Marcus "is it possible to": Looks like if you put the call to `putEnv` in a `static` block it works
21:20:56FromDiscord<Graveflo> sent a code paste, see https://play.nim-lang.org/#ix=4xcx
21:21:10FromDiscord<Marcus> graveflo\: Neat! Thank you!
21:23:17FromDiscord<Marcus> `std/tempfiles.nim:109:10 Error: cannot evaluate at compile time: nimTempPathState` welp, didn't play well with tempfiles, but still good to know for later 🙂
21:24:36FromDiscord<Graveflo> you could maybe use a global variable (or not if you can avoid it) and just delay the arbitration between the modules by using procs in a non-static context
21:25:07FromDiscord<Marcus> Yeah, I'm going to push the place I read the variable into a proc instead of toplevel 🙂
21:25:35FromDiscord<Graveflo> actually not that I think about it `static` might not work at all. Its just setting the value at compile time so the variable exists before the program even runs 😦
21:25:44FromDiscord<Marcus> yea
21:27:55FromDiscord<Graveflo> this makes me question when exactly module level code even runs
21:28:24FromDiscord<Elegantbeef> module level code runs on startup in order of first import
21:29:39FromDiscord<Marcus> Elegantbeef\: seems like the imports run before your module tho
21:29:46FromDiscord<Marcus> which makes sense
21:29:54FromDiscord<Elegantbeef> If you have imports before your module code of course
21:30:15FromDiscord<Marcus> well, I did try putting it above but it seemed to still run after
21:30:26FromDiscord<Elegantbeef> sent a code paste, see https://paste.rs/1r00q
21:30:51FromDiscord<Elegantbeef> I guess you're right that's odd
21:30:57FromDiscord<Marcus> image.png https://media.discordapp.net/attachments/371759389889003532/1113580401705877514/image.png
21:31:14FromDiscord<Graveflo> nah its not odd the dependencies have to run first
21:31:34FromDiscord<Elegantbeef> Uhh no they dont
21:31:56FromDiscord<Elegantbeef> All top level statements can be raised to `NimMain` in import order
21:32:42FromDiscord<Graveflo> well maybe "have to" is a string word. we think about the dependents invoking the dependencies to that is the opposite direction, but module level code may be thought of as creating what the dependents are utilizing
21:32:51FromDiscord<Graveflo> what if there is initialization code in the dependency?
21:33:07FromDiscord<Elegantbeef> It'd run after the code before it run
21:34:06FromDiscord<Graveflo> oh man that one confused me. Are we saying that your example "hm" being echoed before "hello" is weird or are we agreeing that is makes sense? I'm lost LOL
21:34:25FromDiscord<Elegantbeef> Order of declaration should be how NimMain is generated
21:35:16FromDiscord<Elegantbeef> sent a code paste, see https://play.nim-lang.org/#ix=4xcD
21:35:22FromDiscord<Graveflo> but its not tho
21:35:25FromDiscord<Elegantbeef> The only issue is really cyclical dependencies on top level code I imagine
21:35:33FromDiscord<Elegantbeef> Sure, I'd argue this is a bug
21:35:48FromDiscord<Elegantbeef> I do not see there is a reason for this, I don't know
21:35:56FromDiscord<Elegantbeef> You expect code to run in the order you write it in an imperative language
21:36:29FromDiscord<Chronos [She/Her]> https://wasmer.io/posts/announcing-wasix Beef
21:36:43FromDiscord<Graveflo> I agree that is true but only if the blocks of code are segmented such that code in top level modules is only run BEFORE the import then the imports top level code is run
21:36:50FromDiscord<Graveflo> any other way and youll get in trouble
21:37:01FromDiscord<Elegantbeef> What?
21:37:15FromDiscord<Elegantbeef> You cannot have top level code before import depend on a sub module
21:37:29FromDiscord<Chronos [She/Her]> sent a code paste, see https://play.nim-lang.org/#ix=4xcE
21:37:32FromDiscord<Elegantbeef> On import all top level code is added to nim main, then you go to the next statement
21:37:50FromDiscord<Graveflo> sent a code paste, see https://play.nim-lang.org/#ix=4xcF
21:38:07FromDiscord<Elegantbeef> It would run first
21:38:19FromDiscord<Elegantbeef> You have to import the module
21:38:49FromDiscord<Chronos [She/Her]> In reply to @Hourglass, When the Hour Strikes "https://wasmer.io/posts/announcing-wasix Beef": WASIX is interesting but I think it definitely wouldn't work in a scripting environment lol
21:38:56FromDiscord<Graveflo> right so if you want "hello" to come fist it's gotta be before the import, but if there is code after the import it has to run after the top level of the imported module thus a segmentation
21:39:00FromDiscord<Elegantbeef> sent a code paste, see https://paste.rs/2PrOs
21:39:20FromDiscord<Elegantbeef> There is no issue here
21:39:23FromDiscord<Graveflo> its not bad that's what I would want. im js
21:39:37FromDiscord<Elegantbeef> Code that depends on other code has to be declared after importing that code
21:39:48FromDiscord<Graveflo> yes 😛
21:39:55FromDiscord<Elegantbeef> What I'm suggesting makes total sense
21:40:10FromDiscord<Elegantbeef> If you put code before an import it should run before that imports code
21:40:24FromDiscord<Graveflo> yep thats why I was confused originally. I would prefer for it to work as you suggested.
21:40:40FromDiscord<Elegantbeef> So why did you argue otherwise? 😄
21:40:54FromDiscord<Elegantbeef> I had see wasix, it doesnt interest me much 😄
21:41:12FromDiscord<Graveflo> I was just pointing out the stipulation that would have to change in order for it to change from how it works now to how it must work to facilitate that behavior
21:41:42FromDiscord<Elegantbeef> Well I'd argue the present state is a bug and that a bugfix that breaks code is valid in Nim2.0 😄
21:41:55FromDiscord<Graveflo> got my vote
21:44:45FromDiscord<Elegantbeef> Well i've asked in #internals so we'll see what araq says
21:45:23FromDiscord<Graveflo> I'll sacrifice a goat
21:45:56FromDiscord<Marcus> I was actually expecting it to work the way you suggest it should, Elegantbeef.
21:46:07FromDiscord<Elegantbeef> Of course you would Nim is imperative
21:46:45FromDiscord<Graveflo> I guess imports are declarative currently
21:46:55FromDiscord<Elegantbeef> But they arent
21:47:19FromDiscord<Elegantbeef> https://wandbox.org/permlink/ZzgEjgKLfPNRHeK8
21:47:35FromDiscord<Elegantbeef> Import order matters
21:47:47FromDiscord<Elegantbeef> Where you import matters aswell
21:48:43FromDiscord<Ayy Lmao> Is there a decent way to make a procedure compatable with ref and var objects at the same time?
21:48:49FromDiscord<Elegantbeef> It seems like all top level statements are group together and added at the end of the module processing
21:48:49FromDiscord<Elegantbeef> Instead of as processed
21:49:02FromDiscord<Elegantbeef> I answered this yesterday grave you answer
21:49:04FromDiscord<Graveflo> I just asked that yesterday Ayy
21:49:20FromDiscord<Ayy Lmao> What a coincidence
21:50:16FromDiscord<Elegantbeef> Is grave not going to answer and force ayy to search?!
21:50:31FromDiscord<Elegantbeef> Real time chat is such a ephemeral resource
21:50:44FromDiscord<Graveflo> sent a code paste, see https://play.nim-lang.org/#ix=4xcK
21:50:53FromDiscord<Graveflo> I think
21:51:03FromDiscord<Elegantbeef> `(a: ref T or var T)`
21:51:05FromDiscord<Graveflo> no you said to make a generic
21:51:11FromDiscord<Graveflo> ah crap
21:51:24FromDiscord<Elegantbeef> Yes generics are how you make a procedure work with multiple types...
21:52:09FromDiscord<Graveflo> is the compiler smart enough not to bloat up the executable size if you do this often? `[]` is ugly but I'd take it over 2xing my code storage
21:52:43FromDiscord<Elegantbeef> What?
21:52:52FromDiscord<Elegantbeef> Generics are only included if instantiated
21:53:17FromDiscord<Graveflo> say you are working with both ref versions and non ref versions. Then there are two compiled versions then?
21:53:27FromDiscord<Elegantbeef> Of course they're two different types
21:53:40FromDiscord<Ayy Lmao> If you do t[].foo() every time you never instantiate the ref version though right?
21:53:50FromDiscord<Elegantbeef> Right
21:54:01FromDiscord<Graveflo> well versions of the compiled `proc`? if that is the case then `[]` should work with only one compiled version of the `proc`
21:54:16FromDiscord<Graveflo> smaller bin?
21:54:23FromDiscord<Elegantbeef> Sure you can always just make an overload that calls the var if you're anally retentive
21:54:50FromDiscord<Elegantbeef> There you go
21:54:52FromDiscord<Elegantbeef> sent a code paste, see https://paste.rs/t0q0R
21:55:04FromDiscord<Elegantbeef> But the question was not "how do i overload"
21:55:13FromDiscord<Elegantbeef> It was "How do i make a procedure work on two types" 😛
21:57:23FromDiscord<Elegantbeef> As nice as polymorphic procedures sound monomorphic is almost always much saner
21:57:50FromDiscord<Graveflo> so, if you have these code paths that are `var SomeObj` I feel like you aren't going to be de-referencing very often bc once you chuck it into the proc its doesn't need it anymore. I feel like `[]` might be cleaner
21:58:00FromDiscord<Graveflo> this is for `RootObj` only tho
21:58:40FromDiscord<Elegantbeef> Even though `var object or ref object` can be used identically inside the procedure you have to remember every field access in Nim has a nil reference check, and the procedure might need ref counting on any 'copies'
21:58:54FromDiscord<Elegantbeef> There isnt really a way to make a polymorphic version so 2 procedures are required
21:59:15FromDiscord<Elegantbeef> You remove the need by dereferencing insider the overload of course
22:00:25FromDiscord<Graveflo> yea that totally makes sense. So just to be clear if `myThing` has code paths through more procs that use `var int` this comes without consequence
22:01:16FromDiscord<Elegantbeef> Right operating on a field of a object being it ref or not does not have any implications on the operations
22:01:29FromDiscord<Graveflo> I love it
22:01:50FromDiscord<Elegantbeef> Nim is memory safe so accessing anything on a `ref` has memory sanity checks
22:02:58FromDiscord<Elegantbeef> So in the case of the above overload you might generate a procedure, but in reality any good C compiler will inline it
22:03:44FromDiscord<Elegantbeef> So it's likely a 0 cost abstraction in 99% of cases that doesnt cause you to manually `[]`
22:04:19FromDiscord<Elegantbeef> @Ayy Lmao\: this should answer your question right? 😛
22:04:43FromDiscord<Ayy Lmao> In reply to @Elegantbeef "<@277645179115143178>\: this should answer": I'm having some issues actually, not sure if it's a compiler bug or something.
22:04:52FromDiscord<Ayy Lmao> sent a code paste, see https://play.nim-lang.org/#ix=4xcQ
22:05:02FromDiscord<Ayy Lmao> Says I can't assign to baseField
22:05:03FromDiscord<Elegantbeef> `(var Foo) or (ref Foo)`
22:05:18FromDiscord<Ayy Lmao> Still doesn't work
22:05:31FromDiscord<Graveflo> or `foo: (var Foo or ref Foo)`
22:05:47FromDiscord<Ayy Lmao> No luck
22:07:16FromDiscord<Ayy Lmao> It doesn't work on the version of Nim I'm using at least
22:07:31FromDiscord<Elegantbeef> This is probably an issue with that inheritance and the generic
22:07:37FromDiscord<Graveflo> me neither. I'm trying to wrap my head around the generic object
22:07:50FromDiscord<Ayy Lmao> It's beefs insane dependency injection trick
22:07:58FromDiscord<Ayy Lmao> It's turning out to be really powerful
22:08:33FromDiscord<Elegantbeef> Just do the overload method
22:08:54FromDiscord<Elegantbeef> sent a code paste, see https://play.nim-lang.org/#ix=4xcS
22:09:12FromDiscord<Elegantbeef> It's clearly an issue with that inheritance
22:09:39FromDiscord<Ayy Lmao> sent a code paste, see https://play.nim-lang.org/#ix=4xcT
22:10:05FromDiscord<Ayy Lmao> Like you can statically dispatch a template
22:10:25FromDiscord<Elegantbeef> callable
22:10:30FromDiscord<Ayy Lmao> In reply to @Elegantbeef "Just do the overload": I'll try it
22:10:44FromDiscord<Elegantbeef> Quit using a template there
22:10:44FromDiscord<Elegantbeef> I'll slap you
22:11:15FromDiscord<Ayy Lmao> What's wrong with a template?
22:11:28FromDiscord<Elegantbeef> In this case you are just using the template to spite me
22:11:41FromDiscord<Elegantbeef> Use a procedure unless you actually need a template
22:11:51FromDiscord<Elegantbeef> And if you need a template inside a generic procedure top it
22:11:54FromDiscord<Elegantbeef> stop it\
22:11:58FromDiscord<Ayy Lmao> I was mainly doing it to show it was possible haha
22:18:21FromDiscord<Graveflo> sent a code paste, see https://play.nim-lang.org/#ix=4xcU
22:19:05FromDiscord<Elegantbeef> No
22:19:08FromDiscord<Elegantbeef> `Bar[Foo: Foo]` would
22:19:17FromDiscord<Elegantbeef> `Bar[Foo]` is a generic type that can have any type inside `Foo`
22:19:40FromDiscord<Ayy Lmao> sent a code paste, see https://play.nim-lang.org/#ix=4xcV
22:19:48FromDiscord<Ayy Lmao> You can inject whatever you want for Base
22:20:22FromDiscord<Graveflo> oh so it is only really used as above. What I posted doesn't really make sense?
22:21:04FromDiscord<Graveflo> nvm `Foo` is just analogous to `T`?
22:21:15FromDiscord<Ayy Lmao> In reply to @Graveflo "nvm `Foo` is just": Yeah
22:21:23FromDiscord<Ayy Lmao> In your example it is
22:22:13FromDiscord<Graveflo> whoops ok. So it only doesn't make sense for the fact that I chose a really bad generic name. So then your code makes Foo a descendant of anything?
22:23:39FromDiscord<Ayy Lmao> In reply to @Graveflo "whoops ok. So it": Correct, you can inject the parent type and write generic procedures that use the parent type in an abstract way, then the user can inject the parent to implement functionality.
22:24:46FromDiscord<Ayy Lmao> Beef sent me down the rabbit hole of evaluating if it's a plausible way to code things.
22:24:47FromDiscord<Graveflo> very very interesting. I think I might prefer methods for something like that, but still. I like it
22:25:06FromDiscord<Ayy Lmao> I am toying around with it for GUI code.
22:25:44FromDiscord<Ayy Lmao> In reply to @Graveflo "very very interesting. I": The difference is this statically dispatches the methods.
22:27:24FromDiscord<Graveflo> yea that is basically a way cleaner way of doing generic dep injection. I've been toying with generics vs dyn dispatch recently. Obviously there are places where both shine
22:28:43FromDiscord<Graveflo> im most confused about how my generics-based code seems to run slower then method-based code. I was trying to test what the performance hit was and I guess my test is bad bc it showed generics as being slower despite their static linking
22:29:13FromDiscord<Ayy Lmao> I haven't really profiled it but I don't know why it would be slower.
22:30:09FromDiscord<Graveflo> also the compiler is quite frustrating with error messages in generics and imports are a little weird but still they are very powerful
22:31:04FromDiscord<Ayy Lmao> Yeah there is a lot of mental overhead and complications with doing it so I would avoid it when possible.
22:35:36FromDiscord<Elegantbeef> Yea my GUI erroring is always fun to run diagnostics 😄
22:57:19*xet7 joined #nim
23:00:02*marcus quit (Remote host closed the connection)
23:00:45*marcus joined #nim
23:04:47*xet7 quit (Ping timeout: 250 seconds)
23:17:19*xet7 joined #nim
23:18:00*xet7 quit (Remote host closed the connection)
23:59:41FromDiscord<michaelb.eth> Any known tricks to improve lcov reports re: Nim code? The lines displayed as covered (or not) and the numbers reported sometimes don't make much sense.