<< 03-02-2025 >>

00:07:45*beholders_eye quit (Ping timeout: 248 seconds)
00:16:46*fallback quit (Read error: Connection reset by peer)
00:24:22*fallback joined #nim
00:46:25FromDiscord<amarevite> i ended up doing some shenanigans to rebuild my git repo as sha1, but i would still like to know if sha256 support is on the roadmap for nimble
00:53:31FromDiscord<odexine> Probably just wasn’t implemented yet
00:59:35*rockcavera joined #nim
01:20:43*SchweinDeBurg quit (Quit: WeeChat 4.6.0-dev)
01:21:15*SchweinDeBurg joined #nim
01:50:34*disso-peach joined #nim
03:21:55*rockcavera quit (Remote host closed the connection)
03:46:14*m5zs7k quit (Ping timeout: 245 seconds)
03:48:07*ensyde joined #nim
03:59:09*m5zs7k joined #nim
04:13:37*m5zs7k quit (Ping timeout: 248 seconds)
04:23:03FromDiscord<Elegantbeef> arkanoid global variables leak and loggers uses one
04:32:00*m5zs7k joined #nim
04:47:11*ensyde quit (Quit: WeeChat 4.5.1)
05:05:40*m5zs7k quit (Ping timeout: 252 seconds)
05:15:43*m5zs7k joined #nim
06:11:59*arkanoid quit (Ping timeout: 260 seconds)
06:16:21*ntat joined #nim
06:30:35*ntat quit (Quit: Leaving)
06:40:06FromDiscord<ichigo7799> Yeah I'm not super into nim/nimble being so integrated that the repo you're using affects it
06:40:11FromDiscord<ichigo7799> and it also being the build system
08:30:36FromDiscord<lowlowcode_96272> If i have a read only string and I want to send it as a parameter to a function, is their a copy ? I mean if I use the `let` keyword, will Nim makes copy of it when I send it to function parameters or object fields ?
08:34:31FromDiscord<Elegantbeef> Since parameters are immutable there is no copy
08:36:15FromDiscord<lowlowcode_96272> okay thanks and same things for object fields ?
08:36:32FromDiscord<Elegantbeef> Correct
08:36:43FromDiscord<Elegantbeef> A copy is only made when an r-value needs to live longer
08:37:08FromDiscord<Elegantbeef> `var myVar = someObj.someField`
08:37:10FromDiscord<lowlowcode_96272> okay because I have func which return slices, in this case its pointer too right ?
08:37:17FromDiscord<Elegantbeef> No
08:37:23FromDiscord<Elegantbeef> `seq[T]` copies
08:37:35FromDiscord<Elegantbeef> Nim does not have a non copying slice that you can return
08:37:58FromDiscord<Elegantbeef> `openArray` is a slice but as it's not memory safe you cannot use it as a return parameter
08:38:32FromDiscord<lowlowcode_96272> sent a code paste, see https://play.nim-lang.org/#pasty=fPtvuxCl
08:38:39FromDiscord<Elegantbeef> Yes
08:38:42FromDiscord<lowlowcode_96272> fuck
08:38:55FromDiscord<lowlowcode_96272> how to avoid that ?
08:39:35FromDiscord<Elegantbeef> sent a code paste, see https://play.nim-lang.org/#pasty=OYfPqVks
08:39:42FromDiscord<Elegantbeef> Otherwise Nim does not have a safe method in the language
08:39:53FromDiscord<Elegantbeef> So you get to make your own slice or refer to other slice libraries
08:41:07FromDiscord<lowlowcode_96272> okay and If I use cstring ?
08:41:16FromDiscord<Elegantbeef> What about it
08:41:28FromDiscord<Elegantbeef> cstring is a null terminated string, slicing by integer is silly
09:38:32FromDiscord<Passvisa> sent a long message, see https://pasty.ee/xcpaVdpr
09:38:32FromDiscord<Passvisa> sent a long message, see https://pasty.ee/ZoFdlMui
09:38:33FromDiscord<Passvisa> sent a long message, see https://pasty.ee/ggGkKiIX
09:38:54FromDiscord<bosinski2023> <@&371760044473319454> pls
09:47:33*beholders_eye joined #nim
09:59:57*ntat joined #nim
10:06:06*beholders_eye quit (Ping timeout: 272 seconds)
10:31:07*ntat quit (Quit: Leaving)
10:41:53*beholders_eye joined #nim
10:46:24*ntat joined #nim
11:05:01*Lord_Nightmare quit (Read error: Connection reset by peer)
11:05:11*Lord_Nightmare2 joined #nim
11:05:24*ntat quit (Quit: Leaving)
11:07:13*Lord_Nightmare2 is now known as Lord_Nightmare
11:11:59FromDiscord<starkiller1493> cant you just copy() or deepCopy()?
11:12:50FromDiscord<starkiller1493> (edit) "copy() or" => "use"
12:33:20FromDiscord<pmunch> Someone (I think treeform) shared a process or library for echo based testing a couple years ago. Anyone remember what that was called?
12:37:10FromDiscord<nnsee> echo based testing?
13:41:59*arkanoid joined #nim
13:51:02*ntat joined #nim
13:51:28FromDiscord<treeform> I do echo based testing, but I don’t use a library
13:52:45FromDiscord<treeform> I prefer https://en.m.wikipedia.org/wiki/Characterization_test and think is a great way to test complex software that under utilized.
13:53:30FromDiscord<summarity> Is there a library or std proc for runtime key-value based formatting? Something like `%`, but instead of a list of positional args, it would take a StringTableRef and substitute keys? E.g. `"Hello {foo}!" % { "foo": "bar" }.newStringTable == "Hello bar"`. Named parameters may repeat.
13:59:17FromDiscord<arkanoid> interesting, never heard about it. Can you make an eli5? Does it mean you record the stdout/err of a progam and compare it between different runs/changes?↵(@treeform)
14:04:54*ntat quit (Read error: Connection reset by peer)
14:05:22*ntat joined #nim
14:10:06*ntat quit (Client Quit)
14:38:12FromDiscord<treeform> In reply to @arkanoid "interesting, never heard about": I have a draft blog post about it: https://blog.istrolid.com/blog/print-testing.html
14:39:16FromDiscord<treeform> > Instead of traditional unit tests, use print-testing—a method inspired by print debugging. Run a script that exercises your code, print key outputs, and save them to a text file. Commit this file to git and use git diff to detect changes. If the output changes unexpectedly, it's an error; if the change is intended, just commit the new output.
14:39:47FromDiscord<treeform> > Try it if you hate writing tests but want better coverage!
14:56:18*greaser|q joined #nim
14:56:33*GreaseMonkey quit (Ping timeout: 276 seconds)
15:04:25FromDiscord<nnsee> i already do this but i didn't realize this was what it was called
15:10:20FromDiscord<treeform> I am not a fan of unit tests, with setup, tare down, glue code and libraries.
15:10:35FromDiscord<treeform> I choose the simple path
15:16:01FromDiscord<Robyn [She/Her]> In reply to @summarity "Is there a library": I feel like that's something you can very easily make yourself since it's not in the stdlib
15:20:40FromDiscord<fabric.input_output> In reply to @treeform "> Instead of traditional": huh I think that's how doctests in elixir work
15:21:40FromDiscord<odexine> Elixir mentioned
16:11:07*zgasma joined #nim
17:08:54*xet7 joined #nim
17:19:55FromDiscord<fae___> Elixir doctests dont snapshot (write to files). They just thru the CLI.
17:19:58FromDiscord<fae___> (edit) "Elixir doctests dont snapshot (write to files). They just ... thru" added "run"
17:20:19FromDiscord<fae___> But being able to put them right in the code next to your implementation is cool. But really only for simple things.
17:44:43FromDiscord<summarity> In reply to @battery.acid.bubblegum "I feel like that's": I did. I'm sure it can be optimized, but it's good enough: https://gist.github.com/turbo/6e3b4e750416b6ab3bed55c7b4c90a62
17:47:40*coldfeet joined #nim
18:24:29*ntat joined #nim
18:37:39*coldfeet quit (Quit: Lost terminal)
19:26:57*beholders_eye quit (Ping timeout: 276 seconds)
19:28:05*beholders_eye joined #nim
19:39:31FromDiscord<arathanis> What is the correct way to allocate a buffer for passing to a C library I am interfacing with?
19:44:33*ntat_ joined #nim
19:44:42*ntat quit (Ping timeout: 246 seconds)
19:44:43*ntat_ is now known as ntat
19:57:05FromDiscord<Elegantbeef> `newSeq[T]()` works
20:02:36FromDiscord<aintea> Is anyone else having extremely slow nimlangserver LSP in neovim ? Everytime I have to use autocompletion, neovim freezes for like .5 seconds and it's horrible
20:03:11FromDiscord<arathanis> In reply to @Elegantbeef "`newSeq[T]()` works": Can you pass it directly to the C function as is or do you have to pass it in a certain way?
20:03:30FromDiscord<arathanis> In this case it is a char buffer.
20:03:35FromDiscord<Elegantbeef> `mySeq[0].addr`
20:03:37FromDiscord<arathanis> Or would I just use `cstring`
20:04:18FromDiscord<Elegantbeef> So in that case `var myString = newString(len)` `someCall(myString.cstring, len)`
20:08:19FromDiscord<arathanis> sent a code paste, see https://play.nim-lang.org/#pasty=iasjGSlD
20:08:33*strogon14 quit (Quit: Auf Wiese geh'n!)
20:09:16FromDiscord<Elegantbeef> Seems fine
20:09:58*strogon14 joined #nim
20:10:07FromDiscord<arathanis> appreciate it.
20:16:09FromDiscord<arathanis> If the C api returns a char I need to deallocate, what is the correct way to do that? I assume it is something like using `importc` on `free`
20:16:32FromDiscord<Elegantbeef> Use the libraries allocation free procedure
20:18:14FromDiscord<arathanis> It does not provide one :/ It is just returning an allocated `char`
20:18:34FromDiscord<Elegantbeef> Well then you do not free it as you do not know it's allocator
20:19:03FromDiscord<arathanis> well since its for an error message and I am goign to abort anyway I guess no harm no foul lol
20:19:40FromDiscord<Elegantbeef> If it's a static error string it's probably statically allocated anyway
20:20:00FromDiscord<arathanis> I wish I trusted the authors that much.
20:29:22*strogon14 quit (Quit: Auf Wiese geh'n!)
20:30:10*strogon14 joined #nim
20:43:15*beholders_eye quit (Ping timeout: 272 seconds)
20:44:40*beholders_eye joined #nim
20:46:03*greaser|q quit (Changing host)
20:46:03*greaser|q joined #nim
20:46:05*greaser|q is now known as GreaseMonkey
20:58:03*kenran joined #nim
21:05:07*kenran quit (Remote host closed the connection)
21:08:16FromDiscord<threefour> What's the state of concepts, and what's the difference between them and, say, interfaces in Go?
21:09:21FromDiscord<aintea> sent a code paste, see https://play.nim-lang.org/#pasty=xZTvEQIB
21:09:36FromDiscord<aintea> I like the result stuff but I cannot code without explicitely returning something
21:10:05FromDiscord<aintea> btw this is test code, I'm trying to make a simple json parser
21:10:27FromDiscord<Elegantbeef> `self[...] = ...` is calling this procedure?
21:10:41FromDiscord<aintea> no
21:10:49FromDiscord<aintea> good remark though
21:10:52FromDiscord<aintea> I'm changing that
21:11:07FromDiscord<aintea> oh no it's not
21:11:13FromDiscord<aintea> it's the array syntax
21:11:26FromDiscord<aintea> key_i_opt is an `Option[uint]`
21:11:48FromDiscord<Elegantbeef> You don't need `return result` anyway
21:11:50FromDiscord<Elegantbeef> That's the point of result
21:12:27FromDiscord<nnsee> i don't see why this shouldn't, logically, work though
21:12:34FromDiscord<nnsee> even if it is redundant
21:12:56FromDiscord<Elegantbeef> Implicit return is disabled if you use `result`
21:13:14FromDiscord<Elegantbeef> sent a code paste, see https://play.nim-lang.org/#pasty=MxOuyIYz
21:13:37FromDiscord<aintea> I remember being able to implicitly return result
21:13:52FromDiscord<aintea> That's why I'm surprised
21:14:11FromDiscord<aintea> In reply to @Elegantbeef "You don't need `return": More readable, I read small functions from bottom to top
21:14:22FromDiscord<aintea> I see what they return then where the return value is processed
21:24:29*rockcavera joined #nim
22:01:59*ntat quit (Quit: Leaving)
22:20:48*beholders_eye quit (Ping timeout: 246 seconds)