<< 26-09-2023 >>

00:14:05*jmdaemon joined #nim
00:17:35FromDiscord<Elegantbeef> Termer, this is your captain speaking, stack strings doesnt have a release to coincide with you bumping the nimble version
00:28:31termerEy?
00:28:33termerwhat do I need to do
00:28:44termeroh
00:28:45FromDiscord<Elegantbeef> Make a git tag and release
00:28:48termeryeah, my bad
00:28:49termerlemme do that
00:28:54FromDiscord<Elegantbeef> Or just do `graffiti ./my.nimble`
00:28:59termerI'm too lazy for that
00:29:08termerAre you or other people using the library
00:31:22termerDone
00:31:53FromDiscord<Elegantbeef> Cheers, don't know if I'm going to use stack strings
00:32:06*alphacentauri joined #nim
00:32:17FromDiscord<Elegantbeef> Was talking about TOTP with someone and looked at Nim implementations and seen some issues
00:32:43FromDiscord<Elegantbeef> Replacing the secret with a stack string that's fixed size allocated seems much more ideal over a Nim string
00:32:59FromDiscord<Elegantbeef> But it also means the program only supports a secret up to a given size
00:33:06termerOh yeah
00:33:09termerwell that would be a valid use
00:33:37FromDiscord<Elegantbeef> The major concern I had was that they were using `ref object of X` for their passwords
00:33:44FromDiscord<Elegantbeef> Encouraging a heap related vulnerbillity
00:33:59FromDiscord<Elegantbeef> Which is obviously not the worst thing in the world now that we have Arc/Orc
00:34:00termeroh absolutely, you'd definitely not want something like that
00:34:12termerI like using as little heap as possible
00:34:23FromDiscord<Elegantbeef> But just aliasing once could keep the secret in memory for longer than imagined
00:34:35FromDiscord<Elegantbeef> I'll also probably disable the `=copy` hook
00:35:10termer=copy can be annoying
00:35:16termerI don't like memory being accidentally created
00:35:58FromDiscord<Elegantbeef> Yea that's why many people like to disable their copy hooks
00:36:09FromDiscord<Elegantbeef> Especially in a security setting it should not be enabled
00:42:36FromDiscord<Elegantbeef> hopefully they accept my PR even though it's a breaking change 😄
00:56:24termerwhat's your PR
00:58:36FromDiscord<Elegantbeef> https://github.com/OpenSystemsLab/otp.nim/pull/4/files breaking to say the least
01:41:54*brettgilio joined #nim
01:54:43termerfun times
01:54:52termerWell feel free to use stack_strings
01:55:10termerI can help if you need any changes to it
01:55:39FromDiscord<Elegantbeef> There is no fixed length on how big a secret can be so that's less than ideal
02:00:01termerfair 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:01FromDiscord<millymox> I said python was slow in the python discord and I got cyberbullied
02:59:13FromDiscord<Elegantbeef> You know what they say, the only thing slower than python is a python programmer
02:59:48FromDiscord<Elegantbeef> But really though, don't start language was
03:00:55FromDiscord<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:17FromDiscord<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:34FromDiscord<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:55FromDiscord<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:03FromDiscord<millymox> But I guess they took that personally
03:02:06FromDiscord<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:26FromDiscord<Elegantbeef> Termer there is presently no `proc toStackString(s: openArray[char], size: static int): StackString[size]` eh?
03:23:50termerthere's the ss proc
03:23:55termernot with custom size though
03:24:04FromDiscord<Elegantbeef> That works only for static string
03:24:08termerOh right
03:24:11termerNo simple proc for it, no
03:24:16termeryou create one and then append to it
03:24:20termerI could probably add a thing
03:24:38FromDiscord<Elegantbeef> Yea I'll just append but it's a big ugly 😄
03:28:04FromDiscord<Elegantbeef> Oh your `toOpenArray` is wrong
03:28:08FromDiscord<Elegantbeef> it returns the `\0`
03:31:20termerwhat
03:31:25termerah fuck what
03:31:32termerIs it bugged in this version
03:32:34FromDiscord<Elegantbeef> It is
03:32:49termer8|
03:32:56termercan you file a bug on GitHub so I can fix it
03:33:04termeror a fix if you feel so inclined
03:38:18FromDiscord<Elegantbeef> I wasnt going to make the fix, but it's 2 lines I guess.
03:38:40FromDiscord<Elegantbeef> Merge that and create a release when you get a moment, thanks
03:46:39termerTaking a look now
03:49:26FromDiscord<Elegantbeef> Damn the diff you got must be much different to the one I sent 😛
03:55:53termerDone
03:56:04FromDiscord<Elegantbeef> Danke
03:56:09termerthanks for that
04:16:42FromDiscord<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:54termerSweet
05:39:36*advesperacit joined #nim
06:04:48FromDiscord<firasuke> Could there be an interest in optimised Nim toolchains using gcc + musl?
06:07:52FromDiscord<nnsee> In reply to @firasuke "Could there be an": elaborate? optimized in what way?
06:08:50FromDiscord<firasuke> https://github.com/firasuke/mussel
06:09:53FromDiscord<firasuke> Since Nim transpiles to C, executables would benefit greatly from switching to a smaller libc
06:10:06FromDiscord<odexine> Benefit in what way
06:10:18FromDiscord<firasuke> Kind of similar to how Rust provides regular glibc and musl based toolchain
06:10:24FromDiscord<firasuke> (edit) "toolchain" => "toolchains"
06:10:32FromDiscord<nnsee> you can compile with musl without any issues already
06:10:33FromDiscord<Elegantbeef> Portability is the only real way
06:10:35FromDiscord<nnsee> pretty easily
06:10:43FromDiscord<firasuke> In reply to @nnsee "you can compile with": Yes I know that xD
06:10:44FromDiscord<nnsee> i constantly do that for static binaries
06:11:54FromDiscord<firasuke> But I figured providing a musl + gcc toolchain would be interesting
06:12:29FromDiscord<firasuke> Like currently we're tied to whatever toolchain is provided on the host system
06:12:34FromDiscord<firasuke> Which is definitely not a bad thing
06:12:46FromDiscord<firasuke> It shows how powerful Nim is
06:13:32FromDiscord<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:49FromDiscord<firasuke> I was checking if their might any interest
06:13:59FromDiscord<firasuke> (edit) "I was checking if their might ... any" added "be"
06:14:30FromDiscord<firasuke> (Thinking of it as a way to give back to the Nim community as it's my current field of expertise..)
06:14:32FromDiscord<odexine> Surprising no one has tried talking about “transpile” yet lol
06:14:55FromDiscord<firasuke> What about it xD
06:16:31FromDiscord<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:09FromDiscord<gogolxdong666> Anyone has interests in writing smart contract language for TON blockchain like Tact?
07:09:25FromDiscord<gogolxdong666> (edit) "Anyone has interests in writing smart contract ... language" added "programming"
07:18:31FromDiscord<aintea> sent a code paste, see https://paste.rs/BqUu9
07:18:58FromDiscord<aintea> I can find it on the docs for options, for maps, but not for seqs
07:20:24FromDiscord<Elegantbeef> It does not have any pattern matching built in
07:20:41FromDiscord<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:22FromDiscord<Phil> ... asyncdispatch mildly confuses me with its type useage
08:54:32FromDiscord<odexine> hit us with it
08:54:48FromDiscord<Phil> sent a code paste, see https://play.nim-lang.org/#ix=4Hs3
08:54:56FromDiscord<Phil> In reply to @odexine "hit us with it": I'm an old man Rika, I type slow, gimme a minute 😛
08:55:35FromDiscord<Phil> (edit) "https://play.nim-lang.org/#ix=4Hs3" => "https://play.nim-lang.org/#ix=4Hs4"
08:55:52FromDiscord<odexine> the callback may have sideeffects
08:56:40FromDiscord<odexine> this is a first-sight reactionary message i dont really know what it is yet
08:56:47FromDiscord<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:58FromDiscord<Phil> (edit) "Sure, my point is more why insist that `cb` is of type `proc(fd: AsyncFD): bool` ... if" added "(aka `Callback`)"
08:58:08FromDiscord<odexine> lets say i have a proc that takes in callbacks, and i want to use addprocess on it
08:58:54FromDiscord<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:01FromDiscord<odexine> so its prolly for convenience
09:01:05FromDiscord<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:40FromDiscord<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:12FromDiscord<enthus1ast> but the callback does not fire again since the process is gone
09:05:22FromDiscord<odexine> addprocess executes on poll
09:05:26FromDiscord<odexine> it registers a handle
09:05:44FromDiscord<odexine> all three technically "executes on triggering a condition"
09:06:48FromDiscord<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:04FromDiscord<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:23FromDiscord<odexine> read into the template registerWaitableHandle
09:07:36FromDiscord<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:39FromDiscord<odexine> the call to that template is right under the proccb
09:08:20FromDiscord<odexine> In reply to @isofruit "So its more that": sure
09:08:27FromDiscord<odexine> rather
09:08:38FromDiscord<odexine> no, sure that works
09:08:56FromDiscord<odexine> allow repeated execution -> allow to poll for the same event with the same callback again
09:08:59FromDiscord<enthus1ast> btw addProcess does not work in my test
09:09:07FromDiscord<enthus1ast> can you try it ?
09:09:18FromDiscord<Phil> What's your test code?
09:09:25FromDiscord<Phil> Or rather min example code
09:09:36FromDiscord<enthus1ast> sent a code paste, see https://play.nim-lang.org/#ix=4Hsb
09:09:48FromDiscord<enthus1ast> with your pid of course \:)
09:10:02FromDiscord<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:13FromDiscord<enthus1ast> nice!
09:11:05FromDiscord<enthus1ast> i'm on linux
09:13:49FromDiscord<Phil> Yep, failed on my end as well, attached it to firefox, ran `killall firefox` and nothing happened
09:14:10FromDiscord<enthus1ast> on linux it does not even fail when the process does not exist
09:14:18FromDiscord<enthus1ast> in the first place
09:15:43FromDiscord<Phil> Filing a bug report
09:15:58FromDiscord<enthus1ast> would be interesting if this works on windows
09:21:55*cm quit (Ping timeout: 264 seconds)
09:22:45FromDiscord<Phil> https://github.com/nim-lang/Nim/issues/22758↵There the bug report
09:23:15FromDiscord<Phil> Writing docs: The one thing that you're near guaranteed will inevitably turn into more than just writing docs
09:24:35FromDiscord<Phil> I just wanted to add like 3 lines of doc comments 😢
09:31:52FromDiscord<enthus1ast> \:)
09:32:23FromDiscord<enthus1ast> last words\: "just wanna do this real quick"
09:55:06FromDiscord<Phil> We got anyone here on a windows processor?
09:55:17FromDiscord<Phil> (edit) "processor?" => "system?"
09:56:46FromDiscord<Chronos [She/Her]> Nope
09:56:53FromDiscord<Chronos [She/Her]> Does a VM not do the trick, Phil?
09:58:03FromDiscord<Phil> I'd need to actually know, have the tools and a workflow to start a windowsvm
09:59:59FromDiscord<odexine> and why not figure that out
10:10:58FromDiscord<toma400> In reply to @isofruit "We got anyone here": I mean, yeah, I'm using Win10 yet
10:11:09FromDiscord<Phil> Because lazy
10:11:57FromDiscord<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:28FromDiscord<odexine> works on windows
10:16:03FromDiscord<odexine> `GONE` when proc is killed
10:16:09FromDiscord<odexine> `Error: unhandled exception: The parameter is incorrect.` when pid is invalid
10:16:24FromDiscord<odexine> In reply to @odexine "`Error: unhandled exception: The": (OSError)
10:16:44*pbsds quit (Ping timeout: 248 seconds)
10:18:24FromDiscord<enthus1ast> maybe on linux it just works for processes that are started by the testing process?
10:18:39FromDiscord<enthus1ast> afaik on linux there is a more strict process isolation
10:24:34*pbsds joined #nim
10:28:04FromDiscord<enthus1ast> its stranger, but does also not work
10:28:32FromDiscord<enthus1ast> sent a code paste, see https://play.nim-lang.org/#ix=4HsE
11:12:30FromDiscord<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:42FromDiscord<odexine> yes
11:22:48FromDiscord<odexine> -d:ssl not usessl
11:24:06FromDiscord<System64 ~ Flandre Scarlet> yeah sorryù
11:24:07FromDiscord<System64 ~ Flandre Scarlet> (edit) "sorryù" => "sorry"
11:32:39FromDiscord<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:17FromDiscord<enthus1ast> or use puppy↵(@System64 ~ Flandre Scarlet)
12:03:31FromDiscord<enthus1ast> then there is no need for it, since puppy uses either curl or winapi
12:06:44FromDiscord<sOkam! 🫐> whats different between `nnkAsgn` and `nnkFastAsgn`?
12:08:23FromDiscord<nnsee> one of them's fast
12:08:24FromDiscord<nnsee> duh
12:15:58*gooba quit (Remote host closed the connection)
12:23:23FromDiscord<sOkam! 🫐> 🤦‍♂️ 😄
12:33:46*derpydoo joined #nim
12:47:10NimEventerNew 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:33FromDiscord<System64 ~ Flandre Scarlet> @treeform When I connect to a domain name instead of an IP with Netty, is the IP cached somewhere?
13:44:31FromDiscord<Chronos [She/Her]> In reply to @sys64 "<@107140179025735680> When I connect": Why would it be?
13:45:00FromDiscord<Chronos [She/Her]> Domain names are resolved by a DNS, to get the IP you'd have to follow the location yourself
13:45:04FromDiscord<Chronos [She/Her]> Though maybe I'm wrong
13:50:13FromDiscord<saint._._.> Does python have better cpp interop than nim?
13:51:42FromDiscord<jmgomez> In reply to @saint._._. "Does python have better": how so?
13:51:53FromDiscord<nnsee> sent a code paste, see https://play.nim-lang.org/#ix=4HtI
13:52:36FromDiscord<Chronos [She/Her]> Interesting, but can you access that from within Nim?
13:52:52FromDiscord<nnsee> i'm not sure what you mean by that
13:53:19FromDiscord<nnsee> any name lookup from any application goes through the system's resolver, unless the application rolls its own resolver
13:53:35FromDiscord<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:11FromDiscord<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:26FromDiscord<System64 ~ Flandre Scarlet> Normally it is always cached on the computer
13:55:37FromDiscord<Chronos [She/Her]> 🤷‍♀️ I'd have no way to know bc I don't do this stuff aha
13:55:46FromDiscord<nnsee> In reply to @chronos.vitaqua "🤷‍♀️ I'd have no": right
13:55:54FromDiscord<System64 ~ Flandre Scarlet> Idk if Nim caches this
13:56:09FromDiscord<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:37FromDiscord<System64 ~ Flandre Scarlet> So it is probably fine
13:57:04FromDiscord<Chronos [She/Her]> In reply to @nnsee "nim very likely uses": How about on Windows?
13:57:20FromDiscord<Chronos [She/Her]> I'd imagine crossplatform is always an important factor
13:57:47FromDiscord<nnsee> no clue how windows works, not my field
13:58:26FromDiscord<Chronos [She/Her]> Fair aha
14:00:12FromDiscord<nnsee> but if i had to reckon a guess, it probably works similarly and also does caching
14:00:46FromDiscord<Chronos [She/Her]> Fair
14:00:53FromDiscord<nnsee> performing a DNS request every time you want to do networking would make everything very slow :p
14:01:00FromDiscord<Chronos [She/Her]> Yeah-
14:01:02FromDiscord<nnsee> although... it is windows, so I wouldn't be too surprised
14:01:39FromDiscord<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:05FromDiscord<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:06FromDiscord<Chronos [She/Her]> Sounds like a hellish task to do but interesting for sure
14:03:19FromDiscord<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:33FromDiscord<Chronos [She/Her]> Yeah fair xD
14:04:15NimEventerNew thread by aiac: How to static linking sqlite ?, see https://forum.nim-lang.org/t/10516
14:04:32FromDiscord<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:27FromDiscord<Chronos [She/Her]> Huh, I thought there were quite a few reasons why that's not possible
14:05:41FromDiscord<Chronos [She/Her]> Such as WASM having an essentially unlimited number of registers
14:06:04FromDiscord<Chronos [She/Her]> Tho idk what that actually means aha, just asked that question a while ago and got that answer
14:07:07FromDiscord<Chronos [She/Her]> I can't remember what registers actually store in CPUs lol
14:10:18FromDiscord<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:09FromDiscord<nnsee> In reply to @chronos.vitaqua "I can't remember what": call arguments, call results, intermediate values, etc
14:11:47FromDiscord<nnsee> the short answer is _anything_ (that fits in the registers), but calling conventions more or less dictate what should go where
14:12:20FromDiscord<Chronos [She/Her]> Ah
14:15:30FromDiscord<nnsee> see https://en.wikipedia.org/wiki/X86_calling_conventions?useskin=vector#System_V_AMD64_ABI for an example
14:16:14FromDiscord<nnsee> of course there are special purpose registers as well, like the stack pointer, instruction pointer, segment registers etc
14:16:37FromDiscord<nnsee> https://wiki.osdev.org/CPU_Registers_x86
14:16:59FromDiscord<Chronos [She/Her]> This is really interesting ngl
14:17:21NimEventerNew 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:58FromDiscord<Chronos [She/Her]> Time to work on game some more
16:41:25FromDiscord<Chronos [She/Her]> Map format time... :pain:
16:43:18FromDiscord<Chronos [She/Her]> Wait question about frosty, Beef
16:43:47FromDiscord<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:16FromDiscord<Chronos [She/Her]> Also what does it do for serialising ref objects?
16:45:19FromDiscord<_gumbercules> almost all systems these days are LE
16:45:34FromDiscord<_gumbercules> but generally serialization libraries will pick one endianness and expect the user to handle conversion
16:45:44FromDiscord<_gumbercules> binary serialization libraries anyway
16:45:55FromDiscord<Chronos [She/Her]> In reply to @_gumbercules "almost all systems these": Ah, I thought some actually still used BE
16:45:59FromDiscord<Chronos [She/Her]> Oh well I should be fine
16:46:10FromDiscord<_gumbercules> some still do - but it's rare you're going to encounter them
16:47:04FromDiscord<Chronos [She/Her]> Fair, so I should be fine I hope
16:47:11FromDiscord<_gumbercules> sent a code paste, see https://play.nim-lang.org/#ix=4HuV
16:47:30FromDiscord<_gumbercules> unless you're targeting zOS or RISC you're probably fine
16:47:50FromDiscord<Chronos [She/Her]> Ah
16:48:10FromDiscord<_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:31FromDiscord<Chronos [She/Her]> I have to make a map format... Pain
16:48:43FromDiscord<_gumbercules> mmm 2d maps are pretty simple
16:48:53FromDiscord<_gumbercules> 2d array with numbers representing tile types should be fine
16:49:23FromDiscord<_gumbercules> and then you can use bitmasking to auto-tile
16:49:33FromDiscord<Chronos [She/Her]> Not sure how I'd draw a grid
16:49:55FromDiscord<_gumbercules> nested for loops
16:50:01FromDiscord<Chronos [She/Her]> I know I'm using a 2D array just not sure how to align tiles to a grid
16:50:38FromDiscord<_gumbercules> `for x in 0 ..< map.width: for y in 0 ..< map.height: drawTile(map[x][y], mapTileWidth, mapTileHeight)`
16:52:07FromDiscord<_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:40FromDiscord<Chronos [She/Her]> Alright that makes sense I think
16:52:54FromDiscord<_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:01FromDiscord<_gumbercules> (edit) "tileWidth`" => "tileHeight`"
16:53:22FromDiscord<_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:59FromDiscord<Chronos [She/Her]> Alright gucci
16:54:01FromDiscord<_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:04FromDiscord<Chronos [She/Her]> Thanks Gumber!
16:54:14FromDiscord<Chronos [She/Her]> In reply to @_gumbercules "next tile would be": Yep makes sense
16:54:20FromDiscord<_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:30FromDiscord<Chronos [She/Her]> I appreciate it :D
16:54:32FromDiscord<_gumbercules> you can also store your map in a 1d array for efficiency's sake
16:54:59FromDiscord<_gumbercules> and then use `array[width row + col]` to map from 2d to 1d indices
16:55:01FromDiscord<Chronos [She/Her]> Huh? How so? By storing tile positions?
16:55:10FromDiscord<Chronos [She/Her]> Ah
16:55:22FromDiscord<Chronos [She/Her]> Eh it's fine I think
16:57:25FromDiscord<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:35FromDiscord<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:35FromDiscord<Chronos [She/Her]> In a 2D game is it recommended to have all sprites and tiles in a single image?
17:01:18FromDiscord<Chronos [She/Her]> Or is it better to separate them like `tiles.png`, `enemy/<name>.png`, etc?
17:06:51FromDiscord<Chronos [She/Her]> I really despise how poorly the VSC extension for Nim works oof
17:09:39FromDiscord<sOkam! 🫐> In reply to @chronos.vitaqua "I really despise how": you sure its the extension and not nimsuggest in the bg?
17:10:32FromDiscord<_gumbercules> In reply to @chronos.vitaqua "In a 2D game": yes
17:10:44FromDiscord<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:49FromDiscord<Chronos [She/Her]> In reply to @_gumbercules "yes": Good to know
17:11:07*azimut quit (Ping timeout: 252 seconds)
17:11:32FromDiscord<_gumbercules> it's also a good idea to batch your draw calls and not draw each sprite individually
17:11:37FromDiscord<_gumbercules> otherwise known as sprite batching
17:11:45*azimut joined #nim
17:12:26FromDiscord<Chronos [She/Her]> How would I batch the calls?
17:12:43FromDiscord<Chronos [She/Her]> I'm using Raylib so idk if I can do that without touching it
17:13:01FromDiscord<Chronos [She/Her]> Unless you mean just saving the data I need for each call then calling it all at the end?
17:15:01FromDiscord<_gumbercules> mmm I'm not sure if raylib does this for you or not
17:15:07FromDiscord<griffith1deadly> as i recall raylib use auto render batching for rectangles
17:15:36FromDiscord<toma400> In reply to @_gumbercules "yes": Out of curiosity, how does that translate to better performance/quality of code?
17:15:56FromDiscord<toma400> I mean, I'd be nooby enough to have all my textures separate, so just curious ^^
17:16:14FromDiscord<griffith1deadly> https://github.com/raysan5/raylib/blob/557aeff253255a7ce2aac3b1872aeefba6ff2a51/src/rlgl.h#L1339
17:18:22FromDiscord<Chronos [She/Her]> Yep just checked, Raylib batches all draw calls
17:21:03FromDiscord<_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:08FromDiscord<_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:37FromDiscord<_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:52FromDiscord<_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:16FromDiscord<Chronos [She/Her]> Hm honestly I'm half-debating on if it's easier to store sprites in a 2D array
17:23:45FromDiscord<Chronos [She/Her]> Because that way the coordinates match up easily (if I'm drawing an entity with multiple sprites for example)
17:24:10FromDiscord<_gumbercules> well most later versions of OpenGL do support texture arrays
17:24:21FromDiscord<Chronos [She/Her]> Texture arrays?
17:24:26FromDiscord<_gumbercules> so you can have a single texture that has multiple layers and you can sample different layers of the texture
17:24:33FromDiscord<Chronos [She/Her]> I meant when storing the spritesheet in memory
17:24:38FromDiscord<_gumbercules> https://www.khronos.org/opengl/wiki/Array_Texture
17:24:50FromDiscord<Chronos [She/Her]> sent a code paste, see https://play.nim-lang.org/#ix=4Hv4
17:25:21FromDiscord<toma400> In reply to @_gumbercules "this is much more": Thanks so much ❤️ that explains a lot to me ^^
17:25:49FromDiscord<_gumbercules> @Chronos [She/Her] why not just do something like this - https://github.com/SkyVault/nim-tiled
17:26:21FromDiscord<_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:53FromDiscord<_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:30FromDiscord<Chronos [She/Her]> I don't know how tiled map works at all aha
17:29:57FromDiscord<Chronos [She/Her]> Also, it's a good learning experience!
17:31:38FromDiscord<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:57FromDiscord<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:54FromDiscord<.aingel.> In reply to @jmgomez "how so?": https://github.com/pybind/pybind11
18:46:08FromDiscord<.aingel.> Does this give easier c++ interop compared to nim?
18:48:33FromDiscord<jmgomez> Dont think so
19:02:10*ntat quit (Quit: leaving)
19:08:11FromDiscord<.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:35FromDiscord<.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:45FromDiscord<_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:06FromDiscord<_gumbercules> the situation has improved a lot since @jmgomez started working on their NUE project
19:11:35FromDiscord<_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:29FromDiscord<_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:09FromDiscord<raynei486> In reply to @.aingel. "Why is it then": ~~c++ interop is hard for any language~~
19:15:29FromDiscord<_gumbercules> well it's much more difficult to implement than C interop
19:15:37FromDiscord<raynei486> yeah
19:16:09FromDiscord<_gumbercules> but I think difficulty in using an implementation often comes down to how experienced the programmer is in C++
19:16:30FromDiscord<_gumbercules> with C - pattern recognition alone is often enough to get a programmer through writing some bindings
19:16:34FromDiscord<_gumbercules> in C++ that isn't going to be enough
19:17:16FromDiscord<_gumbercules> unless you have a LOT of example code to consult - and even then you'll probably do things incorrectly
19:24:05FromDiscord<.aingel.> > minimize boilerplate code in traditional extension modules by inferring type information using compile-time introspection
19:24:11FromDiscord<.aingel.> pybind11 does this apparently
19:25:57FromDiscord<raynei486> sent a code paste, see https://play.nim-lang.org/#ix=4Hvq
19:26:55FromDiscord<_gumbercules> the hell is `test`?
19:27:01*PMunch quit (Quit: leaving)
19:27:02FromDiscord<raynei486> (edit) "https://play.nim-lang.org/#ix=4Hvq" => "https://play.nim-lang.org/#ix=4Hvr"
19:27:15FromDiscord<Elegantbeef> That's a C++ intialisation syntax
19:27:16FromDiscord<Elegantbeef> It calls a constructor
19:27:28FromDiscord<Elegantbeef> The issue is likely using `T()`
19:27:31FromDiscord<_gumbercules> `test` does?
19:27:44FromDiscord<Elegantbeef> test is the name of the new variable
19:27:45FromDiscord<_gumbercules> oh yeah the variable is named `test` right
19:27:52FromDiscord<Elegantbeef> Right
19:28:06FromDiscord<_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:23FromDiscord<Elegantbeef> The first time i seen that syntax I was confused for a whole 10 minutes
19:28:24FromDiscord<Elegantbeef> It just doesnt make any sense
19:28:27FromDiscord<_gumbercules> but I mean, that takes about 30 minutes and then I'm fine
19:28:35FromDiscord<_gumbercules> and I remember all the weird shit
19:28:40FromDiscord<_gumbercules> that or I just watch this gif
19:28:42FromDiscord<raynei486> In reply to @Elegantbeef "The issue is likely": yeah
19:29:01FromDiscord<raynei486> it confuses the compiler whether this is variable declaration or function declaration
19:29:39FromDiscord<raynei486> it can be interpreted as `test` is a function taking a function pointer that returns `T`
19:29:43FromDiscord<_gumbercules> https://media.discordapp.net/attachments/371759389889003532/1156311658621309058/6KXBnnAAlbCsV5A-4d23dS-FrxjNxyO5FGVMKIL_SCk.mp4?ex=651482a6&is=65133126&hm=3b203cfa86130e0bfd88b1ce84e8e531a3ebdf626febe13a0c222ffccba39d54&
19:30:02FromDiscord<raynei486> In reply to @_gumbercules "": my favorite gif
19:30:19FromDiscord<Elegantbeef> It also can be seen as just wrong 😄
19:30:21FromDiscord<raynei486> just funny C++ quirks
19:30:22FromDiscord<_gumbercules> it's a goodun
19:30:41FromDiscord<raynei486> oh they introduced a new initialization syntax to cover that case
19:30:44FromDiscord<Chronos [She/Her]> What if I just ignore the existence of C++? :P
19:31:03FromDiscord<raynei486> In reply to @raynei486 "oh they introduced a": but that had issues inferring the type
19:31:07FromDiscord<Elegantbeef> To anyone not using C++ `T name(...)` just appears to be an incorrect variable declaration
19:31:08FromDiscord<Elegantbeef> You'd be happier
19:32:26FromDiscord<Elegantbeef> I do wonder if any of the people that contribute to the C++ spec/language design actually write C++ programs
19:33:23FromDiscord<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:40FromDiscord<raynei486> I think the committee does have real programmers in there
19:33:54FromDiscord<raynei486> inside joke is that the library feature group accepts every feature :)
19:34:02FromDiscord<raynei486> (edit) "feature" => "proposal"
19:34:21FromDiscord<Elegantbeef> `cout << "Every Feature" << "Regardless how inane" << endl`
19:36:14FromDiscord<raynei486> yep
19:36:58FromDiscord<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:21FromDiscord<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:56FromDiscord<jmgomez> In reply to @_gumbercules "": cant avoid laughing every time I see this one 😛
19:51:26FromDiscord<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:18FromDiscord<jmgomez> 😛
19:54:43FromDiscord<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:56FromDiscord<.aingel.> What's the None type in nimpy?
21:18:06FromDiscord<.aingel.> If I need to pass None to a python func
21:19:36termerElegantbeef, Taking a look now
21:20:15FromDiscord<.aingel.> Okay found it
21:25:13FromDiscord<.aingel.> sent a code paste, see https://play.nim-lang.org/#ix=4HvT
21:25:26FromDiscord<.aingel.> When I try and run this library it runs in some weird infinite loop thing
21:25:40FromDiscord<.aingel.> Almost like there are multiple threads going and threads break etc
21:25:45FromDiscord<.aingel.> It works fine in regular python
21:26:06FromDiscord<.aingel.> Anyone have an idea as to what is going on?
21:26:19FromDiscord<.aingel.> I can't even really copy output cause it breaks the terminal and I have to kill the terminal
21:28:40FromDiscord<.aingel.> ` /Users/saint/code/margaretXML/test -c from multiprocessing.resource_tracker import main;main(9)`
21:28:53FromDiscord<.aingel.> It's running this in my ps for whatever reason
21:30:11FromDiscord<.aingel.> It's being run multiple times
21:30:12FromDiscord<.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:44FromDiscord<.aingel.> I guess it's the downloader thing that has issues
22:41:52FromDiscord<.aingel.> sent a code paste, see https://play.nim-lang.org/#ix=4Hwb
22:42:04FromDiscord<.aingel.> I get an error when trying to use the function nlp, but why?
22:42:22FromDiscord<.aingel.> `/Users/saint/code/margaretXML/test.nim(10, 14) Error: attempting to call routine: 'nlp'`
23:42:31FromDiscord<.aingel.> Can I cast a pyobj to a pyfunc