00:01:40 | FromDiscord | <-|-> Hrm, how much stack space does a nim program typically use? |
00:03:02 | PMunch | As much as it requires |
00:03:20 | FromDiscord | <-|-> sent a code paste, see https://play.nim-lang.org/#ix=3W3O |
00:03:28 | FromDiscord | <-|-> With `-d:release`, it just hangs after the first `echo` call |
00:05:20 | PMunch | Hmm, that's weird |
00:05:29 | PMunch | How bigs the stack for this target? |
00:07:41 | FromDiscord | <Elegantbeef> Are you using arc?↵(@-|-) |
00:08:29 | FromDiscord | <-|-> In reply to @Elegantbeef "Are you using arc?": Yes |
00:08:30 | FromDiscord | <-|-> sent a code paste, see https://play.nim-lang.org/#ix=3W3P |
00:09:02 | FromDiscord | <-|-> i086 is a new CPU target I added |
00:23:58 | FromDiscord | <huantian> Is there a way I can get nim vscode to use a different nim binary for a single workspace? |
00:24:15 | FromDiscord | <huantian> specifically when working with devel |
00:24:22 | * | pch_ is now known as disso_peach |
00:25:07 | FromDiscord | <System64 ~ Flandre Scarlet> How can I compile to 32-bits please? |
00:25:11 | PMunch | Hmm, @Elegantbeef, I wonder if I could go about this the other way round |
00:25:45 | FromDiscord | <Elegantbeef> That last time i read something that cryptic i was reading egyptian artificats |
00:25:58 | PMunch | Take the routable procedure, then generate procedures that get less and less specific |
00:27:38 | PMunch | So start with getPost(User, Post), and then create procs getPost(Request, Post) which just calls getPost(get(User, Request), Post), and getPost(User, get(Post, Request)) |
00:28:14 | PMunch | And so on |
00:28:50 | PMunch | Then the routing logic would just be `routes: get "/whatever": getPost(request)` |
00:29:07 | PMunch | And since it has at some point generated that procedure it should just work |
00:29:14 | FromDiscord | <Elegantbeef> No clue if it works for you 😄 |
00:29:33 | FromDiscord | <Elegantbeef> insert a comman |
00:29:34 | FromDiscord | <Elegantbeef> comma |
00:29:37 | FromDiscord | <Elegantbeef> Jesus i cannot type right now |
00:29:49 | PMunch | A comma? Where? |
00:30:05 | FromDiscord | <Elegantbeef> 'No clue, ...' |
00:30:07 | PMunch | @System64_~_Flandre_Scarlet, --cpu shoul help you out here |
00:30:24 | PMunch | Of course if you compile on a 32 bit system it will compile to 32 bit automatically |
00:30:33 | PMunch | Ah right :P |
00:30:37 | FromDiscord | <Elegantbeef> you'll need to fetch the compiler for crosscompiling |
00:31:01 | FromDiscord | <Elegantbeef> Hmm Clang/Zigcc allow 64bit -\> 32bit without any special tooling dont they? |
00:31:11 | FromDiscord | <Elegantbeef> Never built for 32bit before cause afterall it's 2022 😄 |
00:31:41 | FromDiscord | <-|-> Well, I solved my problem now. I added another target, i086big, that is specifically able to handle the large memory model. Not the best solution, but there's no other way. |
00:31:48 | FromDiscord | <-|-> In reply to @Elegantbeef "Hmm Clang/Zigcc allow 64bit": It does. I've used it. |
00:32:03 | FromDiscord | <System64 ~ Flandre Scarlet> In reply to @PMunch "@System64_~_Flandre_Scarlet, --cpu shoul help": ah alright, thanks |
00:33:18 | FromDiscord | <Elegantbeef> Hmm `--cc:clang --cpu:i386` does not work you've lied to me! |
00:33:50 | FromDiscord | <-|-> You still need the C library and support files for 32-bit platforms |
00:34:04 | FromDiscord | <-|-> `zig cc` comes with those. Regular clang usually doesn't. |
00:34:12 | FromDiscord | <Elegantbeef> I mean it's hello world, the issue is the size of pointer isnt the same as size of nimint |
00:35:32 | FromDiscord | <-|-> oh, you'll also need to pass the target triple to clang |
00:36:01 | FromDiscord | <-|-> `--passC:"-target i386-<os>-gnu" -passL:"-target i386-<os>-gnu"` |
00:36:34 | FromDiscord | <Elegantbeef> Ah there you go |
00:37:42 | FromDiscord | <Elegantbeef> Yea ran into the lack of 32bit header files |
00:39:09 | PMunch | Oh well, time for bed |
00:39:14 | * | PMunch quit (Quit: leaving) |
00:39:23 | FromDiscord | <Elegantbeef> Buh bye have a nice sobering sleep 😛 |
00:40:05 | FromDiscord | <Elegantbeef> Ah nice fetched 32bit clang and it just worked 😄 |
00:40:56 | FromDiscord | <Elegantbeef> suppose 32bit gcc also works easily |
00:46:21 | disso_peach | hey, I have a library implemented in nim that I've offered for use to a friend who would end up using it from rust, is there much documentation on calling nim code over CFFI in rust |
00:47:26 | FromDiscord | <JSONBash> has anyone dealt with monetary floats and arbitrary decimals in Nim? Looking for ideas on how I should handle them |
00:47:36 | FromDiscord | <Elegantbeef> There isnt any documentation that i know of but you can checkout genny for making the system library, and i'd suggest using `--mm:orc` |
00:48:18 | FromDiscord | <Elegantbeef> https://nim-lang.org/docs/manual.html#foreign-function-interface-dynlib-pragma-for-export https://nim-lang.org/docs/manual.html#foreign-function-interface-exportc-pragma are the best things to read |
00:51:50 | FromDiscord | <huantian> Just noticed asyncdispatch has this stuck at the end of it's docs https://media.discordapp.net/attachments/371759389889003532/967588645710209054/unknown.png |
00:52:04 | FromDiscord | <huantian> because it includes asyncmacro which has this as it's module docstring |
00:56:17 | FromDiscord | <huantian> Is this intentional?? |
01:11:14 | * | vicfred joined #nim |
01:33:09 | FromDiscord | <SirOlaf> Can I force arc to not produce a destructor? Am dealing with a particularly nasty bug |
01:42:56 | FromDiscord | <SirOlaf> Guess cursor annotation is good enough for now. So, I may have memory corruption or something going on, gonna see if I can make this reproducible somehow, as it is currently part of a pretty big codebase |
02:24:55 | FromDiscord | <SirOlaf> sent a code paste, see https://play.nim-lang.org/#ix=3W4a |
02:26:10 | FromDiscord | <huantian> I mean you can `GC_ref()` it but then it won't get collected |
02:26:17 | FromDiscord | <huantian> so you'll get a memory leak |
02:26:32 | FromDiscord | <Elegantbeef> Do you have the scope that causes the issue? |
02:27:08 | FromDiscord | <SirOlaf> Well I can give some context at best. I got this dll that detours a function that does something like that |
02:27:23 | FromDiscord | <SirOlaf> So I don't know if the destructor screws with the stack or something |
02:27:42 | FromDiscord | <Elegantbeef> Are these both Nim libraries? |
02:27:50 | FromDiscord | <SirOlaf> ? |
02:28:04 | FromDiscord | <Elegantbeef> The dll and the caller are they both Nim? |
02:28:10 | FromDiscord | <SirOlaf> I got a foreign process that gets injected with my dll made using Nim |
02:28:15 | FromDiscord | <SirOlaf> And it hooks a few functions in that process |
02:29:48 | FromDiscord | <Elegantbeef> And there's no chance a pointer to this string outlives the string? |
02:30:02 | FromDiscord | <SirOlaf> Absolutely no chance as that code I sent is all I need to crash it |
02:30:26 | FromDiscord | <Elegantbeef> Can i see the scope where the crash happens? |
02:30:34 | FromDiscord | <SirOlaf> What does this mean |
02:30:59 | FromDiscord | <Elegantbeef> Just show the procedure then 😄 |
02:31:12 | FromDiscord | <SirOlaf> Crash happens later from what I can tell because the process, not dll, tries to use an invalid pointer |
02:31:29 | FromDiscord | <SirOlaf> So the situation I got is that the destructor may somehow screw up the stack |
02:32:18 | FromDiscord | <Elegantbeef> doubtful but who knows |
02:32:28 | FromDiscord | <SirOlaf> Well yeah it makes no sense |
02:32:37 | FromDiscord | <SirOlaf> But I'm running out of ideas |
02:32:41 | FromDiscord | <SirOlaf> It works when I mark x as a cursor |
02:32:47 | FromDiscord | <Elegantbeef> Well i still do want to see the procedure you're doing it with |
02:33:19 | FromDiscord | <SirOlaf> In reply to @SirOlaf "It works when I": But that probably has some consequences |
02:33:44 | FromDiscord | <Elegantbeef> What does `x` even do then, you said it causes it even if you just add to it and dont pass it |
02:33:55 | FromDiscord | <SirOlaf> In reply to @Elegantbeef "Well i still do": There is not much to see, it's just a stdcall proc hooked using minhook |
02:34:18 | FromDiscord | <SirOlaf> In reply to @Elegantbeef "What does `x` even": In my real example it does more, but I reduced the crash to this tiny snippet |
02:34:35 | FromDiscord | <SirOlaf> So the destructor must be at fault somehow |
02:34:54 | FromDiscord | <Elegantbeef> well like huan said `GCRef` it |
02:35:00 | FromDiscord | <Elegantbeef> if it still crashes you're wrongo |
02:35:21 | FromDiscord | <SirOlaf> Does that work with arc |
02:35:34 | FromDiscord | <Elegantbeef> Yes |
02:35:44 | FromDiscord | <SirOlaf> Still gives me the issue of a memory leak then |
02:35:55 | FromDiscord | <Elegantbeef> It's a fucking test |
02:35:58 | FromDiscord | <SirOlaf> Yeah true |
02:36:56 | FromDiscord | <SirOlaf> Well that's funny, it for some reason wants a ref T |
02:37:05 | FromDiscord | <SirOlaf> Does not want to use the string version |
02:37:42 | FromDiscord | <Elegantbeef> Do you use `--threads:on`? |
02:37:48 | FromDiscord | <SirOlaf> Oh yeah, forgot to mention that |
02:37:49 | FromDiscord | <SirOlaf> Yes |
02:38:41 | FromDiscord | <SirOlaf> I know it uses sharedalloc or something |
02:38:45 | FromDiscord | <SirOlaf> Does that do anything wild |
02:38:56 | FromDiscord | <SirOlaf> (edit) "sharedalloc" => "allocshared" |
02:39:14 | FromDiscord | <Elegantbeef> It allocates on the shared heap, so nothing really for Arc |
02:39:28 | FromDiscord | <Elegantbeef> Ok so i'm going to say it's more likely you have a thread issue somewhere |
02:39:28 | FromDiscord | <SirOlaf> So why does gc_ref not work for it |
02:39:35 | FromDiscord | <Elegantbeef> Odd that you can use gcref with threads |
02:39:37 | FromDiscord | <Elegantbeef> I dont fucking know |
02:39:40 | FromDiscord | <SirOlaf> Documentation mentions nothing about thread support |
02:40:40 | FromDiscord | <Elegantbeef> Oh wait it just seems you cant use gcref on strings |
02:40:41 | FromDiscord | <Elegantbeef> Guess cause of the COW |
02:41:02 | FromDiscord | <Elegantbeef> Or sequences |
02:41:09 | FromDiscord | <huantian> dang cows always ruining plans |
02:41:16 | FromDiscord | <SirOlaf> Ok, any other options |
02:41:36 | FromDiscord | <SirOlaf> This is extraordinarily hard to debug, have been trying to figure this out for days |
02:41:38 | FromDiscord | <Elegantbeef> Give me the program so i can actually see what's happening |
02:42:02 | FromDiscord | <SirOlaf> That's a bit problematic. I could write a new dll and try to make it fail but it would have to hook something |
02:42:16 | FromDiscord | <Elegantbeef> I mean the code |
02:42:25 | FromDiscord | <SirOlaf> But what do you want to see there |
02:42:39 | FromDiscord | <SirOlaf> I swear to god this detour literally does nothing else |
02:42:40 | FromDiscord | <Elegantbeef> I want to see the code so i can see if you're doing anything unsafe |
02:42:46 | FromDiscord | <SirOlaf> Oh I'm doing tons of unsafe stuff |
02:42:49 | FromDiscord | <Elegantbeef> I dont give a fiddly fuck |
02:43:00 | FromDiscord | <Elegantbeef> I want to see the code to validate the logic and ensure you arent missing a minor detail |
02:43:29 | FromDiscord | <Elegantbeef> By unsafe i mean "Oh it's working" and not "Oh it's done properly" |
02:44:02 | FromDiscord | <SirOlaf> I do basically nothing |
02:44:04 | FromDiscord | <SirOlaf> sent a code paste, see https://play.nim-lang.org/#ix=3W4f |
02:44:13 | FromDiscord | <Elegantbeef> Debugging code without the code is about as useful as a brain surgeon walking a blind person through brain surgury |
02:44:24 | FromDiscord | <SirOlaf> Well yeah but the point is that I'm doing nothing |
02:44:35 | FromDiscord | <Elegantbeef> You have more code than 1 function |
02:44:35 | FromDiscord | <SirOlaf> I just call the original and then make it crash using the string |
02:44:47 | FromDiscord | <SirOlaf> Of course I do, in fact, I got a few thousand lines |
02:44:53 | FromDiscord | <SirOlaf> A massive chunk of which is unsafe |
02:45:07 | FromDiscord | <Elegantbeef> Gib code! |
02:45:47 | FromDiscord | <SirOlaf> I'll just make a new one |
02:45:53 | FromDiscord | <SirOlaf> Then it's easier to look through |
02:46:38 | FromDiscord | <SirOlaf> Still gonna be like a hundred lines though |
02:46:54 | FromDiscord | <SirOlaf> Because of setup and pattern scanning |
02:53:22 | NimEventer | New thread by JPLRouge: Link with a kernel32.lib proc and function, see https://forum.nim-lang.org/t/9124 |
02:54:26 | FromDiscord | <SirOlaf> Good news, my sample still causes the issue |
02:54:47 | FromDiscord | <SirOlaf> https://media.discordapp.net/attachments/371759389889003532/967619582955249704/sample.nim |
02:55:01 | FromDiscord | <SirOlaf> You can ignore the scanning stuff |
02:55:23 | FromDiscord | <SirOlaf> https://media.discordapp.net/attachments/371759389889003532/967619737548914688/sample.nim |
02:55:45 | FromDiscord | <SirOlaf> serializerBinaryLoadDetour is the thing that causes a crash somehow |
02:56:39 | FromDiscord | <SirOlaf> As for why I scan in this weird way, I have no idea. Fast enough though |
02:57:00 | FromDiscord | <SirOlaf> So, anything jump out at you |
02:57:50 | FromDiscord | <Elegantbeef> the fact you heap allocate for your `originalptr` is a bit off |
02:58:27 | FromDiscord | <SirOlaf> Probably true. So, it does seem that threads have something to do with this crash |
02:58:32 | FromDiscord | <SirOlaf> Minimal sample allowed me to switch them off |
02:59:02 | FromDiscord | <Elegantbeef> remove that assignment to the heap allocated pointer and just make it nil |
02:59:20 | FromDiscord | <Elegantbeef> Unless it's supposed to be a `ptr int64` that's a silly operation |
03:00:27 | FromDiscord | <SirOlaf> Yeah so I don't know why I did that |
03:00:29 | FromDiscord | <SirOlaf> Not related to crash though |
03:00:57 | FromDiscord | <SirOlaf> Crash only happens with threads on |
03:02:41 | FromDiscord | <SirOlaf> Does allocShared have some crazy behavior for arc |
03:02:47 | FromDiscord | <Elegantbeef> try `--tlsEmulation:off` with threads on |
03:03:01 | FromDiscord | <Elegantbeef> It's probably just an alias for `alloc` |
03:03:59 | FromDiscord | <Elegantbeef> Afaik `allocShared` isnt needed for `orc/arc` since shared heap |
03:04:12 | FromDiscord | <SirOlaf> Same issue with tlsemulation off |
03:05:01 | FromDiscord | <Elegantbeef> same thing with `-d:useMalloc`? |
03:05:09 | FromDiscord | <SirOlaf> With or without tls |
03:05:56 | FromDiscord | <SirOlaf> Huh |
03:06:15 | FromDiscord | <Elegantbeef> huH |
03:06:20 | FromDiscord | <SirOlaf> Yeah so that seems to work |
03:06:46 | FromDiscord | <Elegantbeef> Well perhaps you need to use C's alloc to make your game hacks |
03:07:11 | FromDiscord | <SirOlaf> It's weird that it only happens with threads on though |
03:07:27 | FromDiscord | <SirOlaf> Maybe allocshared does to something weird for arc |
03:07:31 | FromDiscord | <Elegantbeef> Well threads do creat heap locks |
03:07:45 | FromDiscord | <Elegantbeef> Does it work fine with refc? |
03:07:54 | FromDiscord | <SirOlaf> Need to init gc for that right |
03:08:05 | FromDiscord | <Elegantbeef> Only if you dont care to leak |
03:08:23 | FromDiscord | <Elegantbeef> This is testing it doesnt matter if you leak |
03:08:40 | FromDiscord | <Elegantbeef> Atleast i dont think it matters |
03:08:43 | FromDiscord | <Elegantbeef> I could be wrong |
03:08:45 | FromDiscord | <SirOlaf> refc crashes during scan |
03:08:52 | FromDiscord | <SirOlaf> Probably should do at least something to set it up |
03:08:55 | FromDiscord | <Elegantbeef> Ok we'll say i'm wrong |
03:11:16 | FromDiscord | <SirOlaf> Yeah refc works |
03:11:26 | FromDiscord | <SirOlaf> When you get setupforeignthreadgc and a call to nimmain |
03:11:30 | FromDiscord | <SirOlaf> (edit) "get" => "got" |
03:11:37 | FromDiscord | <Elegantbeef> With default allocator and threads? |
03:11:44 | FromDiscord | <SirOlaf> Correct |
03:15:07 | FromDiscord | <SirOlaf> Well, guess useMalloc works for now |
03:15:08 | FromDiscord | <Elegantbeef> Well then i guess there's a bug with the threaded allocation logic in video game injection, sad that the Nim allocator cannot be used for making aimbots for CSGO, how will i get good now |
03:15:11 | FromDiscord | <SirOlaf> But it is odd that this fails |
03:15:32 | FromDiscord | <SirOlaf> In reply to @Elegantbeef "Well then i guess": This is mostly for data extraction |
03:15:40 | FromDiscord | <SirOlaf> Serialization format and funny stuff like that |
03:16:09 | FromDiscord | <Elegantbeef> I'm going to jokingly pretend it's a case of anticheat and live my life like that 😄 |
03:16:57 | FromDiscord | <SirOlaf> Anyways, you got a clue where I could find the alloc implementations |
03:17:19 | FromDiscord | <Elegantbeef> https://github.com/nim-lang/Nim/tree/cfdac6666f5772479724e082fb08c2db694d8d40/lib/system/mm |
03:17:32 | FromDiscord | <Elegantbeef> https://github.com/nim-lang/Nim/blob/cfdac6666f5772479724e082fb08c2db694d8d40/lib/system/arc.nim |
03:18:03 | FromDiscord | <SirOlaf> That doesn't quite have that |
03:18:36 | FromDiscord | <SirOlaf> alloc.nim seems to have it |
03:18:41 | FromDiscord | <SirOlaf> Guess I should have expected that |
03:19:09 | FromDiscord | <Elegantbeef> You're going to be disappointed due to how simple they are |
03:19:30 | FromDiscord | <SirOlaf> Amazing |
03:21:42 | FromDiscord | <SirOlaf> Well thanks for the help. Probably gonna come back for this bug at some point, but works for now |
05:14:17 | * | slowButPresent quit (Quit: leaving) |
05:27:11 | FromDiscord | <TryAngle> @SirOlaf u doing it on linux or windows? |
05:30:21 | FromDiscord | <TryAngle> I'm curious because I can't find a good resource that I understand well on how to read process memory on linux 💀 |
06:19:45 | FromDiscord | <Rika> In reply to @TryAngle "I'm curious because I": Proc pseudo file system? |
06:20:02 | FromDiscord | <Rika> If you can’t use that you’re in for a ride I believe |
06:35:41 | * | kenran joined #nim |
06:41:45 | * | kenran quit (Quit: WeeChat info:version) |
07:06:31 | FromDiscord | <TryAngle> In reply to @Rika "Proc pseudo file system?": it's blocking the process as far as I understand |
07:06:37 | FromDiscord | <TryAngle> if I read from that |
07:06:56 | FromDiscord | <TryAngle> (edit) "In reply to @Rika "Proc pseudo file system?": it's blocking the process as far as I understand ... " added "(I read that somewhere?)" |
07:07:32 | FromDiscord | <TryAngle> but I need to read multiple values at different offsets AT LEAST once per second |
07:18:23 | * | jmdaemon quit (Ping timeout: 260 seconds) |
07:18:43 | FromDiscord | <Solitude> In reply to @TryAngle "it's blocking the process": i had simple csgo cheat accessing proc/mem and it worked just fine |
07:21:28 | FromDiscord | <qb> In reply to @TryAngle "I'm curious because I": https://github.com/qb-0/PyMeow/blob/master/src/linux/memory.nim |
07:29:09 | FromDiscord | <qb> Or without nimpy: https://github.com/qb-0/hLibLinux/blob/main/memory.nim |
07:29:55 | FromDiscord | <Rika> In reply to @qb "Or without nimpy: https://github.com/qb-0/hLibLinux": This one |
07:36:55 | * | duuude joined #nim |
07:38:02 | FromDiscord | <TryAngle> sent a code paste, see https://paste.rs/GkT |
07:38:03 | FromDiscord | <TryAngle> this was what I've been looking for I think |
07:38:07 | FromDiscord | <TryAngle> thank u @qb |
07:38:12 | FromDiscord | <TryAngle> 🥺 🥺 🥺 🥺 🥺 🥺 🥺 🥺 🥺 🥺 🥺 |
07:38:38 | duuude | can I make nim output C with ifndefs and everything so everyone only needs build-essentials and compiles it? some sort of gentoo-friendly C code |
07:38:50 | FromDiscord | <TryAngle> In reply to @Solitude "i had simple csgo": good to know, guess what I read on stackoverflow was not up to date then or just not knowledgable |
07:39:50 | FromDiscord | <qb> In reply to @TryAngle "good to know, guess": Related to this btw: https://github.com/qb-0/CSGoEsp-Linux |
07:40:09 | FromDiscord | <qb> But pointers / offsets are prob not up 2 date |
07:40:36 | FromDiscord | <TryAngle> oh no dw I'm not writing csgo cheats xd↵just want to read some offsets in league of legends |
07:41:00 | FromDiscord | <TryAngle> hope it works well because it's emulated in wine |
07:41:11 | FromDiscord | <TryAngle> (edit) "oh no dw I'm not writing csgo cheats xd↵just want to read some offsets in league of legends ... " added "(only legal things)" |
07:41:48 | FromDiscord | <qb> yea it works. process_vm_readv/write_v can be used on windows processes. And the windows offsets / pointers will work |
07:41:51 | FromDiscord | <TryAngle> but I read about a similar case about WOW and the offsets were the same even with wine? |
07:42:00 | FromDiscord | <TryAngle> so no issue I hope |
07:42:32 | FromDiscord | <Solitude> In reply to @TryAngle "oh no dw I'm": they are not accessible with client api? |
07:42:52 | FromDiscord | <TryAngle> In reply to @Solitude "they are not accessible": the client api is not for ingame |
07:43:11 | FromDiscord | <Solitude> the ingame api |
07:43:17 | FromDiscord | <Solitude> better? |
07:44:26 | FromDiscord | <TryAngle> In reply to @Solitude "the ingame api*": what do you mean? |
07:44:34 | FromDiscord | <TryAngle> do you mean the lcu or do you mean the riot api? |
07:44:50 | FromDiscord | <Solitude> https://developer.riotgames.com/docs/lol#game-client-api |
07:44:59 | FromDiscord | <Rika> In reply to @duuude "can I make nim": Not that I know of, no |
07:45:25 | FromDiscord | <Rika> Calling resident Gentoo user sheerluck xd |
07:45:45 | FromDiscord | <TryAngle> In reply to @Solitude "https://developer.riotgames.com/docs/lol#game-clien": lol |
07:45:49 | FromDiscord | <TryAngle> https://www.mingweisamuel.com/lcu-schema/tool/↵it's not documented here |
07:46:08 | FromDiscord | <Solitude> why are you looking for documentation at some third party shithole? |
07:46:21 | FromDiscord | <TryAngle> In reply to @Solitude "why are you looking": because it's the only usable documentation lol |
07:46:34 | FromDiscord | <Solitude> user issue |
07:47:54 | FromDiscord | <TryAngle> In reply to @Solitude "user issue": can u get jgl camps etc with this? |
07:48:12 | FromDiscord | <Solitude> i asked you that |
07:48:38 | FromDiscord | <Solitude> i dont know, im just offering alternative resource before reading straight from memory |
07:48:48 | FromDiscord | <TryAngle> ah Isee |
07:48:51 | FromDiscord | <TryAngle> I don't know either |
07:49:04 | FromDiscord | <TryAngle> I'm just a tiny cs undergrad with 0 knowledge 😭 |
07:51:12 | FromDiscord | <TryAngle> @qb wow your pyMeow lib |
07:51:24 | FromDiscord | <TryAngle> didn't know it's so "trivial" to make python libs with nim o_O |
07:51:49 | FromDiscord | <Yardanico> it is, thanks to nimpy |
07:51:57 | FromDiscord | <Yardanico> https://github.com/yglukhov/nimpy |
07:51:58 | FromDiscord | <Solitude> In reply to @TryAngle "can u get jgl": you can query list of ingame events, the dragon and herald are there for sure, maybe jungle monsters too |
07:52:22 | FromDiscord | <TryAngle> In reply to @Yardanico "it is, thanks to": lol |
07:52:27 | FromDiscord | <TryAngle> "One Language to rule them all" |
07:52:30 | FromDiscord | <TryAngle> makes more sense now |
08:01:48 | FromDiscord | <qb> In reply to @TryAngle "<@590220785029873674> wow your pyMeow": 🙏 |
08:03:12 | FromDiscord | <TryAngle> In reply to @Yardanico "https://github.com/yglukhov/nimpy": I haven't tried it but hwat does it look like from the pytohn side? |
08:03:31 | FromDiscord | <TryAngle> when u click to function defintion from your editor for example |
08:03:55 | FromDiscord | <TryAngle> do u see the nim code? or is the result of the compilation literally python code? |
08:05:05 | FromDiscord | <Yardanico> In reply to @TryAngle "I haven't tried it": like a normal native extension |
08:05:16 | FromDiscord | <Yardanico> In reply to @TryAngle "do u see the": python has support for native extensions via the CPython C API |
08:05:19 | FromDiscord | <Yardanico> nimpy just uses that |
08:05:32 | FromDiscord | <Yardanico> it's the same as writing native modules for python in C/C++, except that it's easier and the code looks better |
08:11:02 | FromDiscord | <qb> Guess just pycharm has editor support for python extensions |
08:11:09 | FromDiscord | <qb> if that was the question |
08:11:28 | FromDiscord | <qb> I didn't figured it out for vscode atleast |
08:14:04 | * | Gustavo6046 quit (Quit: Goodbye! Leave messages at my XMPP @ [email protected] or my Discord Gustavo6046#9009 or possibly my Mastodon [email protected] – I don't check my email often since it's full of crap, but in any case, [email protected]) |
08:24:35 | * | kayabaNerve quit (Remote host closed the connection) |
08:24:43 | * | kayabaNerve joined #nim |
08:31:42 | FromDiscord | <Knedlik> Hey guys, I need some help with syntax stuff - the SDL debug output redirect function requires a function and a pointer as a parameter, but I’m not sure, how to pass a function |
08:31:57 | FromDiscord | <Elegantbeef> You just use the name |
08:32:04 | FromDiscord | <Knedlik> Hmmm |
08:32:05 | FromDiscord | <Elegantbeef> so `sdl2logStuff(myProc, nil)` |
08:32:20 | FromDiscord | <Knedlik> I’ll try, thanks |
08:43:34 | * | kayabaNerve quit (Remote host closed the connection) |
08:43:55 | * | kayabaNerve joined #nim |
10:06:33 | * | Guest3791 joined #nim |
10:12:25 | * | Zectbumo quit (Remote host closed the connection) |
10:20:30 | * | Guest3791 quit (Quit: Client closed) |
10:48:54 | FromDiscord | <TryAngle> Any good libraries to work with bit sets with enums? |
10:50:04 | FromDiscord | <Solitude> what do you need |
10:52:22 | FromDiscord | <TryAngle> I'm stoopid↵Nim is that language that already has sets 🥺 |
10:52:59 | FromDiscord | <Knedlik> Uhhh guys why does the compiler complaing about me passing in a string as the first param of write()? |
10:53:07 | FromDiscord | <Knedlik> (edit) "complaing" => "complain" |
10:53:26 | FromDiscord | <TryAngle> In reply to @Solitude "what do you need": set[<Enum Ident>]↵I forgot nim has sets already lol |
10:53:36 | FromDiscord | <Knedlik> Seems to only happen if I import os in some form |
10:53:50 | FromDiscord | <Solitude> In reply to @Knedlik "Uhhh guys why does": sorry, no telepathy today |
10:54:04 | FromDiscord | <TryAngle> In reply to @Knedlik "Uhhh guys why does": What write function |
10:54:14 | FromDiscord | <Knedlik> The file write function, under io |
10:54:33 | FromDiscord | <Solitude> which one |
10:54:39 | FromDiscord | <Solitude> what is the code |
10:54:40 | FromDiscord | <Solitude> what is the error |
10:54:42 | FromDiscord | <Solitude> please |
10:54:43 | FromDiscord | <Solitude> my guy |
10:54:53 | FromDiscord | <Knedlik> Let me just get it in here |
10:55:48 | FromDiscord | <TryAngle> @Knedlik please add the error and code with errors like this in future, otherwise we would need to guess |
10:55:50 | FromDiscord | <Knedlik> `write(fmt”{getAppDir()}/debug.log” & “\n”, log)` |
10:55:59 | FromDiscord | <Solitude> file comes first |
10:56:10 | FromDiscord | <Knedlik> Yeah, that’s the file |
10:56:19 | FromDiscord | <Knedlik> The first param |
10:56:19 | FromDiscord | <Solitude> that path to the file |
10:56:21 | FromDiscord | <Solitude> not file |
10:56:45 | FromDiscord | <Knedlik> I can’t find anything on how to convert string path to the file object |
10:56:48 | FromDiscord | <Solitude> https://nim-lang.org/docs/io.html#writeFile%2Cstring%2Cstring |
10:57:02 | FromDiscord | <Knedlik> Oh yeah I’m dumb af |
10:57:21 | FromDiscord | <Knedlik> Ignore me while I go cry in my corner |
11:00:26 | * | PMunch joined #nim |
11:06:50 | * | gsalazar quit (Ping timeout: 246 seconds) |
11:16:52 | FromDiscord | <SirElephant> there are two nim addons in vsc. Which one should i use? |
11:17:27 | FromDiscord | <Solitude> saem one |
11:17:30 | FromDiscord | <Knedlik> I find the less popular one by nimsaem better |
11:17:48 | FromDiscord | <SirElephant> In reply to @Solitude "saem one": nimsaem? |
11:17:52 | FromDiscord | <Solitude> yes |
11:17:55 | FromDiscord | <SirElephant> oke |
11:18:27 | FromDiscord | <Knedlik> Can’t say anything bad about it, it had no false positives or negatives when it comes to errors yet (for me) |
11:19:28 | FromDiscord | <SirElephant> is there a std lib for random nums? |
11:19:57 | FromDiscord | <Solitude> https://nim-lang.org/docs/lib.html |
11:20:30 | FromDiscord | <SirElephant> is it in algorithm? |
11:20:35 | FromDiscord | <Solitude> its in random |
11:20:43 | FromDiscord | <SirElephant> found it |
11:20:47 | FromDiscord | <Solitude> amazing |
11:39:09 | FromDiscord | <untoreh> sent a code paste, see https://play.nim-lang.org/#ix=3W5I |
11:44:55 | FromDiscord | <Andreas> is there any layout benefit in space or time for either using one uint64 or two uint32 in a tuple or object ? |
11:50:05 | PMunch | @Andreas, it depends |
11:51:17 | PMunch | In general C tries to align data in memory so that access is fast |
11:51:56 | PMunch | Sometimes this means that it adds padding to your struct |
11:53:02 | FromDiscord | <Andreas> In reply to @PMunch "In general C tries": ok, i'll try. I could pack two i16 into one u32, but i guess readabillity stays better if i use two ints |
11:53:12 | PMunch | You can add the {.packed.} pragma to an object definition in Nim to tell the C compiler that it should cram the bits and bytes as tightly together as possible |
11:53:45 | PMunch | But this might come at a cost in execution speed since the CPU might have to do some extra bit-shifting and masking logic to extract the number you requested |
11:54:00 | PMunch | So it really comes down to what is most important, memory or CPU |
11:54:54 | FromDiscord | <Andreas> In reply to @PMunch "So it really comes": i guess using one u32 does not gain any memory-advantage ? |
11:55:06 | FromDiscord | <Knedlik> Hey guys, any idea how to build for linux and mac from windows? It’s throwing all kinds of errors if I add os:linux and os:macos |
11:55:42 | FromDiscord | <Knedlik> To be specific… |
11:56:02 | FromDiscord | <Knedlik> Linux build can’t find sys/mman.h, and mac screams no implementation for dyncalls |
11:57:06 | PMunch | @Andreas, a packed struct vs. a manually shifted and masked integer of the same size likely won't have a big difference |
11:58:11 | PMunch | The CPU might have some extra tricks up it sleeve though, so it could be faster to use a packed struct. But if you have domain-specific knowledge (e.g. you can set the uint32 to 1 if you want to set one value to 0 and another to 1, and not have to do the whole masking rigamarole) then that would be faster |
11:58:38 | PMunch | As with anything, benchmarking is the only real way to know which will perform better for your specific usecase on your specific hardware |
11:59:06 | PMunch | @Knedlik, you need the compatibility libraries and compilers |
11:59:24 | FromDiscord | <Andreas> In reply to @PMunch "As with anything, benchmarking": right, regarding benchmarking, what lib does one use here - i tried benchy, but there are others |
12:01:21 | PMunch | It depends on what you're testing |
12:01:57 | PMunch | Benchy is nice to test for execution time, but I don't think it has any memory checking for example |
12:09:47 | FromDiscord | <Yardanico> In reply to @Knedlik "Hey guys, any idea": the easiest way is probably by using zig cc's cross compiler, but if you're building something like a game you need other libraries like glfw as well |
12:25:03 | * | PMunch quit (Quit: leaving) |
12:41:47 | FromDiscord | <TryAngle> In reply to @Knedlik "Can’t say anything bad": For me it doesn't work randomly until I reopen that file lol |
12:42:58 | * | duuude quit (Remote host closed the connection) |
12:43:23 | * | duuude joined #nim |
13:06:45 | * | slowButPresent joined #nim |
14:01:49 | * | krux02 joined #nim |
14:31:03 | FromDiscord | <Phil> I wonder how jsony manages to serialize also fields of objects that aren't exported and thus not public |
14:45:25 | FromDiscord | <Solitude> fieldPairs returns all fields |
14:51:17 | FromDiscord | <Solitude> In reply to @Isofruit "I wonder how jsony": yeah, just checked, it cant |
14:55:25 | FromDiscord | <TryAngle> sent a code paste, see https://paste.rs/N1r |
14:56:03 | FromDiscord | <Solitude> case nk: NodeKind |
14:56:08 | FromDiscord | <TryAngle> X |
14:56:09 | FromDiscord | <TryAngle> D |
14:56:16 | FromDiscord | <TryAngle> thanks @Solitude |
14:56:34 | FromDiscord | <TryAngle> the more nim I write |
14:56:37 | FromDiscord | <TryAngle> the less nim I understand |
14:56:44 | FromDiscord | <TryAngle> 😔 |
15:03:44 | FromDiscord | <TryAngle> @Solitude in the same example, can I somehow construct a new Node with only one generic? |
15:07:23 | FromDiscord | <Phil> In reply to @Solitude "yeah, just checked, it": I'll need to double check my serialization again, could've sworn I saw fields serialized that were private |
15:10:30 | * | vicfred quit (Quit: Leaving) |
15:17:52 | FromDiscord | <Knedlik> Hey guys, is there not a multi-type sequence, or am I totally blind? |
15:18:00 | FromDiscord | <Solitude> In reply to @Isofruit "I'll need to double": You have hooks in same module? |
15:18:12 | FromDiscord | <Solitude> In reply to @Knedlik "Hey guys, is there": There isnt |
15:18:24 | FromDiscord | <Knedlik> hmmm okay, thx |
15:18:56 | FromDiscord | <Solitude> In reply to @TryAngle "<@104136074569211904> in the same": what |
15:26:53 | FromDiscord | <Phil> In reply to @Solitude "You have hooks in": I don't think so, but given how many layers of generics I use I can't make any guarantees for what gets executed where |
15:30:19 | * | jmdaemon joined #nim |
15:30:32 | FromDiscord | <Phil> sent a code paste, see https://play.nim-lang.org/#ix=3W78 |
15:31:04 | FromDiscord | <Knedlik> Hmmm, how tf do I get the value a ptr is pointing to? Is it like that by default, or do I need to deaddress it? |
15:31:20 | FromDiscord | <Phil> (edit) "https://play.nim-lang.org/#ix=3W78" => "https://play.nim-lang.org/#ix=3W7a" |
15:31:35 | FromDiscord | <Solitude> In reply to @Knedlik "Hmmm, how tf do": ptr[] |
15:31:46 | FromDiscord | <Phil> (edit) "https://play.nim-lang.org/#ix=3W7a" => "https://play.nim-lang.org/#ix=3W7b" |
15:32:53 | FromDiscord | <Knedlik> so if I understood that right, a pointer `adr` would be translated into the variable using `adr[]`? |
15:33:38 | FromDiscord | <Solitude> you get value stored at adr by dereferencing it with [] |
15:33:54 | FromDiscord | <Knedlik> okay, thanks |
15:34:21 | * | neurocyte8614492 joined #nim |
15:35:31 | FromDiscord | <Ayy Lmao> Does anyone know any solid resourced for learning how to draw geometric primitives with triangles? I'm really struggling to find anything. imgui_draw.cpp seems to be the closest thing but it is difficult reading through thousands of lines of heavily inlined c++ code. |
15:35:37 | FromDiscord | <Ayy Lmao> (edit) "resourced" => "resources" |
15:35:58 | FromDiscord | <Ayy Lmao> (edit) "Does anyone know any solid resources for learning how to draw ... geometric" added "2d" |
15:51:26 | FromDiscord | <Knedlik> In reply to @Ayy Lmao "Does anyone know any": Are you okay using a graphics lib? |
15:51:47 | FromDiscord | <Knedlik> Like a full-fledged one? |
15:52:26 | * | emery quit (Ping timeout: 246 seconds) |
15:52:58 | * | ehmry joined #nim |
15:54:54 | FromDiscord | <ynfle> !eval echo float(5) #Is this a bug? |
15:54:56 | NimBot | 5.0 |
15:55:27 | FromDiscord | <Rika> what is the bug? |
15:55:49 | FromDiscord | <ynfle> Lol, it was a mistake |
15:55:54 | FromDiscord | <ynfle> !eval echo float($5) #Is this a bug? |
15:55:57 | NimBot | Compile failed: /usercode/in.nim(1, 11) Error: type mismatch: got 'string' for '"5"' but expected 'float' |
15:56:19 | FromDiscord | <huantian> Float doesn’t parse strings |
15:56:20 | FromDiscord | <Rika> no |
15:56:39 | FromDiscord | <ynfle> !eval echo float(($5)[0]) #Is this a bug? |
15:56:41 | NimBot | 53.0 |
15:56:45 | FromDiscord | <Rika> no |
15:56:58 | FromDiscord | <ynfle> I realized the mistake |
15:57:03 | FromDiscord | <Rika> !eval echo ord(($5)[0]) |
15:57:05 | FromDiscord | <ynfle> That's confusing though |
15:57:05 | NimBot | 53 |
15:57:14 | FromDiscord | <Rika> its not really |
15:57:19 | FromDiscord | <ynfle> Why? |
15:57:23 | FromDiscord | <ynfle> char -> float? |
15:57:31 | * | ehmry quit (Ping timeout: 256 seconds) |
15:57:40 | * | emery joined #nim |
15:57:50 | FromDiscord | <Rika> i guess its not very sensible but i dont think its confusing |
16:01:39 | FromDiscord | <Ayy Lmao> In reply to @Knedlik "Are you okay using": I'm trying to write my own essentially. |
16:04:01 | FromDiscord | <Knedlik> gl, I sadly don't know how to help you there |
16:06:21 | FromDiscord | <aph> In reply to @ynfle "char -> float?": char = int (but prints the utf8/whatever encoding's text) i think |
16:08:58 | FromDiscord | <Rika> yes but its technically not sensible to implicitly convert char to int |
16:13:25 | FromDiscord | <TryAngle> how can I remove the last character of a string? |
16:13:42 | FromDiscord | <Yardanico> `setLen` would be the fastest way I guess |
16:13:51 | FromDiscord | <Yardanico> `mystr.setLen(mystr.len - 1)` |
16:14:42 | FromDiscord | <TryAngle> lol |
16:14:44 | FromDiscord | <TryAngle> thanks |
16:18:03 | FromDiscord | <TryAngle> In reply to @Yardanico "`mystr.setLen(mystr.len - 1)`": I get a really sussy error |
16:18:11 | FromDiscord | <Yardanico> care you show it at least? |
16:18:19 | FromDiscord | <Yardanico> (edit) "care" => "can" |
16:18:21 | FromDiscord | <TryAngle> yes was just looking up again |
16:18:21 | FromDiscord | <TryAngle> `Unhandled exception: value out of range: -2 notin 0 .. 9223372036854775807 [RangeDefect]` |
16:18:35 | FromDiscord | <TryAngle> `result.setLen(result.len() - 2)` |
16:18:44 | FromDiscord | <Yardanico> but what if your string is empty |
16:18:49 | FromDiscord | <Yardanico> then setLen won't work |
16:19:05 | FromDiscord | <Yardanico> it's throwing an exception because you're trying to set string's length to negative |
16:19:18 | FromDiscord | <TryAngle> oh! |
16:19:25 | FromDiscord | <TryAngle> I forgot about the first case |
16:19:44 | FromDiscord | <TryAngle> I'm trying to visualize a tree with nice pipes |
16:21:56 | FromDiscord | <Knedlik> umm guys can I somehow put Type1 and Type2 in the same seq if they both inherit Type0? |
16:24:18 | FromDiscord | <huantian> Yea |
16:24:29 | FromDiscord | <huantian> Just make the sequence of Type0 |
16:24:41 | * | neurocyte8614492 quit (Ping timeout: 272 seconds) |
16:25:52 | FromDiscord | <Knedlik> Maybe I encountered a false positive from the VSC debug... |
16:26:30 | FromDiscord | <Knedlik> When compiling, any syntax error would stop it, right? |
16:27:11 | FromDiscord | <Rika> any compile time error sure |
16:27:20 | FromDiscord | <Knedlik> That's weird |
16:27:39 | FromDiscord | <Knedlik> VSC is giving me errors o'plenty, but compiler for once doesn't complain |
16:27:54 | FromDiscord | <Yardanico> well, there can be a lot of reasons for that |
16:28:13 | FromDiscord | <Yardanico> for example you're compiling with e.g. --threads:on but you didn't put that into your .nim.cfg or .nims so nimsuggest doesn't know that you're using it |
16:28:27 | FromDiscord | <Yardanico> or maybe nimsuggest is just being buggy, try to restart the editor :) |
16:28:45 | FromDiscord | <Knedlik> my compile is clean `nim c src/main.nim` |
16:28:58 | FromDiscord | <Yardanico> restart the editor |
16:29:16 | FromDiscord | <Generic> In reply to @Yardanico "or maybe nimsuggest is": unless you enable it, nim check is used for errors not nimsuggest |
16:29:22 | FromDiscord | <Knedlik> Still the same after a restart |
16:29:32 | FromDiscord | <Generic> what is the error? |
16:30:09 | FromDiscord | <Knedlik> sent a code paste, see https://play.nim-lang.org/#ix=3W7Q |
16:30:33 | FromDiscord | <Knedlik> Graphic is ref object of Object, seq is of type Object |
16:30:53 | FromDiscord | <Knedlik> Object is just `Object = object` |
16:30:53 | FromDiscord | <Yardanico> can you maybe share that part of code? |
16:31:08 | FromDiscord | <Yardanico> the type defs and the code around the error |
16:31:12 | FromDiscord | <Knedlik> sent a code paste, see https://play.nim-lang.org/#ix=3W7R |
16:31:30 | FromDiscord | <Knedlik> sent a code paste, see https://play.nim-lang.org/#ix=3W7S |
16:31:40 | * | duuude quit (Ping timeout: 250 seconds) |
16:31:45 | FromDiscord | <Knedlik> sent a code paste, see https://play.nim-lang.org/#ix=3W7T |
16:31:53 | FromDiscord | <Yardanico> well, this is actually incorrect |
16:32:06 | FromDiscord | <Yardanico> for you to inherit from Object you need to have it inherit from RootObj or RootRef :) |
16:32:32 | * | PMunch joined #nim |
16:32:32 | FromDiscord | <Knedlik> Why not just let me go and have fun wtf |
16:32:45 | FromDiscord | <Yardanico> if you want "fun" then go write basic :) |
16:33:23 | FromDiscord | <Knedlik> I want to know why an inheritable object has to inherit |
16:33:25 | * | duuude joined #nim |
16:33:55 | FromDiscord | <Yardanico> to make it inheritable you need to make it inherit from the base hierarchy |
16:34:12 | FromDiscord | <Yardanico> for RTTI |
16:34:13 | FromDiscord | <Yardanico> https://nim-lang.org/docs/manual.html#types-tuples-and-object-types |
16:34:19 | FromDiscord | <Yardanico> "Objects provide many features that tuples do not. Objects provide inheritance and the ability to hide fields from other modules. Objects with inheritance enabled have information about their type at runtime so that the of operator can be used to determine the object's type. The of operator is similar to the instanceof operator in Java." |
16:34:39 | FromDiscord | <Knedlik> I wonder if Java does that automatically or if it doesn't even need that, but I guess it's different when Java is OOP af |
16:35:00 | FromDiscord | <Yardanico> in Java everything is about OOP and almost everything is boxed |
16:35:03 | FromDiscord | <Yardanico> nim doesn't force you into one way |
16:35:12 | FromDiscord | <Knedlik> Yeah |
16:35:18 | FromDiscord | <Knedlik> And I kind of like that |
16:37:06 | FromDiscord | <Knedlik> I started on Java, and tbh, I feel like I like Nim more with it's simplicity-ish |
16:39:00 | FromDiscord | <Phil> I mean, you can write very java-y code without falling into java's pitfalls, those pitfalls being additional state everywhere in Java |
16:39:50 | FromDiscord | <Phil> (edit) "I mean, you can write very java-y code without falling into java's pitfalls, those pitfalls being additional state everywhere in Java ... " added "(class variables)" |
16:40:11 | FromDiscord | <Phil> The more I write java the less I'm a fan of class variables outside of POJOs |
16:40:49 | FromDiscord | <Phil> In that sense nim gives you a lot of the greatest stuff the language has to offer... now if the intellisense didn't absolutely suck that would be grand |
16:41:14 | FromDiscord | <Yardanico> it doesn't "absolutely suck" for me, but that seems to be a very personal thing for nim, for some it's unusable, for some it's fine :) |
16:41:26 | FromDiscord | <Phil> I wish I were more competent to be able to contribute a solution |
16:42:45 | FromDiscord | <Phil> In reply to @Yardanico "it doesn't "absolutely suck"": Like, the compiler errors are 90% of the time really useful, that gets props from me, the annoying part is just when you ask for an autocomplete on vscodium and it loads longer than 5 seconds |
16:43:04 | FromDiscord | <Yardanico> well, that's what I mean, it's fine for me in most cases |
16:43:17 | FromDiscord | <Yardanico> and fixing it wouldn't be so easy, since nimsuggest builds upon the compiler itself |
16:43:38 | FromDiscord | <Yardanico> so you either fix nimsuggest which is in the compiler, or have to create a new solution from scratch and somehow teach it to understand all of nim (macros, templates, compile time code evaluation, etc) |
16:44:31 | FromDiscord | <Yardanico> it is possible to fix some nimsuggest bugs, you just have to report them at last |
16:44:32 | FromDiscord | <Yardanico> (edit) "last" => "least" |
16:44:40 | FromDiscord | <Phil> Yeh, thus my desire to become more competent one day after my project got its first release |
16:45:08 | FromDiscord | <Rika> me, using buffer autocomplete: |
16:46:01 | FromDiscord | <Yardanico> i have auto-autocomplete in vscode |
16:46:21 | FromDiscord | <Yardanico> the one that triggers as you type without pressing Tab or anything |
16:46:59 | FromDiscord | <Rika> how does that work |
16:47:12 | FromDiscord | <Rika> how do you accept the correction |
16:47:14 | FromDiscord | <Rika> space? |
16:47:15 | FromDiscord | <Phil> One sec:↵> Nimsuggest is a server that takes queries that are related to myproject↵Does that mean there's a server that I can start up with systemd? |
16:47:37 | FromDiscord | <Rika> no |
16:47:40 | FromDiscord | <Rika> its not a server in that sense |
16:48:03 | FromDiscord | <Rika> you start it with arguments about the project youre opening so its per-project instances |
16:48:19 | FromDiscord | <Rika> so i guess you technically can but i dont think you shoukd |
16:48:20 | FromDiscord | <Rika> (edit) "shoukd" => "should" |
16:48:35 | FromDiscord | <Yardanico> In reply to @Rika "space?": tab |
16:49:19 | FromDiscord | <Phil> Ah, hmmmm |
16:49:41 | FromDiscord | <Rika> In reply to @Yardanico "tab": oh so you mean auto popup instead of the one that pops up on tab |
16:49:44 | FromDiscord | <Rika> same here |
16:49:45 | FromDiscord | <Yardanico> yes |
16:53:37 | FromDiscord | <Phil> I really don't understand where the different nimsuggest speeds come from. ↵Does nimsuggest maybe slow down a lot when there's a lot of generics around?↵Does it not like medium-sized projects and larger?↵I'm pretty sure it's not all that hardware related because my hardware is fairly fast |
16:54:08 | FromDiscord | <Solitude> In reply to @Isofruit "I really don't understand": its jsut shit |
16:54:15 | FromDiscord | <Rika> its just the implementation being hacked up |
16:54:23 | FromDiscord | <Rika> yeah pm what solitude says |
16:54:49 | * | duuude quit (Ping timeout: 248 seconds) |
16:54:55 | FromDiscord | <Phil> But isn't nimsuggest also fairly complicated given what it does? |
16:55:05 | FromDiscord | <Rika> thats pretty much why its shit |
16:55:19 | PMunch | Well nimsuggest has to pretty much implement the entire compiler (to understand macros and such) |
16:55:41 | PMunch | So what it does is that it loads the compiler as libraries, then it essentially compiles your project and extracts information |
16:56:09 | FromDiscord | <Yardanico> exactly |
16:56:11 | FromDiscord | <Phil> Wait, so every time I want an auto-complete it does a file-compile in the background? |
16:56:16 | PMunch | Once IC is implemented I assume nimsuggest could trivially be made much faster |
16:56:18 | FromDiscord | <Yardanico> In reply to @Isofruit "Wait, so every time": not full file-compile |
16:56:24 | PMunch | @Phil, not quite, but the process is similar |
16:56:35 | PMunch | Wait, @Phil is Isofruit? |
16:56:40 | FromDiscord | <Phil> Yeh |
16:56:42 | FromDiscord | <Yardanico> In reply to @PMunch "Once IC is implemented": yeah, with IC the plan is to make it emit the files that contain all the symbols for nim files |
16:56:57 | FromDiscord | <Yardanico> so you can use IC'd files for autocompletion |
16:57:01 | PMunch | Huh, never knew |
16:57:07 | FromDiscord | <Yardanico> in fact there's already a tool in the nim repo |
16:57:18 | FromDiscord | <Phil> Made more sense since my github goes under the same name, makes the association easier |
16:57:22 | FromDiscord | <Yardanico> IC nagivator |
16:57:22 | FromDiscord | <Yardanico> https://github.com/nim-lang/Nim/pull/17714 |
16:57:29 | FromDiscord | <Yardanico> defusages |
16:57:30 | PMunch | But yeah, if you have a lot of generics, concepts, or macros then the compiler starts to slow down and you get poor nimsuggest performance |
16:57:31 | FromDiscord | <Rika> cool |
16:57:49 | FromDiscord | <Phil> And apparently a non-zero amount of folks in here have cloned my nimstoryfont repo that are a bit beyond me because I don't see the use but shrugs |
16:58:11 | FromDiscord | <Phil> So for contacting etc. I thought it'd make more sense |
16:58:22 | FromDiscord | <Phil> (edit) "So for contacting ... etc." added "regarding questions" |
16:59:13 | FromDiscord | <Phil> In reply to @PMunch "But yeah, if you": In that case my generics are most likely the culprit. With half a dozen dedicated generic-modules that are used figuratively everywhere else that would explain the slowdown |
16:59:43 | FromDiscord | <2F42BBA1> sent a long message, see http://ix.io/3W83 |
16:59:53 | FromDiscord | <Rika> you can just.. do that |
16:59:53 | FromDiscord | <Yardanico> what |
16:59:56 | FromDiscord | <Rika> write it |
16:59:58 | FromDiscord | <Rika> compile |
17:00:00 | FromDiscord | <Rika> see it works |
17:00:09 | FromDiscord | <Phil> Does it explode with an error if you just write it that way? |
17:00:16 | FromDiscord | <Yardanico> In reply to @2F42BBA1 "I have `readLine(stdin)` ": https://nim-lang.org/docs/manual.html#procedures-method-call-syntax that's exactly one of the main nim "killer" features if you ask me |
17:00:24 | FromDiscord | <Yardanico> ability to write OOP-like code without having to actually write OOP |
17:00:39 | FromDiscord | <Solitude> this is first tutorial... |
17:01:14 | FromDiscord | <Phil> The tutorials are pretty solid stuff btw. Even now I regularly consult the second one |
17:01:25 | FromDiscord | <2F42BBA1> In reply to @Yardanico "https://nim-lang.org/docs/manual.html#procedures-me": i just want write in this way yeah |
17:01:26 | FromDiscord | <Yardanico> In reply to @Solitude "this is first tutorial...": in the modern day people just go with the flow :( |
17:01:29 | FromDiscord | <Yardanico> In reply to @2F42BBA1 "i just want write": just write it? |
17:01:30 | FromDiscord | <Yardanico> it already works |
17:01:56 | FromDiscord | <Yardanico> in nim there's literally no difference between `stdin.readLine()` and `readLine(stdin)` |
17:02:00 | FromDiscord | <Phil> In reply to @2F42BBA1 "i just want write": Given that you're asking the question, why would you believe it doesn't work? |
17:02:37 | FromDiscord | <2F42BBA1> In reply to @Isofruit "Given that you're asking": It does work, but I was curious how do I write in this style of `obj.methodName(args)` |
17:02:42 | FromDiscord | <Rika> you just do |
17:02:45 | FromDiscord | <2F42BBA1> And now I understand how do I do that |
17:02:48 | FromDiscord | <Rika> okay |
17:02:56 | FromDiscord | <Yardanico> In reply to @2F42BBA1 "And now I understand": please, please just give tut1 a read |
17:03:07 | FromDiscord | <Solitude> In reply to @Yardanico "please, please just give": its actually in second part, i lied |
17:03:11 | FromDiscord | <Yardanico> second part too |
17:03:27 | FromDiscord | <Phil> In reply to @2F42BBA1 "It does work, but": I don't mean that in any way hostile, I'm assuming you already tested it out, just wanted to figure out what lead you to assuming otherwise ^^↵Anyway, I recommend to do as Yardanico suggested and read through the tutorial |
17:03:37 | FromDiscord | <Phil> They're all 3 fairly short |
17:03:43 | FromDiscord | <Phil> (edit) "They're all 3 fairly short ... " added "and a great resource to bookmark in general" |
17:04:14 | FromDiscord | <Phil> They may not cover 100% of the available features, but the majority of what you'll need to get going and even a bit more than that seeing as pragmas and macros are also covered |
17:04:18 | FromDiscord | <Phil> (edit) "They may not cover 100% of the available features, but the majority of what you'll need to get going and even a bit more than that seeing as pragmas and macros are also covered ... " added "in part 3" |
17:04:34 | FromDiscord | <Phil> (edit) "what" => "major tools that" |
17:05:20 | * | duuude joined #nim |
17:06:16 | FromDiscord | <Yardanico> In reply to @2F42BBA1 "And now I understand": for even more fun, you can also write it as `readLine stdin` |
17:06:32 | FromDiscord | <Phil> In reply to @Yardanico "so you can use": That... kinda makes me really excited for auto completion.↵I mean, it's pretty doable to write code already, but with non-slow autocomplete that would be wonderful! |
17:06:45 | FromDiscord | <Yardanico> or the classic `r_E_a_D_L_i_N_e s_T_d_I_n` |
17:06:49 | FromDiscord | <Phil> Yard straight delving into the black magic syntax arts |
17:06:54 | FromDiscord | <Yardanico> just don't show this to your kids |
17:07:01 | FromDiscord | <Yardanico> `let val = r_E_a_D_L_i_N_e s_T_d_I_n` |
17:07:28 | FromDiscord | <Phil> I'm still squinting hard at "whitespace as bracket" syntax |
17:07:50 | FromDiscord | <Rika> `2+3 52 5/6` |
17:07:59 | FromDiscord | <Yardanico> it's called command invocation syntax :) |
17:07:59 | FromDiscord | <Phil> Rika, please |
17:08:02 | FromDiscord | <Yardanico> https://nim-lang.org/docs/manual.html#procedures-command-invocation-syntax |
17:08:03 | FromDiscord | <Phil> I'm barely back from sports |
17:08:06 | FromDiscord | <Phil> Don't give me trauma |
17:08:29 | FromDiscord | <Phil> In reply to @Yardanico "it's called command invocation": Cool, now I have a name for the thing I'm always squinting at |
17:08:30 | FromDiscord | <Phil> (edit) "at" => "at!" |
17:08:46 | FromDiscord | <Yardanico> In reply to @Rika "`2+3 * 5*2 ": this works the way it's written, strong spaces aren't really enabled for most stuff anymore |
17:09:13 | FromDiscord | <Rika> In reply to @Yardanico "this works the way": it doesnt? |
17:09:23 | FromDiscord | <Yardanico> ? https://media.discordapp.net/attachments/371759389889003532/967834648577183804/unknown.png |
17:09:25 | FromDiscord | <Rika> `2+3 ...` is not `(2 + 3) (...)` |
17:09:34 | FromDiscord | <Yardanico> In reply to @Rika "`2+3 * ...` is": it gives 27 |
17:09:39 | * | emery quit (Ping timeout: 272 seconds) |
17:09:50 | FromDiscord | <Yardanico> which is literally 2 + 3 5 2 5/6 |
17:09:50 | * | ehmry joined #nim |
17:09:57 | FromDiscord | <Rika> look at what i wrote |
17:09:59 | FromDiscord | <Rika> its not equivalent |
17:10:01 | FromDiscord | <Solitude> yardanico |
17:10:04 | FromDiscord | <Solitude> you are a dumbass |
17:10:13 | FromDiscord | <Yardanico> In reply to @Solitude "you are a dumbass": i copied the exact thing |
17:10:15 | FromDiscord | <Rika> !eval echo ((2+3) (5 2)) (5/6) |
17:10:16 | FromDiscord | <Solitude> yes |
17:10:16 | NimBot | Compile failed: /usercode/in.nim(1, 13) Error: invalid token: (\29) |
17:10:19 | FromDiscord | <Solitude> reading comprehension |
17:10:21 | FromDiscord | <Solitude> holy shit |
17:10:23 | FromDiscord | <Rika> ok thanks bot |
17:10:29 | FromDiscord | <Yardanico> !eval echo 2+3 52 5/6 |
17:10:30 | NimBot | Compile failed: /usercode/in.nim(1, 10) Error: invalid token: (\29) |
17:10:33 | FromDiscord | <Rika> thats not |
17:10:34 | FromDiscord | <Rika> omfg |
17:10:38 | FromDiscord | <Solitude> he is talking about strong whitespace |
17:10:51 | FromDiscord | <spoon> are you talking about order of operation? |
17:10:51 | FromDiscord | <Rika> phil mentioned strong spaces |
17:11:01 | FromDiscord | <Phil> fascinating, that one doesn't fail in inim |
17:11:04 | FromDiscord | <Yardanico> give me a nim snippet please |
17:11:07 | FromDiscord | <Yardanico> with code blocks |
17:11:11 | FromDiscord | <Yardanico> so i can rest at peace |
17:11:14 | FromDiscord | <Solitude> strong whitespace is removed from language |
17:11:15 | FromDiscord | <Phil> Yard, just open inim |
17:11:18 | FromDiscord | <Yardanico> In reply to @Solitude "strong whitespace is removed": i know |
17:11:18 | FromDiscord | <Rika> In reply to @Rika "!eval echo ((2+3) *": this is what it would be equivalent to no? |
17:11:27 | FromDiscord | <Solitude> yes |
17:11:33 | FromDiscord | <Rika> In reply to @Rika "`2+3 * 5*2 ": from this |
17:11:39 | FromDiscord | <spoon> 2+(305/6) |
17:11:40 | FromDiscord | <Yardanico> if strong space was still a thing |
17:11:43 | FromDiscord | <Rika> exactly |
17:11:45 | FromDiscord | <Rika> thats my point |
17:11:45 | FromDiscord | <Rika> what |
17:12:00 | FromDiscord | <Yardanico> you |
17:12:01 | FromDiscord | <Yardanico> didnt |
17:12:03 | FromDiscord | <Yardanico> mention |
17:12:03 | FromDiscord | <Yardanico> it |
17:12:04 | FromDiscord | <Yardanico> explicitly |
17:12:05 | FromDiscord | <Phil> I don't think so, wouldn't ((2+3)(52)(5/6)) = 550/6 = 250/6 = 41 2/3? |
17:12:16 | FromDiscord | <Rika> In reply to @Isofruit "I'm still squinting hard": PHIL SAID IT RIGHT BEFORE I WROTE IT |
17:12:16 | FromDiscord | <Solitude> read the context dummy, he wrote that right after it was mentioned |
17:12:31 | FromDiscord | <Phil> (edit) "((2+3)(52)(5/6))" => "((2+3)\(5\2)\(5/6))" | "550/6" => "5\50/6" |
17:12:39 | FromDiscord | <Yardanico> In reply to @Solitude "read the context dummy,": i thought he was talking about command invocation syntax 🤷 |
17:12:44 | FromDiscord | <Solitude> its over yardanico |
17:12:44 | FromDiscord | <Yardanico> its also "whitespace as brackets" |
17:12:48 | FromDiscord | <Solitude> hand over your mod badge |
17:12:51 | FromDiscord | <Phil> I'm so confused now |
17:12:52 | FromDiscord | <Yardanico> `readLine stdin` vs `readLine(stdin)` |
17:13:18 | FromDiscord | <Rika> well okay then we were both confused |
17:13:26 | FromDiscord | <Phil> Anyway, I had originally assumed Rika's example would evaluate to the bracket syntax above.↵It has turned out that's not the case, I have learned now, nice |
17:13:42 | FromDiscord | <Rika> In reply to @Isofruit "Anyway, I had originally": it wouldnt in nim, no longer |
17:13:51 | FromDiscord | <Phil> Thankfully |
17:14:14 | FromDiscord | <Phil> ~~One more reason to squint at that sort of syntax any time I see it and promote brackets~~ |
17:14:27 | * | ehmry quit (Ping timeout: 276 seconds) |
17:14:32 | * | emery joined #nim |
17:14:37 | FromDiscord | <Phil> Maybe I just suffer a very strong case of bracket-stockholm-syndrome |
17:15:03 | FromDiscord | <Rika> you suffer a case of stockholm syndrome from java |
17:15:14 | * | Gustavo6046 joined #nim |
17:15:21 | FromDiscord | <Phil> Now wait a second, I was a fan of brackets way before java |
17:15:28 | FromDiscord | <Phil> Except for curly braves around function |
17:15:30 | FromDiscord | <Phil> That can fuck off |
17:15:38 | FromDiscord | <Phil> (edit) "braves" => "braces" |
17:15:39 | FromDiscord | <Rika> {func()}? wdym |
17:16:08 | FromDiscord | <Phil> `private void blabla(){ <Method body>}` |
17:16:14 | FromDiscord | <Phil> Those curly braces |
17:16:19 | FromDiscord | <Yardanico> you can also emulate those in nim :) |
17:16:23 | FromDiscord | <Rika> why would you like brackets in general EXCEPT for that |
17:16:25 | FromDiscord | <Rika> thats weird |
17:16:42 | FromDiscord | <Rika> In reply to @Yardanico "you can also emulate": with the added bonus of required semicolons hahaha |
17:16:53 | FromDiscord | <Yardanico> @Phil have you seen https://github.com/nim-lang/Nim/wiki/Lesser-known-Nim-features ? |
17:16:57 | FromDiscord | <Yardanico> it generally has a lot of cool stuff :) |
17:17:08 | FromDiscord | <Yardanico> braces example from here: |
17:17:14 | FromDiscord | <Yardanico> sent a code paste, see https://play.nim-lang.org/#ix=3W8a |
17:17:19 | FromDiscord | <Yardanico> welcome to Janim |
17:17:32 | FromDiscord | <Yardanico> also, an old fact, but nim used to have a braces syntax skin |
17:18:29 | FromDiscord | <Phil> In reply to @Rika "why would you like": I want brackets to visually tell me exactly what things are part of a proc call or not.↵I don't need them to tell me what line is part of a method body and what isn't.↵In fact, I prefer it not being there and the compiler relying on indentation, because indentations are imo easier to visually identify to properly "group" lines of code that belong into the same codeblock together. |
17:19:01 | FromDiscord | <Phil> In reply to @Yardanico "<@180601887916163073> have you seen": I have not, I'll give it a read |
17:19:09 | * | emery quit (Ping timeout: 272 seconds) |
17:19:10 | * | ehmry joined #nim |
17:21:41 | FromDiscord | <spoon> wow |
17:21:53 | FromDiscord | <Phil> Okay, the indexing arrays with enums is pretty dope |
17:21:55 | FromDiscord | <spoon> sent a code paste, see https://play.nim-lang.org/#ix=3W8c |
17:22:04 | FromDiscord | <Yardanico> In reply to @Isofruit "Okay, the indexing arrays": yes, and it's much much faster than the "obvious" approach with a table |
17:22:08 | FromDiscord | <Yardanico> tens of times faster |
17:22:21 | FromDiscord | <Yardanico> like `Table[EnumType, value]` vs `array[EnumType, value]` |
17:22:36 | FromDiscord | <Phil> Shame I don't tend to have array types, it's seqs all the way down everywhere, but generally really cool |
17:23:40 | * | ehmry quit (Ping timeout: 250 seconds) |
17:23:51 | * | ehmry joined #nim |
17:25:58 | FromDiscord | <huantian> In reply to @Yardanico "like `Table[EnumType, value]` vs": And you can emulate missing keys with Option probably |
17:26:05 | FromDiscord | <Phil> Ohhhh default params based on passed in non-default params |
17:26:17 | FromDiscord | <Phil> That's pretty neat |
17:28:31 | * | emery joined #nim |
17:28:32 | PMunch | Hmm, this array initializer with values is new to me |
17:28:39 | * | ehmry quit (Ping timeout: 272 seconds) |
17:28:49 | FromDiscord | <Yardanico> no, i mean value as in value type :) |
17:29:10 | PMunch | And also somewhat cursed: https://play.nim-lang.org/#ix=3W8g :P |
17:29:58 | FromDiscord | <Yardanico> oh yeah this is actually documented in the manual |
17:30:08 | FromDiscord | <Yardanico> maybe i should add it to that wiki as well |
17:30:20 | FromDiscord | <Yardanico> it's in array section of the manual in "An array constructor can have explicit indexes for readability" |
17:30:23 | PMunch | It's in that Wiki, that's where I found it :P |
17:30:35 | PMunch | Under this section: https://github.com/nim-lang/Nim/wiki/Lesser-known-Nim-features#using-enums-as-array-indexes |
17:30:43 | PMunch | But it doesn't mention that it work for normal indices as well |
17:30:44 | FromDiscord | <Yardanico> ah yeah |
17:30:53 | * | xet7 quit (Remote host closed the connection) |
17:30:59 | FromDiscord | <Solitude> In reply to @PMunch "And also somewhat cursed:": epic https://play.nim-lang.org/#ix=3W8h |
17:31:09 | FromDiscord | <Yardanico> zamn |
17:31:16 | FromDiscord | <Solitude> truly a zamn moment |
17:31:16 | PMunch | We should write a simple program where we try to use the most cursed Nim code style possible |
17:31:16 | FromDiscord | <Yardanico> yeah arrays can start at arbitrary indexes |
17:31:19 | FromDiscord | <Yardanico> a lot of languages can't |
17:31:43 | FromDiscord | <Solitude> In reply to @PMunch "We should write a": this is a go to styleguide https://github.com/nim-lang/Nim/issues/19686 |
17:31:46 | PMunch | @Solitude, oh that is interesting.. |
17:32:04 | * | xet7 joined #nim |
17:32:09 | FromDiscord | <Yardanico> In reply to @Solitude "this is a go": shh this is a feature (TM) |
17:32:45 | PMunch | @Solitude, oh goodness gracious.. |
17:33:32 | FromDiscord | <Phil> In reply to @PMunch "<@104136074569211904>, oh goodness gracious..": There are not balls of fire great enough for this |
17:33:39 | FromDiscord | <Phil> (edit) "not" => "no" |
17:33:47 | FromDiscord | <Yardanico> is it time for example_case yet @Solitude |
17:34:08 | PMunch | Hmm, I can't get it to work for me |
17:34:10 | FromDiscord | <Yardanico> i don't remember if Phil seen it already |
17:34:24 | FromDiscord | <Yardanico> In reply to @Isofruit "There are no balls": https://raw.githubusercontent.com/Yardanico/nuglifier/master/example_output/example_case.nim |
17:34:43 | FromDiscord | <Phil> In reply to @Yardanico "https://raw.githubusercontent.com/Yardanico/nuglifi": Ah yes, death in code |
17:34:49 | FromDiscord | <Yardanico> it compiles and runs just fine btw |
17:34:58 | FromDiscord | <Yardanico> its my math evaluator |
17:35:01 | FromDiscord | <Phil> I veto this |
17:35:15 | PMunch | Ah, the first example doesn't work for me on latest devel, all the others does though |
17:35:18 | FromDiscord | <Phil> I'll even veto the veto just so I can veto this again |
17:35:32 | FromDiscord | <Yardanico> how can you not enjoy the `pROC aD_DF_unC(e: Ev_ALU_aT_Or, namE: sT_RI_ng, fUN: Ma_tHF_UnC_Ti_ON, ar_gC_OunT = -1) =` |
17:35:34 | FromDiscord | <Phil> Seek help before you write this |
17:35:45 | FromDiscord | <Yardanico> In reply to @Isofruit "Seek help before you": luckily i haven't done this by hand :) |
17:35:52 | FromDiscord | <Yardanico> https://github.com/Yardanico/nuglifier |
17:35:58 | FromDiscord | <enthus1ast> i just saw aids scroll by↵(@Yardanico) |
17:36:08 | FromDiscord | <Yardanico> need to update it to finally fix the indentation bugs maybe |
17:36:30 | FromDiscord | <Phil> In reply to @enthus1ast "i just saw aids": I'm pretty sure in terms of horrible things I've seen this year this is competing in the same league as Covid |
17:36:31 | PMunch | Using source code filters are a bit of cheating though |
17:36:50 | FromDiscord | <Yardanico> In reply to @PMunch "Using source code filters": those are only for zero width space and tabs indentation here :) |
17:37:09 | PMunch | Aah, that's what the first one did there |
17:37:13 | FromDiscord | <Yardanico> nuglifier uses compiler as a library too btw, its lexer more specifically |
17:37:19 | PMunch | zero width space indentation is truly cursed :P |
17:37:24 | FromDiscord | <Yardanico> yeah |
17:37:32 | FromDiscord | <Yardanico> and in nim different blocks can have different indentation levels |
17:37:37 | FromDiscord | <Yardanico> it just has to match for one indentation block |
17:37:54 | FromDiscord | <Phil> In reply to @Yardanico "https://github.com/Yardanico/nuglifier": Yard, why would you do this |
17:38:08 | FromDiscord | <Phil> Why would you bring such a cursed abomination into this world? |
17:38:11 | FromDiscord | <Yardanico> we toyed around in discord |
17:38:13 | FromDiscord | <Yardanico> and then i made this |
17:38:14 | FromDiscord | <Phil> Do you just want to see the world burn around you? |
17:38:16 | FromDiscord | <Yardanico> lemme find the original paste |
17:38:31 | FromDiscord | <Phil> Is there not enough suffering in this world yet? |
17:38:33 | FromDiscord | <Yardanico> https://play.nim-lang.org/#ix=2qcg |
17:38:38 | FromDiscord | <Yardanico> this is what i was inspired with |
17:38:51 | FromDiscord | <Yardanico> this is a result of crowdsources effort of a few people |
17:38:56 | FromDiscord | <Phil> I will admit this looks like a helicopter in a side-scroller shooter |
17:39:03 | FromDiscord | <Yardanico> LOL |
17:39:31 | FromDiscord | <Phil> You even got the solid walls on top and the bottom |
17:39:35 | PMunch | I like that since that's a play link I can just hit run and see the madness actually running :P |
17:40:03 | FromDiscord | <Phil> This piece of source code is sad, justifiably so https://media.discordapp.net/attachments/371759389889003532/967842369275826226/unknown.png |
17:40:08 | FromDiscord | <Yardanico> just don't show this to newbies |
17:40:09 | * | vicfred joined #nim |
17:40:15 | FromDiscord | <Yardanico> or they'll complain that nim is harder to read than rust |
17:40:57 | FromDiscord | <Phil> > hell o wo_Rld!↵This is, indeed, hell |
17:41:09 | FromDiscord | <Rika> wait wtf |
17:41:12 | FromDiscord | <Rika> japanese |
17:41:13 | FromDiscord | <Rika> really |
17:41:18 | FromDiscord | <Yardanico> yes @Rika it's yours i think |
17:41:22 | FromDiscord | <Yardanico> from like a year ago or something |
17:41:41 | FromDiscord | <Yardanico> i mean the japanese part is yours |
17:41:43 | FromDiscord | <Phil> I always knew that Rika also created monsters as a hobby |
17:41:56 | FromDiscord | <Rika> it is? |
17:41:59 | FromDiscord | <Yardanico> maybe |
17:42:02 | FromDiscord | <Rika> i dont remember speaking japanese |
17:42:03 | FromDiscord | <Yardanico> i don't remember for sure, it was a long time ago |
17:43:07 | FromDiscord | <Yardanico> why do something productive when you can instead show how to abuse nim's syntax rules :) |
17:45:39 | FromDiscord | <Phil> I mean, it's creative, and creative is fun |
17:45:55 | FromDiscord | <Phil> I could rewatch Dylan's beaties "The Art of Programming" talk over and over |
17:46:09 | FromDiscord | <Phil> (edit) "beaties" => "beatties" |
17:46:32 | FromDiscord | <Phil> It's just really fun, diving into a lot of weirdness and fascinating and useless stuff |
17:46:39 | FromDiscord | <Phil> Like this |
17:47:11 | FromDiscord | <Phil> Apparently there's a bad-code-consortium, trying to bets-worst examples of code ever written |
17:47:35 | FromDiscord | <Phil> Which includes Code shaped like a mandelbrot set |
17:47:56 | FromDiscord | <huantian> In reply to @Yardanico "https://github.com/Yardanico/nuglifier": Why is it so much harder to do the opposite of this |
17:47:57 | FromDiscord | <Phil> (edit) "bets-worst" => "conserve the best-worst" |
17:48:35 | FromDiscord | <Yardanico> because beautiful is subjective |
17:48:49 | FromDiscord | <Phil> https://www.youtube.com/watch?v=6avJHaC3C2U↵For anyone wanting to entertain themselves if they haven't watched it already |
17:49:27 | FromDiscord | <Rika> In reply to @Yardanico "because beautiful is subjective": not really, its because "beautiful" is a smaller set than "ugly" |
17:50:00 | FromDiscord | <Phil> ~~Beautiful is writing your constants in screaming case~~ |
17:50:11 | FromDiscord | <Yardanico> In reply to @Rika "not really, its because": that too |
17:52:15 | FromDiscord | <huantian> sent a code paste, see https://play.nim-lang.org/#ix=3W8k |
17:52:41 | FromDiscord | <Yardanico> nooo but if is slow because some random youtuber said so!!! |
17:57:56 | PMunch | Huh, apparently HDMI has a i2c port.. |
17:57:57 | PMunch | https://mitxela.com/projects/ddc-oled |
17:58:05 | PMunch | That could be useful, for, stuff |
18:04:37 | FromDiscord | <golova> In reply to @huantian "I mean this is": Is that a valid code? |
18:04:43 | FromDiscord | <Yardanico> of course? |
18:05:03 | FromDiscord | <Yardanico> nim has if expressions |
18:05:11 | FromDiscord | <golova> I mean i saw smth like that but with block: and const |
18:05:23 | FromDiscord | <Yardanico> yes, that will work too since there are block expressions as well |
18:06:48 | * | oprypin quit (Quit: No Ping reply in 180 seconds.) |
18:06:59 | FromDiscord | <huantian> Omitting the block is more consise tho |
18:07:21 | FromDiscord | <Yardanico> huh? |
18:07:26 | FromDiscord | <Yardanico> @huantian he's talking about the block expression itself |
18:07:41 | FromDiscord | <Yardanico> sent a code paste, see https://play.nim-lang.org/#ix=3W8q |
18:08:05 | * | oprypin joined #nim |
18:08:14 | FromDiscord | <huantian> sent a code paste, see https://play.nim-lang.org/#ix=3W8s |
18:08:40 | FromDiscord | <golova> Actually both cases |
18:08:49 | FromDiscord | <golova> Not sure if last one would work tho |
18:08:50 | FromDiscord | <Yardanico> well, there's nothing unique here, that's normal nim syntax |
18:08:55 | FromDiscord | <Yardanico> In reply to @golova "Not sure if last": of course |
18:08:58 | FromDiscord | <Yardanico> all branches always return a value so why not |
18:09:24 | FromDiscord | <golova> Now i realize that my code is ugly asf |
18:10:02 | FromDiscord | <Yardanico> last expression in a proc can also be used for the result |
18:10:15 | FromDiscord | <Yardanico> sent a code paste, see https://play.nim-lang.org/#ix=3W8u |
18:10:24 | FromDiscord | <Yardanico> this gets interesting once you add case statements or ifs |
18:10:42 | FromDiscord | <Yardanico> for example https://github.com/pietroppeter/nimib/blob/main/src/nimib/highlight.nim#L52 |
18:10:43 | FromDiscord | <Solitude> In reply to @golova "Now i realize that": now you can make it prettier and feel good about yourself |
18:10:49 | FromDiscord | <Yardanico> sent a code paste, see https://play.nim-lang.org/#ix=3W8v |
18:11:05 | FromDiscord | <Yardanico> since the second line of the proc it's all a big case statement expression |
18:11:11 | FromDiscord | <Yardanico> with another case statement expression inside of it |
18:11:21 | FromDiscord | <Yardanico> but since all branches always return a value, nim takes its value as the result of the proc |
18:11:55 | FromDiscord | <Solitude> ^ powerfull stuff |
18:11:59 | FromDiscord | <Yardanico> full |
18:12:05 | FromDiscord | <Yardanico> zamning |
18:12:18 | FromDiscord | <Rika> return a value or raise an exception |
18:12:29 | FromDiscord | <Yardanico> yeah |
18:13:26 | FromDiscord | <Solitude> or make a dummy proc, mark it with noreturn and do a little trolling |
18:13:36 | FromDiscord | <Yardanico> and watch your computer go up in flames |
18:13:48 | FromDiscord | <d4rckh> sent a code paste, see https://play.nim-lang.org/#ix=3W8x |
18:14:05 | FromDiscord | <Yardanico> you're not sending a line |
18:14:08 | PMunch | @golova, for more stuff regarding ifs/blocks and implicit return: https://peterme.net/tips-and-tricks-with-implicit-return-in-nim.html |
18:14:10 | FromDiscord | <Yardanico> recvLine expects a line with line terminators |
18:14:17 | FromDiscord | <d4rckh> oh |
18:14:28 | FromDiscord | <d4rckh> like terminator as in `\n`? |
18:14:34 | FromDiscord | <Yardanico> \r\n |
18:14:51 | PMunch | Or \n if you're on Linux |
18:15:06 | PMunch | Well, if you're on any other system than Windows |
18:15:13 | FromDiscord | <d4rckh> wow it works! thank you |
18:15:41 | FromDiscord | <Yardanico> that's the usual protocol stuff - client or server need to know where the transmission "ends" |
18:15:46 | FromDiscord | <d4rckh> also, whenever i have both of my client and server connected, and i quit the server, the client just prints blank lines forever, what causes that? |
18:15:53 | FromDiscord | <Yardanico> of course it's possible to just receive all data with unbuffered sockets, but it's unreliable |
18:18:15 | FromDiscord | <d4rckh> interesting |
18:24:27 | * | duuude quit (Ping timeout: 240 seconds) |
18:30:30 | FromDiscord | <d4rckh> I am trying to have some sort of cli to interact with the clients, like send them messages and things, but i noticed that i cant have 2 while loops running at the same thing 😅, one to receive the messages from the cli and another one to listen to messages from the clients. what would be the best way of handling this? |
18:31:11 | PMunch | Hmm, I'm creating a system for deriving types. Say I have a base type A and a procedure that takes A and returns B and one which takes B and returns C. I want to be able to say that I have A and want C and have the system figure out what to call in order to get there. I guess some kind of linked structure with a table lookup would be a good way to go about it? |
18:31:19 | FromDiscord | <huantian> In reply to @d4rckh "I am trying to": ✨ async ✨ |
18:31:20 | FromDiscord | <huantian> Probably |
18:31:43 | PMunch | Async is definitely one way of doing it |
18:31:56 | PMunch | Running two threads would also work (although a bit overkill) |
18:32:23 | PMunch | Or you could just poll to see if a message is incoming, otherwise check if the user is typing anything and then loop all of that |
18:33:52 | FromDiscord | <Rika> In reply to @PMunch "Hmm, I'm creating a": yeah something that can resolve graphs like that |
18:34:09 | FromDiscord | <Rika> because in the end what you're describing is kinda a graph |
18:34:15 | PMunch | Yeah it is |
18:34:24 | FromDiscord | <d4rckh> async would like, run them concurrently right? not parallel like threads would do |
18:34:27 | PMunch | The structure would definitely have to be graph-like |
18:34:34 | PMunch | @d4rckh, correct |
18:34:45 | FromDiscord | <Rika> you dont need parallel here |
18:34:46 | PMunch | Basically async does the third thing I wrote |
18:34:58 | FromDiscord | <d4rckh> right, i dont need parallelism here |
18:35:43 | PMunch | You give it a couple of file descriptors (your input socket and your terminal input socket) and then it will tell the operating system to notify it when either of them are ready. Then when they are the action associated with that thing is executed |
18:35:54 | PMunch | Of course all of that is wrapped away in layers of abstraction |
18:36:01 | * | duuude joined #nim |
18:36:07 | PMunch | So your code looks similar to threaded code in a way |
18:37:02 | PMunch | The easiest would be to have two async procedures, both with their own while true loop, and then do an async read from the socket and the terminal input |
18:37:18 | PMunch | Then in your main program you asyncCheck start them both and then runForever() |
18:37:21 | PMunch | Or something like that |
18:37:41 | FromDiscord | <d4rckh> yup, thats what im doing |
18:37:49 | FromDiscord | <dom96> In reply to @d4rckh "I am trying to": @d4rckh this should help you: https://github.com/dom96/nim-in-action-code/tree/master/Chapter3/ChatApp |
18:38:23 | FromDiscord | <dom96> you cannot asynchronously await for data to be read on stdin, the example I linked shows how to get around that |
18:39:21 | FromDiscord | <d4rckh> oh yeah, indeed, the communication stopped |
18:40:57 | PMunch | Wait, so you're spawning a new thread to run the user input? |
18:41:20 | PMunch | Is this a Windows thing? I'm positive you can async read standard input on Linux |
18:42:02 | FromDiscord | <dom96> yes, this is required for Windows |
18:42:09 | FromDiscord | <dom96> indeed, on Linux it's doable |
18:42:30 | FromDiscord | <dom96> if you don't care about Windows you can just use asyncfile with stdin as the file descriptor |
18:42:52 | FromDiscord | <dom96> it's funny how often this comes up though |
18:43:35 | PMunch | People like making CLI applications I guess |
18:43:45 | FromDiscord | <dom96> I think it's important we make awaiting of spawned threads work well and then just implement this logic in the stdlib, with Windows using threads and Linux not |
18:43:52 | PMunch | It's weird that you can't read Windows stdin asynchronously though.. |
18:44:20 | PMunch | Yeah I'd definitely want await for threads, channels, and locks |
18:44:23 | PMunch | That'd be great |
18:44:37 | FromDiscord | <d4rckh> In reply to @dom96 "if you don't care": i do care about windows 😄 |
18:45:02 | FromDiscord | <d4rckh> oh yeah, thats why it didnt work on python last year when i did something similar |
18:47:16 | PMunch | @Rika, hmm since I need the table lookup I could just store identifiers to other types as a list in the table |
18:47:35 | PMunch | Instead of a full blown tree structure with a table for indexing |
18:47:43 | FromDiscord | <dom96> In reply to @d4rckh "i do care about": then just copy the code in the link I gave you, it's in client.nim 🙂 |
18:47:48 | PMunch | Sure traversal will be a bit slower, but that's not really a problem |
18:48:00 | FromDiscord | <d4rckh> In reply to @dom96 "then just copy the": i need to adapt it, my server has the cli :\( |
18:48:10 | FromDiscord | <d4rckh> not clients |
18:49:28 | FromDiscord | <dom96> shouldn't be a problem |
18:50:22 | * | krux02 quit (Remote host closed the connection) |
18:51:02 | * | krux02 joined #nim |
18:53:50 | FromDiscord | <d4rckh> sent a code paste, see https://play.nim-lang.org/#ix=3W8D |
18:53:55 | FromDiscord | <d4rckh> it is able to receive commands, but not listen to my stdin |
18:54:12 | FromDiscord | <d4rckh> just trying to echo back what im inputting for now |
18:54:50 | FromDiscord | <dom96> In reply to @d4rckh "it is able to": hm, not sure what you mean by this. What exactly doesn't work? |
18:55:14 | FromDiscord | <d4rckh> if i am entering something, it wont back |
18:55:16 | FromDiscord | <dom96> but actually I see the problem, you only check for messageFlowVar once |
18:55:26 | FromDiscord | <dom96> you should be doing this in a loop |
18:55:50 | FromDiscord | <dom96> create another procs called `pollStdin` and copy the `messageFlowVar.isReady():` if branch in there |
18:56:08 | FromDiscord | <dom96> do this in a while loop and `await sleepAsync(10)` to give time for the IO loop to do its work |
18:58:16 | * | vicfred quit (Quit: Leaving) |
18:59:32 | FromDiscord | <d4rckh> sent a code paste, see https://play.nim-lang.org/#ix=3W8F |
18:59:42 | * | vicfred joined #nim |
19:01:47 | FromDiscord | <d4rckh> 🤔 i think im missing something |
19:03:30 | FromDiscord | <d4rckh> oh i fucked the order |
19:03:34 | FromDiscord | <d4rckh> silly me |
19:05:09 | FromDiscord | <d4rckh> sent a code paste, see https://play.nim-lang.org/#ix=3W8I |
19:06:41 | FromDiscord | <dom96> sure, that works. You can also replace the `poll` with ` sleepAsync` and have a runForever() at the bottom |
19:06:59 | FromDiscord | <dom96> Doing `poll` in an async proc is bound to lead to issues 🙂 |
19:07:11 | FromDiscord | <dom96> best to just do `poll` at the top-level |
19:11:47 | FromDiscord | <huantian> ☝️ |
19:16:07 | FromDiscord | <d4rckh> In reply to @dom96 "sure, that works. You": sure! |
19:24:08 | * | duuude quit (Ping timeout: 248 seconds) |
19:25:51 | FromDiscord | <d4rckh> @dom96 do you have any idea how could i avoid repeating `var messageFlowVar = spawn stdin.readLine()`? |
19:25:56 | FromDiscord | <d4rckh> (edit) "@dom96 do you have any idea ... how" added "on" |
19:26:25 | FromDiscord | <huantian> Maybe you could make a generalized readLineAsync |
19:26:42 | FromDiscord | <huantian> Which you await in procStdin |
19:28:51 | FromDiscord | <huantian> Since this new proc would only read once you don’t have to reassign |
19:44:05 | * | Gustavo6046 quit (Quit: Goodbye! Leave messages at my XMPP @ [email protected] or my Discord Gustavo6046#9009 or possibly my Mastodon [email protected] – I don't check my email often since it's full of crap, but in any case, [email protected]) |
20:17:32 | * | ssiyad quit (Remote host closed the connection) |
20:32:22 | FromDiscord | <TryAngle> can nim somehow do a seq of inherited objects? |
20:34:59 | FromDiscord | <demotomohiro> https://internet-of-tomohiro.netlify.app/nim/faq.en.html#coding-how-to-store-different-types-in-seqqmark |
20:35:27 | PMunch | @TryAngle, as long as they are ref objects, sure: https://play.nim-lang.org/#ix=3W94 |
21:00:29 | FromDiscord | <TryAngle> In reply to @PMunch "<@147447489316913152>, as long as": thanks!↵but when I try to store this seq in a type I have to cast the vals to the RootObj type↵and then I'm kinda stuck "uncasting" them? 🤔 |
21:01:22 | FromDiscord | <TryAngle> `x of X`↵only works for uncasted ref objects of T |
21:02:04 | FromDiscord | <huantian> No it doesn’t? |
21:03:06 | FromDiscord | <TryAngle> sent a code paste, see https://play.nim-lang.org/#ix=3W9b |
21:03:48 | FromDiscord | <TryAngle> sent a code paste, see https://play.nim-lang.org/#ix=3W9d |
21:03:51 | FromDiscord | <huantian> https://play.nim-lang.org/#ix=3W9c |
21:03:54 | * | vicfred quit (Ping timeout: 276 seconds) |
21:04:31 | FromDiscord | <huantian> Well yeah you’d have to check/know that all the values in the seq are of the type you want and then cast them |
21:04:36 | FromDiscord | <TryAngle> (edit) "https://play.nim-lang.org/#ix=3W9d" => "https://paste.rs/2pK" |
21:05:05 | * | xet7 quit (Remote host closed the connection) |
21:06:05 | FromDiscord | <TryAngle> sent a code paste, see https://play.nim-lang.org/#ix=3W9e |
21:07:03 | FromDiscord | <TryAngle> but then for example in `$`↵`if e of Declaration:` does not work then |
21:07:12 | FromDiscord | <TryAngle> (edit) "e" => "expression" |
21:07:37 | FromDiscord | <huantian> sent a code paste, see https://play.nim-lang.org/#ix=3W9f |
21:07:58 | FromDiscord | <TryAngle> sent a code paste, see https://play.nim-lang.org/#ix=3W9g |
21:09:23 | FromDiscord | <TryAngle> wait I will put all the code on play-nim |
21:10:10 | FromDiscord | <TryAngle> https://play.nim-lang.org/#ix=3W9h |
21:12:18 | FromDiscord | <TryAngle> I can also put everything into a variadic object but this would get big really fast 🤔 |
21:13:04 | FromDiscord | <huantian> https://play.nim-lang.org/#ix=3W9j |
21:13:06 | FromDiscord | <huantian> Maybe? |
21:13:38 | FromDiscord | <huantian> I’d just use a variadic object personally |
21:14:26 | FromDiscord | <TryAngle> In reply to @huantian "I’d just use a": hmm maybe I should also...↵are how big do variadic objects get? their biggest variance or like everything is a field? |
21:14:35 | FromDiscord | <TryAngle> In reply to @huantian "https://play.nim-lang.org/#ix=3W9j": lol why does this work |
21:14:41 | FromDiscord | <Rika> Biggest variance |
21:15:30 | * | vicfred joined #nim |
21:15:34 | FromDiscord | <TryAngle> In reply to @Rika "Biggest variance": oh! |
21:15:42 | FromDiscord | <TryAngle> guess I use them also then |
21:16:06 | FromDiscord | <TryAngle> In reply to @TryAngle "lol why does this": ????? it does work now also, apparnelty I didn't press save button on my pc or something wtf |
21:16:12 | FromDiscord | <Rika> Lol |
21:16:37 | FromDiscord | <TryAngle> but vsc autosaves o_O |
21:16:39 | FromDiscord | <TryAngle> makes no sense |
21:17:55 | FromDiscord | <TryAngle> what is faster and less memory footprint @Rika @huantian, variadic or single ref objects for a lot of variance / different ref objects? |
21:18:13 | FromDiscord | <TryAngle> or is it same because it compiles to same |
21:18:14 | FromDiscord | <Rika> Benchmark if. |
21:18:16 | FromDiscord | <Rika> It |
21:18:23 | FromDiscord | <Rika> They do not compile the same |
21:19:16 | * | vicfred quit (Client Quit) |
21:20:56 | * | vicfred joined #nim |
21:21:01 | * | PMunch quit (Quit: leaving) |
21:33:05 | FromDiscord | <Nanozet> sent a code paste, see https://paste.rs/x2f |
21:33:16 | FromDiscord | <Nanozet> (edit) |
21:33:44 | FromDiscord | <Nanozet> sent a code paste, see https://play.nim-lang.org/#ix=3W9n |
21:34:02 | FromDiscord | <Elegantbeef> your `[]` doesnt return `var Machine` |
21:34:14 | FromDiscord | <Elegantbeef> 'machines[machineResult]' is immutable, not 'var' |
21:35:15 | FromDiscord | <Nanozet> so seq elements are immutable by default |
21:35:43 | FromDiscord | <Elegantbeef> No |
21:36:00 | FromDiscord | <Nanozet> ok I am stupid |
21:36:03 | FromDiscord | <Elegantbeef> If you're not passing `var seq[T]` it's immutable |
21:36:03 | FromDiscord | <Elegantbeef> Nim parameters are immutable by default and require `var T` |
21:36:12 | FromDiscord | <Nanozet> I was using let didnts see that |
21:36:19 | FromDiscord | <Nanozet> thx |
21:36:32 | FromDiscord | <Nanozet> (edit) "didnts" => "didn't" |
21:36:44 | FromDiscord | <Nanozet> (edit) "let" => ""let"," |
21:53:01 | * | Zectbumo joined #nim |
22:15:42 | * | Zectbumo quit (Remote host closed the connection) |
22:19:42 | * | arkurious quit (Quit: Leaving) |
22:24:11 | * | krux02 quit (Quit: Leaving) |
22:41:11 | * | jjido joined #nim |
22:43:53 | * | fowl quit (Quit: cya pals) |
22:44:36 | * | fowl joined #nim |
22:45:55 | * | fowl quit (Client Quit) |
22:48:36 | * | fowl joined #nim |
23:08:46 | * | xet7 joined #nim |
23:10:49 | * | Zectbumo joined #nim |
23:14:25 | FromDiscord | <TryAngle> is there some way to call module a in b and b in a? |
23:14:36 | FromDiscord | <TryAngle> via a pragma, or partial import |
23:16:05 | FromDiscord | <ynfle> What do you mean by call a module? |
23:21:45 | FromDiscord | <TryAngle> In reply to @ynfle "What do you mean": import |
23:21:52 | FromDiscord | <TryAngle> (edit) "import" => "I mean import" |
23:22:04 | FromDiscord | <huantian> If you have recursive imports you need to restructure |
23:23:09 | FromDiscord | <TryAngle> In reply to @huantian "If you have recursive": are triangular importas allowed?↵A -> B↵A <- C <- B |
23:23:12 | FromDiscord | <Elegantbeef> Not always |
23:23:35 | FromDiscord | <Elegantbeef> Depends on what you need but you can do recursive imports if you delay them, but it only gives you up until that imported module |
23:32:51 | * | jjido quit (Quit: My MacBook Air has gone to sleep. ZZZzzz…) |
23:52:28 | FromDiscord | <riplooke> How can I tell what Linux distro someone is using in nim |
23:52:52 | * | droidrage joined #nim |
23:53:28 | FromDiscord | <Elegantbeef> https://nim-lang.org/docs/distros.html |
23:54:48 | FromDiscord | <riplooke> Thx |