<< 15-08-2022 >>

00:00:09FromDiscord<victory> so like this? `if not i.guild_id.isSome:`
00:00:19FromDiscord<Elegantbeef> `isNone`
00:00:31FromDiscord<victory> i want to check if its not there
00:00:34FromDiscord<victory> oh
00:00:37FromDiscord<victory> i can just do isNone
00:00:38FromDiscord<victory> i see
00:00:58FromDiscord<victory> i also had another question, do people not write `()` at the end of procedure calls if the procedure doesn't take a parameter?
00:01:21FromDiscord<Elegantbeef> Some done
00:01:22FromDiscord<Elegantbeef> dont\
00:01:26FromDiscord<victory> i see
00:01:26FromDiscord<Elegantbeef> Some do
00:01:29FromDiscord<Elegantbeef> Depedns on the procedure name
00:01:31FromDiscord<victory> so `isNone` is a proc?
00:01:40FromDiscord<victory> (edit) "so `isNone` is a proc? ... " added "but theres no reason to use ()?"
00:01:42FromDiscord<Elegantbeef> If it's a procedure named like a property most dont
00:01:49FromDiscord<victory> ah okay
00:01:55FromDiscord<victory> ty
00:02:11FromDiscord<Elegantbeef> Indeed Nim is very flexible, so it's down to your preference
00:02:25FromDiscord<victory> okay, i'm rather new to nim but know the basics
00:02:29FromDiscord<victory> im working on a bot :D
00:07:53FromDiscord<victory> how do i get properties from ambiguous types?
00:08:02FromDiscord<huantian> don't have ambiguous types πŸ˜›
00:08:06FromDiscord<victory> well
00:08:06FromDiscord<Elegantbeef> Nim doesnt have ambiguous types
00:08:28FromDiscord<victory> im trying to index an interaction in dimscord but i cannot do `i.member.user.id`
00:08:33FromDiscord<victory> as its saying `member` is ambiguous
00:08:37FromDiscord<victory> or optional
00:10:08FromDiscord<huantian> member is an optional type, so you have to unwrap it
00:10:13FromDiscord<huantian> (edit) "optional" => "optiona"
00:10:16FromDiscord<victory> hm okay, ill check unwrapping out'
00:10:17FromDiscord<huantian> (edit) "optiona" => "option"
00:10:32FromDiscord<Elegantbeef> Like you said `member` is optional
00:10:32FromDiscord<Elegantbeef> You need to do `i.member.get.user.id` inside a `if i.member.isSome`
00:10:49FromDiscord<victory> ohhh
00:10:54FromDiscord<Elegantbeef> https://nim-lang.org/docs/options.html
00:11:07FromDiscord<victory> thank you
00:17:13*krux02 quit (Remote host closed the connection)
00:19:26FromDiscord<Tuatarian> sent a code paste, see https://play.nim-lang.org/#ix=47DU
00:19:36FromDiscord<Tuatarian> this fails to compile since s is of type `McNode:OjbectType`
00:19:44FromDiscord<Tuatarian> McNode is a ref object
00:19:50FromDiscord<Tuatarian> not sure how I should fix this?
00:22:35FromDiscord<Elegantbeef> Why are you manually calling destructors?
00:22:55FromDiscord<Elegantbeef> I'm so confused what you're doing
00:23:12FromDiscord<Elegantbeef> Why arent you just doing `n = s`
00:23:28FromDiscord<Tuatarian> I have a game tree
00:23:40FromDiscord<Tuatarian> when a move is made, not all nodes are irrelevant
00:24:06FromDiscord<Elegantbeef> So then copy what's important?
00:24:07FromDiscord<Tuatarian> the node that represents the move made and the child positions are still relevant
00:24:19FromDiscord<Tuatarian> right but why do an expensive copy of a lot of data when I can avoid it
00:24:40FromDiscord<Tuatarian> only destroying the data that is irrelevant and keeping the stuff that matters
00:25:03FromDiscord<Elegantbeef> Then use the proper GC systems and do `n: var T, a: sink McNode`
00:25:23FromDiscord<Tuatarian> can you explain what that is saying?
00:25:38FromDiscord<Elegantbeef> `sink` is Nim's "move data"
00:25:38FromDiscord<Tuatarian> I'm doing this thinking from a no-gc perspective
00:25:47FromDiscord<Tuatarian> which should be faster too I think
00:28:38FromDiscord<Tuatarian> oh wait I see
00:28:46FromDiscord<Tuatarian> wouldn't that also be expensive though?
00:29:03FromDiscord<Tuatarian> especially since the stored part of the game tree may be quite large?
00:29:22FromDiscord<Elegantbeef> With Nim you dont generally manually move
00:29:23FromDiscord<Elegantbeef> You use automatic move semantics
00:29:39FromDiscord<Tuatarian> right, but even that will move, right?
00:29:42FromDiscord<Elegantbeef> sent a code paste, see https://play.nim-lang.org/#ix=47DV
00:29:44FromDiscord<Tuatarian> what are move semantics btw?
00:29:46FromDiscord<Elegantbeef> Why?
00:29:52FromDiscord<Elegantbeef> ...
00:30:02FromDiscord<Elegantbeef> Move semantics are memory reuse
00:30:07FromDiscord<Elegantbeef> Instead of copying data you reuse it when you can
00:30:21FromDiscord<Elegantbeef> If you run the above program you will see that we take `a`'s string
00:30:34FromDiscord<Elegantbeef> We dont copy it
00:30:35FromDiscord<Elegantbeef> We take ownership of it
00:30:48FromDiscord<Elegantbeef> https://nim-lang.org/docs/destructors.html
00:30:52FromDiscord<Tuatarian> what does it mean to pass `sink T` as a param?
00:31:01FromDiscord<Elegantbeef> If you're using destructors and dont understand move semantics you'e got a problem
00:31:12FromDiscord<Elegantbeef> a `sink` parameter is moved
00:31:22FromDiscord<Elegantbeef> When possible
00:31:41FromDiscord<Elegantbeef> It doesnt make much sense given these are reference types though
00:34:24FromDiscord<Tuatarian> what would make more sense instead?
00:34:43FromDiscord<Elegantbeef> I dont really know what you're doing
00:34:47FromDiscord<Elegantbeef> You're just doing `n = s`
00:34:54FromDiscord<Elegantbeef> so why not just do `n = s`
00:35:06FromDiscord<Tuatarian> I'll explain, maybe will make more sense
00:35:08FromDiscord<Elegantbeef> You're already using references for the root object
00:35:14FromDiscord<Elegantbeef> So there is no copy
00:35:17FromDiscord<Tuatarian> s is a child node of the root object
00:35:26FromDiscord<Tuatarian> yes, if I do n=s I will have to use orc
00:35:46FromDiscord<Elegantbeef> Oh noes
00:35:49FromDiscord<Tuatarian> since n has params which are not referenced by s
00:35:50FromDiscord<Elegantbeef> If you have cycles you need a cycle collector
00:35:57FromDiscord<Tuatarian> no but the cycle breaker has notable overhead
00:36:07FromDiscord<Tuatarian> according to araq in that one post with a german title
00:36:07FromDiscord<Elegantbeef> Oh noes
00:36:21FromDiscord<Elegantbeef> Atlernatively dont use cyclical data types
00:36:26FromDiscord<Elegantbeef> That'd be the real solution here
00:36:35FromDiscord<Tuatarian> I mean, I'm trying to optimize this program to the greatest of my ability
00:36:45FromDiscord<Tuatarian> cyclic types are the most natural representation, not sure how else I'd go about it
00:36:45FromDiscord<Elegantbeef> So then dont use references
00:37:03FromDiscord<Elegantbeef> A sequence of entries that you use `ids` to reference
00:37:09FromDiscord<Elegantbeef> There for you do not need a reference
00:37:24FromDiscord<Tuatarian> how would I store them?
00:37:33FromDiscord<Elegantbeef> `seq[MyType]`
00:37:36FromDiscord<Elegantbeef> Super simple
00:37:44FromDiscord<Tuatarian> maybe but
00:38:01FromDiscord<Tuatarian> iirc resizable arrays resize operations are a copy
00:38:11FromDiscord<Tuatarian> assuming it is out of the "buffer" that it allocates
00:38:46FromDiscord<Tuatarian> copying multi gbs of data in memory seems like it would be unreasonably expensive
00:39:09FromDiscord<Tuatarian> is there no convenient way to do this kind of thing in Nim?
00:39:13FromDiscord<Elegantbeef> There is no but, if you dont want cyclical data types and want performance this is how you do it
00:39:40FromDiscord<Tuatarian> I don't mind cyclical data types
00:39:47FromDiscord<Elegantbeef> You're really making me cry
00:39:50FromDiscord<Tuatarian> I am happy to manage them myself
00:39:57FromDiscord<Tuatarian> but I am not sure how exactly to do it
00:40:00FromDiscord<Tuatarian> lmao
00:40:07FromDiscord<Elegantbeef> You make your own cycle collector
00:40:18FromDiscord<Elegantbeef> Wild idea i know
00:41:06FromDiscord<leorize> to judge if something is expensive, you really have to benchmark it
00:41:21FromDiscord<Elegantbeef> Nah just dick wave based off of hearsay
00:41:28FromDiscord<Tuatarian> lmao
00:41:48FromDiscord<Tuatarian> leorize: I don't know how to write the thing I would be benchmarking just using ORC against
00:41:58FromDiscord<Tuatarian> that's what I'm trying to get help with here
00:42:02FromDiscord<Elegantbeef> So just use orc... and if there is a performance issue then optimise
00:42:14FromDiscord<Tuatarian> there is always a performance issue
00:42:15FromDiscord<Elegantbeef> Premature optimisation is the enemy of production
00:42:15FromDiscord<leorize> write your entire program, then profile it, minimize time spent in hotspot, repeat
00:42:29FromDiscord<Elegantbeef> There isnt always a performance issue
00:42:35FromDiscord<Elegantbeef> Like jesus christ orc isnt going to make your program python levels of speed
00:42:44FromDiscord<Tuatarian> no one is saying that it will beef
00:42:44FromDiscord<Elegantbeef> People really need to learn that automatic memory management does not imply slow
00:43:09FromDiscord<Elegantbeef> Intelligent allocations and memory reuse is much better a solution that making your own cycle collectorr
00:43:11FromDiscord<Tuatarian> but it does possibly imply unneeded operations which may result in a slower program
00:43:18FromDiscord<Tuatarian> to know for sure, you would have to benchmark
00:43:31FromDiscord<Elegantbeef> In a normal world you write the code and if that's the hotspot you resolve it
00:43:47FromDiscord<Elegantbeef> You dont write code under an assumption without evidence
00:44:09FromDiscord<Elegantbeef> If you want a very fast program you avoid references anway
00:44:11FromDiscord<Elegantbeef> anyway\
00:44:23FromDiscord<leorize> note that your overhead come not only from running the code, but waiting for memory reads as well
00:44:27FromDiscord<Tuatarian> are refs generally slow?
00:44:36FromDiscord<Elegantbeef> References destroy cache coherency
00:44:38FromDiscord<Tuatarian> waiting for memory reads meaning?
00:44:51FromDiscord<Elegantbeef> Reading memory is one of the slower operations you can do
00:45:05FromDiscord<Elegantbeef> It's much better to abuse the cache/cacheline and have data on your cpu
00:45:11FromDiscord<Tuatarian> right, but it is surely faster than writing right?
00:45:16FromDiscord<Tuatarian> I see
00:45:21FromDiscord<leorize> writing is actually faster
00:45:52FromDiscord<Tuatarian> huh
00:46:10FromDiscord<Elegantbeef> Given you dont understand how pointer indirection harms performance i do wonder why you think orc is so bad
00:46:10FromDiscord<leorize> since writes discard information, your CPU doesn't have to go to RAM, it just have to cache the write for future flushes
00:46:46FromDiscord<Tuatarian> I see
00:46:55FromDiscord<Tuatarian> so copy should only be super slow if the data isn't in cache?
00:47:30FromDiscord<leorize> yes
00:47:39FromDiscord<Elegantbeef> Regardless you avoid copying as much as possible
00:47:39FromDiscord<Tuatarian> that's interesting, did not know that
00:47:49FromDiscord<Tuatarian> right yeah
00:47:57FromDiscord<Elegantbeef> Copying is mainly slow due to the OS allocation heap allocations
00:48:08FromDiscord<Elegantbeef> Atleast if we're talking about sequences and the like
00:48:11FromDiscord<Tuatarian> also, do you generally know if data is in the cpucache or in RAM?
00:48:13FromDiscord<leorize> copying is not slow on its own, but it could be faster than trying not to copy, due to various CPU shenanigans
00:48:41FromDiscord<Elegantbeef> If you write intelligently designed systems you generally know when it's in the cache
00:48:42FromDiscord<Elegantbeef> πŸ˜„
00:48:52FromDiscord<Elegantbeef> ECS for instance heavily abuses the cache/cacheline
00:49:14FromDiscord<Elegantbeef> The entire point though is to store your data contiguously so when you fetch parts you get parts of others
00:49:18FromDiscord<ajusa> Anyone know who radsoc is on the forums? Curious because they mentioned nimja + HTMX, but they also have a 9 year gap in their post history
00:49:37FromDiscord<Elegantbeef> They're radsoc, you dont know radsoc?!
00:49:42FromDiscord<Tuatarian> lmao
00:49:44FromDiscord<Elegantbeef> They're only the greatest person known as radsoc!
00:50:02FromDiscord<victory> how can i check if the results of an `anonimongo` find query are empty?
00:50:06FromDiscord<Elegantbeef> Pointer types really are the enemy of performance
00:50:21FromDiscord<leorize> you typically load 64 \ cachelines bytes of data on memory access
00:51:05FromDiscord<leorize> if your data is too sparse, you end up filling your caches with data you don't need, trashing performance
00:51:24FromDiscord<Elegantbeef> We just need bigger caches
00:51:28FromDiscord<Tuatarian> so guys let's just sya for educational purposes or whatever, if I wanted to manually implement mem management for that data, how would I go about it?
00:51:28FromDiscord<Elegantbeef> 5700x3d is a start!
00:51:54FromDiscord<Elegantbeef> You'd need to walk the entire data finding the references that are dead then freeing htem
00:52:28FromDiscord<leorize> the simplest form of GC is reference counting
00:53:36FromDiscord<Elegantbeef> To make a cycle collector you get to make a GC that can handle that data structure
00:54:02FromDiscord<Elegantbeef> So just look at C implementation of cyclical data types and see how they free them
00:54:29FromDiscord<Elegantbeef> And after you do that consider just making a linear buffer or using orc
00:56:31FromDiscord<Elegantbeef> To elaborate more on the linear buffer, your usage of references is pretty much replicated with a type that stores a collection of integers are the indexes of the buffer
00:57:33FromDiscord<Elegantbeef> sent a code paste, see https://play.nim-lang.org/#ix=47DY
00:57:46FromDiscord<Elegantbeef> then whenever you do operations on `MCNode` you pass in the `seq[McNode]` so it can get the data it needs
00:58:04FromDiscord<Elegantbeef> This allows you to not have any cyclical graph for GC, have fewer heap allocations and more contiguous memory
00:58:50FromDiscord<leorize> it really depends on the kind of data being worked with, the rule of thumbs is to keep whatever is hot close together
00:58:55FromDiscord<Tuatarian> my biggest worry with this is that given as the seq is going to expand frequently, we may need a lot of resize ops
00:59:02FromDiscord<Elegantbeef> So what
00:59:05FromDiscord<Elegantbeef> Resizing is cheap if you preallocate
00:59:15FromDiscord<Elegantbeef> `newSeqOfCap(65000)`
00:59:23FromDiscord<Elegantbeef> Boom we just reduced resizing a lot
00:59:30FromDiscord<Tuatarian> unfortunately, these seqs are really gigantic
00:59:39FromDiscord<Elegantbeef> So what
00:59:40FromDiscord<leorize> you only have 64 bytes per cache line, so try to squeeze as much data in as you can
00:59:51FromDiscord<Elegantbeef> some have 128 πŸ˜›
00:59:55FromDiscord<Tuatarian> like to the point where we may well be preallocating 8+gb
01:00:05FromDiscord<leorize> also, 1GB in a seq is 1GB, but 1GB in sparse nodes can be 4GB
01:00:20FromDiscord<Tuatarian> why is that?
01:00:32FromDiscord<Tuatarian> because they have to also store each other's locations?
01:01:13FromDiscord<Tuatarian> also, that
01:01:25FromDiscord<ajusa> Nobody knows who radsoc is I guess
01:01:57FromDiscord<Tuatarian> he's probably not anybody other than himself
01:02:05FromDiscord<Elegantbeef> At that much memory you pretty much should figure out how stream operations i'd wager
01:02:05FromDiscord<leorize> this is because allocators must pack data linearly together, while sparse nodes can end up on any gap in RAM, and if your gaps are not small enough, new pages has to be allocated to store them
01:02:05FromDiscord<leorize> s/data/array/
01:02:07FromDiscord<leorize> s/small/big
01:03:06FromDiscord<Elegantbeef> Just free all your references then regrow the structure so you have 0 heap blocks /s
01:03:27FromDiscord<leorize> lol
01:04:12FromDiscord<Tuatarian> ah I see
01:04:16FromDiscord<victory> how can i check if a property exists? i have a custom type called `BsonDocument` and its returned when you do a query to MongoDB↡↡i want to check if `<Result>["id"]` exists, but I'm not sure how
01:04:33FromDiscord<leorize> btw, a cheap trick to use less ram is to... store less
01:04:53FromDiscord<Elegantbeef> Fuck dude with that statement you deserve all the acolades
01:04:56FromDiscord<SrMordred> Is there a way to `await` multiple futures until the first future resolve (like go `select`) ?
01:05:33FromDiscord<leorize> `int` is 64 bits/8 bytes, do you use all of it (you won't), or would uint32 do everything for you?
01:06:01FromDiscord<Tuatarian> In reply to @leorize "btw, a cheap trick": yeah I did an optimization pass earlier which basically amounted to this
01:06:19FromDiscord<Tuatarian> removing unneeded storage
01:06:37FromDiscord<leorize> also, take note of structure padding, something like `tuple[ok: bool, i: int]` is actually 16 bytes, twice that of an `int`
01:06:54FromDiscord<Tuatarian> oh I see
01:07:09FromDiscord<Tuatarian> I did not realize this
01:07:10FromDiscord<Elegantbeef> Sentinels are lovely for that
01:07:26FromDiscord<Elegantbeef> Aslong as you can get away with sentinels that is
01:07:45FromDiscord<Elegantbeef> shameless spam of my sentinel module
01:07:46FromDiscord<Tuatarian> what is a sentinel?
01:07:49FromDiscord<Tuatarian> never heard the term
01:07:51FromDiscord<Tuatarian> oh
01:07:52FromDiscord<Tuatarian> lmao
01:08:05FromDiscord<Elegantbeef> Designating a value as unneeded so treating it as "nothing"
01:08:08FromDiscord<Elegantbeef> https://github.com/beef331/nimtrest/blob/master/sentinels.nim
01:08:16FromDiscord<Elegantbeef> C does this a lot
01:08:24FromDiscord<Elegantbeef> It doesnt statically type it though like the above does
01:08:27FromDiscord<Elegantbeef> So it's shit
01:09:19FromDiscord<Elegantbeef> Due to the fact it's a distinct it's the exact same size as the base which means no extra padding, so in cases you can use it it's much more memory happy
01:12:37FromDiscord<Tuatarian> thanks guys
01:13:04FromDiscord<Tuatarian> one more question, for educational purposes, how would I do what I was trying to earlier?
01:13:15FromDiscord<Tuatarian> sent a code paste, see https://play.nim-lang.org/#ix=47DU
01:13:32FromDiscord<Tuatarian> fails to compile since s is of type `McNode:ObjectType`
01:13:37FromDiscord<Tuatarian> how do I make this work properly?
01:14:28FromDiscord<leorize> what is your object definition?
01:14:55FromDiscord<Tuatarian> sent a code paste, see https://play.nim-lang.org/#ix=47Du
01:16:56*derpydoo quit (Quit: derpydoo)
01:17:08FromDiscord<leorize> ok your error is that `field` is a ref but `s` is an object
01:17:15FromDiscord<leorize> what do you want to compare?
01:17:20FromDiscord<leorize> the reference or?
01:17:31FromDiscord<Tuatarian> reference yeah
01:17:38FromDiscord<Tuatarian> if they both point to the same place
01:17:41FromDiscord<leorize> then `s` must be a reference too
01:17:46FromDiscord<Tuatarian> but `ref s` also fails to compile
01:18:28FromDiscord<Tuatarian> it says type expected
01:18:31FromDiscord<leorize> yes, line 16 won't pass, what do you want to do with it?
01:18:31FromDiscord<Tuatarian> at the very last line
01:18:39FromDiscord<Tuatarian> last char of the line
01:18:44FromDiscord<Tuatarian> wdym?
01:18:46FromDiscord<leorize> are you trying to copy all data over?
01:18:56FromDiscord<Tuatarian> I'm trying to copy the reference itself
01:19:05FromDiscord<leorize> then `n` must be `var ref`
01:19:24FromDiscord<leorize> or `var McNode` in this case
01:19:54FromDiscord<leorize> the iterator won't work because it expects an `object`, but that's easy fix
01:20:07FromDiscord<Tuatarian> oh... n is the internal representation of McNode
01:20:08FromDiscord<leorize> just `n[]` to dereference the `ref`
01:20:12FromDiscord<Tuatarian> thank you
01:22:13FromDiscord<leorize> btw, if you ever want to know the sort of savings a tree -\> seq can make, look at packedjson\: https://github.com/Araq/packedjson#to-compile-the-benchmark-run-these-commands
01:22:59FromDiscord<Tuatarian> thank you
01:23:10FromDiscord<Tuatarian> I'm getting a kind of odd error though
01:23:17FromDiscord<Tuatarian> I also defined a `=destroy` proc
01:23:35FromDiscord<Tuatarian> sent a code paste, see https://play.nim-lang.org/#ix=47E3
01:23:51FromDiscord<Tuatarian> which errors out saying that it was already defined implicitly in this line
01:24:04FromDiscord<leorize> if that's all your destroy have then you don't need it
01:24:11FromDiscord<Tuatarian> oh ok
01:24:15FromDiscord<Tuatarian> that's convenient
01:24:21FromDiscord<leorize> Nim generates a default destructor that destroys all fields automatically
01:24:21FromDiscord<Tuatarian> ` var bestKid : (float, McNode) = (float.low, n.kids[0])`
01:24:31FromDiscord<Tuatarian> it says char 37 which is the f
01:24:33FromDiscord<leorize> you only need your own when you have to adjust the behavior
01:24:34FromDiscord<Tuatarian> just curious at this point
01:25:01FromDiscord<leorize> when it comes to `=destroy`, you have to declare it right after your object definition
01:25:07FromDiscord<Tuatarian> oh, I see
01:25:18FromDiscord<leorize> the use of the object type anywhere will cause Nim to autogenerate a `=destroy`
01:25:26FromDiscord<leorize> (if one doesn't exist yet)
01:25:30FromDiscord<Tuatarian> ohh I see
01:25:36FromDiscord<Tuatarian> thank you
01:26:02FromDiscord<Tuatarian> one more thing
01:26:08FromDiscord<Tuatarian> ` if field != nil and field != ref s:`
01:26:18FromDiscord<Tuatarian> getting an error from this line saying type expected
01:26:22FromDiscord<Tuatarian> on the very last character
01:26:59FromDiscord<Bubblie> sent a code paste, see https://play.nim-lang.org/#ix=47E4
01:27:23FromDiscord<Tuatarian> man I forgot how verbose vulkan is
01:27:28FromDiscord<Bubblie> fr 😭
01:27:31FromDiscord<Tuatarian> it's been a while
01:27:36FromDiscord<Bubblie> after setting it up though its really easy
01:27:42FromDiscord<Bubblie> its just
01:27:45FromDiscord<Bubblie> a pain to set up
01:27:47FromDiscord<leorize> yea, `ref s` implies `ref[s]`, a type↡(@Tuatarian)
01:28:02FromDiscord<Bubblie> so much of my nim code is so unsafe though
01:28:05FromDiscord<Bubblie> like volatile πŸ’€
01:28:05FromDiscord<Tuatarian> so do I do `s.addr` instead?
01:28:31FromDiscord<leorize> yes, if you really need to
01:28:56FromDiscord<Bubblie> should I switch to ORC/ARC or can I stick to the GC
01:29:01FromDiscord<Bubblie> it doesn't seem to give me many issues
01:29:17FromDiscord<Bubblie> (edit) "should I switch to ORC/ARC or can I stick to the ... GC" added "regular"
01:29:30FromDiscord<leorize> orc is recommended for games since it has a much more deterministic collection cycle, at the cost of throughput
01:29:32FromDiscord<Elegantbeef> Orc is much better to write code for, but it's pretty much the same
01:29:44FromDiscord<Bubblie> In reply to @leorize "orc is recommended for": oh so, im making a game engine
01:29:45FromDiscord<Bubblie> im assuming
01:29:48FromDiscord<Bubblie> that would be better then
01:29:51FromDiscord<Elegantbeef> You're going to love having destructors
01:30:04FromDiscord<Bubblie> destructors...?
01:30:15FromDiscord<Elegantbeef> https://github.com/beef331/miniaudio/blob/master/src/miniaudio.nim#L53-L57 for wrapping libraries destructors are lovely for instance
01:30:17FromDiscord<leorize> yea, only orc/arc have working destructors (ask me how I know...)
01:30:20FromDiscord<Tuatarian> throughput meaning memory throughput or IO?
01:30:28FromDiscord<Elegantbeef> Lol leorize
01:30:34FromDiscord<Elegantbeef> CPU throughput
01:30:42FromDiscord<leorize> memory collection throughput↡(@Tuatarian)
01:30:47FromDiscord<Elegantbeef> Arc/Orc deallocate memory in procedures and dont delay it
01:30:49FromDiscord<Bubblie> nim has mixins??!?!!
01:30:52FromDiscord<Bubblie> πŸ‘€
01:30:55FromDiscord<Bubblie> wtf
01:30:57FromDiscord<Bubblie> I did not know this
01:31:00FromDiscord<Elegantbeef> Yes
01:31:06FromDiscord<Tuatarian> so you lose throughput but not eventually I guess?
01:31:09FromDiscord<Elegantbeef> It's literally how most good Nim code is written
01:31:15FromDiscord<Bubblie> does nim have everything
01:31:44FromDiscord<leorize> it's a throughput vs latency tradeoff↡(@Tuatarian)
01:32:08FromDiscord<Elegantbeef> The reason it's lower latency is freeing inline is relatively easy as it's only a small part of your heap getting freed
01:32:16FromDiscord<leorize> default GC would batch collect on new allocation, so a lot of memory can be freed then reuse immediately
01:32:22FromDiscord<Elegantbeef> Whereas with normal GCs when the GC kicks in it's' a large part of the heap getting checked
01:32:49FromDiscord<leorize> the cost is that the random time slice it decides to kick in is completely undeterministic
01:33:03FromDiscord<leorize> this is the stuff behind infamous GC pauses problem
01:33:08FromDiscord<Elegantbeef> Though Nim's let you tune it a lot
01:33:54FromDiscord<Bubblie> so uh, how do I switch to orc instead if any of you know
01:34:03FromDiscord<Elegantbeef> `--mm:orc`
01:34:26FromDiscord<Elegantbeef> I do like that you're asking "if any of you know"
01:39:59FromDiscord<leorize> fun fact, Nim's allocator is `O(1)`
01:40:28FromDiscord<leorize> though you might be better off switching to a regular allocator like those used by `malloc()`
01:40:55FromDiscord<Bubblie> sent a code paste, see https://play.nim-lang.org/#ix=47E7
01:40:58FromDiscord<Elegantbeef> That's it
01:41:11FromDiscord<Elegantbeef> You can just do `nim c -r --mm:orc vulkanmain.nim`
01:41:18FromDiscord<Bubblie> okay so when I do that it gives me an error with cstringArray but with the normal gc it doesn't oh god 😭
01:41:19FromDiscord<Bubblie> not this again
01:41:29FromDiscord<Bubblie> NOO I JUST FIXED THIS TODAY
01:44:26FromDiscord<leorize> maybe you should make your own cstringArray \:p
01:44:34FromDiscord<Bubblie> whar
01:44:45FromDiscord<!Patitotective> pear
01:44:47FromDiscord<!Patitotective> (edit) "pear" => "peare"
01:45:08FromDiscord<Elegantbeef> Can we make it 1 terminated?
01:45:30FromDiscord<Bubblie> okay it works with refc, just not anything else like orc or arc for that matter because apparantly in those two I cannot cast cstringArray to validationLayers[0]
01:45:37FromDiscord<Bubblie> yet I can do that in refc
01:45:49FromDiscord<Bubblie> so what do I even need to add differently in that case
01:45:53FromDiscord<Bubblie> oh my fucking god
01:45:59FromDiscord<leorize> you got the code somewhere?
01:46:13FromDiscord<Bubblie> yeah!
01:46:20FromDiscord<Bubblie> actually let me put this all onto a repo
01:46:32FromDiscord<Bubblie> well I had a repo but let me just commit all of it
01:46:35FromDiscord<Bubblie> my lazy ass hasnt comitted it
01:49:57FromDiscord<leorize> you can push it to a temp branch if you want to redo the commits later
01:50:32FromDiscord<Bubblie> if ur on linux the config.nims should work
01:50:37FromDiscord<Bubblie> I made it hella specific on my end for windows cause
01:50:38FromDiscord<Bubblie> yeah
01:50:43FromDiscord<Bubblie> development is easier for me that way
01:51:00FromDiscord<Bubblie> I do have to at some point make it auto find stuff with nim's dll thing forgot the name
01:51:02FromDiscord<Bubblie> dynalib
01:51:08FromDiscord<Bubblie> not dll thing πŸ’€
01:52:08FromDiscord<leorize> don't use dynlib, it will only bring pain
01:52:14FromDiscord<Bubblie> what should I use instead then
01:53:02FromDiscord<Bubblie> https://github.com/Bubblie01/Molecule
01:53:14FromDiscord<Bubblie> here is the link btw
01:53:44FromDiscord<Bubblie> I made an entirely new repo because git and vscode decided to annoy me
01:54:05FromDiscord<Elegantbeef> What line is the error on?
01:54:17FromDiscord<leorize> do you have the error message?
01:54:36FromDiscord<Bubblie> sent a code paste, see https://play.nim-lang.org/#ix=
01:54:37FromDiscord<Elegantbeef> `cast[ptr UncheckedArray[cstring]](validationLayers[0])` ?
01:54:40FromDiscord<Bubblie> yeah
01:54:47FromDiscord<Elegantbeef> Look at what you're doing
01:54:53FromDiscord<Bubblie> at first I just did
01:54:54FromDiscord<Bubblie> cstringArray
01:55:01FromDiscord<Bubblie> which worked
01:55:26FromDiscord<Elegantbeef> You're attempting to get an address to a const
01:55:33FromDiscord<Elegantbeef> that should be `validationLayers[0].addr`
01:55:41FromDiscord<Bubblie> o
01:55:55FromDiscord<Bubblie> :facepalm:
01:55:59FromDiscord<Elegantbeef> and it should be `let validationLayers = [cstring"VK_LAYER_LUNARG_standard_validation", nil]`
01:56:38FromDiscord<leorize> I'm amazed that this compiles at all
01:56:45FromDiscord<Elegantbeef> Same
01:56:50FromDiscord<Bubblie> me too
01:57:03FromDiscord<Bubblie> this entire thing is a learning process for me honestly
01:57:08FromDiscord<Rainbow Asteroids> !eval echo newSeq[byte](6)
01:57:10NimBot@[0, 0, 0, 0, 0, 0]
01:57:19FromDiscord<Rainbow Asteroids> irc repl
01:57:38FromDiscord<Elegantbeef> Putting the repl in irc
01:59:29FromDiscord<Mr.Ender> Sorry that I dont know exactly how to word this but what would it be called where you can have a file open inside of a program you made and import its data ex like a text editor where when you open the file it opens the text editor and puts the data from the file in it.↡↡How would I impliment this and or find documentation on it.
01:59:37FromDiscord<Mr.Ender> (edit) "dont" => "don't" | "impliment" => "implement" | "and or" => "and/or"
01:59:45FromDiscord<Mr.Ender> (edit) "data ex" => "data.ex"
02:00:04FromDiscord<leorize> @Bubblie pro tip\: `var something = when defined(this): that else: stuff` is possible syntax
02:00:14FromDiscord<Bubblie> wait πŸ‘€
02:00:14FromDiscord<Mr.Ender> (edit) "Sorry that I don't know exactly how to word this but what would it be called where you can have" => "sent" | "file open inside of a program you made and import its data.ex like a text editor where when you open the file it opens the text editor and puts the data from the file in it.↡↡How would I implement this and/or find documentation on it." => "long message, see https://paste.rs/Eqm"
02:00:22FromDiscord<Bubblie> thats actually very cool
02:00:41FromDiscord<Bubblie> sorry im so use to java πŸ’€ sometimes I fear im typing nim like Java/C++ and not like nim
02:00:52FromDiscord<leorize> and, uh, `defined(debug)` is a bool so you don't need your rig at all
02:01:25FromDiscord<leorize> just write Nim like you're writing JS \:p
02:01:33FromDiscord<Mr.Ender> (edit) "long message," => "code paste," | "http://ix.io/47Eb" => "https://play.nim-lang.org/#ix=47Ea"
02:02:02FromDiscord<Bubblie> Iwait so how would I set either to true or false then without checking for debug
02:02:07FromDiscord<Bubblie> (edit) "Iwait" => "wait"
02:02:14FromDiscord<Bubblie> wait
02:02:14FromDiscord<Bubblie> oh
02:02:20FromDiscord<Bubblie> nvm im clowning
02:02:21FromDiscord<Bubblie> got it
02:03:19FromDiscord<leorize> you wanna read the file?↡(@Mr.Ender)
02:03:43FromDiscord<Bubblie> sent a code paste, see https://play.nim-lang.org/#ix=47Ec
02:03:57FromDiscord<Mr.Ender> In reply to @leorize "you wanna read the": I would like to be able to double click a file and it open and import its data into my application
02:04:04FromDiscord<nigrow> https://i.imgflip.com/6pynl9.jpg
02:04:05FromDiscord<Mr.Ender> From my file explore
02:05:52FromDiscord<leorize> can your program do that with `program /path/to/file`?
02:06:07FromDiscord<Mr.Ender> what do you mean by that
02:06:11FromDiscord<Prestige> Anyone know how to set up cors with prologue?
02:06:50FromDiscord<leorize> parse the command line to get the input file name?↡(@Mr.Ender)
02:07:00FromDiscord<Bubblie> sent a code paste, see https://play.nim-lang.org/#ix=
02:07:05FromDiscord<Bubblie> I cantt ell if this is horrible programming or not
02:07:10FromDiscord<Mr.Ender> In reply to @leorize "parse the command line": yes
02:07:11FromDiscord<Bubblie> (edit) "cantt ell" => "cant tell"
02:07:21*jkl quit (Quit: Gone.)
02:07:40FromDiscord<leorize> it's illegal, have you verified whether it works at all?↡(@Bubblie)
02:07:46FromDiscord<Bubblie> it works
02:07:47FromDiscord<Bubblie> somehow
02:07:51FromDiscord<Bubblie> I dont even know how the fuck
02:07:53FromDiscord<Bubblie> it works
02:07:54FromDiscord<Bubblie> but it does
02:08:21FromDiscord<leorize> then you can register a mime type with your program, the procedure is different between Linux and Win, though↡(@Mr.Ender)
02:08:24FromDiscord<Bubblie> it does die though once I close it with illegal storage access
02:08:29FromDiscord<Bubblie> but somehow it still... runs?
02:08:30FromDiscord<!Patitotective> you can pretty much just iterate through `commandLineParams()` and check if the path is valid↡https://nim-lang.org/docs/os.html#commandLineParams↡@Mr.Ender
02:08:36FromDiscord<Bubblie> what should I do instead
02:08:41*jkl joined #nim
02:08:42FromDiscord<Mr.Ender> thank you for all the help
02:10:14FromDiscord<leorize> you can stringify it to do a byte-by-byte comparison
02:10:16FromDiscord<nigrow> https://matrix-client.matrix.org/_matrix/media/r0/thumbnail/matrix.org/2022-08-15_ZfjHaUHfKhmaORti?width=100&height=100&method=scale
02:11:01FromDiscord<leorize> though if you just want simple comparison, you'd need to write your own string compare proc or use libc's
02:11:29FromDiscord<Bubblie> In reply to @leorize "you can stringify it": how would one do that? im unsure how to do that in nim
02:12:02FromDiscord<leorize> a cstring is still an array, so your basic loop compare should do
02:12:10FromDiscord<Bubblie> alright!
02:12:25FromDiscord<leorize> `$` on a cstring turns it into a string btw
02:13:00FromDiscord<leorize> note that it assumes a null terminated string so don't use it on one that's not
02:13:28FromDiscord<Bubblie> so like $layerProperties.layerName[0] ?
02:13:35FromDiscord<Elegantbeef> Hey crashing your program is always up to you
02:13:38FromDiscord<Bubblie> although that might be a compile time error
02:13:39FromDiscord<Bubblie> right
02:13:53FromDiscord<nigrow> I'm jerking it
02:14:08FromDiscord<nigrow> https://matrix-client.matrix.org/_matrix/media/r0/thumbnail/matrix.org/2022-08-15_ZfjHaUHfKhmaORti?width=10000&height=10000&method=scale
02:20:39FromDiscord<Bubblie> sent a code paste, see https://play.nim-lang.org/#ix=
02:21:46FromDiscord<Bubblie> Also <@&371760044473319454>
02:23:09FromDiscord<nigrow> sent a long message, see http://ix.io/47Ef
02:23:30FromDiscord<Elegantbeef> Jesus they're not even trying to be overtly stupid
02:23:38FromDiscord<Elegantbeef> Intersting name
02:24:07FromDiscord<leorize> they're swapping display names like it's irc, kinda funny
02:24:28FromDiscord<Bubblie> Are you talking about that person thats posting things
02:24:35FromDiscord<leorize> I can't moderate here so y'all have to wait til ppl woke up
02:24:42FromDiscord<Bubblie> Damn
02:29:11FromDiscord<Bubblie> wow orc is a lot faster
02:30:04FromDiscord<Elegantbeef> Sometimes
02:51:46*derpydoo joined #nim
02:54:47FromDiscord<voidwalker> meh previous unresolved issue with "weave":
02:54:55FromDiscord<voidwalker> sent a code paste, see https://play.nim-lang.org/#ix=47Ei
02:55:01FromDiscord<voidwalker> `Error: illegal capture 'idsBuf' because 'weaveParallelForSection' has the calling convention: <inline>`
02:55:17FromDiscord<voidwalker> what am I missing?
02:58:04FromDiscord<voidwalker> that code works fine if not in a proc
03:07:06*rockcavera joined #nim
03:07:06*rockcavera quit (Changing host)
03:07:06*rockcavera joined #nim
03:20:41*arkurious quit (Quit: Leaving)
03:41:49*xcodz-dot joined #nim
03:42:55xcodz-dotHey! How does one create variable types? Just the way AST is handled, NimNode is the variable type there.
03:44:22FromDiscord<Elegantbeef> Variable types?
03:44:28FromDiscord<Elegantbeef> You mean like object variants?
03:51:29*xcodz-dot quit (Ping timeout: 255 seconds)
03:55:50*xcodz-dot joined #nim
03:56:00xcodz-dotyes
03:56:06xcodz-dotI do mean object variants
03:56:29xcodz-dotBut how do you really create one and btw whats your timezone?
03:56:42FromDiscord<huantian> beef's timezone is always awake
03:56:58FromDiscord<Elegantbeef> Ehh
03:57:08FromDiscord<Elegantbeef> Mountain time Canada
03:57:23FromDiscord<Elegantbeef> https://nim-lang.org/docs/tut2.html#object-oriented-programming-object-variants
03:57:28xcodz-dotthanks!
03:58:09FromDiscord<huantian> I have the superior mountain time
04:03:48FromDiscord<Elegantbeef> Does yours do DST?
04:03:50FromDiscord<Elegantbeef> If so they're both shit
04:04:05FromDiscord<huantian> nah it's the bit of mst that doesn't have dst
04:04:42FromDiscord<huantian> arizona is based
04:07:06FromDiscord<Elegantbeef> What a world
04:10:07FromDiscord<flywind> Should a new feature like default fields consider refc?
04:10:30FromDiscord<flywind> (edit) "consider" => "support"
04:10:48FromDiscord<leorize> yea, until it ceases to be the default gc
04:11:37*xcodz-dot quit (Ping timeout: 244 seconds)
04:13:02FromDiscord<flywind> It is a 2.0 feature, so I probably drop refc support.
04:17:53*xcodz-dot joined #nim
04:21:38*derpydoo quit (Quit: derpydoo)
04:23:03FromDiscord<Elegantbeef> Seems odd not to support it for refc, but then again i doubt many people will opt to use refc assuming orc doesnt bug out πŸ˜„
04:23:45*derpydoo joined #nim
04:27:03xcodz-dotHow am I supposed to construct a regular expression with double quotes in it
04:27:05xcodz-dot?
04:28:10FromDiscord<Rika> Escape it with a backslash
04:28:23xcodz-dotI thought so, doesn't work
04:28:36xcodz-dot`let stringliteral = r""(?P<data>(\\.|[^"\\])*)(?<!\\)\""`
04:28:37FromDiscord<Rika> Ah wait this is using raw strings so
04:28:58FromDiscord<Rika> re"""content"content"""
04:29:10xcodz-dotthanks
04:29:26FromDiscord<Rika> So triple quotes around the content
04:30:47FromDiscord<Elegantbeef> Regex to parse html, ruhroh
04:31:21xcodz-dotumm, we have a problem `let stringliteral = r""""(?P<data>(\\.|[^"\\])*)(?<!\\)""""`, It thinks that I am using 4 quotes to enclose the string.
04:31:37FromDiscord<Rika> Does it not work even then?
04:31:41FromDiscord<Rika> I assume it would have
04:31:54xcodz-dottry it, not gonna work
04:31:58FromDiscord<Elegantbeef> It does work
04:32:06FromDiscord<Rika> !eval echo r""""(?P<data>(\\.|[^"\\]))(?<!\\)""""
04:32:10NimBot"(?P<data>(\\.|[^"\\]))(?<!\\)"
04:32:18FromDiscord<Rika> Looks like it works
04:32:31FromDiscord<Elegantbeef> need a degree in workology
04:32:47xcodz-dotHuh?
04:32:57FromDiscord<Rika> What?
04:33:06FromDiscord<Elegantbeef> Hmm?
04:33:06xcodz-dotso it means my syntax highlighting is broken after using this?
04:33:11FromDiscord<Rika> Yes
04:33:28FromDiscord<Rika> Highlighting is funky still iirc
04:33:29FromDiscord<flywind> In reply to @Elegantbeef "Seems odd not to": refc seqs add some difficulties because the type is erased => `setLengthSeq(seq: PGenericSeq, elemSize, elemAlign, newLen: int)`
04:34:56xcodz-dothttps://pasteboard.co/X2HpJ0PithpB.png
04:35:40FromDiscord<Rika> Yeah
04:35:50FromDiscord<Elegantbeef> `Let`
04:36:31FromDiscord<Elegantbeef> Consider looking at npeg or making your own parser with parseutils
04:37:17xcodz-dotLater maybe, I am really just converting my python code to nim. And I have been doing this for all projects that I have written to practise nim
04:39:16FromDiscord<Rika> In reply to @Elegantbeef "`Let`": Likely the β€œlowercase italic” of the font somehow
04:41:23xcodz-dotDon't worry, I typed everything with lowercase. Its just the italics font that makes it look that way
04:41:44xcodz-dotIt compiles btw
04:42:13FromDiscord<Rika> Yes
04:50:21xcodz-dotHow to do groups in regex? Like named groups or even unnamed groups?
04:52:12xcodz-dotI have already written the patterns and have used the `re.match` function to generate matches in a `var matches: array[string]`. How am I supposed to obtain named group matches from that array?
04:52:24FromDiscord<retkid> how do i make a ref of an existing object
04:52:34FromDiscord<Elegantbeef> `type A = ref B`
04:52:50FromDiscord<Elegantbeef> or just `ref B`
04:53:06xcodz-dotI agree with later solution
04:53:17FromDiscord<Elegantbeef> Depends what you're doing
04:53:23FromDiscord<Elegantbeef> Sometimes it's better to have an alias
04:53:26FromDiscord<retkid> no i mean
04:53:55FromDiscord<Elegantbeef> What do you mean by named group matches?
04:54:09FromDiscord<retkid> sent a code paste, see https://play.nim-lang.org/#ix=47EB
04:54:23FromDiscord<Elegantbeef> `var b = new typeof(a); b[] = a`
04:54:32FromDiscord<retkid> i shall use addr
04:54:53FromDiscord<Elegantbeef> References are managed pointers you cannot raise a stack value to a reference
04:55:57FromDiscord<Elegantbeef> You either have to make the value a reference to start or copy
04:56:11xcodz-dothttps://pasteboard.co/fY3pvTMJgA8s.png
04:56:24xcodz-dotabove is what I mean by named groups
04:57:00FromDiscord<Elegantbeef> sent a code paste, see https://paste.rs/fir
04:57:16FromDiscord<Elegantbeef> Yea i dont play with regex so that doesnt really help much
04:57:35FromDiscord<Bung> I got nil access line:223 , any hint? https://media.discordapp.net/attachments/371759389889003532/1008600318197629048/2022-08-15_125451.png
04:58:16FromDiscord<Bung> left is translated nim version
04:58:25FromDiscord<retkid> :| annoying cant put addr in paramaters
04:58:38FromDiscord<Elegantbeef> ...
04:58:54FromDiscord<huantian> addr doesn’t belong in parameters
04:58:57FromDiscord<Elegantbeef> Bung it's hard to tell ensure all your casts are safe
04:59:15FromDiscord<Elegantbeef> Addr is a operation to get the address of a value
04:59:21FromDiscord<Elegantbeef> It's not a type
04:59:24FromDiscord<Elegantbeef> `ptr` is a type
04:59:32FromDiscord<retkid> oh yea
04:59:34FromDiscord<retkid> braindead
04:59:41FromDiscord<retkid> my brain is actuallly made of cheese
04:59:43FromDiscord<retkid> i forgot its ptr
05:00:33FromDiscord<Elegantbeef> https://nitely.github.io/nim-regex/regex.html does support named groups it seems
05:00:41FromDiscord<Bung> In reply to @Elegantbeef "Bung it's hard to": original c verson works, I try to figure out whats wrong with translated version
05:01:17*CyberTailor quit (Quit: Konversation terminated!)
05:01:59xcodz-dotThanks I would stick to standard library instead and do some complex stuff I would regret later. Thanks
05:02:03*nullsh quit (*.net *.split)
05:02:05FromDiscord<Bung> type defined as https://media.discordapp.net/attachments/371759389889003532/1008601443659436102/2022-08-15_130128.png
05:02:41FromDiscord<Elegantbeef> And browser is heap allocated type?
05:03:05*nullsh joined #nim
05:04:31FromDiscord<Elegantbeef> You cast browser to `ptr IUnknown` is `IUnknown` a pointer type?
05:04:32FromDiscord<Bung> `IOleObject browser;` in c
05:05:55FromDiscord<Bung> IUnknown is a object contains only on field to a pointer
05:06:12FromDiscord<Elegantbeef> Ok so then it's compatible
05:06:15FromDiscord<Bung> sent a code paste, see https://play.nim-lang.org/#ix=47EI
05:07:15FromDiscord<Elegantbeef> Is `RefId` compatible with a pointer?
05:09:59FromDiscord<Bung> it's ptr of guid
05:10:40FromDiscord<Elegantbeef> Well then time to read the docs carefully
05:10:44FromDiscord<Bung> i try to echo repr these variable , still report that line...
05:11:49FromDiscord<Elegantbeef> Oh god it's' a windows API, so it's going t obe like 9000 times wors than it should be
05:12:43FromDiscord<Bung> bad doc compare to macos's
05:12:55FromDiscord<Elegantbeef> Bad API compared to anything
05:13:37FromDiscord<Bung> yeah, param in out opt flag ..
05:14:00FromDiscord<Elegantbeef> Also worth noting the C code you showed uses C case fall through
05:14:33FromDiscord<Elegantbeef> Not that it changes anything but you should have `of Command, KeyDown, KeyUp`
05:17:18FromDiscord<Bung> oh, it's fall through, indeed
05:22:42FromDiscord<Bung> oh it's browser.lpVtbl
05:32:40FromDiscord<retkid> sent a code paste, see https://play.nim-lang.org/#ix=47EM
05:35:08xcodz-dotWhy isn't `--mm:orc --deepcopy:on` default? I used it with a cpu intensive project and found out that it got me almost double speed.
05:36:22FromDiscord<Elegantbeef> Cause that's nim 2.0
05:37:26xcodz-dotAnd any idea when is nim 2 coming out?
05:38:14xcodz-dotAnd yeah, I shouldn't complaint. What I got before that was already 100x faster than my previous python code.
05:38:32FromDiscord<Elegantbeef> Is that with `-d:release`? πŸ˜„
05:38:40xcodz-dotyep
05:40:33xcodz-dotActually, if you wanna try it for yourself. The project is on `http://github.com/xcodz-dot/NimNN`. You can run it with `--timeit --generate --out simdate_temprorary --count 1000`. You can play with `--count` to directly influence the simulation time.
05:41:26FromDiscord<Elegantbeef> No no no this isnt how this works, when someone shows code I comment on their code smells πŸ˜„
05:42:05FromDiscord<Elegantbeef> These are just templates that are needlessly more complicated https://github.com/xcodz-dot/NimNN/blob/master/src/nn.nim#L8-L13 for instance πŸ˜›
05:42:50FromDiscord<Elegantbeef> https://github.com/xcodz-dot/NimNN/blob/master/src/nn.nim#L29-L44 is just silly `newSeq[float64](...)`
05:43:20xcodz-dotgreat.
05:43:42xcodz-dotIt was actually my second program ever written in Nim. I am still pretty much new to nim.
05:43:55xcodz-dotI was trying to experiment with macros. Just to see how they work
05:44:05FromDiscord<Elegantbeef> Hey i annoy people with unasked for code reviews!
05:44:07xcodz-dotAnd newSeqOfCap == newSeq?
05:44:23xcodz-dotNah, I am open to code reviews. I crave them
05:44:31FromDiscord<Elegantbeef> No `newSeqOfCap` followed by adding the 0'd data is the same as `newSeq`
05:44:48FromDiscord<Elegantbeef> `newSeq` allocates and 0's the memory
05:45:45FromDiscord<Elegantbeef> As such if you're writing the data after allocating with `seqOfCap` you're just being redundant
05:45:50xcodz-dotI am so dumb. I can not express my gratitude towards your wisdom.
05:46:22FromDiscord<Elegantbeef> Also it's up to you but `var a: seq[T]` is the same as `var a: seq[T] = @[]`
05:46:44xcodz-dotDidn't knew that either
05:47:13xcodz-dotI thought nim was more like C, uninitialized data was just null pointer
05:48:00FromDiscord<Elegantbeef> No nim 0 inits all data
05:48:07FromDiscord<Elegantbeef> Which is a pain in some regards
05:48:15FromDiscord<Elegantbeef> Another thing nim 2.0 will address
05:48:27xcodz-dotpain if viewed from performance aspects
05:49:10FromDiscord<Elegantbeef> Eh not really
05:49:18xcodz-dotthen?
05:49:19FromDiscord<Elegantbeef> Nim has `{.noinit.}` if you do not want data 0'd
05:49:34FromDiscord<Elegantbeef> Think it also has `newSeqUnitintialized`
05:49:53xcodz-dotbut then in which regard is it pain?
05:50:01FromDiscord<Elegantbeef> Subrange types
05:50:11FromDiscord<Elegantbeef> Things where 0'd is not valid
05:50:18xcodz-dotanother concept idk about.
05:50:20FromDiscord<Elegantbeef> `var a: 1..1` should not be `0`
05:50:42FromDiscord<Elegantbeef> They're just values that are checked to between a high/low
05:50:59FromDiscord<Elegantbeef> In the case they're 0'd this means you often get invalid values
05:52:14xcodz-dotUnfortunately for you, there are 10 mins to Monday. And Here I am sitting in Monday for past 11 hours.
05:52:19FromDiscord<Elegantbeef> Should also mention that when using stdlib you should prefix the import with `std/` so like `std/[math, os, json, times]`
05:52:27xcodz-dotwhy?
05:52:50FromDiscord<Elegantbeef> Cause some modules require `std` and it ensures you import the stdlib module and not a same named module that's in your project
05:53:09FromDiscord<Elegantbeef> Modern stdlib modules will require `std`
05:53:45xcodz-dotWell, gonna follow that now onwards.
05:56:10FromDiscord<Elegantbeef> Also it seems you dont know you can do `proc thing(a, b, c: int)`
05:56:14FromDiscord<Elegantbeef> Or if you do you dislike it πŸ˜›
05:57:00xcodz-dotOh well, I do know about it and have pretty much used it alot
05:57:18xcodz-dotIt is probabbly my habits that I have carried on from Python
05:57:41xcodz-dotI always do type annotations in Python to make it look clean
05:59:59FromDiscord<huantian> People who write untyped python are monsters
06:00:02FromDiscord<huantian> Or just lazy
06:00:36FromDiscord<Elegantbeef> Also you should wrap your main code in `try: ... except UsageError as e: echo e.msg` to avoid `Error: unhandled exception: Either --generate or --load options should be provided [UsageError]`
06:01:23FromDiscord<Elegantbeef> You can atleast cheat with these types of programs to bubble up exceptions as user facing error messages
06:01:32FromDiscord<Elegantbeef> Dont know what most think of that but i think it's a fairly elegant solution
06:01:48FromDiscord<Elegantbeef> I really should write some code
06:05:05xcodz-dotYeah, I am pretty sure that I am not going to do that for a while now. It really is a chore to refactor even a single line.
06:05:49xcodz-dotAnd I think I will focus on my compiler for now. Been writing a assembly compiler for custom assembly language for custom cpu architecture.
06:06:13xcodz-dotthat runs on a custom cpu architecture emulator.
06:06:18*xcodz-dot quit (Quit: Leaving)
06:06:28FromDiscord<Elegantbeef> I wonder if @Girvo has had any luck with my statically typed custom allocator objects
06:59:59*derpydoo quit (Ping timeout: 268 seconds)
07:21:30*dnh joined #nim
07:35:41*PMunch joined #nim
07:41:01*PMunch quit (Quit: Leaving)
07:41:33*PMunch joined #nim
07:44:38FromDiscord<Ras> let's say i wanted to replace lines 18-19 and 26-27 with a template that looks something like what's defined in lines 13-14 - i'm probably correct in assuming that `w` will be the value of the string itself and not its identifier / variable name https://media.discordapp.net/attachments/371759389889003532/1008642358289629214/unknown.png
07:44:54FromDiscord<Ras> how would i go about referencing the variable name itself in the template
07:45:36FromDiscord<Elegantbeef> change the `w` to `str` then do `m.isSome and m.get.w == str`
07:45:37FromDiscord<Ras> oh, wait, i can't do that at all
07:45:56FromDiscord<Ras> those two functions are accessing different things
07:45:59FromDiscord<Elegantbeef> The issue is that all instances of `w` is replaced
07:46:04FromDiscord<Ras> as in, the object structure is different
07:46:05FromDiscord<Ras> my bad
07:46:17FromDiscord<Elegantbeef> That doesnt matter
07:46:19FromDiscord<Ras> but thanks for the help anyways
07:46:47FromDiscord<Elegantbeef> `if parent.windowProperties.existsAndMatches(val):` is valid
07:47:04FromDiscord<Elegantbeef> Just as `if parent.appId.existsAndMatches(val)` is
07:47:40FromDiscord<Elegantbeef> You could just do `if parent.appId == some(myStr)` if you were lazy and hope move semantics makes it cheap πŸ˜„
07:48:34FromDiscord<Ras> i'm accessing and checking the `class` field of the `window_properties` option in the first proc, but the `app_id` value itself in the second one
07:48:57FromDiscord<Elegantbeef> Oh i missed that
07:50:34FromDiscord<Ras> just out of curiosity, is there maybe already sugar in the std for "`isSome` and is equal to `x`"
07:50:45FromDiscord<Ras> seems like a pretty common pattern maybe
07:51:03FromDiscord<Elegantbeef> `== some(x)` would mostly be equivlent if move semantics kick in
07:52:59FromDiscord<Ras> i'm new to "move semantics", what would be the preconditions required for move semantics to kick in?
07:53:44FromDiscord<Elegantbeef> Using arc/orc and not using the variable after the `some`
07:54:46FromDiscord<Ras> the lefthand variable? or the variable in the `some` call?
07:55:04FromDiscord<Elegantbeef> Inside the some
07:56:32FromDiscord<Ras> ah, i see
07:57:34FromDiscord<Ras> i'm not using it directly in the same proc call, but the proc recursively calls itself for all child nodes and performs the check at the top again, does that count?
07:58:45FromDiscord<Elegantbeef> If it's a parameter it'd have to be passed as sink so no it doesnt
07:59:00FromDiscord<Elegantbeef> If it's not a locally scoped variable it doesnt do implicit move semantics
07:59:30FromDiscord<Ras> full source for context: https://github.com/nnsee/nim-swayipc/blob/master/src/swayipc/util.nim
08:02:27FromDiscord<Ras> i think i need to fully read and comprehend the destructors and move semantics document to understand this
08:02:42FromDiscord<Elegantbeef> sent a code paste, see https://play.nim-lang.org/#ix=47F8
08:03:20FromDiscord<Elegantbeef> Move semantics isnt overly complicate, basicallly any variable or parameter marked `sink` can be moved, which allows reuse of it's variables instead of a copy
08:03:49FromDiscord<Elegantbeef> sent a code paste, see https://play.nim-lang.org/#ix=47F9
08:04:08FromDiscord<Elegantbeef> In refc that's always a copy, with arc/orc it's only a copy if you use a after declaring b
08:04:29FromDiscord<Elegantbeef> sent a code paste, see https://play.nim-lang.org/#ix=47Fa
08:04:55FromDiscord<Elegantbeef> sent a code paste, see https://play.nim-lang.org/#ix=47Fb
08:05:08FromDiscord<Elegantbeef> And this applies to object fields as well
08:05:18FromDiscord<Ras> i see, that makes sense
08:05:19FromDiscord<Ras> thank you
08:05:31FromDiscord<Elegantbeef> The benefit of course is fewer copies means fewer allocations and a faster program
08:07:29FromDiscord<Elegantbeef> A future nim may infer sink by default but presently you have to manually annotate sink or use `--sinkInference:on` which is bugg
08:07:32FromDiscord<Elegantbeef> buggy
08:07:58FromDiscord<Elegantbeef> Wait it's on by default?
08:08:30FromDiscord<Elegantbeef> I could've sworn it wasnt on by default cause it caused many type mismatch issues
08:52:39*dnh quit (Quit: My MacBook has gone to sleep. ZZZzzz…)
09:01:15*dnh joined #nim
09:28:39FromDiscord<aruZeta> sent a code paste, see https://play.nim-lang.org/#ix=47Fl
09:30:51FromDiscord<Rika> Constants don’t exist on runtime
09:31:36FromDiscord<Rika> What you wrote is equal to `let b = [1,2,3]`
09:35:21NimEventerNew thread by Void09: Wave: illegal capture ' ' because 'weaveParallelForSection' has the calling convention: <inline>, see https://forum.nim-lang.org/t/9372
09:35:59FromDiscord<aruZeta> In reply to @Rika "What you wrote is": oh well right
09:39:31FromDiscord<Ras> i googled my project before starting it to see whether someone had already written it, and i found nothing
09:39:55FromDiscord<Ras> naturally, after getting my project into a relatively ok state, i attempted to publish the package to nimble
09:40:51FromDiscord<Ras> the PR CI failed because a package with the same name already existed - only then did i see that someone had already written the same thing i just spent my time on, and even named it the same
09:41:00FromDiscord<Rika> What was it you were making
09:41:16FromDiscord<Rika> And there’s no problem with making the same thing, just need to make it better than the other dude
09:41:22FromDiscord<Ras> a library for communicating with sway via ipc, package name "swayipc"
09:41:34FromDiscord<Ras> In reply to @Rika "And there’s no problem": no, i don't regret writing it anyways, was a learning experience
09:41:40FromDiscord<Rika> I see
09:41:54FromDiscord<Ras> someone named "disruptek" had already written it, and their project seems far more polished than mine
09:42:00FromDiscord<Ras> they seem to be some sort of nim guru
09:43:00FromDiscord<Rika> Ah he got banned here for communication issues but yes he’s pretty good at Nim
09:43:14FromDiscord<Ras> communication issues? πŸ€”
10:03:20FromDiscord<Ras> ok, i searched the logs, seems like a delicate topic with lots of differing opinions so i'll just drop the topic
10:46:21*PMunch_ joined #nim
10:46:33*PMunch_ quit (Remote host closed the connection)
10:53:45*PMunch_ joined #nim
10:55:01*PMunch quit (Quit: Leaving)
10:55:12FromDiscord<offbeat-stuff (offbeat-stuff)> https://play.nim-lang.org/#ix=47FC
10:55:12FromDiscord<offbeat-stuff (offbeat-stuff)> any idea why this does not compile
10:55:34FromDiscord<offbeat-stuff (offbeat-stuff)> actually it gives sigsev
10:55:41FromDiscord<offbeat-stuff (offbeat-stuff)> segmentation fault
10:58:27*PMunch_ quit (Client Quit)
10:59:10FromDiscord<Rika> seems like a compilation issue
11:00:30FromDiscord<offbeat-stuff (offbeat-stuff)> seems like this gives the error (x\: GVec,y\: range[0 .. x.X - 1]
11:00:39FromDiscord<offbeat-stuff (offbeat-stuff)> if i change the range to a simple int
11:00:43FromDiscord<offbeat-stuff (offbeat-stuff)> it compiles
11:03:38FromDiscord<aruZeta> sent a code paste, see https://play.nim-lang.org/#ix=47FF
11:03:52FromDiscord<aruZeta> But if you have `range[0 .. x.X - 1]` it does not
11:05:15FromDiscord<aruZeta> maybe because since X is a Natural, if it were 0, 0 - 1 = -1
11:05:41NimEventerNew thread by Drkameleon: Any way to compile with `-O2` or `-Ofast`?, see https://forum.nim-lang.org/t/9373
11:10:20FromDiscord<aruZeta> sent a code paste, see https://play.nim-lang.org/#ix=47FH
11:10:58FromDiscord<aruZeta> Is there a way to not declare what the returned will be
11:11:00FromDiscord<aruZeta> (edit) "Is there a way to not declare what the returned ... will" added "type"
11:11:09FromDiscord<Rika> `: auto`
11:11:13FromDiscord<aruZeta> :)
11:11:16FromDiscord<aruZeta> im dumb
11:11:22FromDiscord<Rika> no its not obvious
11:12:30FromDiscord<aruZeta> it's a bit of a pain to need to create generics in Bar to specify the generics of Foo
11:13:04FromDiscord<aruZeta> but well, the `auto` is great
11:13:41FromDiscord<aruZeta> (edit) "it's a bit of a pain to need to create generics in Bar to specify the generics of Foo ... " added "( been like 2h breaking my head to think of how to do this lol)"
11:13:49*dnh quit (Quit: My MacBook has gone to sleep. ZZZzzz…)
11:13:52FromDiscord<aruZeta> (edit) "breaking" => "smashing"
11:15:15*dnh joined #nim
11:16:34FromDiscord<Rika> yeah i dont know how the fuck auto works but it does
11:25:30FromDiscord<aruZeta> sent a code paste, see https://play.nim-lang.org/#ix=47FP
11:25:44FromDiscord<aruZeta> (edit) "https://play.nim-lang.org/#ix=47FP" => "https://play.nim-lang.org/#ix=47FQ"
11:25:45FromDiscord<aruZeta> (edit)
11:28:36FromDiscord<aruZeta> I mean, I just need to create a type which holds 2 arrays of a fixed size which will be known at runtime, is it that hard?
11:29:33FromDiscord<aruZeta> What I did before is just make them seqs, and add stuff as necessary, but since I can know the size they will have, i thought it would be faster to use arrays
11:30:31FromDiscord<Rika> `arrays of a fixed size which will be known at runtime` is kind of just a seq where you dont change the size though
11:30:37FromDiscord<Rika> you cant really have it any other way
11:30:46FromDiscord<Rika> unless you want VLAs or w/e
11:31:10FromDiscord<aruZeta> In reply to @Rika "`arrays of a fixed": seems like that will be what I will be doing
11:31:39FromDiscord<aruZeta> when creating the object, `obj.seq.len = lenght`
11:31:42FromDiscord<Rika> you can preallocate the space with newSeq anyway
11:31:58FromDiscord<Rika> newSeq(length) then your seq will be filled with zeroed objects
11:32:01FromDiscord<aruZeta> will do that then
11:32:04FromDiscord<Rika> just like an array
11:32:12FromDiscord<aruZeta> seems like the best approach
11:32:24FromDiscord<Rika> In reply to @Rika "newSeq(length) then your seq": needs the generic sorry newSeq[type](length)
11:32:38FromDiscord<aruZeta> ty :3
11:48:47*PMunch joined #nim
11:53:31*jmdaemon quit (Ping timeout: 268 seconds)
12:44:49*wallabra quit (Ping timeout: 268 seconds)
13:28:53FromDiscord<Ras> sent a code paste, see https://play.nim-lang.org/#ix=47Gt
13:29:14FromDiscord<Ras> (edit) "https://play.nim-lang.org/#ix=47Gt" => "https://play.nim-lang.org/#ix=47Gu"
13:29:49FromDiscord<Ras> i can't find where this is actually set
13:33:50FromDiscord<flywind> In reply to @Ras "when trying to generate": It seems to be a known issue => https://github.com/nim-lang/Nim/issues/14424
14:10:24*dnh quit (Quit: Textual IRC Client: www.textualapp.com)
14:18:04FromDiscord<Knedlik> Hey guys, I'm trying to compile a Nim program on MacOS Monterey 12.5, but no matter what I do, it throws me "file not found" on C std headers... any idea how to solve that?
14:19:39FromDiscord<Ras> what file exactly
14:21:39*arkurious joined #nim
14:22:49FromDiscord<Ras> or, like, post the build log
14:28:44FromDiscord<dom96> how did you install Nim?
14:30:25FromDiscord<dom96> In reply to @Ras "when trying to generate": Nim's config. Maybe it's in /etc/nim?
14:31:03FromDiscord<dom96> You might be better off installing Nim another way though. Nim doesn't particularly like being installed across `/`
14:45:53FromDiscord<Knedlik> In reply to @dom96 "how did you install": Homebrew with `brew install nim --head`
14:46:17FromDiscord<Knedlik> In reply to @Ras "or, like, post the": Where is that?
15:03:19FromDiscord<Ras> In reply to @dom96 "Nim's config. Maybe it's": grepped around in there but didn't see anything relevant
15:08:01*disso_peach quit (Remote host closed the connection)
15:08:16*LuxuryMode joined #nim
15:08:46*disso_peach joined #nim
15:18:11*xet7 joined #nim
15:39:42*Guest5 joined #nim
15:40:29*Guest5 quit (Client Quit)
16:14:40FromDiscord<dom96> You might have better luck installing Nim via choosenim (both of you)
16:16:58FromDiscord<answer> i installed nim using choosenim on my m1 mac and it works perfectly (same version 12.5)
16:17:18FromDiscord<answer> you do also need xcode installed if you don't already have that though
16:17:51FromDiscord<answer> because xcode will install all the headers for the system and provide a compiler (a custom clang or something i believe?)
16:20:39FromDiscord<victory> does anyone have experience with anonimongo? i'm having errors for an invalid URI but the URI is what I've always used?
16:20:54FromDiscord<victory> https://media.discordapp.net/attachments/371759389889003532/1008772280551211028/unknown.png
16:22:41*ixmpp quit (Quit: Gateway shutdown)
16:37:52FromDiscord<treeform> The choosenim Nim I got is x86 not arm m1 native.
16:38:11FromDiscord<answer> hm
16:38:34FromDiscord<treeform> It's probably fine, with flags you can make arm binaries
16:39:04FromDiscord<treeform> They run 10-20% faster, but that is bout it
16:39:21FromDiscord<answer> oh so is mine, but i think it would use the arm C compiler in the end anyway (i hope)? uhh... experimenting
16:40:02FromDiscord<treeform> No x86 Nim will make x86 binaries
16:40:10FromDiscord<answer> oh darn
16:40:24FromDiscord<treeform> But you can tell it to make arm64 binaries
16:40:52FromDiscord<treeform> Or make both and use lipo tool to glue them together for a universal binary
16:41:30FromDiscord<treeform> M1 build steps are more complex
16:41:58FromDiscord<answer> maybe im lucky but https://media.discordapp.net/attachments/371759389889003532/1008777582172438565/Screen_Shot_2022-08-15_at_12.41.18_PM.png
16:42:41FromDiscord<treeform> Oh you do get arm64 neat
16:42:58FromDiscord<answer> i wanna look into lipo tool actually that sounds neat
16:43:18FromDiscord<treeform> It's very easy to use
16:44:00FromDiscord<treeform> https://github.com/treeform/pixie/blob/5f4c15c45c28b1e28439ebb47b1616ef83b3ca11/pixie.nimble#L24
16:44:06FromDiscord<treeform> This is what we do
16:44:20FromDiscord<answer> ah thanks
16:45:24FromDiscord<treeform> And you can see the flags you need
16:45:56FromDiscord<treeform> No matter what your Nim is, you can cross compile to arm or x86
16:47:22FromDiscord<answer> oh i don't know if you know but do you have a link to the reference for the nimble file functions? trying to find what things like `compile` do exactly
16:47:28FromDiscord<answer> (edit) "do" => "does"
16:47:52FromDiscord<treeform> Well compile is defined 3 lines above
16:47:59FromDiscord<answer> oh im
16:48:01FromDiscord<answer> lol sorry
16:49:01FromDiscord<treeform> It makes a long line of flags
17:04:03*rockcavera quit (Ping timeout: 244 seconds)
17:27:38FromDiscord<Knedlik> In reply to @dom96 "You might have better": I think the problem is an aarch64 gcc
17:28:06FromDiscord<Knedlik> Currently installing x86 homebrew
17:29:30*rockcavera joined #nim
17:29:30*rockcavera quit (Changing host)
17:29:30*rockcavera joined #nim
17:38:41FromDiscord<Yardanico> a guy in the telegram chat just hit https://github.com/nim-lang/Nim/issues/10425
17:38:56FromDiscord<Yardanico> it's kind of a weird issue really, and newbies might get bitten hard by it
17:39:04FromDiscord<Yardanico> the problem is that `>` is a template so it doesn't honor the order of evaluation
17:39:20FromDiscord<Yardanico> @flywind do you know if it would hurt to make it a builtin (well, that'll require more compiler code), or at least an inline proc?
17:42:57FromDiscord<enthus1ast> regarding the recent "avoid gravatar in the forum", thread. It inspired me to played with pixie a little http://nimvatar.sn0re.code0.xyz/
17:47:10FromDiscord<Yardanico> I mean, my ircord uses gravatar API for that as well, but it just uses the hashes of nicknames
17:47:24FromDiscord<Yardanico> that's the thing - you don't have to use emails to hash if you don't care about users having the same avatar as they have on gravatar
17:47:28FromDiscord<Yardanico> you can hash whatever
17:47:31FromDiscord<enthus1ast> i just wanted to generate nice images with nim \:)
17:47:37FromDiscord<Yardanico> but yeah, very cool :)
17:47:49FromDiscord<Yardanico> maybe a bit higher res would be nicer
17:48:11FromDiscord<enthus1ast> it runs at home, you have near to 0 upload in germany
17:49:00FromDiscord<Yardanico> oh
18:32:12FromDiscord<!Patitotective> In reply to @enthus1ast "regarding the recent "avoid": really cool
18:32:14*kenran joined #nim
18:33:39FromDiscord<Phil> sent a code paste, see https://play.nim-lang.org/#ix=47HP
18:35:19FromDiscord<Phil> I can't just do `testament -d:normDebug run`, that just gives me a response in my terminal that I'm doing it wrong
18:37:37FromDiscord<domosokrat> Try `command: -d:normDebug`
18:37:56FromDiscord<domosokrat> That should result in the container running `testament run -d:normDebug`
18:38:55FromDiscord<domosokrat> But this will override a CMD that the Dockerfile defines
18:41:53FromDiscord<domosokrat> Sorry, I might have misunderstood your question. Is it about passing options to testament, or about how to do that with a docker-compose file?
18:45:14FromDiscord<Phil> Basically both. I'm not sure whether testament can even deal with "defines" for one, and for the other I'm trying to figure out how to (if testament CAN deal with defines) add that flag to the testament run command in the docker compose file
18:45:39FromDiscord<Phil> I'm currently just copy pasting the test into a playground project at this point to get a look at the failing sql statement
18:45:50FromDiscord<Phil> (edit) "failing sql statement" => "logs"
18:45:53FromDiscord<enthus1ast> @Phil\: you can use cmd\: in the test
18:46:12FromDiscord<enthus1ast> In the testfile
18:46:16FromDiscord<enthus1ast> https://nim-lang.org/docs/testament.html
18:47:11FromDiscord<enthus1ast> So for different defines I guess you must create multiple test files
18:50:19FromDiscord<rolha> Hi everyone. I've started out a Nim (Nimble) project to learn it and it grew a bit over the last months. I should really split it, but at the moment I just wanted to build different binaries and install them in different places, etc. Is Nimble suited for this? I don't mind using something else, like Makefiles if it's easier.
18:50:23FromDiscord<qb> How would I cast `@[77, 0, 97, 0, 114, 0, 111, 0, 111, 0, 110, 0]` to a not null terminated string `Maroon`?
18:52:13FromDiscord<enthus1ast> I guess just casting to string does not work
18:52:44FromDiscord<enthus1ast> Is this a wide string?
18:53:17FromDiscord<qb> Um, maybe? πŸ˜„
18:53:50FromDiscord<enthus1ast> rolha\: in nimble you can define tasks, this tasks run nimscript, there you can copy your stuff around
18:54:33FromDiscord<enthus1ast> Also to just copy them to the nimble dir on install create the nimble file as "application"
18:54:53FromDiscord<rolha> enthus1ast\: nice, thanks. That seems to be what I need. It's not a "proper" app, more like a loose collections of utils
18:55:41FromDiscord<enthus1ast> So you just wanna be able to call them?
18:57:32FromDiscord<rolha> It's a homegrown personal use util collection, so I might want `foo` in `/usr/local/bin` and `bar` in some other place etc... but I wanted to be able to put the build scripts in one place. A Makefile would be my first choice, but if I can do everything with Nim (nimble) it's better for learning it.
18:57:53FromDiscord<enthus1ast> sent a long message, see http://ix.io/47HX
18:58:17FromDiscord<enthus1ast> Yeah then I would use nimble
18:59:21*kenran quit (Quit: WeeChat info:version)
19:00:18FromDiscord<enthus1ast> Ahem, so both is nimble \:) ↡Either tasks or bin (I'm a slow typer on mobile)
19:03:01FromDiscord<domosokrat> sent a code paste, see https://play.nim-lang.org/#ix=47HZ
19:04:06FromDiscord<domosokrat> No casting needed, only conversion
19:10:27*jmdaemon joined #nim
19:11:25FromDiscord<dom96> In reply to @enthus1ast "Then I guess the": this is the way
19:15:16*jmd_ joined #nim
19:16:17*jmdaemon quit (Ping timeout: 252 seconds)
19:27:11*jmdaemon joined #nim
19:27:58*jmd_ quit (Ping timeout: 268 seconds)
19:38:03*LuxuryMode quit (Quit: Connection closed for inactivity)
19:44:56FromDiscord<Zeantar> sent a code paste, see https://play.nim-lang.org/#ix=47I9
19:53:14*jmd_ joined #nim
19:53:23*jmdaemon quit (Ping timeout: 256 seconds)
20:17:39*wallabra joined #nim
20:26:15FromDiscord<pruno> sent a code paste, see https://play.nim-lang.org/#ix=47Ii
20:35:10*xet7 quit (Quit: Leaving)
20:35:27*xet7 joined #nim
20:39:35*wallabra quit (Quit: ZNC 1.8.2 - https://znc.in)
20:41:27*wallabra joined #nim
20:42:10NimEventerNew thread by Rishavs: Why is db_postgres so slow?, see https://forum.nim-lang.org/t/9374
20:44:25FromDiscord<Forest> What would be a good Nim library to look into for making a chat app?
20:44:28FromDiscord<Forest> Not chat app
20:44:30FromDiscord<Forest> Chat bot
20:55:02FromDiscord<Forest> Nevermind, mind settled on a different project
20:58:41FromDiscord<tandy> just kidding
20:58:44FromDiscord<tandy> oh do u mean an AI chat bot?
20:58:44FromDiscord<tandy> matrix-nim-sdk \:\>)↡(@Forest)
20:59:10FromDiscord<Forest> In reply to @tandy "oh do u mean": Yeah aha
20:59:14FromDiscord<Forest> In reply to @tandy "matrix-nim-sdk \:\>) (<@909883978717204561>)": Pfff
21:03:07FromDiscord<!Patitotective> https://github.com/nim-lang/nimbot :p
21:03:29FromDiscord<enthus1ast> a api hook detours the execution to another function.↡(@pruno)
21:03:32FromDiscord<enthus1ast> @pruno\: this means the original function is not called any more, but most hooking libs create a trampolin which is a helper function that contains the stolen bytes of the orginal function, then it jumps to the rest of the orginal code
21:03:36FromDiscord<enthus1ast> so in short, you must call the trampolin the minhook can create for you, in your replacement function
21:03:49FromDiscord<enthus1ast> the minhook nim wrapper has a nice pragma for this already
21:04:38FromDiscord<pruno> In reply to @enthus1ast "the minhook nim wrapper": I see, gonna try that, thanks for the info ! :)
21:05:05*xet7 quit (Quit: Leaving)
21:05:26*xet7 joined #nim
21:06:52FromDiscord<enthus1ast> i've written a simple (in terms of stupid) amd64 hooking lib in nim, maybe its interesting for you\: https://github.com/enthus1ast/nimhook
21:07:17FromDiscord<enthus1ast> stupid because it cannot decompile
21:08:32FromDiscord<enthus1ast> and would break some functions, when theyre not large enough
21:08:32FromDiscord<enthus1ast> and cut instructions in half
21:10:21FromDiscord<treeform> In reply to @enthus1ast "regarding the recent "avoid": Looks great.
21:10:52FromDiscord<enthus1ast> @treeform\: i was wondering how i can set the color of the font
21:10:54FromDiscord<Forest> What's a pure Nim websocket client library for Nim that can be compiled to JS? `ws`?
21:12:27FromDiscord<enthus1ast> @Forest\: imho the one karax uses
21:12:54FromDiscord<Forest> Thanks!
21:13:23FromDiscord<enthus1ast> https://github.com/karaxnim/karax/blob/12b98b2338a5cfb11f89e4fdba7e6b7b65038549/karax/jwebsockets.nim
21:14:13FromDiscord<Forest> Huh, they also have `ws` in the nimble file
21:14:31FromDiscord<enthus1ast> @treeform\: i thought fillStyle and strokeStyle but somehow it was not working
21:15:11FromDiscord<treeform> In reply to @enthus1ast "<@107140179025735680>\: i was wondering": You can set the color on the font, see: https://github.com/treeform/pixiebook/blob/master/tutorial.md#for-websites
21:15:32FromDiscord<treeform> sent a code paste, see https://play.nim-lang.org/#ix=47IA
21:16:32FromDiscord<treeform> In reply to @Forest "What's a pure Nim": I have a stub here: https://github.com/treeform/jsutils/blob/master/src/jsutils/websockets.nim
21:17:17FromDiscord<enthus1ast> ok with readFont, i use the font i set in the ctx
21:17:23FromDiscord<treeform> you can't have ws work in javascript because async does not work in javascript
21:18:08FromDiscord<treeform> In reply to @enthus1ast "ok with readFont, i": strange ctx.fillStyle should work
21:18:21FromDiscord<treeform> can you file a bug with minimal example?
21:18:43FromDiscord<enthus1ast> i tried a few things could be that i misused it
21:18:59FromDiscord<enthus1ast> when its is not working ill file a bug
21:19:12FromDiscord<treeform> it sets it right here: https://github.com/treeform/pixie/blob/master/src/pixie/contexts.nim#L212
21:21:54FromDiscord<treeform> we even have a test for it:
21:21:55FromDiscord<treeform> https://github.com/treeform/pixie/blob/4a8894b6649bca8d5c9154caa33885bd65cd2928/tests/contexts/clip_text.png
21:22:21FromDiscord<treeform> https://github.com/treeform/pixie/blob/4a8894b6649bca8d5c9154caa33885bd65cd2928/tests/test_contexts.nim#L475
21:25:16FromDiscord<Forest> In reply to @treeform "I have a stub": Ah nice! And it'll just work? How do i import it aha
21:25:27FromDiscord<enthus1ast> @treeform\: yep it works
21:25:44FromDiscord<enthus1ast> don't know what i have done
21:26:32FromDiscord<treeform> In reply to @Forest "Ah nice! And it'll": It's currently not in nimble, just copy the file into your source tree.
21:26:44FromDiscord<Forest> Ah okay, thanks!
21:27:10FromDiscord<treeform> its pretty easy to wrap the JS apis you need.
21:29:03FromDiscord<Forest> To basically just replace stuff that's found in the web/NodeJS?
21:33:54FromDiscord<kevin> hey all, I'm trying to do something I probably should not in Nim, which is making a single file object file (`.o`) which contains all of the Nim dependent symbols (from libraries such as stdlib/io or strformat)
21:34:43FromDiscord<enthus1ast> @kevin\: can you not do a staticlib ?
21:35:04FromDiscord<kevin> does anyone know how to create something like this? I imagine you'd have to do the linking together of `-relocatable` object files yourself with `ld` or `collect2` after the Nim compile with `--noLinking=on` flag enabled
21:35:20FromDiscord<kevin> is that a thing? I am not really familiar
21:35:59FromDiscord<enthus1ast> yes you can do a static lib, and just link it with other stuff
21:36:14FromDiscord<treeform> yeah it sounds like you want a static lib
21:36:18FromDiscord<kevin> is there info somewhere on how to do that?
21:36:52FromDiscord<enthus1ast> --app\:staticlib
21:37:02FromDiscord<treeform> ^ from https://nim-lang.org/docs/nimc.html
21:37:31FromDiscord<kevin> hmm, I am trying to create an object file (`.o`), would `--staticlib` create a `.lib` file? (Assuming windows)
21:37:38FromDiscord<enthus1ast> yes
21:37:42FromDiscord<kevin> 😦
21:37:49FromDiscord<kevin> i need an object file specifically
21:37:59FromDiscord<treeform> nim creates a `.o` per each .nim file
21:38:06FromDiscord<treeform> you want a single `.o` file?
21:38:29FromDiscord<kevin> but with the other Nim deps (stdlib system, stdlib io, stdlib digitsutils, etc) linked in
21:39:01FromDiscord<treeform> you probably need to take all of the `.o` files and https://stackoverflow.com/questions/2980102/combine-two-gcc-compiled-o-object-files-into-a-third-o-file
21:39:17FromDiscord<treeform> I don't see how that is desirable
21:39:19FromDiscord<kevin> I've looked at the Nimcache C code, and yes, looks like it makes one object file per Nim file
21:40:14FromDiscord<kevin> In reply to @treeform "I don't see how": basically there are ways to do "dynamic linking" of object files and run them like executables
21:40:18FromDiscord<treeform> but a combination of `.o` files is usually what a `.lib` files is...
21:40:34FromDiscord<kevin> so I am trying to create a Nim object file that can be used like that
21:40:47FromDiscord<treeform> In reply to @kevin "basically there are ways": object files don't run?
21:41:04FromDiscord<kevin> In reply to @treeform "object files don't run?": https://github.com/frkngksl/NiCOFF 🀷
21:42:12FromDiscord<treeform> "but why?"
21:42:30FromDiscord<treeform> I think you can glue multiple .o together into a single .o file.
21:42:35FromDiscord<treeform> with the gcc linker
21:43:25FromDiscord<kevin> In reply to @treeform ""but why?"": Because I want to be able to write code in Nim that works with this object file loader/runner
21:43:32FromDiscord<kevin> as of right now I only know how to do it in C
21:45:11FromDiscord<kevin> In reply to @treeform "I think you can": Yes, I tried using `collect2` and `ld` from mingw directly with the `-relocatable` flag to take multiple object files as input and output yet another object file
21:46:03FromDiscord<kevin> Even still, not all symbols I need are linked in properly. Right now I'm stuck on `image_base` as a symbol that isn't linked in
21:47:05FromDiscord<kevin> Given Nim outputs C code as an intermediate step, I should be able to do anything in Nim that I can do in C. I just don't know how in this case
21:49:05FromDiscord<!Patitotective> doesnt a `.lib` just work?
21:50:12FromDiscord<kevin> no, I think it has to be an object file
21:50:28FromDiscord<!Patitotective> what are you going to use it for?
21:52:03FromDiscord<kevin> specifically used in this Nim project: https://github.com/frkngksl/NiCOFF
21:57:51FromDiscord<kevin> so i did `--app:staticlib` and then used `objdump -t <file>.lib` and that's almost what I want, except instead of many object files bundled into one file, I want one object file with all required symbols linked against it (minus the ones the `.o` loader takes care of)
22:00:25*ixmpp joined #nim
22:00:40FromDiscord<kevin> I'm looking at `strip`. Maybe i can strip out the symbols I don't want
22:16:33*sagax joined #nim
22:17:04FromDiscord<EyeCon> In reply to @enthus1ast "regarding the recent "avoid": The images are beautiful
22:28:40FromDiscord<EyeCon> Do we have somewhere a documentation about how to set up vim with nimsuggest?
22:29:00FromDiscord<Elegantbeef> nim.nvim πŸ˜„
22:30:31FromDiscord<EyeCon> That's neovim, right? I found https://github.com/zah/nim.vim but I was wondering if there's something in the web site that I'm missing or something
22:30:39FromDiscord<victory> is there a way to cancel a `waitFor` statement?
22:31:25FromDiscord<Elegantbeef> Waitfor is blocking so how would you cancel it really
22:31:29FromDiscord<victory> true..
22:31:34FromDiscord<victory> damn
22:31:40FromDiscord<victory> im having issues with anonimongo
22:31:50FromDiscord<victory> `.findOne()` is stopping practically forever
22:31:54FromDiscord<victory> (edit) removed "practically"
22:37:37FromDiscord<!Patitotective> you can "cancel it" (more like don't wait for it) if you're on a loop checking if it finished and just break the loop
22:41:56FromDiscord<!Patitotective> actually https://nim-lang.org/docs/asyncfutures.html#complete%2CFuture%5Bvoid%5D
22:46:24FromDiscord<Rainbow Asteroids> sent a code paste, see https://play.nim-lang.org/#ix=47IN
22:47:07FromDiscord<Rainbow Asteroids> You'll also need to install nimlsp from nimble
22:51:04FromDiscord<dom96> In reply to @Patitotective "you can "cancel it"": don't do that :)
22:51:27FromDiscord<dom96> if you want to cancel an operation just close the FD it's running on
22:55:57FromDiscord<Rainbow Asteroids> In reply to @enthus1ast "regarding the recent "avoid": no https 😱
22:56:31FromDiscord<Elegantbeef> Enthus is stealing all your important information
22:56:41FromDiscord<Rainbow Asteroids> lol
22:57:00FromDiscord<Rainbow Asteroids> my browser is configured to yell at me anytime I visit an unencrypted site
22:57:32FromDiscord<Elegantbeef> Well dont type your credit card info there
22:57:34FromDiscord<!Patitotective> In reply to @Elegantbeef "Enthus is stealing all": i prefer him to do that instead of google
22:57:38FromDiscord<Rainbow Asteroids> there's no reason not to have an HTTPS site with free certs from lets encrypt
22:57:45FromDiscord<!Patitotective> In reply to @Rainbow Asteroids "my browser is configured": mine to
22:57:56FromDiscord<Rainbow Asteroids> In reply to @Elegantbeef "Well dont type your": i generated an avatar with my SSN, what do i do
22:57:57FromDiscord<!Patitotective> (edit) "to" => "too"
22:58:18FromDiscord<!Patitotective> send the immage
22:58:19FromDiscord<!Patitotective> (edit) "immage" => "image"
22:58:40FromDiscord<Rainbow Asteroids> https://media.discordapp.net/attachments/371759389889003532/1008872381147791460/unknown.png
22:58:52FromDiscord<Elegantbeef> Tear down then IRS cause SSN are not supposed to be used as they are↡(@Rainbow Asteroids)
22:59:31FromDiscord<Rainbow Asteroids> tear down the irs!🏴
23:00:03FromDiscord<Elegantbeef> NA's taxes are fucked anyway so let's do it
23:00:11FromDiscord<Rainbow Asteroids> although, it's all the institutions that use SSNs, not just the IRS
23:00:37FromDiscord<!Patitotective> In reply to @Rainbow Asteroids "": they hashed it :p
23:00:58FromDiscord<Rainbow Asteroids> damn image hash
23:01:15FromDiscord<Elegantbeef> All your ID belong to us now
23:01:36FromDiscord<Rainbow Asteroids> they brought down cs;go 😭
23:02:01FromDiscord<Rainbow Asteroids> now i have to go back to programming in nim
23:03:05FromDiscord<Elegantbeef> Its ok you can derank later
23:03:37FromDiscord<Rainbow Asteroids> silver 3, on the road to silver 1
23:04:00FromDiscord<Elegantbeef> The rank change didnt make you a GE?
23:05:43FromDiscord<Rainbow Asteroids> i started playing cs;go again like last week. going from silver 1 to silver 3 is the rank change making it easier
23:05:47FromDiscord<EyeCon> In reply to @Rainbow Asteroids "https://github.com/neovim/nvim-lspconfig install th": Thank you, but is that neovim or does that also work for plain vim?
23:06:50FromDiscord<Rainbow Asteroids> that's neovim. plain vim is on the nimlsp readme: https://github.com/PMunch/nimlsp
23:06:57FromDiscord<EyeCon> Thanks!
23:12:50FromDiscord<EyeCon> sent a code paste, see https://play.nim-lang.org/#ix=47IT
23:14:38FromDiscord<EyeCon> I'll see what I can do, but I don't have much hope
23:17:29FromDiscord<Rainbow Asteroids> that seems weird. stew is not a dependency of nimlsp
23:18:33FromDiscord<EyeCon> Wait, my mistake, that was nimlangserver nor nimlsp
23:18:56FromDiscord<EyeCon> (edit) "nor" => "not"
23:19:01FromDiscord<Rainbow Asteroids> nimlangserver requires a specific version of nim iirc
23:20:00FromDiscord<EyeCon> I was trying too many things at the same time
23:22:02FromDiscord<EyeCon> Whew, it seems to work now
23:22:04FromDiscord<EyeCon> Thanks a lot