00:35:05 | NimEventer | New thread by ringabout: Nim GitHub statistics , see https://forum.nim-lang.org/t/9939 |
00:45:57 | FromDiscord | <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:27 | FromDiscord | <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:41 | FromDiscord | <Hourglass [She/Her]> I think I've seen something similar for `$`? |
02:19:46 | FromDiscord | <Hourglass [She/Her]> In reply to @Hourglass, When the Hour Strikes "Is it possible to": Proc not method |
02:22:42 | FromDiscord | <Elegantbeef> concepts |
02:22:51 | FromDiscord | <Elegantbeef> Scroll up to earlier when i said the same to 4 |
02:23:07 | FromDiscord | <Hourglass [She/Her]> I just found that echo uses `varargs[typed, `$`]` |
02:23:13 | FromDiscord | <Hourglass [She/Her]> In reply to @Elegantbeef "Scroll up to earlier": Aight |
02:26:44 | FromDiscord | <Hourglass [She/Her]> sent a code paste, see https://play.nim-lang.org/#ix=4ped |
02:26:59 | FromDiscord | <Elegantbeef> Yep |
02:26:59 | FromDiscord | <Hourglass [She/Her]> I'm assuming this would mean anything that takes a Serialisable needs an `encode` method |
02:27:04 | FromDiscord | <Hourglass [She/Her]> Sweet, thanks beef! |
03:26:44 | FromDiscord | <ringabout> sent a code paste, see https://play.nim-lang.org/#ix=4pel |
03:26:52 | FromDiscord | <ringabout> Where I got type mismatch errors for it? |
03:26:57 | FromDiscord | <ringabout> (edit) "Where" => "Why " |
03:27:17 | FromDiscord | <ringabout> sent a code paste, see https://play.nim-lang.org/#ix=4pem |
03:28:03 | FromDiscord | <ringabout> (edit) "for" => "from" |
03:29:08 | FromDiscord | <ringabout> It doesn't make sense, since `array[1, Slice[int]]` works. |
03:30:17 | FromDiscord | <Elegantbeef> `for i in 0u16 .. bounds.len - 1` |
03:38:35 | FromDiscord | <ringabout> Yeah, `i` is ot int type? |
03:38:40 | FromDiscord | <ringabout> (edit) "ot" => "of" |
03:42:12 | FromDiscord | <ringabout> In reply to @Elegantbeef "`for i in 0u16": I see, thanks. The errors are not vary friendly though. |
03:48:54 | FromDiscord | <ringabout> Macros changes are hard to make, breaking so many packages => https://github.com/nim-lang/Nim/pull/21433 |
03:51:56 | FromDiscord | <eyes> sent a code paste, see https://play.nim-lang.org/#ix=4per |
03:52:42 | FromDiscord | <eyes> https://media.discordapp.net/attachments/371759389889003532/1079249623966814299/image.png |
03:52:58 | FromDiscord | <eyes> sorry for the shit screenshot, I can't get a copy-able error message |
03:53:05 | FromDiscord | <amadan> modifier is a closure since it accesses `collisions`↵You should pass `collisions` as a pointer for `data` |
03:53:30 | FromDiscord | <eyes> uh oh |
03:53:37 | FromDiscord | <eyes> programming concept i do not know |
03:53:40 | FromDiscord | <eyes> closures |
03:53:44 | FromDiscord | <eyes> allow me to look this up lol |
03:53:48 | FromDiscord | <amadan> sent a code paste, see https://play.nim-lang.org/#ix=4pes |
03:54:27 | FromDiscord | <amadan> (edit) "https://play.nim-lang.org/#ix=4pes" => "https://play.nim-lang.org/#ix=4pet" |
03:54:27 | FromDiscord | <eyes> oh i see right |
03:54:41 | FromDiscord | <eyes> the thing in C where you let people use void pointers as long as they handle the dereferencing themselves |
03:54:50 | FromDiscord | <eyes> fucked up |
03:55:55 | FromDiscord | <eyes> okay thank you for your help, unfortunately the ``SpaceBBQueryFunc`` creation is still not working. should I do an unsafe cast maybe? |
03:56:00 | FromDiscord | <eyes> h |
03:56:31 | FromDiscord | <amadan> sent a code paste, see https://play.nim-lang.org/#ix=4peu |
03:56:40 | FromDiscord | <amadan> In reply to @eyes "okay thank you for": Whats the error message? |
03:56:44 | FromDiscord | <eyes> yeah they couldve |
03:56:52 | FromDiscord | <eyes> In reply to @eyes "": this tiny ass image |
03:57:13 | FromDiscord | <amadan> Oh |
03:57:24 | FromDiscord | <amadan> sent a code paste, see https://play.nim-lang.org/#ix=4pev |
03:57:39 | FromDiscord | <eyes> BRUH |
03:57:45 | FromDiscord | <amadan> says it expects a proc that takes a shape, you gave it a body |
03:57:49 | FromDiscord | <eyes> yeah... |
03:57:50 | FromDiscord | <eyes> thanks |
03:57:54 | FromDiscord | <eyes> game jam lol |
03:57:57 | FromDiscord | <eyes> i am tired |
03:59:51 | FromDiscord | <amadan> lol, understandable |
04:01:02 | * | ltriant joined #nim |
04:05:18 | * | ltriant quit (Ping timeout: 255 seconds) |
05:05:08 | NimEventer | New thread by ringabout: My Nim Development Weekly Report (2/26), see https://forum.nim-lang.org/t/9940 |
05:10:58 | FromDiscord | <Hourglass [She/Her]> Oh huh, that's cool |
05:11:51 | FromDiscord | <Hourglass [She/Her]> Is this a general clean up of the compiler code itself? Or just code that's user-facing |
05:12:55 | FromDiscord | <Hourglass [She/Her]> (User-facing meaning, stuff like fixing the push pragma) |
05:12:56 | FromDiscord | <ringabout> When I say "cleanups", It means trivial changes. I don't distinguish them. |
05:13:10 | FromDiscord | <Hourglass [She/Her]> Ah fair |
05:13:54 | FromDiscord | <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:47 | NimEventer | New 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:00 | FromDiscord | <sigmasd> Here is a plugin to easily add syntax highlighting for nvim (using ts) https://github.com/sigmaSd/nim-nvim-basic |
11:19:17 | FromDiscord | <sigmasd> If you know ts consider contributing to https://github.com/aMOPel/tree-sitter-nim |
11:22:57 | FromDiscord | <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:26 | FromDiscord | <sigmasd> no mine is not an improvement |
11:24:57 | FromDiscord | <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:35 | FromDiscord | <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:20 | FromDiscord | <sigmasd> sent a code paste, see https://play.nim-lang.org/#ix=4pfR |
11:34:20 | FromDiscord | <sigmasd> is that actually how it works ? |
11:42:41 | FromDiscord | <hotdog> In reply to @sigmasd "so If I add": No that’s not right |
11:42:48 | FromDiscord | <hotdog> What error are you getting? |
11:43:34 | FromDiscord | <amadan> What's your nimble version? |
11:43:58 | FromDiscord | <sigmasd> I tried to build https://github.com/nim-lang/langserver |
11:43:58 | FromDiscord | <sigmasd> and it failed becuase it didnt have faststreams |
11:43:59 | FromDiscord | <sigmasd> then I added it and it failed because it wonted its deps |
11:44:10 | FromDiscord | <sigmasd> nim 1.9.1 |
11:44:18 | FromDiscord | <sigmasd> [Edit](https://discord.com/channels/371759389889003530/371759389889003532/1079368229853593659): then I added it and it failed because it wanted its deps |
11:44:39 | FromDiscord | <amadan> Nimble mightn't be the lastest↵`nimble install --mm:refc nimble` |
11:46:21 | FromDiscord | <sigmasd> I was debugin this isssue btw, the langserver crashes, because didOpen receive a url with a newline at the end |
11:46:24 | FromDiscord | <sigmasd> image.png https://media.discordapp.net/attachments/371759389889003532/1079368834047291392/image.png |
11:46:37 | FromDiscord | <sigmasd> nvim obviosuly sends no newline, nimlangserver is adding it somewhere |
11:47:30 | FromDiscord | <sigmasd> oh wait nvm its just stderr.writeline, I'll just have to debug later I guess |
11:49:05 | FromDiscord | <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:43 | luis_ | 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:06 | FromDiscord | <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:47 | luis_ | thanks, will try that... |
14:09:52 | * | azimut joined #nim |
14:10:10 | FromDiscord | <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:58 | luis_ | auxym, emit works great, thanks |
14:15:28 | * | xet7 joined #nim |
14:16:48 | FromDiscord | <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:43 | FromDiscord | <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:23 | luis_ | 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:53 | FromDiscord | <auxym> In reply to @Isofruit "If you simply want": sure, I'll have a look, maybe that could work |
14:22:24 | FromDiscord | <auxym> otherwise I was thinking of using jsondoc and somehow generating sphinx stuff from that |
14:25:29 | FromDiscord | <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:27 | FromDiscord | <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:29 | FromDiscord | <Phil> In reply to @auxym "sure, I'll have a": Check out snorlogue , which does both |
14:27:16 | FromDiscord | <Phil> The setup with the workflow is mildly convoluted |
14:30:53 | FromDiscord | <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:07 | FromDiscord | <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:15 | FromDiscord | <auxym> sphinx btw |
14:35:39 | * | xet7 quit (Remote host closed the connection) |
14:39:59 | * | xet7 joined #nim |
14:57:23 | FromDiscord | <auxym> ? |
14:57:25 | FromDiscord | <auxym> sent a code paste, see https://play.nim-lang.org/#ix=4pgS |
15:02:14 | luis_ | Hi all, why do I get a illegal storage access error in the example: https://play.nim-lang.org/#ix=4ph6 |
15:03:48 | FromDiscord | <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:52 | FromDiscord | <auxym> maybe try importc instead of cdecl, though it doesn't work in playground |
15:07:07 | FromDiscord | <auxym> but really this use of emit is making me sad :S |
15:07:32 | FromDiscord | <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:36 | FromDiscord | <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:47 | FromDiscord | <Hourglass [She/Her]> Slightly modified version of your code: https://play.nim-lang.org/#ix=4ph6 |
15:27:58 | FromDiscord | <Hourglass [She/Her]> 'Ideal' code: https://play.nim-lang.org/#ix=4phf |
15:29:19 | FromDiscord | <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:06 | FromDiscord | <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:53 | FromDiscord | <ieltan> does nim have pattern matching ? |
15:38:18 | FromDiscord | <sigmasd> is there an api to check the latest version of a nimble program ? |
15:38:42 | FromDiscord | <Rika> In reply to @ieltan "does nim have pattern": yes... kind of |
15:39:06 | FromDiscord | <Rika> https://github.com/haxscramper/hmatching |
15:44:50 | * | arkurious joined #nim |
16:07:30 | FromDiscord | <sigmasd> langserver doesn't handle rootUri not being set in init request (its allowed by the spec) |
16:08:14 | FromDiscord | <sigmasd> also when it crashes it leaves the spawned nimsuggests as zombies |
16:08:48 | FromDiscord | <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:48 | FromDiscord | <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:01 | FromDiscord | <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:02 | FromDiscord | <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:32 | FromDiscord | <Rika> not that i know of, defects can always end your program |
16:22:33 | FromDiscord | <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:19 | FromDiscord | <Dudugz> sent a code paste, see https://play.nim-lang.org/#ix=4phu |
16:24:23 | FromDiscord | <Dudugz> (edit) "try~catch" => "try~except" |
16:28:35 | FromDiscord | <sigmasd> so does project usually wrap the main entry point with try catch and do cleanup there ? |
16:29:29 | FromDiscord | <sigmasd> anyhow that seems good enough↵(@Dudugz) |
16:30:26 | FromDiscord | <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:21 | FromDiscord | <Rika> please use CatchableError instead |
16:31:44 | FromDiscord | <Rika> Exception would be erroneous when switching between --panics:on and off |
16:35:13 | FromDiscord | <Dudugz> I didn't know, thanks |
16:49:02 | FromDiscord | <sigmasd> I guess i can just scarp it |
16:49:03 | FromDiscord | <sigmasd> the nimble directory simply uses github apis, and the site itself uses server rendering, so the answer is nope |
17:07:18 | FromDiscord | <sigmasd> does nimble keep no metadata about installed binaries ? |
17:07:42 | FromDiscord | <sigmasd> cargo keeps them in \~/.cargo/.crates.toml |
17:08:09 | FromDiscord | <sigmasd> in nimble case seems there is no way to leverage it to know current program versions to look for updates |
17:09:40 | FromDiscord | <sigmasd> image.png https://media.discordapp.net/attachments/371759389889003532/1079450186855747624/image.png |
17:09:46 | FromDiscord | <sigmasd> seems some bin are symlinks to under pkgs |
17:09:48 | FromDiscord | <sigmasd> that can be leverged |
17:09:50 | FromDiscord | <sigmasd> but the problem is some are not |
17:10:29 | FromDiscord | <sigmasd> maybe thats a new feature I'll try reinstalling |
17:10:49 | NimEventer | New 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:20 | FromDiscord | <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:07 | FromDiscord | <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:08 | FromDiscord | <sigmasd> deno does lot of things right |
17:13:02 | FromDiscord | <sigmasd> like how did programmers never think about `import url-dep` or `deno run url-program` |
17:13:38 | FromDiscord | <Dudugz> Idk, but you can also use deno install to install locally |
17:13:52 | FromDiscord | <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:10 | NimEventer | New 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:40 | FromDiscord | <sigmasd> Here is a program to update nim binaries installed through nimble |
18:17:40 | FromDiscord | <sigmasd> https://gist.github.com/sigmaSd/7b2630eeb0d8ca0bb237ffaa354d9f95 |
18:17:53 | FromDiscord | <sigmasd> run with `deno run https://gist.github.com/sigmaSd/7b2630eeb0d8ca0bb237ffaa354d9f95/raw/b5c419a1ef74eb27cad46e76837dfabe431f5208/nimup.ts` |
18:30:46 | FromDiscord | <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:09 | FromDiscord | <sigmasd> got to love chatgpt for these kind of tasks (get last github tag in javascript) |
18:41:12 | NimEventer | New 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:47 | FromDiscord | <sigmasd> done |
18:46:09 | FromDiscord | <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:52 | luis_ | 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:29 | FromDiscord | <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:30 | FromDiscord | <Hourglass [She/Her]> What's a decent name for a plugin loader in Nim? |
20:23:48 | FromDiscord | <Hourglass [She/Her]> (The plugin loader is generic on purpose so) |
20:26:40 | * | gastus_ joined #nim |
20:28:27 | gastus_ | 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:33 | gastus_ | cause that would put nim on same level as TypeScirpt maybe even beyond. |
20:28:47 | gastus_ | 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:51 | gastus_ | Something like Rust anonymous records ? |
20:29:41 | FromDiscord | <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:44 | FromDiscord | <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:03 | FromDiscord | <ali> nimLoader?↵(@Hourglass [She/Her]) |
20:30:12 | FromDiscord | <ali> (kind of like nimrod) |
20:30:46 | gastus_ | I am also tired of some limitations of TypeScript eg macros. |
20:30:56 | gastus_ | But I also honestly enjoy pyright when coding. |
20:30:58 | FromDiscord | <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:22 | FromDiscord | <Hourglass [She/Her]> My plugin loader is actually quite simple and flexible, which makes it doable |
20:31:29 | gastus_ | And just because TypeScript kinda sucks in some ways dosen't mean some ideas it introduced add value. |
20:31:38 | FromDiscord | <Hourglass [She/Her]> In reply to @sOkam! "gelo, genlo, gload, pluglo": Gelo is... Interesting |
20:31:38 | FromDiscord | <sOkam!> sent a code paste, see https://play.nim-lang.org/#ix=4piX |
20:32:52 | gastus_ | Looks like discord is the way to go :) |
20:33:29 | FromDiscord | <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:41 | FromDiscord | <Coachonko> Yeah come on discord |
20:34:25 | * | gastus_ left #nim (#nim) |
20:34:34 | FromDiscord | <virdisn> gastus_ is me. |
20:34:52 | FromDiscord | <virdisn> I know it would be too tough to ask somebody else to do the work. |
20:35:05 | FromDiscord | <virdisn> I just found that part of TypeScript that useful that I kinda miss it everywhere else. |
20:35:45 | FromDiscord | <virdisn> And typing in ts is like creating preprocessor which adds as Promise<Array<{name: string}>> and done. |
20:35:50 | FromDiscord | <Coachonko> Man I have a love/hate relationship with the js world. So many packages but such shitty tooling |
20:35:56 | FromDiscord | <virdisn> So wondering whether nim has either planned or already has something similar. |
20:36:20 | FromDiscord | <virdisn> Vite/ esbuild etc eventually try to fix it. |
20:36:47 | FromDiscord | <sOkam!> In reply to @virdisn "And typing in ts": `mixin` maybe? |
20:37:09 | FromDiscord | <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:39 | FromDiscord | <Coachonko> My lord, babel... |
20:37:57 | FromDiscord | <Coachonko> I even like the idea of babel, I just don't like that it has to exist |
20:38:18 | FromDiscord | <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:39 | FromDiscord | <Hourglass [She/Her]> In reply to @Coachonko "I even like the": Yeahh, that's JS for ya |
20:39:29 | FromDiscord | <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:56 | FromDiscord | <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:02 | FromDiscord | <virdisn> And even completion works then. |
20:40:10 | FromDiscord | <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:45 | FromDiscord | <Hourglass [She/Her]> In reply to @virdisn "<@186489007247589376> What I": Promise is asynchronous stuff right? |
20:43:17 | FromDiscord | <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:28 | FromDiscord | <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:32 | FromDiscord | <Hourglass [She/Her]> In reply to @virdisn "Yes, its not about": Aah |
20:43:46 | FromDiscord | <virdisn> JS world -> esbuild written in Go. Bable or such got rewritten in Rust. What I hate is having to switch languages. |
20:43:53 | FromDiscord | <Dudugz> In reply to @Hourglass, When the Hour Strikes "Promise is asynchronous stuff": yes, it's the same as Future in nim |
20:43:59 | FromDiscord | <virdisn> And relearn everything from scratch and all the detail.s |
20:44:32 | FromDiscord | <virdisn> https://github.com/launchbadge/sqlx -> checkout that compile time verification search for anonymous records. |
20:44:37 | FromDiscord | <virdisn> That's what I am talking about. |
20:44:56 | FromDiscord | <virdisn> But what if the row contains JSON/JSONP eg from PG and you know the structure ? Then you're lost again. |
20:45:04 | FromDiscord | <virdisn> That's why I want subtyping |
20:45:41 | FromDiscord | <virdisn> Another question: Is Nim a library itself? Thus is it possible to compile nim code at runtime and use it? |
20:45:45 | FromDiscord | <virdisn> Like eval ? |
20:46:16 | FromDiscord | <sOkam!> In reply to @virdisn "<@186489007247589376> What I": runtime or comptime? |
20:46:44 | FromDiscord | <sOkam!> macros run on the vm, but my understanding of the description sounded like runtime |
20:46:55 | FromDiscord | <virdisn> runtime. |
20:47:04 | FromDiscord | <Dudugz> sent a code paste, see https://play.nim-lang.org/#ix=4pj4 |
20:47:08 | FromDiscord | <sOkam!> then macros are not an option |
20:47:11 | FromDiscord | <virdisn> more like x = compilenim("code") then x() |
20:47:27 | FromDiscord | <sOkam!> if you can gen the code at runtime, then macros can be for that |
20:47:33 | FromDiscord | <sOkam!> sry comptime |
20:47:43 | FromDiscord | <sOkam!> (edit) "runtime," => "comptime," |
20:48:47 | * | arkurious quit (Ping timeout: 246 seconds) |
20:50:00 | FromDiscord | <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:20 | FromDiscord | <virdisn> So answer looks to be no for now. |
20:50:26 | FromDiscord | <Dudugz> sent a code paste, see https://play.nim-lang.org/#ix=4pj7 |
20:50:42 | FromDiscord | <virdisn> That's exactly what Haskell etc can do. |
20:50:49 | FromDiscord | <virdisn> And Java also can compile Java and load the packages. |
20:50:52 | FromDiscord | <Hourglass [She/Her]> You can import the compiler as a library |
20:50:57 | FromDiscord | <Hourglass [She/Her]> But it's not user friendly |
20:51:00 | FromDiscord | <Hourglass [She/Her]> At all |
20:51:02 | FromDiscord | <Dudugz> Hmm |
20:51:03 | FromDiscord | <sOkam!> that's what nimscripter does |
20:51:45 | FromDiscord | <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:02 | FromDiscord | <virdisn> Already checked out. That's using the VM. |
20:52:37 | FromDiscord | <virdisn> Nim and some libraries is such a freaking incredible nice piece of software. |
20:53:10 | FromDiscord | <virdisn> I tried looking at the mixin documentation. |
20:53:22 | FromDiscord | <virdisn> But I failed understanding it. Do you know any example code ? |
20:56:03 | FromDiscord | <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:07 | FromDiscord | <Hourglass [She/Her]> Sorry no, I don't understand mixins myself aha |
20:56:35 | FromDiscord | <sOkam!> but i don't know what promises are, so hence the `?` in the sentence 🙂 |
20:56:46 | FromDiscord | <sOkam!> (edit) "are," => "are in your example," |
20:56:47 | FromDiscord | <virdisn> Promises are something which calls then once the answer arrives. |
20:56:52 | FromDiscord | <virdisn> And the answer is either a result or a failure. |
20:57:02 | FromDiscord | <virdisn> That's why then has 2 methods to bec alled one for success one for failure. |
20:57:18 | FromDiscord | <virdisn> PRomise((succ, fail) => succ("foo")) wouldu resolve |
20:57:23 | FromDiscord | <sOkam!> oh, defo not mixin then |
20:57:26 | FromDiscord | <virdisn> Now the succ can be passed arround and resolve later. |
20:57:34 | FromDiscord | <sOkam!> are exceptions not fit for the task? |
20:58:07 | FromDiscord | <virdisn> So its fixing the callback hell of nested quer(SELECT, (failure, result) => { query(SELECT, (failure2, result2) => callback hell |
20:58:16 | FromDiscord | <virdisn> And because .then is still to annoying the async/await suggar was introduced. |
20:59:02 | FromDiscord | <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:26 | FromDiscord | <virdisn> sOkam: It's like asking 10 friends for help at the same time. |
20:59:29 | FromDiscord | <virdisn> So you have 10 future results. |
20:59:38 | FromDiscord | <virdisn> And once they arrive you can do something. |
21:00:02 | FromDiscord | <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:12 | FromDiscord | <virdisn> So yes awaiting something means other code will run in between. |
21:00:14 | FromDiscord | <sOkam!> sent a code paste, see https://paste.rs/8Bw |
21:00:57 | FromDiscord | <virdisn> If you want to understand promises you need to understand callback hell. Then you understand why they solve it. |
21:01:25 | FromDiscord | <virdisn> All the nice JS solutinos like waterfall etc are kinda obsolete by Promise.all([friend1, friend2].map(askfriend)) |
21:01:34 | FromDiscord | <virdisn> Or Promise.race to get the first reply noly. |
21:02:01 | * | arkurious joined #nim |
21:02:14 | FromDiscord | <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:38 | FromDiscord | <virdisn> And it can be chained like query.then((result) => process_result_on_other_server(result)).then( console.log) |
21:04:15 | FromDiscord | <sOkam!> sent a code paste, see https://play.nim-lang.org/#ix=4pjb |
21:04:18 | Zevv | or use CPS so you can just do `result = query(); process_result_on_other_server(result); console.log();` |
21:04:46 | FromDiscord | <sOkam!> (edit) "https://play.nim-lang.org/#ix=4pjb" => "https://play.nim-lang.org/#ix=4pjc" |
21:07:27 | FromDiscord | <virdisn> @sOkam! Do those friends get asked at the same time in parallel ? |
21:07:53 | FromDiscord | <sOkam!> i don't know multithreading |
21:08:07 | FromDiscord | <sOkam!> i imagine you could, but ymmv |
21:08:08 | FromDiscord | <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:20 | FromDiscord | <virdisn> Promise.all() callects and waits for all. |
21:08:23 | FromDiscord | <virdisn> Its not realy multithreading. |
21:08:44 | FromDiscord | <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:34 | FromDiscord | <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:05 | FromDiscord | <virdisn> But the result of forwarding a task to other thread is a future result which can be done by Promise. |
21:10:27 | FromDiscord | <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:47 | NimEventer | New 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:03 | FromDiscord | <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:27 | FromDiscord | <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:27 | FromDiscord | <sOkam!> Is there a default iterator for all fields of an `object`? |
22:37:20 | FromDiscord | <amadan> There is `fields` https://nim-lang.org/docs/iterators.html#fields.i%2CT |
22:43:50 | FromDiscord | <sOkam!> handy, ty |
22:58:53 | FromDiscord | <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:09 | FromDiscord | <Elegantbeef> Nimscripter makes it easier, but one can just use Nim as a library |
23:00:09 | FromDiscord | <Elegantbeef> Yea nimscript can do this↵(@Dudugz) |
23:02:37 | * | Guest39776 joined #nim |
23:03:26 | * | Guest39776 quit (Client Quit) |
23:08:13 | FromDiscord | <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:06 | FromDiscord | <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:09 | FromDiscord | <auxym> https://nim-lang.org/docs/lib.html |
23:19:24 | FromDiscord | <Elegantbeef> @auxym\: https://github.com/nim-lang/Nim/blob/devel/config/nimdoc.cfg#L135 |
23:26:38 | FromDiscord | <Elegantbeef> As an aside it does always amuse me how bad github search is |
23:56:56 | FromDiscord | <tfp> https://media.discordapp.net/attachments/371759389889003532/1079552677870063636/image.png |
23:57:02 | FromDiscord | <tfp> so the issue here on line "4" down there |
23:57:12 | FromDiscord | <tfp> it's using the "beginFrame" from the outer scope |
23:57:25 | FromDiscord | <tfp> is this expected? |
23:59:34 | FromDiscord | <Elegantbeef> No clue but you probably can do `(proc(): float)(beginFrame).rawProc` |