00:12:45 | FromDiscord | <Elegantbeef> Then what is the point of adding? |
00:18:48 | FromDiscord | <System64 ~ Flandre Scarlet> In reply to @Elegantbeef "Then what is the": FM synthesis?↵It consists to add a value previously generated by an oscillator to next oscillator's phase accumulator |
00:22:16 | FromDiscord | <Elegantbeef> So then you do not actually want to add |
00:22:41 | FromDiscord | <Elegantbeef> So sure cast is the only way to achieve what you want |
00:27:25 | FromDiscord | <griffith1deadly> beef, if i have big ref object (big size from object fields) i'm also need declare field object types like ref? |
00:27:48 | FromDiscord | <System64 ~ Flandre Scarlet> In reply to @Elegantbeef "So then you do": I want to add a value to the phase accumulator |
00:28:55 | FromDiscord | <Elegantbeef> Idk |
00:52:54 | FromDiscord | <yoyojambo> sent a code paste, see https://play.nim-lang.org/#ix=html> |
00:54:20 | FromDiscord | <yoyojambo> Is it the tuple? I couldn't find what it could refer to that the compiler dislikes about it. |
00:54:36 | FromDiscord | <Elegantbeef> `Positive` is a sub range type so should be explicitly init'd |
00:55:16 | FromDiscord | <yoyojambo> Ahhhh of course, making it an `int` solves it, thanks! |
00:57:25 | FromDiscord | <us> can you talk some details? |
01:05:07 | * | Mister_Magister quit (Quit: bye) |
01:07:02 | * | Mister_Magister joined #nim |
01:22:13 | FromDiscord | <Elegantbeef> @griffith1deadly to elaborate what you should do depends on what you're doing, speaking in generalities does not generally benefit 😄 |
01:22:30 | FromDiscord | <Elegantbeef> As such I'll say those objects should be only ref if you are moving them around a lot |
01:23:19 | * | krux02 quit (Quit: Leaving) |
01:23:44 | FromDiscord | <Elegantbeef> Otherwise you do not benefit much from having them as `ref`s and just introduce a "mistake" |
02:12:45 | FromDiscord | <demotomohiro> In reply to @sys64 "``(osc.pAcc + prevSample)`` I": If you want to do such addition without overflow, convert both numbers to int32 and add.↵Then, convert result to uint16 or int16. |
02:47:35 | FromDiscord | <griffith1deadly> In reply to @Elegantbeef "<@620135501201932300> to elaborate what": it's like array[256, array[64, array[64, int32]]], but just like container's with smaller size and done with seq |
02:48:13 | FromDiscord | <griffith1deadly> and it's object should be in memory in big counting, like 1000-5000 |
02:48:35 | FromDiscord | <Elegantbeef> Right but many instantiations do not really mean "use ref" |
02:49:05 | FromDiscord | <griffith1deadly> it also need to be modified from many sources |
02:49:05 | FromDiscord | <Elegantbeef> If you can move resources instead of copying them, or would benefit from a pointer |
02:49:40 | FromDiscord | <Elegantbeef> If it needs to be viewed from multiple places you need a reference then |
02:51:26 | FromDiscord | <griffith1deadly> In reply to @Elegantbeef "If you can move": like object poll or? |
02:52:01 | FromDiscord | <Elegantbeef> You can either use a pool with a 'pointer' which is an index into it, or use references |
02:52:58 | FromDiscord | <griffith1deadly> (edit) "poll" => "pool" |
02:53:01 | FromDiscord | <griffith1deadly> thanks! |
02:53:10 | FromDiscord | <Elegantbeef> The first is a bit more tedious as you have to pass the environment around |
02:53:38 | FromDiscord | <Elegantbeef> It also is faster with smaller objects than you have, but is probably on par with `ref T` |
04:02:34 | * | xutaxkamay quit (Ping timeout: 255 seconds) |
04:16:13 | * | xutaxkamay joined #nim |
04:49:23 | * | Qaziquza quit (Ping timeout: 252 seconds) |
05:54:29 | * | jmdaemon joined #nim |
07:34:43 | * | advesperacit joined #nim |
08:02:30 | FromDiscord | <ieltan> Writing a bunch of higher order functions for `Option` à-la Rust and wondering if some parameters should be `sink` |
08:03:49 | FromDiscord | <ieltan> I guess they should be hm |
08:05:16 | FromDiscord | <Elegantbeef> Any parameter that can be moved, should be annotated sink |
08:07:41 | FromDiscord | <ieltan> Alright 🙂 |
08:36:55 | * | PMunch joined #nim |
09:01:43 | NimEventer | New thread by mantielero: Scinim - how to contribute a package, see https://forum.nim-lang.org/t/10780 |
09:15:26 | FromDiscord | <Phil> @vindaar @hugogranstrom It might make sense to enable "Discussions" for the SciNim on github organization.↵mantielero is a useful reminder here that Discussion Pages for an organization can be a decent way for members of the community to get in contact with you guys.↵Not everyone is in the forum or on this discord 😉 |
09:15:50 | FromDiscord | <Phil> (edit) "you guys.↵Not" => "it.↵Not" |
09:25:11 | FromDiscord | <vindaar> Ah, good idea! Will take care of it |
09:25:59 | * | derpydoo quit (Ping timeout: 260 seconds) |
09:33:21 | FromDiscord | <ca_lobo_14153> sent a long message, see <!doctype html> |
09:40:17 | FromDiscord | <demotomohiro> In reply to @ca_lobo_14153 "My first time playing": `stripLineEnd` doesn't return string. It modify the argument. |
09:42:37 | FromDiscord | <demotomohiro> !eval import strutils; var r = "FooBar\n"; r.stripLineEnd; echo r & ".txt" |
09:42:42 | NimBot | FooBar.txt |
09:59:08 | FromDiscord | <ca_lobo_14153> aaaaah, ok so the documentation is incorrect as using a var to capture the osproc.execCmdEx results and then applying stripLineEnd turns it into a void vs actually modifying the results. I've figured out that assigning the result[0] to another variable, allows me to avoid using stripLIneEnd entirely... |
09:59:38 | FromDiscord | <System64 ~ Flandre Scarlet> In reply to @demotomohiro "If you want to": Does it clamp or overflow when converting back to uint16? |
10:03:27 | FromDiscord | <odexine> overflow |
10:03:56 | FromDiscord | <demotomohiro> In reply to @sys64 "Does it clamp or": !eval var x = 65536.int32 + 7.int32; echo x.uint16 |
10:07:02 | FromDiscord | <sOkam! 🫐> sent a code paste, see https://play.nim-lang.org/#ix=html> |
10:07:35 | FromDiscord | <System64 ~ Flandre Scarlet> In reply to @demotomohiro "!eval var x =": Looks like the bot is dead |
10:08:30 | FromDiscord | <System64 ~ Flandre Scarlet> !eval echo "test" |
10:08:33 | NimBot | test |
10:09:02 | FromDiscord | <System64 ~ Flandre Scarlet> sent a code paste, see https://play.nim-lang.org/#ix=html> |
10:09:50 | FromDiscord | <demotomohiro> It still alive.↵Anyway, `(65536.int32 + 7.int32).uint16 == 7` |
10:11:07 | FromDiscord | <System64 ~ Flandre Scarlet> !eval echo(255.uint16 + (-1).uint16) |
10:11:10 | NimBot | Compile failed: /usercode/in.nim(1, 23) Error: -1 can't be converted to uint16 |
10:11:54 | FromDiscord | <System64 ~ Flandre Scarlet> !eval echo(255.uint16 + cast[uint16](-1)) |
10:11:57 | NimBot | 254 |
10:12:12 | FromDiscord | <System64 ~ Flandre Scarlet> Oooh! |
10:13:03 | FromDiscord | <System64 ~ Flandre Scarlet> !eval echo(255.uint16 + cast[uint16](-255)) |
10:13:06 | NimBot | 0 |
10:13:29 | FromDiscord | <System64 ~ Flandre Scarlet> And finally |
10:13:41 | FromDiscord | <System64 ~ Flandre Scarlet> !eval echo(255.uint16 + cast[uint16](-256)) |
10:13:44 | NimBot | 65535 |
10:13:58 | FromDiscord | <System64 ~ Flandre Scarlet> Makes sense |
10:16:13 | * | Qaziquza joined #nim |
10:17:01 | FromDiscord | <ca_lobo_14153> In reply to @heysokam "<@1164001202451775498> tip: writing": Thanks sOkam! I'd forgotten about that... |
10:18:53 | FromDiscord | <ca_lobo_14153> (edit) "In reply to @heysokam "<@1164001202451775498> tip: writing": Thanks sOkam! I'd forgotten about that... ... " added " fixed" |
10:39:22 | * | Qaziquza quit (Ping timeout: 260 seconds) |
11:09:14 | * | jmdaemon quit (Ping timeout: 260 seconds) |
11:34:51 | * | koltrast quit (Ping timeout: 256 seconds) |
11:46:36 | NimEventer | New thread by coneonthefloor: How to await a list of async procedures, see https://forum.nim-lang.org/t/10781 |
12:05:10 | * | koltrast joined #nim |
12:10:28 | FromDiscord | <rakgew> sent a code paste, see https://play.nim-lang.org/#ix=html> |
12:17:48 | FromDiscord | <rubythulhu> im getting real “cool there’s a nimble package for X” -> “breaks during nim install, written for a way old version of nim, current version’s dependencies break things somehow” kinda vibes lately |
12:18:59 | FromDiscord | <Phil> hm? |
12:19:30 | FromDiscord | <Phil> If this is a package that does DB interaction then yeah, 2.0 kinda killed you with how it moved the packages around.↵Then again, that was a breaking version change so to be expected |
12:48:59 | FromDiscord | <rubythulhu> its a whole bunch of stuff |
12:52:04 | FromDiscord | <rubythulhu> i've had that kind of thing happen a bunch, whichever aws sdk thing felt most actually workable, and how i cant even get the nim godot stuff to work, etc |
12:52:48 | FromDiscord | <rubythulhu> kind of to be expected for a younger / less popular language but, is a bit disheartening |
13:08:03 | FromDiscord | <nnsee> In reply to @rubythulhu "i've had that kind": this ofc doesn't apply to huge libraries such as nim-godot or whatever, but if a lib i'm thinking about using is small enough, or a wrapper around a web API or something like that, I usually prefer to write it myself to begin with. Partly because of the problems you mentioned, but also because I enjoy writing Nim and don't mind having an excuse to do it |
13:08:44 | FromDiscord | <rubythulhu> oh, i agree. its just trying to do something more fun than play projects |
13:08:56 | FromDiscord | <rubythulhu> nim's still the best i've found for raspberry pi pico |
13:09:11 | FromDiscord | <rubythulhu> tho i havent tried my old code under nim2 O_O |
13:10:09 | FromDiscord | <nnsee> most of my old code just worked |
13:12:53 | FromDiscord | <rubythulhu> yeah i can maintain my own code |
13:13:10 | FromDiscord | <rubythulhu> is the nimble ecosystem tho |
13:13:18 | FromDiscord | <mratsim> In reply to @rubythulhu "tho i havent tried": There is a tradeoff between trying too early while in devel, and taking focus time away to solve Nim issues, and trying too late and have a regression shipped in Nim 2.0 and then people complaining that your cold doesn't work :/ |
13:14:11 | FromDiscord | <mratsim> Thankfully I have an excuse to write all the code myself with zero dependencies including the stdlib :P, so I only get compiler bugs. |
13:14:15 | FromDiscord | <rubythulhu> In reply to @mratsim "There is a tradeoff": yeah, i understand it. just getting sad how often i think "i wanna do something" -> "lets try it in nim" -> "nimble pkg" -> "oof" |
13:14:46 | FromDiscord | <rubythulhu> need to constrain my problem space more for now when choosing to play in nim |
13:15:33 | FromDiscord | <mratsim> i just assume I have to write everything myself, and I'm pleasantly surprised if I don't 😉 |
13:16:48 | FromDiscord | <rubythulhu> lots of things i love it for, but i keep reaching into dark places haha |
13:17:10 | FromDiscord | <rubythulhu> the pi pico lib is my favorite way to do pico coding hands down |
13:17:24 | FromDiscord | <nnsee> what do you do with your pico |
13:17:27 | FromDiscord | <rubythulhu> and write little whatsits here and there for fun |
13:17:27 | FromDiscord | <nnsee> out of curiosity |
13:17:51 | FromDiscord | <rubythulhu> well, i haven't gone back to the project in a bit haha 😅 |
13:17:59 | FromDiscord | <rubythulhu> i have a bunch of them |
13:18:15 | FromDiscord | <rubythulhu> and i watched and did ben eaters whole 6502 series |
13:18:31 | FromDiscord | <rubythulhu> and i wanted to play w/ more |
13:19:30 | FromDiscord | <rubythulhu> so my plan is to make a 65c816-based single-game arcade console, but basically use pico's to fake old hardware for bunches of it |
13:22:04 | FromDiscord | <nnsee> neat |
13:22:45 | FromDiscord | <rubythulhu> so the thing i was in the middle of before work distracted me was, i was building basically a storage/memory/bus (so basically core of the "motherboard") to communicate w/ the 65c816, and remap ram/flash and send commands to other picos over spi to control output/input/etc |
13:23:48 | FromDiscord | <rubythulhu> nim's really nice for it |
13:25:39 | FromDiscord | <rubythulhu> its hardware level and no-gc land, and it's super nice to guarantee zero cost abstractions w/ templates |
13:26:22 | FromDiscord | <rubythulhu> i tried micropython at first, but was looking at my even base running times vs what i wanted to pull off and wanted to go lower level and didn't wanna go c |
13:26:29 | FromDiscord | <rubythulhu> so i found my way into nim's lap haha |
13:28:17 | FromDiscord | <rubythulhu> plus micropython was too easy, there was already libs for everything and i wanted to write everything myself |
13:34:22 | FromDiscord | <rubythulhu> one thing i’d like to do is prototype the story of that arcade game in a more modern language and less constrained environment, i think nimwave or illwave would be cool for a tui version of it, but still too constrained to start with haha |
13:36:05 | FromDiscord | <rubythulhu> nim’s still my favorite language now, just getting frustrated when i try to use it and it turns into way more of a project than i want it to be |
13:39:15 | FromDiscord | <rubythulhu> there’s also cool stuff in the web api space i think would be fun to play with, but it’s too work-y to do while i’m looking for a job lol |
13:39:19 | FromDiscord | <nnsee> i think the C interop is sometimes an effective band-aid for that |
13:39:23 | FromDiscord | <nnsee> especially with futhark |
13:39:42 | FromDiscord | <nnsee> In reply to @rubythulhu "there’s also cool stuff": what sort of job are you looking for exactly? |
13:39:46 | FromDiscord | <rubythulhu> i haven’t played with furhark yet |
13:51:22 | FromDiscord | <rubythulhu> In reply to @nnsee "what sort of job": duno. been in devops ish stuff for about a decade, but far from the only thing i’ve done and i wonder if im getting bored with it haha |
14:08:10 | * | derpydoo joined #nim |
14:24:44 | * | sagax joined #nim |
14:28:12 | * | edr joined #nim |
14:34:06 | NimEventer | New thread by rel: Direct C/C++ interop without generating wrappers?, see https://forum.nim-lang.org/t/10782 |
15:24:24 | PMunch | rubythulhu, can highly recommend trying Futhark :) |
15:25:51 | PMunch | I use it quite often, now I'm trying out libfuse to implement a user-space filesystem for a little project and wrapping the libfuse library (with all the passC/passL stuff required) was 7 lines of code :) |
15:25:55 | * | PMunch quit (Quit: Leaving) |
15:39:14 | FromDiscord | <nnsee> "use it quite often" |
15:39:20 | FromDiscord | <nnsee> my brother in christ, you wrote it |
15:40:30 | FromDiscord | <ieltan> I'd like to contribute to futhark to add a `nep2` flag but I don't even know where to start |
15:40:45 | FromDiscord | <jviega> Yeah but I've written a lot of things I don't use often 🙂 |
15:41:01 | FromDiscord | <nnsee> touché |
15:41:07 | FromDiscord | <jviega> So I appreciated the way he said it |
15:41:42 | FromDiscord | <Chronos [She/Her]> In reply to @ieltan "I'd like to contribute": Nep2? |
15:44:01 | FromDiscord | <ieltan> Uh more like `nep1` sorry |
15:44:10 | FromDiscord | <ieltan> Dunno where I got that two, I'm kinda tired lol |
15:59:43 | FromDiscord | <Chronos [She/Her]> Nep1? |
15:59:48 | FromDiscord | <Chronos [She/Her]> I don't know either aha |
15:59:56 | FromDiscord | <Chronos [She/Her]> Unless you mean the Nim naming convention? |
16:01:02 | FromDiscord | <Chronos [She/Her]> @ieltan https://github.com/Yu-Vitaqua-fer-Chronos/ngpu-bindings/tree/master/tools if you wanna look at how I made some scripts in my failed attempt to wrap WGPU for Nim, look here |
16:01:09 | FromDiscord | <Chronos [She/Her]> You can most definitely port that to Nim |
16:01:43 | FromDiscord | <bostonboston> I think he means rather than the end result looking C like futhark with generate code in the official Nim style |
16:01:51 | FromDiscord | <Chronos [She/Her]> Yeah fair |
16:07:57 | * | sagax quit (Read error: Connection reset by peer) |
16:13:43 | * | krux02 joined #nim |
16:14:37 | FromDiscord | <mratsim> In reply to @rubythulhu "and i wanted to": I never finished my 65c816 emulator:all those addressing modes .....↵https://github.com/mratsim/glyph/blob/master/glyph/snes/addressing_modes.nim |
16:17:51 | FromDiscord | <mratsim> sent a code paste, see https://play.nim-lang.org/#ix=html> |
16:58:59 | FromDiscord | <piqueiras> doing AoC today, anyone know how to do this in a cooler way? https://media.discordapp.net/attachments/371759389889003532/1186351918264631336/image.png?ex=6592ef52&is=65807a52&hm=e176382a71a6d765e09491690d1c9c205bc691136be19be5e09948a1fceea495& |
16:59:10 | FromDiscord | <piqueiras> (i am aware its not efficient) |
17:02:22 | FromDiscord | <metagngn> probably using strscans |
17:02:27 | FromDiscord | <metagngn> underused module |
17:07:41 | FromDiscord | <_goel_> Does nim sequences also have a `capacity`? Or just the length |
17:07:47 | FromDiscord | <_goel_> (edit) "Does" => "Do" |
17:08:50 | FromDiscord | <_goel_> (edit) "sequences" => "`seq`" |
17:14:36 | FromDiscord | <pmunch> In reply to @jviega "Yeah but I've written": Exactly, I've ended up using Futhark way more than I anticipated. But many of my projects ends up never being used by me. |
17:15:30 | FromDiscord | <pmunch> In reply to @_goel_ "Do nim `seq` also": It has a capacity internally. But it's not accessible by default |
17:16:15 | FromDiscord | <jviega> Well you can set it at the beginning but not query it |
17:16:20 | FromDiscord | <piqueiras> In reply to @metagngn "probably using strscans": hmm |
17:16:21 | FromDiscord | <jviega> newSeqOfCap() |
17:26:07 | FromDiscord | <0ffh> sent a code paste, see https://play.nim-lang.org/#ix=html> |
17:29:07 | FromDiscord | <0ffh> I can't even see any reason why it would want to evaluate "i" at compile time. |
17:34:42 | * | xet7 quit (Remote host closed the connection) |
17:46:55 | * | xet7 joined #nim |
17:47:15 | * | lumidify quit (Quit: leaving) |
17:51:57 | * | lumidify joined #nim |
18:32:52 | FromDiscord | <odexine> needs more context, it does indeed make no sense for that to fail though |
18:34:44 | FromDiscord | <graveflo> doesnt it look like the fist parameter to `[]` is defined as a `static` int? |
18:39:49 | FromDiscord | <odexine> only reason for that to be is if t is a tuple; additionally the other two wouldnt work either |
18:40:02 | FromDiscord | <bostonboston> Is there a way to do `recvFrom` from std/net with a timeout |
18:45:20 | FromDiscord | <0ffh> sent a code paste, see https://play.nim-lang.org/#ix=html> |
18:45:53 | FromDiscord | <odexine> tuples require compile time values for indexing |
18:46:10 | FromDiscord | <odexine> otherwise you have a runtime value that can change return types |
18:47:19 | FromDiscord | <odexine> i'd recommend going to an object in that case, that just looks like tuple abuse |
18:47:28 | FromDiscord | <0ffh> Meh, I need to store those contiguously in an array for performance reasons. |
18:48:37 | FromDiscord | <0ffh> then again, there's already lots of indirections in there |
18:48:41 | FromDiscord | <odexine> the issue iirc is basically youre conflicting with the generic tuple [] access |
18:48:55 | FromDiscord | <0ffh> ah! |
18:49:00 | FromDiscord | <odexine> basically just change the tuple into an object and id say its prolly gonna work |
18:54:10 | FromDiscord | <0ffh> Object works, yes.↵I wonder though, my index type is a seq[int] while I assume that the generic tuple [] takes an int. |
18:54:47 | FromDiscord | <0ffh> So should they really conflict? |
18:56:11 | FromDiscord | <graveflo> idk if this is the reason, but "array get" syntax has it's own semantics in the compiler. So do dot expressions for that matter, but that doesn't really mean that this behavior is expected. Yuo're using the tuple like an object, so it could be that there is something weird going on becuase that is not common |
18:57:08 | FromDiscord | <graveflo> by that I mean, the overload resolution might not even be happening the same way in the case for array get syntax |
19:00:06 | FromDiscord | <0ffh> Well, it seems like my hands are bound, then.↵Sooo many indirections, though! 😢 |
19:01:10 | FromDiscord | <0ffh> This will have totally messed up memory access patterns. |
19:14:59 | FromDiscord | <graveflo> Yea, just for posterity it looks like the `[]` operator on tuple types is hard checked in the compiler. Overload resolution won't even happen if the offset can't the evaluated at compile time. |
19:15:27 | FromDiscord | <graveflo> (edit) "Yea, just for posterity it looks like the `[]` operator ... on" added "in (subscript notation)" |
19:25:32 | FromDiscord | <pmunch> In reply to @0ffh "Well, it seems like": Objects and tuples are laid out the same in memory AFAIK, so it won't change any indirections or memory access patterns to go from tuple to object |
19:25:36 | FromDiscord | <Chronos [She/Her]> https://github.com/Yu-Vitaqua-fer-Chronos/Zaphyt if anyone cares to look through this aha, anyone know why I could possibly be getting a SIGILL here? :/↵↵I have no clue, honestly |
19:25:59 | FromDiscord | <Chronos [She/Her]> Ah hold on- |
19:26:54 | FromDiscord | <Chronos [She/Her]> There |
19:27:08 | FromDiscord | <graveflo> In reply to @0ffh "Well, it seems like": there might be a weird work around for this, where if you add an extra parameter to `[]` overload resolution will happen and the compile time check is skipped. It's not a "solution" by any means because its so stupid, but I think it might actually work |
19:27:45 | FromDiscord | <Chronos [She/Her]> https://github.com/Yu-Vitaqua-fer-Chronos/Zaphyt/blob/main/parser/types.nim#L62 seems to be here, specifically |
19:27:58 | FromDiscord | <Chronos [She/Her]> For some reason the AST is nil... |
19:28:50 | FromDiscord | <Chronos [She/Her]> Maybe I'll restart from scratch, actually |
19:28:53 | FromDiscord | <0ffh> In reply to @pmunch "Objects and tuples are": Hmmm, I might have got that wrong.↵So, if I've a seq of tuples I imagine them being one after the other in memory.↵A seq of objects, I imagine a list of pointers.↵Is that wrong? |
19:29:23 | FromDiscord | <pmunch> Yes, that is wrong |
19:29:35 | FromDiscord | <graveflo> no the objects should all the have the same size so contiguous storage is still possible. If they are ref or ptrs then what you were saying is true |
19:29:54 | FromDiscord | <pmunch> If you have a sequence of `ref object` then they'd be pointers |
19:30:03 | FromDiscord | <griffith1deadly> In reply to @0ffh "Hmmm, I might have": seq of objects true to pointers only if object `ref object` |
19:30:10 | FromDiscord | <0ffh> Oops, sorry for the misunderstanding, then!↵Okay, objects are fine then! |
19:30:50 | FromDiscord | <0ffh> Still not quite used to the details of Nim's semantics. |
19:32:27 | FromDiscord | <0ffh> Or, semantics more or less, but not the implementation details. |
19:38:36 | FromDiscord | <JJ> you can think of objects as structs. and tuples as anonymous structs |
19:39:12 | FromDiscord | <JJ> despite the name, there's little object-oriented about them: all functions defined on them, even those called with `Object.function`, are statically dispatched |
19:39:29 | FromDiscord | <JJ> (you can write `method`s that are dynamically dispatched but there is little reason to do so) |
19:40:21 | FromDiscord | <0ffh> In reply to @omentic "despite the name, there's": Yeah, that part I know. It's the same UFCS as in D. |
19:40:51 | FromDiscord | <JJ> In reply to @omentic "you can think of": ah, i say this, but actually objects must have names for all of their fields: you can't treat a tuple as an object directly |
19:40:54 | FromDiscord | <griffith1deadly> In reply to @omentic "(you can write `method`s": what about inheritance? |
19:41:47 | FromDiscord | <JJ> inheritance is done with `object of RootObj` and `ref object of <name>` |
19:42:41 | FromDiscord | <JJ> ah, i see what you mean |
19:42:48 | FromDiscord | <bostonboston> Inheritance can be a valid use case of dynamic dispatching, but up can use the data of the object to determine calls in a lot of cases |
19:43:29 | FromDiscord | <griffith1deadly> sent a code paste, see https://play.nim-lang.org/#ix=html> |
19:43:38 | FromDiscord | <JJ> personally i shy away from inheritance in favour of variant objects whenever possible |
19:43:40 | FromDiscord | <bostonboston> The std/streams implementation for example |
19:44:17 | NimEventer | New question by GiMS_Pang: Declare procedures prototypes in nim, see https://stackoverflow.com/questions/77681392/declare-procedures-prototypes-in-nim |
19:46:55 | FromDiscord | <griffith1deadly> In reply to @omentic "personally i shy away": you use it with object or ref object? |
19:48:03 | FromDiscord | <0ffh> In reply to @NimEventer "New question by GiMS_Pang:": Oof, needs forward declaration and will also explode the stack. |
19:50:18 | FromDiscord | <JJ> In reply to @griffith1deadly "you use it with": ref object only when i need indirection, for ex. an ast |
19:51:32 | FromDiscord | <JJ> but i'm not really defining different functions on different variants, i use it to define the same function, behaving differently |
20:19:17 | * | NimBot joined #nim |
20:19:38 | * | FromDiscord joined #nim |
20:21:25 | FromDiscord | <alec.j> How do I load an array from json? My json looks something like this: `{"arr": ["element", "element2", "element3"]}` |
20:21:49 | FromDiscord | <alec.j> I wanna get the array elements as a sequence preferably |
20:26:42 | FromDiscord | <Phil> In reply to @alec.j "I wanna get the": Have you checked out std/json already?↵Notably the `parseJson()` and `to` procs are of interest for you |
20:27:04 | FromDiscord | <alec.j> I found it lol |
20:27:20 | FromDiscord | <alec.j> Weird how it's called getElems and not getArray or smth |
20:27:38 | FromDiscord | <Phil> Generally I'd recommend bookmarking the overview of the stdlib 😉 |
20:28:16 | FromDiscord | <Phil> In reply to @alec.j "Weird how it's called": It grabs you the individual elements as JsonNodes.↵To transform the JsonNode representing the entire list into a seq, use `to` |
20:55:59 | FromDiscord | <Phil> Question, what are the implications of using an atomic bool for a `while true` loop (that you can then kill multiple of by changing a single atomic bool).↵Does the bool being atomic make iterations "slower" in any meaningful capacity? |
20:57:59 | FromDiscord | <Elegantbeef> Depends on the cpu |
20:58:01 | FromDiscord | <Elegantbeef> But generally negligably |
20:58:37 | FromDiscord | <Phil> I'm mostly wondering if it would be a good or bad idea to have all my while-loops that you may spawn on n-threads depend on the same atomic. |
20:58:41 | FromDiscord | <Elegantbeef> Atomics have operations that are guaranteed to take one cycle, they do not use the same registers as non atomics so it can be slower, but it highly depends on the CPU |
20:58:49 | FromDiscord | <Elegantbeef> It's fine to do that |
20:58:53 | FromDiscord | <Phil> Like imagine 4 threads all on the same while-loop reading the same atomic until it gets switched |
20:58:55 | FromDiscord | <Phil> Check |
20:59:35 | FromDiscord | <Phil> Timeot implement a "killAll" proc on top of the procs that already exist to kill individual threads |
20:59:43 | FromDiscord | <Phil> threadservers |
21:00:35 | FromDiscord | <Elegantbeef> You probably do not even need an atomic here though, it saves one iteration at most |
21:00:49 | FromDiscord | <Elegantbeef> Just use it, but just saying |
21:01:02 | FromDiscord | <graveflo> is it imperative that the boolean is synchronized? If it's just a simple kill switch then you don't really have a benefit |
21:01:32 | FromDiscord | <Elegantbeef> Unless it is of utmost importance that the threads do not run another iteration there is really not much difference between the two |
21:01:59 | FromDiscord | <Phil> More a convenience utility. You currently can kill the threads individually but unless you raise an uncaught exception or defect in the main thread you can't really kill the program without doing so. A really easy graceful "Yeah just kill everything" would be neat |
21:02:26 | FromDiscord | <Phil> "Between the two"?↵What to? Did the bridge eat something? |
21:02:36 | FromDiscord | <graveflo> and thats assuming that the timing doesn't get shifted in the slightest and loop iterations are at the perfect ratio of long |
21:03:08 | FromDiscord | <Elegantbeef> The difference between global bool and a global atomic bool is that one will never run an extra iteration, whereas the other one might run another iteration |
21:03:10 | FromDiscord | <Phil> Or do you mean between the just "while true" that you can break out of with a Channel-message vs. changing an atomic |
21:03:17 | FromDiscord | <graveflo> just have a pointer to a bool maybe? flip the switch and they all die |
21:03:59 | FromDiscord | <graveflo> or that would just be an indirection. idk how this shit gets optimized. Maybe the global sticks in a register idk |
21:04:15 | FromDiscord | <Elegantbeef> Bleh it's generally the same |
21:04:29 | FromDiscord | <Phil> I think a global var bool should likely already do, which will just be a pointer underneath likely |
21:05:48 | FromDiscord | <Phil> or a ref |
21:07:26 | FromDiscord | <Elegantbeef> Using the atomic is fine |
21:07:27 | FromDiscord | <Phil> I mean if I can just do a global var bool that is easier and less likely to blow up in my face in case this ever starts mattering:↵> Types and operations for atomic operations and lockless algorithms.↵> ↵> Unstable API. |
21:07:27 | FromDiscord | <Phil> Less dependencies is always better |
21:07:29 | FromDiscord | <Elegantbeef> Well like I said with a non atomic there is the chance for one extra iteration |
21:07:38 | FromDiscord | <Phil> That shouldn't really matter I don't think.↵If it does, somebody will raise an issue for it. |
21:07:46 | FromDiscord | <Elegantbeef> I say one extra but I guess it's N extra |
21:07:57 | FromDiscord | <Phil> I highly doubt that would be the thing that makes somebody jump ship |
21:08:04 | FromDiscord | <graveflo> I would think of that more like an "iteration after" .. its different in such a small way but also ina big way |
21:08:38 | FromDiscord | <Elegantbeef> Yea if the thread is dealing with resources that the main thread has destructed it can be bad |
21:09:11 | FromDiscord | <Phil> But in those scenarios I feel like you'd be more trying to go for a controlled shut down |
21:09:36 | FromDiscord | <Phil> Which means you either shut down the threads yourself individually with already provided utilities or... can't think of anything else |
21:12:46 | FromDiscord | <rubythulhu> In reply to @mratsim "I never finished my": haha yeah there’s a lot of them. also to make the long addresses work it sends half the address on the rising edge of clock and the other half on the falling edge, which is a cute trick but makes the hardware impl talking to it more crazy |
22:04:09 | FromDiscord | <graveflo> trying to get nesper to work with atlas. I'm told to put an `include` statement in `X.nimble` so I can run some tasks, but I cannot figure out how to get nimble to run with the correct path configuration to find the nesper package installed in atlases custom nimble path. I know I can just run the configurations manually, but is there a way to set the nimble path used by nimble? I tried `nim.cfg` and `config.nims` and stuff like that and |
22:04:33 | FromDiscord | <graveflo> (edit) "atlases" => "atlas's" |
22:08:42 | FromDiscord | <Elegantbeef> Just use a relative path no? |
22:08:53 | FromDiscord | <Elegantbeef> `yourDeps/nesper/build_utils/tasks`? |
22:09:25 | FromDiscord | <graveflo> yea ig I could just do that. it would be more like `../deps/nesper/src/nesper/build_utils` blah |
22:09:50 | FromDiscord | <Elegantbeef> Well atlas does `--noNimblePath` so I assume that it makes nimble very silly on path resolution |
22:09:52 | FromDiscord | <graveflo> but it would be nice if I could tell nimble to use a custom nimble path for itself in this script |
22:10:13 | FromDiscord | <Elegantbeef> Really though you should just do a `myProject.nims` and use `nim task` |
22:10:23 | FromDiscord | <Elegantbeef> Unless nesper relies on nimble functionality |
22:14:28 | FromDiscord | <graveflo> unfortunately, it looks like it uses some nimble related macros, specifically `after` so idk if that makes it nimble dependent or not |
22:23:40 | FromDiscord | <Phil> hmmm I wonder if owlkettle has a graceful programmatic way to kill the GTK eventloop |
22:25:50 | FromDiscord | <Phil> It does! `g_main_loop_quit()` |
22:41:55 | * | advesperacit quit () |