00:14:05 | * | jmdaemon joined #nim |
00:17:35 | FromDiscord | <Elegantbeef> Termer, this is your captain speaking, stack strings doesnt have a release to coincide with you bumping the nimble version |
00:28:31 | termer | Ey? |
00:28:33 | termer | what do I need to do |
00:28:44 | termer | oh |
00:28:45 | FromDiscord | <Elegantbeef> Make a git tag and release |
00:28:48 | termer | yeah, my bad |
00:28:49 | termer | lemme do that |
00:28:54 | FromDiscord | <Elegantbeef> Or just do `graffiti ./my.nimble` |
00:28:59 | termer | I'm too lazy for that |
00:29:08 | termer | Are you or other people using the library |
00:31:22 | termer | Done |
00:31:53 | FromDiscord | <Elegantbeef> Cheers, don't know if I'm going to use stack strings |
00:32:06 | * | alphacentauri joined #nim |
00:32:17 | FromDiscord | <Elegantbeef> Was talking about TOTP with someone and looked at Nim implementations and seen some issues |
00:32:43 | FromDiscord | <Elegantbeef> Replacing the secret with a stack string that's fixed size allocated seems much more ideal over a Nim string |
00:32:59 | FromDiscord | <Elegantbeef> But it also means the program only supports a secret up to a given size |
00:33:06 | termer | Oh yeah |
00:33:09 | termer | well that would be a valid use |
00:33:37 | FromDiscord | <Elegantbeef> The major concern I had was that they were using `ref object of X` for their passwords |
00:33:44 | FromDiscord | <Elegantbeef> Encouraging a heap related vulnerbillity |
00:33:59 | FromDiscord | <Elegantbeef> Which is obviously not the worst thing in the world now that we have Arc/Orc |
00:34:00 | termer | oh absolutely, you'd definitely not want something like that |
00:34:12 | termer | I like using as little heap as possible |
00:34:23 | FromDiscord | <Elegantbeef> But just aliasing once could keep the secret in memory for longer than imagined |
00:34:35 | FromDiscord | <Elegantbeef> I'll also probably disable the `=copy` hook |
00:35:10 | termer | =copy can be annoying |
00:35:16 | termer | I don't like memory being accidentally created |
00:35:58 | FromDiscord | <Elegantbeef> Yea that's why many people like to disable their copy hooks |
00:36:09 | FromDiscord | <Elegantbeef> Especially in a security setting it should not be enabled |
00:42:36 | FromDiscord | <Elegantbeef> hopefully they accept my PR even though it's a breaking change 😄 |
00:56:24 | termer | what's your PR |
00:58:36 | FromDiscord | <Elegantbeef> https://github.com/OpenSystemsLab/otp.nim/pull/4/files breaking to say the least |
01:41:54 | * | brettgilio joined #nim |
01:54:43 | termer | fun times |
01:54:52 | termer | Well feel free to use stack_strings |
01:55:10 | termer | I can help if you need any changes to it |
01:55:39 | FromDiscord | <Elegantbeef> There is no fixed length on how big a secret can be so that's less than ideal |
02:00:01 | termer | fair enough |
02:18:39 | * | blop_ quit (Ping timeout: 252 seconds) |
02:19:35 | * | blop_ joined #nim |
02:22:41 | * | edr quit (Quit: Leaving) |
02:58:01 | FromDiscord | <millymox> I said python was slow in the python discord and I got cyberbullied |
02:59:13 | FromDiscord | <Elegantbeef> You know what they say, the only thing slower than python is a python programmer |
02:59:48 | FromDiscord | <Elegantbeef> But really though, don't start language was |
03:00:55 | FromDiscord | <millymox> Didn’t start a war I’m making a program in python and I asked how I could speed it up |
03:01:13 | * | alphacentauri quit (Ping timeout: 240 seconds) |
03:01:17 | FromDiscord | <millymox> And instead of helping they attack me as a developer and say it’s because of my “shitty” and I quote “coding abilities” |
03:01:18 | * | blop joined #nim |
03:01:34 | FromDiscord | <millymox> And then someone asked me how is python slow and I gave them 5 reasons and he told me I was a troll |
03:01:55 | FromDiscord | <millymox> All I asked was how to speed it up, I never necessarily said python was slow but rather how to speed up the code |
03:02:03 | FromDiscord | <millymox> But I guess they took that personally |
03:02:06 | FromDiscord | <Elegantbeef> Sounds like you said more and now are seeking validation |
03:04:07 | * | blop_ quit (Ping timeout: 252 seconds) |
03:07:26 | * | alphacentauri joined #nim |
03:23:26 | FromDiscord | <Elegantbeef> Termer there is presently no `proc toStackString(s: openArray[char], size: static int): StackString[size]` eh? |
03:23:50 | termer | there's the ss proc |
03:23:55 | termer | not with custom size though |
03:24:04 | FromDiscord | <Elegantbeef> That works only for static string |
03:24:08 | termer | Oh right |
03:24:11 | termer | No simple proc for it, no |
03:24:16 | termer | you create one and then append to it |
03:24:20 | termer | I could probably add a thing |
03:24:38 | FromDiscord | <Elegantbeef> Yea I'll just append but it's a big ugly 😄 |
03:28:04 | FromDiscord | <Elegantbeef> Oh your `toOpenArray` is wrong |
03:28:08 | FromDiscord | <Elegantbeef> it returns the `\0` |
03:31:20 | termer | what |
03:31:25 | termer | ah fuck what |
03:31:32 | termer | Is it bugged in this version |
03:32:34 | FromDiscord | <Elegantbeef> It is |
03:32:49 | termer | 8| |
03:32:56 | termer | can you file a bug on GitHub so I can fix it |
03:33:04 | termer | or a fix if you feel so inclined |
03:38:18 | FromDiscord | <Elegantbeef> I wasnt going to make the fix, but it's 2 lines I guess. |
03:38:40 | FromDiscord | <Elegantbeef> Merge that and create a release when you get a moment, thanks |
03:46:39 | termer | Taking a look now |
03:49:26 | FromDiscord | <Elegantbeef> Damn the diff you got must be much different to the one I sent 😛 |
03:55:53 | termer | Done |
03:56:04 | FromDiscord | <Elegantbeef> Danke |
03:56:09 | termer | thanks for that |
04:16:42 | FromDiscord | <Elegantbeef> Well the author of the otp was interested in using stack strings so heh, guess I was wrong |
04:23:23 | * | lucasta joined #nim |
04:27:21 | * | azimut quit (Ping timeout: 252 seconds) |
04:29:54 | termer | Sweet |
05:39:36 | * | advesperacit joined #nim |
06:04:48 | FromDiscord | <firasuke> Could there be an interest in optimised Nim toolchains using gcc + musl? |
06:07:52 | FromDiscord | <nnsee> In reply to @firasuke "Could there be an": elaborate? optimized in what way? |
06:08:50 | FromDiscord | <firasuke> https://github.com/firasuke/mussel |
06:09:53 | FromDiscord | <firasuke> Since Nim transpiles to C, executables would benefit greatly from switching to a smaller libc |
06:10:06 | FromDiscord | <odexine> Benefit in what way |
06:10:18 | FromDiscord | <firasuke> Kind of similar to how Rust provides regular glibc and musl based toolchain |
06:10:24 | FromDiscord | <firasuke> (edit) "toolchain" => "toolchains" |
06:10:32 | FromDiscord | <nnsee> you can compile with musl without any issues already |
06:10:33 | FromDiscord | <Elegantbeef> Portability is the only real way |
06:10:35 | FromDiscord | <nnsee> pretty easily |
06:10:43 | FromDiscord | <firasuke> In reply to @nnsee "you can compile with": Yes I know that xD |
06:10:44 | FromDiscord | <nnsee> i constantly do that for static binaries |
06:11:54 | FromDiscord | <firasuke> But I figured providing a musl + gcc toolchain would be interesting |
06:12:29 | FromDiscord | <firasuke> Like currently we're tied to whatever toolchain is provided on the host system |
06:12:34 | FromDiscord | <firasuke> Which is definitely not a bad thing |
06:12:46 | FromDiscord | <firasuke> It shows how powerful Nim is |
06:13:32 | FromDiscord | <firasuke> Again since Nim transpiles to C, it beats the purpose of using a custom toolchain, as the host system already provides one |
06:13:49 | FromDiscord | <firasuke> I was checking if their might any interest |
06:13:59 | FromDiscord | <firasuke> (edit) "I was checking if their might ... any" added "be" |
06:14:30 | FromDiscord | <firasuke> (Thinking of it as a way to give back to the Nim community as it's my current field of expertise..) |
06:14:32 | FromDiscord | <odexine> Surprising no one has tried talking about “transpile” yet lol |
06:14:55 | FromDiscord | <firasuke> What about it xD |
06:16:31 | FromDiscord | <odexine> In reply to @firasuke "I was checking if": I think there’s a little interest but not to make it a default |
06:35:54 | * | lucasta quit (Quit: Leaving) |
06:53:29 | * | PMunch joined #nim |
07:09:09 | FromDiscord | <gogolxdong666> Anyone has interests in writing smart contract language for TON blockchain like Tact? |
07:09:25 | FromDiscord | <gogolxdong666> (edit) "Anyone has interests in writing smart contract ... language" added "programming" |
07:18:31 | FromDiscord | <aintea> sent a code paste, see https://paste.rs/BqUu9 |
07:18:58 | FromDiscord | <aintea> I can find it on the docs for options, for maps, but not for seqs |
07:20:24 | FromDiscord | <Elegantbeef> It does not have any pattern matching built in |
07:20:41 | FromDiscord | <Elegantbeef> Inside of the fusion package there is a matching module |
07:36:22 | * | def- quit (Quit: -) |
07:36:35 | * | def- joined #nim |
08:15:57 | * | junaid_ joined #nim |
08:34:54 | * | junaid_ quit (Remote host closed the connection) |
08:52:22 | FromDiscord | <Phil> ... asyncdispatch mildly confuses me with its type useage |
08:54:32 | FromDiscord | <odexine> hit us with it |
08:54:48 | FromDiscord | <Phil> sent a code paste, see https://play.nim-lang.org/#ix=4Hs3 |
08:54:56 | FromDiscord | <Phil> In reply to @odexine "hit us with it": I'm an old man Rika, I type slow, gimme a minute 😛 |
08:55:35 | FromDiscord | <Phil> (edit) "https://play.nim-lang.org/#ix=4Hs3" => "https://play.nim-lang.org/#ix=4Hs4" |
08:55:52 | FromDiscord | <odexine> the callback may have sideeffects |
08:56:40 | FromDiscord | <odexine> this is a first-sight reactionary message i dont really know what it is yet |
08:56:47 | FromDiscord | <Phil> Sure, my point is more why insist that `cb` is of type `proc(fd: AsyncFD): bool` if what you actually want is `proc(fd: AsyncFD)` |
08:56:58 | FromDiscord | <Phil> (edit) "Sure, my point is more why insist that `cb` is of type `proc(fd: AsyncFD): bool` ... if" added "(aka `Callback`)" |
08:58:08 | FromDiscord | <odexine> lets say i have a proc that takes in callbacks, and i want to use addprocess on it |
08:58:54 | FromDiscord | <odexine> i'd have to essentially convert the callbacks into that type you want every time, in which it's essentially (fd)=>discard cb(fd) anwyay |
08:59:01 | FromDiscord | <odexine> so its prolly for convenience |
09:01:05 | FromDiscord | <Phil> In that case I'd want a doc-comment that explains this, as during useage of `addRead`, `addWrite` and `addTimer` I would've gained the impression that `Callback` is always something to put on the dispatcher whose boolean determines whether it shall be removed from there or not. |
09:02:03 | * | junaid_ joined #nim |
09:02:40 | FromDiscord | <Phil> It also makes `addProcess` kind of an ugly duckling because to me it seems that the other three are about actually working in a "normal async fashion" (not sure how else to describe it) where they execute once you poll, while addProcess has nothing to do with poll and executes on triggering a condition |
09:03:12 | FromDiscord | <enthus1ast> but the callback does not fire again since the process is gone |
09:05:22 | FromDiscord | <odexine> addprocess executes on poll |
09:05:26 | FromDiscord | <odexine> it registers a handle |
09:05:44 | FromDiscord | <odexine> all three technically "executes on triggering a condition" |
09:06:48 | FromDiscord | <odexine> read i assume waits for more input to read, write i assume waits to be able to write again, timer ofc waits for a timer to lapse |
09:07:04 | FromDiscord | <odexine> they all work via poll ofc; i believe it is the same for addProcess |
09:07:21 | * | junaid_ quit (Remote host closed the connection) |
09:07:23 | FromDiscord | <odexine> read into the template registerWaitableHandle |
09:07:36 | FromDiscord | <Phil> In reply to @odexine "it registers a handle": So its more that `addProcess` is just a single-execution-cb via the dispatcher (which means the useage of Callback is just confusing in the sense that it has a return-type that for this particular circumstance is irrelevant) whereas the others allow repeated execution? |
09:07:39 | FromDiscord | <odexine> the call to that template is right under the proccb |
09:08:20 | FromDiscord | <odexine> In reply to @isofruit "So its more that": sure |
09:08:27 | FromDiscord | <odexine> rather |
09:08:38 | FromDiscord | <odexine> no, sure that works |
09:08:56 | FromDiscord | <odexine> allow repeated execution -> allow to poll for the same event with the same callback again |
09:08:59 | FromDiscord | <enthus1ast> btw addProcess does not work in my test |
09:09:07 | FromDiscord | <enthus1ast> can you try it ? |
09:09:18 | FromDiscord | <Phil> What's your test code? |
09:09:25 | FromDiscord | <Phil> Or rather min example code |
09:09:36 | FromDiscord | <enthus1ast> sent a code paste, see https://play.nim-lang.org/#ix=4Hsb |
09:09:48 | FromDiscord | <enthus1ast> with your pid of course \:) |
09:10:02 | FromDiscord | <Phil> The main reason I'm stumbling over this is because I finally want doc-comments on types like `Callback` so I'm on a draft-PR for that atm |
09:10:13 | FromDiscord | <enthus1ast> nice! |
09:11:05 | FromDiscord | <enthus1ast> i'm on linux |
09:13:49 | FromDiscord | <Phil> Yep, failed on my end as well, attached it to firefox, ran `killall firefox` and nothing happened |
09:14:10 | FromDiscord | <enthus1ast> on linux it does not even fail when the process does not exist |
09:14:18 | FromDiscord | <enthus1ast> in the first place |
09:15:43 | FromDiscord | <Phil> Filing a bug report |
09:15:58 | FromDiscord | <enthus1ast> would be interesting if this works on windows |
09:21:55 | * | cm quit (Ping timeout: 264 seconds) |
09:22:45 | FromDiscord | <Phil> https://github.com/nim-lang/Nim/issues/22758↵There the bug report |
09:23:15 | FromDiscord | <Phil> Writing docs: The one thing that you're near guaranteed will inevitably turn into more than just writing docs |
09:24:35 | FromDiscord | <Phil> I just wanted to add like 3 lines of doc comments 😢 |
09:31:52 | FromDiscord | <enthus1ast> \:) |
09:32:23 | FromDiscord | <enthus1ast> last words\: "just wanna do this real quick" |
09:55:06 | FromDiscord | <Phil> We got anyone here on a windows processor? |
09:55:17 | FromDiscord | <Phil> (edit) "processor?" => "system?" |
09:56:46 | FromDiscord | <Chronos [She/Her]> Nope |
09:56:53 | FromDiscord | <Chronos [She/Her]> Does a VM not do the trick, Phil? |
09:58:03 | FromDiscord | <Phil> I'd need to actually know, have the tools and a workflow to start a windowsvm |
09:59:59 | FromDiscord | <odexine> and why not figure that out |
10:10:58 | FromDiscord | <toma400> In reply to @isofruit "We got anyone here": I mean, yeah, I'm using Win10 yet |
10:11:09 | FromDiscord | <Phil> Because lazy |
10:11:57 | FromDiscord | <Phil> In reply to @toma400 "I mean, yeah, I'm": Mind running the example from this github issue (just replace the number with the id of a process you can close without issue)?↵https://github.com/nim-lang/Nim/issues/22758 |
10:15:28 | FromDiscord | <odexine> works on windows |
10:16:03 | FromDiscord | <odexine> `GONE` when proc is killed |
10:16:09 | FromDiscord | <odexine> `Error: unhandled exception: The parameter is incorrect.` when pid is invalid |
10:16:24 | FromDiscord | <odexine> In reply to @odexine "`Error: unhandled exception: The": (OSError) |
10:16:44 | * | pbsds quit (Ping timeout: 248 seconds) |
10:18:24 | FromDiscord | <enthus1ast> maybe on linux it just works for processes that are started by the testing process? |
10:18:39 | FromDiscord | <enthus1ast> afaik on linux there is a more strict process isolation |
10:24:34 | * | pbsds joined #nim |
10:28:04 | FromDiscord | <enthus1ast> its stranger, but does also not work |
10:28:32 | FromDiscord | <enthus1ast> sent a code paste, see https://play.nim-lang.org/#ix=4HsE |
11:12:30 | FromDiscord | <System64 ~ Flandre Scarlet> Do I need -d:useSSL to do request to an https website? |
11:20:46 | * | jmdaemon quit (Ping timeout: 252 seconds) |
11:22:42 | FromDiscord | <odexine> yes |
11:22:48 | FromDiscord | <odexine> -d:ssl not usessl |
11:24:06 | FromDiscord | <System64 ~ Flandre Scarlet> yeah sorryù |
11:24:07 | FromDiscord | <System64 ~ Flandre Scarlet> (edit) "sorryù" => "sorry" |
11:32:39 | FromDiscord | <toma400> In reply to @isofruit "Mind running the example": Sorry, came back late enough, seems like Rika checked that already 😅 |
11:34:49 | * | tiorock joined #nim |
11:34:49 | * | tiorock quit (Changing host) |
11:34:49 | * | tiorock joined #nim |
11:34:49 | * | rockcavera is now known as Guest6056 |
11:34:50 | * | Guest6056 quit (Killed (molybdenum.libera.chat (Nickname regained by services))) |
11:34:50 | * | tiorock is now known as rockcavera |
12:03:17 | FromDiscord | <enthus1ast> or use puppy↵(@System64 ~ Flandre Scarlet) |
12:03:31 | FromDiscord | <enthus1ast> then there is no need for it, since puppy uses either curl or winapi |
12:06:44 | FromDiscord | <sOkam! 🫐> whats different between `nnkAsgn` and `nnkFastAsgn`? |
12:08:23 | FromDiscord | <nnsee> one of them's fast |
12:08:24 | FromDiscord | <nnsee> duh |
12:15:58 | * | gooba quit (Remote host closed the connection) |
12:23:23 | FromDiscord | <sOkam! 🫐> 🤦♂️ 😄 |
12:33:46 | * | derpydoo joined #nim |
12:47:10 | NimEventer | New thread by galaxyDragon: ImPlot library, see https://forum.nim-lang.org/t/10515 |
13:04:00 | * | xet7 quit (Ping timeout: 252 seconds) |
13:10:10 | * | xutaxkamay joined #nim |
13:22:48 | * | azimut joined #nim |
13:33:33 | FromDiscord | <System64 ~ Flandre Scarlet> @treeform When I connect to a domain name instead of an IP with Netty, is the IP cached somewhere? |
13:44:31 | FromDiscord | <Chronos [She/Her]> In reply to @sys64 "<@107140179025735680> When I connect": Why would it be? |
13:45:00 | FromDiscord | <Chronos [She/Her]> Domain names are resolved by a DNS, to get the IP you'd have to follow the location yourself |
13:45:04 | FromDiscord | <Chronos [She/Her]> Though maybe I'm wrong |
13:50:13 | FromDiscord | <saint._._.> Does python have better cpp interop than nim? |
13:51:42 | FromDiscord | <jmgomez> In reply to @saint._._. "Does python have better": how so? |
13:51:53 | FromDiscord | <nnsee> sent a code paste, see https://play.nim-lang.org/#ix=4HtI |
13:52:36 | FromDiscord | <Chronos [She/Her]> Interesting, but can you access that from within Nim? |
13:52:52 | FromDiscord | <nnsee> i'm not sure what you mean by that |
13:53:19 | FromDiscord | <nnsee> any name lookup from any application goes through the system's resolver, unless the application rolls its own resolver |
13:53:35 | FromDiscord | <Chronos [She/Her]> In reply to @nnsee "i'm not sure what": As in, is there a way to access the cached results from the system's resolver in Nim? |
13:54:48 | * | gooba joined #nim |
13:55:11 | FromDiscord | <nnsee> In reply to @chronos.vitaqua "As in, is there": i would be very surprised if this wasn't the case by default |
13:55:26 | FromDiscord | <System64 ~ Flandre Scarlet> Normally it is always cached on the computer |
13:55:37 | FromDiscord | <Chronos [She/Her]> 🤷♀️ I'd have no way to know bc I don't do this stuff aha |
13:55:46 | FromDiscord | <nnsee> In reply to @chronos.vitaqua "🤷♀️ I'd have no": right |
13:55:54 | FromDiscord | <System64 ~ Flandre Scarlet> Idk if Nim caches this |
13:56:09 | FromDiscord | <nnsee> nim very likely uses the libc's `getnameinfo`, which in turn talks with the system's resolver, which in turn does the caching |
13:56:37 | FromDiscord | <System64 ~ Flandre Scarlet> So it is probably fine |
13:57:04 | FromDiscord | <Chronos [She/Her]> In reply to @nnsee "nim very likely uses": How about on Windows? |
13:57:20 | FromDiscord | <Chronos [She/Her]> I'd imagine crossplatform is always an important factor |
13:57:47 | FromDiscord | <nnsee> no clue how windows works, not my field |
13:58:26 | FromDiscord | <Chronos [She/Her]> Fair aha |
14:00:12 | FromDiscord | <nnsee> but if i had to reckon a guess, it probably works similarly and also does caching |
14:00:46 | FromDiscord | <Chronos [She/Her]> Fair |
14:00:53 | FromDiscord | <nnsee> performing a DNS request every time you want to do networking would make everything very slow :p |
14:01:00 | FromDiscord | <Chronos [She/Her]> Yeah- |
14:01:02 | FromDiscord | <nnsee> although... it is windows, so I wouldn't be too surprised |
14:01:39 | FromDiscord | <Chronos [She/Her]> Unrelated but I wonder how bad an OS that uses WASM for everything as much as it can (obviously ignoring initial bootstrap) would perform |
14:02:05 | FromDiscord | <Chronos [She/Her]> Ig it'd depend on how code is executed but you most definitely can't use an existing library unless it's a pure interpreter |
14:03:06 | FromDiscord | <Chronos [She/Her]> Sounds like a hellish task to do but interesting for sure |
14:03:19 | FromDiscord | <nnsee> wasm is reasonably fast and I could see it used for certain userland programs, but I definitely wouldn't use it for critical OS components |
14:03:33 | FromDiscord | <Chronos [She/Her]> Yeah fair xD |
14:04:15 | NimEventer | New thread by aiac: How to static linking sqlite ?, see https://forum.nim-lang.org/t/10516 |
14:04:32 | FromDiscord | <nnsee> ... of course, if we had [wasm running on bare metal](https://github.com/lastmjs/wasm-metal), it'd be a different story |
14:05:27 | FromDiscord | <Chronos [She/Her]> Huh, I thought there were quite a few reasons why that's not possible |
14:05:41 | FromDiscord | <Chronos [She/Her]> Such as WASM having an essentially unlimited number of registers |
14:06:04 | FromDiscord | <Chronos [She/Her]> Tho idk what that actually means aha, just asked that question a while ago and got that answer |
14:07:07 | FromDiscord | <Chronos [She/Her]> I can't remember what registers actually store in CPUs lol |
14:10:18 | FromDiscord | <nnsee> In reply to @chronos.vitaqua "Such as WASM having": if you treat wasm as a stack machine then i don't see this being an issue |
14:11:09 | FromDiscord | <nnsee> In reply to @chronos.vitaqua "I can't remember what": call arguments, call results, intermediate values, etc |
14:11:47 | FromDiscord | <nnsee> the short answer is _anything_ (that fits in the registers), but calling conventions more or less dictate what should go where |
14:12:20 | FromDiscord | <Chronos [She/Her]> Ah |
14:15:30 | FromDiscord | <nnsee> see https://en.wikipedia.org/wiki/X86_calling_conventions?useskin=vector#System_V_AMD64_ABI for an example |
14:16:14 | FromDiscord | <nnsee> of course there are special purpose registers as well, like the stack pointer, instruction pointer, segment registers etc |
14:16:37 | FromDiscord | <nnsee> https://wiki.osdev.org/CPU_Registers_x86 |
14:16:59 | FromDiscord | <Chronos [She/Her]> This is really interesting ngl |
14:17:21 | NimEventer | New thread by Levlan: [newbie] go to definition is not working on vscodium on EndeavourOS(Arch based distro), see https://forum.nim-lang.org/t/10517 |
14:21:31 | * | gooba quit (Remote host closed the connection) |
15:23:39 | * | gooba joined #nim |
15:33:26 | * | gooba quit (Remote host closed the connection) |
15:42:22 | * | ntat joined #nim |
16:13:23 | * | alphacentauri quit (Quit: WeeChat 4.0.5) |
16:15:16 | * | alphacentauri joined #nim |
16:30:47 | * | azimut quit (Ping timeout: 252 seconds) |
16:31:04 | * | azimut joined #nim |
16:31:53 | * | blop quit (Ping timeout: 252 seconds) |
16:34:06 | * | blop joined #nim |
16:40:58 | FromDiscord | <Chronos [She/Her]> Time to work on game some more |
16:41:25 | FromDiscord | <Chronos [She/Her]> Map format time... :pain: |
16:43:18 | FromDiscord | <Chronos [She/Her]> Wait question about frosty, Beef |
16:43:47 | FromDiscord | <Chronos [She/Her]> What does it do for BE and LE? Does it make sure bytes are always converted to one so it can be used across platforms or? |
16:45:16 | FromDiscord | <Chronos [She/Her]> Also what does it do for serialising ref objects? |
16:45:19 | FromDiscord | <_gumbercules> almost all systems these days are LE |
16:45:34 | FromDiscord | <_gumbercules> but generally serialization libraries will pick one endianness and expect the user to handle conversion |
16:45:44 | FromDiscord | <_gumbercules> binary serialization libraries anyway |
16:45:55 | FromDiscord | <Chronos [She/Her]> In reply to @_gumbercules "almost all systems these": Ah, I thought some actually still used BE |
16:45:59 | FromDiscord | <Chronos [She/Her]> Oh well I should be fine |
16:46:10 | FromDiscord | <_gumbercules> some still do - but it's rare you're going to encounter them |
16:47:04 | FromDiscord | <Chronos [She/Her]> Fair, so I should be fine I hope |
16:47:11 | FromDiscord | <_gumbercules> sent a code paste, see https://play.nim-lang.org/#ix=4HuV |
16:47:30 | FromDiscord | <_gumbercules> unless you're targeting zOS or RISC you're probably fine |
16:47:50 | FromDiscord | <Chronos [She/Her]> Ah |
16:48:10 | FromDiscord | <_gumbercules> even then - `ARM, C-Sky, and RISC-V have no relevant big-endian deployments, and can be considered little-endian in practice.` |
16:48:31 | FromDiscord | <Chronos [She/Her]> I have to make a map format... Pain |
16:48:43 | FromDiscord | <_gumbercules> mmm 2d maps are pretty simple |
16:48:53 | FromDiscord | <_gumbercules> 2d array with numbers representing tile types should be fine |
16:49:23 | FromDiscord | <_gumbercules> and then you can use bitmasking to auto-tile |
16:49:33 | FromDiscord | <Chronos [She/Her]> Not sure how I'd draw a grid |
16:49:55 | FromDiscord | <_gumbercules> nested for loops |
16:50:01 | FromDiscord | <Chronos [She/Her]> I know I'm using a 2D array just not sure how to align tiles to a grid |
16:50:38 | FromDiscord | <_gumbercules> `for x in 0 ..< map.width: for y in 0 ..< map.height: drawTile(map[x][y], mapTileWidth, mapTileHeight)` |
16:52:07 | FromDiscord | <_gumbercules> you essentially just iterate over your 2d array - for every element in the array you're going to draw a tile and where you draw it is going to depend on the width and height of your tiles |
16:52:40 | FromDiscord | <Chronos [She/Her]> Alright that makes sense I think |
16:52:54 | FromDiscord | <_gumbercules> so if your tiles are 32x32 let's say - the first one is obviously going to go at `map_offset.x + x tileWidth, map_offset.y + y tileWidth` |
16:53:01 | FromDiscord | <_gumbercules> (edit) "tileWidth`" => "tileHeight`" |
16:53:22 | FromDiscord | <_gumbercules> and `x` as well as `y` would be 0, so if the map offset == `0` you're going to put a tile at `0, 0` |
16:53:59 | FromDiscord | <Chronos [She/Her]> Alright gucci |
16:54:01 | FromDiscord | <_gumbercules> next tile would be row `0` column `1` so `x == 0 and y == 1` so you're going to put a tile at `32, 0` |
16:54:04 | FromDiscord | <Chronos [She/Her]> Thanks Gumber! |
16:54:14 | FromDiscord | <Chronos [She/Her]> In reply to @_gumbercules "next tile would be": Yep makes sense |
16:54:20 | FromDiscord | <_gumbercules> sure thing! I've written a lot of 2d tile based games so if you have more questions feel free to ask |
16:54:30 | FromDiscord | <Chronos [She/Her]> I appreciate it :D |
16:54:32 | FromDiscord | <_gumbercules> you can also store your map in a 1d array for efficiency's sake |
16:54:59 | FromDiscord | <_gumbercules> and then use `array[width row + col]` to map from 2d to 1d indices |
16:55:01 | FromDiscord | <Chronos [She/Her]> Huh? How so? By storing tile positions? |
16:55:10 | FromDiscord | <Chronos [She/Her]> Ah |
16:55:22 | FromDiscord | <Chronos [She/Her]> Eh it's fine I think |
16:57:25 | FromDiscord | <toma400> In reply to @_gumbercules "and then use `array[width": This reminds me playing with my library trying to convert its own image type into Pixie's PNG where I needed to convert my nice hashtable into array 😅 ↵It was a bit of a pain, haha |
16:57:35 | FromDiscord | <toma400> (edit) "In reply to @_gumbercules "and then use `array[width": This reminds me playing with my library trying to convert its own image type into Pixie's PNG where I needed to convert my nice hashtable ... into1d" added "of coordinates" | "of coordinatesinto ... array" added "1d" |
17:00:35 | FromDiscord | <Chronos [She/Her]> In a 2D game is it recommended to have all sprites and tiles in a single image? |
17:01:18 | FromDiscord | <Chronos [She/Her]> Or is it better to separate them like `tiles.png`, `enemy/<name>.png`, etc? |
17:06:51 | FromDiscord | <Chronos [She/Her]> I really despise how poorly the VSC extension for Nim works oof |
17:09:39 | FromDiscord | <sOkam! 🫐> In reply to @chronos.vitaqua "I really despise how": you sure its the extension and not nimsuggest in the bg? |
17:10:32 | FromDiscord | <_gumbercules> In reply to @chronos.vitaqua "In a 2D game": yes |
17:10:44 | FromDiscord | <Chronos [She/Her]> I'm p sure it's the extension, if I edit another file after fixing it, and it's already imported in another file, editing the original causes the issue of it just discarding everything |
17:10:49 | FromDiscord | <Chronos [She/Her]> In reply to @_gumbercules "yes": Good to know |
17:11:07 | * | azimut quit (Ping timeout: 252 seconds) |
17:11:32 | FromDiscord | <_gumbercules> it's also a good idea to batch your draw calls and not draw each sprite individually |
17:11:37 | FromDiscord | <_gumbercules> otherwise known as sprite batching |
17:11:45 | * | azimut joined #nim |
17:12:26 | FromDiscord | <Chronos [She/Her]> How would I batch the calls? |
17:12:43 | FromDiscord | <Chronos [She/Her]> I'm using Raylib so idk if I can do that without touching it |
17:13:01 | FromDiscord | <Chronos [She/Her]> Unless you mean just saving the data I need for each call then calling it all at the end? |
17:15:01 | FromDiscord | <_gumbercules> mmm I'm not sure if raylib does this for you or not |
17:15:07 | FromDiscord | <griffith1deadly> as i recall raylib use auto render batching for rectangles |
17:15:36 | FromDiscord | <toma400> In reply to @_gumbercules "yes": Out of curiosity, how does that translate to better performance/quality of code? |
17:15:56 | FromDiscord | <toma400> I mean, I'd be nooby enough to have all my textures separate, so just curious ^^ |
17:16:14 | FromDiscord | <griffith1deadly> https://github.com/raysan5/raylib/blob/557aeff253255a7ce2aac3b1872aeefba6ff2a51/src/rlgl.h#L1339 |
17:18:22 | FromDiscord | <Chronos [She/Her]> Yep just checked, Raylib batches all draw calls |
17:21:03 | FromDiscord | <_gumbercules> In reply to @toma400 "I mean, I'd be": Any time data needs to be sent between the CPU and the GPU you're going create a performance burden |
17:22:08 | FromDiscord | <_gumbercules> the GPU is also going to spend time switching between textures as it has to load them up into memory - so whenever you're binding different texture samplers for each image you watn to draw from, you're degrading your app's performance |
17:22:37 | FromDiscord | <_gumbercules> so this is why spritesheets are a thing - you pack all of your sprites into a single texture and now you only have to bind one texture to the GPU and you can draw all of your sprites simply by sampling portions of that bound texture |
17:22:52 | FromDiscord | <_gumbercules> this is much more performant than asking the GPU to switch contexts frequently and bind to a new texture for each draw call |
17:23:16 | FromDiscord | <Chronos [She/Her]> Hm honestly I'm half-debating on if it's easier to store sprites in a 2D array |
17:23:45 | FromDiscord | <Chronos [She/Her]> Because that way the coordinates match up easily (if I'm drawing an entity with multiple sprites for example) |
17:24:10 | FromDiscord | <_gumbercules> well most later versions of OpenGL do support texture arrays |
17:24:21 | FromDiscord | <Chronos [She/Her]> Texture arrays? |
17:24:26 | FromDiscord | <_gumbercules> so you can have a single texture that has multiple layers and you can sample different layers of the texture |
17:24:33 | FromDiscord | <Chronos [She/Her]> I meant when storing the spritesheet in memory |
17:24:38 | FromDiscord | <_gumbercules> https://www.khronos.org/opengl/wiki/Array_Texture |
17:24:50 | FromDiscord | <Chronos [She/Her]> sent a code paste, see https://play.nim-lang.org/#ix=4Hv4 |
17:25:21 | FromDiscord | <toma400> In reply to @_gumbercules "this is much more": Thanks so much ❤️ that explains a lot to me ^^ |
17:25:49 | FromDiscord | <_gumbercules> @Chronos [She/Her] why not just do something like this - https://github.com/SkyVault/nim-tiled |
17:26:21 | FromDiscord | <_gumbercules> I don't know if I'd use windy or boxy. but I don't think you need to do what you're doing - it seems overly complicated |
17:26:53 | FromDiscord | <_gumbercules> whatever map editor / tile editor software you're using to create your levels - just mirror that with objects in Nim so you can serialize / dserialize between them easily |
17:29:30 | FromDiscord | <Chronos [She/Her]> I don't know how tiled map works at all aha |
17:29:57 | FromDiscord | <Chronos [She/Her]> Also, it's a good learning experience! |
17:31:38 | FromDiscord | <griffith1deadly> In reply to @chronos.vitaqua "Or is it better": you also can load different textures in one texture like it doing minecraft |
17:38:57 | FromDiscord | <Chronos [She/Her]> Wdym? |
17:45:37 | * | ntat quit (Quit: leaving) |
17:57:09 | * | pbsds quit (Ping timeout: 245 seconds) |
18:20:38 | * | ntat joined #nim |
18:45:54 | FromDiscord | <.aingel.> In reply to @jmgomez "how so?": https://github.com/pybind/pybind11 |
18:46:08 | FromDiscord | <.aingel.> Does this give easier c++ interop compared to nim? |
18:48:33 | FromDiscord | <jmgomez> Dont think so |
19:02:10 | * | ntat quit (Quit: leaving) |
19:08:11 | FromDiscord | <.aingel.> In reply to @jmgomez "Dont think so": Why is it then that people say c++ interop is hard with nim? I wrapped a small c++ lib and it didn't seem bad but |
19:08:35 | FromDiscord | <.aingel.> I'm sure there is more to than it, was it templating? Or just weird template tricks, cause it seems like templating itself isn't problematic, is it? |
19:10:45 | FromDiscord | <_gumbercules> In reply to @.aingel. "Why is it then": it's all relative and a lot of people that say things like that often times don't know C++ or Nim that well |
19:11:06 | FromDiscord | <_gumbercules> the situation has improved a lot since @jmgomez started working on their NUE project |
19:11:35 | FromDiscord | <_gumbercules> but I mean - prior to that it was also doable you just couldn't do certain things and certain things were a bit more cumbersome to do than they are now |
19:12:29 | FromDiscord | <_gumbercules> but I mean, difficulty is subjective and many people don't want to take the time to learn how things work and are instead just looking for an ez button |
19:15:09 | FromDiscord | <raynei486> In reply to @.aingel. "Why is it then": ~~c++ interop is hard for any language~~ |
19:15:29 | FromDiscord | <_gumbercules> well it's much more difficult to implement than C interop |
19:15:37 | FromDiscord | <raynei486> yeah |
19:16:09 | FromDiscord | <_gumbercules> but I think difficulty in using an implementation often comes down to how experienced the programmer is in C++ |
19:16:30 | FromDiscord | <_gumbercules> with C - pattern recognition alone is often enough to get a programmer through writing some bindings |
19:16:34 | FromDiscord | <_gumbercules> in C++ that isn't going to be enough |
19:17:16 | FromDiscord | <_gumbercules> unless you have a LOT of example code to consult - and even then you'll probably do things incorrectly |
19:24:05 | FromDiscord | <.aingel.> > minimize boilerplate code in traditional extension modules by inferring type information using compile-time introspection |
19:24:11 | FromDiscord | <.aingel.> pybind11 does this apparently |
19:25:57 | FromDiscord | <raynei486> sent a code paste, see https://play.nim-lang.org/#ix=4Hvq |
19:26:55 | FromDiscord | <_gumbercules> the hell is `test`? |
19:27:01 | * | PMunch quit (Quit: leaving) |
19:27:02 | FromDiscord | <raynei486> (edit) "https://play.nim-lang.org/#ix=4Hvq" => "https://play.nim-lang.org/#ix=4Hvr" |
19:27:15 | FromDiscord | <Elegantbeef> That's a C++ intialisation syntax |
19:27:16 | FromDiscord | <Elegantbeef> It calls a constructor |
19:27:28 | FromDiscord | <Elegantbeef> The issue is likely using `T()` |
19:27:31 | FromDiscord | <_gumbercules> `test` does? |
19:27:44 | FromDiscord | <Elegantbeef> test is the name of the new variable |
19:27:45 | FromDiscord | <_gumbercules> oh yeah the variable is named `test` right |
19:27:52 | FromDiscord | <Elegantbeef> Right |
19:28:06 | FromDiscord | <_gumbercules> yeah see - I barely code in C++ so I always have to rethink through these mind fucks when I get back into it |
19:28:23 | FromDiscord | <Elegantbeef> The first time i seen that syntax I was confused for a whole 10 minutes |
19:28:24 | FromDiscord | <Elegantbeef> It just doesnt make any sense |
19:28:27 | FromDiscord | <_gumbercules> but I mean, that takes about 30 minutes and then I'm fine |
19:28:35 | FromDiscord | <_gumbercules> and I remember all the weird shit |
19:28:40 | FromDiscord | <_gumbercules> that or I just watch this gif |
19:28:42 | FromDiscord | <raynei486> In reply to @Elegantbeef "The issue is likely": yeah |
19:29:01 | FromDiscord | <raynei486> it confuses the compiler whether this is variable declaration or function declaration |
19:29:39 | FromDiscord | <raynei486> it can be interpreted as `test` is a function taking a function pointer that returns `T` |
19:29:43 | FromDiscord | <_gumbercules> https://media.discordapp.net/attachments/371759389889003532/1156311658621309058/6KXBnnAAlbCsV5A-4d23dS-FrxjNxyO5FGVMKIL_SCk.mp4?ex=651482a6&is=65133126&hm=3b203cfa86130e0bfd88b1ce84e8e531a3ebdf626febe13a0c222ffccba39d54& |
19:30:02 | FromDiscord | <raynei486> In reply to @_gumbercules "": my favorite gif |
19:30:19 | FromDiscord | <Elegantbeef> It also can be seen as just wrong 😄 |
19:30:21 | FromDiscord | <raynei486> just funny C++ quirks |
19:30:22 | FromDiscord | <_gumbercules> it's a goodun |
19:30:41 | FromDiscord | <raynei486> oh they introduced a new initialization syntax to cover that case |
19:30:44 | FromDiscord | <Chronos [She/Her]> What if I just ignore the existence of C++? :P |
19:31:03 | FromDiscord | <raynei486> In reply to @raynei486 "oh they introduced a": but that had issues inferring the type |
19:31:07 | FromDiscord | <Elegantbeef> To anyone not using C++ `T name(...)` just appears to be an incorrect variable declaration |
19:31:08 | FromDiscord | <Elegantbeef> You'd be happier |
19:32:26 | FromDiscord | <Elegantbeef> I do wonder if any of the people that contribute to the C++ spec/language design actually write C++ programs |
19:33:23 | FromDiscord | <Elegantbeef> "I heard from someone that it'd be nice if X could be done, so let's implement it in the most obnoxious way just to fuck with them" |
19:33:40 | FromDiscord | <raynei486> I think the committee does have real programmers in there |
19:33:54 | FromDiscord | <raynei486> inside joke is that the library feature group accepts every feature :) |
19:34:02 | FromDiscord | <raynei486> (edit) "feature" => "proposal" |
19:34:21 | FromDiscord | <Elegantbeef> `cout << "Every Feature" << "Regardless how inane" << endl` |
19:36:14 | FromDiscord | <raynei486> yep |
19:36:58 | FromDiscord | <raynei486> In reply to @chronos.vitaqua "What if I just": games: https://media.discordapp.net/attachments/371759389889003532/1156313483999199292/image0.gif?ex=65148459&is=651332d9&hm=63722a6e09f5cd16f7d42225f3cb8e25cf52cc5178c9d954ad3ae622fb77ccc8& |
19:45:21 | FromDiscord | <jmgomez> In reply to @.aingel. "I'm sure there is": I dont know. If you know the basics of C++ and look at the Nim codegen, it's straightforward once you get the hang of it. The syntax is a bit weird maybe that's what turn people off. Im not a C++ expert and my first Nim based project was NUE |
19:46:56 | FromDiscord | <jmgomez> In reply to @_gumbercules "": cant avoid laughing every time I see this one 😛 |
19:51:26 | FromDiscord | <Elegantbeef> > Im not a C++ expert and my first Nim based project was NUE↵"Using Mac, not a C++ expert,... oh I know I should make an obscure language work for UE" 😄 |
19:53:18 | FromDiscord | <jmgomez> 😛 |
19:54:43 | FromDiscord | <Elegantbeef> termer the PR should be good now when you get the time to review |
20:52:03 | * | pbsds joined #nim |
20:58:34 | * | gooba joined #nim |
21:08:13 | * | gooba_ joined #nim |
21:08:19 | * | gooba_ quit (Remote host closed the connection) |
21:08:20 | * | gooba quit (Quit: Leaving) |
21:17:56 | FromDiscord | <.aingel.> What's the None type in nimpy? |
21:18:06 | FromDiscord | <.aingel.> If I need to pass None to a python func |
21:19:36 | termer | Elegantbeef, Taking a look now |
21:20:15 | FromDiscord | <.aingel.> Okay found it |
21:25:13 | FromDiscord | <.aingel.> sent a code paste, see https://play.nim-lang.org/#ix=4HvT |
21:25:26 | FromDiscord | <.aingel.> When I try and run this library it runs in some weird infinite loop thing |
21:25:40 | FromDiscord | <.aingel.> Almost like there are multiple threads going and threads break etc |
21:25:45 | FromDiscord | <.aingel.> It works fine in regular python |
21:26:06 | FromDiscord | <.aingel.> Anyone have an idea as to what is going on? |
21:26:19 | FromDiscord | <.aingel.> I can't even really copy output cause it breaks the terminal and I have to kill the terminal |
21:28:40 | FromDiscord | <.aingel.> ` /Users/saint/code/margaretXML/test -c from multiprocessing.resource_tracker import main;main(9)` |
21:28:53 | FromDiscord | <.aingel.> It's running this in my ps for whatever reason |
21:30:11 | FromDiscord | <.aingel.> It's being run multiple times |
21:30:12 | FromDiscord | <.aingel.> sent a code paste, see https://play.nim-lang.org/#ix=4HvU |
21:42:55 | * | jmdaemon joined #nim |
21:55:28 | * | advesperacit quit () |
22:35:29 | * | derpydoo quit (Ping timeout: 245 seconds) |
22:41:44 | FromDiscord | <.aingel.> I guess it's the downloader thing that has issues |
22:41:52 | FromDiscord | <.aingel.> sent a code paste, see https://play.nim-lang.org/#ix=4Hwb |
22:42:04 | FromDiscord | <.aingel.> I get an error when trying to use the function nlp, but why? |
22:42:22 | FromDiscord | <.aingel.> `/Users/saint/code/margaretXML/test.nim(10, 14) Error: attempting to call routine: 'nlp'` |
23:42:31 | FromDiscord | <.aingel.> Can I cast a pyobj to a pyfunc |