<< 14-07-2023 >>

00:04:43FromDiscord<JJ> can i call dumpTree after a macro expansion? doing some stupid metaprogramming and running into problems
00:06:33FromDiscord<Elegantbeef> `expandMacros`
00:06:43FromDiscord<Elegantbeef> or `--expandMacro: myMacro`
00:06:50FromDiscord<Elegantbeef> or `echo result.repr`
00:07:19FromDiscord<Elegantbeef> Or share the macro so I can say you're doing stupid things with an air of superiority 😄
00:09:38FromDiscord<takemichihanagaki3129> In reply to @Elegantbeef "Or share the macro": LMAO
00:48:25NimEventerNew Nimble package! rclnim - Nim bindings for ROS2, see https://github.com/Pylgos/rclnim
00:52:08*jmd_ quit (Ping timeout: 252 seconds)
00:53:25NimEventerNew Nimble package! polyrpc - A system for generating remote-procedure-calls for any pair of server and client, see https://github.com/choltreppe/polyrpc
01:13:36*jmdaemon joined #nim
01:32:53*rockcavera quit (Remote host closed the connection)
02:08:01FromDiscord<bung8954> `static wil::com_ptr<ICoreWebView2> webviewWindow;` should I use `wil::com_ptr` to make this kind of pointer?
02:21:23*disso-peach quit (Quit: Leaving)
02:48:25FromDiscord<bung8954> found the anwser.
02:55:53NimEventerNew thread by oyster: Redirect echo result to make a lazy function?, see https://forum.nim-lang.org/t/10336
03:06:12FromDiscord<gogolxdong666> How to debug Nimbus macro like `rpc`
04:34:17FromDiscord<m4ul3r> In windows, does `alloc()` from system using VirtualAlloc ?
04:37:22FromDiscord<Elegantbeef> It uses the default nim allocator
04:37:45FromDiscord<Elegantbeef> https://github.com/nim-lang/Nim/blob/devel/lib/system/alloc.nim
05:13:47NimEventerNew Nimble package! spotlightr - Spotlightr basic extractor to get the video, see https://git.ozzuu.com/thisago/spotlightr
05:27:45FromDiscord<JJ> In reply to @Elegantbeef "Or share the macro": agh apologies for asking and immediately going afk!
05:27:57FromDiscord<JJ> this is in fact the stupid thing
05:28:07FromDiscord<JJ> sent a code paste, see https://play.nim-lang.org/#ix=4AxX
05:29:50FromDiscord<JJ> i believe i am slightly misusing the semantics of `quote do` but i do not know why `quote do: 0` works while `quote do: 'a'` fails
05:33:11FromDiscord<Elegantbeef> The hell are you doing
05:33:22FromDiscord<Elegantbeef> Attempting to inline fib?
05:33:32FromDiscord<Elegantbeef> Rather unroll
05:33:44FromDiscord<Elegantbeef> I'm so confused
05:33:52FromDiscord<Elegantbeef> Why are you using a macro here
05:35:46FromDiscord<JJ> In reply to @Elegantbeef "The hell are you": well it's a bit of a shitpost
05:35:51FromDiscord<JJ> In reply to @Elegantbeef "Rather unroll": essentially
05:36:40FromDiscord<JJ> i think the problem is `a` is of type int rather than a NimNode
05:36:40FromDiscord<Elegantbeef> Well firstly why are you doing `result = quote do: 0`
05:36:52FromDiscord<Elegantbeef> secondly why are you doing `result = quote do: result + a`
05:36:59FromDiscord<Elegantbeef> The result of a macro is a NimNode
05:37:48FromDiscord<JJ> well the idea is it outputs literally, `0`, `0+1`, `0+1+1`, `0+1+1+2` though looking back i see my logic is wrong
05:38:18FromDiscord<Elegantbeef> sent a code paste, see https://paste.rs/MWnqC
05:38:39FromDiscord<JJ> i'll need to eval `result` then use that instead of `a`
05:39:08FromDiscord<ambient3332> fib is fib-1 + fib-2 tho, not n!
05:39:15FromDiscord<ambient3332> or 1+2+3+4 etc
05:39:24FromDiscord<punchcake> https://programming-language-benchmarks.vercel.app/c-vs-nim
05:39:34FromDiscord<punchcake> acording to all of these benchmarks why is nim slower than C?
05:39:44FromDiscord<Elegantbeef> Cause benchmarks are useless
05:39:54FromDiscord<Elegantbeef> Though Nim beats C in some places
05:40:26FromDiscord<Elegantbeef> https://github.com/hanabi1224/Programming-Language-Benchmarks/blob/main/bench/algorithm/spectral-norm/4.c like how is this in the same benchmark as https://github.com/hanabi1224/Programming-Language-Benchmarks/blob/main/bench/algorithm/spectral-norm/1.nim
05:40:46FromDiscord<JJ> In reply to @punchcake "acording to all of": the first benchmark on that page has nim in fact beating c (which is a bit funny, generated c beating handcrafted c)
05:40:53FromDiscord<Elegantbeef> The C solution is using simd
05:40:54FromDiscord<punchcake> so i can use nim as a replacement for C?
05:41:05FromDiscord<Elegantbeef> Sure
05:41:08FromDiscord<Elegantbeef> If you do the same thing that the fast C does of course
05:41:13FromDiscord<punchcake> i like the gc aspect of nim
05:41:19FromDiscord<ambient3332> GC always has a cost
05:41:31FromDiscord<Elegantbeef> Using simd in a benchmark against a non simd benchmark is like entering a race shooting the other racers when it starts
05:41:34FromDiscord<punchcake> i usally implement a lot of tree graphing and it makes manual memory managment impossible
05:41:39FromDiscord<Elegantbeef> "GC always has a cost" well luckily we have arc/orc
05:41:41FromDiscord<Elegantbeef> So... there goes that
05:41:59FromDiscord<ambient3332> doubt.jpg
05:42:02FromDiscord<Elegantbeef> RAII is indistinguishable from manual memory management, fitem e
05:42:04FromDiscord<Elegantbeef> fite me\
05:42:32FromDiscord<JJ> sent a code paste, see https://play.nim-lang.org/#ix=4AxZ
05:42:39FromDiscord<JJ> this is of course profoundly stupid
05:42:55FromDiscord<Elegantbeef> Of course
05:43:15FromDiscord<JJ> sent a code paste, see https://play.nim-lang.org/#ix=4Ay0
05:43:49FromDiscord<ambient3332> Plus my take on Nim is that it's playing a game with the C or C++ compiler to produce optimal code, sometimes that game might fail. However the tradeoffs are worth it.
05:43:51FromDiscord<Elegantbeef> So JJ how goes UXN 😛
05:44:09FromDiscord<Elegantbeef> Eh Nim's generated code is hardly ever why it's slow imo
05:44:21FromDiscord<Elegantbeef> It's generally due to the programmer
05:44:25FromDiscord<JJ> it's been going, i finally have time to get back to it this week
05:44:27FromDiscord<ambient3332> In reply to @Elegantbeef "Eh Nim's generated code": People say the exact same thing about Python
05:44:44FromDiscord<demotomohiro> Cost of Nim's arc is only increment/decrementing ref count and check if it 0, isnt it?
05:44:46FromDiscord<Elegantbeef> Sure, but if you look at the benchmarks nim's naive benchmarks are fairly good
05:44:59FromDiscord<Elegantbeef> Right demo, and that's only for ref types
05:45:07FromDiscord<Elegantbeef> For non refs there is no ref count
05:45:08FromDiscord<punchcake> orc isnt stop the world right?
05:45:11FromDiscord<ambient3332> --mm:refc often is performance improvement over --mm:orc
05:45:32FromDiscord<JJ> my friend finished his rust impl. he gave up on rust macros and hand-wrote each case of the 255 opcodes
05:45:33FromDiscord<Elegantbeef> Sure and refc and orc are two different memory management systems so code might need to be changed to benefit from orc
05:45:52FromDiscord<ambient3332> How do I change code to benefit from ORC? 🤔
05:46:10FromDiscord<Elegantbeef> Use `sink`, `lent` and do not copy data accidently
05:46:19FromDiscord<punchcake> In reply to @ambient3332 "--mm:refc often is performance": refc will leak cycles
05:46:30FromDiscord<Elegantbeef> refc doesnt leak cycles
05:46:30FromDiscord<Elegantbeef> arc leaks cycles
05:46:38FromDiscord<punchcake> refc vs orc?
05:46:43FromDiscord<JJ> how much of anything does `sink` do? i was quite surprised to learn it would fall back to copying
05:46:51FromDiscord<Elegantbeef> refc is a garbage collector
05:46:52FromDiscord<JJ> instead of failing to compile
05:46:59FromDiscord<Elegantbeef> orc is mark and sweep + arc
05:47:08FromDiscord<Elegantbeef> What do you mean how much does it do?
05:47:24FromDiscord<Elegantbeef> It tells the compiler it can move memory
05:47:28FromDiscord<punchcake> bruv what do i use that wont leak cycles and doesnt stop the world
05:48:29FromDiscord<huantian> In reply to @Elegantbeef "What do you mean": i think the question is that if `sink` falls back to copying, why isn't everything just `sink` and fall back to copying?
05:48:43FromDiscord<Elegantbeef> What more can it do
05:48:43FromDiscord<Elegantbeef> Erroring is a ballache that just encourages people to write `.clone`
05:48:50FromDiscord<Elegantbeef> `orc` and `refc`
05:49:13FromDiscord<JJ> yea i remembered the conversation we had earlier
05:49:19FromDiscord<Elegantbeef> `--sinkInference:on`
05:49:19FromDiscord<Elegantbeef> There we go 😄
05:49:27FromDiscord<JJ> i do wish `sink` would fail to compile on unsinkable types
05:49:40FromDiscord<huantian> like `float`? 😛
05:49:47FromDiscord<JJ> lmao
05:50:07FromDiscord<huantian> if your object has a float field then it can't be used in sink lmao↵that would be a funny april fools
05:50:07FromDiscord<Elegantbeef> The issue with `sink` is it's apart of the proc signature
05:50:33FromDiscord<Elegantbeef> so `--sinkInference:on` breaks code
05:50:52FromDiscord<JJ> In reply to @huantian "like `float`? 😛": this is technically correct too right? i can't remember the threshold at which point passing by reference + counting is more efficient
05:51:06FromDiscord<Elegantbeef> It's a line of code
05:51:07FromDiscord<Elegantbeef> If you dont want a sink to be made error it for your type
05:51:08FromDiscord<Elegantbeef> Rather a copy
05:51:31FromDiscord<Elegantbeef> I know I'm hardly the pillar of good performance important code, but I've never really found an issue with the implicit copy
05:51:44FromDiscord<huantian> In reply to @punchcake "bruv what do i": just in case it wasn't clear this is beef's answer to your question https://discord.com/channels/371759389889003530/371759389889003532/1129288373232742420
05:52:07FromDiscord<ambient3332> Seems there's never a free lunch for memory management. It's always a pain https://nim-lang.org/docs/destructors.html
05:52:13FromDiscord<punchcake> In reply to @huantian "just in case it": thanks
05:52:26FromDiscord<Elegantbeef> You only need to worry about that stuff ambient if you need hooks
05:52:37FromDiscord<Elegantbeef> Otherwise you can close your eyes and just understand move semantics
05:52:55FromDiscord<Elegantbeef> `sink` takes memory, you should not use a variable after a suspposed move
05:52:58FromDiscord<Elegantbeef> supposed\
05:53:22FromDiscord<Elegantbeef> That's as simple as move semantics need to be if you do not need hooks
05:53:31FromDiscord<JJ> In reply to @Elegantbeef "If you dont want": would this work for the "actually your struct is on the stack dumbass" problem too?
05:53:32FromDiscord<demotomohiro> sent a code paste, see https://play.nim-lang.org/#ix=4Ay2
05:53:44FromDiscord<Elegantbeef> Of course you disable the copy hook
05:53:58FromDiscord<Elegantbeef> A copy would have to be done explicitly some other way
05:54:13FromDiscord<Elegantbeef> by implementing a `clone` by using `copyMem` by asking very very nicely, one of those
05:54:45FromDiscord<Elegantbeef> Hooks are just general procedures you can implement for your type
05:55:00FromDiscord<Elegantbeef> Want to implement type operations for GPIO pins of a microcontroller you can
05:56:05FromDiscord<Elegantbeef> sent a code paste, see https://paste.rs/sT7AK
05:56:15FromDiscord<Elegantbeef> This even works with `distinct T`
05:56:33FromDiscord<Elegantbeef> https://forum.nim-lang.org/t/9976#65763
05:56:38FromDiscord<Elegantbeef> for a full case study of that
05:58:49FromDiscord<JJ> i gotta play around with hooks more sometime
05:59:18FromDiscord<Elegantbeef> Each day we get more for some reason and I don't know how to use the new ones
05:59:20FromDiscord<JJ> also beef can you evaluate a NimNode to a value within a macro?
05:59:27FromDiscord<Elegantbeef> `=wasMoved` and `=dup` are ones I have 0 clue what they do and why they exist
05:59:28FromDiscord<Elegantbeef> Of course not
05:59:48FromDiscord<Elegantbeef> Nim is statically typed evaluating a NimNode inside a macro would be it'd be dynamically typed
06:00:18FromDiscord<Elegantbeef> Arent you just making a recursive infix tree
06:00:41FromDiscord<JJ> In reply to @Elegantbeef "`=wasMoved` and `=dup` are": oh god i was trying to understand the semantics of wasMoved a while back
06:00:43FromDiscord<Elegantbeef> sent a code paste, see https://paste.rs/T2as2
06:01:09FromDiscord<JJ> mmm. yeah i was trying to do it all with `quote do` but that's better
06:01:13FromDiscord<Elegantbeef> I stick to `=destroy` `=copy` and `=sink`
06:01:23FromDiscord<Elegantbeef> `=trace` is also simple
06:01:29FromDiscord<Elegantbeef> The rest are fucking abysmally under explained
06:01:37FromDiscord<JJ> In reply to @Elegantbeef "Nim is statically typed": wait can you elaborate on this though? if all the values in the NimNode are static it should be fine right
06:01:45FromDiscord<Elegantbeef> Nope
06:02:20FromDiscord<Elegantbeef> The type of the NimNode would have to be dynamically looked up for it to make any sense
06:03:36FromDiscord<JJ> is that not statically known?
06:05:08FromDiscord<Elegantbeef> How does the VM know what type is inside a NimNode before it's evaluated?
06:06:41FromDiscord<Elegantbeef> What does `typeof(a)` expand into when the macro is semantically checked?
06:06:44FromDiscord<Elegantbeef> sent a code paste, see https://paste.rs/IyCPZ
06:06:51FromDiscord<Elegantbeef> You're describing a template that wraps a macro
06:06:54FromDiscord<JJ> well i know nothing about NimNodes but i don't see why it doesn't evaluate it
06:07:04FromDiscord<Elegantbeef> Macros are semantically checked once they're practically compile time procedures
06:07:24FromDiscord<Elegantbeef> Well the question is how can it give a type to an expression when the type can be anything?
06:08:44FromDiscord<Elegantbeef> There is no way without having a macro treated like a template to have `a` be a single type
06:09:09FromDiscord<ambient3332> sent a code paste, see https://play.nim-lang.org/#ix=4Ay8
06:09:14FromDiscord<Elegantbeef> You don't
06:09:33FromDiscord<ambient3332> How do I force a function to use only refs or pointers?
06:09:37FromDiscord<JJ> seqs are heap allocated i believe
06:09:43FromDiscord<Elegantbeef> sent a code paste, see https://play.nim-lang.org/#ix=4Ay9
06:10:02FromDiscord<Elegantbeef> seqs are heap allocated, but that doesnt matter
06:10:17FromDiscord<Elegantbeef> They have a non gc'd object component that's stack allocated
06:10:39FromDiscord<JJ> In reply to @ambient3332 "How do I force": also i don't know if you can do that, sounds quite type unsafe
06:10:43FromDiscord<Elegantbeef> In orc/arc atleast
06:10:44FromDiscord<Elegantbeef> In refc they're just another gc'd type
06:10:44FromDiscord<Elegantbeef> But you cannot go `addr` to ref
06:10:45FromDiscord<Elegantbeef> Those are two different types
06:11:00FromDiscord<Elegantbeef> `proc doThing(t: ref T or ptr T)` 😄
06:11:29FromDiscord<ambient3332> Not what I meant
06:11:29FromDiscord<Elegantbeef> So JJ do you understand why evaluating NimNodes is a bit of a oddball thing?
06:11:55FromDiscord<JJ> no, not really: my confusion comes from the distinction between macros and templates i think
06:12:16FromDiscord<JJ> i thought templates were raw substitution and macros were programmatic ast substitution, before or after typechecking
06:12:20FromDiscord<Elegantbeef> Macros are not code subsitution
06:12:20FromDiscord<Elegantbeef> They run on the VM
06:12:20FromDiscord<Elegantbeef> They are semantically checked once, just like a procedure
06:12:33FromDiscord<Elegantbeef> So a variable has a singular type
06:13:57FromDiscord<JJ> hmm okay i suppose that makes sense
06:13:57FromDiscord<Elegantbeef> For you to be able to evaluate a Nim node that means that variable has to be reinstantiated for every invokation
06:14:08FromDiscord<punchcake> @pmunch will you ever update wxnim?
06:14:45FromDiscord<Elegantbeef> I'm going to say "PRs welcome" for him
06:15:00FromDiscord<punchcake> bet
06:15:10FromDiscord<pmunch> For a newer version of wxWidgets?
06:15:26FromDiscord<pmunch> Or just update wxNim with more features?
06:16:13FromDiscord<punchcake> In reply to @pmunch "Or just update wxNim": update wxnim to wrap all widgets
06:17:06FromDiscord<pmunch> Ah, well I probably will, once Futhark can handle C++
06:20:49FromDiscord<pmunch> Currently it's wrapped by an unwieldy c2nim script, and then manually edited..
06:21:02FromDiscord<pmunch> Which isn't very update friendly
06:22:10FromDiscord<punchcake> damn why is nim lacking so much for production ready gui's
06:22:28FromDiscord<Elegantbeef> It's an uphill battle
06:22:52FromDiscord<JJ> eh isn't gintro pretty good
06:23:31FromDiscord<JJ> but yeah gui is very hard
06:23:40FromDiscord<Elegantbeef> Owlkettle is even nicer 😄
06:24:24FromDiscord<punchcake> i think the best we got is is nim qml bindings
06:25:00FromDiscord<JJ> oh yes that is what i was thinking of! gintro wasn't too bad when i played around with it but owlkettle has been on my totry list for ages
06:25:32FromDiscord<JJ> i knew something had the nice macros
06:30:18FromDiscord<pmunch> wxNim also has nice macros. Along with genui-gtk and genui-gtk3
06:30:55FromDiscord<pmunch> Maybe I should update the latter two to work on my Futhark'd Gtk. That's what I've been using lately
06:32:21FromDiscord<JJ> how are identifier conflicts with gtk? are there too many or is it fairly 1:1
06:34:19FromDiscord<Elegantbeef> Futhark gets around conflicts
06:34:21FromDiscord<JJ> oh my god i didn't realize how much documentation was in `std/macros`
06:34:44FromDiscord<JJ> holy i've been driving blind this whole time
06:35:22FromDiscord<punchcake> when compiling the calculator example on windows https://github.com/neroist/uing↵i keep getting this error https://media.discordapp.net/attachments/371759389889003532/1129300085700833400/message.txt
06:35:26FromDiscord<punchcake> (edit) "error" => "error↵wtf is this"
06:35:30FromDiscord<Elegantbeef> https://github.com/nim-lang/Nim/blob/devel/compiler/ast.nim#L35-L229 there's even more
06:36:07FromDiscord<punchcake> windows gcc btw
06:36:55FromDiscord<JJ> In reply to @Elegantbeef "Futhark gets around conflicts": yea i'm curious how much of it is 1:1 though, i've had some pretty gross experiences with keyboard libraries and the like that need wrapping post futhark
06:37:36FromDiscord<JJ> i suppose gtk falls into that camp purely for the gobject weirdness though
06:41:24*PMunch joined #nim
06:43:25FromDiscord<punchcake> god fucking damn
06:43:32FromDiscord<pmunch> Not quite sure what you mean @JJ
06:43:32FromDiscord<punchcake> is there no decent gui lib in nim
06:43:38FromDiscord<punchcake> at this point im gonna fucking make one
06:43:56FromDiscord<pmunch> @punchcake, I think the answer to that is that there is no good GUI lib period
06:44:03FromDiscord<punchcake> web based ui with nim backend inspired by wails.io
06:44:07FromDiscord<punchcake> In reply to @pmunch "<@655759729477287956>, I think the": wails.io
06:44:12FromDiscord<punchcake> for go at least
06:44:18FromDiscord<pmunch> Welp, you lost me at web-based..
06:44:24FromDiscord<Elegantbeef> web based and written in go
06:44:30FromDiscord<punchcake> web based is unparalleled
06:44:31FromDiscord<Elegantbeef> Two of the worst things imaginable
06:44:46FromDiscord<JJ> yeah that is disgusting
06:44:50FromDiscord<Elegantbeef> You're right it's unparalleled cause it's tangential to a solution
06:44:59FromDiscord<punchcake> In reply to @Elegantbeef "You're right it's unparalleled": what solution is there
06:45:04FromDiscord<Elegantbeef> I did a math funny!
06:45:04FromDiscord<JJ> if you want that though i thought there were some decent web-based uis
06:45:15FromDiscord<punchcake> In reply to @omentic "if you *want* that": where is it?
06:45:22FromDiscord<Elegantbeef> owlkettle is nice ime
06:45:28FromDiscord<Elegantbeef> I'm not a proper developer though
06:45:43FromDiscord<Elegantbeef> I'm just a sophisticated monkey at a computer
06:45:52FromDiscord<JJ> In reply to @punchcake "where is it?": https://github.com/ringabout/awesome-nim#web-technology
06:45:55FromDiscord<JJ> https://github.com/treeform/fidget in particular
06:46:13FromDiscord<punchcake> fidget is abandoned
06:46:24FromDiscord<Elegantbeef> fidget isnt web based
06:46:28FromDiscord<punchcake> the maintainer treeform is too busy hopping between projects instead of finishing it
06:46:53FromDiscord<Elegantbeef> I mean he writes using his libraries that's proprietary
06:47:17FromDiscord<JJ> i really gotta try out owlkettle
06:47:31FromDiscord<JJ> gotta come up with a reason to though, i write guis so infrequently
06:47:32FromDiscord<pmunch> https://github.com/bung87/crowngui Maybe give this a try?
06:47:42FromDiscord<Elegantbeef> I wrote a doom launcher in it one day, was nice
06:47:59FromDiscord<Elegantbeef> https://github.com/webui-dev/nim-webui also there is this
06:48:08FromDiscord<JJ> also what exactly is your problem punchcake? do you want a cross-platform ui library, or a native library, or a web library, or...
06:48:33FromDiscord<JJ> or immediate mode or something
06:48:37FromDiscord<punchcake> In reply to @omentic "also what exactly is": web ui preferred but something that isnt just straight up abandoned and made for humans would work
06:48:40FromDiscord<pmunch> Or maybe this? https://github.com/juancarlospaco/webgui
06:49:05FromDiscord<pmunch> Or just go through this list yourself 😛 https://nimble.directory/search?query=gui
06:49:13FromDiscord<JJ> In reply to @punchcake "web ui preferred but": > last commit was 10 months ago↵> "straight-up abandoned"
06:49:21FromDiscord<punchcake> im making my own web ui lib
06:49:23FromDiscord<Elegantbeef> JJ if you care to see the doom launcher https://play.nim-lang.org/#ix=4Ayd
06:49:36FromDiscord<punchcake> you bind to javascript using only a macro
06:49:40FromDiscord<pmunch> But yeah, I agree that the community hasn't landed on one particular solution
06:49:42FromDiscord<punchcake> sorta like tauri
06:49:46FromDiscord<Elegantbeef> image.png https://media.discordapp.net/attachments/371759389889003532/1129303710091182090/image.png
06:49:47FromDiscord<Elegantbeef> It's like totally passable on top of it
06:50:12FromDiscord<pmunch> I wanted to take Genui to be a bring-your-own-toolkit macro system for generating UIs
06:50:18FromDiscord<JJ> In reply to @punchcake "you bind to javascript": ooh nice
06:50:30FromDiscord<JJ> In reply to @Elegantbeef "JJ if you care": ooh nice
06:50:57FromDiscord<punchcake> althought uing looks promising if the thing would actually compile on my system
06:51:30FromDiscord<pmunch> https://github.com/pmunch/genui but well, 4 years since last commit. Don't quite remember what the blocker was..
06:52:05FromDiscord<punchcake> In reply to @pmunch "https://github.com/pmunch/genui but well, 4": sorta like haxeui?
06:52:18FromDiscord<punchcake> the ui code you write is backend agonistic
06:52:38FromDiscord<punchcake> you can have wxwidgets as backend and suddenly switch to openfl and everything would work fine
06:52:51FromDiscord<Elegantbeef> I've pretty much given up on the premise of using DSLs for generating UI
06:52:55FromDiscord<punchcake> i actually convinced them to add a winui backend and they're working on it
06:53:14FromDiscord<JJ> also beef any way to use `expandMacros` when my code (not macro) doesn't compile
06:53:22FromDiscord<Elegantbeef> `echo result.repr`
06:53:35FromDiscord<pmunch> @punchcake that's a weird error message..
06:53:41FromDiscord<punchcake> In reply to @pmunch "<@655759729477287956> that's a weird": where?
06:53:48FromDiscord<pmunch> _O_BINARY should be a built in Windows thing
06:53:52FromDiscord<JJ> In reply to @Elegantbeef "`echo result.repr`": ah nice ty
06:54:07FromDiscord<Elegantbeef> For context https://github.com/beef331/gooey/blob/master/example/sdlimpl.nim#L306-L430 to me is much more sensible to a DSL as it's just pure Nim code
06:54:09FromDiscord<punchcake> In reply to @pmunch "_O_BINARY should be a": its strange
06:54:23FromDiscord<Elegantbeef> @JJ\: I already mentioned `echo result.repr`, but no someone never listens to me 😄
06:54:27FromDiscord<punchcake> even compiling an `echo "hello world"` doesnt work
06:54:40FromDiscord<pmunch> Yeah I guess sorta like haxeui
06:54:49FromDiscord<punchcake> perhapse i clapped my gcc install?
06:55:00FromDiscord<Elegantbeef> Possibly
06:55:20FromDiscord<punchcake> nim should really use msvc on windows
06:55:52FromDiscord<pmunch> You can use MSVC on Windows if you like
06:55:55FromDiscord<punchcake> how?
06:56:13FromDiscord<Elegantbeef> I mean it cannot ship msvc easily
06:56:18FromDiscord<pmunch> https://forum.nim-lang.org/t/2770
06:56:27FromDiscord<Elegantbeef> Mingw is used cause it can ship it
06:56:39FromDiscord<Elegantbeef> clang could be nicer
06:57:03Amun-Razig cc -target windows-something-something too
06:57:16FromDiscord<punchcake> zig?
06:57:17Amun-Rax86_64-windows-sth
06:57:31FromDiscord<Elegantbeef> amun keep your zig installation soon that wont be possible! 😛
06:57:39Amun-Ra;)
06:57:41FromDiscord<pmunch> In reply to @Elegantbeef "For context https://github.com/beef331/gooey/blob/m": There are so many lines though..
06:57:46Amun-RaElegantbeef: why?
06:58:03Amun-Rapunchcake: I'd use mingw64/32 really
06:58:05FromDiscord<Elegantbeef> Right pmunch cause it's a game ui 😄
06:58:31FromDiscord<Elegantbeef> Cause Zig is getting spring cleaning removing that functionality
06:58:44FromDiscord<pmunch> Yeah but I meant there are so many lines to describe what could be done in fewer lines
06:58:50Amun-Raoh, I didn't know that…
06:58:55FromDiscord<Elegantbeef> Uhhh
06:59:29FromDiscord<Elegantbeef> Size is important, pos is important, anchor is important, ....
06:59:30FromDiscord<pmunch> Personally I think the approach I took with genui is the right one for a DSL. Basically just a code generator, nothing fancy: https://github.com/PMunch/wxnim/blob/master/examples/genuimacro/controlgallery.nim
06:59:46FromDiscord<punchcake> i think its a problem because im using the gcc that ada installer installed for me with msys2
06:59:51FromDiscord<punchcake> hm
06:59:51FromDiscord<pmunch> It's almost a straight 1:1 mapping
06:59:55FromDiscord<Elegantbeef> In normal GUIs you don't need any of the anchoring, size, or position stuff
07:00:51FromDiscord<Elegantbeef> but that's on Nim being silly
07:00:51FromDiscord<Elegantbeef> And ideally a `.named` template would work to prevent those variables
07:01:09FromDiscord<pmunch> And compare that to gtk3genui: https://github.com/PMunch/gtk3genui/blob/master/example.nim
07:01:32FromDiscord<pmunch> The names change, but the concept is still the same
07:01:46FromDiscord<Elegantbeef> The thing with dsls that i'm weary of is stuff like https://github.com/can-lehmann/owlkettle/issues/25
07:02:05FromDiscord<Elegantbeef> Assumptions can break otherwise valid code
07:02:13FromDiscord<pmunch> Basically just keep some context from indentation, remove some terse Cisms when it comes to creating containers and putting stuff in them, et voila
07:02:50FromDiscord<punchcake> btw is the creator of nim in this server?
07:03:07FromDiscord<Elegantbeef> Or like if you look at karax missing some specific valid html tags
07:03:15FromDiscord<pmunch> Yup, but he mainly stays in the internals channel nowadays
07:03:30FromDiscord<Elegantbeef> Cannot put up with my clown world inanity for sure
07:03:40FromDiscord<pmunch> <_<
07:03:46FromDiscord<punchcake> In reply to @pmunch "Yup, but he mainly": would like to ask him what he thinks of the state of nim gui's
07:03:59FromDiscord<Elegantbeef> https://forum.nim-lang.org/t/10301
07:04:02FromDiscord<Elegantbeef> There you go already answered
07:04:04FromDiscord<punchcake> he looks pretty mad
07:04:09FromDiscord<pmunch> Haha, I was just about to link that
07:05:18FromDiscord<punchcake> how do i clear the nim compiler cache
07:05:23FromDiscord<punchcake> i think i fixed my gcc bug
07:05:26FromDiscord<pmunch> Anyways ElegantBeef, that criticism is more about DSL design in general
07:05:30FromDiscord<pmunch> And not really GUI specific
07:05:42FromDiscord<pmunch> @punchcake just delete your nimcache folder
07:05:46FromDiscord<Elegantbeef> Eh depends on the application
07:05:47FromDiscord<pmunch> Wherever that is on Windows..
07:05:48FromDiscord<punchcake> wow
07:05:51FromDiscord<punchcake> sent a code paste, see https://play.nim-lang.org/#ix=4Ayg
07:06:28FromDiscord<punchcake> In reply to @pmunch "<@655759729477287956> just delete your": aight bet
07:07:07FromDiscord<punchcake> sent a code paste, see https://play.nim-lang.org/#ix=4Ayh
07:07:09FromDiscord<punchcake> im starting to think this is a nim bug
07:07:15FromDiscord<punchcake> gcc compile regular C just fine
07:08:09FromDiscord<pmunch> Hmm, that leading underscore is a bit strange
07:08:29FromDiscord<pmunch> But Araq himself uses Windows, so it's not like Nim doesn't compile there
07:08:39FromDiscord<punchcake> well then
07:08:40FromDiscord<punchcake> shit
07:08:42FromDiscord<pmunch> Which Nim version do you have?
07:08:49FromDiscord<punchcake> latest
07:08:55FromDiscord<pmunch> And by latest you mean?
07:09:00FromDiscord<pmunch> What does nim --version return?
07:09:11FromDiscord<punchcake> Nim Compiler Version 1.6.14 [Windows: amd64]↵Compiled at 2023-06-27↵Copyright (c) 2006-2023 by Andreas Rumpf
07:09:14FromDiscord<Elegantbeef> > 1.6.14
07:09:29FromDiscord<pmunch> Oh duh, it says in the error trace 😛
07:09:40FromDiscord<Elegantbeef> Hey I wasnt going to say it
07:10:36FromDiscord<punchcake> prolly a nim bug
07:10:42FromDiscord<punchcake> lemme see if downgrading nim would help
07:12:51*sagax joined #nim
07:12:55FromDiscord<punchcake> so i use the mingw provided by the nim site and i get more errors
07:13:04FromDiscord<pmunch> I mean the Windows documentation for that _setmode call says that you should be able to use _O_BINARY: https://learn.microsoft.com/en-us/cpp/c-runtime-library/reference/setmode?view=msvc-170
07:13:11FromDiscord<punchcake> https://media.discordapp.net/attachments/371759389889003532/1129309602215907429/message.txt
07:13:53FromDiscord<punchcake> ffs nim should ship its own gcc or something
07:14:00FromDiscord<pmunch> That just looks like a linker error though
07:14:08FromDiscord<odexine> In reply to @punchcake "ffs nim should ship": It kinda does?
07:14:09FromDiscord<pmunch> What are you trying to compile?
07:14:16FromDiscord<punchcake> In reply to @pmunch "What are you trying": `echo "hello world"`
07:14:35FromDiscord<pmunch> I mean, the better solution is that people start to use an operating system with a sane package management system..
07:14:52FromDiscord<punchcake> i perfer to use proprietary spyware
07:15:02FromDiscord<pmunch> I won't kink shame
07:15:06FromDiscord<odexine> Hey we don’t kink shame here
07:15:13FromDiscord<punchcake> thanks!
07:15:14FromDiscord<odexine> What the fuck don’t beat me to the punch
07:15:28FromDiscord<punchcake> In reply to @odexine "What the fuck don’t": thats what she said
07:15:44FromDiscord<huantian> In reply to @pmunch "I mean, the better": everyone go use nixos
07:15:55FromDiscord<punchcake> tried linux mint
07:15:56FromDiscord<punchcake> sucks
07:16:06FromDiscord<punchcake> tried every linux distro and i didnt like any
07:16:12FromDiscord<ambient3332> sent a code paste, see https://play.nim-lang.org/#ix=4Ayj
07:16:13FromDiscord<JJ> In reply to @pmunch "I mean, the better": tbf arch is actually quite awful at keeping the nim package up to date
07:16:26FromDiscord<JJ> surprisingly, they're usually very good with everything except haskell
07:16:33FromDiscord<huantian> In reply to @punchcake "tried linux mint": ngl I kinda didn't like mint
07:16:39FromDiscord<Elegantbeef> Same I liked my hard drive after installing it but it didnt taste minty
07:16:39FromDiscord<Elegantbeef> licked\
07:16:40*ntat joined #nim
07:16:47FromDiscord<punchcake> In reply to @Elegantbeef "Same I liked my": scammed
07:16:54FromDiscord<punchcake> i have an idea
07:16:54FromDiscord<pmunch> In reply to @omentic "tbf arch is actually": Well that's because you use the Nim package and not the choosenim package 😛
07:17:06FromDiscord<huantian> yeah you should use choosenim from the AUR 😛
07:17:09FromDiscord<punchcake> i can compile nim directly to C then compile C using msvc right?
07:17:20FromDiscord<JJ> In reply to @pmunch "Well that's because you": nah i jumped on choosenim immediately, same for rustup etc
07:17:37FromDiscord<JJ> actually switched to disruptek's thing recently though
07:17:40FromDiscord<pmunch> @punchcake so do manually what setting the MSVC flags do? Just without all the compatibility stuff`
07:17:44FromDiscord<JJ> it was painful (i cannot read documentation)
07:18:01FromDiscord<pmunch> @JJ Does he have a choosenim alternative now as well?
07:18:19FromDiscord<JJ> yeah: https://github.com/nim-works/gitnim
07:18:44FromDiscord<punchcake> wait how do i get the c file that nim compiles to
07:19:55Amun-Raset --nimcache
07:21:17FromDiscord<punchcake> HUH
07:21:18FromDiscord<JJ> i think mine is broken though, i only have `devel` as an option, no `stable` or anything else. kinda fucked up my installation hard the first time though so
07:21:36FromDiscord<punchcake> after clearing nimcache it somehow compiles fine
07:21:46FromDiscord<ambient3332> how do I override toFloat so that it throws an error when it's called and gives me the stack?
07:22:13FromDiscord<ambient3332> ...locally
07:22:43FromDiscord<Elegantbeef> Gitnim doesnt work on windows
07:22:43FromDiscord<Elegantbeef> Cannot tell if that was a joke by dis or a bug
07:22:43FromDiscord<Elegantbeef> libgit and all is fun
07:22:44FromDiscord<Elegantbeef> I think there is an issue with gitnim presently, didnt look into it though
07:22:44FromDiscord<Elegantbeef> `git nim stable` got like `1.4.8` iirc
07:23:06FromDiscord<JJ> oof the bridge
07:23:11FromDiscord<Elegantbeef> Do you have a converter by any chance ambient?
07:23:18FromDiscord<ambient3332> A what?
07:23:36FromDiscord<Elegantbeef> `converter someName(a: int): float = toFloat(a)`
07:23:39FromDiscord<Elegantbeef> Something like that
07:23:52FromDiscord<ambient3332> No I haven't written anything like that
07:24:36FromDiscord<Elegantbeef> Well then there is no `toFloat` inside that could you shared unless you overloaded `[]` to calll `toFloat`
07:24:36FromDiscord<Elegantbeef> that code you shared\
07:25:26FromDiscord<odexine> In reply to @huantian "everyone go use nixos": uegh
07:25:35FromDiscord<odexine> i love nixos for my sysadmin tasks but
07:25:44FromDiscord<odexine> id prolly puke using it on my desktop/laptop
07:26:19FromDiscord<odexine> In reply to @omentic "surprisingly, they're usually very": i discovered this painfully
07:26:34FromDiscord<ambient3332> sent a code paste, see https://play.nim-lang.org/#ix=4Aym
07:27:30FromDiscord<Elegantbeef> Right you're not calling `toFloat` directly then, it's likey inside one of the procedures you're using so what types are those collections?
07:27:38FromDiscord<JJ> sent a code paste, see https://play.nim-lang.org/#ix=4Ayo
07:27:39PMunchHmm gitnim has an interesting idea of putting itself next to the Nim compiler
07:27:56FromDiscord<Elegantbeef> JJ you need `: untyped` as the return type
07:28:01PMunchAh crap..
07:28:10FromDiscord<JJ> oh, thanks!
07:28:13PMunchI forgot choosenim uses the silly proxy executable..
07:28:35PMunchI thought I could get nimlsp to recompile for each choosenim version..
07:28:40FromDiscord<Elegantbeef> git nim is interesting due to the shipping a static Nim library
07:28:49FromDiscord<Elegantbeef> Just clone, build, add to path and you're off to the raises
07:28:55FromDiscord<Elegantbeef> races even
07:28:58FromDiscord<Elegantbeef> raises is funnier though
07:29:26PMunchA static Nim library?
07:29:40FromDiscord<Elegantbeef> binary
07:29:40FromDiscord<odexine> In reply to @Elegantbeef "Just clone, build, add": off to the raisins
07:29:54FromDiscord<Elegantbeef> I phonetically fucked up raises and races, you think I can get all my words right
07:29:54PMunchOh by the way Elegantbeef, I was wondering if it would be possible to create a dynamic library out of the nimscript stuff
07:29:59PMunchWouldn't that be neat?
07:30:20FromDiscord<Elegantbeef> Would reduce compile times
07:30:24FromDiscord<Elegantbeef> So that'd be nifty
07:31:49FromDiscord<JJ> In reply to @Elegantbeef "JJ you need `:": just checking: there's no typed/untyped distinction for macro return types, right?
07:31:58FromDiscord<demotomohiro> In reply to @punchcake "i can compile nim": If you compile Nim code with `--cc:vcc` option, Nim generate C code for msvc and calls cl.exe.
07:31:58FromDiscord<Elegantbeef> Right
07:32:07FromDiscord<Elegantbeef> You just need to tell it you're returning a value from the macro
07:32:09FromDiscord<Elegantbeef> A bit odd
07:32:16FromDiscord<JJ> oh hmm
07:33:51FromDiscord<ambient3332> sent a code paste, see https://play.nim-lang.org/#ix=4Ayr
07:33:52PMunchElegantbeef, yeah and you could re-use the same library instead of having to add 5Mb to every project which wanted to use it
07:33:57FromDiscord<ambient3332> even if I specify int manually for both types
07:36:21FromDiscord<ambient3332> fixed it. apparently Nim doesn't understand const types
07:36:41FromDiscord<Elegantbeef> It does
07:36:49FromDiscord<odexine> what do you mean, yeah
07:36:49FromDiscord<ambient3332> well, it did not
07:37:07FromDiscord<Elegantbeef> Well pmunch luckily the entry module is like 200 loc so it shouldnt be too hard to do
07:37:13FromDiscord<ambient3332> sent a code paste, see https://paste.rs/YA2g7
07:37:27PMunchElegantbeef, yeah that's what I seemed to remember
07:37:30FromDiscord<Elegantbeef> integers are int by default
07:38:00PMunchAs long as it doesn't use too much type magic..
07:38:21FromDiscord<Elegantbeef> Although `invokeDynamic` needs to be turned into a procedure that just returns the VM stuff
07:38:41FromDiscord<Elegantbeef> I also don't know how exceptions in DLLs work
07:40:19PMunchThey don't..
07:40:23PMunchWell unless you use nimrtl
07:40:45PMunchBut I was kinda thinking it should be made to work with normal C as well
07:41:41PMunchBut that's mostly just a matter of setting up a try/except and turn the exception into something else
07:41:57FromDiscord<Elegantbeef> Well just removing the front facing exceptions, yea
07:42:30FromDiscord<Elegantbeef> It's completely useless as a C library though
07:42:55FromDiscord<Elegantbeef> Well mostly useless
07:43:20FromDiscord<Elegantbeef> Cause yay you can call Nimscript, but to actually do anything with the result or hook procedures you have to write a bunch of inane code
07:45:14PMunchWould you though? Say you want to use it for some configuration stuff. You define some setter procedures, and hook them to a callback. The callback is called, and you unpack the argument (same as you have to in Nim)
07:45:44FromDiscord<Elegantbeef> Except that Nim has the type information to unpack complex types and has the type information for the entire Nim AST
07:45:56PMunchHmm, true
07:46:07FromDiscord<Elegantbeef> Unpacking primitives is easy
07:46:27FromDiscord<ambient3332> it seems the foFloat has something to do with overflow checking... 😖
07:46:31FromDiscord<Elegantbeef> But if you want to unpack anything else you need to port `vmconversions` to your language
07:48:09PMunchTrue
07:48:20PMunchBut you had to implement that in Nim :P
07:48:22FromDiscord<Elegantbeef> But I'll consider trying to make it a library, probably won't do it any time soon if I do though, still want to work on my game and perhaps the dumb language benchmark idea I have
07:48:26PMunchSo the cost isn't really any higher
07:49:39PMunchYeah it's not high up on my list either. Just a thought which struck me today and wanted to bounce it off you to see if you could think of something which would make it impossible
07:52:23FromDiscord<Elegantbeef> If curious I made a fractal tree toy inside Odin with sdl2 and now I kinda want to port the exact code to other system languages just to say "Look all languages are the same, shut up"
07:52:37FromDiscord<Elegantbeef> Fractal tree is a great example cause it's interactive and fun 😄
07:57:53PMunchFractal tree?
07:58:23FromDiscord<Elegantbeef> simplescreenrecorder-2023-07-13\_02.20.24.mp4 [simplescreenrecorder-2023-07-13_02.20.24.mp4](https://t2bot.io/_matrix/media/r0/download/matrix.org/quKqINmmjBdrQrTlGGbikXJA)
07:58:52FromDiscord<Elegantbeef> Split evenly at every split until you run out of memory or reach a small enough branch
07:59:50Amun-Ranice
08:05:00PMunchHuh, pretty cool
08:06:37FromDiscord<Elegantbeef> The fun part is it's quite a visible graph problem when it comes to optimising it
08:07:18FromDiscord<Elegantbeef> Like moving a branch can be optimised to just move the subnodes if you set up the data type properly
08:07:26FromDiscord<Elegantbeef> iterate the subnodes\
08:15:55FromDiscord<bung8954> any idea I get nil ? I've searched on github that the useage is same as c or using com_ptr in cpp https://github.com/bung87/webview2/blob/da054ada39c0c3905edbaf6babad332d6785febe/src/webview2/controller_completed_handler.nim#L22C2-L29C20
08:20:01FromDiscord<demotomohiro> This PR adds `staticFileExists` and `staticDirExists`, but I cannot make calling them at runtime to compile error.↵https://github.com/nim-lang/Nim/pull/22278
08:23:50*PMunch_ joined #nim
08:25:26*PMunch quit (Killed (NickServ (GHOST command used by PMunch_)))
08:25:29*PMunch_ is now known as PMunch
08:25:57FromDiscord<Elegantbeef> There's no way of doing it
08:26:03FromDiscord<Elegantbeef> `when nimvm` sems both branches
08:26:48FromDiscord<Elegantbeef> it might have to be made magic and error inside codegen sadly
08:28:57FromDiscord<demotomohiro> That's sounds hard.↵I don't know much about Nim compiler internals.
08:30:48FromDiscord<Elegantbeef> Best to ask inside internals though
08:30:58FromDiscord<Elegantbeef> It's a real shame that nimvm works how it does
08:40:33FromDiscord<JJ> sent a code paste, see https://play.nim-lang.org/#ix=4AyK
08:42:57FromDiscord<demotomohiro> fold?
08:43:16FromDiscord<JJ> it's not fold, fold is cumulative
08:43:21FromDiscord<JJ> it's like a blend of fold and map
08:44:16FromDiscord<nnsee> reduce?
08:44:29FromDiscord<odexine> zip + map
08:44:39FromDiscord<Elegantbeef> zap?
08:44:44FromDiscord<nnsee> function reads just like https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/reduce
08:44:53FromDiscord<odexine> it isnt
08:45:02FromDiscord<odexine> it doesnt accumulate
08:45:36FromDiscord<nnsee> reduce doesn't either
08:45:40FromDiscord<odexine> it reads more like zip(arr[0..^2], arr[1..^1]).map() to me, except the first element is weird and its first&first
08:46:55FromDiscord<odexine> In reply to @nnsee "reduce doesn't either": reduce is `ret = fun(ret, elem)`, this is `elem = fun(prev, elem); prev = elem`
08:46:56FromDiscord<nnsee> sent a long message, see http://ix.io/4AyN
08:47:21FromDiscord<JJ> reduce seems equivalent to fold
08:47:25FromDiscord<odexine> reduce is fold
08:47:41FromDiscord<JJ> > The final result of running the reducer across all elements of the array is a single value.↵mine is mutating a `var seq[int]`
08:47:48FromDiscord<odexine> again, i think it is zip and map
08:47:59FromDiscord<nnsee> oh, I see now, right
08:48:11FromDiscord<odexine> but i dont know why you want first run to be (first, first)
08:48:54FromDiscord<JJ> i don't think zip and map can work because `prev` is the output of the previous calculation not just the previous value
08:49:13FromDiscord<odexine> ig it would be (naively) `zip(arr[0] & arr, arr).map(...)`
08:49:18FromDiscord<odexine> oh is it
08:49:25FromDiscord<odexine> okay wait i remember what the name is for that
08:49:47FromDiscord<jmgomez> The best way to know the "funtional name" is to dont mutate it and to put the signature here: https://hackage.haskell.org/packages/browse↵I found stuff like `sequence` like that
08:50:19FromDiscord<odexine> its called scanl in haskell
08:50:25FromDiscord<odexine> https://hackage.haskell.org/package/base-4.18.0.0/docs/Prelude.html#v:scanl
08:50:27FromDiscord<odexine> but
08:50:31FromDiscord<odexine> no equiv in nim
08:50:40FromDiscord<JJ> hmm interesting
08:50:48FromDiscord<JJ> i suppose it is not too widely useful
08:50:56FromDiscord<odexine> lol
08:51:59FromDiscord<JJ> well might pr it to sequtils then 😛
08:52:20FromDiscord<odexine> eh
08:52:31FromDiscord<odexine> i mean sure ig
08:52:50FromDiscord<Elegantbeef> Firstly you should use `openarray[T]`
08:52:59FromDiscord<odexine> personally think sequtils should die and a replacement that can compose should be made, maybe i should bring Control.Arrow to nim LMFAO
08:53:11FromDiscord<JJ> yeah sequtils does suck hard
08:53:21FromDiscord<JJ> beef you had a magic replacement right?
08:53:23FromDiscord<nnsee> i like sequtils
08:53:28FromDiscord<jmgomez> My opinion on it is that it should use concepts
08:53:32FromDiscord<Elegantbeef> Secondly why are you using two generic parameters
08:53:33FromDiscord<Elegantbeef> "magic replacement"
08:53:39FromDiscord<odexine> i sure wish concepts worked better tho
08:53:43FromDiscord<Elegantbeef> concepts do not work to solve the issues it has
08:53:59FromDiscord<JJ> In reply to @nnsee "i like sequtils": it's not lazy though, chaining multiple functions will iterate through the whole seq again when you don't need to
08:53:59FromDiscord<jmgomez> what issue?
08:54:09FromDiscord<JJ> laziness yea
08:54:15FromDiscord<Elegantbeef> Allocations
08:54:16FromDiscord<jmgomez> I mean the std in general anyways
08:54:26FromDiscord<Elegantbeef> https://github.com/beef331/slicerator/blob/itermacros/tests/titermacros.nim JJ
08:54:30FromDiscord<JJ> rust does it with types and a collect but that's a little gross
08:54:33FromDiscord<Elegantbeef> Zoom did some nice work
08:54:43FromDiscord<jmgomez> ahh yeah, this was more of a general thought
08:54:48FromDiscord<Elegantbeef> Oh sure the stdlib should use concepts
08:55:02FromDiscord<Elegantbeef> sequtils needs to do what slicerator's itermacros branch has
08:55:12FromDiscord<Elegantbeef> But that makes it no longer sequtils 😄
08:55:14FromDiscord<JJ> In reply to @Elegantbeef "Oh sure the stdlib": oh yea absolutely
08:55:29FromDiscord<JJ> that'd be totally sick if it happened (with v2 concepts)
08:55:30FromDiscord<ambient3332> My Nim FFT is only 10x slower than state of the art. Maybe it's time to do some other things
08:55:40FromDiscord<nnsee> In reply to @Elegantbeef "https://github.com/beef331/slicerator/blob/itermacr": neat
08:55:44FromDiscord<Elegantbeef> 10x slower is unacceptable
08:56:11FromDiscord<Elegantbeef> Worth noting with that itermacros module it only allocates a sequence where it calls `collect`
08:56:16FromDiscord<Elegantbeef> otherwise it's just an iterator
08:56:26FromDiscord<Elegantbeef> So chaining is quite literally 0 cost
08:57:05FromDiscord<ambient3332> You're welcome to make it faster https://pastebin.com/0ib7Hga6
08:57:18FromDiscord<JJ> the stdlib using concepts is on my shortlist of viable-changes-with-major-improvements
08:57:50FromDiscord<JJ> unfortunately i also have an inviable shortlist
08:58:12FromDiscord<Elegantbeef> Concepts are still experimental so uhh yea
08:59:16FromDiscord<odexine> make them not experimental, duh, ex
08:59:17FromDiscord<odexine> (edit) "ex" => "ez"
08:59:23FromDiscord<odexine> such a simple solution smh
08:59:38FromDiscord<Elegantbeef> sent a code paste, see https://play.nim-lang.org/#ix=4AyR
08:59:59FromDiscord<Elegantbeef> atleast the second two can be
09:01:07FromDiscord<Elegantbeef> Eh maybe it's not worth it
09:01:17FromDiscord<Elegantbeef> Thought one could get more math out but it seems like it's the same amount of math
09:02:12FromDiscord<ambient3332> The biggest gains will probably be on algorithm level and cache locality
09:02:32FromDiscord<JJ> In reply to @omentic "the stdlib using concepts": viable shortlist is concepts in the stdlib, sum types & pattern matching, arbitrary recursive type/function lookup (declaration order not mattering)
09:02:37FromDiscord<Elegantbeef> Right but eliminating any amount of work from commonly looped code will be beneficial 😄
09:02:38FromDiscord<ambient3332> Also usin sincos instead of separate would give a noticiable boost
09:02:55FromDiscord<JJ> In reply to @omentic "unfortunately i also have": inviable shortlist is swift-style error handling (stdlib uses Options/Results universally & you can unwrap them into try/catchable errors with `!`), no first-class iterators and instead an Iterable concept/interface that just defines a `next()` func, `pub` instead of `` for the export marker
09:03:10FromDiscord<JJ> beef you'd find swift error handling reasonable i think
09:03:17FromDiscord<Elegantbeef> Nope
09:03:20FromDiscord<JJ> options when you want them, try/catches when you don't
09:03:25FromDiscord<JJ> oh really
09:03:40FromDiscord<Elegantbeef> I do not like the pollution of the return type with errors really
09:04:00FromDiscord<JJ> when writing func? or when using funcs?
09:04:03FromDiscord<Elegantbeef> Arne says I dislike handling errors, but I just dislike handling errors when I'm writing one offs
09:04:07FromDiscord<Elegantbeef> When using
09:04:16FromDiscord<JJ> ah see but that's what swift makes nice
09:04:27FromDiscord<jmgomez> I do like them but inference in Nim will no make a nice UX for it
09:04:51FromDiscord<jmgomez> so first it has to be improved if it is even possible to do so
09:05:07FromDiscord<JJ> you just call the function name with `!` and it treats it like it throws errors
09:05:17FromDiscord<Elegantbeef> Lol
09:05:33FromDiscord<Elegantbeef> That's not a solution in Rust, it's not a solution in Swift
09:05:55FromDiscord<ambient3332> @elegantbeef https://media.discordapp.net/attachments/371759389889003532/1129337969166258236/Profiler_lwJ7MjpVeS.png
09:06:00FromDiscord<Elegantbeef> Atleast in Swift it doesnt pollute the type since it just says throws x
09:09:34FromDiscord<JJ> sent a code paste, see https://play.nim-lang.org/#ix=4AyU
09:10:33FromDiscord<JJ> result types might still pollute the function return type if only in declaration but it functions as you like it when used with `!`
09:11:05FromDiscord<Elegantbeef> Yes I know how it works
09:11:05FromDiscord<Elegantbeef> It's the same as rust
09:12:15FromDiscord<JJ> rust doesn't have try/catch i believe, and `unwrap()` directly panics instead of throwing a catchable error
09:12:27FromDiscord<Elegantbeef> Sure, same semantics though
09:12:34FromDiscord<JJ> what do you not like about it?
09:12:40FromDiscord<Elegantbeef> `!` allows you disregard the error
09:12:53FromDiscord<Elegantbeef> I want to just write code 😄
09:13:16FromDiscord<JJ> yea you'd just have to put `!` everywhere i suppose
09:13:55FromDiscord<Elegantbeef> If you have results or error tuples like odin/go you force the handling of errors which nice I guess
09:14:02FromDiscord<JJ> but it's super minimal syntax overhead, and in exchange you can write safe code without loads of try/catches if you'd like
09:14:11FromDiscord<Elegantbeef> Sure
09:14:14FromDiscord<JJ> yeah rust really sold me on the handle-everything paradigm
09:14:28FromDiscord<Elegantbeef> I don't really like the handle everything paradigm
09:14:56FromDiscord<JJ> there's definitely two camps
09:15:15FromDiscord<JJ> and each camp "pollutes" the other if they have control of the stdlib
09:16:03FromDiscord<JJ> i haven't found a minimal syntax for going from the object-oriented throws-errors approach to a functional result-types approach however
09:16:13FromDiscord<JJ> vs. `!` is pretty minimal the other way around
09:17:09FromDiscord<JJ> anyways i'm going to play around with questionable at some point to make it work like that, see if the ergonomics are actually good
09:17:35FromDiscord<JJ> since i don't write much swift (fortunately? unfortunately?)
09:18:34FromDiscord<deeuu> Hey,↵Isn't Nim's `.raises` a fair compromise, though? i.e. force error handling where needed (and when not writing one-offs)?
09:19:25FromDiscord<deeuu> (lurking, so thought I'd chip in 😉
09:20:57FromDiscord<JJ> imo error handling is 100% about the syntax
09:21:10FromDiscord<JJ> and raises is pretty verbose
09:22:03FromDiscord<JJ> java's checked exceptions scared a generation of programmers out of safe error handling despite being pretty good technically
09:22:54FromDiscord<JJ> oh i totally misunderstood you! nvm
09:23:22FromDiscord<odexine> {.raises: .} is what they meant
09:23:29FromDiscord<deeuu> Yeah that's what I meant, thanks
09:24:00FromDiscord<Elegantbeef> The magic part of Nim's effect system that makes it as good as options for everything but performance
09:24:08NimEventerNew Nimble package! skinsuit - utility macros mostly for object variants, see https://github.com/metagn/skinsuit
09:24:16FromDiscord<Elegantbeef> Bad path is still slower than the bad path of results
09:24:40FromDiscord<JJ> you mean treat the `.raises.` that the compiler infers as an implicit `Result` type? yeah that'd be interesting, hmm. would you then have similar functional helper methods for quickly handling errors like in std/options etc?
09:24:59FromDiscord<Elegantbeef> Fuck every time I write a library related to sumtypes someone does something better
09:25:47FromDiscord<JJ> ooh looks like metagn's been working on that huh
09:25:59FromDiscord<JJ> i gotta pick up the pace 😅
09:26:02FromDiscord<jmgomez> Was checking it, it looks nice. Is metagn a core dev? He does a lot of work
09:26:09FromDiscord<Elegantbeef> Nope
09:26:11FromDiscord<odexine> is treeform a core dev?
09:26:14FromDiscord<odexine> :baqua:
09:26:16FromDiscord<odexine> i kid
09:26:23FromDiscord<jmgomez> I mean, treeform doenst work in the compiler, does he?
09:26:24FromDiscord<Elegantbeef> Metagn does a lot of compiler stuffs
09:26:52FromDiscord<odexine> "does a lot of work" sounded kinda ambiguous
09:27:31FromDiscord<jmgomez> Well the context of core dev disambiguates it 😛
09:28:10FromDiscord<odexine> we be malicious in interpretation sometimes
09:30:05FromDiscord<jmgomez> just checked the guy has 236 PRs, and not stuff like changing a typo in the manual precisely
09:31:52FromDiscord<Asbjørn> sent a long message, see http://ix.io/4AyY
09:32:34FromDiscord<Elegantbeef> Well they want advice from experience Nim devs so that's my signal to go to sleep
09:34:58FromDiscord<ringabout> In reply to @jmgomez "Was checking it, it": Well, I suppose everyone who has contributed to the Nim compiler dozen times is/was a core dev. Since Nim doesn't have a foundation or something, it's vague in core dev's sense,
09:37:58FromDiscord<jmgomez> In reply to @ringabout "Well, I suppose everyone": Maybe a professional Nim compiler developer is a better term then? 😛 I just meant if he was getting paid for working on it
09:39:18FromDiscord<ringabout> Yeah, could have. You can check the opencollective page of Nim.
09:39:55FromDiscord<ringabout> I think set up a page like https://crystal-lang.org/team/ should clarify the core team better.
09:40:29FromDiscord<ringabout> (edit) "set" => "setting"
09:48:00*ntat quit (Ping timeout: 272 seconds)
09:55:03FromDiscord<odexine> in seriousness what does it mean to be a core dev?
09:55:36FromDiscord<ambient3332> you dev the core
10:31:43FromDiscord<megagn> In reply to @jmgomez "Was checking it, it": nothing official, i've mostly been contributing just because i want the language to work for myself and i've been using the language heavily since like 2016. i got paid recently out of generosity but i can't guarantee consistently working on the language
10:36:02FromDiscord<megagn> i also have triage role on the main repo now but no responsibilities
11:23:44FromDiscord<gogolxdong666> Which is the better way to replace shallowCopy for orc/arc, direct assignment or system.move?
11:44:43*fallback quit (Ping timeout: 246 seconds)
11:59:24FromDiscord<punchcake> is nim sutiable for writing compilers?
12:03:05FromDiscord<demotomohiro> I think so because Nim is written in Nim.
12:03:28FromDiscord<punchcake> if nim is written in nim then what was nim written in before nim was written in nim
12:04:00FromDiscord<demotomohiro> I heard Nim was written in pascal before.
12:04:40FromDiscord<punchcake> i want to make my own language llvm frontend
12:08:25PMunchNim is definitely suited to write compilers in
12:09:07PMunchAs demotomohiro said, once an early version of Nim was built in Pascal it was ported to Nim and then compiled with Nim since then
12:10:18FromDiscord<punchcake> i see
12:10:37FromDiscord<punchcake> im really confused if i should make an llvm frontend or just target .net CLR
12:13:34FromDiscord<eliot> does nim have a suitable web scraping library?
12:14:05PMunchpunchcake, why in the name of all that is good and pure would you want to target the .net CLR?
12:14:19PMunchOh sorry, I forgot we said no kink shaming earlier
12:14:23FromDiscord<punchcake> In reply to @PMunch "<@655759729477287956>, why in the": .net jit is amazingly fast
12:14:47PMunchSo is LLVM compiled binaries..
12:14:53FromDiscord<punchcake> and i can use existing ecosystem
12:15:01PMunchDitto for LLVM
12:15:10PMunchLLVM is the reason Zig has such great C interop
12:15:20FromDiscord<punchcake> hmmm
12:16:04FromDiscord<punchcake> i mean the goal is to be fast with a garbage collector
12:16:13FromDiscord<punchcake> sorta like C++ without its mess and with a gc
12:16:19PMunchAnd besides, the .net ecosystem is the .net ecosystem. It's like saying you got a good deal at an all you could eat buffet, but the dishes are all rocks and cow patties. Sure you get as much as you want, but you wouldn't really want any of it..
12:16:39PMunchpunchcake, have you heard of a little language called Nim?
12:16:49FromDiscord<punchcake> no
12:16:56PMunchSounds like it would suit your goals :P
12:17:02FromDiscord<punchcake> nim does have classes
12:17:03FromDiscord<punchcake> sadly
12:17:11FromDiscord<punchcake> how am i supposed to abuse inheratince
12:17:12PMunchNo it doesn't?
12:17:22FromDiscord<punchcake> (edit) "does" => "doesnt"
12:17:23FromDiscord<punchcake> typo
12:17:30PMunchAh :P
12:17:44FromDiscord<punchcake> pmuch ever considered making a PL?
12:17:51FromDiscord<punchcake> (edit) "pmuch" => "pmunch"
12:17:53PMunchWell, I kinda have already :P
12:17:58FromDiscord<punchcake> what is it
12:18:00FromDiscord<punchcake> nim++
12:18:03FromDiscord<punchcake> nim with classes
12:18:05PMunchhttps://github.com/PMunch/stacklang
12:18:11PMunchNah, more like RPN++
12:18:53FromDiscord<jmgomez> can I ask what do you understand for having classes?
12:19:00FromDiscord<punchcake> imagine making a PL compiling to nim that compiles to C
12:19:02FromDiscord<craciu25_YT> how can I use `hashlib`? I have looked and theres no docs and in the read me just says things that I don't know what they even mean. I just want to encode a string into a sha256 hash. How can I do that?
12:19:07FromDiscord<punchcake> the compile times gonna go craaazy
12:19:31FromDiscord<punchcake> In reply to @jmgomez "can I ask what": wdym
12:19:37FromDiscord<punchcake> i like classes bc inheratince
12:19:47FromDiscord<punchcake> one time i wrote a game using 60% inheratince
12:19:53FromDiscord<jmgomez> you said Nim doesnt have classes
12:19:56FromDiscord<punchcake> yes
12:20:01FromDiscord<jmgomez> well, nim actually has multiple inheritance
12:20:06FromDiscord<punchcake> huh
12:20:07FromDiscord<punchcake> where
12:20:07PMunchOf course in my language you end up with abominations such as `100 200 < if else gofwd if smaller -1 print end gofwd else larger -1 print end gofwd end`
12:20:38FromDiscord<jmgomez> you target the cpp backend and you use virtual
12:21:06FromDiscord<punchcake> In reply to @PMunch "Of course in my": is it interpreted
12:21:07FromDiscord<jmgomez> https://nim-lang.github.io/Nim/manual_experimental.html#virtual-pragma
12:21:14FromDiscord<jmgomez> (only devel though)
12:21:27FromDiscord<punchcake> no thanks looks like a mess
12:22:01PMunchI actually have a Stacklang v2 which is what I use personally. But it should be cleaned up into a v3 before I publish it. Also wrote an application called stacksheet which is a small excel-ish thing in your terminal with stacklang instead of Excel macros
12:22:06FromDiscord<jmgomez> lol, it's better to write a programming lang
12:22:21PMunchYeah my language is interpreted
12:22:57PMunchI did write a VM at some point though, which runs bytecode. I'm just missing a step of actually writing a compiler for a language :P
12:23:08FromDiscord<demotomohiro> Example Nim code that uses inheritance from Nim manual:↵https://nim-lang.org/docs/manual.html#types-tuples-and-object-types
12:24:01FromDiscord<punchcake> tbh if im gonna write a PL i gotta solve a problem
12:24:06*fallback joined #nim
12:24:17FromDiscord<punchcake> i really want to write a PL dedicated to soley making gui apps
12:24:20FromDiscord<punchcake> run everywhere
12:24:22PMunchYou also have: https://github.com/jjv360/nim-classes
12:24:30PMunchNot sure if it has multi-inheritance though
12:25:13FromDiscord<Chronos [She/Her]> Can't multi-inheritance be avoided by just adding the objects as fields in the new object?
12:25:20FromDiscord<Chronos [She/Her]> Then can write some proxy thing
12:25:32FromDiscord<punchcake> In reply to @PMunch "You also have: https://github.com/jjv360/nim-classe": oh its just macros
12:25:39PMunchWell, the entire concept of inheritance can be avoided that way :P
12:25:41FromDiscord<punchcake> yeah nim macros are so good they map to ast
12:25:52PMunchpunchcake, of course, it's macros all the way down
12:25:59FromDiscord<punchcake> idk if i really should use it
12:26:19FromDiscord<punchcake> some update might break things
12:26:26PMunchThat's true for all code
12:26:34PMunchAnd you could also just lock your version
12:26:46PMunchSeems to be fairly well maintained though
12:26:48FromDiscord<jmgomez> yeah sure, just roll your own programming lang. So it doest break
12:26:55FromDiscord<punchcake> FUCK IT
12:26:59FromDiscord<punchcake> im gonna use it
12:27:03FromDiscord<punchcake> thanks pmunch
12:27:12FromDiscord<punchcake> he carrying the whole nim community with his bindings frfr
12:27:27PMunchSure, no problem :P That's not my library by the way
12:27:41FromDiscord<punchcake> yes i know
12:27:45PMunchAnd as I said, not sure if it supports multi-inheritance
12:27:58FromDiscord<punchcake> multi-inheritance is a bad idea
12:28:10FromDiscord<punchcake> im convinced if you use multi-inheritance your code is flawed
12:28:21FromDiscord<jmgomez> one could say the same about single inheritance
12:28:25FromDiscord<jmgomez> 😛
12:28:26FromDiscord<punchcake> not really
12:28:39FromDiscord<punchcake> single inheritance is a 1:1 dependancy
12:28:46FromDiscord<punchcake> multi inheratince is 1:n
12:28:56FromDiscord<jmgomez> how that makes a difference?
12:29:03FromDiscord<punchcake> you tell me
12:29:10PMunchIf you want to make a game you could also look at pararules/paranim or polymorph
12:29:12FromDiscord<punchcake> if you inherit from 3 classes good luck maintaining it
12:29:35PMunchjmgomez, very good point
12:30:31FromDiscord<Chronos [She/Her]> In reply to @punchcake "if you inherit from": Better to use components imo
12:30:51FromDiscord<Chronos [She/Her]> That way you can avoid inheritance all together
12:31:33FromDiscord<punchcake> ehh
12:31:36FromDiscord<punchcake> idk
12:31:50FromDiscord<punchcake> in games i just use a player class and make every npc inherit from it
12:31:56FromDiscord<Chronos [She/Her]> `Player`? Nah, `Entity(components: @[Controllable]` 😎
12:32:07FromDiscord<punchcake> and chronos wtf is you wpm
12:32:18FromDiscord<punchcake> i didnt even send my message and you replied close to instantly
12:32:24FromDiscord<punchcake> xd
12:32:38FromDiscord<Chronos [She/Her]> NPCs inheriting from Players? That seems so backwards
12:32:57FromDiscord<Chronos [She/Her]> In reply to @punchcake "and chronos wtf is": No idea, I'm on my phone rn and use autocomplete a lot xD
12:33:06FromDiscord<punchcake> In reply to @yu.vitaqua.fer.chronos "NPCs inheriting from Players?": yeah
12:33:11FromDiscord<punchcake> they all have everything in common
12:33:19FromDiscord<punchcake> you need to give and take damage and heal
12:33:27PMunchBut you control the player?
12:33:32FromDiscord<punchcake> you need to have an inventory for weapons
12:33:46FromDiscord<punchcake> In reply to @PMunch "But you control the": yes
12:34:10FromDiscord<Chronos [She/Her]> This is why I'd use components in a game, logic is clearly separated
12:34:35PMunchAnd still, with components that would mean `Entity(components: @[Health, Inventory, Attack])` or something
12:34:45FromDiscord<Chronos [She/Her]> Exactly
12:34:59PMunchThen you could have a chest which just has the `Inventory` system but without the others
12:35:18PMunchOr a door with the `Health` system so you can break it
12:35:56FromDiscord<punchcake> idk
12:36:00FromDiscord<punchcake> aye man if it works it works
12:36:30PMunchOf course, but you could also write something in Nim without classes. That works as well
12:36:54FromDiscord<punchcake> i have to learn the nim way
12:37:01FromDiscord<punchcake> which is what i dont want
12:37:14PMunchI really want to play with ECS, if only there where more hours in a day..
12:37:28PMunchpunchcake, why don't you want to learn Nim?
12:37:38PMunchI think you've gotten lost in the wrong channel :P
12:37:42FromDiscord<punchcake> because im tired of learning PL's
12:37:59FromDiscord<punchcake> i wanna hop in start programming and get out
12:38:14PMunchI can recommend Nim for that
12:38:20FromDiscord<punchcake> like go, i never really learnt go i just raw dog everything and learn as i go
12:38:21PMunchIt really is the last language I properly learned
12:39:05PMunchNim is pretty simple to learn if you know a bit of programming already
12:39:49FromDiscord<punchcake> i guess so
12:40:12FromDiscord<punchcake> i want to make a server that does video streaming but idk if i should do it in nim or go
12:40:18FromDiscord<punchcake> it has to be very concurrent
12:42:40PMunchWell concurrency is pretty much what Go was written for
12:43:00FromDiscord<punchcake> yes
12:43:12FromDiscord<punchcake> nim is more performant though
12:43:24FromDiscord<punchcake> which shouldnt matter anyways since its 100% io bound
12:56:36*disso-peach joined #nim
13:14:25FromDiscord<catnowblue> sent a code paste, see https://play.nim-lang.org/#ix=4AzD
13:18:17*sagax quit (Ping timeout: 245 seconds)
13:27:24FromDiscord<bung8954> when I wraps windows com interface does the functions order matters?
13:38:27*ntat joined #nim
13:43:18FromDiscord<punchcake> `var obj: seq[int] = seq[int]`
13:43:23FromDiscord<punchcake> why is this invalid bruh?
13:44:33FromDiscord<odexine> that makes no sense?
13:44:42FromDiscord<odexine> its invalid because thats not how that's done
13:46:12FromDiscord<punchcake> In reply to @odexine "its invalid because thats": how is it done
13:47:08FromDiscord<odexine> `var obj: seq[int]`
13:47:13FromDiscord<odexine> what are you trying to do
13:47:25FromDiscord<punchcake> make a seq clearly
13:48:02FromDiscord<odexine> no shit, what characteristics do you want this seq to have
13:48:08FromDiscord<catnowblue> In reply to @punchcake "why is this invalid": you were suppose to create an object, but you used value as type which isn't valid
13:48:09FromDiscord<k0ts> `var obj: int = int` also doesn't work, I should probably read the tutorial one of these days
13:48:11FromDiscord<odexine> length? what elements?
13:48:14FromDiscord<punchcake> In reply to @odexine "no shit, what characteristics": just a seq of int
13:48:21FromDiscord<punchcake> isnt a sequince a vector
13:48:23FromDiscord<odexine> (edit) "elements?" => "elements values?"
13:48:30FromDiscord<punchcake> In reply to @catnowblue "you were suppose to": OH LMAO
13:48:34FromDiscord<punchcake> i forgot
13:48:37FromDiscord<odexine> it is variable length yes
13:48:49FromDiscord<catnowblue> leave it as empty or put `@[]` into it
13:49:05FromDiscord<odexine> In reply to @odexine "`var obj: seq[int]`": you can just not do that as well, as i wrote
13:49:10FromDiscord<odexine> it is empty by default
13:49:35FromDiscord<punchcake> sent a code paste, see https://play.nim-lang.org/#ix=4AzL
13:50:03*hmht joined #nim
13:50:14FromDiscord<odexine> depends on what you need?
13:50:21FromDiscord<odexine> do you need it empty or with initial values
13:50:34FromDiscord<punchcake> In reply to @odexine "do you need it": empty
13:51:00FromDiscord<odexine> second then
13:51:28FromDiscord<odexine> first one you cant do if you want it empty, `var obj = newSeq[int]()` would be the equivalent, and at that point why not do the second
13:52:14FromDiscord<punchcake> i think the second one is better
13:53:15FromDiscord<punchcake> how do i even accept a seq as a ptr for a proc?
13:53:29FromDiscord<odexine> wdym?
13:54:05FromDiscord<punchcake> instead of copying a seq how do i accept it as a ptr?
13:55:11FromDiscord<odexine> do you want to delve into "unsafe" territory or do you want to do it safely?
13:55:17FromDiscord<punchcake> safley
13:55:23FromDiscord<punchcake> (edit) "safley" => "safely"
13:56:39FromDiscord<punchcake> sent a code paste, see https://play.nim-lang.org/#ix=4AzR
13:56:40FromDiscord<odexine> do you want to mutate the list? or do you just want to avoid copying?
13:56:48FromDiscord<punchcake> it takes a refrence to a vector and i can modify it there
13:56:58FromDiscord<punchcake> In reply to @odexine "do you want to": i want to do both
13:57:34FromDiscord<odexine> sent a code paste, see https://play.nim-lang.org/#ix=4AzT
13:57:45FromDiscord<odexine> make the type "var ..."
13:57:51FromDiscord<punchcake> In reply to @odexine "if you just want": this wont modify it?
13:58:00FromDiscord<punchcake> bc i dont want to copy a 100k element seq
13:58:20FromDiscord<odexine> what?
13:58:31FromDiscord<punchcake> i dont want to copy the sequance
13:58:37FromDiscord<punchcake> (edit) "modify" => "~~modify ~~ copy"
13:58:40FromDiscord<odexine> oh
13:58:44FromDiscord<punchcake> im sorry im just tired as fuck
13:58:45FromDiscord<odexine> yes it wont copy
13:59:02FromDiscord<punchcake> isnt there a `ptr` keyword?
13:59:04FromDiscord<odexine> it's equivalent to passing a pointer but nim typechecks it
13:59:06FromDiscord<odexine> yes
13:59:08FromDiscord<odexine> but that is unsafe
13:59:35FromDiscord<punchcake> unsafe in what sense
13:59:38FromDiscord<punchcake> does it generate UB?
14:00:55FromDiscord<odexine> unsafe as in the compiler will not do any checks for whether it will cause whatever problems like segfaults or whatever
14:01:07FromDiscord<odexine> youll have to put those checks in yourseklf
14:01:09FromDiscord<odexine> (edit) "yourseklf" => "yourself"
14:01:30FromDiscord<punchcake> ah so i can end up derefrencing something null?
14:02:21FromDiscord<odexine> yes
14:03:48FromDiscord<punchcake> In reply to @odexine "yes": thanks rika
14:05:50FromDiscord<punchcake> then wait when should i ever use `ptr` instead of `var`?
14:08:02FromDiscord<odexine> C interop
14:08:08FromDiscord<odexine> pretty much
14:08:13FromDiscord<punchcake> xd
14:08:22FromDiscord<odexine> or if you need more control on how nim manages memory
14:08:26FromDiscord<odexine> sometimes you want to go manual
14:08:34FromDiscord<punchcake> but wont ptr severly fuck up the GC
14:08:35FromDiscord<odexine> but that comes with responsibilities, naturally
14:08:38FromDiscord<odexine> no
14:08:42FromDiscord<odexine> ptr doesnt interact with the GC
14:08:50FromDiscord<punchcake> i see
14:08:53FromDiscord<odexine> making pointers "normally" will not crash the GC
14:09:01FromDiscord<punchcake> idk tbh
14:09:06FromDiscord<odexine> basically dont make a pointer by casting refs and stuff
14:09:10FromDiscord<punchcake> pointers tend to fuck up gcs pretty bad
14:09:24FromDiscord<odexine> only if you do stuff wrong lol
14:09:31FromDiscord<punchcake> not rlly
14:09:40FromDiscord<punchcake> its one of the reasons why every C gc failed
14:09:46FromDiscord<odexine> you can use ptr without breaking the GC, just have to be careful about it
14:09:59FromDiscord<odexine> In reply to @punchcake "its one of the": that has a different reason, i think
14:10:04FromDiscord<punchcake> nah
14:10:14FromDiscord<punchcake> its purely because of pointers
14:10:27FromDiscord<punchcake> even bohem is pretty bad
14:13:08*PMunch quit (Quit: Leaving)
14:20:18FromDiscord<catnowblue> sent a code paste, see https://play.nim-lang.org/#ix=4AA4
14:20:36FromDiscord<catnowblue> sent a code paste, see https://play.nim-lang.org/#ix=4AA5
14:20:39FromDiscord<catnowblue> I just don't understand
14:25:38FromDiscord<punchcake> sent a code paste, see https://play.nim-lang.org/#ix=4AA6
14:25:43FromDiscord<punchcake> just wrap the `let json = rawJson.parseJson()`
14:28:22FromDiscord<catnowblue> yea but that variable would be inaccessible outside of try/except
14:28:24FromDiscord<catnowblue> @punchcake
14:28:43FromDiscord<punchcake> it would be?
14:28:44FromDiscord<punchcake> him
14:28:46FromDiscord<catnowblue> yes
14:29:11FromDiscord<catnowblue> except I got very confusing error which may suggest that the variable is not defined
14:29:32FromDiscord<catnowblue> nim really needs to ditch confusing error
14:29:48FromDiscord<punchcake> are you even sure that websocket is giving to you valid json?
14:29:51FromDiscord<catnowblue> it is
14:29:59FromDiscord<catnowblue> I even give the API's format to json
14:29:59FromDiscord<punchcake> log it to the console
14:30:01FromDiscord<catnowblue> everything works
14:30:11FromDiscord<catnowblue> In reply to @punchcake "log it to the": I did, it prints valid json just fine
14:30:28FromDiscord<punchcake> im not sure
14:30:32FromDiscord<punchcake> im a noob nim programmer
14:30:42FromDiscord<catnowblue> me neither
14:30:49FromDiscord<punchcake> can you post full code?
14:31:06FromDiscord<catnowblue> there's also other file modules, so that would be big
14:31:16FromDiscord<punchcake> hmm
14:31:45FromDiscord<punchcake> can you give me the sample json i wanna test it on my machine
14:33:06FromDiscord<catnowblue> sent a code paste, see https://play.nim-lang.org/#ix=4AA8
14:33:19FromDiscord<catnowblue> In reply to @punchcake "can you give me": you need to have revolt account to do so
14:33:32FromDiscord<catnowblue> then put your token into there
14:33:43FromDiscord<punchcake> idk tbh
14:33:46FromDiscord<punchcake> this looks complicated
14:33:58FromDiscord<catnowblue> that's what it's supposed to be
14:34:17FromDiscord<catnowblue> I wish nim has helpful error like what Rust did
14:34:52FromDiscord<catnowblue> it's just... too much confusing that not even chatgpt or third party libraries will fix it
14:34:58FromDiscord<punchcake> wait bruh
14:35:40FromDiscord<punchcake> check my comment
14:35:42FromDiscord<punchcake> sent a code paste, see https://play.nim-lang.org/#ix=4AA9
14:36:00FromDiscord<punchcake> (edit) "https://play.nim-lang.org/#ix=4AA9" => "https://play.nim-lang.org/#ix=4AAa"
14:36:25FromDiscord<catnowblue> that's websocket, it needs to create new websocket
14:36:39FromDiscord<catnowblue> and fromhandleWebSocket as you can see at the top
14:36:45FromDiscord<catnowblue> (edit) "fromhandleWebSocket" => "from handleWebSocket"
14:36:53FromDiscord<punchcake> you never called the handleWebSocket proc bro
14:36:59FromDiscord<catnowblue> ????????????????
14:37:02FromDiscord<catnowblue> I did
14:37:04FromDiscord<punchcake> im confused
14:37:05FromDiscord<punchcake> where?
14:37:36FromDiscord<catnowblue> https://media.discordapp.net/attachments/371759389889003532/1129421440463155381/image.png
14:37:43FromDiscord<punchcake> your calling handleWebSocket with no function args
14:37:44FromDiscord<catnowblue> you didn't see the top don't you?
14:37:45FromDiscord<punchcake> (edit) "function" => "proc"
14:37:52FromDiscord<catnowblue> In reply to @punchcake "your calling handleWebSocket with": ....
14:38:41FromDiscord<punchcake> thE PROC ARGS ARE EMPTY
14:38:57FromDiscord<punchcake> it accepts 1 argument and you gave it 0
14:39:30FromDiscord<ajusa> ws?
14:39:36FromDiscord<ajusa> It's being called with an argument
14:39:44FromDiscord<punchcake> am i blind
14:39:45FromDiscord<punchcake> where?
14:39:53FromDiscord<catnowblue> sent a code paste, see https://play.nim-lang.org/#ix=4AAd
14:40:07FromDiscord<catnowblue> (edit) "https://play.nim-lang.org/#ix=4AAd" => "https://paste.rs/PDQsy"
14:40:32FromDiscord<catnowblue> there has nothing to do with websocket issue, I'm having issue with parsing json
14:40:37FromDiscord<punchcake> hm
14:40:38FromDiscord<punchcake> idk tbh
14:40:48FromDiscord<catnowblue> fine, I'm waiting for someone to help me
14:41:05FromDiscord<catnowblue> cuz chatgpt only knows 2021 thing which nim wasn't stable at that time
14:41:07FromDiscord<ajusa> Anyway I have no idea what the context is, but if you're building a websocket server I recommend using mummy
14:41:17FromDiscord<catnowblue> no
14:41:32FromDiscord<catnowblue> I want to create new web socket client which handles each event
14:41:33FromDiscord<catnowblue> like this way
14:41:43FromDiscord<ajusa> Then I'd recommendhttps://github.com/guzba/whisky
14:41:47FromDiscord<catnowblue> it's a requirements to make the bot online
14:42:48FromDiscord<punchcake> i recommend a rewrite
14:42:54FromDiscord<punchcake> its too complicated for no reason
14:42:58FromDiscord<catnowblue> rewrite?
14:43:02FromDiscord<punchcake> yup
14:43:06FromDiscord<catnowblue> man nobody wrote a nim library for Revolt Chat
14:43:13FromDiscord<punchcake> start from scratcj
14:43:14FromDiscord<punchcake> (edit) "scratcj" => "scratcg"
14:43:17FromDiscord<punchcake> (edit) "scratcg" => "scratch"
14:43:38FromDiscord<ajusa> sent a code paste, see https://paste.rs/D9zgO
14:44:11FromDiscord<catnowblue> listen ajusa, that's not asyncious which means any actions outside of web socket client is blocked.
14:44:31FromDiscord<catnowblue> and since this library will also request http to fetch memebrs and channels
14:44:34FromDiscord<catnowblue> that would be awful
14:44:44FromDiscord<punchcake> thread pooling
14:44:47FromDiscord<catnowblue> why
14:44:54FromDiscord<punchcake> to solve the problem
14:45:08FromDiscord<catnowblue> why would I need threading
14:45:21FromDiscord<punchcake> to solve the its not async problem
14:45:36FromDiscord<catnowblue> I'm using dimscord, nim library for discord api as a reference
14:45:44FromDiscord<catnowblue> and they are all using json and websocket asyncious
14:48:46FromDiscord<ajusa> Ah fair enough. Yeah you'd need to use threads with whisky in that case. Hope someone is able to help you! I haven't used the standard library for a websocket client
14:51:17FromDiscord<punchcake> threadpooling bro
14:59:21FromDiscord<k0ts> @catnowblue , looks like it's because you don't export ResponseEvent's `type` field, so it resolves to system.`type`: https://nim-lang.org/docs/system.html#type
14:59:37*hmht left #nim (#nim)
15:04:38*jmdaemon quit (Ping timeout: 246 seconds)
15:06:33FromDiscord<catnowblue> damn thank you so much
15:12:15FromDiscord<michaelb.eth> sent a code paste, see https://play.nim-lang.org/#ix=4AAq
15:12:26FromDiscord<michaelb.eth> wdym?
15:21:05*lucasta joined #nim
15:26:52*Goodbye_Vincent joined #nim
15:30:30*Goodbye_Vincent quit (Client Quit)
15:39:17FromDiscord<System64 ~ Flandre Scarlet> Does async use multithreading?
15:39:20FromDiscord<System64 ~ Flandre Scarlet> (edit) "Does async ... use" added "pragma"
15:46:21FromDiscord<odexine> no
15:46:27FromDiscord<odexine> async and multithreading are separate
15:48:15FromDiscord<System64 ~ Flandre Scarlet> In reply to @odexine "async and multithreading are": Oh alright↵So for writing to a file, what is the best?
15:48:33FromDiscord<arathanis> In reply to @sys64 "Oh alright So for": for writing to files in parallel?
15:48:37FromDiscord<System64 ~ Flandre Scarlet> Yeah
15:48:59FromDiscord<arathanis> probably depends on where you are sourcing the data to write to the files
15:50:56FromDiscord<System64 ~ Flandre Scarlet> In reply to @arathanis "probably depends on where": I create a new synthesizer context, I use this new context to generate the waveforms without touching the main context, and then I export those waveforms to a wav file
15:51:14FromDiscord<arathanis> sent a long message, see http://ix.io/4AAA
15:51:42FromDiscord<arathanis> (edit) "http://ix.io/4AAA" => "http://ix.io/4AAC"
15:52:03FromDiscord<arathanis> (edit) "http://ix.io/4AAC" => "http://ix.io/4AAD"
15:52:37FromDiscord<arathanis> In reply to @sys64 "I create a new": is it different files?
15:52:42FromDiscord<System64 ~ Flandre Scarlet> Oh alright↵So for my case, is multithreading better?
15:53:22FromDiscord<System64 ~ Flandre Scarlet> In reply to @arathanis "is it different files?": Yeah I think?↵I just copy the context so the new synth does not interact with the synth the user interacts with
15:53:29FromDiscord<catnowblue> In reply to @michaelb.eth "was just reading the": there was error regarding options, but I have no idea how it was gone
15:53:42FromDiscord<arathanis> In reply to @sys64 "Yeah I think? I": so they aren't writin to the same file, but each their own file?
15:54:46FromDiscord<arathanis> @System64 ~ Flandre Scarlet If you need them to be able to process waveforms before writing to a file, it sounds like lots of CPU work is involved so I suggest Multithreading
15:54:51FromDiscord<System64 ~ Flandre Scarlet> In reply to @arathanis "so they aren't writin": The users choose the name of the file
15:55:05FromDiscord<System64 ~ Flandre Scarlet> In reply to @arathanis "so they aren't writin": Yeah there is process involved
15:55:19FromDiscord<arathanis> So if you have parallel waveform processing, use multithreading. That is usually CPU intensive and async can't do multiple CPU bound things at the same time.
15:55:38FromDiscord<arathanis> In reply to @sys64 "Yeah there is process": so in your application i give it a file name, and multiple waveform processes happen. But do they all write to the same file?
15:55:49FromDiscord<arathanis> like ultimately are they combined into my result file?
15:56:57FromDiscord<System64 ~ Flandre Scarlet> sent a code paste, see https://play.nim-lang.org/#ix=4AAE
15:57:01FromDiscord<arathanis> you should use multithreading
15:57:04FromDiscord<arathanis> but only have a single file writing
15:57:06FromDiscord<arathanis> (edit) "writing" => "writer"
15:57:40FromDiscord<System64 ~ Flandre Scarlet> Here this is one thread processing a waveform, write it, process, write and so on
15:57:41FromDiscord<arathanis> opening the same file multiple times for concurrent writes is a fools errand. Have your wave processing threads which write their results to a channel and then a single other thread that listens to the incoming waveform data and outputs it to the target file
15:57:54FromDiscord<arathanis> much cleaner architecture. easier to reason about, less error prone
15:58:26FromDiscord<System64 ~ Flandre Scarlet> In the code, this is one single thread
15:58:47FromDiscord<arathanis> im assuming they share the sameoutput filename since you said it was a single file
15:59:02FromDiscord<System64 ~ Flandre Scarlet> Yeah
15:59:09FromDiscord<System64 ~ Flandre Scarlet> But it close the file at the end
15:59:15FromDiscord<arathanis> yeah so remove the file writing from these threads. make them only do waveform processing
15:59:33FromDiscord<arathanis> when they are done, have them write their resulting waveform to a channel which is being read by a file writer
15:59:36FromDiscord<System64 ~ Flandre Scarlet> those waveforms need to be wrote in a precise order
15:59:49FromDiscord<arathanis> you cant guarantee multiple threads wont open the file at the same time and stomp all over each others data
15:59:58FromDiscord<arathanis> In reply to @sys64 "those waveforms need to": you can include order in the waveform output
16:00:08FromDiscord<arathanis> then the file writer respects that order
16:00:43FromDiscord<System64 ~ Flandre Scarlet> Btw↵If I need to generate 64 waveforms↵Can I use 64 threads?
16:00:51FromDiscord<arathanis> you can use as many threads as you want
16:01:10FromDiscord<arathanis> know that you should adjust how many threads based on the number of CPU threads poissible though
16:01:19FromDiscord<arathanis> so i suggest not hard coding 64
16:01:49FromDiscord<arathanis> i suggest using the `std/cpuinfo` libraries `countProcessors` proc to see how many threads the computer supports
16:02:00FromDiscord<arathanis> then use that many for your default, and allow the user to change it if they want
16:02:28FromDiscord<arathanis> if I have a quadcore CPU and you open 64 threads its going to lock down the computer completely until your code is done
16:03:13FromDiscord<System64 ~ Flandre Scarlet> A single threaded file export can take more than 5 seconds
16:03:52FromDiscord<arathanis> more threads wont make it faster if the CPU cant run them at the same time
16:04:02FromDiscord<arathanis> if I have a quadcore and you open 4 threads each one can run
16:04:07FromDiscord<arathanis> if you open 8 threads 4 of them have to wait
16:04:57FromDiscord<arathanis> and if you open that many the context switching between threads creates tons of overhead, slowing it down, but also dominates the CPU so any other programs running on the computer grind to a halt. You should use a dynamic default number of threads based on the CPU of the computer which you can look up at runtime.
16:06:08FromDiscord<System64 ~ Flandre Scarlet> Multithreading is hard
16:06:16FromDiscord<arathanis> yes
16:06:18FromDiscord<arathanis> yes it is
16:08:04FromDiscord<System64 ~ Flandre Scarlet> But how is that possible? https://media.discordapp.net/attachments/371759389889003532/1129444209573773405/image.png
16:08:42FromDiscord<arathanis> a lot of them are background tasks that only run every once in a while
16:08:47FromDiscord<arathanis> pol very slowly
16:08:50FromDiscord<arathanis> or are not intensive
16:09:08FromDiscord<arathanis> waveform processing is pretty big math 100% cpu stuff
16:10:03FromDiscord<arathanis> so really it depends on the thread, but waveform processing is gonna max out the CPU its on, yeah? like crunching primes numbers
16:10:24FromDiscord<arathanis> if i make a program that checks stock prices every 5s
16:10:28FromDiscord<arathanis> i can run like 1000 of those
16:10:34FromDiscord<arathanis> once every 5 seconds is nothing to a computer
16:11:01FromDiscord<arathanis> but if its doing complex math, like an artificial intelligence its gonna use all the resources on the computer
16:11:09FromDiscord<arathanis> so if i have too many threads the CPU will be at 100% and unusable
16:11:22FromDiscord<System64 ~ Flandre Scarlet> and then blue screen
16:11:29FromDiscord<arathanis> less likely to bluescreen
16:11:34FromDiscord<arathanis> more likely to hang up and i have to wait
16:11:39FromDiscord<arathanis> maybe for a very long time
16:12:00FromDiscord<arathanis> cause so much is trying to run everything is just unusably slow
16:12:01FromDiscord<System64 ~ Flandre Scarlet> Why does Windows not have a security against thyis?
16:12:09FromDiscord<System64 ~ Flandre Scarlet> (edit) "thyis?" => "this?"
16:12:16FromDiscord<arathanis> nothing has security against this lol
16:12:24FromDiscord<arathanis> but they try
16:12:29FromDiscord<arathanis> its a halting problem thing
16:12:39FromDiscord<arathanis> if you have ever had windows say "this program is not responding, do you want to wait?"
16:12:45FromDiscord<arathanis> you have seen a form of security against this kind of thing
16:12:55FromDiscord<arathanis> (edit) "if you have ever had windows say "this program is not responding, do you want to ... wait?"" added "close it or"
16:13:08FromDiscord<System64 ~ Flandre Scarlet> But the problem can spread to stuff like explorer.exe and so on
16:14:10FromDiscord<arathanis> yeah, the cpu only has so much work it can do at a time and if too much is going on it will make the computer slow
16:15:04FromDiscord<arathanis> always best to have your default number of threads be based on the number of cores reported by the cpu
16:15:16FromDiscord<arathanis> then give a way to override like `--num-threads 64`
16:15:23FromDiscord<System64 ~ Flandre Scarlet> Imagine doing such treatments on... Python
16:15:28FromDiscord<arathanis> ive done it
16:15:35FromDiscord<arathanis> i love python lol
16:15:49FromDiscord<System64 ~ Flandre Scarlet> Python is slow 🐌
16:16:04FromDiscord<arathanis> you wouldnt be doing any of the math stuff in pure python
16:16:11FromDiscord<arathanis> so its quite fast at doing what you are doing
16:16:45FromDiscord<System64 ~ Flandre Scarlet> Ray tracing on Python
16:16:58FromDiscord<arathanis> also there is no such thing as "slow" only "too slow" and you can't know something is too slow until its done and you profile it.↵↵Python respects your time as a developer, and if there is a hot spot you can optimize that hotspot for performance.
16:17:23FromDiscord<arathanis> In reply to @sys64 "Ray tracing on Python": yeah, you would be using something like numpy for this which is extremely fast. probably much faster than the nim code you are writing
16:17:42FromDiscord<arathanis> Python has a wealth of scientific and computing libraries that are blazingly fast
16:17:50FromDiscord<System64 ~ Flandre Scarlet> why much faster?↵Isn't Nim compiled?
16:18:01FromDiscord<System64 ~ Flandre Scarlet> and also GCC optimizations
16:18:15FromDiscord<arathanis> In reply to @sys64 "why much faster? Isn't": because the underlying code doing the heavy lifting isn't written in pure python, its a C extension written in C and compiled
16:19:26FromDiscord<catnowblue> Is there sort of `any` type in Nim?
16:19:40FromDiscord<catnowblue> I tried with auto, it yells that it's not valid
16:20:11FromDiscord<arathanis> sent a code paste, see https://play.nim-lang.org/#ix=4AAI
16:20:20FromDiscord<catnowblue> I want to declare a variable that changes type depends on event type such as `ReadyEvent`, `MessageEvent`
16:20:52FromDiscord<System64 ~ Flandre Scarlet> sent a code paste, see https://play.nim-lang.org/#ix=4AAJ
16:20:53FromDiscord<catnowblue> I tried unionize them, but it says invalid type
16:21:09FromDiscord<arathanis> In reply to @sys64 "and what if we": depends if PyPy supports numpy or not
16:21:10FromDiscord<catnowblue> (edit) "them," => "them with `ReadyEvent | MessageEvent`,"
16:21:28FromDiscord<System64 ~ Flandre Scarlet> also, is it possible to compile Python?
16:21:29FromDiscord<arathanis> there is an official PyPy numpy build called "numpypy"
16:21:36FromDiscord<System64 ~ Flandre Scarlet> oh wow!
16:21:54FromDiscord<arathanis> In reply to @sys64 "also, is it possible": depends what you mean, Python is compiled. but its probably not what you meant
16:22:35FromDiscord<System64 ~ Flandre Scarlet> Isn't Python interpreted?
16:22:55FromDiscord<arathanis> yes, but python is compiled to bytecode
16:23:02FromDiscord<arathanis> the interpreter runs that compiled bytecode
16:23:22FromDiscord<arathanis> i think you meant to a binary executable
16:23:37FromDiscord<System64 ~ Flandre Scarlet> Java uses bytecode↵C# uses bytecode↵So why is Python slower than thoses?
16:24:02FromDiscord<arathanis> In reply to @sys64 "Java uses bytecode C#": metaprogramming overhead and ergonomics
16:24:22FromDiscord<arathanis> the language design and features necessitate a runtime with more overhead
16:24:29FromDiscord<arathanis> its sacrificing compute timee for developer time
16:24:37FromDiscord<System64 ~ Flandre Scarlet> Oh alright
16:24:46FromDiscord<arathanis> the secret to leveraging python is to write your working application super fast, cause python
16:25:04FromDiscord<arathanis> then, if you find its too slow, identifying the slow spot and either↵1. use a library that does that fast
16:25:12FromDiscord<arathanis> (edit) "fast" => "fast"↵2. write a c-extension to do it"
16:25:24FromDiscord<arathanis> i actually do this with nim, Nim is very good at compiling .pyd files.
16:25:40FromDiscord<System64 ~ Flandre Scarlet> pyd?
16:25:43FromDiscord<arathanis> so ill write a Python app, get it going and if its too slow I profile it and find the one or two slow parts
16:25:55FromDiscord<arathanis> rewrite that function in nim, then have python call that function
16:26:06FromDiscord<arathanis> In reply to @sys64 "pyd?": .pyd is a DLL that Python can import and use like a module.
16:26:16FromDiscord<arathanis> so you can write it in C, or Nim as I said above
16:26:23FromDiscord<arathanis> and just use it like any old python function in python
16:26:46FromDiscord<arathanis> its why things like numpy are so fast
16:27:55FromDiscord<System64 ~ Flandre Scarlet> Oh alright!↵And does Nim have some kind of tradeoffs?
16:28:47FromDiscord<arathanis> In reply to @sys64 "Oh alright! And does": its usually a little slower than raw C, but imo not enough to matter since the language is much more ergonomic and expressive and you can always come back and optimize
16:29:06FromDiscord<arathanis> also since its a more boutique language finding supporting libraries can be hard
16:29:14FromDiscord<arathanis> cause they might↵- not exist↵- be unmaintained
16:29:29FromDiscord<System64 ~ Flandre Scarlet> Nim is underrated
16:29:32FromDiscord<arathanis> its a great language
16:29:35FromDiscord<arathanis> In reply to @sys64 "Nim is underrated": i agree
16:29:49FromDiscord<System64 ~ Flandre Scarlet> it deserves waaaaay more visibility
16:29:50FromDiscord<arathanis> my preferred workflow is to write Python, and use Nim for writing pyd extensions if I find i need more speed
16:30:20FromDiscord<System64 ~ Flandre Scarlet> Now I still have ONE problem with Nim↵No cyclic imports
16:34:15FromDiscord<arathanis> sent a code paste, see https://play.nim-lang.org/#ix=4AAN
16:35:06FromDiscord<arathanis> so ill write the entire program in python, then if its too slow ill do the above for the 1 or 2 functions that are slow
16:35:29FromDiscord<arathanis> now i get all the incredible development speed of python and its ecosystem, and the blazing speed and expressiveness of Nim where I need it
16:36:01*FromDiscord quit (Remote host closed the connection)
16:36:14*FromDiscord joined #nim
16:36:31FromDiscord<System64 ~ Flandre Scarlet> can Nim be used for AI stuff?
16:36:52FromDiscord<arathanis> yes, but its probably too boutique for broad appeal. I imagine any AI libraries, if they exist, are some combination of unmaintained and low on features
16:37:04FromDiscord<arathanis> but theres nothing stopping you from doing it
16:38:23FromDiscord<System64 ~ Flandre Scarlet> I'm currently writing a game wiith Nim
16:38:43FromDiscord<arathanis> sounds like a fun project :]
16:39:00FromDiscord<System64 ~ Flandre Scarlet> https://media.discordapp.net/attachments/371759389889003532/1129451995426738246/2023-07-10_17-06-11.mp4
16:39:36*lucasta quit (Remote host closed the connection)
16:39:59FromDiscord<arathanis> In reply to @sys64 "I'm currently writing a": let me see if I can write an example of the multithreaded arch I was suggesting for you... it may be in Python since im more familiar but the syntax is similar and the idea is what matters.
16:40:10FromDiscord<arathanis> is the size of a computed waveform section always the same siz?
16:40:12FromDiscord<arathanis> (edit) "siz?" => "size?"
16:42:04FromDiscord<arathanis> In reply to @sys64 "": this is cool! are you writing your own engine or using something like godot?
16:44:08FromDiscord<michaelb.eth> In reply to @arathanis "yes, but its probably": Arraymancer is maintained, though it's more of a building block: https://github.com/mratsim/Arraymancer
16:44:17FromDiscord<System64 ~ Flandre Scarlet> In reply to @arathanis "this is cool! are": the graphic engine is Tilengine
16:44:50FromDiscord<arathanis> In reply to @michaelb.eth "Arraymancer is maintained, though": yeah that is a good one, but i was thinking of libraries like scipy or scikit-learn
16:45:13FromDiscord<System64 ~ Flandre Scarlet> In reply to @arathanis "is the size of": You can change the length up to 4096 https://media.discordapp.net/attachments/371759389889003532/1129453556538298508/image.png
16:45:20FromDiscord<arathanis> theres a reason all these generative AIs taking the world by storm are written in Python lol.
16:45:55FromDiscord<arathanis> In reply to @sys64 "You can change the": i meant when you split it between threads do they all return the same sized waveform section to combine?
16:46:23FromDiscord<michaelb.eth> In reply to @arathanis "yeah that is a": cf. https://github.com/SciNim
16:46:38FromDiscord<System64 ~ Flandre Scarlet> In reply to @arathanis "i meant when you": Yeah
16:46:41FromDiscord<michaelb.eth> though, sure, it's never going to be as popular as Python, for various reasons
16:47:08FromDiscord<System64 ~ Flandre Scarlet> https://github.com/system64MC/kurumi-x↵Link to the project
16:47:43FromDiscord<arathanis> In reply to @sys64 "Yeah": perfect, when you distribute the waveform processing give them an index of what part of the waveform they are. when you load the results into the channel use a tuple that includes the index.↵↵the file writer simply reads the finished data, seeks in the file using the already known size to the write location and writes the completed waveform, then waits for the next finished waveform section
16:47:50FromDiscord<arathanis> In reply to @michaelb.eth "cf. https://github.com/SciNim": sweet ill take a look
16:47:59FromDiscord<arathanis> In reply to @michaelb.eth "though, sure, it's never": i like combining them as I stated above lol
16:48:28FromDiscord<michaelb.eth> being practical is definitely a good strategy 😄
16:48:50FromDiscord<michaelb.eth> and it is nice that Nim makes interop with C, Python, etc. pretty simple
16:48:58*azimut quit (Ping timeout: 240 seconds)
16:49:33FromDiscord<arathanis> exactly
16:49:53FromDiscord<arathanis> in fact looking for a BKM for that practicality was how I found Nim in the first place lol
16:50:27FromDiscord<System64 ~ Flandre Scarlet> In reply to @arathanis "perfect, when you distribute": You can find the code in the link I posted
16:50:44FromDiscord<System64 ~ Flandre Scarlet> caution, select the BoxUndoRedo branch
16:52:00FromDiscord<System64 ~ Flandre Scarlet> Pretty sure I have a lot of bad practices lol
17:00:39*jmdaemon joined #nim
17:21:50FromDiscord<arathanis> recognizing bad practices is the first step to good practices
17:26:47FromDiscord<System64 ~ Flandre Scarlet> True
18:19:58FromDiscord<whoman0385> I keep getting this exception: "The system cannot find the file specified." when i try to run "cls" with execCmd and im on windows so i have no idea whats wrong can someone help me?
18:20:43FromDiscord<whoman0385> nvm
18:57:26*cyraxjoe quit (Ping timeout: 260 seconds)
18:58:05*cyraxjoe joined #nim
19:10:36*ntat quit (Quit: Leaving)
19:10:59*ntat joined #nim
19:16:50*ntat quit (Quit: Leaving)
19:17:13*ntat joined #nim
19:30:57*cyraxjoe quit (Ping timeout: 250 seconds)
19:31:13*cyraxjoe joined #nim
19:32:38FromDiscord<catnowblue> sent a code paste, see https://play.nim-lang.org/#ix=4ABi
19:32:53FromDiscord<catnowblue> (edit) "https://play.nim-lang.org/#ix=4ABi" => "https://play.nim-lang.org/#ix=4ABj"
19:41:24FromDiscord<ntzeno> is there some kind of environment variable i can set for nimcache ? for example, for nimble theres NIMBLE_DIR, is there equivalent for nimcache ? or do i have to use `--nimcache` for each projects manually ?
19:42:48FromDiscord<graveflo> you can usually set parameters like that in nim.cfg. There is a global, local and project local version of the file
19:43:00FromDiscord<graveflo> https://nim-lang.org/docs/nimc.html#compiler-usage-configuration-files
19:43:12FromDiscord<ntzeno> i'll check it out, ty!
19:45:51FromDiscord<hotdog> In reply to @catnowblue "why am I getting": What do the custom objects look like?
19:47:39FromDiscord<catnowblue> it's a little bit huge
19:48:38FromDiscord<catnowblue> sent a code paste, see https://play.nim-lang.org/#ix=4ABm
19:49:01FromDiscord<catnowblue> sent a code paste, see https://play.nim-lang.org/#ix=4ABn
19:49:03FromDiscord<catnowblue> @hotdog
19:50:19FromDiscord<toma400> In reply to @sys64 "Now I still have": It's kinda like strict type system. It's useful to have this thing be available, but in the same time it can shoot you in the foot. So while I'd like some cyclic importing myself, it's one of those safety measures I also find rather good to have.
19:50:41FromDiscord<toma400> Unlike, for example, required module or variable use, like Go does
19:51:24FromDiscord<toma400> (edit) "does" => "does. It's rarely safety measure, and way more frequently an annoyance"
19:51:33FromDiscord<toma400> (edit) "an" => "just"
19:52:15FromDiscord<System64 ~ Flandre Scarlet> In reply to @toma400 "Unlike, for example, required": But how can C# and Java still be safe, despite having cyclic imports?
19:52:54FromDiscord<toma400> In reply to @sys64 "But how can C#": They work on different system, as far as I know. At least from Java, everything there is a class basically, so you do not take a risk of running something out of pure import.
19:53:15FromDiscord<toma400> Also their module system works differently, as you rather import folders instead of files
19:53:20FromDiscord<toma400> (edit) "import." => "import"
19:53:40FromDiscord<System64 ~ Flandre Scarlet> Now having cyclic imports can be useful in some cases
19:54:16FromDiscord<toma400> Oh, definitely. I kinda ran into situation my app I just designed in Nigui needs complete rewrite, as I made it work in a way that requires cyclic imports
19:55:03FromDiscord<toma400> It wouldn't make much difference if they were allowed in such case, but it's bad design choice and I kinda see it. It's intuitive for newbie programmer (who I kinda still am), but transitioning from there I see also why it is bad intuition
19:55:07FromDiscord<System64 ~ Flandre Scarlet> I have to write my game in a quirky way because of that
19:55:44FromDiscord<System64 ~ Flandre Scarlet> In reply to @toma400 "It wouldn't make much": cyclic imports are bad design?
19:56:42FromDiscord<griffith1deadly> In reply to @sys64 "cyclic imports are bad": rather depends on what you're doing↵there are some cases where you can't do without it↵especially in Java
19:58:19FromDiscord<toma400> In reply to @sys64 "cyclic imports are bad": They increase possibility of running into bugs you may not realise for long time. So maybe not bad design, but risky design. Really depends on language and architecture you are going for.
19:58:28FromDiscord<toma400> (edit) "In reply to @sys64 "cyclic imports are bad": They increase possibility of running into bugs you may not realise for long time. So maybe not bad design, but risky design. Really depends on language and architecture ... you" added "of project"
19:59:45FromDiscord<System64 ~ Flandre Scarlet> For a video game, it can be annoying
20:00:22FromDiscord<System64 ~ Flandre Scarlet> because the player module might need stuff for room↵And room module might need stuff for player
20:00:36FromDiscord<griffith1deadly> In reply to @sys64 "For a video game,": try kotlin for making game)0
20:01:32FromDiscord<System64 ~ Flandre Scarlet> In reply to @griffith1deadly "try kotlin for making": Is it a good language?
20:02:11FromDiscord<toma400> In reply to @sys64 "because the player module": Yeah, I'm not against you here. I just see why this may be discouraged or limited. But I really hope for cyclic imports being possible in 2.0
20:02:16FromDiscord<toma400> In reply to @sys64 "Is it a good": Absolutely ❤️
20:02:18FromDiscord<griffith1deadly> In reply to @sys64 "Is it a good": yes, in some cases like java, but has more sugar and inline with compile time generic operations
20:02:45FromDiscord<toma400> (edit) "In reply to @sys64 "Is it a good": Absolutely ❤️ ... " added "(sorry for answering for everything, I missed this server a bit, haven't replied for two weeks or so here XD)"
20:03:28FromDiscord<griffith1deadly> but i dont recommend use kotlin/native target
20:03:43FromDiscord<griffith1deadly> if need low level -> use jnim
20:05:00FromDiscord<System64 ~ Flandre Scarlet> In reply to @griffith1deadly "if need low level": jnim?
20:05:27FromDiscord<griffith1deadly> https://github.com/yglukhov/jnim
20:06:32FromDiscord<griffith1deadly> Kotlin is a JVM language, so it will work perfectly with that
20:07:22FromDiscord<System64 ~ Flandre Scarlet> https://github.com/megamarc/Tilengine↵And what if I want to use this library?
20:08:40FromDiscord<griffith1deadly> In reply to @sys64 "https://github.com/megamarc/Tilengine And what if": write your own nim binding -> make your own binding to jnim
20:08:58FromDiscord<griffith1deadly> or if u can understand c just realize it on jni
20:09:44FromDiscord<System64 ~ Flandre Scarlet> In reply to @griffith1deadly "or if u can": And will my final program be as fast as Nim?
20:11:12FromDiscord<griffith1deadly> In reply to @sys64 "And will my final": Java not faster than Nim or C
20:11:27FromDiscord<griffith1deadly> (edit) "In reply to @sys64 "And will my final": Java ... not" added "(and all jvm languages)"
20:12:38FromDiscord<griffith1deadly> at least it will be much faster to run than Python paired with Nim.
20:20:52FromDiscord<System64 ~ Flandre Scarlet> In reply to @griffith1deadly "at least it will": Oh alright↵and can I use this as a base?↵https://sr.ht/~exelotl/nim-tilengine/
20:24:12FromDiscord<griffith1deadly> In reply to @sys64 "Oh alright and can": yes, why not?
20:24:46FromDiscord<griffith1deadly> just dont forget that u need compile your jnim binding to more platforms, to support java crosstarger
20:24:58FromDiscord<griffith1deadly> (edit) "crosstarger" => "crosstarget"
20:25:56FromDiscord<griffith1deadly> like LWJGL -> 32 bit, 64 bit, arm for Windows, Linux, MacOS
20:26:24FromDiscord<griffith1deadly> also for java exists good game engines like libgdx
20:26:48FromDiscord<griffith1deadly> that can work on mobile devices
20:27:03FromDiscord<Elegantbeef> libgdx isnt a game engine
20:27:25FromDiscord<griffith1deadly> okay, its Java game development framework
20:30:06FromDiscord<System64 ~ Flandre Scarlet> In reply to @griffith1deadly "like LWJGL -> 32": Nice cross compilation ooof↵Pain
20:34:45FromDiscord<griffith1deadly> i think u can cross compile for everything but macOS with zig cc compiler
20:35:04FromDiscord<Elegantbeef> zigcc can also target mac
20:38:28FromDiscord<System64 ~ Flandre Scarlet> In reply to @griffith1deadly "i think u can": Zig CC?↵Zig's compiler?
20:41:57FromDiscord<griffith1deadly> In reply to @sys64 "Zig CC? Zig's compiler?": yes
20:43:12FromDiscord<System64 ~ Flandre Scarlet> In reply to @griffith1deadly "yes": Interesting↵Btw↵Is Zig a good language?
20:44:18FromDiscord<griffith1deadly> in general, I would rather say that all languages are good. it depends on your desire to understand them, and your goals
20:44:25FromDiscord<griffith1deadly> (edit) "I" => "i"
20:44:40FromDiscord<System64 ~ Flandre Scarlet> In reply to @griffith1deadly "in general, i would": Except php
20:45:53FromDiscord<griffith1deadly> and rust 🙂
20:51:56*azimut joined #nim
20:53:36FromDiscord<nimlang> In reply to @griffith1deadly "in general, i would": Yes, there's a saying that goes it does not matter what language but it matters what programmer
20:59:42*ntat quit (Quit: leaving)
21:01:13FromDiscord<michaelb.eth> A discord user named “nimlang”?
21:12:56FromDiscord<Elegantbeef> My AI works!
21:19:13FromDiscord<Elegantbeef> It's not a very good AI given that it only says what i've said
21:24:11FromDiscord<System64 ~ Flandre Scarlet> In reply to @griffith1deadly "and rust 🙂": Rst 🤣
21:25:43FromDiscord<toma400> In reply to @griffith1deadly "and rust 🙂": Don't hate on my boi 😢
21:30:28om3gaElegantbeef what it does
21:31:08FromDiscord<Elegantbeef> I was suggesting nimlang was my AI
21:34:34FromDiscord<nimdev> I am not your AI
21:41:44FromDiscord<michaelb.eth> In reply to @nimdev "I am not your": that’s what an AI would say
21:42:45FromDiscord<Elegantbeef> Beep boop beep
21:43:07FromDiscord<emanresu3> we need an AI written in nim
21:43:15FromDiscord<emanresu3> god I hate python's speed
21:43:21FromDiscord<nimdev> In reply to @emanresu3 "we need an AI": True
21:43:42FromDiscord<nimdev> In reply to @emanresu3 "god I hate python's": I hate the language in general to be honest. Very overrated
21:44:10FromDiscord<Elegantbeef> Good thing most python code isnt python
21:44:37FromDiscord<nimdev> https://media.discordapp.net/attachments/1124847670012411935/1124848877724512376/caption.gif
22:00:08*dza quit (Remote host closed the connection)
22:01:40*dza joined #nim
22:10:27FromDiscord<hotdog> In reply to @catnowblue "but here's every objects": I think it's because you have module and type names the same, either rename the modules or fully qualify the type names (e.g. `Attachment.Attachment`). It's a type resolution thing
22:10:40FromDiscord<Chronos [She/Her]> In reply to @emanresu3 "we need an AI": I mean llama.cpp exists
22:24:37FromDiscord<spotlightkid> I like Python. One must also not forget that it started in the early 90s and that it IMHO is the first PL that managd to fufill the "easy for beginners" promise without giving them bad programming habits. And the success of Python in the Scicomp and AI fields show that execution speed is not the most important factor but faciitating experimentation.
22:24:59FromDiscord<spotlightkid> What I don't like about Python is the deployment story.
22:33:06*lukas joined #nim
22:38:14FromDiscord<bung8954> sent a code paste, see https://play.nim-lang.org/#ix=4ABR
22:45:35lukasWhats the best way to parse a value from a header response? With Python and requests I can for example just use: response.headers.get("total-hits"). Do I have to use regex with Nim?
22:47:44FromDiscord<graveflo> https://nim-lang.org/docs/httpclient.html#Response
22:48:02FromDiscord<graveflo> in nim it is "response.headers["total-hits"]`
22:48:47FromDiscord<graveflo> (edit) ""response.headers["total-hits"]`" => "`response.headers["total-hits"]`"
22:48:48FromDiscord<treeform> In reply to @odexine "is treeform a core": I would not say so. I did make a ton of libs though.
22:49:20*lukas quit (Read error: Connection reset by peer)
22:51:00*lukas joined #nim
22:52:06lukas@Graveflo thank you :) that's perfect
23:34:33*lukas quit (Quit: Konversation terminated!)
23:44:51FromDiscord<gogolxdong666> In reply to @emanresu3 "we need an AI": +1