<< 23-10-2024 >>

01:20:30*redj joined #nim
04:47:20*ntat joined #nim
04:55:06FromDiscord<yottzumm> If I have an array of this type, how do I index into it? type↵ RArray[T] = object↵ len: int↵ data: ptr UncheckedArray[T]
04:58:11FromDiscord<yottzumm> I'm trying `var anims: RArray[ModelAnimation]↵ anims = loadModelAnimations("resources/JoeSkinTexcoordDisplacerKickUpdate2Export.gltf")↵ echo anims↵ echo anims.data
04:58:44FromDiscord<yottzumm> but I get the message: C:\Users\jcarl\assetmanager\skybox.nim(75, 13) Error: undeclared field: 'data' for type raylib.RArray [type declared in C:\Users\jcarl\.nimble\pkgs2\naylib-24.41-14ddf84cbfb248aabc7c9ff1cf1be35d32469937\raylib.nim(1816, 3)]
05:06:27FromDiscord<michaelb.eth> the `data` field doesn’t seem to be exported (public), otherwise it would be `data` in the type definition
07:12:30FromDiscord<spiderdave> sent a code paste, see https://play.nim-lang.org/#pasty=YegqdMAV
07:13:40FromDiscord<Robyn [She/Her]> sent a code paste, see https://play.nim-lang.org/#pasty=TywaUNxH
07:13:53FromDiscord<Robyn [She/Her]> You should look at the tutorials
07:14:36FromDiscord<Robyn [She/Her]> Also, Nim has tuples too but there's no reason not to use an array, since Nim's array type doesn't change size once declared
07:18:33*ntat quit (Quit: Leaving)
07:18:35FromDiscord<spiderdave> https://i.imgur.com/tqAVFC3.png
07:20:29FromDiscord<Robyn [She/Her]> In reply to @spiderdave "https://i.imgur.com/tqAVFC3.png": i didn't say not to ask here, i said you should look at the tutorials as they'd provide useful info to you
07:20:47FromDiscord<spiderdave> k, i'd still like an answer to my question from someone willing to answer it
07:21:02FromDiscord<Robyn [She/Her]> i did answer it?
07:21:52FromDiscord<spiderdave> you responded, but didn't answer, i asked for how i could do that specific thing in nim
07:22:48FromDiscord<Robyn [She/Her]> sent a code paste, see https://play.nim-lang.org/#pasty=WTieWXFZ
07:22:55FromDiscord<spiderdave> ?
07:22:59FromDiscord<Elegantbeef> Losing battle robyn
07:23:06FromDiscord<Robyn [She/Her]> that's the answer
07:23:32FromDiscord<Robyn [She/Her]> In reply to @Elegantbeef "Losing battle robyn": trying to give the benefit of doubt
07:23:35FromDiscord<spiderdave> oh, sorry i thought that was quoted
07:23:42*SchweinDeBurg quit (Quit: WeeChat 4.5.0-dev)
07:23:52FromDiscord<spiderdave> mb
07:24:08FromDiscord<Robyn [She/Her]> no sweat
07:24:12FromDiscord<spiderdave> i thought i tried, that i must've done something wrong
07:25:36FromDiscord<Robyn [She/Her]> In reply to @spiderdave "i thought i tried,": You probably tried `"foo" in ("foo", ...)` which doesn't work in Nim since tuples aren't iterable
07:26:57*SchweinDeBurg joined #nim
08:28:04FromDiscord<TӨMΛ ☠> sent a long message, see https://pasty.ee/KXUarHIs
08:31:01FromDiscord<TӨMΛ ☠> For context, I installed newest Nim and used finish.exe (including MinGW installation) and I'm trying to test `odsreader` lib - it requires `zip` lib (which isn't noted in their Nimble, so I will do the PR soonish adding that) but it seems like `zip` lib has some issues?
08:31:25FromDiscord<TӨMΛ ☠> (edit) "Nimble," => "nimble file,"
08:55:34FromDiscord<k0ts> That line is just quoting the GCC command and stating that it failed
08:55:44FromDiscord<k0ts> Is the actual error message from GCC not shown above?
09:23:05FromDiscord<TӨMΛ ☠> sent a long message, see https://pasty.ee/MetpLzbC
09:23:54Amun-Razip nimble package requires zlib dev files
09:49:00om3gaHello all! https://play.nim-lang.org/#pasty=mATqcTpx is this a bug?
09:50:00om3gaNim Compiler Version 2.0.4 [MacOSX: amd64] Compiled at 2024-04-25
09:52:56Amun-Rayou mean 8.044499999999999?
09:53:05Amun-Raom3ga: no, that's how floating point numbers work
09:53:20*PMunch joined #nim
09:53:57om3gaAmun-Ra: https://onlinegdb.com/kJd5Ho5X7
09:56:02Amun-Rahmm, I can't connect to onlinegdb
09:56:25om3galet me share using another online compiler
09:56:35Amun-Rabut if you turned nimPreviewSlimSystem on, you have to import std/formatfloat
09:58:11om3gahttps://nextleap.app/online-compiler/c-programming/7rsayi44f
09:58:42FromDiscord<k0ts> See also `-d:nimPreviewFloatRoundtrip` which recently become the default on devel
09:58:52FromDiscord<k0ts> (edit) "become" => "became"
09:59:22om3gaI understand all about rounding errors, but if this non mutable variable is like that during assignment, this isn't good
10:00:29om3gak0ts interesting, but anyway, I don't think that such behaviour is ok
10:06:17Amun-Rawhat do you mean?
10:06:25Amun-Rayou can't store 8.0045 directly
10:06:30FromDiscord<k0ts> 8.0445 cannot be represented exactly in floating point, so 8.0449999... is the best you can get
10:06:43Amun-Rathe value stored is really 8.04449999999999931788
10:07:05Amun-Rayou see 8.0446 printed because of rounding during the print
10:07:08FromDiscord<k0ts> Some programming languages, now including Nim, choose to display it as 8.0445 so it looks better, even though that isn't the actual value stored
10:07:25Amun-Raom3ga: https://float.exposed/0x402016c8b4395810
10:07:34Amun-Ratry to enter 8.0446 there
10:08:05FromDiscord<k0ts> (edit) "8.0449999..." => "8.04449999..."
10:08:30Amun-Raas I was saying, that's how floating point numbers work
10:09:02Amun-Rayou can't have 0.3 either :)
10:09:13Amun-Rahttps://float.exposed/0x3fd3333333333333
10:10:29Amun-Ra"let val = 8.0445" in nim stores exactly the same value as C "double FloatNumber = 8.0445;" the difference is only in print code
10:10:44om3gaso that's misleading
10:10:45om3ga8.044500
10:10:47Amun-Ra(tbh it can differ one value up or down)
10:11:02om3gathis what prints code in C
10:11:07Amun-Rafloat64 can't store 8.044500
10:11:20Amun-Raprintf rouds the value
10:12:32om3gahttps://nextleap.app/online-compiler/c-programming/dntiqqgy1
10:12:42om3gathis is 64 bit float with C
10:12:58om3gaprintf prints properly
10:13:22Amun-Rayou. cannot. store. 8.0445. in. double.
10:14:00om3gaI understand. how you explain C code?
10:14:38Amun-Ralook at the printf implementation
10:14:48om3gathat's what I'm saying
10:15:41om3gashould in this case echo print the value as printf does?
10:16:11Amun-Ratbh I'd like to have the value printed as close to the original value as possible
10:17:19om3gaToday, my colleague has asked me to explain why the calculated results do not match.
10:18:23om3gaI don't know how to explain him rounding errors, and why this number cannot be stored exactly like was assigned, because even I forgot the nuances
10:26:58om3gaAmun-Ra: thank you, import std/formatfloat <- this works
10:27:19om3gabut still, in my opinion that should be on by default
10:37:13Amun-Rahmm, I almost always print floats with specific numer of digits after '.' (fmt"{foo:.4}" etc.)
10:41:59om3gaAmun-Ra: Colleagues' wishes are important, if you know what I mean :)
10:42:08Amun-Ramhm ;>
10:43:25FromDiscord<ringabout> It already prints `8.0445` by default on the devel branch
10:43:42FromDiscord<ringabout> https://github.com/nim-lang/Nim/pull/24300
10:44:14FromDiscord<ringabout> since https://github.com/nim-lang/Nim/pull/24217
10:45:17om3garingabout, I hope this will be added to next stable release
10:50:50om3gadanm I have old version here
11:36:05FromDiscord<ayex> sent a long message, see https://pasty.ee/uUbzNIII
11:37:04FromDiscord<ayex> ah ok, the have that issue already in the tracker. #140
11:45:51FromDiscord<TӨMΛ ☠> In reply to @Amun-Ra "zip nimble package requires": How can I fix that then? 😣 I wish the lib didn't use `zip`, it gives me so much trouble
11:47:08FromDiscord<k0ts> In reply to @ayex "anyone else has this": I had that a while back, fixed after recompiling latest inim with latest nim
11:47:49FromDiscord<ayex> latest stable or latest dev?
11:48:36FromDiscord<k0ts> Latest devel at the time but that was a while ago
11:51:01FromDiscord<ayex> ah ok. thx
11:56:48FromDiscord<ringabout> In reply to @ayex "anyone else has this": It's a bug of its dependency
11:56:50FromDiscord<ringabout> https://github.com/jangko/nim-noise/pull/35
12:00:41FromDiscord<ayex> [ringabout](https://matrix.to/#/%40_discord_658563905425244160%3At2bot.io) \: thank you for the explanation and link on issue. 🙂
12:01:12FromDiscord<ringabout> np
12:32:35*beholders_eye joined #nim
12:49:03*ntat joined #nim
12:55:57*Deadm0th quit (Quit: Twój stary)
13:05:52FromDiscord<xtrayambak> In reply to @Amun-Ra "you can't have 0.3": 0.1 + 0.2 is an interesting one too
14:18:47*lucasta joined #nim
14:24:31FromDiscord<demotomohiro> If you want to learn how floating point numvbe
14:25:21FromDiscord<demotomohiro> If you want to learn how floating point numbers work, search for ieee754.
14:37:43PMunchHmm, no varargs[openArray]? Any way to work around this?
14:48:43PMunch`toOpenArray("", 0, -1)`, this feels very cursed, is there a better way to create an openArray of len 0?
14:49:00FromDiscord<leorize> `[]`
14:49:03PMunch(Trying to have an optional argument and want to default to an empty one)
14:49:08PMunchDoesn't work
14:49:39PMunchOh wait, if I explicitly type `toOpenArray` then it works
14:50:17FromDiscord<leorize> maybe be explicit and go `array[0, T]([])`?
14:50:29FromDiscord<leorize> kinda weird that it doesn't work, though
14:50:55*ntat_ joined #nim
14:51:05PMunch`toOpenArray[char]([], 0, -1)` works
14:51:39*ntat quit (Ping timeout: 260 seconds)
14:51:46*ntat_ quit (Remote host closed the connection)
14:52:08*ntat_ joined #nim
14:52:24PMunchUnfortunately creates a length 1 array to grab a pointer to though..
14:53:37PMunchAha! `toOpenArray(cast[ptr UncheckedArray[char]](nil), 0, -1)`
14:54:41FromDiscord<leorize> that's the most cursed thing I've seen
14:55:57PMunchHaha, yeah it's not great is it..
14:58:04FromDiscord<leorize> usually I managed to just use `[]` so it's weird that you need the dance
15:02:50PMunchWell it worked with `toOpenArray[char]([], 0, -1)`
15:02:56PMunchBut it created more code than I wanted
15:15:09FromDiscord<leorize> I mean usually I don't even need toOpenArray
15:18:56PMunchOh shit, that works..
15:20:44PMunchSame file size and everything..
15:24:13PMunchI just assumed that Nim wouldn't be smart enough to handle that. Silly me
15:31:56Amun-Rawait, toOpenArray[char]([], 0, -1) that's legal?
15:35:15FromDiscord<leorize> nim is dumb but not that dumb
15:51:08*PMunch quit (Quit: Leaving)
15:58:40*beholders_eye quit (Ping timeout: 252 seconds)
15:59:36*beholders_eye joined #nim
16:03:09FromDiscord<buwubie> sent a long message, see https://pasty.ee/adFAbGBa
16:07:59FromDiscord<leorize> it's more that an operator can only be used as an operator in either unary or binary mode
16:08:38FromDiscord<leorize> so `a $$ b` would work, I believe
16:09:02FromDiscord<buwubie> Oh, ok, thank you
16:09:04Amun-Rabuwubie: https://play.nim-lang.org/#pasty=noaISdGg
16:09:11FromDiscord<leorize> but if you want to pass in more than 2 parameters then you can't do it using operator syntax
16:09:20FromDiscord<leorize> you must call it like a function
16:09:43Amun-Raand if function returns a value () are mandatory
16:12:29FromDiscord<buwubie> So i should replace the operator with a named proc
16:13:37Amun-Rathat's a good idea
16:15:40*lucasta quit (Quit: Leaving)
16:16:00FromDiscord<buwubie> Thank you very much
16:43:45*beholders_eye quit (Ping timeout: 252 seconds)
18:43:19*Artea quit (Ping timeout: 264 seconds)
19:06:04*Artea joined #nim
19:15:41*Artea quit (Quit: ZNC 1.8.2 - https://znc.in)
19:20:33*Artea joined #nim
19:57:34*ntat_ quit (Quit: Leaving)
20:45:44*rockcavera joined #nim
23:55:53FromDiscord<spotlightkid> @ringabout\: choosnim's https://nim-lang.org/choosenim/init.sh needs to be updated to the latest version in the repo. It is missing the latest changes in [commit ac77dc5 "supports arm64 on macOS" ](https://github.com/nim-lang/choosenim/commit/fc240acbcfaff5fe8f3eda4bcf5fbafe84a86add).
23:58:23FromDiscord<spotlightkid> @ringabout\: choosenim's https://nim-lang.org/choosenim/init.sh needs to be updated to the latest version in the repo. It is missing the latest changes in [commit ac77dc5 "supports arm64 on macOS" ](https://github.com/nim-lang/choosenim/commit/fc240acbcfaff5fe8f3eda4bcf5fbafe84a86add).