00:00:29 | * | azimut joined #nim |
00:16:34 | FromDiscord | <vmawz> sent a code paste, see https://play.nim-lang.org/#ix=4rKB |
00:19:05 | FromDiscord | <Yardanico> In reply to @vmawz "How do I prompt": uhh |
00:19:10 | FromDiscord | <Yardanico> it's literally called that and it's in the os https://nim-lang.org/docs/os.html#isAdmin |
00:19:15 | FromDiscord | <Yardanico> so your code just works if you have an up-to-date nim |
00:25:55 | * | fallback joined #nim |
00:26:04 | FromDiscord | <vmawz> In reply to @Yardanico "it's literally called that": What? |
00:26:09 | FromDiscord | <Yardanico> ? |
00:26:17 | FromDiscord | <vmawz> isAdmin tells you if it's ran as admin, not ask for admin |
00:26:26 | FromDiscord | <Yardanico> ah you want to prompt, sorry, sleepy brain :(( |
00:26:42 | FromDiscord | <vmawz> Yes |
00:51:09 | FromDiscord | <vmawz> I attempted `&"runas /profile /user:administrator {getAppFilename()}"` but doesn't prompt UAC |
00:51:24 | FromDiscord | <vmawz> If you know a solution please tell |
00:52:28 | FromDiscord | <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:24 | Guest93 | how to generate code which is called when the scope of a function is left? |
01:54:21 | NimEventer | New Nimble package! lodev - Simple reverse proxy server for local development., see https://github.com/vandot/lodev |
02:12:22 | FromDiscord | <Elegantbeef> Guest93 use orc and a destructor |
02:13:24 | FromDiscord | <Elegantbeef> unless this is just for a single function then use `defer` |
02:13:33 | FromDiscord | <Elegantbeef> or `try: ... finally:...` |
02:24:18 | FromDiscord | <vmawz> In reply to @etra "if it's for windows,": Thanks, I'll try a manifest |
02:25:31 | Guest93 | thx!!! |
02:30:10 | * | fallback joined #nim |
02:36:10 | * | Guest93 quit (Quit: Client closed) |
02:46:09 | FromDiscord | <sOkam!> @ElegantBeef is there a way to get pairs-like behavior for an `iterable[SomeType]`? |
02:46:26 | FromDiscord | <Elegantbeef> `import std/enumerate` |
02:46:45 | FromDiscord | <Elegantbeef> \`for i, x in enumerate splitLines("someString"\: |
02:47:11 | FromDiscord | <sOkam!> enumerate(iter) errors |
02:47:53 | FromDiscord | <Elegantbeef> What? |
02:47:59 | FromDiscord | <sOkam!> sent a code paste, see https://play.nim-lang.org/#ix=4rL2 |
02:48:46 | FromDiscord | <Elegantbeef> Oh god using the`iterable` type |
02:49:29 | FromDiscord | <sOkam!> its for some assimp importer code, i just copied from some implementation there |
02:49:53 | FromDiscord | <sOkam!> if there is a better way to do it, im all ears |
02:51:06 | FromDiscord | <Elegantbeef> sent a code paste, see https://play.nim-lang.org/#ix=4rL5 |
02:51:13 | FromDiscord | <Elegantbeef> `iterable` is a poorly implemented feature |
02:52:09 | FromDiscord | <Elegantbeef> sent a code paste, see https://play.nim-lang.org/#ix=4rL6 |
02:52:25 | FromDiscord | <sOkam!> yeah i think i didn't import enumerate or something when i tried |
02:52:49 | FromDiscord | <Elegantbeef> lol |
03:17:44 | FromDiscord | <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:36 | FromDiscord | <Dale> https://hastebin.skyra.pw/acazeyeluc.nim |
03:21:22 | * | fallback quit (Read error: Connection reset by peer) |
03:21:44 | FromDiscord | <huantian> Youโd need to do `parseopt.getopt(p)` |
03:22:11 | FromDiscord | <Dale> Ah! UFCS, right? |
03:22:21 | FromDiscord | <huantian> Yeah |
03:22:53 | FromDiscord | <huantian> With Nim people very rarely do import nil because you wonโt be able to reap the benefits of UFC syntax |
03:23:18 | FromDiscord | <Dale> Yeah I wasn't aware of that, but at the same time I do like being explicit that way. Damn |
03:23:40 | FromDiscord | <Dale> Thank you :) |
03:44:18 | FromDiscord | <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:13 | FromDiscord | <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:27 | FromDiscord | <Gumbercules> Discord has horrible search / information retrieval properties |
04:05:50 | FromDiscord | <Elegantbeef> Be like phil and make a question and answer it on SO |
04:07:03 | FromDiscord | <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:47 | FromDiscord | <vmawz> In reply to @Gumbercules "I'll let <@1056763166262042634> decide": I don't know any good forums ๐ |
04:09:01 | FromDiscord | <Gumbercules> Beef suggested stack overflow |
04:09:17 | FromDiscord | <Gumbercules> which I would advocate for as well - it is well indexed by search engines so pretty easy to find answers there |
04:09:36 | FromDiscord | <Gumbercules> or maybe we should ask whoever maintains the winim repo to add it as a test / example |
04:09:53 | FromDiscord | <vmawz> In reply to @Gumbercules "or maybe we should": I agree, their docs are terrible |
04:09:58 | FromDiscord | <vmawz> Ngl |
04:10:36 | FromDiscord | <vmawz> But it's basically just winapi so |
04:10:44 | FromDiscord | <Gumbercules> Doesn't look like they've been very active |
04:10:48 | FromDiscord | <Gumbercules> (edit) "Doesn't look like they've been very active ... " added "lately" |
04:11:06 | FromDiscord | <vmawz> `Error: 'nil' is now invalid for 'string'; usage of '==' ` nim errors frustrate me, this doesn't make any sense |
04:11:34 | FromDiscord | <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:48 | FromDiscord | <Gumbercules> strings are value types now |
04:12:04 | FromDiscord | <Gumbercules> so you can't compare them to `nil` - you should do `len(str) == 0` |
04:12:10 | FromDiscord | <vmawz> I'm new to Nim so idk anything |
04:12:28 | FromDiscord | <vmawz> In reply to @Gumbercules "so you can't compare": I thought it was strlen |
04:12:44 | FromDiscord | <vmawz> strlen(string) |
04:12:46 | FromDiscord | <Gumbercules> nope - `len` is used for `seq[T]` and `string` |
04:13:00 | FromDiscord | <Gumbercules> strings use `seq` under the hood anyway |
04:13:16 | FromDiscord | <Gumbercules> both are value types - so you do `len(s) == 0` to check for an empty string or sequence |
04:13:32 | FromDiscord | <Gumbercules> they are still allocated on the heap |
04:13:45 | FromDiscord | <vmawz> `s == ""` would work right? |
04:14:05 | FromDiscord | <Gumbercules> sure |
04:14:14 | FromDiscord | <vmawz> Okay thanks for the help |
04:14:38 | FromDiscord | <Gumbercules> `len` is probably more efficient since the length is stored in the datastructure itself |
04:14:55 | FromDiscord | <vmawz> Why is my Nim program being flagged in windows defender, it's fine? |
04:15:09 | FromDiscord | <vmawz> In reply to @Gumbercules "`len` is probably more": Yeah I'm using len I was just curious |
04:15:14 | FromDiscord | <Gumbercules> yeah - some people have written malware in Nim so it gets flagged by Windows AV |
04:15:24 | FromDiscord | <vmawz> In reply to @Gumbercules "yeah - some people": That sucks |
04:15:29 | FromDiscord | <Gumbercules> it's being worked on I believe |
04:15:50 | FromDiscord | <vmawz> Theoretically, EDR shouldn't know it's made in Nim at all since it's compiled to C |
04:16:39 | FromDiscord | <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:15 | FromDiscord | <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:32 | FromDiscord | <vmawz> Hm |
04:18:01 | FromDiscord | <vmawz> How long have you been learning Nim? |
04:18:13 | FromDiscord | <Gumbercules> I've been coding in Nim for a little over 7 years now |
04:18:26 | FromDiscord | <vmawz> 7 years?? |
04:18:30 | FromDiscord | <Gumbercules> Yeah |
04:18:31 | FromDiscord | <Gumbercules> https://github.com/zacharycarter |
04:18:52 | FromDiscord | <vmawz> You must be an expert |
04:21:04 | FromDiscord | <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:16 | FromDiscord | <Gumbercules> I shouldn't say probably - I should say definitely ๐ |
04:21:56 | FromDiscord | <vmawz> I've got a lot of learning to do |
04:22:07 | FromDiscord | <vmawz> Just started yesterday |
04:22:09 | FromDiscord | <Gumbercules> Easy does it and have fun ๐ |
04:22:49 | FromDiscord | <vmawz> It's fairly easy compared to other languages |
04:23:41 | FromDiscord | <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:09 | FromDiscord | <Gumbercules> Yeah, I think it all depends on what you're trying to do with the language and your prior experience |
04:24:15 | FromDiscord | <vmawz> Is there a better way to do `cast[HKEY](0x80000002)` |
04:24:21 | FromDiscord | <Gumbercules> If you have a lot of C/C++ experience you should be good |
04:24:30 | FromDiscord | <vmawz> In reply to @Gumbercules "If you have a": Sadly I have none |
04:24:46 | FromDiscord | <vmawz> I'm more into web automation so I don't think I'll need it |
04:25:12 | FromDiscord | <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:14 | FromDiscord | <Gumbercules> In reply to @vmawz "Is there a better": you can probably just do `HKEY(0x80000002)` |
04:26:27 | FromDiscord | <Gumbercules> I don't believe there's any need for a `cast` there |
04:26:39 | FromDiscord | <vmawz> I tried that with cstring but I got an error |
04:26:47 | FromDiscord | <Gumbercules> `cstring` is another beast |
04:26:58 | FromDiscord | <Gumbercules> `HKEY` is an alias for `HANDLE` which is an alias for `int` |
04:28:23 | FromDiscord | <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:26 | FromDiscord | <demotomohiro> cstring is `char` in C lang, you cannot simply convert int literal to cstring. |
04:28:41 | FromDiscord | <Gumbercules> In reply to @week old roadkill "hey guys just a": `csize_t` |
04:28:54 | FromDiscord | <week old roadkill> is it recommended for indexing and so forth? |
04:29:09 | FromDiscord | <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:45 | FromDiscord | <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:02 | FromDiscord | <demotomohiro> csize_t is for C inter op. `int` is usually used for indexing and array length in Nim stdlib. |
04:30:32 | FromDiscord | <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:50 | FromDiscord | <Gumbercules> I believe in Nim it is represented by `uint` |
04:30:55 | FromDiscord | <week old roadkill> im just using it to index a sequence |
04:31:00 | FromDiscord | <Gumbercules> and it's `importc`d |
04:31:12 | FromDiscord | <week old roadkill> as i would in c to index any array |
04:31:13 | FromDiscord | <Gumbercules> if you're not interoping with C you could just use `int` |
04:31:23 | FromDiscord | <Gumbercules> as @demotomohiro suggested |
04:32:42 | FromDiscord | <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:47 | FromDiscord | <vmawz> In reply to @vmawz "What is this? `Error:": Huh? I assigned it: `let result = ShellExecute(...)` and now it works fine? |
04:33:56 | FromDiscord | <vmawz> Nvm just forgot to discard it |
04:34:06 | FromDiscord | <vmawz> I'm still probably wrong though |
04:35:52 | FromDiscord | <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:36 | FromDiscord | <Elegantbeef> Nim unlike C has `int` be a 64bit integer |
04:36:47 | * | azimut quit (Ping timeout: 255 seconds) |
04:36:48 | FromDiscord | <Elegantbeef> Well it's arch specific |
04:37:24 | FromDiscord | <Elegantbeef> So atleast on 64 bit there is no reasonable way presently to hit the max of the value ๐ |
04:37:43 | FromDiscord | <demotomohiro> sizeof int and pointer is always same in Nim. |
04:37:47 | FromDiscord | <Elegantbeef> If you need more than int.high elements in a sequence, might i request your ram modules |
04:38:54 | FromDiscord | <Gumbercules> garbage collection is for poor people - just buy more RAM |
04:39:16 | FromDiscord | <Gumbercules> same with `free` |
04:39:16 | FromDiscord | <Elegantbeef> Still int.high of any type in a sequence is a lot of ram |
04:39:28 | FromDiscord | <demotomohiro> !eval echo sizeof(int), ", ", sizeof(cint), ", ", sizeof(ptr int) |
04:39:33 | NimBot | 8, 4, 8 |
04:39:33 | FromDiscord | <Elegantbeef> Using a NAS ram disk? |
04:42:35 | FromDiscord | <demotomohiro> I use ARC because I am poor and my raspberry pi pico has only 264kb memory. |
04:42:57 | FromDiscord | <Elegantbeef> Download more ram |
04:43:58 | FromDiscord | <Gumbercules> I was just referencing some dumb meme ๐ I don't actually think that about garbage collection |
04:44:33 | FromDiscord | <Elegantbeef> Of course you are, do not want to out that you have a petabyte of ram |
04:54:19 | FromDiscord | <Phil> In reply to @Elegantbeef "If you need more": The internet is my RAM module! |
05:06:15 | FromDiscord | <Dale> CPU: AMD Ryzen RAM: Amazon AWS |
05:37:09 | * | arkurious quit (Quit: Leaving) |
06:29:56 | FromDiscord | <Phil> Small news update, Docker did a complete 180 and free tier organizations are no longer going to die! |
06:30:02 | FromDiscord | <Phil> Which is nice for the nim images |
07:16:13 | FromDiscord | <Phil> Can I tell the smtp module to have a timeout? |
07:16:28 | FromDiscord | <Phil> Because I know it's failing to authenticate, but it's taking a solid minute for it to do so |
07:17:36 | FromDiscord | <Phil> sent a code paste, see https://play.nim-lang.org/#ix=4rLL |
07:34:48 | FromDiscord | <kcvinker> How to get the address of a string ? |
07:36:11 | FromDiscord | <Elegantbeef> Why do you need it? |
07:37:12 | FromDiscord | <kcvinker> sent a code paste, see https://play.nim-lang.org/#ix=4rLO |
07:47:01 | FromDiscord | <Elegantbeef> Ok you want `srcString[0].unsafeaddr` |
07:47:51 | FromDiscord | <Elegantbeef> or `cstring(srcString)` |
07:51:04 | * | rockcavera quit (Remote host closed the connection) |
07:58:38 | FromDiscord | <Elegantbeef> I'd also say consider naming it `utf16Str` so you can do `utf16Str"MyString"` but ymmv |
08:06:36 | FromDiscord | <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:55 | FromDiscord | <firasuke> how do you control/disable wrapping for nimpretty formatting on save? |
10:03:20 | FromDiscord | <Phil> Nim pretty, produce of number of whitespaces, is not configurable |
10:03:32 | FromDiscord | <Phil> (edit) "produce" => "outside" |
10:10:46 | NimEventer | New thread by Bosinski: Iteration against a C-API, see https://forum.nim-lang.org/t/10035 |
10:17:58 | FromDiscord | <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:58 | FromDiscord | <kcvinker> sent a code paste, see https://play.nim-lang.org/#ix=4rMu |
10:34:47 | FromDiscord | <Yardanico> what does this do? |
10:34:49 | FromDiscord | <Yardanico> convert utf-8 to utf-16? |
10:35:05 | FromDiscord | <Yardanico> i think https://nim-lang.org/docs/widestrs.html does the same? |
10:43:04 | FromDiscord | <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:29 | FromDiscord | <firasuke> Do we have a working treesitter parser for nim? |
11:15:24 | FromDiscord | <vmawz> Anyone know how to run a powershell command without a console appearing? |
11:15:38 | FromDiscord | <vmawz> -WindowStyle Hidden flashes for a split second |
11:15:58 | FromDiscord | <kcvinker> sent a code paste, see https://play.nim-lang.org/#ix=4rMA |
11:16:29 | FromDiscord | <kcvinker> (edit) "https://play.nim-lang.org/#ix=4rMA" => "https://play.nim-lang.org/#ix=4rMB" |
11:19:15 | FromDiscord | <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:28 | FromDiscord | <vmawz> In reply to @Isofruit "Check the docs of": I need powershell though |
11:20:19 | FromDiscord | <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:59 | FromDiscord | <federico3> can I get a seq of field names from a tuple definition? |
11:56:37 | FromDiscord | <firasuke> I can't install `nimlsp` using `nimble install` |
12:00:39 | * | derpydoo joined #nim |
12:03:59 | FromDiscord | <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:13 | FromDiscord | <firasuke> lemme check |
12:04:39 | FromDiscord | <firasuke> and no I have not xD |
12:10:32 | FromDiscord | <enthus1ast> @vmawz\: it should work when you spawn the process powershell.exe |
12:10:40 | FromDiscord | <enthus1ast> and give it the right params |
12:10:54 | FromDiscord | <vmawz> In reply to @enthus1ast "and give it the": Nope |
12:11:11 | FromDiscord | <vmawz> Powershell opens and then reads the flags so it hides after already being open |
12:11:41 | FromDiscord | <vmawz> I can make it slightly better by using `cmd /c start /min` but it still appears in taskbar |
12:12:21 | FromDiscord | <enthus1ast> https://nim-lang.org/docs/osproc.html#ProcessOption try poDaemon |
12:12:36 | FromDiscord | <enthus1ast> with the startProcess proc |
12:13:16 | FromDiscord | <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:57 | FromDiscord | <michaelb.eth> In reply to @firasuke "ok it failed as": What OS and what version of Nim are you using? |
12:15:32 | FromDiscord | <firasuke> In reply to @michaelb.eth "What OS and what": I'm on Linux, using nim 1.6.10 |
12:16:04 | FromDiscord | <michaelb.eth> How is Nim installed? |
12:16:14 | FromDiscord | <michaelb.eth> with choosenim? |
12:29:53 | FromDiscord | <Yardanico> In reply to @michaelb.eth "with choosenim?": the path obviously indicates it's a sytsem install |
12:30:09 | FromDiscord | <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:17 | FromDiscord | <Yardanico> (edit) "sytsem" => "system" |
12:30:28 | FromDiscord | <firasuke> oh ok |
12:30:58 | FromDiscord | <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:14 | FromDiscord | <michaelb.eth> (edit) "by" => "but" |
12:31:38 | FromDiscord | <firasuke> the `choosenim` has some bashisms in it |
12:32:27 | FromDiscord | <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:33 | FromDiscord | <Yardanico> there's also an option of a manual nim install from source of course |
12:32:39 | FromDiscord | <Yardanico> <https://github.com/dom96/choosenim/releases/tag/v0.8.4> |
12:32:59 | FromDiscord | <firasuke> oh ok |
12:36:48 | FromDiscord | <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:58 | FromDiscord | <firasuke> ok using `choosenim` made nimlangserver build successfully |
12:48:34 | * | nanxiao joined #nim |
12:53:26 | FromDiscord | <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:33 | FromDiscord | <Yardanico> <https://github.com/PMunch/nimlsp> |
12:53:59 | FromDiscord | <firasuke> I see, thanks |
13:02:36 | FromDiscord | <week old roadkill> sent a code paste, see https://play.nim-lang.org/#ix=4rMU |
13:02:45 | FromDiscord | <week old roadkill> im really struggling with this |
13:03:16 | * | nanxiao quit (Quit: Client closed) |
13:25:08 | * | nanxiao joined #nim |
13:26:49 | FromDiscord | <kcvinker> Where I can get a list of equivalent c data types for nim primitives ? |
13:29:22 | FromDiscord | <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:43 | FromDiscord | <kcvinker> Thanks @michaelb.eth |
13:29:50 | FromDiscord | <michaelb.eth> But theyโre not grouped in a list of equiv types as such |
13:31:37 | FromDiscord | <kcvinker> In reply to @michaelb.eth "But theyโre not grouped": No probs. I think I can find from that page. ๐ |
13:40:54 | FromDiscord | <firasuke> what should I use for syntax highlighting in nvim? |
13:41:18 | FromDiscord | <week old roadkill> In reply to @firasuke "what should I use": i use `https://github.com/alaviss/nim.nvim` |
13:41:48 | FromDiscord | <firasuke> don't we have a working treesitter parser? |
13:42:40 | FromDiscord | <week old roadkill> i dont know but if there is a treesitter parser its not recognized by `nvim-treesitter` |
13:43:17 | FromDiscord | <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:30 | FromDiscord | <kcvinker> How to convert a `WideCStringObj` to nim string ? |
14:38:24 | FromDiscord | <kcvinker> Using `$` ? |
14:42:16 | * | kenran joined #nim |
14:47:09 | Amun-Ra | looks that way |
14:55:27 | FromDiscord | <Hourglass [She/Her]> Trying to make a brainfuck interpreter in Nim again, but loops are horrid |
14:55:59 | FromDiscord | <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:50 | FromDiscord | <Hourglass [She/Her]> Finally fixed it! |
15:51:53 | FromDiscord | <elgringo> If heard that nim is bad for malware dev? Anyone agree or disagree with this, and why? |
15:52:03 | FromDiscord | <elgringo> (edit) "If" => "I've" |
15:54:27 | FromDiscord | <Phil> ? |
15:55:49 | FromDiscord | <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:51 | FromDiscord | <elgringo> sorry, should've prefaced it... Hello, Malware analysis here ๐ |
15:57:23 | FromDiscord | <Phil> I think your go to likely is the security channel. Mratsim who does security related stuff hangs out there afaik |
15:57:35 | FromDiscord | <elgringo> Thanks, Ill move to that channel |
15:59:23 | FromDiscord | <enthus1ast> the security channel is not on bridged to matrix yet right? |
16:00:05 | FromDiscord | <week old roadkill> sent a code paste, see https://play.nim-lang.org/#ix=4rNz |
16:00:39 | FromDiscord | <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:46 | FromDiscord | <enthus1ast> who does the discord \<-\> matrix bridges btw? |
16:00:58 | FromDiscord | <week old roadkill> (edit) "setter" => "getter" |
16:01:03 | FromDiscord | <week old roadkill> this 2nd setter also removes the necessity for me to have a setter at all |
16:01:09 | FromDiscord | <week old roadkill> (edit) "setter" => "getter" |
16:02:32 | FromDiscord | <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:35 | FromDiscord | <Phil> Generally those with admin rights on discord have the most to weigh in here. |
16:12:59 | FromDiscord | <Phil> (Regarding matrix discord bridges, for discord irc bridges Yard has the most knowledge) |
16:14:02 | FromDiscord | <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:27 | FromDiscord | <Phil> sent a code paste, see https://play.nim-lang.org/#ix=4rNG |
16:20:27 | FromDiscord | <Yardanico> yes, memory allocations were never a side effect in Nim |
16:24:01 | FromDiscord | <enthus1ast> @Yardanico\: can i open an issue somewhere (about bridgeing the nim security channel, from discord to matrix) |
16:24:27 | FromDiscord | <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:34 | FromDiscord | <Yardanico> https://t2bot.io/discord/ |
16:24:40 | FromDiscord | <Yardanico> the workflow is described here |
16:25:03 | FromDiscord | <Phil> Snatched and I'll add that to the community repo as documentation |
16:25:21 | FromDiscord | <enthus1ast> can someone ping an admin in the security channel (someone with discord \:) ) |
16:25:31 | FromDiscord | <enthus1ast> ๐ |
16:26:21 | FromDiscord | <Yardanico> me |
16:26:22 | FromDiscord | <Yardanico> did you do it on matrix side? |
16:26:32 | FromDiscord | <enthus1ast> i cant |
16:26:36 | FromDiscord | <enthus1ast> phil could |
16:26:41 | FromDiscord | <Yardanico> welp, i'll see if I'm an admin in the matrix side |
16:26:51 | FromDiscord | <Yardanico> for that channel |
16:27:08 | FromDiscord | <Yardanico> wait @enthus1ast there's no such channel in matrix at all |
16:27:16 | FromDiscord | <Yardanico> I honestly don't know what workflow we use to create channels in matrix |
16:27:20 | FromDiscord | <Yardanico> who does it? :P |
16:27:46 | FromDiscord | <Yardanico> ah, dom and leorize are the only two admins there, so @Phil add that to the doc too I guess :) |
16:27:49 | FromDiscord | <Yardanico> <https://app.element.io/#/room/#nim:envs.net> |
16:27:52 | FromDiscord | <enthus1ast> mh, maybe it must also be added to the community |
16:28:03 | FromDiscord | <enthus1ast> or how is it called now |
16:28:10 | FromDiscord | <Nilts> What does checkOverflowInt do and how do i disable it? |
16:28:34 | FromDiscord | <Phil> In reply to @Yardanico "ah, dom and leorize": Wait, so it makes sense to maintain a table over channel admin privileges? |
16:28:45 | FromDiscord | <Phil> (edit) "privileges?" => "privileges in matrix (as I don't think discord has that)?" |
16:29:03 | FromDiscord | <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:33 | FromDiscord | <Nilts> In reply to @not logged in "What does checkOverflowInt do": (causing issue with the js backend) |
16:29:50 | FromDiscord | <Yardanico> In reply to @not logged in "(causing issue with the": `--overflowChecks:off` i think |
16:30:08 | FromDiscord | <Nilts> In reply to @Yardanico "`--overflowChecks:off` i think": ok |
16:30:11 | FromDiscord | <Yardanico> https://nim-lang.org/docs/nimc.html |
16:30:15 | FromDiscord | <Yardanico> search for "Runtime checks" |
16:31:52 | FromDiscord | <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:13 | FromDiscord | <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:20 | FromDiscord | <Yardanico> https://app.element.io/#/room/#nim:envs.net |
16:33:00 | * | arkurious joined #nim |
16:38:30 | * | rockcavera joined #nim |
16:45:07 | FromDiscord | <Nilts> that fixed it, thanks! |
16:45:14 | FromDiscord | <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:10 | FromDiscord | <week old roadkill> sent a code paste, see https://play.nim-lang.org/#ix=4rNN |
16:47:14 | FromDiscord | <week old roadkill> (edit) "https://play.nim-lang.org/#ix=4rNN" => "https://paste.rs/ZRf" |
16:47:18 | FromDiscord | <week old roadkill> because i just ran into this by accident and nim allowed it |
16:47:21 | FromDiscord | <week old roadkill> https://media.discordapp.net/attachments/371759389889003532/1089229041111945488/image.png |
16:50:22 | Zevv | treeform: yes, but you need to sit on your hands and think before you type |
16:50:41 | Zevv | also, 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:01 | Zevv | and there is no proper run-time way to do this as well for all types, although it works for most things |
16:51:11 | Zevv | so you'll get an exception when you try to send something that is not properly isolated |
17:48:20 | FromDiscord | <Raynei486> sent a code paste, see https://play.nim-lang.org/#ix=4rNZ |
17:52:45 | FromDiscord | <planetis> In reply to @Raynei486 "Is there an elegant": No that's not the issue |
17:52:51 | FromDiscord | <Andreas> In reply to @Raynei486 "Is there an elegant": `$getFPS().cstring` |
17:53:09 | FromDiscord | <Raynei486> oh it's the conversion part |
17:53:12 | FromDiscord | <Raynei486> alright thanks |
17:53:27 | FromDiscord | <planetis> The issue is drawText accepting a cstring |
17:54:00 | FromDiscord | <planetis> And you can ignore it in that case |
17:56:00 | FromDiscord | <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:55 | FromDiscord | <week old roadkill> yea but there is a side effect to that function |
18:12:57 | FromDiscord | <firasuke> ok nimsuggest is crashing with neovim |
18:17:57 | * | kenran joined #nim |
18:27:21 | FromDiscord | <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:34 | FromDiscord | <Phil> Yes |
18:29:15 | FromDiscord | <Phil> sent a code paste, see https://play.nim-lang.org/#ix=4rOc |
18:29:38 | FromDiscord | <Dale> sent a code paste, see https://play.nim-lang.org/#ix=4rOd |
18:29:49 | FromDiscord | <Dale> That's super handy! |
18:32:10 | FromDiscord | <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:09 | FromDiscord | <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:12 | FromDiscord | <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:16 | FromDiscord | <Yardanico> In reply to @Dale "Quick question on implicit": it's not really about "being instantiated" |
18:33:30 | FromDiscord | <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:40 | FromDiscord | <Yardanico> so seqs and strings always have a valid default value (empty) |
18:33:48 | FromDiscord | <auxym> style preference ig. NEP-1 proposes to prefer result over return, except when control flow is required |
18:34:04 | FromDiscord | <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:15 | FromDiscord | <Yardanico> nimslp for any editors with LSP support |
18:34:29 | FromDiscord | <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:32 | FromDiscord | <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:45 | FromDiscord | <Dale> Implicit return is novel to me, so I want to try it |
18:34:59 | FromDiscord | <firasuke> In reply to @Yardanico "nimslp for any editors": nimlsp is crashing with neosuggest errors in neovim |
18:35:08 | FromDiscord | <Yardanico> In reply to @firasuke "nimlsp is crashing with": and what about alaviss' extension? |
18:35:11 | FromDiscord | <Yardanico> it uses nimsuggest directly by itself |
18:35:26 | FromDiscord | <Dale> Also this project is not meant to be used by anyone ever so may as well go nuts |
18:35:27 | FromDiscord | <Yardanico> https://github.com/alaviss/nim.nvim |
18:35:29 | FromDiscord | <firasuke> In reply to @Yardanico "and what about alaviss'": alaviss's extension is also crashing |
18:35:35 | FromDiscord | <Yardanico> really weird |
18:35:48 | FromDiscord | <Yardanico> any logs or something? and nim 1.6.12 right? |
18:36:48 | FromDiscord | <firasuke> yup 1.6.12 |
18:37:43 | FromDiscord | <firasuke> `nimsuggest instance for project stopped with exitcode:` |
18:37:48 | FromDiscord | <firasuke> (edit) "exitcode:`" => "exitcode: 1`" |
18:37:58 | FromDiscord | <firasuke> whenever I open any nim file |
18:38:12 | FromDiscord | <Yardanico> what happens if you just run `nimlsp` in terminal? |
18:38:28 | FromDiscord | <Yardanico> it should just run (it's listening to connections) without any output |
18:40:12 | FromDiscord | <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:29 | FromDiscord | <Yardanico> In reply to @Dale "<@180601887916163073> if you don't": it won't get wasted, don't worry :) |
18:40:39 | FromDiscord | <Yardanico> first of all Nim itself is smart, and C compilers are very smart too |
18:40:46 | FromDiscord | <Yardanico> also there's one more way except using result and return |
18:41:01 | FromDiscord | <Yardanico> making your whole proc body one big expression |
18:41:02 | FromDiscord | <Dale> I know you can a one-liner style |
18:41:35 | FromDiscord | <Dale> Not sure I'd ever use that one |
18:41:44 | FromDiscord | <Yardanico> it can be useful sometimes |
18:41:45 | FromDiscord | <Yardanico> sent a code paste, see https://play.nim-lang.org/#ix=4rOf |
18:41:51 | FromDiscord | <Yardanico> like for wrapping a case statement in a proc |
18:41:56 | FromDiscord | <firasuke> In reply to @Yardanico "what happens if you": lemme check |
18:44:05 | FromDiscord | <firasuke> In reply to @Yardanico "what happens if you": `nimlsp --version`โต`nimlsp v0.4.4` |
18:44:15 | FromDiscord | <Yardanico> and what if just `nimlsp`? does it just stay on? |
18:44:28 | FromDiscord | <firasuke> In reply to @Yardanico "and what if just": yes |
18:44:33 | FromDiscord | <Yardanico> hm |
18:44:38 | FromDiscord | <firasuke> until I terminate it with Ctrl C |
18:45:01 | FromDiscord | <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:40 | FromDiscord | <Yardanico> https://github.com/PMunch/nimlsp clone and then do `nimble debug`, you'll get a binary `nimlsp` |
18:47:01 | FromDiscord | <Yardanico> then just backup the original binary and copy this one to ~/.nimble/bin/ |
18:47:10 | FromDiscord | <Yardanico> or maybe the nim nvim plugi allows you to change nimlsp binary path |
18:47:14 | FromDiscord | <Yardanico> (edit) "plugi" => "plugin" |
18:49:29 | FromDiscord | <firasuke> that is what I was thinking |
18:49:39 | FromDiscord | <firasuke> I'm looking for a way to change the nimlsp binary path |
18:49:44 | FromDiscord | <firasuke> because I am positive it is not picking it up |
18:49:52 | FromDiscord | <Yardanico> huh |
18:50:05 | FromDiscord | <firasuke> I am using lsp-zero and mason |
18:52:09 | FromDiscord | <Yardanico> i can't help with nvim itself, never used it, sorry :( |
18:56:31 | FromDiscord | <Dale> What's the most convenient way of constructing a hashmap where the values are enum values? |
18:56:54 | FromDiscord | <Dale> `table[string, myenum]` |
18:57:11 | FromDiscord | <Dale> Should I do a for loop over some const data? |
18:57:19 | FromDiscord | <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:28 | FromDiscord | <Dale> Yeah |
18:57:35 | FromDiscord | <Yardanico> you don't need table at all then |
18:57:44 | FromDiscord | <Yardanico> https://nim-lang.org/docs/strutils.html#parseEnum%2Cstring |
18:58:14 | FromDiscord | <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:43 | FromDiscord | <Dale> Oh, the enum values work 'in reverse'? |
18:58:45 | FromDiscord | <Yardanico> well, a case statement would still perform better :) |
18:58:51 | FromDiscord | <Yardanico> than a hashmap i mean |
18:58:54 | FromDiscord | <Dale> Really? |
18:58:59 | FromDiscord | <Yardanico> i think so? |
18:59:17 | FromDiscord | <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:18 | FromDiscord | <Yardanico> (edit) "valuies" => "values" |
18:59:39 | FromDiscord | <Dale> Isn't a switch basically just a big pile of branches, whereas the hash should be more predictable |
19:00:03 | FromDiscord | <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:31 | FromDiscord | <Dale> I knew about that, but I'm looking to go from some type -> enum |
19:01:32 | FromDiscord | <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:34 | FromDiscord | <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:52 | FromDiscord | <Dale> I expect nim does the same |
19:02:13 | FromDiscord | <Dale> (edit) "in" => "material is" |
19:04:46 | FromDiscord | <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:43 | FromDiscord | <Yardanico> you could always write a macro to do that automatically for you ;) |
19:06:30 | FromDiscord | <Dale> If I mark the map as `const` it's done at comp time anyway right? So little difference |
19:07:36 | FromDiscord | <Diogenes of Toronto> sent a code paste, see https://play.nim-lang.org/#ix=4rOn |
19:08:40 | FromDiscord | <Elegantbeef> You need to specify the generic type |
19:08:53 | FromDiscord | <Yardanico> In reply to @Dale "If I mark the": ah if you mean that way, sure |
19:08:59 | FromDiscord | <Elegantbeef> so `createCmd[T](props: varargs[cmd[T]]): seq[cmd[T]) .... cmd[T]` |
19:09:14 | FromDiscord | <Elegantbeef> Like i said you cannot have a homogeneous collection of generics |
19:11:20 | FromDiscord | <Diogenes of Toronto> sent a code paste, see https://play.nim-lang.org/#ix=4rOo |
19:11:32 | FromDiscord | <Diogenes of Toronto> (edit) "https://play.nim-lang.org/#ix=4rOo" => "https://play.nim-lang.org/#ix=4rOp" |
19:11:36 | FromDiscord | <Elegantbeef> Types are not runtime values |
19:11:41 | FromDiscord | <Elegantbeef> So you want an object variant |
19:12:26 | FromDiscord | <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:08 | FromDiscord | <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:38 | FromDiscord | <Elegantbeef> `--passL:"-L/path/to/your/.so"` |
19:19:03 | * | fallback joined #nim |
19:23:11 | FromDiscord | <morgan> thanks |
19:24:10 | FromDiscord | <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:12 | FromDiscord | <demotomohiro> See: https://internet-of-tomohiro.netlify.app/nim/faq.en.html#coding-how-to-store-different-types-in-seqqmark |
19:26:12 | FromDiscord | <Elegantbeef> Hmm makes me wonder if i should add `sharedFields` to fungus ๐ |
19:27:13 | FromDiscord | <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:24 | FromDiscord | <Diogenes of Toronto> sent a code paste, see https://play.nim-lang.org/#ix=4rOq |
19:28:03 | FromDiscord | <Elegantbeef> Seems senible |
19:28:04 | FromDiscord | <Elegantbeef> sent a code paste, see https://paste.rs/XOZ |
19:28:43 | FromDiscord | <Elegantbeef> You do not need that `ref cmdObject` unless you need ref semantics |
19:28:52 | FromDiscord | <Elegantbeef> Also types in nim are conventionally CapitalPascalCased |
19:29:01 | FromDiscord | <leorize> I think mods can do it too, but I don't remember if I added all mods to it.โต(@Yardanico) |
19:29:50 | FromDiscord | <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:50 | FromDiscord | <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:19 | FromDiscord | <Phil> Trying to keep lists on what is all there and who has what rights and such ^^' |
19:34:59 | FromDiscord | <Diogenes of Toronto> In reply to @demotomohiro "See: https://internet-of-tomohiro.netlify.app/nim/f": thanks |
19:37:33 | FromDiscord | <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:38 | FromDiscord | <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:36 | FromDiscord | <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:33 | FromDiscord | <demotomohiro> @ElegantBeef I'm sorry but I didn't know about fungus. I will update my FAQ soon. |
19:50:02 | FromDiscord | <jmgomez> What is fungus? |
19:50:31 | FromDiscord | <Elegantbeef> Rust like ADT enums in Nim |
19:50:59 | FromDiscord | <Elegantbeef> Demo i was joking of course, just thought it's worth the addendum, though no clue how well it works ๐ |
19:51:04 | FromDiscord | <Elegantbeef> https://github.com/beef331/fungus |
19:51:07 | FromDiscord | <jmgomez> oh really? |
19:51:24 | FromDiscord | <jmgomez> any caveat? |
19:51:37 | FromDiscord | <Phil> You will be using a beef package and he will berate you for it |
19:51:52 | FromDiscord | <Elegantbeef> It doesnt have an API for shared fields |
19:51:58 | FromDiscord | <Phil> It'll still be good, but you will still get comments ๐ |
19:52:09 | FromDiscord | <jmgomez> That's why I steal it, like with nimscripter:P |
19:52:21 | FromDiscord | <Elegantbeef> It also has an ugly syntax for single field types |
19:52:41 | FromDiscord | <Elegantbeef> sent a code paste, see https://play.nim-lang.org/#ix=4rOx |
19:52:55 | FromDiscord | <Elegantbeef> Which would emit a converter for `StrCmd` to `string` |
19:52:55 | FromDiscord | <jmgomez> bookmarked, will take a closer look |
19:53:22 | FromDiscord | <Elegantbeef> It also has very primitive pattern matching which encourages explicit flow control |
19:53:57 | FromDiscord | <Elegantbeef> Instead of `myCircle.r` you do like `if (myVar: Circle) from myShape: echo myVar.r` |
19:54:02 | FromDiscord | <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:03 | FromDiscord | <Elegantbeef> Or you use the `match` macro to do the same premise |
19:54:42 | FromDiscord | <Elegantbeef> I do not like pattern matching to begin with |
19:55:26 | FromDiscord | <Elegantbeef> But this pattern matching pretty much needs to be custom due to how it works |
19:55:36 | FromDiscord | <jmgomez> The nim community is fckd because beef doesnt like pattern matching |
19:56:05 | FromDiscord | <Phil> No, because we are unable to have a better linter xP |
19:56:15 | FromDiscord | <Phil> (edit) "No, ... because" added "more" |
19:56:18 | FromDiscord | <Elegantbeef> We have the best linter though |
19:56:19 | FromDiscord | <jmgomez> Any reason why you dindnt do a RFC to improve enums? |
19:56:34 | FromDiscord | <Elegantbeef> Enums are fine |
19:56:49 | FromDiscord | <Elegantbeef> Object variants are also fine |
19:57:46 | FromDiscord | <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:30 | FromDiscord | <Elegantbeef> Would it be nice to have `adtenum` inside a type section, yes |
19:58:31 | FromDiscord | <Elegantbeef> Does it make sense to add it as a basic feature to Nim...? I do not think so |
19:58:41 | FromDiscord | <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:03 | FromDiscord | <Elegantbeef> To me it doesnt really matter if it's a package or in the stdlib it's all easy to use |
19:59:46 | FromDiscord | <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:06 | FromDiscord | <Elegantbeef> It's not any more risky than depending on the stdlib |
20:00:16 | FromDiscord | <jmgomez> if it's on the std it gives more trust that it wont get abandoned and bugs will be fixed etc. |
20:00:45 | FromDiscord | <Elegantbeef> Ah yes the stdlib is known for not abandoning code and fixing bugs in a rapid manner |
20:01:00 | FromDiscord | <Elegantbeef> Given how the present stdlib is authored using stdlib is worse than using external libraries |
20:01:14 | FromDiscord | <Elegantbeef> If you fix a bug with the stdlib you have to wait for the next stable release or go to devel |
20:01:17 | FromDiscord | <jmgomez> hmm but you get what you mean, right? |
20:01:24 | FromDiscord | <jmgomez> (edit) "you mean," => "Imean," |
20:01:26 | FromDiscord | <Elegantbeef> If you fix a bug with an external library you can use whatever version you're on now |
20:01:36 | FromDiscord | <Elegantbeef> I get what you mean but i disagree with the premise |
20:02:25 | FromDiscord | <Elegantbeef> Also " even if by one of the major devs of the lang" hopefully that's not directed to me ๐ |
20:02:32 | FromDiscord | <Elegantbeef> I'm just a simpleton that writes fun code |
20:03:32 | FromDiscord | <Elegantbeef> To put it in perspective there are 168 open issues for the nim stdlib |
20:03:50 | FromDiscord | <jmgomez> lol |
20:03:54 | FromDiscord | <Elegantbeef> I fix a majority of issues that are raised within a few days of the issue |
20:04:10 | FromDiscord | <Elegantbeef> And even if i do not, you can fork fix and use them |
20:04:19 | FromDiscord | <Elegantbeef> You cannot fork and fix the stdlib without inane hacks |
20:04:29 | FromDiscord | <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:08 | FromDiscord | <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:10 | FromDiscord | <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:28 | FromDiscord | <Elegantbeef> Sure but is the stdlib presently authored this way |
20:05:56 | FromDiscord | <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:00 | FromDiscord | <jmgomez> but the idea is to change it. That's why it's getting split, right? |
20:06:15 | FromDiscord | <Elegantbeef> Sure but what is the present state |
20:06:44 | FromDiscord | <jmgomez> yeah, Im talking about 2.0+ |
20:07:13 | FromDiscord | <Dale> Does 1.6 have type field defaults? |
20:07:20 | FromDiscord | <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:21 | FromDiscord | <Elegantbeef> No |
20:07:35 | FromDiscord | <Dale> kk, thanks! |
20:09:42 | FromDiscord | <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:03 | FromDiscord | <Elegantbeef> Wrong reply? ๐ |
20:10:08 | * | fallback quit (Read error: Connection reset by peer) |
20:10:15 | FromDiscord | <ezquerra> LOL. Yes ๐ |
20:10:32 | FromDiscord | <ezquerra> Not sure how I did that ๐ฎ |
20:11:15 | FromDiscord | <Andreas> @ElegantBeef @jmgomez would you know a method to process a nim-modul with a macro ? |
20:11:32 | FromDiscord | <Elegantbeef> I do not disagree that it gives an aire of security, but in the present state that security is a joke |
20:11:38 | FromDiscord | <QuiteQuietQ> In reply to @ezquerra "I agree with <@726017160115126333>.": Lol, not for me? |
20:11:44 | FromDiscord | <Elegantbeef> If it takes a backport and version tick to reach the user where is the security |
20:12:07 | FromDiscord | <QuiteQuietQ> Quite a coincidence, I just got online for one minute |
20:12:08 | FromDiscord | <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:02 | FromDiscord | <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:29 | FromDiscord | <Elegantbeef> Well it's not the greatest solution as you do not get symbols |
20:16:24 | FromDiscord | <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:02 | FromDiscord | <Andreas> In reply to @jmgomez "<@754284517316886598> in case it's": thx, i'll take a look.. |
20:17:50 | FromDiscord | <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:42 | FromDiscord | <Hourglass [She/Her]> What happens if you `return` in a template? |
20:22:57 | FromDiscord | <Elegantbeef> You insert a return where it's called |
20:24:12 | FromDiscord | <Hourglass [She/Her]> Ah, so how do I give a value to the call site then? Just giving the variable name directly? |
20:24:24 | FromDiscord | <Elegantbeef> yes you make an expression |
20:24:27 | FromDiscord | <Elegantbeef> Or just make a proc |
20:24:33 | FromDiscord | <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:46 | FromDiscord | <Hourglass [She/Her]> Alr sweet thanks! |
20:25:49 | FromDiscord | <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:22 | FromDiscord | <demotomohiro> !eval template foo(a, b: int) = a + b; echo foo(2, 3) |
20:26:29 | NimBot | <no output> |
20:27:50 | FromDiscord | <Dale> How do I make `Rune` literals? |
20:29:00 | FromDiscord | <Dale> sent a code paste, see https://play.nim-lang.org/#ix=4rOF |
20:30:41 | FromDiscord | <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:10 | FromDiscord | <Elegantbeef> sent a code paste, see https://play.nim-lang.org/#ix=4rOG |
20:32:44 | FromDiscord | <Elegantbeef> `rune"("` now works |
20:33:14 | FromDiscord | <Dale> Hmm |
20:33:43 | FromDiscord | <Dale> So `static` implies a constant, so this is all compile-time stuff right? |
20:33:54 | FromDiscord | <huantian> indeed |
20:33:59 | FromDiscord | <Dale> \o/ |
20:34:11 | FromDiscord | <Dale> Brilliant, thanks! |
20:34:14 | FromDiscord | <huantian> it also makes sure at compile time that the string you provide only has one rune |
20:34:21 | FromDiscord | <Elegantbeef> Hence `error` and not `raise` |
20:34:24 | FromDiscord | <Dale> Yeah I got that much |
20:34:52 | FromDiscord | <huantian> man Nim is so cool when compile time checks are this easy |
20:36:41 | * | jmdaemon joined #nim |
20:40:15 | FromDiscord | <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:44 | FromDiscord | <Elegantbeef> Yea it's quite wonderful to have it |
20:42:13 | FromDiscord | <Elegantbeef> Rust has issues with compile time strings in that they're constant C strings and not Rust's runtime strings |
20:42:22 | FromDiscord | <Elegantbeef> So operations that operate on Rust strings are not usable at compile time |
20:44:37 | FromDiscord | <Elegantbeef> Wonder if Zig's comptime has similar issues, probably does |
20:44:38 | FromDiscord | <Elegantbeef> Jai just has compile time evaluation blocks which compiles the code then runs it |
20:46:48 | FromDiscord | <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:15 | FromDiscord | <Elegantbeef> Depends on you really |
20:47:41 | FromDiscord | <Elegantbeef> I generally prefer the semantics of exceptions, but options/results are technically less harmful |
20:48:05 | FromDiscord | <firasuke> oh ok |
20:48:27 | FromDiscord | <firasuke> and for handling exceptions, can you try a bunch of times, then have a separate section for exceptions based on types? |
20:48:42 | FromDiscord | <huantian> I personally lean towards `Option`, but depending on the situation exceptions might work better |
20:48:43 | FromDiscord | <jmgomez> In reply to @Elegantbeef "Jai just has compile": do you have access to it or read it somewhere? |
20:48:58 | FromDiscord | <firasuke> In reply to @huantian "I personally lean towards": oh ok |
20:49:22 | FromDiscord | <jmgomez> I also prefer options/result, but I do use exceptions for some stuff |
20:50:53 | FromDiscord | <Elegantbeef> Regret it most the time cause jblow can be a tool |
20:50:54 | FromDiscord | <Elegantbeef> https://www.youtube.com/watch?v=XLVjSeusPYg points to this video in particular |
20:50:57 | FromDiscord | <Elegantbeef> sent a code paste, see https://play.nim-lang.org/#ix=4rOM |
20:50:59 | FromDiscord | <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:58 | FromDiscord | <Elegantbeef> I just hate the semantics of options/results, it pollutes the user code even if they do not care |
20:52:42 | FromDiscord | <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:06 | FromDiscord | <firasuke> sent a code paste, see https://paste.rs/iG7 |
20:53:06 | FromDiscord | <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:23 | FromDiscord | <Elegantbeef> I mean i do not disagree the huan |
20:53:54 | FromDiscord | <Elegantbeef> The point of options is generally to give n + 1 values |
20:54:01 | FromDiscord | <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:07 | FromDiscord | <Elegantbeef> Using n + 1 as a sentinel is generally what is considered |
20:54:42 | FromDiscord | <firasuke> I don't mind that |
20:54:44 | FromDiscord | <firasuke> sent a code paste, see https://play.nim-lang.org/#ix=4rOO |
20:55:34 | FromDiscord | <Elegantbeef> To each their own, I just do not think the approach to errors validates constantly checking if one doesnt care ๐ |
20:55:53 | FromDiscord | <firasuke> oh ok xD |
20:56:03 | FromDiscord | <Elegantbeef> Talking to jm with that |
20:58:33 | FromDiscord | <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:53 | FromDiscord | <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:40 | FromDiscord | <Hourglass [She/Her]> sent a code paste, see https://play.nim-lang.org/#ix=4rOS |
21:01:54 | FromDiscord | <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:56 | FromDiscord | <Elegantbeef> string streams are memory based |
21:02:06 | FromDiscord | <Elegantbeef> The issue is likely IO related |
21:02:38 | FromDiscord | <Elegantbeef> Might not have permissions or something like that, or in termux you need to use a different API to write files? |
21:02:41 | FromDiscord | <Elegantbeef> I do not really know |
21:02:57 | FromDiscord | <Elegantbeef> Alternatively the File io is broke on termux |
21:03:34 | FromDiscord | <Elegantbeef> Does `let theFile = open("myFile", fmWrite); theFile.write("hello"); flushFIle(theFile);` work? |
21:04:27 | FromDiscord | <Hourglass [She/Her]> Let me rjn that now, is it fine to use that in `inim`? |
21:04:52 | FromDiscord | <Hourglass [She/Her]> It should work tho since writing files normally work |
21:04:58 | FromDiscord | <Elegantbeef> Probably |
21:05:04 | FromDiscord | <Hourglass [She/Her]> Yep that works |
21:05:38 | FromDiscord | <Elegantbeef> Well something is either wrong with your stream or with the API for termux |
21:05:46 | FromDiscord | <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:05 | FromDiscord | <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:01 | FromDiscord | <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:21 | FromDiscord | <Elegantbeef> Indexing a Utf8 is a O(n) operation, so if you want a O(1) lookup yes |
21:43:36 | FromDiscord | <Elegantbeef> If you're just iterating there is an iterator `runes` |
21:44:18 | FromDiscord | <Dale> I'm doing a token scanner, so it's not a straightforward iter |
21:44:59 | FromDiscord | <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:06 | Zevv | scanning/lexing can probably be done from an iterator |
21:47:30 | Zevv | what beef says: sequentially you're ok, but if you want random access, you pbly want to convert |
21:48:05 | FromDiscord | <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:25 | Zevv | wat are you doing exactly |
21:53:23 | FromDiscord | <Dale> Bob Nystrom's book https://craftinginterpreters.com/scanning.html#lexemes-and-tokens |
21:53:36 | FromDiscord | <Dale> Mainly as an exercise to scope out nim |
21:53:52 | Zevv | nice. |
21:53:55 | FromDiscord | <Dale> I'm gonna do the second half in zig |
21:54:16 | FromDiscord | <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:17 | Zevv | parse away! |
21:54:35 | FromDiscord | <Dale> I'm trying! haha |
21:54:57 | Zevv | it'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:09 | FromDiscord | <Dale> Have a weird error now. The `rune` proc that Beef provided earlier doesn't play nice with escapes it seems |
21:55:26 | FromDiscord | <Elegantbeef> `rune "\..."` will work |
21:55:30 | Zevv | yeah beef usually is just rambling, don't trust the man |
21:55:31 | FromDiscord | <Dale> `rune"\0"` is causing compile error |
21:55:35 | FromDiscord | <Dale> haha |
21:55:37 | FromDiscord | <Elegantbeef> It's not the proc it's the generalised string literal |
21:55:55 | FromDiscord | <Elegantbeef> `rune"\0"` is parsed as `rune("\\0")` |
21:56:26 | FromDiscord | <Elegantbeef> Zevv you know me better than I know me |
21:56:38 | Zevv | are 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:05 | Zevv | yeah true, I know you better than I know me |
21:57:08 | Zevv | no wait |
21:57:08 | FromDiscord | <Elegantbeef> Especially for language tokens |
21:57:13 | * | fallback quit (Read error: Connection reset by peer) |
21:57:24 | FromDiscord | <Elegantbeef> Like it's not like you're going to use unicode `(` or `{` |
21:58:11 | Zevv | well, if you are tokenizing, it usually should not matter. You can just tokenize a ยท like any other character. |
21:58:14 | FromDiscord | <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:15 | FromDiscord | <Elegantbeef> Unicode is more important if you're doing string operations |
21:58:29 | Zevv | or doin layouting, needing string lengths etc |
21:58:52 | FromDiscord | <Elegantbeef> You generally do not care if something is a unicode string in a programming language |
21:58:58 | Zevv | well, it depends on what you mean with 'UTF-8 as a standard' |
21:59:17 | Zevv | UTF-8 and unicode are related; UTF-8 is "just a string", but unicode is hell with tons of huge tables |
21:59:26 | FromDiscord | <Elegantbeef> Like if you declare a variable with a utf8 symbol comparisons are the same |
21:59:48 | FromDiscord | <Elegantbeef> It just works there is no extra logic needed two strings are equal if they contain the same content |
22:00:07 | Zevv | enters unicode normalization |
22:00:20 | FromDiscord | <Elegantbeef> Lol |
22:00:56 | FromDiscord | <Dale> Hrm |
22:01:30 | FromDiscord | <Dale> So I should be okay just treating everything as a stream of bytes then |
22:02:06 | FromDiscord | <Dale> I mean, it would be interesting to allow unicode for identifiers |
22:02:18 | FromDiscord | <Elegantbeef> It's 0 work to allow unicode for identifiers |
22:02:18 | Zevv | sure, but you can do that, like any identifier |
22:02:36 | FromDiscord | <Elegantbeef> A unicode identifier is no different to just an ascii identifier |
22:02:40 | Zevv | any unicode character or sequence of unicode characters is "just a string" in UTF-8 |
22:02:43 | FromDiscord | <Dale> Oh yeah, because they are going to be seqs of bytes anyway |
22:02:48 | Zevv | right, you got it |
22:02:52 | FromDiscord | <Elegantbeef> in your tokeniser you're searching for a space proceeding and succeeding a space |
22:03:52 | FromDiscord | <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:17 | FromDiscord | <Elegantbeef> Since you're not processing the string you do not care if someone wrote an entire essay with unicode emojis ๐ |
22:04:49 | FromDiscord | <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:22 | FromDiscord | <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:05 | FromDiscord | <Elegantbeef> I love Go's "capital's are exported" whilst supporting unicode identifiers |
22:07:06 | FromDiscord | <Elegantbeef> It means so much non english code uses like `T` followed by non ascii characters |
22:07:07 | FromDiscord | <Elegantbeef> Atleast i've seen a fair bit of Chinese Nim code that follows that where `T` is like an export marker |
22:07:07 | FromDiscord | <Elegantbeef> Someone should've mentioned not all languages have glyphs which are considered capitals ๐ |
22:07:28 | FromDiscord | <Elegantbeef> Bleh |
22:08:04 | Zevv | just don't write parsers by hand, eh :) |
22:08:15 | FromDiscord | <Dale> Here's an example of what I meant btw https://lafolie.itch.io/golf-560 |
22:08:31 | FromDiscord | <Dale> The whole game is 560 chars |
22:09:15 | FromDiscord | <Dale> but anyways, yeah I should probably revert this back to using strings then |
22:13:14 | FromDiscord | <Elegantbeef> Quite literal code golf eh |
22:13:35 | FromDiscord | <Dale> Oh right, haha, didn't mean to make a pun! |
22:13:40 | FromDiscord | <Dale> I've a few more on my profile |
22:13:46 | FromDiscord | <Dale> but that's my favourite |
22:15:37 | FromDiscord | <Elegantbeef> Grapheme code golf is always so weird |
22:16:38 | FromDiscord | <Dale> The end result is always disgusting |
22:17:31 | FromDiscord | <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:02 | FromDiscord | <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:03 | FromDiscord | <Elegantbeef> Binary size golfing is much more interesting imo |
22:21:10 | FromDiscord | <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:35 | FromDiscord | <Dale> Yeah I prefer binary size, but Pico8 isn't compiled, so he had to use other limits |
22:21:54 | FromDiscord | <Dale> It's really jarring at first, but you learn to live with it |
22:22:47 | FromDiscord | <Dale> I really wanna make an ASM-based fantasy console as well. That'll be one reason I'm prospecting nim |
22:23:57 | FromDiscord | <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:14 | FromDiscord | <Dale> BAH I've done it again |
22:28:25 | FromDiscord | <Dale> Should I be using string even if it's a single char? |
22:29:30 | FromDiscord | <Dale> ...no because `someStr[n]` returns char |
22:30:18 | FromDiscord | <Dale> Oh you use `'` |
22:31:00 | FromDiscord | <Elegantbeef> WASM based fantasy console is the way to go |
22:31:20 | FromDiscord | <Elegantbeef> https://wasm4.org/ something like this |
22:31:34 | FromDiscord | <Dale> Well that would be the target arch. I would be making a VM that runs on there |
22:31:57 | FromDiscord | <Elegantbeef> No i mean using wasm as the target VM so it's capable of being written from any language |
22:32:15 | FromDiscord | <Elegantbeef> drastically increasing your prospective userbase |
22:32:31 | FromDiscord | <Dale> I think I misrepresented the idea. I would want the language for the console to be ASM |
22:32:45 | FromDiscord | <Dale> If you wanted to use something else, you'd have to write a compiler yourself |
22:32:53 | FromDiscord | <Elegantbeef> Oh i know, but that limits the prospective user base ๐ |
22:33:21 | FromDiscord | <Dale> I know that, but the point is to have fun writing for something like it's the 80s haha |
22:33:37 | FromDiscord | <Elegantbeef> Just write WASM by hand with wasm4 |
22:36:03 | FromDiscord | <Dale> I see where you're coming from, but that's not my little dream haha |
22:39:25 | FromDiscord | <Dale> Looking at the spec, WASM is way more convoluted than what I mean anyway |
22:39:41 | FromDiscord | <Dale> Though looking at some of these instructions I can see that a lot of thought went into it |
22:40:05 | FromDiscord | <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:49 | FromDiscord | <nimโ> nim |
22:43:50 | FromDiscord | <nimโ> otp |
22:44:46 | FromDiscord | <Dale> Pardon? |
22:45:22 | FromDiscord | <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:51 | FromDiscord | <Elegantbeef> @planetis\: i now have a lame excuse for not using `(x: int,y: float)` for fungus |
23:21:07 | FromDiscord | <Elegantbeef> I now allow non tuples as the right hand |
23:21:14 | FromDiscord | <Elegantbeef> Which means you can type complex expressions there and it should work |
23:21:28 | FromDiscord | <Elegantbeef> https://github.com/beef331/fungus#non-tuple-types like so |
23:54:50 | FromDiscord | <Dale> Is it okay to use different sized values in object variants? |
23:55:15 | FromDiscord | <Dale> So, I could store an int or a string (obviously different sizes) in the union? |
23:56:14 | FromDiscord | <Dale> Oh, the docs do so in an example. Hmm, so I guess internally the string will be a pointer or something |
23:58:09 | FromDiscord | <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:10 | FromDiscord | <Elegantbeef> It's completely fine |
23:58:19 | FromDiscord | <Elegantbeef> The largest branch is the size of the variant |
23:58:44 | FromDiscord | <Elegantbeef> It's just a `kind: type, union{a: ATyp, b: Btype}` |
23:58:53 | FromDiscord | <Dale> Right, but a string is of unknown length, so I assume that's gonna boil down to a ptr |
23:59:11 | FromDiscord | <Dale> Yeah |
23:59:19 | FromDiscord | <Elegantbeef> A string on arc/orc is a `int, pointer` |
23:59:26 | FromDiscord | <Elegantbeef> On refc a string is a `pointer` |
23:59:55 | FromDiscord | <Dale> Good to know, thanks! I know it doesn't matter so much, it's just a case of getting my head around it |