00:14:16 | FromDiscord | <guttural666> i shouldn't have to compile with --threads:on anymore in Nim 2? |
00:14:27 | FromDiscord | <guttural666> (edit) "2?" => "2, right??" |
00:14:31 | FromDiscord | <guttural666> (edit) "right??" => "right?" |
00:14:55 | * | NunavuT quit (Killed (NickServ (GHOST command used by Nunavut_))) |
00:14:58 | * | NunavuT joined #nim |
00:19:40 | * | NunavuT quit (Killed (NickServ (GHOST command used by Nunavut_))) |
00:19:43 | * | NunavuT joined #nim |
00:32:22 | FromDiscord | <that_dude.> Is owned a keyword in nim? I see that I used that word as a var and I see some syntax highlighting showing it differently |
01:02:20 | FromDiscord | <ravinder387> if anybody know |
01:03:03 | FromDiscord | <ravinder387> sent a code paste, see https://paste.rs/v7rB9 |
01:03:12 | FromDiscord | <ravinder387> why gcc -c not write here |
01:03:18 | FromDiscord | <ravinder387> sent a code paste, see https://paste.rs/MQJWA |
01:03:43 | FromDiscord | <ravinder387> sent a code paste, see https://paste.rs/VQbuW |
01:03:49 | FromDiscord | <guttural666> sent a long message, see https://paste.rs/ssD6H |
01:04:23 | FromDiscord | <ravinder387> sent a code paste, see https://paste.rs/0dRPh |
01:04:59 | FromDiscord | <ravinder387> sent a code paste, see https://paste.rs/ngKd5 |
01:08:55 | FromDiscord | <ravinder387> sent a code paste, see https://paste.rs/W6vFe |
01:10:17 | FromDiscord | <Elegantbeef> `initDeque[string]` is a proc not a `Deque[string]` |
01:10:21 | FromDiscord | <Elegantbeef> you want `initDeque[string]()` |
01:15:37 | FromDiscord | <ravinder387> gcc -c not allowed multiple files .c |
01:15:50 | FromDiscord | <guttural666> hm okay, and how do I make the queue gc safe, so I can access/write to it from multiple threads? |
01:16:03 | FromDiscord | <Elegantbeef> You don't 😄 |
01:16:10 | FromDiscord | <Elegantbeef> `{.cast(gcSafe).}` |
01:18:24 | FromDiscord | <guttural666> if I have a queue and somebody has to write to it and the scheduler has to read from it, that is my problem rn |
01:18:34 | FromDiscord | <bostonboston> is it still recommended to use the `{.guard: .}` pragma and `withLock` template |
01:18:41 | FromDiscord | <Elegantbeef> Yes |
01:18:44 | FromDiscord | <Elegantbeef> sent a code paste, see https://paste.rs/o351R |
01:19:15 | FromDiscord | <Elegantbeef> Though I'd say a `ptr (Deque[string, Lock)` makes more sense than a global variable |
01:19:16 | FromDiscord | <guttural666> (edit) "it," => "it (and pop the queue)," |
01:19:27 | FromDiscord | <Elegantbeef> Although I have no clue if deques explode when shared across thread |
01:19:52 | FromDiscord | <Elegantbeef> Isn't that global pragma redundant |
01:20:04 | FromDiscord | <Elegantbeef> It's not marked `{.threadVar.}` |
01:20:24 | FromDiscord | <bostonboston> probably, I copied it from another codebase of mine thats probably wrong |
01:20:41 | FromDiscord | <Elegantbeef> Global is for making variables inside of a procedure global |
01:21:02 | FromDiscord | <bostonboston> I knew it did that, suppose I thought it did more |
01:21:28 | FromDiscord | <bostonboston> sent a code paste, see https://paste.rs/VFIeA |
01:22:02 | FromDiscord | <guttural666> thanks, going to investigate that |
01:22:20 | FromDiscord | <bostonboston> `{.threadVar.}` makes a copy not a reference yeah? |
01:23:25 | FromDiscord | <Elegantbeef> It makes each thread have it's own variable |
01:23:28 | FromDiscord | <Elegantbeef> So it's thread local |
01:23:33 | FromDiscord | <Elegantbeef> Without it it's global |
01:23:58 | FromDiscord | <bostonboston> ah |
01:58:31 | * | azimut quit (Ping timeout: 240 seconds) |
02:21:47 | nmz | Is the documentation in a pdf? |
02:29:16 | * | NunavuT quit (Remote host closed the connection) |
02:33:21 | nmz | oh, the html is in the package, sorry |
03:10:25 | FromDiscord | <bostonboston> what is `owned` used for, not many docs on it |
03:13:08 | FromDiscord | <Elegantbeef> It's a deprecated idea that was meant to indicate ownership |
03:13:16 | FromDiscord | <Elegantbeef> move semantics and `isolated` I think mostly replaced it |
03:14:36 | FromDiscord | <stoneface86> was wondering what that was, std/streams still uses it |
03:18:00 | FromDiscord | <bostonboston> how do `lent` and `sink` fit in to that |
03:18:06 | FromDiscord | <bostonboston> if at all |
03:20:38 | FromDiscord | <Elegantbeef> Well `owned` was the first pass at ARC really inside of the "newRuntime" |
03:20:57 | FromDiscord | <Elegantbeef> https://github.com/nim-lang/RFCs/issues/144 |
03:21:19 | FromDiscord | <Elegantbeef> Owned has turned into isolated afaik |
03:21:23 | FromDiscord | <Elegantbeef> Atleast in some part |
03:23:26 | FromDiscord | <Elegantbeef> Actually that's not really true cause `owned` was meant to allow you to share resources across threads but only have one side actually own it |
03:30:45 | * | def- quit (Quit: -) |
03:35:04 | * | def- joined #nim |
05:55:52 | * | sagax joined #nim |
06:15:00 | * | rockcavera quit (Remote host closed the connection) |
06:15:25 | * | disso_pch quit (Ping timeout: 256 seconds) |
06:19:30 | * | azimut joined #nim |
06:22:06 | * | disso-peach joined #nim |
06:50:33 | * | advesperacit joined #nim |
07:16:15 | * | azimut quit (Remote host closed the connection) |
07:16:35 | * | azimut joined #nim |
07:23:47 | FromDiscord | <JJ> curious as to if anyone sees why this doesn't compile? nim is complaining about a type mismatch at the call of `consumes` |
07:24:14 | FromDiscord | <Elegantbeef> `func head: T` is just 100% wrong |
07:24:21 | FromDiscord | <Elegantbeef> Ah nvm newstyle concept |
07:24:50 | * | kenran joined #nim |
07:24:51 | FromDiscord | <Elegantbeef> you do not have a `proc head: char` |
07:24:53 | FromDiscord | <JJ> yeah "concepts". i really with they were properly called interfaces |
07:25:05 | FromDiscord | <Elegantbeef> They're not interfaces though |
07:25:27 | FromDiscord | <JJ> sure they are! in so far as interfaces is a quite underdefined word |
07:25:31 | FromDiscord | <Elegantbeef> So why would they be called that |
07:25:34 | FromDiscord | <JJ> sent a code paste, see https://paste.rs/e4Pqp |
07:25:58 | FromDiscord | <JJ> i mean they've got implicit implementations, but when i think of describing a type by its behavior, i think of the term "interface" |
07:26:01 | FromDiscord | <Elegantbeef> When most people here interfaces they will imagine the most popular implementations of them such as Go, C#, Java! |
07:26:03 | FromDiscord | <Elegantbeef> hear\ |
07:26:09 | FromDiscord | <Elegantbeef> Anywho that's neither here nor there |
07:26:32 | FromDiscord | <Elegantbeef> Your concept has a `func head: T` but you do not have the corresponding `func head: char` |
07:26:48 | FromDiscord | <JJ> In reply to @Elegantbeef "When most people here": simple solution: nim stabilizes them, their raw appeal leads to a meteoric rise in popularity, java is forced to change the name of their interfaces due to confusion |
07:27:17 | FromDiscord | <JJ> In reply to @Elegantbeef "Your concept has a": isn't my `func head[T](stream: StreamImpl[T]): T` this? |
07:27:23 | FromDiscord | <Elegantbeef> No |
07:27:31 | FromDiscord | <Elegantbeef> that'd be `func head(_: Self): Self` |
07:27:50 | FromDiscord | <Elegantbeef> It does not intuit the first parameter is `Self` as that's dumb |
07:28:20 | FromDiscord | <Elegantbeef> sorry that return type would be `T` |
07:28:36 | FromDiscord | <JJ> In reply to @Elegantbeef "that'd be `func head(_:": oh 🤦 |
07:28:48 | FromDiscord | <Elegantbeef> That still does not resolve it though |
07:29:04 | FromDiscord | <Elegantbeef> Probably cause new style concepts are faulty |
07:29:06 | FromDiscord | <JJ> hm wait i'm still getting the same error |
07:29:08 | FromDiscord | <JJ> yea |
07:29:10 | FromDiscord | <JJ> ah rip |
07:30:03 | FromDiscord | <Elegantbeef> I dislike new styled concepts, they're quite limited in their present design and have so many issues |
07:30:44 | FromDiscord | <JJ> i dunno. i think new style concepts could be really good if the standard library used them extensively |
07:30:52 | FromDiscord | <JJ> kind of like rust traits, but implicitly implemented |
07:31:09 | FromDiscord | <Elegantbeef> I mean sure, if new style worked |
07:31:14 | FromDiscord | <JJ> i do not like that they are broken however 😠 |
07:31:15 | FromDiscord | <JJ> lmao yeah |
07:31:17 | FromDiscord | <Elegantbeef> Old style concepts work better(Somehow that's possible) |
07:31:39 | FromDiscord | <Elegantbeef> sent a code paste, see https://paste.rs/8Gx5Z |
07:33:26 | FromDiscord | <Elegantbeef> You can of course make an issue if you want to |
07:33:36 | FromDiscord | <JJ> hmm, what'd you change? i cannot spot the difference |
07:33:46 | FromDiscord | <JJ> aside from the Self parameters |
07:33:46 | FromDiscord | <Elegantbeef> I removed the generic on the `StreamImpl` |
07:33:59 | FromDiscord | <JJ> ah interesting |
07:34:12 | FromDiscord | <Elegantbeef> sent a code paste, see https://paste.rs/CkMxB |
07:34:36 | FromDiscord | <JJ> yeah i might. weird behavior |
07:35:24 | FromDiscord | <Elegantbeef> In closing use old style concepts |
07:35:28 | FromDiscord | <Elegantbeef> They're more reliable and just better imo |
07:35:58 | FromDiscord | <graveflo> did `stmt` used to be a keyword? does it mean `untyped` now? |
07:36:06 | FromDiscord | <Elegantbeef> Yes |
07:36:09 | FromDiscord | <graveflo> ty |
07:36:14 | FromDiscord | <Elegantbeef> Think it was `stmt -> untyped` `expr -> typed` |
07:36:23 | FromDiscord | <Elegantbeef> Might be wrong |
07:36:31 | FromDiscord | <graveflo> seems to check out |
07:38:44 | FromDiscord | <Elegantbeef> Oh shit JJ I know what it is now |
07:38:51 | FromDiscord | <Elegantbeef> It's the fucking type alias probably |
07:39:15 | FromDiscord | <Elegantbeef> Yea |
07:39:25 | FromDiscord | <Elegantbeef> Generic type aliases are awful in the present type graph |
07:41:22 | FromDiscord | <Elegantbeef> sent a code paste, see https://paste.rs/V1Nni |
07:41:46 | FromDiscord | <JJ> In reply to @Elegantbeef "It's the fucking type": wtf?? that's uh |
07:41:54 | FromDiscord | <JJ> really terrifying actually |
07:42:16 | FromDiscord | <Elegantbeef> You've clearly never looked at how PType works |
07:42:18 | FromDiscord | <Elegantbeef> Or supposedly works |
07:42:39 | FromDiscord | <Elegantbeef> I'm just hopeful that https://github.com/nim-lang/Nim/pull/23023 makes it work |
07:43:19 | FromDiscord | <Elegantbeef> There are quite a lot of generic related things that the present type graph do not correctly handle |
07:45:04 | FromDiscord | <Elegantbeef> Luckily if you add a field to `B` that uses the generic parameter this goes away |
07:45:18 | FromDiscord | <Elegantbeef> So it's not an issue unless you want to attach type information to a reference |
07:46:37 | FromDiscord | <Elegantbeef> sent a code paste, see https://paste.rs/aCTif |
07:55:07 | * | PMunch joined #nim |
07:59:44 | * | disso_pch joined #nim |
08:02:34 | * | disso-peach quit (Ping timeout: 256 seconds) |
09:33:32 | FromDiscord | <odexine> Type atrocities |
09:34:35 | FromDiscord | <Elegantbeef> The `of` checking works on the instantiated bodies, so since they're the same in the first case they're the same type |
09:34:37 | FromDiscord | <JJ> oh thank god. this now alleviates all my concerns. |
09:34:49 | FromDiscord | <JJ> (it does not) |
09:34:58 | FromDiscord | <JJ> sent a code paste, see https://paste.rs/1Ag6T |
09:35:26 | FromDiscord | <Elegantbeef> I did look into fixing this and it's quite a annoying thing 😄 |
09:35:54 | FromDiscord | <Elegantbeef> sent a code paste, see https://paste.rs/zNxRE |
09:36:17 | FromDiscord | <Elegantbeef> https://github.com/nim-lang/Nim/blob/202e21daba1424762cf330effb52220c6f1d5772/compiler/types.nim#L1364-L1386 the issue resides inside here |
09:36:56 | FromDiscord | <Elegantbeef> `skipPtrs` causes it to skip over the type to find the parent type since they have the same bodies they're the same |
09:39:28 | FromDiscord | <Elegantbeef> Oh also JJ you should make `std/streams` using concepts, thanks |
09:47:24 | FromDiscord | <JJ> ha oh no |
09:47:48 | FromDiscord | <JJ> well actually uh, that might be a better implementation than whatever this is?? https://github.com/nim-lang/Nim/blob/version-2-0/lib/pure/streams.nim#L111 |
09:47:54 | FromDiscord | <JJ> (edit) "https://github.com/nim-lang/Nim/blob/version-2-0/lib/pure/streams.nim#L111" => "↵https://github.com/nim-lang/Nim/blob/version-2-0/lib/pure/streams.nim#L111" |
09:48:50 | FromDiscord | <JJ> i see that `StreamObj = ref object of RootObj` pattern a lot and have never liked how it feels on my eyes |
09:50:49 | FromDiscord | <nnsee> "feels on the eyes"? isn't that "looks"? lmao |
10:10:39 | FromDiscord | <shoujouy> Is there a way to get user input without blocking terminal? getch doesnt satisfy me because of blocking |
10:16:55 | FromDiscord | <odexine> Not with windows IIRC |
10:17:05 | FromDiscord | <odexine> Rather, not with windows and single threading |
10:17:06 | FromDiscord | <shoujouy> I use linux |
10:30:05 | PMunch | In Linux it should be fairly easy |
10:30:20 | PMunch | I think there is an asyncpipe module out there somewhere |
10:30:24 | PMunch | NimLSP uses it IIRC |
10:38:14 | FromDiscord | <shoujouy> working on it |
11:20:51 | FromDiscord | <alireza0x0> why it is not possilbe to cast a pointer to uncheckedarray[char] ...?↵did i misunderstand something about unchecked arrays? |
11:21:04 | * | disso_pch quit (Quit: Leaving) |
11:23:43 | FromDiscord | <nnsee> arrays are not pointers in nim |
11:25:22 | PMunch | You can cast a pointer to `ptr UncheckedArray[char]` or to `UncheckedArray[ptr char]` |
11:25:44 | PMunch | Unchecked arrays are the actual memory, not the pointer to it |
11:27:14 | FromDiscord | <odexine> You said in internals “yes but, ptr unchecked array is a char” |
11:27:16 | FromDiscord | <odexine> No it is not |
11:27:29 | FromDiscord | <odexine> UncheckedArray does not signify a pointer |
11:28:08 | FromDiscord | <odexine> If you think of it this way, unchecked array signifies that there is contiguous memory of type T |
11:28:31 | FromDiscord | <odexine> So a pointer to an unchecked array of characters is conceptually what char is |
11:30:10 | FromDiscord | <odexine> So an unchecked array is quite literally what it says it is, an unchecked array; just like how arrays in Nim (the one with the size in its type this time) aren’t pointers, they’re whole contiguous portions of memory |
11:34:04 | FromDiscord | <Phil> When you write "whole contiguous portions of memory", do you mean "That's memory in stack"? |
11:34:15 | FromDiscord | <odexine> No |
11:34:22 | FromDiscord | <odexine> I mean nothing about stack heap or whatever |
11:34:23 | FromDiscord | <Phil> I doN't do much with arrays so I legit don't know |
11:34:40 | FromDiscord | <odexine> It could be in stack or heap |
11:40:10 | FromDiscord | <odexine> In reply to @isofruit "When you write "whole": An array is not necessarily stack naturally because anything stored in a containing data type that is heap allocated is automatically also in the heap (with even further exceptions) |
11:40:20 | FromDiscord | <Phil> So my underlying understanding so far of ↵array => stack (its members may be in heap but the array itself is stack)↵ref/ptr array => heap↵Is wrong ? |
11:40:43 | FromDiscord | <odexine> Where would a global array be stored in memory? |
11:41:33 | FromDiscord | <Phil> .... on the stack ? (Like legit question mark, my understanding so far was that stack but now I no longer know) |
11:41:38 | FromDiscord | <odexine> In reply to @isofruit "So my underlying understanding": It’s mostly right but again exceptions are difficult |
11:41:50 | FromDiscord | <odexine> In reply to @isofruit ".... on the stack": There’s no stack if there’s no function no? |
11:42:34 | FromDiscord | <Phil> There isn't? I mean "global scope" is all stuff inside of nim's nim-main function that gets generated, no? |
11:42:39 | FromDiscord | <odexine> In the case of globals it’s neither stack nor heap |
11:44:03 | FromDiscord | <odexine> In reply to @isofruit "There isn't? I mean": Not necessarily? I’m not too sure about it but I believe in some situations when globals are accessed by all sorts of procedures and statements they’re generated as a C-style global |
11:45:12 | FromDiscord | <Phil> So nim codegen implementation details aside, a "true global" would be stored in what, memory for instructions (forgot the name for it) ? |
11:46:32 | FromDiscord | <odexine> No there’s a section in the program called a data section and that’s where it gets stored |
11:47:18 | FromDiscord | <Phil> So there's stack memory. heap memory. instruction... whatever. And data section... memory (?). |
11:47:35 | FromDiscord | <odexine> Pretty much |
11:47:58 | FromDiscord | <Phil> Given that 1 year ago the amounts of memory I knew of was half that I'd say, strong learning curve of 100% since then! |
11:49:18 | FromDiscord | <Phil> People need to start inventing more memory types for me to keep it up! |
11:50:25 | FromDiscord | <odexine> In reply to @isofruit "So my underlying understanding": If you want a more solid rule, basically as long as all container types of the array (or in fact any value type) are stack, then its stack, but as soon as one container type is a reference or a heap allocated pointer, then it’s heap |
11:50:47 | FromDiscord | <odexine> In reply to @isofruit "People need to start": GCs have further subdivisions for garbage management |
11:51:05 | FromDiscord | <Phil> In reply to @odexine "GCs have further subdivisions": Fuck my life ☠️ |
11:51:08 | PMunch | Doesn't the data section of the executable get loaded onto the stack or heap before execution begins? |
11:51:15 | FromDiscord | <odexine> Does it? |
11:51:25 | FromDiscord | <odexine> I was under the impression that it’s its own section |
11:52:06 | FromDiscord | <exelotl> In reply to @isofruit "People need to start": u gotta go to specific platforms next :P↵GBA has IWRAM, EWRAM, VRAM, PAL RAM, OAM, SRAM, ROM, ... |
11:52:26 | FromDiscord | <Phil> So what I'm learning |
11:52:46 | FromDiscord | <Phil> Is that after I just barely crawled out of the rabbit hole that is "threads treated as servers for app development" |
11:52:52 | FromDiscord | <Phil> Well, still in the process more like |
11:53:03 | PMunch | Ah, you appear to be right odexine, the data section is indeed allocated under the heap: https://upload.wikimedia.org/wikipedia/commons/5/50/Program_memory_layout.pdf |
11:53:10 | FromDiscord | <Phil> There's yet another rabbit hole waiting called "Memory types" in order to kill me |
11:53:39 | PMunch | In general you don't really have to ever think about it |
11:53:51 | PMunch | The stack/heap distinction is by far the most useful one to keep in mind |
11:54:19 | PMunch | text/data/bss just gets allocated (and potentially populated) when your program starts and will stick around until it quits. |
11:54:32 | FromDiscord | <Phil> bss? |
11:54:35 | FromDiscord | <odexine> By the way I’m Rika if you’ve forgotten |
11:54:41 | PMunch | BullShit Stuff |
11:54:50 | PMunch | I remember :) |
11:55:44 | PMunch | Phil, have a look here: https://en.wikipedia.org/wiki/Data_segment |
11:56:15 | FromDiscord | <odexine> In reply to @PMunch "Ah, you appear to": I assume it depends on the architecture |
11:56:29 | FromDiscord | <Phil> I have spent legit like 2 years now exposing myself to lower level concepts, how am I still getting left fielded on fundamental stuff, ahhhhh 🤣 |
11:56:42 | FromDiscord | <odexine> In reply to @isofruit "I have spent legit": You probably need a good book or something |
11:57:35 | PMunch | Basically an executable contains a couple sections. Obviously the code that should be run, but also "initialized globals" which it just copies into memory, then it also has a "uninitialized globals" section which is basically just a way to say that some memory should be allocated, but without having to pad the executable with a bunch of zeros. Then you have your stack and heap which grows towards each other. |
11:59:38 | FromDiscord | <odexine> I keep on forgetting what BSS stands for |
11:59:49 | FromDiscord | <odexine> bullshit stack |
12:02:26 | PMunch | Apparently it's block starting symbol |
12:03:16 | PMunch | Not sure I understand why though.. |
12:19:19 | FromDiscord | <9ih> how do you mofos parse an int64 from a string |
12:20:23 | FromDiscord | <9ih> nvm the int is 64 bits |
12:20:27 | FromDiscord | <9ih> apparently |
12:22:36 | FromDiscord | <nnsee> sent a long message, see https://paste.rs/HC7c6 |
12:22:44 | FromDiscord | <odexine> Darned Fortran |
12:31:54 | PMunch | 9ih, int is the same size as a pointer |
12:32:03 | PMunch | So on 64-bit machines it's 64 bits |
12:32:09 | PMunch | On 32 bit machines it's 32 bits |
12:32:26 | PMunch | And on microcontrollers and such it's not uncommon to find it be 16 bits. |
12:33:33 | PMunch | You can use parseBiggestInt which parses the biggest integer Nim supports, which is int64 |
13:18:00 | FromDiscord | <cy_tek> sent a code paste, see https://paste.rs/OyG4h |
13:18:10 | FromDiscord | <nnsee> just to test, does the error go away when you create a git commit? |
13:18:39 | FromDiscord | <nnsee> ie `git add -A && git commit -m "initial commit"` |
13:19:23 | FromDiscord | <nnsee> it looks like your project might be a git project with no commits and nimble doesn't like that |
13:20:06 | FromDiscord | <nnsee> `nimble run` tries to resolve and install dependencies before running and apparently parses the project's own dir during that? no clue why |
13:21:06 | FromDiscord | <cy_tek> In reply to @nnsee "just to test, does": Yes, it does go away after I make a git commit, but it did that even without a `.git` directory, so it was before it was even a git project which is what I found so strange. Thank you so much though, I super appreciate the help, and now I'll know why it's failing lol 🙂 |
13:21:20 | FromDiscord | <nnsee> `/Users` - this is a mac, right? |
13:21:27 | FromDiscord | <cy_tek> In reply to @nnsee "`/Users` - this is": Yup 🙂 |
13:21:33 | FromDiscord | <spotlightkid> the warning from `nimble --version` is probably because nimble itself was not installed from git. |
13:22:00 | FromDiscord | <nnsee> In reply to @cy_tek "Yup 🙂": apparently this is a known issue on macs, https://stackoverflow.com/questions/12267912/git-error-fatal-ambiguous-argument-head-unknown-revision-or-path-not-in-the for more context |
13:22:46 | FromDiscord | <nnsee> or maybe it's not related to mac at all, and that's just what the OP was using at the time |
13:23:17 | FromDiscord | <nnsee> In reply to @cy_tek "Yes, it does go": that is strange |
13:24:19 | FromDiscord | <nnsee> although for what it's worth, i just tested on linux and i can't seem to be able to reproduce this |
13:24:32 | FromDiscord | <nnsee> either with no `.git` or a `.git` with no commits |
13:25:10 | FromDiscord | <nnsee> oh, wait, scractch that |
13:25:48 | FromDiscord | <nnsee> it works fine for me with no `.git` directory, but it gives the same error when i init a new `.git` with no commits |
13:25:55 | FromDiscord | <nnsee> sorry for the wrong information haha |
13:26:34 | FromDiscord | <cy_tek> In reply to @nnsee "sorry for the wrong": No worries haha, I do wonder though what the difference is that causes it to fail like in the message I sent above where I go and remove the `.git` folder and it still errors out 😦 |
13:26:51 | FromDiscord | <nnsee> hm |
13:27:11 | FromDiscord | <nnsee> in `nim_test`, if you've removed the `.git` directory, does `git status` there show anything? |
13:27:16 | FromDiscord | <cy_tek> sent a code paste, see https://paste.rs/0dY8v |
13:27:26 | FromDiscord | <nnsee> maybe you've accidentally init'd a new repo in one of the upper directories |
13:29:02 | FromDiscord | <cy_tek> In reply to @nnsee "maybe you've accidentally init'd": Thank you thank you thank you! Yes... that was exactly what the problem was lol 😅 Somehow I had accidentally inited a git directory into my home dir 😲 |
13:29:38 | FromDiscord | <cy_tek> I never would have thought of that haha, so yeah, thanks, that completely fixes the issue for me 🙂 |
13:29:49 | FromDiscord | <nnsee> great! happens to the best of us lol |
13:30:38 | FromDiscord | <nnsee> that `status` listing must've been massive |
13:31:36 | FromDiscord | <cy_tek> In reply to @nnsee "that `status` listing must've": Yeah....it was insane lol 😂 |
13:44:42 | * | rockcavera joined #nim |
13:48:54 | * | Guest91 joined #nim |
13:49:54 | Guest91 | Hey guys, is it possible to index into a slice? Say I got let f = 50 .. 100, it seems I can't do f[10] to get the 11th element of the slice? |
13:53:08 | * | Guest91 quit (Client Quit) |
13:55:53 | PMunch | Not by default, but you can implement the index operator quite easily |
13:56:25 | * | Guest91 joined #nim |
13:56:42 | Guest91 | I got |
13:56:43 | Guest91 | ``` |
13:56:43 | Guest91 | proc nth(slice: HSlice[int, int], needle: int): int = |
13:56:44 | Guest91 | for idx, n in enumerate(slice): |
13:56:44 | Guest91 | if needle == idx: |
13:56:45 | Guest91 | return n |
13:56:45 | Guest91 | ``` |
13:56:46 | Guest91 | but not sure it can be more efficient? |
13:56:56 | PMunch | Please don't paste code into IRC.. |
13:57:01 | PMunch | Use a paste service of some kind |
13:57:16 | Guest91 | Sorry! |
13:57:26 | PMunch | Uhm, that's quite inefficient |
13:57:31 | FromDiscord | <nnsee> just add the needle to the hslice's `a` (lower bound) |
13:57:49 | PMunch | Try template `[]`(x: HSlice, y: int): untyped = x.a + y |
13:58:28 | Guest91 | Yup I'm an idiot. Thanks 🙏 |
13:58:32 | PMunch | Alternatively throw an `assert x.b - x.a >= y` in there to check the range |
13:59:00 | FromDiscord | <nnsee> probably _optionally_, not _alternatively_ |
13:59:13 | PMunch | Indeed! |
14:00:52 | PMunch | Hmm, ix.io is still down.. |
14:00:58 | Guest91 | Makes sense, thanks guys! |
14:01:02 | * | Guest91 quit (Client Quit) |
14:40:07 | * | azimut quit (Ping timeout: 240 seconds) |
14:40:58 | * | azimut joined #nim |
14:42:33 | * | rockcavera quit (Remote host closed the connection) |
14:47:24 | * | DimensionalX joined #nim |
14:47:31 | * | DimensionalX left #nim (#nim) |
14:55:19 | * | azimut quit (Ping timeout: 240 seconds) |
15:06:38 | * | azimut joined #nim |
15:06:42 | * | kenran quit (Remote host closed the connection) |
15:21:22 | * | jmdaemon quit (Ping timeout: 260 seconds) |
15:25:14 | * | PMunch quit (Quit: Leaving) |
16:08:29 | * | disso-peach joined #nim |
16:44:31 | FromDiscord | <ntzeno> Hello folks, if I want everything in one file to be exported, do I have to manually add `` to everything, or is there something that exports everything in file ? |
16:44:47 | FromDiscord | <ntzeno> (edit) "Hello folks, if I want everything in one file to be exported, do I have to manually add `` to everything, or is there something that exports everything in file ... ?" added "without me manually adding `` to everything" |
16:57:31 | FromDiscord | <nnsee> In reply to @ntzeno "Hello folks, if I": last time I asked this was a few years ago and the answer was "no" |
16:57:35 | FromDiscord | <nnsee> but maybe something has changed recently |
16:57:46 | FromDiscord | <nnsee> ah, the answer i got was "you can probably write a macro for it" |
16:57:55 | FromDiscord | <Chronos [She/Her]> In reply to @ntzeno "Hello folks, if I": Yeah, you have to manually export it all |
16:58:04 | FromDiscord | <Chronos [She/Her]> In reply to @nnsee "ah, the answer i": Was about to say that too :p |
16:59:40 | * | sagax quit (Quit: Konversation terminated!) |
17:00:21 | FromDiscord | <ntzeno> In reply to @nnsee "ah, the answer i": Sad, I don't really want to bother with macros |
17:00:28 | FromDiscord | <ntzeno> I'll just export manually anyways, ty @Chronos [She/Her] @nnsee |
17:22:29 | * | rockcavera joined #nim |
17:53:08 | * | eery joined #nim |
18:02:00 | eery | So std/parsecfg has some behavior I think is a bug - values with embedded quotation marks get triple quoted _and_ escaped, so writing/reading back replace newlines with escaped newline literals, but only for values with quotes inside |
18:02:25 | eery | I have a patch for it but this would change the runtime behavior |
18:55:40 | FromDiscord | <apetransaction> sent a code paste, see https://paste.rs/MtEX1 |
18:57:59 | FromDiscord | <apetransaction> (edit) "https://paste.rs/C6JTM" => "https://paste.rs/f9Tms" |
19:18:38 | FromDiscord | <bostonboston> You can write a 'wrapper' function |
19:19:20 | FromDiscord | <dissolved.girl> Let's imagine that the proc has a case statement that handles all possible Opcode values (and doesn't have a default case). What should happen when you pass an arbitrary value or modify the enum itself? Suddenly, not all cases are covered. |
19:31:58 | * | jkl quit (Quit: Gone.) |
19:33:35 | * | jkl joined #nim |
19:39:23 | FromDiscord | <srabb> is nim a registered trademark |
19:46:53 | FromDiscord | <systemonia> there's nothing on the website, plus no relevant results returned when I searched it in tmsearch.uspto.gov or euipo.europa.eu so I assume no. |
19:54:14 | * | jmdaemon joined #nim |
20:10:34 | FromDiscord | <kaddkaka> Suddenly my nimlsp says "In orde to get the IDE features working you must either configure nim.p↵rojectMapping or import the module." |
20:11:00 | FromDiscord | <kaddkaka> Suddenly as in "I just restarted my editor" |
20:15:03 | FromDiscord | <kaddkaka> sent a code paste, see https://paste.rs/qaLxx |
20:21:34 | FromDiscord | <JJ> lsp in general is very weird with wanting a "project root" of sorts. try opening the containing folder in your ide, and then opening each of the two files. |
20:23:14 | FromDiscord | <kaddkaka> I'm in the folder when I alarm neovim, so the cwd is the folder with the two files |
20:23:32 | FromDiscord | <JJ> since nim does not have ex. a cargo.lock the language server has to make a best guess of where the "project" is, and the best guess is occasionally wrong |
20:23:48 | FromDiscord | <JJ> hm |
20:23:54 | FromDiscord | <kaddkaka> I only get the message when day5_2.nim, but not even opening day5.nim |
20:24:17 | FromDiscord | <JJ> if you open day5_2.nim first do you still get the message in it? |
20:24:20 | FromDiscord | <kaddkaka> (edit) "I only get the message when ... day5_2.nim,when" added "opening" | "even" => "when" |
20:24:24 | FromDiscord | <kaddkaka> Yes |
20:24:43 | FromDiscord | <kaddkaka> So I'm guessing some kind of caching ? |
20:24:51 | FromDiscord | <JJ> that's very strange. do you have any files related to nimble in the directory? |
20:25:00 | FromDiscord | <JJ> maybe? i've got no idea, honestly |
20:25:24 | FromDiscord | <kaddkaka> Nope, the 2 nim files are the only files there |
20:25:58 | FromDiscord | <JJ> hm yeah that sounds like something weird with caching then |
20:26:46 | FromDiscord | <JJ> my only other suggestion would be to kill all nimsuggest/nimlangserver processes, they can get orphaned pretty frequently (though i wouldn't think it would affect the editor??) |
20:31:48 | FromDiscord | <kaddkaka> Ooh, I have a lot of nim suggest processes running/sleeping! |
20:32:38 | FromDiscord | <kaddkaka> Hmm |
20:32:48 | FromDiscord | <kaddkaka> Still same messages after killing all of them |
20:33:13 | FromDiscord | <kaddkaka> And nimsuggest is still running after closing neovim 😬 |
20:33:41 | FromDiscord | <kaddkaka> I guess no shutdown command is sent over lsp protocol |
20:37:23 | FromDiscord | <kaddkaka> In reply to @kaddkaka "Still same messages after": so even if neovim is bad at closing down, nimsuggest still seems weak at understanding two separate files in same folder. (there is no relative import or so, they are both standalone scripts) |
20:45:14 | FromDiscord | <alireza0x0> guys, i want to write a destructor for my ref obj |
20:45:39 | FromDiscord | <alireza0x0> i mean sink not des |
20:46:12 | FromDiscord | <alireza0x0> is this the right way? |
20:48:11 | FromDiscord | <alireza0x0> sent a code paste, see https://paste.rs/ewqo2 |
20:49:06 | FromDiscord | <alireza0x0> this was working but now i have a problem that says you cannot get len of a seq elemnt in the myrefobj() because type of b.myseq is typedesc[seq[int]] not a seq[int] ... |
20:50:59 | FromDiscord | <alireza0x0> ahh my bad i used = instead of : in object creation 🤣 🤣 sorry |
20:53:28 | FromDiscord | <kaddkaka> Hmm, is there a sum type in Nim? |
20:54:14 | FromDiscord | <alireza0x0> sum type...? like big int you mean? |
20:54:16 | FromDiscord | <kaddkaka> I want a list of values that are either a boolean or an integer (`bool | int`) |
20:54:43 | FromDiscord | <fwsgonzo> is there a Nim HTTP client that uses custom DNS? the std client uses glibc NSS which requires dlopen |
20:54:56 | FromDiscord | <alireza0x0> i think you should create something like union or in nim they say object variant afaik |
20:55:15 | FromDiscord | <fwsgonzo> (edit) "dlopen" => "dlopen. Or is it perhaps possible to override the name resolution?" |
20:55:50 | FromDiscord | <kaddkaka> right, found variants, thats it I guess |
20:56:32 | FromDiscord | <alireza0x0> In reply to @fwsgonzo "is there a Nim": you should take a look at chronos http client, it had much more abilitys than the std one as far as i know |
20:56:51 | FromDiscord | <alireza0x0> and also there is a lib called puppy that dose the http request with 0 dependencys, dlls, etc.. |
20:58:09 | FromDiscord | <kaddkaka> The example in the manual is extremely short https://nim-lang.org/docs/tut2.html#object-oriented-programming-object-variants↵Is there any more meaty example? |
20:58:18 | FromDiscord | <kaddkaka> (edit) "more meaty" => "simpler" |
20:58:47 | FromDiscord | <alireza0x0> In reply to @kaddkaka "The example in the": https://ssalewski.de/nimprogramming.html#_object_variants |
20:58:47 | FromDiscord | <kaddkaka> (edit) "short" => "frugal" |
20:59:10 | FromDiscord | <alireza0x0> also this is a full complete and up to date book, helped me alot to start using nim |
21:01:56 | FromDiscord | <fwsgonzo> puppy seems not to be installable, missing dependency: webby >= 0.1.6 |
21:02:32 | FromDiscord | <alireza0x0> did you run nimble install on it? |
21:03:01 | FromDiscord | <fwsgonzo> ah, i needed to update the nimble package cache |
21:03:04 | FromDiscord | <fwsgonzo> my bad! |
21:05:24 | FromDiscord | <kaddkaka> this object variant seems really hard to use compare to just sumtype T_T |
21:05:38 | FromDiscord | <kaddkaka> But I probably just dont get it yet |
21:11:51 | FromDiscord | <kaddkaka> sent a code paste, see https://paste.rs/bJvvw |
21:22:50 | FromDiscord | <Elegantbeef> It's practically the exact same you just have to be a tinge more explicit @kaddkaka |
21:23:01 | FromDiscord | <Elegantbeef> https://github.com/alaviss/union or anonymous unions |
21:23:11 | FromDiscord | <Elegantbeef> As an aside depending on definition Object variants are sumtypes |
21:23:45 | FromDiscord | <kaddkaka> thanks |
21:26:29 | FromDiscord | <kaddkaka> I'm not sure what to call A and B and avoid name conflicts (in the example above) any pointers @ElegantBeef ? |
21:26:58 | FromDiscord | <Elegantbeef> What do you mean "avoid name conflicts"? |
21:27:42 | FromDiscord | <kaddkaka> I have a type that is the OnOff type, but I would like to call A OnOff as well, perhaps that is OnOffActionKind? |
21:28:05 | FromDiscord | <Elegantbeef> `OnOffKind` works |
21:28:33 | FromDiscord | <kaddkaka> could I reuse OnOddKine if I make a another object with an OnOff variant? |
21:28:44 | FromDiscord | <kaddkaka> (edit) "OnOddKine" => "OnOddKind" | "OnOff" => "OnOffKind" |
21:28:54 | FromDiscord | <Elegantbeef> It's just an enum you can use it N number of times |
21:29:28 | FromDiscord | <kaddkaka> (Oh, maybe I shouldn't mix `kind` and `variant`?) |
21:30:09 | FromDiscord | <Elegantbeef> https://nim-lang.org/docs/manual.html#guards-and-locks |
21:31:48 | FromDiscord | <guttural666> sent a long message, see https://paste.rs/kzAKR |
21:31:57 | FromDiscord | <Elegantbeef> Sure |
21:32:10 | FromDiscord | <Elegantbeef> Though I imagine you mean "FancyActionKind" |
21:32:20 | FromDiscord | <kaddkaka> oh, yes |
21:32:34 | FromDiscord | <kaddkaka> (edit) "oh, yes ... " added "(fixed)" |
21:33:19 | FromDiscord | <kaddkaka> so everytime I create a variant object, I have to explicitly specify what kind it is |
21:33:33 | FromDiscord | <kaddkaka> similar to union tagging in C it feels like |
21:33:36 | FromDiscord | <kaddkaka> sent a code paste, see https://paste.rs/0Dy7D |
21:35:22 | FromDiscord | <Elegantbeef> Right, they're quite clearly tagged unions |
21:36:47 | FromDiscord | <kaddkaka> (edit) "https://paste.rs/oIKBc" => "https://paste.rs/OtEIq" |
21:36:57 | FromDiscord | <kaddkaka> yes |
21:38:08 | FromDiscord | <guttural666> ix on nimplayground seems to be down |
21:38:17 | FromDiscord | <kaddkaka> And if I want conciser ways to create these objects I would make "make" functions?↵`func A(): Action = Action(kind: A, A: true)` ? |
21:38:39 | FromDiscord | <kaddkaka> (edit) "A():" => "A(value):" | "true)`" => "value)`" |
21:38:42 | FromDiscord | <Elegantbeef> Yea though I'd call them "constructors" |
21:39:04 | FromDiscord | <kaddkaka> and we don't get them for free I suppose |
21:39:39 | FromDiscord | <kaddkaka> is the name `kind` magic in any way? |
21:40:03 | FromDiscord | <Elegantbeef> No you can name it `deeblebopGringleSnobTheThird` |
21:46:13 | FromDiscord | <kaddkaka> ok, will do! |
21:56:21 | FromDiscord | <fwsgonzo> Alright, I've tested "all" of them now. Puppy uses cURL (dlopen) and chronos uses libnss (dlopen), so .. so far there is no HTTP library with built-in DNS |
21:56:33 | FromDiscord | <fwsgonzo> (edit) "Alright, I've tested "all" of them now. Puppy uses cURL (dlopen) and chronos uses ... libnss" added "glibc" |
22:12:49 | FromDiscord | <guttural666> In reply to @bostonboston "so something like this": thanks so much for this, I am getting this to run, gonna have to write this down, my prototype now works like this: https://media.discordapp.net/attachments/371759389889003532/1181719851539103774/image.png?ex=6582155f&is=656fa05f&hm=c1c2faf007bd2c623ac137d200fa7752a558de902d57f6db988ba2f3610691bc& |
22:28:43 | FromDiscord | <Elegantbeef> @guttural666 you do not need that global pragma there |
22:29:36 | FromDiscord | <guttural666> okay, gonna try it |
22:29:52 | FromDiscord | <guttural666> works no prob, thanks |
22:31:23 | * | Lord_Nightmare quit (Quit: ZNC - http://znc.in) |
22:31:26 | FromDiscord | <guttural666> is this just a promise to the compiler here? or does this really talk inform the GC not to touch this? https://media.discordapp.net/attachments/371759389889003532/1181724540255076443/image.png?ex=658219bd&is=656fa4bd&hm=dc95abaeadf362c130f7c7ae5b3de2b73076837ca029b2a91449dfbb22bc404c& |
22:31:36 | FromDiscord | <guttural666> (edit) removed "talk" |
22:31:40 | FromDiscord | <Elegantbeef> It's neither |
22:31:52 | FromDiscord | <Elegantbeef> It's saying "I know better" |
22:34:21 | * | Lord_Nightmare joined #nim |
22:34:27 | FromDiscord | <guttural666> in the past I have implemented multithreading by segmenting an array or work areas of an array and giving them to specific threads to fill them with content, obv. the C++ compiler didn't complain and it worked, because the program logic was correct, so I guess I'm telling the compiler here to not complain, because I am sure I did the right thing? |
22:34:56 | FromDiscord | <Elegantbeef> You're disabling the GC safety analysis for the block of code |
22:35:12 | FromDiscord | <guttural666> okay, so I guess that is talking to the compiler then |
22:36:05 | FromDiscord | <guttural666> do you always have to do this with pragmas? or is there some "right" way to just write code and the compiler sees from the code that no bad things can happen? |
22:36:42 | FromDiscord | <Elegantbeef> Pass a pointer to your `Deque[T]` instead of using a global |
22:39:04 | FromDiscord | <guttural666> ptrs to stack variables should be inherently safe frorm GC? |
22:39:12 | FromDiscord | <guttural666> (edit) "stack" => "heap" |
22:40:07 | FromDiscord | <bostonboston> Is there a proper way to convert unchecked arrays to seqs, or just create a new seq of proper length and copyMem? |
22:40:09 | FromDiscord | <guttural666> GC makes a lot of things very easy, but obfuscates a lot of things for me |
22:47:29 | FromDiscord | <Elegantbeef> No pointers do not have thread analysis and globals are icky |
22:49:36 | FromDiscord | <Elegantbeef> sent a code paste, see https://paste.rs/GWYbw |
23:07:05 | FromDiscord | <guttural666> yeah, figured I want to have the state touched by lots of threads in its own thing and the indepenent scheduler somewhere else |
23:25:59 | FromDiscord | <guttural666> to make a typed thread of a scheduler like this doesn't really make any sense, if you want to mutate the scheduler, if I understood the concept correctly↵var queue_thr: Thread[Scheduler] |
23:26:46 | FromDiscord | <Elegantbeef> you need to have `ptr Scheduler` and either use an address to the thread local variable or heap allocate using `create`/`alloc` |
23:27:05 | FromDiscord | <Elegantbeef> Multi threading in Nim is fairly manual still |
23:27:14 | * | advesperacit quit () |
23:27:20 | FromDiscord | <Elegantbeef> Unless you have taks and can use malebolgia/taskpools |
23:31:19 | FromDiscord | <guttural666> a scheduler should be a singleton really, accessible by a single memory address |
23:32:12 | FromDiscord | <Elegantbeef> Right so then a `ptr T` or a global |
23:32:33 | FromDiscord | <guttural666> gonna try that |
23:35:38 | FromDiscord | <Elegantbeef> Though a non pointer works aswell |
23:35:40 | FromDiscord | <Elegantbeef> Assuming you do not need to mutate it and it's all value types |
23:36:24 | FromDiscord | <guttural666> I really want to mutate the Scheduler itself, so it can hold a clock and the queue itself and so on |
23:36:34 | FromDiscord | <blind_faith> is there a way I can write↵`for i, elem in mySeq`↵so that `i` is mutable? |
23:36:37 | FromDiscord | <guttural666> one thing to hold all the things |
23:36:42 | FromDiscord | <blind_faith> (edit) "mySeq`↵so" => "mySeq:`↵so" |
23:36:52 | FromDiscord | <Elegantbeef> So then you need `ptr Scheduler` or similar |
23:37:15 | FromDiscord | <Elegantbeef> You can write your own iterator |
23:37:29 | FromDiscord | <guttural666> yeah, that would be lovely, trying to write that rn, thanks again for your help man, really appreciate it |
23:41:11 | FromDiscord | <Elegantbeef> Or make your own macro like `std/enumerate` |
23:43:18 | FromDiscord | <Elegantbeef> sent a code paste, see https://paste.rs/7VI9s |
23:50:47 | FromDiscord | <blind_faith> thanks |
23:52:03 | FromDiscord | <guttural666> ptrs just work, I prefer to be fucked at runtime but shit works for a while than being nipped in the bud at compile time, this is a real confidence boost 🥹 |
23:52:51 | FromDiscord | <Elegantbeef> You prefer stuff to fail at runtime? |
23:52:54 | FromDiscord | <Elegantbeef> That's an absurd idea |
23:54:00 | FromDiscord | <Elegantbeef> That's akin to saying "I prefer my brakes to fail whilst going 100km/h rather than having an inspection" |
23:55:06 | * | lucasta joined #nim |