<< 21-08-2022 >>

00:01:34FromDiscord<Rika> In reply to @bulan2 "<@229378547419054080> No": Only on compliant terminals, of course
00:08:28*CyberTailor quit (Excess Flood)
00:11:19*CyberTailor joined #nim
00:11:39FromDiscord<Zectbumo> In reply to @Patitotective "better name for `addOrAdd`?": `addToSeq` and not worry about expressing `orPut` it's just an easy to use interface that "just works".
00:28:29NimEventerNew Nimble package! libdeflate_gzip - A wrapper for libdeflate, see https://github.com/radekm/nim_libdeflate_gzip
00:36:16FromDiscord<!Patitotective> the forum should really have some kind of notifications system
00:36:44FromDiscord<!Patitotective> its really annoying not being able to know when someone answered you or to follow a thread
00:43:23FromDiscord<leorize> ~~maybe we should switch to discourse~~
00:43:29FromDiscord<Elegantbeef> "PRs welcome"
00:43:57FromDiscord<!Patitotective> PR #2033: delete this repo and use github discussions
00:44:19FromDiscord<Elegantbeef> Eh github forums lock you to github
00:44:39FromDiscord<!Patitotective> /j
00:46:14FromDiscord<!Patitotective> actually yeah, why not just use discourse?
00:47:21FromDiscord<auxym> I like the idea that nimforum doubles as a good showcase project for nim, but in practice no-one seems to be stepping up to maintain it, so not sure. I remember it getting some flak on some HN post or another that made front page. Discourse works.
01:03:35FromDiscord<bun> thank you to @ElegantBeef and @bulan2 for the help, its really basic atm and has a lot of quirks but after trying to learn to program for years nim seems like a nice fit 😊 https://media.discordapp.net/attachments/371759389889003532/1010715757937688646/Screen_Recording_2022-08-20_at_8.58.34_PM.mov
01:04:12FromDiscord<Elegantbeef> yet another rogue clone? 😄
01:07:11FromDiscord<bun> just some practice 🙂 can always do with one more
01:07:32FromDiscord<bun> a lot harder than it looks doing it from scratch
01:07:38FromDiscord<!Patitotective> In reply to @bun "thank you to <@145405730571288577>": really cool
01:08:09FromDiscord<bun> thank u 😊
02:34:09*arkurious quit (Quit: Leaving)
04:10:23*xcodz-dot joined #nim
04:14:13xcodz-dotGood morning/evening/night gentlemen/gentlewomen. I am here to kindly request for a cli library that will keep me from going insane. Lately, my options have included parseopt, cligen, docopt, therapist (its a library). None of them are quite as good as Python's argparse.
04:15:28FromDiscord<leorize> have you tried nim-argparse?
04:15:48xcodz-dotWell, yes and its has a infuriating bug
04:15:52xcodz-dotit
04:15:54xcodz-dotit*
04:17:18FromDiscord<leorize> if you've tried everything, maybe it's time to roll your own or fix one of those you tried
04:17:44FromDiscord<Elegantbeef> Yea arg parsers are generally meh to me 😄
04:18:21FromDiscord<Elegantbeef> I have a few attempts at them, but much like anything user facing it's a pain in my experience
04:18:31xcodz-dotWell, I have tried rolling out my own, but I have a infuriating bug which I can not fix. It is only 50 lines long when I encountered the bug.
04:18:41FromDiscord<leorize> just make a clap clone \:p
04:18:48FromDiscord<leorize> what bug is that?
04:18:56xcodz-dotWait, I will send the code paste
04:19:20FromDiscord<Elegantbeef> Leo i dont think clap is close to the API i want 😄
04:19:39FromDiscord<Elegantbeef> I was playing around with this type of API https://github.com/beef331/nimtrest/blob/master/parser.nim#L199-L221
04:20:02xcodz-dothttps://play.nim-lang.org/#ix=48dt
04:20:49FromDiscord<Elegantbeef> you need to make `Argument` generic
04:20:55FromDiscord<Elegantbeef> Since `PositionalArg` is generic
04:21:09FromDiscord<Elegantbeef> This wont really work though cause generics are not capable of being homogenous
04:21:37FromDiscord<Elegantbeef> https://internet-of-tomohiro.netlify.app/nim/faq.en.html#coding-how-to-store-different-types-in-seqqmark may help you
04:21:45xcodz-dotSo, I think I would just use the strings without converters for now.
04:22:17xcodz-dotAnd instead of generic converters, I would now use a `proc verify(value: string): bool` to verify
04:22:41FromDiscord<Elegantbeef> At that point you may consider inheritance as a solution to arguments
04:23:18xcodz-dotWhat? Inheritance is a thing in Nim? A link to documentation please.
04:23:30FromDiscord<Elegantbeef> Refer to the link i sent
04:23:36xcodz-dotk
04:23:46FromDiscord<Elegantbeef> It shows inheritance without methods
04:23:55FromDiscord<Elegantbeef> But yes nim has single parent inheritance and dynamic dispatch
04:24:03FromDiscord<Elegantbeef> Look in the tutorial for `method`
04:24:27FromDiscord<Elegantbeef> Not that anyone asked but i really hate CLI parsers, i always feel like they dont solve the solution elegantly
04:24:41FromDiscord<Elegantbeef> solve the problem 😄
04:24:52xcodz-dotI have already swept through that. Never really got the idea but now I do.
04:25:05FromDiscord<huantian> they don't have enough beef for elegance
04:25:26xcodz-dotWell, cli has been a hate point for me as a Python dev. But given how GUI condition is, I wont complaint
04:25:30xcodz-dotcomplain*
04:25:34FromDiscord<Elegantbeef> I dont know they always either seem to be just calling functions or lack the flexibility to just load directly into a config
04:26:48xcodz-dotWell, see ya next week if I manage to get a running parser. This is a good opportunity to farm some github stars. Never really got those
04:27:02FromDiscord<Elegantbeef> Oddly i have a couple
04:27:17xcodz-dotHow long have ya been on github?
04:27:20FromDiscord<Elegantbeef> It's odd cause i dont get many issues, which makes me think no one actually uses the software
04:27:30FromDiscord<Elegantbeef> A few years now
04:27:40xcodz-dotThat has been well how I started out.
04:28:05FromDiscord<leorize> dunno if it helps, but this is how I structured my cli\: https://github.com/nim-works/nimskull/blob/837238f3cbebb6d52be6c328624f6f5598b44788/tools/release_manifest.nim#L308-L574
04:28:12FromDiscord<leorize> not a library though, manual parsing for the most part
04:29:13FromDiscord<Sabena Sema> something to be said for the getopt style approach
04:29:36FromDiscord<Sabena Sema> In reply to @xcodz-dot "Well, cli has been": python's gtk binding is extremely good btw
04:29:40FromDiscord<Elegantbeef> Dont know if it's just me but the whole table solution for command parser is lackluster, if i'm loading a config i just want an object 😄
04:29:46FromDiscord<Sabena Sema> I have used it "in anger" (for stuff I was paid for)'
04:29:47FromDiscord<Sabena Sema> (edit) "for)'" => "for)"
04:30:25FromDiscord<Sabena Sema> I really don't love the stuff like rust's clap that requires defining stuff beforehand
04:30:36xcodz-dotI have infact written a lil bit of libAdwaita/Gtk4 app in Python.
04:30:42FromDiscord<Sabena Sema> clap has a more "as you go" api too though (it's not great...)
04:31:04xcodz-dotAre you guys talking about clap from `rust`?
04:31:08FromDiscord<Sabena Sema> In reply to @xcodz-dot "I have infact written": yeah I used it back in gtk3, it really is quite nice in any lang that supports composite widget templates
04:31:12FromDiscord<Sabena Sema> which python does
04:31:13FromDiscord<Elegantbeef> I really like my idea above, but there are some sharp edges that need worked on
04:31:21FromDiscord<Elegantbeef> Luckily it's not a suggested to use library
04:31:45xcodz-dotclap from rust or clap from python? Which one?
04:31:51FromDiscord<Sabena Sema> rust
04:32:01FromDiscord<Sabena Sema> idk about pyton argparsing, I just use argparse
04:32:06FromDiscord<Sabena Sema> (edit) "pyton" => "python"
04:32:19FromDiscord<Sabena Sema> and in C and C++ I usually use either gflags or getopt_long
04:32:35xcodz-dotRust is horrible. I never got rust code to compile on first try, even a simple helloworld program.
04:32:46xcodz-dotIts a opinion, take it lightly
04:32:48FromDiscord<Sabena Sema> yeah, I find rust does a ton of asinine stuff
04:32:58FromDiscord<Sabena Sema> and the syntax appears to take all the bad parts of C++
04:33:12FromDiscord<Sabena Sema> except I guess the whole < and << could be a binary operator or a bracket
04:33:14FromDiscord<Elegantbeef> This isnt a rust real time chat xcodz no one is going to flame you for insulting rust
04:33:31FromDiscord<Sabena Sema> I keep bouncing off rust
04:33:41FromDiscord<Sabena Sema> but their standard library is _extremely_ high quality
04:33:42FromDiscord<Elegantbeef> Rust has many nice things, but i really dislike the package it's in
04:33:48FromDiscord<Sabena Sema> yes
04:33:52xcodz-dotIts precautionary, I see that people seem to like rust and a lot of people are multilingual here.
04:34:35FromDiscord<Sabena Sema> it inherits a lot of cultural baggage from C++ that imo nim is very, very good at discarding, despite nim being much closer to C++ semantically than rust
04:34:52FromDiscord<Sabena Sema> like namespaces and people just qual::ify::ing::every::thing
04:35:10xcodz-dotNim really has a great learning curve, hasn't it? Even with lesser documentation about nim than rust. It barely took me a week when I wrote neural networks from scratch in nim
04:35:25FromDiscord<Sabena Sema> yeah, you get off the ground really fast
04:35:46FromDiscord<Elegantbeef> I love the idea of traits, but oh boy do i hate that `derive` 😄
04:35:59FromDiscord<Sabena Sema> rust has some nice stuff though, like no type based aliasing (nim presumably inherits Cs rules here)
04:36:13FromDiscord<Sabena Sema> yeah derive is annoying
04:36:17FromDiscord<Sabena Sema> and the orphan rule is asinine
04:36:43FromDiscord<creikey> In reply to @Elegantbeef "I love the idea": Yeah and it's needed everywhere. Rust has so much noise to me, very messy syntax and way of doing things
04:36:45FromDiscord<Elegantbeef> I think if concepts were ensured you only accessed what you declared it'd be so much nicer than traits
04:37:03FromDiscord<Sabena Sema> proc macros are nice to have, but nim's macro system is essentially equivalent from a compiler impl perspective and probably much, much faster
04:37:18FromDiscord<Elegantbeef> Cause then you dont have to explicitly say "Hey this is has trait X" you just call something that takes trait X and it works
04:37:20FromDiscord<Sabena Sema> In reply to @Elegantbeef "I think if concepts": isn't that the idea of new style concepts
04:37:25FromDiscord<Sabena Sema> still, though, old style can be useful
04:37:29FromDiscord<Elegantbeef> Well they're not checked at runtime
04:37:35FromDiscord<Sabena Sema> like "Hashable" is difficult to write in rust
04:37:35FromDiscord<Elegantbeef> i mean at instantiation
04:37:38FromDiscord<Sabena Sema> I think
04:37:55FromDiscord<Sabena Sema> I though the idea of new concepts was to allow checking at definition
04:38:01FromDiscord<Elegantbeef> No clue if concepts will be checked at call site, but it'd be nice
04:38:05xcodz-dotRust has an issue with its productivity. Its hard to read as well as to write.
04:38:12FromDiscord<Sabena Sema> old style concepts are checked at instanciation
04:38:13FromDiscord<Elegantbeef> declaration is what i mean to say
04:38:15FromDiscord<Elegantbeef> Jesus i cannot type today
04:38:17FromDiscord<Sabena Sema> (edit) "instanciation" => "instantiation"
04:38:23xcodz-dotThe error handling in rust is worst of all
04:38:32FromDiscord<Sabena Sema> In reply to @xcodz-dot "Rust has an issue": yeah, and it feels less flexible stylistically
04:38:34FromDiscord<Rika> Huh really
04:38:44FromDiscord<Sabena Sema> like everyone involved has always followed some draconian c++ style guide
04:38:56FromDiscord<Elegantbeef> Exception handling is best error handling, change my mind
04:39:05FromDiscord<Sabena Sema> yeah the error handling situation is not great
04:39:05FromDiscord<creikey> In reply to @xcodz-dot "Rust has an issue": Sometime I think about if I spent another couple years with rust along with the year I've already done, I would be just as fast as I am in other languages
04:39:06FromDiscord<Rika> In reply to @Sabena Sema "yeah, and it feels": There’s a good amount of people who would say that that is a benefit
04:39:16FromDiscord<Sabena Sema> In reply to @Rika "There’s a good amount": they are wrong 😄
04:39:34FromDiscord<Rika> I’d say so too but I don’t have any good arguments for why they are wrong lol
04:39:34FromDiscord<creikey> In reply to @Elegantbeef "Exception handling is best": I don't know how to change your mind other than to say it makes the path of execution confusing for me
04:39:35FromDiscord<Sabena Sema> you can use different styles depending on what you want the reader to notivce
04:39:36FromDiscord<Sabena Sema> (edit) "notivce" => "notice"
04:39:58FromDiscord<Sabena Sema> also in rust people end up using anyhow which is just exceptions but worse
04:40:08FromDiscord<Sabena Sema> personally I really like quirky exceptions, I think they are neat
04:40:11FromDiscord<Rika> In reply to @creikey "Sometime I think about": Are you sure?
04:40:32FromDiscord<Sabena Sema> I honestly feel more productive in C
04:40:34FromDiscord<Elegantbeef> Eh criekey i personally find myself using raises on procedures and then the flow is very simple(not in async)
04:40:38FromDiscord<Sabena Sema> although I surely write more memory bugs 😄
04:40:56xcodz-dotI sure know that I am not touching C for a while.
04:40:56FromDiscord<Rika> In reply to @Elegantbeef "Eh criekey i": If you start to deal with async please fix everything for us
04:40:59FromDiscord<Rika> Shits hell over there
04:40:59FromDiscord<Sabena Sema> also: I really like Ada's exception handling
04:41:09FromDiscord<Rika> It’s like a gimped version of Nim
04:41:09FromDiscord<Sabena Sema> it's much much much simpler than what C++ does
04:41:23FromDiscord<Sabena Sema> I like C
04:41:27xcodz-dotAnd, yeah, Do not even get me started on rust compile times
04:41:30FromDiscord<Sabena Sema> as long as I can use clang or gcc
04:41:30FromDiscord<Elegantbeef> I really like the tracked exception raising Nim has and the fact you can just say "We have no exceptions here" 😄
04:42:01FromDiscord<Rika> Just remove defects and we’re pretty much golden
04:42:02FromDiscord<Sabena Sema> C with attribute((cleanup)), VLAs, and statement expressions (and maybe GCC's cursed lambda extension) is pretty usable
04:42:11FromDiscord<Sabena Sema> anyway I gotta go
04:42:11xcodz-dot*Enters MSVC*
04:42:38FromDiscord<Sabena Sema> yeah, I've been banging the gong with the msvc frontend folks to implement VLAs
04:42:39FromDiscord<Elegantbeef> I dont know what one replaces defects with after removing
04:42:41FromDiscord<Elegantbeef> Just an `assert` 😄
04:42:48xcodz-dotwell, aren't defects catchable?
04:42:52FromDiscord<Elegantbeef> No
04:42:57FromDiscord<Rika> Technically
04:42:57FromDiscord<Elegantbeef> in some dialects they are
04:43:20xcodz-dotThen there is something wrong because I am actually able to catch IndexDefects.
04:43:20FromDiscord<Rika> They’re not tracked like other exceptions are
04:43:22FromDiscord<Elegantbeef> you can play with the `--panics` to make them catchable
04:43:28FromDiscord<Rika> So you don’t get the nice raises stuff
04:43:33FromDiscord<Elegantbeef> Debug allows you to catch them
04:43:37FromDiscord<Elegantbeef> Which is a silly thing
04:43:47*wallabra quit (Ping timeout: 268 seconds)
04:43:50FromDiscord<Elegantbeef> But `-d:release` with stock settings you will not catch defects
04:43:55xcodz-dotNo, not really. It is great to be able to catch defects at debug time.
04:44:08FromDiscord<Rika> What why
04:44:15xcodz-dotmaybe, I never really tried
04:44:15FromDiscord<creikey> In reply to @Rika "Are you sure?": No
04:44:21FromDiscord<Elegantbeef> Ah yes my program runs fine in debug, but when i run release it crashes
04:44:34FromDiscord<Elegantbeef> That sentence should never be that way
04:44:37FromDiscord<creikey> In reply to @Elegantbeef "I really like the": Yeah I like this
04:45:01FromDiscord<Sabena Sema> wait what's a defect
04:45:03FromDiscord<creikey> In reply to @Rika "Shits hell over there": Honestly now that I know how async works it's not so bad
04:45:08xcodz-dotFun fact, this is what happened with me when using nim-argparse. I use release mode and the output is blank on windows. I use release mode on linux, it works. I use debug on both it works.
04:45:12FromDiscord<creikey> You gotta watch that talk from the guy who wrote nim in action
04:45:16FromDiscord<Rika> In reply to @creikey "Honestly now that I": That’s not what I mean
04:45:21FromDiscord<creikey> And then understand how function callbacks works
04:45:26FromDiscord<Elegantbeef> A defect is considered a logical error that is raised when you do something wrong
04:45:29FromDiscord<creikey> Anonymous function callbacks
04:45:30FromDiscord<Rika> There’s a good amount of Nim features that you don’t have on async
04:45:40*wallabra joined #nim
04:45:40FromDiscord<creikey> In reply to @Rika "There’s a good amount": Oh interesting never encountered these yet
04:45:43FromDiscord<Rika> Mainly related to exceptions
04:45:44FromDiscord<Elegantbeef> sent a code paste, see https://play.nim-lang.org/#ix=48dB
04:45:44FromDiscord<Elegantbeef> That will raise a `RaiseDefect`
04:45:46FromDiscord<Rika> You have
04:45:54FromDiscord<Sabena Sema> In reply to @Elegantbeef "A defect is considered": oh, it's a debug assert basically
04:45:56FromDiscord<Rika> In reply to @Elegantbeef "That will raise a": Range
04:45:57FromDiscord<Elegantbeef> They're not meant to be caught but are meant to signify a logical issue
04:45:58FromDiscord<Rika> Range defect
04:46:00FromDiscord<Sabena Sema> but one you might want to keep on in prod
04:46:06FromDiscord<Elegantbeef> Yea sorry i'm a dumb dumb rika
04:46:22FromDiscord<Rika> Happens to all of us, just more often with you it seems xd
04:46:23FromDiscord<Sabena Sema> do they just abort or do they unwind (or just generate a stack trace)
04:46:25FromDiscord<Elegantbeef> I actually did some programming today so really melted my brain it seems
04:46:34FromDiscord<Sabena Sema> I guess in prod you might not be able to get a good stack trace
04:46:38FromDiscord<creikey> In reply to @Rika "You have": Oh I was just doing something wrong
04:46:40FromDiscord<Elegantbeef> Defects close the program
04:46:44FromDiscord<flywind> https://github.com/nim-lang/Nim/issues/6639 {.async.} doesn't work with {.raises:[].}
04:46:49FromDiscord<Elegantbeef> They're considered a bug
04:47:00FromDiscord<Sabena Sema> is failing to allocate a defect?
04:47:03FromDiscord<Sabena Sema> that's the real question
04:47:10FromDiscord<Sabena Sema> imo it should be on desktop systems
04:47:13FromDiscord<Rika> Not really, isn’t that a signal?
04:47:22FromDiscord<Elegantbeef> You're generally fucked 😄
04:47:31FromDiscord<Sabena Sema> well, malloc can return null on linux if you ask for a huge quantity of memory
04:47:52FromDiscord<Sabena Sema> on windows it just returns null, windows won't overcommit (annoyingly)
04:48:05FromDiscord<Sabena Sema> but if you're _ACTUALLY_ OOM just handling errors from malloc is not sufficient
04:48:07FromDiscord<Sabena Sema> at least on linux
04:48:23FromDiscord<Sabena Sema> since you could hit the stack guard page and allocate memory that way
04:48:29FromDiscord<Sabena Sema> which just kills the process
04:48:39FromDiscord<Sabena Sema> or, it generates a segfault that's very hard to handle
04:48:52xcodz-dotWindows really needs some sort of standardized package manager that handles dependencies. Like really, microsoft needs to do that.
04:48:59FromDiscord<Rika> Well you don’t really have a way to gracefully exit from those
04:49:00FromDiscord<Sabena Sema> vcpkg
04:49:02FromDiscord<Sabena Sema> it's vcpkg
04:49:02xcodz-dotC dependencies are painful
04:49:10xcodz-dotreally?
04:49:27xcodz-dotvcpkg is a thing? But does it work with gcc mingw?
04:49:31FromDiscord<Sabena Sema> yes
04:49:43FromDiscord<Sabena Sema> though not all packages do
04:50:10FromDiscord<Sabena Sema> and the whole "building debug and release" thing is asinine for mingw, since libstdc++ is compatible in debug and release
04:50:26FromDiscord<Sabena Sema> msys2 packages are usually higher quality / more working for mingw
04:50:46FromDiscord<Sabena Sema> actually IMHO you should never build debug mode in msvc
04:50:48FromDiscord<Sabena Sema> basically
04:50:51xcodz-dotdoes msys2 integerate with nim?
04:50:55FromDiscord<Sabena Sema> sure
04:51:03FromDiscord<Sabena Sema> nim can use the gcc from msys21
04:51:04FromDiscord<Sabena Sema> (edit) "msys21" => "msys2"
04:51:19xcodz-dotand do the dependencies installed with msys2 work with nim?
04:51:30FromDiscord<Sabena Sema> the cygwin environment (msys2, as opposed to ucrt64) is not officially supported, but I think you can acutally get nim to link to cygwin
04:51:34FromDiscord<Sabena Sema> syre
04:51:38FromDiscord<Sabena Sema> nim just loads them
04:51:57FromDiscord<Sabena Sema> you can bootstrap nim as you would on a linux system from a msys2 ucrt64 shell and things work fine
04:52:05xcodz-dothmm, is there a plugin for vscode to integrate with Msys2 console?
04:52:13FromDiscord<Sabena Sema> well, most things, some stuff assumes msvcrt, but that needs fixing
04:52:20FromDiscord<Sabena Sema> In reply to @xcodz-dot "hmm, is there a": don't need one
04:52:26xcodz-dotHow?
04:52:36FromDiscord<Sabena Sema> you can set the console to use bash, you might want to start through msys2
04:52:48FromDiscord<Sabena Sema> you can just launch code.exe from msys2 bash
04:52:51FromDiscord<Sabena Sema> and everything is there
04:53:14FromDiscord<Sabena Sema> you can set the shell to bash too if you want that
04:53:25FromDiscord<Sabena Sema> but you can also run the mingw tools from powershell OK
04:53:27xcodz-dotWill get right away to install msys2, I am dumb for having installed mingw manually.
04:54:11FromDiscord<Sabena Sema> msys2 _is_ the modern mingw (there are others, like STL's mingw is up to date I think)
04:54:26FromDiscord<Sabena Sema> but the old mingw32 download is like 15 years old and cursed
04:54:31FromDiscord<Sabena Sema> also msys2 has the ucrt64 env
04:54:38FromDiscord<Sabena Sema> which uses the ucrt instead of msvcrt
04:54:39xcodz-dotidk about C really. I just installed mingw earlier for Rust and now for nim.
04:54:45FromDiscord<Sabena Sema> msvcrt is the crt from Visual C++ 6.0
04:54:57xcodz-dotrt means Runtime?
04:55:04FromDiscord<Sabena Sema> it's libc
04:55:13xcodz-dotthat is the C runtime?
04:55:20FromDiscord<Sabena Sema> yeah
04:55:26FromDiscord<Sabena Sema> it's not part of the core system on windows
04:55:38FromDiscord<Sabena Sema> (although the ucrt and msvcrt are shipped inside windows)
04:56:12xcodz-dotthat is great. I think I will zone out for a while as I work with moving my system to use msys2 instead.
05:18:18*xcodz-dot quit (Quit: Leaving)
05:38:02FromDiscord<leorize> you should never use the builtin msvcrt, though
05:38:18FromDiscord<leorize> the ABI is unstable and you can't link with anything that's made with msvc
05:38:58FromDiscord<leorize> typically the deal with mingw/msys is that you want to debug and develop on mingw but release your software compiled with msvc
05:59:39FromDiscord<4zv4l> I just saw this
05:59:41FromDiscord<4zv4l> https://media.discordapp.net/attachments/371759389889003532/1010790276220080188/unknown.png
05:59:47FromDiscord<4zv4l> it's possible to achieve the same without macros right ?
06:00:13FromDiscord<Elegantbeef> Everything macros do you can write manually if that's what you mean
06:00:15FromDiscord<4zv4l> it says it's nice because it's ran at compile time but I don't get why he needs macro for that
06:00:31FromDiscord<Elegantbeef> You can use a compile time procedure for that example
06:00:45FromDiscord<4zv4l> compile time procedure ? how ?
06:02:04FromDiscord<Elegantbeef> sent a code paste, see https://play.nim-lang.org/#ix=48dQ
06:02:07FromDiscord<Elegantbeef> Lol that's dumb
06:02:11FromDiscord<Elegantbeef> `toSeq` on a seq
06:02:20FromDiscord<Elegantbeef> Fuck I'm scared of the code quality i'm making
06:03:30FromDiscord<4zv4l> oh so const variable are made at compile time
06:03:35FromDiscord<Elegantbeef> Yes
06:03:58FromDiscord<4zv4l> if I want an immutable variable but at runtime them I have to use `let` right ?
06:04:05FromDiscord<Elegantbeef> Correct
06:04:15FromDiscord<4zv4l> thanks ^^
06:13:57*kenran joined #nim
06:17:21FromDiscord<j-james> are there any other file extensions for nim code aside from `.nim` and `.nimble`?
06:17:35FromDiscord<Elegantbeef> `.nims`
06:17:51FromDiscord<Elegantbeef> `.nim.cfg` occasionally
06:26:39FromDiscord<j-james> ty 👍
06:33:27FromDiscord<bun> update on 'yet another rogue clone': you can loop around now! https://media.discordapp.net/attachments/371759389889003532/1010798770507755520/Screen_Recording_2022-08-21_at_2.31.37_AM.mov
06:34:00FromDiscord<Elegantbeef> Nice rogue didnt have wrapping so you're atleast 30 years ahead
06:34:00*xcodz-dot joined #nim
06:34:04*xcodz-dot quit (Quit: Leaving)
06:34:07FromDiscord<bun> the future in now
06:34:13FromDiscord<bun> (edit) "in" => "is"
06:38:05FromDiscord<Elegantbeef> If you get tilesets you'll be in the super feature
06:40:03*genpaku quit (Remote host closed the connection)
06:40:43*genpaku joined #nim
06:41:01FromDiscord<j-james> do any tree-sitter "tree queries" (syntax highlighting stuff) exist for nim?
06:41:07FromDiscord<j-james> a la https://tree-sitter.github.io/tree-sitter/syntax-highlighting#queries
06:41:09*kenran quit (Ping timeout: 256 seconds)
07:11:50FromDiscord<4zv4l> is there a kind of `pause` like windows batch in Nim ?
07:11:53FromDiscord<4zv4l> because for now I use this
07:12:05FromDiscord<4zv4l> not sure if that's the best way
07:12:07FromDiscord<4zv4l> sent a code paste, see https://play.nim-lang.org/#ix=48e7
07:12:33FromDiscord<4zv4l> because when I share my cli program to friends well they don't open a terminal to run the program so it closes directly when the program ends
07:26:27FromDiscord<Prestige> In reply to @apropos "do any tree-sitter "tree": Nope
07:26:36FromDiscord<Prestige> It's been deemed too difficult
07:29:34FromDiscord<leorize> I actually found one on github the other day
07:29:52FromDiscord<Prestige> Doesn't work afaik
07:30:00FromDiscord<leorize> https://github.com/aMOPel/tree-sitter-nim
07:30:27FromDiscord<leorize> but it's possible to write one given enough time, just that no one is attempting one full-time yet
07:30:35FromDiscord<j-james> In reply to @Avahe "It's been deemed too": not the grammars, but raw queries
07:31:08FromDiscord<leorize> you need to write a grammar to generate the concrete syntax tree that you can query from
07:31:47FromDiscord<leorize> you can't use the nim parser for this, because tree sitter parser is a totally different type of parser
07:34:21FromDiscord<j-james> oh interesting
07:34:56FromDiscord<Prestige> I don't think it's possible to write a grammar for it to be honest, you would have to hook directly into the nim compiler I think
07:35:16FromDiscord<leorize> eh, nim is not an eldritch horror to parse \:p
07:36:08FromDiscord<leorize> a concrete syntax tree is just the file as it is written translated into a tree
07:36:49FromDiscord<leorize> nim have a kind of abnf(?) grammar defined in the manual, and you can absolutely create a parser from just that
07:37:24FromDiscord<leorize> off-side rule needs a bit of special support, but since a tree-sitter python grammar exist, so could one be written for nim
07:40:05*Vladar joined #nim
07:42:26*kenran joined #nim
07:49:30FromDiscord<Prestige> Doubt it without using or basically rewriting the compiler
07:49:39FromDiscord<Prestige> But you're welcome to try
07:51:49FromDiscord<Elegantbeef> If you're after semantic highlighting you will need the compilers semantic analysis
07:51:58FromDiscord<Elegantbeef> But otherwise you can just highlight using a grammar
07:55:20*krux02 joined #nim
07:57:29FromDiscord<Elegantbeef> I dont know why Nim would be any more complicated than Rust, Zig, or Odin
07:58:38FromDiscord<Elegantbeef> well within reason
08:14:19FromDiscord<Phil> TFW you want to give "nimview" a try but you can't find the proper package name for pacman to install the libwebkit2gtk4 package (as it is called on apt)
08:19:33*wallabra_ joined #nim
08:19:33FromDiscord<leorize> it's simply webkitgtk iirc
08:19:47*wallabra quit (Ping timeout: 248 seconds)
08:21:27FromDiscord<leorize> you gotta use `newAsyncHttpClient`
08:21:39*wallabra_ is now known as wallabra
08:21:58FromDiscord<Phil> Isn't that package dead as a doornail?
08:22:07FromDiscord<Bennyelg (Benny Elgazar)> thanks!
08:22:23FromDiscord<Elegantbeef> You also need to close the client after you're done using it
08:22:39FromDiscord<Sabena Sema> In reply to @leorize "the ABI is unstable": msvcrt has a stable ABI, we have not updated it since 1998, so its stable
08:23:09FromDiscord<Phil> Or am I mixing that up with another asynchttpclient package? I recall looking at a package of somebody else recently that made use of asynchttpclient and that hasn't been maintained in 6 years
08:23:22FromDiscord<leorize> eh, oldnewthing blog said it's whatever the windows team needed↵(@Sabena Sema)
08:23:40FromDiscord<enthus1ast> @Phil\: prolly asyncftp
08:24:21FromDiscord<Phil> Also no webkitgtk in the default repos, there is AUR stuff, but there's like 6 different packages and none of them are the devel kind that nimview wants
08:24:39FromDiscord<leorize> webkit2gtk is what it is called↵(@Phil)
08:24:56FromDiscord<Bennyelg (Benny Elgazar)> anyone knows how I mimic the python asyncio.gather([List Of tasks?])
08:24:59FromDiscord<leorize> you can search with `pacman -Ss`
08:25:16FromDiscord<leorize> asyncfutures.all seems to be what you want
08:25:30FromDiscord<Phil> In reply to @leorize "webkit2gtk is what it": Ahhh there we go, yeah that found it
08:26:13FromDiscord<Phil> I google with webkit2gtk4 the entire time and never found anything >_>↵Package names are painful sometimes
08:26:33FromDiscord<leorize> try smaller pieces next time \:p
08:26:37FromDiscord<Phil> In reply to @leorize "you can search with": TIme to alias that because there's no way I'll recall that flag in 5 minutes
08:27:05*krux02 quit (Quit: Leaving)
08:27:20FromDiscord<leorize> btw, you can also use the `pacman -Fs` feature if you know the file name and want to find a package providing it
08:30:43FromDiscord<Bennyelg (Benny Elgazar)> thanks!
09:02:00FromDiscord<Bung> anyone use `memlib` , when i call maped proc I got `C:\Users\crc32\.nimble\pkgs\memlib-1.2.0\memlib.nim(1029) CreateCoreWebView2EnvironmentWithOptions↵SIGSEGV: Illegal storage access. (Attempt to read from nil?)`
09:05:27FromDiscord<enthus1ast> could be that ↵ sym\: LPCSTR↵↵is nil
09:07:11FromDiscord<enthus1ast> maybe the procname is mangled, since c++?
09:08:21FromDiscord<Bung> no c++ , pure nim project
09:08:39FromDiscord<enthus1ast> this ist from webview CreateCoreWebView2EnvironmentWithOptions
09:08:43FromDiscord<enthus1ast> right?
09:08:47FromDiscord<Bung> `var h = wv.environmentCompletedHandler()↵ let r1 = CreateCoreWebView2EnvironmentWithOptions("", dataPath, NULL, h.addr)`
09:09:15FromDiscord<Bung> problem passing proc ?
09:10:00FromDiscord<Bung> it's in WebView2Loader.dll
09:10:27FromDiscord<Bung> I've also maped GetAvailableCoreWebView2BrowserVersionString works find
09:10:32FromDiscord<Bung> (edit) "find" => "fine"
09:10:36FromDiscord<enthus1ast> my guess was that maybe since i thought its c++ that the name of the proc is not CreateCoreWebView2EnvironmentWithOptions but CreateCoreWebView2EnvironmentWithOptions\_someMangledStuff
09:10:40FromDiscord<enthus1ast> but yeah \:)
09:11:38FromDiscord<Bung> I've use dllexp check the dll exports, name is exactly CreateCoreWebView2EnvironmentWithOptions
09:17:01*kenran quit (Quit: WeeChat info:version)
09:20:09FromDiscord<Ras> In reply to @Isofruit "TIme to alias that": yep...
09:20:12FromDiscord<Ras> https://media.discordapp.net/attachments/371759389889003532/1010840734854815795/unknown.png
09:21:03madpropsbeen re-inventing bookmarks https://i.imgur.com/JksRhlG.gif
09:21:08madpropsnot nim, but a firefox addon
09:23:37FromDiscord<Phil> I just played around a bit with nimview.↵So basically it creates a JS object that sends requests to the backend (I assume HTTP requests), where you basically define a bunch of callbacks to execute on being called.↵↵It's... kinda just like writing a single-page webapplication but the server is local.
09:23:59FromDiscord<Phil> And you don't have to care about various things such as "login", "authentication" etc.
09:24:39*wallabra_ joined #nim
09:24:57*wallabra quit (Ping timeout: 244 seconds)
09:25:03FromDiscord<Phil> The more I think about it, the more I start believing that this is basically how tauri operates
09:26:37*wallabra_ is now known as wallabra
09:29:32madpropstauri gtk web view, what even is that. it was broken in some ways, didn't like it
09:29:36madpropstuari uses*
09:30:05FromDiscord<Bung> js <-> nim interop is not through http, I dont deep look nimview, but other webview just use map obj map proc at compile time ,and pass arguments as json
09:30:12madpropsi've been thinking of distributing web apps just be placing the files in /opt and make it open with the browser
09:30:42FromDiscord<Bung> that's already done by some nim projects
09:31:47FromDiscord<Bung> I think the improvment direction is making webview2 binding, that's what am currently doing
09:31:53FromDiscord<Phil> Just checked, nimview definitely does it through HTTP, in dev mode you can just start the server up and have it rendered by any browser
09:32:34FromDiscord<Phil> That's building after the example provided https://media.discordapp.net/attachments/371759389889003532/1010843846940315648/unknown.png
09:33:17FromDiscord<Phil> It sends a POST request for interaction containing the name of the proc to fire and the params to fire it with
09:33:34FromDiscord<Bung> that's weird , since it can use hook call it directly
09:33:53FromDiscord<Phil> If there are other projects to work with webview and a nim backend I'm open to looking at them
09:34:30*wallabra_ joined #nim
09:34:59FromDiscord<Bung> you can check https://github.com/juancarlospaco/webgui and https://github.com/bung87/crowngui
09:35:07*wallabra quit (Ping timeout: 256 seconds)
09:35:52FromDiscord<Phil> While waiting for moigagoo to give me feedback on norm and with the full release of the stable diffusion AI for image generation fast approaching I've been wanting to learn a bit about webview and doing """native""" apps with them before I go from there to trying the same with straight up using gnome
09:35:54FromDiscord<Bung> mine goal is rewrite with managable nim code and some improvements
09:35:57FromDiscord<Phil> (edit) "gnome" => "gtk"
09:36:25FromDiscord<Bung> also with building tools
09:36:46*wallabra_ is now known as wallabra
09:37:25FromDiscord<Bung> I've fullly rewrite macos part code to pure nim
09:37:53FromDiscord<Phil> first things first, what's the webgui approach?
09:38:52FromDiscord<Phil> I'm seeing a lot of screenshots on the github but not if the idea is "you get a JS object that sends calls to the backend" or "Your nim code will get compiled to js and it all runs on node" or somesuch
09:38:57FromDiscord<Bung> in short term, it's single header webview's binding with builtin themes
09:40:04FromDiscord<Bung> it means the webview can be url, string of html content, js file path, or nim file path
09:40:21FromDiscord<Bung> when it is nim file path it will compile to js first
09:40:38FromDiscord<Bung> (edit) "it means the webview ... can" added " entry"
09:42:11FromDiscord<Phil> Does it still have the (apparently standard? I've seen this architecture multiple times now) general idea of "JS+HTML+CSS Frontend, backend in another language"?↵So there is a "server" component that does the potentially computation heavy stuff or stuff like storing files on the PC etc?
09:42:15*wallabra_ joined #nim
09:43:02*wallabra quit (Ping timeout: 244 seconds)
09:43:15FromDiscord<Bung> the original webview c project does not have server , so does webgui
09:43:17FromDiscord<Phil> Basically, I haven't written anything with webview before, I'm approaching this from a bog standard webdev perspective and trying to find the analogies
09:44:04FromDiscord<Bung> https://github.com/bung87/crowngui can have server, but bundle file in exe , so there's no file access
09:44:06FromDiscord<Phil> And I've roughly understood how Electron and Tauri work, which both appear to subscribe to a "There's a frontend and the backend is node/rust)
09:44:09FromDiscord<Phil> (edit) "node/rust)" => "node/rust""
09:44:24FromDiscord<Phil> (edit) "And I've roughly understood how Electron and Tauri work, which both appear to subscribe to a "There's a ... frontend" added "webview"
09:44:42*wallabra_ is now known as wallabra
09:49:54FromDiscord<Phil> Ohhh wait, might be it only does HTTP when not compiling releases:↵> This project uses Webview to render Desktop applications and an integrated HttpServer for Development and Cloud. It doesn't use the latest version, as the latest version stopped working with file urls.
09:49:57FromDiscord<Phil> (nimview I mean)
09:51:11FromDiscord<Bung> oh , so it is for debugging easier
09:53:43FromDiscord<Phil> Still, what I'm getting out of this is:↵Write your frontend with a JS Framework as an SPA.↵For compiling, compile your frontend, copy paste it to the resources folder of your nimview project, then compile nimview
09:54:15FromDiscord<djazz> I wish the wxWidgets bindings were better for Nim. Then you could use that to make a main menu bar and modern webview
09:55:06FromDiscord<djazz> Tried to generate bindings for latest wx, but couldn’t do it. Too much C++ stuff not easy to translate
09:56:07*wallabra_ joined #nim
09:56:51*wallabra quit (Ping timeout: 248 seconds)
09:58:15*wallabra_ is now known as wallabra
09:59:15FromDiscord<Bung> In reply to @Isofruit "Still, what I'm getting": this is basic feature these kind of frameworks have
10:01:02FromDiscord<Phil> I'm mostly trying to wrap my head around how to use them at all, not really evaluating their feature richness, I'm not at the level yet where I can actually comprehend that.↵I'm trying to get proficient at basic usage first basically 😛
10:02:48FromDiscord<Bung> I have two basic web based gui app, you can check them out https://github.com/bung87/crown_excel https://github.com/bung87/gamode
10:18:59*PMunch joined #nim
10:25:29FromDiscord<Phil> Before I invest time into that, how high are my chances of getting that to work with a frontend written in Angular?
10:26:40FromDiscord<Bung> I think the most work is on Angular based web side
10:27:22FromDiscord<Phil> ~~Because in nimview that is proving to be a pain due to how the package does not provide typing for typescript~~
10:28:09FromDiscord<Bung> I've use number of this kind of frameworks , even very tiny project does this well
10:29:09FromDiscord<Bung> first you will need compile your web that the platform web engine supported
10:29:14FromDiscord<Phil> In reply to @Bung "I've use number of": Could you rephrase that sentence, I'm not entirely sure what you mean
10:30:26FromDiscord<Bung> most web based gui framework can bundle your web assets as well.
10:31:09FromDiscord<Phil> Ah, the bundling is not the problem, the problem might be that if there is a JS component that must be imported, than that import can proove to be a massive pain
10:31:39FromDiscord<Phil> E.g. nimview:↵Wants you to use a JS object through which you call your backend - In Angular that is a problem because the package has some kind of issue
10:32:15NimEventerNew question by dromologue: Can&#39;t evaluate at compile time - NIM, see https://stackoverflow.com/questions/73433576/cant-evaluate-at-compile-time-nim
10:33:51FromDiscord<Bung> in webgui there's bindProc
10:34:37FromDiscord<Bung> like this https://github.com/bung87/gamode/blob/8eb5cdaeff9900b5909d2105bdd17488c098a6ca/src/gamode.nim#L166
10:36:51FromDiscord<Bung> am not sure this is what you asking for
11:05:11*wallabra_ joined #nim
11:06:21*wallabra quit (Ping timeout: 256 seconds)
11:07:16*wallabra_ is now known as wallabra
11:12:04*kenran joined #nim
11:47:45*toluene quit (Read error: Connection reset by peer)
11:47:54*toluene joined #nim
11:53:01FromDiscord<Phil> sent a long message, see http://ix.io/48f0
11:53:22FromDiscord<4zv4l> I try to make a nim program that fetch `getnews.tech` but it doesn't work↵but with `curl` it does work↵any idea how I could do ?
11:54:08FromDiscord<Phil> code or it didn't happen xP
11:54:35FromDiscord<4zv4l> it says 404 not found but with curl it works
11:54:53FromDiscord<4zv4l> sent a code paste, see https://play.nim-lang.org/#ix=48f2
11:55:12FromDiscord<4zv4l> sent a code paste, see https://play.nim-lang.org/#ix=48f3
11:55:39FromDiscord<Phil> I mean, the browser reacts fundamentally identical in that it throws a 404, not sure what curl downloads
11:56:26FromDiscord<Phil> Could you show your curl command?
11:56:53FromDiscord<Phil> My first idea is that either they're not both targetting the same URL or curl also returns 404 but in a non obvious way
11:57:45FromDiscord<4zv4l> `curl http://getnews.tech`
11:57:54FromDiscord<4zv4l> did you try with curl ?
12:00:51FromDiscord<Phil> Fascianting. The url does not work on a browser, nor with nim's client
12:00:55FromDiscord<Phil> only curl
12:01:18FromDiscord<Phil> There's no JS that gets executed, best I can guess is that they somehow figure out as part of the request if it was sent via curl?
12:01:40FromDiscord<Bung> In reply to @Isofruit "My understanding is that": it's like when you bind procs, you will have a object have methods on js and nim side
12:02:18FromDiscord<4zv4l> because then except making a bash script which I dont want to↵I can't find how to make it work xD
12:02:40FromDiscord<Phil> In reply to @4zv4l "because then except making": Call curl from nim
12:03:00FromDiscord<4zv4l> is there an easy way to do it ?
12:03:08FromDiscord<4zv4l> haven't check how to call system program yet
12:03:31FromDiscord<Phil> In reply to @Bung "it's like when you": So it will generate an object that will have the methods and if you call the function in that JS object it will send a message with what's needed to the nim backend where the pre-defined nim proc as native binary code gets executed?
12:03:43FromDiscord<Phil> In reply to @4zv4l "haven't check how to": Should be pretty straightforward, iirc it was the os module, one sec
12:04:49FromDiscord<Bung> it does not send message , it is under web engine hook
12:05:03FromDiscord<fredrikhr> Something has happened, suddenly lots of people are starring my nimble package... Should I be worried? 🤔
12:05:56FromDiscord<fredrikhr> (especially since I haven't touched it for 3 years... :D)
12:05:57FromDiscord<Phil> sent a code paste, see https://play.nim-lang.org/#ix=48f6
12:06:33FromDiscord<Phil> In reply to @Bung "it does not send": So the nim code gets compiled into JS code that has the entire functionality.↵When your JS code calls code on that object, it is still JS code that gets executed and nothing else?
12:07:04FromDiscord<Phil> I have no concept of web engine hooks so I'm struggling here
12:07:27FromDiscord<Phil> Like what bits are JS, what bits are not JS, where is the transition if there is one, how does that transition look like
12:07:33FromDiscord<Bung> when you say copmiled to js , it's webgui feature, it treats as normal js assets
12:07:46FromDiscord<Phil> Okay, so basically the entire program is 100% JS
12:09:08FromDiscord<Bung> it's another topic, like some developers dont prefer write in nim then compile to js , so they dont write js as web assets
12:09:21FromDiscord<Bung> (edit) removed "dont"
12:09:50FromDiscord<Phil> I have no such hindrances. If I write code where JS is involved I just write typescript
12:09:59FromDiscord<Phil> In that case my question is why I'm using nim for anything
12:10:26FromDiscord<Bung> so your repo on github will show 100% nim code
12:11:34FromDiscord<Phil> Like, nimviews draw is that you can use JS for the simple stuff and offload anything non-graphical to nim-code which runs faster since its compiled into a binary
12:12:01FromDiscord<Phil> (edit) "non-graphical" => "non-GUI"
12:12:30FromDiscord<Phil> For example, stable diffusion ai will soon go open, I'd like to make it a nice little sideproject to make a GUI over it where you can locally generate as many images from your prompt as you want
12:13:22FromDiscord<Phil> So I'd want a JS/HTML/CSS frontend that at one point sends a "generateImage" call to my backend, which then triggers the AI through whatever pathways will be available, stores the image on the drive and tells the frontend which paths the files are under
12:13:43FromDiscord<Phil> So that the frontend then can display the generated images.
12:14:06FromDiscord<Phil> I'd prefer not to deal with interacting with that AI code through nim compiled to JS
12:14:08FromDiscord<Bung> yeah, you can do hard work on nim side , show gui progress on web
12:14:38FromDiscord<Phil> But that nim-side is still being turned into JS code, no?
12:15:14FromDiscord<Bung> no, cant do that
12:16:10FromDiscord<Bung> since your nim code will do system level task, your js under web engine woun't let you do on js side
12:16:16FromDiscord<4zv4l> `let repl = if choice == 2: '_' else '+'`↵is there something similar in nim ?
12:16:39FromDiscord<Phil> Okay, so there is a nim-server and your webview which is powered by your OS webengine HTML/JS/CSS!
12:16:51FromDiscord<Phil> So then there must be some sort of messaging between that server and the webengine!
12:16:52PMunch@4zv4l, what do you mean, you can do exactly that in Nim already?
12:17:06PMunchWell, you need a colon after the else but apart from that your code is valid Nim
12:17:11*jmdaemon quit (Ping timeout: 256 seconds)
12:17:24FromDiscord<Bung> that's not the conclusion, you can still have local file html,js ,css
12:17:42FromDiscord<Bung> does not need http server actually
12:18:08NimEventerNew post on r/nim by themoregames: Efficient 2D graphics on GPU with a tiling atlas texture ("Pixie"), see https://reddit.com/r/nim/comments/wty7u1/efficient_2d_graphics_on_gpu_with_a_tiling_atlas/
12:18:20FromDiscord<Phil> I'm not saying that the nim-server is the thing that serves the HTML/JS/CSS files or an HTTP server, I'm saying there's a separate thread, process, whatever that is doing system-level stuff
12:18:42FromDiscord<Phil> I'm calling it server because a bunch of applications I've seen call this second thread that isn't the frontend the "Backend"
12:18:51FromDiscord<4zv4l> In reply to @PMunch "<@329196212282458112>, what do you": oooh yes right my bad xD
12:19:11FromDiscord<Phil> In reply to @fredrikhr "Something has happened, suddenly": Which one 😛 ?
12:19:57FromDiscord<Phil> Like, theres one process that is the frontend aka the webview where your HTML/CSS/JS is and then there's a second process which is where your nim code is and the two must communicate somehow
12:20:03FromDiscord<Bung> okay, I get your point, still you can do all your task in single thread, but js executing is controled under web engine, it will use another thread
12:20:18FromDiscord<fredrikhr> @Phil https://github.com/fredrikhr/nim-importc-helpers
12:21:07FromDiscord<fredrikhr> foxoman, mratsim, planetis-m and elcritch all starred it in the last 48 hours 😄
12:21:37FromDiscord<Bung> no, that's not. all you need care about is your task is heavy or not
12:22:18FromDiscord<Bung> your nim code runs on main ui thread , so if you task is heavy you may need another thread do your task
12:22:21FromDiscord<Phil> In reply to @Bung "okay, I get your": Is the default way of crowngui having 2 threads or does crowngui do it all in 1 thread that is basically the webengine executing a bunch of code (I have to assume that a webengine only executes JS and WASM, I'm not aware of anything else they do other than maybe parse HTML/CSS but I think there's separate things for that)
12:23:04FromDiscord<Bung> crowngui and webgui dont do this way
12:23:29FromDiscord<Bung> https://github.com/bung87/gamode/blob/8eb5cdaeff9900b5909d2105bdd17488c098a6ca/src/gamode.nim#L130 you can check here
12:24:15FromDiscord<Bung> my task do system management task , so it's heavy , I create thread and use channel to do the task
12:24:45FromDiscord<Bung> otherwise you'll block main ui thread
12:25:58FromDiscord<Bung> eg. under windows your gui app main proc will have loop receive system message
12:27:36FromDiscord<Phil> I read, but I do not understand. For the most part I do not understand what the scope of the webview is and who does what.↵I think I'll play around a bit more with nimview and see if I can get the import working
12:27:47FromDiscord<Bung> you better have sub thread do the real task since it's gui app, you dont want user get stucked
12:29:31FromDiscord<Phil> Like, I understand the principles that you have your UI and whatever heavy task you want to do on separate threads to avoid making the UI non-responsive.↵AFAIK that's why even Electron has 2 threads, one for the backend one for the frontend.↵But I'm not understanding the communication
12:30:34FromDiscord<Phil> Like in nimview the order of operations is fairly straightforward
12:33:27FromDiscord<Phil> sent a long message, see http://ix.io/48fa
12:33:50FromDiscord<Phil> (edit) "http://ix.io/48fa" => "http://ix.io/48fb"
12:34:49FromDiscord<Phil> (edit) "http://ix.io/48fb" => "http://ix.io/48fc"
12:35:14FromDiscord<Phil> (edit) "http://ix.io/48fc" => "http://ix.io/48fd"
12:35:42FromDiscord<Bung> it can be more simpler, do you know android js bridge
12:36:52FromDiscord<Phil> I don't, I have never coded for android
12:38:02FromDiscord<Bung> like you write object on native side, and export it to web engine, window.xx.proc() will do the work
12:38:48FromDiscord<Phil> What does "exporting an object to web engine" mean
12:39:20FromDiscord<Phil> Is that basically running code as WASM?↵Is that compiling code to JS so that it runs on a web engine?
12:39:31FromDiscord<Phil> In my head web engine means JS engine
12:39:43FromDiscord<Phil> JS and WASM engine
12:40:35FromDiscord<Phil> Or are we talking java webengine which is a class?
12:40:45FromDiscord<Bung> like webengine.inject(yourJsBridgeObj)
12:41:41FromDiscord<Phil> That looks like java
12:41:55FromDiscord<Phil> So https://html.duckduckgo.com/html/ ?
12:42:04FromDiscord<Phil> (edit) "https://html.duckduckgo.com/html/" => "https://docs.oracle.com/javase/8/javafx/api/javafx/scene/web/WebEngine.html"
12:43:26FromDiscord<Bung> yeah, same theory
12:44:41FromDiscord<Phil> ... you know what, I just give up, I don't get it and I think I'm fundamentally missing one thing, the larger context of what you're trying to explain to me on how things work just keeps escaping me and we've been at this for easily 2-3 hours now.
12:45:50FromDiscord<Bung> maybe you just need try some framework and develope a simple app.
12:50:11FromDiscord<Phil> Possibly, I'll see, time to make a first draft
13:08:08NimEventerNew thread by EnteryName: Fidget and its alternatives, see https://forum.nim-lang.org/t/9396
13:08:50*Vladar quit (Quit: Leaving)
13:24:01*kenran quit (Quit: WeeChat info:version)
13:36:21PMunchHmm, what would be a nice Nim abstraction for interrupts
13:38:56FromDiscord<auxym> you mean for ISRs? Not sure, in ARM world, in C, it is common that default ISRs are defined as weak functions that do nothing, which you can then easily re-define. Not sure what the best way would be to implement something similar
13:39:17FromDiscord<aruZeta> sent a code paste, see https://play.nim-lang.org/#ix=48fn
13:39:30FromDiscord<aruZeta> (edit) "https://play.nim-lang.org/#ix=48fn" => "https://play.nim-lang.org/#ix=48fo"
13:39:31FromDiscord<auxym> like "just define a func with this name and signature and it will be magically triggered by an interrupt"
13:40:11FromDiscord<aruZeta> sent a code paste, see https://play.nim-lang.org/#ix=48fp
13:41:54FromDiscord<Rika> Not that way, no
13:42:30FromDiscord<auxym> In reply to @auxym "like "just define a": maybe some sort of template or macro that defines the proc for you but then also modifies the correct entry in the vector table?
13:42:33PMunch@auxym, yeah I'm thinking interrupts for microcontrollers
13:43:05PMunchYeah I know how it's done in C, but is that the best way of doing it?
13:43:44FromDiscord<auxym> yeah. I meant to clarify, abstractions for enabling or disabling or clearing or setting interrupt priority should be pretty straightforward. but setting handlers could be tricky
13:43:47PMunchBasically they have a procedure somewhere that just gets called by the interrupt if it is enabled
13:44:22FromDiscord<auxym> yeah, its a function pointer at some fixed position in memory calle the vector table, at least in ARM
13:44:27PMunchI was considering to write something like `registerInterrupt` that takes an interrupt and a procedure and registers it
13:44:39PMunchYeah same thing for AVR
13:44:40FromDiscord<aruZeta> In reply to @Rika "Not that way, no": so no way then, maybe with a template tho
13:44:50FromDiscord<aruZeta> (edit) "template" => "template/macro"
13:45:04PMunchThe question is just, would that even be possible?
13:45:51PMunchWell, it would be possible if the function in the interrupt table is actually a function which calls whatever function pointer which is stored in a global variable
13:46:07PMunchBut this means that there is a second level of indirection and more overhead
13:46:32FromDiscord<!!sharpcdf!!> `Error: unhandled exception: cannot open: /home/sharpcdf/.jitter/nerve/odin-lang::odin::dev-2022-08/core/odin/printer/ [IOError]` after trying to unzip latest odin-lang/odin release with zippy, any idea why?
13:47:46*arkurious joined #nim
13:48:40PMunchI'll probably end up with just a `interrupt` macro which takes a name and a body
13:58:13FromDiscord<auxym> In reply to @PMunch "Well, it would be": Would it not be possible to modify the function pointer directly in the vector table? Here's an (ARM) example: https://github.com/auxym/nim-on-samd21/blob/master/lib/atmel/samd21a/gcc/gcc/startup_samd21.c#L109
13:58:39FromDiscord<4zv4l> how can I return this `["url1","url2"]` as a sequence ?
13:58:45FromDiscord<4zv4l> and not as array
13:58:47FromDiscord<Rika> @[]
13:58:51FromDiscord<auxym> its const though, I still don't understand C enough to know what this means in this means. can the fields be modified?
13:58:56FromDiscord<Rika> Add the @ before the brackets
13:59:47FromDiscord<aruZeta> `[]` array↵`@[]` seq
14:00:00FromDiscord<aruZeta> (edit) "seq" => "seq↵`{}` set"
14:00:08FromDiscord<aruZeta> (edit) "set" => "set↵`()` tuple"
14:01:00FromDiscord<4zv4l> thaaaaanks↵named is it easy to make a named tuple ?
14:01:19FromDiscord<4zv4l> (edit) "thaaaaanks↵named is" => "thaaaaanks↵is"
14:01:39FromDiscord<aruZeta> what do you mean?
14:01:59FromDiscord<aruZeta> a tuple is like an object, you need to name it's content
14:02:30FromDiscord<Rika> You don’t need to
14:02:56FromDiscord<Rika> (1, 2) is an anonymous tuple
14:02:58FromDiscord<aruZeta> `let myTuple: tuple[a: string, b: string] = (a: "foo", b: "bar")`
14:03:04FromDiscord<aruZeta> In reply to @Rika "(1, 2) is an": ah yh
14:03:10FromDiscord<4zv4l> just then instead of doing↵`tuple[0]` I can do `tuple.url`
14:03:14FromDiscord<Rika> yes
14:03:17FromDiscord<aruZeta> yep
14:03:26FromDiscord<4zv4l> alright thanks !!!
14:03:31FromDiscord<4zv4l> damn that language is amazing xD
14:04:07PMunch@auxym, possible? Maybe, but not easy. The thing is that its really only possible to write to program memory from the boot block in AVR
14:04:24FromDiscord<4zv4l> if you have time to loose↵I'm rewriting this : https://github.com/SaigoNoo/jpscanvf↵in nim here : https://github.com/4zv4l/jpscanvf↵there is one TODO left
14:04:33FromDiscord<auxym> In reply to @auxym "Would it not be": actually @PMunch the ARM core headers have a C function to do just that, set the func pointer (vector) for a giver interrupt: https://github.com/ARM-software/CMSIS_5/blob/develop/CMSIS/Core/Include/core_cm0plus.h#L950
14:04:53FromDiscord<aruZeta> btw, should I use const for some big arrays (like 160 elements) or a let with {.compileTime.}?
14:05:03PMunchMost USB-reprogrammable chips have a bootloader that runs as the first thing, checks for any upload commands, and writes new memory. But from a running program this command doesn't do anything.
14:05:39FromDiscord<auxym> so yeah, I thin `registerInterrupt` would be a fine abstraction over that.
14:06:17PMunchWhat?
14:06:18FromDiscord<aruZeta> In reply to @4zv4l "if you have time": yet another repo with a README not in english so I don't understand shit
14:06:20FromDiscord<Rika> In reply to @aruZeta "btw, should I use": Const will “copy” the value in every usage
14:06:39FromDiscord<aruZeta> In reply to @Rika "Const will “copy” the": it's used a LOT, so I guess better use the pragma
14:06:39FromDiscord<Rika> Let will use memory, may still copy as well depending on usage
14:06:50PMunchThe problem is that only the bootloader can write these interrupts. Ratel doesn't ship its own bootloader
14:07:01PMunchSo I have no way of doing that
14:07:12FromDiscord<4zv4l> In reply to @aruZeta "yet another repo with": mine is in English tho xD↵google trad is here also xD
14:07:23FromDiscord<Rika> In reply to @aruZeta "yet another repo with": Looks like a manga site ripper
14:07:27FromDiscord<aruZeta> yh
14:07:43FromDiscord<Rika> In reply to @4zv4l "mine is in English": The English of traducion is translation
14:08:49FromDiscord<auxym> In reply to @PMunch "The problem is that": the vector table can be modified at runtime though, no? at least that's what the SetVector thing seems to be doing
14:09:22FromDiscord<auxym> so a user could just register the ISR at any time
14:09:47PMunch@auxym, not in AVR
14:09:54FromDiscord<auxym> ah
14:11:05FromDiscord<auxym> then I don't see a way to do it at runtime, but at compile time maybe a template or macro that `exportC`s a proc with the correct C name to shadow the weak C func?
14:13:11FromDiscord<aruZeta> In reply to @Rika "Const will “copy” the": but a question I have is, when the const value is copied to every location where I used and the program is run, won't the copied array be put in memory to get the index I requested? I don't actually know how it works
14:13:27FromDiscord<Rika> Constants don’t exist past compile time
14:13:37FromDiscord<aruZeta> yh I get that
14:13:43FromDiscord<Rika> It will look like you copied the value into the areas manually
14:14:00FromDiscord<Rika> Of course whatever memory implications those have applied to constants too
14:14:09FromDiscord<Rika> (edit) "applied" => "apply"
14:14:26FromDiscord<aruZeta> sent a code paste, see https://play.nim-lang.org/#ix=48fI
14:14:42FromDiscord<aruZeta> right
14:14:44FromDiscord<aruZeta> (edit) "right" => "right?"
14:14:45FromDiscord<aruZeta> sent a code paste, see https://play.nim-lang.org/#ix=48fJ
14:14:53FromDiscord<Rika> Yeah
14:15:08FromDiscord<aruZeta> so then, to get the index of that array, that array will be put in memory
14:15:23FromDiscord<Rika> Yes, I did say that in some roundabout way
14:15:55FromDiscord<aruZeta> so then if I use that const let's say 100 times, it would be better for it to be put in there once and not 100 times
14:16:39FromDiscord<Rika> I’m not sure about the compiler and it’s optimisations but it might just do that if you use a const
14:16:55FromDiscord<aruZeta> hmm
14:16:55FromDiscord<Rika> Perhaps it doesn’t though
14:17:05FromDiscord<Rika> As always, it’s best to test
14:17:06*wallabra_ joined #nim
14:18:22FromDiscord<aruZeta> it would be about 2-3KB of memory in total anyway
14:18:27*wallabra quit (Ping timeout: 256 seconds)
14:18:41FromDiscord<auxym> In reply to @auxym "then I don't see": @PMunch an abstraction that only allows compile-time definition of ISRs seems quite reasonable to me. runtime ISR modifications seems like a really niche usecase and if someone really wants that they could just drop out of ratel to a lower level, platform-dependent code.
14:19:08PMunch@auxym, yeah that's what I'm thinking as well
14:19:49FromDiscord<aruZeta> In reply to @Rika "As always, it’s best": And with that,↵`101517 lines; 1.451s; 182.234MiB peakmem`↵Is peakmem what the compiler calculates to be the max memory the program would use if every variable was filled ?
14:20:02FromDiscord<retkid> i need to define a type but in order to define that type another type must exist
14:20:05FromDiscord<aruZeta> (edit) "with" => "about"
14:20:08FromDiscord<retkid> i would like to define them both at the same time
14:20:11FromDiscord<retkid> i forget how to do this
14:20:33FromDiscord<auxym> In reply to @PMunch "<@882793909246369864>, yeah that's what": we do something like that to define "callbacks" for the tinyusb wrapper in picostdlib: https://github.com/EmbeddedNim/picostdlib/blob/master/src/picostdlib/tusb.nim#L677
14:20:41FromDiscord<aruZeta> sent a code paste, see https://play.nim-lang.org/#ix=48fL
14:20:47FromDiscord<aruZeta> like this you mean? @retkid
14:20:56FromDiscord<retkid> yes
14:21:05FromDiscord<retkid> kinda
14:21:06FromDiscord<Rika> In reply to @aruZeta "And about that, `101517": No
14:21:15FromDiscord<Rika> It’s how much memory the compiler used, the peak
14:21:18FromDiscord<retkid> if i can replace A that would be fine
14:21:20FromDiscord<aruZeta> ah lol
14:21:27PMunch@auxym, ooh, I like that called twice guard
14:21:32FromDiscord<aruZeta> any benchmark lib for nim lol?
14:21:41FromDiscord<retkid> theres one in the stdlib
14:21:44PMunchbenchy comes to mind @aruZeta
14:21:46FromDiscord<retkid> alternatively
14:21:47FromDiscord<aruZeta> benchy?
14:21:54PMunchAnd there's stuff in the stdlib as well
14:22:01*wallabra joined #nim
14:22:05FromDiscord<aruZeta> I saw it before used in some pixie line but didn't know it was in std
14:22:15FromDiscord<auxym> In reply to @PMunch "<@882793909246369864>, ooh, I like": credit goes to beef for that one IIRC
14:22:31FromDiscord<retkid> is invalid
14:22:39FromDiscord<retkid> sent a code paste, see https://play.nim-lang.org/#ix=48fM
14:22:44FromDiscord<retkid> i forget how to do this as well
14:23:27FromDiscord<retkid> no
14:23:31FromDiscord<aruZeta> you did not name it
14:23:31FromDiscord<aruZeta> sent a code paste, see https://play.nim-lang.org/#ix=48fN
14:23:31FromDiscord<retkid> as a type
14:23:33*wallabra_ quit (Ping timeout: 256 seconds)
14:23:40FromDiscord<aruZeta> T is a type
14:23:40FromDiscord<retkid> you dont name a static proc type
14:23:58FromDiscord<4zv4l> any idea how I could easily list all folder on a http server ?↵the http server allows to browse the folder so is there any easy way to do that ?
14:24:21FromDiscord<retkid> as in
14:24:26FromDiscord<retkid> sent a code paste, see https://play.nim-lang.org/#ix=48fQ
14:24:44FromDiscord<aruZeta> a paramater being another proc you mean
14:24:52FromDiscord<retkid> uh sure
14:24:56FromDiscord<Rika> Bare proc types cannot be generic
14:25:00FromDiscord<retkid> pain
14:25:01FromDiscord<aruZeta> my bad, didn't understand
14:25:14FromDiscord<retkid> can i alternatively make a bare templte
14:25:21FromDiscord<Rika> ???
14:25:22FromDiscord<retkid> (edit) "templte" => "template"
14:25:34FromDiscord<retkid> i need to define these two types together
14:25:39FromDiscord<retkid> because they are interconnected
14:25:41FromDiscord<Rika> Templates can’t be stored in runtime variables, I’ve never seen anyone do it for const but I bet it wouldn’t work
14:25:53FromDiscord<Rika> Define it in the same block then I don’t get it
14:26:00FromDiscord<retkid> wait
14:26:53FromDiscord<retkid> yea i forgot you can do that
14:26:59FromDiscord<retkid> ありがと
14:27:08FromDiscord<Rika> :widepepe:
14:27:55PMunchHmm, I have a little dilemma with my laptop project. The Teensy 2.0 doesn't have enough IO pins for both the keyboard and the mouse
14:28:02PMunchI wonder if I can multiplex it..
14:28:44PMunchBasically read the mouse when I'm not scanning the keyboard, and if the mouse is moved away from its resting position disable keyboard scanning until it is returned
14:28:59PMunchI might actually try that
14:29:41FromDiscord<Rika> If someone is already typing then tries to move the mouse?
14:29:54FromDiscord<Rika> Just use a shift register if you really need more pins
14:30:04FromDiscord<Rika> Not expensive to add unless you’re mass producing this
14:30:11FromDiscord<Rika> Costs dev time though
14:30:50FromDiscord<Rika> 74HC165 or 164
14:31:18FromDiscord<Rika> Piss common
14:31:29FromDiscord<aruZeta> I have a spare pro micro atmega32u4, would like to make some project with it one day
14:31:41FromDiscord<aruZeta> any cool ideas?
14:34:03FromDiscord<Rika> A keyboard :OMEGALUL:
14:34:12FromDiscord<aruZeta> already have one lol
14:34:17FromDiscord<aruZeta> a crkbd
14:34:21FromDiscord<Rika> Make one more
14:34:26FromDiscord<aruZeta> one moar
14:34:49FromDiscord<aruZeta> In reply to @aruZeta "I have a spare": (funny that I ordered one to replace the one in my keyboard which I fried and 2 arrived, so 1 for free lol)
14:40:11FromDiscord<aruZeta> does `nimble test` search for `test` files under subdirectories in `/test`?
14:40:53*kenran joined #nim
14:46:21NimEventerNew thread by Enjoysmath: Can't get basic example of creating reference objects to work. Compilation errors., see https://forum.nim-lang.org/t/9397
14:49:18FromDiscord<retkid> rate my code
14:49:33FromDiscord<retkid> sent a code paste, see https://play.nim-lang.org/#ix=48fW
14:49:50FromDiscord<aruZeta> rating: -2, no colors
14:50:02FromDiscord<auxym> In reply to @PMunch "Hmm, I have a": You mean you're working on an integrated keyboard/trackpad thing?
14:50:05FromDiscord<retkid> (edit) "https://play.nim-lang.org/#ix=48fW" => "https://play.nim-lang.org/#ix=48fX"
14:50:09FromDiscord<auxym> cool
14:50:09FromDiscord<retkid> fixed
14:50:16FromDiscord<aruZeta> hahaha
14:50:59FromDiscord<retkid> the status ref stuff is a tad sketchy
14:51:15FromDiscord<retkid> i did it because it would be a circular definition if it gave itself
14:51:29FromDiscord<aruZeta> just a question since I have never used inheritance in nim (well maybe to create a defect) but why would one want to `ref object of RootObj` ?
14:51:42FromDiscord<retkid> well
14:51:47FromDiscord<auxym> In reply to @Rika "Just use a shift": or an i2c/spi IO expander, which IIRC he was already using in badger, so I'm not sure I understand the issue
14:51:53FromDiscord<retkid> you need a root to start from
14:52:05FromDiscord<retkid> you can do inheriatance by changing rootObj to something
14:52:10FromDiscord<retkid> pretty sure
14:52:23FromDiscord<retkid> this stuff is relatively typed and stuff, but it would make sense for a game
14:52:29FromDiscord<retkid> which is what this system is referencing
14:53:04FromDiscord<retkid> i did it to prove i could probably code the combat system to his favorite game in an afternoon.
14:53:17FromDiscord<retkid> which doesn't actually say much
14:54:04FromDiscord<dom96> your types should start with a capital letter
14:54:16FromDiscord<dom96> also only space after the `:`
14:54:29FromDiscord<retkid> I am the master of my own formatting
14:54:52FromDiscord<dom96> and your indentation is so inconsistent 🙈
14:55:10FromDiscord<aruZeta> sent a code paste, see https://play.nim-lang.org/#ix=48g0
14:55:20FromDiscord<Rika> In reply to @auxym "or an i2c/spi IO": Sure but those are more expensive. Much easier to use though
14:55:51FromDiscord<retkid> In reply to @aruZeta "why `bleed` has `a:": Because that's how you instanciate types in him
14:56:03FromDiscord<aruZeta> In reply to @aruZeta "why `bleed` has `a:": `ref object`'s params can be changed without it being a var
14:56:07FromDiscord<retkid> Oh that
14:56:16FromDiscord<retkid> Because otherwise it wouldn't be mutable
14:56:27FromDiscord<retkid> And I need to reduce the hp
14:56:33FromDiscord<aruZeta> it is mutable
14:56:44FromDiscord<dom96> `ref`s are always mutable
14:56:48FromDiscord<aruZeta> sent a code paste, see https://play.nim-lang.org/#ix=48g1
14:56:49FromDiscord<retkid> Til
14:56:54FromDiscord<retkid> Wait
14:57:10FromDiscord<retkid> Ah
14:57:15FromDiscord<retkid> I didn't know that
14:57:28FromDiscord<aruZeta> you only need a type to be `var` (mutable) when it is a `object`, not `ref object`
14:57:45FromDiscord<Rika> In reply to @dom96 "`ref`s are always mutable": Until strict functions
14:57:51FromDiscord<aruZeta> since a `ref object` stores the reference to that object's location in the heap
14:58:01FromDiscord<retkid> I kinda got that
14:58:13FromDiscord<retkid> Thanks for the clarification though
14:58:19FromDiscord<aruZeta> np :)
15:00:12*CyberTailor quit (Remote host closed the connection)
15:13:08NimEventerNew question by Philipp Doerner: How do I use nimview together with Angular?, see https://stackoverflow.com/questions/73435668/how-do-i-use-nimview-together-with-angular
15:13:57FromDiscord<Phil> No need to answer, I answered it myself already
15:14:03FromDiscord<Phil> Figured out the solution earlier
15:16:14PMunch@auxym, I'm working on an eInk laptop, so I need to integrate the trackpoint and keyboard of the case I'm using
15:19:12FromDiscord<Bung> is there something I should notice when pass object to dll's proc on windows ? I got nil access , but echo repr shows not nil
15:24:43*kenran quit (Quit: WeeChat info:version)
15:25:21*kenran joined #nim
15:25:31*kenran quit (Client Quit)
15:31:06FromDiscord<Rika> In reply to @PMunch "<@882793909246369864>, I'm working on": I’m not sure what combining the two has to do with the e ink part lol
15:41:54FromDiscord<retkid> the trick is not using windows
15:42:01FromDiscord<retkid> that has helped me avoid dll issues
15:44:05FromDiscord<Bung> the project is for windows
15:53:40FromDiscord<Phil> That merely sounds like a challenge!
15:59:35FromDiscord<4zv4l> would that be a good idea to load the whole web server tree and make a search with auto completion on the terminal ? with something like `readline` but that works on both windows and linux ?
15:59:54FromDiscord<4zv4l> or idk if the dude search for an anime but the name doesn't exactly match the folder idk how to handle that
16:02:09FromDiscord<Bung> sounds like devdocs-app but a gui app
16:04:07FromDiscord<4zv4l> `readLineFromStdin` but with auto completion
16:06:35FromDiscord<Rika> Does line noise not work on windows?
16:06:50FromDiscord<Rika> In reply to @4zv4l "or idk if the": Fuzzy search
16:08:24FromDiscord<4zv4l> how can I get fuzzy search on nim ?
16:08:30FromDiscord<4zv4l> https://github.com/genotrance/nimfuzzy is it a good lib for that ?
16:21:53FromDiscord<auxym> looks good
16:54:14FromDiscord<Bung> sent a code paste, see https://play.nim-lang.org/#ix=48gF
16:54:45FromDiscord<Bung> (edit) "https://play.nim-lang.org/#ix=48gF" => "https://play.nim-lang.org/#ix=48gG"
17:04:47*wallabra_ joined #nim
17:05:37*wallabra quit (Ping timeout: 256 seconds)
17:07:08*wallabra_ is now known as wallabra
17:14:37*wallabra_ joined #nim
17:14:56*wallabra quit (Remote host closed the connection)
17:16:54*wallabra_ is now known as wallabra
17:17:24FromDiscord<Forest> How do i build the Nim compiler with koch? Cloned from source with tag v1.6.6
17:17:53FromDiscord<Forest> `./koch boot` gives this: `not all cases are covered; missing: {mm}`
17:17:56FromDiscord<Forest> Then says failure
17:18:21FromDiscord<Forest> The compiler version i have installed system-wide is `1.7.1`
17:19:29FromDiscord<Forest> I haven't modified anything yet either
17:21:37FromDiscord<aruZeta> sent a code paste, see https://play.nim-lang.org/#ix=48gN
17:22:49FromDiscord<huantian> Hm you should just be able to run build-all.sh or whatever it’s called
17:24:46FromDiscord<Forest> Ah
17:25:07FromDiscord<Forest> I want a way to build the compiler fast tbh since I'm doing many small modifications
18:03:11FromDiscord<Forest> What's Nim `jsonscript`?
18:11:27FromDiscord<yrashk> I am curious, `concepts` being experimental, is there any expectation that they'll be overhauled significantly in the future?
18:23:56*derpydoo joined #nim
18:24:54FromDiscord<Phil> Not to my knowledge, Elegantbeef may know more, but from what I've noticed it's unlikely.↵They're afaik closer the "release" bit than the "experimental" bit
18:44:44FromDiscord<dom96> from what I know they are in fact being overhauled
18:45:14FromDiscord<dom96> https://github.com/nim-lang/RFCs/issues/168
18:49:39FromDiscord<Phil> Wasn't that more refinement than changing principles?
18:49:56FromDiscord<Phil> Like, the last activity from beef looks like handling edge-cases
18:50:27FromDiscord<dom96> it's changing completely how concepts are written
18:50:47FromDiscord<Phil> Ohhhh wait, as in that's the redesign being discussed and that's not yet implemented
18:59:33FromDiscord<Phil> could've sworn that had already been done,welp
19:20:21FromDiscord<Forest> Before i recreate the wheel... Is there any library that like, takes the Nim AST and spits it out in an easy to read way?
19:21:08FromDiscord<treeform> In reply to @Forest "Before i recreate the": dumpTree?
19:21:15FromDiscord<treeform> https://nim-lang.org/docs/macros.html#dumpTree.m%2Cuntyped
19:21:56FromDiscord<Forest> Yeah thanks
19:22:15FromDiscord<Forest> Wonder how easily i could use that instead of forking Nim because honestly i hate that lmao
19:24:40*jmdaemon joined #nim
19:30:19FromDiscord<Phil> ... has anyone figured out how to get a look at messages when there's an error in the JS a webview is supposed to run on Linux?
19:46:20PMunch@Rika, well it's a laptop, so it needs a keyboard and a mouse integrated. But if I just said I was creating my own laptop I'd get questions like "why don't you just buy one, like literally everyone else", that's why I was qualifying with eInk :P
19:46:42FromDiscord<EyeCon> Does someone know of an XID implementation in Nim? A quick search revealed nothing. The XID is a time-sortable kind of nonce used as ID, designed to be generated independently with minimal risk of collusion, like Snowflake: https://github.com/rs/xid
19:47:18FromDiscord<EyeCon> (edit) "XID" => "xid"
19:51:42PMunchThere are OIDS which are also mentioned to be extracted from MongoDB and is 12 bytes
19:51:43*PMunch quit (Quit: leaving)
19:54:12FromDiscord<EyeCon> That would have been my second choice, is there a Nim implementation you know of?
19:55:00FromDiscord<EyeCon> If not, I will implement that since it's so easy
20:14:50FromDiscord<Bung> still have no idea why this https://github.com/bung87/webview2/blob/d51e6bba84aef345be8447a4e2ba9f317e437ad6/src/webview2/browser.nim#L52 cause `C:\Users\crc32\.nimble\pkgs\memlib-1.2.0\memlib.nim(1029) CreateCoreWebView2EnvironmentWithOptions↵SIGSEGV: Illegal storage access. (Attempt to read from nil?)`
20:36:12FromDiscord<EyeCon> In reply to @EyeCon "If not, I will": https://github.com/EyeCon/mongoobjectid
20:36:34FromDiscord<EyeCon> I hope there are no glaring mistakes, I'm open to suggestions
20:39:22FromDiscord<Forest> Is there a way to go through all nodes in a Nim file?
20:39:40FromDiscord<Forest> I don't really understand how I'm supposed to do that with the macro library lol
20:39:46FromDiscord<Forest> Unless I'm looking in the wrong place
20:41:00FromDiscord<EyeCon> Do you really want to iterate all nodes in a file? Most macros take a tiny piece of code
20:41:23FromDiscord<Forest> In reply to @EyeCon "Do you really want": Yeah, I'm doing it to generate a representation of a Nim file in JSON
20:41:52FromDiscord<EyeCon> Understood, interesting, I'd like to see the result of that
20:42:36FromDiscord<Forest> I was originally gonna modify the Nim JS backend but I can't understand it so.... Time to do cursed stuff that people will curse me for aha
20:46:16FromDiscord<Bung> parseStmt does not fit your needs?
20:46:46FromDiscord<Forest> In reply to @Bung "parseStmt does not fit": Can that parse entire Nim files and give me a completed AST?
20:46:48FromDiscord<Forest> Tree
20:47:16FromDiscord<Forest> Hm... Reading that rn
20:47:29FromDiscord<Bung> Compiles the passed string to its AST representation. Expects one or more statements.
20:47:53FromDiscord<Forest> That looks really useful actually
20:47:58FromDiscord<Forest> Thanks for pointing it out!
20:49:31FromDiscord<Forest> Where can i find all of NimNode's properties? Will it be in PNimNode (or whatever it's called)
20:53:00FromDiscord<Bung> it's documented in first section
20:53:09FromDiscord<amadan> In reply to @EyeCon "I hope there are": Any reason you used std/random instead of std/sysrand?
20:56:32FromDiscord<Forest> In reply to @Bung "it's documented in first": Ah okay
20:57:02FromDiscord<Forest> Also I can't figure out how to actually use parseStmt? Just throws compile time errors but i don't know how to use the code at compile time aha
20:57:13FromDiscord<Forest> Also it'd be better if i could use it at runtime
20:57:19FromDiscord<Forest> ...maybe NimScript could save me
20:58:43FromDiscord<Bung> you can use staticRead
20:59:39NimEventerNew thread by Bung: Use memlib call dll proc face nil access, see https://forum.nim-lang.org/t/9398
21:02:06FromDiscord<Forest> Oh?
21:02:28FromDiscord<Forest> Slurp lmao
21:02:38FromDiscord<Forest> Oh sweet that's amazing
21:07:48FromDiscord<EyeCon> In reply to @amadan "Any reason you used": That I forgot about it 🙂
21:08:12FromDiscord<EyeCon> And the OID's random numbers can be pseudorandom anyway, it's not supposed to be a CSPRNG
21:27:21FromDiscord<Forest> For some reason I can't echo the NimNode without getting `invalid node kind nnkStmtList for macros.×$×`
21:27:31FromDiscord<Forest> Replacing ` with × because discord formatting
21:27:53FromDiscord<Elegantbeef> `echo myNode.repr` or `echo myNode.treeRepr`
21:27:58FromDiscord<EyeCon> I think \\ works as an escape character: \`
21:28:08FromDiscord<Forest> In reply to @EyeCon "I think \\ works": Not in code blocks
21:28:15FromDiscord<Forest> In reply to @Elegantbeef "`echo myNode.repr` or `echo": Oh that makes sense lmao
21:33:38FromDiscord<Forest> I feel like doing this at compile time will impact my goals because this is meant to be a program users can run on any nim file
21:34:16FromDiscord<Bung> then use readFile
21:34:37FromDiscord<Elegantbeef> I mean you're attempting to reimplement the Nim compiler
21:35:34FromDiscord<Forest> All i need is to get an AST tree that i can iterate through, can that not be done with NimScript? Why would it be a bad idea?
21:36:14FromDiscord<Elegantbeef> Nimscript isnt capable of everything Nim is
21:36:37FromDiscord<Forest> It isn't capable of providing me a workable AST tree?
21:36:49FromDiscord<Forest> So i could use that within my Nim program
21:36:54FromDiscord<Elegantbeef> I mean if you use any part that isnt supported in nimscript it'll error
21:37:25FromDiscord<Forest> Hm
21:37:40FromDiscord<Elegantbeef> Either forking the compiler or using it as a library is the sane thing to do
21:37:42FromDiscord<Forest> Is there a list of what isn't supported?
21:38:04FromDiscord<Elegantbeef> It's a subset of Nim there isnt a complete list of what's not supported
21:38:17FromDiscord<Bung> there's list it supported
21:38:45FromDiscord<Forest> In reply to @Elegantbeef "Either forking the compiler": I don't know how to use it as a library tbh, it isn't easy to understand Nim or Cyo's core code, that's my issue lmao
21:38:59FromDiscord<Forest> I just want the Nim AST from a file that the user passes to me
21:39:01FromDiscord<Elegantbeef> A small list is↵● Many casts are disallowed↵● Closures do not work↵● Anything that requires importC does not work
21:39:39FromDiscord<EyeCon> @ElegantBeef I'm trying to understand how I can implement some Matrix endpoints in your new and very elegant way, but I couldn't completely understand what happens in the `createRequest` as it is a bit too macro-ey for me. Could you point me to the part where the requested output tuple is constructed? Does it get the values automagically from the response JSON? What happens if the requested values are too deep in the response?
21:40:00*derpydoo quit (Quit: derpydoo)
21:40:25FromDiscord<Elegantbeef> The output tuple is just a tuple generated by the output block of your code
21:40:53FromDiscord<Forest> In reply to @Elegantbeef "A small list is": That isn't really an issue to me, only thing i really need is the syntax and the core libraries such as `tables`, which I'm sure can be polyfilled
21:41:24FromDiscord<Elegantbeef> Well then use the compiler as a library and replicate what it's `main` does
21:41:24FromDiscord<EyeCon> In reply to @Elegantbeef "The output tuple is": But I'm looking at, say, `login` and I fail to see where it constructs the output. Specifically, where it parses the JSON to find the values
21:41:32FromDiscord<EyeCon> Am I missing something big here?
21:41:59*adium quit (Ping timeout: 252 seconds)
21:42:15FromDiscord<Elegantbeef> Have you done `--expandMacro:createRequest`?
21:42:24FromDiscord<Forest> Main.nim in `compiler`?
21:42:32FromDiscord<Elegantbeef> https://github.com/tandy-1000/matrix-nim-sdk/blob/v1.3/src/matrix/utils/endgen.nim#L177 it's right here though
21:42:51FromDiscord<Elegantbeef> Yes main.nim
21:43:37FromDiscord<Forest> Aight, thanks!
21:43:51FromDiscord<Elegantbeef> That an main.nim
21:43:55FromDiscord<Elegantbeef> nim.nim i mean
21:44:00FromDiscord<EyeCon> In reply to @Elegantbeef "Have you done `--expandMacro:createRequest`?": Is it a switch of the Nim compiler? Let me check
21:44:12FromDiscord<Elegantbeef> Yes it is↵(@EyeCon)
21:44:29FromDiscord<Elegantbeef> eyecon in the case of `login` it doesnt generate a tuple
21:44:47FromDiscord<Elegantbeef> Sorry i mean logout
21:45:22FromDiscord<EyeCon> But it does in the case of login, right?
21:45:37FromDiscord<Elegantbeef> for login it generates a `type LoginReqData = (userData, accessToken, deviceId: string, wellKnown: Option[DiscoveryInfo])`
21:45:39FromDiscord<Elegantbeef> Indeed
21:46:07FromDiscord<Forest> In reply to @Elegantbeef "nim.nim i mean": Aight
21:46:16FromDiscord<Elegantbeef> If the output is a type it Needs a responsehandler
21:46:17FromDiscord<Elegantbeef> Otherwise it creates a tuple and parses to it
21:46:18FromDiscord<EyeCon> In reply to @Elegantbeef "https://github.com/tandy-1000/matrix-nim-sdk/blob/v": I found that, but what I couldn't find is where it assigns the response data to the result
21:46:28FromDiscord<Elegantbeef> It does it right there
21:46:41FromDiscord<Elegantbeef> `res` is result in genast
21:46:50FromDiscord<Elegantbeef> I didnt use `result` as i didnt want to overload the macro logic
21:47:11FromDiscord<Elegantbeef> `result = a` inside genast may be misconstrued for assigning the result of the macro
21:47:32FromDiscord<Elegantbeef> `res = ident"result"` is a genast parameter
21:48:26FromDiscord<Forest> I don't understand what i should be looking at ngl
21:48:37FromDiscord<Forest> Reading `mainCommand` of main.nim rn lmao
21:48:40FromDiscord<Elegantbeef> Well i'm not going to write it for you
21:49:12FromDiscord<Elegantbeef> You need to use the nim compiler as a library and get it to compile the code to AST then you take that module graph and can do whatever you want with it instead of outputting the backend
21:49:25FromDiscord<Forest> In reply to @Elegantbeef "Well i'm not going": Wouldn't expect that at all lmao
21:49:57FromDiscord<Forest> In reply to @Elegantbeef "You need to use": Ohhhh that makes sense
21:50:25FromDiscord<EyeCon> In reply to @Elegantbeef "`res` is result in": This is becoming an XY problem because I know so little about macros, so let me ask my original question: let's say the server responds with a huge JSON. Can I use your macro to write an endpoint which returns a single, possibly deeply nested value in the response?
21:50:25*toluene quit (Ping timeout: 252 seconds)
21:50:52FromDiscord<Elegantbeef> If the json parser can handle it of course
21:51:40FromDiscord<Elegantbeef> the macro just emits a procedure which sends a request to the end point then does `result = response.body.fromJson(typeof(result))`
21:52:07FromDiscord<Elegantbeef> Atleast if you make it generate a type
21:52:16FromDiscord<Elegantbeef> Otherwise you can operate on the response directly and do whatever you want
21:52:18FromDiscord<Elegantbeef> So it should work to solve any problem
21:52:28FromDiscord<EyeCon> But this means that the whole response is parsed in the first case, right?
21:52:40FromDiscord<EyeCon> So I should write a handler to extract the data in my case
21:52:47FromDiscord<Elegantbeef> No clue what parser is used
21:53:19FromDiscord<Elegantbeef> Whether the entire response is parsed is down to what parser is used and what fields match
21:53:31FromDiscord<Elegantbeef> But yea if you need custom logic go for the manual handler
21:53:51FromDiscord<EyeCon> In reply to @Elegantbeef "Whether the entire response": Ah, that was the missing part. The JSON parser ignores the missing parts?
21:54:06FromDiscord<EyeCon> So you construct a tuple with just the bits you're interested in
21:54:10FromDiscord<Elegantbeef> No clue which parser it is so it might
21:54:15FromDiscord<EyeCon> And you try to deserialize from the JSON
21:54:22FromDiscord<EyeCon> If I understood correctly
21:54:34FromDiscord<Elegantbeef> That's the idea
21:54:36FromDiscord<EyeCon> OK, makes sense, thank you
21:54:43FromDiscord<Elegantbeef> If it doesnt work that way blame the json parser used
21:54:52FromDiscord<EyeCon> In reply to @Elegantbeef "If it doesnt work": Will do
21:55:15FromDiscord<Elegantbeef> Do look at the expanded macro it'll make life a bit easier
21:56:38FromDiscord<EyeCon> I should add the switch to the compiler in my nimble file ideally, right? Standalone doesn't make any sense
21:56:41FromDiscord<EyeCon> Let me try
21:56:52FromDiscord<EyeCon> Ah, I meant config file, not nimble
21:57:05FromDiscord<Elegantbeef> I mean it's just for testing so yea you can just use it through the cli
21:59:18FromDiscord<!&luke> How can I have a webserver that can run in the background
21:59:26FromDiscord<!&luke> With something like prologue
21:59:36FromDiscord<EyeCon> Wait, where does it "dump" to?
21:59:47FromDiscord<Elegantbeef> The terminal
21:59:48FromDiscord<EyeCon> I added `switch("expandMacro", "createRequest")` into the config.nims file
22:00:16FromDiscord<!&luke> In reply to @ripluke "With something like prologue": I want to have a webserver with my discord bot, so both the bot and the website work
22:00:23FromDiscord<!&luke> In reply to @Elegantbeef "The terminal": What
22:01:02FromDiscord<Bung> just use another thread run your web server
22:01:39FromDiscord<!&luke> In reply to @Bung "just use another thread": Yea but how
22:02:29FromDiscord<Bung> createThread pass your work proc, in your work proc run your server forever
22:02:55FromDiscord<!&luke> Ok
22:09:54FromDiscord<amadan> sent a code paste, see https://play.nim-lang.org/#ix=48hD
22:10:16FromDiscord<amadan> (edit) "https://play.nim-lang.org/#ix=48hD" => "https://play.nim-lang.org/#ix=48hE"
22:14:03NimEventerNew thread by Templatedperson: Nim without libc?, see https://forum.nim-lang.org/t/9399
22:19:37FromDiscord<Forest> Aha... How does `nim.nim` or `main.nim` tell the compiler that "hey! A file has been passed!"
22:21:49FromDiscord<Forest> I've stripped it down a lot but i may of stripped something needed? I don't understand what though
22:22:19FromDiscord<Forest> Hold on
22:22:31FromDiscord<Forest> https://hastebin.com/emibolufev.nim
23:12:15FromDiscord<!&luke> In reply to @amadan "Could also start the": Ok
23:21:05FromDiscord<Bung> https://forum.nim-lang.org/t/9398 anyone help me out?I can't get it out of my head , it costs me hours already
23:26:48*adium joined #nim
23:31:29FromDiscord<Zectbumo> sent a code paste, see https://play.nim-lang.org/#ix=48hP
23:37:23FromDiscord<Elegantbeef> sent a code paste, see https://play.nim-lang.org/#ix=48hQ
23:40:35FromDiscord<Zectbumo> well that's interesting. I swore I just tried that...
23:42:23FromDiscord<Zectbumo> that checks that box. I'm happy to see. As for the second part, I've seen others use the `reallyDoThis()` pattern. Any tips there?
23:44:01FromDiscord<Zectbumo> hmm, maybe use a module eg. `internalModule.verifyName(name)`
23:48:33FromDiscord<Elegantbeef> Dont know what you mean
23:51:52FromDiscord<Zectbumo> sent a code paste, see https://play.nim-lang.org/#ix=48hS
23:52:10FromDiscord<Elegantbeef> This is why Nim has distinct types imo
23:53:45FromDiscord<Zectbumo> oh so I make a `verifyName(name: cleansedName)` or something?
23:54:00FromDiscord<huantian> I usually use impl instead of really 😛
23:54:06FromDiscord<Elegantbeef> sent a code paste, see https://play.nim-lang.org/#ix=48hT
23:54:27FromDiscord<Elegantbeef> I dont know exactly what you're after but i like using distinct for this disambiguation if possible
23:54:46FromDiscord<Zectbumo> yes, I see now. Very nice
23:56:16FromDiscord<Zectbumo> thx, I think that helped rewire my brain a bit
23:56:26*Figworm quit (Quit: Figworm)
23:56:57FromDiscord<Elegantbeef> If you're talking about the distinct type solution, distinct types are amazing when used well
23:57:15FromDiscord<Elegantbeef> Some people avoid them, and those people are what i call wrong
23:57:40FromDiscord<Zectbumo> 😁 yeah the distinct solution is clean