00:04:29 | FromDiscord | <_gumbercules> I remember talking to you years ago about Scala collections in here - I think even before Nim discord was a thing (I think the Gitter bridge was at thing then) |
00:09:48 | FromDiscord | <eb442a17a2aaee577399ca9e38eb67b5> Compiled nim files are PE's right? |
00:11:06 | FromDiscord | <eb442a17a2aaee577399ca9e38eb67b5> How do I compile nim down to a C# executable |
00:11:11 | FromDiscord | <eb442a17a2aaee577399ca9e38eb67b5> (edit) "How do I compile nim down to a C# ... executable" added ".NET" |
00:11:17 | FromDiscord | <eb442a17a2aaee577399ca9e38eb67b5> or is it not possible |
00:14:19 | FromDiscord | <_gumbercules> You don't because Nim doesn't have a .NET backend |
00:14:40 | FromDiscord | <_gumbercules> You would instead compile your Nim program to a DLL and call into it from C# |
00:14:42 | FromDiscord | <eb442a17a2aaee577399ca9e38eb67b5> How does winim work then? |
00:14:45 | FromDiscord | <_gumbercules> or a static library |
00:15:13 | FromDiscord | <_gumbercules> winim simply wraps C/C++ APIs that the windows SDK exposes |
00:15:34 | FromDiscord | <eb442a17a2aaee577399ca9e38eb67b5> ok |
00:16:04 | FromDiscord | <eb442a17a2aaee577399ca9e38eb67b5> Would this work? found it on github |
00:16:05 | FromDiscord | <eb442a17a2aaee577399ca9e38eb67b5> sent a code paste, see https://play.nim-lang.org/#ix=4DBT |
00:16:31 | FromDiscord | <_gumbercules> Well... |
00:17:48 | FromDiscord | <_gumbercules> to be honest, I haven't done this sort of thing before because I just use Nim and not much C#. The `stdcall`, `exportc` and `dynlib` pragmas all look correct. As for the naming of `DllMain` / `importc` of `NimMain` I cannot say. I also don't know how you'd consume this in a C# program. If you're finding stuff on Github though - it's probably going to be better than whatever I can offer. |
00:18:16 | FromDiscord | <_gumbercules> https://stackoverflow.com/questions/33348222/how-to-create-a-nim-dll-and-call-it-from-c-sharp↵https://www.euantorano.co.uk/posts/2016/09/30/nim-with-c-sharp-net/ |
00:18:32 | FromDiscord | <_gumbercules> https://gist.github.com/zah/fe8f5956684abee6bec9 - Generally you can trust stuff from Zahary |
00:30:44 | FromDiscord | <heysokam> is there an existing pragma for `{.passC: "-I/some/path".}` for C headers? 🤔 |
00:31:22 | FromDiscord | <heysokam> something like `{.link.}`, but for includes |
00:40:42 | FromDiscord | <Elegantbeef> Other than `emit:"/INCLUDESECTION/...."` |
00:40:48 | FromDiscord | <Elegantbeef> ? |
00:41:21 | * | Guest50 joined #nim |
00:42:06 | * | Guest50 quit (Client Quit) |
01:00:48 | * | cnx quit (Remote host closed the connection) |
01:02:03 | * | cnx joined #nim |
01:21:40 | * | lucasta_ joined #nim |
01:24:49 | FromDiscord | <heysokam> sent a code paste, see https://play.nim-lang.org/#ix=4DC7 |
01:25:09 | FromDiscord | <heysokam> (edit) "https://play.nim-lang.org/#ix=4DC7" => "https://play.nim-lang.org/#ix=4DC8" |
01:30:55 | * | krux02 quit (Remote host closed the connection) |
01:30:58 | FromDiscord | <eb442a17a2aaee577399ca9e38eb67b5> tf? |
01:31:01 | FromDiscord | <eb442a17a2aaee577399ca9e38eb67b5> sent a code paste, see https://play.nim-lang.org/#ix=4DCa |
01:31:23 | FromDiscord | <Elegantbeef> epoch time doesnt take a float |
01:31:35 | FromDiscord | <Elegantbeef> It returns a float |
01:31:38 | FromDiscord | <eb442a17a2aaee577399ca9e38eb67b5> What does it take then, because it says float |
01:31:41 | FromDiscord | <eb442a17a2aaee577399ca9e38eb67b5> oh |
01:31:44 | FromDiscord | <eb442a17a2aaee577399ca9e38eb67b5> So what do I give it? |
01:31:53 | FromDiscord | <Elegantbeef> Nothing |
01:42:37 | FromDiscord | <terrygillis> sent a code paste, see https://play.nim-lang.org/#ix=4DCc |
01:42:59 | FromDiscord | <terrygillis> (edit) "https://play.nim-lang.org/#ix=4DCc" => "https://play.nim-lang.org/#ix=4DCd" |
01:43:58 | FromDiscord | <Elegantbeef> The output as in the generate code does not actually export the symbol, or `repr` doesnt show the ``? |
01:44:30 | FromDiscord | <terrygillis> The output doesn't export the symbol |
01:44:48 | FromDiscord | <Elegantbeef> Well without an actual test case I can only say "you're wrong" |
01:46:00 | FromDiscord | <terrygillis> And it only happened with type names e.g: `type A =` but the fields of object variants still include (`field1: int, field2: string`) |
01:51:03 | FromDiscord | <terrygillis> https://play.nim-lang.org/#ix=4DCf a reproduction of my problem |
01:51:40 | FromDiscord | <terrygillis> despite the nnkPostfix it doesn't output the after the type name "DEMO" |
01:52:34 | FromDiscord | <terrygillis> neither is it included when exported to a string |
01:52:48 | FromDiscord | <Elegantbeef> Well then it's not in the ast |
01:52:51 | FromDiscord | <Elegantbeef> `echo result.treeRepr` |
01:55:32 | FromDiscord | <terrygillis> In reply to @Elegantbeef "`echo result.treeRepr`": when echoing that in the macro itself it does include in the |
01:56:44 | FromDiscord | <terrygillis> in fact `echo result.repr` in the macro ITSELF includes it but once it leaves the macro the postfix just disappear |
01:57:12 | FromDiscord | <Elegantbeef> Are you inside a block where exporting is not sensible? |
01:57:28 | FromDiscord | <Elegantbeef> Without the code it's impossible to say the issue |
01:57:34 | FromDiscord | <terrygillis> https://play.nim-lang.org/#ix=4DCh |
01:58:30 | FromDiscord | <terrygillis> somehow the macro invocation sanitised away the star postfix as in the snippet |
01:59:02 | FromDiscord | <Elegantbeef> But it's actually exported |
01:59:54 | FromDiscord | <Elegantbeef> You're echoing typed ast `` is dropped cause it's not needed |
02:00:31 | FromDiscord | <terrygillis> Is there any way to retain the |
02:00:35 | FromDiscord | <terrygillis> (edit) "Is there any way to retain the ... " added "?" |
02:00:57 | FromDiscord | <Elegantbeef> Change the compiler so it's rendering of PNodes includes `` inside exported typedefs |
02:01:32 | FromDiscord | <Elegantbeef> Write your own stringification procedure |
02:03:03 | FromDiscord | <terrygillis> Now if only there were some magic that turns me into a compiler dev 🤣 |
02:03:21 | FromDiscord | <Elegantbeef> That's always the step beforebeing one |
02:05:11 | FromDiscord | <Elegantbeef> https://github.com/nim-lang/Nim/blob/ade75a148332e670244a719202f7f0337d2e469a/compiler/renderer.nim#L1501-L1509 How hard could it be! |
02:10:51 | FromDiscord | <terrygillis> https://github.com/nim-lang/Nim/blob/ade75a148332e670244a719202f7f0337d2e469a/compiler/renderer.nim#L82C6-L82C6 Is this where the problem begins. Just speculating for fun because I don't know shit 😆 |
02:11:42 | FromDiscord | <Elegantbeef> The issue isnt really in `isExported` as much as the writing the symbol |
02:11:55 | FromDiscord | <Elegantbeef> There is no `TypeSection` inside g.inside\` |
02:13:52 | FromDiscord | <Elegantbeef> The `gsub` proc is basically just a big old state machine for rendering the AST |
02:14:08 | FromDiscord | <Elegantbeef> right now there just is no logic inside `nkTypeDef` to rendere the exported marker |
02:14:42 | FromDiscord | <ahungry> hi all - I'm trying a simple usage of httpClient - I'm stumbling on lack of SSL support, as I have openssl 3.1.2, and openssl 1.1 both installed (arch linux) - is there a setup or configuration step I need to do? (I don't see -dev or -lib versions of either of these in my package manager) |
02:15:12 | FromDiscord | <odexine> So what’s the issue you get |
02:16:03 | FromDiscord | <ahungry> What packages or libs do I need to install? or is the `-d:ssl` flag telling it "go ahead and include ssl in the compilation"? Maybe I was stupidly misreading that, thinking I could compile without SSL support and only hit http URLs |
02:16:38 | FromDiscord | <Elegantbeef> Basically all one really has to do terry is check if it's an exported symbol inside the `nkTypeDef` case and if so write a `` after it, it's really simple, but my urge to get more people tinkering says "have fun" 😄 |
02:17:03 | FromDiscord | <Elegantbeef> Without ssl you should be able to request http |
02:17:56 | FromDiscord | <odexine> In reply to @ahungry "What packages or libs": The define flag does make Nim include SSL support, what did you assume it did? As a genuine question |
02:18:16 | FromDiscord | <ahungry> I thought it told it, "go ahead and compile without ssl" - like an http only client (as opposed to an https client) |
02:18:38 | FromDiscord | <ahungry> I have no idea why my brain went there, but it's great to feel like a noob in a language and learn something often 😂 |
02:18:57 | FromDiscord | <odexine> Kinda weird lol |
02:19:07 | FromDiscord | <ahungry> Just the base compilation failing, I figured those were my options - fix libssl for global inclusion, or re-compile and use a D flag to omit entirely |
02:19:57 | FromDiscord | <ahungry> I had to go into the office for 9 hours today, for the first time in 4 years - apparently it friend my brain 🤣 |
02:20:08 | FromDiscord | <ahungry> (edit) "friend" => "fried" |
02:20:21 | FromDiscord | <Elegantbeef> You see ivan when you do `--threads:off` what you're really saying is "turn the thread off switch on, so we have threads enabled" |
02:20:42 | FromDiscord | <odexine> Oh shit I can see beef’s dog again |
02:20:51 | FromDiscord | <Elegantbeef> We're back bitches! |
02:21:08 | FromDiscord | <Elegantbeef> CGI tongue looking mother fucker is back! |
02:32:05 | FromDiscord | <jordan4ibanez> https://tenor.com/view/sad-dog-gif-24691979 |
02:33:09 | FromDiscord | <requiresupport> sent a code paste, see https://play.nim-lang.org/#ix=4DCn |
02:34:07 | FromDiscord | <Elegantbeef> take the address of `Object` offset it by `Pos sizeof(DWord) and assign `Val\` to that I believe |
02:34:23 | FromDiscord | <requiresupport> I think so too, is this possible in nim? |
02:34:40 | FromDiscord | <Elegantbeef> It's possible of course |
02:34:41 | FromDiscord | <Elegantbeef> It's just dumb |
02:34:48 | FromDiscord | <Elegantbeef> You lose all type safety |
02:35:01 | FromDiscord | <requiresupport> any other non dumb way I can do this |
02:35:14 | FromDiscord | <Elegantbeef> Use a case statement |
02:35:43 | FromDiscord | <requiresupport> thanks 🙏 |
02:35:45 | FromDiscord | <Elegantbeef> But the Nim way is `cast[ptr UncheckedArray[DWord]](obj.f1.addr)[int pos] = val` |
02:35:51 | FromDiscord | <Elegantbeef> But it's so dumb it's not funny |
02:36:15 | FromDiscord | <Elegantbeef> If you want an array use an array why would one use pointer arithmetic this way |
02:36:53 | FromDiscord | <Elegantbeef> sent a code paste, see https://play.nim-lang.org/#ix=4DCo |
02:37:10 | FromDiscord | <Elegantbeef> Then you just do `myType.fields[Field pos] = val` |
02:38:37 | FromDiscord | <Elegantbeef> And if one really wanted to have `.f1` as a field they could make properties, all without the manic code |
02:54:43 | FromDiscord | <acek7> been out of the nim scene for a bit, whats new? |
02:56:12 | FromDiscord | <odexine> the major version number |
02:57:09 | FromDiscord | <intellij_gamer> Orc is new default memory management |
02:57:22 | FromDiscord | <intellij_gamer> (edit) "Orc is new default memory management ... " added "(reason for the new major number)" |
02:58:08 | FromDiscord | <acek7> still compatiable with all the projects everyone has done? |
03:00:20 | FromDiscord | <Elegantbeef> Assuming they didnt rely on some odd refc behaviour |
03:01:03 | FromDiscord | <acek7> cool cool |
03:01:08 | FromDiscord | <acek7> whats the best way for me to upgrade? |
03:01:13 | FromDiscord | <odexine> In reply to @acek7 "still compatiable with all": mostly, nothing like python 3 |
03:01:22 | FromDiscord | <acek7> Do i uninstall the old one |
03:01:23 | FromDiscord | <odexine> what did you originally use to install nim? |
03:01:48 | FromDiscord | <acek7> just the manual way of dropping the folder in the program files directory and setting up the environment path |
03:02:26 | FromDiscord | <odexine> theres this thing called choosenim which automates that, maybe you can use that instead of the manual way |
03:02:37 | FromDiscord | <odexine> unless you use a specific compiler? even if, its prolly easier |
03:02:59 | FromDiscord | <acek7> ill look into that |
03:38:09 | FromDiscord | <jos7388> @ElegantBeouf is there a lib to embed nimscript nicely? like generated bindings ands tuff |
03:38:11 | FromDiscord | <jos7388> (edit) "ands tuff" => "and stuff" |
03:38:38 | FromDiscord | <Elegantbeef> Part of nimscripter is that |
03:38:55 | FromDiscord | <Elegantbeef> It's not ideal though as it didnt make a proper nim file one could import |
03:40:07 | FromDiscord | <jos7388> okey dokey |
03:40:11 | FromDiscord | <jos7388> ill look at it ty |
03:46:31 | FromDiscord | <Elegantbeef> I do need to remake that for my dynamically loaded api, but I think some parts of that API are a dead end |
03:46:58 | FromDiscord | <Elegantbeef> For typedefs and the like it makes a lot of sense, but for procs it doesnt make much sense |
04:28:03 | FromDiscord | <jos7388> is it possible to get like a custom ref object |
04:28:12 | FromDiscord | <jos7388> like `type X = my_thing: poop` |
04:28:16 | FromDiscord | <jos7388> in place of ref object |
04:28:20 | FromDiscord | <jos7388> i dont really know what you would call that |
04:28:47 | FromDiscord | <jos7388> but i just wanna wrap `ref object`, and add some pragmas on it |
04:29:07 | FromDiscord | <jos7388> so my_thing would just convert to `type X {.requiresInit.} = ref object: poop` |
04:29:33 | FromDiscord | <jos7388> (edit) "so my_thing would just convert to `type X {.requiresInit.} = ref object: poop`" => "sent a code paste, see https://play.nim-lang.org/#ix=4DCF" |
04:29:43 | FromDiscord | <jos7388> (edit) "my_thing: poop`" => "my_thing\n poop: int`" |
04:30:28 | FromDiscord | <jos7388> is that possible |
04:30:32 | FromDiscord | <jos7388> (edit) "https://play.nim-lang.org/#ix=4DCF" => "https://play.nim-lang.org/#ix=4DCG" |
04:33:49 | FromDiscord | <Elegantbeef> You're describing inheritance |
04:34:00 | FromDiscord | <Elegantbeef> Wait nvm |
04:34:24 | FromDiscord | <Elegantbeef> Type section macros exist but are poorly documented |
04:35:11 | FromDiscord | <Elegantbeef> Though i'd just say "annotate the pragmas" |
04:35:27 | FromDiscord | <Elegantbeef> If you're doing a lot of pragmas alias the pragma using the pragma pragma |
04:36:10 | FromDiscord | <jos7388> the pragma pragma |
04:36:44 | FromDiscord | <Elegantbeef> https://nim-lang.org/docs/manual.html#userminusdefined-pragmas-pragma-pragma |
04:36:58 | FromDiscord | <jos7388> do you know why a NimNode's children is called sons |
04:38:02 | FromDiscord | <Elegantbeef> Cause it's a word that's shorter than daughters |
04:38:48 | FromDiscord | <jos7388> true and real |
04:38:54 | FromDiscord | <odexine> why not kids |
04:39:03 | FromDiscord | <Elegantbeef> Don't look at me |
04:39:19 | FromDiscord | <Elegantbeef> Knowing araq he'd say "They arent goats" |
04:48:06 | FromDiscord | <Phil> sent a long message, see http://ix.io/4DCI |
04:48:21 | FromDiscord | <Phil> (edit) "http://ix.io/4DCI" => "http://ix.io/4DCJ" |
04:48:54 | FromDiscord | <Elegantbeef> Depends what you're doing, sometimes you need to emit a call to another macro to get around the fact compilation is done in stages |
04:49:16 | FromDiscord | <odexine> its possible to do macros in macors |
04:49:18 | FromDiscord | <Phil> Ah, so macro calls macro in order to play around with order of compilation |
04:49:19 | FromDiscord | <odexine> (edit) "macors" => "macros" |
04:49:31 | FromDiscord | <Elegantbeef> If you need a macro to write your macro it could just be as simple as using enumerate or any other sugar macro |
04:49:36 | FromDiscord | <Elegantbeef> I mean you can use macros inside macros no different to normal code |
04:49:42 | FromDiscord | <Elegantbeef> So if that suites a problem it works |
04:49:57 | FromDiscord | <Phil> Yeah, I was mostly just trying to ponder what properties of a macro would make me want it |
04:50:00 | FromDiscord | <Elegantbeef> Now emitting a call to another macro might be needed if you have a untyped macro and want some extra typing i another macro |
04:50:43 | FromDiscord | <Phil> Because I start with a macros as an entrypoint to get access to NimNodes of whatever AST.↵Once I got those I couldn't think of another reason of using macros within macros (except for macros from the stdlib like fmt, but that would work just as well for me if it were a proc) |
04:51:16 | FromDiscord | <Phil> (edit) "macros" => "macro" |
04:51:24 | FromDiscord | <Elegantbeef> I mean it wouldnt work just aswell for you if it was a proc 😄 |
04:51:24 | FromDiscord | <Elegantbeef> Cause then you'd be using `strutils.%` |
04:52:26 | FromDiscord | <Phil> Most of the time I just use strformat because they're like f-strings/template-strings/groovy-strings and are the most readable imo |
04:52:29 | FromDiscord | <huantian> In reply to @Elegantbeef "Now emitting a call": macro macro macro |
04:52:40 | FromDiscord | <Phil> But yeah your point stands |
04:57:54 | FromDiscord | <Phil> What is the order of compilation for macros? |
04:58:03 | FromDiscord | <Phil> Does the "inner" macro get compiled first? Or the "outer" macro? |
04:58:15 | FromDiscord | <Phil> (edit) "macro?" => "macro (which gets called by normal code)?" |
04:58:19 | FromDiscord | <Elegantbeef> Depends on if the argument is `typed` or `untyped` |
04:58:40 | FromDiscord | <Elegantbeef> If the argument is untyped then the inner one is not expanded |
05:00:27 | FromDiscord | <Phil> That argument being the argument of inner? |
05:00:51 | FromDiscord | <Phil> So inner macro with untyped param ↵--> Compiler first resolves outer macro in first pass, then Inner macro in second pass? |
05:01:12 | FromDiscord | <Elegantbeef> sent a code paste, see https://play.nim-lang.org/#ix=4DCL |
05:01:25 | FromDiscord | <Elegantbeef> In this case `macroThatTakesUntyped` gets `macroThatTakesTyped: ...` as ast cause untyped explicitly is just "parse the macro" |
05:01:38 | FromDiscord | <Elegantbeef> well "parse the ast" |
05:02:18 | FromDiscord | <Elegantbeef> sent a code paste, see https://play.nim-lang.org/#ix=4DCM |
05:02:25 | FromDiscord | <Elegantbeef> In this case the untyped is evaluated before the inner takes typed |
05:03:07 | FromDiscord | <Elegantbeef> If the argument is typed then it of course abides by the logic of the most indented evaluates first |
05:05:06 | FromDiscord | <Phil> In reply to @Elegantbeef "In this case `macroThatTakesUntyped`": Could you expand on that one?↵I'm trying to visualize it and coming up short |
05:06:03 | FromDiscord | <Elegantbeef> `typed` is explicitly "I want to have this code semantically checked and compile", `untyped` is "I want whatever ast the user typed as long as the compiler can parse it" when you remember `a: b: c` is just syntax sugar for `a(b(c))` you magically do not have this order of dispatch issue |
05:06:37 | FromDiscord | <Elegantbeef> Evaluation is done by the lowest typed macro in a chain |
05:06:44 | FromDiscord | <Elegantbeef> If they're all untyped then there is no other macro evaluated |
05:08:36 | FromDiscord | <Phil> sent a code paste, see https://play.nim-lang.org/#ix=4DCO |
05:09:02 | FromDiscord | <Phil> (edit) "https://play.nim-lang.org/#ix=4DCO" => "https://play.nim-lang.org/#ix=4DCP" |
05:09:12 | FromDiscord | <Elegantbeef> In the first example there are only two macro evaluations |
05:09:30 | FromDiscord | <Elegantbeef> Since there is untyped inside typed, it depends on untyped to emit the macro again |
05:09:51 | FromDiscord | <Elegantbeef> In the second there would be 3 evaluations, first untyped then the indented typed, then finally the top |
05:10:02 | FromDiscord | <Elegantbeef> cause it's afterall `typedMac(typedMac(untypedMac(..)))` |
05:15:55 | FromDiscord | <Phil> sent a code paste, see https://play.nim-lang.org/#ix=4DCQ |
05:16:25 | FromDiscord | <Elegantbeef> the first one only has two garuenteed evaluations |
05:17:28 | FromDiscord | <Elegantbeef> The compiler looks and sees a `typed` macro so then goes "ok evaluate this argument", it then steps forward and sees `untyped`. Since it's untyped there is no semantic checking for it's body, so it's ready to be invoked now |
05:17:54 | FromDiscord | <Elegantbeef> Untyped arguments completely skip semantic checking which means there is no invocation there |
05:20:46 | FromDiscord | <Phil> So basically even if there was a macro callchain 4 levels deep after the untyped, it would just skip them because untyped? |
05:21:00 | FromDiscord | <Phil> Do the rest of the macros then just get called after a second compiler pass? |
05:21:10 | FromDiscord | <Elegantbeef> There is no second compiler pass |
05:21:27 | FromDiscord | <Elegantbeef> The macro returns ast, that ast is placed where it was called |
05:21:30 | FromDiscord | <Phil> So I might end up with macro-code non-running because I made the compiler skip the parts it should evaluate by using untyped? |
05:21:58 | FromDiscord | <Elegantbeef> Indeed, this is why untyped macros suck, they do not compose |
05:23:23 | FromDiscord | <Phil> Okay let me do some experiments based on that |
05:24:30 | FromDiscord | <Elegantbeef> Araq does eventually want to remove `untyped` and replace it with `semityped` or whatever, where it has idents and syms |
05:24:35 | FromDiscord | <Elegantbeef> But that's a big ol' pipedream |
05:24:54 | FromDiscord | <Phil> Oh wait, you speak of guaranteed, so basically it's not well defined if the compiler does additional crap or not.↵Any time you have an inner untyped macro you may get evaluation but there are also scenarios where you may not |
05:25:12 | FromDiscord | <Elegantbeef> I mean it's not the compiler that defines it |
05:25:23 | FromDiscord | <Elegantbeef> Since macros can just disregard ast, it's down to the macro |
05:26:20 | FromDiscord | <Elegantbeef> sent a code paste, see https://play.nim-lang.org/#ix=4DCT |
05:26:45 | * | advesperacit joined #nim |
05:26:45 | FromDiscord | <Phil> I asume does nothing |
05:26:59 | FromDiscord | <Phil> But might start doing stuff once it's `static: echo "1000"` |
05:27:00 | FromDiscord | <Elegantbeef> "assume", are you using the `body`? |
05:27:07 | FromDiscord | <Elegantbeef> No it wouldnt |
05:27:19 | FromDiscord | <Elegantbeef> if you do not return the ast to the place it's called, why would it do anything |
05:27:51 | FromDiscord | <Phil> Because maybe static evaluation happens before macro evaluation, but that example just provied me wrong |
05:28:04 | FromDiscord | <Elegantbeef> Again untyped code is not semantically checked |
05:28:13 | FromDiscord | <Elegantbeef> How do you do static evaluation on code that doesnt exist |
05:29:15 | FromDiscord | <Elegantbeef> sent a code paste, see https://play.nim-lang.org/#ix=4DCU |
05:29:24 | FromDiscord | <Elegantbeef> There is no symbol, so the compiler cannot evaluate anything |
05:30:24 | FromDiscord | <Phil> Basically "AST expression goes into template, template returns AST expression or nothing, whatever gets returned by template gets evaluated. If nothing gets returned, nothing happens " ? |
05:30:50 | FromDiscord | <Elegantbeef> templates and macros have to return ast for the compiler to process yes |
05:30:51 | FromDiscord | <Phil> (edit) "template," => "template ↵-->" | "nothing," => "nothing↵-->" | """ => "↵"" |
05:31:20 | FromDiscord | <Elegantbeef> macros can have side effects cause they run in the vm, but otherwise if you do not return ast, nothing happens |
05:32:23 | FromDiscord | <Elegantbeef> Macros are really user defined compiler passes |
05:32:28 | FromDiscord | <Elegantbeef> untyped macros especially |
05:33:13 | * | rockcavera quit (Remote host closed the connection) |
05:39:10 | * | fallback quit (Ping timeout: 246 seconds) |
05:41:09 | FromDiscord | <jos7388> i just realized the "warning" macro + inline errors = godlike debugging for macros |
05:41:52 | FromDiscord | <Elegantbeef> Or just use `warning` and `error` procedures inside macros |
05:43:18 | FromDiscord | <Phil> Or write your own `assertKind` and `expectKind` procs that use warning and error |
05:43:52 | FromDiscord | <Phil> (edit) "Or write your own `assertKind` and `expectKind` procs that use warning and ... errormessages" added "error, so that you can actually provide custom" | "error, so that you can actually provide customerror ... " added "messages" |
05:44:00 | FromDiscord | <Elegantbeef> This guy |
05:44:23 | FromDiscord | <Elegantbeef> You didnt even write your own `assertLen` |
05:44:25 | FromDiscord | <Phil> Or use micros |
05:45:00 | FromDiscord | <Elegantbeef> Well micros only covers a very small amount of the NimAst |
05:45:01 | FromDiscord | <Phil> And then still write your own `assertKind` in order to ensure that everything before micros is correctly typed and everything that comes out of micros is also correctly typed |
05:45:10 | FromDiscord | <Elegantbeef> Why do that |
05:45:18 | FromDiscord | <Elegantbeef> you can just use `isa` |
05:45:27 | FromDiscord | <Phil> Because I'm paranoid and I don't turst anything and don't know isa |
05:45:36 | FromDiscord | <Phil> (edit) "turst" => "trust" |
05:45:44 | FromDiscord | <Elegantbeef> It's my procedure I implement for every single distinct typed nimnode |
05:45:47 | FromDiscord | <Elegantbeef> Also used for my case statement macro |
05:46:12 | FromDiscord | <Elegantbeef> https://github.com/beef331/micros/blob/master/src/micros/definitions/identdefs.nim#L3-L8 for example |
05:47:40 | * | fallback joined #nim |
05:49:20 | FromDiscord | <jos7388> https://media.discordapp.net/attachments/371759389889003532/1141247300170154054/image.png |
05:49:24 | FromDiscord | <jos7388> so nice |
05:49:29 | FromDiscord | <jos7388> i can just see whatever i want |
05:49:39 | FromDiscord | <arathanis> beef, is your pfp your dog? |
05:49:47 | FromDiscord | <Elegantbeef> Yes |
05:49:47 | FromDiscord | <jos7388> it almost makes me want like a hover that shows each time it reached there and what the value was |
05:49:52 | FromDiscord | <arathanis> What kind of dog? |
05:49:58 | FromDiscord | <arathanis> it definitely looks like a terrier |
05:50:03 | FromDiscord | <Elegantbeef> A pug westie mix |
05:50:09 | FromDiscord | <arathanis> they are adorable |
05:52:05 | FromDiscord | <Elegantbeef> Phil did you see the case statement macro in micros? |
05:52:21 | FromDiscord | <Elegantbeef> https://github.com/beef331/micros/blob/master/tests/tcasemacro.nim#L17-L43 going to blow your mind! 😄 |
05:53:14 | FromDiscord | <Elegantbeef> Takes in a NimNode and matches using the `isa` proc and then shadows it to the name it was |
05:53:49 | FromDiscord | <Elegantbeef> Fairly useful for more elaborate DSLs but I've never seriously used it |
05:56:04 | FromDiscord | <Phil> One sec, will take a look when I'm on the go, getting ready |
06:05:49 | FromDiscord | <Phil> So kind of a case statement over node but more like your distinct nimnode types instead? |
06:06:00 | FromDiscord | <Phil> (edit) "So kind of a case statement over node ... but" added "kind" |
06:06:16 | FromDiscord | <Elegantbeef> Yea so you get your desired distinct NimNode and all of it's type safe accessors |
06:06:57 | FromDiscord | <Phil> So what the case does is parse the incoming nimnode to the distinct nimnode type? |
06:07:08 | FromDiscord | <Phil> And then do a case over it |
06:07:16 | FromDiscord | <Elegantbeef> well "parse" is a loose term |
06:07:33 | FromDiscord | <Elegantbeef> it generates a `if isa(n, Type)` |
06:15:16 | * | PMunch joined #nim |
06:49:04 | FromDiscord | <requiresupport> sent a code paste, see https://paste.rs/ajCAp |
06:50:43 | FromDiscord | <arathanis> In reply to @requiresupport "what is the best": use `sequtils.filter |
06:50:46 | FromDiscord | <arathanis> (edit) "`sequtils.filter" => "`sequtils.filter`" |
06:51:04 | FromDiscord | <arathanis> wont even need the for loop |
06:51:04 | FromDiscord | <arathanis> https://nim-lang.org/docs/sequtils.html#filter%2CopenArray%5BT%5D%2Cproc%28T%29 |
06:51:32 | FromDiscord | <arathanis> you give it a predicate and a sequence, and it only keeps items that make the predicate true |
06:53:06 | FromDiscord | <requiresupport> wow thats nice |
06:53:18 | FromDiscord | <arathanis> sent a code paste, see https://play.nim-lang.org/#ix=4DDa |
06:53:25 | * | ntat joined #nim |
06:53:36 | FromDiscord | <arathanis> In reply to @requiresupport "wow thats nice": yes! classic functional programming filter for some sequence type |
06:53:53 | FromDiscord | <requiresupport> thanks 🙏 |
06:54:03 | FromDiscord | <arathanis> (edit) "https://play.nim-lang.org/#ix=4DDa" => "https://play.nim-lang.org/#ix=4DDb" |
06:54:05 | FromDiscord | <arathanis> np, also i edited it |
06:54:13 | FromDiscord | <arathanis> remember it keeps items that make the predicate true |
06:54:21 | FromDiscord | <arathanis> your initial implementation was looking to remove items that made it true |
06:54:25 | FromDiscord | <arathanis> be sure to invert your condition |
07:01:44 | * | ced1 is now known as cedb |
07:03:19 | PMunch | ElegantBeef, this is awesome! https://forum.nim-lang.org/t/9897#65308 |
07:03:54 | PMunch | Should definitely be part of sugar, if not just system.. |
07:04:22 | FromDiscord | <Elegantbeef> "prs welcome" 😛 |
07:10:25 | FromDiscord | <arathanis> https://tenor.com/view/you-do-it-curtis-payne-house-of-payne-from-heart-to-heart-s9e8-gif-25472601 |
07:17:02 | FromDiscord | <_gumbercules> This is the kind of stuff that is going to turn people off of Nim honestly: https://forum.nim-lang.org/t/10405 |
07:17:34 | FromDiscord | <_gumbercules> person ask a question, everyone takes it personally, and only one reply is really helpful |
07:17:58 | FromDiscord | <_gumbercules> (edit) "ask" => "asks" |
07:18:36 | PMunch | One of the two replies? But I agree Araqs response was a bit unnecessary. |
07:19:09 | FromDiscord | <_gumbercules> Well there are three - I think even termer's came off in a way |
07:19:36 | PMunch | Fair enough, it's not very helpful |
07:19:52 | FromDiscord | <_gumbercules> maybe I'm reading too much into it but either way - lead by example. We were having a discussion earlier today re: community issues and language growth in this channel. |
07:20:17 | FromDiscord | <_gumbercules> (edit) "maybe I'm reading too much into it but either way - lead by example. We were having a discussion earlier today re: community issues and ... languageadoption" added "community growth /" | "growth" => "adoption" |
07:20:52 | termer | I was attempting to be very careful with my wording to not sound patronizing |
07:21:09 | termer | whether I did a good job or not is not something I know, but it was relegated only to facts |
07:21:24 | FromDiscord | <_gumbercules> I mean I can sense that but at the end of the day the first reply should have been a welcome to the community followed up by several links to examples of using SSH with Nim |
07:21:41 | FromDiscord | <_gumbercules> and that could have also been the only reply, other than other welcomes |
07:21:54 | termer | Perhaps |
07:22:07 | FromDiscord | <_gumbercules> assuming this was their first post / they recently joined, otherwise just a polite hello followed by some helpful links would have sufficed |
07:22:14 | advesperacit | there is an offputting level of nonchalance rampant in online communities, the nim forum is unfortunately not immune |
07:22:31 | termer | Araq and I appear to have a similar personality, at least in how it comes off in online replies |
07:22:40 | termer | but I'm just a cold person in general lol |
07:23:02 | termer | but you are right _gumbercules |
07:23:17 | termer | It would have been helpful to address the person with a welcome |
07:23:18 | FromDiscord | <_gumbercules> I mean, that's fine and everyone is who they are but people ask why Nim isn't growing and why it's not more popular and I'm simply pointing out the answers |
07:23:35 | FromDiscord | <_gumbercules> this is definitely one reason, amongst others |
07:23:45 | termer | you've heard my opinion on the subject |
07:23:57 | termer | improvement can be had in all areas though, so what you're saying is completely valid |
07:24:18 | FromDiscord | <Elegantbeef> Yea termer light a candle your cold hearted bastard |
07:24:24 | FromDiscord | <arathanis> sent a code paste, see https://play.nim-lang.org/#ix=4DDi |
07:24:26 | FromDiscord | <_gumbercules> yeah I know - I've heard a lot of people's opinions haha. I've also seen a lot of Nim history first hand |
07:25:02 | termer | I wasn't active in the community until 2022 |
07:25:07 | termer | but I had been using it since 2020 |
07:25:18 | FromDiscord | <_gumbercules> I've been around since 2015 |
07:25:22 | termer | most regulars on IRC and Discord know more than me |
07:26:22 | FromDiscord | <_gumbercules> mostly anyway - I stepped away from the community for a bit but regardless I only bring that up because after a while you start to recognize patterns if you're paying attention to anything in life |
07:27:17 | termer | for sure |
07:28:28 | FromDiscord | <_gumbercules> I'm pretty sure at this point I know several of the reasons that Nim doesn't grow as quickly as other systems programming languages or attract the same number of contributors but no need to beat that horse again. |
07:29:25 | FromDiscord | <Elegantbeef> We should have this conversation daily so anyone new just sees this conversation and thinks that the Nim community is stuck a groundhog day scenario never accepting no one uses the language |
07:29:32 | termer | hahahaha |
07:29:35 | termer | I was thinking about that |
07:29:55 | termer | it's fun to have meta conversation, why do you think all the most popular threads are meta? |
07:30:06 | advesperacit | I think a little more inclination towards being helpful and less, snark perhaps, would go a long way in general. |
07:30:11 | FromDiscord | <Elegantbeef> Who wants to be bill murray?! |
07:30:39 | termer | snark replies are never appropriate unless the person asking the question is genuinely an idiot who has asked something multiple times and not used the information given previously |
07:30:39 | FromDiscord | <Elegantbeef> Less snark, but that's all I have |
07:31:01 | FromDiscord | <Elegantbeef> That's a long winded way of saying "Unless I termer asked the question" |
07:31:17 | termer | I ask the same questions all the time and forget the answers |
07:31:37 | FromDiscord | <Elegantbeef> What was the question again? |
07:31:42 | termer | nice one |
07:31:45 | termer | dumbass! |
07:32:03 | FromDiscord | <Elegantbeef> Lol, also i remembered you do not use `contains` for your stack strings |
07:32:16 | termer | there's a reason for that |
07:32:20 | FromDiscord | <Elegantbeef> so I cannot do `"hello" in myStackString"` or `'a' in myStackString` |
07:32:29 | termer | the type system dies |
07:32:39 | FromDiscord | <Elegantbeef> Why you always lying |
07:32:41 | termer | it gets very confused |
07:33:00 | * | PMunch_ joined #nim |
07:33:01 | termer | You can try for yourself, a few of the tests don't compile when using those names |
07:33:14 | termer | although maybe they can be qualified internally using the full package name |
07:33:18 | termer | however that defeats the purpose |
07:33:44 | termer | also, when someone linked a post and then said that my reply might not have been helpful, I was almost certain it was going to be referring to the post I made saying "Scala 3 sucks lol" |
07:34:23 | termer | Nobody caught on to the potentially damning nuances of that comment |
07:35:13 | FromDiscord | <Elegantbeef> So uhh I just tested the contains and it seems to work for me |
07:35:35 | * | PMunch quit (Ping timeout: 244 seconds) |
07:38:02 | termer | Elegantbeef, Maybe it was a weird circumstance for me |
07:38:17 | termer | if you replace all the runnableExamples with contains, does it still compile at docgen time? |
07:39:01 | termer | and does it shit itself if the find variants are also named find |
07:39:12 | FromDiscord | <Elegantbeef> Yea |
07:39:25 | termer | another TODO added |
07:41:01 | FromDiscord | <Elegantbeef> https://play.nim-lang.org/#ix=4DDk to save you a few |
07:41:06 | FromDiscord | <Elegantbeef> too lazy to make a PR right now |
07:43:35 | FromDiscord | <Elegantbeef> Afaik you dont even technically need `find` for `'char'` as there is a generic `find` proc inside the stdlib |
07:58:42 | NimEventer | New thread by Cnerd: NimBcs, see https://forum.nim-lang.org/t/10411 |
07:59:50 | FromDiscord | <System64 ~ Flandre Scarlet> I guess Norm doesn't support async either? |
08:11:16 | FromDiscord | <acek7> how do you uninstall nim? |
08:11:46 | NimEventer | New thread by xavjer: Close console terminal after initialization but keep application running, see https://forum.nim-lang.org/t/10412 |
08:39:42 | * | azimut quit (Ping timeout: 246 seconds) |
08:42:13 | FromDiscord | <Phil> In reply to @sys64 "I guess Norm doesn't": Not to my knowledge, with sqlite that doesn't change much either way afaik |
08:45:57 | NimEventer | New thread by chaemon: SomeFloat in std/complex, see https://forum.nim-lang.org/t/10413 |
09:01:49 | FromDiscord | <System64 ~ Flandre Scarlet> In reply to @isofruit "Not to my knowledge,": Wait, SQLite doesn't support async too? |
09:02:47 | NimEventer | New post on r/nim by qtless: HappyX And Python, see https://reddit.com/r/nim/comments/15skh6k/happyx_and_python/ |
09:41:18 | * | jkl quit (Quit: Gone.) |
09:50:23 | * | jkl joined #nim |
10:02:10 | FromDiscord | <Phil> In reply to @sys64 "Wait, SQLite doesn't support": It does: https://www.sqlite.org/asyncvfs.html↵It's just that you won't have the data unless it's written.↵Further, IIRC not even std/db_sqlite supports it |
10:03:05 | FromDiscord | <Phil> So basically you'll need to start accessing the sqlite async procs available yourself |
10:09:42 | FromDiscord | <System64 ~ Flandre Scarlet> Oh alright |
10:10:08 | FromDiscord | <Phil> Could actually be an interesting task to figure out though how to access that |
10:11:19 | FromDiscord | <System64 ~ Flandre Scarlet> Now one sad thing is Norm doesn't support arrays |
10:11:34 | FromDiscord | <Phil> Does support seqs though |
10:11:57 | FromDiscord | <System64 ~ Flandre Scarlet> Oh, very nice↵I was afraid I had to do that https://media.discordapp.net/attachments/371759389889003532/1141313392477487156/image.png |
10:12:57 | FromDiscord | <Phil> The way norm works is basically you pass it a "shell" and norm populates it with data.↵If you pass it a seq with one entry with dummy-data, norm just duplicates that shell as often as needed and then fills it with data |
10:13:30 | FromDiscord | <Phil> Given what I now know of macros I wonder if that could be improved upon because the compile-time seqs I wrote aren't the easiest to understand |
10:13:43 | FromDiscord | <Phil> But on the other hand macros are never easy to understand so eh |
10:15:42 | FromDiscord | <System64 ~ Flandre Scarlet> sent a code paste, see https://play.nim-lang.org/#ix=4DDW |
10:17:39 | FromDiscord | <System64 ~ Flandre Scarlet> Seems it doesn't support seq |
10:47:35 | FromDiscord | <duskhorn> In reply to @sys64 "Oh, very nice I": This looks interesting, what are you coding? |
10:49:26 | FromDiscord | <Phil> sent a code paste, see https://play.nim-lang.org/#ix=4DE4 |
10:54:33 | FromDiscord | <Phil> sent a long message, see http://ix.io/4DE7 |
10:55:22 | FromDiscord | <Phil> Super alternatively:↵You can of course also just query all players belonging to that game, each of those player objects will contain a game object either way |
10:57:47 | * | advesperacit_ joined #nim |
10:57:55 | * | cm_ joined #nim |
10:58:12 | * | alice quit (Killed (lithium.libera.chat (Nickname regained by services))) |
10:58:14 | * | alice joined #nim |
10:58:31 | * | nmz- joined #nim |
11:00:03 | * | gshumway_ joined #nim |
11:02:13 | * | advesperacit_ quit (Ping timeout: 246 seconds) |
11:02:56 | * | advesperacit_ joined #nim |
11:05:29 | * | jkl quit (*.net *.split) |
11:05:29 | * | advesperacit quit (*.net *.split) |
11:05:29 | * | cm quit (*.net *.split) |
11:05:29 | * | gshumway quit (*.net *.split) |
11:05:29 | * | nmz quit (*.net *.split) |
11:05:29 | * | skulk quit (*.net *.split) |
11:05:30 | * | cm_ is now known as cm |
11:07:33 | * | jkl joined #nim |
11:07:33 | * | skulk joined #nim |
11:10:52 | FromDiscord | <System64 ~ Flandre Scarlet> In reply to @isofruit "If you want to": One player belongs to one game, but one game has 4 players at max |
11:19:48 | FromDiscord | <System64 ~ Flandre Scarlet> So I guess I have to store a reference to the game in my players? |
11:20:41 | * | junaid_ joined #nim |
11:28:30 | FromDiscord | <System64 ~ Flandre Scarlet> Btw is it possible to send messages between threads? |
11:38:50 | FromDiscord | <Chronos [She/Her]> In reply to @sys64 "Now one sad thing": Iirc doesn't support byte seqs which was an issue I had |
11:44:51 | FromDiscord | <System64 ~ Flandre Scarlet> In reply to @chronos.vitaqua "Iirc doesn't support byte": I have to think in reverse↵A game having multiple players doesn't work here↵I have to do multiple players belong to one game |
11:46:21 | FromDiscord | <Chronos [She/Her]> Fair |
11:46:32 | * | fallback quit (Ping timeout: 240 seconds) |
11:48:35 | FromDiscord | <System64 ~ Flandre Scarlet> Now I wonder if threads can send messages↵Because I want to have a global table with a code as key and a server address as value↵But I need to add and remove servers from this table |
11:52:53 | * | fallback joined #nim |
11:53:29 | FromDiscord | <System64 ~ Flandre Scarlet> sent a long message, see http://ix.io/4DEj |
12:04:11 | FromDiscord | <Chronos [She/Her]> In reply to @sys64 "Now I wonder if": Look at Nim channels |
12:13:25 | FromDiscord | <System64 ~ Flandre Scarlet> In reply to @chronos.vitaqua "Look at Nim channels": Will have a look, thanks! |
12:29:02 | FromDiscord | <Chronos [She/Her]> No worries! |
13:03:32 | FromDiscord | <Andreas> sent a code paste, see https://play.nim-lang.org/#ix=4DED |
13:11:15 | FromDiscord | <toma400> Is it only me that Nim docs stay on light mode after 2.0 update? |
13:12:01 | FromDiscord | <toma400> (I mean std ones, I loved their dark tone, also huge kudos for whoever wrote them, they are my absolute fav docs for language (and the only ones that I visit so frequently thanks to that)) |
13:12:07 | FromDiscord | <toma400> (edit) "tone," => "tone;" |
13:12:14 | FromDiscord | <toma400> (edit) "for" => "to" |
13:12:37 | FromDiscord | <toma400> (edit) "update?" => "update, no matter switching mode manually or having dark ones as default OS?" |
13:14:14 | FromDiscord | <odexine> bug already known, fix already pushed, waiting on new release iirc |
13:16:17 | FromDiscord | <demotomohiro> In reply to @Andreas "Given a recent 64-bit": https://perf.wiki.kernel.org/index.php/Main_Page↵If you use linux, perf might helps you to study whether cache hit or miss happened. |
13:17:18 | FromDiscord | <ntzeno> In reply to @toma400 "Is it only me": it's known bug but you can temporarily use requestly extension if it annoys you so much https://media.discordapp.net/attachments/371759389889003532/1141360033981005954/image.png |
13:19:48 | FromDiscord | <toma400> Thanks everyone, wishing this will be soon ❤️ not really annoying for me, but it was comfy to have this beautiful dark one |
13:27:45 | * | rockcavera joined #nim |
13:37:51 | * | lucasta_ quit (Ping timeout: 260 seconds) |
13:44:24 | * | nyeaa492842301 quit (Ping timeout: 246 seconds) |
14:13:06 | * | PMunch_ quit (Quit: Leaving) |
14:14:26 | * | junaid_ quit (Remote host closed the connection) |
14:21:32 | FromDiscord | <Phil> Agreed, my seared retinas will never recover |
14:22:47 | FromDiscord | <ringabout> In reply to @toma400 "Thanks everyone, wishing this": Well, you can use the devel doc, which works fine with dark mode. |
14:24:15 | FromDiscord | <ringabout> https://nim-lang.github.io/Nim/manual.html |
14:32:37 | * | azimut joined #nim |
14:44:47 | FromDiscord | <System64 ~ Flandre Scarlet> In reply to @chronos.vitaqua "No worries!": Can I pass strings, objects, ints and so on through channels? |
14:46:51 | * | lucasta joined #nim |
14:49:35 | FromDiscord | <Chronos [She/Her]> In reply to @sys64 "Can I pass strings,": https://nim-lang.org/0.20.0/channels.html |
14:49:44 | FromDiscord | <Chronos [She/Her]> Wait that's old sorry |
14:50:49 | FromDiscord | <Chronos [She/Her]> Hm... Nim channels were removed |
14:51:06 | FromDiscord | <Chronos [She/Her]> In reply to @sys64 "Can I pass strings,": I think you're going to have to rely on sockets instead honestly |
14:52:57 | * | _0x00 joined #nim |
14:53:01 | FromDiscord | <System64 ~ Flandre Scarlet> In reply to @chronos.vitaqua "I think you're going": aren't sockets for networking? |
15:00:34 | FromDiscord | <Chronos [She/Her]> In reply to @sys64 "aren't sockets for networking?": Yeah but there's no reason you can't use them locally too for communication |
15:02:09 | FromDiscord | <odexine> channels doc has been assimilated into system iirc |
15:04:15 | FromDiscord | <System64 ~ Flandre Scarlet> In reply to @odexine "channels doc has been": https://nim-lang.org/0.20.0/channels.html↵That? |
15:04:22 | FromDiscord | <System64 ~ Flandre Scarlet> In reply to @chronos.vitaqua "Yeah but there's no": Netty goes BRRRRRRRR |
15:04:26 | FromDiscord | <odexine> https://nim-lang.org/docs/system.html#example |
15:04:49 | FromDiscord | <System64 ~ Flandre Scarlet> Oooooh! |
15:05:32 | FromDiscord | <System64 ~ Flandre Scarlet> Thanks, I will study that |
15:07:55 | FromDiscord | <Chronos [She/Her]> In reply to @odexine "channels doc has been": Oh has it? Didn't know that lol |
15:11:14 | FromDiscord | <System64 ~ Flandre Scarlet> I hope I won't suffer like I did with async/await |
15:18:43 | FromDiscord | <Chronos [She/Her]> Lol |
15:48:06 | * | xet7 joined #nim |
16:36:20 | * | lucasta quit (Quit: Leaving) |
16:50:39 | termer | To whoever was asking about async sqlite: you don't need async for that |
16:50:59 | termer | you can't do concurrent queries anyway |
16:51:26 | termer | and for blocking concerns, your OS should already have cached the DB so it's not hitting disk anyway |
16:51:44 | termer | If you're worried though, but sqlite in another thread |
16:52:50 | termer | At first it seems like a no-brainer to use some async wrapper around sqlite, but actually that'll only get you higher latency and worse performance in general |
16:53:36 | termer | Good anecdotal proof of this is the fact that among the 2 most popular Node.js bindings for SQLite, the non-async one performs better in all metrics |
16:55:18 | FromDiscord | <System64 ~ Flandre Scarlet> Oh alright, so I shouldn't care about async then |
16:56:38 | termer | in the context of sqlite, no |
16:56:56 | termer | network-bound DBs, yes |
16:57:06 | termer | but sqlite has no networking |
16:57:32 | termer | it's just a C library, it has no daemon |
16:58:14 | termer | I have a suspicion that Nim's sqlite wrapper leaks memory |
16:58:28 | termer | you should be my canary and try tiny_sqlite lol |
16:58:41 | * | lucasta_ joined #nim |
17:02:28 | FromDiscord | <jos7388> @beefbroccoli i was thinking about nimscript the other day |
17:02:29 | FromDiscord | <jos7388> wait |
17:02:38 | FromDiscord | <jos7388> @ElegantBeouf i was thinking about nimscript the other day and wanted to ask u some stuff |
17:02:53 | FromDiscord | <jos7388> what is the compilation unit in nimscript? is it the entire program? |
17:02:57 | FromDiscord | <Phil> In reply to @jos7388 "<@391728494058405890> i was thinking": bwahahahahaahha |
17:03:16 | FromDiscord | <Phil> Okay that was hilarious 😄 |
17:03:21 | FromDiscord | <jos7388> too many beef guys on here 🙂 |
17:04:11 | FromDiscord | <jos7388> (edit) "what is the compilation unit in nimscript? is it the entire program? ... " added "i'm wondering how hot reload can be scaled up to multiple little files" |
17:04:57 | * | lucasta_ quit (Ping timeout: 245 seconds) |
17:05:06 | * | krux02 joined #nim |
17:19:57 | FromDiscord | <_gumbercules> where is @beefncheddar? |
17:28:08 | FromDiscord | <Phil> Maybe at a bar with beefbacon |
17:30:34 | FromDiscord | <arathanis> Anytime someone has a somewhat complicated question on this server: https://media.discordapp.net/attachments/371759389889003532/1141423770121281628/image.png |
17:34:52 | FromDiscord | <System64 ~ Flandre Scarlet> build failed↵Reason : None https://media.discordapp.net/attachments/371759389889003532/1141424855225479219/message.txt |
17:39:03 | FromDiscord | <Phil> Er.... what?↵Okay never seen that happen before, as in, ever |
17:39:22 | FromDiscord | <Phil> Like, for the compiler to completely fail to tell why shit's broken is pretty new to me |
17:44:31 | FromDiscord | <System64 ~ Flandre Scarlet> Even clearing the cache doesn't work |
17:44:54 | FromDiscord | <Phil> Yeah I'd wager it's something about the code, it's just I don't see what could cause this |
17:45:11 | FromDiscord | <Phil> That is so far beyond my expertise it's not even funny |
17:47:26 | FromDiscord | <System64 ~ Flandre Scarlet> I hate when the compiler says nothing about the error |
17:53:28 | FromDiscord | <Phil> Undo changes until it compiles again? |
17:55:21 | FromDiscord | <System64 ~ Flandre Scarlet> I found the issue, attempt to assign an undeclared field in a template |
17:57:03 | FromDiscord | <System64 ~ Flandre Scarlet> sent a code paste, see https://play.nim-lang.org/#ix=4DG5 |
18:04:24 | FromDiscord | <Phil> sent a code paste, see https://play.nim-lang.org/#ix=4DG9 |
18:04:40 | FromDiscord | <Phil> You may have murdered the compiler through recursion |
18:05:35 | FromDiscord | <Phil> Like, the first line of the template very much looks to me like that template itself getting invoked again |
18:05:50 | FromDiscord | <System64 ~ Flandre Scarlet> OOF |
18:06:28 | FromDiscord | <System64 ~ Flandre Scarlet> Can I put an underscore at the begining to differentiate it? |
18:06:34 | FromDiscord | <System64 ~ Flandre Scarlet> like _myField? |
18:07:19 | FromDiscord | <Phil> I mean you can. ↵I'd ask again why this is a template when it simply looks like it's assigning a couple values to a layer field |
18:08:03 | FromDiscord | <System64 ~ Flandre Scarlet> sould setting this to a proc solve the problem? |
18:08:33 | FromDiscord | <Phil> might? I tend to not do a ton of operator overloading so I'm not insanely aware of how that'll work out.↵But generall it goes↵Proc >>> Template >>> Macros↵In terms of complexity |
18:09:00 | FromDiscord | <Phil> Or rather↵Proc > Generics > Templates > Macros |
18:10:24 | FromDiscord | <Phil> But this is me guessing tbh, I don't have a true understanding of why this is exploding |
18:10:40 | FromDiscord | <Phil> Can you give me the layer, tilemap types and LAYER_TILEMAP value for a minimal example? |
18:10:49 | FromDiscord | <System64 ~ Flandre Scarlet> The error : no reason is solved |
18:11:00 | FromDiscord | <Phil> ? |
18:11:11 | FromDiscord | <Phil> Ah, as in using a proc solves the issue |
18:11:13 | FromDiscord | <System64 ~ Flandre Scarlet> In reply to @sys64 "build failed Reason :": This problem is solve |
18:11:20 | FromDiscord | <System64 ~ Flandre Scarlet> (edit) "solve" => "solved" |
18:12:41 | FromDiscord | <Phil> sent a long message, see http://ix.io/4DGc |
18:14:50 | FromDiscord | <System64 ~ Flandre Scarlet> Oh alright, gotta use procs then |
18:17:24 | FromDiscord | <Phil> 👍 ↵At least that's my view on it. |
18:27:18 | FromDiscord | <dersnof> whats best nim lib for discord api |
18:27:24 | FromDiscord | <dersnof> wrapper |
18:27:34 | FromDiscord | <dersnof> to develop discord bot |
18:27:36 | FromDiscord | <Phil> Anyone got a good testament example?↵I'm trying to grok it since I want to compile tests with different compilation flags |
18:27:54 | FromDiscord | <dersnof> https://github.com/krisppurg/dimscord |
18:28:00 | FromDiscord | <dersnof> this looks nice but only 206 stars |
18:28:06 | FromDiscord | <dersnof> i'm not sure if its reliable lib |
18:28:17 | FromDiscord | <Phil> (edit) "flags" => "flags↵However, I'm not sure whether e.g. a `discard """ """` block needs to be defined per unittest or per unittest file and if testament is supposed to be used on its own or with std/unittest" |
18:28:37 | FromDiscord | <Phil> Keep in mind the nim ecosystem isn't particularly masssive, 206 stars is fine |
18:28:51 | FromDiscord | <dersnof> but what if they dump project in future |
18:28:54 | FromDiscord | <dersnof> and my bot groke |
18:28:58 | FromDiscord | <dersnof> (edit) "groke" => "broke" |
18:29:09 | FromDiscord | <dersnof> i would have to rewrite everything |
18:29:36 | FromDiscord | <Phil> That is an issue you face with any project |
18:30:42 | FromDiscord | <Phil> When I mention that the nim ecosystem isn't particularly massive, this is one of the things that I mean.↵The group of maintainers isn't gargantuan and so the amount of times you hit a package with bus-factor 1 is quite high. |
18:32:44 | FromDiscord | <dersnof> hmm btw |
18:32:46 | FromDiscord | <dersnof> in coding i start to believe that, unrelated to however you are good at it, there is always some asian teen better than u |
18:32:53 | FromDiscord | <dersnof> seeing developer of million.js |
18:33:24 | FromDiscord | <Phil> In reply to @dersnof "in coding i start": That has nothing to do with asian and more to do with how vast a field coding is in general |
18:33:41 | FromDiscord | <dersnof> In reply to @isofruit "That has nothing to": asian part is generally due to competitive nature of asian countries |
18:33:47 | FromDiscord | <dersnof> they have more strict education system and so on |
18:34:03 | FromDiscord | <dersnof> they have same brain, but they work harder |
18:36:39 | FromDiscord | <Phil> sent a long message, see http://ix.io/4DGo |
18:37:11 | FromDiscord | <Phil> Though that's just the technical aspects, there's also the massive amount of communication that coding also encompasses |
18:37:22 | FromDiscord | <Phil> (edit) "technical" => "technical/problem solving" |
18:37:57 | FromDiscord | <dersnof> I start to think, I might want to switch teams inside my job |
18:38:12 | FromDiscord | <dersnof> like it doesnt sound nice to do cobol pl/i and mainframe lifetime |
18:38:12 | FromDiscord | <dersnof> lol |
18:38:21 | FromDiscord | <dersnof> but i just started, i should have patience |
18:38:26 | FromDiscord | <Phil> That sounds like it might belong more in offtopic 😉 |
18:38:37 | FromDiscord | <dersnof> oh right |
18:39:57 | termer | If you want to write a Discord not with Nim then do it |
18:40:22 | termer | I view that lib as pretty reliable considering the bridge I'm using to communicate with you right now is using it |
18:40:35 | termer | It's pretty important Nim community infrastructure |
18:41:17 | termer | normally I don't trust random Discord libs to stay up to date, but since it's used for the official IRC-Discord bridge, it should be pretty reliable with updates |
18:41:39 | FromDiscord | <dersnof> nice |
18:41:46 | FromDiscord | <dersnof> it would be nice experiment i suppose |
18:41:56 | termer | do it and enjoy it |
18:42:01 | termer | you'll have fun |
18:43:34 | * | junaid_ joined #nim |
18:46:13 | FromDiscord | <Elegantbeef> @jos7388\: nimscript has a single entry and you need an interpreter for every file if you want code reloading with state saving |
19:02:07 | FromDiscord | <summarity> sent a code paste, see https://play.nim-lang.org/#ix=4DGw |
19:03:56 | FromDiscord | <Elegantbeef> Use two overloads |
19:04:21 | FromDiscord | <Elegantbeef> Whoops |
19:04:22 | FromDiscord | <Elegantbeef> sent a code paste, see https://play.nim-lang.org/#ix=4DGz |
19:05:29 | FromDiscord | <Elegantbeef> sent a code paste, see https://play.nim-lang.org/#ix=4DGA |
19:08:28 | FromDiscord | <summarity> hmm, that's not bad |
19:12:00 | FromDiscord | <Phil> Yeh, overloads are generally the way to go imo when you want to provide the same functionality but with different proc signatures |
19:29:05 | FromDiscord | <jos7388> In reply to @Elegantbeef "<@610710352254205952>\: nimscript has a": can you save, load and link bytecode? Or just nimscript sources |
19:29:58 | FromDiscord | <Chronos [She/Her]> I'm pretty sure Nimscript has no bytecode |
19:30:57 | FromDiscord | <Elegantbeef> I mean it has bytecode sorta, but yea it does not really have any |
19:31:48 | FromDiscord | <Elegantbeef> I think it technically is bytecode if it's only primitives |
19:34:39 | FromDiscord | <Elegantbeef> Nim's VM is quite literally made specifically for easy interop for macros, so it does not do anything overly intelligent for speed and the like. Objects are stored as PNodes which means it's AST based instead of tables or similar |
19:39:51 | FromDiscord | <jos7388> so it’s like a tree walk interpreter I guess? |
19:40:13 | FromDiscord | <jos7388> ok I’m probably gonna use lua or something then |
19:43:12 | FromDiscord | <Elegantbeef> I mean it's not a tree walk interpreter |
19:43:14 | FromDiscord | <Elegantbeef> It just uses the PNodes for objects |
19:44:21 | FromDiscord | <dersnof> sent a code paste, see https://play.nim-lang.org/#ix=4DGT |
19:44:21 | FromDiscord | <dersnof> ngl i expected error |
19:44:32 | FromDiscord | <dersnof> i gave seq to openArray argument |
19:44:56 | FromDiscord | <Elegantbeef> That's the entire point of `openArray` it's a type that abstracts all arrays, seqs, and slices |
19:46:28 | FromDiscord | <dersnof> oh okay |
19:52:17 | FromDiscord | <mr.whis> WTF is a Seq??? |
19:53:44 | * | junaid_ quit (Remote host closed the connection) |
19:54:43 | FromDiscord | <dersnof> Btw how do i compile multiple files together |
19:54:45 | FromDiscord | <dersnof> in Nüm |
19:54:50 | FromDiscord | <dersnof> (edit) "Nüm" => "Nim" |
19:55:27 | FromDiscord | <jordan4ibanez> ``import my_cool_folder/my_cool_thing`` |
19:55:46 | FromDiscord | <jordan4ibanez> or ``import ../my_cool_blep/flarp`` |
19:55:50 | FromDiscord | <arathanis> I dont Nim's compiler compiles from a single file. You need to organize your application into have a single entrypoint |
19:55:58 | FromDiscord | <arathanis> (edit) "dont" => "think" |
19:56:43 | FromDiscord | <dersnof> Oh, are there guide for it. Im trying to understand visible objects stuff |
19:56:50 | FromDiscord | <dersnof> So i was trying multiple modules |
19:56:52 | FromDiscord | <dersnof> Like files |
19:57:09 | FromDiscord | <jordan4ibanez> sent a code paste, see https://paste.rs/VOaFf |
19:57:48 | FromDiscord | <jordan4ibanez> Unfortunately, you'd have to import notImport |
19:58:32 | FromDiscord | <dersnof> Cant you just import whole file |
19:58:37 | FromDiscord | <dersnof> Then use stuff inside |
19:59:10 | FromDiscord | <jordan4ibanez> Ye |
19:59:35 | FromDiscord | <Phil> You may see the word "include" in places |
19:59:37 | FromDiscord | <Phil> Ignore it |
19:59:41 | FromDiscord | <Phil> Ban it from your memory if you see it |
19:59:45 | FromDiscord | <jordan4ibanez> sent a code paste, see https://play.nim-lang.org/#ix=4DGX |
19:59:52 | FromDiscord | <Phil> That is a tool for very special circumstances that will only bring you pain 99.9% of the time |
20:00:01 | FromDiscord | <Phil> And I still haven't found the 0.1% where it's valid |
20:01:29 | FromDiscord | <jordan4ibanez> export can be your friend also |
20:01:36 | FromDiscord | <jordan4ibanez> (edit) "export" => "``export``" |
20:01:47 | FromDiscord | <jordan4ibanez> cyclical deps are a bad time |
20:01:54 | FromDiscord | <Phil> Yeh |
20:06:23 | FromDiscord | <jordan4ibanez> You can treat nim like java, or C, or python (kinda), it's pretty dang neat tbh |
20:06:40 | FromDiscord | <jordan4ibanez> It will just make your life a lot easier der snof |
20:07:13 | FromDiscord | <jordan4ibanez> I've never used an indentation lang before but I see the advantage |
20:07:43 | FromDiscord | <Phil> Now if I could get the gdb debugger to break on breakpoints like in java that'd be neat |
20:08:21 | FromDiscord | <jordan4ibanez> sent a code paste, see https://play.nim-lang.org/#ix=4DH3 |
20:08:25 | FromDiscord | <jordan4ibanez> https://tenor.com/view/house-explosion-explode-boom-kaboom-gif-19506150 |
20:11:26 | FromDiscord | <jordan4ibanez> https://tenor.com/view/spongebob-melting-gif-25326789 |
20:11:36 | FromDiscord | <jordan4ibanez> I think that's a better representation of your expectation |
20:14:19 | FromDiscord | <jordan4ibanez> Oh oh, I almost forgot, another neat thing is like in curly langs or like in lua's ``do`` block there's nim's ``block`` ...block. So you want a temp var or sub procedure without being functional, there you go |
20:25:18 | FromDiscord | <Elegantbeef> `if true:` is more proper |
20:26:28 | FromDiscord | <jordan4ibanez> wat |
20:29:17 | FromDiscord | <Elegantbeef> sent a code paste, see https://paste.rs/tdE5g |
20:29:20 | FromDiscord | <Elegantbeef> It's more proper cause it doesnt eat a `break` |
20:30:36 | FromDiscord | <jordan4ibanez> Then why is the ``block`` scope even in the language? |
20:32:59 | FromDiscord | <Phil> Beef?↵Are you aware of a simple project using testament?↵For mapster I kind of want to have specific sets of tests that deal with specific flags my lib may be compiled with, the only option I'm seeing for doing that is testament |
20:33:38 | FromDiscord | <Phil> The examples in nim-section about testament don't really tell me if you're supposed to do a discard statement a file or a unit-test, nor whether it integrates well with std/unittest |
20:33:41 | FromDiscord | <Elegantbeef> sent a code paste, see https://play.nim-lang.org/#ix=4DH9 |
20:33:55 | FromDiscord | <Elegantbeef> Discard statement goes at the top of a file |
20:34:02 | FromDiscord | <Elegantbeef> No clue about projects that use it |
20:34:22 | FromDiscord | <Phil> Check, so one discard for an entire set of tests in a file |
20:35:37 | FromDiscord | <Elegantbeef> As far as I know, yes |
20:35:56 | FromDiscord | <jordan4ibanez> I'll just stick to ``block`` :nim1: |
20:37:44 | FromDiscord | <arathanis> sent a code paste, see https://play.nim-lang.org/#ix=4DHb |
20:37:49 | FromDiscord | <arathanis> (edit) "https://play.nim-lang.org/#ix=4DHb" => "https://play.nim-lang.org/#ix=4DHc" |
20:38:10 | FromDiscord | <jordan4ibanez> No, no it can't be true, that's not real |
20:38:24 | FromDiscord | <jordan4ibanez> https://tenor.com/view/scream-cat-loud-angry-gif-26168455 |
20:42:21 | FromDiscord | <Phil> Wait what does that even express |
20:45:16 | FromDiscord | <jordan4ibanez> I dunno man I was just being dramatic about a discard statement |
20:45:42 | FromDiscord | <arathanis> In reply to @isofruit "Wait what does that": you have never had a 3rd party block your jira story and been enraged because you are their lowest priority? |
20:45:50 | FromDiscord | <nnsee> sorry if this has already been asked or pointed out, but am I the only one for whom setting the docs theme doesn't work? console spews out a `setTheme is not defined` |
20:45:52 | FromDiscord | <Phil> the discard is fine, but the fuck does `block <variable>` even mean?! |
20:46:12 | FromDiscord | <arathanis> In reply to @isofruit "the discard is fine,": named block, so you can "break <block-name>" |
20:46:34 | FromDiscord | <jos7388> does nimscript evaluate expressions like `type X = enum`> |
20:46:35 | FromDiscord | <jos7388> (edit) "enum`>" => "enum`?" |
20:46:43 | FromDiscord | <arathanis> sent a code paste, see https://play.nim-lang.org/#ix=4DHy |
20:46:44 | FromDiscord | <arathanis> @Phil ^ |
20:46:46 | FromDiscord | <jordan4ibanez> beat me to it |
20:47:02 | FromDiscord | <nnsee> sent a code paste, see https://paste.rs/8Km43 |
20:47:35 | FromDiscord | <nnsee> slightly different syntax (you set a label for the loop itself) but it works the same |
20:47:39 | FromDiscord | <Phil> Ohh not variable name, block name |
20:47:44 | FromDiscord | <Phil> Check |
20:48:00 | FromDiscord | <arathanis> i was just making a jira joke using the word "block" |
20:48:10 | FromDiscord | <Phil> Yeh, got that one, was confused by named block |
20:48:51 | FromDiscord | <Phil> Also it shouldn't be too hard to just make namedFor macro that writes a normal for-loop in a named block |
20:49:02 | FromDiscord | <Phil> To get smoother syntax |
20:49:05 | FromDiscord | <arathanis> In reply to @isofruit "Also it shouldn't be": Beef did this yesterday |
20:49:23 | FromDiscord | <arathanis> https://discord.com/channels/371759389889003530/371759389889003532/1141265923316129812 |
20:49:51 | FromDiscord | <Phil> I assume he did it half asleep with one hand tied behind his back balacning on a mountain-top while bears attack him from both sides |
20:50:02 | FromDiscord | <arathanis> ok beef did it 6 years ago |
20:50:09 | FromDiscord | <arathanis> but PMunch brought it up yesterday haha |
20:50:47 | FromDiscord | <arathanis> (edit) "6" => "~~6" | "ago" => "ago~~ in February" |
20:58:29 | FromDiscord | <Elegantbeef> No that's not an expression↵(@jos7388) |
21:03:13 | FromDiscord | <jos7388> when i add pragmas and stuff the AST looks a lot like an expression |
21:03:18 | FromDiscord | <jos7388> what is evaluating that to produce a type? |
21:03:25 | FromDiscord | <jos7388> the nim compiler seems so nutty |
21:04:05 | FromDiscord | <Elegantbeef> What? |
21:04:22 | FromDiscord | <Elegantbeef> I mean it's compiled into typed ast |
21:04:28 | FromDiscord | <Elegantbeef> Is that evaluation... uhhh |
21:05:09 | FromDiscord | <jos7388> so nimscript just produces an AST i guess |
21:05:24 | FromDiscord | <Elegantbeef> No |
21:05:30 | FromDiscord | <jos7388> macros do |
21:05:34 | FromDiscord | <jos7388> and macros are nimscript ye? |
21:05:40 | FromDiscord | <Elegantbeef> The compiler compiiles code, believe it or not 😄 |
21:07:15 | FromDiscord | <Phil> Sounds illegal, called the cops |
21:07:34 | FromDiscord | <dersnof> sent a code paste, see https://play.nim-lang.org/#ix=4DHE |
21:07:45 | FromDiscord | <dersnof> instead of importing every proc one by one |
21:07:47 | FromDiscord | <Elegantbeef> Macros are a usage of nimscript yes |
21:07:48 | FromDiscord | <Elegantbeef> they return AST yes |
21:08:41 | FromDiscord | <jos7388> so type information is just a data source, like a traditional symbol table, for macros |
21:09:05 | FromDiscord | <Elegantbeef> type information is for semantic analysis |
21:09:17 | FromDiscord | <jos7388> yeah of course |
21:09:26 | FromDiscord | <jos7388> but it can also be read by macros |
21:09:35 | FromDiscord | <jos7388> right? like macros in rust are just lexical, only consume AST |
21:09:40 | FromDiscord | <Elegantbeef> Right cause the code inside the macro is semantically checked |
21:09:46 | FromDiscord | <jos7388> but in nim, you can actually query type information i think |
21:09:59 | FromDiscord | <Elegantbeef> Nim asts are inspired by lisp |
21:10:13 | FromDiscord | <Elegantbeef> Nim macros\ |
21:10:19 | FromDiscord | <Elegantbeef> They take in ast and return ast |
21:10:34 | FromDiscord | <jos7388> i feel once you start querying type information in macros, you run into a lot of issues with compilation order |
21:10:36 | FromDiscord | <Elegantbeef> this means they have access to type information and everything the compiler has access to if it were to compile the code |
21:10:52 | FromDiscord | <Elegantbeef> Nope cause compilation is bottom up |
21:10:55 | FromDiscord | <Elegantbeef> The lowest type macro is evaluated first |
21:11:03 | FromDiscord | <Elegantbeef> typed\ |
21:12:28 | FromDiscord | <jos7388> i see |
21:12:48 | FromDiscord | <jos7388> is typed macro a macro that reads a `typed` parameter? |
21:13:24 | * | ntat quit (Quit: leaving) |
21:13:40 | FromDiscord | <jos7388> i can't find any docs on what typed vs untyped is doing-- i'm guessing that typed has more type information.. somehow but i dont really know what extra it has |
21:17:55 | FromDiscord | <Elegantbeef> typed macros require arguments to pass semantic analysis, untyped only parse the arguments |
21:18:01 | FromDiscord | <Elegantbeef> as such typed has type information, untyped does not |
21:18:09 | FromDiscord | <Elegantbeef> phil and I discussed this in detail last night |
21:18:10 | FromDiscord | <Elegantbeef> so find that |
21:22:25 | FromDiscord | <dersnof> Are there any nice Nim project that i can inspect its modularization and stuff |
21:22:29 | FromDiscord | <dersnof> Shouldnt be huge project |
21:22:39 | FromDiscord | <dersnof> So i can inspect codes easier |
21:23:24 | * | advesperacit_ quit () |
21:27:59 | FromDiscord | <michaelb.eth> In reply to @dersnof "Are there any nice": I'd suggest nim-chronos as well organized project that shows off organization of Nim code into layers of modules:↵https://github.com/status-im/nim-chronos |
21:28:08 | FromDiscord | <michaelb.eth> (edit) "In reply to @dersnof "Are there any nice": I'd suggest nim-chronos as ... well" added "a" |
21:29:23 | FromDiscord | <dersnof> In reply to @michaelb.eth "I'd suggest nim-chronos as": Oh okay it can teach me multi files Nim architecture |
21:35:57 | FromDiscord | <jos7388> In reply to @Elegantbeef "typed macros require arguments": ok cool, this makes sense to me |
21:36:01 | FromDiscord | <jos7388> thanks very helpful |
21:42:43 | FromDiscord | <summarity> sent a code paste, see https://play.nim-lang.org/#ix=4DHL |
21:43:22 | FromDiscord | <Chronos [She/Her]> `cast[proc()](foo)` |
21:43:36 | FromDiscord | <Chronos [She/Her]> In reply to @summarity "When I have a": But why not store the proc type itself? |
21:46:08 | FromDiscord | <summarity> sent a code paste, see https://play.nim-lang.org/#ix=4DHN |
21:46:44 | FromDiscord | <Chronos [She/Her]> Hm I'm not too sure, that should work |
21:47:08 | FromDiscord | <Chronos [She/Her]> I'm confused why you're not doing `foo: ProcType` instead though honestly |
21:48:06 | FromDiscord | <summarity> It's a bit of weird situation, the proc ptr goes through a layer of callbacks and hooks with other C code, and I need to recover it (and yet I know exactly what signature it has). |
21:49:42 | FromDiscord | <summarity> Ah it was missing {.cdecl, gcsafe.} |
21:50:14 | * | Yew joined #nim |
22:00:56 | FromDiscord | <dersnof> Hmm i have an idea |
22:00:59 | FromDiscord | <dersnof> So i love Vue |
22:01:10 | FromDiscord | <dersnof> And there is Karax to output JS from Nim |
22:01:35 | FromDiscord | <dersnof> So would there maybe way to write Vue stuff in Nim and produce JS |
22:01:50 | FromDiscord | <dersnof> (edit) "Vue" => "Vue.JS" |
22:04:07 | * | _0x00 quit (Ping timeout: 245 seconds) |
22:28:10 | * | rockcavera quit (Remote host closed the connection) |
22:30:27 | FromDiscord | <arathanis> oh god |
22:30:32 | FromDiscord | <arathanis> noooooooooooo |
22:30:52 | * | genr8eofl_ joined #nim |
22:30:57 | FromDiscord | <arathanis> someone in a channel im in at work just said:↵> a post-mortem is definitely in order |
22:31:01 | FromDiscord | <arathanis> pray for me, friends |
22:33:06 | * | genr8eofl quit (Ping timeout: 246 seconds) |
22:34:17 | FromDiscord | <Chronos [She/Her]> In reply to @summarity "It's a bit of": Ah fair |
22:40:19 | * | rockcavera joined #nim |
22:47:10 | FromDiscord | <ygorko> Hello everyone o/ |
22:48:35 | FromDiscord | <ygorko> I'm new to Nim, and I've decided to make a tiny game with naylib to learn the language, but I've encountered a problem |
22:48:45 | FromDiscord | <ygorko> specifically with nil checks |
22:48:57 | FromDiscord | <arathanis> what previous languages have you used/ |
22:48:57 | FromDiscord | <arathanis> (edit) "used/" => "used?" |
22:50:05 | FromDiscord | <ygorko> oh, lots of them haha |
22:50:22 | FromDiscord | <ygorko> to name compiled ones: C/C++, Java, C#, Kotlin, etc |
22:50:57 | FromDiscord | <ygorko> I have a struct "Game", that has a currentScene field https://media.discordapp.net/attachments/371759389889003532/1141504395855548466/image.png |
22:51:12 | FromDiscord | <arathanis> > struct |
22:51:15 | FromDiscord | <arathanis> so definitely used C |
22:51:17 | FromDiscord | <arathanis> 😂 |
22:51:18 | FromDiscord | <ygorko> mb |
22:51:40 | FromDiscord | <ygorko> well, C is the most recent thing i've used, so my vocabulary is affected a bit 🥴 |
22:52:24 | FromDiscord | <ygorko> I also have a scene ~~struct~~object type, which is just a bunch of closures https://media.discordapp.net/attachments/371759389889003532/1141504761506582548/image.png |
22:53:01 | FromDiscord | <ygorko> and here's my update function that has the problem: https://media.discordapp.net/attachments/371759389889003532/1141504918017019944/image.png |
22:53:27 | FromDiscord | <arathanis> sent a code paste, see https://play.nim-lang.org/#ix=4DHT |
22:53:34 | FromDiscord | <arathanis> if you are into that sort of thing |
22:54:09 | FromDiscord | <ygorko> I'll definitely try it out later, but now i'm bugged over compiler yelling at me |
22:54:54 | FromDiscord | <arathanis> what is it complaining about? |
22:55:03 | FromDiscord | <ygorko> https://media.discordapp.net/attachments/371759389889003532/1141505429432709191/image.png |
22:55:30 | FromDiscord | <arathanis> currentScene is a ref type, and you have not nullchecked it |
22:55:39 | FromDiscord | <arathanis> oh wait, you did wth |
22:55:44 | FromDiscord | <ygorko> it tells me that it cant deref a currentScene as it may be nil, even though I've assigned it to a non nillable var just fine |
22:55:46 | FromDiscord | <ygorko> yea |
22:56:08 | FromDiscord | <arathanis> so SceneRef, assuming its a ref type, is still nullable |
22:56:21 | FromDiscord | <Elegantbeef> using not nil, what a brave soul |
22:56:34 | FromDiscord | <arathanis> maybe the compiler is confused, you did check if game.currentScene is not nil |
22:56:35 | FromDiscord | <ygorko> In reply to @ygorko "I also have a": i dont think it is |
22:56:54 | FromDiscord | <arathanis> but maybe now that you reassign it it does not understand the nil checks trannsitivity |
22:57:05 | FromDiscord | <arathanis> looks like you get to submit a compiler PR, lucky you! |
22:57:38 | FromDiscord | <ygorko> In reply to @arathanis "but maybe now that": actually i reassign it because i figured it would understand them better if i assigned it to a non nillable variable explicitly 😂 |
22:58:02 | FromDiscord | <arathanis> is SceneRef not a ref type and therefore nullable? |
22:58:28 | FromDiscord | <ygorko> In reply to @ygorko "I also have a": it is a ref type |
22:58:30 | FromDiscord | <arathanis> sent a code paste, see https://play.nim-lang.org/#ix=4DHU |
22:58:35 | FromDiscord | <arathanis> ref types can be nil |
22:58:39 | FromDiscord | <Elegantbeef> You have a `ref ref` |
22:58:42 | FromDiscord | <ygorko> no, i need to keep it a ref type |
22:58:54 | FromDiscord | <Elegantbeef> Wait nvm misread |
22:59:05 | FromDiscord | <arathanis> SceneRef is a nullable type |
22:59:08 | FromDiscord | <arathanis> if it a ref |
22:59:12 | FromDiscord | <arathanis> (edit) "it" => "its" |
22:59:15 | FromDiscord | <Elegantbeef> I'd say stop using not nil annotations, they're experimental for a reason |
22:59:28 | FromDiscord | <Elegantbeef> Use `Option[Scene]` instead |
22:59:32 | FromDiscord | <ygorko> In reply to @Elegantbeef "I'd say stop using": 🙃 |
23:00:00 | FromDiscord | <arathanis> In reply to @Elegantbeef "I'd say stop using": is not nil notation just `!= nil`? |
23:00:17 | FromDiscord | <Elegantbeef> No |
23:00:20 | FromDiscord | <arathanis> (edit) "notation" => "annotations" |
23:00:28 | FromDiscord | <Elegantbeef> `SceneRef = ref Scene not nil` |
23:00:32 | FromDiscord | <arathanis> oh its the `a: SceneRef not nil` lol |
23:00:59 | FromDiscord | <Elegantbeef> It's a flow analysis to ensure that you never deference a nil ref, it's practically `Option[ref]` |
23:01:08 | FromDiscord | <Elegantbeef> But with flow control analysis |
23:03:32 | FromDiscord | <arathanis> you should listen to beef and be at least a little suspect of experimental features |
23:03:42 | FromDiscord | <arathanis> perhaps try using `concepts`? |
23:03:45 | FromDiscord | <arathanis> 😉 |
23:05:25 | FromDiscord | <ygorko> In reply to @arathanis "you should listen to": yeah, I guess I'll have to stick to good ol' Options for now |
23:05:40 | FromDiscord | <ygorko> In reply to @arathanis "perhaps try using `concepts`?": arent concepts experimental too? 🥴 |
23:05:47 | FromDiscord | <arathanis> In reply to @ygorko "arent concepts experimental too?": hence the winking emoji |
23:05:52 | FromDiscord | <ygorko> i see |
23:05:57 | FromDiscord | <arathanis> i was clowning on concepts for being experimental forever |
23:06:05 | FromDiscord | <arathanis> its awesome when they work |
23:06:11 | FromDiscord | <jviega> Cool so nimcrypto, something that's barely used by a dependency of a dependency of a dependency, just pushed a new change 30 mins ago, and it breaks everything downstream. But I can't clone and pin, because they don't even use release numbers?? |
23:06:22 | FromDiscord | <jviega> Makes my low opinion of it even lower |
23:06:43 | FromDiscord | <arathanis> classic |
23:07:08 | FromDiscord | <arathanis> In reply to @jviega "Cool so nimcrypto, something": clone at a working commit and embed into your system? |
23:07:11 | FromDiscord | <arathanis> (edit) "system?" => "project?" |
23:07:59 | FromDiscord | <jviega> Yeah, sucks that I have to do that. I'm going to have to rip out my few dependencies and wrap C/C++ libs I actually trust |
23:08:48 | FromDiscord | <jviega> It's an AWS lib I had to fix anyway because there's nothing good, that uses an HMAC library, that imports nimcrypto for.... who knows what. |
23:09:12 | FromDiscord | <jviega> There are good C++ AWS libraries, just no good wrapping. It's silly |
23:10:35 | FromDiscord | <Elegantbeef> Concepts are experimental, but they're more usable that not nil annotations |
23:11:18 | FromDiscord | <arathanis> In reply to @Elegantbeef "Concepts are experimental, but": in my experience you mostly have to keep them on the simpler side |
23:11:32 | FromDiscord | <arathanis> if you try and get very complex with concepts you run into the experimental edges and fall off the end of the compiler |
23:11:52 | FromDiscord | <Elegantbeef> I mean if you do dumb shit, yes |
23:11:56 | FromDiscord | <Elegantbeef> Concepts work if you do sensible shit |
23:12:30 | FromDiscord | <arathanis> what do you consider to be sensible shit, and what do you consider to be dumb shit? |
23:12:43 | FromDiscord | <Elegantbeef> "I just tried representing a recursive monoid, it's not dumb it works in haskell" |
23:13:16 | FromDiscord | <Elegantbeef> Sensible shit is using it as a declarative type match, which it is |
23:14:28 | FromDiscord | <arathanis> My biggest problem is the Experimental Features page is still wrong |
23:14:38 | FromDiscord | <arathanis> one of the examples doesn't even work |
23:14:43 | FromDiscord | <arathanis> for concepts |
23:14:45 | FromDiscord | <jviega> @arnetheduck Don't know if you're aware, but you seem to have broken the build on most platforms. |
23:14:59 | FromDiscord | <arathanis> it is a monoid but it is used as an example lol |
23:15:01 | FromDiscord | <jviega> sent a code paste, see https://play.nim-lang.org/#ix=4DHZ |
23:15:47 | FromDiscord | <ygorko> I don't think I have a use case for concepts yet |
23:16:04 | FromDiscord | <Elegantbeef> Right arath, it's the exact wrong case to use concepts imo |
23:16:23 | FromDiscord | <Elegantbeef> First it uses concepts recursively |
23:16:26 | FromDiscord | <Elegantbeef> Which is just ugh |
23:16:28 | FromDiscord | <ygorko> They do seem to be quite interesting, as a tool to restrict what kind of generic types are allowed in functions, but idk where I'd use them for now |
23:16:47 | FromDiscord | <arathanis> In reply to @Elegantbeef "Right arath, it's the": I can see this. I just wish the examples didn't contain something so misleading 😂 |
23:17:23 | FromDiscord | <arathanis> So you think the sensible shit is basic structure matching without craziness |
23:17:34 | FromDiscord | <arathanis> "if it is at least this, then it works" |
23:17:42 | FromDiscord | <Elegantbeef> I mean it uses concepts recursively, that's just awful |
23:17:53 | FromDiscord | <arathanis> its kind of like duck typing |
23:18:01 | FromDiscord | <arathanis> or structural typing |
23:18:16 | FromDiscord | <arathanis> "if it has at least this structure you may use it here" |
23:18:41 | FromDiscord | <Elegantbeef> User defined duck typing is what concepts are |
23:19:11 | FromDiscord | <Elegantbeef> sent a code paste, see https://play.nim-lang.org/#ix=4DI0 |
23:19:20 | FromDiscord | <Elegantbeef> This is a much more sensible thing that does not cause a recurse inside of a concept |
23:19:42 | FromDiscord | <Elegantbeef> Though the doc concept works |
23:19:43 | FromDiscord | <Elegantbeef> So... |
23:20:21 | FromDiscord | <arathanis> In reply to @Elegantbeef "Though the doc concept": I just ran it |
23:20:27 | FromDiscord | <arathanis> it compiles but prints false not true |
23:20:43 | FromDiscord | <arathanis> sent a code paste, see https://play.nim-lang.org/#ix=4DI2 |
23:21:13 | FromDiscord | <Elegantbeef> There is no `val` for options |
23:22:17 | FromDiscord | <arathanis> oh does it just need an edit? |
23:22:26 | FromDiscord | <Elegantbeef> Well that's the first issue I see |
23:22:39 | FromDiscord | <arathanis> it should be f.get, right? |
23:22:47 | FromDiscord | <arathanis> or `f.get()` |
23:22:47 | FromDiscord | <Elegantbeef> It might work there, but that's odd |
23:23:56 | FromDiscord | <Elegantbeef> We went over this before though, afaik this is just wrong to begin with, you cannot bind a type here to `MatcheGenericType` |
23:24:35 | FromDiscord | <arathanis> yeah we did go over it before |
23:24:42 | FromDiscord | <arathanis> im not trying to fight it into working now |
23:24:54 | FromDiscord | <arathanis> just commenting that the page its on was updated for 2.0.0 and this is unchanged and still incorrect. |
23:32:19 | FromDiscord | <heysokam> sent a code paste, see https://play.nim-lang.org/#ix=4DI4 |
23:32:54 | FromDiscord | <Elegantbeef> `RPG(discord = newDiscordClient(token))` |
23:33:00 | FromDiscord | <Elegantbeef> whoops \`\: |
23:33:50 | FromDiscord | <ygorko> Can i ask another question? |
23:34:04 | FromDiscord | <Elegantbeef> Nope the quota has been reached, you'll have to come back in a month or two |
23:34:09 | FromDiscord | <ygorko> ah crap |
23:34:11 | FromDiscord | <heysokam> In reply to @Elegantbeef "`RPG(discord = newDiscordClient(token))`": `=`? |
23:34:16 | FromDiscord | <Elegantbeef> "Why does it say bot next to your name" is an invalid question |
23:34:19 | FromDiscord | <Elegantbeef> I mean `:` |
23:34:20 | FromDiscord | <heysokam> woudln't it be `:`? |
23:34:20 | FromDiscord | <Elegantbeef> of course |
23:34:32 | FromDiscord | <heysokam> but that's what wasn't working |
23:34:46 | FromDiscord | <Elegantbeef> Well maybe if you provided an error instead of just saying that I might help more |
23:34:50 | FromDiscord | <heysokam> hmm wait |
23:35:02 | FromDiscord | <heysokam> i was saying `new RPG(...)` because its a ref object |
23:35:08 | FromDiscord | <heysokam> does it change anything? |
23:35:18 | FromDiscord | <Elegantbeef> yes `new T()` is invalid |
23:35:27 | FromDiscord | <heysokam> ah i see |
23:35:30 | FromDiscord | <Elegantbeef> Nim does not have a `new` that takes in a value |
23:35:45 | FromDiscord | <ygorko> awesome, that was one of my questions |
23:35:47 | FromDiscord | <Elegantbeef> You do not need new when allocating ref objects with constructors |
23:35:47 | FromDiscord | <Elegantbeef> they do it i implicitly |
23:35:56 | FromDiscord | <heysokam> ohhh kk i didn't know that |
23:36:03 | FromDiscord | <ygorko> What is the difference between constructing new instance of Type with `new Type` and `Type()`? |
23:36:12 | FromDiscord | <ygorko> assuming `Type` is a `ref object` |
23:36:17 | FromDiscord | <Elegantbeef> You like typing more |
23:36:44 | FromDiscord | <ygorko> alright, thanks! |
23:37:18 | FromDiscord | <Elegantbeef> Any more questions and you'll have to put a penny in the hat out front |
23:42:32 | FromDiscord | <summarity> > cannot use symbol of kind 'proc' as a 'param'↵is this a known limitation of `template`s? |
23:42:47 | FromDiscord | <Elegantbeef> depends, what are you doing |
23:43:31 | FromDiscord | <summarity> passing a proc to a template |
23:43:39 | FromDiscord | <Elegantbeef> That's not helping |
23:43:56 | FromDiscord | <Elegantbeef> Are you passing a proc to a template then using that parameter name as a parameter's field ident |
23:44:08 | FromDiscord | <Elegantbeef> If so, welcome to templates, they replace all parameters with their name |
23:44:32 | FromDiscord | <Elegantbeef> So if you write `template doThing(i: untyped) = proc(i: int) = discard` that `i` inside that `proc` is whatever you passed in |
23:44:48 | FromDiscord | <Elegantbeef> so `doThing "hmm"` will error about a string being placed inside a ident def |
23:46:09 | FromDiscord | <summarity> ah yes, that led me to the issue, it was accidentally overwriting a type name |
23:48:36 | * | Yew left #nim (.) |