<< 07-02-2024 >>

00:01:29FromDiscord<graveflo> I prefer to write with generics for stuff like this, but the std lib wasn't designed with this pattern in mind so maybe that change wouldn't be accepted unless it is very comprehensive and not part of `system.nim` or `io` or something like that. There is a reason to keep those minimal in their abuse of lang features. Still there are a lot of convenience procs that could be added somewhere
00:02:07FromDiscord<grumblygibson> @graveflo interesting, I actually tried without the `auto` and it doesn't work without a return type specified. Is there a reason why you think it would work without?
00:04:08FromDiscord<graveflo> `proc parse[T](v: string): T =`
00:04:43FromDiscord<graveflo> `proc parseImpl[T](v: string, tds: typedesc[T]): T =`
00:05:20FromDiscord<grumblygibson> I guess I prefer Status' syntax here.
00:11:25*jmdaemon joined #nim
00:15:11FromDiscord<grumblygibson> sent a code paste, see https://play.nim-lang.org/#pasty=OjIlowdELOLi
00:17:31FromDiscord<Elegantbeef> > Status' syntax?
00:19:00FromDiscord<graveflo> sent a code paste, see https://play.nim-lang.org/#pasty=AtTGJzncpvph
00:19:24FromDiscord<grumblygibson> In reply to @Elegantbeef "Given you do not": Does the parseInt, for example, do some special stuff to "cover all ints"? I'm not sure what this means.
00:20:48FromDiscord<Elegantbeef> It does not no cause you cannot do `myUint8 = parseInt`
00:21:03FromDiscord<Elegantbeef> You'd need to use `std/parseutils` and range check
00:22:39FromDiscord<grumblygibson> In reply to @graveflo "can also do this,": Sorry I'm dense when it comes to parts of the language I don't use much - what does this enable?
00:23:34FromDiscord<graveflo> I don't think it does much of anything differently except standardized the `mixin` which is not better or worse. Just depends on how you want it to be used
00:23:55FromDiscord<graveflo> (edit) "standardized" => "standardizes"
00:24:30FromDiscord<Elegantbeef> it allows you to define your own `parseImpl` for any type in the future
00:25:00FromDiscord<grumblygibson> In reply to @Elegantbeef "> Status' syntax?": The Nim style guide that Status publishes I found very helpful. Not everything I agree with.
00:25:03FromDiscord<Elegantbeef> Though the mixin is not really needed due to how sym binding works
00:26:52FromDiscord<graveflo> `mixin` and `bind` are weird. Sometimes I need them and sometimes I don't. Sometimes it depends on which version of Nim I'm using. What's the point of `mixin` anyway then
00:27:06FromDiscord<graveflo> `bind` has never worked for me at all
00:27:07FromDiscord<Elegantbeef> It forces symbols open
00:27:16FromDiscord<Elegantbeef> `bind` forces symbols close
00:27:34FromDiscord<Elegantbeef> sent a code paste, see https://play.nim-lang.org/#pasty=DNYGrLvpCQiN
00:27:51FromDiscord<graveflo> in what context though. You can't just close a symbol without picking one. It's the closing context that would matter
00:27:52FromDiscord<Elegantbeef> sent a code paste, see https://play.nim-lang.org/#pasty=nGZJFWwCHuRL
00:28:14FromDiscord<Elegantbeef> A closed symbol is one that only considers the declaration's scope
00:28:21FromDiscord<Elegantbeef> An open symbol considers the declaration and instantiation scope
00:28:43FromDiscord<graveflo> yea that part has never worked for me. Binding a symbol will still pick stuff from the client code's scope
00:28:52FromDiscord<Elegantbeef> It really doesn't
00:28:58FromDiscord<Elegantbeef> Atleast in my experience it works fine
00:29:02FromDiscord<graveflo> its not supposed to
00:31:21FromDiscord<Elegantbeef> I should say I almost never use bind though
00:31:33FromDiscord<Elegantbeef> There are very few cases where a closed symbol makes sense ime
00:32:51FromDiscord<graveflo> yea I just tested it and `mixin` is needed or it will pick symbols closer to the defined scope
00:34:18FromDiscord<Elegantbeef> I mean that's the point of predefined procedures
00:34:30FromDiscord<graveflo> sent a code paste, see https://play.nim-lang.org/#pasty=gwmnnFSaxoIA
00:34:31FromDiscord<Elegantbeef> You do not predefine procedures if you want the user to override them
00:35:41FromDiscord<graveflo> not necessarily true. If you are using the type variable as a parameter anyway you might want to enable overload resolution from the calling context
00:35:46FromDiscord<Elegantbeef> You're moreso describing a template
00:36:30FromDiscord<Elegantbeef> Also you export the generic
00:37:46FromDiscord<Elegantbeef> I'd argue that if you want to enable overloaded procedures you use a `static proc(...):...`
00:38:16FromDiscord<Elegantbeef> Atleast if you want supposed 0 cost overloading 😄
00:39:14FromDiscord<graveflo> well this doesn't look like a template to me at all and I'm not sure what cost you are avoiding and you lost me on the static proc LOL but w/e
00:39:44FromDiscord<graveflo> this is the way to makes sense to me to make a structured modular dispatch that is based on a typedescr
00:40:17FromDiscord<Elegantbeef> Instead of using Nim's generic overloading you just do `proc parse[T](s: string, prc: static proc(s: string): T): T`
00:41:09FromDiscord<graveflo> that is will using the overloading, its just overloading on tyProc instead of tyTyepdesc. Plus that looks like a lot more work
00:41:25FromDiscord<Elegantbeef> I mean that allows you to actually supply a specific proc where you want
00:42:09FromDiscord<Elegantbeef> Anyway Nim's dispatch rules generally are what people want, but YMMV 😄
00:42:21FromDiscord<graveflo> that's true but you still have to refer to the proc which has the same semantics as the symbols in the other method. That just seems like a more convoluted way of doing it.
00:42:46FromDiscord<Elegantbeef> It's not really convoluted it's a completely different semantic
00:43:43FromDiscord<grumblygibson> Nice. The indirection is usually why I avoid passing procs around, but for cases like this `static proc` looks clear, fast, and easy to use.
00:45:12FromDiscord<graveflo> yea itll be a different semantic but that is just in symbol resolution of the parameters vs the parameters wrapped in a proc definition. Some of the types used in the resolution will be utilized differently and at different times. Not sure why one would be preferred. I wouldn't go using proc types unless it was part of the data model. like in a `void ` kind of way.
00:45:41FromDiscord<Elegantbeef> Eh depends what you're doing of course
00:45:48FromDiscord<graveflo> or if I was forced to by other means
00:45:54FromDiscord<Elegantbeef> In the above parse example I can hardly imagine a case where you actually want to use a different parseimpl for a type
00:46:00FromDiscord<Elegantbeef> If you did you could wrap it in a distinct for parsing
00:46:54FromDiscord<Elegantbeef> Especially since generics are instantiated once, so changing the underlying `parseImpl` could break other code
00:47:19FromDiscord<graveflo> that's true. I'm too lazy to see how it interacts with inheritance and the other hierarchical generic rules. as long as it doesn't greedy bind then that is an acceptable take in my mind. Still I dont think the mixin hurts anything so I would do it anyway
00:47:41FromDiscord<Elegantbeef> Oh I almost always use mixin in generics that have interfaces
00:47:44FromDiscord<Elegantbeef> As it's good documentation
00:47:49FromDiscord<graveflo> I prefer the "you can change it if you want but if it breaks it's own you" philosophy
00:48:12FromDiscord<Elegantbeef> well it'd silently break so that's not ideal
00:48:13FromDiscord<graveflo> (edit) "own" => "on"
00:48:26FromDiscord<Elegantbeef> Though worth noting due to generics changing import order can change a program's behaviour
00:49:37FromDiscord<graveflo> yea that is not necessarily the goal for things like this. It could be, but that is more niche. The implementations would have to have a well understood contract.
00:50:10FromDiscord<graveflo> Now I am curious how the non mixed in bindings work with overload resolution, bc if they are greedy that would be an annoying choice to make
00:51:03FromDiscord<Elegantbeef> https://wandbox.org/permlink/wq6EKN4Om9K6Dcmw an example works
00:51:31FromDiscord<Elegantbeef> Change that when to change the entire program
00:52:09FromDiscord<graveflo> actually if `bind` worked that could be a way to stop that from happening. as in, "Im writing code that is sensitive to this particular implementation of X"
00:52:11FromDiscord<Elegantbeef> Whether this is necessarily "wrong" is an interesting question
00:52:19FromDiscord<Elegantbeef> I mean it does work ime
00:52:32FromDiscord<graveflo> yea it's not wrong, but I think typically you would not want that to happen like you said
00:52:47FromDiscord<Elegantbeef> https://wandbox.org/permlink/KiIQl2B61LTmdfuN works
00:53:33FromDiscord<graveflo> Ive only ever tried to use `bind` in templates. I think that is what confuses the compiler
00:53:44FromDiscord<graveflo> and inline iterators I think
00:53:47FromDiscord<Elegantbeef> Oh `bind` in templates is not the same as `bind` in procs
00:53:52FromDiscord<graveflo> >.>
00:54:03FromDiscord<Elegantbeef> I find `bind` in templates works more like `mixin` in procs
00:54:05FromDiscord<Elegantbeef> I could be wrong
00:55:13FromDiscord<Elegantbeef> Actually `bind` just might not work inside templates, I do not recall
00:56:14FromDiscord<Elegantbeef> https://stackoverflow.com/a/74077789/15200657 scroll down for my variation of the unroll but yea this compiles even without `macros` imported, but `bind` didn't work
00:56:23FromDiscord<graveflo> yea it looks like the bindings are lazy without `mixin` too, so I'm probably going to still use it in these situations
00:56:39FromDiscord<graveflo> (edit) "lazy" => "greedy (no lazy)"
00:57:35FromDiscord<graveflo> sent a code paste, see https://play.nim-lang.org/#pasty=IVzzWaPgijUF
00:58:02FromDiscord<graveflo> that prints 1 but commenting the `mixin` line prints 0
00:58:17FromDiscord<Elegantbeef> That's not an overloaded symbol without mixin
00:58:25FromDiscord<Elegantbeef> With mixin it's tightly bound
00:58:27FromDiscord<Elegantbeef> Without\
00:58:40FromDiscord<Elegantbeef> Nim tightly binds to procedures with a single symbol
00:58:46FromDiscord<Elegantbeef> It open symbols for overloaded
00:58:48FromDiscord<graveflo> so if I add another definition it's not tightly bound then?
00:58:53FromDiscord<Elegantbeef> It closes only `bind`
00:58:54FromDiscord<Elegantbeef> Yes
00:58:58FromDiscord<graveflo> kk itry
00:59:16FromDiscord<graveflo> yep ur right
00:59:51FromDiscord<graveflo> okay nice. This has been educational LOL
01:00:30FromDiscord<Elegantbeef> I should document this inside my code reuse writeup 😄
01:00:37FromDiscord<Elegantbeef> I think I did, I do not recall
01:02:00FromDiscord<Elegantbeef> https://www.jasonbeetham.com/writeups/codereuse.html I do not, but this still might interest you
01:19:40FromDiscord<graveflo> after all this it just makes me want the "weak distinct" more. I use `distinct` a lot and I usually want that behavior instead.
01:20:37FromDiscord<graveflo> It's annoying constantly making lifting templates and copy/pasting them around
01:21:32FromDiscord<Elegantbeef> "lifting templates"?
01:22:04FromDiscord<graveflo> for all distinct ints youd call `borrowIntShit(myType)` and it defines all of the int bindings with `borrow`
01:22:24FromDiscord<graveflo> but of course it's only some of them
01:22:29FromDiscord<Elegantbeef> Just define a converter to and from and cry about errors
01:22:38FromDiscord<graveflo> yea exactly
01:24:04FromDiscord<Elegantbeef> https://github.com/beef331/nimtrest/blob/master/lender.nim#L226-L242 I do have this interesting macro for declarative borrows
01:38:05*dtomato joined #nim
01:42:05*def- quit (Quit: -)
01:44:11*def- joined #nim
01:47:18FromDiscord<varriount> sent a code paste, see https://play.nim-lang.org/#pasty=OTEfuUTnDDTG
01:47:41FromDiscord<varriount> (edit) "https://play.nim-lang.org/#pasty=ORXNsyyccUZA" => "https://play.nim-lang.org/#pasty=OQQZrydLLAyN"
01:49:06FromDiscord<graveflo> sent a code paste, see https://play.nim-lang.org/#pasty=aYhzQbdHIwrO
02:08:16*jmdaemon quit (Ping timeout: 255 seconds)
02:08:28*jkl quit (Quit: Gone.)
02:10:22*jkl joined #nim
02:10:25FromDiscord<varriount> sent a code paste, see https://play.nim-lang.org/#pasty=gAagFDEDALZd
02:17:55*jmdaemon joined #nim
02:30:13*jmdaemon quit (Quit: ZNC 1.8.2 - https://znc.in)
02:30:33*jmdaemon joined #nim
02:37:41*jmdaemon quit (Ping timeout: 272 seconds)
03:19:34*rockcavera quit (Remote host closed the connection)
04:04:40*derpydoo quit (Ping timeout: 246 seconds)
04:58:02*krux02 quit (Remote host closed the connection)
05:03:27*SchweinDeBurg quit (Quit: WeeChat 4.3.0-dev)
06:46:11*advesperacit joined #nim
07:01:51Amun-RaElegantbeef: home in https://www.jasonbeetham.com/writeups/codereuse.html leads to /writeups/ instrad of /writeups.html
07:04:06FromDiscord<Elegantbeef> Right someone should remove those buttons
07:05:16FromDiscord<Elegantbeef> Jokes aside I'll get off my ass, thanks
07:21:56FromDiscord<Robyn [She/Her]> Wouldn't it be really easy to make a trait impl using concepts?
07:22:16FromDiscord<Elegantbeef> We went over this before robyn
07:22:22FromDiscord<Elegantbeef> That was traitor 0.1.x
07:22:30FromDiscord<Elegantbeef> It sucks cause it's so macro ridden
07:22:37FromDiscord<Robyn [She/Her]> All you'd need to do is `template implement[T: MyConcept](t: T) = discard`?
07:22:40FromDiscord<Robyn [She/Her]> Ah
07:22:44FromDiscord<Robyn [She/Her]> Ignore me then
07:22:51FromDiscord<Robyn [She/Her]> My memory sucks really bad
07:22:52FromDiscord<Elegantbeef> No it does not work that way
07:22:55FromDiscord<Elegantbeef> Cause you need to emit a vtable
07:23:11FromDiscord<Elegantbeef> And cause the types are not existential you cannot have a `Trait[T]` so you need to store indexes of the traits you've implemented
07:23:21FromDiscord<Robyn [She/Her]> Ah
07:23:33FromDiscord<Robyn [She/Her]> Fun then
07:23:34FromDiscord<Elegantbeef> So now you have `Trait[[0, 1, 2]]` and need a macro to convert `[0, 1, 2]` to types to check
07:24:07*NimEventer quit (Remote host closed the connection)
07:24:14FromDiscord<Elegantbeef> Well you only need an integer I guess I was doing some silly overlapping trait system
07:24:21*NimEventer joined #nim
07:24:29FromDiscord<Elegantbeef> Where you could do `Trait[[A, B]]` and have a union of A and B
07:26:19FromDiscord<Robyn [She/Her]> Fair
07:26:27FromDiscord<Elegantbeef> But that made it more complex
07:26:27FromDiscord<Elegantbeef> Honestly the `type Trait = distinct tuple[_: Atom, ...]` I do with traitor is hands down the best
07:26:27FromDiscord<Elegantbeef> Whilst yes it is a `distinct tuple` it does not use a macro to declare any type
07:26:28FromDiscord<Elegantbeef> it requires a single `implTrait MyTrait` and then you can do `myVal.toTrait MyTrait`
07:26:28FromDiscord<Elegantbeef> hmph seems one cannot change where home points in nimib
07:26:32FromDiscord<Elegantbeef> If you want a trait system try traitor
07:26:58FromDiscord<Elegantbeef> It has `AnyTrait[T]` so you can write a procedure that works on value types or boxed trait types
07:27:18FromDiscord<Robyn [She/Her]> I'll probably look into using it, it might have some usecases in my MC server once I get to entities
07:27:22FromDiscord<Elegantbeef> `AnyTraitor`\
07:27:40FromDiscord<Robyn [She/Her]> In reply to @Elegantbeef "It has `AnyTrait[T]` so": Fun
07:27:52FromDiscord<Elegantbeef> http://www.jasonbeetham.com/traitor/traitor.html#ValidTraitor it has this gnarly concept 😄
07:28:31FromDiscord<Elegantbeef> http://www.jasonbeetham.com/traitor/traitor/streams.html but yea if you have not seen, it's quite awesome
07:28:54FromDiscord<Robyn [She/Her]> Fair
07:29:55FromDiscord<Elegantbeef> It's slightly slower to dispatch than Nim's OOP sadly, but it gets us away from inheritance trees and does not require more work to get a value type
07:30:04FromDiscord<Elegantbeef> Which means it's simple as hell to write GC hooks
07:30:46FromDiscord<Elegantbeef> My file stream self closes for instance
07:33:48FromDiscord<amaank404> i wonder, was it actually hard to make the matrix, discord and irc co operate in sync?
07:33:53FromDiscord<Robyn [She/Her]> In reply to @Elegantbeef "It's slightly slower to": Fair
07:34:20FromDiscord<Elegantbeef> IRC is done with a Nim bot, but the other bridge is just t2bot
07:35:21FromDiscord<Robyn [She/Her]> Tbh, I think Traitor looks nicer than `method`
07:37:21FromDiscord<Elegantbeef> I try
07:38:07FromDiscord<Robyn [She/Her]> And you ate (lol)
07:39:10*PMunch joined #nim
07:39:16FromDiscord<Elegantbeef> god that was a stretch that took the entire fibre of my being to understand
07:45:54FromDiscord<Robyn [She/Her]> Get with the times boomer 😛
07:46:01FromDiscord<Robyn [She/Her]> I got that skibidi rizz~
07:46:23FromDiscord<Elegantbeef> I hope that you perpetually get hang nails
07:46:25FromDiscord<Robyn [She/Her]> I'm totes tubular
07:46:27FromDiscord<Robyn [She/Her]> XD
07:47:00FromDiscord<Elegantbeef> Just for that I'm closing up shop, no more Nim. I'm a Rust user now
07:47:07FromDiscord<Robyn [She/Her]> Pffff
07:47:11FromDiscord<Elegantbeef> I'm all about those `pub fn name_do_stuff(){...}`
07:47:57FromDiscord<Robyn [She/Her]> Jokes on you, I'm in the Rust community too :)
07:48:19FromDiscord<Robyn [She/Her]> In reply to @Elegantbeef "I'm all about those": I do dislike this though
07:48:24FromDiscord<Elegantbeef> Odin?
07:48:26FromDiscord<zumi.dxy> `present.unwrap()`↵↵...and the prize is a `panic!()`
07:48:43FromDiscord<Robyn [She/Her]> In reply to @Elegantbeef "Odin?": Not in Odin but I'll try it just for you :)
07:48:56FromDiscord<Robyn [She/Her]> In reply to @zumi.dxy "`present.unwrap()` ...and the": Fun!
07:49:16FromDiscord<Robyn [She/Her]> Tbf you aren't supposed to unwrap unless you're fine with a panic or can guarantee there's something in it
07:51:29FromDiscord<Elegantbeef> Next you'll tell me I'm not supposed to do `{.cast(raises: []).}: ...`
07:54:43FromDiscord<zumi.dxy> Rust seems to love method chaining abstract stuff↵Some people don't think it's boilerplate because "data operations are made explicit"↵but it often makes it harder to me to tell what the code does at a high level
07:55:00FromDiscord<zumi.dxy> that's kind of my surface level gripe with it
07:57:59*SchweinDeBurg joined #nim
07:58:22NimEventerNew Nimble package! littlefs - API and bindings for littlefs. Includes a fuse implementation., see https://github.com/Graveflo/nim-littlefs
08:04:16FromDiscord<Robyn [She/Her]> Fair
08:23:02FromDiscord<odexine> Nice
08:24:12FromDiscord<Elegantbeef> > might have to enable co-variance to use the API functions↵Now someone is just taking the piss
08:28:57FromDiscord<graveflo> LOL I haven't even tried that once
08:35:40FromDiscord<graveflo> wait, is covariance enabled all the time? Can you just annotate something with `var X` and then pass a `ref X` or `ptr X` to it and it just works?
08:37:56FromDiscord<odexine> i think theyd still have to dereference it but otherwise
08:39:36FromDiscord<graveflo> yea nvm, this looks like something else entirely
08:41:33FromDiscord<graveflo> one day I'll figure out what to do about `var X | ref X | ptr X`
09:20:20FromDiscord<Elegantbeef> @graveflo what do you mean figure out what to do about them?
09:28:41FromDiscord<graveflo> you know what. I don't even know. It's about time I stop programming for today. I keep getting into situations where I'm writing procs that want to be invariant like that, but it seems like some projects don't need it at all so maybe I'm just being weird
09:40:18FromDiscord<Elegantbeef> Hmm a typeclass with var does lose the varness
09:40:20FromDiscord<Elegantbeef> sent a code paste, see https://play.nim-lang.org/#pasty=jkVSOgwZwAmF
09:40:21FromDiscord<Elegantbeef> sent a code paste, see https://play.nim-lang.org/#pasty=PXtAKzZyCXrf
10:11:41*xet7 joined #nim
10:23:37NimEventerNew Nimble package! curlies - A macro for object construction using {} (curlies)., see https://github.com/svenrdz/curlies
10:27:02FromDiscord<whisperecean> Is someone from status here? I can't pull in toml serialization it fails on stew/enums
10:27:21PMunchwhisperecean, maybe try parsetoml instead?
10:31:14PMunchHmm, curlies looks cool. But that's a lot of code :S
10:47:10FromDiscord<nnsee> In reply to @whisperecean "Is someone from status": i had this exact issue
10:47:11FromDiscord<nnsee> https://discord.com/channels/371759389889003530/371759389889003532/1141692874988199957
11:03:42NimEventerNew Nimble package! tagforge - A library made for the serialisation and deserialisation of MC NBT!, see https://github.com/Nimberite-Development/TagForge-Nim
11:29:43FromDiscord<Robyn [She/Her]> Eyyyy
11:30:16FromDiscord<Robyn [She/Her]> @nnsee did you see my message earlier? :p
11:40:59*lucasta joined #nim
11:54:30FromDiscord<arnetheduck> In reply to @whisperecean "Is someone from status": wipe your nimble cache and start over, that usually fixes things
11:55:08FromDiscord<nnsee> In reply to @chronos.vitaqua "<@961485620075720734> did you see": yup! well done
11:59:44FromDiscord<Robyn [She/Her]> In reply to @nnsee "yup! well done": Thanks! :D
11:59:57FromDiscord<Robyn [She/Her]> Hope it works for you if you continue any MC dev-
12:08:25*xet7 quit (Remote host closed the connection)
12:14:57*rockcavera joined #nim
12:34:50FromDiscord<nnsee> In reply to @chronos.vitaqua "Hope it works for": haha yup, thanks
12:36:02FromDiscord<Robyn [She/Her]> Of course :D
13:56:34*lucasta quit (Quit: Leaving)
14:07:05FromDiscord<summarity> Is there a reason why `execProcess` only accepts argument arrays, but not seqs? It eventually calls `startProcess`, which also has this restriction, but then weirdly does create a `seq[string]` from that array itself (osproc, line 985) and then dynamically allocates a cstringarray. So I'm not sure why the API exposes strictly only arrays
14:08:41FromDiscord<odexine> It accepts sequences
14:10:52FromDiscord<nnsee> https://nim-lang.org/docs/osproc.html#execProcess%2Cstring%2Cstring%2CopenArray%5Bstring%5D%2CStringTableRef%2Cset%5BProcessOption%5D
14:11:06FromDiscord<nnsee> openArray[string], which also includes seqs
14:14:52FromDiscord<summarity> Ah nvm, I was confused by another error. Shouldn't mix positional and keyword args in my code 😖
14:22:09FromDiscord<nikita> sent a code paste, see https://play.nim-lang.org/#pasty=aChRuzLMecuQ
14:38:34FromDiscord<whisperecean> How do I wipe my nimble cache?
14:50:56*LuxuryMode_ joined #nim
14:52:34Amun-RaI don't think nimble has cache
14:55:01FromDiscord<kots> Are you getting "Error\: string literal as key expected [JsonParsingError]"? If so, the problem is that `{ quality: 2 }` is invalid JSON and it needs to be `{ "quality": 2 }`.
15:26:18FromDiscord<arnetheduck> In reply to @whisperecean "How do I wipe": `rm -rf ~/.nimble` if you're on linux - other platforms, equivalent but not sure where nimble stores its stuff - you will have to redo any `nimble install` you might have done (I generally don't use it, for this reason)
15:27:14*PMunch quit (Quit: Leaving)
15:27:52FromDiscord<whisperecean> That worked! yay
15:39:22FromDiscord<@@prestosilver> at one point I was working on nimble pkgs directly in the nimble dir, just to get around cloning the repos, that was such a nightmare when I switched to a new pc lol
15:59:35FromDiscord<nikita> sent a code paste, see https://play.nim-lang.org/#pasty=NrLRCLtJrgcM
16:07:18FromDiscord<kots> sent a long message, see https://pasty.ee/eHnyhqdYjfLL
16:10:15FromDiscord<kots> sent a code paste, see https://play.nim-lang.org/#pasty=KpHEjRIwazge
16:10:23*tiorock joined #nim
16:10:23*tiorock quit (Changing host)
16:10:23*tiorock joined #nim
16:10:23*rockcavera quit (Killed (mercury.libera.chat (Nickname regained by services)))
16:10:23*tiorock is now known as rockcavera
16:50:12*SchweinDeBurg quit (Quit: WeeChat 4.3.0-dev)
16:51:09*derpydoo joined #nim
17:06:02*azimut quit (Ping timeout: 255 seconds)
17:14:32FromDiscord<griffith1deadly> In reply to @nikita "kots\: json is ok": if it some library/module with able custom hook's, then you can create one for your enum that parse it as int
17:14:55FromDiscord<griffith1deadly> like cast[Quality](int) or Quality(int)
17:15:36FromDiscord<griffith1deadly> with jsony (treeform library for json) you can set hook for types
18:02:40*zgasma joined #nim
18:56:16FromDiscord<Sven> In reply to @PMunch "Hmm, curlies looks cool.": Hey thanks, that's me messing around with macros. I could probably clean it up so it's less code
19:06:07*zgasma quit (Quit: leaving)
19:25:03FromDiscord<avant_> Hey, does someone know any more guides on how to use move/sink/lent, except the NimConf 2020 video?
20:25:11FromDiscord<Robyn [She/Her]> Is there any reason to use a cache table instead of a comp time variable?
20:33:41FromDiscord<odexine> When you need a table instead of just a variable?
20:34:14FromDiscord<odexine> You can’t productively use a CT variable with type table across modules
20:34:25FromDiscord<odexine> You can with a macro cache table
20:40:41FromDiscord<Robyn [She/Her]> In reply to @odexine "You can with a": If I don't plan to use it across modules then is it fine?
20:42:22FromDiscord<Robyn [She/Her]> I can't do a nested table using cachetables after all
20:42:56FromDiscord<whisperecean> Does anybody have a problem with intellisense and Copilot?
20:43:05FromDiscord<whisperecean> On VS Code
20:43:57FromDiscord<odexine> In reply to @chronos.vitaqua "If I don't plan": Sure yes
20:47:17FromDiscord<nikita> it's `std/marshal`↵(@griffith1deadly)
20:48:19FromDiscord<nikita> it's `std/marshal`. I think I'll be able to deal with it after reading a book, for now I'll keep it as int
20:51:07FromDiscord<Robyn [She/Her]> In reply to @odexine "Sure yes": Rad
20:57:59FromDiscord<whisperecean> ah nimlangserver failed to install
20:58:02FromDiscord<whisperecean> installed it manually
21:00:25FromDiscord<MDuardo> nimlangserver needs some improvements
21:06:27FromDiscord<Elegantbeef> You can but you have to manually implement it through iteration 😄↵(@Robyn [She/Her])
21:07:37FromDiscord<Robyn [She/Her]> In reply to @Elegantbeef "You can but you": Haha no thanks
21:08:09NimEventerNew thread by nrk: Chame 0.14.0 released, see https://forum.nim-lang.org/t/10963
21:23:52FromDiscord<gabrioche_> Hello everyone, I juste learned about Nim recently and I really enjoyed the project and the language itself. I have only made translations of challenged on Codewars but I've never started any projects in this cool language. So, do you reccomend me any tutorials / resources to learn it ? ( I have experience in programming so advanced resources are not a problem)
21:24:03FromDiscord<gabrioche_> (edit) "challenged" => "challenges"
21:35:06FromDiscord<gabrioche_> Maybe I am not aksing in the good channel ?
21:36:54Amun-Rapick something you'd like to write
21:42:39FromDiscord<Clonkk> If you already know how to code then try to build something. Start small and make it bigger / better. Tutorials will only take you so far.↵(@gabrioche_)
21:43:48*xet7 joined #nim
21:49:36FromDiscord<MDuardo> Start cooking something then↵Also, read the documentation if you can↵(@gabrioche_)
22:06:37FromDiscord<Srabb Van Griekenland> theres no fucking way https://media.discordapp.net/attachments/371759389889003532/1204911118984806481/image.png?ex=65d673ec&is=65c3feec&hm=f512e45781d7721da629b72d89efb38040a578bd411c3ce7d1433696614da662&
22:07:17FromDiscord<Elegantbeef> Wrong channel?
22:08:29FromDiscord<Srabb Van Griekenland> oh wait lmfao
22:08:37FromDiscord<Srabb Van Griekenland> https://media.discordapp.net/attachments/371759389889003532/1204911623806914633/image.png?ex=65d67465&is=65c3ff65&hm=02f3bb7ff2fddd2f65ec3e94bdf2b6637d4092952168ef6d943d7ea3066b4f94&
22:08:46FromDiscord<Srabb Van Griekenland> thought i clicked on the one below, apologis
22:08:47FromDiscord<Srabb Van Griekenland> (edit) "apologis" => "apologies"
22:08:54FromDiscord<Elegantbeef> Glad you're playing a boomer shooter though 😛
22:09:14FromDiscord<Srabb Van Griekenland> In reply to @Elegantbeef "Glad you're playing a": big fan of 'em
22:09:35FromDiscord<Srabb Van Griekenland> i made 2 of them too
22:09:40FromDiscord<Srabb Van Griekenland> 1.5
22:09:49FromDiscord<Srabb Van Griekenland> 1 of them isnt finished
22:10:00FromDiscord<Elegantbeef> I do want to eventually make a coop centric doom mod 😄
22:12:45FromDiscord<Srabb Van Griekenland> In reply to @Elegantbeef "I do want to": centric?
22:13:11FromDiscord<Elegantbeef> A good coop focused mod, there arent many of them
22:13:14FromDiscord<odexine> Co-op centric, as in centred around
22:13:20FromDiscord<Srabb Van Griekenland> oh
22:15:15FromDiscord<Elegantbeef> Anyway that Nim huh?
22:32:00FromDiscord<kdot_227> sent a code paste, see https://play.nim-lang.org/#pasty=mYNOXKQkISbz
22:32:16FromDiscord<kdot_227> but I'm not sure how to achieve this since most of the viewing of the AST is done during compile time
22:32:21FromDiscord<kdot_227> and I need this to work during runtime
22:32:37FromDiscord<kdot_227> I might just be stupid but I don't see a clear solution to this problem,
22:32:43FromDiscord<kdot_227> (edit) "problem," => "problem."
22:32:47FromDiscord<Elegantbeef> What you're asking for requires using the VM at runtime
22:32:54FromDiscord<Elegantbeef> Macros explicitly are compile time expansions
22:33:28FromDiscord<kdot_227> In reply to @Elegantbeef "Macros explicitly are compile": is there any other way to view the AST of a block of code during runtime?
22:33:28FromDiscord<Elegantbeef> You can either shell out to the nim compiler passing `e` to evaluate on the VM, use the compiler API directly, or use nimscripter
22:33:56FromDiscord<Elegantbeef> You need to compile the code so you need the VM or the compiler to compile it
22:35:41FromDiscord<kdot_227> damn
22:35:44FromDiscord<kdot_227> that makes it a lot harder
22:36:05FromDiscord<Elegantbeef> It's not that hard if you use nimscripter 😄
22:36:53FromDiscord<kdot_227> ooh I see
22:36:56FromDiscord<kdot_227> thank you for the help
22:38:13FromDiscord<Elegantbeef> https://github.com/beef331/nimscripter/blob/master/examples/macrorepl/macrorepl.nim infact this program monitors a nimscript file and emits ast inside of blocks
22:38:13FromDiscord<kdot_227> this is exactly what I was looking for thank you
22:38:29FromDiscord<kdot_227> you dont know how much help u are rn
22:38:41FromDiscord<kdot_227> ive been reading through all the macro docs
22:38:44FromDiscord<kdot_227> for nothing to work
22:39:07FromDiscord<Elegantbeef> https://streamable.com/c6farb for a showcase of it in use
22:39:09FromDiscord<Srabb Van Griekenland> what you guys doing
22:39:17FromDiscord<Elegantbeef> Probably something nasty
22:39:31FromDiscord<Elegantbeef> Reaching for nimscripter for AST related things is never good 😄
22:41:42FromDiscord<Robyn [She/Her]> I know I shouldn't generate a string of Nim code but I don't wanna use macros rn-
22:42:04FromDiscord<Robyn [She/Her]> More effort than they're worth even though it'd be nicer to use a macro
22:45:10FromDiscord<Robyn [She/Her]> My usecase: Generating types and functions for serialising and deserialising
22:51:52*azimut joined #nim
23:00:59FromDiscord<Elegantbeef> @Robyn [She/Her] serialising object variants?
23:02:36FromDiscord<Robyn [She/Her]> In reply to @Elegantbeef "<@524288464422830095> serialising object variants?": Nope
23:02:49FromDiscord<Robyn [She/Her]> Just very simple MC packets into Nim types
23:03:06FromDiscord<Elegantbeef> So then why do you need to generate code?
23:03:33FromDiscord<Elegantbeef> Got an example?
23:07:23FromDiscord<Robyn [She/Her]> In reply to @Elegantbeef "So then why do": To autogenerate procedures for reading and writing packets from a buffer, that's the main reason I want it
23:07:53FromDiscord<Elegantbeef> But why not just use a generic that takes a tuple type and reads it
23:10:33FromDiscord<Robyn [She/Her]> A tuple type? Why would a tuple type help?
23:10:56FromDiscord<Elegantbeef> I mean I assume you have a list of packets you want to serialize/deserialize
23:11:20FromDiscord<Robyn [She/Her]> It's only a packet at a time, and it'll be from a buffer
23:12:14FromDiscord<Elegantbeef> Right... you still likely have a list of packets that you want to use no?
23:12:32FromDiscord<Elegantbeef> I do not mean a runtime list, I mean a set, a known collection of data types that are the packets used
23:16:04FromDiscord<ezquerra> Maybe this is obvious but is there a way to pass an array or sequence to a proc that expects a varargs?
23:16:13FromDiscord<Elegantbeef> yes you just pass them
23:16:22FromDiscord<Elegantbeef> `varargs` is also `openArray[T]`
23:17:07FromDiscord<ezquerra> Umm, I must be doing something else wrong then, since I’m getting a compilation error due to a signature mismatch
23:17:15FromDiscord<Elegantbeef> Cooooode
23:18:30FromDiscord<grumblygibson> Was the experimental `{.this: self.}` syntax removed? I was seeing references to it on some old posts. "Cool! Oh, I'm super late to the game and it looks like it's gone."
23:18:42FromDiscord<Elegantbeef> Probably
23:19:00FromDiscord<Elegantbeef> sent a code paste, see https://play.nim-lang.org/#pasty=WqyRskJmCzAD
23:20:11FromDiscord<grumblygibson> That does clean up the declarations a bit. Mostly I was hoping to avoid the plethora of `self.member` in the body of the proc.
23:20:24FromDiscord<Robyn [She/Her]> In reply to @Elegantbeef "I do not mean": Ah yeah, I have that
23:20:30FromDiscord<ezquerra> I found the problem. The signature mismatch was not due to the varargs, but due to a missing `var` 🤦
23:20:46FromDiscord<ezquerra> sent a long message, see https://pasty.ee/vHoiIUbiWQJz
23:21:03FromDiscord<kdot_227> @ElegantBeef what version of nim do you use?
23:21:18FromDiscord<Robyn [She/Her]> Probably 2.0.2, it's the newest version currently
23:21:24FromDiscord<Elegantbeef> Bleh using `self` is awful in my view so don't do it↵(@grumblygibson)
23:21:26FromDiscord<ezquerra> I totally missed 1. the `[1]` and 2. the missing `var` 🙂
23:21:26FromDiscord<Robyn [She/Her]> Well, besides devel
23:21:28FromDiscord<Elegantbeef> Devel and 2.0.2
23:21:35FromDiscord<kdot_227> In reply to @chronos.vitaqua "Probably 2.0.2, it's the": im using it right now but a lot of things that I see aren't working on it
23:21:50FromDiscord<Robyn [She/Her]> In reply to @kdot_227 "im using it right": Oh? What do you mean?
23:22:10FromDiscord<ezquerra> Now that I think of it this is not the first time I had this problem. var / let mismatches are kind of hard to see from the message that nim gives you
23:22:35FromDiscord<Robyn [She/Her]> Nim's error messages could be greatly improved tbh
23:22:36FromDiscord<ezquerra> Anyway, thank you @ElegantBeef!
23:22:39FromDiscord<kdot_227> In reply to @chronos.vitaqua "Oh? What do you": the examples @ElegantBeef showed me with https://github.com/beef331/nimscripter. A lot of them don't work
23:22:52FromDiscord<kdot_227> last update was 6 months ago and I have no idea what version was primary at that time
23:22:56FromDiscord<grumblygibson> In reply to @Elegantbeef "Bleh using `self` is": I'm happy to do anything else if you have a good idea or pattern? In python I used `i` for a time, like bad grammar for `me`.
23:22:57FromDiscord<Elegantbeef> sent a code paste, see https://play.nim-lang.org/#pasty=mubeiWLEEZVQ
23:23:00FromDiscord<ezquerra> In reply to @chronos.vitaqua "Nim's error messages could": That is true
23:23:24FromDiscord<Elegantbeef> I mean use a descriptive name of the type or reason the value is there
23:23:31FromDiscord<Elegantbeef> `self` and `this` applies procedures are attached to instances
23:23:38FromDiscord<Elegantbeef> They're not unless they're `method`s
23:24:08FromDiscord<grumblygibson> Gotcha.
23:24:56FromDiscord<ezquerra> I often get an "indentation" error for all sorts of non indentation related problems (e.g. for an extra comma on the last module name of an import statement)
23:25:46FromDiscord<Elegantbeef> Kdot what's the issue you're running into?
23:26:07FromDiscord<Elegantbeef> I should say grumbly that's just my view if you prefer self/this/i/me/other pronoun feel free to
23:26:20FromDiscord<Elegantbeef> I just think it's daft and makes it harder to read code
23:27:41FromDiscord<Elegantbeef> You do need to run `macrorepl` with a target file
23:27:50FromDiscord<Elegantbeef> so like `./macrorepl ./test.nims`
23:29:10FromDiscord<Robyn [She/Her]> In reply to @kdot_227 "last update was 6": Ah, it was Nim 1.6
23:29:38FromDiscord<Elegantbeef> What are we talking about?
23:29:42FromDiscord<Elegantbeef> I just compiled on 2.0.2
23:29:51FromDiscord<Robyn [She/Her]> In reply to @Elegantbeef "<@524288464422830095> so just convert": Tbf I could do that
23:29:51FromDiscord<kdot_227> In reply to @Elegantbeef "I just compiled on": wait hol up give me a sec
23:30:02FromDiscord<Robyn [She/Her]> In reply to @Elegantbeef "I just compiled on": 🤷‍♀️
23:32:02FromDiscord<kdot_227> ok here we go
23:32:23FromDiscord<grumblygibson> In reply to @Elegantbeef "I just think it's": Yeah, thank you. I am generally annoyed with `self` and was still doing it today out of habit. You had me take a step back to realize that -- duh -- this isn't OOP that I'm writing so bad me, stop it. I like that distinction of reserving those for dynamic dispatch scenarios where they are tied to the instance.
23:32:37FromDiscord<kdot_227> https://media.discordapp.net/attachments/371759389889003532/1204932760704131133/test.txt?ex=65d68814&is=65c41314&hm=785a55cf296a25b1687b3f16232739b7f302d7c5ca594eeb595005fb350b2805&
23:32:52FromDiscord<kdot_227> @ElegantBeef that's my error
23:33:18FromDiscord<Robyn [She/Her]> Seems like you're missing a library?
23:33:24FromDiscord<Robyn [She/Her]> Idk
23:33:33FromDiscord<Elegantbeef> I don't use windows so yea that's the issue
23:33:35FromDiscord<Elegantbeef> Install a real OS, thanks 😛
23:33:46FromDiscord<kdot_227> In reply to @Elegantbeef "*Install a real OS,": 😭
23:34:58FromDiscord<Elegantbeef> I do use linenoise so you need to get a windows package for it
23:37:13FromDiscord<kdot_227> @ElegantBeef What are you using linenoise for?
23:37:57FromDiscord<Elegantbeef> it is a TUI program
23:38:21FromDiscord<kdot_227> In reply to @Elegantbeef "it is a TUI": what OS are you on
23:38:26FromDiscord<Elegantbeef> Linux
23:38:30FromDiscord<kdot_227> I'll see if I can get success on a vm
23:38:33FromDiscord<kdot_227> In reply to @Elegantbeef "Linux": distro
23:38:39FromDiscord<Elegantbeef> I mean just install linenoise
23:38:50FromDiscord<kdot_227> In reply to @Elegantbeef "I mean just install": easier said that done on windows
23:39:02FromDiscord<Elegantbeef> You also can use WSL2
23:39:52FromDiscord<Elegantbeef> https://github.com/arangodb/linenoise-ng
23:39:59FromDiscord<kdot_227> I found that
23:40:01FromDiscord<kdot_227> compiling rn
23:40:17FromDiscord<Elegantbeef> Though that's C++ written so `{.compile: linenoise.c.}` will fail
23:40:37FromDiscord<kdot_227> that's nice
23:40:41FromDiscord<Elegantbeef> Could also look for a termios port for windows
23:40:56FromDiscord<kdot_227> I think imma just go put my breadsticks in the oven
23:41:00FromDiscord<kdot_227> and read your code
23:41:01FromDiscord<Elegantbeef> Could also remove the `linenoise` import and deal with what is broken
23:41:07FromDiscord<kdot_227> and try and recreate my own version
23:41:12FromDiscord<kdot_227> In reply to @Elegantbeef "Could also remove the": I was thinking that too
23:41:17FromDiscord<kdot_227> thank you for all your help
23:41:22FromDiscord<Elegantbeef> Think I only use `clearScreen` from there
23:41:28FromDiscord<kdot_227> I appreciate it
23:42:31FromDiscord<kdot_227> these are the only problems
23:42:32FromDiscord<kdot_227> https://media.discordapp.net/attachments/371759389889003532/1204935254909915186/image.png?ex=65d68a67&is=65c41567&hm=c6078a30cd31d192a3d57eaa20eecd949a4b37d62bf023794eb478867a7d4ad4&
23:43:38FromDiscord<kdot_227> wait
23:43:43FromDiscord<kdot_227> yay
23:43:45FromDiscord<kdot_227> got it to compile
23:44:00*advesperacit quit ()
23:45:15NimEventerNew Nimble package! nimplex - NIM simPLEX: A concise scientific Nim library (with CLI and Python binding) providing samplings, uniform grids, and traversal graphs in compositional (simplex) spaces., see https://github.com/amkrajewski/nimplex
23:45:15NimEventerNew Nimble package! serde - Easy-to-use serialization capabilities (currently json only), with a drop-in replacement for std/json., see https://github.com/codex-storage/nim-json
23:46:43FromDiscord<Robyn [She/Her]> Procrastinating so much on everything ugh
23:48:17FromDiscord<kdot_227> @ElegantBeef were up to a new part now
23:48:19FromDiscord<kdot_227> https://media.discordapp.net/attachments/371759389889003532/1204936713018019910/image.png?ex=65d68bc3&is=65c416c3&hm=070abbaa99805fe073d76b0c3666c5e08b684232d722d5c8a272f0a959ffda97&
23:48:21FromDiscord<kdot_227> I got this far
23:48:26FromDiscord<kdot_227> and the process hung
23:48:53FromDiscord<kdot_227> I just want my AST 😭
23:49:05FromDiscord<kdot_227> I'm only using it to find strings in nim code
23:49:08FromDiscord<kdot_227> nothing more nothing less
23:49:23FromDiscord<Robyn [She/Her]> You could use the compiler as a library
23:49:35FromDiscord<that_dude.> Why are you trying to finid strings?
23:49:35FromDiscord<Robyn [She/Her]> Though it can be pretty complex
23:49:45FromDiscord<kdot_227> In reply to @chronos.vitaqua "You could use the": that sounds like a good idea but I've been working with nim for maybe 2 days and have 0 idea how I would do that
23:50:23FromDiscord<Elegantbeef> I mean you do not even need to usue the compiler as a library, just implement a nim string parser
23:50:33FromDiscord<Elegantbeef> But if you're searching for strings in Nim code why do you need this program?
23:50:42FromDiscord<kdot_227> In reply to @that_dude. "Why are you trying": very stupid project but I want to go to every string in a script and replace it with a rot13(stringval) function
23:50:59FromDiscord<Robyn [She/Her]> In reply to @kdot_227 "that sounds like a": Why would you wanna do this then?
23:51:06FromDiscord<kdot_227> In reply to @Elegantbeef "But if you're searching": I'm used to using AST for parsing code so I thought it would be the same unless you have a better idea (please have a better idea)
23:51:07FromDiscord<Robyn [She/Her]> In reply to @kdot_227 "very stupid project but": Huh...
23:51:13FromDiscord<Elegantbeef> Sounds like malware 😄
23:51:17FromDiscord<kdot_227> In reply to @Elegantbeef "Sounds like malware 😄": NO
23:51:22FromDiscord<kdot_227> obfuscation != malware
23:51:31FromDiscord<Robyn [She/Her]> In reply to @Elegantbeef "Sounds like malware 😄": Just sounds pointless :P
23:51:37FromDiscord<Elegantbeef> https://github.com/Yardanico/nim-strenc
23:51:41FromDiscord<that_dude.> https://nim-lang.org/docs/strutils.html#multiReplace%2Cstring%2Cvarargs%5B%5D↵?
23:51:44FromDiscord<that_dude.> What about this?
23:51:52FromDiscord<Elegantbeef> Obfuscation is heavily used in malware
23:51:53FromDiscord<Robyn [She/Her]> In reply to @kdot_227 "obfuscation != malware": Obfuscating the strings seems pointless honestly
23:52:00FromDiscord<Robyn [She/Her]> In reply to @Elegantbeef "Obfuscation is heavily used": h
23:52:00FromDiscord<Elegantbeef> There is very little reason to obfuscate anyway
23:52:01FromDiscord<Robyn [She/Her]> Ah
23:52:18FromDiscord<kdot_227> In reply to @Elegantbeef "https://github.com/Yardanico/nim-strenc": 👁️
23:52:19FromDiscord<kdot_227> wow
23:52:20FromDiscord<kdot_227> ok
23:52:21FromDiscord<kdot_227> i c
23:52:28FromDiscord<kdot_227> just needed macro to do all the work
23:52:31FromDiscord<kdot_227> during compile time
23:52:34FromDiscord<kdot_227> makes sense
23:52:36FromDiscord<kdot_227> thank you
23:52:57FromDiscord<Elegantbeef> I mean you could just you know import a module and do `obfuscate"..."`
23:53:11FromDiscord<Elegantbeef> There is no reason this needs to apply to all string literals used
23:55:01FromDiscord<odexine> well as long as youre aware that it's not too difficult to undo it
23:58:11FromDiscord<Robyn [She/Her]> Yeah I feel like that it's very pointless to do rot13
23:59:04FromDiscord<Robyn [She/Her]> What if you stored the bytes of a private key somewhere in the binary in various places and then you piece it together throughout the program's runtime to try and avoid detection /j
23:59:27FromDiscord<Robyn [She/Her]> Tho that wouldn't work because it'd show in the memory if it was observed, right?
23:59:43FromDiscord<Elegantbeef> What if you just didn't care about obfuscating