00:02:36 | * | bcksl joined #nim |
00:07:50 | * | end joined #nim |
01:20:57 | * | rockcavera joined #nim |
01:23:38 | * | yeti quit (Ping timeout: 248 seconds) |
01:24:06 | FromDiscord | <microssd.> how to put compile options in .nimble? |
01:25:35 | FromDiscord | <janakali> @heysokam↵https://nim-lang.org/docs/ctypes.html#BiggestInt https://nim-lang.org/docs/dollars.html#%24%2Cint64↵https://github.com/nim-lang/Nim/tree/version-2-2/lib/system/dollars.nim#L44 |
01:35:59 | * | yeti joined #nim |
01:45:11 | FromDiscord | <janakali> sent a code paste, see https://play.nim-lang.org/#pasty=aZjsLAKc |
01:46:31 | FromDiscord | <janakali> `nimble foo` for running the task, but if you want `nimble build/install` to work correctly use `config.nims` |
01:48:14 | FromDiscord | <janakali> (edit) "task, but" => "task.↵But" | "work correctly" => "see the flags -" |
01:50:27 | FromDiscord | <microssd.> where is config.nims? |
01:56:50 | FromDiscord | <microssd.> oh I see I have to create it |
01:58:09 | FromDiscord | <janakali> usually in the project folder, but can be in any parent folder or beside the entry point file. Yes you need to create it |
02:00:59 | FromDiscord | <janakali> see "NimScript as a configuration file":↵https://nim-lang.org/docs/nims.html |
02:17:29 | FromDiscord | <microssd.> In reply to @janakali "usually in the project": how do I run config.nims ? |
02:27:46 | FromDiscord | <microssd.> I did it like this: https://media.discordapp.net/attachments/371759389889003532/1428932541691334747/image.png?ex=68f44ca2&is=68f2fb22&hm=c5e9dae29082de8f626bfe95381c5292a5d1a5e6da8fff0d246c63e562187e0c& |
02:28:17 | FromDiscord | <microssd.> but I cant run it |
02:32:12 | FromDiscord | <microssd.> even if I put config.nims above src |
02:32:48 | * | Guest13 joined #nim |
02:35:20 | * | Guest13 quit (Client Quit) |
02:37:44 | FromDiscord | <microssd.> is there a documentation for this? |
02:57:57 | FromDiscord | <janakali> sent a code paste, see https://play.nim-lang.org/#pasty=SPpjfZRg |
03:02:32 | FromDiscord | <janakali> tasks go in `.nimble`↵flags go in `config.nims` (at least that's what I do)↵↵`.nimble` is read only by `nimble` command, `config.nims` is read by nimble and compiler e.g. you can do `nim c main.nim` and it will pull flags from config. |
03:12:48 | FromDiscord | <janakali> In reply to @microssd. "is there a documentation": https://discord.com/channels/371759389889003530/371759389889003532/1428925796336275567 |
04:21:15 | * | SchweinDeBurg quit (Quit: WeeChat 4.8.0-dev) |
04:21:51 | * | SchweinDeBurg joined #nim |
07:06:33 | FromDiscord | <kiloneie> Freaking gremlins dude. Code i made yesterday, not working, copy paste what i put into issue after 5-8 min of O,O, now it works... i wish i knew what was different... |
07:07:59 | FromDiscord | <kiloneie> o.O https://media.discordapp.net/attachments/371759389889003532/1429003057508651018/Screenshot_2025-10-18_09-07-34.png?ex=68f48e4e&is=68f33cce&hm=8c556554bfb2c7e79048de2cc852d0b324b16265124b7b469b196997e8400d4a& |
07:08:45 | FromDiscord | <kiloneie> This is like how i was setting up today's workout on my phone in bed this morning, apparently your breath makes touch screen go nutz <.<. |
07:11:17 | FromDiscord | <kiloneie> Idk, maybe somehow the runnable example was not indented enough, the error message was "The expression has not type", which tells me nothing... |
07:18:39 | Amun-Ra | always git commit your code :> |
07:32:29 | FromDiscord | <nnsee> In reply to @kiloneie "o.O": well it looks like the indentation was wrong |
07:32:37 | FromDiscord | <nnsee> so the body was not in the scope of the template you defined |
07:32:50 | FromDiscord | <nnsee> copy-pasting probably pasted it with the correct indentation |
07:44:19 | FromDiscord | <janakali> In reply to @Amun-Ra "always git commit your": I have persistent history with backups in my neovim for that. I can literally go back to any point in time for every single file I was editing in the last ~2 years. |
08:08:15 | Amun-Ra | janakali: I store everything in my local repo, I can check the code difference between any days |
08:27:49 | FromDiscord | <kiloneie> Well, commit history has just so much, and i also 95% of the time copy paste my solutions into my issues on github. |
08:27:59 | FromDiscord | <kiloneie> So i got a pretty good history/backup i'd say |
08:32:33 | FromDiscord | <kiloneie> Is there a purpose to proc 2's tuple parameter ? https://media.discordapp.net/attachments/371759389889003532/1429024337205268632/Screenshot_2025-10-18_10-31-59.png?ex=68f4a21f&is=68f3509f&hm=5e695f7f5cf726ebf3929c6d2f86cda8ef340a613b64b7d2504247519dcaac6c& |
08:36:56 | FromDiscord | <alexander888alexander> I always wondered why python has tuples and frozen sets |
08:37:03 | FromDiscord | <alexander888alexander> why can't we just have constants |
09:02:32 | FromDiscord | <aethrvmn> In reply to @janakali "put flags into `config.nims`": Is this getting changed for Nim3? |
10:10:45 | * | zero` quit (Ping timeout: 256 seconds) |
10:11:22 | FromDiscord | <spotlightkid> @alexander888alexander\: Because Python is a dynamic language, i.e it has dynamic dispatch of methods, attributes etc. Making something immutable makes handling these objects more efficient, because the number of possible operations on/with them is much smaller.↵Why immutability is bound to the type rather than a variable qualifier like `const`. Because in Python variables are just labels and what they point to can be switched out |
10:23:48 | * | zero` joined #nim |
11:42:18 | FromDiscord | <.tokyovigilante> If I have a seq[float32], is there any better way to calculate RMS (root mean square) than `sqrt(foldl(values, a + b b) / values.len.float32)`↵` |
11:51:01 | * | zero` quit (Ping timeout: 264 seconds) |
11:51:19 | * | zero` joined #nim |
12:19:57 | FromDiscord | <ezic9276> sent a code paste, see https://play.nim-lang.org/#pasty=WzwPuPsE |
12:20:42 | FromDiscord | <ezic9276> (edit) "https://play.nim-lang.org/#pasty=rnZVWRXm" => "https://play.nim-lang.org/#pasty=PiZKivoI" |
12:21:13 | FromDiscord | <ezic9276> (edit) "https://play.nim-lang.org/#pasty=jBRaXdvs" => "https://play.nim-lang.org/#pasty=PMdvBDdY" |
12:21:31 | FromDiscord | <ezic9276> (edit) "https://play.nim-lang.org/#pasty=nqFMdtbL" => "https://play.nim-lang.org/#pasty=avVQUStk" |
12:21:46 | FromDiscord | <ezic9276> (edit) "https://paste.rs/74REE" => "https://paste.rs/hT5rb" |
12:25:40 | * | mahlon quit (Ping timeout: 244 seconds) |
12:54:28 | FromDiscord | <heysokam> In reply to @janakali "<@186489007247589376> https://nim-lang.org/docs/cty": ty. I arrived at the same files too, but they don't seem to add a `'i64` suffix 🤔 so I'm still puzzled by the error 🙁↵Maybe the error message itself is adding the suffix and its erroring for another reason? 🧩 its really confusing |
12:57:28 | FromDiscord | <heysokam> sent a code paste, see https://play.nim-lang.org/#pasty=naFzjTKV |
13:00:19 | FromDiscord | <ezic9276> So I have to name the attributes, right? |
13:00:42 | FromDiscord | <heysokam> a named tuple is still a tuple. I meant to make it a struct |
13:08:38 | FromDiscord | <ezic9276> so `object` keyword? but then I have to define [] myself, and I have to specify names, so 2 things that I want to avoid. Why is haveing MyType("a", 1) a bad idea? |
13:09:41 | FromDiscord | <ezic9276> (edit) "so ... `object``[]`" added "the" | "[]" => "`[]`" | "haveing" => "having" |
13:10:18 | FromDiscord | <ezic9276> (edit) "MyType("a", 1)" => "`MyType("a", 1)`" |
13:22:26 | FromDiscord | <heysokam> sent a long message, see https://pasty.ee/LIearMwL |
13:23:41 | FromDiscord | <heysokam> The "hack" part was referring to the unbounded nature of the function you described in your example↵`thing[3]` would crash, and your user would have no clue why |
13:31:24 | FromDiscord | <ezic9276> sent a code paste, see https://play.nim-lang.org/#pasty=XkCCCmMX |
13:32:44 | FromDiscord | <ezic9276> (edit) "https://play.nim-lang.org/#pasty=MUmUnBGg" => "https://play.nim-lang.org/#pasty=quswfXYT" |
13:52:49 | FromDiscord | <anuke> Are there any known libraries for LZF compression/decompression in Nim? |
15:16:39 | FromDiscord | <TFed> How to iterate a sequence from the end? Dont we have a `reverse()` or `mirror()` function, or iterator like `for i in seq from end:` to iterate the list in reverse |
15:18:44 | FromDiscord | <Robyn [She/Her]> In reply to @TFed "How to iterate a": `std/algorithm` |
15:19:09 | FromDiscord | <Robyn [She/Her]> Has `reversed` (returns a copy) and `reverse` (in-place) |
15:31:41 | FromDiscord | <lainlaylie> sent a code paste, see https://play.nim-lang.org/#pasty=qVAWWtcy |
15:42:19 | FromDiscord | <TFed> curious how to use `ritems` iterator 🤔, is it `for i in seq from end` or smth?↵(@lainlaylie) |
15:42:49 | FromDiscord | <TFed> oh got it\: `for i in seq.ritems()` |
15:42:50 | FromDiscord | <Laylie> just call it like any other iterator |
15:42:52 | FromDiscord | <Laylie> yeah that |
15:42:59 | FromDiscord | <TFed> thank you |
15:44:08 | FromDiscord | <TFed> thank you, also i was looking for reversing a table, however i think i can make the iterator myself now.↵(@Robyn [She/Her]) |
16:40:54 | Amun-Ra | anuke: pure lzf implementation or just a wrapper? |
16:45:11 | FromDiscord | <anuke> Either one, but at this point I gave up looking for a library and wrapped it myself <https://github.com/Anuken/nimlzf> |
16:45:43 | Amun-Ra | nice |
16:46:37 | Amun-Ra | you could include errno in IO exception |
16:47:01 | FromDiscord | <anuke> errno? |
16:47:09 | FromDiscord | <anuke> The library only seems to return 0 as an error code |
16:47:31 | FromDiscord | <anuke> there don't seem to be any descriptive errors |
16:47:31 | Amun-Ra | it stores error code in errno in that case |
16:48:00 | FromDiscord | <anuke> what is "errno"? |
16:48:13 | Amun-Ra | https://en.wikipedia.org/wiki/Errno.h |
16:48:43 | FromDiscord | <anuke> does nim have an API for accessing errno? |
16:49:19 | Amun-Ra | https://github.com/nim-lang/Nim/blob/devel/lib/std/syncio.nim#L166-L178 |
16:50:15 | Amun-Ra | it's a global variable that stores last function error |
16:50:37 | Amun-Ra | and strerror in a C standard library that return its string description |
16:50:45 | FromDiscord | <anuke> should I copy-paste `errno {.importc, header: "<errno.h>".}: cint` and such into the code? |
16:50:58 | FromDiscord | <anuke> as it doesn't seem to be exported |
16:51:53 | Amun-Ra | it's in standard library, it's safe to just include the line |
16:52:11 | Amun-Ra | same with strerror |
16:53:05 | * | rockcavera quit (Ping timeout: 256 seconds) |
17:00:06 | FromDiscord | <Elegantbeef> https://nim-lang.org/docs/oserrors.html#osLastError does exist |
17:03:15 | Amun-Ra | sure, but iirc that calls GetLastError on wintendo, and liblzf does not |
17:03:24 | FromDiscord | <anuke> ~~too late, I implemented it with the errno imports~~ |
17:03:26 | FromDiscord | <Robyn [She/Her]> In reply to @TFed "thank you, also i": for reversing a table, you can do `toSeq(tbl.pairs).reversed().initTable` |
17:03:54 | FromDiscord | <anuke> for some reason only decompression sets an error code, compression simply returns 0 upon failure |
17:04:23 | FromDiscord | <microssd.> hi. I have xml on a string, how do I process it? |
17:04:30 | FromDiscord | <Robyn [She/Her]> `pairs` is an iterator that returns the key and value of a table, we capture the data from the iterator with toSeq, reverse the sequence and initialise a new table with this value |
17:04:31 | Amun-Ra | anuke: good, it wouldn't work as expected on windows if you did |
17:04:48 | FromDiscord | <Elegantbeef> Good, who the fuck uses windows! \:D |
17:04:58 | Amun-Ra | true :P |
17:05:03 | FromDiscord | <Robyn [She/Her]> In reply to @microssd. "hi. I have xml": https://nim-lang.org/docs/xmlparser.html here |
17:05:24 | FromDiscord | <Elegantbeef> @Robyn [She/Her]Tables do not have an order do not encourage this |
17:05:41 | FromDiscord | <Robyn [She/Her]> In reply to @Elegantbeef "<@524288464422830095>*Tables do not have": I assumed they meant OrderedTable |
17:05:49 | FromDiscord | <Robyn [She/Her]> I forgot to use ordered table tho oops |
17:06:16 | FromDiscord | <Elegantbeef> You'd likely want to keep a concurrent list of the keys then just iterate those in reverse |
17:06:18 | FromDiscord | <Robyn [She/Her]> fixed |
17:06:40 | FromDiscord | <Robyn [She/Her]> In reply to @Elegantbeef "You'd likely want to": nabhh sequtils and algorithm go brrr |
17:07:29 | FromDiscord | <Elegantbeef> Though technically ordered tables should just have a built in iterator for reversed iterations |
17:13:37 | FromDiscord | <TFed> `toSeq(tbl.pairs).reversed()` worked as i just using the table for iterating. |
17:14:14 | FromDiscord | <anuke> In reply to @anuke "Either one, but at": is this worth adding to the package registry? |
17:15:37 | FromDiscord | <lainlaylie> i only glanced at it but it seems like a straight wrapper that still uses pointers and stuff? |
17:16:00 | FromDiscord | <lainlaylie> either way, you dont have to worry about being "good enough" for the registry, judging by the stuff that gets added there... |
17:16:19 | FromDiscord | <anuke> In reply to @lainlaylie "i only glanced at": there's a "high level" string wrapper similar to zippy |
17:21:31 | Amun-Ra | anuke: can't see why not |
17:24:51 | FromDiscord | <lainlaylie> if it were me i'd like make it openarray[char] and/or openarray[byte] instead and maybe add something funky like a iterator that does chunked de/compress or something |
17:32:48 | FromDiscord | <anuke> I just assumed the zippy developer(s?) knew what they were doing and copied that. I don't really need anything fancier for my use case |
17:34:39 | FromDiscord | <anuke> Not sure what the stance is on `string` vs `openArray[byte]` vs `seq[byte]` vs `byte/uint8`, it seems very inconsistent across libraries |
17:36:02 | Amun-Ra | I was never a fan of using string type for a buffer |
17:36:30 | Amun-Ra | openarray[byte] already includes seq[byte] |
17:36:40 | Amun-Ra | and adds array[n, byte] for fre |
17:36:42 | Amun-Ra | free* |
17:36:50 | FromDiscord | <anuke> I'm aware, but I believe I've seen some libraries use seq instead of openArray |
17:37:15 | Amun-Ra | hmm |
17:37:28 | FromDiscord | <anuke> In reply to @Amun-Ra "I was never a": string doesn't seem like the right data type for the job, yes, but as mentioned before, people still use it as such, so... |
17:37:46 | Amun-Ra | anuke: so is nim stdlib ;) |
17:37:56 | Amun-Ra | or so 'does' |
17:38:26 | FromDiscord | <anuke> augh |
17:38:46 | FromDiscord | <anuke> ~~Does nimv3/nimony address this?~~ |
17:39:02 | Amun-Ra | dunno |
17:40:09 | * | mahlon joined #nim |
17:45:01 | * | mahlon quit (Ping timeout: 250 seconds) |
17:45:06 | FromDiscord | <Elegantbeef> `openarray[byte]` is the best cause it can accept all data without casting↵(@anuke) |
17:45:09 | FromDiscord | <Elegantbeef> `toOpenArrayByte` exists for `openArray[char]` |
17:45:26 | FromDiscord | <Elegantbeef> You may want to just do `openArray[byte | char]` |
17:45:43 | FromDiscord | <anuke> What about as a return type? |
17:46:10 | FromDiscord | <anuke> e.g. compression returns `string`, a new buffer |
17:46:20 | FromDiscord | <anuke> `seq[byte]`? |
17:46:24 | FromDiscord | <Elegantbeef> As an existential `string` or `seq[char]` due to the above reasons |
17:47:05 | FromDiscord | <Elegantbeef> You have to cast to send a `seq[byte]` to `openArray[char]`, so it's less than ideal |
17:48:16 | Amun-Ra | I'm an old C fart and I tend to (over)use arrays when I can |
17:48:20 | FromDiscord | <anuke> how about `data: string | openArray[char] | openArray[byte]` as a parameter? |
17:49:03 | Amun-Ra | YOU DON'T NEED THAT STRING PART |
17:49:11 | Amun-Ra | sorry for those caps |
17:49:15 | FromDiscord | <anuke> why not? |
17:49:26 | FromDiscord | <Elegantbeef> nope that's just `openArray[char | byte]` but worse |
17:50:00 | Amun-Ra | my laptop suddenly entered the mode: "capslock off means caps" |
17:50:11 | FromDiscord | <Elegantbeef> Cause string -\> openArray[char] implicitly |
17:50:24 | Amun-Ra | ^ |
17:50:38 | FromDiscord | <anuke> ah I assumed it was explicit |
17:51:36 | FromDiscord | <Elegantbeef> `array[T, char]` `seq[char]` and `string` all pass to it without explicit conversion |
17:51:52 | FromDiscord | <Elegantbeef> Unless of course you have a `string` overload |
17:52:03 | FromDiscord | <Elegantbeef> Then `string` goes to `string` |
17:53:42 | FromDiscord | <anuke> this doesn't compile, what am I missing? https://media.discordapp.net/attachments/371759389889003532/1429165555968901181/image.png?ex=68f525a5&is=68f3d425&hm=1c4a685b64194a8469f8866d7b3b5ec6af7939e09646c51edfc96fdb70f4485c& |
17:54:08 | FromDiscord | <anuke> nim 2.0.8 (I refuse to upgrade because it doubles compile times) |
17:55:38 | FromDiscord | <anuke> requires an explicit `.toOpenArray(0, 2)` |
17:59:03 | FromDiscord | <demotomohiro> iirc, implicit type conversions doesn't work with type class parameters. |
17:59:35 | FromDiscord | <anuke> ...I think I'm just gonna stick to string for now |
18:01:56 | FromDiscord | <griffith1deadly> can't you make generic variants? T: openArray[char](data: T) ↵and then second for byte |
18:04:51 | FromDiscord | <Elegantbeef> You just do `data: openArray[byte | char]` and it should work |
18:10:24 | FromDiscord | <anuke> it does not https://play.nim-lang.org/#pasty=DKGvUGYQ |
18:11:55 | FromDiscord | <Elegantbeef> Silly compiler is silly |
18:12:01 | FromDiscord | <Elegantbeef> sent a code paste, see https://play.nim-lang.org/#pasty=wSANMgcq |
18:12:13 | FromDiscord | <Elegantbeef> Both should logically be the same but generics r hard |
19:12:05 | * | mahlon joined #nim |
20:26:46 | FromDiscord | <.tokyovigilante> is it ORC-safe to pass an object that contains a `seq[float]` down a `Channel`? I have an audio app which needs to shuffle PCM chunks down a pipeline/graph, and was hoping to use threads/channels. I have a lock-free ringbuffer that I'm using for realtime ops, but would prefer to operate on sample chunks with metadata (timestamp etc). |
20:27:37 | FromDiscord | <.tokyovigilante> Docs say `TMsg` is deeply copied, so I assume yes, but then deep copying seems controversial? https://forum.nim-lang.org/t/9868 |
21:24:02 | FromDiscord | <kubo39> I tried to use SRWLock for mutex on windows, but I found that Nim supports Windows XP and OS X 10.4(including ppc!!!) How maintain these? |
21:24:53 | FromDiscord | <kubo39> (edit) "I tried to use SRWLock for ... mutex" added "stdlib's" |
21:30:46 | FromDiscord | <kubo39> In reply to @kubo39 "I tried to use": FYI: python drops so often 😅 https://pythondev.readthedocs.io/platforms.html#windows |
21:42:22 | * | SchweinDeBurg quit (Ping timeout: 260 seconds) |
21:43:11 | * | SchweinDeBurg joined #nim |
22:37:15 | * | beholders_eye quit (Quit: WeeChat 4.6.3) |