<< 25-03-2023 >>

00:00:29*azimut joined #nim
00:16:34FromDiscord<vmawz> sent a code paste, see https://play.nim-lang.org/#ix=4rKB
00:19:05FromDiscord<Yardanico> In reply to @vmawz "How do I prompt": uhh
00:19:10FromDiscord<Yardanico> it's literally called that and it's in the os https://nim-lang.org/docs/os.html#isAdmin
00:19:15FromDiscord<Yardanico> so your code just works if you have an up-to-date nim
00:25:55*fallback joined #nim
00:26:04FromDiscord<vmawz> In reply to @Yardanico "it's literally called that": What?
00:26:09FromDiscord<Yardanico> ?
00:26:17FromDiscord<vmawz> isAdmin tells you if it's ran as admin, not ask for admin
00:26:26FromDiscord<Yardanico> ah you want to prompt, sorry, sleepy brain :((
00:26:42FromDiscord<vmawz> Yes
00:51:09FromDiscord<vmawz> I attempted `&"runas /profile /user:administrator {getAppFilename()}"` but doesn't prompt UAC
00:51:24FromDiscord<vmawz> If you know a solution please tell
00:52:28FromDiscord<etra> if it's for windows, apparently you can either give it a manifest, or do a shell execute with admin privileges
01:08:54*ltriant quit (Ping timeout: 255 seconds)
01:37:39*fallback quit (Read error: Connection reset by peer)
01:53:06*Guest93 joined #nim
01:53:24Guest93how to generate code which is called when the scope of a function is left?
01:54:21NimEventerNew Nimble package! lodev - Simple reverse proxy server for local development., see https://github.com/vandot/lodev
02:12:22FromDiscord<Elegantbeef> Guest93 use orc and a destructor
02:13:24FromDiscord<Elegantbeef> unless this is just for a single function then use `defer`
02:13:33FromDiscord<Elegantbeef> or `try: ... finally:...`
02:24:18FromDiscord<vmawz> In reply to @etra "if it's for windows,": Thanks, I'll try a manifest
02:25:31Guest93thx!!!
02:30:10*fallback joined #nim
02:36:10*Guest93 quit (Quit: Client closed)
02:46:09FromDiscord<sOkam!> @ElegantBeef is there a way to get pairs-like behavior for an `iterable[SomeType]`?
02:46:26FromDiscord<Elegantbeef> `import std/enumerate`
02:46:45FromDiscord<Elegantbeef> \`for i, x in enumerate splitLines("someString"\:
02:47:11FromDiscord<sOkam!> enumerate(iter) errors
02:47:53FromDiscord<Elegantbeef> What?
02:47:59FromDiscord<sOkam!> sent a code paste, see https://play.nim-lang.org/#ix=4rL2
02:48:46FromDiscord<Elegantbeef> Oh god using the`iterable` type
02:49:29FromDiscord<sOkam!> its for some assimp importer code, i just copied from some implementation there
02:49:53FromDiscord<sOkam!> if there is a better way to do it, im all ears
02:51:06FromDiscord<Elegantbeef> sent a code paste, see https://play.nim-lang.org/#ix=4rL5
02:51:13FromDiscord<Elegantbeef> `iterable` is a poorly implemented feature
02:52:09FromDiscord<Elegantbeef> sent a code paste, see https://play.nim-lang.org/#ix=4rL6
02:52:25FromDiscord<sOkam!> yeah i think i didn't import enumerate or something when i tried
02:52:49FromDiscord<Elegantbeef> lol
03:17:44FromDiscord<Dale> I'm trying to use the `parseopt` lib with a fully-qualified symbol (`from x import nil`) but it doesn't seem to work, is there a something I'm missing? This particular iterator won't compile https://nim-lang.org/docs/parseopt.html#getopt.i,OptParser
03:18:36FromDiscord<Dale> https://hastebin.skyra.pw/acazeyeluc.nim
03:21:22*fallback quit (Read error: Connection reset by peer)
03:21:44FromDiscord<huantian> Youโ€™d need to do `parseopt.getopt(p)`
03:22:11FromDiscord<Dale> Ah! UFCS, right?
03:22:21FromDiscord<huantian> Yeah
03:22:53FromDiscord<huantian> With Nim people very rarely do import nil because you wonโ€™t be able to reap the benefits of UFC syntax
03:23:18FromDiscord<Dale> Yeah I wasn't aware of that, but at the same time I do like being explicit that way. Damn
03:23:40FromDiscord<Dale> Thank you :)
03:44:18FromDiscord<vmawz> sent a code paste, see https://play.nim-lang.org/#ix=4rLd
03:51:23*derpydoo quit (Quit: derpydoo)
03:52:57*derpydoo joined #nim
04:04:21*ltriant joined #nim
04:05:13FromDiscord<Gumbercules> In reply to @vmawz "I figured it out": Would be nice to share this for posterity somewhere - I'd recommend the forums but I'm sure the post would eventually be lost because the forums like to do that
04:05:27FromDiscord<Gumbercules> Discord has horrible search / information retrieval properties
04:05:50FromDiscord<Elegantbeef> Be like phil and make a question and answer it on SO
04:07:03FromDiscord<Gumbercules> I'll let @vmawz decide how to proceed - I don't want to steal their sweet SO karma or whatever system they use
04:08:47FromDiscord<vmawz> In reply to @Gumbercules "I'll let <@1056763166262042634> decide": I don't know any good forums ๐Ÿ˜‚
04:09:01FromDiscord<Gumbercules> Beef suggested stack overflow
04:09:17FromDiscord<Gumbercules> which I would advocate for as well - it is well indexed by search engines so pretty easy to find answers there
04:09:36FromDiscord<Gumbercules> or maybe we should ask whoever maintains the winim repo to add it as a test / example
04:09:53FromDiscord<vmawz> In reply to @Gumbercules "or maybe we should": I agree, their docs are terrible
04:09:58FromDiscord<vmawz> Ngl
04:10:36FromDiscord<vmawz> But it's basically just winapi so
04:10:44FromDiscord<Gumbercules> Doesn't look like they've been very active
04:10:48FromDiscord<Gumbercules> (edit) "Doesn't look like they've been very active ... " added "lately"
04:11:06FromDiscord<vmawz> `Error: 'nil' is now invalid for 'string'; usage of '==' ` nim errors frustrate me, this doesn't make any sense
04:11:34FromDiscord<Gumbercules> In reply to @vmawz "But it's basically just": fair - I guess if it's easy enough to figure out how to do this in C, then it's also easy enough to figure out in Nim
04:11:48FromDiscord<Gumbercules> strings are value types now
04:12:04FromDiscord<Gumbercules> so you can't compare them to `nil` - you should do `len(str) == 0`
04:12:10FromDiscord<vmawz> I'm new to Nim so idk anything
04:12:28FromDiscord<vmawz> In reply to @Gumbercules "so you can't compare": I thought it was strlen
04:12:44FromDiscord<vmawz> strlen(string)
04:12:46FromDiscord<Gumbercules> nope - `len` is used for `seq[T]` and `string`
04:13:00FromDiscord<Gumbercules> strings use `seq` under the hood anyway
04:13:16FromDiscord<Gumbercules> both are value types - so you do `len(s) == 0` to check for an empty string or sequence
04:13:32FromDiscord<Gumbercules> they are still allocated on the heap
04:13:45FromDiscord<vmawz> `s == ""` would work right?
04:14:05FromDiscord<Gumbercules> sure
04:14:14FromDiscord<vmawz> Okay thanks for the help
04:14:38FromDiscord<Gumbercules> `len` is probably more efficient since the length is stored in the datastructure itself
04:14:55FromDiscord<vmawz> Why is my Nim program being flagged in windows defender, it's fine?
04:15:09FromDiscord<vmawz> In reply to @Gumbercules "`len` is probably more": Yeah I'm using len I was just curious
04:15:14FromDiscord<Gumbercules> yeah - some people have written malware in Nim so it gets flagged by Windows AV
04:15:24FromDiscord<vmawz> In reply to @Gumbercules "yeah - some people": That sucks
04:15:29FromDiscord<Gumbercules> it's being worked on I believe
04:15:50FromDiscord<vmawz> Theoretically, EDR shouldn't know it's made in Nim at all since it's compiled to C
04:16:39FromDiscord<Gumbercules> yeah - I think since Nim malware has been flagged previously and Nim tends to generate pretty crazy looking, but consistent C code it's easily recognizable
04:17:15FromDiscord<Gumbercules> if you look at the C code Nim generates, you'll find that it's easy recognizable after you've seen a few generated files
04:17:32FromDiscord<vmawz> Hm
04:18:01FromDiscord<vmawz> How long have you been learning Nim?
04:18:13FromDiscord<Gumbercules> I've been coding in Nim for a little over 7 years now
04:18:26FromDiscord<vmawz> 7 years??
04:18:30FromDiscord<Gumbercules> Yeah
04:18:31FromDiscord<Gumbercules> https://github.com/zacharycarter
04:18:52FromDiscord<vmawz> You must be an expert
04:21:04FromDiscord<Gumbercules> Mmm - there are people who probably know more about the language in its current state than I do. I know enough Nim to get what I need to done. I do a lot of C interop and don't spend a ton of time trying to push the language. My needs are fairly simple most of the time.
04:21:16FromDiscord<Gumbercules> I shouldn't say probably - I should say definitely ๐Ÿ™‚
04:21:56FromDiscord<vmawz> I've got a lot of learning to do
04:22:07FromDiscord<vmawz> Just started yesterday
04:22:09FromDiscord<Gumbercules> Easy does it and have fun ๐Ÿ™‚
04:22:49FromDiscord<vmawz> It's fairly easy compared to other languages
04:23:41FromDiscord<Gumbercules> There's certainly a lot that can be learned - not sure what you're interesting in building with the language or if you're just learning it to learn it, but I've found it to be a productive and satisfying language to code in, for the most part. There are no panaceas when it comes to PLs ๐Ÿ™‚
04:24:09FromDiscord<Gumbercules> Yeah, I think it all depends on what you're trying to do with the language and your prior experience
04:24:15FromDiscord<vmawz> Is there a better way to do `cast[HKEY](0x80000002)`
04:24:21FromDiscord<Gumbercules> If you have a lot of C/C++ experience you should be good
04:24:30FromDiscord<vmawz> In reply to @Gumbercules "If you have a": Sadly I have none
04:24:46FromDiscord<vmawz> I'm more into web automation so I don't think I'll need it
04:25:12FromDiscord<Gumbercules> Gotcha - yeah if you're not doing a lot of interop or don't need to target embedded, cross compile, etc... then you're probably fine without that knowledge
04:26:14FromDiscord<Gumbercules> In reply to @vmawz "Is there a better": you can probably just do `HKEY(0x80000002)`
04:26:27FromDiscord<Gumbercules> I don't believe there's any need for a `cast` there
04:26:39FromDiscord<vmawz> I tried that with cstring but I got an error
04:26:47FromDiscord<Gumbercules> `cstring` is another beast
04:26:58FromDiscord<Gumbercules> `HKEY` is an alias for `HANDLE` which is an alias for `int`
04:28:23FromDiscord<week old roadkill> hey guys just a quick question is there anything equivalent to `size_t` in nim, a type designed specifically for representing indexes and lengths of chunks of memory
04:28:26FromDiscord<demotomohiro> cstring is `char` in C lang, you cannot simply convert int literal to cstring.
04:28:41FromDiscord<Gumbercules> In reply to @week old roadkill "hey guys just a": `csize_t`
04:28:54FromDiscord<week old roadkill> is it recommended for indexing and so forth?
04:29:09FromDiscord<vmawz> What is this? `Error: type mismatch: got 'HINSTANCE' for 'ShellExecute(0, "runas", getAppFilename(), "", "", cast[INT](5))' but expected 'LONG = int32'` It was working earlier..
04:29:45FromDiscord<Gumbercules> In reply to @week old roadkill "is it recommended for": generally `size_t` is used when you need the variable to hold the word size of whatever architecture you're targeting
04:30:02FromDiscord<demotomohiro> csize_t is for C inter op. `int` is usually used for indexing and array length in Nim stdlib.
04:30:32FromDiscord<Gumbercules> you'll find it generally used when you're trying to represent the size of something - like how many members an array holds or the size of something in memory
04:30:50FromDiscord<Gumbercules> I believe in Nim it is represented by `uint`
04:30:55FromDiscord<week old roadkill> im just using it to index a sequence
04:31:00FromDiscord<Gumbercules> and it's `importc`d
04:31:12FromDiscord<week old roadkill> as i would in c to index any array
04:31:13FromDiscord<Gumbercules> if you're not interoping with C you could just use `int`
04:31:23FromDiscord<Gumbercules> as @demotomohiro suggested
04:32:42FromDiscord<week old roadkill> In reply to @demotomohiro "csize_t is for C": i have found in the documentation for relaying the sizes of certain structures the `Natural` type which is just `int` with the negative bit cut off and i was just wondering if it wouldnt be better to be using an unsigned integer for that or even better an unsigned integer which is guaranteed to be the same size as a pointer
04:32:47FromDiscord<vmawz> In reply to @vmawz "What is this? `Error:": Huh? I assigned it: `let result = ShellExecute(...)` and now it works fine?
04:33:56FromDiscord<vmawz> Nvm just forgot to discard it
04:34:06FromDiscord<vmawz> I'm still probably wrong though
04:35:52FromDiscord<demotomohiro> In Nim, unsigned ints are discouraged for indexing: https://internet-of-tomohiro.netlify.app/nim/faq.en.html#language-design-why-are-unsigned-types-discouragedqmark
04:36:36FromDiscord<Elegantbeef> Nim unlike C has `int` be a 64bit integer
04:36:47*azimut quit (Ping timeout: 255 seconds)
04:36:48FromDiscord<Elegantbeef> Well it's arch specific
04:37:24FromDiscord<Elegantbeef> So atleast on 64 bit there is no reasonable way presently to hit the max of the value ๐Ÿ˜„
04:37:43FromDiscord<demotomohiro> sizeof int and pointer is always same in Nim.
04:37:47FromDiscord<Elegantbeef> If you need more than int.high elements in a sequence, might i request your ram modules
04:38:54FromDiscord<Gumbercules> garbage collection is for poor people - just buy more RAM
04:39:16FromDiscord<Gumbercules> same with `free`
04:39:16FromDiscord<Elegantbeef> Still int.high of any type in a sequence is a lot of ram
04:39:28FromDiscord<demotomohiro> !eval echo sizeof(int), ", ", sizeof(cint), ", ", sizeof(ptr int)
04:39:33NimBot8, 4, 8
04:39:33FromDiscord<Elegantbeef> Using a NAS ram disk?
04:42:35FromDiscord<demotomohiro> I use ARC because I am poor and my raspberry pi pico has only 264kb memory.
04:42:57FromDiscord<Elegantbeef> Download more ram
04:43:58FromDiscord<Gumbercules> I was just referencing some dumb meme ๐Ÿ™‚ I don't actually think that about garbage collection
04:44:33FromDiscord<Elegantbeef> Of course you are, do not want to out that you have a petabyte of ram
04:54:19FromDiscord<Phil> In reply to @Elegantbeef "If you need more": The internet is my RAM module!
05:06:15FromDiscord<Dale> CPU: AMD Ryzen RAM: Amazon AWS
05:37:09*arkurious quit (Quit: Leaving)
06:29:56FromDiscord<Phil> Small news update, Docker did a complete 180 and free tier organizations are no longer going to die!
06:30:02FromDiscord<Phil> Which is nice for the nim images
07:16:13FromDiscord<Phil> Can I tell the smtp module to have a timeout?
07:16:28FromDiscord<Phil> Because I know it's failing to authenticate, but it's taking a solid minute for it to do so
07:17:36FromDiscord<Phil> sent a code paste, see https://play.nim-lang.org/#ix=4rLL
07:34:48FromDiscord<kcvinker> How to get the address of a string ?
07:36:11FromDiscord<Elegantbeef> Why do you need it?
07:37:12FromDiscord<kcvinker> sent a code paste, see https://play.nim-lang.org/#ix=4rLO
07:47:01FromDiscord<Elegantbeef> Ok you want `srcString[0].unsafeaddr`
07:47:51FromDiscord<Elegantbeef> or `cstring(srcString)`
07:51:04*rockcavera quit (Remote host closed the connection)
07:58:38FromDiscord<Elegantbeef> I'd also say consider naming it `utf16Str` so you can do `utf16Str"MyString"` but ymmv
08:06:36FromDiscord<kcvinker> In reply to @Elegantbeef "Ok you want `srcString[0].unsafeaddr`": Thank you @ElegantBeef
08:06:37*Notxor joined #nim
08:34:31*ltriant quit (Ping timeout: 240 seconds)
08:43:59*azimut joined #nim
08:57:57*jmdaemon quit (Ping timeout: 265 seconds)
09:00:13*ltriant joined #nim
09:28:43*derpydoo quit (Ping timeout: 268 seconds)
09:51:50*kenran joined #nim
09:58:55FromDiscord<firasuke> how do you control/disable wrapping for nimpretty formatting on save?
10:03:20FromDiscord<Phil> Nim pretty, produce of number of whitespaces, is not configurable
10:03:32FromDiscord<Phil> (edit) "produce" => "outside"
10:10:46NimEventerNew thread by Bosinski: Iteration against a C-API, see https://forum.nim-lang.org/t/10035
10:17:58FromDiscord<firasuke> In reply to @Isofruit "Nim pretty, outside of": I just checked `nimpretty --help` and `--maxLineLen` is what I am looking for, thanks
10:31:58FromDiscord<kcvinker> sent a code paste, see https://play.nim-lang.org/#ix=4rMu
10:34:47FromDiscord<Yardanico> what does this do?
10:34:49FromDiscord<Yardanico> convert utf-8 to utf-16?
10:35:05FromDiscord<Yardanico> i think https://nim-lang.org/docs/widestrs.html does the same?
10:43:04FromDiscord<kcvinker> In reply to @Yardanico "convert utf-8 to utf-16?": Yes. Let me check the `widestrs`
11:05:54*nanxiao joined #nim
11:14:29FromDiscord<firasuke> Do we have a working treesitter parser for nim?
11:15:24FromDiscord<vmawz> Anyone know how to run a powershell command without a console appearing?
11:15:38FromDiscord<vmawz> -WindowStyle Hidden flashes for a split second
11:15:58FromDiscord<kcvinker> sent a code paste, see https://play.nim-lang.org/#ix=4rMA
11:16:29FromDiscord<kcvinker> (edit) "https://play.nim-lang.org/#ix=4rMA" => "https://play.nim-lang.org/#ix=4rMB"
11:19:15FromDiscord<Phil> In reply to @vmawz "-WindowStyle Hidden flashes for": Check the docs of Std os and osproc, one of those executes commands without a shell
11:19:28FromDiscord<vmawz> In reply to @Isofruit "Check the docs of": I need powershell though
11:20:19FromDiscord<Phil> May still work. I don't use Windows so I can't tell you if those procs remove shell capability or not
11:24:30*ltriant quit (Ping timeout: 255 seconds)
11:31:31*ltriant joined #nim
11:39:07*nanxiao quit (Quit: Client closed)
11:41:59FromDiscord<federico3> can I get a seq of field names from a tuple definition?
11:56:37FromDiscord<firasuke> I can't install `nimlsp` using `nimble install`
12:00:39*derpydoo joined #nim
12:03:59FromDiscord<michaelb.eth> In reply to @firasuke "I can't install `nimlsp`": Iโ€™m not sure what the problem might be, but have you tried `nimble install nimlangserver` as an alternative lang server?
12:04:13FromDiscord<firasuke> lemme check
12:04:39FromDiscord<firasuke> and no I have not xD
12:10:32FromDiscord<enthus1ast> @vmawz\: it should work when you spawn the process powershell.exe
12:10:40FromDiscord<enthus1ast> and give it the right params
12:10:54FromDiscord<vmawz> In reply to @enthus1ast "and give it the": Nope
12:11:11FromDiscord<vmawz> Powershell opens and then reads the flags so it hides after already being open
12:11:41FromDiscord<vmawz> I can make it slightly better by using `cmd /c start /min` but it still appears in taskbar
12:12:21FromDiscord<enthus1ast> https://nim-lang.org/docs/osproc.html#ProcessOption try poDaemon
12:12:36FromDiscord<enthus1ast> with the startProcess proc
12:13:16FromDiscord<firasuke> In reply to @michaelb.eth "Iโ€™m not sure what": ok it failed as well, "Error: cannot open file: /usr/compiler/pathutils"
12:14:57FromDiscord<michaelb.eth> In reply to @firasuke "ok it failed as": What OS and what version of Nim are you using?
12:15:32FromDiscord<firasuke> In reply to @michaelb.eth "What OS and what": I'm on Linux, using nim 1.6.10
12:16:04FromDiscord<michaelb.eth> How is Nim installed?
12:16:14FromDiscord<michaelb.eth> with choosenim?
12:29:53FromDiscord<Yardanico> In reply to @michaelb.eth "with choosenim?": the path obviously indicates it's a sytsem install
12:30:09FromDiscord<Yardanico> In reply to @firasuke "ok it failed as": I think the best solution would be to install nim from choosenim and remove the sytsem-installed nim
12:30:17FromDiscord<Yardanico> (edit) "sytsem" => "system"
12:30:28FromDiscord<firasuke> oh ok
12:30:58FromDiscord<michaelb.eth> I see that but I was wondering if some wires got crossed with a system install, maybe has both by ~/.nimble/bin isnโ€™t in PATH
12:31:14FromDiscord<michaelb.eth> (edit) "by" => "but"
12:31:38FromDiscord<firasuke> the `choosenim` has some bashisms in it
12:32:27FromDiscord<Yardanico> In reply to @firasuke "the `choosenim` has some": well yeah, you can just ran it with bash or do what it does yourself by downloading the latest choosenim release
12:32:33FromDiscord<Yardanico> there's also an option of a manual nim install from source of course
12:32:39FromDiscord<Yardanico> <https://github.com/dom96/choosenim/releases/tag/v0.8.4>
12:32:59FromDiscord<firasuke> oh ok
12:36:48FromDiscord<debris> Nevermind, figured it out. One isn't meant to discard a `void`, removing `discard` from line 18 works fine I think.
12:38:33*kenran quit (Remote host closed the connection)
12:44:58FromDiscord<firasuke> ok using `choosenim` made nimlangserver build successfully
12:48:34*nanxiao joined #nim
12:53:26FromDiscord<Yardanico> In reply to @firasuke "ok using `choosenim` made": I think it's still less stable than nimlsp though, so if you have issues with nimlangserver, try nimlsp
12:53:33FromDiscord<Yardanico> <https://github.com/PMunch/nimlsp>
12:53:59FromDiscord<firasuke> I see, thanks
13:02:36FromDiscord<week old roadkill> sent a code paste, see https://play.nim-lang.org/#ix=4rMU
13:02:45FromDiscord<week old roadkill> im really struggling with this
13:03:16*nanxiao quit (Quit: Client closed)
13:25:08*nanxiao joined #nim
13:26:49FromDiscord<kcvinker> Where I can get a list of equivalent c data types for nim primitives ?
13:29:22FromDiscord<michaelb.eth> In reply to @kcvinker "Where I can get": Many can be found here: https://nim-lang.org/docs/system.htmlโ†ตโ†ตe.g. cint, cchar, etc.
13:29:43FromDiscord<kcvinker> Thanks @michaelb.eth
13:29:50FromDiscord<michaelb.eth> But theyโ€™re not grouped in a list of equiv types as such
13:31:37FromDiscord<kcvinker> In reply to @michaelb.eth "But theyโ€™re not grouped": No probs. I think I can find from that page. ๐Ÿ™‚
13:40:54FromDiscord<firasuke> what should I use for syntax highlighting in nvim?
13:41:18FromDiscord<week old roadkill> In reply to @firasuke "what should I use": i use `https://github.com/alaviss/nim.nvim`
13:41:48FromDiscord<firasuke> don't we have a working treesitter parser?
13:42:40FromDiscord<week old roadkill> i dont know but if there is a treesitter parser its not recognized by `nvim-treesitter`
13:43:17FromDiscord<week old roadkill> it also took me by surprise that `nvim-treesitter` didn't come with a nim parser since its such a popular language
14:16:18*nanxiao quit (Quit: Client closed)
14:16:40*nanxiao joined #nim
14:17:58*nanxiao quit (Client Quit)
14:37:30FromDiscord<kcvinker> How to convert a `WideCStringObj` to nim string ?
14:38:24FromDiscord<kcvinker> Using `$` ?
14:42:16*kenran joined #nim
14:47:09Amun-Ralooks that way
14:55:27FromDiscord<Hourglass [She/Her]> Trying to make a brainfuck interpreter in Nim again, but loops are horrid
14:55:59FromDiscord<Hourglass [She/Her]> I already have a nearly complete implementation but it's just the loops that are screwing me over
15:12:42*beholders_eye joined #nim
15:14:35*kenran quit (Remote host closed the connection)
15:31:50FromDiscord<Hourglass [She/Her]> Finally fixed it!
15:51:53FromDiscord<elgringo> If heard that nim is bad for malware dev? Anyone agree or disagree with this, and why?
15:52:03FromDiscord<elgringo> (edit) "If" => "I've"
15:54:27FromDiscord<Phil> ?
15:55:49FromDiscord<Phil> Bit of an odd question. I mean, you can use any language to write malware, I guess there are some more red team tools than in most languages but I really don't know much there.โ†ตI'd also like to point out that it would be nice if you didn't write malware
15:56:51FromDiscord<elgringo> sorry, should've prefaced it... Hello, Malware analysis here ๐Ÿ‘‹
15:57:23FromDiscord<Phil> I think your go to likely is the security channel. Mratsim who does security related stuff hangs out there afaik
15:57:35FromDiscord<elgringo> Thanks, Ill move to that channel
15:59:23FromDiscord<enthus1ast> the security channel is not on bridged to matrix yet right?
16:00:05FromDiscord<week old roadkill> sent a code paste, see https://play.nim-lang.org/#ix=4rNz
16:00:39FromDiscord<week old roadkill> i added a second setter for `Board` that takes in a `var Board` and two indices and returns a `var Cell`
16:00:46FromDiscord<enthus1ast> who does the discord \<-\> matrix bridges btw?
16:00:58FromDiscord<week old roadkill> (edit) "setter" => "getter"
16:01:03FromDiscord<week old roadkill> this 2nd setter also removes the necessity for me to have a setter at all
16:01:09FromDiscord<week old roadkill> (edit) "setter" => "getter"
16:02:32FromDiscord<week old roadkill> also i have a question about `func`, if my procedure's only side effect is memory allocation, can it be marked as `func` instead of `proc`?
16:12:35FromDiscord<Phil> Generally those with admin rights on discord have the most to weigh in here.
16:12:59FromDiscord<Phil> (Regarding matrix discord bridges, for discord irc bridges Yard has the most knowledge)
16:14:02FromDiscord<Phil> In reply to @week old roadkill "also i have a": As far as I'm aware, memory allocation things don't fall under the perview of side-effects
16:18:27FromDiscord<Phil> sent a code paste, see https://play.nim-lang.org/#ix=4rNG
16:20:27FromDiscord<Yardanico> yes, memory allocations were never a side effect in Nim
16:24:01FromDiscord<enthus1ast> @Yardanico\: can i open an issue somewhere (about bridgeing the nim security channel, from discord to matrix)
16:24:27FromDiscord<Yardanico> In reply to @enthus1ast "<@177365113899057152>\: can i open": there's no need for an issue, it just needs admins on the channel in both networks to connect it with t2bot io
16:24:34FromDiscord<Yardanico> https://t2bot.io/discord/
16:24:40FromDiscord<Yardanico> the workflow is described here
16:25:03FromDiscord<Phil> Snatched and I'll add that to the community repo as documentation
16:25:21FromDiscord<enthus1ast> can someone ping an admin in the security channel (someone with discord \:) )
16:25:31FromDiscord<enthus1ast> ๐Ÿ˜‡
16:26:21FromDiscord<Yardanico> me
16:26:22FromDiscord<Yardanico> did you do it on matrix side?
16:26:32FromDiscord<enthus1ast> i cant
16:26:36FromDiscord<enthus1ast> phil could
16:26:41FromDiscord<Yardanico> welp, i'll see if I'm an admin in the matrix side
16:26:51FromDiscord<Yardanico> for that channel
16:27:08FromDiscord<Yardanico> wait @enthus1ast there's no such channel in matrix at all
16:27:16FromDiscord<Yardanico> I honestly don't know what workflow we use to create channels in matrix
16:27:20FromDiscord<Yardanico> who does it? :P
16:27:46FromDiscord<Yardanico> ah, dom and leorize are the only two admins there, so @Phil add that to the doc too I guess :)
16:27:49FromDiscord<Yardanico> <https://app.element.io/#/room/#nim:envs.net>
16:27:52FromDiscord<enthus1ast> mh, maybe it must also be added to the community
16:28:03FromDiscord<enthus1ast> or how is it called now
16:28:10FromDiscord<Nilts> What does checkOverflowInt do and how do i disable it?
16:28:34FromDiscord<Phil> In reply to @Yardanico "ah, dom and leorize": Wait, so it makes sense to maintain a table over channel admin privileges?
16:28:45FromDiscord<Phil> (edit) "privileges?" => "privileges in matrix (as I don't think discord has that)?"
16:29:03FromDiscord<Yardanico> In reply to @Isofruit "Wait, so it makes": yes, matrix doesn't have a proper concept of servers, so on each channel you must assign admins/mods separately
16:29:33FromDiscord<Nilts> In reply to @not logged in "What does checkOverflowInt do": (causing issue with the js backend)
16:29:50FromDiscord<Yardanico> In reply to @not logged in "(causing issue with the": `--overflowChecks:off` i think
16:30:08FromDiscord<Nilts> In reply to @Yardanico "`--overflowChecks:off` i think": ok
16:30:11FromDiscord<Yardanico> https://nim-lang.org/docs/nimc.html
16:30:15FromDiscord<Yardanico> search for "Runtime checks"
16:31:52FromDiscord<Phil> In reply to @Yardanico "yes, matrix doesn't have": Ah und leorize + dom are admins over... what exactly on matrix? The Nim Programming Language matrix space?
16:32:13FromDiscord<Yardanico> In reply to @Isofruit "Ah und leorize +": yes, the matrix space itself, so they can add channels to it and edit the space info as far as I can understand
16:32:20FromDiscord<Yardanico> https://app.element.io/#/room/#nim:envs.net
16:33:00*arkurious joined #nim
16:38:30*rockcavera joined #nim
16:45:07FromDiscord<Nilts> that fixed it, thanks!
16:45:14FromDiscord<treeform> In reply to @Zevv "https://github.com/zevv/actors/blob/master/actors/p": Do you think a kind of a tread-safe ref object is possible with your code? If I create ref object on main thread and then pass them to two two other threads where they get unref'ed a destroy will work?
16:47:10FromDiscord<week old roadkill> sent a code paste, see https://play.nim-lang.org/#ix=4rNN
16:47:14FromDiscord<week old roadkill> (edit) "https://play.nim-lang.org/#ix=4rNN" => "https://paste.rs/ZRf"
16:47:18FromDiscord<week old roadkill> because i just ran into this by accident and nim allowed it
16:47:21FromDiscord<week old roadkill> https://media.discordapp.net/attachments/371759389889003532/1089229041111945488/image.png
16:50:22Zevvtreeform: yes, but you need to sit on your hands and think before you type
16:50:41Zevvalso, there is no compile time way to prove your ref is isolated, unless you use `isolated` from the start (which is a pita)
16:51:01Zevvand there is no proper run-time way to do this as well for all types, although it works for most things
16:51:11Zevvso you'll get an exception when you try to send something that is not properly isolated
17:48:20FromDiscord<Raynei486> sent a code paste, see https://play.nim-lang.org/#ix=4rNZ
17:52:45FromDiscord<planetis> In reply to @Raynei486 "Is there an elegant": No that's not the issue
17:52:51FromDiscord<Andreas> In reply to @Raynei486 "Is there an elegant": `$getFPS().cstring`
17:53:09FromDiscord<Raynei486> oh it's the conversion part
17:53:12FromDiscord<Raynei486> alright thanks
17:53:27FromDiscord<planetis> The issue is drawText accepting a cstring
17:54:00FromDiscord<planetis> And you can ignore it in that case
17:56:00FromDiscord<planetis> In reply to @week old roadkill "because i just ran": What's exactly the issue board is a var so its perfectly acceptable per the spec
17:56:55FromDiscord<week old roadkill> yea but there is a side effect to that function
18:12:57FromDiscord<firasuke> ok nimsuggest is crashing with neovim
18:17:57*kenran joined #nim
18:27:21FromDiscord<Dale> Quick question on implicit return, will a returned container type be instantiated for me? i.e. `proc f(): seq[int] = result.add(1)` is fine?
18:28:34FromDiscord<Phil> Yes
18:29:15FromDiscord<Phil> sent a code paste, see https://play.nim-lang.org/#ix=4rOc
18:29:38FromDiscord<Dale> sent a code paste, see https://play.nim-lang.org/#ix=4rOd
18:29:49FromDiscord<Dale> That's super handy!
18:32:10FromDiscord<Phil> I would generally caution against it in general programming style for readability.โ†ต`return` is clear and I know exactly what will be returned, namely the thing after the `return`.โ†ต`result` means I have to read the rest of the proc to know what exactly gets returned.โ†ตIf you start having branching control flow (aka if-statements) that can make reading it not as clean as it could be.
18:33:09FromDiscord<Phil> There is a place for result in procs that are specifically about building up a value that then gets returned, but I don't think I'm a big fan of that over just a clear return
18:33:12FromDiscord<firasuke> In reply to @firasuke "ok nimsuggest is crashing": feeling frustrated as I don't know what editor to pick, what lsp to use, and what formatting tool to use with Nim..
18:33:16FromDiscord<Yardanico> In reply to @Dale "Quick question on implicit": it's not really about "being instantiated"
18:33:30FromDiscord<Yardanico> it's just that all value types in Nim are always zero-initialized, and seqs and strings are treated as value types (even though they do use heap memory)
18:33:40FromDiscord<Yardanico> so seqs and strings always have a valid default value (empty)
18:33:48FromDiscord<auxym> style preference ig. NEP-1 proposes to prefer result over return, except when control flow is required
18:34:04FromDiscord<Yardanico> In reply to @firasuke "feeling frustrated as I": the most common is ofc vscode, plugin - nimsaem, formatting - no real tool, nimpretty is really raw
18:34:15FromDiscord<Yardanico> nimslp for any editors with LSP support
18:34:29FromDiscord<Dale> Well I'm experimenting with picking up the language, so I want to use as many unique features as possible (within reason)
18:34:32FromDiscord<Phil> In reply to @firasuke "feeling frustrated as I": In terms of formatting tool, I have arrived at using none as nimpretty doesn't work well for me and I haven't seen anything else out there.โ†ตvscode with the nim plugin works alright, intellij with its nim extension provides better autosuggest (but intellih is slower overall)
18:34:45FromDiscord<Dale> Implicit return is novel to me, so I want to try it
18:34:59FromDiscord<firasuke> In reply to @Yardanico "nimslp for any editors": nimlsp is crashing with neosuggest errors in neovim
18:35:08FromDiscord<Yardanico> In reply to @firasuke "nimlsp is crashing with": and what about alaviss' extension?
18:35:11FromDiscord<Yardanico> it uses nimsuggest directly by itself
18:35:26FromDiscord<Dale> Also this project is not meant to be used by anyone ever so may as well go nuts
18:35:27FromDiscord<Yardanico> https://github.com/alaviss/nim.nvim
18:35:29FromDiscord<firasuke> In reply to @Yardanico "and what about alaviss'": alaviss's extension is also crashing
18:35:35FromDiscord<Yardanico> really weird
18:35:48FromDiscord<Yardanico> any logs or something? and nim 1.6.12 right?
18:36:48FromDiscord<firasuke> yup 1.6.12
18:37:43FromDiscord<firasuke> `nimsuggest instance for project stopped with exitcode:`
18:37:48FromDiscord<firasuke> (edit) "exitcode:`" => "exitcode: 1`"
18:37:58FromDiscord<firasuke> whenever I open any nim file
18:38:12FromDiscord<Yardanico> what happens if you just run `nimlsp` in terminal?
18:38:28FromDiscord<Yardanico> it should just run (it's listening to connections) without any output
18:40:12FromDiscord<Dale> @Phil if you don't use `result`, what happens to the object that is implicitly created? Will the compiler detect that you didn't use it and skip creation of it, or odes it just sit there being wasted?
18:40:29FromDiscord<Yardanico> In reply to @Dale "<@180601887916163073> if you don't": it won't get wasted, don't worry :)
18:40:39FromDiscord<Yardanico> first of all Nim itself is smart, and C compilers are very smart too
18:40:46FromDiscord<Yardanico> also there's one more way except using result and return
18:41:01FromDiscord<Yardanico> making your whole proc body one big expression
18:41:02FromDiscord<Dale> I know you can a one-liner style
18:41:35FromDiscord<Dale> Not sure I'd ever use that one
18:41:44FromDiscord<Yardanico> it can be useful sometimes
18:41:45FromDiscord<Yardanico> sent a code paste, see https://play.nim-lang.org/#ix=4rOf
18:41:51FromDiscord<Yardanico> like for wrapping a case statement in a proc
18:41:56FromDiscord<firasuke> In reply to @Yardanico "what happens if you": lemme check
18:44:05FromDiscord<firasuke> In reply to @Yardanico "what happens if you": `nimlsp --version`โ†ต`nimlsp v0.4.4`
18:44:15FromDiscord<Yardanico> and what if just `nimlsp`? does it just stay on?
18:44:28FromDiscord<firasuke> In reply to @Yardanico "and what if just": yes
18:44:33FromDiscord<Yardanico> hm
18:44:38FromDiscord<firasuke> until I terminate it with Ctrl C
18:45:01FromDiscord<Yardanico> you can compile nimlsp in debug mode and then it should show log when crashing, I just don't know if you'll be able to see it in nvim
18:46:40FromDiscord<Yardanico> https://github.com/PMunch/nimlsp clone and then do `nimble debug`, you'll get a binary `nimlsp`
18:47:01FromDiscord<Yardanico> then just backup the original binary and copy this one to ~/.nimble/bin/
18:47:10FromDiscord<Yardanico> or maybe the nim nvim plugi allows you to change nimlsp binary path
18:47:14FromDiscord<Yardanico> (edit) "plugi" => "plugin"
18:49:29FromDiscord<firasuke> that is what I was thinking
18:49:39FromDiscord<firasuke> I'm looking for a way to change the nimlsp binary path
18:49:44FromDiscord<firasuke> because I am positive it is not picking it up
18:49:52FromDiscord<Yardanico> huh
18:50:05FromDiscord<firasuke> I am using lsp-zero and mason
18:52:09FromDiscord<Yardanico> i can't help with nvim itself, never used it, sorry :(
18:56:31FromDiscord<Dale> What's the most convenient way of constructing a hashmap where the values are enum values?
18:56:54FromDiscord<Dale> `table[string, myenum]`
18:57:11FromDiscord<Dale> Should I do a for loop over some const data?
18:57:19FromDiscord<Yardanico> In reply to @Dale "`table[string, myenum]`": one thing to note: do you just want a mapping from strings to myenums, and strings are always the same?
18:57:28FromDiscord<Dale> Yeah
18:57:35FromDiscord<Yardanico> you don't need table at all then
18:57:44FromDiscord<Yardanico> https://nim-lang.org/docs/strutils.html#parseEnum%2Cstring
18:58:14FromDiscord<Dale> I'm following Bob Nystroms crafting interpreters book, and he uses a giant switch statement for parsing tokens, but I think a hashmap sounds like a better fit
18:58:43FromDiscord<Dale> Oh, the enum values work 'in reverse'?
18:58:45FromDiscord<Yardanico> well, a case statement would still perform better :)
18:58:51FromDiscord<Yardanico> than a hashmap i mean
18:58:54FromDiscord<Dale> Really?
18:58:59FromDiscord<Yardanico> i think so?
18:59:17FromDiscord<Yardanico> In reply to @Dale "Oh, the enum values": I mean you can assign strings to enum values, so then you can convert strings into enum valuies
18:59:18FromDiscord<Yardanico> (edit) "valuies" => "values"
18:59:39FromDiscord<Dale> Isn't a switch basically just a big pile of branches, whereas the hash should be more predictable
19:00:03FromDiscord<Yardanico> and if you ever need enum -> some type, you can just use arrays: <https://github.com/nim-lang/Nim/wiki/Lesser-known-Nim-features#using-enums-as-array-indexes>
19:00:31FromDiscord<Dale> I knew about that, but I'm looking to go from some type -> enum
19:01:32FromDiscord<firasuke> In reply to @Yardanico "i can't help with": oh np, thanks for all the help, I'll try to figure the rest and report back
19:01:34FromDiscord<Dale> On the perf issue, I think it's language dependant? The source in in Java, which will actually compile it into a hash lookup (so I was right)
19:01:52FromDiscord<Dale> I expect nim does the same
19:02:13FromDiscord<Dale> (edit) "in" => "material is"
19:04:46FromDiscord<Dale> I think I'll go with the hashmap implementation because I can generate it from the enum, which makes it easier to maintain. I can simply addend the enum, whereas with a switch statement I'd have to edit that also
19:05:43FromDiscord<Yardanico> you could always write a macro to do that automatically for you ;)
19:06:30FromDiscord<Dale> If I mark the map as `const` it's done at comp time anyway right? So little difference
19:07:36FromDiscord<Diogenes of Toronto> sent a code paste, see https://play.nim-lang.org/#ix=4rOn
19:08:40FromDiscord<Elegantbeef> You need to specify the generic type
19:08:53FromDiscord<Yardanico> In reply to @Dale "If I mark the": ah if you mean that way, sure
19:08:59FromDiscord<Elegantbeef> so `createCmd[T](props: varargs[cmd[T]]): seq[cmd[T]) .... cmd[T]`
19:09:14FromDiscord<Elegantbeef> Like i said you cannot have a homogeneous collection of generics
19:11:20FromDiscord<Diogenes of Toronto> sent a code paste, see https://play.nim-lang.org/#ix=4rOo
19:11:32FromDiscord<Diogenes of Toronto> (edit) "https://play.nim-lang.org/#ix=4rOo" => "https://play.nim-lang.org/#ix=4rOp"
19:11:36FromDiscord<Elegantbeef> Types are not runtime values
19:11:41FromDiscord<Elegantbeef> So you want an object variant
19:12:26FromDiscord<morgan> so im trying to use the ngspice package, and been struggling with the c library it uses. couldn't figure out compiling version 39 but version 32 has a binary. i tried putting it in the right place and that didn't work so im wondering, as a test to see if stuff is working, if there's a way to modify the `{.passl: "-lngspice" .}` to something that includes the path to it
19:13:08FromDiscord<morgan> ideally then trying to get the library to show up normally but i wanna see if it would work at all first
19:16:38FromDiscord<Elegantbeef> `--passL:"-L/path/to/your/.so"`
19:19:03*fallback joined #nim
19:23:11FromDiscord<morgan> thanks
19:24:10FromDiscord<demotomohiro> In reply to @Diogenes of Toronto "so if i wanted": `cmd[bool]` and `cmd[string]` are different types. seq can have only 1 type.
19:25:12FromDiscord<demotomohiro> See: https://internet-of-tomohiro.netlify.app/nim/faq.en.html#coding-how-to-store-different-types-in-seqqmark
19:26:12FromDiscord<Elegantbeef> Hmm makes me wonder if i should add `sharedFields` to fungus ๐Ÿ˜„
19:27:13FromDiscord<morgan> In reply to @Elegantbeef "`--passL:"-L/path/to/your/.so"`": this seems to get added after the passL in the ngspice.nim file
19:27:24FromDiscord<Diogenes of Toronto> sent a code paste, see https://play.nim-lang.org/#ix=4rOq
19:28:03FromDiscord<Elegantbeef> Seems senible
19:28:04FromDiscord<Elegantbeef> sent a code paste, see https://paste.rs/XOZ
19:28:43FromDiscord<Elegantbeef> You do not need that `ref cmdObject` unless you need ref semantics
19:28:52FromDiscord<Elegantbeef> Also types in nim are conventionally CapitalPascalCased
19:29:01FromDiscord<leorize> I think mods can do it too, but I don't remember if I added all mods to it.โ†ต(@Yardanico)
19:29:50FromDiscord<leorize> well but do let me know if there's gonna be an another admin after dom left, I can add them to the channels I have admin on
19:31:50FromDiscord<Phil> In reply to @leorize "I think mods can": We'll be trying to organize this, basically first clearing up on who'll do it
19:33:19FromDiscord<Phil> Trying to keep lists on what is all there and who has what rights and such ^^'
19:34:59FromDiscord<Diogenes of Toronto> In reply to @demotomohiro "See: https://internet-of-tomohiro.netlify.app/nim/f": thanks
19:37:33FromDiscord<Elegantbeef> @demotomohiro\: this is where i semi-jokingly say "Your FAQ does not mention fungus, therefore it's not a longer supported FAQ"
19:40:38FromDiscord<Dale> @Yardanico so in the end I have settled for the giant switch statement. The const map would need to be written by hand, and the LUT generated from the switch by the compiler will be able to be optimised better than my own
19:42:36FromDiscord<Dale> There are also a few cases where a token doesn't match to a specific source sequence (literals/identifiers), so generating an LUT would be a little messy anyways
19:46:33FromDiscord<demotomohiro> @ElegantBeef I'm sorry but I didn't know about fungus. I will update my FAQ soon.
19:50:02FromDiscord<jmgomez> What is fungus?
19:50:31FromDiscord<Elegantbeef> Rust like ADT enums in Nim
19:50:59FromDiscord<Elegantbeef> Demo i was joking of course, just thought it's worth the addendum, though no clue how well it works ๐Ÿ˜„
19:51:04FromDiscord<Elegantbeef> https://github.com/beef331/fungus
19:51:07FromDiscord<jmgomez> oh really?
19:51:24FromDiscord<jmgomez> any caveat?
19:51:37FromDiscord<Phil> You will be using a beef package and he will berate you for it
19:51:52FromDiscord<Elegantbeef> It doesnt have an API for shared fields
19:51:58FromDiscord<Phil> It'll still be good, but you will still get comments ๐Ÿ˜›
19:52:09FromDiscord<jmgomez> That's why I steal it, like with nimscripter:P
19:52:21FromDiscord<Elegantbeef> It also has an ugly syntax for single field types
19:52:41FromDiscord<Elegantbeef> sent a code paste, see https://play.nim-lang.org/#ix=4rOx
19:52:55FromDiscord<Elegantbeef> Which would emit a converter for `StrCmd` to `string`
19:52:55FromDiscord<jmgomez> bookmarked, will take a closer look
19:53:22FromDiscord<Elegantbeef> It also has very primitive pattern matching which encourages explicit flow control
19:53:57FromDiscord<Elegantbeef> Instead of `myCircle.r` you do like `if (myVar: Circle) from myShape: echo myVar.r`
19:54:02FromDiscord<jmgomez> hmm why you dont fix a general solution for PM and add it to it? Having a PM implementation just for your lib sounds a bit of a smell. Dont you think?
19:54:03FromDiscord<Elegantbeef> Or you use the `match` macro to do the same premise
19:54:42FromDiscord<Elegantbeef> I do not like pattern matching to begin with
19:55:26FromDiscord<Elegantbeef> But this pattern matching pretty much needs to be custom due to how it works
19:55:36FromDiscord<jmgomez> The nim community is fckd because beef doesnt like pattern matching
19:56:05FromDiscord<Phil> No, because we are unable to have a better linter xP
19:56:15FromDiscord<Phil> (edit) "No, ... because" added "more"
19:56:18FromDiscord<Elegantbeef> We have the best linter though
19:56:19FromDiscord<jmgomez> Any reason why you dindnt do a RFC to improve enums?
19:56:34FromDiscord<Elegantbeef> Enums are fine
19:56:49FromDiscord<Elegantbeef> Object variants are also fine
19:57:46FromDiscord<Elegantbeef> I also do not really believe in making the compiler more complex for something that can be faithfully reproduced in user code
19:58:30FromDiscord<Elegantbeef> Would it be nice to have `adtenum` inside a type section, yes
19:58:31FromDiscord<Elegantbeef> Does it make sense to add it as a basic feature to Nim...? I do not think so
19:58:41FromDiscord<jmgomez> I agree with that last part, but it would be great if it were part of the std. Now that it's being splited
19:59:03FromDiscord<Elegantbeef> To me it doesnt really matter if it's a package or in the stdlib it's all easy to use
19:59:46FromDiscord<jmgomez> picking a random lib for a lang constructor (no offense) even if by one of the major devs of the lang, it's a bit risky
20:00:06FromDiscord<Elegantbeef> It's not any more risky than depending on the stdlib
20:00:16FromDiscord<jmgomez> if it's on the std it gives more trust that it wont get abandoned and bugs will be fixed etc.
20:00:45FromDiscord<Elegantbeef> Ah yes the stdlib is known for not abandoning code and fixing bugs in a rapid manner
20:01:00FromDiscord<Elegantbeef> Given how the present stdlib is authored using stdlib is worse than using external libraries
20:01:14FromDiscord<Elegantbeef> If you fix a bug with the stdlib you have to wait for the next stable release or go to devel
20:01:17FromDiscord<jmgomez> hmm but you get what you mean, right?
20:01:24FromDiscord<jmgomez> (edit) "you mean," => "Imean,"
20:01:26FromDiscord<Elegantbeef> If you fix a bug with an external library you can use whatever version you're on now
20:01:36FromDiscord<Elegantbeef> I get what you mean but i disagree with the premise
20:02:25FromDiscord<Elegantbeef> Also " even if by one of the major devs of the lang" hopefully that's not directed to me ๐Ÿ˜„
20:02:32FromDiscord<Elegantbeef> I'm just a simpleton that writes fun code
20:03:32FromDiscord<Elegantbeef> To put it in perspective there are 168 open issues for the nim stdlib
20:03:50FromDiscord<jmgomez> lol
20:03:54FromDiscord<Elegantbeef> I fix a majority of issues that are raised within a few days of the issue
20:04:10FromDiscord<Elegantbeef> And even if i do not, you can fork fix and use them
20:04:19FromDiscord<Elegantbeef> You cannot fork and fix the stdlib without inane hacks
20:04:29FromDiscord<jmgomez> well, so maybe in this particular case you are right. But in general, from an outsider dont you think it the std is more trusted?
20:05:08FromDiscord<Elegantbeef> I think it's all software and given the way the stdlib is authored using the stdlib can be a curse as much as a blessing
20:05:10FromDiscord<jmgomez> also, to that point, if it's in the std (as external package) you (beef) can fix it withit a few days too ๐Ÿ˜›
20:05:28FromDiscord<Elegantbeef> Sure but is the stdlib presently authored this way
20:05:56FromDiscord<Elegantbeef> If you're on 1.6.12 and want a bug fix in the stdlib, miran has to backport it and then you have to way for 1.6.14
20:06:00FromDiscord<jmgomez> but the idea is to change it. That's why it's getting split, right?
20:06:15FromDiscord<Elegantbeef> Sure but what is the present state
20:06:44FromDiscord<jmgomez> yeah, Im talking about 2.0+
20:07:13FromDiscord<Dale> Does 1.6 have type field defaults?
20:07:20FromDiscord<Elegantbeef> Sure in the world that Nim's stdlib is authored separately from the compiler it'd be nice to have useful utillities inside the repos
20:07:21FromDiscord<Elegantbeef> No
20:07:35FromDiscord<Dale> kk, thanks!
20:09:42FromDiscord<ezquerra> In reply to @QuiteQuietQ "that is another problem": I agree with @jmgomez. Maybe it is a foolish believe but a lot of people prefer to use the stdlib if possible, because it "feels" safer. It seems less likely to be completely abandoned than using some random library you found on github
20:10:03FromDiscord<Elegantbeef> Wrong reply? ๐Ÿ˜„
20:10:08*fallback quit (Read error: Connection reset by peer)
20:10:15FromDiscord<ezquerra> LOL. Yes ๐Ÿ™‚
20:10:32FromDiscord<ezquerra> Not sure how I did that ๐Ÿ˜ฎ
20:11:15FromDiscord<Andreas> @ElegantBeef @jmgomez would you know a method to process a nim-modul with a macro ?
20:11:32FromDiscord<Elegantbeef> I do not disagree that it gives an aire of security, but in the present state that security is a joke
20:11:38FromDiscord<QuiteQuietQ> In reply to @ezquerra "I agree with <@726017160115126333>.": Lol, not for me?
20:11:44FromDiscord<Elegantbeef> If it takes a backport and version tick to reach the user where is the security
20:12:07FromDiscord<QuiteQuietQ> Quite a coincidence, I just got online for one minute
20:12:08FromDiscord<Elegantbeef> You cannot process a nim module with a macro really you can use `parseStmt` and `parseExpr` as a hack but it's not proper
20:14:02FromDiscord<Andreas> In reply to @Elegantbeef "You cannot process a": great, i'll try that. I just need the exported routine-Nodes and Consts..
20:14:29FromDiscord<Elegantbeef> Well it's not the greatest solution as you do not get symbols
20:16:24FromDiscord<jmgomez> @Andreas in case it's helpful for you https://github.com/jmgomez/NimForUE/blob/master/src/nimforue/codegen/projectinstrospect.nimโ†ตAt the time of writing this Im working on this, it uses it to parse NimCode into an intermediary type. For now it only retrieves types but I plan to expand it
20:17:02FromDiscord<Andreas> In reply to @jmgomez "<@754284517316886598> in case it's": thx, i'll take a look..
20:17:50FromDiscord<demotomohiro> @ElegantBeef I have added a link to fungus in my Nim FAQ: https://internet-of-tomohiro.netlify.app/nim/faq.en.html#type-how-to-store-different-types-in-seqqmark
20:19:02*Notxor quit (Remote host closed the connection)
20:19:24*derpydoo quit (Quit: derpydoo)
20:22:42FromDiscord<Hourglass [She/Her]> What happens if you `return` in a template?
20:22:57FromDiscord<Elegantbeef> You insert a return where it's called
20:24:12FromDiscord<Hourglass [She/Her]> Ah, so how do I give a value to the call site then? Just giving the variable name directly?
20:24:24FromDiscord<Elegantbeef> yes you make an expression
20:24:27FromDiscord<Elegantbeef> Or just make a proc
20:24:33FromDiscord<jmgomez> In reply to @Andreas "thx, i'll take a": getAllModule from recieves a entry point (path) and return all modules that it finds like if you pass the entry point of your project it should get all. Doesnt support includes neither searchPaths yet
20:24:46FromDiscord<Hourglass [She/Her]> Alr sweet thanks!
20:25:49FromDiscord<jmgomez> I started it to dont bind manually bound object from Unreal and now Im amplifying to auto gen some types in the vm bindings. I plan to do a NimSuggest companion with it in the future
20:26:22FromDiscord<demotomohiro> !eval template foo(a, b: int) = a + b; echo foo(2, 3)
20:26:29NimBot<no output>
20:27:50FromDiscord<Dale> How do I make `Rune` literals?
20:29:00FromDiscord<Dale> sent a code paste, see https://play.nim-lang.org/#ix=4rOF
20:30:41FromDiscord<firasuke> The vscode plugin uses `nimlangserver` and I think modern LSP configurations should switch to `nimlangserver` as it works better with the latest versions of `nimsuggest` compared to `nimlsp`...
20:31:10FromDiscord<Elegantbeef> sent a code paste, see https://play.nim-lang.org/#ix=4rOG
20:32:44FromDiscord<Elegantbeef> `rune"("` now works
20:33:14FromDiscord<Dale> Hmm
20:33:43FromDiscord<Dale> So `static` implies a constant, so this is all compile-time stuff right?
20:33:54FromDiscord<huantian> indeed
20:33:59FromDiscord<Dale> \o/
20:34:11FromDiscord<Dale> Brilliant, thanks!
20:34:14FromDiscord<huantian> it also makes sure at compile time that the string you provide only has one rune
20:34:21FromDiscord<Elegantbeef> Hence `error` and not `raise`
20:34:24FromDiscord<Dale> Yeah I got that much
20:34:52FromDiscord<huantian> man Nim is so cool when compile time checks are this easy
20:36:41*jmdaemon joined #nim
20:40:15FromDiscord<jmgomez> it doesnt stop to blow my mind, to have the vm at compile time is so good that I cant think of using a lang that doesnt have something similar anymore
20:41:44FromDiscord<Elegantbeef> Yea it's quite wonderful to have it
20:42:13FromDiscord<Elegantbeef> Rust has issues with compile time strings in that they're constant C strings and not Rust's runtime strings
20:42:22FromDiscord<Elegantbeef> So operations that operate on Rust strings are not usable at compile time
20:44:37FromDiscord<Elegantbeef> Wonder if Zig's comptime has similar issues, probably does
20:44:38FromDiscord<Elegantbeef> Jai just has compile time evaluation blocks which compiles the code then runs it
20:46:48FromDiscord<firasuke> so what's the standard way of handling values that might be present or not? using `options` similar to Rust, or just `try` and `except ErrorNotPresent`?
20:47:15FromDiscord<Elegantbeef> Depends on you really
20:47:41FromDiscord<Elegantbeef> I generally prefer the semantics of exceptions, but options/results are technically less harmful
20:48:05FromDiscord<firasuke> oh ok
20:48:27FromDiscord<firasuke> and for handling exceptions, can you try a bunch of times, then have a separate section for exceptions based on types?
20:48:42FromDiscord<huantian> I personally lean towards `Option`, but depending on the situation exceptions might work better
20:48:43FromDiscord<jmgomez> In reply to @Elegantbeef "Jai just has compile": do you have access to it or read it somewhere?
20:48:58FromDiscord<firasuke> In reply to @huantian "I personally lean towards": oh ok
20:49:22FromDiscord<jmgomez> I also prefer options/result, but I do use exceptions for some stuff
20:50:53FromDiscord<Elegantbeef> Regret it most the time cause jblow can be a tool
20:50:54FromDiscord<Elegantbeef> https://www.youtube.com/watch?v=XLVjSeusPYg points to this video in particular
20:50:57FromDiscord<Elegantbeef> sent a code paste, see https://play.nim-lang.org/#ix=4rOM
20:50:59FromDiscord<Elegantbeef> I've watched some of jblow's streamsโ†ต(@jmgomez)
20:51:35*rockcavera quit (Read error: Connection reset by peer)
20:51:55*rockcavera joined #nim
20:51:58FromDiscord<Elegantbeef> I just hate the semantics of options/results, it pollutes the user code even if they do not care
20:52:42FromDiscord<jmgomez> In reply to @Elegantbeef "I just hate the": I guess that's somehow correlated with you dont inclination to use pattern matching
20:53:06FromDiscord<firasuke> sent a code paste, see https://paste.rs/iG7
20:53:06FromDiscord<huantian> well with option i think it depends, sometimes you use it to handle errors which I'm 50/50 on, but a lot of the time it makes sense for values where not having a value is completely valid
20:53:23FromDiscord<Elegantbeef> I mean i do not disagree the huan
20:53:54FromDiscord<Elegantbeef> The point of options is generally to give n + 1 values
20:54:01FromDiscord<jmgomez> In reply to @Elegantbeef "I just hate the": In the past I used to do a more railway oriented programming but since Nim doesnt have neat inference I sometimes found myself opening it more often
20:54:07FromDiscord<Elegantbeef> Using n + 1 as a sentinel is generally what is considered
20:54:42FromDiscord<firasuke> I don't mind that
20:54:44FromDiscord<firasuke> sent a code paste, see https://play.nim-lang.org/#ix=4rOO
20:55:34FromDiscord<Elegantbeef> To each their own, I just do not think the approach to errors validates constantly checking if one doesnt care ๐Ÿ˜„
20:55:53FromDiscord<firasuke> oh ok xD
20:56:03FromDiscord<Elegantbeef> Talking to jm with that
20:58:33FromDiscord<jmgomez> yes, I agree with that. It also has to do with ergonomics if it doesnt add friction to the code to do it because the lang offers constructors it may make more sense. In Nim I just tend to be more practical
20:59:53FromDiscord<huantian> Since I write write user facing app code, I handle a lot of errors the same way: crash and give the user an error message ๐Ÿ˜›
21:01:40FromDiscord<Hourglass [She/Her]> sent a code paste, see https://play.nim-lang.org/#ix=4rOS
21:01:54FromDiscord<Hourglass [She/Her]> I would test on my PC and with a newer version but don't have access to my PC rn
21:01:56FromDiscord<Elegantbeef> string streams are memory based
21:02:06FromDiscord<Elegantbeef> The issue is likely IO related
21:02:38FromDiscord<Elegantbeef> Might not have permissions or something like that, or in termux you need to use a different API to write files?
21:02:41FromDiscord<Elegantbeef> I do not really know
21:02:57FromDiscord<Elegantbeef> Alternatively the File io is broke on termux
21:03:34FromDiscord<Elegantbeef> Does `let theFile = open("myFile", fmWrite); theFile.write("hello"); flushFIle(theFile);` work?
21:04:27FromDiscord<Hourglass [She/Her]> Let me rjn that now, is it fine to use that in `inim`?
21:04:52FromDiscord<Hourglass [She/Her]> It should work tho since writing files normally work
21:04:58FromDiscord<Elegantbeef> Probably
21:05:04FromDiscord<Hourglass [She/Her]> Yep that works
21:05:38FromDiscord<Elegantbeef> Well something is either wrong with your stream or with the API for termux
21:05:46FromDiscord<Hourglass [She/Her]> Also instead of using a `newFileStream`, `newStringStream` then writing the contents to a file using `writeFile(strm.readAll)` also works
21:06:05FromDiscord<Hourglass [She/Her]> In reply to @Elegantbeef "Well something is either": Aight, I'll take a look whenever I can on PC
21:27:35*fallback joined #nim
21:34:52*kenran quit (Remote host closed the connection)
21:39:01FromDiscord<Dale> So here https://nim-lang.org/docs/unicode.html#runeAtPos%2Cstring%2Cint there is a warning. I need to check individual unicode chars, so is the ideal solution to convert my string into a `seq[Rune]` before I start to work with it?
21:42:21FromDiscord<Elegantbeef> Indexing a Utf8 is a O(n) operation, so if you want a O(1) lookup yes
21:43:36FromDiscord<Elegantbeef> If you're just iterating there is an iterator `runes`
21:44:18FromDiscord<Dale> I'm doing a token scanner, so it's not a straightforward iter
21:44:59FromDiscord<Elegantbeef> So then yes you may want to convert it into a `seq[Rune]`
21:45:01*beholders_eye quit (Ping timeout: 240 seconds)
21:47:06Zevvscanning/lexing can probably be done from an iterator
21:47:30Zevvwhat beef says: sequentially you're ok, but if you want random access, you pbly want to convert
21:48:05FromDiscord<Dale> I had that intuition, but I don't want to deviate from the book too much until I fully understand the work
21:50:25Zevvwat are you doing exactly
21:53:23FromDiscord<Dale> Bob Nystrom's book https://craftinginterpreters.com/scanning.html#lexemes-and-tokens
21:53:36FromDiscord<Dale> Mainly as an exercise to scope out nim
21:53:52Zevvnice.
21:53:55FromDiscord<Dale> I'm gonna do the second half in zig
21:54:16FromDiscord<Dale> I really like the look of both nim and zig, so I thought this would be a cool way to try them both
21:54:17Zevvparse away!
21:54:35FromDiscord<Dale> I'm trying! haha
21:54:57Zevvit's a nice topic to concentrate on; you need a bit of the stdlib, do some string handling, seqs and the like. good.
21:55:09FromDiscord<Dale> Have a weird error now. The `rune` proc that Beef provided earlier doesn't play nice with escapes it seems
21:55:26FromDiscord<Elegantbeef> `rune "\..."` will work
21:55:30Zevvyeah beef usually is just rambling, don't trust the man
21:55:31FromDiscord<Dale> `rune"\0"` is causing compile error
21:55:35FromDiscord<Dale> haha
21:55:37FromDiscord<Elegantbeef> It's not the proc it's the generalised string literal
21:55:55FromDiscord<Elegantbeef> `rune"\0"` is parsed as `rune("\\0")`
21:56:26FromDiscord<Elegantbeef> Zevv you know me better than I know me
21:56:38Zevvare you sure you *need* runes? in practice, it's often very much ok to handle UTF8 just like any other string, it's just a seq of bytes
21:57:05Zevvyeah true, I know you better than I know me
21:57:08Zevvno wait
21:57:08FromDiscord<Elegantbeef> Especially for language tokens
21:57:13*fallback quit (Read error: Connection reset by peer)
21:57:24FromDiscord<Elegantbeef> Like it's not like you're going to use unicode `(` or `{`
21:58:11Zevvwell, if you are tokenizing, it usually should not matter. You can just tokenize a ยท like any other character.
21:58:14FromDiscord<Dale> Well I think any new lang like this should do UTF-8 as a standard, and I intuited that there could be edge cases I'm not aware of, and I wanna learn this stuff anyway, so why not
21:58:15FromDiscord<Elegantbeef> Unicode is more important if you're doing string operations
21:58:29Zevvor doin layouting, needing string lengths etc
21:58:52FromDiscord<Elegantbeef> You generally do not care if something is a unicode string in a programming language
21:58:58Zevvwell, it depends on what you mean with 'UTF-8 as a standard'
21:59:17ZevvUTF-8 and unicode are related; UTF-8 is "just a string", but unicode is hell with tons of huge tables
21:59:26FromDiscord<Elegantbeef> Like if you declare a variable with a utf8 symbol comparisons are the same
21:59:48FromDiscord<Elegantbeef> It just works there is no extra logic needed two strings are equal if they contain the same content
22:00:07Zevventers unicode normalization
22:00:20FromDiscord<Elegantbeef> Lol
22:00:56FromDiscord<Dale> Hrm
22:01:30FromDiscord<Dale> So I should be okay just treating everything as a stream of bytes then
22:02:06FromDiscord<Dale> I mean, it would be interesting to allow unicode for identifiers
22:02:18FromDiscord<Elegantbeef> It's 0 work to allow unicode for identifiers
22:02:18Zevvsure, but you can do that, like any identifier
22:02:36FromDiscord<Elegantbeef> A unicode identifier is no different to just an ascii identifier
22:02:40Zevvany unicode character or sequence of unicode characters is "just a string" in UTF-8
22:02:43FromDiscord<Dale> Oh yeah, because they are going to be seqs of bytes anyway
22:02:48Zevvright, you got it
22:02:52FromDiscord<Elegantbeef> in your tokeniser you're searching for a space proceeding and succeeding a space
22:03:52FromDiscord<Elegantbeef> anything inbetween two spaces is an identifier, if you then want to enforce rules on that identifier like "No underscores, no leading capital, ..." that's when you might need Unicode
22:04:17FromDiscord<Elegantbeef> Since you're not processing the string you do not care if someone wrote an entire essay with unicode emojis ๐Ÿ˜„
22:04:49FromDiscord<Dale> Yeah. Well, I'm not a fan of strict formatting (one of the biggest reason I don't like Go) so that's not an issue
22:05:22FromDiscord<Dale> I do like the idea of allowing unicode, it allows you to write super minimal code golf stuff, which I'm really into
22:07:05FromDiscord<Elegantbeef> I love Go's "capital's are exported" whilst supporting unicode identifiers
22:07:06FromDiscord<Elegantbeef> It means so much non english code uses like `T` followed by non ascii characters
22:07:07FromDiscord<Elegantbeef> Atleast i've seen a fair bit of Chinese Nim code that follows that where `T` is like an export marker
22:07:07FromDiscord<Elegantbeef> Someone should've mentioned not all languages have glyphs which are considered capitals ๐Ÿ˜„
22:07:28FromDiscord<Elegantbeef> Bleh
22:08:04Zevvjust don't write parsers by hand, eh :)
22:08:15FromDiscord<Dale> Here's an example of what I meant btw https://lafolie.itch.io/golf-560
22:08:31FromDiscord<Dale> The whole game is 560 chars
22:09:15FromDiscord<Dale> but anyways, yeah I should probably revert this back to using strings then
22:13:14FromDiscord<Elegantbeef> Quite literal code golf eh
22:13:35FromDiscord<Dale> Oh right, haha, didn't mean to make a pun!
22:13:40FromDiscord<Dale> I've a few more on my profile
22:13:46FromDiscord<Dale> but that's my favourite
22:15:37FromDiscord<Elegantbeef> Grapheme code golf is always so weird
22:16:38FromDiscord<Dale> The end result is always disgusting
22:17:31FromDiscord<Dale> I did a reduction for Tom Hall with this other fellow, we got it down from over 1k chars, and the end result was illegible
22:18:02FromDiscord<Dale> There's a way of doing 8-way movement with bitops as well, I can't even remember it it's so weird
22:21:03FromDiscord<Elegantbeef> Binary size golfing is much more interesting imo
22:21:10FromDiscord<Dale> I've often thought about a language designed specifically for it anyway, so I guess that's my overthinking the unicode come from
22:21:35FromDiscord<Dale> Yeah I prefer binary size, but Pico8 isn't compiled, so he had to use other limits
22:21:54FromDiscord<Dale> It's really jarring at first, but you learn to live with it
22:22:47FromDiscord<Dale> I really wanna make an ASM-based fantasy console as well. That'll be one reason I'm prospecting nim
22:23:57FromDiscord<Dale> I know few would use it, but I really enjoy ASM (at least, non-x86), and it'd be neat to have an FC that uses it, but is modernised in some ways to make the whole thing more pleasant than writing for a GameBoy or something
22:28:14FromDiscord<Dale> BAH I've done it again
22:28:25FromDiscord<Dale> Should I be using string even if it's a single char?
22:29:30FromDiscord<Dale> ...no because `someStr[n]` returns char
22:30:18FromDiscord<Dale> Oh you use `'`
22:31:00FromDiscord<Elegantbeef> WASM based fantasy console is the way to go
22:31:20FromDiscord<Elegantbeef> https://wasm4.org/ something like this
22:31:34FromDiscord<Dale> Well that would be the target arch. I would be making a VM that runs on there
22:31:57FromDiscord<Elegantbeef> No i mean using wasm as the target VM so it's capable of being written from any language
22:32:15FromDiscord<Elegantbeef> drastically increasing your prospective userbase
22:32:31FromDiscord<Dale> I think I misrepresented the idea. I would want the language for the console to be ASM
22:32:45FromDiscord<Dale> If you wanted to use something else, you'd have to write a compiler yourself
22:32:53FromDiscord<Elegantbeef> Oh i know, but that limits the prospective user base ๐Ÿ˜„
22:33:21FromDiscord<Dale> I know that, but the point is to have fun writing for something like it's the 80s haha
22:33:37FromDiscord<Elegantbeef> Just write WASM by hand with wasm4
22:36:03FromDiscord<Dale> I see where you're coming from, but that's not my little dream haha
22:39:25FromDiscord<Dale> Looking at the spec, WASM is way more convoluted than what I mean anyway
22:39:41FromDiscord<Dale> Though looking at some of these instructions I can see that a lot of thought went into it
22:40:05FromDiscord<Elegantbeef> Yea it's quite complicated, i just whore it whenever stuff like this comes up cause it's just the most sane approach to scripting imo
22:43:49FromDiscord<nimโ€™> nim
22:43:50FromDiscord<nimโ€™> otp
22:44:46FromDiscord<Dale> Pardon?
22:45:22FromDiscord<Dale> Well after much procrastinating, I switched back to plain chars and it compiles, so whoop
23:16:56*tiorock joined #nim
23:16:56*tiorock quit (Changing host)
23:16:56*tiorock joined #nim
23:16:56*rockcavera quit (Killed (erbium.libera.chat (Nickname regained by services)))
23:16:56*tiorock is now known as rockcavera
23:20:51FromDiscord<Elegantbeef> @planetis\: i now have a lame excuse for not using `(x: int,y: float)` for fungus
23:21:07FromDiscord<Elegantbeef> I now allow non tuples as the right hand
23:21:14FromDiscord<Elegantbeef> Which means you can type complex expressions there and it should work
23:21:28FromDiscord<Elegantbeef> https://github.com/beef331/fungus#non-tuple-types like so
23:54:50FromDiscord<Dale> Is it okay to use different sized values in object variants?
23:55:15FromDiscord<Dale> So, I could store an int or a string (obviously different sizes) in the union?
23:56:14FromDiscord<Dale> Oh, the docs do so in an example. Hmm, so I guess internally the string will be a pointer or something
23:58:09FromDiscord<Dale> and if I'm reading this right, the value used in the case statement is actually a property of your object, and not just used to control the variant
23:58:10FromDiscord<Elegantbeef> It's completely fine
23:58:19FromDiscord<Elegantbeef> The largest branch is the size of the variant
23:58:44FromDiscord<Elegantbeef> It's just a `kind: type, union{a: ATyp, b: Btype}`
23:58:53FromDiscord<Dale> Right, but a string is of unknown length, so I assume that's gonna boil down to a ptr
23:59:11FromDiscord<Dale> Yeah
23:59:19FromDiscord<Elegantbeef> A string on arc/orc is a `int, pointer`
23:59:26FromDiscord<Elegantbeef> On refc a string is a `pointer`
23:59:55FromDiscord<Dale> Good to know, thanks! I know it doesn't matter so much, it's just a case of getting my head around it