<< 05-08-2022 >>

00:02:08FromDiscord<voidwalker> Anyone got some better docs for understanding spawn/threads ? I read it 3 times and I can't figure out how it works
00:02:33FromDiscord<voidwalker> And the example in "nim in action" is super convoluted and bloaty
00:04:09FromDiscord<!Patitotective> In reply to @voidwalker "Anyone got some better": this looks good enough for me 🤷‍♂️ https://nim-lang.org/docs/threads.html
00:04:32FromDiscord<voidwalker> seriously now ?
00:04:49FromDiscord<voidwalker> echo i ? who spawns a new thread to do an echo ?
00:05:05FromDiscord<!Patitotective> its an example
00:05:41FromDiscord<voidwalker> https://nim-lang.org/docs/manual_experimental.html#parallel-amp-spawn
00:05:43FromDiscord<voidwalker> I read this
00:08:56*CyberTailor quit (Read error: Connection reset by peer)
00:09:49*CyberTailor joined #nim
00:10:26FromDiscord<Elegantbeef> I think it's mostly suggested to either use createThread manually, Weave or Taskpools
00:14:08FromDiscord<voidwalker> hah this is a funny pattern now
00:14:18FromDiscord<voidwalker> how come for every module in std there is a better/fancier alternative
00:17:37FromDiscord<Elegantbeef> In this case it's cause it was an experimental API
00:28:02FromDiscord<voidwalker> I want to have n instance of a proc that downloads a webpage and returns a string which gets updated/inserted in a database. Can this be maybe done with async/await ?
00:28:43FromDiscord<Elegantbeef> Yes most likely
00:29:56FromDiscord<Elegantbeef> @gibson\: templates and procedures dont use `mixin` the same
00:30:09FromDiscord<Elegantbeef> Templates always 'mixin' scope due to how they work
00:30:55FromDiscord<Elegantbeef> sent a code paste, see https://play.nim-lang.org/#ix=46Hg
00:31:07FromDiscord<Elegantbeef> Cause templates are code substitution
00:31:29FromDiscord<Elegantbeef> `mixin` and `bind ` generally are just used when you have a bug binding a symbol from the template scope
00:32:20FromDiscord<gibson> Depending how they're called, as you pointed out. They don't always mixin the scope the same way when there's another match available. Not sure if that's actually what's going on, but that's what I'm observing.
00:33:01FromDiscord<gibson> In my case I have to specify `mixin` otherwise the template won't have the symbol binding in its body bind the way I want.
00:33:19FromDiscord<Elegantbeef> Do you have a `getToken` in the scope of your template?
00:33:33FromDiscord<gibson> Yes, it's imported.
00:34:08*def- quit (Quit: -)
00:34:09FromDiscord<b1rdf00d> In reply to @Elegantbeef "I think it's mostly": the docs say `parallel` is the preferred (stdlib) way to add threads to Nim, is this the case or outdated / contended?
00:34:09FromDiscord<!&luke> Does nim have any good mongodb librarys
00:34:15FromDiscord<!&luke> (edit) "librarys" => "libraries"
00:34:51*def- joined #nim
00:37:10FromDiscord<Elegantbeef> Nim 2.0's rfc↵@b1rdf00d)
00:39:32FromDiscord<!&luke> In reply to @ripluke "Does nim have any": Hmm guess not
00:39:46FromDiscord<!&luke> I’ll just use norm with postgres
00:39:58FromDiscord<Elegantbeef> https://nimble.directory/search?query=mongodb
00:40:02FromDiscord<Elegantbeef> We're not a search engine 😄
00:40:19FromDiscord<!Patitotective> you won me beef https://media.discordapp.net/attachments/371759389889003532/1004911694469922867/unknown.png
00:40:32FromDiscord<Elegantbeef> I dont want you
00:40:38FromDiscord<Elegantbeef> I default on this win
00:40:57FromDiscord<!Patitotective> not when you're sleeping
00:41:12FromDiscord<b1rdf00d> In reply to @Elegantbeef "Nim 2.0's rfc >": thanks!
00:41:14FromDiscord<!&luke> In reply to @Elegantbeef "We're not a search": 💀 yea I didn’t like how any of them worked
00:41:24FromDiscord<!&luke> Norm just uses types so it’s easy
00:44:05FromDiscord<!Patitotective> make your own lmao
00:44:11FromDiscord<!Patitotective> (edit) "lmao" => "lol"
00:48:53FromDiscord<Prestige> I'm inches away from starting my own text editor for Nim
00:49:08FromDiscord<Prestige> I'm so tired of dumb neovim bugs, lua, etc
00:49:32FromDiscord<Elegantbeef> Lapce 😄
00:49:41FromDiscord<Elegantbeef> Though it's written in rust
00:50:53FromDiscord<Prestige> Eh I don't trust their code to not suck
00:51:04FromDiscord<Elegantbeef> The compiler literally does that 😛
00:51:05FromDiscord<Prestige> Also we shouldn't need LSP
00:51:26FromDiscord<Prestige> Nah you can still write crap code in rust
00:51:34FromDiscord<Elegantbeef> I know i was joking
00:51:40FromDiscord<Prestige> Okay good lol
00:51:57FromDiscord<Elegantbeef> I already abide by poes law but i need to extend it further
00:52:16FromDiscord<Elegantbeef> The compiler literally does that 😛 😄 🙃 😛
00:52:30FromDiscord<Prestige> Beautiful
00:52:52FromDiscord<Prestige> If I write my own editor I'm definitely not supporting LSP
00:53:14FromDiscord<Elegantbeef> Already want your editor to be dead
00:53:16FromDiscord<Elegantbeef> Interesting
00:53:51FromDiscord<Prestige> There's no real reason an editor needs to communicate with an external process to understand things about the code, it could be faster just doing that work internally as a plugin
00:54:31FromDiscord<Prestige> Or built-in
00:54:39FromDiscord<Elegantbeef> Yea just hardcode every languages semantic analysis into the editor
00:55:02FromDiscord<Prestige> I just need it for Nim. And I could provide a plugin api for other languages
00:55:49FromDiscord<!&luke> In reply to @Avahe "I'm so tired of": What bugs
00:55:54FromDiscord<Elegantbeef> The fun part is if your analysis part of the code crashes your entire editor crashes
00:56:29FromDiscord<Prestige> One big issue I'm running into, is running nim code with a key binding. It bogs down my whole computer, don't know why
00:56:48FromDiscord<Prestige> In reply to @Elegantbeef "The fun part is": Nah you don't have to close the editor
00:56:55FromDiscord<Elegantbeef> What?
00:56:56FromDiscord<!&luke> In reply to @Avahe "One big issue I'm": Vs or lua?
00:57:29FromDiscord<gibson> In reply to @Avahe "I'm so tired of": Have you tried moe? https://github.com/fox0430/moe
00:57:52FromDiscord<Prestige> In reply to @ripluke "Vs or lua?": Keybinding is in vimscript, just doing :term nim r %s basically
00:57:58FromDiscord<Elegantbeef> I dont think moe has semantic analysis
00:58:08FromDiscord<Prestige> Which runs fine if I manually do that, not using a key binding
00:58:27FromDiscord<Prestige> In reply to @gibson "Have you tried moe?": Yeah I contributed to it actually, but it's missing too much
00:58:28FromDiscord<gibson> It does not, but it would reduce the effort of writing a text editor & plugin system manually, to more quickly get to the conclusion that it's a bad idea :p
00:58:48FromDiscord<Prestige> In reply to @gibson "It does not, but": It's a good idea
00:58:51FromDiscord<Elegantbeef> Oh cool they want to rewrite moe
00:59:08FromDiscord<Prestige> Nah I'd take a different approach than moe
00:59:18FromDiscord<Elegantbeef> Not you
00:59:21FromDiscord<Elegantbeef> The author of moe
00:59:28FromDiscord<Elegantbeef> https://github.com/fox0430/moe/issues/1483
00:59:34FromDiscord<Prestige> Interesting
00:59:35FromDiscord<!&luke> In reply to @Avahe "Keybinding is in vimscript,": compiling is resource intensive
01:00:16FromDiscord<Prestige> In reply to @ripluke "compiling is resource intensive": It only does that if I run it I with a keybinding
01:00:22FromDiscord<Prestige> Otherwise it's fine
01:00:55FromDiscord<!&luke> For me cc takes all available cpu
01:09:24FromDiscord<Rika> In reply to @Avahe "I just need it": Yeah because it’s definitely more desirable for someone to write a plugin than to already have the support via LSP?
01:11:44FromDiscord<Prestige> I think it's more desirable to have a program just do some work, rather that have to do the work and communicate data over a socket to another program. I think LSP just wasn't a great idea in the first place
01:12:48FromDiscord<Prestige> If more things like LSP become mainstream, our editors are going to be talking to multiple other processes on our computers communicating over sockets. Just going to be a mess and ultimate add to the list of things computers do slowly for no good reason
01:13:36FromDiscord<!&luke> Lsp is pretty much universal
01:13:52FromDiscord<Elegantbeef> I dont see how it makes it slower but ok
01:14:33FromDiscord<Prestige> I don't see how communicating over a socket couldn't be slower than just not doing it
01:14:39FromDiscord<Elegantbeef> Pipes exist and they're fast
01:14:48FromDiscord<Prestige> sure, but it's work that doesn't need to be done at all
01:15:14FromDiscord<Elegantbeef> Is the IO even really the slowdown of a text editor
01:15:32FromDiscord<!&luke> In reply to @Avahe "I don't see how": The alternative is to write a plugin for every text editor
01:15:43FromDiscord<Elegantbeef> The presumption is it's a significant slowdown
01:16:03FromDiscord<Prestige> doesn't even have to be significant - also it just increases complexity
01:16:15FromDiscord<Prestige> Like I can just write an editor that does what I want it to, right there in the program
01:16:19FromDiscord<!&luke> In reply to @ripluke "The alternative is to": It’s just not very feasible
01:16:40FromDiscord<Elegantbeef> You can do what you want in the program, the downside is you now have a very very rigid text editor
01:16:42FromDiscord<Prestige> Well I'm not concerned with every text editor or every language
01:17:00FromDiscord<Elegantbeef> The reason LSP exists is to remove the rigidity of editors
01:17:03FromDiscord<Prestige> Not rigid if it has a plugin system
01:17:09FromDiscord<Elegantbeef> It is rigid
01:17:16FromDiscord<Prestige> That's basically all LSP is
01:17:55FromDiscord<Elegantbeef> Cause i now have to re-implement the LSP capabilities for your plugin system
01:18:00FromDiscord<Prestige> LSP doesn't remove rigidity
01:18:06FromDiscord<Elegantbeef> It very much does
01:18:21FromDiscord<Elegantbeef> You remove having to rewrite code that is pretty much universal
01:18:32FromDiscord<Prestige> The editor has to support the protocol, it's as rigid as the protocol is
01:18:53FromDiscord<Elegantbeef> With LSP supported you can just use any language server you want and it just works
01:19:27FromDiscord<Prestige> With a plugin system you can use any language that has a plugin and it just works
01:19:29FromDiscord<Prestige> I don't get your point
01:19:39FromDiscord<Elegantbeef> You have to write the plugin specifically for your editor
01:19:43FromDiscord<Elegantbeef> It's a bunch of repeated work
01:20:11FromDiscord<!&luke> In reply to @Elegantbeef "You have to write": Yea
01:20:18FromDiscord<Elegantbeef> The LSP works anywhere your plugin works at a single spot
01:20:35FromDiscord<Prestige> That still has no effect on the rigidity of the editor
01:20:43FromDiscord<Elegantbeef> What?
01:20:54FromDiscord<Prestige> They would both have the same capabilities
01:21:26FromDiscord<Elegantbeef> The rigidity of editors i'm talking about is when they use their own plugin system you're locked there
01:21:27FromDiscord<Elegantbeef> You cannot easily move to another editor
01:21:53FromDiscord<!Patitotective> In reply to @Avahe "They would both have": well, yes↵if you implement all LSP features in your plugin they'll have the same features
01:22:02FromDiscord<Prestige> Yeah exactly
01:23:03FromDiscord<Elegantbeef> I do wonder In what way is a plugin system less complex than supporting LSP
01:23:10*krux02 quit (Remote host closed the connection)
01:23:22FromDiscord<!Patitotective> what about making your own efficient LSP lmao
01:23:44FromDiscord<Prestige> The most efficient lsp is basically just a plugin
01:23:51FromDiscord<!Patitotective> and then make a text editor that supports both
01:24:04FromDiscord<Elegantbeef> The most efficient LSP no LSP
01:24:33FromDiscord<Prestige> imo editors shouldn't be like interfacing with servers that do some work, that's just bonkers to me
01:24:45FromDiscord<Elegantbeef> Code resuse is a wonderful thing
01:24:49FromDiscord<Elegantbeef> reuse\
01:25:05FromDiscord<Prestige> Slow computers in the 2020s makes me sad
01:25:14FromDiscord<Elegantbeef> Sure is the LSP the actual slowdown though
01:25:16FromDiscord<Prestige> hardware has advanced so far and shit is slower than ever
01:25:37FromDiscord<Elegantbeef> Yea wirth had a good point in 1995, but I'm very dubious of the claim that LSPs are the reason for slow software
01:25:54FromDiscord<Prestige> I think LSP is the wrong approach and systems/designs like LSP will drive us further from fast computers
01:26:13FromDiscord<Elegantbeef> Do you have empirical evidence to the claim that LSPs are actually slowing down operations?
01:26:21FromDiscord<Prestige> Yes
01:26:34FromDiscord<Prestige> The laws of physics
01:26:39FromDiscord<Elegantbeef> Ok so no
01:26:58FromDiscord<Prestige> Sending data back and forth over a socket cannot be faster than not doing it at all
01:27:10FromDiscord<Elegantbeef> That's under the assumption that's the bottle neck of a program
01:27:30FromDiscord<Prestige> I'm not talking about bottlenecks of a program, I'm talking about LSP
01:27:31FromDiscord<Elegantbeef> You lack evidence for the claim that LSP is actually causing programs to be slow
01:27:44FromDiscord<Elegantbeef> You are saying programs are slow, due to the socket approach of LSP
01:27:47FromDiscord<Prestige> I think you're missing my point
01:27:57FromDiscord<Elegantbeef> "IO is slow"
01:28:08FromDiscord<Prestige> My whole point is that doing IO is slower than _not_ doing IO
01:28:22FromDiscord<Elegantbeef> Ok so... LSPs are bad cause IO exists
01:28:29FromDiscord<Elegantbeef> Not cause they empirically cause issues
01:28:34FromDiscord<Elegantbeef> Got you
01:28:36FromDiscord<Prestige> Doing IO work when you don't need to do IO is bad, yes
01:28:57FromDiscord<Rika> You only think you don’t need it because you don’t see the point of LSP
01:29:11FromDiscord<Elegantbeef> Is IO work better than VM work?
01:29:16FromDiscord<Elegantbeef> Which is better work
01:29:21FromDiscord<Prestige> I see the point of LSP, but I also see why it's not a good design we should be following
01:29:35FromDiscord<Rika> I don’t see how you could do better without IO
01:29:36FromDiscord<Elegantbeef> Would a JIT'd VM's work always be faster than a native program using IO?
01:29:51FromDiscord<Elegantbeef> Web Assembly! 😛↵(@Rika)
01:29:59FromDiscord<Rika> No I don’t think another plugin system in another language with another standard library for the editor is any better
01:30:16FromDiscord<Elegantbeef> Use a system library so when that crashes your entire editor crashes
01:30:29FromDiscord<Rika> In reply to @Elegantbeef "Would a JIT'd VM's": Possibly
01:30:39FromDiscord<Rika> In reply to @Elegantbeef "Web Assembly! 😛 (<@259277943275126785>)": Not what I mean xd
01:31:09FromDiscord<Prestige> Like I can have a program do the work for `1 + 1` and just have it there in my program. Or, I could send it off to some other CSP (calculator server protocol) server over a socket to do the math, then send it back to my program, then translate that to the actual result
01:31:17FromDiscord<Prestige> doing it locally in my program would be much better
01:31:20FromDiscord<Prestige> and less complex
01:31:21FromDiscord<gibson> In the context of text editing, below some time threshold all computational work is equivalent, and thus LSP work is probably qualitatively equivalent to an editor that doesn't use LSP at all.
01:31:41FromDiscord<Rika> In reply to @Avahe "Like I can have": Well you can go have fun having your community write plugins for every programming language in the world
01:31:51FromDiscord<Prestige> In reply to @Rika "Well you can go": Why would I do that?
01:31:56FromDiscord<Rika> There’s a difference between math and languages
01:32:03FromDiscord<Prestige> I already said I'm not concerned with supporting every language
01:32:17*rockcavera joined #nim
01:32:17*rockcavera quit (Changing host)
01:32:17*rockcavera joined #nim
01:32:24FromDiscord<Rika> In reply to @Avahe "I already said I'm": If that’s so then why are you so tempted to write a new editor
01:32:33FromDiscord<Prestige> For Nim
01:32:39FromDiscord<Rika> Okay
01:32:49FromDiscord<Rika> You do you I guess
01:32:55FromDiscord<Prestige> Always do
01:35:00FromDiscord<gibson> @Prestige this would make sense as a plugin for Aporia. Everything written in one place, for 1 language, if that's what you're after. https://github.com/dom96/Aporia
01:36:18FromDiscord<Prestige> Well, sorta. Mine will be tui based, but yeah. It'll all be one thing in one code base, not a distributed system like lsp
01:37:25FromDiscord<Elegantbeef> context for that 'wirth was right in 1995' if anyone was curious https://cr.yp.to/bib/1995/wirth.pdf
01:38:48FromDiscord<!Patitotective> In reply to @Elegantbeef "*context for that 'wirth": beef thinking in the young people
01:39:12FromDiscord<Elegantbeef> I'm a young people patito
01:43:20FromDiscord<!Patitotective> depends on how old you consider young
01:43:26FromDiscord<gibson> sent a long message, see http://ix.io/46Ho
01:44:15FromDiscord<Prestige> Yeah, I've found over the years it's usually worth the effort of writing your own thing for your own use case. It hasn't failed me yet
01:44:43FromDiscord<Prestige> Usually re-using someone else's thing causes more headache than it's worth
01:45:34FromDiscord<gibson> I'm surprised you can't do work with neovim. It seems to work for most folks who are interested in editing code.
01:45:48FromDiscord<voidwalker> sent a code paste, see https://play.nim-lang.org/#ix=46Hp
01:46:21FromDiscord<Prestige> Neovim mostly works, but if I wanted to fix some bug deep in there code base it wouldn't be fun
01:46:33FromDiscord<Prestige> and I'm really not a fan of lua
01:47:37FromDiscord<!Patitotective> neovim PR #2839 rewritten in nim
01:47:43FromDiscord<Prestige> Lol
01:48:07FromDiscord<Elegantbeef> PR #2840 no more vimscript it's now nimscript
01:48:18FromDiscord<gibson> But you are saying it is by default causing more headache for you than if you were to write an editor yourself, which is a bold claim about the state of neovim, and about the proportion of that headache to the time you think it would take to write a new editor. I'm just surprised anyone has such a large headache with neovim.
01:48:34FromDiscord<Rika> In reply to @Avahe "Neovim mostly works, but": What bug
01:48:51FromDiscord<Elegantbeef> Hey neovim is annoying give i dont type properly with my right hand↵(@gibson)
01:48:56FromDiscord<Elegantbeef> given i dont\
01:49:27FromDiscord<Rika> Lol
01:49:36FromDiscord<gibson> That doesn't sound like a bug 😉 also, sorry 😦
01:49:55FromDiscord<Elegantbeef> Saying sorry cause i'm a fuckwit seems like a low bar
01:50:31FromDiscord<Prestige> In reply to @Rika "What bug": That was a hypothetical, but I am running into a weird bug - If I run a `nim r` command with a keybinding from within neovim, my whole computer basically freezes for 30+ seconds. I can run the same command in a terminal and it works fine. I can even type the command inside neovim with `:!nim r ...` syntax and it's fine. But with a keybinding, it all grinds to a halt
01:50:53FromDiscord<gibson> I've been there-adjacent, having cut the tip of my finger off.
01:51:10FromDiscord<!Patitotective> ~~i dont complain and sublime sometimes freezes when switching projects~~
01:51:35FromDiscord<Elegantbeef> Fucking LSPs amirite 😛↵(@!Patitotective)
01:51:38FromDiscord<Prestige> In reply to @gibson "But you are saying": Yep I am saying that
01:51:40FromDiscord<Elegantbeef> Sorry prestige i couldnt help myself
01:51:49FromDiscord<Prestige> In reply to @Elegantbeef "Fucking LSPs amirite 😛": Heh
01:52:49FromDiscord<Prestige> I've had problems with game engines so I wrote my own, had problems with DEs and WMs so I wrote my own, don't think a text editor is going to be the thing that stops me from being anal about software
01:52:56FromDiscord<!Patitotective> In reply to @Elegantbeef "Fucking LSPs amirite 😛": i dont even use an lsp because it slows down my pc lmao
01:56:54FromDiscord<!Patitotective> In reply to @Avahe "I've had problems with": name the text editor prestige
01:57:37FromDiscord<Prestige> The one I'll make? Hmm I'll have to think of a name
01:57:38FromDiscord<Elegantbeef> Fuck no
01:57:54FromDiscord<!Patitotective> like sublime, prestige, elegant lmao
01:58:08FromDiscord<Elegantbeef> Call it "rightly" as it's done right in his opinion
01:58:22FromDiscord<Elegantbeef> and rightly is a homophone for the made up word writely
01:58:50FromDiscord<Elegantbeef> Or call it writely, 😄
01:58:51FromDiscord<Prestige> Nice
01:58:56FromDiscord<Prestige> I like Writely
01:59:32FromDiscord<Elegantbeef> That'll be $70.99
01:59:39FromDiscord<!Patitotective> ~~more like Writely (only-nim)~~
02:00:18FromDiscord<Elegantbeef> Patito i really hope your parents didnt have the same naming skills as you. If so you're probably named "Son of Mother and \father"
02:00:43FromDiscord<Elegantbeef> What i'm saying is dont name anything
02:01:43FromDiscord<!Patitotective> In reply to @Elegantbeef "Patito i really hope": hahah
02:01:57FromDiscord<!Patitotective> In reply to @Elegantbeef "What i'm saying is": im going to consult you from now on
02:04:27FromDiscord<voidwalker> Haha, first succesful use of weave, got my IP restricted on imdb.com
02:04:30FromDiscord<Bubblie> sent a code paste, see https://play.nim-lang.org/#ix=46Hr
02:04:39FromDiscord<Bubblie> (edit) "https://play.nim-lang.org/#ix=46Hr" => "https://play.nim-lang.org/#ix=46Hs"
02:04:52FromDiscord<Bubblie> thank you!
02:04:53FromDiscord<!Patitotective> sent a code paste, see https://play.nim-lang.org/#ix=46Ht
02:04:57FromDiscord<Bubblie> I forgot nim uses keywords for that
02:05:28FromDiscord<voidwalker> sent a code paste, see https://play.nim-lang.org/#ix=46Hu
02:05:55FromDiscord<voidwalker> Ok so it seems I cannot add the results of the proc to a global variable, tells me it is not GC safe
02:06:07FromDiscord<!Patitotective> In reply to @Bubblie "I forgot nim uses": yep, nim doesnt like cryptic stuff (ignore %)
02:06:18FromDiscord<huantian> data race pog
02:06:20FromDiscord<!Patitotective> (edit) "(ignore %)" => "~~(ignore %)~~"
02:07:16FromDiscord<voidwalker> I wonder if writing directly to the database would work.. sqlite seems to have a way to do concurrent writes.
02:07:27NimEventerNew Nimble package! records - Operations on tuples as heterogeneous record types a la Relational Algebra, see https://github.com/rotu/nim-records
02:08:21FromDiscord<voidwalker> What is the way to do things here, where I need i, and proc(i):string ?
02:08:39FromDiscord<huantian> if you're doing web requests you might wanna do async↵but using threads you need to use a lock on your seq or an atomic sequency thingy↵idk I don't use threads
02:09:15FromDiscord<voidwalker> atomic sequence.. never heard of that. I read about locks, I thought this was simple enough to get away without using any
02:09:44FromDiscord<voidwalker> the examples in the weave git passes pointers.. maybe I should just pass the pointer to list[i] and write there?
02:09:49FromDiscord<huantian> I have no idea if atomic sequences exist lmao
02:10:07FromDiscord<Elegantbeef> probably not
02:10:22FromDiscord<Elegantbeef> Growing/accessing a sequence very much seems like something not capable of being done in a single cycle
02:10:37FromDiscord<!Patitotective> well, i'm not sure you can do that since you're doing multi-threading, why not async or threading?
02:10:46FromDiscord<huantian> multithreading == threading
02:11:03FromDiscord<!Patitotective> eeeh, really?
02:11:07FromDiscord<huantian> I think?
02:11:16FromDiscord<Elegantbeef> yes
02:11:54FromDiscord<!Patitotective> may i mean single threading?
02:12:01FromDiscord<voidwalker> Well I thought, it could be possible to write it with async, but then I'd have to basically write a threadpool manager for it, if I want n instances of the thing running ?
02:12:03FromDiscord<Elegantbeef> No
02:12:10FromDiscord<Bubblie> In reply to @Patitotective "yep, nim doesnt like": it makes it easier to read tbh
02:12:13FromDiscord<Bubblie> I quite like it
02:12:24FromDiscord<Bubblie> its not overly verbose either :)
02:12:29FromDiscord<Elegantbeef> No one ever will really say "threaded" to mean "single threaded"
02:12:33FromDiscord<!Patitotective> In reply to @voidwalker "Well I thought, it": https://nim-lang.org/docs/asyncdispatch.html
02:12:49FromDiscord<!Patitotective> In reply to @Elegantbeef "No one ever will": may i be dumb
02:13:02FromDiscord<voidwalker> yeah I read that like 5 times, still don't quite get it 😦
02:13:19FromDiscord<!Patitotective> maybe https://peterme.net/asynchronous-programming-in-nim.html
02:13:19FromDiscord<Elegantbeef> Likely
02:13:38FromDiscord<huantian> you probably want <https://nim-lang.org/docs/asyncfutures.html#all%2Cvarargs%5BFuture%5BT%5D%5D> at some time
02:57:41FromDiscord<!Patitotective> 🌃
03:05:48*arkurious quit (Quit: Leaving)
03:27:23FromDiscord<Rainbow Asteroids> why is that an emoji
03:27:33FromDiscord<Rika> Ask the Japanese
03:27:38FromDiscord<Rika> 🗾
03:28:00FromDiscord<pepperoni> Why nim have standard library when c has standard library and nim comlile to c
03:28:17FromDiscord<Rainbow Asteroids> because our stdlib is cooler
03:28:20FromDiscord<Rika> Because the c standard library isn’t fitting for Nim
03:28:39FromDiscord<Rika> There’s a lot missing for a modern language
03:28:52FromDiscord<Rika> Many people expect stuff like a web client and whatnot
03:29:02FromDiscord<Rainbow Asteroids> or length to be embedded in the array type
03:29:13FromDiscord<pepperoni> Their expectations are too high
03:29:46FromDiscord<huantian> I don't know I don't wanna be using printf instead of echo 😛
03:29:58FromDiscord<pepperoni> I feel like web stuff in stdlib bad and make executable too big
03:30:13FromDiscord<Rainbow Asteroids> then just dont import the web client
03:30:20FromDiscord<huantian> ^ it doesn't compile the parts in the stdlib that you don't use
03:30:26FromDiscord<Rainbow Asteroids> dead code isn't compiled
03:30:42FromDiscord<pepperoni> O
03:31:00FromDiscord<pepperoni> Ok I take back what I said
03:36:37FromDiscord<Elegantbeef> Lol what a deeply held belief
03:40:41FromDiscord<Rika> Lol
03:49:57FromDiscord<Bubblie> sent a code paste, see https://play.nim-lang.org/#ix=46HF
03:50:00FromDiscord<Bubblie> basically checking for debug or not
03:50:01FromDiscord<Bubblie> (edit) "https://play.nim-lang.org/#ix=46HF" => "https://paste.rs/NBN"
03:50:03FromDiscord<Elegantbeef> `when defined(debug)`
03:50:08FromDiscord<Bubblie> thanks :)
03:51:29*xet7 quit (Remote host closed the connection)
03:56:54FromDiscord<Bubblie> sorry to keep pestering but is there a way to throw exceptions like a runtime exception in C++?
03:57:04FromDiscord<Elegantbeef> Yes
03:57:16FromDiscord<Bubblie> how would one do that?
03:57:26FromDiscord<Elegantbeef> https://nim-lang.org/docs/tut2.html#exceptions
03:58:01FromDiscord<voidwalker> sent a code paste, see https://play.nim-lang.org/#ix=
03:58:16FromDiscord<Bubblie> In reply to @Elegantbeef "https://nim-lang.org/docs/tut2.html#exceptions": thanks :)
03:58:26FromDiscord<Rika> sent a code paste, see https://play.nim-lang.org/#ix=46HG
03:58:45FromDiscord<voidwalker> so I can use weave with atomics, the nim locks from threadpool, and the messages thingies?
03:58:52FromDiscord<voidwalker> message channels
03:59:20FromDiscord<Rika> I think weave has its own implementation, they mean that you can use it on any operating system with those facilities
04:00:46FromDiscord<voidwalker> didn't find anything about that in the main page
04:01:22FromDiscord<voidwalker> I could do a hack and write the results to files on disk : (
04:02:02FromDiscord<Bubblie> wait so which error would I use for a runtime error in nim
04:02:27FromDiscord<Elegantbeef> Depends on which you have↵(@Bubblie)
04:02:37FromDiscord<Elegantbeef> Nim has a few built in but you can define your own if they're not specific enough
04:02:45FromDiscord<Bubblie> oh thats neat!
04:02:53FromDiscord<Elegantbeef> IOError, ValueError, OSError are the common ones in the stdlib
04:03:15FromDiscord<Prestige> I'm lazy and just use `Exception` and write an error message
04:03:46FromDiscord<Elegantbeef> Ah yes the most unhelpful exception 😄
04:03:49FromDiscord<Prestige> Heh
04:04:02FromDiscord<Elegantbeef> `raises: [Exception]` .... wait that means it could raise anything!
04:04:17FromDiscord<Bubblie> thats really cool
04:04:23FromDiscord<!&luke> Hello
04:04:25FromDiscord<Bubblie> I just used ValueError actually since it fit my purpose
04:04:28FromDiscord<Bubblie> thanks beef :D
04:04:30FromDiscord<Elegantbeef> Yea good
04:04:36FromDiscord<!&luke> I have a question about imports
04:04:46FromDiscord<Elegantbeef> Using `Exception` is not great for anyone that uses your code
04:05:12FromDiscord<!&luke> In reply to @ripluke "I have a question": How can I get the code inside of the imported file to be run instead of just putting it in a function
04:05:26FromDiscord<Elegantbeef> You want the most specific exception so if someone annotates with the `raise` annotation they can say "I dont care about X exception from Y proc call"
04:05:35FromDiscord<Elegantbeef> Top level code still runs
04:05:35FromDiscord<!&luke> In reply to @ripluke "How can I get": Like in lua and js the require function runs the code
04:05:40FromDiscord<Elegantbeef> But it's generally to be avoided
04:05:52FromDiscord<!&luke> In reply to @Elegantbeef "Top level code still": It does?
04:05:54FromDiscord<Prestige> Yep
04:06:27*euantorano quit (Ping timeout: 244 seconds)
04:07:27FromDiscord<Rika> It runs on import
04:07:50FromDiscord<Rika> So the code after the import statement is “run before the imported code’s top level”
04:11:28FromDiscord<voidwalker> @ElegantBeef wanna say some words about a seq[string] result data storage to be resutled from running procs in parallel ?
04:11:46FromDiscord<voidwalker> I need a better way than write a million files then read the results from them and combine
04:12:15FromDiscord<Elegantbeef> Spool up threads send result to a channel then write the output to a file on main thread
04:12:27FromDiscord<Elegantbeef> Or a specific t hread
04:12:35FromDiscord<Elegantbeef> Depends on what the program is doing
04:13:14FromDiscord<voidwalker> well I don't want to write to files.. that was just a hack to avoid the inability to accumulte them in a global seq
04:13:25FromDiscord<voidwalker> the end destination is an sqlite database
04:13:34NimEventerNew Nimble package! geomancer - A library and program for getting geomancy charts and figures., see https://github.com/VitorGoatman/geomancer
04:13:35FromDiscord<Elegantbeef> Well then the channel approach works fine
04:13:46*euantorano joined #nim
04:13:48FromDiscord<Elegantbeef> Your main thread can add them to a sequence then send them at a certain limit
04:17:48FromDiscord<voidwalker> Weave has not been tested with GC-ed types. Pass a pointer around or use Nim channels which are GC-aware.
04:17:57FromDiscord<voidwalker> Only I can't see any example on using channels
04:18:02FromDiscord<voidwalker> are those from nim or weave channels?
04:18:10FromDiscord<Elegantbeef> https://nim-lang.org/docs/channels_builtin.html#example
04:36:41FromDiscord<Prestige> What's this weave business
04:37:58FromDiscord<Elegantbeef> mratsims multithreaded library
04:50:51FromDiscord<Prestige> Interesting
05:02:08*wallabra_ joined #nim
05:04:03*wallabra quit (Ping timeout: 252 seconds)
05:04:03*wallabra_ is now known as wallabra
05:24:03*wallabra_ joined #nim
05:24:59*CyberTailor quit (Excess Flood)
05:25:02*wallabra quit (Ping timeout: 240 seconds)
05:25:42*wallabra_ is now known as wallabra
05:26:14*CyberTailor joined #nim
05:30:37*CyberTailor quit (Remote host closed the connection)
05:31:36*CyberTailor joined #nim
05:46:28FromDiscord<!&luke> How can I have nim try running a peice of code, but if it errors just continue running the rest of the code
05:46:51FromDiscord<Elegantbeef> You cannot really
05:46:57FromDiscord<!&luke> I don’t want to use try except as then I would have to duplicate my code for the try and except statements
05:46:58FromDiscord<Elegantbeef> You can do `when compiles(codeHere): codeHere`
05:47:09FromDiscord<Elegantbeef> What's the case here
05:47:13FromDiscord<!&luke> In reply to @Elegantbeef "You can do": Not compiler error
05:47:16FromDiscord<!&luke> Runtime error
05:47:17FromDiscord<Elegantbeef> You want a try finally
05:47:25FromDiscord<!&luke> What
05:47:52FromDiscord<Elegantbeef> sent a code paste, see https://play.nim-lang.org/#ix=46HR
05:48:08FromDiscord<!&luke> What does the finally do tho
05:48:18FromDiscord<!&luke> Is it the rest of the code
05:48:24FromDiscord<Elegantbeef> It runs after the try
05:48:27FromDiscord<Elegantbeef> or any exceptions inbetween them
05:48:27FromDiscord<!&luke> oh
05:49:20FromDiscord<Elegantbeef> https://nim-lang.org/docs/tut2.html#exceptions-try-statement
06:37:36madpropswhat should rumself be
06:37:42madpropsi've been staring at an empty main function
06:37:47madpropsthinking what rumsfeld.nim should be
06:37:50madpropsbut im blank
06:38:02madpropsit's in honor of donald rumsfeld
06:38:06madpropsa person i know nothing about
06:39:05FromDiscord<Elegantbeef> Cant tell if political satire or actually crazy
06:39:50madpropsi just think it's a name
06:40:06madpropswhat i want to do is a vscode extension
06:40:10madpropsbut doing them is a pita
06:40:23madpropsi've made several
06:41:16madpropsthe extension would simply save in /tmp/ the current path you're editing
06:41:21madpropsso you can use it with scripts
06:41:26madpropsthe path
06:41:52madpropssince right now there's no way to know what document you're editing/focused on vscode
06:42:22madpropsi would use it with my file system explorer
06:42:37madpropsto start exploring in the that dir
06:44:28madpropsi made an issue about it on vscode. they said that's the job for an extension
06:45:28madpropswhich is probably right
06:57:15*CyberTailor quit (Read error: Connection reset by peer)
06:57:59*CyberTailor joined #nim
07:09:03FromDiscord<PyryTheBurger> sent a code paste, see https://play.nim-lang.org/#ix=46Ib
07:09:35FromDiscord<Elegantbeef> An error that is posting to a very rude terminal is my money
07:14:48madpropsthe playground is not responding
07:17:17FromDiscord<Prestige> It goes down all the time
07:17:24FromDiscord<Prestige> Need PMunch to restart it
07:34:09*rockcavera quit (Remote host closed the connection)
07:56:18*toothlessgear left #nim (#nim)
10:02:05*CyberTailor quit (Remote host closed the connection)
10:03:17*CyberTailor joined #nim
10:55:43*CyberTailor quit (Remote host closed the connection)
10:56:55*CyberTailor joined #nim
11:04:45FromDiscord<creikey> Why does nim have exceptions, they seem not good because at any point in your program you need to consider that an exception could happen reducing the reliability of all nim programs
11:05:00FromDiscord<creikey> (edit) "Why does nim have exceptions, they seem not good because at any point in your program you need to consider that an exception could happen reducing the reliability of all nim programs ... " added "as this is usually not done completely"
11:10:05FromDiscord<Rika> You can enforce exception catching with the raises pragma
11:10:28FromDiscord<Rika> This allows for checked exceptions without enforcing it for those who do not want to catch exceptions
11:11:28FromDiscord<creikey> That's cool
11:39:26FromDiscord<Phil> In reply to @Rika "You can enforce exception": is there a flag that acts as if every proc had that pragma annotated?↵I'm asking mostly because e.g. annotating with raises, specifically when the raised exceptions may originate from code not my own, means reading a lot of docs
11:39:40FromDiscord<Phil> (edit) "annotated?↵I'm" => "annotated with the specific exceptions it may throw?↵I'm"
11:42:34FromDiscord<Rika> Push pragma not working?
11:42:39qwrin many cases you don't really care about what failed or how - and then exceptions simplify code considerably
11:43:44qwreven rust invited ? operator to emulate such exception handling
11:46:06*qwr has only one nitpick about nim exceptions - newException around exception constuctors seems a bit reduntant and unusually verbose among other nim code
11:46:41FromDiscord<planetis> I think .raises is better inferred by the compiler and you don't need it. But sometimes it's wrong and you have to override it.
12:17:18*ggsx joined #nim
12:18:01FromDiscord<exelotl> but the compiler infers anyways, raises:[] is asking the compiler to let you know if your assumptions were wrong
12:25:51ggsxplayground is down
12:26:20ggsxError: internal error: /build/nim/src/Nim-1.6.6/compiler/ccgstmts.nim(1604, 18)
12:27:20ggsxanyone can understand that error message?
12:41:50FromDiscord<konsumlamm> internal error means it's a bug in the compiler
12:41:53FromDiscord<konsumlamm> always
12:42:12FromDiscord<konsumlamm> best to open an issue on github
12:47:39*ggsx quit (Quit: Client closed)
12:49:56*ggsx joined #nim
12:50:49FromDiscord<Phil> In reply to @Rika "Push pragma not working?": Does the push pragma automatically apply to all code in my project if I just put it at the start of my project file?
13:08:07NimEventerNew Nimble package! nbcnews - NBC News scraper, see https://github.com/thisago/nbcnews
13:09:14FromDiscord<PyryTheBurger> what does export do in nim
13:11:57FromDiscord<hotdog> Ping @4zv4l a fix for nim's jsondoc output just got merged, so `mddoc` works again - https://github.com/nim-lang/Nim/pull/20135 . You can use it now by updating to latest devel, or wait until the next stable release. Or use a different method for docs if you want to 🙂
13:12:14FromDiscord<deeuu> @Phil curious, do you prefer rust style explicit error handling (results)? I think I spotted you talking about them in the past. Keen to hear from your experience
13:13:34FromDiscord<hotdog> In reply to @PyryTheBurger "what does export do": https://nim-lang.org/docs/manual.html#modules-export-statement
13:13:52FromDiscord<hotdog> Useful for exporting modules at the top level of a package and stuff like that
13:16:51*lumo_e joined #nim
13:17:26FromDiscord<4zv4l> In reply to @hotdog "Ping <@329196212282458112> a fix": thaaanks !!!
13:22:23FromDiscord<Phil> In reply to @deeuu "<@180601887916163073> curious, do you": Yes. As much as I dislike a lot of the other things in the language, I like being forced to deal with the errors I am potentially causing and thus being forced to be aware and handle all code-paths
13:22:39*jmd_ quit (Ping timeout: 268 seconds)
13:22:48FromDiscord<Phil> It's why I use optionals everywhere that could be "empty"
13:29:19FromDiscord<Phil> I don't explicitly need the "Result" type, I just want the compiler to yell at me for exceptions I don't catch in my code
13:29:40FromDiscord<Phil> (edit) "code" => "code. And ideally I'd want that mechanism with as little effort put in on my own as possible"
13:33:38FromDiscord<enthus1ast> @Phil\:↵{.push raises\: [].}maybe?
13:33:49FromDiscord<enthus1ast> this way you say\: my stuff do not raise
13:34:05FromDiscord<enthus1ast> and when it raise and it is not catched then it is an error
13:34:52FromDiscord<enthus1ast> this is what status has in their style guide\: https://status-im.github.io/nim-style-guide/errors.exceptions.html
13:37:17FromDiscord<enthus1ast> ah rika mentioned this already
13:38:02FromDiscord<deeuu> @Phil That's fair. For one of my apps, I tried slapping the raises pragma on every proc and man my code started to look dirty since basically everything can raise. I ended up compromising by moving them further up the call chain. ↵↵@enthus1ast what are your thoughts?
13:39:14FromDiscord<enthus1ast> i think its a valid point that unhandled exceptions are a source of leaks etc.
13:39:27FromDiscord<Phil> In reply to @deeuu "<@180601887916163073> That's fair. For": If rika mentioned this already I may just not have gotten it, let me read the styleguide
13:40:25FromDiscord<enthus1ast> imho java (or c#?) requires the same annotations right?
13:41:17FromDiscord<Phil> not requires, they have `throws <ExceptionClass>`
13:41:39FromDiscord<enthus1ast> yeah this
13:41:44FromDiscord<Phil> for multiple exceptions, `throws <ExceptionType1>, <ExceptionType2>, ...`
13:42:18FromDiscord<Phil> In that sense the raises pragma acts very similarly to the raises pragma
13:42:24FromDiscord<enthus1ast> it would actually be nice if the nim compiler could generate such hints in for the docs
13:42:29FromDiscord<Phil> But as a sidenote: I rarely use throws exactly because of this
13:43:21FromDiscord<Phil> In reply to @enthus1ast "this way you say\:": I don't think I can properly parse that sentence, could you rephrase?
13:43:30FromDiscord<Phil> Does that mean "if you see an exception, do not raise it"?
13:44:13FromDiscord<enthus1ast> you say\: "i tell you compiler that my code do not raise exceptions (or should not), but if it does, it is an compile time error"
13:44:42FromDiscord<enthus1ast> my brain does not function well, its simply too hot
13:45:14FromDiscord<Phil> Ohhh so that way the compiler tells me to handle all exceptions within my procs
13:45:30FromDiscord<enthus1ast> yes
13:47:16FromDiscord<Phil> And assuming I say "Well, this one proc shall raise my own "NotFoundException", that's okay" I can just annotate that proc specifically?
13:47:46FromDiscord<Phil> In reply to @enthus1ast "my brain does not": I relate to this way too much
13:51:35*ggsx quit (Quit: Client closed)
14:08:36FromDiscord<deeuu> In reply to @Isofruit "And assuming I say": Yeah that's right. Is this different to Java?
14:09:23*rockcavera joined #nim
14:09:23*rockcavera quit (Changing host)
14:09:23*rockcavera joined #nim
14:09:37FromDiscord<Phil> In reply to @deeuu "Yeah that's right. Is": I at least haven't seen so far the ability in java to say "Enforce that every function deals with every exception it might throw"
14:09:52FromDiscord<Phil> You can only add throws and tell functions that will call you to deal with the Exceptions you inform them of
14:11:08FromDiscord<Phil> So right now I'm contemplating how to add the {.raises: [].} to all files in my project via cli
14:11:24FromDiscord<Phil> ~~Because I'll be damned if I add that manually over 100 times~~
14:11:52*xet7 joined #nim
14:15:08*xet7 quit (Remote host closed the connection)
14:16:15FromDiscord<deeuu> In reply to @Isofruit "You can only add": oh okay I see.
14:18:51*wallabra_ joined #nim
14:19:02*wallabra quit (Ping timeout: 240 seconds)
14:19:02*xet7 joined #nim
14:19:29FromDiscord<Phil> In reply to @deeuu "oh okay I see.": It's one of many ways in which java is just very inconvenient
14:20:25*wallabra_ is now known as wallabra
14:23:34FromDiscord<deeuu> In reply to @Isofruit "~~Because I'll be damned": Let me know how you find it, especially if you try nim-result (https://github.com/arnetheduck/nim-result/)
14:23:58FromDiscord<deeuu> In reply to @Isofruit "So right now I'm": Let me know how you find it, especially if you try nim-result (https://github.com/arnetheduck/nim-result/)
14:27:32FromDiscord<Phil> In reply to @deeuu "Let me know how": I assume you're also of the type that you like the compiler telling you to fix minor stuff (e.g. like naming inconsistencies) ?
14:29:42FromDiscord<deeuu> I suppose so, yes. At work, we are doing typescript and have eslint configured to yell at us all the time.
14:31:53FromDiscord<Phil> In that case you may be glad to hear that chances are the next nim version will fix the thing that makes it currently impossible to turn hints/warnings into errors
14:32:03FromDiscord<Phil> some
14:32:08FromDiscord<Phil> (edit) "some ... " added "hints/warnings into errors"
14:34:45FromDiscord<deeuu> Any examples (I don't Nim enough, though I'm trying to change my ways)
14:35:40FromDiscord<Phil> Something that I'm currently really looking forward to using:↵ --hintAsError[XDeclaredButNotUsed]:on #Can't be used because systems.nim itself has screwy stuff↵ --warningAsError[UnusedImport]:on #Can't be used because systems.nim itself has screwy stuff
14:36:00FromDiscord<Phil> That means you can no longer have variables in your code that you do not use↵You can also no longer have imports that you do not use
14:36:24FromDiscord<Phil> (edit) "#Can't be used because systems.nim itself has screwy stuff↵" => "↵" | removed "#Can't be used because systems.nim itself has screwy stuff"
14:36:36FromDiscord<deeuu> ahh yeah I recall those.
14:37:02*ehmry quit (Quit: https://quassel-irc.org - Chat comfortably. Anywhere.)
14:37:06FromDiscord<Phil> I would also use --styleCheck:error but I'm forced to have some snake-case in my models due to my database coming from python
14:37:10FromDiscord<Phil> And I don't want to rename all my tables
14:37:29FromDiscord<Phil> (edit) "coming from" => "having been created via"
14:37:38FromDiscord<Phil> (edit) "I would also use --styleCheck:error but I'm forced to have some snake-case in my models due to my database having been created via python ... " added "back in the day"
14:38:57*ehmry joined #nim
14:46:20NimEventerNew thread by Deech: Error using `bindSym` at compile time, see https://forum.nim-lang.org/t/9351
14:50:14NimEventerNew Nimble package! editlyconf - Editly config generation tools and types, see https://github.com/thisago/editlyconf
15:05:41*Guest8615 is now known as om3ga
15:23:28FromDiscord<Phil> Fascinating, so some of my code throws `IOSelectorsException` and I have no idea from where it stems, hmm
15:24:57FromDiscord<Phil> Likely the http server that prologue uses and that prologue uncaught hands over
15:25:27FromDiscord<flywind> In reply to @Isofruit "Fascinating, so some of": It is from std/selectors.
15:26:29FromDiscord<flywind> https://github.com/nim-lang/Nim/blob/714eb658666de5b28ee3116a150bc0e59634dfc9/lib/pure/selectors.nim#L282
15:29:21FromDiscord<Phil> In reply to @deeuu "Let me know how": the way of just having `raises[]` in each file is extremely verbose, I'll contemplate arne's result type... at some point, I'm feeling like I'm cooking again
15:31:02FromDiscord<deeuu> In reply to @Isofruit "the way of just": As in, the resulting Nim code (having to try/except everything) is verbose? Or simply that the annotation is verbose
15:35:17FromDiscord<Phil> The sheer volume of try catch, specifically when you want to covert one exception to another, is near unreadable
15:36:16FromDiscord<deeuu> Yeah that's where I ended up, even using the `std/logger` was a pain (had to wrap it)
15:36:17FromDiscord<Phil> Gut feeling says that's an avenue that won't lead to code I like
15:36:39FromDiscord<deeuu> (edit) "the `std/logger`" => " `std/logging`"
15:37:04FromDiscord<deeuu> I think it's cleaner if you move the pragma further up, near your CLI entrypoint
15:44:19*LuxuryMode joined #nim
15:46:10FromDiscord<deeuu> In reply to @Isofruit "The sheer volume of": How would a result type help with your conversion problem? You're in the same boat, no?
16:06:43*arkurious joined #nim
16:06:58FromDiscord<Phil> sent a long message, see http://ix.io/46K1
16:07:53FromDiscord<Phil> Just the fact it gets broken down into a single codeblock with a lot of one-liners gives a lot, or at least were my experience with the short time I spent in Rust
16:08:01FromDiscord<Phil> I'd need to see how that translates with arne's Result lib
16:09:05FromDiscord<Rainbow Asteroids> is https://play.nim-lang.org/ down for anyone else?
16:09:30FromDiscord<Phil> In reply to @Rainbow Asteroids "is https://play.nim-lang.org/ down for": can confirm
16:09:31FromDiscord<flywind> Yeah
16:09:34FromDiscord<deeuu> In reply to @Rainbow Asteroids "is https://play.nim-lang.org/ down for": down for me
16:09:36FromDiscord<Rainbow Asteroids> :(
16:09:58FromDiscord<flywind> You can use some alternatives like wandbox
16:10:13FromDiscord<Rainbow Asteroids> i have the compiler on this computer so im good
16:15:34FromDiscord<Bung> hi, I want create windows app with button and particle effect , any resource ?
16:16:13FromDiscord<Bung> I found some gui libs that have basic components , and https://github.com/oprypin/nim-csfml
16:21:08FromDiscord<deeuu> In reply to @Isofruit "If a proc I": I mean, you could re-raise on the same line as each except...
16:23:12FromDiscord<Phil> squint↵Am I that java broken? Let me check
16:54:40FromDiscord<Phil> sent a code paste, see https://play.nim-lang.org/#ix=46Kj
17:12:47*CyberTailor quit (Remote host closed the connection)
17:13:51*CyberTailor joined #nim
18:42:08*kenran joined #nim
18:42:58*krux02 joined #nim
18:45:29*kenran quit (Client Quit)
18:56:02FromDiscord<!&luke> Would Nim be faster than dart (exe/js)
19:00:31FromDiscord<Rika> Speed is mainly up to the programmer
19:00:57FromDiscord<Rika> If you want a good comparison, make a program in both and see their performance
19:01:10FromDiscord<Rika> Even then it’s not that good because you’re experienced in Nim but not Darr
19:01:12FromDiscord<Rika> Dart
19:02:15*lumo_e quit (Ping timeout: 252 seconds)
19:02:19FromDiscord<Mike> For web, both compile to js, so it's just down to whoever's compiler is smarter. Probably it doesn't matter
19:02:49FromDiscord<Rika> It can matter but still depends on the programmer
19:03:16FromDiscord<voidwalker> sent a code paste, see https://play.nim-lang.org/#ix=46KW
19:03:28FromDiscord<voidwalker> `Error: 'weaveParallelForSection' is not GC-safe as it accesses 'ids' which is a global using GC'ed memory`
19:05:38FromDiscord<voidwalker> any idea how to get around this ? I need to work on ids[i] instead of just i. I could use a 0.. max(ids[i]) interval and check if the id exists, as there's not that many blanks.. but that's not very smart
19:06:25FromDiscord<voidwalker> I thought that it's enough to pass the ids sequence to the proc running in parallel
19:06:34FromDiscord<domosokrat> did you try putting the code into a function
19:06:52FromDiscord<domosokrat> since it complains about `ids`being global
19:09:27FromDiscord<voidwalker> I put it all in a main() proc, now I have
19:09:44FromDiscord<voidwalker> ` Error: illegal capture 'db' because 'weaveParallelForSection' has the calling convention: <inline>`
19:19:16*lumo_e joined #nim
19:22:21FromDiscord<domosokrat> is db a global or defined inside the function?
19:23:56FromDiscord<reversem3> Has anyone played with event loops for a gui or game engine ?
19:26:05*rockcavera quit (Read error: Connection reset by peer)
19:27:48FromDiscord<Prestige> What do you mean exactly?
19:28:01FromDiscord<Prestige> I have a game engine that polls for input events
19:33:29FromDiscord<reversem3> Would that be event driven then ?
19:37:27*rockcavera joined #nim
19:37:28*rockcavera quit (Changing host)
19:37:28*rockcavera joined #nim
19:41:20FromDiscord<voidwalker> domoskrat it's global, the db connection. it worked fine with it passed to the proc executed in parallel
19:46:48FromDiscord<domosokrat> So you got it working? Great.
19:51:29FromDiscord<voidwalker> No. It doesn't work. If I have the parallel for not in a proc (main), it complains about not gc safe sequence of int. If I pass it to the parallel executing proc or not. If I have the code body in main, i get the error above
20:08:18FromDiscord<voidwalker> so what exactly is the limitation for using threadpool/weave, when passing data to procs executing in parallel ?
20:11:52FromDiscord<Phil> Sorry, I can't simulate how that code would look like, could you post?↵Generally my first thought is that lang's like nim tend to forbid shared mutable state as it is the root of all evil, so my first though would be that maybe one of your 2 code versions gets around that and doesn't actually have shared state
20:12:21FromDiscord<Phil> (edit) "Sorry, I can't simulate ... how" added "in my head"
20:16:57FromDiscord<voidwalker> sent a code paste, see https://play.nim-lang.org/#ix=46L4
20:17:28FromDiscord<voidwalker> (edit) "https://play.nim-lang.org/#ix=46L4" => "https://play.nim-lang.org/#ix=46L5"
20:17:40FromDiscord<voidwalker> this results in : ` Error: 'weaveParallelForSection' is not GC-safe as it accesses 'ids' which is a global using GC'ed memory`
20:18:26FromDiscord<voidwalker> ahh, I think I must pass the pointer to it
20:19:02FromDiscord<voidwalker> I tried to reassign the sequence with `let`, thinking that if it's immutable it would allow me to use it
20:19:04FromDiscord<voidwalker> but nope, same thing
20:22:31FromDiscord<voidwalker> so the problem is not the mutability, but the GC
20:26:15FromDiscord<Phil> Can you just build the IDS using sequtils on odb.fastRows so you don't have to do the for-loop?
20:27:51FromDiscord<Phil> sent a code paste, see https://play.nim-lang.org/#ix=46L8
20:28:21FromDiscord<Phil> (edit) "https://play.nim-lang.org/#ix=46L8" => "https://play.nim-lang.org/#ix=46La"
20:29:49FromDiscord<Phil> no, wait, that doesn't change anything, seq[uint32] is still a ref-type and thus allocated on the heap, which means that the memory will eventually get garbage collected once all references to it die.↵HOWEVER, you know stuff there that the GC doesn't, which is that the reference to that memory will not go out of scope until the end of your code!
20:29:58FromDiscord<Phil> Which means you can just cast ids as gcsafe
20:30:37FromDiscord<Phil> As you don't need nim to protect you from a potential read of memory you do not own, you know that memory is yours until you're done
20:46:19FromDiscord<vindaar> sent a code paste, see https://play.nim-lang.org/#ix=46Ld
20:48:15FromDiscord<vindaar> sent a long message, see http://ix.io/46Lg
20:50:33FromDiscord<Phil> In reply to @vindaar "yeah, as <@180601887916163073> says": Wouldn't just telling the compiler to ignore the perceived gc-unsafeness suffice here?
20:50:56FromDiscord<Phil> Via ` {.cast(gcsafe).}:`
20:52:38*mahlon quit (Ping timeout: 240 seconds)
20:53:08FromDiscord<vindaar> I'd be wary. In the past I've seen fun things happening to the GC when handing over seqs directly (random segfaults in the GC code at some points later)
20:53:28FromDiscord<vindaar> possibly fine, but better to be explicit
20:54:17FromDiscord<Rika> I doubt it will be fine for weave
20:55:33FromDiscord<vindaar> in any case, for simple "dumb" parallel work I now often just use `procpool` from cligen (https://github.com/c-blake/cligen/blob/master/cligen/procpool.nim). multiprocessing made simple and less worries about these sort of problems. Doesn't solve the problems weave mainly aims to solve, but most use users of weave probably aren't dealing with those either
21:05:09FromDiscord<voidwalker> sent a code paste, see https://play.nim-lang.org/#ix=46Ln
21:05:27FromDiscord<voidwalker> It has somehow not occured to me that I can do this, since fastRows is an iterator and not a sequence
21:05:44FromDiscord<voidwalker> however this code results in : ` Error: undeclared identifier: 'it'`
21:06:32FromDiscord<Rika> If fast rows is an iterator then you cant, no?
21:07:17FromDiscord<huantian> if mapIt is a template, maybe it does work?
21:09:04FromDiscord<huantian> you can try adding a toSeq to see if it's a problem with the iterator
21:09:39FromDiscord<Rika> mapIt is a template from sequtils
21:09:41FromDiscord<voidwalker> Yeah toSeq worked
21:10:29FromDiscord<huantian> then you probably just wanna use getAllRows directly
21:10:33*wallabra quit (Ping timeout: 268 seconds)
21:11:44FromDiscord<voidwalker> sent a code paste, see https://play.nim-lang.org/#ix=46Lq
21:11:49FromDiscord<voidwalker> still does not fix ` 'weaveParallelForSection' is not GC-safe as it accesses 'ids' which is a global using GC'ed memory`
21:12:47FromDiscord<Phil> cast the paraööelfor
21:12:52FromDiscord<voidwalker> I tried the variable declaration and the whole parralelFor code, (not sure which I was supposed to)
21:13:00FromDiscord<Phil> hm
21:13:40FromDiscord<voidwalker> sent a code paste, see https://play.nim-lang.org/#ix=46Lt
21:15:08*jmdaemon joined #nim
21:20:57*wallabra joined #nim
21:20:59*wallabra quit (Client Quit)
21:21:18*jmd_ joined #nim
21:21:35*jmdaemon quit (Ping timeout: 252 seconds)
21:22:39*wallabra joined #nim
21:29:14FromDiscord<domosokrat> Can't you make 'db' local to the function containing this code (or pass it as a parameter)? Then the 'illegal capture' error should disappear, or am I wrong?
21:29:23*mahlon joined #nim
21:31:12FromDiscord<voidwalker> it's already passed as parameter, the first one. The db never posed an issue, as it's a pointer to a dbConn
21:33:31*wallabra quit (Ping timeout: 268 seconds)
21:34:36FromDiscord<domosokrat> earlier you said it was a global
21:36:36FromDiscord<voidwalker> yeah it's global, but apparently it's not a GC-ed type, so not a problem in this context. The db issue appeared only when following your suggestion to pu the whole code in a proc
21:36:55FromDiscord<voidwalker> (edit) "pu" => "put"
21:37:52FromDiscord<domosokrat> yes, and what if you pass db as a parameter to this proc, since weave comlains that capturing it is illegal?
21:39:45FromDiscord<domosokrat> and local variable should not need to be captured
22:07:13FromDiscord<Sun「無用」> sent a code paste, see https://play.nim-lang.org/#ix=46LG
22:07:20FromDiscord<Elegantbeef> Object variants
22:07:27FromDiscord<Elegantbeef> or https://github.com/alaviss/union
22:07:55FromDiscord<Elegantbeef> https://nim-lang.org/docs/tut2.html#object-oriented-programming-object-variants
22:09:57FromDiscord<Sun「無用」> I didn't understand the object variant thingy, but the union is kinda readable.... kinda.
22:10:50FromDiscord<huantian> well generally in nim you don't need unions too much
22:11:42FromDiscord<!Patitotective> unless you do
22:12:11FromDiscord<Sun「無用」> Can you do union on type definition as well?
22:13:09FromDiscord<Sun「無用」> sent a code paste, see https://play.nim-lang.org/#ix=46LJ
22:13:13FromDiscord<Elegantbeef> Yes
22:14:06FromDiscord<voidwalker> In reply to @domosokrat "yes, and what if": To be honest I have no idea what this capturing is. db was always passed as parameter to the proc
22:27:52FromDiscord<voidwalker> sent a code paste, see https://play.nim-lang.org/#ix=46LO
22:28:16FromDiscord<voidwalker> Results in `Error: expression has no address; maybe use 'unsafeAddr'`
22:35:38FromDiscord<domosokrat> sent a code paste, see https://play.nim-lang.org/#ix=46LP
22:50:16FromDiscord<voidwalker> why can't they be both ?
22:51:06FromDiscord<vindaar> that's because you probably changed the `ids` variable from a `var` (as in my full snippet) to a `let`..↵(@voidwalker)
22:54:05*lumo_e quit (Quit: Quit)
22:54:58*CyberTailor quit (Write error: Connection reset by peer)
22:56:05*CyberTailor joined #nim
22:57:07*krux02 quit (Remote host closed the connection)
23:09:22FromDiscord<voidwalker> @Vindaar indee I have. Now how do I pass that to the proc ? the code example you gave results in ` required type for ids: seq[uint32]↵ but expression 'idsBuf' is of type: ptr UncheckedArray[uint32]`
23:09:55FromDiscord<vindaar> well, you need to change the signature to match the type you now hand
23:10:10FromDiscord<vindaar> so instead of `seq[uint32]` it's now going to be `ptr UncheckedArray[uint32]`
23:10:44FromDiscord<Sun「無用」> sent a code paste, see https://play.nim-lang.org/#ix=46M0
23:12:43FromDiscord<vindaar> sequtils has `cycle` for that\: https://nim-lang.github.io/Nim/sequtils.html#cycle%2CopenArray%5BT%5D%2CNatural (or `repeat` if it's only a single element)↵(@Sun「無用」)
23:13:04FromDiscord<Rika> Not for arrays as far as I know
23:13:18FromDiscord<Sun「無用」> In reply to @Rika "Not for arrays as": ah, I'm using arrays.
23:13:30FromDiscord<vindaar> ah, if you want an array output type Rika is right, sorry
23:13:59FromDiscord<voidwalker> @Vindaar isn't there any alterantive, to keep the signature as it is ? I've no idea what an uncheckedArray is, gotta read
23:14:05FromDiscord<voidwalker> anyway, with that change I now get : SIGSEGV: Illegal storage access. (Attempt to read from nil?)
23:14:17FromDiscord<Sun「無用」> In reply to @vindaar "ah, if you want": so I have to literally implement it.
23:14:18FromDiscord<Sun「無用」> okay
23:14:39FromDiscord<vindaar> it's just a fancy name for a raw memory buffer (i.e. a pointer) that has no bounds checking or knowledge about it's length.↵(@voidwalker)
23:14:56FromDiscord<vindaar> that might be for many, many reasons↵(@voidwalker)
23:16:13FromDiscord<voidwalker> wait, if it's a pointer, it needs different syntax to access the values, no ?
23:17:09FromDiscord<Rika> In reply to @Sun「無用」 "so I have to": You can but not without some heavy restrictions
23:17:36FromDiscord<vindaar> yeah, the tricky part for arrays will be that, as they are CT sized, you need a static argument to compute the resulting array type↵(@Sun「無用」)
23:19:02FromDiscord<vindaar> no, it automatically dereferences it for you when using `[]`↵(@voidwalker)
23:19:08FromDiscord<Sun「無用」> In reply to @vindaar "yeah, the tricky part": what?
23:19:20FromDiscord<Sun「無用」> I don't know how to implement it anyways, I'll just do manual
23:21:25*wallabra joined #nim
23:23:31FromDiscord<Rika> In reply to @Sun「無用」 "what?": Arrays are sized at compile time
23:23:39FromDiscord<Rika> You can’t pass in a variable to size then
23:23:41FromDiscord<Rika> Them
23:23:50FromDiscord<Rika> oversimplification
23:24:05FromDiscord<!Patitotective> ~~use seqs~~
23:24:14FromDiscord<voidwalker> I put some echos in the proc and before the proc call/parallelFor. It crashses before the proc begine executing the lines, and after it is called
23:24:50FromDiscord<voidwalker> sent a code paste, see https://play.nim-lang.org/#ix=46M2
23:25:32FromDiscord<vindaar> ah, you're trying to return a `string`? that almost certainly will cause problems as `strings` are GC'd types
23:26:13FromDiscord<voidwalker> @Vindaar it Had no problem echo-ing the returned string in parallel, before I tried to give the seq[int] list to process (it just went from 0..300)
23:27:12FromDiscord<voidwalker> so the syntax to access the seq[int] inside the proc would be ids[][i], right ?
23:27:22FromDiscord<voidwalker> (edit) "seq[int]" => "seq[uint32]"
23:27:42FromDiscord<vindaar> the syntax to access element `i` of `ids` inside the proc is just `ids[i]`
23:27:50FromDiscord<vindaar> no dereferencing necessary
23:31:35FromDiscord<Sun「無用」> how to make a function mutable? cause like, copying is making everything too slow.
23:34:12FromDiscord<vindaar> what do you mean making a function mutable?↵(@Sun「無用」)
23:34:44*qwr . o O ( play don't load for me... )
23:35:13FromDiscord<Sun「無用」> sent a code paste, see https://play.nim-lang.org/#ix=46M6
23:35:19FromDiscord<Sun「無用」> How to make that not an error
23:36:41FromDiscord<Sun「無用」> In reply to @vindaar "what do you mean": ^
23:36:45FromDiscord<vindaar> sent a code paste, see https://play.nim-lang.org/#ix=46M7
23:36:58FromDiscord<Sun「無用」> sent a code paste, see https://play.nim-lang.org/#ix=46M8
23:37:09FromDiscord<vindaar> what you asked for. making the argument mutable
23:37:10FromDiscord<Rika> Makes the parameter mutable
23:42:15FromDiscord<Sun「無用」> ``let playerMove: (Natural, Natural) = (1, 2)`` Why does this gives me an error? It's a natural tuple...
23:43:02FromDiscord<vindaar> because `Natural` is not an explicit type. It's just a "type class". Those are meant to restrict generic procedure types, not serve as types of variables
23:43:18FromDiscord<Sun「無用」> what...
23:43:23FromDiscord<voidwalker> sent a code paste, see https://play.nim-lang.org/#ix=46M9
23:43:28FromDiscord<Sun「無用」> can you translate that to english...
23:44:39FromDiscord<voidwalker> I simplified the code a bit. Can anyone check the results ? I am using `nimble install weave@#master`
23:45:50FromDiscord<vindaar> sent a code paste, see https://play.nim-lang.org/#ix=46Ma
23:47:08FromDiscord<voidwalker> Very nice english translation
23:47:35FromDiscord<Sun「無用」> sent a code paste, see https://play.nim-lang.org/#ix=46Mb
23:49:03FromDiscord<Sun「無用」> also `let num: Natural = 2` works
23:49:51FromDiscord<Rika> It’s a bit difficult to explain why it doesn’t work, but I think it can basically be boiled down to “it’s a limitation of the type inferenc”
23:49:55FromDiscord<Rika> (edit) "inferenc”" => "inference”"
23:50:39FromDiscord<Sun「無用」> So how would I create a Natural tuple?
23:51:10FromDiscord<Sun「無用」> Cause doing `if v < 0: return` is kinda boring and dumb
23:52:25FromDiscord<Rika> I think you can convert each field
23:52:38FromDiscord<Sun「無用」> wdym?
23:52:42FromDiscord<Rika> (1.Natural, 2.Natural)
23:53:39FromDiscord<Hi02Hi> isnt Natural a range, not a typeclass?
23:53:40FromDiscord<Sun「無用」> can't I do something like rust and just convert the first one?
23:53:47FromDiscord<Elegantbeef> Natural is a range
23:53:48FromDiscord<Rika> In reply to @Sun「無用」 "can't I do something": Not on tuples
23:54:00FromDiscord<Sun「無用」> ...
23:54:13FromDiscord<Rika> Tuples can hold different types so not there
23:54:15FromDiscord<vindaar> ah, I'm paying attention very well 🙈 thanks for the correction
23:54:16FromDiscord<Rika> You can for arrays
23:54:33FromDiscord<Elegantbeef> Though to be fair it also behaves like a typeclass 😄
23:54:49FromDiscord<vindaar> yeah, I was just making assumption without thinking 🤣↵(@Hi02Hi)
23:57:10FromDiscord<Sun「無用」> In reply to @vindaar "yeah, I was just": I don't know neither of those, and I didn't understand it, so it doesn't matter anyways