00:11:42 | * | Mister_Magister quit (Ping timeout: 256 seconds) |
00:15:37 | * | Mister_Magister joined #nim |
00:16:15 | FromDiscord | <unquietwiki> Hey, there's a Discord outage spreading on some servers. https://discordstatus.com/ Just a heads up. ❗ |
00:16:55 | FromDiscord | <Elegantbeef> Oh noes! |
00:17:12 | FromDiscord | <unquietwiki> In reply to @Elegantbeef "Oh noes!": Yeah, at least a third of the servers I'm on are offline. |
00:17:58 | FromDiscord | <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:18 | FromDiscord | <Elegantbeef> Centralisation is da poop 😛 |
00:25:33 | FromDiscord | <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:07 | FromDiscord | <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:34 | FromDiscord | <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:14 | FromDiscord | <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:00 | NimEventer | New 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:19 | FromDiscord | <dedraiaken> In reply to @dedraiaken "Anyone know where the": I think I may have found it actually. |
05:34:53 | FromDiscord | <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:07 | FromDiscord | <michaelb.eth> In reply to @Marko Zima "Hello everyone, I'm a": what would you like to know? |
05:38:17 | FromDiscord | <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:05 | FromDiscord | <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:45 | FromDiscord | <eebahn> Has anyone used `treeform/chrono`? |
07:07:16 | FromDiscord | <eebahn> I cannot find how to get it to give me the same as `std/times.now()` |
07:11:22 | FromDiscord | <odexine> why do you need it to give you the same results as times now? |
07:11:45 | FromDiscord | <odexine> what do you mean by that as well |
07:16:09 | FromDiscord | <eebahn> sent a code paste, see https://play.nim-lang.org/#ix=html> |
07:16:18 | FromDiscord | <eebahn> (edit) |
07:17:16 | FromDiscord | <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:29 | FromDiscord | <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:34 | FromDiscord | <eebahn> (edit) removed "when the app is run" |
07:18:26 | FromDiscord | <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:37 | FromDiscord | <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:54 | FromDiscord | <JJ> there's a good chance you could parse the output of `std.times.now()` with it |
07:22:25 | FromDiscord | <eebahn> was trying that currently, but haven't found how yet |
07:30:29 | FromDiscord | <eebahn> sent a code paste, see https://play.nim-lang.org/#ix=html> |
07:30:46 | FromDiscord | <eebahn> (edit) |
08:33:55 | NimEventer | New thread by aiac: Error occurred when add thread to seq, see https://forum.nim-lang.org/t/10772 |
08:51:33 | FromDiscord | <TӨMΛ ☠> sent a code paste, see https://play.nim-lang.org/#ix=html> |
08:52:32 | FromDiscord | <TӨMΛ ☠> (edit) |
08:53:00 | FromDiscord | <TӨMΛ ☠> (edit) |
08:53:06 | FromDiscord | <TӨMΛ ☠> (edit) |
08:54:28 | FromDiscord | <eebahn> In reply to @toma400 "How one can iterate": `for example in k.mitems: ...` |
08:54:45 | FromDiscord | <eebahn> For reference, `for example in k` == `for example in k.items` |
08:55:34 | FromDiscord | <TӨMΛ ☠> Ooh, totally forgot `mitems` exist, thank you ❤️ |
09:02:54 | FromDiscord | <Phil> sent a long message, see <!doctype html> |
09:03:17 | * | junaid_ joined #nim |
09:05:11 | FromDiscord | <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:50 | FromDiscord | <gyatsoyt> sent a code paste, see https://play.nim-lang.org/#ix=html> |
09:11:04 | FromDiscord | <Phil> Write yourself procs with names that represent what individual moves mean, I aint debugging your business logic for you 😄 |
09:11:16 | FromDiscord | <Phil> (edit) "moves" => "pieces of your code" |
09:15:21 | FromDiscord | <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:25 | FromDiscord | <demotomohiro> sent a code paste, see https://play.nim-lang.org/#ix=html> |
09:23:59 | FromDiscord | <Phil> Where is it determined which config files nim pulls in for a nimble task? |
09:25:31 | FromDiscord | <Phil> sent a code paste, see https://play.nim-lang.org/#ix=html> |
09:33:25 | FromDiscord | <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:12 | FromDiscord | <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:50 | FromDiscord | <Phil> Arrrrrgh |
10:20:00 | FromDiscord | <Phil> I have a nim compiler under /usr/bin/bin |
10:20:02 | FromDiscord | <Phil> (edit) "/usr/bin/bin" => "/usr/bin/nim" |
10:20:06 | FromDiscord | <Phil> That's what vscode was using |
10:20:29 | FromDiscord | <Phil> While my terminal uses /home/<user>/.nimble/bin/nim |
10:22:51 | FromDiscord | <Phil> How to tell vscode to user the other compiler is now the real question |
10:25:56 | FromDiscord | <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:10 | FromDiscord | <odexine> usually the path is all you need to change |
10:26:29 | FromDiscord | <odexine> the thing is that you have to figure out how its reading the path |
10:26:42 | FromDiscord | <odexine> path as in the PATH env. var. |
10:31:28 | FromDiscord | <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:27 | FromDiscord | <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:01 | FromDiscord | <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:16 | FromDiscord | <odexine> In reply to @isofruit "Okay that is so": Sounds like the path thing then |
10:45:55 | FromDiscord | <Phil> sent a code paste, see https://play.nim-lang.org/#ix=html> |
10:45:57 | FromDiscord | <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:42 | FromDiscord | <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:39 | FromDiscord | <odexine> well then wouldnt vscode then need to know what shells youre using |
11:05:46 | FromDiscord | <odexine> rather, support many shells for that |
11:08:44 | FromDiscord | <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:22 | FromDiscord | <odexine> "where they store their rc files" then you break custom installs |
11:12:38 | FromDiscord | <odexine> or i guess a config form could be made |
11:12:48 | FromDiscord | <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:58 | FromDiscord | <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:12 | FromDiscord | <Phil> Now to find out why import paths on individual files I compile docs for are incorrect |
11:34:38 | FromDiscord | <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:21 | FromDiscord | <odexine> is this base 10? thats not how those work no |
11:45:38 | FromDiscord | <System64 ~ Flandre Scarlet> In reply to @odexine "is this base 10?": It's base 2 |
11:46:52 | FromDiscord | <odexine> 01111011.11111111 plus 0.00000001 would indeed be 01111100.0 |
11:47:09 | FromDiscord | <odexine> (edit) "01111011.11111111" => "01111011.1111_1111" | "0.00000001" => "0.0000_0001" | "01111100.0" => "0111_1100.0" |
11:47:12 | FromDiscord | <odexine> (edit) "01111011.1111_1111" => "0111_1011.1111_1111" |
11:58:15 | FromDiscord | <piqueiras> is this like, done well?↵↵template '[]'[T](matrix: seq[seq[T]], idx: array[2, int]): T =↵ matrix[idx[0]][idx[1]] |
11:59:01 | FromDiscord | <intellij_gamer> sent a code paste, see https://play.nim-lang.org/#ix=html> |
11:59:14 | FromDiscord | <intellij_gamer> (edit) |
11:59:44 | FromDiscord | <demotomohiro> !eval import strformat; for i in 0 .. 7: echo &"{1 shl i:08b}: {1.0 / float(1 shl (8 - i))}" |
11:59:49 | NimBot | Compile 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:50 | FromDiscord | <piqueiras> well I already had a `type Coords = array[2,int]` thing xdd |
12:00:34 | FromDiscord | <intellij_gamer> In reply to @piqueiras "well I already had": Ah I see, nvm then lol |
12:00:51 | FromDiscord | <piqueiras> I mean I am new to templates and such lmfaoo |
12:01:00 | FromDiscord | <demotomohiro> In reply to @NimBot "Compile failed: 00000001: 0.00390625↵00000010:": x:8 fix point number cannot represent 0.001 |
12:01:09 | FromDiscord | <piqueiras> Im scared to even do some [] replacement |
12:01:43 | FromDiscord | <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:18 | FromDiscord | <piqueiras> How to do []= then, var matrix? |
12:03:05 | FromDiscord | <piqueiras> sent a code paste, see https://play.nim-lang.org/#ix=html> |
12:03:07 | FromDiscord | <piqueiras> looks like it |
12:05:03 | FromDiscord | <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:10 | FromDiscord | <piqueiras> huh thats c++ thing? |
12:08:05 | FromDiscord | <piqueiras> well anyways I managed |
12:09:19 | FromDiscord | <demotomohiro> I just opened Nim manual, ctrl+f and searched '[]=' |
12:11:11 | FromDiscord | <demotomohiro> There are also many `[]=` procs in system module: https://nim-lang.org/docs/system.html#%5B%5D%3D%2Cstring%2CBackwardsIndex%2Cchar |
12:11:23 | FromDiscord | <piqueiras> yea but I wanted to try template |
12:12:00 | FromDiscord | <Zoom> Welcome to multithreading!↵(@Phil) |
12:12:44 | FromDiscord | <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:13 | FromDiscord | <Zoom> What you describe reads like a basic pool. But you're definitely gloss over some synchronization gotcha. |
12:13:50 | FromDiscord | <Phil> Btw. thanks for the review, helped with building some better understanding |
12:14:49 | FromDiscord | <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:33 | FromDiscord | <Phil> it's always joinThread under the hood |
12:16:25 | FromDiscord | <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:47 | FromDiscord | <Phil> want to spawn threads |
12:19:48 | FromDiscord | <System64 ~ Flandre Scarlet> In reply to @odexine "0111_1011.1111_1111 plus 0.0000_0001 would": And what if it is signed? |
12:20:35 | NimEventer | New 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:05 | FromDiscord | <piqueiras> So if you have a collection the only way to remove elements from it while iterating is a while loop rigth |
12:21:41 | FromDiscord | <Phil> Only way I can think of at least |
12:22:15 | FromDiscord | <piqueiras> Unless there was some magic macro |
12:22:29 | FromDiscord | <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:12 | FromDiscord | <piqueiras> bro does not compile https://media.discordapp.net/attachments/371759389889003532/1185557736084213801/image.png?ex=65900bae&is=657d96ae&hm=872ef37bf0ba72f2cf07d33838bd54006a1078189e2874f1b4935312f0318def& |
12:24:47 | FromDiscord | <piqueiras> I guess I could use filter...? |
12:29:04 | * | end quit (Quit: end) |
12:29:04 | * | bcksl quit (Quit: \) |
12:36:29 | FromDiscord | <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:58 | FromDiscord | <System64 ~ Flandre Scarlet> In reply to @odexine "same thing, 0111_1011 or": And if it's negative? |
12:47:57 | FromDiscord | <odexine> then it would be `1_111_1100` and `1_111_1101`; refer to two's complement |
12:48:15 | FromDiscord | <odexine> fixed point math works exactly the same to integer math IIRC |
12:53:28 | * | end joined #nim |
12:55:30 | FromDiscord | <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:45 | FromDiscord | <odexine> why? |
12:57:25 | FromDiscord | <System64 ~ Flandre Scarlet> that means you have 0xFF as integer part and 1000_0001 as fractionnal part |
12:58:41 | FromDiscord | <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:52 | FromDiscord | <odexine> you'll have to do it manually though |
13:01:54 | FromDiscord | <odexine> well i guess that's not equivalent completely to integer values |
13:02:04 | FromDiscord | <odexine> as the latter 8 bits are not subject to twos complement |
13:02:38 | FromDiscord | <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:58 | FromDiscord | <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:52 | FromDiscord | <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:42 | FromDiscord | <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:07 | FromDiscord | <odexine> so yes it's still just regular integer math |
13:17:26 | FromDiscord | <_goel_> Std `parseutils` doesn't have `parseBool`? |
13:31:41 | FromDiscord | <graveflo> In reply to @_goel_ "Std `parseutils` doesn't have": https://nim-lang.org/docs/strutils.html#parseBool%2Cstring↵this? |
13:45:39 | FromDiscord | <odexine> that's from strutils |
13:54:15 | FromDiscord | <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:40 | FromDiscord | <Chronos [She/Her]> (For example, using `Option` types, using `uint` instead of `int` everywhere) |
13:54:56 | FromDiscord | <Chronos [She/Her]> That's the only two changes I have in mind rn lol |
14:03:58 | FromDiscord | <Phil> Because then you also get to maintain it, new features in std-lib mean work for you |
14:04:10 | FromDiscord | <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:21 | FromDiscord | <odexine> why use uint over int? |
14:08:22 | FromDiscord | <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:53 | FromDiscord | <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:37 | FromDiscord | <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:41 | FromDiscord | <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:03 | FromDiscord | <Phil> the GUI while loop |
14:11:54 | FromDiscord | <Zoom> So, create a GUI thread and make it receive messages from threads doing blocking stuff, like IO?↵(@Phil) |
14:12:17 | FromDiscord | <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:26 | FromDiscord | <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:12 | FromDiscord | <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:01 | FromDiscord | <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:45 | FromDiscord | <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:59 | FromDiscord | <Phil> (edit) "eventually," => "eventually after the while-loop of my GUI thread," |
14:20:24 | FromDiscord | <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:02 | FromDiscord | <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:34 | FromDiscord | <Chronos [She/Her]> If you've seen how much I switch between projects, you'd know :P |
14:39:11 | FromDiscord | <Zoom> Believe in yourself!↵(@Chronos [She/Her]) |
14:40:03 | FromDiscord | <Chronos [She/Her]> Belief doesn't work when I physically happened |
14:58:38 | FromDiscord | <piqueiras> Only way to add an element to a seq at a position is include from sequtils? |
15:01:32 | FromDiscord | <piqueiras> wait theres one in sys |
15:24:12 | FromDiscord | <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:53 | FromDiscord | <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:42 | FromDiscord | <odexine> In reply to @chronos.vitaqua "Why use int instead": arrays can have -1 indices |
16:04:11 | FromDiscord | <odexine> and they fall under openarray so you might have a problem there in some sense |
16:04:31 | FromDiscord | <odexine> raises a good qn what does find return when the index range is negative too |
16:05:30 | * | koltrast joined #nim |
16:22:45 | FromDiscord | <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:16 | FromDiscord | <griffith1deadly> In reply to @isofruit "Any examples I see": what about std/selectors and user-event inside? |
16:33:44 | FromDiscord | <Phil> Can't say I tried |
16:33:48 | FromDiscord | <Phil> Or knew of even |
16:34:41 | FromDiscord | <griffith1deadly> selectors is non-blocking io as i know |
16:34:43 | FromDiscord | <Phil> And reading the module docs I don't understand usage either |
16:35:07 | FromDiscord | <griffith1deadly> In reply to @isofruit "And reading the module": same, but you always can look inside httpx for examples |
16:35:52 | FromDiscord | <griffith1deadly> i use this for minecraft server socket handling |
16:38:57 | FromDiscord | <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:56 | FromDiscord | <Shubham Verma> Hi friends, I am new in this room, happy to connect with you all |
17:08:57 | FromDiscord | <rakgew> welcome! \:-D |
17:09:17 | FromDiscord | <Shubham Verma> what is Nim programming language? |
17:10:19 | FromDiscord | <exelotl> it's like if Python and Pascal had a baby, and the baby had Lisp superpowers |
17:12:17 | FromDiscord | <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:03 | FromDiscord | <Chronos [She/Her]> In reply to @odexine "and they fall under": I wonder if concepts could work for this tbh |
17:13:22 | FromDiscord | <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:30 | FromDiscord | <Chronos [She/Her]> Rust seems to mitigate the issue of C implicitly casting it, and Nim does have compiler checks iirc, so |
17:55:56 | Amun-Ra | ints have overflows, uint don't |
19:20:25 | FromDiscord | <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:46 | FromDiscord | <Phil> sent a code paste, see https://play.nim-lang.org/#ix=html> |
20:41:17 | FromDiscord | <Elegantbeef> `poll` will finish all futures that are ready |
20:42:51 | FromDiscord | <Elegantbeef> So you have \~500ms due to the default timeout of `poll` |
20:43:06 | FromDiscord | <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:00 | FromDiscord | <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:11 | FromDiscord | <Phil> Hah, you were faster than I was, was about to look at the docs for drain again to see the difference |
20:46:51 | FromDiscord | <Phil> No wait, drain processes as many events as it can, poll only one, no? |
20:47:11 | FromDiscord | <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:12 | FromDiscord | <Elegantbeef> poll only completes those that are ready at the callsite, drain proccess all as they finish |
20:47:44 | FromDiscord | <Elegantbeef> So if you have a callback that takes 1ms you can finish any futures that take less than around 499ms |
20:48:36 | FromDiscord | <Elegantbeef> image.png https://media.discordapp.net/attachments/371759389889003532/1185684929661636608/image.png?ex=65908224&is=657e0d24&hm=2b9a246eb477c07ad7c2c57d468f5e1932cb2ebcd866fa30d37c3c97eea20475& |
20:48:56 | FromDiscord | <Elegantbeef> See drain has a while loop that calculates as it goes, poll just fires once |
20:49:10 | FromDiscord | <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:15 | FromDiscord | <Elegantbeef> Read the docs for Epoll/kqueue |
20:51:09 | FromDiscord | <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:14 | FromDiscord | <Elegantbeef> They cannot know how long your callback will take so if the future is ready at the callsite it yields |
20:51:36 | FromDiscord | <Elegantbeef> Otherwise you have to wait for another CPU sharing operation |
20:52:01 | FromDiscord | <Elegantbeef> At least as far as I know |
20:52:06 | * | krux02 quit (Remote host closed the connection) |
20:52:15 | FromDiscord | <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:26 | FromDiscord | <Elegantbeef> "During compsci"? |
20:52:33 | FromDiscord | <Phil> computer science classes |
20:53:02 | FromDiscord | <Phil> Which at this point I just assume you had ^^' |
20:53:06 | FromDiscord | <Elegantbeef> I do not have any post secondary education Phil, we've gone over this |
20:53:34 | FromDiscord | <Phil> Sometimes that's just really hard to believe |
20:53:34 | FromDiscord | <Elegantbeef> I got this knowledge overtime and RTFMing! |
20:53:36 | FromDiscord | <michaelb.eth> sent a long message, see <!doctype html> |
20:53:50 | FromDiscord | <Elegantbeef> Yes both use closures |
20:54:13 | FromDiscord | <Elegantbeef> But that does not really matter here |
20:54:24 | FromDiscord | <Phil> So is... async and CPS both share this version of "transforming a proc" and "execute in steps" but with different syntax? |
20:54:31 | FromDiscord | <Phil> Because that all sounds reminiscent of CPS |
20:54:36 | FromDiscord | <Elegantbeef> That's an implementation detail when talking about why the above happens the way it does |
20:54:37 | FromDiscord | <Phil> The entire "execute in steps" bit |
20:54:43 | FromDiscord | <Elegantbeef> I mean it's all CPU sharing |
20:55:29 | FromDiscord | <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:49 | FromDiscord | <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:10 | FromDiscord | <Elegantbeef> https://rust-lang.github.io/async-book/06_multiple_futures/01_chapter.html sounds familiar 😄 |
21:13:31 | FromDiscord | <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:59 | FromDiscord | <Elegantbeef> Using a try except |
21:14:08 | FromDiscord | <guttural666> and how do I get that text? |
21:14:17 | FromDiscord | <Elegantbeef> The message of the exception |
21:14:22 | FromDiscord | <guttural666> nice, thanks |
21:14:33 | FromDiscord | <Elegantbeef> sent a code paste, see https://play.nim-lang.org/#ix=html> |
21:14:49 | FromDiscord | <Elegantbeef> `Exception` should technically be `CatchableError` but meh |
21:15:00 | FromDiscord | <Elegantbeef> Also your thread procs should be marked `raises: []` |
21:17:24 | FromDiscord | <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:41 | FromDiscord | <Elegantbeef> Just never do `try: ... except: discard` |
21:25:00 | FromDiscord | <Elegantbeef> Always do something with the error else you'll be staring at code for ten thousand years |
21:33:25 | FromDiscord | <guttural666> any way to read the last stdout messages? |
21:33:30 | FromDiscord | <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:33 | FromDiscord | <Elegantbeef> Yea `--panics:off` is a horrendous default |
21:35:37 | FromDiscord | <Phil> It's also one of those gotchas you never expect until they bite you |
21:35:59 | FromDiscord | <Phil> like how in JS arrow functions have a different meaning of `this` than normal functions |
21:36:26 | FromDiscord | <guttural666> Exceptions will catch everything right, so I'm good? |
21:36:39 | FromDiscord | <Elegantbeef> No |
21:36:42 | FromDiscord | <Elegantbeef> You want defects to crash |
21:36:44 | FromDiscord | <Phil> It will catch so much stuff it will even catch things it really shouldn't |
21:37:11 | FromDiscord | <guttural666> yeah but I want to log anything that could go wrong that I haven't already handled locally |
21:37:35 | FromDiscord | <guttural666> anything that crashes the program and would output something to stdout |
21:37:41 | FromDiscord | <Phil> sent a code paste, see https://play.nim-lang.org/#ix=html> |
21:38:23 | FromDiscord | <guttural666> it should, but I also want to log that ^^ |
21:38:52 | FromDiscord | <Elegantbeef> https://nim-lang.org/docs/system.html#unhandledExceptionHook |
21:38:55 | FromDiscord | <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:50 | FromDiscord | <Elegantbeef> It's a fatal inside of a log |
21:40:18 | FromDiscord | <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:46 | FromDiscord | <guttural666> i understand, I just want to write that shit down in a file |
21:41:24 | FromDiscord | <guttural666> I want to catch, log and hard crash |
21:51:09 | FromDiscord | <sOkam! 🫐> In reply to @guttural666 "I want to catch,": I use the fatal log level for that, personally |
21:52:06 | FromDiscord | <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:47 | FromDiscord | <Elegantbeef> Yea the unhandled exception hook |
21:53:25 | FromDiscord | <sOkam! 🫐> isn't that hook for any exception, even ones that should be catched? |
21:53:31 | FromDiscord | <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:37 | FromDiscord | <Elegantbeef> `unhandled` is the operative word |
21:54:03 | FromDiscord | <Elegantbeef> `let kind = if x of Defect: Fatal else: Error` |
21:54:44 | FromDiscord | <guttural666> or a version for Exception |
21:54:50 | FromDiscord | <guttural666> (edit) "or" => "and" |
21:55:42 | FromDiscord | <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:52 | FromDiscord | <guttural666> should probably call quit() as well then, it's technically "handled", but it really isnt |
21:56:13 | FromDiscord | <guttural666> thanks, gonna bookmark that for review |
21:56:15 | FromDiscord | <sOkam! 🫐> In reply to @guttural666 "should probably call quit()": yeah that's why i call quit manually |
21:59:17 | FromDiscord | <ezquerra> Can somebody explain how to use toOpenArray? The procedure is present but not documented on the nim docs... |
22:13:04 | FromDiscord | <guttural666> sent a code paste, see https://play.nim-lang.org/#ix=html> |
22:15:07 | FromDiscord | <ezquerra> Thank you |
22:15:36 | FromDiscord | <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:05 | FromDiscord | <bostonboston> Views I think are what you want, but I dont know enough to be certain |
22:19:56 | Amun-Ra | hmm, can you extend beyond slice with toopenarray? I'd refactor the code |
22:22:24 | FromDiscord | <bostonboston> sent a code paste, see https://play.nim-lang.org/#ix=html> |
22:26:12 | * | Qaziquza joined #nim |
22:26:16 | FromDiscord | <Phil> I think I'm finally coming around to viewing thread servers as just eternally running tasks |
22:27:08 | FromDiscord | <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:23 | FromDiscord | <ezquerra> sent a code paste, see https://play.nim-lang.org/#ix=html> |
22:34:41 | FromDiscord | <bostonboston> I guess I dont understadn what size is for, you couild just pass the slice of interest |
23:16:46 | FromDiscord | <helloworld_09810> hey how could I import a local package? (a nimble package that I have on my machine) |
23:19:26 | FromDiscord | <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:48 | FromDiscord | <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:57 | FromDiscord | <Phil> I personally prefer that over messing with nimble install |
23:38:22 | * | jmdaemon joined #nim |
23:58:12 | * | azimut joined #nim |