<< 26-02-2023 >>

00:35:05NimEventerNew thread by ringabout: Nim GitHub statistics , see https://forum.nim-lang.org/t/9939
00:45:57FromDiscord<ringabout> https://media.discordapp.net/attachments/371759389889003532/1079202624211001394/image.png
01:35:40*ltriant joined #nim
01:39:49*ltriant quit (Ping timeout: 246 seconds)
02:19:27FromDiscord<Hourglass [She/Her]> Is it possible to make a proc that accepts any data type as long as an `encode` method exists for it?
02:19:41FromDiscord<Hourglass [She/Her]> I think I've seen something similar for `$`?
02:19:46FromDiscord<Hourglass [She/Her]> In reply to @Hourglass, When the Hour Strikes "Is it possible to": Proc not method
02:22:42FromDiscord<Elegantbeef> concepts
02:22:51FromDiscord<Elegantbeef> Scroll up to earlier when i said the same to 4
02:23:07FromDiscord<Hourglass [She/Her]> I just found that echo uses `varargs[typed, `$`]`
02:23:13FromDiscord<Hourglass [She/Her]> In reply to @Elegantbeef "Scroll up to earlier": Aight
02:26:44FromDiscord<Hourglass [She/Her]> sent a code paste, see https://play.nim-lang.org/#ix=4ped
02:26:59FromDiscord<Elegantbeef> Yep
02:26:59FromDiscord<Hourglass [She/Her]> I'm assuming this would mean anything that takes a Serialisable needs an `encode` method
02:27:04FromDiscord<Hourglass [She/Her]> Sweet, thanks beef!
03:26:44FromDiscord<ringabout> sent a code paste, see https://play.nim-lang.org/#ix=4pel
03:26:52FromDiscord<ringabout> Where I got type mismatch errors for it?
03:26:57FromDiscord<ringabout> (edit) "Where" => "Why "
03:27:17FromDiscord<ringabout> sent a code paste, see https://play.nim-lang.org/#ix=4pem
03:28:03FromDiscord<ringabout> (edit) "for" => "from"
03:29:08FromDiscord<ringabout> It doesn't make sense, since `array[1, Slice[int]]` works.
03:30:17FromDiscord<Elegantbeef> `for i in 0u16 .. bounds.len - 1`
03:38:35FromDiscord<ringabout> Yeah, `i` is ot int type?
03:38:40FromDiscord<ringabout> (edit) "ot" => "of"
03:42:12FromDiscord<ringabout> In reply to @Elegantbeef "`for i in 0u16": I see, thanks. The errors are not vary friendly though.
03:48:54FromDiscord<ringabout> Macros changes are hard to make, breaking so many packages => https://github.com/nim-lang/Nim/pull/21433
03:51:56FromDiscord<eyes> sent a code paste, see https://play.nim-lang.org/#ix=4per
03:52:42FromDiscord<eyes> https://media.discordapp.net/attachments/371759389889003532/1079249623966814299/image.png
03:52:58FromDiscord<eyes> sorry for the shit screenshot, I can't get a copy-able error message
03:53:05FromDiscord<amadan> modifier is a closure since it accesses `collisions`↵You should pass `collisions` as a pointer for `data`
03:53:30FromDiscord<eyes> uh oh
03:53:37FromDiscord<eyes> programming concept i do not know
03:53:40FromDiscord<eyes> closures
03:53:44FromDiscord<eyes> allow me to look this up lol
03:53:48FromDiscord<amadan> sent a code paste, see https://play.nim-lang.org/#ix=4pes
03:54:27FromDiscord<amadan> (edit) "https://play.nim-lang.org/#ix=4pes" => "https://play.nim-lang.org/#ix=4pet"
03:54:27FromDiscord<eyes> oh i see right
03:54:41FromDiscord<eyes> the thing in C where you let people use void pointers as long as they handle the dereferencing themselves
03:54:50FromDiscord<eyes> fucked up
03:55:55FromDiscord<eyes> okay thank you for your help, unfortunately the ``SpaceBBQueryFunc`` creation is still not working. should I do an unsafe cast maybe?
03:56:00FromDiscord<eyes> h
03:56:31FromDiscord<amadan> sent a code paste, see https://play.nim-lang.org/#ix=4peu
03:56:40FromDiscord<amadan> In reply to @eyes "okay thank you for": Whats the error message?
03:56:44FromDiscord<eyes> yeah they couldve
03:56:52FromDiscord<eyes> In reply to @eyes "": this tiny ass image
03:57:13FromDiscord<amadan> Oh
03:57:24FromDiscord<amadan> sent a code paste, see https://play.nim-lang.org/#ix=4pev
03:57:39FromDiscord<eyes> BRUH
03:57:45FromDiscord<amadan> says it expects a proc that takes a shape, you gave it a body
03:57:49FromDiscord<eyes> yeah...
03:57:50FromDiscord<eyes> thanks
03:57:54FromDiscord<eyes> game jam lol
03:57:57FromDiscord<eyes> i am tired
03:59:51FromDiscord<amadan> lol, understandable
04:01:02*ltriant joined #nim
04:05:18*ltriant quit (Ping timeout: 255 seconds)
05:05:08NimEventerNew thread by ringabout: My Nim Development Weekly Report (2/26), see https://forum.nim-lang.org/t/9940
05:10:58FromDiscord<Hourglass [She/Her]> Oh huh, that's cool
05:11:51FromDiscord<Hourglass [She/Her]> Is this a general clean up of the compiler code itself? Or just code that's user-facing
05:12:55FromDiscord<Hourglass [She/Her]> (User-facing meaning, stuff like fixing the push pragma)
05:12:56FromDiscord<ringabout> When I say "cleanups", It means trivial changes. I don't distinguish them.
05:13:10FromDiscord<Hourglass [She/Her]> Ah fair
05:13:54FromDiscord<ringabout> Perhaps I should call it "chores" following conventions.
05:19:44*arkurious quit (Quit: Leaving)
05:52:45*azimut quit (Remote host closed the connection)
05:53:24*azimut joined #nim
06:15:17*ltriant joined #nim
06:19:51*ltriant quit (Ping timeout: 255 seconds)
06:36:56*azimut quit (Ping timeout: 255 seconds)
06:47:40*al1ranger joined #nim
06:49:19*al1ranger quit (Client Quit)
07:34:18*oprypin joined #nim
08:50:40*Notxor joined #nim
08:56:44*Notxor quit (Remote host closed the connection)
08:59:04*Notxor joined #nim
09:15:59*ltriant joined #nim
09:20:11*ltriant quit (Ping timeout: 248 seconds)
09:22:11*ltriant joined #nim
10:05:47NimEventerNew thread by moigagoo: Proc type won't match despite identical signatures, see https://forum.nim-lang.org/t/9941
11:18:43*jmdaemon quit (Ping timeout: 246 seconds)
11:19:00FromDiscord<sigmasd> Here is a plugin to easily add syntax highlighting for nvim (using ts) https://github.com/sigmaSd/nim-nvim-basic
11:19:17FromDiscord<sigmasd> If you know ts consider contributing to https://github.com/aMOPel/tree-sitter-nim
11:22:57FromDiscord<sOkam!> @sigmasd How does that compare with https://github.com/zah/nim.vim ?↵I found that plugin to be the most reliable highlighter so far, but if yours is an improvement I wouldn't mind switching
11:24:26FromDiscord<sigmasd> no mine is not an improvement
11:24:57FromDiscord<sigmasd> I just don't want to add vimscript, also the above plugin uses regex, this one uses treesitter implementation which is not complete for nim
11:31:35FromDiscord<sigmasd> so If I add a dependency on "faststreams", it seems like nimble doesn't understand transitive dependencies ? and I have to add the dependencies of faststreams manually ?
11:34:20FromDiscord<sigmasd> sent a code paste, see https://play.nim-lang.org/#ix=4pfR
11:34:20FromDiscord<sigmasd> is that actually how it works ?
11:42:41FromDiscord<hotdog> In reply to @sigmasd "so If I add": No that’s not right
11:42:48FromDiscord<hotdog> What error are you getting?
11:43:34FromDiscord<amadan> What's your nimble version?
11:43:58FromDiscord<sigmasd> I tried to build https://github.com/nim-lang/langserver
11:43:58FromDiscord<sigmasd> and it failed becuase it didnt have faststreams
11:43:59FromDiscord<sigmasd> then I added it and it failed because it wonted its deps
11:44:10FromDiscord<sigmasd> nim 1.9.1
11:44:18FromDiscord<sigmasd> [Edit](https://discord.com/channels/371759389889003530/371759389889003532/1079368229853593659): then I added it and it failed because it wanted its deps
11:44:39FromDiscord<amadan> Nimble mightn't be the lastest↵`nimble install --mm:refc nimble`
11:46:21FromDiscord<sigmasd> I was debugin this isssue btw, the langserver crashes, because didOpen receive a url with a newline at the end
11:46:24FromDiscord<sigmasd> image.png https://media.discordapp.net/attachments/371759389889003532/1079368834047291392/image.png
11:46:37FromDiscord<sigmasd> nvim obviosuly sends no newline, nimlangserver is adding it somewhere
11:47:30FromDiscord<sigmasd> oh wait nvm its just stderr.writeline, I'll just have to debug later I guess
11:49:05FromDiscord<sigmasd> that worked↵(@amadan)
13:50:45*luis_ quit (Remote host closed the connection)
13:52:57*xet7 quit (Ping timeout: 252 seconds)
14:01:55*luis_ joined #nim
14:02:43luis_Hi all, is it possible to use C code directly inside a nim file? Is there a way of making the compiler understand that?
14:04:06FromDiscord<auxym> In reply to @luis_ "Hi all, is it": you can use the `{.emit.}` pragma. It's usually a last resort for FFI edge cases. What exactly do you want to do?
14:06:47luis_thanks, will try that...
14:09:52*azimut joined #nim
14:10:10FromDiscord<auxym> would anyone have a nice example to suggest for getting started with `nim doc`? I'd like separate pages for some submodules, maybe even (automatically, if possible) mixing in manually-written rst files
14:12:58luis_auxym, emit works great, thanks
14:15:28*xet7 joined #nim
14:16:48FromDiscord<Phil> In reply to @auxym "would anyone have a": Honestly I just use Nim doc to generate an index as reference documentation and nimibook to generate introduction documentation that explains examples and concepts
14:17:43FromDiscord<Phil> If you simply want to do that I have multiple projects that have nimble tasks that do that and workflows that deploy them on GitHub pages
14:21:23luis_auxym, so if I write a small function inside the emit pragma, how can I access it in the nim code? I have a `int calculate(int int)` and how do I run calculate(2,2) outside the pragma?
14:21:53FromDiscord<auxym> In reply to @Isofruit "If you simply want": sure, I'll have a look, maybe that could work
14:22:24FromDiscord<auxym> otherwise I was thinking of using jsondoc and somehow generating sphinx stuff from that
14:25:29FromDiscord<auxym> In reply to @luis_ "<@882793909246369864>, so if I": maybe look at this as an example: https://github.com/nim-lang/Nim/blob/version-1-6/lib/pure/volatile.nim#L26
14:26:27FromDiscord<auxym> but once again, what are you doing inside the emit? are you sure there's no way to do it in nim? as you can see, emit is hacky to use and exists as a last-resort escape hatch
14:26:29FromDiscord<Phil> In reply to @auxym "sure, I'll have a": Check out snorlogue , which does both
14:27:16FromDiscord<Phil> The setup with the workflow is mildly convoluted
14:30:53FromDiscord<auxym> the snorlogue nimibook look good! I just wish there was an easy way to sort of integrate it with nim doc generated API docs
14:32:07FromDiscord<auxym> I'd like to end up with something like this: https://nptdms.readthedocs.io/en/stable/ Some sections are handwritten files, but the API reference section is auto-generated from (python) docstrings
14:32:15FromDiscord<auxym> sphinx btw
14:35:39*xet7 quit (Remote host closed the connection)
14:39:59*xet7 joined #nim
14:57:23FromDiscord<auxym> ?
14:57:25FromDiscord<auxym> sent a code paste, see https://play.nim-lang.org/#ix=4pgS
15:02:14luis_Hi all, why do I get a illegal storage access error in the example: https://play.nim-lang.org/#ix=4ph6
15:03:48FromDiscord<auxym> as I suggested already, you really should write that emitted C function in nim (and use exportc if you need accessible from C for interop or something)
15:06:52FromDiscord<auxym> maybe try importc instead of cdecl, though it doesn't work in playground
15:07:07FromDiscord<auxym> but really this use of emit is making me sad :S
15:07:32FromDiscord<Phil> In reply to @auxym "the snorlogue nimibook look": There kinda is if you think about it, both support hyperlinks so you can add links from one to the other.↵In Nim docs that would be in doc comments
15:27:36FromDiscord<Hourglass [She/Her]> In reply to @luis_ "Hi all, why do": @luis here, I fixed your code, the way you're doing it, and the way that (i and others believe) it should be done
15:27:47FromDiscord<Hourglass [She/Her]> Slightly modified version of your code: https://play.nim-lang.org/#ix=4ph6
15:27:58FromDiscord<Hourglass [She/Her]> 'Ideal' code: https://play.nim-lang.org/#ix=4phf
15:29:19FromDiscord<Hourglass [She/Her]> In reply to @Hourglass, When the Hour Strikes "Slightly modified version of": Ah this one is wrong, correct link: https://play.nim-lang.org/#ix=4phi
15:31:06FromDiscord<Gabben> How to make timeout in `Connection` from nim-libp2p infinite or disable it?↵↵I tried `connection.timeout = InfiniteDuration`, but it fails on `timeoutMonitor` -> `sleepAsync` -> https://github.com/status-im/nim-chronos/blob/master/chronos/timer.nim#L456 with `[OverflowDefect]`. I thought `sleepAsync` had a check for `InfiniteDuration`
15:37:53FromDiscord<ieltan> does nim have pattern matching ?
15:38:18FromDiscord<sigmasd> is there an api to check the latest version of a nimble program ?
15:38:42FromDiscord<Rika> In reply to @ieltan "does nim have pattern": yes... kind of
15:39:06FromDiscord<Rika> https://github.com/haxscramper/hmatching
15:44:50*arkurious joined #nim
16:07:30FromDiscord<sigmasd> langserver doesn't handle rootUri not being set in init request (its allowed by the spec)
16:08:14FromDiscord<sigmasd> also when it crashes it leaves the spawned nimsuggests as zombies
16:08:48FromDiscord<sigmasd> is there a pattern in nim to handle craches gracefully, in rust there is std\:\:panic\:\:set\_hook, or implemeting Drop for structs
16:08:48FromDiscord<sigmasd> is there a pattern in nim to handle craches gracefully ? in rust there is std\:\:panic\:\:set\_hook, or implemeting Drop for structs
16:09:01FromDiscord<sigmasd> [Edit](https://discord.com/channels/371759389889003530/371759389889003532/1079434866279579758): is there a pattern in nim to handle crashes gracefully ? in rust there is std\:\:panic\:\:set\_hook, or implemeting Drop for structs
16:09:02FromDiscord<sigmasd> [Edit](https://discord.com/channels/371759389889003530/371759389889003532/1079434866279579758): is there a pattern in nim to handle crashes gracefully ? in rust there is std\:\:panic\:\:set\_hook, or implementing Drop for structs
16:10:32FromDiscord<Rika> not that i know of, defects can always end your program
16:22:33FromDiscord<Dudugz> ... if your program is crashing in the middle of the process then surely there is something wrong, now if it is error handling why not use try~catch
16:24:19FromDiscord<Dudugz> sent a code paste, see https://play.nim-lang.org/#ix=4phu
16:24:23FromDiscord<Dudugz> (edit) "try~catch" => "try~except"
16:28:35FromDiscord<sigmasd> so does project usually wrap the main entry point with try catch and do cleanup there ?
16:29:29FromDiscord<sigmasd> anyhow that seems good enough↵(@Dudugz)
16:30:26FromDiscord<Dudugz> Not sure but it's a viable alternative, there are also deconstructors but I don't know how they work as I haven't tested them yet.
16:31:21FromDiscord<Rika> please use CatchableError instead
16:31:44FromDiscord<Rika> Exception would be erroneous when switching between --panics:on and off
16:35:13FromDiscord<Dudugz> I didn't know, thanks
16:49:02FromDiscord<sigmasd> I guess i can just scarp it
16:49:03FromDiscord<sigmasd> the nimble directory simply uses github apis, and the site itself uses server rendering, so the answer is nope
17:07:18FromDiscord<sigmasd> does nimble keep no metadata about installed binaries ?
17:07:42FromDiscord<sigmasd> cargo keeps them in \~/.cargo/.crates.toml
17:08:09FromDiscord<sigmasd> in nimble case seems there is no way to leverage it to know current program versions to look for updates
17:09:40FromDiscord<sigmasd> image.png https://media.discordapp.net/attachments/371759389889003532/1079450186855747624/image.png
17:09:46FromDiscord<sigmasd> seems some bin are symlinks to under pkgs
17:09:48FromDiscord<sigmasd> that can be leverged
17:09:50FromDiscord<sigmasd> but the problem is some are not
17:10:29FromDiscord<sigmasd> maybe thats a new feature I'll try reinstalling
17:10:49NimEventerNew thread by jyapayne: Orc RTTI: Is there a way to get Enum + Tuple type info?, see https://forum.nim-lang.org/t/9942
17:11:20FromDiscord<Dudugz> Honestly I prefer the solution used in Deno to host packages, more liberal. This business of having to have an extra repository just to add a package and then having to wait until someone remembers that they need to check new packages is too much boilerplate.
17:12:07FromDiscord<Dudugz> The good thing about the deno solution is that it brings immutability and you can keep your package up to date without having to deal with other things.
17:12:08FromDiscord<sigmasd> deno does lot of things right
17:13:02FromDiscord<sigmasd> like how did programmers never think about `import url-dep` or `deno run url-program`
17:13:38FromDiscord<Dudugz> Idk, but you can also use deno install to install locally
17:13:52FromDiscord<Dudugz> It downloads the latest version from your git
17:54:57*arkurious quit (Ping timeout: 252 seconds)
18:02:08*xet7 quit (Read error: Connection reset by peer)
18:07:44*arkurious joined #nim
18:09:40*xet7 joined #nim
18:14:52*jmdaemon joined #nim
18:17:10NimEventerNew thread by moigagoo: JS backend: Can't return a proc that iterates over an openArray, see https://forum.nim-lang.org/t/9943
18:17:40FromDiscord<sigmasd> Here is a program to update nim binaries installed through nimble
18:17:40FromDiscord<sigmasd> https://gist.github.com/sigmaSd/7b2630eeb0d8ca0bb237ffaa354d9f95
18:17:53FromDiscord<sigmasd> run with `deno run https://gist.github.com/sigmaSd/7b2630eeb0d8ca0bb237ffaa354d9f95/raw/b5c419a1ef74eb27cad46e76837dfabe431f5208/nimup.ts`
18:30:46FromDiscord<sigmasd> hmm the method I'm using to find upstream version , finds the master version but now I looked a bit more its seems like nimble just looks for the latest tag, I'll just update the code
18:33:09FromDiscord<sigmasd> got to love chatgpt for these kind of tasks (get last github tag in javascript)
18:41:12NimEventerNew post on r/nim by lf_araujo: Nim scratchpad in neovim with Codi, see https://reddit.com/r/nim/comments/11cp06r/nim_scratchpad_in_neovim_with_codi/
18:44:47FromDiscord<sigmasd> done
18:46:09FromDiscord<sigmasd> [Edit](https://discord.com/channels/371759389889003530/371759389889003532/1079467355626815670): run with `deno run https://gist.github.com/sigmaSd/7b2630eeb0d8ca0bb237ffaa354d9f95/raw/f0d37b50808c6a83eece0c0756bfa1c029e24d72/nimup.ts`
19:17:52luis_Hi all, I managed to make Codi work with Nim: https://imgur.com/a/U8cqivu (needs to click to see the animated gif). Codi is a scratchpad that supports many languages, I use it normally with R as a calculator.
19:48:15*luis_ quit (Ping timeout: 260 seconds)
20:11:29FromDiscord<luteva> In reply to @luis_ "Hi all, I managed": cool! can you add a pull request to add nim as a new language for codi?
20:23:30FromDiscord<Hourglass [She/Her]> What's a decent name for a plugin loader in Nim?
20:23:48FromDiscord<Hourglass [She/Her]> (The plugin loader is generic on purpose so)
20:26:40*gastus_ joined #nim
20:28:27gastus_Hi. I started looking into Nim. just read all descriptions in packages.json from Nimble. Awesome. However there is one feature I'd like to be using myself in the future eventually and that's bidirectional typing *AND* allowing to embed foreign languages *AND* allowing subtypnig. Like a string is not a string, but a string containing JSON of focrmat {x:number} or JSON is not JSON but JSON of type {x:number}
20:28:33gastus_cause that would put nim on same level as TypeScirpt maybe even beyond.
20:28:47gastus_Alos if you want to build a query(select * from usres where id =10) how can you create a typed row on the fly ?
20:28:51gastus_Something like Rust anonymous records ?
20:29:41FromDiscord<sOkam!> In reply to @Hourglass, When the Hour Strikes "What's a decent name": gelo, genlo, gload, pluglo↵obviously the only that stands any chance of this is gelo, but just brainstorming
20:29:44FromDiscord<Coachonko> In reply to @gastus_ "cause that would put": People who want to use typescript probably will use typescript, not Nim. I speak as somebody who is tired of typescript
20:30:03FromDiscord<ali> nimLoader?↵(@Hourglass [She/Her])
20:30:12FromDiscord<ali> (kind of like nimrod)
20:30:46gastus_I am also tired of some limitations of TypeScript eg macros.
20:30:56gastus_But I also honestly enjoy pyright when coding.
20:30:58FromDiscord<Hourglass [She/Her]> In reply to @ali "nimLoader? (<@909883978717204561>)": I'm planning on adding a way to implement loader plugins (which would allow for loading plugins written in Python, for example)
20:31:22FromDiscord<Hourglass [She/Her]> My plugin loader is actually quite simple and flexible, which makes it doable
20:31:29gastus_And just because TypeScript kinda sucks in some ways dosen't mean some ideas it introduced add value.
20:31:38FromDiscord<Hourglass [She/Her]> In reply to @sOkam! "gelo, genlo, gload, pluglo": Gelo is... Interesting
20:31:38FromDiscord<sOkam!> sent a code paste, see https://play.nim-lang.org/#ix=4piX
20:32:52gastus_Looks like discord is the way to go :)
20:33:29FromDiscord<Coachonko> In reply to @gastus_ "And just because TypeScript": You're very welcome to create your own open source module for that functionality, I am sure other people will find it useful. Though, Nim has a relatively small community so I don't think people will do that work for you
20:33:41FromDiscord<Coachonko> Yeah come on discord
20:34:25*gastus_ left #nim (#nim)
20:34:34FromDiscord<virdisn> gastus_ is me.
20:34:52FromDiscord<virdisn> I know it would be too tough to ask somebody else to do the work.
20:35:05FromDiscord<virdisn> I just found that part of TypeScript that useful that I kinda miss it everywhere else.
20:35:45FromDiscord<virdisn> And typing in ts is like creating preprocessor which adds as Promise<Array<{name: string}>> and done.
20:35:50FromDiscord<Coachonko> Man I have a love/hate relationship with the js world. So many packages but such shitty tooling
20:35:56FromDiscord<virdisn> So wondering whether nim has either planned or already has something similar.
20:36:20FromDiscord<virdisn> Vite/ esbuild etc eventually try to fix it.
20:36:47FromDiscord<sOkam!> In reply to @virdisn "And typing in ts": `mixin` maybe?
20:37:09FromDiscord<virdisn> I personally wrote my own mono repo like manager to symlink small files so that I can refactor accross library borders. Cause some snippets are like 20 lines only but then I can reuse them. But got into hell with babel and whatnot. So yeah /..
20:37:39FromDiscord<Coachonko> My lord, babel...
20:37:57FromDiscord<Coachonko> I even like the idea of babel, I just don't like that it has to exist
20:38:18FromDiscord<virdisn> Well that you have to declare the extensions you use and it doesn't find out on its own is yet another story.
20:38:39FromDiscord<Hourglass [She/Her]> In reply to @Coachonko "I even like the": Yeahh, that's JS for ya
20:39:29FromDiscord<virdisn> @sOkam! What I am looking for is a macro I can pass a string like select from users which then returns promise like type which type checks the keys of the row. my understanding is that nim SQL libraries only return row you can index like x["name"] without knowing whether name exists.
20:39:56FromDiscord<virdisn> And with TS you have many ways like passing T = {name: string} and have a .get(k: key of T): T[k] and you're done.
20:40:02FromDiscord<virdisn> And even completion works then.
20:40:10FromDiscord<Coachonko> Different es versions, different module systems, sugar and magic everywhere, configuration over convention... I hate js again now
20:41:08*kenran joined #nim
20:42:45FromDiscord<Hourglass [She/Her]> In reply to @virdisn "<@186489007247589376> What I": Promise is asynchronous stuff right?
20:43:17FromDiscord<virdisn> Yes, its not about the promise. ITs about knowing that row.name exists and row. completes name in the editor to be faster.
20:43:28FromDiscord<Dudugz> I have a tiny library that is actually a core library that I'll be using in several things but because it's tiny I can't add it to the nim repo so I'm thinking of making a binary that lets you download a lib directly from a repository and then install it. ``nimble install`` would work if it were just going to be on my machine.
20:43:32FromDiscord<Hourglass [She/Her]> In reply to @virdisn "Yes, its not about": Aah
20:43:46FromDiscord<virdisn> JS world -> esbuild written in Go. Bable or such got rewritten in Rust. What I hate is having to switch languages.
20:43:53FromDiscord<Dudugz> In reply to @Hourglass, When the Hour Strikes "Promise is asynchronous stuff": yes, it's the same as Future in nim
20:43:59FromDiscord<virdisn> And relearn everything from scratch and all the detail.s
20:44:32FromDiscord<virdisn> https://github.com/launchbadge/sqlx -> checkout that compile time verification search for anonymous records.
20:44:37FromDiscord<virdisn> That's what I am talking about.
20:44:56FromDiscord<virdisn> But what if the row contains JSON/JSONP eg from PG and you know the structure ? Then you're lost again.
20:45:04FromDiscord<virdisn> That's why I want subtyping
20:45:41FromDiscord<virdisn> Another question: Is Nim a library itself? Thus is it possible to compile nim code at runtime and use it?
20:45:45FromDiscord<virdisn> Like eval ?
20:46:16FromDiscord<sOkam!> In reply to @virdisn "<@186489007247589376> What I": runtime or comptime?
20:46:44FromDiscord<sOkam!> macros run on the vm, but my understanding of the description sounded like runtime
20:46:55FromDiscord<virdisn> runtime.
20:47:04FromDiscord<Dudugz> sent a code paste, see https://play.nim-lang.org/#ix=4pj4
20:47:08FromDiscord<sOkam!> then macros are not an option
20:47:11FromDiscord<virdisn> more like x = compilenim("code") then x()
20:47:27FromDiscord<sOkam!> if you can gen the code at runtime, then macros can be for that
20:47:33FromDiscord<sOkam!> sry comptime
20:47:43FromDiscord<sOkam!> (edit) "runtime," => "comptime,"
20:48:47*arkurious quit (Ping timeout: 246 seconds)
20:50:00FromDiscord<sOkam!> i believe nimscripter can work as vm at runtime. but i know very little about the topic, so i might be misguiding you, so take it with a grain of salt
20:50:20FromDiscord<virdisn> So answer looks to be no for now.
20:50:26FromDiscord<Dudugz> sent a code paste, see https://play.nim-lang.org/#ix=4pj7
20:50:42FromDiscord<virdisn> That's exactly what Haskell etc can do.
20:50:49FromDiscord<virdisn> And Java also can compile Java and load the packages.
20:50:52FromDiscord<Hourglass [She/Her]> You can import the compiler as a library
20:50:57FromDiscord<Hourglass [She/Her]> But it's not user friendly
20:51:00FromDiscord<Hourglass [She/Her]> At all
20:51:02FromDiscord<Dudugz> Hmm
20:51:03FromDiscord<sOkam!> that's what nimscripter does
20:51:45FromDiscord<Hourglass [She/Her]> Yeah you may wanna check out Nimscripter, there's some limitations since it isn't Nim and FFI isn't exactly great, but it may be useful?
20:52:02FromDiscord<virdisn> Already checked out. That's using the VM.
20:52:37FromDiscord<virdisn> Nim and some libraries is such a freaking incredible nice piece of software.
20:53:10FromDiscord<virdisn> I tried looking at the mixin documentation.
20:53:22FromDiscord<virdisn> But I failed understanding it. Do you know any example code ?
20:56:03FromDiscord<sOkam!> In reply to @virdisn "But I failed understanding": its basically saying "hey compiler, i promise you this thing will exist eventually, don't crash here yet"
20:56:07FromDiscord<Hourglass [She/Her]> Sorry no, I don't understand mixins myself aha
20:56:35FromDiscord<sOkam!> but i don't know what promises are, so hence the `?` in the sentence 🙂
20:56:46FromDiscord<sOkam!> (edit) "are," => "are in your example,"
20:56:47FromDiscord<virdisn> Promises are something which calls then once the answer arrives.
20:56:52FromDiscord<virdisn> And the answer is either a result or a failure.
20:57:02FromDiscord<virdisn> That's why then has 2 methods to bec alled one for success one for failure.
20:57:18FromDiscord<virdisn> PRomise((succ, fail) => succ("foo")) wouldu resolve
20:57:23FromDiscord<sOkam!> oh, defo not mixin then
20:57:26FromDiscord<virdisn> Now the succ can be passed arround and resolve later.
20:57:34FromDiscord<sOkam!> are exceptions not fit for the task?
20:58:07FromDiscord<virdisn> So its fixing the callback hell of nested quer(SELECT, (failure, result) => { query(SELECT, (failure2, result2) => callback hell
20:58:16FromDiscord<virdisn> And because .then is still to annoying the async/await suggar was introduced.
20:59:02FromDiscord<virdisn> Problem is ordinary JS promises are not cancellable but Bluebird promises are. And you cannot set priorities which would be fun if you change focus but that's maybe overengineering.
20:59:26FromDiscord<virdisn> sOkam: It's like asking 10 friends for help at the same time.
20:59:29FromDiscord<virdisn> So you have 10 future results.
20:59:38FromDiscord<virdisn> And once they arrive you can do something.
21:00:02FromDiscord<virdisn> So its more than just future result. Its allowing to have multiple async processes running at the same time even if your code is running in one theard.
21:00:12FromDiscord<virdisn> So yes awaiting something means other code will run in between.
21:00:14FromDiscord<sOkam!> sent a code paste, see https://paste.rs/8Bw
21:00:57FromDiscord<virdisn> If you want to understand promises you need to understand callback hell. Then you understand why they solve it.
21:01:25FromDiscord<virdisn> All the nice JS solutinos like waterfall etc are kinda obsolete by Promise.all([friend1, friend2].map(askfriend))
21:01:34FromDiscord<virdisn> Or Promise.race to get the first reply noly.
21:02:01*arkurious joined #nim
21:02:14FromDiscord<virdisn> So a Promise is something having given away callbacks which can be used to talk about the result. And knows whom to notify about success/failure.
21:02:38FromDiscord<virdisn> And it can be chained like query.then((result) => process_result_on_other_server(result)).then( console.log)
21:04:15FromDiscord<sOkam!> sent a code paste, see https://play.nim-lang.org/#ix=4pjb
21:04:18Zevvor use CPS so you can just do `result = query(); process_result_on_other_server(result); console.log();`
21:04:46FromDiscord<sOkam!> (edit) "https://play.nim-lang.org/#ix=4pjb" => "https://play.nim-lang.org/#ix=4pjc"
21:07:27FromDiscord<virdisn> @sOkam! Do those friends get asked at the same time in parallel ?
21:07:53FromDiscord<sOkam!> i don't know multithreading
21:08:07FromDiscord<sOkam!> i imagine you could, but ymmv
21:08:08FromDiscord<virdisn> Looks like ordinary loop hidden in a template. Also the results are not passed to doSuccess. Also they results are not collected and passed as one result. doSuccess is called for each result.
21:08:20FromDiscord<virdisn> Promise.all() callects and waits for all.
21:08:23FromDiscord<virdisn> Its not realy multithreading.
21:08:44FromDiscord<virdisn> Its like while true: .. do nothing till one of the results come in like sql query result or such like watching sockets.
21:09:34FromDiscord<virdisn> It's like you telling 10 chefs of ktiches to do something else and waiting till its done. You're not multithreading. You're just starting 10 different tasks one by one .. and then once they return you look at them one by one and collecting them for further processing.
21:10:05FromDiscord<virdisn> But the result of forwarding a task to other thread is a future result which can be done by Promise.
21:10:27FromDiscord<virdisn> like run_other_thread(js_code_as_string_to_be_evaled).then( on_uscc, on_fail_callback)
21:17:53*Batzy quit (Quit: https://quassel-irc.org - Chat comfortably. Anywhere.)
21:18:17*Batzy joined #nim
21:33:47NimEventerNew post on r/nim by Geff10: Is Nim's site hacked?, see https://reddit.com/r/nim/comments/11cteg6/is_nims_site_hacked/
21:42:55*pbsds quit (Quit: The Lounge - https://thelounge.chat)
21:43:20*pbsds joined #nim
22:07:03FromDiscord<Elegantbeef> Mixins are for generics, they tell the compiler that you want to consider the scope of the generic instantiation aswell as the scope of declaration↵(@virdisn)
22:07:27FromDiscord<Elegantbeef> the `bind` statement does the inverse it tells the compiler only consider scope of declaration
22:10:17*Notxor quit (Quit: Leaving)
22:23:50*kenran quit (Remote host closed the connection)
22:34:27FromDiscord<sOkam!> Is there a default iterator for all fields of an `object`?
22:37:20FromDiscord<amadan> There is `fields` https://nim-lang.org/docs/iterators.html#fields.i%2CT
22:43:50FromDiscord<sOkam!> handy, ty
22:58:53FromDiscord<Dudugz> In reply to @sOkam! "are exceptions not fit": If you want to understand the concept of promises I recommend reading the link below, it makes a real analogy and explains in detail what a promise would be and how they work.↵↵https://javascript.info/promise-basics
23:00:09FromDiscord<Elegantbeef> Nimscripter makes it easier, but one can just use Nim as a library
23:00:09FromDiscord<Elegantbeef> Yea nimscript can do this↵(@Dudugz)
23:02:37*Guest39776 joined #nim
23:03:26*Guest39776 quit (Client Quit)
23:08:13FromDiscord<Dudugz> in Nim the JS promises are the Future object but unlike the JS promises, Future doesn't have an executor instead you call ``futureInstance.complete(value);``
23:11:06FromDiscord<auxym> how do Nim's official docs generate the menu at the top of the sidebar? "Manual", "Standard library", "Index", etc. Is that something I can replicate somehow with `nim doc`?
23:11:09FromDiscord<auxym> https://nim-lang.org/docs/lib.html
23:19:24FromDiscord<Elegantbeef> @auxym\: https://github.com/nim-lang/Nim/blob/devel/config/nimdoc.cfg#L135
23:26:38FromDiscord<Elegantbeef> As an aside it does always amuse me how bad github search is
23:56:56FromDiscord<tfp> https://media.discordapp.net/attachments/371759389889003532/1079552677870063636/image.png
23:57:02FromDiscord<tfp> so the issue here on line "4" down there
23:57:12FromDiscord<tfp> it's using the "beginFrame" from the outer scope
23:57:25FromDiscord<tfp> is this expected?
23:59:34FromDiscord<Elegantbeef> No clue but you probably can do `(proc(): float)(beginFrame).rawProc`