<< 15-05-2024 >>

00:13:56*xet7 quit (Ping timeout: 260 seconds)
00:22:05*xet7 joined #nim
02:11:47NimEventerNew thread by alexeypetrushin: Why not use AI to create momentum in Nim?, see https://forum.nim-lang.org/t/11601
02:51:40*beholders_eye quit (Ping timeout: 260 seconds)
03:05:15FromDiscord<.bobbbob> using norm with sqlite, what's the RIght Way™️ to retry inserting something when DbError: database is locked ie something is concurrently being inserted?
03:25:40*xet7 quit (Remote host closed the connection)
05:01:49*xet7 joined #nim
05:05:02*xet7 quit (Remote host closed the connection)
05:05:32*xet7 joined #nim
05:26:12FromDiscord<.bobbbob> sent a code paste, see https://play.nim-lang.org/#pasty=guIUJsUu
05:28:53FromDiscord<Phil> In reply to @.bobbbob "is this a remotely": No because you can crash your server like that or let your user wait forever for a response. Write yourself a template that does a couple retries and give up after that. ↵If this does not suffice you should solve the underlying problem that causes your dB to be locked all the time
05:30:49FromDiscord<.bobbbob> In reply to @isofruit "No because you can": Sounds good, should I maybe put a teensy pause between retries? It's not all the time, it just very occasionally loses stuff when two things are inserted at the same time.
05:33:15FromDiscord<Phil> In reply to @.bobbbob "Sounds good, should I": That's up to you. If you do that I'd try to do that with sleep async to not block the thread (if your underlying Webserver can process multiple requests on the same thread via async).
05:35:18FromDiscord<Phil> If you do that with sleep keep in mind that sleep will block the thread and make the request take longer than it usually would. ↵For reference, for simple insertions the time spent on your server (given an sqlite dB) is roughly 1-10ms.↵If you sleep for 10ms that means you now need double the threads for the same amount of requests. ↵Could be fine in low request load scenarios, could be bad
05:36:21FromDiscord<.bobbbob> I guess the right way is to check if the database is locked and insert it once it's not but I don't see a way to do that with norm
05:36:43FromDiscord<Phil> You can use raw SQL assuming that can be queried
05:38:11FromDiscord<Phil> Actually, how many connections do you use?
05:44:05FromDiscord<.bobbbob> I think one per thread?
05:48:57*rockcavera quit (Remote host closed the connection)
06:03:41*SchweinDeBurg quit (Quit: WeeChat 4.3.0-dev)
06:04:04*SchweinDeBurg joined #nim
06:20:12*def- quit (Quit: -)
06:20:28*def- joined #nim
06:38:05FromDiscord<.bobbbob> I think Im gonna have to rework a lot of my code to use transactions too
06:45:41*ntat joined #nim
06:59:00*xet7 quit (Ping timeout: 260 seconds)
07:10:52*xet7 joined #nim
07:12:25FromDiscord<Phil> In reply to @.bobbbob "I think Im gonna": Wait, do you have multiple queries that depend on one another and you aren't putting them in transactions?
07:13:00FromDiscord<Phil> Then that's definitely the point to start on.↵Transactions are the absolute baseline you must be using (when you need them) to ensure correctness.
07:13:50FromDiscord<Phil> Generally I'd recommend writing a template that starts and ends the transaction within a scope automatically so you can't possibly forget to close it
07:19:53*ntat quit (Quit: Leaving)
07:30:47FromDiscord<.bobbbob> who would've thought concurrent database programming was tricky
07:45:27FromDiscord<Phil> Me, I would've thought that ↵PTSD flashes in the background
07:55:25FromDiscord<thatben> sent a code paste, see https://play.nim-lang.org/#pasty=ohQHBiOX
08:29:31FromDiscord<demotomohiro> At compile time, write C code that uses the symbols you want to check then compile it by calling C compiler with `gorgeEx`.↵If it compiles without errors, you have the symbols.
08:30:40FromDiscord<demotomohiro> In reply to @thatben "Hi! I'm trying to": I forgot to reply.
08:36:26FromDiscord<thatben> Thanks, I'll give that a try rightaway
08:49:23FromDiscord<pusewicz> sent a code paste, see https://play.nim-lang.org/#pasty=LyirlfQu
08:54:37FromDiscord<Elegantbeef> You made a cyclical data type and hit an orc bug. On an off chance try `--d:useMalloc`
08:58:07FromDiscord<Elegantbeef> Seems it's fixed in devel
08:58:16FromDiscord<Elegantbeef> Just an orc issue and unrelated to the allocator
08:58:51FromDiscord<Elegantbeef> Though refc is lame you could also just do `--mm:refc` and avoid that cyclical issue
08:59:50FromDiscord<Elegantbeef> The cool stylish solution is to avoid cyclical data types but using an a `seq` and storing indexes into that instead of referencces
08:59:58FromDiscord<Elegantbeef> But yea orc does work with devel and this is a bug
09:04:00FromDiscord<demotomohiro> In reply to @pusewicz "https://github.com/pusewicz/wave-function-collapse-": https://github.com/pusewicz/wave-function-collapse-nim/blob/main/src/model.nim#L182↵This code looks wrong as `index` can equal to `lowestEntropyCells.len`.↵I think `sample` proc is better: https://nim-lang.org/docs/random.html#sample%2CopenArray%5BT%5D
09:14:27FromDiscord<pusewicz> Oooh, there is sample, nice!
09:18:35FromDiscord<pusewicz> In reply to @demotomohiro "https://github.com/pusewicz/wave-function-collapse-": This solved the issue, thanks!
09:19:03FromDiscord<pusewicz> In reply to @Elegantbeef "The cool stylish solution": Yeah, I'm trying to get this whole thing to work, and then figure out ways to improve it. I'll definitely will be asking for some code reviews! 😄
09:20:34FromDiscord<ringabout> How I can configure a new gcc compiler for Nim compiler.?I want to switch to `/usr/bin/gcc-14`
09:23:47FromDiscord<ringabout> It seems that I need to change gcc.exe in `congig/nim.cfg`
09:26:02FromDiscord<bandithedoge> use the `--cc` option↵(@ringabout)
09:26:15FromDiscord<bandithedoge> https://nim-lang.org/docs/nimc.html#compiler-usage-commandminusline-switches it's here under advanced options
09:26:23*krux02 joined #nim
09:30:27FromDiscord<ringabout> I don't think this will work
09:30:41FromDiscord<ringabout> Anyway I changed `compilerExe: "gcc-14"` which works for me
10:00:13*def- quit (Quit: -)
10:00:40*def- joined #nim
10:03:35*def- quit (Client Quit)
10:03:56*def- joined #nim
10:15:55*gst joined #nim
11:25:22*ntat joined #nim
12:02:19FromDiscord<System64 ~ Flandre Scarlet> sent a code paste, see https://play.nim-lang.org/#pasty=bMXmGYmO
12:02:46*beholders_eye joined #nim
12:03:01FromDiscord<System64 ~ Flandre Scarlet> So it can either return a Tilemap or a Bitmap?
12:12:17*krux02 quit (Remote host closed the connection)
12:12:33FromDiscord<demotomohiro> When return type is `or` type class, return type must be determined at compile time.
12:13:44FromDiscord<System64 ~ Flandre Scarlet> sent a code paste, see https://play.nim-lang.org/#pasty=XgdvEaui
12:17:31FromDiscord<demotomohiro> sent a code paste, see https://play.nim-lang.org/#pasty=wXfKIOel
12:18:01FromDiscord<System64 ~ Flandre Scarlet> In reply to @demotomohiro "In your case, unless": My code still compiles 🤔
12:20:33FromDiscord<System64 ~ Flandre Scarlet> What can I do if a function can return either a Tilemap or a Bitmap on runtime?
12:21:37FromDiscord<odexine> In reply to @sys64 "What can I do": Object variant
12:23:40FromDiscord<System64 ~ Flandre Scarlet> In reply to @odexine "Object variant": https://nim-lang.org/docs/tut2.html#object-oriented-programming-object-variants↵This?
12:24:20FromDiscord<odexine> Yes
12:25:09FromDiscord<System64 ~ Flandre Scarlet> So I can basically do a LayerItem object and depending of the type, I can set the right field?
12:27:15FromDiscord<odexine> I think you got the right thinking yes
12:27:40FromDiscord<System64 ~ Flandre Scarlet> In reply to @odexine "I think you got": Oh alright, and does it have to be a ref object?
12:27:46FromDiscord<odexine> No
12:28:13FromDiscord<odexine> References only needed when the object stores itself
12:31:27FromDiscord<System64 ~ Flandre Scarlet> Oh alright↵Nim is quite neat, you can replicate some kind of dynamic typing
12:37:36*def- quit (Quit: -)
12:38:08*def- joined #nim
12:40:22FromDiscord<System64 ~ Flandre Scarlet> sent a code paste, see https://play.nim-lang.org/#pasty=yqnStYvN
12:45:27FromDiscord<System64 ~ Flandre Scarlet> Now can I access the Kind parameter?
12:45:39FromDiscord<System64 ~ Flandre Scarlet> like myLayerItem.kind?
12:58:41FromDiscord<odexine> Yeah, its just another field
12:58:51FromDiscord<odexine> But you can’t assign after construction
13:01:04FromDiscord<System64 ~ Flandre Scarlet> In reply to @odexine "But you can’t assign": Is it for all the fields?
13:01:26FromDiscord<System64 ~ Flandre Scarlet> Or only the kind field?
13:02:19FromDiscord<odexine> In reply to @sys64 "Or only the kind": This
13:02:35FromDiscord<System64 ~ Flandre Scarlet> Oh alright↵Makes sense
13:17:59*rockcavera joined #nim
13:31:11*beholders_eye quit (Ping timeout: 264 seconds)
13:39:18*beholders_eye joined #nim
13:41:50*disso-peach joined #nim
13:49:39*def- quit (Quit: -)
13:49:51*def- joined #nim
13:50:59FromDiscord<bung8954> `is not GC-safe as it performs an indirect call` is this certain or just possible ?
14:02:25*gst quit (Quit: Client closed)
14:05:50FromDiscord<threefour> When I had that, I had to add the `{.gcsafe.}` pragma to the caller function to reveal what the actual issue was with indirectly-called function.
14:09:16FromDiscord<bung8954> my dependent lib cause this, it use json key store function name, seems safe, but am not sure safe to use cast forced mark it safe or not
14:11:02*def- quit (Quit: -)
14:11:27*def- joined #nim
14:53:35*beholders_eye quit (Ping timeout: 256 seconds)
15:00:54*def- quit (Quit: -)
15:01:44NimEventerNew thread by Hobbyman: Conversion-to-string-function is hard to find, see https://forum.nim-lang.org/t/11605
15:04:25*def- joined #nim
15:14:52FromDiscord<grumblygibson> In reply to @odexine "But you can’t assign": @System64 ~ Flandre Scarlet ↵In C++ you can assign variants after construction, which is very powerful. Nim is "safe by default" and does not let you modify after construction to change the type, but always lets you trade brevity for power if you really want to do that.↵https://nim-lang.org/docs/manual.html#types-cast-uncheckedassign
15:32:31FromDiscord<System64 ~ Flandre Scarlet> In reply to @grumblygibson "<@380360389377916939> In C++": Quite interesting
15:32:43FromDiscord<System64 ~ Flandre Scarlet> And C++ has variants too?
15:37:00*beholders_eye joined #nim
15:46:39FromDiscord<System64 ~ Flandre Scarlet> Didn't even knew that↵Well, C++ is (VERY) complex
15:53:52FromDiscord<grumblygibson> Just FYI because it's interesting, c++ also has views, iterators (generators), and slices (spans). It's pretty great, but still unsafe by default, and quite verbose. cpp2 pushes cpp closer to nim-like with the safe by default and laconic syntax philosophy.
15:55:37FromDiscord<System64 ~ Flandre Scarlet> In reply to @grumblygibson "Just FYI because it's": Wait CPP2 exists?
15:56:40FromDiscord<grumblygibson> cpp2 is an experimental front end for c++ exploring what the syntax could be like. it generates c++ and compiles for you in the back end, a lot like nim and C. It's being actively developed.
15:57:54FromDiscord<System64 ~ Flandre Scarlet> In reply to @grumblygibson "cpp2 is an experimental": https://github.com/hsutter/cppfront↵Is it that?
15:59:16FromDiscord<System64 ~ Flandre Scarlet> And can we already use CPP2?
16:00:26FromDiscord<grumblygibson> As I understand it, it lacks some of the fancier c++ stuff, but most things are already implemented.
16:01:07FromDiscord<grumblygibson> just look at the commit history timestamps. the energy is impressive
16:01:14*xet7 quit (Ping timeout: 268 seconds)
16:05:33FromDiscord<System64 ~ Flandre Scarlet> What about the build system and library management?
16:05:35FromDiscord<grumblygibson> one thing cpp2 has I wish nim had, which is a better gradual workflow for how to migrate to the new language from existing code. cpp2 is a modular seamless drop-in, allowing heterogeneous code in c++ and cpp2, even within the same file. I'd love nim tooling to get to a point allowing something like this.
16:06:15FromDiscord<grumblygibson> In reply to @sys64 "What about the build": I don't think they touch that, existing tools will keep working for those needs.
16:08:52FromDiscord<System64 ~ Flandre Scarlet> Oh alright↵I don't really like the build and library workflow of C++
16:12:59*xet7 joined #nim
16:22:21FromDiscord<System64 ~ Flandre Scarlet> nimble does its job quite well
16:25:50*coldfeet joined #nim
16:34:15FromDiscord<System64 ~ Flandre Scarlet> sent a code paste, see https://play.nim-lang.org/#pasty=EwemoerA
16:37:30FromDiscord<System64 ~ Flandre Scarlet> Imo it just complexifies the API
16:55:05*disso-peach quit (Quit: Leaving)
17:13:23*def- quit (Quit: -)
17:13:39*def- joined #nim
17:28:24*coldfeet quit (Remote host closed the connection)
18:06:08*def- quit (Quit: -)
18:23:51*def- joined #nim
18:46:52*krux02 joined #nim
18:58:27*xutaxkamay quit (Quit: ZNC 1.8.2+deb3.1 - https://znc.in)
18:59:20*xutaxkamay joined #nim
19:18:54FromDiscord<xkonti> sent a code paste, see https://play.nim-lang.org/#pasty=trykJJjr
19:29:11FromDiscord<rakgew> @xkonti \: thx for the new nim stream/videos (-\:
19:34:54FromDiscord<xkonti> In reply to @rakgew "<@244832576215318528> \: thx for": ♥️ I'm happy to hear some find them useful!
19:36:06FromDiscord<solitudesf> In reply to @xkonti "Has anybody used the": `export dir except getPath, setPath`
19:36:15FromDiscord<solitudesf> In reply to @xkonti "Has anybody used the": the same as import
19:36:49FromDiscord<xkonti> Aaaah... I thought it'd be `export dir except [getPath, setPath]`. Silly me 🤪
19:37:30FromDiscord<xkonti> @solitudesf What if I have 2 overloads of `getPath` and I want to exclude only a specific one? I know I'm pushing it...
19:38:38FromDiscord<solitudesf> In reply to @xkonti "<@104136074569211904> What if I": cant be bothered to test it, but i think if your provide the argument list it should work
19:38:53FromDiscord<xkonti> Ok. I'll try it 🙂
19:41:03FromDiscord<xkonti> Instantly turning into errors. I guess that functionality would be a stretch.
19:41:19FromDiscord<rakgew> for sure. went through the short ones already, now I am looking into the longer stream recordings.↵(@xkonti)
19:42:18*krux02 quit (Quit: Leaving)
19:45:39FromDiscord<xkonti> In reply to @rakgew "for sure. went through": That's great to hear! Tonight will be another stream focusing on the `commonFs` and `osFs`. I'm doing some organizing in the project now so that it's easier to follow.↵I plan to make more short videos (10-20min), where I focus on a single topic and cover EVERYTHING about it (unlike the usual tutorials). Also I hope to make some videos that cover some smaller specific projects. But that will
19:52:49FromDiscord<rakgew> very nice - looking forward!↵really happy to see a stream where a nim project gets built from scratch.
19:54:37FromDiscord<xkonti> I hope it's obvious that I have no idea what I'm doing 😅
19:55:00FromDiscord<.lisuwu_> In reply to @xkonti "I hope it's obvious": hey you'll get over it eventually
19:55:33FromDiscord<.lisuwu_> just have some self confidence :P
19:56:01FromDiscord<xkonti> In reply to @.lisuwu_ "hey you'll get over": That's why I decided to live-stream. Forces me to try explain things I don't understand instead of rage-quitting 😂
19:56:16FromDiscord<.lisuwu_> creative idea actually
19:56:29FromDiscord<.lisuwu_> you have no choice but to go through the pain
19:56:45FromDiscord<xkonti> Yup...
20:00:43FromDiscord<rakgew> well you bring experience from other languages, which is vecry interesting to see.↵(@xkonti)
20:01:03*ntat quit (Quit: Leaving)
20:02:07FromDiscord<rakgew> dong a good job, as far as I seen. (-\:↵(@xkonti)
20:04:34FromDiscord<xkonti> That's what's fun about learning new programming languages. You notice similarities, differences, and what consequences those changes bring. Gives you a different perspective on what you already know.
20:05:29FromDiscord<xkonti> Currently I'm upset that Primeagen is learning Zig instead of Nim 😠
20:07:53FromDiscord<rakgew> sad to hear that. his "review" of nim 2.0 release I found a little strange.
20:08:41FromDiscord<rakgew> right on.↵(@xkonti)
20:27:57FromDiscord<pmunch> @rakgew if you want more Nim stream content you might enjoy mine: https://youtube.com/@peterme
20:33:13FromDiscord<rakgew> @pmunch thank you - I did already, quite enjoyed your streams and videos! \:-D
20:36:03FromDiscord<rakgew> ..also\: every advent of code I hope for pmunch content. (-;
21:38:44*def- quit (Quit: -)
21:39:06*def- joined #nim
22:01:09*def- quit (Quit: -)
22:02:23*def- joined #nim
22:05:13FromDiscord<System64 ~ Flandre Scarlet> Is it normal I always have this? https://media.discordapp.net/attachments/371759389889003532/1240424776695156757/image.png?ex=66468318&is=66453198&hm=94f3230be04300c7cd46276bcfe0aff60a7159ece872c00529ccf0834eab35ed&
22:25:04FromDiscord<jmgomez> In reply to @sys64 "Is it normal I": Nope, fill an issue with a small repro pls
22:30:23FromDiscord<System64 ~ Flandre Scarlet> In reply to @jmgomez "Nope, fill an issue": I just open VS Code
22:30:27FromDiscord<System64 ~ Flandre Scarlet> and I'm on Linux
22:33:27*def- quit (Quit: -)
22:34:09*def- joined #nim
22:54:53*xet7 quit (Remote host closed the connection)
22:56:22FromDiscord<System64 ~ Flandre Scarlet> Btw↵Do you think there is something missing in the Math library?
22:57:58FromDiscord<bulletxbt> Any good books for nim?
22:58:15FromDiscord<System64 ~ Flandre Scarlet> In reply to @bulletxbt "Any good books for": Nim in Action and Mastering Nim
23:41:54FromDiscord<bulletxbt> Is there a nim equivalent for python's `if name == "main"`?
23:44:51FromDiscord<that_dude.> Something along the lines of 'If ismainmodule'
23:44:57FromDiscord<polylokh_39446> `when isMainModule:`
23:52:58FromDiscord<that_dude.> When for compile time, if for run time
23:59:25FromDiscord<__nycto__> Is there a way to enable allocation logging in Nim such that I can see the types that are being created and destroyed? I’m fighting a memory overwrite issue in a large-ish Nim app, and setting a breakpoint in the underlying allocator means I only have visibility into the raw pointer