<< 19-03-2023 >>

00:01:25arkanoidI've learned async first with C#, then Python, so I've always considered futures requires to be awaited to run. This caused some unexpected behaviour in my Nim code. It took me a while
00:04:06FromDiscord<alcatraz> In reply to @arkanoid "alcatraz, it depends on": thanks arkanoid
00:04:26FromDiscord<alcatraz> are there any good videos to watch while bored? i cant read for long periods of time i get a headache
00:05:31arkanoidalcatraz, there is a youtube channel https://www.youtube.com/@nimprogramminglanguage3130 , but just search "nim lang" on youtube there is quite some stuff
00:06:11FromDiscord<alcatraz> thanks, how are you sending messages as a bot?
00:06:16arkanoidkiloneie has creates some good tutorials, for example https://www.youtube.com/@kiloneie
00:07:10arkanoidI'm using IRC, there's a software bridge that links irc, matrix and discord if I remember correctly
00:07:28arkanoidanother chunk of the community lives on telegram afaik
00:07:39FromDiscord<alcatraz> thats cool, im from the discord
00:11:17FromDiscord<Phil> At some point I'll start claiming y'all IRC and matrix users are chat GPT Bots and nobody will be able to claim differently
00:13:34FromDiscord<Elegantbeef> Wait i'm not?
00:13:45arkanoidWho is real here?
00:14:03FromDiscord<Elegantbeef> Will the real Nim user please stand up
00:16:05FromDiscord<Hourglass [She/Her]> Too tired sorry
00:16:07FromDiscord<Hourglass [She/Her]> Lmao
00:16:14FromDiscord<Hourglass [She/Her]> Good song tho
00:22:29*ltriant joined #nim
00:25:51FromDiscord<michaelb.eth> @ElegantBeef any thoughts on https://discord.com/channels/371759389889003530/371759389889003532/1086789852567179264
00:26:06FromDiscord<Elegantbeef> Damn discord links
00:27:21FromDiscord<michaelb.eth> oh sorry, I wrote about "curious about this approach" a little more than an hour ago, 6:14p my tz
00:27:29*ltriant quit (Ping timeout: 265 seconds)
00:27:31FromDiscord<Elegantbeef> I do not use the C++ backend much
00:27:34FromDiscord<Elegantbeef> ever really
00:27:48FromDiscord<michaelb.eth> that's the thing, per comments in that issue (which may be incorrect), it can be used with C backend
00:28:11FromDiscord<michaelb.eth> but I may have misunderstood
00:28:31FromDiscord<michaelb.eth> (edit) "that's the thing, per comments in that ... issue" added "GitHub"
00:28:47FromDiscord<Elegantbeef> Well `<clocale>` is `<locale>` in C
00:28:55FromDiscord<Elegantbeef> So you need to whendef this afaik
00:31:09FromDiscord<michaelb.eth> so if I put `<locale.h>`, it compiles, but the linker fails with undefined symbols, which is why I was thinking I needed the cpp header, and that somehow magically it would sort out... but I guess that's wishful thinking 😄
00:31:19FromDiscord<michaelb.eth> I probably misunderstood the context of what Araq was suggesting
00:32:23FromDiscord<Elegantbeef> Not a clue here
00:32:43FromDiscord<Elegantbeef> You want to compile the hpp with the C backend?
00:33:06FromDiscord<michaelb.eth> well, I want to get the constant value at compile-time instead of runtime
00:33:36FromDiscord<michaelb.eth> seemed like he was suggesting `proc foo(): cint {.importcpp: "FOO@".}` is a way to do that
00:33:49FromDiscord<michaelb.eth> i.e. "nullary function" workaround
00:34:04FromDiscord<Elegantbeef> You mean constant at compilation and not inside Nim right?
00:34:16FromDiscord<michaelb.eth> yes
00:34:33FromDiscord<michaelb.eth> errr, well, actually, not sure what you mean
00:35:08FromDiscord<Elegantbeef> I mean you do not expect to have Nim know the contents of the constant
00:35:34FromDiscord<michaelb.eth> it would be nice if it could
00:35:44FromDiscord<Elegantbeef> Well it cannot
00:35:47FromDiscord<michaelb.eth> I see
00:37:41FromDiscord<alcatraz> is nim good for malware? 🤔
00:37:53FromDiscord<Elegantbeef> Do not write malware in Nim, thanks
00:39:44FromDiscord<michaelb.eth> please don't write malware in general, thanks also
00:39:53FromDiscord<alcatraz> In reply to @michaelb.eth "please don't write malware": educational purposes.
00:41:32FromDiscord<Elegantbeef> Anyway michael yea sinc Nim is not a C compiler the only things you can import is procs or variables. In those cases it just emits the symbol you say it is
00:41:49FromDiscord<Hourglass [She/Her]> In reply to @alcatraz "is nim good for": Any programming language could be used for malware, but you'll get no support for writing one here probably loo
00:41:51FromDiscord<Hourglass [She/Her]> Lol
00:42:04FromDiscord<Elegantbeef> Nim doesnt even check if a header exists when you compile it, so it's not like it knows where the symbols lie
00:42:51FromDiscord<Elegantbeef> I suppose you could make something like futhark that compiles the program to extract the value of a symbol
00:46:01FromDiscord<michaelb.eth> makes sense, thanks for the feedback
00:46:52FromDiscord<Elegantbeef> No problem
00:47:35FromDiscord<michaelb.eth> coming at it from a different angle (leave aside locale.h, that was just something I was experimenting with re: Araq's comment), I have a header in which some constants are declared as wide strings using C's `L"..."`.↵↵I was hoping to extract them one way or another so I have them as proper Nim `const`
00:48:05FromDiscord<Elegantbeef> I mean you can always copy them over manually, but yea there is no automated mechanism
00:48:19FromDiscord<michaelb.eth> how would you represent a wide string literal in Nim source?
00:48:42FromDiscord<Elegantbeef> Utf16 encoded into a string
00:49:17FromDiscord<michaelb.eth> so on Windows wchar_t is uint16 but on e.g. Linux it's 32-bit
00:49:35FromDiscord<michaelb.eth> afaict, Nim's widestring module makes some incorrect assumptions
00:50:18FromDiscord<Elegantbeef> I think it makes a single assumption, that silly people use non utf8 encoded strings 😄
00:54:05FromDiscord<michaelb.eth> I hear what you're saying, multibyte strings are definitely the way to go... but some folks use wchar_t on systems where it's 4 bytes as a convenient way to store the bytes of a multipoint grapheme cluster
00:55:07FromDiscord<michaelb.eth> and it happens that in those contexts `L"..."` string literals in the sources is a match for the ordering of the codepoints
00:55:51FromDiscord<michaelb.eth> (edit) "it's" => "its" | "as" => "are" | "multipoint" => "multi-codepoint"
00:56:08FromDiscord<Elegantbeef> sent a code paste, see https://paste.rs/CDA
00:56:22FromDiscord<Elegantbeef> Then do `WideStr32("yourwidestringfromtheCfile")`
00:57:16FromDiscord<michaelb.eth> cool! I'll experiment with that idea
00:57:25FromDiscord<Elegantbeef> Nim strings afterall are just binary blobs and not any specific encoding
00:57:40FromDiscord<Elegantbeef> So if you copy a widestring literal inbetween them it should work assuming it's escaped properly
01:00:11*rockcavera joined #nim
01:01:17FromDiscord<alcatraz> In reply to @Hourglass, When the Hour Strikes "Any programming language could": yeah but some languages are better than others
01:05:10FromDiscord<anno> sent a code paste, see https://play.nim-lang.org/#ix=4rdQ
01:05:41FromDiscord<Elegantbeef> Where's the UB?
01:05:55FromDiscord<anno> (edit) "https://play.nim-lang.org/#ix=4rdQ" => "https://play.nim-lang.org/#ix=4rdR"
01:06:04FromDiscord<Elegantbeef> Objects are stack allocated so `var a = b` copies
01:06:13FromDiscord<Elegantbeef> refs are heap allocated so it copies the pointer to b
01:07:30FromDiscord<Elegantbeef> sent a code paste, see https://play.nim-lang.org/#ix=4rdS
01:07:50FromDiscord<anno> 😄
01:08:24FromDiscord<Elegantbeef> If you do `x[0].val = 1` it behaves the same since you're mutating the data held by the seq
01:09:02FromDiscord<anno> Okay, so if I write a generic function, I should never use var to alias into an argument, because it could probably do a copy?
01:09:14FromDiscord<Elegantbeef> I mean you should if you want to
01:09:43*beholders_eye quit (Ping timeout: 246 seconds)
01:09:48FromDiscord<Elegantbeef> sent a code paste, see https://play.nim-lang.org/#ix=4rdY
01:11:12FromDiscord<Elegantbeef> If you're writing a generic procedure you have think about whether types are values or references and if so what consequences your actions have
01:12:35FromDiscord<anno> Ah okay. Thank u 🙂
01:49:07FromDiscord<anno> sent a code paste, see https://play.nim-lang.org/#ix=4rew
01:49:49FromDiscord<Elegantbeef> `for y in x.mitems: y.val = 1`
01:51:24FromDiscord<anno> Great 😄 Thank u again
02:22:28*arkurious quit (Quit: Leaving)
02:24:09FromDiscord<michaelb.eth> In reply to @Elegantbeef "Then do `WideStr32("yourwidestringfromtheCfile")`": I tried variations, couldn't get it to work. After additional research, if I want to achieve my `const` goal, I'd need to implement C's `mbstowcs` in pure Nim such that I have a proc that I can call at compile-time with a static Nim string
02:26:11FromDiscord<michaelb.eth> my initial impression is that there's an issue with byte ordering in the individual `wchar_t` in an array of `whcar_t`
02:26:30FromDiscord<michaelb.eth> (edit) "array of `whcar_t`" => "`array[N, whcar_t]`"
02:28:39FromDiscord<Elegantbeef> Hmm this is a bit tricky
03:00:27*azimut joined #nim
04:23:16*ltriant joined #nim
04:30:14*ltriant quit (Ping timeout: 246 seconds)
04:46:44*ltriant joined #nim
05:05:46*ltriant quit (Ping timeout: 252 seconds)
05:08:01*ltriant joined #nim
05:12:21*ltriant quit (Ping timeout: 255 seconds)
05:14:14*ltriant joined #nim
05:19:16*ltriant quit (Ping timeout: 246 seconds)
05:37:21NimEventerNew thread by Naterlarsen: Only one line will load. Need all lines in directory to load., see https://forum.nim-lang.org/t/10022
06:09:37*om3ga quit (Ping timeout: 252 seconds)
06:22:27*rmt joined #nim
06:23:11*tiorock joined #nim
06:23:12*tiorock quit (Changing host)
06:23:12*tiorock joined #nim
06:23:12*rockcavera is now known as Guest3876
06:23:12*tiorock is now known as rockcavera
06:26:35*Guest3876 quit (Ping timeout: 264 seconds)
06:31:37NimEventerNew thread by noah: Design question: generic methods are deprecated, see https://forum.nim-lang.org/t/10023
06:47:12FromDiscord<sOkam!> In reply to @anno "Sorry to bother u": there is also `for id, y in x.mpairs:` if you ever need both the item and its iteration number and the item should be modifiable. pairs does the same idea, but not modifiable
07:18:51*om3ga joined #nim
08:46:19*nanxiao joined #nim
09:37:11*nanxiao quit (Quit: Client closed)
09:45:43*onetwo38 joined #nim
09:46:51*onetwo3 quit (Ping timeout: 255 seconds)
09:50:54*nanxiao joined #nim
10:14:00*ltriant joined #nim
10:22:24*oprypin quit (Remote host closed the connection)
11:21:12*nanxiao quit (Quit: Client closed)
11:33:57*rmt quit (Ping timeout: 255 seconds)
11:53:45*jmdaemon quit (Ping timeout: 255 seconds)
12:43:33FromDiscord<sOkam!> sent a code paste, see https://play.nim-lang.org/#ix=4rgF
12:44:20FromDiscord<sOkam!> how can that be printed as 0, but crash on assert because of being 524288... at the same time?
12:52:02FromDiscord<Recruit_main707> it crashes because it isnt 52488
12:52:09*PMunch joined #nim
12:52:14FromDiscord<Recruit_main707> 524288
12:56:01FromDiscord<sOkam!> oh, good catch
13:46:39FromDiscord<Ayy Lmao> Man ChatGPT isn't half bad at translating c++ to nim, it's actually saving me some typing making bindings.
14:28:53*alice quit (Quit: *disappears* U_U)
15:14:38*kas joined #nim
15:16:54FromDiscord<Gumbercules> In reply to @Ayy Lmao "Man ChatGPT isn't half": have you tested the bindings?
15:17:16FromDiscord<Gumbercules> also c2nim could already do this fairly well so 🤷
15:20:15*cfa joined #nim
15:20:36cfamorning folks
15:20:46cfalooks like there's an issue with the nimble directory at the moment?
15:20:48cfahttps://nimble.directory/
15:20:52cfanot sure whether it's been reported already
15:24:45cfapackage_directory.nim(533) package_directory␤package_directory.nim(530) main etc.
15:24:45cfainput(1, 0) Error: { expected
15:33:49*alice joined #nim
15:51:47FromDiscord<Ayy Lmao> In reply to @Gumbercules "have you tested the": Yeah they seemed legit. It was mainly just throwing a small list of functions in there so I didn't feel like making a file and cleaning it up and running c2nim.
15:55:39*cfa left #nim (#nim)
15:57:45FromDiscord<treeform> In reply to @Ayy Lmao "Man ChatGPT isn't half": I have tried this as well. It made a few errors but worked in the end. ChatGPT is Amazing...
15:57:59FromDiscord<treeform> (edit) "In reply to @Ayy Lmao "Man ChatGPT isn't half": I have tried this as well. It made a few errors but ... worked" added "they were easy to fix,"
16:03:28*rmt joined #nim
16:24:36FromDiscord<Gumbercules> It's about as amazing as stack overflow with incorrect answers
16:25:35*arkurious joined #nim
16:25:55FromDiscord<deech> When generating bindings how does it figure out ownership and lifetimes? Or does it `void` everything?
16:35:59FromDiscord<planetis> why does binarySearch https://nim-lang.github.io/Nim/algorithm.html#binarySearch%2CopenArray%5BT%5D%2CK%2Cproc%28T%2CK%29 has two generic parameters? How that can ever be useful?
16:36:44FromDiscord<planetis> lower/upperBound as well, but not sort
16:37:40FromDiscord<planetis> let me make a PR and see what it breaks
16:39:15FromDiscord<healdove> are you asking why it'd be useful, or are you asking how code could ever even use it?
16:40:28FromDiscord<healdove> really contrived example\: you have an array of strings representing ints, and you're searching for an int
16:41:00FromDiscord<healdove> T is string but K is int, the cmp func would convert T to int before comparing
16:41:22FromDiscord<healdove> if T=K, you'd have to write this in a way that the cmp func would also convert K to int every time
16:41:37FromDiscord<healdove> (or use closure context but... it's a contrived example)
16:43:10FromDiscord<planetis> right mixing up types
16:45:05FromDiscord<planetis> I had already made my PR when I read your reply, so I still submitted it
16:47:07FromDiscord<healdove> would still be nice to have something documenting why T!=K \:)
16:47:11FromDiscord<planetis> so it failed with colors.nim where it has an array of (string, Color) and key is string
16:47:24FromDiscord<healdove> ah! that's a good example
16:50:12FromDiscord<Nilts> sent a code paste, see https://paste.rs/pCy
17:20:52FromDiscord<mk-fg> -+
17:20:54FromDiscord<mk-fg> +
17:21:22*azimut quit (Remote host closed the connection)
17:22:01*azimut joined #nim
17:40:23*Notxor joined #nim
17:50:46FromDiscord<Hourglass [She/Her]> How would I go about assigning a ref object to the field of another ref object initialised in a shared library? There's some off behaviour I've found where the field won't get set no matter what I try
17:59:16FromDiscord<Hourglass [She/Her]> Using the `orc` memory manager and on latest Nim devel
18:06:10*PMunch quit (Quit: leaving)
18:45:08*rmt quit (Ping timeout: 265 seconds)
18:46:25FromDiscord<Hourglass [She/Her]> I've been lost on this for a while now ngl
18:50:09FromDiscord<auxym> post some code?
18:54:23FromDiscord<jmgomez> In reply to @Ayy Lmao "Man ChatGPT isn't half": Not sure about ChatGPT but copilot did easily 90%+ the manual part of the bindings for NUE
18:55:21FromDiscord<Hourglass [She/Her]> In reply to @auxym "post some code?": Hold on, I'll need a bit for a minimal reproducible example
19:17:31FromDiscord<Hourglass [She/Her]> ...that's odd? My minimal reproducible example isn't reproducing the bug
19:23:54*jmdaemon joined #nim
19:28:38FromDiscord<Elegantbeef> Does your ref issue disappear if you `GcRef` the ref?
19:35:12FromDiscord<Hourglass [She/Her]> Okay this is the most absurd thing ever
19:35:25FromDiscord<Hourglass [She/Her]> I'm not sure exactly what I did but the issue is just gone
19:35:32FromDiscord<Hourglass [She/Her]> I'm so unbelievably confused
19:43:09FromDiscord<Hourglass [She/Her]> I am so confused
19:43:36FromDiscord<Hourglass [She/Her]> `gdb` seems to just crash as soon as I run my program through the debugger
19:43:57FromDiscord<Hourglass [She/Her]> Even though running it without a debugger works just fine
19:44:25FromDiscord<ieltan> hm
19:44:31FromDiscord<Hourglass [She/Her]> The issue is with `No handles or timers registered in dispatcher. [ValueError]` when running through a debugger
19:44:47FromDiscord<Hourglass [She/Her]> Let me paste the exact log
19:45:35FromDiscord<Hourglass [She/Her]> sent a code paste, see https://play.nim-lang.org/#ix=4riw
19:45:54FromDiscord<Hourglass [She/Her]> Hold on that cut off while copying
19:46:02FromDiscord<ieltan> sent a code paste, see https://play.nim-lang.org/#ix=4rix
19:46:22FromDiscord<Hourglass [She/Her]> sent a code paste, see https://paste.rs/ZQ2
19:46:30FromDiscord<Elegantbeef> What would you be trying to await
19:46:35FromDiscord<Hourglass [She/Her]> (`Pre-start`is just my program's output)
19:46:40FromDiscord<ieltan> that was lazy but there should be an async proc in there
19:47:42FromDiscord<Elegantbeef> sent a code paste, see https://play.nim-lang.org/#ix=4riy
19:47:54FromDiscord<Elegantbeef> Do not forget to anotate it `async`
19:48:55FromDiscord<Hourglass [She/Her]> I am so lost on all these issues
19:49:01FromDiscord<ieltan> In reply to @Elegantbeef "It should be possible": Thanks :
19:49:03FromDiscord<ieltan> (edit) ":" => "!"
19:50:51FromDiscord<Hourglass [She/Her]> I don't think the debugger likes `runForever`
19:51:24FromDiscord<Hourglass [She/Her]> Since that's the line the program crashes on
19:52:40FromDiscord<Ayy Lmao> In reply to @jmgomez "Not sure about ChatGPT": Ooh that's interesting. I'll have to look into that, I haven't used it yet.
19:52:49*Mi left #nim (#nim)
19:58:07FromDiscord<Ayy Lmao> sent a code paste, see https://play.nim-lang.org/#ix=4riB
19:58:13FromDiscord<Elegantbeef> nope
19:58:26FromDiscord<Ayy Lmao> Well darn
19:58:33FromDiscord<Elegantbeef> Well if it's an array technically `values.addr` is that
19:58:39FromDiscord<Elegantbeef> You can always write a proc if you want
19:59:11FromDiscord<Elegantbeef> sent a code paste, see https://play.nim-lang.org/#ix=4riC
20:00:08FromDiscord<Ayy Lmao> True, I was hoping there was a nicer way that was idiomatic though.
20:00:30FromDiscord<Elegantbeef> Just use an openarray instead 😄
20:00:45FromDiscord<Elegantbeef> Depends what you're doing though
20:02:09FromDiscord<Ayy Lmao> I'm just doing stuff with sequences and ImPlot where you need to pass addresses to data for it to plot it. Eventually I'll wrap the functions in nicer nim friendly ones.
20:02:54FromDiscord<Elegantbeef> Yea do the lowlevel operations on a proc that takes a openarray and that should make it less ugly
20:03:35FromDiscord<Ayy Lmao> I'm curious if you think it is worth using templates? Would there be a lot of overhead with using a proc to wrap?
20:04:20FromDiscord<Elegantbeef> C compilers are smart
20:04:21FromDiscord<Elegantbeef> They know when something is simple enough to inline
20:04:22FromDiscord<Elegantbeef> If really worried use `{.inline.}`
20:04:46FromDiscord<Ayy Lmao> Alright sounds good.
20:05:27FromDiscord<Elegantbeef> Doubt it would be that impactful but in debug builds always inlining will slow down compilation a tinge
20:06:17FromDiscord<Ayy Lmao> I guess I just won't inline unless I notice issues.
20:06:54FromDiscord<Elegantbeef> The places where inlining makes sense is when the operation is cheaper than a proc call
20:06:55FromDiscord<Phil> sent a code paste, see https://play.nim-lang.org/#ix=4riG
20:07:37FromDiscord<Elegantbeef> Otherwise it's just wishful optimising 😄
20:08:09FromDiscord<Elegantbeef> Perhaps the generated type is cyclical Phil
20:08:24FromDiscord<Elegantbeef> Look at the `-d: debugOwkettle` or w/e and see if that holds water
20:08:27FromDiscord<Phil> Minimized the example
20:08:27FromDiscord<Phil> (edit) "https://play.nim-lang.org/#ix=4riG" => "https://play.nim-lang.org/#ix=4riH"
20:09:09FromDiscord<Elegantbeef> Also you can do `echo state[]`
20:10:19FromDiscord<Elegantbeef> That code does not compile with orc and 1.6.12
20:10:21FromDiscord<Elegantbeef> What version are you on?
20:10:39*beholders_eye joined #nim
20:11:54FromDiscord<Elegantbeef> sent a code paste, see https://play.nim-lang.org/#ix=4riI
20:13:05FromDiscord<Phil> So you can't repr a state because it packs a reference to itself
20:13:24FromDiscord<Elegantbeef> Depending on your nim version and gc
20:13:25FromDiscord<Elegantbeef> It worked fine with refc
20:13:36FromDiscord<Phil> That is surprisingly not an issue in 1.6.10
20:13:41FromDiscord<Phil> Yeh, just checked
20:13:48FromDiscord<Phil> with orc it is an issue
20:14:03FromDiscord<Phil> Which I don't get, how does this become problematic for reprß
20:14:06FromDiscord<Phil> (edit) "reprß" => "repr?"
20:14:18FromDiscord<Phil> The data structure itself doesn't change, right?
20:14:19FromDiscord<Elegantbeef> Repr is implemented differently for the MMs
20:14:24FromDiscord<Elegantbeef> Orc might not have a cycle breaker
20:14:37FromDiscord<Elegantbeef> I personally cannot get it to compile with orc
20:14:40FromDiscord<Phil> Ah, repr is mm dependent, check
20:37:32*azimut quit (Ping timeout: 255 seconds)
20:38:25FromDiscord<Phil> Hmmm if I want to have a mini CLI, is there a way I can do that with nimscript but call it like a binary?↵Like, I'd love to be able to do something like:↵`owl newwidget myproject/somefolder/widgetname.nim`
20:39:04FromDiscord<Phil> which means I'd need... a binary in the path? Can I have nimscript behave as if it were a binary or something?
20:39:59FromDiscord<Elegantbeef> owl could be your own nimscript based program
20:40:13FromDiscord<Elegantbeef> You also can use shebangs
20:40:23FromDiscord<Phil> Yeah, it's just I don't know how to execute nimscript without calling the nim compiler
20:40:39FromDiscord<Elegantbeef> That is afterall how python programs are generally run
20:41:07FromDiscord<Elegantbeef> https://nim-lang.org/docs/nims.html#standalone-nimscript
20:43:26FromDiscord<Phil> Okay, so I can use shebang to not have to specify the nim compiler, can I just leave out ".nims" at the end of the file? docs says no
20:43:43FromDiscord<Elegantbeef> I think you can now
20:43:45FromDiscord<Phil> So I could do `owl.nims newwidget myproject/somefolder/widgetname.nim`
20:43:51FromDiscord<Phil> Testing
20:44:19FromDiscord<Phil> sent a code paste, see https://play.nim-lang.org/#ix=4riO
20:45:16FromDiscord<Phil> sent a code paste, see https://play.nim-lang.org/#ix=4riP
20:45:58FromDiscord<Phil> or accepting that the user must write `owl.nims`
20:46:38FromDiscord<Elegantbeef> One moment
20:48:12FromDiscord<Elegantbeef> `#!/usr/bin/env -S nim e`
20:48:27FromDiscord<Elegantbeef> there you can have a extensionless nimscript file
20:50:53FromDiscord<Phil> sent a code paste, see https://play.nim-lang.org/#ix=4riQ
20:51:07FromDiscord<Elegantbeef> Yep
20:51:24FromDiscord<Elegantbeef> It seems wrong though cause it loads the file as a config
20:51:49FromDiscord<Phil> Okay, does work, though the fact it loads config.nims is concerning
20:52:07FromDiscord<Elegantbeef> I mean `config.nims` is always used if next to the nim file
20:52:09FromDiscord<ezquerra> Is there a way to "eval" a nimscript expression provided by the user (as an input to the program) at runtime?
20:52:10FromDiscord<Phil> The nice thing though is this opens the door for every framework to bundle with it its own CLI helper
20:52:41FromDiscord<Elegantbeef> I mean Picostdlib and Nico just shipped a binary
20:52:54FromDiscord<Elegantbeef> Yes there is ezquerra, use the compiler API
20:53:04FromDiscord<Elegantbeef> This can be done manually or by using nimscripter
20:53:32FromDiscord<Phil> I'd prefer not shipping a binary because that feels more error prone for alternative platforms
20:53:39FromDiscord<Phil> since they'd need their own binaries
20:53:47FromDiscord<Elegantbeef> How it's compiled when you install the package
20:53:50FromDiscord<Phil> And I don't wanna bother with that when I can just use nimscript which uses the compiler
20:54:16FromDiscord<Phil> (edit) "And I don't wanna bother with that when I can just use nimscript which uses the compiler ... " added "which somebody else already guarantees me is working for that platform"
20:54:39FromDiscord<Phil> Less tools in the mix and thus more stable imo
20:55:52FromDiscord<Elegantbeef> Anyway the worst part about using nimscript is that it's quite limited
20:56:32FromDiscord<Phil> it's fine. I don't need it to execute complex logic, I need it to generate folders with files in it for me, maybe attach a string to a part of another file at most
21:02:02FromDiscord<ezquerra> In reply to @Elegantbeef "Yes there is ezquerra,": Looking at the nimscripter readme, it seems you must call invoke, passing a known function name. Won't that fail to compile if you try to do that at runtime?
21:02:36FromDiscord<ezquerra> I'd be nice if there was an example of reading some input from a user and running it through nimscripter at runtime if that is possible 🙂
21:03:05FromDiscord<Phil> How do I get the commandline in that?
21:03:37FromDiscord<Elegantbeef> Ezquerra loading a nimscript file calls all top level code
21:03:49FromDiscord<Phil> nevermind, I have std/os
21:04:00FromDiscord<Elegantbeef> The first example uses just a string with no invoke
21:06:33FromDiscord<Nilts> In reply to @not logged in "bumping this. still ping": Did i miss an answer again? Although idk how i could miss a ping...
21:07:21FromDiscord<Elegantbeef> You declare a variable then attempt to call that variable
21:10:50FromDiscord<Nilts> you wonder how stupid i can be sometimes. Anyways, thanks!
21:15:21*om3ga quit (Ping timeout: 255 seconds)
21:16:18*joast quit (Ping timeout: 250 seconds)
21:23:50*junaid_ joined #nim
21:44:56arkanoidis there Nim equivalent of https://blessed.rs/crates ?
21:46:00*junaid_ quit (Remote host closed the connection)
21:47:06FromDiscord<Phil> awesome-nim
21:47:56FromDiscord<Phil> https://github.com/ringabout/awesome-nim
21:56:54arkanoidthanks!
21:57:19FromDiscord<Phil> What surprises me is that owlkettle isn't on that list
21:57:35FromDiscord<Phil> Particularly with the recent pushes I'd claim it's well enough documented to make the cut
21:59:15FromDiscord<Nilts> In reply to @Isofruit "What surprises me is": what is owlkettle
22:00:40FromDiscord<Phil> In reply to @not logged in "what is owlkettle": project from can lehman. Essentially a framework/wrapper (?) built around GTK4.↵And really easy to pick up imo. Like, I managed to get started in it pretty quickly.↵I wouldn't say I have any mastery, but I managed to start contributing the docs explaining all the surrounding features (setters, hooks etc.) within a week or two
22:02:04FromDiscord<Phil> Which imo speaks for the framework
22:02:05FromDiscord<Nilts> In reply to @Isofruit "project from can lehman.": kind of looks like karx
22:02:09FromDiscord<Nilts> (edit) "karx" => "karax"
22:02:17FromDiscord<Nilts> anyway, looks really cool
22:02:18FromDiscord<Phil> Yeah, which is why I picked it up easily enough
22:02:36FromDiscord<Phil> With the recent addition of the style attribute you can also pass your own css classes easily enough
22:03:06FromDiscord<Nilts> I might use that for my future ui endeavors.
22:04:33FromDiscord<Phil> I have not yet played around with how to test owlkettle for reference and I'm not sure can has checked for that
22:06:40*Notxor quit (Remote host closed the connection)
22:07:22FromDiscord<Nilts> oh, yeah. wtf is method, I never really understood it.
22:08:51FromDiscord<Elegantbeef> Dispatching the procedure based off runtime information
22:09:47FromDiscord<Yandall> Is someone else using vscode?
22:09:52FromDiscord<Phil> Yes
22:10:31FromDiscord<Elegantbeef> No after 23.01 vscode is now a singleton application and only one person an use it at a time, congrats
22:10:38FromDiscord<Yandall> Do you know how to use correctly the debugger? I get pretty lost using it
22:11:09FromDiscord<Elegantbeef> https://github.com/saem/vscode-nim#debugging
22:11:23FromDiscord<Phil> I can't say I use the debugger in that regard
22:13:53FromDiscord<jmgomez> Did someone give this a shot already? https://github.com/nim-lang/Nim/pull/21517
22:14:43FromDiscord<Nilts> In reply to @Elegantbeef "Dispatching the procedure based": and what does that mean
22:16:55FromDiscord<Yandall> In reply to @Elegantbeef "https://github.com/saem/vscode-nim#debugging": I don't know if there is something that I'm missing but in this case I can't see the `body` variable https://media.discordapp.net/attachments/371759389889003532/1087137653645901834/image.png
22:22:54FromDiscord<Nilts> In reply to @Yandall "I don't know if": try breaking on the next line.
22:23:54FromDiscord<Yandall> In reply to @not logged in "try breaking on the": It gets even more confusing https://media.discordapp.net/attachments/371759389889003532/1087139413445836901/image.png
22:25:13FromDiscord<Nilts> In reply to @Yandall "It gets even more": it could be possible the the generated code from the async macro is messing the debugger up.
22:30:03FromDiscord<Elegantbeef> The debugger doesnt really understand Nim types
22:30:32FromDiscord<Elegantbeef> https://github.com/nim-lang/Nim/commit/cae539996a9a3b4c79af06d9ba8a0f9273bab3e1 does address this a bit
22:30:39FromDiscord<Yandall> In reply to @not logged in "it could be possible": That could be the case. In a non async proc is more readable
22:31:07FromDiscord<Elegantbeef> An async proc is also a closure which means it's really a `(ptr, proc)`
22:31:16FromDiscord<Elegantbeef> hence `colonEnvP`
22:33:55FromDiscord<Yandall> It seems that is better to just print my variables to know what is in them
22:39:01FromDiscord<Elegantbeef> It's generally the easier path
22:39:16FromDiscord<Elegantbeef> Debuggers work with nim but only to an extent
22:41:41FromDiscord<jmgomez> Worth mentioning that if you use types outside Nim (i.e C++ std or something like that) they work fine
22:42:16FromDiscord<Elegantbeef> Yea the main issue is that Nim has types that are actually distinct from their implementation
22:42:51FromDiscord<Elegantbeef> Like a `set[X]` is either `uint8` `uint16` `uint32` `uint64` or a `array[bitLen div 8, uint8`
22:43:13FromDiscord<jmgomez> I see, never thought of that. So it unfixable?
22:43:21FromDiscord<jmgomez> (edit) "I see, never thought of that. So it ... unfixable?" added "'s"
22:43:23FromDiscord<Elegantbeef> It's fixable likely
22:43:34FromDiscord<Elegantbeef> If someone puts in the effort in the compiler/debugger script
22:43:45FromDiscord<huantian> Beef that could be you!
22:44:02FromDiscord<Elegantbeef> That involves writing python, i'd rather put my thingy where i wouldnt put my fingies
22:44:04FromDiscord<jmgomez> No skin in the game, beef just use echo 😛
22:44:20FromDiscord<jmgomez> (edit) "use" => "uses"
22:44:34FromDiscord<Elegantbeef> Why do you need anything else
22:44:59FromDiscord<jmgomez> There is the pynim thing, or whatever the name is though maybe that works?
22:45:02FromDiscord<Elegantbeef> `writeStackTrace` and `echo` has got me to fix compiler bugs, so uhhh yea
22:45:13FromDiscord<Elegantbeef> It doesnt emit python from Nim
22:45:13FromDiscord<jmgomez> yes, but people like debuggers
22:45:34FromDiscord<Elegantbeef> gdb and lldb both use python for pretty printers afaik
22:45:54FromDiscord<Elegantbeef> but anywho if someone wanted to make the experience better i'm sure they could
22:46:07FromDiscord<jmgomez> btw, how would you approach a way to debug the vm, is it even possible?
22:46:08FromDiscord<Elegantbeef> Personally i'd emit a `debug` for each type Nim instantiates
22:46:18FromDiscord<Elegantbeef> Though @amadan has said that there are issues with that idea
22:46:38FromDiscord<Elegantbeef> There are some VM diagnostics, performance and writing each stack frame
22:46:56FromDiscord<jmgomez> where I can learn more about those?
22:47:06FromDiscord<Elegantbeef> Think it's `profileVm`
22:47:17FromDiscord<Elegantbeef> `--profileVm:on` i think shows registers and operations as they go
22:47:55FromDiscord<!&luke> Hi
22:47:56FromDiscord<Elegantbeef> There is no way to debug the runtime code aside from that though
22:47:57FromDiscord<jmgomez> In reply to @Elegantbeef "but anywho if someone": the big task missing for being feature complete for NUE is after the VM a decent plugin for code. Maybe I can try to look at debugging there, although UE types are just fine which is what people uses
22:48:03FromDiscord<Elegantbeef> It's mostly just for debugging the VM
22:48:10FromDiscord<jmgomez> gotcha
22:48:27FromDiscord<Elegantbeef> https://github.com/nim-lang/Nim/blob/devel/compiler/vm.nim#L567
22:49:37FromDiscord<Elegantbeef> It's not that helpful for user code
22:49:39FromDiscord<Elegantbeef> Mostly for the VM
22:49:46FromDiscord<jmgomez> oh that's cool, but tbh I have no idea how the opcodes work
22:50:42FromDiscord<Elegantbeef> Do you know how assembly works? 😄
22:50:49FromDiscord<Elegantbeef> VMs are just your own defined assembly
22:52:54FromDiscord<jmgomez> Just the very basic stuff from the Uni back in the day. So it's a set of instructions, I really need to dig in into the compiler
22:53:46FromDiscord<Hourglass [She/Her]> In reply to @jmgomez "There is the pynim": Nimpy
22:53:50FromDiscord<Elegantbeef> Yea Nim's VM to my recollection is just a simple `opcode, left, right`
22:54:21NimEventerNew post on r/nim by ChapolinBond: Noob question about Nim, see https://reddit.com/r/nim/comments/11w0gvj/noob_question_about_nim/
22:58:57anddamI am trying to figure if and how I can use a more up-to-date version of nimgl/imgui
22:59:43FromDiscord<Elegantbeef> Pin to the specific commit you want
23:00:00anddamfrom what I understand nimgl/cimgui is a programmatically generated wrapper on dear-imgui, and nimgl/imgui has a generator.nim to provide all the enums and whatnot
23:01:16anddamso if I clone --recursive, go into cimgui-imgui submodule and update that (to docking branch btw), then generate cimgui via the script, then I can call the top-level generate.nim (that I imagine I have to compile first) to generate the new imgui.nim
23:01:30anddamonce this is done how do I tell nimble "here install this thing I just built"
23:01:33anddam?
23:01:58FromDiscord<Elegantbeef> Push to your fork and then depend on that fork
23:02:19anddamas in an https git URL?
23:02:25anddamcan that be a local file:///
23:02:26FromDiscord<Elegantbeef> yes
23:02:56anddamdepend? as in a project dependency?
23:02:57FromDiscord<Elegantbeef> I mean you an depend on it locally with `nimble develop` if on 1.6.x and below
23:03:12FromDiscord<Elegantbeef> If on 1.9.x you can do `nimble develop --global`
23:03:14FromDiscord<Elegantbeef> Yes
23:04:04anddamthere's nim 1.9?
23:04:08anddamI am on 1.6.10
23:04:20FromDiscord<Elegantbeef> 1.9.1 is devel for 2.0
23:04:29FromDiscord<Elegantbeef> 1.6.12 is the most recent stable
23:04:30anddamoh that makes sense, I installed "stable"
23:04:55FromDiscord<Elegantbeef> With nim any odd number of minor or patch is a development build
23:05:13FromDiscord<jmgomez> Did someone in the community attempted to do a runtime reflection system for Nim? Cant find anything around
23:05:32FromDiscord<Elegantbeef> IE 1.5.1 was development for 1.6.0, 1.6.1 for 1.6.2 , and so on
23:05:34anddamlike ye Olde Softuar of Yesteryear
23:05:44FromDiscord<Elegantbeef> Ew runtime reflection
23:06:32FromDiscord<jmgomez> Yeah, but again it could improve the dev workflow. You can turn it off on release
23:06:59anddamElegantbeef: your initial "Pin to the specific commit you want" makes me think it's easier than I concocted
23:07:21FromDiscord<Elegantbeef> Well if imgui has a release you want that isnt tagged you can pin to that
23:07:25FromDiscord<Elegantbeef> If it doesnt you need to fork and make it
23:07:34FromDiscord<Elegantbeef> No clue what you need runtime reflection for jm
23:07:45FromDiscord<Elegantbeef> I tend to avoid anything that uses RTTI, it's just ugh
23:08:32anddamElegantbeef: imgui has (more) recent tags, but I guess those are in master, I am looking for the docking feature
23:08:54FromDiscord<jmgomez> Well, just thinking that what I did for NUE can be applied to any Nim project. Like imaging having a server or an UI that you can draft on NimScript
23:09:09FromDiscord<jmgomez> The issue with RTTI is functions, you cant emit them
23:09:11anddamnimgl/imgui has a docking branch, but once I installed nimble https://fubar.git@#docking the resulting app does not have the docking feature (that I can see)
23:09:54FromDiscord<Elegantbeef> You may need to install the specific commit
23:10:24FromDiscord<Elegantbeef> I do not quite know and the author isnt active here anymore
23:15:33anddamthanks as usual
23:16:37FromDiscord<Elegantbeef> Jm my thinking is that can you not do what you do with compile time logic
23:22:07FromDiscord<jmgomez> But still worth it, I mean obviously it's a subset of Nim I didnt use it for real stuff yet, but I cant see what on daily base use it will be problematic. I started to write the macros inside the VM directly actually
23:22:17FromDiscord<jmgomez> Where do you see the bigger gaps?
23:23:05FromDiscord<jmgomez> (edit) "But still worth it, I mean obviously it's a subset of Nim I didnt use it for real stuff yet, but I cant see what on ... dailybasis" added "a" | "base" => "basis"
23:24:07FromDiscord<Elegantbeef> I was just wondering if what you do requires RTTI or can be done statically with marcos
23:24:10FromDiscord<Elegantbeef> macros even
23:24:53FromDiscord<jmgomez> Like for NUE you mean?
23:25:05FromDiscord<Elegantbeef> Yes
23:25:30FromDiscord<jmgomez> It needs to be at runtime because I query the UE reflection system
23:26:13FromDiscord<jmgomez> https://github.com/jmgomez/NimForUE/blob/594a1e231c74b7c07c5558e7234e5f9703851bed/src/nimforue/vm/nimvm.nim#L122
23:27:12FromDiscord<jmgomez> It isnt finished yet, that's for the borrow thing (to overwrite the UE funcs) for the regular interop is in here: proc setPropWithValueInMemoryBlock(prop : FPropertyPtr, memoryRegion:ByteAddress, value : JsonNode, allocatedStrings : var TArray[pointer], propOffset:int32 = prop.getOffset()) =
23:27:29FromDiscord<jmgomez> It isnt finished yet, that's for the borrow thing (to overwrite the UE funcs) for the regular interop is in here: https://github.com/jmgomez/NimForUE/blob/594a1e231c74b7c07c5558e7234e5f9703851bed/src/nimforue/vm/uecall.nim#L36
23:27:36FromDiscord<Elegantbeef> Isnt this mostly just due to the UE requirement
23:27:52FromDiscord<Elegantbeef> If you're writing pure Nim you can just do what nimscripter does and expose the native code as is
23:27:53FromDiscord<jmgomez> (edit) "https://github.com/jmgomez/NimForUE/blob/594a1e231c74b7c07c5558e7234e5f9703851bed/src/nimforue/vm/uecall.nim#L36" => "↵https://github.com/jmgomez/NimForUE/blob/594a1e231c74b7c07c5558e7234e5f9703851bed/src/nimforue/vm/uecall.nim#L111"
23:28:45FromDiscord<jmgomez> Technically yes, and probably for a subset of it it will be better to do it that way (once the bindings are generated)
23:29:08FromDiscord<jmgomez> however, you lost the option to bind a funcion in the vm without restarting the host
23:29:38FromDiscord<jmgomez> Like if a function is added after the vm is compiled, you can hook it in the script directly
23:30:16FromDiscord<Elegantbeef> I'd wager to say that is an unlikely operation to have done safely anyway
23:30:27FromDiscord<Elegantbeef> It's an issue that harms hot code reload in general
23:30:37FromDiscord<Elegantbeef> You can change bodies but not headers
23:31:22FromDiscord<jmgomez> Yeah but I mean, the vm is in a dll that gets compiled once (it takes a while compiling the Nim part cause UE + Nim compiler)
23:31:39FromDiscord<jmgomez> If you add in another dll a function, or in blueprint or cpp, you can hook it safely in the script
23:32:10FromDiscord<jmgomez> if something doesnt match with the function, the host doesnt allow you to hook it. It shows you an error on the UE's console
23:32:58FromDiscord<Elegantbeef> Yea i do not follow one bit
23:33:01FromDiscord<jmgomez> Im just leveraging on UE"s reflection system for the heaving lifting. You can emit/change functions at runtime (they needed to do it for their script lang back in the day)
23:33:59FromDiscord<jmgomez> basically Im changing UFunction not C/C++ functions. They do have a native implementation which always have the same signature
23:34:15FromDiscord<Elegantbeef> Sure, but i'm talking about pure Nim programs
23:35:05FromDiscord<jmgomez> ok lol, that why I asked you before. I do not change regular Nim funcs. But if Nim had a similar reflection system it will work for that subset of reflected funcs
23:36:10FromDiscord<Elegantbeef> Well that's not even a reflection system in my eyes, it's just a plugin system
23:37:17FromDiscord<jmgomez> Maybe, plugin sounds more high level to me, like dlls. But for sure you need the introspection part at runtime to know what to change
23:38:13FromDiscord<Elegantbeef> sent a code paste, see https://paste.rs/OC9
23:38:15FromDiscord<Elegantbeef> Something like this
23:38:55FromDiscord<Elegantbeef> sent a code paste, see https://play.nim-lang.org/#ix=4rjg
23:39:06FromDiscord<jmgomez> Yup, it can be emitted silently under a pragma or another name for the func/proc keyworkd
23:39:33FromDiscord<Elegantbeef> Then when subscribing the otherside would do like `subscribeProc(name, [VoidTyp])`
23:39:49FromDiscord<Elegantbeef> This just seems like a procedure plugin system if you ask me
23:40:00FromDiscord<Elegantbeef> Could use Nimscript, Wasm, SystemLibraries
23:40:50FromDiscord<jmgomez> Yeah, but the important part is do you agree with me that it can be really handy? Specially on projects where you need to test things quickly for experimentation etc.
23:40:57FromDiscord<Elegantbeef> In the case of wasm or system libraries you'd just call a `initHooks` procedure which would setup all your procedures
23:41:05FromDiscord<Elegantbeef> I mean it's a plugin system of course it can be handy
23:41:07FromDiscord<Elegantbeef> But it doesnt need reflection
23:41:32FromDiscord<Elegantbeef> Atleast runtime reflection
23:41:47FromDiscord<jmgomez> problem with wasm is that you dont use Nim anymore, do you?
23:41:50FromDiscord<Elegantbeef> Also worth noting you can even override `()`
23:41:54FromDiscord<Elegantbeef> So what?
23:41:59FromDiscord<Elegantbeef> That's what the `interopThunk` is for
23:42:10FromDiscord<Elegantbeef> It converts the arguments to the underlying type and calls the underlying code
23:42:38FromDiscord<Elegantbeef> It's a general solution to runtime interop across any environment
23:42:40FromDiscord<jmgomez> I still dont get if the code is not there to stay why you dont just prefer to use the VM
23:43:08FromDiscord<Elegantbeef> Cause i proposed a cross environment API to your plugin system
23:43:18FromDiscord<Elegantbeef> Who said the code isnt there to stay?
23:43:39FromDiscord<Elegantbeef> I look at wasm as a runtime scripting backend that is language agnostic and usable for scripting games either permanently or for mods
23:44:25FromDiscord<jmgomez> Well the dicothomy then is Nim code in both sides, one temporary VS Nim code in one side and something else that talks to WASM in the other
23:44:33FromDiscord<jmgomez> Okay, the mods makes sense
23:44:38FromDiscord<Elegantbeef> wasm is not just for prototyping but a sandboxed, cross platform, cross language backend, for scripting and modding
23:44:42FromDiscord<Elegantbeef> It's not even Nim on both sides
23:45:00FromDiscord<Elegantbeef> I generally use Nim on both sides, but there is no reason not to imagine one day i want to write another language
23:45:54FromDiscord<jmgomez> In reply to @Elegantbeef "It's not even Nim": Im still waiting for an example of something that you use on a daily basis and cant be done in Nim script. Besides importc
23:46:28FromDiscord<Elegantbeef> Like if you make your project in a module way that wasm works for and it's not a bottleneck, why would you convert it to native
23:46:28FromDiscord<Elegantbeef> Why does it matter if nimscript can do it
23:46:43FromDiscord<Elegantbeef> I write open software on an open os using an open language, why should i close down a scripting backend
23:47:15FromDiscord<Elegantbeef> If i write something that i want scripting support, i want anyone to script using what they're conformable with
23:47:32FromDiscord<Elegantbeef> If they want to use luavascript 2047 they can
23:47:39FromDiscord<jmgomez> I guess that depends on the scope. Switching langs also have kind of a cognitive overhead, you need to get use to it etc. I suffer it when witching C++/Nim a lot, especially going from Nim to C++
23:47:53FromDiscord<Elegantbeef> Sure but I'm not looking for myself
23:48:02FromDiscord<Elegantbeef> I imagine that people will use my project/code
23:48:10FromDiscord<jmgomez> Okay, yeah and that makes sense
23:48:26FromDiscord<jmgomez> I look mostly for my use case
23:48:44FromDiscord<Elegantbeef> The point of mentioning wasm in this case was not "Haha use Wasm" but making your suggested tool actually reusable
23:48:54FromDiscord<Elegantbeef> There is nothing like code that looks useful but is purposely limited
23:49:41FromDiscord<Elegantbeef> If you could design a plugin system that supports N number of backends without much extra work, it seems like a sensible thing
23:49:45FromDiscord<jmgomez> Yeah, I mean I needed to build a layer between NUE and NimScript nothing stops me to open that layer to a C interface or WASM
23:50:36FromDiscord<Elegantbeef> This is also why I stay away from RTTI and runtime reflection, it's much too implementation specific for my liking
23:51:06FromDiscord<jmgomez> gotcha
23:51:13FromDiscord<Elegantbeef> In the above example the RTTI used would be an array of enums
23:51:33FromDiscord<Elegantbeef> A simple RTTI that is very easily reproducible
23:52:03FromDiscord<jmgomez> I see. I will bug you if I ever come back and implement the idaea 😛 ↵I have to go, it's late around here. Nice chat!
23:52:55FromDiscord<Elegantbeef> Well before you go i have to mention that wasm3 does something similar with it's RTTI it uses a string so like `v(v)` is a void proc or `i(v)` is a void proc that returns an int
23:53:07FromDiscord<Elegantbeef> Really simple, so it's easy and cross platform
23:53:14FromDiscord<Elegantbeef> But yea buh bye