00:09:52 | FromDiscord | <Elegantbeef> Nim's typed AST really is fun to work around π |
00:09:52 | FromDiscord | <Elegantbeef> https://play.nim-lang.org/#pasty=efQbUjaHwLhi |
00:10:07 | FromDiscord | <Elegantbeef> Just throw `typeof` whenever it errors about type mismatches until it works |
00:25:34 | * | khazakar quit (Quit: Connection closed for inactivity) |
00:34:37 | * | derpydoo joined #nim |
00:34:40 | * | raynei quit (Ping timeout: 255 seconds) |
00:58:04 | FromDiscord | <graveflo> Is there a syntax to force Nim to treat a return value with the same semantics as a `var` parameter. The only thing close to this that I can find is the manual section on NRVO, but nothing that I have tried has worked yet. No matter what I try the address of `result` is not the same as the address of the return type at the callsite. |
00:59:40 | FromDiscord | <Elegantbeef> Are you testing code inside of a proc or top level? |
01:00:15 | FromDiscord | <graveflo> I tried both |
01:00:41 | FromDiscord | <graveflo> But i guess not all combinations of both with all the things I tried |
01:01:10 | FromDiscord | <Elegantbeef> sent a code paste, see https://play.nim-lang.org/#pasty=cTdnzHfecexg |
01:01:32 | FromDiscord | <Elegantbeef> Or... it did |
01:01:37 | FromDiscord | <Elegantbeef> The fuck π |
01:02:10 | FromDiscord | <Elegantbeef> Seems it was just bad cached code |
01:02:18 | FromDiscord | <Elegantbeef> Yea with `-d:release` it certainly is NVRO'd |
01:03:49 | FromDiscord | <leorize> just remember that NVRO is an optimization, if you want it to act like a `var` all the time, use a `var` |
01:04:10 | FromDiscord | <Elegantbeef> I thought that was sink π |
01:04:10 | FromDiscord | <graveflo> `var` return is for iterators or something |
01:04:19 | FromDiscord | <Elegantbeef> It's for everything |
01:04:52 | FromDiscord | <Elegantbeef> a getter can return `var T` |
01:04:52 | FromDiscord | <Elegantbeef> but you can just do `proc doThing(result: var T)` |
01:04:56 | * | Mister_Magister quit (Quit: bye) |
01:05:05 | FromDiscord | <graveflo> I disabled `copy` and `dup` for the type and Nim doesn't like the `var` return because it needs to copy for some reason |
01:05:18 | FromDiscord | <Elegantbeef> Uhh |
01:05:24 | FromDiscord | <Elegantbeef> Do you have a min repro? |
01:05:27 | FromDiscord | <leorize> var return is not the same as a var parameter |
01:06:00 | FromDiscord | <Elegantbeef> `var` as a return value is a mutable reference to data from the parameter list |
01:06:18 | FromDiscord | <graveflo> Yea I'll try and make a min example. I don't fully understand what `var` return does but looking at it for 10 seconds it looked like it was for cooperative functions |
01:06:23 | FromDiscord | <leorize> it's rust borrow but worse |
01:06:43 | FromDiscord | <Elegantbeef> sent a code paste, see https://play.nim-lang.org/#pasty=ROlVARuxSQSV |
01:06:50 | * | Mister_Magister joined #nim |
01:06:56 | FromDiscord | <Elegantbeef> Hey I think it's better than Rust's borrow |
01:07:01 | * | raynei joined #nim |
01:07:10 | FromDiscord | <Elegantbeef> You don't have to call `clone`! π |
01:07:25 | FromDiscord | <leorize> but you can't store it either \:P |
01:07:33 | FromDiscord | <Elegantbeef> safely |
01:08:31 | FromDiscord | <Elegantbeef> Anyway it sounds like you're doing something like `proc doThing(val: T): T = val` |
01:08:41 | FromDiscord | <Elegantbeef> Without `dup` or `copy` that needs to be `sink` |
01:09:27 | FromDiscord | <leorize> `sink` is an optimization, it cannot make your code more correct |
01:09:32 | FromDiscord | <Elegantbeef> lol |
01:10:46 | FromDiscord | <graveflo> In reply to @Elegantbeef "Anyway it sounds like": no the input is not the output that would be weird. This is an `initX` style proc |
01:11:05 | FromDiscord | <Elegantbeef> Uh huh |
01:15:52 | FromDiscord | <graveflo> the only way I can reproduce it is if I make the structure less than the magic nvro size. The structure that I am working with is well above that but it is also `importc`d (with the members defined so I don't know why that would matter). Besides, the question is: can I force this behavior? I need to make sure that the addresses are the same regardless of nvro or `d:release` or anything like that. It's part of how the C library behaves |
01:16:17 | FromDiscord | <leorize> you can't |
01:16:24 | FromDiscord | <leorize> it's called an optimization for a reason |
01:16:41 | FromDiscord | <graveflo> to make development not optimal? |
01:16:51 | FromDiscord | <Elegantbeef> If you want it to always do what you want `proc bleh(res: var result)` |
01:17:12 | FromDiscord | <Elegantbeef> It's an optimisation whether it's enabled or not should not change the behaviour of the program |
01:17:23 | FromDiscord | <leorize> nor the semantics |
01:17:33 | FromDiscord | <graveflo> yea I figured that, but it's gross. I wish Nim could just transform the return value into that syntax.. it's a pretty straight forward concept |
01:18:09 | FromDiscord | <Elegantbeef> It should do that in specific cases iirc |
01:18:41 | FromDiscord | <leorize> if you're interacting with C you gotta give up the sugar |
01:18:56 | FromDiscord | <leorize> though it's trivial to just wrap it so that you can still have the sugar |
01:19:03 | FromDiscord | <graveflo> I'm done with these fancy languages. I'm going to do everything in pure ASM from now on and never upgrading my CPU |
01:20:07 | FromDiscord | <Elegantbeef> Fuck it just get a steady hand and a magnet |
01:20:15 | FromDiscord | <graveflo> In reply to @leorize "if you're interacting with": you say this but there no point in being ignorant to what is possible. That is not the case here. What I am trying to do is very doable with the "sugary" syntax. I understand what you are saying but here's a difference. No need to be so complacent |
01:20:36 | FromDiscord | <Elegantbeef> I'm so confused at what you're doing |
01:21:08 | FromDiscord | <leorize> the point is that it shouldn't matter because the compiler knows better when it comes to speed |
01:21:13 | FromDiscord | <Elegantbeef> Whether something is NVRO'd or not should not change the anything |
01:21:20 | FromDiscord | <Elegantbeef> "the anything" ah yes |
01:21:49 | FromDiscord | <Elegantbeef> I'd like to believe your miss-attributing a bug to NVRO |
01:22:01 | FromDiscord | <leorize> like if you return a struct \<= 2x machine word it is significantly faster to pass back 2 registers than doing a move to pointer |
01:22:18 | FromDiscord | <graveflo> okay, at the callsite se say `let x = initX()` and the value of `x` has space on the stack on the callsite stack frame. Inside of `initX` there is a choice to work with the return value as a new address on `initX`s stack frame or use the address from the callsite. I would like to use the address from the callsite. In fact I need to. That's it |
01:22:37 | FromDiscord | <Elegantbeef> "I need to"? |
01:22:44 | FromDiscord | <graveflo> yes |
01:23:05 | FromDiscord | <Elegantbeef> Why? |
01:24:23 | FromDiscord | <graveflo> because I the library I'm working with will capture the address when I call a proc in the init function and sigsev. I know. "dont do it like that", "use ref semantics". I know how to work around problems like this is just stupid that I can't do something that is simple that I know is possible. |
01:25:27 | FromDiscord | <Elegantbeef> `/s/proc/template` π |
01:25:27 | FromDiscord | <graveflo> it's weird too because the library is designed to work without malloc at all |
01:25:44 | FromDiscord | <leorize> just use `var`, really |
01:25:50 | FromDiscord | <graveflo> I was thinking about using a template but idk |
01:25:52 | FromDiscord | <Elegantbeef> Yea leo is right |
01:26:05 | FromDiscord | <graveflo> yea I know about that, like I said it's just gross |
01:26:06 | FromDiscord | <leorize> while such a transformation is possible it breaks the semantic of the language |
01:26:16 | FromDiscord | <graveflo> it doesn't |
01:26:38 | FromDiscord | <Elegantbeef> I think it's way less gross than relying on NVRO π |
01:27:01 | FromDiscord | <leorize> or rather, you impose a restriction that doesn't exist where the compiler has much more liberty |
01:27:19 | FromDiscord | <Elegantbeef> NVRO my ints! |
01:27:25 | FromDiscord | <graveflo> It's not like NVRO does something that only NVRO can do. Theres no need to rely on it |
01:27:37 | FromDiscord | <Elegantbeef> Glad we're in agreeance |
01:28:15 | FromDiscord | <graveflo> right. It's the syntax that I'm saying is lacking, but anyway, just wanted to know if Nim had a way to control that. Guess not |
01:28:50 | FromDiscord | <Elegantbeef> I mean forced NVRO changes the semantics drastically |
01:29:33 | FromDiscord | <Elegantbeef> sent a code paste, see https://play.nim-lang.org/#pasty=XSGyJTuERSTw |
01:29:42 | FromDiscord | <Elegantbeef> This requires a thunk to be generated for one of them |
01:29:51 | FromDiscord | <Elegantbeef> Assuming one is nvro'd and the other is not |
01:30:12 | FromDiscord | <graveflo> a thunk? |
01:30:18 | FromDiscord | <Elegantbeef> Atleast if i'm not being brain dead I think it does |
01:30:26 | FromDiscord | <Elegantbeef> A intermediate proc |
01:30:46 | FromDiscord | <Elegantbeef> The same logic exists for {.nimcall.} -\> {.closure.} |
01:30:56 | FromDiscord | <graveflo> right yea I can understand that |
01:31:18 | FromDiscord | <bubblie> To turn a ptr cstring into a seq cstring should I just cast the seq cstring to it |
01:31:21 | FromDiscord | <leorize> sent a code paste, see https://play.nim-lang.org/#pasty=XDxxNmfKhgbq |
01:31:39 | FromDiscord | <Elegantbeef> No you should not cast it |
01:32:04 | FromDiscord | <Elegantbeef> `@cast[ptr UncheckedArray[cstring]](myArr).toOpenArray(0, len)` |
01:32:11 | FromDiscord | <Elegantbeef> `seq[T]` is not `T` |
01:32:17 | FromDiscord | <bubblie> Ah |
01:32:25 | FromDiscord | <graveflo> sent a code paste, see https://play.nim-lang.org/#pasty=NAJNpZmVVsnt |
01:32:31 | FromDiscord | <Elegantbeef> If it's nil terminated iterate the array |
01:32:41 | FromDiscord | <bubblie> Got it |
01:32:44 | FromDiscord | <bubblie> Thanks! |
01:35:42 | FromDiscord | <leorize> it doesn'tβ΅(@graveflo) |
01:36:18 | FromDiscord | <leorize> since `int` fits in a register, it could be left there and picked up by `bar` |
01:36:27 | FromDiscord | <leorize> this kind of function is called a "leaf" function |
01:36:47 | FromDiscord | <graveflo> wouldn't `foo`s stack frame be popped before the addion operation can happen? If the value is in `foo`s stack frame that means that `bar` will never know what it was |
01:36:53 | * | rockcavera quit (Remote host closed the connection) |
01:37:01 | FromDiscord | <leorize> the stack doesn't exist |
01:37:19 | FromDiscord | <Elegantbeef> Leo hitting us with deep philosophical takes |
01:37:24 | FromDiscord | <graveflo> right I get that it can fit in a register. This is more of a conceptual problem. |
01:38:53 | FromDiscord | <graveflo> not that it isn't relevant in it's own right, but what I'm talking about doesn't concern details on that level |
01:39:28 | * | rockcavera joined #nim |
01:40:07 | FromDiscord | <leorize> it does, because it is the primary reason why "return value" as a concept is intentionally vague |
01:42:48 | FromDiscord | <graveflo> If that level of vagueness is ultimately expected then doing anything with memory addresses would be nonsensical. It's not abnormal to want control memory addresses. Return values, parameters included |
01:45:32 | FromDiscord | <leorize> the thing with return values is that the target location can be anything and doesn't have to "exist" semantically or literally |
01:46:04 | FromDiscord | <leorize> parameters on the other hand must exist semantically, and thus already have constraints like having a location |
01:46:07 | FromDiscord | <graveflo> but it could. Like an "out parameter" |
01:46:29 | FromDiscord | <leorize> an out parameter still exist semantically, because you must provide the out location |
01:46:49 | FromDiscord | <leorize> take beef array example, you can't write it with an out location before that array exist |
01:47:54 | FromDiscord | <graveflo> the only problem I can understand from beefs example is that they may need to have different calling conventions. That makes sense to me but I'm not 100% sure. Those would have been proc handles |
01:48:31 | FromDiscord | <Elegantbeef> Right they'd change the type of the procs afaik |
01:48:41 | FromDiscord | <graveflo> but besides, I was asking if something like that exists, not trying to say that it should work with Nim's current implementation. Seems like it doesn't exist. At this point I'm just saying that it could exist |
01:48:45 | FromDiscord | <Elegantbeef> But then you can have `{.nimcall, nvro.}` and more sets |
01:49:09 | FromDiscord | <Elegantbeef> On the plus side the convention to do what you want is extremely simple |
01:49:33 | FromDiscord | <Elegantbeef> sent a code paste, see https://play.nim-lang.org/#pasty=OWVrGGHDPsxr |
01:50:04 | FromDiscord | <graveflo> I feel like it would be a nice way to wrap C code with out parameters since Nim doesn't seem to like those. They are a lot less readable IMO and require more lines of code that is necessary |
01:50:32 | FromDiscord | <Elegantbeef> Nim has out parameters in 2.0(devel?) |
01:50:42 | FromDiscord | <graveflo> It's not that much different but you have to define something at the callsite which is a lot less expressive imo |
01:51:40 | FromDiscord | <graveflo> out parameters never worked well for me and I thought they existed just to wrap C code not to copy it's syntax. I like to wrap C code in a way that has Nim syntax so making out parameters is something I would like to avoid |
01:51:47 | FromDiscord | <Elegantbeef> You could do `var a {.nvro.} = someCall()` which emits a new proc that is NVRO'd |
01:51:52 | FromDiscord | <graveflo> (edit) "out parameters ... never" added "in Nim" |
01:52:18 | FromDiscord | <graveflo> lost me on that one beef |
01:52:33 | * | raynei quit (Ping timeout: 260 seconds) |
01:53:10 | FromDiscord | <graveflo> Is there an advantage to the pragma being at the callsite as opposed to the `proc`. I would assume the `proc` is the only place it would make much sense |
01:53:39 | FromDiscord | <Elegantbeef> sent a code paste, see https://play.nim-lang.org/#pasty=pdGHCwaVSWjS |
01:53:55 | FromDiscord | <Elegantbeef> The benefit at the callsite is that it allows you to do this π |
01:54:31 | FromDiscord | <Elegantbeef> Nim does not allow you to attach a macro on a proc that changes how a variable is declared |
01:54:37 | FromDiscord | <graveflo> oh so you think a macro could do this |
01:54:40 | FromDiscord | <Elegantbeef> It does allow you attach a macro on a variable to change how it's declared |
01:55:06 | FromDiscord | <Elegantbeef> But now you have a proc floating around that relies on UB |
01:55:11 | FromDiscord | <graveflo> well that would make it even more confusing to client code, but that is an interesting idea. I didn't think of that |
01:55:36 | FromDiscord | <Elegantbeef> `someCall` now has to be called using the `{.nvro.}` macro |
01:58:40 | FromDiscord | <Elegantbeef> The better Nim sugar is to just use templates that introduce symbols |
01:59:25 | FromDiscord | <Elegantbeef> write your proc with `var T` then just have a pragma that you attach on the symbol |
01:59:35 | FromDiscord | <Elegantbeef> `var a {.nvro.} = someCall(a)` |
02:00:02 | FromDiscord | <Elegantbeef> Annoyingly even `var a: int = someCall(a)` is invalid |
02:02:40 | FromDiscord | <graveflo> yea I think I'll just do the template |
02:05:01 | FromDiscord | <Elegantbeef> sent a code paste, see https://play.nim-lang.org/#pasty=BDaLeyGsVFNw |
02:10:52 | * | SchweinDeBurg quit (Quit: WeeChat 4.3.0-dev) |
03:06:13 | FromDiscord | <bubblie> is there a quick way to take a cStringArray and turn it into a sequence |
03:06:35 | FromDiscord | <bubblie> (edit) "cStringArray" => "cstringArray tpye variable" |
03:06:42 | FromDiscord | <bubblie> (edit) "tpye" => "type" |
03:07:23 | * | tiorock joined #nim |
03:07:23 | * | tiorock quit (Changing host) |
03:07:23 | * | tiorock joined #nim |
03:07:23 | * | rockcavera quit (Killed (tantalum.libera.chat (Nickname regained by services))) |
03:07:24 | * | tiorock is now known as rockcavera |
03:07:58 | FromDiscord | <bubblie> I just traversed |
03:28:31 | FromDiscord | <Elegantbeef> Again if it's nil terminated you have to iterate |
03:37:38 | * | raynei joined #nim |
03:55:07 | NimEventer | New thread by dwhall256: Help with a template, see https://forum.nim-lang.org/t/10926 |
03:58:08 | FromDiscord | <piman_discriminator_1010> what's the best way to pass an object through an `int`?β΅I have a function callback that reads userdata as an `int` presumably as a substitute for what would be a C void pointer |
04:00:13 | FromDiscord | <Elegantbeef> `pointer` |
04:20:08 | FromDiscord | <piman_discriminator_1010> can I get a ref as a pointer? |
04:21:10 | FromDiscord | <Elegantbeef> You can `cast[pointer](yourRef)`, but otherwise no |
04:21:20 | FromDiscord | <Elegantbeef> Mixing gc and non gc is only for those that know what they're doing |
04:21:47 | FromDiscord | <piman_discriminator_1010> the lifetime of the pointer will be less than the lifetime of the GCd object it points to |
04:22:17 | FromDiscord | <piman_discriminator_1010> (well more like about the same, which is also the lifetime of the program) |
04:22:49 | FromDiscord | <Elegantbeef> Yea I mean you can do `GcRef` and `GcUnref` to manage it manually otherwise |
04:23:41 | FromDiscord | <piman_discriminator_1010> if the lifetime is equal or less though I don't need to use those? |
04:24:19 | FromDiscord | <bubblie> In reply to @Elegantbeef "Again if it's nil": Right yeah I just ended up doing that it was nil terminated and it works fine now thank you again |
04:24:42 | FromDiscord | <Elegantbeef> Correct if the ref isn't gc'd before the proc exits you do not need it thanks to determinisim |
04:25:36 | FromDiscord | <piman_discriminator_1010> π |
04:25:42 | FromDiscord | <Elegantbeef> Those procs are for manually managing memory that you give up ownership of or lose through type erasure |
04:27:31 | * | raynei quit (Ping timeout: 276 seconds) |
04:28:06 | * | SchweinDeBurg joined #nim |
04:33:10 | * | nazgulsenpai quit (Ping timeout: 255 seconds) |
04:35:49 | * | nazgulsenpai joined #nim |
04:35:53 | * | rockcavera quit (Remote host closed the connection) |
06:02:02 | * | jkl quit (Quit: Gone.) |
06:06:38 | * | raynei joined #nim |
06:38:52 | * | khazakar joined #nim |
07:03:13 | * | PMunch joined #nim |
07:24:41 | * | raynei quit (Ping timeout: 252 seconds) |
07:49:09 | PMunch | Hmm, is there a way in Nim to format a string directly into a cstring? |
07:49:48 | PMunch | I know I can use C stuff to do this, but I was thinking something like `"the value is " & $value` |
07:53:42 | FromDiscord | <Elegantbeef> There's nothing premade that I know of |
07:57:01 | * | advesperacit joined #nim |
08:38:55 | FromDiscord | <exelotl> I've been thinking to make a macro with a `fmt` like syntax which invokes any printf/sprintf routine under the hood |
08:47:52 | Amun-Ra | same |
08:48:25 | Amun-Ra | although I'd just wrap it for simplicity |
08:58:18 | * | khazakar quit (Quit: Connection closed for inactivity) |
09:02:43 | * | derpydoo quit (Ping timeout: 246 seconds) |
09:08:31 | FromDiscord | <Robyn [She/Her]> In reply to @exelotl "I've been thinking to": Oh? Why printf? |
09:32:21 | PMunch | $Robyn_[She/Her], can't speak for exelotl, but I want it to be able to avoid Nim strings on embedded targets |
09:38:31 | FromDiscord | <Robyn [She/Her]> Aah fair |
09:51:31 | * | khazakar joined #nim |
11:09:27 | FromDiscord | <Robyn [She/Her]> What's the issue some people have with result types? |
11:09:38 | FromDiscord | <Robyn [She/Her]> Is it the fact that they don't have any sort of traceback or? |
11:10:32 | FromDiscord | <nnsee> that's one of the issues |
11:11:45 | FromDiscord | <Robyn [She/Her]> What's the other issues? I'm curious |
11:11:57 | FromDiscord | <Robyn [She/Her]> Also I'm wondering how the issue of lacking a traceback could be solved |
11:13:17 | FromDiscord | <nnsee> explicit handling of every result is often very verbose and complicates the code, especially if the language doesn't have first class support for it |
11:13:32 | FromDiscord | <Robyn [She/Her]> Fair, like Rust's `match` statement? |
11:14:07 | FromDiscord | <Robyn [She/Her]> Can't remember the syntax but I know that it's very clean |
11:14:51 | FromDiscord | <nnsee> yes, and returning error types implicitly using a specific operator like ? if the signature matches with the calling function's signature |
11:15:35 | FromDiscord | <Robyn [She/Her]> `?` operator sounds a bit yucky |
11:16:48 | FromDiscord | <nnsee> what is your proposed solution to the equivalent of being able to `throw` something three functions deep and catching and handling the error three functions higher up the call chain without having explicit code for it in each calling function? |
11:17:09 | FromDiscord | <nnsee> `?` sounds like a reasonable solution to me |
11:17:21 | FromDiscord | <Robyn [She/Her]> Unfortunately nothing, you're right |
11:17:27 | FromDiscord | <Robyn [She/Her]> I dislike `?` though :p |
11:17:32 | FromDiscord | <Robyn [She/Her]> It's the only way I guess |
11:19:17 | FromDiscord | <nnsee> and re: traceback, as far as i understand it, attaching a traceback to error values isn't exactly "hard", but again requires first class support by the language/compiler |
11:19:59 | FromDiscord | <nnsee> mind you i have almost no idea what i'm talking about so take anything i say with a grain of salt |
11:20:31 | FromDiscord | <Robyn [She/Her]> Fair |
11:36:20 | FromDiscord | <dissolved.girl> In reply to @nnsee "mind you i have": Appreciate the honesty haha |
11:53:09 | FromDiscord | <Robyn [She/Her]> Couldn't "first class 'support'" be done with purely macros? |
11:56:05 | FromDiscord | <nnsee> within the scope of your own project i don't see why not (although perhaps persuading the compiler to spit out a stack trace might be somewhat difficult), however once you start shipping libraries etc this breaks down, because the library users will then have to start using your macro mechanism for handling exceptions etc |
11:57:25 | PMunch | nnsee, getting a stack trace is actually pretty trivial: https://nim-lang.org/docs/system.html#getStackTrace |
11:57:27 | FromDiscord | <Robyn [She/Her]> A possible idea would be a macro/template to wrap functions with errors into result types instead possibly |
11:57:34 | FromDiscord | <Robyn [She/Her]> In reply to @PMunch "<@961485620075720734>, getting a stack": Oh fun |
11:58:06 | FromDiscord | <Robyn [She/Her]> In reply to @nnsee "within the scope of": And yeah I'd expect it'd have to be explicitly supported |
11:58:17 | FromDiscord | <nnsee> In reply to @PMunch "<@961485620075720734>, getting a stack": fair enough |
11:58:37 | PMunch | Robyn_[She/Her], I have this kind of wrapping in my optionsutils library: https://github.com/PMunch/nim-optionsutils/blob/master/src/optionsutils.nim#L329 |
11:59:45 | FromDiscord | <Robyn [She/Her]> In reply to @PMunch "Robyn_[She/Her], I have this": Oh fun |
12:02:02 | FromDiscord | <nnsee> In reply to @nnsee "what is your proposed": also inb4 Rika comes in here and starts talking about how Haskell has solved it with invariant ephemeral nomads or whatever the hell insanity the Haskell devs have conjured up |
12:02:53 | FromDiscord | <Robyn [She/Her]> Lol |
12:03:02 | FromDiscord | <Robyn [She/Her]> In reply to @nnsee "also inb4 Rika comes": @odexine |
12:03:12 | FromDiscord | <odexine> I was already reading the chat |
12:03:27 | FromDiscord | <odexine> And yes essentially monads |
12:03:37 | FromDiscord | <Robyn [She/Her]> Pfff |
12:03:55 | FromDiscord | <nnsee> called it |
12:05:09 | FromDiscord | <odexine> Well, the result type itself is a monad |
12:44:43 | PMunch | Hmm, it's a bit annoying that Nim won't show the mismatch when you want to pass a callback that is aliased to a type |
13:14:50 | * | rockcavera joined #nim |
13:19:59 | FromDiscord | <Robyn [She/Her]> How does Nim's lsp work with macros? |
13:20:06 | FromDiscord | <Robyn [She/Her]> Is it good or no? |
13:28:41 | PMunch | Should work just fine |
13:28:48 | PMunch | At least nimlsp |
13:43:22 | * | raynei joined #nim |
13:43:35 | * | anddam joined #nim |
13:44:22 | anddam | howdy, what could be causing this while installing via choosenim on windows11 64bit using 0.8.4 official installer? https://termbin.com/c8js |
13:45:16 | FromDiscord | <Robyn [She/Her]> In reply to @PMunch "At least nimlsp": Fair |
13:46:43 | anddam | nvm, I ran choosenim.bat twice and did the trick, maybe ~/nimble/bin wasn't there on first run of `choosenim.exe stable --firstInstall`? |
13:49:08 | PMunch | Robyn_[She/Her], I mean they both use nimsuggest, and nimsuggest is basically the compiler just modified to output information instead of code |
13:49:14 | PMunch | So most things should work just fine |
13:51:03 | FromDiscord | <nnsee> In reply to @anddam "nvm, I ran choosenim.bat": that sounds like a bug |
13:51:06 | FromDiscord | <nnsee> will try to reproduce later |
13:52:20 | FromDiscord | <Robyn [She/Her]> In reply to @PMunch "So most things should": Fair :P |
13:52:46 | FromDiscord | <Robyn [She/Her]> I was wondering because if I made a custom `match` macro I was wondering if it'd work with autocomplete at all |
14:01:16 | PMunch | I mean the name should autocomplete just fine |
14:01:25 | PMunch | But of course a DSL won't autocorrect |
14:30:57 | FromDiscord | <Robyn [She/Her]> Fair |
14:37:26 | anddam | does nimble have something equivalent to virtual environment to manage per-project dependencies? |
14:39:40 | FromDiscord | <Robyn [She/Her]> In reply to @anddam "does nimble have something": Atlas fulfils that I believe |
14:42:57 | anddam | I'll check it thx |
14:45:29 | PMunch | Also you don't really need it in Nim |
14:51:24 | anddam | how so? |
14:51:49 | anddam | I mean what if I have a package wanting foo2 and another wanting foo3 ? |
14:54:37 | PMunch | Like two versions of the same package? |
14:55:02 | PMunch | You just add `requires "foo == 2.0.0"` in your nimble file |
14:55:16 | anddam | ok, but how do you use one or another? |
14:55:34 | anddam | (I am trying to translate my python habits) |
14:56:30 | PMunch | Well you add that to the nimble file for your project, and then just `import foo` in your Nim file where you want to use it |
14:57:02 | PMunch | Then build with `nimble build` and Nimble will figure out which packages to use |
14:57:31 | PMunch | Of course since Nim is compiled all this sort of stuff is way less problematic |
14:58:04 | PMunch | If you want to use someone elses program you just download their pre-built binaries. No need to have Nim or any packages installed at all |
14:58:36 | PMunch | And if you want to build it yourself then Nimble figures it out for you |
14:58:40 | * | derpydoo joined #nim |
14:59:11 | anddam | from what you said I gather the dependencies are pulled in the build directory at build time |
14:59:28 | anddam | hehe right about the binary and being self-contained, not very used to that |
14:59:51 | anddam | (also what led me looking for other languages and finding nim) |
15:00:16 | PMunch | Not quite |
15:00:37 | PMunch | Nim by default will look for installed packages in `~/.nimble/pkgs` |
15:01:06 | PMunch | But it has command line switches which disables that, and another switch to manually add a search path |
15:01:40 | anddam | what if there's a dependency specified in nimble file for a package that is in conflict with what's in ~/.nimble/pkgs? |
15:01:56 | PMunch | So what Nimble does is just disable the "look for installed packages" flag and adds the paths to whatever you listed in the nimble file |
15:02:50 | PMunch | Well in your case you would have `~/.nimble/pkgs/foo-2.0.0` and `~/.nimble/pkgs/foo-3.0.0` |
15:03:00 | PMunch | By default Nim picks the one with the higher version |
15:03:17 | PMunch | But with a Nimble file you can specify which one you want |
15:03:29 | anddam | that seems an approach too rational and easy |
15:03:41 | PMunch | Welcome to Nim :P |
15:04:07 | anddam | it's like making problems going away with a magic wand gesture by not allowing them to exist in first place, |
15:08:56 | * | PMunch quit (Quit: Leaving) |
15:43:40 | * | jmdaemon quit (Ping timeout: 255 seconds) |
16:14:34 | FromDiscord | <anuke> Is this a known bug in `rand`, or is it expected behavior? https://media.discordapp.net/attachments/371759389889003532/1201561023157645353/image.png?ex=65ca43e7&is=65b7cee7&hm=e9c1223947df870ac79bb52233d8864fb3bcaa0e369d2289681a209a5bedb2fe& |
16:15:33 | FromDiscord | <anuke> This works correctly, for example: https://media.discordapp.net/attachments/371759389889003532/1201561277865132072/image.png?ex=65ca4424&is=65b7cf24&hm=8fc38c318035f3dc66d4649284c8729d563c436a8df2c9cbc8a0f0be4bebdc15& |
16:33:07 | FromDiscord | <odexine> "hey technically its possible to be so incredibly lucky that you get 10 falses" |
16:33:11 | * | raynei quit (Quit: Konversation terminated!) |
16:34:31 | FromDiscord | <demotomohiro> Let's check issues about random module and read source code of random module. |
16:35:57 | FromDiscord | <drunkenalcoholic> TestBool has 2 options, a or b, bool as just bool might be default to false, but im new to nim so I wouldn't really know, I just think of it saying rand(0) as 0 representing fault or -1 ect.. |
16:37:45 | FromDiscord | <drunkenalcoholic> (edit) "false," => "false?," | "0" => "in zero" | "fault" => "false" | "-1 ect.." => "is bool false -1?" |
16:41:28 | anddam | anuke: what rand function would be that of the screenshot? https://nim-lang.org/docs/random.html#rand%2Cfloat |
16:42:05 | FromDiscord | <odexine> it would be this one https://nim-lang.org/docs/random.html#rand%2Ctypedesc%5BT%5D |
16:43:03 | FromDiscord | <demotomohiro> It seems bool and enum are generated in different way:β΅https://github.com/nim-lang/Nim/blob/devel/lib/pure/random.nim#L381 |
16:43:20 | anddam | ironically almost got a 10 false on first run https://termbin.com/gb47 |
16:44:33 | FromDiscord | <odexine> In reply to @demotomohiro "It seems bool and": https://github.com/nim-lang/Nim/blob/version-2-0/lib/pure/random.nim#L387C7-L387C39 for 2.0 |
16:45:10 | FromDiscord | <Robyn [She/Her]> https://play.nim-lang.org/#pasty=abDDJZTbhGkB immense pain |
16:45:26 | FromDiscord | <Robyn [She/Her]> For some reason at the end, the code is indenting instead of dedenting |
16:49:18 | FromDiscord | <demotomohiro> In reply to @anuke "Is this a known": It is known issue and there is the fix: https://github.com/nim-lang/Nim/pull/22361β΅But it is not yet merged to ver2.0.2? |
16:51:18 | * | SchweinDeBurg quit (Quit: WeeChat 4.3.0-dev) |
16:58:45 | FromDiscord | <anuke> Seems to be backported, but I don't have the fix at 2.0.2, yeah |
16:58:58 | FromDiscord | <jaar23> In reply to @norax.2 "does someone have a": try out my example here,https://github.com/jaar23/tui_widgetβ΅ i'm building widget based on illwill. illwill is a superb library. It's way more easier than many other tui lib if you are familiar with it |
17:17:35 | * | Lord_Nightmare quit (Quit: ZNC - http://znc.in) |
17:20:35 | * | Lord_Nightmare joined #nim |
18:03:22 | FromDiscord | <norax.2> In reply to @jaar23 "try out my example": thx |
18:16:59 | FromDiscord | <Phil> Oh hey, my tests work proving threadButler to have reached the stage of correctness, yaaaayβ΅Oh hey, my docs no longer compile because of some random weird ass interaction between nim docs and chronos, less yay |
18:28:59 | NimEventer | New thread by mig: Feedback on site: Scroll to Top or Update Design for Docs, see https://forum.nim-lang.org/t/10927 |
18:40:59 | FromDiscord | <Robyn [She/Her]> In reply to @chronos.vitaqua "https://play.nim-lang.org/#pasty=abDDJZTbhGkB immen": Anyone know why after the identifier 'e' and before 'f' there's an indent token even though it should be a dedent? |
18:41:06 | FromDiscord | <norax.2> sent a code paste, see https://play.nim-lang.org/#pasty=eWbeerFCqaBv |
18:41:24 | FromDiscord | <norax.2> This like shortes all your code lol |
18:42:56 | FromDiscord | <norax.2> (edit) "lol" => "lol(yeah idk if it work or smth i havent tried it lol)" |
18:44:36 | FromDiscord | <odexine> In reply to @chronos.vitaqua "Anyone know why after": idk what to tell you other than "youll be hardpressed to find someone to debug 500+ lines" |
18:45:14 | FromDiscord | <Phil> I don't even have the mental capacity to solve my own problems at the moment other than isolating them to a modul from status |
18:45:21 | FromDiscord | <Phil> Let alone debug 500+ loc |
18:46:59 | FromDiscord | <Robyn [She/Her]> L387-L463 LP |
18:47:06 | FromDiscord | <Robyn [She/Her]> Still 80 lines tho so yeah fair |
18:47:16 | FromDiscord | <Robyn [She/Her]> I am so confused on the issue π |
18:50:38 | FromDiscord | <Robyn [She/Her]> Hm... |
18:50:42 | FromDiscord | <Robyn [She/Her]> Indent stack is pain |
18:53:14 | FromDiscord | <Robyn [She/Her]> Rewrite time |
18:53:20 | FromDiscord | <odexine> xd |
18:53:39 | FromDiscord | <odexine> refactor not rewrite |
18:53:51 | FromDiscord | <Robyn [She/Her]> What's the difference :p |
18:53:55 | FromDiscord | <Robyn [She/Her]> Refactor is moving around |
18:54:02 | FromDiscord | <Robyn [She/Her]> Rewrite is delete then write- |
18:54:10 | FromDiscord | <odexine> rewrite gives me the impression of throwing away the current implementation |
18:54:19 | FromDiscord | <odexine> refactor is restructuring what you already have |
18:54:24 | FromDiscord | <odexine> this disctinction is significant |
18:55:50 | FromDiscord | <Robyn [She/Her]> Ah |
19:01:24 | FromDiscord | <Phil> Rewrite imo is changing actual approach |
19:01:35 | FromDiscord | <Phil> Refactor is just the same approach, but written in a different way |
19:01:42 | FromDiscord | <Phil> (edit) "Refactor is just the same approach, ... but" added "same APIs," |
19:01:47 | FromDiscord | <Phil> (edit) "Refactor is just the same approach, same APIs, but written in a different way ... " added "under the covers" |
19:01:57 | FromDiscord | <Phil> (edit) "approach" => "approach, implying also API changes" |
19:06:11 | FromDiscord | <Robyn [She/Her]> HAH! FIXED! :D |
19:06:21 | FromDiscord | <Robyn [She/Her]> In reply to @isofruit "Refactor is just the": That makes it cleared ty :p |
19:06:25 | FromDiscord | <Robyn [She/Her]> clearer |
19:52:12 | FromDiscord | <Robyn [She/Her]> Whyyyy can't programming be easy |
19:56:17 | FromDiscord | <Phil> Because every time it's easy you're just crunching through your tasks without appreciating it |
19:56:30 | FromDiscord | <Phil> So only the hard stuff is left over |
19:58:43 | FromDiscord | <Robyn [She/Her]> True |
19:58:45 | FromDiscord | <Robyn [She/Her]> Pain |
20:00:30 | FromDiscord | <norax.2> microsoft is gonna sue me for recreating excell lol https://media.discordapp.net/attachments/371759389889003532/1201617887744491600/image.png?ex=65ca78dd&is=65b803dd&hm=df0ae0ac3679952461f10002a1762a61242aa10c9775f47a1b49d61a39de9d8a& |
20:00:41 | FromDiscord | <norax.2> yes you can write in ANY of thesse |
20:00:48 | FromDiscord | <norax.2> and resize |
20:02:51 | FromDiscord | <norax.2> https://media.discordapp.net/attachments/371759389889003532/1201618480701636738/image.png?ex=65ca796a&is=65b8046a&hm=1da7847c14e68dfe6ca5e3ee8173289e96952ad5b2d02029151ca535623b3057& |
20:03:00 | FromDiscord | <norax.2> well...why the rest is like so.. |
20:03:04 | FromDiscord | <norax.2> what |
20:20:22 | FromDiscord | <Phil> Aaaand now I have data races when observing my tests under loonyqueueβ΅This stuff can be such a braindrain |
21:09:57 | anddam | went through this little tutorial https://arhamjain.com/2021/11/22/nim-simple-chat.html (code at https://github.com/ajusa/simple-chat ) but the code won't work with a current setup |
21:10:05 | anddam | ```Error: 'matchMatcher (Async)' is not GC-safe as it accesses 'chatrooms' which is a global using GC'ed memory``` |
21:11:32 | anddam | I am not able to figure what I should be changing, not having a global chatroom? disabling GC? (does not sound wise) |
21:12:09 | FromDiscord | <graveflo> any reason why a case statement would want `of X` to be defined at compile time? I thought that nim only supports `when X: elif:` syntax |
21:15:48 | FromDiscord | <demotomohiro> In reply to @graveflo "any reason why a": I guess it is to optimize case statement.β΅If `X` in `of X` is runtime value, you can rewrite it with if statement. |
21:19:06 | FromDiscord | <graveflo> sent a code paste, see https://play.nim-lang.org/#pasty=jyjvBpCPqzSY |
21:20:09 | FromDiscord | <Elegantbeef> It's supposed to happen |
21:20:32 | FromDiscord | <Elegantbeef> Nim case statements are exhaustively checked which requires the branches to be static |
21:20:42 | FromDiscord | <Elegantbeef> Make a `runtimeCase` macro π |
21:21:09 | FromDiscord | <graveflo> they are checked exhaustively in enums but how is that supposed to work for other types? |
21:21:22 | FromDiscord | <Elegantbeef> The same way |
21:21:40 | FromDiscord | <Elegantbeef> sent a code paste, see https://play.nim-lang.org/#pasty=BzqLANKkWEiA |
21:21:44 | FromDiscord | <graveflo> there is an `else` in there anyway so it is exhaustive |
21:21:55 | FromDiscord | <Elegantbeef> Sure |
21:22:24 | FromDiscord | <graveflo> so what needs to be evaluated at compile time for `int` types? |
21:22:30 | FromDiscord | <Elegantbeef> > Because case statements are checked for exhaustiveness during semantic analysis, the value in every of branch must be a constant expression. This restriction also allows the compiler to generate more performant code. |
21:22:37 | FromDiscord | <Elegantbeef> The branch delimiter |
21:22:53 | FromDiscord | <graveflo> have to check for `high(int)` number of cases or an `else`? I'd think that the else is what matters |
21:22:53 | FromDiscord | <Elegantbeef> You want if branches |
21:23:15 | FromDiscord | <graveflo> alright. It's weird tho |
21:23:23 | FromDiscord | <Elegantbeef> It's not that weird |
21:23:30 | FromDiscord | <Elegantbeef> Case statements are exhaustive for everything but strings |
21:23:39 | FromDiscord | <Elegantbeef> Runtime values prevent exhaustiveness |
21:23:53 | FromDiscord | <graveflo> all it needs to prove its exhaustive is `else` so it |
21:23:57 | FromDiscord | <graveflo> s weird LOL |
21:24:16 | FromDiscord | <graveflo> especially for types that have `high(int)` branches. thats just silly |
21:24:32 | FromDiscord | <graveflo> or more like `high(uint64)` |
21:24:33 | FromDiscord | <Elegantbeef> Not really cause you can handle the cases you care about then have an `else` |
21:24:39 | FromDiscord | <Elegantbeef> The issue is purely just "I want runtime values" |
21:24:46 | FromDiscord | <graveflo> right and if you do that there is nothing to check at compile time |
21:25:39 | FromDiscord | <graveflo> actually nim doesn't even need to do that for enums either. It can just make sure that `else` is there or all names are used not values |
21:25:59 | FromDiscord | <Elegantbeef> Right |
21:26:13 | FromDiscord | <graveflo> okay I would call that weird then |
21:26:39 | FromDiscord | <graveflo> there no reason why the code I posted shouldn't work |
21:26:43 | FromDiscord | <Elegantbeef> I mean it also silently generates worse code, but I guess that's the intention |
21:27:37 | FromDiscord | <graveflo> what silently generates worse code? The algo I mentioned or the dummy example? |
21:27:50 | FromDiscord | <Elegantbeef> Allowing runtime values |
21:28:02 | FromDiscord | <Elegantbeef> It prevents creation of a jump table which means it's slower |
21:28:35 | FromDiscord | <graveflo> shouldn't the C compiler be able to do that if the branches are constant anyway? Whats the point of enforcing it when it can just be a special case |
21:28:58 | FromDiscord | <Elegantbeef> I mean this is a feature that's not yet implemented |
21:29:04 | FromDiscord | <Elegantbeef> "PRs possibly welcome" |
21:29:09 | FromDiscord | <graveflo> it's not like there isn't already a test that can determine if it's a compile optimization or not. Thats what currently happens |
21:32:53 | FromDiscord | <Elegantbeef> Does C's switch statement accept runtime values? |
21:33:07 | FromDiscord | <graveflo> Who cares? C is for losers |
21:33:24 | FromDiscord | <graveflo> that being said I use C |
21:33:39 | FromDiscord | <Elegantbeef> I mean it's important cause it changes whether it's a front end change or a frontend and backend change |
21:33:58 | FromDiscord | <Robyn [She/Her]> In reply to @Elegantbeef "Does C's switch statement": I can't remember, possibly no |
21:34:34 | FromDiscord | <graveflo> it could but at the same time it might be easier to just keep the current impl for the special case and generate something else for runtime |
21:35:11 | FromDiscord | <graveflo> it's prob easier to do it that way tbh. Just might add bloat to the compiler, so I guess that would be bad |
21:35:30 | FromDiscord | <Elegantbeef> Well presently it probably generates a switch statement, which means at codegen you need to check whether it has static values or not if not generate if statements |
21:35:44 | FromDiscord | <Elegantbeef> Until then just write a `runtimecase` macro π |
21:38:10 | FromDiscord | <graveflo> I'll prob just ignore it LOL. I don't like the design but I was just wondering why it didn't work. |
21:41:02 | FromDiscord | <graveflo> it looks like `switch` doesn't have to be constant in C but it's hard to find anyone who gives a shit about that either. I'm only saying that bc `case` is usually explicitly labelled as constant where `switch` is not |
22:01:32 | FromDiscord | <pierce.jason> anyone familiar with PyCharm Community ide, w/ Jetbrains Nim plugin? I'm wondering what I'm missing in Community vs VSCode. I did notice PyCharm Comm doesnt allow builtin debugging |
22:02:24 | FromDiscord | <graveflo> Nim doesn't have any usable debugging solutions. It's just print statements for now |
22:02:45 | FromDiscord | <Elegantbeef> I mean gdb sorta kinda not really works |
22:02:56 | FromDiscord | <Elegantbeef> Jmgomez does have a PR to add better mangling |
22:03:45 | FromDiscord | <Elegantbeef> Atleast for procs |
22:04:49 | FromDiscord | <Robyn [She/Her]> How would the mangling be better? |
22:04:56 | FromDiscord | <pierce.jason> I've never used a debugger, I come mostly from scripted languages using print/echo for debugging, so thats not a big deal for now |
22:05:10 | FromDiscord | <Elegantbeef> It changes it to a more readable 'standard' |
22:05:19 | FromDiscord | <Robyn [She/Her]> In reply to @pierce.jason "I've never used a": Until you get segfaults :P |
22:05:33 | FromDiscord | <Robyn [She/Her]> With async code :P |
22:05:34 | FromDiscord | <pierce.jason> right, lol |
22:05:47 | FromDiscord | <Robyn [She/Her]> In reply to @Elegantbeef "It changes it to": Fair |
22:05:50 | FromDiscord | <Elegantbeef> image.png https://media.discordapp.net/attachments/371759389889003532/1201649426909900891/image.png?ex=65ca963c&is=65b8213c&hm=ba5a2fb9b804c50192d57a5e506b521e7d61e498c75b44051add84a444a55b67& |
22:05:52 | FromDiscord | <Elegantbeef> The stack trace in the new mangling |
22:05:54 | FromDiscord | <Robyn [She/Her]> Also I've barely touched a debugger too so |
22:06:19 | FromDiscord | <pierce.jason> cross that bridge after I get a usable environment |
22:06:24 | FromDiscord | <Robyn [She/Her]> In reply to @Elegantbeef "image.png": Oh neat |
22:06:29 | FromDiscord | <Robyn [She/Her]> In reply to @pierce.jason "cross that bridge after": Fair |
22:07:10 | FromDiscord | <Elegantbeef> No the bridge is too well guarded |
22:08:44 | FromDiscord | <pierce.jason> haha, so are there any decent reasons that I should keep fighting VSCode plugins instead of rolling with JetBrain/Pycharm w/ Nim plugin? |
22:09:17 | FromDiscord | <graveflo> usually the vscode plugin works well. I'm surpised that's giving you an issue |
22:09:22 | FromDiscord | <Elegantbeef> Jetbrain's Nim plugin is done dumber and does not support things like macros or templates |
22:09:23 | FromDiscord | <graveflo> for me the jeybrains plugin never wokrs |
22:09:32 | FromDiscord | <graveflo> (edit) "jeybrains" => "jetbrains" | "wokrs" => "works" |
22:09:41 | FromDiscord | <pierce.jason> iirc thr jetbrains plugin is updated only to nim v1.5x |
22:10:02 | FromDiscord | <graveflo> there is a vscode extensions that has a lot of downoads but it's old and prob boroken |
22:10:10 | FromDiscord | <Elegantbeef> Right it also does not use any compiler based tooling so is done only lexically |
22:10:12 | FromDiscord | <Robyn [She/Her]> In reply to @pierce.jason "haha, so are there": VSC is the go-to of many here (excluding Vim/Emacs users) |
22:10:41 | FromDiscord | <Robyn [She/Her]> In reply to @graveflo "there is a vscode": There's one by nim-lang apparently but it's not in the extension marketplace for me on my install for an odd reason |
22:10:42 | FromDiscord | <Elegantbeef> I mean Nimlsp and Nimlangserver with a LSP enabled editor is as good as vscode ime |
22:11:00 | FromDiscord | <Elegantbeef> Are you using vscodium or another free vscode fork? |
22:11:11 | FromDiscord | <Robyn [She/Her]> In reply to @Elegantbeef "Are you using vscodium": Possibly Code OSS |
22:11:12 | FromDiscord | <graveflo> there used to be a "nim" plugin and a "nim-saem" plugin and now I think there is a third that is build on "nim-saem" |
22:11:21 | FromDiscord | <pierce.jason> In reply to @chronos.vitaqua "VSC is the go-to": Thats what I figured, and a good reason to go vscode, |
22:11:26 | FromDiscord | <Elegantbeef> There is a fork of saem's that is now official |
22:11:37 | FromDiscord | <graveflo> In reply to @Elegantbeef "There is a fork": yea use this one |
22:11:41 | FromDiscord | <Elegantbeef> It's not open vsix afaik |
22:11:47 | FromDiscord | <pierce.jason> vscode has one from nim-lang.org which i am trying to use |
22:11:51 | FromDiscord | <Elegantbeef> or w/e the open plugin place is |
22:12:00 | FromDiscord | <graveflo> yea I can't get the new one on codium |
22:12:06 | FromDiscord | <Robyn [She/Her]> In reply to @Elegantbeef "It's not open vsix": Pain |
22:12:13 | FromDiscord | <Elegantbeef> I mean you can get it if you manually download it and install it |
22:12:17 | FromDiscord | <Elegantbeef> But that's silly |
22:12:22 | FromDiscord | <Elegantbeef> At that point just use kate π |
22:12:39 | FromDiscord | <graveflo> I like kate but it has dumbass defaults and pisses the bed sometimes |
22:12:51 | FromDiscord | <Elegantbeef> works fine for me |
22:13:09 | FromDiscord | <graveflo> vscode has its own warts but it just works and doesn't do anything annoying as far as I'm concerned |
22:13:49 | FromDiscord | <pierce.jason> I'll keep trying to get vscode setup, thanks for the advice |
22:14:01 | FromDiscord | <Elegantbeef> Actually I take it back an annoying thing with kate is the fact there is no clear way of overriding default LSPs |
22:14:19 | FromDiscord | <pierce.jason> current issue is langserv crashing when I start up vscode |
22:14:22 | FromDiscord | <Elegantbeef> Fairly certain I've got a `nimlangserver` named `nimlsp` in my .nimble/bin π |
22:14:33 | FromDiscord | <graveflo> I couldn't get the nim lang server working without customizing the lsp in kate.. ah well |
22:14:57 | FromDiscord | <pierce.jason> https://gist.github.com/pierce-jason/00462061446da52f450fa68f66ad1a18 is the errors i get from the vscode nim-lang plugin |
22:15:08 | FromDiscord | <Elegantbeef> Does the official plugin default to nimlangserver now? |
22:15:21 | FromDiscord | <graveflo> I also don't like how kate doesn't save temp files. It's annoying to turn my PC off and think "oh did I save that". Makes me feel like I'm using notepad on windows in 2005 |
22:15:46 | FromDiscord | <Elegantbeef> It does save temp filesβ΅(@graveflo) |
22:15:54 | FromDiscord | <Elegantbeef> It creates a `kate.swp` file next to the file |
22:16:04 | FromDiscord | <graveflo> not if you havent saved before |
22:16:11 | FromDiscord | <pierce.jason> In reply to @Elegantbeef "Does the official plugin": yes, asked me to nimble langserv on vscode startup |
22:16:40 | FromDiscord | <Elegantbeef> image.png https://media.discordapp.net/attachments/371759389889003532/1201652156239708252/image.png?ex=65ca98c7&is=65b823c7&hm=0892301eeabe83e38d0bc0b7c57fb501cf5cd41f1b0e1f536703f82ee9e972fd& |
22:16:47 | FromDiscord | <pierce.jason> I also get a popup in vscode that langserv restarted 5 times |
22:17:14 | FromDiscord | <Elegantbeef> Is this just an empty `.nim` file? |
22:17:21 | FromDiscord | <graveflo> In reply to @Elegantbeef "image.png": what's this? I'm not reading that. i just typed `poweroff` in the terminal |
22:17:30 | FromDiscord | <Elegantbeef> Lol |
22:17:42 | FromDiscord | <Elegantbeef> Improperly closes programs then wonders why they do not behave π |
22:18:09 | FromDiscord | <graveflo> expect they all do. bs i use programs that have modern features π |
22:18:19 | FromDiscord | <graveflo> (edit) "expect" => "except" |
22:18:33 | FromDiscord | <Elegantbeef> We just have different expectations |
22:18:37 | FromDiscord | <pierce.jason> good question, both files i have tried have contents, let me check on an empty |
22:19:33 | FromDiscord | <exelotl> I really want to like Kate but I had the same experience as Graveflo haha |
22:19:51 | FromDiscord | <Elegantbeef> You guys just shut off your PC without closing programs you care about? |
22:20:13 | FromDiscord | <exelotl> not intentionally |
22:20:35 | FromDiscord | <Elegantbeef> I realise I do not use my computer like most people so I guess ok π |
22:20:44 | FromDiscord | <Elegantbeef> How many tabs do you lot have open in your web browser right now? |
22:21:00 | FromDiscord | <exelotl> but sometimes you can have a hardware blip or your laptop runs out of battery in its sleep or something |
22:21:18 | FromDiscord | <Elegantbeef> We're talking about an untitled file though |
22:21:29 | FromDiscord | <Elegantbeef> How often are you working on an untitled file? |
22:22:02 | FromDiscord | <graveflo> all the time. besides SIGTERM is not improper shutdown |
22:22:14 | FromDiscord | <exelotl> I have 12 browser tabs open, 6 vscode windows, one of which has several untitled files which are basically notes I haven't gotten round to saving yet |
22:22:19 | FromDiscord | <graveflo> I open files just to type sometimes. I use them as buffers. |
22:22:20 | FromDiscord | <Elegantbeef> Why are you so often working on an untitled file that you care about |
22:22:29 | FromDiscord | <Elegantbeef> Weird |
22:22:38 | FromDiscord | <exelotl> In reply to @graveflo "I open files just": this |
22:22:53 | FromDiscord | <graveflo> I care about most things that I type. I don't need to bother giving them a name until I need to. It's much easier to just have my open buffers stay there until Idiscard them ro save them |
22:23:21 | FromDiscord | <Elegantbeef> If i'm typing something in an editor I'm saving it to a file, so this is an odd paradigm I'm learning about |
22:23:39 | FromDiscord | <graveflo> no it isn't thats why most modern editors have temp files |
22:23:48 | FromDiscord | <Elegantbeef> It's weird to me I mean |
22:23:49 | FromDiscord | <graveflo> you literally don't have to do that step |
22:24:18 | FromDiscord | <graveflo> I dont want to go `rm` a file that I never needed saved |
22:24:32 | FromDiscord | <graveflo> if I gotta go do somethign and my computer needs to be turned off I just want to turn it off |
22:24:40 | FromDiscord | <graveflo> not shift thru all my programs and make suer I save everything |
22:24:51 | FromDiscord | <graveflo> I just turn it off and go. everythign stays as I left it |
22:25:02 | FromDiscord | <Elegantbeef> We use our computers very differently |
22:25:10 | FromDiscord | <exelotl> I'll be in a meeting, someone will say something important, so I press the Super key, type 'Notepad' open up xed or kwrite or whatever and then start typing |
22:25:11 | FromDiscord | <Elegantbeef> I close things I'm not using and like my PC to start up fresh |
22:25:43 | FromDiscord | <graveflo> I don't have desktop sessions. I like that feature for my editors |
22:25:58 | FromDiscord | <exelotl> it might be a very long time before I actually get around to saving said notes, if ever x) |
22:25:58 | FromDiscord | <graveflo> and the browser is nice too |
22:26:09 | FromDiscord | <Elegantbeef> I absolutely despise "continue were you left off" |
22:26:20 | FromDiscord | <Elegantbeef> So I guess it makes sense why I've never ran into this problem |
22:26:35 | FromDiscord | <graveflo> I used to have 100+ pages open in notepad++. some nights I would just spend 2 hours going through them and deciding to save to discard them |
22:26:48 | FromDiscord | <Elegantbeef> That's crazy to me |
22:26:56 | FromDiscord | <graveflo> it is pretty messed up ngl |
22:27:15 | FromDiscord | <graveflo> but I don't really do that much anymore. I just want to be able to turn my computer off at any moment and tend to the outside world |
22:27:30 | FromDiscord | <exelotl> there's a notes app on my phone which forces you to name the note before you can type anything, and refuses to let you use a name you previously used |
22:27:34 | FromDiscord | <exelotl> it's so bad |
22:27:52 | FromDiscord | <Elegantbeef> Meanwhile me\: "That's great" |
22:29:03 | FromDiscord | <exelotl> tfw you already made a note called "shopping" and you have to stop and think of a more descriptive name to avoid the clash, and by the time you've solved this mini-puzzle you've forgotten what you even wanted to write down |
22:29:44 | FromDiscord | <graveflo> yea.... that is so relatable. You know, some people are not brain-dead though and they just remember stuff |
22:29:56 | FromDiscord | <graveflo> but why beef doesn't mind remembering to save his files |
22:30:10 | FromDiscord | <graveflo> to me that is like.. its not going to happen. I'm going to lose something and it will piss me off |
22:31:03 | FromDiscord | <graveflo> I don't like remembering things the computer can remember for me. It's hard enough as is. That is prime real-estate in my grey matter. |
22:31:12 | FromDiscord | <Elegantbeef> Like I said if I'm writing something I'm making a file |
22:31:17 | FromDiscord | <Elegantbeef> I close the editor when I'm done |
22:31:26 | FromDiscord | <pierce.jason> empty.nim flashes some vscode popup errors that disappeared, but not seeing any persistant errors on blank file |
22:31:46 | FromDiscord | <Elegantbeef> If I'm not using a program(chat clients aside) they're closed |
22:32:44 | FromDiscord | <graveflo> I get that, but for me that usually a notes app, IDE, multiple terminals, and a web browser. That's a lot of shit to close. I need to go back and forth between all of them while I'm working |
22:32:57 | FromDiscord | <Elegantbeef> I don't have that much stuff open |
22:33:03 | FromDiscord | <Elegantbeef> I have a text editor and maybe a browser |
22:33:14 | FromDiscord | <graveflo> terminal in the editor I guess? |
22:33:19 | FromDiscord | <Elegantbeef> Yes |
22:33:34 | FromDiscord | <graveflo> I don't like those. Purpose built terminals always work so much better for me |
22:33:42 | FromDiscord | <Elegantbeef> To each their own |
22:33:52 | FromDiscord | <Elegantbeef> Even if I have a terminal window open, I close it when I'm done coding |
22:36:27 | FromDiscord | <graveflo> do you usually end your session on the computer in the heat of development or do you wind down? I always just stop coding by closing everything at once with `poweroff`. If I played games or did other stuff on my computer I could see myself closing everything up |
22:36:54 | FromDiscord | <graveflo> Why I say "if".. more like "when" |
22:37:06 | FromDiscord | <graveflo> I dont leave that up if I stop coding Im just coding 99% of the time |
22:37:23 | FromDiscord | <Elegantbeef> I mean even on my laptop I manually close things when done |
22:37:29 | FromDiscord | <Elegantbeef> But it's not like I code on there |
22:38:03 | FromDiscord | <Elegantbeef> But yes I do generally code inbetween doing something else |
22:43:11 | * | jkl joined #nim |
22:43:56 | FromDiscord | <user2m> sent a code paste, see https://play.nim-lang.org/#pasty=SnGOSsWwkalh |
22:52:09 | FromDiscord | <pierce.jason> In reply to @Elegantbeef "Is this just an": starting w/ an empty.nim seems to have cleared up whatever was causing problems. the other file I was working on loads, compiles, and runs fine now |
22:53:08 | FromDiscord | <pierce.jason> thanks a million! |
22:56:55 | * | jmdaemon joined #nim |
23:02:45 | FromDiscord | <Elegantbeef> @user2m Nim has tuple unpacking |
23:02:47 | FromDiscord | <Elegantbeef> That's it |
23:03:25 | FromDiscord | <Elegantbeef> You can use procs or macros to unpack objects, one example is here https://github.com/beef331/nimtrest/wiki/Code-snippets#unpack-objects-with-optional-fields |
23:09:10 | * | advesperacit quit () |
23:10:49 | FromDiscord | <Robyn [She/Her]> I wonder if an alternative docs site would be good for Nim |
23:11:00 | FromDiscord | <Robyn [She/Her]> Not sure how it'd look but maybe a different style would be nice... |
23:11:18 | FromDiscord | <Robyn [She/Her]> Current docs feel kinda clunky at times, if ya get what I mean |
23:21:29 | FromDiscord | <pierce.jason> I don't remember the style, is been years... But I always liked the web docs for php |
23:28:22 | FromDiscord | <graveflo> In reply to @chronos.vitaqua "Current docs feel kinda": I think the docs would improve significantly if it generated an alternative view where an object is documented along with every `proc` `template` `iterator` `macro` etc that uses it. It's annoying to try and find all the compatible actions you can do with a type in the docs |
23:29:22 | FromDiscord | <graveflo> and that should span the whole std lib. So if a type is defined in `system.nim` it's doc page will have everything that uses it across the entire std lib |
23:30:18 | FromDiscord | <graveflo> There's no curated place of "how to use X" it's just a massive info dump of everything in a module. Very time consuming to parse through especially when you are new |
23:30:43 | FromDiscord | <anuke> Yeah. I remember being very confused about `seq` in particular |
23:31:29 | FromDiscord | <anuke> Most seq-related procs beyond the basics are in `sequtils`, but a few "higher level" ones like `find` are in system. |
23:32:00 | FromDiscord | <graveflo> and that is a lucky type that has a module named after it. Try `openArray`. it's everywhere |
23:32:43 | FromDiscord | <graveflo> I don't think I've found any good documentation on `openArray` at all actually. I think I understand what it is from this chat |
23:32:56 | FromDiscord | <Elegantbeef> the manual has a reference π |
23:33:02 | FromDiscord | <graveflo> yea but it sucks |
23:33:59 | FromDiscord | <graveflo> In reply to @Elegantbeef "the manual has a": wait do you mean for openArray or for cross referencing entities |
23:34:09 | FromDiscord | <anuke> A bigger issue for me is that I can't just type `mySeq.` and have the IDE (whatever that may be) instantly autocomplete everything I can do with it - nimsuggest is broken beyond trivial projects in VSCode across multiple extensions, the langserver didn't work for me either and the intelliJ plugin is incomplete |
23:34:20 | FromDiscord | <Elegantbeef> I mean it has documentation on `openArray` |
23:35:00 | FromDiscord | <graveflo> yea IDE support is an ongoing issue. It's gotten better as far as I can tell, but it's a far cry from the popular languages. |
23:47:41 | * | tiorock joined #nim |
23:47:41 | * | tiorock quit (Changing host) |
23:47:41 | * | tiorock joined #nim |
23:47:41 | * | rockcavera is now known as Guest2497 |
23:47:41 | * | Guest2497 quit (Killed (lead.libera.chat (Nickname regained by services))) |
23:47:41 | * | tiorock is now known as rockcavera |