<< 13-04-2023 >>

00:22:17*rockcavera quit (Read error: Connection reset by peer)
00:23:04*rockcavera joined #nim
00:23:04*rockcavera quit (Changing host)
00:23:04*rockcavera joined #nim
00:27:52*derpydoo joined #nim
00:47:34*hochata quit (Ping timeout: 252 seconds)
00:54:58*nanxiao joined #nim
01:34:05FromDiscord<Nilts> Anyone here have a good answer for me second to last question? https://forum.nim-lang.org/t/10078
01:35:10FromDiscord<Elegantbeef> `optHighlight in c.options`
01:35:14FromDiscord<Elegantbeef> Or whateve
01:36:18FromDiscord<Nilts> In reply to @Elegantbeef "`optHighlight in c.options`": It was presented as a compiler flag, that is why i was confused
01:36:27FromDiscord<Nilts> and what is c
01:37:11FromDiscord<Elegantbeef> `config`
01:37:14FromDiscord<Elegantbeef> It's a config
01:37:31FromDiscord<Elegantbeef> Search for `in c.options` or similar in the repository you'll find a reference
01:39:41FromDiscord<Nilts> In reply to @Elegantbeef "`config`": I am still confused, Is it a compiler option? I know how to do it if it is a generator option.
01:41:18FromDiscord<Elegantbeef> It's a compiler option
01:41:24FromDiscord<Elegantbeef> `nim doc` is the compiler still
01:41:34FromDiscord<Nilts> In reply to @Elegantbeef "`nim doc` is the": I am not using nim doc
01:41:35FromDiscord<Elegantbeef> You need to add the option and handle it afaik
01:42:34FromDiscord<Elegantbeef> Oh this is for rstgen
01:42:55FromDiscord<Nilts> In reply to @Elegantbeef "Oh this is for": yes, ig that is why what you are saying is confusing
01:43:32FromDiscord<Elegantbeef> No clue then what araq means
01:44:28FromDiscord<Nilts> In reply to @Elegantbeef "No clue then what": Just have to wait
01:44:36*lucasta quit (Remote host closed the connection)
01:44:46FromDiscord<Nilts> Although there is no notifications system on nimforum so it will probably get lost
01:44:48FromDiscord<Nilts> (edit) "In reply to @Elegantbeef "No clue then what": Just have to wait ... " added "then"
01:48:17FromDiscord<Elegantbeef> You can always ping him in #internals
01:50:57FromDiscord<Nilts> In reply to @Elegantbeef "You can always ping": I generally refrain from pinging mods and idk what i would say
01:51:42FromDiscord<Elegantbeef> "I'm completely lost what you mean, could you please elaborate what you mean by --highlite\:off, do you mean a `-d:nimRstGenHighlite:off`?"
01:52:09FromDiscord<Elegantbeef> And i thought I was bad at human interaction
01:52:32FromDiscord<Nilts> In reply to @Elegantbeef "And i thought I": do you have anxiety?
01:52:42FromDiscord<Nilts> In reply to @Elegantbeef ""I'm completely lost what": and can I copy that
01:56:17FromDiscord<Elegantbeef> Nah i only wrote it to mock you and not provide any help in generating a sentence, remember i'm a glorified GPT
01:56:22FromDiscord<Elegantbeef> If you use that you will hear from my nonexistent lawyers
02:04:08*nanxiao quit (Quit: Client closed)
02:07:54*nanxiao joined #nim
02:36:29*arkurious quit (Quit: Leaving)
03:04:02FromDiscord<Mr Gandolfio> This was an interesting interaction
03:08:38FromDiscord<Elegantbeef> Thanks i try
03:17:46*cyraxjoe quit (Ping timeout: 250 seconds)
03:18:17*cyraxjoe joined #nim
03:37:52*nanxiao quit (Quit: Client closed)
04:17:24*cm quit (Quit: Bye.)
04:17:51*cm joined #nim
05:22:44*rockcavera quit (Remote host closed the connection)
05:47:35FromDiscord<Dudugz> lol
05:48:01*m5zs7k quit (Ping timeout: 265 seconds)
05:49:01*m5zs7k joined #nim
05:49:34FromDiscord<Dudugz> sent a code paste, see https://play.nim-lang.org/#ix=4tjw
05:54:20FromDiscord<Dudugz> sent a code paste, see https://paste.rs/bnF
05:54:32FromDiscord<Elegantbeef> Nope
05:57:12FromDiscord<Elegantbeef> Async is non blocking assuming you have a some sort of `await` or similar place in your code to give up your cpu
05:57:26FromDiscord<Arathanis> async is cooperative multitasking
05:57:43FromDiscord<Arathanis> await = someone else can run (maybe)
06:14:54FromDiscord<Arathanis> with taht said, how would you kick off parallel tasks in nim's async and then wait for the collection of futures?
06:15:15FromDiscord<Arathanis> (edit) "async" => "asyncdispatch"
06:15:21FromDiscord<Arathanis> (edit) "futures?" => "futures to complete?"
06:16:51FromDiscord<Rika> you call the procs that give futures without await, store their values into a seq (lets call it `futures`), and then after that you do `await all futures`
06:16:59FromDiscord<Rika> thats the code yes, `await all futures`
06:17:12FromDiscord<Arathanis> all must be a proc or something?
06:17:14FromDiscord<Rika> yes
06:17:20FromDiscord<Rika> i think its in asyncfutures
06:17:22FromDiscord<Rika> the module
06:17:28FromDiscord<Rika> which is exported by asyncdispatch
06:17:29FromDiscord<Arathanis> `await(all(futures))`
06:17:32FromDiscord<Rika> yes
06:17:38FromDiscord<Arathanis> but since nim
06:17:39FromDiscord<Rika> it reads real nice lol
06:17:43FromDiscord<Arathanis> we can omit the ugly characters
06:20:26FromDiscord<Arathanis> thank you @Rika
06:20:56FromDiscord<Arathanis> sent a code paste, see https://play.nim-lang.org/#ix=4tjF
06:21:05FromDiscord<Arathanis> output: https://media.discordapp.net/attachments/371759389889003532/1095956810848018452/image.png
06:21:11*azimut quit (Ping timeout: 255 seconds)
06:21:37FromDiscord<Arathanis> basically when a task is awaited control is given to the event loop which can choose to run a different task
06:21:54FromDiscord<Arathanis> await "freezes" the current task (async procedure) and gives control back to the event loop
06:22:32FromDiscord<Arathanis> so its cooperative multitasking, you have to explicitly return control to the event loop, cause until you do you are in that execution path
06:22:43FromDiscord<Arathanis> the idea is that when you make a system call to perform some kind of IO
06:22:47FromDiscord<Arathanis> the Os is actually doing that
06:22:54FromDiscord<Arathanis> so you can run other tasks while waiting on the OS to make that call
06:23:12FromDiscord<Arathanis> (edit) "make" => "execute" | "call" => "system call, like writing to a file"
06:23:36FromDiscord<Dudugz> lol i know how async works tho. That's not the point, if you make an async function in Javascript with an infinite while loop and call the function it won't block the rest of the code. In Nim doing what I demonstrated above blocks, echo will never be executed
06:23:54FromDiscord<Arathanis> that's because javascript is always async all the time
06:24:19FromDiscord<Arathanis> you have to set up that boilerplate yourself in nim
06:24:24FromDiscord<Arathanis> ie: put the echo in a different task
06:24:28FromDiscord<Arathanis> and explicitly call it
06:25:06FromDiscord<Dudugz> It's not... Javascript runs in a separate thread yes but async is a feature that came with ES6, if you don't create a module type script it will continue to work synchronously
06:26:52FromDiscord<Dudugz> But I understand, in this case I would have to use threads to be non-blocking? Because asyncCheck in theory should already execute the asynchronous function without blocking
06:27:20FromDiscord<Elegantbeef> I mean the issue is purely your while loop doesnt give up the cpu
06:27:29FromDiscord<Dudugz> Hm
06:27:32FromDiscord<Arathanis> when you call asyncCheck it gives the main thread over to the event loop
06:27:48FromDiscord<Arathanis> and wont terminate until that event loop closes, which is when the future returned by the task you called is complete
06:28:40FromDiscord<Elegantbeef> The way Nim's async work is when you do `await`, `waitFor`, `poll`, or any other operations that do it, you give up the cpu to work on other operations
06:28:47FromDiscord<Dudugz> Hm, is there an efficient way to make an infinite loop without blocking then?
06:28:56FromDiscord<Elegantbeef> So if you have a empty while loop there is no way to go back to your main thread
06:29:05FromDiscord<Arathanis> add "await sleepAsync(0)" to give control back to the event loop
06:29:14FromDiscord<Dudugz> In reply to @Elegantbeef "The way Nim's async": Got it, in this case the while loop will hold the cpu forever
06:29:19FromDiscord<Elegantbeef> Yes
06:29:26FromDiscord<Elegantbeef> I say main thread but i mean main body
06:29:34FromDiscord<Arathanis> you have to multitask "cooperatively"
06:30:04FromDiscord<Dudugz> Sure, i'll try. Thanks :3
06:31:01FromDiscord<Arathanis> take a look at my example above, it kicks off two loops that could be infinite
06:31:22FromDiscord<Arathanis> and they both run cooperatively cause they both give control back to the event loop with an await during each loop body
06:33:28FromDiscord<Arathanis> sent a code paste, see https://play.nim-lang.org/#ix=4tjI
06:33:46FromDiscord<Dudugz> Got it, 0 would do it too, right?
06:33:49FromDiscord<Arathanis> yes
06:34:01FromDiscord<Dudugz> Thx 😁
06:34:03FromDiscord<Arathanis> np
06:34:53FromDiscord<⚶ Zeno> In reply to @Rika "thats the code yes,": i didnt expect that code to be that self explanatory, damn
06:35:28FromDiscord<Arathanis> In reply to @Dudugz "Thx 😁": also if we want to be explicit and just generally cool you can do silly things like this
06:35:41FromDiscord<Arathanis> sent a code paste, see https://play.nim-lang.org/#ix=4tjJ
06:35:53FromDiscord<Arathanis> 😎
06:36:09FromDiscord<Dudugz> Yeah but no lol, it's just an unnecessary syntactic sugar
06:36:21FromDiscord<Arathanis> it most certainly is
06:36:37FromDiscord<Elegantbeef> Cant you do `await Future[void]()`... hmm
06:37:12FromDiscord<Elegantbeef> I do not use async so i'm uncertain
06:37:31FromDiscord<Dudugz> But wouldn't you have to create a future that completes immediately? It's basically sleepAsync(0)
06:37:37FromDiscord<Arathanis> sent a code paste, see https://play.nim-lang.org/#ix=4tjL
06:37:48FromDiscord<Elegantbeef> cant you also do `poll(0)`
06:37:58FromDiscord<Arathanis> (edit) "https://play.nim-lang.org/#ix=4tjL" => "https://play.nim-lang.org/#ix=4tjM"
06:37:59FromDiscord<Dudugz> I think so
06:38:05FromDiscord<Arathanis> also i wonder if i could port `trio` to nim đŸ€”
06:38:09FromDiscord<Arathanis> call it `trion`
06:39:30FromDiscord<Elegantbeef> trio?
06:39:43FromDiscord<Arathanis> In reply to @Elegantbeef "trio?": https://trio.readthedocs.io/en/stable/
06:41:22FromDiscord<Dudugz> I'm surprised that Beef doesn't use async >.> I mean, it's important for a lot of things.
06:41:35FromDiscord<Elegantbeef> Not so much for simple games or macros
06:42:09FromDiscord<Dudugz> Hmm, indeed for this kind of thing it doesn't really help
06:43:07FromDiscord<Elegantbeef> Not to say one cannot use io loading of assets and the like, but my game loads fast cause everything is so small
06:44:45FromDiscord<Dudugz> yea i think for bigger games the best strategy is to use async to load the files.
06:45:07FromDiscord<Dudugz> I like to mess around with networking a lot so async is always welcome
06:51:06*PMunch joined #nim
06:57:56*nanxiao joined #nim
07:28:59FromDiscord<Rika> In reply to @Arathanis "also i wonder if": i tried
07:29:04FromDiscord<Rika> it needs a lot of work
07:30:35FromDiscord<Arathanis> In reply to @Rika "it needs a lot": our port does?
07:30:41FromDiscord<Rika> trio?
07:30:43FromDiscord<Rika> what?
07:30:51FromDiscord<Arathanis> (edit) "our" => "your"
07:30:53FromDiscord<Arathanis> sorry
07:30:53FromDiscord<Rika> porting trio would need a lot of work
07:30:55FromDiscord<Arathanis> missed a "y"
07:31:00FromDiscord<Arathanis> new keyyboard
07:31:01FromDiscord<Rika> to do properly
07:31:03FromDiscord<Arathanis> (edit) "keyyboard" => "keyboard"
07:31:08FromDiscord<Rika> i only looked at what was needed to port
07:31:23FromDiscord<Rika> i didnt write much code yet on the idea
07:31:26FromDiscord<Arathanis> yeah it would need a lot
07:31:31FromDiscord<Arathanis> good on you for at least attempting
07:31:34FromDiscord<Arathanis> i love trio's interface
07:31:39FromDiscord<Rika> i do too
07:31:50FromDiscord<Arathanis> it's my favorite ive seen so far
07:31:56FromDiscord<Arathanis> solidarity 👊
07:56:07FromDiscord<morgan> is there a way to have a type that contains an array and define that array at compile time? i might end up using a seq idk
07:56:50FromDiscord<morgan> not even sure i need a separate type actually
07:57:03FromDiscord<morgan> haven't started on the code yet
07:57:10FromDiscord<morgan> been working on the math
07:58:43FromDiscord<demotomohiro> In reply to @MorganAlyssa "is there a way": Something like `Foo[T: static[array[2, int]]]`?
07:59:18FromDiscord<morgan> oh as a generic
07:59:23FromDiscord<morgan> i hadn't thought of that
08:05:10FromDiscord<morgan> i might just use one big array, since i'd have an array of these smaller arrays
08:05:23FromDiscord<morgan> im not sure i'd gain anything from the array of smaller arrays
08:06:09FromDiscord<ringabout> In reply to @Isofruit "Ahhh check, so that": Hopefully it should fix the illegal assignment => https://github.com/nim-lang/Nim/pull/21660
08:06:36FromDiscord<morgan> i've been writing it like that so far, but a lot of the operations involve flipping it around or shifting it over a partial amount so it would probably just get in my way
08:09:25FromDiscord<Phil> In reply to @ringabout "Hopefully it should fix": Just got the mail notification!↔That is super cool, thank you very much!
08:09:36FromDiscord<ringabout> My pleasure
08:09:49FromDiscord<Phil> I love things that prevent me from doing bad things, that's why I'm so happy about this
08:10:27*nanxiao quit (Quit: Client closed)
08:10:31FromDiscord<Elegantbeef> Now if only it did it at compile time
08:12:30FromDiscord<Phil> In reply to @Elegantbeef "Now if only it": Isn't that being done at compile time?
08:12:39FromDiscord<Phil> Ah, runtime defect
08:13:20FromDiscord<System64 ~ Flandre Scarlet> Are seqs passed by reference or by copy?
08:14:39FromDiscord<Elegantbeef> by ref
08:14:51FromDiscord<System64 ~ Flandre Scarlet> Ah alright
08:14:51FromDiscord<Elegantbeef> Actually by copy
08:15:13FromDiscord<Elegantbeef> But it doesnt matter cause the data they point to is heap allocated
08:15:15FromDiscord<System64 ~ Flandre Scarlet> Oh wait↔That means if there is 2000 items, it will copy all 2000 items?
08:15:38FromDiscord<System64 ~ Flandre Scarlet> Like for example↔A seq of uint32
08:15:39FromDiscord<Elegantbeef> No
08:15:49FromDiscord<Elegantbeef> cause a sequence is not stack allocated
08:16:16FromDiscord<System64 ~ Flandre Scarlet> Oh alright↔It is the case in C too I think
08:17:58FromDiscord<Elegantbeef> Nim really doesnt make you have to think if something is passed by ref or copy
08:18:31FromDiscord<huantian> cow strings when
08:18:35FromDiscord<System64 ~ Flandre Scarlet> so I just pass the value, and Nim manages it for me?
08:19:30FromDiscord<Elegantbeef> You pass a sequence and cause a sequence is `len: int, data: ptr` it's fine
08:19:46FromDiscord<System64 ~ Flandre Scarlet> Oh alright
08:20:17FromDiscord<Elegantbeef> Nim literals are COW so checkmate↔(@huantian)
08:20:35FromDiscord<System64 ~ Flandre Scarlet> what are COW strings 🐼 🐄
08:28:49FromDiscord<Rika> Copy on write
08:29:02FromDiscord<Rika> The data is only duplicated or copied when a write is made
08:30:23FromDiscord<System64 ~ Flandre Scarlet> Isn't it a bit heavy?
08:32:15FromDiscord<Rika> What do you mean
08:33:37*fredrikhr joined #nim
08:37:17FromDiscord<System64 ~ Flandre Scarlet> seems it's a lot of reallocation
08:42:52FromDiscord<ringabout> sent a code paste, see https://paste.rs/P5h
08:45:22FromDiscord<System64 ~ Flandre Scarlet> Shouldn't it be ref object of RootObj instead of object of?
08:46:37FromDiscord<huantian> I see no reason why not, how would you make it not work↔Ig just once it becomes a value it can’t be casted anymore?
09:03:01FromDiscord<demotomohiro> Copying only base object part from inherited object can cause problem?
09:03:12*cm quit (Ping timeout: 255 seconds)
09:04:30*nanxiao joined #nim
09:07:04FromDiscord<sOkam!> sent a code paste, see https://play.nim-lang.org/#ix=4tk6
09:07:29FromDiscord<sOkam!> (edit) "https://play.nim-lang.org/#ix=4tk6" => "https://play.nim-lang.org/#ix=4tk7"
09:09:23FromDiscord<sOkam!> actually no, because the adapter is already an adapter type đŸ€”â†”can i just do `userdata[] = adapter` in nim? would that work?
09:09:56*cm joined #nim
09:10:08FromDiscord<Rika> You can’t dereference a void pointer in Nim
09:11:06FromDiscord<Rika> cast[ptr WGPUAdapter](userdata)[] = adapter
09:11:12FromDiscord<Rika> Would that work I don’t know
09:12:30FromDiscord<sOkam!> is it valid to change the incoming proc to use `ptr WGPUAdapter` instead of `pointer`? would that be compatible with C?
09:16:42FromDiscord<Rika> No lol
09:16:59FromDiscord<Rika> Void pointers are a very very massive exception in C
09:17:09FromDiscord<Rika> Be very very careful with what you do with them
09:19:09FromDiscord<sOkam!> kk
09:20:23*Notxor joined #nim
09:35:25*frenchboy[m] quit (Read error: Connection reset by peer)
09:35:26*jmcantrell quit (Write error: Connection reset by peer)
09:38:06*nanxiao quit (Quit: Client closed)
09:43:31*jmcantrell joined #nim
09:59:13*frenchboy[m] joined #nim
10:06:02FromDiscord<sOkam!> strformat is so conchfuzhing 😔 ↔how would you make it so that this hex formatting becomes 0 padded to 8 total numbers?↔`let thing = &"{someInt:#X}"`
10:09:31FromDiscord<sOkam!> actually, nvm. will use the enum. much cleaner and understandable anyway
10:17:28*frenchboy[m] quit (Ping timeout: 260 seconds)
10:17:28*jmcantrell quit (Ping timeout: 260 seconds)
10:23:09FromDiscord<Yardanico> if you don't want 0x
10:23:11FromDiscord<Yardanico> sent a code paste, see https://play.nim-lang.org/#ix=4tkj
10:23:30FromDiscord<Yardanico> or `X` instead of `x` if you want upper-case letters
10:24:11FromDiscord<Yardanico> also if you really just want to convert a single number to hex, you can just use toHex from strutils, it does the same
10:24:14*frenchboy[m] joined #nim
10:24:20FromDiscord<Yardanico> sent a code paste, see https://play.nim-lang.org/#ix=4tkk
10:26:51FromDiscord<sOkam!> oh true. completely forgot about tohex. tyty
10:38:24*derpydoo quit (Quit: derpydoo)
10:41:35FromDiscord<Arvin❓> quick noob question đŸ™‹â€â™‚ïž, can i use {} and ; in nim like you would in java?
10:42:11Amun-Rayou can use ;
10:43:58FromDiscord<Arvin❓> Can a nim dev verify this information? https://media.discordapp.net/attachments/371759389889003532/1096022961825267805/IMG_0478.jpg
10:46:42Amun-Raidentation is done with spaces and you can't turn that off
10:47:08FromDiscord<Arvin❓> sent a code paste, see https://play.nim-lang.org/#ix=4tkp
10:47:49FromDiscord<Arvin❓> (edit) "https://play.nim-lang.org/#ix=4tkp" => "https://play.nim-lang.org/#ix=4tkq"
10:48:04FromDiscord<Arvin❓> In reply to @Amun-Ra "identation is done with": Oh ok ✅
10:49:37Amun-Rathat text you pasted mantioned parentheses and not curly braces
10:50:01Amun-RaI think they mean something like that: https://play.nim-lang.org/#ix=4tkr
10:50:05FromDiscord<Arvin❓> In reply to @Amun-Ra "that text you pasted": Oh read that wrong
10:50:31Amun-RaI don't know whether you can write that way any code or not
10:51:45Amun-Ras/any/every/
10:53:48FromDiscord<Yardanico> In reply to @Arvin❓ "Can a nim dev": did you get that info from chatgpt?
10:54:03FromDiscord<Yardanico> Nim had a braces syntax skin, but that was a long time ago, it's removed
10:54:09FromDiscord<Yardanico> (edit) "Nim had a braces syntax skin, but that was a long time ago, it's ... removedages" added "been" | "beenremoved ... " added "ages ago"
10:54:18FromDiscord<Arvin❓> In reply to @Yardanico "did you get that": Nah from here: http://www.foxydatascience.com/blog/whats-the-situation-with-the-nim-programming-language-these-days
10:54:35FromDiscord<Arvin❓> In reply to @Yardanico "did you get that": ChatGPT is useless when it comes to Nim
10:54:45FromDiscord<Yardanico> looks like SEO spam to me tbh
10:54:47FromDiscord<Yardanico> a lot of weird nonsensical statements
10:55:18FromDiscord<Yardanico> "As Nim is somewhat closer to C than any other language" because of statements like this
10:55:32FromDiscord<Yardanico> "Nim's compiler is much better, however than that of C and any other low-level language"
10:55:39Amun-RaI can't get on that page from work: Security policy violation - Web Page Blocked; Category: malware :
10:55:41Amun-Ra:>
10:55:49Amun-Ras/on/to/
10:55:52FromDiscord<Yardanico> so yeah, a lot of text without any concrete info
10:55:57FromDiscord<Yardanico> please don't use sources like this
10:56:57FromDiscord<Arvin❓> In reply to @Yardanico "please don't use sources": I actually just got the “Nim in action “ book, I’m guessing that’s a better way of learning about Nim
10:57:11FromDiscord<Yardanico> yes, it's been written a while ago, but almost everything from there is still true
10:57:24FromDiscord<Yardanico> also see https://deepakg.github.io/nim/2019/09/28/nim-in-action-errata.html
10:57:47FromDiscord<Yardanico> <https://github.com/dom96/nim-in-action-code/> and for the code, there's a branch for newer Nim
11:10:36*jmcantrell joined #nim
11:15:14FromDiscord<sOkam!> sent a code paste, see https://play.nim-lang.org/#ix=4tkw
11:16:33Amun-RanewSeq[WGPUTextureFormat](caps.formatCount) etc.
11:18:43Amun-Rayou could alloc that 1 to 1 in nim, but I'd not recomment it
11:18:48FromDiscord<sOkam!> a seq is enough?
11:19:02Amun-Rayes
11:19:31FromDiscord<sOkam!> sent a code paste, see https://paste.rs/jqG
11:19:49FromDiscord<sOkam!> ptr TextureFormat could be a seq?
11:19:54FromDiscord<sOkam!> if yes, thats very handy
11:23:20FromDiscord<sOkam!> sent a code paste, see https://paste.rs/d6m
11:24:19Amun-Rahmm
11:24:54Amun-Raare formats filled by you or by some C function?
11:25:24Amun-Rayou can either test in with seq or make formats: ptr UncheckedArray[TextureFormat]
11:26:24Amun-Raand alloc memory via alloc from std/system
11:27:04FromDiscord<Yardanico> sent a code paste, see https://play.nim-lang.org/#ix=4tky
11:27:27FromDiscord<Yardanico> you can do [0].addr of course, but you still need to store the sequence somewhere so it doesn't get destroyed
11:27:52Amun-Rayes, I was wondering how to make nim not to free that seq
11:28:03Amun-RaI'd go with uncheckedarray
11:29:15FromDiscord<Yardanico> In reply to @Amun-Ra "yes, I was wondering": create a wrapper object and store the sequences there I guess
11:32:19*frenchboy[m] quit (Read error: Connection reset by peer)
11:32:20*jmcantrell quit (Read error: Connection reset by peer)
11:34:23FromDiscord<sOkam!> sent a code paste, see https://play.nim-lang.org/#ix=4tkB
11:35:34Amun-Rathat may work, just mind the life time of the data
11:36:14Amun-Rahmm, newSeqOfCap → newSeq/newSeqUninitialized
11:37:09*jmcantrell joined #nim
11:39:36Amun-RaI think I'd pick UncheckeArray+alloc+dealloc
11:39:39*frenchboy[m] joined #nim
11:45:53FromDiscord<sOkam!> Seems to have worked https://media.discordapp.net/attachments/371759389889003532/1096038542750253206/image.png
11:46:15FromDiscord<sOkam!> i changed it to `newSeqWith` though
11:47:24*Notxor quit (Remote host closed the connection)
11:47:36Amun-Ramhm
12:03:54FromDiscord<xTrayambak> Is there no way to call functions from a function that has a cdecl convention?
12:04:24*azimut joined #nim
12:23:03*advesperacit joined #nim
12:24:49*Notxor joined #nim
12:28:47NimEventerNew post on r/nim by RememberToBackupData: Where/how do you view and search Nim's docs?, see https://reddit.com/r/nim/comments/12knf9f/wherehow_do_you_view_and_search_nims_docs/
12:32:28NimEventerNew question by treeyossy: How can I import python libaray into Nim&#39;s source code?, see https://stackoverflow.com/questions/76005465/how-can-i-import-python-libaray-into-nims-source-code
12:35:16FromDiscord<Yardanico> In reply to @xTrayambak "Is there no way": i don't think that cdecl should affect this at all, can you show the code?
12:36:42FromDiscord<Yardanico> sent a code paste, see https://paste.rs/BrQ
13:08:01*jmdaemon quit (Ping timeout: 240 seconds)
13:09:05*progranner joined #nim
13:31:42*ehmry quit (Quit: https://quassel-irc.org - Chat comfortably. Anywhere.)
13:32:16*ehmry joined #nim
13:35:41FromDiscord<System64 ~ Flandre Scarlet> Is it possible to call Nim code from C?
13:38:15PMunchYes
13:38:33FromDiscord<System64 ~ Flandre Scarlet> And is it unsafe to do this?
13:38:43PMunchDefine unsafe
13:39:11PMunchIs someone going to stab you with a knife if you do it, probably not. Could you mess something up and crash your program, definitely
13:39:27FromDiscord<System64 ~ Flandre Scarlet> For example if GC is enabled↔Is it possible to have memory problems? such as dangling pointers, memory leaks, etc
13:39:34PMunchIs there a way of doing it that doesn't involve crashing your program, also yes
13:39:46PMunchProblems are always possible
13:40:07PMunchBut if you call NimMain and use ARC/ORC then you're probably fine
13:40:08FromDiscord<System64 ~ Flandre Scarlet> ah alright, so recommanded to call Nim from Nim I guess?
13:40:41FromDiscord<System64 ~ Flandre Scarlet> Ah alright↔I meant in a library context↔you call Nim library from C
13:40:41PMunchI mean if you have the option I'd always use Nim, but for more than this reason alone
13:40:56PMunchYes that is possible, and can be done safely
13:41:09FromDiscord<System64 ~ Flandre Scarlet> Oh alright, good to know
13:41:24PMunchI wrote a dynamic library which was loaded into a DNS server for work, it's still in production and handles millions of DNS requests
13:41:34*Jjp137 quit (Ping timeout: 276 seconds)
13:41:45FromDiscord<System64 ~ Flandre Scarlet> this is interesting
13:42:26*oprypin quit (Remote host closed the connection)
13:43:35*oprypin joined #nim
13:50:09*ismustachio left #nim (Leaving.)
13:54:39FromDiscord<auxym> ARC/ORC makes it easier to call nim from C (don't need to call NimMain or whatever to init the GC). https://github.com/treeform/genny provides macros to generate a C header file for your nim code.↔↔As for safety, I think the gist of it is that C is inherently unsafe. The fact that you call Nim code doesn't really change anything (one way or another).
13:56:28FromDiscord<Yardanico> In reply to @auxym "ARC/ORC makes it easier": `setupForeignThreadGC` is the function needed to setup refc for "foreign threads" and it's not needed for arc/orc, yes
13:56:34FromDiscord<Yardanico> that said, NimMain isn't just limited to GC
13:56:51FromDiscord<Yardanico> if your program or any of libs you import use global variables or global code, you must call NimMain so that this code gets executed
13:57:06FromDiscord<System64 ~ Flandre Scarlet> Oh alright
13:57:06*rockcavera joined #nim
13:59:41*progranner quit (Quit: My Mac has gone to sleep. ZZZzzz
)
14:00:52*progranner joined #nim
14:01:42*fredrikhr quit (Quit: Disconnecting...)
14:03:53FromDiscord<sOkam!> is this `(uint32_t)~0` equivalent to `uint32.high`?
14:04:36PMunchYes
14:05:01PMunchTilde is the not operator in C, so ~0 would be all 1s, which for uint32 is the highest value.
14:05:12FromDiscord<demotomohiro> !eval doAssert (not 0'u32) == uint32.high
14:05:16NimBot<no output>
14:05:18FromDiscord<sOkam!> kk ty ✍
14:08:26Amun-Ra!eval echo 0.uint32.not == uint32.high
14:08:29NimBottrue
14:10:04*PMunch quit (Quit: Leaving)
14:10:20FromDiscord<demotomohiro> !eval echo 0.uint32.not.uint64 == 0.uint32.not.int64.uint64
14:10:27NimBottrue
14:11:04FromDiscord<sOkam!> that is confhushings and makes sense at the same time 😄
14:11:27Amun-Ra0'u32.not works too :>
14:16:20FromDiscord<Raynei486> How can I link to the manual within a doc comment?
14:16:40Amun-RasOkam!: x.y.z is a form of (z (y x))
14:17:40FromDiscord<System64 ~ Flandre Scarlet> sent a code paste, see https://play.nim-lang.org/#ix=4tla
14:17:41Amun-RaRaynei486: drectly https://nim-lang.org/docs/os.html#walkDir.i,string
14:19:32Amun-RaSystem64: yes
14:20:06FromDiscord<System64 ~ Flandre Scarlet> Oh alright
14:21:44*progranner quit (Quit: My Mac has gone to sleep. ZZZzzz
)
14:22:15Amun-Rayou can keep non-ref objects and check whether it's initialized or not by checking some attribute values, ie: func is_init(self: Tilemap): self.width != 0 and self.height != 0 etc

14:22:24Amun-Rathey're*
14:22:39*progranner joined #nim
14:23:00FromDiscord<System64 ~ Flandre Scarlet> In reply to @Amun-Ra "you can keep non-ref": Good idea↔But should I use refs or not?
14:25:46Amun-Rait's your call
14:26:11FromDiscord<System64 ~ Flandre Scarlet> I'm targetting performances and ease of use
14:26:14FromDiscord<demotomohiro> In reply to @System64 "Good idea But should": https://internet-of-tomohiro.netlify.app/nim/faq.en.html#type-when-to-use-ref-object-vs-plain-object-qmark
14:26:39*progranner quit (Client Quit)
14:26:40FromDiscord<demotomohiro> It explains ref obj vs obj
14:26:46Amun-RaSystem64 ~ Flandre Scarlet: if you have a function that returns an object and you have to check whether it was initialized or not - I'd use refs
14:27:11*progranner joined #nim
14:28:06FromDiscord<demotomohiro> I think you can do `proc isInitialized(x: Tilemap): bool = x.tiles.len() != 0`
14:29:09FromDiscord<System64 ~ Flandre Scarlet> that works too↔Btw is it possible to put variables in objects you only can allocate once?
14:30:01Amun-Rayes, pass the object as an argument to function and set its members
14:30:56FromDiscord<System64 ~ Flandre Scarlet> Oh alright↔Good ol' constructors
14:33:40*lucasta joined #nim
14:36:28*rockcavera quit (Remote host closed the connection)
14:38:09*progranner quit (Quit: My Mac has gone to sleep. ZZZzzz
)
14:45:29*xet7 quit (Ping timeout: 265 seconds)
14:49:34*rockcavera joined #nim
14:59:15*xet7 joined #nim
15:21:58*progranner joined #nim
15:38:18*arkurious joined #nim
15:50:28*Jjp137 joined #nim
16:02:13*cm quit (Quit: Bye.)
16:09:47*cm joined #nim
16:22:51*progranner quit (Quit: My Mac has gone to sleep. ZZZzzz
)
16:24:17*progranner joined #nim
16:37:56FromDiscord<Gabben> sent a code paste, see https://paste.rs/0Hd
16:39:58*Guest5438 joined #nim
16:40:33*Guest5438 quit (Client Quit)
16:57:38*ehmry quit (Ping timeout: 250 seconds)
17:00:48*ehmry joined #nim
17:03:54*guggy_warle joined #nim
17:04:06*guggy_warle quit (Client Quit)
17:04:46*guggy_warle joined #nim
17:05:13*guggy_warle left #nim (#nim)
17:20:43FromDiscord<Alvo> Hello! I'm trying NIM for the first time. I built NIM from source using the v2 branch and modified the build.bat to use Clang. ↔↔I'm getting `could not load: (libcrypto-1_1-x64|libeay64).dll` after running `./nimble.exe install nimlsp`
17:25:54*void09 joined #nim
17:33:39FromDiscord<Gumbercules> do you have those libraries installed on your machine?
17:38:00FromDiscord<Alvo> I don’t think so, should I get them somewhere and place them in the bin folder?
17:43:36FromDiscord<Nerve> So `sequtils` has a `foldl` template, why isn't there a `scanl` template? Also, why should they be templates instead of simple procs with generic type arguments?
17:44:44*void09 quit ()
17:45:30*void09 joined #nim
17:45:44FromDiscord<Elegantbeef> They're templates so they can work on any iterator
17:50:13*void09 quit (Client Quit)
17:50:43*void09 joined #nim
17:52:49rockcaveraAlvo https://nim-lang.org/download/dlls.zip
17:54:19FromDiscord<Dudugz> In reply to @Elegantbeef "They're templates so they": It's a bit tricky and confusing tho, the first time I went to use it I was lost
17:55:29FromDiscord<Dudugz> sent a code paste, see https://paste.rs/D3V
17:56:07FromDiscord<Nerve> Yeah having an actual lambda argument, either a `proc` or `=>`, would make way more sense
17:56:17FromDiscord<Dudugz> Yea
17:56:18FromDiscord<Dudugz> (edit) "https://play.nim-lang.org/#ix=4tm0" => "https://play.nim-lang.org/#ix=4tlZ"
17:57:16FromDiscord<Dudugz> ``a, b => bitor(a, b)`` would be less confusing
17:57:43FromDiscord<Alvo> In reply to @rockcavera "Alvo https://nim-lang.org/download/dlls.zip": Ty good sir!
18:14:49FromDiscord<0ffh> Is a rough estimate available, on what the duration of one tick in std/monotimes is?
18:17:50FromDiscord<Nerve> sent a code paste, see https://play.nim-lang.org/#ix=4tm4
18:18:32FromDiscord<Elegantbeef> If you're wanting help no clue, i never use `=>`
18:20:20FromDiscord<Nerve> Maybe, but mainly this is just a proof of concept that if we take `sequtils` at its namesake and presume `foldl` and `scanl` expect `seq` or `openarray` instead of all possible iterators, it's possible to make very simple `foldl` and `scanl` procs that also give you detailed compiler error checking.
18:20:51FromDiscord<Elegantbeef> With `iterable` it's not impossible for sequtils to do the same
18:20:56FromDiscord<Elegantbeef> you just need to do like `mySeq.items`
18:21:23FromDiscord<Nerve> hmmm
18:23:22FromDiscord<demotomohiro> sent a code paste, see https://paste.rs/pLq
18:29:09FromDiscord<Dudugz> Hmm
18:30:13FromDiscord<demotomohiro> In reply to @0ffh "Is a rough estimate": If you use posix os, clock_getres() finds the resolution (precision) of the↔specified clock clockid:↔https://www.man7.org/linux/man-pages/man3/clock_gettime.3.html↔https://github.com/nim-lang/Nim/blob/devel/lib/std/monotimes.nim
18:31:05*Notxor quit (Remote host closed the connection)
18:39:06FromDiscord<0ffh> In reply to @demotomohiro "If you use posix": Thanks!
18:43:36*lucasta quit (Remote host closed the connection)
18:53:50madpropsi don't get it
18:53:54madpropsnimble run myproject
18:53:58madpropsworks
18:54:02madpropsif i give it a -flag
18:54:09madpropsit starts asking about download deps
18:54:12madpropsit breaks
18:54:16madpropsso i have to delete a deps dir
18:54:18madpropsand nimble install -d again
18:56:23madpropsthe weird thing is that it was working some minutes ago
18:57:26madpropswhatever i'll compile directly
19:04:58*ehmry quit (Read error: Connection reset by peer)
19:05:25*ehmry joined #nim
19:14:43FromDiscord<Dudugz> sent a code paste, see https://play.nim-lang.org/#ix=4tmg
19:22:21FromDiscord<demotomohiro> sent a code paste, see https://play.nim-lang.org/#ix=4tmj
19:24:11FromDiscord<Dudugz> oooh, thx :3
19:25:27FromDiscord<Prestige> In jester, is there a way to set up rate limits?
19:40:23*Notxor joined #nim
19:55:25FromDiscord<Dudugz> Doing some tests with sdl, any objections regarding syntax/best practices? https://media.discordapp.net/attachments/371759389889003532/1096161742855352462/bandicam_2023-04-13_16-54-01-296.mp4
19:58:02FromDiscord<Elegantbeef> You project is 30loc with nothing significant in hte main loop
19:59:39*xet7 quit (Remote host closed the connection)
20:01:19*xet7 joined #nim
20:04:15FromDiscord<Dudugz> I didn't understand lol
20:04:55FromDiscord<Elegantbeef> You've shown small bit line art of a massive art piece and asked "how's this art"
20:05:05FromDiscord<Elegantbeef> "small bit of line art in a massive art piece"
20:05:21*Notxor quit (Remote host closed the connection)
20:05:22FromDiscord<Elegantbeef> There is not enough information to do anything with other than applaud the rendering of a square
20:05:56FromDiscord<Dudugz> Oh yeah lol I just wanted to know if the syntax is nice or would you rather something be different
20:06:14FromDiscord<Dudugz> Usually I tend to use a lot of my own style and it turns out that other devs don't like it.
20:07:06FromDiscord<Elegantbeef> There's nothing that atrocious, aside maybe from using OOP but that's just a me thing
20:07:20FromDiscord<Dudugz> also poll(0) didn't work as expected so i used sleepAsync
20:10:23*Notxor joined #nim
20:28:34FromDiscord<jmgomez> hey beef, any suggestion to get around it? https://github.com/nim-lang/Nim/pull/21628#discussion_r1165305310↔was taking a look at the toplevel scope with the hope that import symbols are there so I can use the hash, but they didnt seem to be
20:29:19FromDiscord<jmgomez> In reply to @Dudugz "also poll(0) didn't work": ? they are orthogonal, I mean if you dont call poll after sleepAsync it will sleep sync. doesnt it?
20:37:21FromDiscord<Dudugz> No lol, this is from yesterday's thread about while + async blocking the main block
20:37:49FromDiscord<Dudugz> Beef suggested trying poll(0) but it throws an error, in this case the solution was await sleepAsync(0)
20:38:15FromDiscord<jmgomez> the dispatcher calls pol for you
20:38:48FromDiscord<jmgomez> otherwise async/await wouldnt work
20:38:49FromDiscord<Dudugz> :v you'll need to read yesterday's messages to get it
21:06:29*progranner quit (Quit: My Mac has gone to sleep. ZZZzzz
)
21:09:22*progranner joined #nim
21:20:14*jmdaemon joined #nim
21:24:38*progranner quit (Quit: My Mac has gone to sleep. ZZZzzz
)
21:29:43FromDiscord<dector> sent a code paste, see https://paste.rs/mfg
21:31:10*ttkap joined #nim
21:36:06*Notxor quit (Quit: Leaving)
21:37:11FromDiscord<ricky> In reply to @PMunch "I wrote a dynamic": king mode
21:37:19FromDiscord<ricky> (unless it was for cloudflare ofc)
21:38:19FromDiscord<Nilts> In reply to @Elegantbeef "Nah i only wrote": wait so can or can't I
21:38:58*advesperacit quit ()
21:48:15FromDiscord<Elegantbeef> You can
21:49:34FromDiscord<Elegantbeef> Pmunch @elcritch we've got a fix for our `$nim` woes apparently that always existed
22:14:45*luis_ quit (Remote host closed the connection)
22:30:34*hochata joined #nim
22:32:40FromDiscord<Jessa> sent a code paste, see https://play.nim-lang.org/#ix=4tng
22:32:59FromDiscord<Jessa> how can i make the `[]` proc work at run time
22:35:45FromDiscord<Elegantbeef> The issue is `[]` needs to be static for tuples so you need to do something really dumb
22:36:17FromDiscord<Elegantbeef> `[]` is already defined for integers
22:37:09FromDiscord<Jessa> so this iis kind of not possibile without workarounds?
22:37:20FromDiscord<Elegantbeef> Use an object
22:37:38FromDiscord<Elegantbeef> Use `{}`
22:37:43FromDiscord<Elegantbeef> use a named proc
22:37:45FromDiscord<Elegantbeef> Use ...
22:37:58FromDiscord<Elegantbeef> sent a code paste, see https://play.nim-lang.org/#ix=4tni
22:38:26FromDiscord<Elegantbeef> sent a code paste, see https://play.nim-lang.org/#ix=4tnj
22:38:47FromDiscord<jmgomez> beef, any idea on the question that I posted above?
22:39:07FromDiscord<Jessa> sent a code paste, see https://play.nim-lang.org/#ix=4tnk
22:39:09FromDiscord<Jessa> thank you
22:39:40FromDiscord<jmgomez> I think if somehow I access the right PContext I can use the module name as hash
22:40:14FromDiscord<jmgomez> (edit) "PContext" => "PScopre"
22:40:19FromDiscord<jmgomez> (edit) "PScopre" => "PScope"
22:40:52FromDiscord<Elegantbeef> I pinged you with "no clue"
22:40:57FromDiscord<Elegantbeef> This is beyond my paygrade
22:41:01FromDiscord<Elegantbeef> It's not semantic analysis 😛
22:42:19FromDiscord<jmgomez> oh didnt make it to discord because I dont see it
22:43:06FromDiscord<jmgomez> that's too bad
22:48:15FromDiscord<jmgomez> do you know what roughly speaking is a context? and if it's possible to get other context from one
22:48:28FromDiscord<jmgomez> (edit) "context" => "contexts"
22:53:55FromDiscord<jmgomez> seems to be somewhat related to a module but depending where you access to it has different symbols. May it depend on the current compiler pass or something?
22:54:22FromDiscord<Elegantbeef> I know it has a config and that's about it sorry
23:17:05FromDiscord<Raynei486> In reply to @Elegantbeef "Pmunch <@703717429230174229> we've got": Does it have to do with my PR?
23:17:26FromDiscord<Raynei486> I'm curious what the issue was
23:17:31FromDiscord<Elegantbeef> Yea it showed me an unknown feature
23:17:47FromDiscord<Elegantbeef> Previously it required `--path:"$nim"` in code
23:17:52FromDiscord<Elegantbeef> Well in a config
23:18:47FromDiscord<Elegantbeef> But cause i can do `"$nim"/compiler` it's not required anymore
23:19:28FromDiscord<Raynei486> I didn't think my first PR writing some docs would already have an positive effect lol 👍
23:19:40FromDiscord<Raynei486> (edit) "an" => "a"
23:46:10*lucasta joined #nim
23:47:05FromDiscord<Elegantbeef> Yea i knew one could use strings in imports but never knew that it had expanded things like that