00:00:03 | * | vicecea quit (*.net *.split) |
00:00:03 | * | cornfeedhobo quit (*.net *.split) |
00:00:03 | * | dv2 quit (*.net *.split) |
00:00:03 | * | Schnouki quit (*.net *.split) |
00:00:03 | * | GreaseMonkey quit (*.net *.split) |
00:00:03 | * | Onionhammer quit (*.net *.split) |
00:00:03 | * | notchris quit (*.net *.split) |
00:00:04 | * | Jjp137 quit (*.net *.split) |
00:00:04 | * | FromDiscord quit (*.net *.split) |
00:00:38 | * | NimBot joined #nim |
00:00:45 | * | noeontheend joined #nim |
00:01:28 | * | Colt quit (Remote host closed the connection) |
00:01:50 | * | jmdaemon joined #nim |
00:02:11 | * | greaser|q joined #nim |
00:03:28 | * | Colt joined #nim |
00:03:56 | * | greaser|q quit (Changing host) |
00:03:56 | * | greaser|q joined #nim |
00:03:59 | * | greaser|q is now known as GreaseMonkey |
00:04:54 | * | nixfreaknim[m] joined #nim |
00:06:48 | * | Jjp137 joined #nim |
00:07:12 | * | cornfeedhobo joined #nim |
00:16:56 | * | bigmanbird joined #nim |
00:21:18 | FromDiscord | <huantian> is there a way to make a seq of `n` length of default vals |
00:24:11 | FromDiscord | <Rosen> In reply to @huantian "is there a way": setLen on an initialized empty seq? |
00:24:24 | FromDiscord | <Rosen> Or it needs to be in one step |
00:25:14 | FromDiscord | <impbox [ftsf]> `newSeq[type](size)` |
00:25:59 | * | bigmanbird quit (Read error: Connection reset by peer) |
00:26:15 | FromDiscord | <Rosen> You know I always had an idea that would be the way to do it but I just never tried |
00:33:23 | * | noeontheend quit (Ping timeout: 256 seconds) |
00:36:35 | * | noeontheend joined #nim |
00:43:53 | * | bigmanbird joined #nim |
00:44:33 | FromDiscord | <Elegantbeef> https://nim-lang.org/docs/sequtils.html#newSeqWith.t%2Cint%2Cuntyped |
00:44:37 | FromDiscord | <Elegantbeef> For if you want custom default value |
00:55:38 | FromDiscord | <huantian> oh neat |
00:56:17 | * | noeontheend quit (Ping timeout: 240 seconds) |
00:59:01 | * | src quit (Quit: Leaving) |
01:03:18 | FromDiscord | <Yardanico> Oh, nice, https://plugins.jetbrains.com/plugin/15128-nim/versions new minor version out, so it's in development and wasn't abandoned :) |
01:23:09 | * | dv2 joined #nim |
01:28:24 | * | bigmanbird quit (Quit: Leaving) |
01:33:40 | * | arkurious quit (Read error: Connection reset by peer) |
01:34:07 | * | arkurious joined #nim |
01:39:26 | nrds | <Prestige99> What is the `likelyProc` in system? The docs don't really explain much |
01:39:45 | nrds | <Prestige99> The definition is just `proc likelyProc(val: bool): bool {.importc: "NIM_LIKELY", nodecl, noSideEffect.}` |
01:51:36 | FromDiscord | <exelotl> I don't think `likelyProc` is to be used directly, but system defines `likely` and `unlikely` |
01:51:43 | FromDiscord | <Yardanico> yeah I think so too |
01:52:15 | FromDiscord | <exelotl> Those allow you to hint that an expression is more likely to evaluate to true than false, and the C compiler can use that information to produce better optimized assembly |
01:53:01 | FromDiscord | <Yardanico> Yeah, although it's not a good idea to use it everywhere but rather find hot paths in your code if you really want to use it |
01:53:08 | FromDiscord | <Yardanico> IMO compilers are already good at this |
01:53:26 | FromDiscord | <Yardanico> And PGO will be much better than manually adding likely/unlikely |
01:55:44 | FromDiscord | <Yardanico> And it's not that hard to do with clang, although does require a few commands currently |
01:55:45 | FromDiscord | <Yardanico> https://forum.nim-lang.org/t/6295 |
01:57:28 | FromDiscord | <exelotl> I wish that likely/unlikely were pragmas though, they feel like the more appropriate construct for the job since they affect codegen |
01:59:26 | FromDiscord | <Marisol> What's nim's equivalent of map<string, dynamic>? |
02:00:32 | FromDiscord | <Yardanico> In reply to @Marisol "What's nim's equivalent of": the closest you can get is by using an object variant |
02:00:59 | FromDiscord | <Yardanico> nim is a statically compiled language, it can't have a fully "dynamic" type without considerable changes to the runtime and the language itself |
02:01:22 | FromDiscord | <Yardanico> See for example https://nim-lang.org/docs/json.html, you can use JsonNode from here or define your own |
02:01:44 | FromDiscord | <Yardanico> (if you just use JsonNode you won't deal with json at all, it's just the type) |
02:03:02 | FromDiscord | <Marisol> sent a code paste, see https://play.nim-lang.org/#ix=3Iy1 |
02:03:09 | FromDiscord | <Marisol> Hmm I'll look at JsonNode |
02:03:16 | FromDiscord | <Yardanico> as I said, you can use object variants |
02:03:34 | FromDiscord | <Yardanico> JsonNode is an object variant too, it's just a little handy so that you don't have to define your own type |
02:04:09 | FromDiscord | <Marisol> Ah you're right |
02:04:20 | FromDiscord | <Marisol> Thanks, I'll look on it |
02:18:27 | * | neurocyte0132889 quit (Ping timeout: 250 seconds) |
02:32:05 | FromDiscord | <Roundlay> Wondering if anyone can point me in the direction of any of native macOS (Metal) projects written primarily in Nim? I'd kind of like to avoid Swift/C++/Zig etc. if I can, and enjoy using Nim, but am not sure if it's up to the task yet. |
02:33:38 | FromDiscord | <fenrave> In reply to @Yardanico "Oh, nice, https://plugins.jetbrains.com/plugin/1512": This plugin is alright but it has a hard time actually just finding `nim` in the system path for whatever reason, so you have to manually configure everything sometimes |
02:33:49 | FromDiscord | <Yardanico> yeah I'm not saying it's the best |
02:33:54 | FromDiscord | <fenrave> kind of defeats the point of using something like intellij |
02:33:55 | FromDiscord | <Yardanico> I still use VSCode because it actually uses nimsuggest :) |
02:34:18 | FromDiscord | <fenrave> I wonder if fleet will have better nim integration |
02:34:30 | FromDiscord | <Yardanico> well it supports LSP |
02:34:33 | FromDiscord | <Yardanico> so you can just use nimlsp with it |
02:34:51 | FromDiscord | <Yardanico> but yeah, someone will have to write a syntax highlighting plugin if fleet can't use existing definitions from other editors |
02:35:36 | FromDiscord | <fenrave> I would hope it least supports vscodes definitions given that it's supposed to be a paid(not clear on this yet) competitor |
02:35:59 | FromDiscord | <fenrave> Now all I need is a reason to use nim and to learn it further 😎 |
02:37:42 | FromDiscord | <fenrave> :cryingsunglasses: |
02:41:17 | * | arkurious quit (Quit: Leaving) |
02:47:44 | FromDiscord | <huantian> I have a few random complaints with vscode nim like not being able to see the type of something in it's declaration |
02:48:03 | FromDiscord | <Yardanico> that's related to nimsuggest actually |
02:48:06 | FromDiscord | <huantian> ah |
02:48:11 | FromDiscord | <Yardanico> it doesn' |
02:48:21 | FromDiscord | <Yardanico> (edit) "doesn'" => "doesn't give the type info in the declaration" |
02:49:02 | FromDiscord | <huantian> that's mildly annoying |
02:49:44 | FromDiscord | <gogolxdong (liuxiaodong)> How to serve large file downloading with Jester? |
02:58:23 | FromDiscord | <Marisol> If it's static file just serve it via nginx |
03:00:34 | FromDiscord | <Marisol> Or if you really want to use jester for it try to put them to ./public dir |
03:09:44 | FromDiscord | <gogolxdong (liuxiaodong)> sent a code paste, see https://play.nim-lang.org/#ix=3Iyc |
03:10:01 | FromDiscord | <gogolxdong (liuxiaodong)> Is this possible with staticDir set to getCurrentDir() |
03:10:59 | FromDiscord | <gogolxdong (liuxiaodong)> file is about 7GB |
03:26:43 | FromDiscord | <XeroOl> I've got a feature / change suggest for nim |
03:27:17 | FromDiscord | <XeroOl> I just pulled a repo from the internet, and they had a config.nims file that would check for an error condition and abort |
03:28:02 | FromDiscord | <XeroOl> and it called `quit("helpful error message here")` |
03:28:24 | FromDiscord | <XeroOl> in the output of nimble, I actually missed the error message because the stack trace was in bold and the message wasn't |
03:28:40 | FromDiscord | <XeroOl> would it be possible to make that message be highlighted or bold or more emphasized in some way? |
03:30:12 | FromDiscord | <Sabena Sema> In reply to @Marisol "What's nim's equivalent of": it should be possible to write a type like C++' |
03:30:15 | FromDiscord | <XeroOl> Here's an image of the output (on discord, might not send) https://media.discordapp.net/attachments/371759389889003532/920880478159011870/unknown.png |
03:30:17 | FromDiscord | <Sabena Sema> (edit) "C++'" => "C++'s `std::any`" |
03:30:32 | FromDiscord | <XeroOl> notice how easy it is to miss the "helpful error message" for the rest of the stack trace |
03:30:46 | FromDiscord | <XeroOl> (edit) "send)" => "send to libera / gitter)" |
03:30:53 | FromDiscord | <XeroOl> (edit) "Here's an image of the output (on discord, ... might" added "it" |
03:31:19 | FromDiscord | <Sabena Sema> but, ultimately, object variants are usually used, even map<any, dynamic> in most dynamic langs are such because most dynamic langs have "any" types that have special branches for small primitive types |
03:34:12 | FromDiscord | <Sabena Sema> In reply to @XeroOl "Here's an image of": you can use the terminal package to get style codes to make that bold |
03:35:03 | FromDiscord | <Sabena Sema> something like `quit(ansiStyleCode(styleBright) & "text")` |
03:35:11 | FromDiscord | <huantian> It wouldn't be good to force boldness on all `quit()`s |
03:35:23 | FromDiscord | <Sabena Sema> oh, you'd need to reset the style too or else everything will be bold after running your program |
03:35:30 | FromDiscord | <huantian> so that wouldn't be an option, you'd have to do it manually like above |
03:36:00 | FromDiscord | <Sabena Sema> quit(string,...) is just a shortcut for echo(string); quit |
03:36:00 | FromDiscord | <XeroOl> is there a way to not print the stack trace at all? |
03:36:09 | FromDiscord | <Sabena Sema> you can write your own function that calls writeStyled then quits |
03:36:55 | FromDiscord | <XeroOl> from what I can tell there's no way to return an error code but supress the stack trace |
03:38:09 | FromDiscord | <XeroOl> it just seems strange that a message that's meant to go to the user is supressed by the noise of the stack trace in one instance |
03:38:13 | FromDiscord | <XeroOl> anyway thank you very much |
03:38:36 | FromDiscord | <XeroOl> (edit) "one" => "this" |
03:45:39 | FromDiscord | <Marisol> @Yardanico @Sabena Sema I haven't understand object variants yet but I found `std/tables`, I can do map<string, string> for now! 😆 |
04:06:01 | * | supakeen quit (Quit: WeeChat 3.3) |
04:06:30 | * | supakeen joined #nim |
04:25:29 | * | noeontheend joined #nim |
04:33:46 | FromDiscord | <Sabena Sema> what's the name of that lib where you supply like patch files and it runs c2nim for you on import? |
04:35:02 | * | xet7 joined #nim |
04:39:34 | FromDiscord | <huantian> Man why does dimscord have to use snake case for attributes |
04:40:07 | FromDiscord | <huantian> there's probably some reason that I don't know but still↵kind of a pain |
04:42:17 | * | noeontheend quit (Ping timeout: 240 seconds) |
04:42:37 | * | jmdaemon quit (Ping timeout: 240 seconds) |
04:43:31 | FromDiscord | <Elegantbeef> How is it a pain? |
04:47:34 | FromDiscord | <Sabena Sema> you don't need to use snake case to refer to them if you don't want to |
04:48:10 | FromDiscord | <Sabena Sema> `m.channel_id` is the same as `m.channelId` in nim |
04:48:56 | FromDiscord | <Elegantbeef> Odd that feature is one of the most complained about, but also often unknown |
04:49:07 | FromDiscord | <Sabena Sema> heh yeah |
04:49:11 | FromDiscord | <Sabena Sema> I like it |
04:49:28 | FromDiscord | <Sabena Sema> although I also liked the old fully insensitive `TFoo`, `RFoo` thing |
04:49:45 | FromDiscord | <Sabena Sema> esp because it discouraged writing ref objects needlessly |
04:49:51 | FromDiscord | <Sabena Sema> (edit) "needlessly" => "needlessly, sorta" |
04:50:12 | * | noeontheend joined #nim |
04:50:26 | FromDiscord | <Sabena Sema> idk if vscode-nim has an option to pick which one you like |
04:50:47 | FromDiscord | <Elegantbeef> It doesnt, i did have a start of it which seemed to work |
04:51:52 | FromDiscord | <Elegantbeef> Though i think there is the view it should be configurable for your nimsuggest/compiler |
04:52:10 | FromDiscord | <Sabena Sema> I thought whitespace sensitive precedence was cool too |
04:52:25 | FromDiscord | <Sabena Sema> nim's was less out there than what Fortress did |
04:52:28 | FromDiscord | <Elegantbeef> What's that in english? |
04:53:35 | FromDiscord | <Sabena Sema> there used to be an option to make `a+b c` parse as `(a+b)c` |
04:53:48 | FromDiscord | <Elegantbeef> Ah |
04:53:51 | FromDiscord | <Sabena Sema> each power of two spaces would increase precedence by 1 |
04:54:04 | FromDiscord | <Elegantbeef> Odd but interesting |
04:54:32 | * | GnuYawk quit (Quit: GnuYawk) |
04:54:44 | FromDiscord | <Rika> In reply to @Sabena Sema "there used to be": That's almost totally crazy lmao |
04:54:46 | FromDiscord | <Sabena Sema> Fortress was a sun research project (designed by Guy Steele!) and let you overload whitespace |
04:54:50 | * | GnuYawk joined #nim |
04:54:58 | FromDiscord | <Rika> That sounds like too much I don’t know |
04:55:02 | FromDiscord | <Sabena Sema> so you could have f(a, b) and f a, b etc do different things |
04:55:11 | FromDiscord | <Sabena Sema> and also you could have ab multiply a and b |
04:55:18 | FromDiscord | <Elegantbeef> That's crazy |
04:55:22 | FromDiscord | <Sabena Sema> yeah, the thing fortress did was pretty out there |
04:55:28 | FromDiscord | <Elegantbeef> Noob traps left/right 😀 |
04:55:37 | FromDiscord | <Sabena Sema> but the rules weren't that bad |
04:56:00 | FromDiscord | <Elegantbeef> It makes sense, but it's pretty wacky |
04:56:04 | FromDiscord | <Sabena Sema> I mean, it's designed to allow APL style programming, but also allow you do write more structured library code |
04:56:38 | FromDiscord | <Sabena Sema> yeah, it's wacky and provokes a very strong negative reaction in most programmers |
04:56:42 | FromDiscord | <Sabena Sema> but I think it was a neat idea |
04:57:19 | FromDiscord | <Rika> It's a neat idea but it's doubtful it would be useful in reality |
04:57:29 | FromDiscord | <Sabena Sema> the idea behind nim's whitespace thing was to simplify precedence rules esp w.r.t. user defined operators |
04:58:23 | FromDiscord | <Sabena Sema> fortress had a bunch of cool stuff |
04:59:23 | FromDiscord | <huantian> In reply to @Elegantbeef "How is it a": It's a pain because I keep changing vscode's autocomplete ↵though --styleCheck:hint is helpful for when I forget |
05:00:29 | FromDiscord | <huantian> I meant to try to see if I could finish the case converter but then I died (mentally) |
05:02:48 | * | jmdaemon joined #nim |
05:02:56 | * | jmdaemon quit (Remote host closed the connection) |
05:03:12 | * | jmdaemon joined #nim |
05:12:13 | * | jmdaemon quit (Quit: ZNC 1.8.2 - https://znc.in) |
05:18:02 | * | jmdaemon joined #nim |
05:19:30 | FromDiscord | <gogolxdong (liuxiaodong)> Jester sendFile is different from how nginx does. |
05:20:53 | FromDiscord | <gogolxdong (liuxiaodong)> It seems cannot serve such large file. |
05:24:06 | * | jmdaemon quit (Quit: ZNC 1.8.2 - https://znc.in) |
05:24:54 | * | vicfred joined #nim |
05:27:22 | * | jmdaemon joined #nim |
05:29:10 | * | jmdaemon quit (Client Quit) |
05:31:18 | * | rockcavera quit (Remote host closed the connection) |
06:00:32 | FromDiscord | <Marisol> Yeah and probably no resume support. Definitely use nginx for static files, use jester to send dynamic data |
06:01:12 | FromDiscord | <spazzy> so i found another C library i could try to translate that does the same thing but its a full program instead of a single header file |
06:01:30 | FromDiscord | <spazzy> which do you think would package better |
06:09:06 | * | gshumway joined #nim |
06:10:10 | FromDiscord | <Rika> You can always convert full programs into libraries |
06:13:46 | FromDiscord | <Sabena Sema> both should be fine, c2nim isn't really designed to handle translating full programs (although it can, sorta) |
06:15:06 | FromDiscord | <spazzy> i already need to do it with futhark anyway since c2nim really doesnt like variadic macros |
06:29:39 | FromDiscord | <Sabena Sema> what's futhark? |
06:31:54 | FromDiscord | <Elegantbeef> https://github.com/pmunch/futhark a C importer |
06:32:50 | FromDiscord | <Sabena Sema> ah that's cool |
06:34:02 | FromDiscord | <spazzy> unless theres a nim equivalent i dont know about |
06:34:22 | FromDiscord | <spazzy> then i could just c2nim the header file after changing literally 3 lines and it would work fine |
06:34:37 | FromDiscord | <Sabena Sema> it's typical to have to modify headers a bit before using c2nim |
06:34:52 | FromDiscord | <spazzy> i just dont know the nim equivalent of this |
06:35:13 | FromDiscord | <spazzy> https://gcc.gnu.org/onlinedocs/cpp/Variadic-Macros.html |
06:35:58 | FromDiscord | <impbox [ftsf]> nim templates are similar to macros, and they can take varargs |
06:37:30 | FromDiscord | <impbox [ftsf]> (edit) "nim templates are similar to ... macros," added "C" |
06:37:43 | FromDiscord | <impbox [ftsf]> nim macros are much more powerful |
06:37:56 | FromDiscord | <spazzy> so i could probably just change |
06:38:16 | FromDiscord | <spazzy> '''#define whatever(...)''' |
06:39:02 | FromDiscord | <spazzy> (edit) "'''#define whatever(...)'''" => "sent a code paste, see https://play.nim-lang.org/#ix=" |
06:39:04 | FromDiscord | <spazzy> to |
06:40:00 | FromDiscord | <spazzy> sent a code paste, see https://play.nim-lang.org/#ix=3IyM |
06:40:15 | FromDiscord | <impbox [ftsf]> no.... what is the C macro you're trying to convert to nim? |
06:40:44 | FromDiscord | <impbox [ftsf]> you'll need to use nim's template syntax https://nim-lang.org/docs/manual.html#templates |
06:41:06 | FromDiscord | <spazzy> yeah i know i just glanced at it without copying the syntax right tbh |
06:42:18 | FromDiscord | <spazzy> sent a code paste, see https://play.nim-lang.org/#ix=3IyN |
06:42:34 | FromDiscord | <spazzy> (edit) "https://play.nim-lang.org/#ix=3IyN" => "https://play.nim-lang.org/#ix=3IyO" |
06:44:40 | FromDiscord | <spazzy> or something close to that |
06:44:41 | FromDiscord | <spazzy> sent a code paste, see https://play.nim-lang.org/#ix=3IyP |
06:44:49 | FromDiscord | <Yardanico> we have `varargs` in Nim but that's mainly for C interop |
06:45:00 | FromDiscord | <Yardanico> well, actually not only for them, but yeah, it's not used often |
06:45:05 | FromDiscord | <Yardanico> but you can use them of course |
06:45:15 | FromDiscord | <spazzy> i mean im translating a c header file |
06:45:25 | FromDiscord | <impbox [ftsf]> for what purpose? |
06:45:29 | FromDiscord | <impbox [ftsf]> to wrap a c library? |
06:45:33 | FromDiscord | <spazzy> yeah |
06:45:48 | FromDiscord | <impbox [ftsf]> well you probably don't need that macro in the wrapper |
06:46:02 | FromDiscord | <spazzy> https://github.com/krychu/wfc |
06:46:06 | FromDiscord | <spazzy> it kinda relies on it |
06:46:59 | FromDiscord | <impbox [ftsf]> see that header file is not just a header |
06:47:08 | FromDiscord | <impbox [ftsf]> it's also an implementation file |
06:47:14 | FromDiscord | <spazzy> yeah |
06:47:37 | FromDiscord | <impbox [ftsf]> you only wrap the header bits |
06:47:41 | FromDiscord | <impbox [ftsf]> not the implementation bits |
06:48:06 | FromDiscord | <spazzy> which is why i was using futhark |
06:48:12 | FromDiscord | <impbox [ftsf]> all the bits inside #ifdef WFC_IMPLEMENTATION you can ignore |
06:48:25 | FromDiscord | <impbox [ftsf]> just wrap the few bits outside it |
06:49:03 | FromDiscord | <impbox [ftsf]> if you're going to wrap the implementation you may as well just reimplement it in nim |
06:50:15 | FromDiscord | <impbox [ftsf]> you only need to wrap lines 147..167 |
06:52:08 | FromDiscord | <impbox [ftsf]> https://github.com/define-private-public/stb_image-Nim example of a header only c library wrapped in nim |
06:52:31 | FromDiscord | <spazzy> thats actually really convenient if i wanted to wrap the whole thing |
06:52:53 | FromDiscord | <impbox [ftsf]> though it goes a fair bit further than the minimum by making nice nimmy functions |
06:53:06 | FromDiscord | <spazzy> since the wfctool.c relies on stb_image |
06:53:42 | FromDiscord | <impbox [ftsf]> but wfctool isn't a library, so you don't need to wrap it |
06:53:59 | FromDiscord | <spazzy> yeah i know, i mean if i wanted to just rewrite the thing |
07:48:27 | * | PMunch joined #nim |
07:54:57 | * | PMunch quit (Quit: leaving) |
08:01:33 | * | PMunch joined #nim |
08:56:06 | * | Jjp137 quit (Ping timeout: 260 seconds) |
09:10:01 | FromDiscord | <Michal58> In reply to @Elegantbeef "https://github.com/pmunch/futhark a C importer": Huh I thought you people are talking about the programming language and was rather confused. |
09:17:53 | PMunch | A lot more people have heard of Futhark the programming language than I first anticipated.. |
09:18:24 | FromDiscord | <Elegantbeef> rename it to "No not that Futhark" |
09:20:20 | FromDiscord | <Rika> PMunch more likely that a search yields the language first |
09:20:22 | madprops | never heard of it |
09:21:22 | madprops | that's a nice looking readme PMunch |
09:21:47 | PMunch | @Rika, yeah that makes sense. Just have to make Futhark more popular I guess :P |
09:21:52 | PMunch | madprops, thank you :) |
09:26:47 | FromDiscord | <Michal58> In reply to @Rika "PMunch more likely that": I wasn't googling but might be the case in general |
09:29:18 | FromDiscord | <Michal58> I have futhark - the lang only as the last link on the 3rd page on Google |
09:31:15 | PMunch | What are you first three pages filled with? Info about the real Futhark stuff? |
09:35:43 | madprops | i get an elder, runes, and the lang, on first page |
09:36:22 | PMunch | The elder Futhark is just the old runic alphabet, so both those first ones are about runes |
09:37:49 | madprops | last commit on github 2 hours ago, the lang |
09:38:06 | PMunch | Oh yeah, it is an actively developed language |
09:38:13 | PMunch | Just didn't think it was that well known |
09:38:40 | FromDiscord | <Michal58> In reply to @PMunch "What are you first": Yeah basically |
09:39:02 | FromDiscord | <Michal58> In reply to @PMunch "Just didn't think it": I know it from the context free YT channel |
10:31:23 | FromDiscord | <Tanguy> Is there a way to read a file from nimscript? |
10:32:28 | PMunch | readFile doesn't work? |
10:32:44 | FromDiscord | <Tanguy> `Error: undeclared identifier: 'copyMem'` |
10:33:14 | FromDiscord | <Tanguy> Ah, it works on devel but not on 1.2 |
10:33:44 | PMunch | Works for me on 1.2 as well.. |
10:34:31 | PMunch | But it appears to be a special `readFile` and not the one from the `os` module as I get `/tmp/test.nims(1, 8) Warning: imported and not used: 'os' [UnusedImport]` on 1.2 but not on 1.6 |
10:35:13 | FromDiscord | <Tanguy> Mhh, it's broken on my script because of `import json` |
10:35:13 | FromDiscord | <Elegantbeef> Readfile isnt in os |
10:35:42 | PMunch | Oh, you're right |
10:35:53 | PMunch | Why isn't it shown as not used for 1.6 then? |
10:36:22 | FromDiscord | <Elegantbeef> Usage bug possibly?? |
10:36:53 | PMunch | Or just the output flags for `nim e` have changed |
10:37:49 | FromDiscord | <Tanguy> So import json / parseJson / `from json import parseJson` breaks it↵I'm back to parsing manually I guess |
10:38:21 | FromDiscord | <Rika> Somewhat odd |
10:39:01 | FromDiscord | <Elegantbeef> https://play.nim-lang.org/#ix=3Izp indeed |
10:39:52 | FromDiscord | <Elegantbeef> The copymem error sounds like you're using a procedure that uses copymem, are you sure you've narrowed where it comes from? |
10:40:02 | FromDiscord | <Tanguy> Playground uses nimscript? |
10:40:14 | FromDiscord | <Tanguy> Oh no, const, ok |
10:40:23 | FromDiscord | <Elegantbeef> I assign an expression to a const which is done using nimscript |
10:40:40 | FromDiscord | <Elegantbeef> Or are we talking about an embedded VM? |
10:41:01 | FromDiscord | <Tanguy> A nimble file but I think that's the same as nimscript |
10:41:10 | FromDiscord | <Elegantbeef> Yea it's nimscript |
10:41:18 | FromDiscord | <Elegantbeef> Which is the same as compile time evaluation |
10:41:29 | FromDiscord | <gogolxdong (liuxiaodong)> How to convert array to string? |
10:41:44 | FromDiscord | <gogolxdong (liuxiaodong)> array/seq to string |
10:42:39 | FromDiscord | <Tanguy> sent a code paste, see https://play.nim-lang.org/#ix=3Izq |
10:42:40 | FromDiscord | <Tanguy> Must not by exactly the same then |
10:43:08 | FromDiscord | <Elegantbeef> you're compiling a nimscript ifle |
10:43:31 | FromDiscord | <Elegantbeef> Use `nim e test.nims` |
10:43:42 | FromDiscord | <Tanguy> Same |
10:43:51 | FromDiscord | <Tanguy> Oh but in your test you don't use readFile, only json |
10:43:53 | FromDiscord | <Elegantbeef> Wait `nim c .nims` evaluates it aswell i guess |
10:44:07 | FromDiscord | <Tanguy> It's readFile + import json which fails |
10:44:14 | FromDiscord | <ynfle (ynfle)> @gogolxdong with the ``$` ` operator |
10:44:25 | FromDiscord | <Elegantbeef> `Error: unhandled exception: cannot open: test.json [IOError]` |
10:44:27 | FromDiscord | <Elegantbeef> Nope |
10:44:33 | FromDiscord | <Elegantbeef> Works fine |
10:45:04 | FromDiscord | <Elegantbeef> What's your nim version? |
10:45:07 | FromDiscord | <Tanguy> 1.2.14 |
10:45:20 | FromDiscord | <Tanguy> Latest and greatest 🙂 |
10:45:27 | FromDiscord | <gogolxdong (liuxiaodong)> `$` converts to the format of `@[]` / `[]` string |
10:45:31 | FromDiscord | <Elegantbeef> That's not latest |
10:45:33 | FromDiscord | <Elegantbeef> Latest is 1.6 |
10:45:36 | FromDiscord | <Tanguy> I know |
10:45:54 | FromDiscord | <Rika> Gogo if you want quick and dirty you can cast between them |
10:45:57 | FromDiscord | <Elegantbeef> That bug has been fixed in 1.6 if you look at the error it was cause something was using `streams` and didnt handle it for nimscript |
10:45:58 | FromDiscord | <ynfle (ynfle)> @gogolxdong So what to you want? |
10:46:06 | FromDiscord | <Rika> If you want correct you have to iterate and make a new container |
10:47:08 | FromDiscord | <gogolxdong (liuxiaodong)> string data |
10:47:12 | FromDiscord | <Elegantbeef> So i guess if you insist on using 1.2 find the PR that fixed it and request it be backported |
10:47:46 | FromDiscord | <ynfle (ynfle)> @gogolxdong Can you be more specific? I don't know what string data means. A string representation of the seq/array? |
10:48:07 | FromDiscord | <Rika> @gogolxdong did you see what I said? |
10:48:15 | FromDiscord | <Elegantbeef> sent a code paste, see https://play.nim-lang.org/#ix=3Izr |
10:48:23 | FromDiscord | <Tanguy> But I don't understand why I can't repro it in the playground |
10:48:40 | FromDiscord | <Elegantbeef> What do you mean? |
10:49:35 | FromDiscord | <gogolxdong (liuxiaodong)> I found some similiar question in hisotry , some one uses arr.mapIt(char it).join |
10:49:49 | FromDiscord | <Tanguy> sent a code paste, see https://play.nim-lang.org/#ix=3Izs |
10:50:08 | FromDiscord | <Elegantbeef> Sounds like a regression with streams |
10:50:29 | FromDiscord | <Tanguy> Yeah but the playground is using the same 1.2.12 as me, no? |
10:50:42 | FromDiscord | <Elegantbeef> Thought you said you were using 1.2.14 |
10:50:50 | FromDiscord | <gogolxdong (liuxiaodong)> which is better, copyMem or mapIt.join |
10:50:52 | FromDiscord | <Tanguy> I have the same issue on 1.2.12 |
10:50:58 | FromDiscord | <Elegantbeef> As do i |
10:51:10 | FromDiscord | <Elegantbeef> Playground might be running arm which might behave differently? |
10:51:24 | FromDiscord | <Elegantbeef> I dont know, all i know is it's fixed in modern version so something needs backported/fixed |
10:51:28 | FromDiscord | <Elegantbeef> Anyway i need to go to sleep |
10:51:46 | FromDiscord | <Tanguy> Mhh yeah, weird. thanks |
10:52:39 | FromDiscord | <Rika> Copy is better |
10:55:32 | PMunch | gogolxdong_(liuxiaodong), if you want to convert a seq[char] to a string you can just do a cast |
10:55:45 | FromDiscord | <Rika> Am I being ignored globally or what |
10:55:46 | PMunch | It's a bit hacky, but they are essentially the same type |
10:55:56 | PMunch | @Rika, ignored? |
10:56:09 | PMunch | Oh, you already said that :P |
10:56:12 | PMunch | Sorry I was AFK |
10:56:14 | FromDiscord | <Rika> In reply to @Rika "Gogo if you want": Yeah I said it a while ago |
10:56:34 | FromDiscord | <Rika> I asked because no one seemed to acknowledge that I was here lol |
10:57:48 | PMunch | !eval echo hostCPU & " is the CPU on the playground ElegantBeef" |
10:57:50 | NimBot | amd64 is the CPU on the playground ElegantBeef |
11:05:21 | * | Jjp137 joined #nim |
11:08:58 | * | toothlessgear joined #nim |
11:23:13 | FromDiscord | <krisppurg> In reply to @huantian "Man why does dimscord": True, but I did it to also match discord's snake case json fields (which is used for json.to) but also to make it look a little nicer. Then again you can write attributes as in camelCase. |
11:42:28 | FromDiscord | <ynfle (ynfle)> @gogolxdong What do you want? If you `[1, 2, 3, 4] -> "1234"`then`sequtils.mapIt` & `strutils.join` if you want `['1', '2', '3']` the you can use join with out mapIt. You can also do copymem and cast, but cast isn't stable. ie. it's an implementation detail (may apply to copymem) as well |
12:06:01 | * | supakeen quit (Quit: WeeChat 3.3) |
12:06:31 | * | supakeen joined #nim |
12:06:42 | PMunch | I still hold that we should create a wrapper for `cast[string]` and `cast[seq[char/uint8/int8/byte]]` so that if this implementation detail changes then it won't break every program who depends on this behaviour |
12:39:22 | * | pro joined #nim |
12:39:29 | * | pro quit (Client Quit) |
13:15:33 | FromDiscord | <hmmm> sent a code paste, see https://play.nim-lang.org/#ix=3IzQ |
13:23:06 | FromDiscord | <el__maco> this is correct |
13:23:24 | FromDiscord | <el__maco> its called short circuit evaluation |
13:24:40 | FromDiscord | <hmmm> sent a code paste, see https://play.nim-lang.org/#ix=3IzS |
13:25:36 | FromDiscord | <el__maco> assuming the official nim tutorial knows the semantics, the answer is yes i.e. you don't need to do that 😅 |
13:26:23 | FromDiscord | <hmmm> haha let's hope, I'll let you know if the entire mess will take fire and burn out |
13:27:17 | FromDiscord | <el__maco> easy enough to verify https://play.nim-lang.org/#ix=3IzT |
13:35:56 | * | rockcavera joined #nim |
13:35:56 | * | rockcavera quit (Changing host) |
13:35:56 | * | rockcavera joined #nim |
13:40:42 | * | lumo_e joined #nim |
13:50:19 | FromDiscord | <IsaacPaul> sent a code paste, see https://play.nim-lang.org/#ix=3Ivi |
13:50:41 | FromDiscord | <IsaacPaul> with optimizations on (o2 or o3) |
13:54:40 | FromDiscord | <el__maco> the compiler would have to be extra sure thing2() absolutely does not have side effects |
13:55:36 | FromDiscord | <el__maco> that said I it wouldn't surprise me if some compilers would postpone the call |
14:02:10 | * | arkurious joined #nim |
14:05:51 | * | vicfred quit (Quit: Leaving) |
14:43:37 | * | noeontheend quit (Ping timeout: 240 seconds) |
14:53:02 | * | xet7 quit (Quit: Leaving) |
15:07:20 | * | PMunch quit (Quit: leaving) |
15:18:11 | * | pro joined #nim |
15:18:45 | FromDiscord | <eyecon> What kind of solutions do we have currently for a previously unknown number of tasks, which should run "concurrently" (suspending as in Kotlin-like coroutines or blocking) and can spawn other tasks, and which need to pass information back (not just at completion but also in between)? |
15:19:13 | FromDiscord | <eyecon> I know threadpool which spawns threads, and `Channel`s as message-passing mechanism |
15:20:22 | FromDiscord | <eyecon> Do we have maybe a similar information passing mechanism which can be used with single-threaded concurrent (async/await) code? AFAIK the channels are not designed for non-multithread applications |
15:22:30 | FromDiscord | <JSONBash> There is a project to implement a CPS runtime (https://github.com/nim-works/cps) but it is a work in progress |
15:23:24 | FromDiscord | <JSONBash> other than that, there is asyncdispatch which uses async/await |
15:24:23 | FromDiscord | <JSONBash> but I don't know of any good threaded and async solutions (would like to know one too) |
15:24:41 | FromDiscord | <JSONBash> you could look at httpbeast and see how it has implemented a threaded and async system? |
15:25:27 | FromDiscord | <eyecon> In reply to @JSONBash "There is a project": Full-blown CPS is nice for sure, let's hope it's complete soon |
15:25:41 | FromDiscord | <eyecon> In reply to @JSONBash "you could look at": Good thinking, I'll do that, thanks |
15:26:20 | FromDiscord | <eyecon> In reply to @JSONBash "other than that, there": But no way to pass information between the concurrent running paths? |
15:27:03 | FromDiscord | <exelotl> @eyecon the actual built-in language mechanism for resumable functions is "closure iterators" - this is what async/await are built on-top of |
15:27:07 | FromDiscord | <exelotl> https://nim-lang.github.io/Nim/manual.html#iterators-and-the-for-statement-firstminusclass-iterators |
15:28:43 | * | pro quit (Quit: WeeChat 3.3) |
15:29:15 | FromDiscord | <eyecon> Yes, I saw that, I think that is _almost_ CPS but not quite |
15:29:47 | FromDiscord | <eyecon> Previously I dabbled in Kotlin and this is solved really really well there |
15:30:15 | FromDiscord | <eyecon> So I'm looking for things I can put together to achieve something similar |
15:30:35 | FromDiscord | <fumamatar> sent a code paste, see https://play.nim-lang.org/#ix=3IAD |
15:30:50 | FromDiscord | <fumamatar> (edit) "https://play.nim-lang.org/#ix=3IAF" => "https://play.nim-lang.org/#ix=3IAE" |
15:34:03 | FromDiscord | <eyecon> In reply to @JSONBash "There is a project": This looks actually quite good, thanks again |
15:38:13 | FromDiscord | <can.l> In reply to @fumamatar "Sorry for interrupting you": A seq is not just a pointer (it also has fields for length and capacity), this is why simply casting a pointer to a seq will not give you a valid seq object. One solution is to use copyMem to copy your ethernet_header into the buffer. In this case no call to alloc is necessary. |
15:43:15 | FromDiscord | <fumamatar> Oh that makes sense, thank you. copyMem sounds good, would there otherwise be something analogue to a char in c? |
15:44:41 | FromDiscord | <can.l> There is ptr byte and ptr UncheckedArray[byte], but I would not recommend using it in most cases. |
15:45:18 | FromDiscord | <fumamatar> oh well that makes sense, its quite literally the same as char |
15:45:29 | FromDiscord | <fumamatar> thank you for your help, i appreciate it ! |
15:48:15 | FromDiscord | <Fish-Face> why is `--gc:none` slower than `--gc:orc` ... at least to me it seems that way, benching AoC problems |
15:55:31 | FromDiscord | <exelotl> could be that gc:orc is allowing you to reuse the same block of memory that was just freed (which may be cached or something) while gc:none forces new blocks to be allocated every time |
16:30:49 | * | fputs quit (Ping timeout: 250 seconds) |
16:35:23 | * | src joined #nim |
18:10:40 | FromDiscord | <hmmm> is aoc still going? I'm not hearing updates from pmunch |
18:11:15 | FromDiscord | <hmmm> !sheerluck !updatestatus |
18:14:02 | FromDiscord | <el__maco> I thought he said he's travelling and won't be streaming |
18:14:18 | FromDiscord | <hmmm> ah ok 👍 |
18:14:32 | FromDiscord | <hmmm> who is leading nim leaderboard |
18:15:15 | * | jmdaemon joined #nim |
18:29:18 | FromDiscord | <kevin> Thoughts about nesting Nim func/proc for functions only used within that proc? |
18:30:22 | FromDiscord | <kevin> sent a code paste, see https://play.nim-lang.org/#ix=3IBv |
18:30:42 | FromDiscord | <kevin> if the local proc is only used within the greater scoped proc is this a good idea |
18:31:10 | FromDiscord | <kevin> or should you just keep them in the same scope level |
18:31:50 | FromDiscord | <kevin> sent a code paste, see https://play.nim-lang.org/#ix=3IBx |
18:31:59 | FromDiscord | <kevin> (edit) "https://play.nim-lang.org/#ix=3IBx" => "https://play.nim-lang.org/#ix=3IBy" |
18:33:15 | FromDiscord | <Rosen> I like not polluting the global namespace so I'd always nest as long as I was SURE it wouldn't ever be reused in a different proc |
18:35:01 | NimEventer | New thread by Miran: Nim 1.2.16 released, see https://forum.nim-lang.org/t/8715 |
18:35:42 | FromDiscord | <exelotl> both are acceptable, I do like nested procedures though, as they can make it easier to reason about the code (when you see an unexported function at the top level you have to figure out where is it used in the file - nested procedures simplify that) |
18:39:39 | * | xet7 joined #nim |
19:03:05 | NimEventer | New thread by Despam: Nim - shell, see https://forum.nim-lang.org/t/8716 |
19:05:28 | FromDiscord | <Michal58> sent a code paste, see https://play.nim-lang.org/#ix= |
19:12:42 | * | tombrick joined #nim |
19:13:59 | FromDiscord | <Michal58> my Nim is weird |
19:16:54 | FromDiscord | <Solitude> windows has 1 mb stack limit according to stackoverflow |
19:16:56 | FromDiscord | <el__maco> aren't nim arrays on the stack? Maybe asking for 2MB is too much |
19:17:01 | FromDiscord | <Solitude> you allocate 4 mb |
19:17:22 | FromDiscord | <el__maco> 4MB yes, I forgot the int is 64 bit |
19:17:53 | FromDiscord | <Michal58> ok thanks |
19:18:19 | FromDiscord | <Michal58> I just trying my original code in the playground and it worked first time |
19:18:25 | FromDiscord | <Michal58> i lost 2 hors to that |
19:18:27 | FromDiscord | <Solitude> playground runs on linux |
19:18:36 | FromDiscord | <Solitude> which has 8 mb stack limit by default |
19:18:39 | FromDiscord | <Michal58> In reply to @Solitude "playground runs on linux": ik that's what I'm saying |
19:19:16 | * | noeontheend joined #nim |
19:19:17 | FromDiscord | <Michal58> how do I change the limit? |
19:22:17 | FromDiscord | <demotomohiro> I think you need to google "man gcc" and pass the gcc option via --passC. |
19:23:06 | FromDiscord | <demotomohiro> Or use seq instead of array. |
19:25:46 | * | krux02 joined #nim |
19:26:13 | FromDiscord | <Recruit_main707> id say once you are at 4mb you are most likely not gonna get any kind of performance improvements compared to using sequences |
19:26:28 | FromDiscord | <Recruit_main707> probably the opposite |
19:35:53 | FromDiscord | <Michal58> yeah, that makes sense |
19:43:02 | FromDiscord | <Michal58> Thank you everyone |
19:54:19 | tombrick | this compiles and works without examining the list of children, but obviously "children" ("para5") is meant to be some sort of unchecked array of Windows. is it possible to pass in something or cast it with the existing proc signature? https://termbin.com/dkcm |
19:59:41 | tombrick | i was trying to find some examples of UncheckedArray and types in similar function calls, too, without success |
20:07:37 | * | lumo_e quit (Ping timeout: 240 seconds) |
20:08:19 | tombrick | oh! i think i got it with cast[ptr UncheckedArray[Window]](children) |
20:10:59 | FromDiscord | <Michal58> Would it be possible to say the error is due to exceeding the stack size limit in the error message? @Recruit_main707 @Solitude @elmaco |
20:14:12 | FromDiscord | <Recruit_main707> idk |
20:16:35 | * | noeontheend quit (Ping timeout: 256 seconds) |
20:19:36 | FromDiscord | <Solitude> In reply to @Michal58 "Would it be possible": error message comes from os |
20:20:30 | FromDiscord | <Michal58> ok detect that at compilation time then |
20:20:40 | FromDiscord | <Michal58> at least give a warning |
20:20:54 | FromDiscord | <Michal58> ? |
20:22:01 | FromDiscord | <Solitude> ok |
20:22:49 | * | lumo_e joined #nim |
20:53:20 | FromDiscord | <analesthetist> hi, i'm quite new to the language and i'm checkout out parallelization |
20:53:32 | FromDiscord | <analesthetist> i'm trying to paralelize an iterator |
20:53:58 | FromDiscord | <analesthetist> but i think the iterators are sharing memory |
20:54:43 | FromDiscord | <analesthetist> because internally the iterator created a table and a deque |
20:54:59 | FromDiscord | <analesthetist> and weird stuff happens que running in parallel |
21:32:33 | FromDiscord | <el__maco> I'm not convinced that the compiler could give a warning for running out of stack. It probably could in trivial cases, but the trivial cases are relatively easy to figure out anyways 🤷♂️ |
21:33:14 | * | bkay joined #nim |
21:34:25 | * | beshr quit (Ping timeout: 268 seconds) |
21:34:48 | FromDiscord | <leorize> I don't see why it could not, the compiler has to allocate this space for variables anyway, and it knows all the sizes |
21:35:42 | FromDiscord | <el__maco> yes but it doesn't know what happens at runtime |
21:37:16 | FromDiscord | <ynfle (ynfle)> Doesn't nim allocate itself? |
21:40:14 | FromDiscord | <el__maco> not sure what you mean |
21:41:48 | FromDiscord | <leorize> variables in a function are typically allocated up front |
21:42:07 | FromDiscord | <leorize> so the compiler know how much stack is necessary for a stack frame |
21:42:42 | FromDiscord | <el__maco> local variables are on stack, and you cannot allocate them ahead of time. But obviously you have to know how much space is required |
21:42:48 | FromDiscord | <leorize> now if you do recursion, then it's not detectable by the compiler, but the cost of a stack frame is definitely measurable |
21:43:43 | FromDiscord | <el__maco> when you know how much stack you need you increment or decrement the stack pointer by that amount, and whether or not you run out depends on where the stack pointer was at that moment |
21:44:09 | FromDiscord | <el__maco> this takes place at runtime, at compile time you don't know |
21:44:25 | FromDiscord | <leorize> yea but the compiler knows how much would a function need to run, like the minimum needed |
21:44:38 | FromDiscord | <el__maco> yes, but it doesn't know your call stack |
21:44:51 | FromDiscord | <el__maco> so it can only reason about the trivial case |
21:45:17 | FromDiscord | <leorize> yes, but you could easily catch a 1MiB stack frame caused by oversized variables |
21:45:33 | FromDiscord | <el__maco> 1MB can be perfectly okay, even on Windows |
21:45:56 | FromDiscord | <el__maco> though I wouldn't necessarily write such code but you know |
21:47:25 | FromDiscord | <el__maco> you could add a warning for the trivial case surely, but how useful that would be since you cannot rely on that warning at all |
21:49:43 | FromDiscord | <leorize> it can still be plenty useful, we have more warnings than most users will see |
22:06:02 | qwr | "Error: cannot 'importc' variable at compile time; F_WRLCK" -- what it actually means? i'm cross compiling and specified --cincludes:/usr/arm-linux-gnueabihf/include but this seems to not help? |
22:09:21 | * | qwr thinks it tries to use in posix_other_consts.nim var F_WRLCK* {.importc: "F_WRLCK", header: "<fcntl.h>".}: cint |
22:25:29 | FromDiscord | <Sabena Sema> in general without recursion (or mutual recursion) you can put static bounds on stack size and then prove they are met |
22:26:50 | FromDiscord | <Sabena Sema> in terms of making sure (at runtime) the program will crash fairly gracefully if you run out of stack (or run out of memory in general) you need stack probes |
22:27:18 | FromDiscord | <Sabena Sema> oh, variable length arrays/alloca with runtime size can break static proofs of stack size too |
22:27:23 | * | qwr could work around the problem by replacing F_WRLCK with 1 (that is its value), but would be interesting to know what could be the cause (cross compiling on arm64 debian for armhf...) |
22:27:26 | FromDiscord | <Sabena Sema> but can still be dealt with using probes |
22:27:50 | FromDiscord | <Sabena Sema> (historically a lot of C99 compilers just ... didn't emit correct probes for alloca, which was embarrassing and led to the feature's removal |
22:27:53 | FromDiscord | <Sabena Sema> (edit) "removal" => "removal)" |
22:32:03 | FromDiscord | <Sabena Sema> you can't just ask the OS how much "stack space" is left at runtime and compare, since the kernel does not reserve enough memory to ensure programs can successfully execute, it'll only (at best) reserve memory exactly when you ask for it |
22:32:14 | FromDiscord | <Sabena Sema> so asking "is there memory" then allocating memory is a race |
22:38:00 | FromDiscord | <Sabena Sema> anyhow, you can get stack size checks by passing `--passc:/Gs` and perhaps gcc's `-fstack-check` option |
22:38:18 | FromDiscord | <Sabena Sema> gcc appears to like, not probe every page... I'm not sure |
22:38:28 | FromDiscord | <Sabena Sema> it also probes using writes which is extremely odd |
22:56:09 | * | tombrick quit (Quit: tombrick) |
23:04:10 | * | krux02 quit (Remote host closed the connection) |
23:27:51 | FromDiscord | <huantian> looking at <https://nim-lang.org/docs/tut2.html#object-oriented-programming-object-variants>↵and wondering if there's a way to notate that a proc returns a specific variant |
23:28:22 | FromDiscord | <Elegantbeef> Using a macro you could, but nothing built in |
23:28:33 | FromDiscord | <huantian> kk |
23:34:58 | FromDiscord | <Elegantbeef> https://play.nim-lang.org/#ix=3ICC here's an example |
23:41:34 | FromDiscord | <ynfle (ynfle)> @beef, it won't help for the type system though. Just more like a sanity check |
23:43:12 | FromDiscord | <Elegantbeef> Well you could also make it check it in the type system checking all constructors of the procedure |
23:44:02 | FromDiscord | <Elegantbeef> Basically check all assignment to result at CT assuming the functions they call dont rely on importC would work |
23:44:14 | FromDiscord | <Elegantbeef> It'd be a big ol' macro to write but it's mostly doable |
23:44:54 | FromDiscord | <ynfle (ynfle)> Only if you have control over it, ie. you have control over the library if it's not your own |
23:46:08 | FromDiscord | <Elegantbeef> I dont follow |
23:47:06 | FromDiscord | <ynfle (ynfle)> Never mind. Basically to ensure that the proc from the json module returns a certain type, or to enforce that the other person knows that this type is of a certain variant |
23:47:13 | FromDiscord | <ynfle (ynfle)> Either way. It's some next level stuff |
23:48:19 | FromDiscord | <Elegantbeef> I think it's still doable with json since if anywhere in the proc call stack there is an object constructed that doesnt have your given type you stop compilation |
23:48:59 | FromDiscord | <Elegantbeef> So if you call parseJson and you annotate your proc with `kind: jInt` or w/e the kind is and it finds constructors that dont construct with that kind it'd error |
23:49:32 | FromDiscord | <leorize> maybe one of these days we can create a macro that creates an union from a representation \:p |
23:50:04 | FromDiscord | <Elegantbeef> lol |
23:50:24 | FromDiscord | <Elegantbeef> doesnt even know what that means |
23:50:47 | FromDiscord | <leorize> factor JsonNode -\> JInt, JNull, etc. automatically |
23:51:14 | FromDiscord | <leorize> and when used with `union`, for example, any combination of these types result in the `JsonNode` object, but distinct \:p |
23:54:42 | FromDiscord | <MegaIng (MegaIng)> sent a code paste, see https://paste.rs/YTD |
23:56:10 | FromDiscord | <Elegantbeef> You can put the nonref before the ref, however odd |
23:57:08 | FromDiscord | <Elegantbeef> sent a code paste, see https://play.nim-lang.org/#ix=3ICF |
23:57:12 | FromDiscord | <Elegantbeef> Seems it's just an issue with the generic type definition |
23:57:36 | FromDiscord | <Elegantbeef> Dont know if you were adding more to the `obj` if not this is a good way of doing it |
23:58:15 | FromDiscord | <Elegantbeef> Oh nvm i broke the type definition like a dummy |
23:58:57 | FromDiscord | <Elegantbeef> Putting the obj before the ref solves the issue so seems like an issue with the generic cache |
23:59:11 | FromDiscord | <Elegantbeef> sent a code paste, see https://play.nim-lang.org/#ix=3ICG |