<< 16-12-2023 >>

00:11:42*Mister_Magister quit (Ping timeout: 256 seconds)
00:15:37*Mister_Magister joined #nim
00:16:15FromDiscord<unquietwiki> Hey, there's a Discord outage spreading on some servers. https://discordstatus.com/ Just a heads up. ❗
00:16:55FromDiscord<Elegantbeef> Oh noes!
00:17:12FromDiscord<unquietwiki> In reply to @Elegantbeef "Oh noes!": Yeah, at least a third of the servers I'm on are offline.
00:17:58FromDiscord<unquietwiki> In reply to @unquietwiki "Hey, there's a Discord": Might be coming back online, but this stuff apparently was starting around 2 my time. So who knows.
00:18:18FromDiscord<Elegantbeef> Centralisation is da poop 😛
00:25:33FromDiscord<unquietwiki> In reply to @Elegantbeef "Centralisation is da poop": Kinda hard to avoid sometimes. I was looking at a Mesh-routing Wireguard manager written in Go; curious if something like that exists for Nim.
02:21:25*krux02 quit (Remote host closed the connection)
03:41:30*edr quit (Quit: Leaving)
04:28:07FromDiscord<cy_tek> Hi all, I'm trying to setup VsCode on Windows with the nimlangserver because Vulkan autocompletions aren't working at all with the regular nimlsp. When I try this though after installing the application, I get the following error `could not load pcre64.dll`. Any ideas how to install this lib or know where I should add it to my path?
04:28:34FromDiscord<Marko Zima> Hello everyone, I'm a senior web developer. I'm happy to join this room first. I'd like to learn about Nim. Help me.
04:49:14FromDiscord<dedraiaken> Anyone know where the compiler handles the CC target? I'm trying to get the new cosmopolitan GCC (cosmocc) working with nim.cfg, but on Windows it appends .exe to the compiler executable name, which causes Windows to invoke it improperly.
04:52:00NimEventerNew thread by aiac: What is the difference between std/atomics and threading/atomics, which one is recommended?, see https://forum.nim-lang.org/t/10771
05:01:15*azimut quit (Remote host closed the connection)
05:01:49*azimut joined #nim
05:03:19FromDiscord<dedraiaken> In reply to @dedraiaken "Anyone know where the": I think I may have found it actually.
05:34:53FromDiscord<gyatsoyt> In reply to @graveflo "yea its the "checking": So I setup a position on the board through a number of moves where en passant is possible and then I try to play it and it doesn't works
05:36:07FromDiscord<michaelb.eth> In reply to @Marko Zima "Hello everyone, I'm a": what would you like to know?
05:38:17FromDiscord<michaelb.eth> In reply to @cy_tek "Hi all, I'm trying": `pcre64.dll` is a DLL (along with several others) that's included with the Nim/tools distribution for Windows that can be downloaded from nim-lang.org↵↵Apparently it's not available in PATH when VSCode is launched
05:43:05FromDiscord<michaelb.eth> whoops, @cy_tek, I read to quickly, now see you asked specifically about adding to PATH. For Windows, that's in Advanced system settings
05:46:14*eery quit (Ping timeout: 252 seconds)
05:47:58*eery joined #nim
06:08:23*antranigv quit (Ping timeout: 264 seconds)
06:15:35*antranigv joined #nim
07:06:45FromDiscord<eebahn> Has anyone used `treeform/chrono`?
07:07:16FromDiscord<eebahn> I cannot find how to get it to give me the same as `std/times.now()`
07:11:22FromDiscord<odexine> why do you need it to give you the same results as times now?
07:11:45FromDiscord<odexine> what do you mean by that as well
07:16:09FromDiscord<eebahn> sent a code paste, see https://play.nim-lang.org/#ix=html>
07:16:18FromDiscord<eebahn> (edit)
07:17:16FromDiscord<eebahn> I'm creating a scheduling app, but I don't know how to create a schedule without having some way to reference the current time
07:17:29FromDiscord<eebahn> (edit) "I'm creating a scheduling app, but I don't know how to create a schedule without having some way to reference the current time ... " added "at runtime when the app is run"
07:17:34FromDiscord<eebahn> (edit) removed "when the app is run"
07:18:26FromDiscord<eebahn> I could just use `std/times` but I figured if treeform made chrono he must have had a good reason, and so far his libs have been really useful in general
07:21:37FromDiscord<JJ> i don't see anything in the chrono docs about getting the current time. i suspect he made it because parsing dates and converting between them is a hard problem?
07:21:54FromDiscord<JJ> there's a good chance you could parse the output of `std.times.now()` with it
07:22:25FromDiscord<eebahn> was trying that currently, but haven't found how yet
07:30:29FromDiscord<eebahn> sent a code paste, see https://play.nim-lang.org/#ix=html>
07:30:46FromDiscord<eebahn> (edit)
08:33:55NimEventerNew thread by aiac: Error occurred when add thread to seq, see https://forum.nim-lang.org/t/10772
08:51:33FromDiscord<TӨMΛ ☠> sent a code paste, see https://play.nim-lang.org/#ix=html>
08:52:32FromDiscord<TӨMΛ ☠> (edit)
08:53:00FromDiscord<TӨMΛ ☠> (edit)
08:53:06FromDiscord<TӨMΛ ☠> (edit)
08:54:28FromDiscord<eebahn> In reply to @toma400 "How one can iterate": `for example in k.mitems: ...`
08:54:45FromDiscord<eebahn> For reference, `for example in k` == `for example in k.items`
08:55:34FromDiscord<TӨMΛ ☠> Ooh, totally forgot `mitems` exist, thank you ❤️
09:02:54FromDiscord<Phil> sent a long message, see <!doctype html>
09:03:17*junaid_ joined #nim
09:05:11FromDiscord<Phil> Meanwhile both Araq and jtv write of their solutions and I just don't get them the longer I stare at them, or rather I don't see how they'd be implemented without going into the weeds and interacting with the OS directly which imo an application should not do for portability
09:09:50FromDiscord<gyatsoyt> sent a code paste, see https://play.nim-lang.org/#ix=html>
09:11:04FromDiscord<Phil> Write yourself procs with names that represent what individual moves mean, I aint debugging your business logic for you 😄
09:11:16FromDiscord<Phil> (edit) "moves" => "pieces of your code"
09:15:21FromDiscord<Phil> The first if-condition could be split up into 1-2 procs to check for individual things (e.g. square.hasFigure(blackPawn))
09:20:46*jmdaemon quit (Ping timeout: 246 seconds)
09:22:25FromDiscord<demotomohiro> sent a code paste, see https://play.nim-lang.org/#ix=html>
09:23:59FromDiscord<Phil> Where is it determined which config files nim pulls in for a nimble task?
09:25:31FromDiscord<Phil> sent a code paste, see https://play.nim-lang.org/#ix=html>
09:33:25FromDiscord<demotomohiro> I think these config files are read by Nim compiler that is called by nimble.↵https://nim-lang.org/docs/nimc.html#compiler-usage-configuration-files↵https://nim-lang.org/docs/nims.html
09:36:12FromDiscord<demotomohiro> Maybe your system has mulitple Nim compilers (installed by choosenim and package manager).↵And different Nim compiler is called by VScode and tasks.json.
10:15:35*krux02 joined #nim
10:19:50FromDiscord<Phil> Arrrrrgh
10:20:00FromDiscord<Phil> I have a nim compiler under /usr/bin/bin
10:20:02FromDiscord<Phil> (edit) "/usr/bin/bin" => "/usr/bin/nim"
10:20:06FromDiscord<Phil> That's what vscode was using
10:20:29FromDiscord<Phil> While my terminal uses /home/<user>/.nimble/bin/nim
10:22:51FromDiscord<Phil> How to tell vscode to user the other compiler is now the real question
10:25:56FromDiscord<odexine> depending on how vscode is running the binaries, either make it read a new path or somehow fix/change the code of whatever is running the binaries
10:26:10FromDiscord<odexine> usually the path is all you need to change
10:26:29FromDiscord<odexine> the thing is that you have to figure out how its reading the path
10:26:42FromDiscord<odexine> path as in the PATH env. var.
10:31:28FromDiscord<Phil> Okay that is so stupid. So spawning vscode from terminal get it to use the right path.↵Spawning it from the applauncher causes it to use whatever the hell
10:40:27FromDiscord<nnsee> In reply to @isofruit "Okay that is so": probably because you set your PATH in your shell's rc file. Since the app launcher never runs your shell, the rc isn't executed and the path isn't set correctly
10:44:01FromDiscord<Phil> I mean that is entirely correct, I would have assumed that to be such a wide-spread pattern that a dev-tool would know about it and attempt to read that in
10:45:16FromDiscord<odexine> In reply to @isofruit "Okay that is so": Sounds like the path thing then
10:45:55FromDiscord<Phil> sent a code paste, see https://play.nim-lang.org/#ix=html>
10:45:57FromDiscord<odexine> In reply to @isofruit "I mean that is": That would require assumptions on how the dev wants it set up which would probably break another kind of workflow
10:47:42FromDiscord<Phil> Would've loved to set that somehow to automatically what is in my .zshrc to future-proof this, but I guess that's too much to ask
11:05:39FromDiscord<odexine> well then wouldnt vscode then need to know what shells youre using
11:05:46FromDiscord<odexine> rather, support many shells for that
11:08:44FromDiscord<Phil> I'll concede that point even though I think it really wouldn't be crazy hard to just maintain a list of top 10 shells, where they store their rc files and check for those.↵But being able to specify "load this rc file for your terminal" would be neat
11:12:22FromDiscord<odexine> "where they store their rc files" then you break custom installs
11:12:38FromDiscord<odexine> or i guess a config form could be made
11:12:48FromDiscord<odexine> but that sounds like a lot of work just to load a path variable
11:20:46*junaid_ quit (Remote host closed the connection)
11:22:58FromDiscord<Phil> More like an entire environment, you'd also get access to alias & co in your terminal, the idea would be to make it identical to your shell environment to avoid surprises
11:30:12FromDiscord<Phil> Now to find out why import paths on individual files I compile docs for are incorrect
11:34:38FromDiscord<System64 ~ Flandre Scarlet> I have a question↵In a 8:8 fixed point number↵↵If I have 123.255 and I add 0.001, would I end up with 124.000?
11:39:21FromDiscord<odexine> is this base 10? thats not how those work no
11:45:38FromDiscord<System64 ~ Flandre Scarlet> In reply to @odexine "is this base 10?": It's base 2
11:46:52FromDiscord<odexine> 01111011.11111111 plus 0.00000001 would indeed be 01111100.0
11:47:09FromDiscord<odexine> (edit) "01111011.11111111" => "01111011.1111_1111" | "0.00000001" => "0.0000_0001" | "01111100.0" => "0111_1100.0"
11:47:12FromDiscord<odexine> (edit) "01111011.1111_1111" => "0111_1011.1111_1111"
11:58:15FromDiscord<piqueiras> is this like, done well?↵↵template '[]'[T](matrix: seq[seq[T]], idx: array[2, int]): T =↵ matrix[idx[0]][idx[1]]
11:59:01FromDiscord<intellij_gamer> sent a code paste, see https://play.nim-lang.org/#ix=html>
11:59:14FromDiscord<intellij_gamer> (edit)
11:59:44FromDiscord<demotomohiro> !eval import strformat; for i in 0 .. 7: echo &"{1 shl i:08b}: {1.0 / float(1 shl (8 - i))}"
11:59:49NimBotCompile failed: 00000001: 0.00390625↵00000010: 0.0078125↵00000100: 0.015625↵00001000: 0.03125↵00010000: 0.0625↵00100000: 0.125↵01000000: 0.25↵10000000: 0.5
11:59:50FromDiscord<piqueiras> well I already had a `type Coords = array[2,int]` thing xdd
12:00:34FromDiscord<intellij_gamer> In reply to @piqueiras "well I already had": Ah I see, nvm then lol
12:00:51FromDiscord<piqueiras> I mean I am new to templates and such lmfaoo
12:01:00FromDiscord<demotomohiro> In reply to @NimBot "Compile failed: 00000001: 0.00390625↵00000010:": x:8 fix point number cannot represent 0.001
12:01:09FromDiscord<piqueiras> Im scared to even do some [] replacement
12:01:43FromDiscord<demotomohiro> (edit) "In reply to @NimBot "Compile failed: 00000001: 0.00390625↵00000010:": x:8 fix point number cannot represent 0.001 ... " added "in base10"
12:02:18FromDiscord<piqueiras> How to do []= then, var matrix?
12:03:05FromDiscord<piqueiras> sent a code paste, see https://play.nim-lang.org/#ix=html>
12:03:07FromDiscord<piqueiras> looks like it
12:05:03FromDiscord<demotomohiro> In reply to @piqueiras "Im scared to even": There is sample code in Nim manual:↵https://nim-lang.org/docs/manual.html#importcpp-pragma-importcpp-for-objects
12:07:10FromDiscord<piqueiras> huh thats c++ thing?
12:08:05FromDiscord<piqueiras> well anyways I managed
12:09:19FromDiscord<demotomohiro> I just opened Nim manual, ctrl+f and searched '[]='
12:11:11FromDiscord<demotomohiro> There are also many `[]=` procs in system module: https://nim-lang.org/docs/system.html#%5B%5D%3D%2Cstring%2CBackwardsIndex%2Cchar
12:11:23FromDiscord<piqueiras> yea but I wanted to try template
12:12:00FromDiscord<Zoom> Welcome to multithreading!↵(@Phil)
12:12:44FromDiscord<Phil> In reply to @Zoom "Welcome to multithreading! (<@180601887916163073>)": Where everyone has different ideas and nobody understand the ideas of the other person?
12:13:13FromDiscord<Zoom> What you describe reads like a basic pool. But you're definitely gloss over some synchronization gotcha.
12:13:50FromDiscord<Phil> Btw. thanks for the review, helped with building some better understanding
12:14:49FromDiscord<Phil> In reply to @Zoom "What you describe reads": I mean kinda, the thing is every "task-based" approach that I see anywhere causes me to run something blocking in my gui-thread (like joinThread... basically I think it's always joinThread)
12:15:33FromDiscord<Phil> it's always joinThread under the hood
12:16:25FromDiscord<Phil> Which makes no sense to me because I'd want to spawn that runs stuff precisely because I don't want to block my GUI thread
12:16:47FromDiscord<Phil> want to spawn threads
12:19:48FromDiscord<System64 ~ Flandre Scarlet> In reply to @odexine "0111_1011.1111_1111 plus 0.0000_0001 would": And what if it is signed?
12:20:35NimEventerNew thread by Isofruit: How to correctly use nim doc when a project has unimported modules, see https://forum.nim-lang.org/t/10773
12:21:05FromDiscord<piqueiras> So if you have a collection the only way to remove elements from it while iterating is a while loop rigth
12:21:41FromDiscord<Phil> Only way I can think of at least
12:22:15FromDiscord<piqueiras> Unless there was some magic macro
12:22:29FromDiscord<piqueiras> not me asking chatgpt (outdated nim 1.4 or sth) https://media.discordapp.net/attachments/371759389889003532/1185557561651515482/image.png?ex=65900b85&is=657d9685&hm=ee40b4de9c1939754ecb33c3af32bcb939cc9c69c337a1023712147bd1120d7a&
12:23:12FromDiscord<piqueiras> bro does not compile https://media.discordapp.net/attachments/371759389889003532/1185557736084213801/image.png?ex=65900bae&is=657d96ae&hm=872ef37bf0ba72f2cf07d33838bd54006a1078189e2874f1b4935312f0318def&
12:24:47FromDiscord<piqueiras> I guess I could use filter...?
12:29:04*end quit (Quit: end)
12:29:04*bcksl quit (Quit: \)
12:36:29FromDiscord<odexine> In reply to @sys64 "And what if it": same thing, 0111_1011 or 0111_1100 are both still positive
12:46:08*bcksl joined #nim
12:46:58FromDiscord<System64 ~ Flandre Scarlet> In reply to @odexine "same thing, 0111_1011 or": And if it's negative?
12:47:57FromDiscord<odexine> then it would be `1_111_1100` and `1_111_1101`; refer to two's complement
12:48:15FromDiscord<odexine> fixed point math works exactly the same to integer math IIRC
12:53:28*end joined #nim
12:55:30FromDiscord<System64 ~ Flandre Scarlet> In reply to @odexine "fixed point math works": I doubt it would work here https://media.discordapp.net/attachments/371759389889003532/1185565865832349776/image.png?ex=65901341&is=657d9e41&hm=b2649bdc36974aa4a61b28c61ec6a66053b454e35e46258ed1a22d5c96058103&
12:55:45FromDiscord<odexine> why?
12:57:25FromDiscord<System64 ~ Flandre Scarlet> that means you have 0xFF as integer part and 1000_0001 as fractionnal part
12:58:41FromDiscord<odexine> `0.0 - 0_111_1111.0 = 0.0 + 1_000_001.0 = 1_000_0001.0` given Q7.n (arbitrary decimal bit count)
12:58:52FromDiscord<odexine> you'll have to do it manually though
13:01:54FromDiscord<odexine> well i guess that's not equivalent completely to integer values
13:02:04FromDiscord<odexine> as the latter 8 bits are not subject to twos complement
13:02:38FromDiscord<odexine> let me think about this; for reference i've never dealt with signed fixed point, its gonna be fun to reason about this for a moment w/o any references
13:03:58FromDiscord<System64 ~ Flandre Scarlet> If you want more context, I want to make a synth with 8:8 fixed point↵↵Samples are signed 8 bits↵Phase accumulator is unsigned 8:8 fixed point
13:05:52FromDiscord<System64 ~ Flandre Scarlet> the decimal part is used for interpolation
13:07:20*mahlon quit (Ping timeout: 252 seconds)
13:09:29*mahlon joined #nim
13:16:42FromDiscord<odexine> seems actually that `- 0_111_1111.0` would still be `1_000_0001.0000_0000` in Q7.8 or Q7.n yeah, i forgot a bit
13:17:07FromDiscord<odexine> so yes it's still just regular integer math
13:17:26FromDiscord<_goel_> Std `parseutils` doesn't have `parseBool`?
13:31:41FromDiscord<graveflo> In reply to @_goel_ "Std `parseutils` doesn't have": https://nim-lang.org/docs/strutils.html#parseBool%2Cstring↵this?
13:45:39FromDiscord<odexine> that's from strutils
13:54:15FromDiscord<Chronos [She/Her]> I just had a thought... Why don't I just, make a fork of Nim's stdlib and then modify it to be more ideal for me
13:54:40FromDiscord<Chronos [She/Her]> (For example, using `Option` types, using `uint` instead of `int` everywhere)
13:54:56FromDiscord<Chronos [She/Her]> That's the only two changes I have in mind rn lol
14:03:58FromDiscord<Phil> Because then you also get to maintain it, new features in std-lib mean work for you
14:04:10FromDiscord<Phil> (edit) "Because then you also get to maintain it, new features in std-lib mean work for you ... " added "if you want to also have them"
14:06:21FromDiscord<odexine> why use uint over int?
14:08:22FromDiscord<Zoom> I'm not sure what the problem is exactly, you join the threads on completion, if it's still runnning why would you? If you want to create short-lived threads to manipulate the GUI, then the question is why not a single long-living thread instead?↵(@Phil)
14:09:53FromDiscord<Phil> In reply to @Zoom "I'm not sure what": The idea is to have the UI-thread stay reactive under any circumstance. That means the main loop may not ever be blocked for anything significant amount of time.↵It needs to be able to react to the next user input (e.g. next button click), not block until some HTTP request finishes
14:10:37FromDiscord<Zoom> Ideally, std lib has to have overloads working with Option, if you make a proper RFC with a plan of a consistent API I think many people can get behind it↵(@Chronos [She/Her])
14:10:41FromDiscord<Phil> My current impression of joinThreads is that your current thread stops, aka so does the while loop and thus the threads ability to react to user ipnut
14:11:03FromDiscord<Phil> the GUI while loop
14:11:54FromDiscord<Zoom> So, create a GUI thread and make it receive messages from threads doing blocking stuff, like IO?↵(@Phil)
14:12:17FromDiscord<Zoom> [Edit](https://discord.com/channels/371759389889003530/371759389889003532/1185584772009967616): Ideally, std lib has to have overloads working with Option, if you'll make a proper RFC with a plan of a consistent API I think many people can get behind it
14:12:26FromDiscord<Phil> Yeah the thing is that would require me to be able to spawn a thread and not ever have to joinThread it no? That is the thing I never managed to get working
14:15:12FromDiscord<Phil> Any examples I see anywhere for the paradigm of "spawn a thread to do a one-off task" use something like "awaitAll" or the like (Malebolgia), "exit" (Weave) or directly calling joinThread (nim generally).↵↵Any attempts at not blocking my GUI threads with joinThread or the like typically lead to segfaults
14:17:01FromDiscord<Phil> In a perfect world I can spawn a thread, hand it a channel and just listen on the channel as part of my GUI while-loop if that other channel ever sent a message back
14:17:45FromDiscord<Phil> Which I can do with long-running threads that I joinThread eventually, but not with threads whose lifetime is supposed to be like 3s
14:17:59FromDiscord<Phil> (edit) "eventually," => "eventually after the while-loop of my GUI thread,"
14:20:24FromDiscord<Chronos [She/Her]> In reply to @odexine "why use uint over": Why use int instead of uint? Lists don't have -1 indexes aha
14:21:02FromDiscord<Chronos [She/Her]> In reply to @Zoom "Ideally, std lib *has*": I wouldn't be able to do that, imo, I lack a consistent stream of energy + time
14:21:34FromDiscord<Chronos [She/Her]> If you've seen how much I switch between projects, you'd know :P
14:39:11FromDiscord<Zoom> Believe in yourself!↵(@Chronos [She/Her])
14:40:03FromDiscord<Chronos [She/Her]> Belief doesn't work when I physically happened
14:58:38FromDiscord<piqueiras> Only way to add an element to a seq at a position is include from sequtils?
15:01:32FromDiscord<piqueiras> wait theres one in sys
15:24:12FromDiscord<rakgew> I was wondering what would be a good way about the following\:↵interact with a waveshare e\_paper display connected to raspi from nim 2.0.0? it works well with some python scripts I have written, the c examples from their repo work fine as well. but now I would like to use it from nim.↵ideally all pure nime code, so c2nim? or is futhark the better approach?
15:29:53FromDiscord<demotomohiro> In reply to @chronos.vitaqua "Why use int instead": Nim uses int type for anything represents integer number even if it doesn't go negative:↵https://internet-of-tomohiro.netlify.app/nim/faq.en.html#language-design-why-are-unsigned-types-discouragedqmark
15:44:57*koltrast quit (Ping timeout: 256 seconds)
16:03:42FromDiscord<odexine> In reply to @chronos.vitaqua "Why use int instead": arrays can have -1 indices
16:04:11FromDiscord<odexine> and they fall under openarray so you might have a problem there in some sense
16:04:31FromDiscord<odexine> raises a good qn what does find return when the index range is negative too
16:05:30*koltrast joined #nim
16:22:45FromDiscord<graveflo> In reply to @rakgew "I was wondering what": They both work. I'd suggest futhark. Often its just as well, or better, to write the wrapper manually. Both c2nim and futhark often require finagling and finishing to get something up to scratch anyway. When I use those tools it's typically just to help save some time and I use copy/paste a lot
16:33:16FromDiscord<griffith1deadly> In reply to @isofruit "Any examples I see": what about std/selectors and user-event inside?
16:33:44FromDiscord<Phil> Can't say I tried
16:33:48FromDiscord<Phil> Or knew of even
16:34:41FromDiscord<griffith1deadly> selectors is non-blocking io as i know
16:34:43FromDiscord<Phil> And reading the module docs I don't understand usage either
16:35:07FromDiscord<griffith1deadly> In reply to @isofruit "And reading the module": same, but you always can look inside httpx for examples
16:35:52FromDiscord<griffith1deadly> i use this for minecraft server socket handling
16:38:57FromDiscord<rakgew> thank you for the feedback! I will give it a go with both approaches then.↵(@graveflo)
16:46:55*azimut quit (Ping timeout: 240 seconds)
16:46:55*azimut_ joined #nim
17:03:56FromDiscord<Shubham Verma> Hi friends, I am new in this room, happy to connect with you all
17:08:57FromDiscord<rakgew> welcome! \:-D
17:09:17FromDiscord<Shubham Verma> what is Nim programming language?
17:10:19FromDiscord<exelotl> it's like if Python and Pascal had a baby, and the baby had Lisp superpowers
17:12:17FromDiscord<Chronos [She/Her]> In reply to @demotomohiro "Nim uses int type": Yeah I know Nim does, but it's something that seems odd imo
17:13:03FromDiscord<Chronos [She/Her]> In reply to @odexine "and they fall under": I wonder if concepts could work for this tbh
17:13:22FromDiscord<Chronos [She/Her]> In reply to @chronos.vitaqua "Yeah I know Nim": Though, reading the website you sent, I can also see why int is used instead
17:14:30FromDiscord<Chronos [She/Her]> Rust seems to mitigate the issue of C implicitly casting it, and Nim does have compiler checks iirc, so
17:55:56Amun-Raints have overflows, uint don't
19:20:25FromDiscord<Chronos [She/Her]> Ah
19:24:31*azimut_ quit (Ping timeout: 240 seconds)
19:35:59*azimut joined #nim
20:21:43*azimut quit (Ping timeout: 240 seconds)
20:39:46FromDiscord<Phil> sent a code paste, see https://play.nim-lang.org/#ix=html>
20:41:17FromDiscord<Elegantbeef> `poll` will finish all futures that are ready
20:42:51FromDiscord<Elegantbeef> So you have \~500ms due to the default timeout of `poll`
20:43:06FromDiscord<Phil> So its not that that poll takes one "unit of work" and executes it, it does as many units of work as it can inside the timeout it is given
20:44:00FromDiscord<Elegantbeef> Right when you create a future and use `await` or hold onto it it adds it to the dispatcher, when you use `await` `waitfor` `poll` `drain` or any other method of giving up your CPU it will run all callbacks for any futures that finished
20:46:11FromDiscord<Phil> Hah, you were faster than I was, was about to look at the docs for drain again to see the difference
20:46:51FromDiscord<Phil> No wait, drain processes as many events as it can, poll only one, no?
20:47:11FromDiscord<Phil> Based on this line of the docs:↵> In contrast to poll this processes as many events as are available until the timeout has elapsed.
20:47:12FromDiscord<Elegantbeef> poll only completes those that are ready at the callsite, drain proccess all as they finish
20:47:44FromDiscord<Elegantbeef> So if you have a callback that takes 1ms you can finish any futures that take less than around 499ms
20:48:36FromDiscord<Elegantbeef> image.png https://media.discordapp.net/attachments/371759389889003532/1185684929661636608/image.png?ex=65908224&is=657e0d24&hm=2b9a246eb477c07ad7c2c57d468f5e1932cb2ebcd866fa30d37c3c97eea20475&
20:48:56FromDiscord<Elegantbeef> See drain has a while loop that calculates as it goes, poll just fires once
20:49:10FromDiscord<Phil> But say a future takes 200ms and the callback to execute after it returns takes 301ms.↵Poll only lasts 500ms, will it overstate its mandate?
20:50:15FromDiscord<Elegantbeef> Read the docs for Epoll/kqueue
20:51:09FromDiscord<Phil> I dunno why but epoll kqueue are still in the area of scary OS topics that I've got classified as "Too high for me still"
20:51:14FromDiscord<Elegantbeef> They cannot know how long your callback will take so if the future is ready at the callsite it yields
20:51:36FromDiscord<Elegantbeef> Otherwise you have to wait for another CPU sharing operation
20:52:01FromDiscord<Elegantbeef> At least as far as I know
20:52:06*krux02 quit (Remote host closed the connection)
20:52:15FromDiscord<Phil> Okay that feels like a general fundamentals topic, did you learn that over time, during CompSci or any specific material you'd recommend?
20:52:26FromDiscord<Elegantbeef> "During compsci"?
20:52:33FromDiscord<Phil> computer science classes
20:53:02FromDiscord<Phil> Which at this point I just assume you had ^^'
20:53:06FromDiscord<Elegantbeef> I do not have any post secondary education Phil, we've gone over this
20:53:34FromDiscord<Phil> Sometimes that's just really hard to believe
20:53:34FromDiscord<Elegantbeef> I got this knowledge overtime and RTFMing!
20:53:36FromDiscord<michaelb.eth> sent a long message, see <!doctype html>
20:53:50FromDiscord<Elegantbeef> Yes both use closures
20:54:13FromDiscord<Elegantbeef> But that does not really matter here
20:54:24FromDiscord<Phil> So is... async and CPS both share this version of "transforming a proc" and "execute in steps" but with different syntax?
20:54:31FromDiscord<Phil> Because that all sounds reminiscent of CPS
20:54:36FromDiscord<Elegantbeef> That's an implementation detail when talking about why the above happens the way it does
20:54:37FromDiscord<Phil> The entire "execute in steps" bit
20:54:43FromDiscord<Elegantbeef> I mean it's all CPU sharing
20:55:29FromDiscord<Elegantbeef> In async legs are denoted with `await` or `poll` or `drain` .... in CPS it's an explicit operation with your own 'yield' procedure
20:56:49FromDiscord<Elegantbeef> It's the same basic principle everywhere you go. You have a procedure that you want to be resumable, which means you need to have a place to give up the CPU to do other things, and you need an environment to recover where you are. As such you either get something like CPS' Continuation, or a `closure`'s hidden `Environment`
20:59:10FromDiscord<Elegantbeef> https://rust-lang.github.io/async-book/06_multiple_futures/01_chapter.html sounds familiar 😄
21:13:31FromDiscord<guttural666> how do I access all this unhandled exception stuff so I can dump all that text in a file in my main thread? https://media.discordapp.net/attachments/371759389889003532/1185691195763064972/image.png?ex=659087fa&is=657e12fa&hm=34b5f2531113ca1cf65d079f00373af91929d06de2bb3433e34c8acc18c903f6&
21:13:59FromDiscord<Elegantbeef> Using a try except
21:14:08FromDiscord<guttural666> and how do I get that text?
21:14:17FromDiscord<Elegantbeef> The message of the exception
21:14:22FromDiscord<guttural666> nice, thanks
21:14:33FromDiscord<Elegantbeef> sent a code paste, see https://play.nim-lang.org/#ix=html>
21:14:49FromDiscord<Elegantbeef> `Exception` should technically be `CatchableError` but meh
21:15:00FromDiscord<Elegantbeef> Also your thread procs should be marked `raises: []`
21:17:24FromDiscord<guttural666> yeah, testing what all my stuff can throw and trying to handle it locally first, but anything unexpected should just be dumped for review
21:24:41FromDiscord<Elegantbeef> Just never do `try: ... except: discard`
21:25:00FromDiscord<Elegantbeef> Always do something with the error else you'll be staring at code for ten thousand years
21:33:25FromDiscord<guttural666> any way to read the last stdout messages?
21:33:30FromDiscord<Phil> In reply to @Elegantbeef "`Exception` should technically be": Ever since I learned that catching "Exception" instead of CatchableError also catches defects I've been scared of doing it
21:34:33FromDiscord<Elegantbeef> Yea `--panics:off` is a horrendous default
21:35:37FromDiscord<Phil> It's also one of those gotchas you never expect until they bite you
21:35:59FromDiscord<Phil> like how in JS arrow functions have a different meaning of `this` than normal functions
21:36:26FromDiscord<guttural666> Exceptions will catch everything right, so I'm good?
21:36:39FromDiscord<Elegantbeef> No
21:36:42FromDiscord<Elegantbeef> You want defects to crash
21:36:44FromDiscord<Phil> It will catch so much stuff it will even catch things it really shouldn't
21:37:11FromDiscord<guttural666> yeah but I want to log anything that could go wrong that I haven't already handled locally
21:37:35FromDiscord<guttural666> anything that crashes the program and would output something to stdout
21:37:41FromDiscord<Phil> sent a code paste, see https://play.nim-lang.org/#ix=html>
21:38:23FromDiscord<guttural666> it should, but I also want to log that ^^
21:38:52FromDiscord<Elegantbeef> https://nim-lang.org/docs/system.html#unhandledExceptionHook
21:38:55FromDiscord<Phil> No you should not just log that, you should get bugreports and fire alarms that there's a fundamental problem.↵A log report doesn't do it justice, this is higher priority imo
21:39:50FromDiscord<Elegantbeef> It's a fatal inside of a log
21:40:18FromDiscord<Phil> Being able to just catch-and-log implies that you can live with this being inside the program.↵Crashing means your users have a problem, which they definitely have, if you catch-and-log chances are decent they'll miss that.
21:40:46FromDiscord<guttural666> i understand, I just want to write that shit down in a file
21:41:24FromDiscord<guttural666> I want to catch, log and hard crash
21:51:09FromDiscord<sOkam! 🫐> In reply to @guttural666 "I want to catch,": I use the fatal log level for that, personally
21:52:06FromDiscord<sOkam! 🫐> i have a tiny `fail` function that basically logs the crash and backtrace and calls for `quit()`↵there is probably a better way, but has worked decent so far
21:52:47FromDiscord<Elegantbeef> Yea the unhandled exception hook
21:53:25FromDiscord<sOkam! 🫐> isn't that hook for any exception, even ones that should be catched?
21:53:31FromDiscord<guttural666> have this in my logging.nim now https://media.discordapp.net/attachments/371759389889003532/1185701265859158086/image.png?ex=6590915b&is=657e1c5b&hm=1dc564956ae2bde5b9da53fcdf3a106f0f39f32f0322d5005b0e15310fa76c82&
21:53:37FromDiscord<Elegantbeef> `unhandled` is the operative word
21:54:03FromDiscord<Elegantbeef> `let kind = if x of Defect: Fatal else: Error`
21:54:44FromDiscord<guttural666> or a version for Exception
21:54:50FromDiscord<guttural666> (edit) "or" => "and"
21:55:42FromDiscord<sOkam! 🫐> In reply to @guttural666 "have this in my": I personally use [this logging setup](https://github.com/heysokam/nstd/tree/master/src/nstd/logger) in case its helpful. its based on `std/logging`, but modified quite a bit
21:55:52FromDiscord<guttural666> should probably call quit() as well then, it's technically "handled", but it really isnt
21:56:13FromDiscord<guttural666> thanks, gonna bookmark that for review
21:56:15FromDiscord<sOkam! 🫐> In reply to @guttural666 "should probably call quit()": yeah that's why i call quit manually
21:59:17FromDiscord<ezquerra> Can somebody explain how to use toOpenArray? The procedure is present but not documented on the nim docs...
22:13:04FromDiscord<guttural666> sent a code paste, see https://play.nim-lang.org/#ix=html>
22:15:07FromDiscord<ezquerra> Thank you
22:15:36FromDiscord<ezquerra> Is it possible to resize an openarray? That is, can I take a slice of an openarray parameter? For example, if I have a proc that gets an open array of size n, can I take a slice of the elements 1 to n-1 _without making a copy_?
22:19:05FromDiscord<bostonboston> Views I think are what you want, but I dont know enough to be certain
22:19:56Amun-Rahmm, can you extend beyond slice with toopenarray? I'd refactor the code
22:22:24FromDiscord<bostonboston> sent a code paste, see https://play.nim-lang.org/#ix=html>
22:26:12*Qaziquza joined #nim
22:26:16FromDiscord<Phil> I think I'm finally coming around to viewing thread servers as just eternally running tasks
22:27:08FromDiscord<Phil> Which means I think I could build threadButler on top of malebolgia or sth.↵Or just leave it at the current level where it's built atop of the createThread/joinThread procs
22:30:23FromDiscord<ezquerra> sent a code paste, see https://play.nim-lang.org/#ix=html>
22:34:41FromDiscord<bostonboston> I guess I dont understadn what size is for, you couild just pass the slice of interest
23:16:46FromDiscord<helloworld_09810> hey how could I import a local package? (a nimble package that I have on my machine)
23:19:26FromDiscord<bostonboston> either add it's dir to your projects search path, or if it's a properly formed nimble package you can `nimble install` in the package directory and use it like any other package
23:37:48FromDiscord<Phil> In reply to @helloworld_09810 "hey how could I": A way would be to compile with `--path:<path-to-local-package>`, then you can import as if it were normally installed
23:37:57FromDiscord<Phil> I personally prefer that over messing with nimble install
23:38:22*jmdaemon joined #nim
23:58:12*azimut joined #nim