<< 08-02-2022 >>

00:27:08*jmdaemon quit (Ping timeout: 252 seconds)
00:44:17*vicfred quit (Quit: Leaving)
01:01:39*krux02 quit (Remote host closed the connection)
01:10:57*m5zs7k quit (Ping timeout: 256 seconds)
01:18:11*jmdaemon joined #nim
01:27:25*jmdaemon quit (Ping timeout: 240 seconds)
01:28:40FromDiscord<Arathanis> @ElegantBeef thanks for pointing me in that direction, its helped a lot. If you have some time tonight ( and I find the time) i was wondering if you could walk me through some of the finer points of how all this fits together.↵↵Also I don't know if you saw my previous message, but I believe you need to add `netty` as a requirement in nettyrpc's deps!
01:28:51FromDiscord<Evrensel Kişilik> sooooooooo
01:29:11FromDiscord<Evrensel Kişilik> is Nim bindings for Godot stable and full-featured?
01:29:15FromDiscord<Elegantbeef> Lol did i not have netty as a dep 😀↵(@Arathanis)
01:29:24FromDiscord<Elegantbeef> How the fuck did i manage to do that 😀
01:29:55FromDiscord<Arathanis> its easy, nimble doesn't add them automatically
01:30:00FromDiscord<Arathanis> i struggle with it too
01:30:07FromDiscord<Elegantbeef> Nah that's not my point
01:30:14FromDiscord<Elegantbeef> I somehow didnt run into any compilation issues
01:30:55FromDiscord<Arathanis> oh, well it should work fine if netty is installed with nimble, since nimble access your global environment you wont see any areas. Its if you take a clean nim environment and do `nimble install` that you are in trouble
01:31:10FromDiscord<Elegantbeef> you're telling me things i know
01:31:27FromDiscord<Arathanis> i dont doubt it, but I am reinforcing my own knowledge by repeating it. it helps me
01:31:34FromDiscord<Elegantbeef> Ah
01:31:51FromDiscord<Arathanis> also you mentioned not having compilation issues so i was seeking to explain since I assumed that meant you were at least partially confused. I mean no disrespect
01:32:27FromDiscord<Arathanis> you clearly have a stronger grasp on nim than I do :P
01:32:35FromDiscord<Elegantbeef> It's no problem just my behaviour 😛
01:34:04FromDiscord<Elegantbeef> Hey my pong still works!
01:34:13FromDiscord<Elegantbeef> Well thanks for that
01:34:43FromDiscord<Elegantbeef> So you had questions?
01:34:52*jmdaemon joined #nim
01:34:53FromDiscord<Evrensel Kişilik> @ElegantBeef
01:34:56FromDiscord<Evrensel Kişilik> hewwoooo
01:35:09FromDiscord<Evrensel Kişilik> :meat:
01:35:14FromDiscord<Evrensel Kişilik> beeeeeeeeeef
01:35:16FromDiscord<Elegantbeef> Hello
01:35:21FromDiscord<Evrensel Kişilik> soooooooooooooooooooooooooooooooooooooooooooooooooooo
01:35:45FromDiscord<Evrensel Kişilik> is Nim bindings mature enough?
01:36:02FromDiscord<Elegantbeef> I mean people have used them to make games
01:36:11FromDiscord<Elegantbeef> I've toyed with them a bit I havent used them much
01:36:21FromDiscord<Evrensel Kişilik> people are using Unity tooooooo 😱
01:36:24FromDiscord<Elegantbeef> They seem to work although are underdocumented
01:36:36FromDiscord<Evrensel Kişilik> oh
01:36:43FromDiscord<Evrensel Kişilik> thank you
01:41:52FromDiscord<Elegantbeef> @Arathanis\: did you dieded? 😛
01:44:58*jmdaemon quit (Quit: ZNC 1.8.2 - https://znc.in)
01:46:10FromDiscord<Arathanis> In reply to @Elegantbeef "<@136570191038513152>\: did you dieded?": nope!
01:46:11FromDiscord<Arathanis> still around
01:46:17FromDiscord<Arathanis> oh sorry
01:46:23FromDiscord<Arathanis> your query about questions was for me hjaha
01:46:26FromDiscord<Arathanis> (edit) "hjaha" => "haha"
01:47:07FromDiscord<Arathanis> im just trying to parse all the specifics of how the macro works, especially how it can be applied to a ensuring the type of a proc is appropriate for loading into the handler sequence
01:47:39FromDiscord<Arathanis> i noticed you have a proc for creating a list of parameter names and a mapping of names to types
01:49:02FromDiscord<Elegantbeef> Ok so you want a compile time error if you attempt to load the wrong proc?
01:49:16FromDiscord<Elegantbeef> Do you by any chance have the macro i gave you yesterday?
01:50:38Amun-Rahmm, is there a doNotOptimizeOutThisCode pragma in nim?
01:51:03FromDiscord<Elegantbeef> Not that i know of
01:51:08*jmdaemon joined #nim
01:52:11FromDiscord<Rika> Technically exportc in some way lol
01:54:44Amun-Rathe other (non portable way) is importc: "memset_s"
01:56:47Amun-Ra(I need to make sure I zero sensitive data at the end of a main)
01:57:25FromDiscord<Elegantbeef> Use orc and a destructor?
01:58:22Amun-Rahmm
01:58:36Amun-Ragood idea
01:58:52FromDiscord<Elegantbeef> I have them occasionally
01:59:34Amun-Ra;)
02:00:56Amun-Ra"/dev/null".writeFile buf
02:00:58Amun-Ra;)
02:01:06FromDiscord<Evrensel Kişilik> 😱
02:01:10FromDiscord<Evrensel Kişilik> nooooo ()
02:01:13FromDiscord<Evrensel Kişilik> oh nooo
02:01:31FromDiscord<Evrensel Kişilik> it is terrible for code search
02:01:59Amun-Rawhat do you mean?
02:02:29Amun-Rathe joke code as a whole or the order of args?
02:03:04FromDiscord<Evrensel Kişilik> i meaaaan
02:03:20FromDiscord<Evrensel Kişilik> im finding codes by searching patterns like `foo(`
02:03:40FromDiscord<Rika> Lol
02:03:42FromDiscord<Rika> Have fun
02:03:44Amun-Ra:>
02:04:03FromDiscord<Rika> You’re gonna have to account for MCS and style insensitivity I gues
02:04:13Amun-RaI usually write (if it's doable): writeFile "arg1", arg2
02:05:38FromDiscord<Elegantbeef> Depends on the procedure name but yea
02:08:48FromDiscord<Evrensel Kişilik> 😱
02:08:51FromDiscord<Evrensel Kişilik> oh nooooooooooooo
02:08:59FromDiscord<Elegantbeef> https://play.nim-lang.org/#ix=3OZE
02:09:00Amun-RaI'm team snake case and I would write write_file but there's no such option in vim and vscode plugins
02:09:01FromDiscord<Evrensel Kişilik> you are razy
02:09:05FromDiscord<Elegantbeef> There you go arathanis 😛
02:09:13FromDiscord<Arathanis> In reply to @Elegantbeef "Ok so you want": pretty much, I want to pass in a proc to be a handler and get a compile time error if its function signature doesn't match, and at least stitch the function signature up so you can omit params you dont need but it will be patched into the function to ensure it type matches the handler sequence
02:09:25FromDiscord<Arathanis> sorry i had to step away
02:09:34FromDiscord<Arathanis> dog caught a mouse, had to clean up the aftermath >_>;;
02:09:43FromDiscord<Elegantbeef> My dogs would probably run away
02:09:53FromDiscord<Arathanis> haha
02:10:05FromDiscord<Elegantbeef> Well you can do the patching inside that if branch now
02:10:19FromDiscord<Elegantbeef> Hopefully it makes sense you can do `pdef[3]` or `allowedImpl[3]` to get the parameters
02:10:22FromDiscord<Elegantbeef> first one is the return type
02:10:35FromDiscord<Elegantbeef> If you havent played with macros before it might be confusing but i do have a basic writeup to explain tooling to make it easier
02:10:46FromDiscord<Arathanis> ohhhh a writeup would be very useful
02:11:01FromDiscord<Arathanis> I wish the nim nodes used named parameters instead of numerical indexes
02:11:05FromDiscord<Elegantbeef> I need to expand it more for typed macros but it atleast explains the basic API https://dev.to/beef331/demystification-of-macros-in-nim-13n8
02:11:05FromDiscord<Arathanis> it would make code a lot more readable
02:11:21FromDiscord<Elegantbeef> For procedures you can do `.name` `.params` and a few other i think
02:11:23FromDiscord<Rika> In reply to @Arathanis "I wish the nim": There are third party libraries that do this
02:11:27FromDiscord<Elegantbeef> But you need to know it's a procedure node
02:11:49FromDiscord<Elegantbeef> Personally I wish NimNodes were 100% distinct, each node was it's own Node type
02:12:09*neurocyte0917090 quit (Ping timeout: 256 seconds)
02:12:09FromDiscord<Arathanis> In reply to @Rika "There are third party": i figured this would exist, shame it isn't the standard
02:12:13FromDiscord<Elegantbeef> I know there are some packages that have started with that
02:12:23FromDiscord<Rika> In reply to @Elegantbeef "Personally I wish NimNodes": Not feasible
02:18:42FromDiscord<Arathanis> In reply to @Elegantbeef "I need to expand": this is pretty great
02:19:12FromDiscord<Elegantbeef> When ever i see a response like that i expect a "but...."
02:19:19FromDiscord<Arathanis> not this time
02:19:44FromDiscord<Arathanis> now im just tossing the specifics around in my hea
02:19:45FromDiscord<Arathanis> (edit) "hea" => "head"
02:21:30FromDiscord<Arathanis> sent a code paste, see https://play.nim-lang.org/#ix=3OZH
02:22:23FromDiscord<Arathanis> sent a code paste, see https://play.nim-lang.org/#ix=3OZI
02:22:39FromDiscord<Elegantbeef> Yep
02:23:28FromDiscord<Arathanis> sent a code paste, see https://play.nim-lang.org/#ix=3OZL
02:23:45FromDiscord<Arathanis> rather than `s`
02:24:11FromDiscord<Arathanis> I suppose the easiest way would be to based it entirely on the type, and not the name and just make sure the parameter order is always the same
02:24:21FromDiscord<Elegantbeef> I mean any parameter they didnt define is `_: TheType`
02:24:21FromDiscord<Elegantbeef> They cannot use it internally if they didnt define it
02:25:31FromDiscord<Arathanis> your article helped me understand the real value of dumpTree
02:25:42FromDiscord<Arathanis> apply it to the result you want -> see your goal
02:25:49FromDiscord<Arathanis> apply it to what you want to type -> see your starting position
02:26:32FromDiscord<Elegantbeef> Since it has to compile before the macro gets it
02:26:32FromDiscord<Elegantbeef> since the AST is typed they can only use parameters they supplied
02:26:53*jmdaemon quit (Ping timeout: 256 seconds)
02:27:32FromDiscord<Arathanis> sent a code paste, see https://play.nim-lang.org/#ix=3OZM
02:28:13FromDiscord<Elegantbeef> Well you could just have an untyped macro
02:28:25FromDiscord<Rika> Macros can be pragmas if you still don’t know
02:28:47FromDiscord<Arathanis> yeah i think that is what ElegantBeef was referring to, we were initally discussing using `{.myMacro.}`
02:28:55FromDiscord<Rika> What happened then
02:28:57FromDiscord<Arathanis> but that means the proc has to be semantically valid
02:29:10FromDiscord<Elegantbeef> No only if it's a typed macro
02:29:15FromDiscord<Elegantbeef> Untyped macros do not have to be semantically checked
02:29:23FromDiscord<Arathanis> even when used as a pragma?
02:29:35FromDiscord<Elegantbeef> Even when used as a pragma
02:29:48FromDiscord<Arathanis> so the proc could be nonsense and it would be ok? lol that is amazing
02:30:11FromDiscord<Elegantbeef> sent a code paste, see https://play.nim-lang.org/#ix=3OZN
02:30:17FromDiscord<Elegantbeef> But if it's not semantically checked you dont get types
02:30:27FromDiscord<Elegantbeef> So that means you have to rely on names being the same
02:31:15FromDiscord<Elegantbeef> Which means things like type aliases will not work
02:31:46FromDiscord<Elegantbeef> Personally I'm very much on the "Try to not inject anything that's unclear" now
02:32:16FromDiscord<Arathanis> that's honestly probably for the best
02:32:21FromDiscord<Arathanis> explicit is better than implicit kind of thing
02:32:57FromDiscord<Elegantbeef> sent a code paste, see https://play.nim-lang.org/#ix=3OZQ
02:33:07FromDiscord<Elegantbeef> You know what arguments the procedure wants
02:33:17FromDiscord<Elegantbeef> So you can see which ones you need to pass and in what order
02:33:58FromDiscord<Arathanis> ohh turn it into a closure which automatically has the right signature and just introspect how to construct the internal call?
02:34:06FromDiscord<Arathanis> well
02:34:06FromDiscord<Elegantbeef> This does add another proc of indirection but it makes it so they can reuse the code without hidden variables
02:34:07FromDiscord<Arathanis> not a closure
02:34:08FromDiscord<Elegantbeef> It's not a closure, but yes
02:34:09FromDiscord<Arathanis> a wrapper
02:34:16FromDiscord<Elegantbeef> It's just a anonymous proc yes
02:34:35FromDiscord<Arathanis> i can dig that
02:34:37FromDiscord<Elegantbeef> It allows the most code reuse without introducing any funky shit
02:34:42FromDiscord<Arathanis> good advice
02:35:02FromDiscord<Elegantbeef> Funky shit isnt nice, i've learned that playing with macros 😀
02:35:09FromDiscord<Arathanis> or, and hear me out, i could take the advice of Ruby and Perl devs and make it as obtuse as possible
02:35:12FromDiscord<Arathanis> :^)
02:35:52FromDiscord<Elegantbeef> Like you can do cool stuff with macros, but doing anything that introduces hidden things is kinda bad form, I strive to avoid it as much as possible where it makes sense
02:36:48FromDiscord<Elegantbeef> I find it funny to say given that this was pretty much my first usage of macros
02:36:50FromDiscord<Elegantbeef> image.png https://media.discordapp.net/attachments/371759389889003532/940435978038956093/image.png
02:37:10FromDiscord<Elegantbeef> Super unintuitive API brought to you by silly ideas
02:38:11FromDiscord<Elegantbeef> It's now replaced by the following
02:38:12FromDiscord<Elegantbeef> image.png https://media.discordapp.net/attachments/371759389889003532/940436322965946369/image.png
02:38:31FromDiscord<Elegantbeef> One is vastly more sensible due to not making a new language for something simple 😛
02:38:58FromDiscord<Arathanis> so how am I supposed to know `expectRoutine` exists if its not in the docs for `std/macros` u_u
02:40:04FromDiscord<Elegantbeef> isnt it `.expect(Routines)`?
02:40:22FromDiscord<Arathanis> https://media.discordapp.net/attachments/371759389889003532/940436870205173760/unknown.png
02:40:41FromDiscord<Elegantbeef> It's not exported
02:40:45FromDiscord<Elegantbeef> So you arent supposed to know about it
02:40:51FromDiscord<Evrensel Kişilik> soooooooooo
02:40:56FromDiscord<Evrensel Kişilik> tell me a reason to use Nim
02:40:57FromDiscord<Evrensel Kişilik> plsss
02:41:12FromDiscord<Arathanis> In reply to @Elegantbeef "It's not exported": oh you are right lmao, im deep in the source code following def links
02:41:17FromDiscord<Arathanis> i followed it from `params`
02:41:20FromDiscord<Arathanis> which is exported
02:41:30FromDiscord<Elegantbeef> It's a nice to write language with a bunch of utilities to make pleasurable to write efficient code 😀
02:41:51FromDiscord<Evrensel Kişilik> sooooooooooooooooooo
02:41:57FromDiscord<Evrensel Kişilik> it is garbage collected
02:42:05FromDiscord<Arathanis> yes
02:42:08FromDiscord<Elegantbeef> It has a GC and reference counting like RAII
02:42:11FromDiscord<Arathanis> but iirc you have full control over the GC
02:42:12FromDiscord<Evrensel Kişilik> and we can write code like scripting
02:42:35FromDiscord<Evrensel Kişilik> buuuuuuut we can use pointer arithmetic tooooo right?
02:42:46FromDiscord<Elegantbeef> It's a system progrraming language
02:43:00FromDiscord<Evrensel Kişilik> sooooooo is there an OS written in Nim?
02:43:02FromDiscord<Elegantbeef> It doesnt have pointer arithmetic built in since it prefers type safe things, but yes
02:43:14FromDiscord<Elegantbeef> https://github.com/dom96/nimkernel
02:43:41FromDiscord<Evrensel Kişilik> In reply to @Elegantbeef "It doesnt have pointer": i don't like safe coding
02:43:47FromDiscord<Arathanis> ive been selling it to people by saying its like statically typed python, with the low level power of C or C++ but it puts the footguns behind a few doors that you have to open explicitly instead of just handing them to you
02:43:58FromDiscord<Evrensel Kişilik> even GDScript is not totally memory safe
02:44:04FromDiscord<Evrensel Kişilik> it is not garbage collected tooo
02:44:07FromDiscord<Evrensel Kişilik> 😱
02:44:20FromDiscord<Elegantbeef> Who said memory safe
02:44:25FromDiscord<Elegantbeef> Typesafety is not memory safety
02:44:29FromDiscord<Evrensel Kişilik> oh
02:44:35FromDiscord<Evrensel Kişilik> you meant type safety?
02:44:52FromDiscord<Arathanis> type safety as in if you say a variable is an integer and assign anything but an integer to it it screams at you
02:44:57FromDiscord<Arathanis> its strong, statically typed
02:44:57FromDiscord<Evrensel Kişilik> sooooooo i can't interpret memory with structs in Nim?
02:45:31FromDiscord<Elegantbeef> Nim differentiates pointers from pointers to an array
02:45:32FromDiscord<Elegantbeef> `ptr int` is a pointer to a single int `ptr UncheckedArray[int]` is a pointer to an array of ints
02:45:32FromDiscord<Elegantbeef> You can index the latter the former you cannot
02:45:32FromDiscord<Elegantbeef> This is similar to what Odin and Zig also do
02:45:45FromDiscord<Elegantbeef> You can
02:45:50FromDiscord<Arathanis> In reply to @Evrensel Kişilik "sooooooo i can't interpret": my understanding is that you can, its just the memory unsafe procedures-- the footguns -- are behind doors.↵↵it defaults to safe, you can be unsafe but you have to say you are going to be unsafe
02:45:56FromDiscord<Elegantbeef> Nim allows you to do the same as you would in any other system language
02:46:02FromDiscord<Elegantbeef> It just prefers by default to be type safe
02:46:07FromDiscord<Arathanis> its one of the things i think a lot of people like
02:46:13FromDiscord<Arathanis> is that you can be super low level and unsafe
02:46:15FromDiscord<Elegantbeef> There are like 6 unsafe keywords in nim
02:46:17FromDiscord<Arathanis> but you have to be explicit about it
02:46:21FromDiscord<Arathanis> and the defaults are safe
02:46:21FromDiscord<Evrensel Kişilik> soooooooooooo
02:46:23FromDiscord<Evrensel Kişilik> i like it
02:46:33FromDiscord<Elegantbeef> `pointer/ptr` `addr` `cast`
02:46:39FromDiscord<Rika> Nim doesn’t like restricting by design lol
02:46:40FromDiscord<Evrensel Kişilik> i don't have time to play with Nim now
02:46:41FromDiscord<Elegantbeef> What else am i missing
02:46:41FromDiscord<Evrensel Kişilik> buuuuuut
02:46:44FromDiscord<Elegantbeef> `unsafeaddr`
02:46:47FromDiscord<Evrensel Kişilik> i will do something
02:47:01FromDiscord<Elegantbeef> Nim can be used just as you'd use C but with a better typesystem, macros, and CTE
02:47:16FromDiscord<Elegantbeef> You can do `--gc:none` all day long if you wished
02:47:32FromDiscord<Elegantbeef> But most people would say do `--gc:arc` and use the RAII inspired memory management
02:47:36FromDiscord<Evrensel Kişilik> soooooooooooo
02:47:47FromDiscord<Elegantbeef> Which is based off move semantics and destructors just like..... C++/Rust afaik
02:47:56FromDiscord<Evrensel Kişilik> i can build some specific things without GC and statically link them right?
02:47:58FromDiscord<Elegantbeef> Well C++'s smartptr or w/e they're called
02:48:04FromDiscord<Elegantbeef> Yes
02:48:07FromDiscord<Rika> Sure
02:48:09*jmdaemon joined #nim
02:48:16FromDiscord<Evrensel Kişilik> goooooooooooooooooooooooooooooooooooooooooooooooooooood
02:48:25FromDiscord<Rika> It’s not very nice looking but it’s possible
02:48:32FromDiscord<Elegantbeef> Though you could consider the arc instead since it's deterministic and a bit safer 😛
02:48:36FromDiscord<Evrensel Kişilik> soooooooooooo
02:48:43FromDiscord<Elegantbeef> Well they're a C lover so not very nice looking is what they like 😛
02:48:52FromDiscord<Evrensel Kişilik> if i don't have anything that needs to be garbage collected
02:49:12FromDiscord<Evrensel Kişilik> would it affect my code complexity
02:49:13FromDiscord<Evrensel Kişilik> (edit) "complexity" => "complexity?"
02:49:18FromDiscord<Rika> Oh that’s gonna look no different from normal GC on code I believe
02:49:23FromDiscord<Evrensel Kişilik> i mean compiled code
02:49:55FromDiscord<Elegantbeef> It may depend on the memory management you use
02:49:58FromDiscord<Rika> The GC will still initialise if it’s on, but the Nim code should be the same between the two
02:50:24FromDiscord<Arathanis> sent a code paste, see https://play.nim-lang.org/#ix=3OZS
02:50:32FromDiscord<Evrensel Kişilik> oh
02:50:32FromDiscord<Elegantbeef> https://nim-lang.org/docs/mm.html
02:50:37FromDiscord<Evrensel Kişilik> `ptr` and `ref`
02:50:41FromDiscord<Evrensel Kişilik> soooooooooooooooooooooooooooooooooo
02:50:48FromDiscord<Elegantbeef> `ref` is a managed pointer
02:50:52FromDiscord<Evrensel Kişilik> what is `ref`?
02:50:54FromDiscord<Elegantbeef> `ptr` is a unmanaged pointer
02:50:55FromDiscord<Evrensel Kişilik> sooooooooooooo?
02:50:58FromDiscord<Arathanis> reference
02:51:03FromDiscord<Arathanis> its like a pointer the GC manages iirc
02:51:04FromDiscord<Evrensel Kişilik> what is managed?
02:51:06FromDiscord<Elegantbeef> `ref` is managed by the GC and the "safe" way to do pointers in Nim
02:51:12FromDiscord<Arathanis> the GC will reference count it
02:51:22FromDiscord<Evrensel Kişilik> damn
02:51:22FromDiscord<Elegantbeef> I say GC but more memory manager
02:51:24FromDiscord<Arathanis> `ptr` is a ref and you are telling the GC to butt out
02:51:31FromDiscord<Evrensel Kişilik> what will the GC free?
02:51:39FromDiscord<Elegantbeef> Since people dont like GC when talking about determnistic RCs
02:51:44FromDiscord<Elegantbeef> Depends on the memory management you use
02:51:47FromDiscord<Elegantbeef> ARC is a deterministic memory management system
02:51:58FromDiscord<Arathanis> GC should free any non-ptr memory with no external reference... i think
02:52:23FromDiscord<Arathanis> pretty sure you can import the gc and turn it off and on during runtime too
02:52:27FromDiscord<Elegantbeef> ARC decrements the counter at end of scope and it it's 0'd it calls the destructor afaik
02:52:39FromDiscord<Evrensel Kişilik> sooooooooooo
02:52:48FromDiscord<Elegantbeef> Refc is deferred reference counter
02:53:02FromDiscord<Elegantbeef> The link to memory mangement explains the systems
02:53:19FromDiscord<Evrensel Kişilik> sent a code paste, see https://play.nim-lang.org/#ix=3OZW
02:53:23FromDiscord<Evrensel Kişilik> what is GC about?
02:53:48FromDiscord<Rika> ?
02:53:55FromDiscord<Rika> References cannot be stack pointers
02:53:55FromDiscord<Elegantbeef> the `ref` is stack allocated since it's a pointer but the `bar` would be heap allocated
02:54:09FromDiscord<Elegantbeef> `ref T` can only refer to values allocated on the heap
02:54:22FromDiscord<Evrensel Kişilik> sooooooooooooooooooooooooooooooooo
02:54:30FromDiscord<Evrensel Kişilik> what will be garbage collected?
02:54:33FromDiscord<Rika> If you don’t want the GC use ptr
02:54:38FromDiscord<Rika> All ref is GCed
02:54:39FromDiscord<Elegantbeef> The heap allocated object
02:54:50FromDiscord<Evrensel Kişilik> buuuuuuuut refs are stack variables
02:54:59FromDiscord<Evrensel Kişilik> In reply to @Elegantbeef "The heap allocated object": oh
02:55:00FromDiscord<Evrensel Kişilik> damn
02:55:00FromDiscord<Rika> Yes, the data in ref
02:55:02FromDiscord<Evrensel Kişilik> sooooooooo
02:55:04FromDiscord<Elegantbeef> The pointer is stack allocated
02:55:04FromDiscord<Evrensel Kişilik> you mean
02:55:07FromDiscord<Evrensel Kişilik> oh wait
02:55:09FromDiscord<Evrensel Kişilik> damn
02:55:12FromDiscord<Evrensel Kişilik> you mean
02:55:18FromDiscord<Rika> ??
02:55:23FromDiscord<Elegantbeef> Just like any other language the pointer is on the stack
02:55:28FromDiscord<Elegantbeef> The data it points to is on the heap
02:55:33FromDiscord<Evrensel Kişilik> i have an allocated thing
02:55:39FromDiscord<Evrensel Kişilik> and i don't use it anymore
02:55:42FromDiscord<Rika> Yes
02:55:44FromDiscord<Evrensel Kişilik> and it will be garbage collected
02:55:47FromDiscord<Evrensel Kişilik> buuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuut
02:55:49FromDiscord<Rika> If it is a reference
02:55:53FromDiscord<Elegantbeef> sent a code paste, see https://paste.rs/TfA
02:56:07FromDiscord<Evrensel Kişilik> if i use the allocated variable
02:56:09FromDiscord<Elegantbeef> In the above case the integer will be freed when the GC system says to
02:56:13FromDiscord<Evrensel Kişilik> it would not be garbage collected
02:56:15FromDiscord<Evrensel Kişilik> buuuuuuuuuuuuuut also
02:56:26FromDiscord<Evrensel Kişilik> it is same if i use a reference to it
02:56:36FromDiscord<Evrensel Kişilik> it will not be garbage collected also
02:56:38FromDiscord<Evrensel Kişilik> right?
02:56:50FromDiscord<Rika> I don’t understand
02:56:58FromDiscord<Elegantbeef> Me either
02:57:03FromDiscord<Evrensel Kişilik> ban @Rika
02:57:04FromDiscord<Evrensel Kişilik> pls
02:57:21FromDiscord<Evrensel Kişilik> soooooooooooooooo i just mean
02:57:31FromDiscord<Evrensel Kişilik> using a ref to an allocated thing
02:57:38FromDiscord<Rika> Okay
02:57:45FromDiscord<Evrensel Kişilik> avoids garbage collection for that allocated thing
02:57:46FromDiscord<Evrensel Kişilik> right?
02:57:49FromDiscord<Elegantbeef> If you allocate a reference it's heap allocated and will be freed when the GC says so(nothing points to it)
02:58:00FromDiscord<haolian9 (高浩亮)> hi all, is there a guide on using log inside a library?↵i checked out some libraries which did not use log, what if i need some log info to debug those libraies?
02:58:09FromDiscord<Rika> If you have a reference and it’s still being used it will not be reallocated
02:58:09FromDiscord<Evrensel Kişilik> soooooooooooooo?
02:58:10FromDiscord<Evrensel Kişilik> yes or no?
02:58:14FromDiscord<Rika> Deallocated
02:58:30FromDiscord<Evrensel Kişilik> In reply to @Rika "If you have a": sooooooooooooooooooooooooo it is a yes
02:58:31FromDiscord<Rika> In reply to @haolian9 (高浩亮) "hi all, is there": Add logs then
02:58:42FromDiscord<Evrensel Kişilik> buuuuuuut it is not same for `ptr`
02:58:53FromDiscord<Rika> In reply to @Evrensel Kişilik "sooooooooooooooooooooooooo it is a": By the way, you cannot convert ptr to ref without reallocation
02:59:02FromDiscord<Evrensel Kişilik> hmmmmmmmmmmmmmm
02:59:06FromDiscord<Evrensel Kişilik> convert?
02:59:11FromDiscord<Rika> You must stay in one or the other
02:59:22FromDiscord<Rika> You can’t make a ptr into a ref and vice versa
02:59:22FromDiscord<Elegantbeef> pointers are unmanged the Nim memory management cannot know how many things point to the data
02:59:44FromDiscord<Elegantbeef> Pointers work just like they do in C
02:59:48FromDiscord<Rika> Pointers are plain pointers like in C
02:59:49FromDiscord<Rika> Yes
02:59:55FromDiscord<Elegantbeef> though in Nim they're 0-init'd
02:59:56FromDiscord<Elegantbeef> So they're always nil by default
03:00:15FromDiscord<Rika> So like calloc
03:00:24FromDiscord<Elegantbeef> Though like i mentioned before Nim doesnt have pointer arithmetic by default
03:00:33FromDiscord<Elegantbeef> Cause that's a very silly thing \:
03:01:13FromDiscord<Rika> You can make it do pointer arithmetic but it’s not pretty
03:01:48FromDiscord<Elegantbeef> https://github.com/kaushalmodi/ptr_math just use this 😛
03:01:58FromDiscord<Evrensel Kişilik> high level things are always cauising unpredictable issues
03:02:12FromDiscord<Elegantbeef> Yea like lowlevel things never do
03:02:31FromDiscord<Evrensel Kişilik> low level things are always difficult
03:02:31FromDiscord<Elegantbeef> No one has ever accidently dereferenced a non 0-init'd pointer in C
03:02:37FromDiscord<Evrensel Kişilik> but never unpredictable
03:02:45FromDiscord<Elegantbeef> No one has ever forgot the `\0` inside a cstring 😀
03:02:53FromDiscord<Elegantbeef> Well there is no unpredictable issues
03:02:55FromDiscord<Evrensel Kişilik> i left Unity and switched back to Godot
03:03:05FromDiscord<Evrensel Kişilik> the problam was being fucking high level
03:03:06FromDiscord<Rika> Unpredictability is not the only issue
03:03:13FromDiscord<Rika> Something being obtuse causes bugs too
03:03:24FromDiscord<Evrensel Kişilik> soooooooooooooo
03:03:28FromDiscord<Evrensel Kişilik> dooooon't worry
03:03:29FromDiscord<Elegantbeef> The problem with Unity isnt about highlevel but more about the fact the engine lacks anything but a rendering backend
03:03:36FromDiscord<Evrensel Kişilik> i will write some articles about my philosophy
03:03:48FromDiscord<Rika> Unity is pretty confusing ngl
03:03:52FromDiscord<Elegantbeef> Unity's biggest issue is that you have to make everything yourself or buy an asset
03:04:08FromDiscord<Evrensel Kişilik> simply
03:04:11FromDiscord<Evrensel Kişilik> it is broken
03:04:12FromDiscord<Elegantbeef> Anyone that uses Unity "properly" makes their own tooling, cause Unity lacks it
03:04:31FromDiscord<Evrensel Kişilik> Unity's Netcode thing is extremely buggy
03:04:35FromDiscord<Elegantbeef> All the people I know that use Unity just use it as a BGFX like library
03:04:55FromDiscord<Evrensel Kişilik> it doesn't support WebSocket and there is a community thing for that but it is not working for web exports
03:05:08FromDiscord<Evrensel Kişilik> ummmmm also web exports are totally buggy in Unity
03:05:18FromDiscord<Evrensel Kişilik> i was about to crazy today
03:05:23FromDiscord<Evrensel Kişilik> (edit) "i was about to ... crazy" added "go"
03:05:25FromDiscord<Evrensel Kişilik> buuuuut
03:05:35FromDiscord<Evrensel Kişilik> it is always same
03:05:54FromDiscord<Evrensel Kişilik> some people write some shit codes with shit architectures
03:06:28FromDiscord<Evrensel Kişilik> and other ones make something that will force them to write better architectured code
03:06:33FromDiscord<Elegantbeef> Hey i'm right here just say it to my face
03:06:34FromDiscord<Evrensel Kişilik> this is just a curse
03:06:49FromDiscord<Evrensel Kişilik> In reply to @Elegantbeef "Hey i'm right here": what?
03:07:04FromDiscord<Elegantbeef> > some people write some shit codes with shit architectures
03:07:10FromDiscord<Evrensel Kişilik> oh
03:07:12FromDiscord<Evrensel Kişilik> lol
03:07:15FromDiscord<Evrensel Kişilik> i mean for example
03:07:18FromDiscord<Evrensel Kişilik> JavaScript
03:07:32FromDiscord<Evrensel Kişilik> tons of people write shit codes
03:07:52FromDiscord<Evrensel Kişilik> and damn virus frameworks are occuring
03:08:02FromDiscord<Evrensel Kişilik> frameworks are viruses
03:08:26FromDiscord<Evrensel Kişilik> soooooooooo breaking programmability
03:08:31FromDiscord<Evrensel Kişilik> this is the problem
03:10:29FromDiscord<Evrensel Kişilik> soooooooo GDScript is very high level yes
03:10:43FromDiscord<Evrensel Kişilik> but not in meaning of breaking programmability
03:17:32*arkurious quit (Quit: Leaving)
03:28:13NimEventerNew thread by Haoliang: Best practice or guidelines on using log in a library?, see https://forum.nim-lang.org/t/8880
03:28:30FromDiscord<Evrensel Kişilik> In reply to @NimEventer "New thread by Haoliang:": you are a real bot?
03:28:35FromDiscord<Evrensel Kişilik> i hope you are
03:28:45FromDiscord<Elegantbeef> That's a real bot
03:28:57FromDiscord<Evrensel Kişilik> In reply to @Elegantbeef "That's a real bot": just like you!!!!
03:29:11FromDiscord<Evrensel Kişilik> your avatar scaring me
03:29:18FromDiscord<Elegantbeef> Leave my doggo alone
03:29:18FromDiscord<Evrensel Kişilik> plssss get out here
03:29:31FromDiscord<congusbongus> says the anime dp guy
03:29:54FromDiscord<Evrensel Kişilik> 😱
03:30:16FromDiscord<congusbongus> just kidding
03:30:37FromDiscord<Evrensel Kişilik> im hungry
03:30:43FromDiscord<Evrensel Kişilik> please make me some fooods
03:31:02FromDiscord<Evrensel Kişilik> maybe a beef toast
03:31:06FromDiscord<evoalg> Sometimes I think I'm the only human here
03:31:15FromDiscord<Elegantbeef> Clearly you're not human
03:31:24FromDiscord<Evrensel Kişilik> In reply to @Elegantbeef "Clearly you're not human": yes
03:31:27FromDiscord<Evrensel Kişilik> yesssssssssssssssssssss
03:31:55FromDiscord<Evrensel Kişilik> sooooooooo this 1440p monitor is not enough
03:31:56FromDiscord<congusbongus> Tell me more about Sometimes I think I'm the only human here
03:32:00FromDiscord<Rika> Sometimes I think
03:32:10FromDiscord<Rika> Only sometimes though
03:32:30FromDiscord<Evrensel Kişilik> i will get a 4K monitor
03:32:47FromDiscord<Evrensel Kişilik> buuuuuut curved one
03:34:34FromDiscord<Elegantbeef> You're a programmer you dont need horizontal display you need vertical display
03:37:13FromDiscord<Evrensel Kişilik> In reply to @Elegantbeef "You're a programmer you": oh
03:37:23FromDiscord<Evrensel Kişilik> it is correct
03:37:26FromDiscord<Evrensel Kişilik> buuuuuuuuuut
03:37:46FromDiscord<Evrensel Kişilik> im using soooo many windows
03:38:02FromDiscord<Evrensel Kişilik> it is correct while coding
03:39:03*m5zs7k joined #nim
03:39:03FromDiscord<Evrensel Kişilik> buuuuuuut sometimes
03:39:07FromDiscord<Evrensel Kişilik> for example debugging
03:39:17FromDiscord<Evrensel Kişilik> we need horizontal space
03:39:25FromDiscord<Evrensel Kişilik> ummmmmmm there are soooo many times
03:39:29FromDiscord<Evrensel Kişilik> that we need horizontal space
03:40:38FromDiscord<Evrensel Kişilik> this new monitor's feet is not gooooooood it only has vertical movement
03:40:57FromDiscord<Evrensel Kişilik> i need a custom monitor feet
03:43:03FromDiscord<Evrensel Kişilik> why do i love Godot this much?
03:43:34FromDiscord<Rika> That’s an idea soup if I’ve ever seen one
03:43:47FromDiscord<Evrensel Kişilik> In reply to @Rika "That’s an idea soup": whaaaaaaaaaaaaaaaaaaaat
03:43:53FromDiscord<Evrensel Kişilik> whatt soup??
03:44:02FromDiscord<Evrensel Kişilik> will you make a soup for me?
03:44:05FromDiscord<Evrensel Kişilik> you mean that?
04:12:48FromDiscord<creikey> sent a code paste, see https://play.nim-lang.org/#ix=3P0i
04:13:10FromDiscord<creikey> if I wanted to create a windy window like this and return it from a function, how should I capture the window for the resize callback?
04:13:18FromDiscord<creikey> doing this results in a compile error about memory safety
04:13:31FromDiscord<creikey> sent a code paste, see https://play.nim-lang.org/#ix=
04:15:37FromDiscord<Elegantbeef> One way would be to make the `result` type a `ref T`
04:16:03FromDiscord<Elegantbeef> The issue is that `result` is a stack variable so once the procedure is done it's unsafe to reference it i assume
04:16:41FromDiscord<Elegantbeef> Really the `onResize` should probably take a parameter `window` so you can access that stuff internally
04:17:53FromDiscord<Elegantbeef> sent a code paste, see https://play.nim-lang.org/#ix=3P0j
04:20:10FromDiscord<creikey> In reply to @Elegantbeef "The issue is that": it's only referenced by a function also tied to the lifetime of the window
04:20:57FromDiscord<Elegantbeef> What?
04:21:17FromDiscord<creikey> like the `window.onResize` proc will also be freed with the `window` variable
04:21:39FromDiscord<Elegantbeef> Sure but that's not related to what i said
04:21:41FromDiscord<creikey> so it should be fine to capture `window` in it as when window dies it dies
04:21:46FromDiscord<creikey> I mean I guess you can still copy the function
04:21:49FromDiscord<Elegantbeef> It's not capturing window
04:21:59FromDiscord<Elegantbeef> It's capturing the window on the result
04:22:04FromDiscord<creikey> it's capturing result which is a Window ooh wait
04:22:06FromDiscord<creikey> I see what you're saying
04:22:29FromDiscord<Elegantbeef> What is the type of `result`?
04:29:17FromDiscord<creikey> In reply to @Elegantbeef "What is the type": I stashed those changes as I decided refactoring everything into a separate file and api wasn't really worth it but it was just an object with window in it
04:29:45FromDiscord<Elegantbeef> Ah so i was right that it was a stack variable
04:29:59FromDiscord<creikey> yeah returned from the function
04:30:24FromDiscord<creikey> I can just git submodule nimble packages from a fork if I want to edit them right
04:30:25FromDiscord<Elegantbeef> Then yea i'm 99% certain the bug would've went away with the ref change or the direct reference of the window
04:30:31FromDiscord<Elegantbeef> Well compile error
04:30:40FromDiscord<Elegantbeef> Uhh i just fork clone and `nimble develop` which symlinks it
04:30:47FromDiscord<creikey> oh yo that sounds nice
04:56:40FromDiscord<noow> any way to mark an import used, when importing it has a side effect
04:57:14FromDiscord<noow> i know i know importing modules mutating global variables is not the best design, but sometimes it's convenient in a module-loadingy thingy
04:58:18FromDiscord<Elegantbeef> You can do `import x {.used.}`
04:58:31FromDiscord<Elegantbeef> you can also put `{.used.}` inside the body of the proc
04:58:35FromDiscord<Elegantbeef> i mean module
04:58:39FromDiscord<noow> thank
04:58:45FromDiscord<noow> i guess i could also use includes
04:58:49FromDiscord<noow> but this one seems fine for now
04:58:52FromDiscord<Elegantbeef> No
04:58:57FromDiscord<Elegantbeef> Dont use include unless you actually need it
04:59:30FromDiscord<Elegantbeef> https://nim-lang.org/docs/manual.html#pragmas-used-pragma
05:00:16FromDiscord<noow> Error: invalid pragma, expected: {all}
05:01:05FromDiscord<Elegantbeef> Guess you cannot use it on imports
05:01:09FromDiscord<Elegantbeef> So just throw it inside the module
05:01:18FromDiscord<noow> oki
06:23:30*Gustavo6046 joined #nim
06:28:37*Gustavo6046 quit (Ping timeout: 250 seconds)
06:33:29*lain quit (Quit: brb)
06:35:09*lain joined #nim
06:35:14*cyraxjoe quit (Quit: I'm out!)
06:36:55*cyraxjoe joined #nim
06:38:55*cyraxjoe quit (Client Quit)
06:40:45*cyraxjoe joined #nim
07:00:22FromDiscord<Someone.one> is it possible to have non-continuous range types?
07:00:34FromDiscord<Elegantbeef> No
07:01:08FromDiscord<Elegantbeef> You could use a `sequence[Slice[T]]`
07:01:13FromDiscord<Elegantbeef> jeez
07:01:16FromDiscord<Elegantbeef> `seq[Slice[T]]`
07:04:15FromDiscord<Elegantbeef> sent a code paste, see https://play.nim-lang.org/#ix=3P0G
07:04:59*PMunch joined #nim
07:12:55FromDiscord<Arathanis> whats the best way to make a new expression node? Specifically a ExprEqExpr?
07:13:12FromDiscord<Elegantbeef> `nnkExprEqExpr.newTree(a, b)`
07:16:57FromDiscord<Phil> reads the bit about "you can just turn on the gc arc flag with your currently written code
07:16:59FromDiscord<Phil> squints
07:17:10FromDiscord<Phil> (edit) "code" => "code""
07:17:37FromDiscord<Phil> Are you sure I wouldn't have to do some code adjustments here or there to make different GC's such as ARC work?
07:18:06FromDiscord<Phil> Like, I haven't tried, but I'd be willing to bet the compiler explodes somewhere if I turned that flag on right now
07:18:23FromDiscord<Elegantbeef> sent a code paste, see https://play.nim-lang.org/#ix=3P0H
07:18:35FromDiscord<Elegantbeef> You shouldnt need to do anything to make ORC work
07:18:42FromDiscord<Elegantbeef> With ARC you have to ensure you dont have cycles
07:18:48FromDiscord<Elegantbeef> But it will "work" without that
07:19:11FromDiscord<Elegantbeef> Arc/Orc should not require changing code
07:21:23FromDiscord<Phil> Wait, can arc compile even if I have cycles or does it explode as would be appropriate?
07:21:33FromDiscord<Elegantbeef> It compiles it just doesnt free
07:21:50FromDiscord<Phil> Well... that's unfortunate for me
07:21:51FromDiscord<Phil> hm
07:21:58FromDiscord<Elegantbeef> You leak cycles
07:22:02FromDiscord<Arathanis> does `ident` not let you make arbitrary identifier nodes?
07:22:06FromDiscord<Elegantbeef> Use orc or handle cycles yourself
07:22:13FromDiscord<Elegantbeef> "arbitrary identifiers"?
07:22:20FromDiscord<Arathanis> https://media.discordapp.net/attachments/371759389889003532/940507822846771210/unknown.png
07:22:22FromDiscord<Phil> I don't know if I leak cycles, having the compiler check for me would be nice ^^'
07:22:24FromDiscord<Elegantbeef> `genSym` is what you want
07:22:36FromDiscord<Arathanis> ohhhh ok
07:22:44FromDiscord<Elegantbeef> I mean i thin kti's what you want
07:22:49FromDiscord<Elegantbeef> Do you want to be able to access the symbol?
07:23:21FromDiscord<Phil> Was just a matter of whether it could've been a low-hanging-fruit optimization - Just enable the flag, adjust the parts of your code where the compiler screams and enjoy having arc
07:24:20FromDiscord<Arathanis> In reply to @Elegantbeef "Do you want to": im trying to use it to make a `ExprEqExpr`
07:24:50FromDiscord<Elegantbeef> so then `ident"number", yourValHere`
07:24:54FromDiscord<Arathanis> sent a code paste, see https://paste.rs/jd0
07:25:15FromDiscord<Elegantbeef> Oh you've fallen for the trap
07:25:28FromDiscord<Arathanis> getting trapped is part of learning :]
07:25:32FromDiscord<Arathanis> (edit) "https://play.nim-lang.org/#ix=3P0L" => "https://play.nim-lang.org/#ix=3P0K"
07:25:37FromDiscord<Elegantbeef> inside an arg list it's not a `nnkExprEqExpr` it's a `nnkIdentDef`
07:25:50FromDiscord<Elegantbeef> https://nim-lang.org/docs/macros.html#newIdentDefs%2CNimNode%2CNimNode
07:26:13FromDiscord<Elegantbeef> Wait you're doing named parameters
07:26:13FromDiscord<Elegantbeef> I'm dumb
07:26:30FromDiscord<Elegantbeef> What's the compiler error?
07:26:45FromDiscord<Arathanis> undeclared identifier: "number"
07:26:52FromDiscord<Elegantbeef> do me a favour and do `echo result.repr` at the end of the macrro
07:26:53FromDiscord<Arathanis> same for message
07:26:56FromDiscord<Arathanis> https://media.discordapp.net/attachments/371759389889003532/940508982026592276/unknown.png
07:27:01FromDiscord<Arathanis> it has a problem there
07:27:12FromDiscord<Elegantbeef> Like i said `echo result.repr`
07:27:30FromDiscord<Arathanis> sent a code paste, see https://play.nim-lang.org/#ix=3P0M
07:27:44FromDiscord<Elegantbeef> Yea then run the code
07:27:47FromDiscord<Elegantbeef> Or attempt to compile it
07:27:53FromDiscord<Elegantbeef> it'll give you the generated Nim code out
07:27:56FromDiscord<Elegantbeef> I want to see that
07:28:44FromDiscord<Arathanis> k let me make sure its cleaned up so im only giving you relevant output
07:28:49FromDiscord<Arathanis> scratchpaper folder lol
07:29:27FromDiscord<Arathanis> sent a code paste, see https://play.nim-lang.org/#ix=3P0O
07:29:40FromDiscord<Elegantbeef> Ah there you go
07:29:42FromDiscord<Elegantbeef> You can probably see the issue now
07:30:09FromDiscord<Arathanis> oh its in the uhh
07:30:16FromDiscord<Arathanis> genAst call isnt it
07:30:18FromDiscord<Elegantbeef> `genAst` gensyms symbols by default, so you need to do `genAst(..., number = ident"number", message = ident"message")`
07:30:40FromDiscord<Elegantbeef> Dont know if it respects `{.inject.}`
07:30:48FromDiscord<Elegantbeef> you could try that aswell
07:31:02FromDiscord<Arathanis> how would i try inject?
07:31:07FromDiscord<Elegantbeef> `proc (number {.inject.}: int, message {.inject.}: string)`
07:31:16FromDiscord<Arathanis> ohhh
07:31:19FromDiscord<Arathanis> ill try that
07:31:23FromDiscord<Arathanis> also your first idea totally worked
07:31:37FromDiscord<Elegantbeef> Who'd i be if i couldnt write macros
07:32:02FromDiscord<Elegantbeef> Where's rika to say "Useful"
07:32:13FromDiscord<Arathanis> it does respect inject
07:32:48FromDiscord<Arathanis> it also autoformats things really terribly
07:32:56FromDiscord<Arathanis> this looks awful https://media.discordapp.net/attachments/371759389889003532/940510496233234472/unknown.png
07:33:04FromDiscord<Arathanis> apparently it wants it to look that way lol
07:33:20FromDiscord<Elegantbeef> I mean you can disable nimpretty
07:33:37FromDiscord<Elegantbeef> Or increase the line limit
07:33:40FromDiscord<Elegantbeef> 80 is quite small
07:33:53FromDiscord<Elegantbeef> Someone is writting a fucking essay and i'm scared
07:34:08FromDiscord<Elegantbeef> Oh did the bridge just glitch
07:34:23FromDiscord<Arathanis> nah i decided i didnt need to hit enter :P
07:34:37FromDiscord<Arathanis> extended the line length to 120
07:34:39FromDiscord<Arathanis> and now its sane
07:34:43FromDiscord<Elegantbeef> Not you the person that asked about the ranges
07:34:47FromDiscord<Arathanis> ohhhh
07:34:57FromDiscord<Elegantbeef> Just dont go too wild with the horizontal size
07:35:03FromDiscord<Elegantbeef> Vertical \> horizontal
07:35:49FromDiscord<Elegantbeef> sent a code paste, see https://paste.rs/jCB
07:36:08FromDiscord<Elegantbeef> If you dont want the random `add` that is
07:36:30FromDiscord<Arathanis> that seems, almost weird
07:36:42FromDiscord<Elegantbeef> Macros really benefit from the fun Nim syntax imo
07:36:46FromDiscord<Arathanis> haha
07:36:58FromDiscord<Elegantbeef> You come to love the block call logic Nim has
07:37:10FromDiscord<Arathanis> oh i do, its just about internalizing it all
07:37:19FromDiscord<Arathanis> lots of... i think the word is currying
07:37:34FromDiscord<Arathanis> well i really appreciate the help
07:37:37FromDiscord<Elegantbeef> Currying is different but we'll take it 😀
07:37:45FromDiscord<Elegantbeef> No problem
07:37:50FromDiscord<Arathanis> im finally at the point where i understand macros enough to be dangerous lmao
07:37:55FromDiscord<Arathanis> now i can experiment
07:38:04FromDiscord<Arathanis> sent a code paste, see https://play.nim-lang.org/#ix=3P0R
07:38:06FromDiscord<Elegantbeef> Personally I view `error` much better than `expect`
07:38:37FromDiscord<Arathanis> i agree, but I was going for quick and dirty get it working before working on, "now that it works, make it better"
07:39:08FromDiscord<Elegantbeef> Ah ok
07:39:15FromDiscord<Elegantbeef> Getting that wonderful line information is one thing i wanted to push in the recent additions i did to that tutorial
07:39:21FromDiscord<Elegantbeef> Getting line information is so much nicer than just not compiling
07:39:38FromDiscord<Elegantbeef> If you want more macros to look at i have no shortage of them 😛
07:40:02FromDiscord<Elegantbeef> Oh right i did link a bunch of my macro projects on that writeup
07:40:39FromDiscord<Arathanis> so "error" lets pass a string and the node causing the error, so you get better line number indication of where the actual problem is?
07:40:49FromDiscord<Elegantbeef> Yep
07:41:00FromDiscord<Elegantbeef> You also can give a custom error message which helps more than just a "Bitch this wrong"
07:41:19FromDiscord<Elegantbeef> If you have error message reporting for the line number (code lens in vscode) it's glorious
07:41:24FromDiscord<Arathanis> how smart is it, could i for example see that the first parameter in the wrapped function's type is incorrect and raise an error on that specific node?
07:41:32FromDiscord<Elegantbeef> Yes
07:41:36FromDiscord<Arathanis> beautiful
07:41:38*crem1 quit (Ping timeout: 260 seconds)
07:41:41FromDiscord<Elegantbeef> It copies the line information of the Nimnode
07:42:02FromDiscord<Elegantbeef> image.png https://media.discordapp.net/attachments/371759389889003532/940512782493814804/image.png
07:42:04FromDiscord<Elegantbeef> I mean it's wonderful
07:42:15FromDiscord<Arathanis> ha
07:42:18FromDiscord<Arathanis> it totally works
07:42:40FromDiscord<Arathanis> https://media.discordapp.net/attachments/371759389889003532/940512944402350110/unknown.png
07:42:49FromDiscord<Arathanis> https://media.discordapp.net/attachments/371759389889003532/940512980955705414/unknown.png
07:43:03FromDiscord<Elegantbeef> Yea it really makes the macros feel like compiler extensions rather than some silly procs
07:43:17FromDiscord<Elegantbeef> I highly suggest codelens since it seems you're using vscode
07:43:36FromDiscord<Arathanis> yeah this solves the problem i experienced with macros before
07:43:39FromDiscord<Arathanis> extension?
07:43:44FromDiscord<Elegantbeef> Yea
07:43:57FromDiscord<Elegantbeef> Sorry it's called errorlens
07:44:03FromDiscord<Elegantbeef> codelens is just the feature
07:44:22FromDiscord<Arathanis> i see two, im guessing the 500k+ one is the good one and the other is a horrible fork
07:44:38FromDiscord<Elegantbeef> No clue i'm on vscodium using openvsix so i have 1
07:45:01FromDiscord<Arathanis> ah thats really nice, ngl
07:45:03FromDiscord<Arathanis> looks good
07:45:26FromDiscord<Elegantbeef> The thing i'd suggest to do now is make that macro a `typed` one then inspect the arguments to see if they match the definition
07:45:51FromDiscord<Arathanis> can you elaborate on that just a tad? im gonna have to go to bed so I can work tomorrow.
07:45:53FromDiscord<Elegantbeef> Then support nothing, `string` `string, int` `int`
07:46:26FromDiscord<Elegantbeef> Well use typed macros so you can see if they have a `string, int` parameter and then when you call the event pass the argument in the proper order
07:46:59FromDiscord<Elegantbeef> This way you can do `proc myProc(a: string, b: int)` or `proc myProc(a: int, b: string)` 😀
07:47:16FromDiscord<Elegantbeef> The reason you'd want typed is so you can support aliases
07:48:52FromDiscord<Elegantbeef> then also handle nice error reporting if they have a return type, if they have too many parameters or none of the right kind 😛
07:49:01FromDiscord<Arathanis> i guess im just not quite sure how to do that and exactly what typed buys me
07:49:04FromDiscord<Elegantbeef> Then you can say "I've done it"
07:49:34FromDiscord<Elegantbeef> `typed` macros are semantically checked, so you can get what the types are from the `parameter[^2]` ast
07:49:55FromDiscord<Elegantbeef> you can do `parameter[^2].sameType(bindSym"string")` for instance
07:52:37FromDiscord<Arathanis> what does `sameType` do
07:53:11FromDiscord<Elegantbeef> https://nim-lang.org/docs/macros.html#sameType%2CNimNode%2CNimNode
07:53:12FromDiscord<Arathanis> oh it ensures they are the same
07:53:13FromDiscord<Elegantbeef> It's supposed to compare the type of two semantically checked nodes
07:53:30FromDiscord<Arathanis> so i will also have to make my idents semantically checked as well
07:55:06FromDiscord<Elegantbeef> No your output ones dont need to be
07:55:06FromDiscord<Elegantbeef> The compiler is what semantically checks them
07:55:47FromDiscord<Arathanis> ok, i will have to follow up on this tomorrow after work
07:55:56FromDiscord<Arathanis> thanks again, this has helped a lot
07:56:28FromDiscord<Elegantbeef> Here's an example anyway
07:56:34FromDiscord<Elegantbeef> sent a code paste, see https://play.nim-lang.org/#ix=3P0V
07:56:56FromDiscord<Elegantbeef> You probably wont need the `getType` stuff, but for this example it was needed
07:57:03FromDiscord<Elegantbeef> Go to sleep now!
08:04:22*crem1 joined #nim
08:11:25FromDiscord<Someone.one> In reply to @Elegantbeef "You encouraged me to": this is quite helpful, thanks. is it possible to get and set `a` without using a discrete method? kind of like a transparent replacement for something like `var z: range[1..10]` ?
08:12:36FromDiscord<Elegantbeef> Nope that'd require return type inference
08:12:56FromDiscord<Elegantbeef> Atleast i dont think so
08:14:27*krux02 joined #nim
08:15:07FromDiscord<Elegantbeef> we can steal `:=` https://play.nim-lang.org/#ix=3P11
08:15:24FromDiscord<Elegantbeef> Nim would be more expressive if we could write custom `=` for non equivalent types though
08:17:11FromDiscord<Someone.one> In reply to @Elegantbeef "we can steal `:=`": ah, this is nice. but the situation for the getter would still be the same, no?
08:17:14FromDiscord<Elegantbeef> Though `..=` might make sense as it's "range assign"
08:17:28FromDiscord<Elegantbeef> What?
08:21:04FromDiscord<Someone.one> In reply to @Elegantbeef "What?": to get the value we still need to do a.val
08:21:15FromDiscord<Elegantbeef> Yes
08:21:28*Gustavo6046 joined #nim
08:23:50*Zevv joined #nim
08:23:53ZevvPMunch: moin
08:24:09PMunchMornin' Zevv
08:24:20FromDiscord<Elegantbeef> Morning
08:24:36Zevvi believe you'd like to have `[]` on the capture object, right?
08:25:15ZevvI forgot the details, but I remember struggling with that for some reason
08:25:29FromDiscord<Elegantbeef> Context?
08:25:55Zevva ticket on npeg from pmunch : https://github.com/zevv/npeg/issues/40
08:26:42FromDiscord<Elegantbeef> Ah
08:28:48PMunchYes, so that you could still do captures[1..^1]
08:29:10FromDiscord<Elegantbeef> Yea i dont see any reason why you could not do `[1..^1]`
08:29:25Zevvright. i'll have to look into that, I had a fight with nim over that IIRC
08:30:03PMunchWouldn't the simple implementation just be a template which passes it on to the sequence?
08:30:28FromDiscord<Elegantbeef> `proc `[]`[S](cs: Captures[S], i: Slice[Natural]): Capture[S]` and `proc `[]`[S](cs: Captures[S], i: HSlice[Natural, BackwardsIndex]): Capture[S]` should work
08:30:36Zevv*should* work, yes
08:30:56FromDiscord<Elegantbeef> Could it been an iterator you were trying?
08:31:10Zevvi have no idea
08:31:22PMunchZevv, haha yes I remember struggling with those myself at some point
08:31:36PMunchThere are (or at least was) some dragons there
08:31:38FromDiscord<Elegantbeef> Well if it doesnt work anymore ping me and i'll look into it
08:31:52FromDiscord<Elegantbeef> Well `[]` should work for an iterator now
08:32:04FromDiscord<Elegantbeef> I never ran into an bug with `[]` operators
08:32:28Zevvthere is https://github.com/zevv/npeg/blob/master/src/npeg/capture.nim#L80-L87 now
08:32:42Zevvbut no slices, true
08:37:51Zevvhm ok, there still is something dragoning me, the naive implementation does not work, I only get type mismatches and nim is not able to find the proper proc for doing the slice
08:38:01ZevvI'll shelve this for now, need to do $work first
08:43:39PMunchZevv, this is apparently what it gets now: <Captures[system.char], HSlice[system.int, system.int]>
08:43:57PMunchNot sure if Slices/Hslices would cause the mistmatch
08:44:03PMunchOr if it's Natural vs. int
08:44:29FromDiscord<Elegantbeef> The natural/int shouldnt matter
08:44:36Zevvyeah, the ints was the mismatch - but I can't seem to remember why I changed the Capture type in the first place
08:44:42Zevvnatrual/int does matter
08:45:18Zevvthe commit message was not helpful: "refactoring captures"
08:45:21Zevvthank you Zevv
08:45:29Zevvpast zevv is a bitch, sometimes
08:45:49ZevvI always tell people to put the *why* in the commit messages, not the *what*
08:45:54Zevvbut for some reason, I do not do as I preach
08:46:59PMunchIt looks like you wanted better error messages
08:48:11Zevvi guess i did :)
08:49:19FromDiscord<Elegantbeef> Ah the generic first parameter is causing an weird behaviour
08:50:58FromDiscord<Elegantbeef> Ah guess i was wrong Natural does cause issues due to the slice creation
08:51:20FromDiscord<Elegantbeef> https://play.nim-lang.org/#ix=3P1b for posterity this seems to work fine
08:51:28Zevvwhile you're at it, could you fix PMunch's issue and PR it :)
08:53:21FromDiscord<Elegantbeef> I spose
08:53:21FromDiscord<Elegantbeef> Not doing anything else atm
08:53:27Zevvhehe
08:56:35FromDiscord<Elegantbeef> I have 0 clue how to test this though
08:57:05PMunchBut now you have to deref Elegant :(
08:57:23FromDiscord<Elegantbeef> No
08:57:44FromDiscord<Elegantbeef> `proc `[]`[S](cs: Captures[S], slice: HSlice[int, BackwardsIndex] or Slice[int]): Captures[S] = Captures[S](capList: cs.s[slice])` should be it
08:58:48FromDiscord<Elegantbeef> I have 0 idea the API here so i dont know how to fix it nor test it
08:58:52FromDiscord<Elegantbeef> So i'll just leave it with pmunch
09:00:16PMunchI was thinking something like this: https://play.nim-lang.org/#ix=3P1c
09:00:42PMunchBut not entirely sure if returning a seq[Capture[S]] is the right way to go
09:00:46FromDiscord<Elegantbeef> I mean i'm looking at Zevv's code
09:00:58FromDiscord<Elegantbeef> I dont know the API so i can only copy it based of what `[]` does
09:01:06PMunchYou do lose the Captures bit
09:01:12FromDiscord<Elegantbeef> I have 0 clue what it should do or how it should behave
09:05:04*jjido joined #nim
09:31:29*jjido quit (Quit: My MacBook Air has gone to sleep. ZZZzzz…)
09:54:42NimEventerNew thread by Drkameleon: NImScript task and using a shebang line, see https://forum.nim-lang.org/t/8881
10:36:40*Vladar joined #nim
11:09:51NimEventerNew post on r/nim by mavavilj: Any place where we could focus on comparing how Nim does or does not replace Java/C#?, see https://reddit.com/r/nim/comments/snhp05/any_place_where_we_could_focus_on_comparing_how/
12:09:04FromDiscord<haxscramper> sent a long message, see http://ix.io/3P1I
12:09:53FromDiscord<haxscramper> (edit) "http://ix.io/3P1I" => "http://ix.io/3P1J"
12:12:17FromDiscord<haxscramper> the "good error message" request for the compiler is a multi-month refactoring at best
12:26:36*jjido joined #nim
12:42:23FromDiscord<Clonkk> Okay, I didn't know that. I thought the information was abstracted and the formatted (that would have made sense conceptually)↵(@haxscramper)
12:46:37FromDiscord<haxscramper> Yes, that would ceratinly make a lot more sense
12:47:47FromDiscord<haxscramper> sent a code paste, see https://play.nim-lang.org/#ix=3P1T
12:47:47FromDiscord<haxscramper> format strings in-place
12:56:03FromDiscord<rishav> sent a code paste, see https://play.nim-lang.org/#ix=3P1Y
12:57:09FromDiscord<haxscramper> `var` in arguments means that parameter is mutable
12:57:53FromDiscord<haxscramper> `var ps: ParseStack` is a statement declaring mutable variable, `(ps: var ParseStack)` is an mutable argument
12:59:30FromDiscord<rishav> Thank!
12:59:36FromDiscord<rishav> (edit) "Thank!" => "Thanks!"
13:25:59*krux02 quit (Remote host closed the connection)
13:47:02*jjido quit (Quit: My MacBook Air has gone to sleep. ZZZzzz…)
13:47:27*jmdaemon quit (Ping timeout: 256 seconds)
14:12:13*vicfred joined #nim
14:32:48*Vladar quit (Quit: Leaving)
14:43:06*arkurious joined #nim
15:07:40nixfreaknim[m]I want to find all vowels in a string , with C I can just call char but how do I do that with nim
15:10:13nixfreaknim[m]so basically I create an echo asking for a string then use readLine to scanf the string and use a case statement to look for the vowels
15:12:19FromDiscord<xx_ns> maybe use find?
15:12:23FromDiscord<xx_ns> https://nim-lang.org/docs/strutils.html#find,string,set%5Bchar%5D,Natural,int
15:14:28nixfreaknim[m]hmm , is there no other way to do this without a builtin function ?
15:16:16FromDiscord<xx_ns> I mean there's loads of ways
15:16:45FromDiscord<xx_ns> you iterate over each character in the string and see if it's in your predefined set of wovels for example
15:18:20FromDiscord<xx_ns> see the second example here
15:18:22FromDiscord<xx_ns> https://nim-lang.org/docs/sequtils.html
15:20:42*PMunch quit (Quit: Leaving)
15:22:24*nrds quit (Remote host closed the connection)
15:40:09*jjido joined #nim
15:44:15*jjido quit (Client Quit)
15:47:39FromDiscord<eqf0> Why can't you do it the same way as in C?↵(<@709044657232936960_nixfreaknim=5b=4datrix=5d>)
15:50:59FromDiscord<huantian> Yeah you can just iterate though each character in the string and check if it’s a vowel
15:51:43*nrds joined #nim
15:57:04NimEventerNew post on r/nim by Familiar_Ad_8919: apparently summing floats as part of tuples is a sin, see https://reddit.com/r/nim/comments/snnh4t/apparently_summing_floats_as_part_of_tuples_is_a/
16:02:02FromDiscord<Rika> ???
16:06:33FromDiscord<huantian> I wonder what that post was about lmao
16:09:35nixfreaknim[m]<FromDiscord> "<huantian> Yeah you can just..." <- every time i do that I get mismatch string and char
16:10:04FromDiscord<huantian> Are you for looping?
16:10:51nixfreaknim[m]yes , then use a case statement
16:12:05FromDiscord<xx_ns> can you post your code on play.nim-lang.org
16:13:41nixfreaknim[m]https://play.nim-lang.org/#ix=3P37
16:14:40nrds<Prestige99> https://play.nim-lang.org/#ix=3P38 ?
16:17:49nixfreaknim[m]yeah that doesn't work , I have tried thtat
16:17:53nixfreaknim[m]s/thtat/that/
16:18:08nixfreaknim[m]/Users/aaronm/.env/nim/practice/vowels.nim(5, 10) Error: type mismatch: got <char, char>
16:18:26nrds<Prestige99> It works in the playground, what are you trying to do?
16:18:51nixfreaknim[m]vowels.nim(5, 10) Error: type mismatch: got <char, char>
16:19:13nixfreaknim[m]am I missing a module ?
16:20:01nrds<Prestige99> show your code
16:21:25nixfreaknim[m]yeah thats not search through the string to find the vowels though
16:22:06nrds<Prestige99> I'm not sure what you want to do, add all the vowels to a seq or something?
16:22:23nixfreaknim[m]ok , I thought you had to do of 'a' in volume
16:22:30nixfreaknim[m]s/volume/vowel:/
16:22:47nixfreaknim[m]its just of 'a':
16:24:53nixfreaknim[m]ok so you can't use "in" in a case statement
16:25:25FromDiscord<xx_ns> what would that even do?
16:26:11FromDiscord<xx_ns> case statements match a value against different cases...
16:53:11NimEventerNew thread by Tubbs: Webscrape, see https://forum.nim-lang.org/t/8882
16:54:55*jjido joined #nim
17:11:22*PMunch joined #nim
17:18:06FromDiscord<TurtleP> sent a long message, see http://ix.io/3P3s
17:24:35FromDiscord<Clonkk> Have you tried https://nim-lang.org/docs/parsecfg.html ? INI and Toml syntax are mostly identical↵(@TurtleP)
17:26:21FromDiscord<TurtleP> I haven't
17:26:44PMunchUuh, I'd advise using anything but a TOML parser for parsing TOML files..
17:27:29FromDiscord<Clonkk> Is there some wierd specificity to toml ?↵(<@709044657232936960_=50=4dunch=5b=49=52=43=5d>)
17:27:36FromDiscord<TurtleP> I think their point was more "try using an INI file instead because this is easier"
17:27:42PMunchYou could probably write a macro that tries to read the fields of the objects you pass in from the runtime-parsed TOML file
17:27:46FromDiscord<Clonkk> Well if it's just config you want, then yeah
17:27:47Amun-RaClonkk: indentation, array, etc.
17:28:01FromDiscord<Clonkk> Yeah but are you using those ?↵(<@709044657232936960_=41mun-=52a=5b=49=52=43=5d>)
17:28:10PMunchOoh there's plenty
17:28:29PMunchAnd I would know, I'm the one who rewrote the TOML parser
17:29:14FromDiscord<TurtleP> hmm.. I mean afaik I don't need anything specific about the TOML format to use it
17:29:23FromDiscord<TurtleP> versus a regular INI file, but idk
17:29:41PMunchINI files are terrible, use TOML
17:29:48PMunchDo you have a sample I could work with?
17:29:55FromDiscord<TurtleP> toml file?
17:30:37*jjido quit (Quit: My MacBook Air has gone to sleep. ZZZzzz…)
17:31:00PMunchYes
17:31:07FromDiscord<TurtleP> <https://github.com/lovebrew/lovebrew/blob/dev/next/src/data/resources/lovebrew.toml>
17:31:14FromDiscord<TurtleP> this is the toml file I'm using
17:31:21FromDiscord<Clonkk> Terrible is a bit strong. INI is nice when you need something simple.↵(<@709044657232936960_=50=4dunch=5b=49=52=43=5d>)
17:31:55PMunchWell apart from that INI isn't really one format, so it's terrible to write a parser for that handles anything but a single format
17:32:12PMunchTOML is essentially INI properly specified with a couple added niceties
17:32:57FromDiscord<Clonkk> It looks simple enough. I'm fairly confident, you should be able to parse it with `std/parsecfg`↵(@TurtleP)
17:33:47FromDiscord<Clonkk> That's the one ? https://github.com/NimParsers/parsetoml↵(<@709044657232936960_=50=4dunch=5b=49=52=43=5d>)
17:34:50PMunchYes
17:35:02PMunch@TurtleP, just give me a minute, I'll whip you up something nice
17:35:08FromDiscord<TurtleP> aight
17:35:48FromDiscord<TurtleP> cause I might rearrange this toml file a tiny bit, so hopefully whatever you come up with will be generic :p
17:35:57PMunchIt will be
17:44:46*pro joined #nim
17:45:03nixfreaknim[m]Yeah I need to read more about that
18:02:31nixfreaknim[m]ahh in only works in collections
18:02:51nixfreaknim[m] let collection = {'a', 'x', 'r'}
18:02:51nixfreaknim[m] assert 'a' in collection
18:03:04nixfreaknim[m]easier to find in the book then the manual
18:08:58*Gustavo6046 quit (Quit: Leaving)
18:14:07*pro quit (Quit: pro)
18:17:01PMunch@TurtleP, here you go: http://ix.io/3P3L
18:17:44FromDiscord<TurtleP> jesus that looks complex haha
18:17:52PMunchIt handles objects, nested objects, sequences, and enums
18:17:58FromDiscord<TurtleP> oooh
18:18:00PMunchBut not objects in sequences I believe
18:18:24PMunchIf you look at the compile-time output you can see what it does
18:18:42PMunchhttp://ix.io/3P3M
18:19:29PMunchIt just recursively generates calls to itself until it gets to the base types it can read, then it simply outputs a statement like: `config.build.searchPath = toml["build"]["searchPath"].getStr()`
18:20:50FromDiscord<TurtleP> huh, neat
18:22:06PMunchAs an exercise to the reader you can try to check that the TOML value is in fact the correct type (now it just uses a default value if it's the wrong type)
18:22:12*jjido joined #nim
18:22:54PMunchAnd of course handle more types
18:23:03PMunchBy the way you had two misnamed fields
18:23:35FromDiscord<TurtleP> oh, heh
18:24:06PMunchconfig.output.asRaw was called "rawData" and config.build.searchPath was called binSearchPath
18:24:32PMunchThose will give you an error because the key doesn't exist
18:25:06FromDiscord<TurtleP> yeah, it's some breaking changes I did
18:27:11*pro joined #nim
18:31:50*pro quit (Client Quit)
18:32:33FromDiscord<TurtleP> thanks again! 🙂
18:32:52PMunchNo problem, always fun to write a small macro :)
18:33:30*PMunch quit (Quit: leaving)
18:34:00FromDiscord<TurtleP> though wouldn't it also be useful for this to be part of the `parsetoml` library?
18:43:47NimEventerNew post on r/nim by _SleepingOwl: Nim for game development? What are some good frameworks &amp; libs?, see https://reddit.com/r/nim/comments/snrgdc/nim_for_game_development_what_are_some_good/
20:01:38*noeontheend joined #nim
20:16:31*neurocyte0917090 joined #nim
20:25:04FromDiscord<vindaar> toml is awesome
20:51:16*krux02 joined #nim
21:09:37*noeontheend quit (Ping timeout: 240 seconds)
21:12:09NimEventerNew Nimble package! networkutils - Various networking utils, see https://github.com/Q-Master/networkutils.nim
21:20:40*jjido quit (Quit: My MacBook Air has gone to sleep. ZZZzzz…)
21:35:10*jjido joined #nim
22:03:08NimEventerNew thread by Tmsa04: (Linux) removeDir fails on directory without rw permission, see https://forum.nim-lang.org/t/8883
22:04:40*lumo_e joined #nim
22:09:02*lumo_e quit (Read error: Connection reset by peer)
22:10:00*lumo_e joined #nim
22:20:46*jmdaemon joined #nim
22:32:28FromDiscord<planetis> does the docker nimlang/nim include clang?
22:34:26FromDiscord<planetis> dump question I've never used containers
22:40:00euantoranoThis probably doesn't get said enough, but darn does the standard library have some useful tools
22:41:11euantoranoLike, I was just using `strtabs` with a format string and wondered what options there were to handle missing keys - and it turns out they can be pulled from environment variables (which, as it happens is exactly what I wanted!) and you can also specify whether to error, use a blank string, or use the variable name if still missing
22:41:22euantoranoFor anybody wondering, see: https://nim-lang.org/docs/strtabs.html#%25%2Cstring%2CStringTableRef%2Cset%5BFormatFlag%5D
22:42:47euantoranoAnd `strscans` continues to be one of my favourite hidden gems, which I don't think enough people know about
22:43:22FromDiscord<Elegantbeef> strscans lovely
22:43:32FromDiscord<Elegantbeef> What's your favourite part of it?
22:44:40euantoranoThe sheer simplicity
22:45:05euantoranoIt's so easy to use if all you want to do is quickly parse some value from a string
22:46:49FromDiscord<Elegantbeef> Yay that's what i love aswell, too many people grasp for regex
22:49:39FromDiscord<Waldecir Santos> do we have any equivalent to python descriptors (https://docs.python.org/3/howto/descriptor.html) in Nim ?
22:50:46FromDiscord<Elegantbeef> are descriptors just properties?
22:52:52FromDiscord<Waldecir Santos> They are "classes" that define how the field behave. we can kind do the same overloading the operators, but I'm missing a way to set "defaults" to it
22:53:14FromDiscord<Waldecir Santos> This is a clear example: https://docs.python.org/3/howto/descriptor.html#orm-example
22:54:10FromDiscord<Elegantbeef> That's properties afaict
22:54:48FromDiscord<Waldecir Santos> Kind of yes, do you know how does models ?
22:55:08FromDiscord<Waldecir Santos> (edit) "Kind of yes, do you know how ... does" added "Django"
22:55:16FromDiscord<Elegantbeef> Npe
22:55:32FromDiscord<Waldecir Santos> This is why I'm trying to reproduce:
22:55:40FromDiscord<Waldecir Santos> sent a code paste, see https://play.nim-lang.org/#ix=3P4K
22:56:02FromDiscord<Waldecir Santos> It creates a property that also have some "porperties/options" within it
22:56:32FromDiscord<Elegantbeef> Ah i see
22:58:20FromDiscord<b4mbus> sent a code paste, see https://paste.rs/6BV
22:58:55FromDiscord<b4mbus> The compiler is very helpful and says `Error: type expected` 🙂
23:00:34FromDiscord<Elegantbeef> https://play.nim-lang.org/#ix=3P4R here you go wald
23:00:52FromDiscord<Elegantbeef> named parameters use `=` not `:`
23:01:04FromDiscord<Elegantbeef> should be `headers = newHttpHeaders(...)`
23:01:40FromDiscord<b4mbus> yeah it does seem to compile nicely now
23:01:42FromDiscord<b4mbus> Thanks a lot 🙏
23:02:09FromDiscord<xigoi> This is a really weird inconsistency in Nim's syntax. I always get it wrong.
23:02:24FromDiscord<Elegantbeef> It's `=` everywhere but typedefs
23:02:37FromDiscord<Elegantbeef> and constructors
23:03:06FromDiscord<xigoi> Yeah, and it's the constructors that trip me up most of the time.
23:06:33FromDiscord<Waldecir Santos> In reply to @Elegantbeef "https://play.nim-lang.org/#ix=3P4R here you go": I need to store more data within the field `nameBacker` I'ld need something like this
23:06:41FromDiscord<xigoi> I think the Nim equivalent would be just specialized types…↵(@Waldecir Santos)
23:07:03FromDiscord<Waldecir Santos> sent a code paste, see https://play.nim-lang.org/#ix=3P4U
23:07:06FromDiscord<Elegantbeef> Well make a new type 😀
23:07:36FromDiscord<Elegantbeef> Nim allows you to make as many types as you little heart can desire
23:07:42FromDiscord<Waldecir Santos> Yeap I know but I'm not sure how to make a "configurable" type in the type block
23:08:20FromDiscord<Elegantbeef> sent a code paste, see https://play.nim-lang.org/#ix=3P4V
23:08:35FromDiscord<congusbongus> Char is a confusing type name
23:09:03FromDiscord<Elegantbeef> I dont disagree but i was being lazy
23:09:05FromDiscord<Waldecir Santos> I got that far, how would you use it/instantiate in a new type declaration ?
23:09:30FromDiscord<xigoi> sent a code paste, see https://paste.rs/Pg1
23:09:45FromDiscord<Elegantbeef> Really depends what you're after
23:10:01FromDiscord<Waldecir Santos> This is what I'm missing https://play.nim-lang.org/#ix=3P4Y
23:10:47FromDiscord<Waldecir Santos> sent a code paste, see https://play.nim-lang.org/#ix=3P4Z
23:10:56FromDiscord<Elegantbeef> `LimitedString[30]`
23:11:03FromDiscord<Elegantbeef> This would be statically typed by the way
23:11:22FromDiscord<Elegantbeef> so `LimitedString[30]` cannot be assigned by a `LimitedString[20]`
23:11:26FromDiscord<xigoi> `[]` is Nim's syntax for generic types. Just like Python.↵(@Waldecir Santos)
23:11:36FromDiscord<Elegantbeef> Python has generics?
23:12:19FromDiscord<Waldecir Santos> @ElegantBeef it dosen't work https://play.nim-lang.org/#ix=3P51
23:12:29FromDiscord<Waldecir Santos> `Error: initialization not allowed here``
23:12:40FromDiscord<Elegantbeef> `field: LimitedString[20, 10]`
23:13:03FromDiscord<xigoi> sent a code paste, see https://play.nim-lang.org/#ix=3P52
23:13:37FromDiscord<xigoi> sent a code paste, see https://play.nim-lang.org/#ix=3P54
23:17:55FromDiscord<nothratal (nothratal)> sent a long message, see https://paste.rs/MfL
23:18:17FromDiscord<nothratal (nothratal)> I probably didn't understand how to evaluate at compile time
23:18:27FromDiscord<Elegantbeef> `const fileCOntent = staticRead("file.txt")`
23:19:00FromDiscord<Elegantbeef> You can do `var fileContent {.compileTime.} = staticRead("file.txt")` aswell
23:19:12FromDiscord<Elegantbeef> Depends what you're doing though
23:20:29FromDiscord<Waldecir Santos> In reply to @xigoi "Then you would do": I don't need to really do any check these values are going to be used when I need to communicate with the DB server, I'm trying to create a ORM like django on top of nim, that is my goal
23:21:14FromDiscord<Waldecir Santos> I need either a way to "instantiate" the property in the type declaration block or create a type with "internal values"
23:21:57FromDiscord<Waldecir Santos> I think that the only way right would be to create a macro with a custom block for model declaration and with that I can inject some procs to handle this at run time
23:23:15FromDiscord<Waldecir Santos> or I can probably create something like a "procvar" that could work, hmmmm
23:23:20FromDiscord<Elegantbeef> You can use generics to instantiate it
23:23:34FromDiscord<Elegantbeef> Like there isnt much reason to use macros here afaict
23:28:00FromDiscord<Waldecir Santos> Sorry I don get it, can you show me what you mean ?
23:29:24FromDiscord<nothratal (nothratal)> thanks all, all nice ideas, but I stick to the const-version. Just read that const enforces compile time evaluation
23:29:43FromDiscord<Elegantbeef> I mean i need a more elaborate example of what you're after
23:29:57FromDiscord<Elegantbeef> I'm a dullard so i can only have understand you want to put restrictions on types
23:30:01FromDiscord<Elegantbeef> half understand
23:31:15FromDiscord<nothratal (nothratal)> I just wanted to embed the content of a file into the code as string, so it doesn't need to be present at runtime.
23:31:23FromDiscord<Elegantbeef> Not you
23:31:25FromDiscord<Elegantbeef> Wald
23:31:30FromDiscord<nothratal (nothratal)> 😃
23:31:32FromDiscord<nothratal (nothratal)> sorry
23:31:58FromDiscord<Waldecir Santos> @ElegantBeef No I don't want to add restrictions I want types with Hidden values so I can use to build the DB query/tables
23:32:12FromDiscord<Waldecir Santos> like in here: https://docs.djangoproject.com/en/4.0/topics/db/models/#quick-example
23:42:23FromDiscord<Elegantbeef> https://play.nim-lang.org/#ix=3P59
23:42:28FromDiscord<Elegantbeef> I dont know this seems like what you'd want
23:42:37FromDiscord<Elegantbeef> I dont know the actual API so not a clue