<< 17-11-2022 >>

00:15:51*oprypin quit (Quit: No Ping reply in 180 seconds.)
00:20:30*oprypin joined #nim
00:28:16FromDiscord<voidwalker> so I am trying to make a super basic torrent client. wrote an async proc where the peer messaging happens. I am passing a Peer type object to it with var, so I can write to its fields directly. Problem is, I am getting `'aPeer' is of type <var Peer> which cannot be captured as it would violate memory safety`. How would I get around this ? I don't think there will be any memory safety issues with this design.
00:35:48FromDiscord<Elegantbeef> You can either do the unsafe thing and do `let a = aPee.addr` and use `a` inside your closure or make `Peer` a ref object
00:37:19FromDiscord<Elegantbeef> sent a code paste, see https://play.nim-lang.org/#ix=4g5b
00:40:04FromDiscord<Elegantbeef> in the case it's a ref object you drop the `var`
00:40:43FromDiscord<voidwalker> that's it ? what are the consequences of this ?
00:40:57FromDiscord<Elegantbeef> Consequences of what?
00:41:09FromDiscord<voidwalker> of using ref instead of normal object with var
00:41:21FromDiscord<Elegantbeef> It's heap allocated and a nilable type now
00:41:25FromDiscord<Elegantbeef> But it can safely be captured
00:41:56FromDiscord<Elegantbeef> To explain further `var T` cannot be captured as it's a pointer to any resource which can mean a value on the stack
00:42:59FromDiscord<voidwalker> btw, any such nim libs/programs out there, with high quality code, that I could learn from ? I am talking implementation of network protocols, tracking state and such
00:44:12FromDiscord<Elegantbeef> https://play.nim-lang.org/#ix=4g5c for an example
00:50:41FromDiscord<auxym> In reply to @voidwalker "btw, any such nim": https://github.com/treeform/netty maybe?
00:53:26FromDiscord<voidwalker> hm not exactly what I was thinking of (udp is too low level), but it's good
01:37:58FromDiscord<.tochka> not nil ref by default when
01:38:23FromDiscord<Elegantbeef> Sometime in 2.x
01:40:28FromDiscord<.tochka> jason the time traveler
01:40:40FromDiscord<Elegantbeef> What?
01:40:41FromDiscord<Elegantbeef> Nah there is a 'roadmap
01:41:01FromDiscord<MilesTheFox> Hello!
01:41:29FromDiscord<.tochka> hi
01:42:42FromDiscord<MilesTheFox> Huh, do you know how to encrypt TCP connections in Nim?
01:43:16*derpydoo quit (Ping timeout: 248 seconds)
01:44:11FromDiscord<.tochka> use ssl or something
01:44:38FromDiscord<MilesTheFox> I never tried using SSL in Nim
01:45:42FromDiscord<Elegantbeef> Nim ships with openssl and bindings for it that are used for `net` and `httpclient`
01:46:16FromDiscord<MilesTheFox> Ohh, okayy
01:49:34FromDiscord<Elegantbeef> There is also bearssl which is arguably better
01:49:36FromDiscord<Elegantbeef> Status uses it
01:51:52*wallabra joined #nim
02:03:28*jjido quit (Quit: My laptop has gone to sleep. ZZZzzz…)
02:09:55FromDiscord<aquova> Hello everyone. Is there a way to set some code behind a JS compiler flag? I have a program that I want to be able to both compile into a binary as well as compile and embed as javascript. Since the main function has some file loading code, it can't be used with the javascipt. I wasn't sure if there's anyway to set one function to be used if compiling as javascript, and a different one otherwise (aside from breaking it out into two files,
02:11:07FromDiscord<.tochka> when defined(js): should work?
02:12:30FromDiscord<aquova> that might be what I'm looking for
02:14:32FromDiscord<aquova> Is there a list of those `defined` items somewhere?
02:16:23FromDiscord<MilesTheFox> In reply to @Elegantbeef "There is also bearssl": How to use it?
02:16:57FromDiscord<ringabout> In reply to @aquova "Is there a list": I don't think there is, but it is worth having it documented somewhere.
02:17:13FromDiscord<Elegantbeef> No clue, other than import the bearssl bindings
02:18:24FromDiscord<.tochka> documentation of stuff is certainly lacking with nim 😔
02:19:00FromDiscord<.tochka> eternal wip smh
02:19:08FromDiscord<MilesTheFox> In reply to @.tochka "documentation of stuff is": At least you don't have to suffering with porting your app to Windows
02:19:17FromDiscord<MilesTheFox> (edit) "suffering" => "suffer"
02:20:21*rockcavera joined #nim
02:21:24FromDiscord<.tochka> its rather windows friendly indeed
02:22:27FromDiscord<MilesTheFox> Windows programming is hard
02:22:41FromDiscord<MilesTheFox> Also, uh, how to properly crosscompile to Windows via MinGW?
02:23:08FromDiscord<MilesTheFox> ``-os:windows`` uses default GCC and because of that it can't find Windows headers
02:23:14FromDiscord<Elegantbeef> `-d:mingw`
02:23:18FromDiscord<Meowing Cat> In reply to @MilesTheFox "Windows programming is hard": MacOS is even worse
02:23:20FromDiscord<Meowing Cat> i think
02:23:47FromDiscord<Meowing Cat> In reply to @Elegantbeef "`-d:mingw`": beef i was looking for you
02:23:58FromDiscord<Meowing Cat> are you still a bot?
02:24:23FromDiscord<MilesTheFox> https://media.discordapp.net/attachments/371759389889003532/1042626225966960670/image.png
02:24:40FromDiscord<Elegantbeef> That's what it says on my name tag
02:24:52FromDiscord<MilesTheFox> In reply to @Meowing Cat "MacOS is even worse": Nope
02:25:11FromDiscord<MilesTheFox> NIX(-like) systems are much easier
02:25:37FromDiscord<Meowing Cat> In reply to @MilesTheFox "*NIX(-like) systems are much": iOS?
02:25:43FromDiscord<MilesTheFox> I still can't understand WinSocks2 docs XD
02:25:53FromDiscord<MilesTheFox> In reply to @Meowing Cat "iOS?": A bit hard
02:26:23FromDiscord<.tochka> i mean, winsocks2 are pretty much the same berkeley sockets linux has
02:26:23FromDiscord<MilesTheFox> On Nim I can use anything and it'll work on any OS
02:26:38FromDiscord<.tochka> (edit) "i mean, winsocks2 are pretty much the same berkeley sockets linux ... has" added "too"
02:27:01FromDiscord<.tochka> its just that this ancient api is rather whacky
02:27:02FromDiscord<MilesTheFox> In reply to @.tochka "i mean, winsocks2 are": Nope, NIX sockets are much easier than Win↵Socks2
02:27:10FromDiscord<MilesTheFox> (edit) "Win↵Socks2" => "WinSocks2"
02:27:44FromDiscord<MilesTheFox> In reply to @.tochka "its just that this": I always have to use #pragma comment and it's annoying
02:28:25FromDiscord<.tochka> for what?
02:28:35FromDiscord<MilesTheFox> Every lib
02:28:36FromDiscord<.tochka> linking?
02:28:43FromDiscord<.tochka> you can pass it via cli
02:28:44FromDiscord<MilesTheFox> Y e a h
02:28:52FromDiscord<.tochka> same way other compilers work
02:29:00FromDiscord<.tochka> (edit) "same way other compilers ... work" added "and environments"
02:29:10FromDiscord<MilesTheFox> I tried and it didn't work
02:30:21FromDiscord<Elegantbeef> image.png↵(@MilesTheFox) https://media.discordapp.net/attachments/371759389889003532/1042627727951405187/image.png
02:31:14FromDiscord<MilesTheFox> Weird
02:31:30FromDiscord<.tochka> looks like misconfiguration or something
02:31:44FromDiscord<MilesTheFox> Wait... looks like it still uses default GCC
02:32:34FromDiscord<MilesTheFox> sent a code paste, see https://play.nim-lang.org/#ix=4g5r
02:32:51FromDiscord<Elegantbeef> How are you compiling?
02:33:15FromDiscord<MilesTheFox> In reply to @Elegantbeef "How are you compiling?": ``nim compile --os:windows --d:mingw --app:gui -d:danger b64t.nim``
02:33:35FromDiscord<MilesTheFox> (edit) "--d:mingw" => "-d:mingw"
02:33:45FromDiscord<Elegantbeef> you can remove the `--os:windows`
02:34:41FromDiscord<MilesTheFox> I'm confused https://media.discordapp.net/attachments/371759389889003532/1042628815505072138/image.png
02:35:13FromDiscord<.tochka> top 10 reasons to have nim llvm: 1. cross compiling
02:35:32FromDiscord<MilesTheFox> XD
02:35:41FromDiscord<Elegantbeef> `nimble install zigcc` 😛
02:35:53FromDiscord<huantian> while you're at it move to nixos
02:36:06FromDiscord<ringabout> sent a code paste, see https://play.nim-lang.org/#ix=4g5s
02:36:22FromDiscord<MilesTheFox> In reply to @huantian "while you're at it": NixOS is a bit bloated
02:36:35FromDiscord<MilesTheFox> I use suckless init (sinit)
02:36:41FromDiscord<MilesTheFox> With Sway compositor
02:36:46FromDiscord<MilesTheFox> No DM
02:36:49FromDiscord<huantian> right
02:36:52FromDiscord<MilesTheFox> (edit) "DM" => "Desktop Manager"
02:37:00FromDiscord<huantian> i mean you can use sway on nixos
02:37:07FromDiscord<huantian> if that's what you mean?
02:37:15FromDiscord<MilesTheFox> But it's slow for 11 years old laptop
02:37:23FromDiscord<huantian> unless you're talking about the nix package manager being not the fastest
02:37:37FromDiscord<MilesTheFox> I heard Nix packakge manager uses 2GB RAM
02:37:39FromDiscord<huantian> but this is offtopic lmao
02:37:48FromDiscord<MilesTheFox> My laptop has only 2GB RAM
02:38:04FromDiscord<.tochka> In reply to @MilesTheFox "I heard Nix packakge": no way o.O
02:38:08FromDiscord<huantian> I mean anything can use 2gb of ram if you tell it to
02:38:35FromDiscord<MilesTheFox> In reply to @huantian "I mean anything can": ``cat /dev/zero > /dev/shm/a``
02:39:29FromDiscord<Elegantbeef> Your PC sweats hearing that doesnt it 😛↵(@.tochka)
02:39:40FromDiscord<.tochka> lol
02:40:02FromDiscord<huantian> but anyway I got 32gb of ram for my new laptop for minecraft so im fine
02:40:08FromDiscord<.tochka> now i have machine even older
02:40:15FromDiscord<.tochka> before it was at least 4gb ram
02:40:42FromDiscord<huantian> lol
02:52:35FromDiscord<Rika> In reply to @huantian "but anyway I got": Bruh
02:52:55FromDiscord<Rika> TBF the reason I have 32 GB of RAM isn’t much better lol
02:55:54FromDiscord<MilesTheFox> Is it possible to use WebSockets with Nim?
02:56:50FromDiscord<Rika> https://github.com/treeform/ws
02:57:57FromDiscord<MilesTheFox> Also, is it possible to prevent 2 instances of app running at same time?
02:58:50FromDiscord<Rika> Sure but manually
02:59:06FromDiscord<Rika> No code in the standard library to easily implement it so you’re gonna need your own solution
02:59:17FromDiscord<MilesTheFox> Okayy
03:00:50FromDiscord<Elegantbeef> A solution is to make a dummy file and if it exists you just close the appliication
03:01:40FromDiscord<leorize> that's just pidfiles with extra steps
03:01:51FromDiscord<Rika> Then you have the problem of what if the working application crashes and doesn’t remove the file so yeah have fun
03:01:58FromDiscord<Elegantbeef> Comically Unity does that to prevent you from working on multiple projects
03:02:05FromDiscord<Elegantbeef> well the same project multiple times
03:02:08FromDiscord<Rika> PID file would prolly work best yes
03:02:26FromDiscord<leorize> you can copy Qt's solution
03:02:33FromDiscord<huantian> yeah and if I force kill unity I have to manually remove it! what a pain those 10 seconds of my life oculd've been used to do something meaningfuly but instead I'm left here to clean up after unity's issues
03:02:36FromDiscord<MilesTheFox> In reply to @Elegantbeef "A solution is to": But what if power outage happens?
03:02:41FromDiscord<leorize> iirc they just use a named pipe/fifo
03:02:54FromDiscord<huantian> In reply to @MilesTheFox "But what if power": tell your user to get a ups
03:03:02FromDiscord<MilesTheFox> Huh
03:03:04FromDiscord<Elegantbeef> It's all on the user
03:04:13FromDiscord<huantian> the developer is always right
03:05:23FromDiscord<MilesTheFox> Easy solution: just check if something is already listening on the port, if nothing is listening it will use it and continue working, if not it'll close
03:05:47FromDiscord<MilesTheFox> (edit) "not" => "something is listening on the port"
03:06:24FromDiscord<MilesTheFox> Anyways we have 65565 free ports
03:06:50FromDiscord<Rika> It’s not a lot of ports tbh
03:06:50FromDiscord<leorize> and then someone squat your port
03:07:05FromDiscord<Rika> As mentioned you should prolly use Unix sockets or named pipes or what else
03:07:09FromDiscord<leorize> do remember that all OS have facilities for picking a random port
03:08:06FromDiscord<MilesTheFox> In reply to @Rika "As mentioned you should": NIX sockets don't work on Spyndows
03:08:30FromDiscord<Rika> Named pipes
03:09:03FromDiscord<MilesTheFox> Okayy
03:09:37FromDiscord<leorize> also unix sockets is a thing on windows 10 for quite awhile
03:10:57FromDiscord<Rika> Woah really?
03:11:03FromDiscord<MilesTheFox> Huhh
03:12:27FromDiscord<leorize> https://devblogs.microsoft.com/commandline/af_unix-comes-to-windows/
03:13:16FromDiscord<Rika> Yeah
03:13:26FromDiscord<Rika> No data gram support
03:13:27FromDiscord<@thatrandomperson5-6310e3b26da03> Nim is great because i don’t have to worry too much on how expensive the costs of running the code are.
03:13:31FromDiscord<Rika> Doesn’t matter though I think
03:14:03*arkurious quit (Quit: Leaving)
04:18:15FromDiscord<dizzyliam> Just double checking: If a macro generates code that includes macros, those macros will also be executed afterwards?
04:20:04FromDiscord<leorize> yes they will
04:21:47*droidrage joined #nim
04:23:07FromDiscord<morgan> In reply to @MilesTheFox "But what if power": so you could have the program not just create a file, but instead periodically write a timestamp to it, and if the timestamp is more than some amount of time out of date, assume no other instances are open
04:24:14*rockcavera quit (Remote host closed the connection)
04:26:51FromDiscord<dizzyliam> In reply to @leorize "yes they will": Interesting, my macro that generates jester routes is resulting in undeclared identifier errors for identifiers that jester's `router` macro should take out. Almost like scope checking is happening between the two macros
04:26:53FromDiscord<MilesTheFox> People that keep PC running 24/7: you'll never understand my power
04:27:24FromDiscord<.tochka> hm, how to mark loop for unrolling?
04:29:14FromDiscord<Elegantbeef> https://stackoverflow.com/a/74077789
04:29:58FromDiscord<MilesTheFox> Huh, is it possible to embed executable inside Nim app?
04:30:44FromDiscord<dizzyliam> Could read it at compile time, then save it to a temporary file at runtime and execute
04:31:10FromDiscord<Elegantbeef> You can `staticRead` it but it''s just a binary file there
04:33:25FromDiscord<.tochka> In reply to @Elegantbeef "https://stackoverflow.com/a/74077789": hm, wonder, was it proposed to be implemented in std or language
04:33:34FromDiscord<MilesTheFox> How to do it? I don't wanna have more than 1 file
04:33:50FromDiscord<MilesTheFox> I'm already thinking about how to embed cacert.pem inside Nim app itself
04:36:11FromDiscord<.tochka> In reply to @MilesTheFox "How to do it?": looks promising https://captain-woof.medium.com/how-to-execute-an-elf-in-memory-living-off-the-land-c7e67dbc3100
04:36:23FromDiscord<leorize> indeed, scope checking happens between macro. If you&#x27;d like to call a symbol declared in /your/ scope (and not the macro&#x27;s caller scope), then you have to use `bindSym` to get the symbol↵(@dizzyliam)
04:36:30FromDiscord<.tochka> but would be highly non-portable any way
04:37:10FromDiscord<Elegantbeef> No clue, personally my way i find is the best↵(@.tochka)
04:37:15FromDiscord<Elegantbeef> Works on all iterators
04:37:34FromDiscord<.tochka> you would need to compile the elf first tho, and then embed it in other compiler invocation
04:37:57FromDiscord<leorize> here&#x27;s your reminder that `{.unroll: n.}` was in the Nim spec
04:38:31FromDiscord<Elegantbeef> With for loop macros could throw it in `sugar`
04:38:52FromDiscord<MilesTheFox> In reply to @.tochka "you would need to": Already compiled ELF
04:39:25FromDiscord<leorize> you can copy appimage's approach
04:39:48FromDiscord<leorize> (or, just use appimage to make your life easier)
04:39:56FromDiscord<Meowing Cat> what is Nim's JS support?
04:40:40FromDiscord<huantian> what exactly do you wanna know about it?
04:41:02FromDiscord<Meowing Cat> seems like it has something like Next.js
04:42:06FromDiscord<huantian> next js is server side rendering right?
04:42:20FromDiscord<huantian> if you wanna do serverside rendering, you can do it in C compiled Nim
04:42:36FromDiscord<Meowing Cat> In reply to @huantian "next js is server": yes
04:42:39FromDiscord<Meowing Cat> In reply to @huantian "if you wanna do": ummmmmmm
04:42:43FromDiscord<leorize> next js is hybrid server side/client side iirc
04:42:47FromDiscord<Meowing Cat> so it has a similar feature?
04:43:06FromDiscord<Meowing Cat> In reply to @leorize "next js is hybrid": damn another bottttt
04:43:18FromDiscord<.tochka> this server is full of bots
04:43:22FromDiscord<.tochka> worse than twitter
04:43:26FromDiscord<leorize> you basically pre-generate the DOM as an HTML document then have your JS use it to do things like an SPA
04:43:27FromDiscord<Meowing Cat> 🙀
04:43:33FromDiscord<dizzyliam> In reply to @leorize "indeed, scope checking happens": Thanks I'll have a look
04:43:41FromDiscord<Elegantbeef> Give me your 8$↵(@.tochka)
04:45:04FromDiscord<huantian> In reply to @leorize "next js is hybrid": so it's like a combo of jester/prologue + karax?
04:45:45FromDiscord<leorize ✔> nope, it's more advanced
04:46:01FromDiscord<huantian> so like a combo of those but built to work together
04:47:03FromDiscord<leorize> SPA generates the pages on client when load, the next.js approach basically take that code and run it on the server first to get a page that can be delivered verbatim to the user
04:47:16FromDiscord<dizzyliam> Karax can do server side rendering, although I've never tried it
04:48:06FromDiscord<.tochka> In reply to @.tochka "looks promising https://captain-woof.medium.com/how": looks possible in windows too https://github.com/aaaddress1/RunPE-In-Memory/tree/master/RunPE-In-Memory/RunPEinMemory
04:48:22FromDiscord<leorize> basically let you reuse client code as page generation code on server-side
04:49:14FromDiscord<leorize> karax can do SSR, but I don't know if it can rehydrate a page
05:02:19FromDiscord<dizzyliam> In reply to @leorize "indeed, scope checking happens": Sadly the documentation for `bindSym` isn't helping me. Basically I need a way to get around the scope checking that happens between my macro and the `router` macro, because the latter is designed to execute before any scope checking has happened.
05:03:29FromDiscord<Elegantbeef> you `bindSym"myCode"` then use that symbol in your code
05:04:18FromDiscord<Elegantbeef> https://github.com/beef331/nimtrest/blob/2efefb944b954b9f05891dce5274e53d7798bcf2/lender.nim#L5↵https://github.com/beef331/nimtrest/blob/2efefb944b954b9f05891dce5274e53d7798bcf2/lender.nim#L51
05:08:11FromDiscord<dizzyliam> Thanks for the examples :)
05:15:55FromDiscord<leorize> [@dizzyliam](https://matrix.to/#/%40_discord_531959880609955841%3At2bot.io) oh wait, you&#x27;re running it to generate routes inside the router macro?
05:16:05FromDiscord<leorize> then no amount of `bindSym` will help you
05:17:11FromDiscord<leorize> `jester.router` is an untyped macro. In short, it will perform all the transformation /before/ your macro executes
05:19:20FromDiscord<dizzyliam> In reply to @leorize "`jester.router` is an untyped": Ah, so I can't generate code that uses it. Damm
05:19:28FromDiscord<dizzyliam> Thanks for the help
05:20:33FromDiscord<leorize> you can try to see if its possible to register routes manually without the fancy macro
05:21:08FromDiscord<leorize> fancy `router` macro
05:21:23FromDiscord<leorize> I don&#x27;t think it&#x27;s possible, the `router` macro is quite a hack on its own
05:22:20FromDiscord<dizzyliam> Yeah I was registering them manually before but needed some of that fancy `router` functionality
05:28:14FromDiscord<leorize> time to craft your own macro-friendly `router` \:p
05:32:47FromDiscord<alicia ッ> https://github.com/andreaferretti/patty↵is it still maintained?
05:34:45FromDiscord<dizzyliam> In reply to @leorize "time to craft your": regex magic time
05:35:12FromDiscord<dizzyliam> I was mostly looking at `router` for it's url matching ability
05:35:14FromDiscord<Elegantbeef> Ew
05:35:15FromDiscord<Elegantbeef> Regex
05:35:51FromDiscord<alicia ッ> @ElegantBeef is patty still maintained/supported
05:35:58FromDiscord<alicia ッ> im interested in pattern matching libraries for nim
05:41:33FromDiscord<alicia ッ> or should i use fusion
05:50:19FromDiscord<Elegantbeef> No clue i dont do PM
05:50:44*ltriant joined #nim
05:51:53FromDiscord<pietroppeter> I think this is a more update version of Pattern Matching (have not used it though) https://github.com/haxscramper/hmatching (the version in fusion is an early version of this), cc @haxscramper
05:53:00FromDiscord<Bung> use https://github.com/nim-lang/ast-pattern-matching if want official support
05:53:44FromDiscord<leorize> i'm pretty sure that one is for macro devs only
05:56:41FromDiscord<Bung> ah, so use patty or hmatching
05:58:58FromDiscord<Meowing Cat> too many bots
05:59:00FromDiscord<Meowing Cat> damnnnnnnnnnnnnnnnn
05:59:15FromDiscord<Elegantbeef> Beep boop beep
06:00:54FromDiscord<alicia ッ> sent a code paste, see https://play.nim-lang.org/#ix=4g66
06:36:49*ehmry quit (Remote host closed the connection)
06:38:31*ehmry joined #nim
06:53:36FromDiscord<.tochka> sent a long message, see http://ix.io/4g6i
06:53:57FromDiscord<.tochka> sent a code paste, see https://play.nim-lang.org/#ix=4g6i
06:54:01FromDiscord<.tochka> could something like this work?
06:57:13FromDiscord<Meowing Cat> sent a code paste, see https://play.nim-lang.org/#ix=4g6l
06:57:31FromDiscord<Meowing Cat> Nim is weird
06:59:04FromDiscord<Elegantbeef> Sadly no tochka
06:59:22FromDiscord<.tochka> bummer
07:05:22FromDiscord<Meowing Cat> In reply to @.tochka "bummer": beef is a booooomer
07:05:32FromDiscord<.tochka> ik
07:05:41FromDiscord<Meowing Cat> also a bot
07:05:58FromDiscord<Meowing Cat> a beef can't even meow
07:06:24FromDiscord<.tochka> it can but not by its own will
07:06:33FromDiscord<.tochka> anything can meow if you force it
07:06:35FromDiscord<.tochka> (edit) "anything can meow if you force it ... " added "to"
07:06:41FromDiscord<.tochka> (edit) "anything" => "butanything"
07:06:46FromDiscord<.tochka> (edit) "butanything" => "but anything"
07:07:17FromDiscord<Elegantbeef> Bark
07:11:15FromDiscord<Meowing Cat> In reply to @.tochka "but anything can meow": fake meow
07:11:22FromDiscord<Elegantbeef> sent a code paste, see https://play.nim-lang.org/#ix=4g6o
07:11:36FromDiscord<Meowing Cat> sent a code paste, see https://play.nim-lang.org/#ix=4g6p
07:12:16FromDiscord<Elegantbeef> Cause by doing `T.myArr` we delay the logic until instantation
07:13:10FromDiscord<.tochka> nice
07:13:25FromDiscord<Elegantbeef> Fuck that's an easy hack 😄
07:13:25FromDiscord<Elegantbeef> sent a code paste, see https://play.nim-lang.org/#ix=4g6q
07:13:47FromDiscord<Elegantbeef> This actually makes so many things easier
07:27:56*ltriant quit (Ping timeout: 256 seconds)
07:35:30*LuxuryMode quit (Quit: Connection closed for inactivity)
07:35:36*PMunch joined #nim
07:41:40*jjido joined #nim
07:45:57*kenran joined #nim
07:55:28*ltriant joined #nim
07:57:02*kenran quit (Remote host closed the connection)
08:03:04*ltriant quit (Ping timeout: 256 seconds)
08:16:16*ltriant joined #nim
08:17:25FromDiscord<SBG> hey fellas.
08:17:33FromDiscord<SBG> Does nim have anything like ncat
08:17:43FromDiscord<SBG> or should i just like make it run the ncat cmd from linux?
08:19:26FromDiscord<Elegantbeef> You can program what you want to do but it'll be more complex than just calling ncat
08:21:12*ltriant quit (Ping timeout: 256 seconds)
08:22:52FromDiscord<SBG> In reply to @Elegantbeef "You can program what": would it be faster to use sockets instead of ncat? as ncat depends on Linux (unless that gcc thingy is installed i forgor name)?
08:23:36FromDiscord<luteva> maybe: https://github.com/iocrate/netkit ? or have a look at what netkit uses for its tools....?
08:23:45FromDiscord<SBG> 👍🏻
08:24:22FromDiscord<Elegantbeef> Depends what you're doing wit ncat
08:24:23FromDiscord<Elegantbeef> ncat does a lot
08:24:29FromDiscord<Elegantbeef> So you need to be specific what you want
08:24:54FromDiscord<SBG> ill show u essentially what im doing in python atm
08:26:21FromDiscord<SBG> sent a code paste, see https://play.nim-lang.org/#ix=4g6z
08:26:33FromDiscord<SBG> (edit) "https://play.nim-lang.org/#ix=4g6z" => "https://play.nim-lang.org/#ix=4g6A"
08:27:16Zevvwait what
08:28:07Zevvwhat does spinning up a qemu have to do with all of this
08:28:25Zevvbasically, you just want to open a TCP socket, connect it to 127.0.0.1:1234 and send the string "sendkey 1"
08:28:26FromDiscord<Elegantbeef> Seems they're using ncat to see if a server is alive?
08:28:39FromDiscord<Elegantbeef> Yea there is no reason to use ncat for that 😄
08:28:47FromDiscord<SBG> no thats not whats going on
08:29:04FromDiscord<SBG> cmd("") just wraps shell commands.
08:29:33FromDiscord<SBG> I'm sunning qemu and im giving it a monitor on blahblahblah which is sort of like a tty session
08:30:12FromDiscord<SBG> im launching whats like a ssh into the tty of the qemu (it's not a tty into the guest but the vm hardware itself) and then it sends the function "sendkey 1"
08:30:22FromDiscord<SBG> which sends the number 1 as user input into qemu
08:31:01FromDiscord<Elegantbeef> sent a code paste, see https://play.nim-lang.org/#ix=4g6D
08:31:07FromDiscord<SBG> oh dang that simple dude?
08:31:29FromDiscord<SBG> and this doesn't need to be routed through shell right so there's not like a midlde man slowing stuff down?
08:31:29FromDiscord<Elegantbeef> Of course you're just sending a single string across tcp
08:31:58FromDiscord<Elegantbeef> Indeed and it's portable, it doesnt require ncat on the PC or even to be ran on linux
08:32:03FromDiscord<SBG> well yeah
08:32:06Zevvdial("127.0.0.1", 1234.Port).send("sendkey 1")
08:32:17FromDiscord<SBG> qemu sendkey makes chars be seperated by -
08:32:20FromDiscord<Elegantbeef> Ah dial is even niftier
08:32:34FromDiscord<SBG> sent a code paste, see https://play.nim-lang.org/#ix=4g6F
08:32:38FromDiscord<Elegantbeef> I dont do network stuff much so didnt know about dial
08:33:05FromDiscord<SBG> is there any difference between dial and Elegantbeef's solution?
08:33:13FromDiscord<Elegantbeef> dial manages the socket itself
08:33:18FromDiscord<Elegantbeef> So you need to make a new socket
08:33:22FromDiscord<Elegantbeef> Well internally it does it
08:33:33FromDiscord<Elegantbeef> My way allows a series of requests with the same socket
08:33:48FromDiscord<SBG> In reply to @SBG "so i have to": yeah it's doing multiple requests
08:34:56FromDiscord<luteva> but the dial version will work too, for multiple requests. it just opens new sockets. afaik.
08:35:33FromDiscord<Elegantbeef> Yea it's best to avoid doing that
08:35:45FromDiscord<SBG> In reply to @Elegantbeef "Yea it's best to": avoid doing?
08:35:59FromDiscord<luteva> so the main difference is the line:↵defer: mySocket.close()↵which is done implicitly in the dial version
08:36:04FromDiscord<Elegantbeef> Avoid making new sockets repetitively
08:36:17FromDiscord<SBG> ah right k
08:36:20FromDiscord<Elegantbeef> Wait dial returns a socket
08:36:40FromDiscord<Elegantbeef> So just use dial
08:36:41FromDiscord<Elegantbeef> I'm a fuckwit
08:37:09Amun-Ra^ noted
08:37:15FromDiscord<Elegantbeef> Thought dial just send the data, guess i'm too tired
08:38:17FromDiscord<Elegantbeef> Amun if we noted how many times i called myself a fuckwit, we'd run out of paper
08:38:39Amun-Ra;p
08:41:44FromDiscord<SBG> In reply to @Elegantbeef "Amun if we noted": well on the account your on, of the webhook id of 854845166641086475, you've said the phrase "I'm a fuckwit" 3 times. On your discord account you've said it twice. So unless your writing using a font size of 400 and paper the size of tictacs then sure.
08:42:32FromDiscord<Elegantbeef> That implies i've only done it here
08:43:18FromDiscord<jmgomez> Can you use the compiler API to get the type from a symbol in a file? Similar of what nimsuggest do but much more relaxed, just the inferred type name (return for a fn or the variable type itself) in a given file?
08:43:50FromDiscord<Elegantbeef> You should be able to it's `PSym.type`
08:43:54FromDiscord<Elegantbeef> well `.typ`
08:47:09FromDiscord<jmgomez> sweet, where would you start to look into it if you want to pass around the nim file, any particular fn?
08:47:21FromDiscord<Elegantbeef> Uhh
08:47:35FromDiscord<Elegantbeef> My response is "Just use a macro", cause i really dont know
08:51:11*ltriant joined #nim
08:53:06FromDiscord<jmgomez> but if nim file is incorrect which is usually the case it wouldnt work, would it? What I want is to build a small plugin editor, I have potentially millions of functions and type information to feed in already parsed but I need to know the type of what the user is typing
08:53:14FromDiscord<jmgomez> (edit) "but if ... nim" added "the"
08:53:43FromDiscord<Elegantbeef> Yea it wont work
08:55:46*ltriant quit (Ping timeout: 256 seconds)
08:56:22*jjido quit (Quit: My laptop has gone to sleep. ZZZzzz…)
09:16:45*ltriant joined #nim
09:51:17*lumidify joined #nim
11:04:21FromDiscord<albassort> whenever beef doesn't know he goes "make a macro"
11:05:00FromDiscord<Rika> Whenever seasoned Nim programmers don’t know they’d go “just make a macro it’s possible anyway”
11:40:07*genpaku quit (Remote host closed the connection)
11:40:47*genpaku joined #nim
11:49:48FromDiscord<&Makarov/1> Hi beautifull people 👋
11:49:57FromDiscord<&Makarov/1> sent a code paste, see https://play.nim-lang.org/#ix=4g7z
11:50:12FromDiscord<&Makarov/1> i dont know this throws an error and says that it's a type mismatch
11:50:30FromDiscord<&Makarov/1> https://media.discordapp.net/attachments/371759389889003532/1042768689914708108/image.png
11:50:53FromDiscord<&Makarov/1> https://media.discordapp.net/attachments/371759389889003532/1042768784508854282/image.png
11:51:03FromDiscord<&Makarov/1> m trying to play a little with references 😂
11:52:04FromDiscord<ChocolettePalette> p is actually a ref ref Person
11:52:17FromDiscord<ChocolettePalette> Because there's already 1 ref in declaration
11:52:21FromDiscord<scarf> In reply to @&Makarov/1 "m trying to play": does removing space between `alter` make changes?
11:52:28FromDiscord<ChocolettePalette> Isn't it?
11:52:39FromDiscord<scarf> (edit) "`alter`" => "`alter (n, hello)`"
11:52:40FromDiscord<Rika> In reply to @scarf "does removing space between": Yes
11:53:26FromDiscord<&Makarov/1> In reply to @ChocolettePalette "Because there's already 1": okaay 😂
11:53:49FromDiscord<&Makarov/1> but the compiler says that it's just one ref 😂
11:54:21FromDiscord<Rika> In reply to @&Makarov/1 "but the compiler says": It doesn’t
11:54:29FromDiscord<Rika> It’s just saying as it is
11:56:07FromDiscord<ChocolettePalette> Wtf why??? It is so CRINGE↵(@Rika)
11:56:12FromDiscord<&Makarov/1> sent a code paste, see https://play.nim-lang.org/#ix=4g7A
11:56:34FromDiscord<&Makarov/1> okay i removed "ref" from the `var n,m : Person` declaration
11:56:57FromDiscord<&Makarov/1> but still the same error !
11:57:11FromDiscord<Rika> Remove the space between alter and (n, “hello”)
11:57:29FromDiscord<&Makarov/1> https://media.discordapp.net/attachments/371759389889003532/1042770450746458134/image.png
11:57:42FromDiscord<ChocolettePalette> > maybe misplaced space between alter and↵Ah if it's the design then OK
11:57:45FromDiscord<&Makarov/1> In reply to @Rika "Remove the space between": no change 🥲
11:57:57FromDiscord<Rika> Show
11:58:07FromDiscord<Rika> Show the new error and the new code
11:58:08FromDiscord<&Makarov/1> https://media.discordapp.net/attachments/371759389889003532/1042770613829386250/image.png
12:02:30FromDiscord<&Makarov/1> sent a code paste, see https://play.nim-lang.org/#ix=4g7C
12:02:31FromDiscord<&Makarov/1> it's fixed here !
12:02:58FromDiscord<&Makarov/1> thanks anyway 🙏
12:05:03FromDiscord<Rika> Weird
12:05:04FromDiscord<&Makarov/1> in fact it's not working cause it doesnt affect the referenced value
12:05:15FromDiscord<Rika> Ah I see
12:05:25FromDiscord<&Makarov/1> is there any "address referencing" operator in nim
12:05:29FromDiscord<Rika> You removed the ref in the bar but not the one in the function signature
12:05:31FromDiscord<&Makarov/1> like "&" in C ?
12:05:39FromDiscord<&Makarov/1> In reply to @Rika "You removed the ref": yeah !
12:05:40FromDiscord<Rika> Technically yes but not for ref
12:05:48FromDiscord<&Makarov/1> In reply to @Rika "Technically yes but not": ptr ?
12:05:58FromDiscord<Rika> Yes, “addr” function
12:06:07FromDiscord<&Makarov/1> hmm i didnt reach it yet
12:06:40FromDiscord<&Makarov/1> so what i'm trying to achieve is to get alter the person.name value fron the proc by passing a ref to it 🙁
12:07:05FromDiscord<Rika> I’d help you but I’m on a phone so I don’t really want to program lol
12:08:23FromDiscord<&Makarov/1> yeah man take a break , thanks 🙏
12:08:33FromDiscord<&Makarov/1> some how this works
12:08:33FromDiscord<&Makarov/1> sent a code paste, see https://play.nim-lang.org/#ix=4g7E
12:12:11FromDiscord<&Makarov/1> it explains a lot now 😂 https://media.discordapp.net/attachments/371759389889003532/1042774149233381407/image.png
12:13:28FromDiscord<Rika> Yeah ref ref object
12:13:33FromDiscord<Rika> Two pointers
12:13:39FromDiscord<&Makarov/1> nice
12:13:46FromDiscord<&Makarov/1> it's fun to play with this shit :joy
12:13:50FromDiscord<&Makarov/1> (edit) ":joy" => "😂"
12:15:11FromDiscord<&Makarov/1> hurray i got it 😂 , thanks guys !
12:15:12FromDiscord<scarf> does `n` and `m` need allocation tho, for they are just references
12:15:26FromDiscord<&Makarov/1> they dont need ?
12:15:36FromDiscord<Rika> They do
12:15:42FromDiscord<Rika> In your scenario they need
12:15:48FromDiscord<Rika> Because you do new, then []
12:16:01FromDiscord<Rika> If you only do [] you dereference a nil so
12:16:59FromDiscord<&Makarov/1> i guess they need @scarf https://media.discordapp.net/attachments/371759389889003532/1042775357792714853/image.png
12:17:00FromDiscord<scarf> sent a code paste, see https://play.nim-lang.org/#ix=4g7G
12:17:15FromDiscord<scarf> (edit) "https://play.nim-lang.org/#ix=4g7G" => "https://play.nim-lang.org/#ix=4g7H"
12:17:43FromDiscord<scarf> (edit) "https://play.nim-lang.org/#ix=4g7H" => "https://play.nim-lang.org/#ix=4g7J"
12:17:58FromDiscord<scarf> (edit) "https://play.nim-lang.org/#ix=4g7J" => "https://play.nim-lang.org/#ix=4g7L"
12:18:14FromDiscord<Rika> In reply to @scarf "what would be an": What does “const string” mean exactly
12:18:23FromDiscord<Rika> Because I’m not familiar with the semantics
12:19:08FromDiscord<&Makarov/1> immutable string !
12:19:36FromDiscord<Rika> Yes but immutable in what ways
12:19:48FromDiscord<Rika> Because C++ is hell and I’m not sure of all the edge cases
12:20:02FromDiscord<scarf> In reply to @Rika "What does “const string”": my mistake, removed const because `alter` wouldn't work without it
12:20:05FromDiscord<Rika> Oh you edited it
12:20:06FromDiscord<Rika> Okay
12:20:12FromDiscord<Rika> Yeah I thought so too
12:22:21FromDiscord<&Makarov/1> In reply to @scarf "my mistake, removed const": you can keep the `const string & bar = &foo`
12:22:36FromDiscord<Rika> sent a long message, see http://ix.io/4g7Q
12:25:16FromDiscord<scarf> In reply to @Rika "var foo = "Hello"": are nim `addr` the same as C++ references?
12:25:29FromDiscord<MilesTheFox> Is it possible to make GUI app in Nim?
12:25:40FromDiscord<MilesTheFox> Like GTK app
12:25:51PMunchYup
12:26:01FromDiscord<Rika> In reply to @scarf "are nim `addr` the": I don’t know , raw pointer
12:26:09FromDiscord<Rika> Same as C &
12:26:27FromDiscord<Rika> I think that C has that, I forgot
12:26:33FromDiscord<Rika> C in type
12:26:44PMunchC++ ref would be closer to a Nim ref wouldn't it?
12:27:03FromDiscord<Rika> I don’t know
12:27:24PMunch@MilesTheFox, there are plenty of ways to make GUI apps in Nim
12:27:29PMunchGTK included
12:28:53PMunchYou can use it directly, or you might want to check out something like https://github.com/pmunch/gtkgenui
12:29:25FromDiscord<jmgomez> In reply to @PMunch "C++ ref would be": No, it would be closer to nim var
12:29:47*jmdaemon quit (Ping timeout: 256 seconds)
12:30:03PMunchHmm, right
12:30:07*PMunch quit (Quit: Leaving)
12:32:58FromDiscord<&Makarov/1> In reply to @scarf "are nim `addr` the": i dont think soo
12:33:29FromDiscord<&Makarov/1> they are more like C pointer ! without afaik a referencing pointer
12:34:08FromDiscord<MilesTheFox> In reply to @PMunch "@MilesTheFox, there are plenty": Thank you!
13:16:11FromDiscord<b1rdf00d> sent a code paste, see https://play.nim-lang.org/#ix=4g82
13:16:33FromDiscord<b1rdf00d> (edit) "https://play.nim-lang.org/#ix=4g82" => "https://play.nim-lang.org/#ix=4g83"
13:28:17FromDiscord<Rika> Parenthesise the ref Circle
13:28:19FromDiscord<Rika> That’s it
13:28:28FromDiscord<Rika> @b1rdf00d
13:28:52FromDiscord<.tochka> In reply to @b1rdf00d "I've got a ref": var circle = (ref Circle)(radius: 20.0)
13:29:18FromDiscord<Rika> That, yes
13:30:27FromDiscord<.tochka> you will get segfault in that example btw, as circle memory is assigned without being allocated
13:31:07FromDiscord<Rika> Yes, first example is broken
13:31:42FromDiscord<.tochka> wonder could this case be statically checked when obvious like that
13:36:21FromDiscord<.tochka> In reply to @&Makarov/1 "i dont think soo": they would be if marked as not nil, which they arent afaik. could probably be done in the future for addressing objects that are known to exist, such as automatics in functions and globals
13:39:03FromDiscord<b1rdf00d> Thanks! Rika and .tochka
13:39:13FromDiscord<b1rdf00d> (I'm discovering the segfault now 🙂 )
14:14:29FromDiscord<.tochka> lol https://media.discordapp.net/attachments/371759389889003532/1042804927669481502/image.png
14:29:28FromDiscord<.tochka> cant replicate it on small scale...
15:16:13FromDiscord<MilesTheFox> Is there any Blowfish or Twofish library for Nim?
15:22:15FromDiscord<hmmm> broskis is there a sugary one liner way of testing if a string has only the characters 'a' or 'b' or 'c' in it
15:24:27FromDiscord<Yardanico> In reply to @hmmm "broskis is there a": yes
15:24:29FromDiscord<Yardanico> with sequtils
15:24:42FromDiscord<Yardanico> `mystr.allIt(it in {'a', 'b', 'c'})`
15:24:51FromDiscord<hmmm> ty yardy ❤️
15:27:06FromDiscord<albassort> does if any exist in the stdlib
15:38:07FromDiscord<.tochka> yes
15:38:20FromDiscord<hmmm> nunununu all it doesn't work for me because "aaab" should pass the test
15:38:28FromDiscord<hmmm> allit requires a c to be present
15:40:06FromDiscord<albassort> In reply to @.tochka "yes": what is it called
15:42:08*kenran joined #nim
15:42:10FromDiscord<untoreh> sent a code paste, see https://play.nim-lang.org/#ix=4g8K
15:42:39FromDiscord<untoreh> it generates a new tag at `<scr`
15:42:47FromDiscord<Rika> In reply to @hmmm "allit requires a c": I don’t think so?
15:42:48FromDiscord<albassort> post code
15:43:47FromDiscord<Rika> !eval import sequtils; echo "aaab".allIt(it in {'a', 'b', 'c'})
15:43:52FromDiscord<hmmm> In reply to @Rika "I don’t think so?": you are correct, I was dumb lol
15:43:54NimBottrue
15:44:12FromDiscord<hmmm> HEY THE NIMBOT INSULTED ME
15:44:13FromDiscord<Rika> In reply to @hmmm "you are correct, I": ~~”was”?~~
15:44:14FromDiscord<.tochka> In reply to @untoreh "`std/xmlparser` parses this incorrectly:": embedded text is not part o xml
15:44:17FromDiscord<hmmm> HEEEEEEEEY
15:44:32FromDiscord<hmmm> damn I'm getting torched left and right today 🧐
15:44:36FromDiscord<.tochka> (edit) "o" => "of"
15:45:13FromDiscord<untoreh> In reply to @.tochka "embedded text is not": what about html?
15:45:24FromDiscord<Rika> In reply to @.tochka "embedded text is not": Note that HTML isn’t a set in XML
15:45:39FromDiscord<Rika> Which is why it fails
15:45:40FromDiscord<Rika> I assume
15:45:53FromDiscord<.tochka> In reply to @untoreh "what about html?": should work in xhtml and html
15:45:59*ixmpp quit (Ping timeout: 260 seconds)
15:46:13FromDiscord<untoreh> so its `std/htmlparser` bug
15:46:25FromDiscord<.tochka> hmmm
15:47:10*droidrage quit (Ping timeout: 256 seconds)
15:47:13FromDiscord<Rika> Didn’t you say you used the xml one
15:47:33FromDiscord<untoreh> I assumed it was xmlparser as an htmlparser dependencies
15:47:43FromDiscord<untoreh> (edit) "dependencies" => "dependency"
15:48:21FromDiscord<untoreh> they both spit out `XmlNode` trees
15:53:54NimEventerNew thread by templatedperson: Procedure to remove modules from stdlib?, see https://forum.nim-lang.org/t/9627
15:58:00*xet7 quit (Read error: Connection reset by peer)
16:00:14FromDiscord<DarkSky> helloo
16:04:13FromDiscord<Rika> hello
16:13:10*ehmry quit (Quit: https://quassel-irc.org - Chat comfortably. Anywhere.)
16:13:47*xet7 joined #nim
16:14:03*ehmry joined #nim
16:14:24FromDiscord<albassort> im looking for a proc to convert unicode to a string
16:14:35FromDiscord<albassort> i dont think its in unicode
16:14:38FromDiscord<albassort> do i have to do it...
16:15:27FromDiscord<albassort> yep
16:15:28FromDiscord<albassort> sad
16:15:32FromDiscord<Yardanico> In reply to @albassort "im looking for a": As in?
16:15:39FromDiscord<Yardanico> Nim strings are just bytes
16:15:45FromDiscord<albassort> yes
16:15:50FromDiscord<Yardanico> so what do you want to do
16:16:27FromDiscord<albassort> i give, say 0x30 and it gives me the char 0x30
16:17:08FromDiscord<albassort> or i give it 0x257F and it gives me ╬
16:19:12FromDiscord<Rika> do you know what charset that is
16:19:37FromDiscord<albassort> nope, I'll just invert a function i already have to convert chars to unicode
16:21:43FromDiscord<Rika> http://www.madore.org/~david/computers/unicode/cstab.html
16:21:53FromDiscord<Rika> `Tables of Common Character Sets↵Summary↵↵This page gives the tables of a few common character sets. The various cells contain the Unicode character that represents the character set's entry.`
16:23:24FromDiscord<albassort> be faster and simpler to just do some bitoperations
16:23:28FromDiscord<albassort> (edit) "bitoperations" => "bit operations"
16:23:52FromDiscord<albassort> is there a proc to get the minimum amount of bytes to contain this integer?
16:30:46FromDiscord<.tochka> amount of bytes for coded point?
16:30:58FromDiscord<.tochka> there graphemeLen in std/unicode
16:31:27FromDiscord<.tochka> at least if you're assuming utf8 by unicode
16:31:47*lampi quit (Remote host closed the connection)
16:42:18FromDiscord<albassort> no
16:42:37FromDiscord<albassort> for an integer you need to know how many bytes it takes up in order to convert it to utf8
16:44:28FromDiscord<Rika> get the bit size of the stored integer, then subtract it by CLZ
16:45:12FromDiscord<Rika> theoretically `integ.sizeof8 - integ.countLeadingZeroBits == integ.bitsize`
16:45:28FromDiscord<albassort> i was writing a macro
16:46:12FromDiscord<Rika> countLeadingZeroBits is in bitops
16:46:33FromDiscord<Rika> note this is bitsize
16:46:56FromDiscord<Rika> you can always `(.../8).ceil`
16:47:31FromDiscord<Rika> or use div + mod + conditionals but thats smth im too lazy to write
16:49:22FromDiscord<albassort> In reply to @Rika "countLeadingZeroBits is in bitops": bytes dont start with 1 so its irrelevant
16:49:31FromDiscord<albassort> (edit) "bytes" => "integers"
16:49:48FromDiscord<albassort> i suppose you could round up
16:49:57FromDiscord<albassort> but thats just an extrapolation of what im doing
16:51:00FromDiscord<albassort> sent a code paste, see https://play.nim-lang.org/#ix=4g8Z
16:51:51FromDiscord<albassort> (edit) "https://play.nim-lang.org/#ix=4g8Z" => "https://play.nim-lang.org/#ix=4g90"
16:51:54FromDiscord<albassort> disgusting
16:54:10NimEventerNew thread by RodSteward: How to inject member identifiers in generics, see https://forum.nim-lang.org/t/9628
16:54:24FromDiscord<albassort> doesn't compile dynamicly typed
16:59:09FromDiscord<albassort> alright gonna settle for just doing uint32
16:59:12FromDiscord<albassort> (edit) "uint32" => "uint16"
17:01:28FromDiscord<Rika> In reply to @albassort "integers dont start with": What?
17:02:00FromDiscord<albassort> doesn't matter my idea isn't static
17:03:23FromDiscord<Rika> There is this
17:03:25FromDiscord<Rika> https://nim-lang.org/docs/math.html#nextPowerOfTwo%2Cint
17:07:52*derpydoo joined #nim
17:10:24*derpydoo quit (Client Quit)
17:21:23*kenran quit (Remote host closed the connection)
17:23:24FromDiscord<albassort> pretty scuffed here
17:23:25FromDiscord<albassort> sent a code paste, see https://play.nim-lang.org/#ix=4g97
17:24:24FromDiscord<Yardanico> sent a code paste, see https://play.nim-lang.org/#ix=4g98
17:24:26FromDiscord<Yardanico> nim has that in stdlib
17:24:33FromDiscord<Yardanico> or there's https://github.com/treeform/encode if you prefer
17:24:41FromDiscord<Yardanico> https://nim-lang.org/docs/widestrs.html is the stdlib module
17:24:48FromDiscord<albassort> useful
17:25:16FromDiscord<Yardanico> with widestrs it's just `$newWideCString(yourstringwithutf16bytes)`
17:25:32FromDiscord<albassort> no its an integer
17:25:37FromDiscord<albassort> oh wait
17:25:51FromDiscord<albassort> this takes unicode and spits out the utf8
17:26:07FromDiscord<albassort> its specified uint16 because i dont want to code more bits
17:26:08FromDiscord<Yardanico> don't you have the whole string in seq/string as bytes?
17:26:30FromDiscord<albassort> https://media.discordapp.net/attachments/371759389889003532/1042853247465050143/image.png
17:26:47FromDiscord<albassort> outputs ゖ
17:27:06FromDiscord<Yardanico> but in a real program will you receive just a single codepoint or whole strings?
17:27:30FromDiscord<albassort> in a real program, i have a function which gets the unicode value, adds 60, then puts it through this
17:29:06FromDiscord<albassort> the function for that is
17:29:16FromDiscord<albassort> sent a code paste, see https://play.nim-lang.org/#ix=4g9c
17:29:22FromDiscord<albassort> if you're wondering why this is all strings
17:29:29FromDiscord<albassort> its because the strings are faster for some reason
17:29:34FromDiscord<albassort> i reprogrammed it in bits but it was slower
17:29:37FromDiscord<albassort> so i just reverted it
17:29:46FromDiscord<Yardanico> so again what do you want to do at the highest level? You have a UTF-8 string and you want to +60 all utf8 chars?
17:29:58*kenran joined #nim
17:30:03FromDiscord<albassort> here is how im using it
17:30:20NimEventerNew thread by drkameleon: Using templates with generic or untyped parameters, see https://forum.nim-lang.org/t/9629
17:30:46FromDiscord<albassort> シ -> unicode -> isKatakana -> シ-60 -> parseUnicode -> し
17:31:42FromDiscord<albassort> its kinda too late i already wrote my own shitty code
17:33:47FromDiscord<Yardanico> yeah I get that, I just want to understand what you're trying to do, because I feel like there's a much easier way
17:34:13FromDiscord<Yardanico> what does -60 mean here? utf8 value for that symbol is 12471 and -60 gives ほ
17:35:49FromDiscord<Yardanico> ahh 60 in hex
17:36:23*rockcavera joined #nim
17:36:29FromDiscord<Yardanico> sent a code paste, see https://play.nim-lang.org/#ix=4g9f
17:36:34FromDiscord<Yardanico> outputs 4 `し`s
17:37:09FromDiscord<albassort> ok so this is what i asked in the start
17:37:49FromDiscord<Yardanico> and what else do you need to do?
17:38:37FromDiscord<albassort> runes also destroy the need for my unicode thing
17:38:38FromDiscord<albassort> nice
17:41:28FromDiscord<jmgomez> @ShalokShalom did you see that they jetbrains pushed a new version of the Nim plugin? I think your comment made effect! ↵They support rendering on debug types now, I think they are the first on support that. Of course, no nimsuggest/autocomplete yet but seems to be alive again
17:41:48FromDiscord<Yardanico> wow really?
17:41:53FromDiscord<Yardanico> i thought it was abandoned for good :D
17:42:10FromDiscord<Yardanico> wow https://media.discordapp.net/attachments/371759389889003532/1042857191641727066/image.png
17:42:22FromDiscord<jmgomez> Yeah, https://twitter.com/PiotrekTomiak/status/1593237584159076352↵We should give it some love and RT it
17:42:25FromDiscord<Yardanico> https://media.discordapp.net/attachments/371759389889003532/1042857254526910494/image.png
17:42:29FromDiscord<Yardanico> i should try it again now then
17:42:50*kenran quit (Remote host closed the connection)
17:43:05FromDiscord<Yardanico> In reply to @jmgomez "Yeah, https://twitter.com/PiotrekTomiak/status/1593": pls make a forum thread
17:43:07FromDiscord<Yardanico> a new one :)
17:43:50FromDiscord<Yardanico> going to download idea rn
17:44:53FromDiscord<Yardanico> or actually CLion, guess that'd fit more
17:47:33FromDiscord<hmmm> sent a code paste, see https://play.nim-lang.org/#ix=4g9h
17:47:47FromDiscord<hmmm> sent a code paste, see https://play.nim-lang.org/#ix=4g9i
17:48:26FromDiscord<Arathanis> are you trying to map original over the others?
17:48:37FromDiscord<hmmm> yea something like that
17:48:40FromDiscord<hmmm> but failed 😦
17:48:43FromDiscord<Arathanis> taking the size of original
17:48:53FromDiscord<Arathanis> and replacing missing elements with the value in original?
17:48:57FromDiscord<ShalokShalom> In reply to @jmgomez "<@208199869301522432> did you see": Wonderful
17:49:41FromDiscord<hmmm> I mean if a seq is too short it should leave the zeros of original seq and if it's too long it should ignore the longer part
17:50:00FromDiscord<Arathanis> yes i understand
17:50:24NimEventerNew thread by jmgomez: Jetbrains updated its Nim Plugin!, see https://forum.nim-lang.org/t/9630
17:51:32FromDiscord<Arathanis> you should use `sequtils.zip` and compare the resulting length to the length of "original" then if its too short start padding the missing elements with the correct indexes from "original"
17:51:46FromDiscord<Arathanis> or easier, just compare lengths
17:51:53FromDiscord<Arathanis> if the case seq is too short, pad
17:51:59FromDiscord<Arathanis> if its too long or equal, just slice
17:52:21FromDiscord<Arathanis> (edit) "you" => "~~you" | ""original"" => ""original"~~"
17:52:50FromDiscord<hmmm> hmm I can do that, I was hoping for some simple for loop trickery to avoid a bunch of code 🙂
17:53:22FromDiscord<Yardanico> In reply to @hmmm "hmm I can do": if `original` is always with 0s, it's just 2 lines of code
17:53:29FromDiscord<Yardanico> `setLen`
17:53:32FromDiscord<hmmm> ye original is always with 0
17:54:02FromDiscord<Yardanico> ?
17:54:03FromDiscord<hmmm> setlen slashes the longer seq right? but what about the padding
17:54:05FromDiscord<Yardanico> sent a code paste, see https://play.nim-lang.org/#ix=4g9j
17:54:15FromDiscord<Yardanico> In reply to @hmmm "setlen slashes the longer": it expands if it's too short, removes if it's too long
17:54:18FromDiscord<Yardanico> kinda obvious from the name
17:54:27FromDiscord<hmmm> woa
17:54:35FromDiscord<hmmm> this is so comfy
17:54:35FromDiscord<Arathanis> and since default int value is 0, the expand should fill with 0s!
17:54:38FromDiscord<Arathanis> good call @Yardanico
17:54:51FromDiscord<Arathanis> if you want to pad with non-zero you will have to add more logic
17:54:54FromDiscord<Arathanis> just keep that in mind
17:55:00FromDiscord<Yardanico> yeah, setLen is useful for lower level stuff especially because it doesn't change the capacity
17:55:11FromDiscord<Yardanico> so you can reuse the same buffer if you have some code that adds to the seq, and then you need to "reset" it
17:55:15FromDiscord<Yardanico> so you won't allocate every loop iteration
17:56:10FromDiscord<Yardanico> In reply to @jmgomez "Yeah, https://twitter.com/PiotrekTomiak/status/1593": i checked, they do seem to have some debugging support and some defaults
17:56:22FromDiscord<Yardanico> e.g. they already provide some built-in expression so the editor can read nim strings, but only with refc
17:56:30FromDiscord<Yardanico> arc/orc have strings/seq with a different internal layout so they can't be read
17:56:44FromDiscord<Yardanico> maybe I should try doing lldb expressions for that myself
17:56:55FromDiscord<Yardanico> ah right, you just can't really do that for tables
17:57:02FromDiscord<Yardanico> they don't store the original values for keys, only hashes :P
17:58:01*derpydoo joined #nim
17:58:45FromDiscord<jmgomez> Ohh I see, I tried with rider on NUE but I assumed it didnt work with dlls or something with my setup. But then it's ORC? Although I saw the statcktrace listed, downloading clion now..
17:59:16*junaid__ joined #nim
17:59:35FromDiscord<Yardanico> In reply to @jmgomez "Ohh I see, I": what didn't work?
17:59:41FromDiscord<Yardanico> if you mean strings, then it's because devel defaults to orc
17:59:49FromDiscord<Yardanico> and the extension seems to only understand strings/seqs for refc
18:00:07FromDiscord<Yardanico> they have different internal representation in arc/orc so it doesn't work
18:00:31FromDiscord<ShalokShalom> In reply to @jmgomez "Ohh I see, I": I am also about to use it on Rider.
18:00:32FromDiscord<jmgomez> On the other hand debugging alongside intellisense, are the most important tools that a dev would want.. I have zero idea of lldb but we should push it. For the hashes, the compiler does know if you are debugging so it can emit the proper symbols/values..
18:00:43FromDiscord<ShalokShalom> Do you use it for the Unreal support?
18:00:45FromDiscord<Yardanico> well lldb can be easily used in vscode and all that
18:00:47FromDiscord<jmgomez> Yeah, I use ORC on NUE too..
18:00:51*junaid__ quit (Quit: leaving)
18:01:08FromDiscord<Yardanico> There's really nothing new in how this extension does debugging really, it just provides a way for it to work out of the box :)
18:01:09FromDiscord<ShalokShalom> I wonder if I can use both F# and Nim for one Unreal project.
18:01:15FromDiscord<ShalokShalom> That would be really cool.
18:01:17FromDiscord<Yardanico> and then it uses the same usual stuff for getting actual Nim values
18:01:26FromDiscord<Yardanico> nim-gdb does the same but it's not really maintained, we could rewrite it to use LLDB
18:01:43FromDiscord<Yardanico> also nim-gdb uses nim runtime type info kinda a lot, and that just doesn't exist with arc/orc
18:01:50FromDiscord<jmgomez> In reply to @Yardanico "nim-gdb does the same": I would help if someone else leads the project..
18:02:05FromDiscord<jmgomez> And also to improve the intellisense with another approach different than nim suggest
18:02:20FromDiscord<jmgomez> In reply to @ShalokShalom "I wonder if I": how would you use F#?
18:02:27FromDiscord<ShalokShalom> UnrealCLR
18:02:30FromDiscord<jmgomez> UnrealCLR, with all my respect, it's a toy
18:02:44FromDiscord<ShalokShalom> Its currently not yet compatible with Unreal 5
18:02:46FromDiscord<Yardanico> In reply to @jmgomez "And also to improve": the main problem with non-nimsuggest is macros
18:02:49FromDiscord<Yardanico> and templates too
18:02:57FromDiscord<ShalokShalom> I will see 👀
18:02:58FromDiscord<jmgomez> Proper unreal bindings is not just interop with cpp
18:03:16FromDiscord<Yardanico> it will work for basic Nim code just fine, but when you get into macros, compileTime functions, templates, it'll stop working
18:03:24FromDiscord<jmgomez> In reply to @Yardanico "the main problem with": Yeah, but NimSuggest is still there for that
18:03:55FromDiscord<Yardanico> I guess I'll look at LLDB soon again, see how simple it is to at least get expressions for strings/seqs, should be really simple
18:04:09FromDiscord<ShalokShalom> Do you suggest to drop Nim suggest completely?
18:04:14FromDiscord<jmgomez> In reply to @Yardanico "I guess I'll look": Okay, keep updated pls if you do so
18:04:14FromDiscord<ShalokShalom> Or just for this case
18:04:37FromDiscord<jmgomez> In reply to @ShalokShalom "Do you suggest to": No..
18:04:42FromDiscord<Elegantbeef> I still need to toy with the compiler to emit `debug` procedures that the nim pretty printer can call
18:05:01FromDiscord<Jessa> sent a code paste, see https://play.nim-lang.org/#ix=4g9l
18:05:15FromDiscord<jmgomez> NimSuggest is great.. Im saying that you can use another approach (much faster) for regular nim code
18:05:16FromDiscord<Elegantbeef> You just did
18:05:19FromDiscord<Yardanico> In reply to @Jessa "how would i make": your code just works as is
18:05:22FromDiscord<Yardanico> nim has UFCS
18:05:26FromDiscord<Yardanico> a.b() is same as b(a)
18:05:39FromDiscord<Jessa> wait what
18:05:41FromDiscord<Jessa> really
18:05:41FromDiscord<Yardanico> lol
18:05:42FromDiscord<Elegantbeef> But regular nim code has templates and macros↵(@jmgomez)
18:05:43FromDiscord<Yardanico> yes
18:05:46FromDiscord<Jessa> omg
18:05:52FromDiscord<Yardanico> https://nim-lang.org/docs/manual.html#procedures-method-call-syntax
18:06:06FromDiscord<Jessa> holy fuck
18:06:09FromDiscord<Jessa> i love nim
18:06:17FromDiscord<jmgomez> In reply to @Elegantbeef "But regular nim code": right, regular nim code except templates and macros then
18:06:29FromDiscord<jmgomez> for templates and macros NimSuggest is fine
18:07:45FromDiscord<Yardanico> @jmgomez this is how codelldb extension with nim looks ootb in vscode
18:07:47FromDiscord<Yardanico> https://media.discordapp.net/attachments/371759389889003532/1042863636651188365/image.png
18:07:52FromDiscord<Jessa> that's actually amazing, i love how it automatically kind of knows to make the string_function an extension of string↵↵i'm so used to python where it's basically impossible to do that
18:08:00FromDiscord<Elegantbeef> sent a code paste, see https://play.nim-lang.org/#ix=4g9n
18:08:22FromDiscord<Elegantbeef> Not using a compiler to give code suggestions is a dead end if you ask me
18:08:39FromDiscord<Yardanico> at least for compiled languages I'd kind of agree, there's just too much going on
18:08:52FromDiscord<Yardanico> all the types and stuff, you'd have reimplement large parts of the compiler yourself otherwise
18:09:06FromDiscord<Elegantbeef> Or you dont and the tooling is mostly useless
18:09:37FromDiscord<Elegantbeef> sent a code paste, see https://play.nim-lang.org/#ix=4g9o
18:09:50FromDiscord<Elegantbeef> How does it know whether x is mutable
18:09:55FromDiscord<jmgomez> In reply to @Yardanico "": yeah, same in regular VS and my current Rider setup..
18:10:18FromDiscord<Yardanico> well that's how it'd look like, the jetbrains extension didn't really add much to it
18:10:20FromDiscord<jmgomez> sent a code paste, see https://play.nim-lang.org/#ix=4g9p
18:10:24FromDiscord<Yardanico> they just added some defaults for strings and the like
18:10:29FromDiscord<jmgomez> I mean ideally it would work better, but it doesnt..
18:10:40FromDiscord<Elegantbeef> The real thing for debugging is emitting debugging procedures
18:10:54FromDiscord<Elegantbeef> If someone adds that functionality into the compiler we're golden
18:10:59FromDiscord<Elegantbeef> No more complex pretty printer
18:11:21FromDiscord<Elegantbeef> You just call the nim debug procedure and you've got complex types showing up when debugging
18:11:34FromDiscord<Yardanico> debuggers can call native code from the binaries themselves?
18:11:49FromDiscord<Elegantbeef> https://github.com/nim-lang/Nim/blob/devel/tools/nim-gdb.py#L135-L171
18:12:17FromDiscord<Yardanico> oh yeah at least for $
18:12:21FromDiscord<Elegantbeef> Nim's already allows you to call the `$` proc, but Nim doesnt emit one for everytype nor mark it `extern`
18:12:31FromDiscord<jmgomez> I think it's important enough to be considered
18:12:36FromDiscord<Yardanico> and if it's not extern you can't call it from gdb?
18:12:38FromDiscord<Elegantbeef> This is a much better way of handling pretty printer imo
18:12:47FromDiscord<Elegantbeef> Well extern code doesnt get DCE'd out
18:12:53FromDiscord<jmgomez> (edit) "considered" => "considered↵https://discord.com/channels/371759389889003530/371759389889003532/1042864423070617671"
18:12:56FromDiscord<Yardanico> ah you mean exportc ?
18:13:13FromDiscord<Elegantbeef> Same difference 😜
18:13:29FromDiscord<Elegantbeef> I know it's not
18:13:30FromDiscord<Elegantbeef> but meh
18:13:35FromDiscord<Yardanico> can't one just create a small lib/prelude file that just has a single exportc proc by calling $ for most stdlib types?
18:13:47FromDiscord<Yardanico> i know then it's not 0 effort, but a single import is still good enough
18:13:54FromDiscord<Elegantbeef> One could but the issue is that still can be DCE'd
18:13:59FromDiscord<Yardanico> not if it's exportc ?
18:14:09FromDiscord<Elegantbeef> missed the exportc part
18:14:22FromDiscord<Yardanico> yeah ugly, but I think it'd work
18:14:53FromDiscord<.tochka> hm, could unmanaged pointer be casted to var array
18:15:03FromDiscord<.tochka> you cant assign to items of non-var array right?
18:15:13FromDiscord<Yardanico> if you want to have nice array syntax, use UncheckedArray[T]
18:15:24FromDiscord<Elegantbeef> `cast[ptr UncheckedArray[T]](myPtr)`
18:15:40FromDiscord<.tochka> yes, but you lose length guarantee
18:15:51FromDiscord<Elegantbeef> you can cast it to an array aswell
18:15:55FromDiscord<Elegantbeef> Or use toOpenArray after
18:16:02FromDiscord<Elegantbeef> I'd suggest the latter more
18:16:50FromDiscord<.tochka> non static length 😔
18:16:54FromDiscord<Elegantbeef> But yea yardanico that's a way of doing it, but really the compiler should emit `gdb_debug` procedures for every type
18:17:21FromDiscord<Yardanico> In reply to @.tochka "non static length 😔": > you can cast it to an array as well
18:17:24FromDiscord<Elegantbeef> Instead of using RTTI and attempting to figure out the data
18:17:30FromDiscord<.tochka> In reply to @Yardanico "> you can cast": but not a var one
18:17:43FromDiscord<Yardanico> why not?
18:17:45FromDiscord<Elegantbeef> `ptr array[l, t]` is a var
18:17:53FromDiscord<Elegantbeef> It's a L-value == var
18:18:10FromDiscord<.tochka> oh this way
18:18:20FromDiscord<Elegantbeef> You can likely also do `var array[l, t]`
18:18:34FromDiscord<Elegantbeef> Though i might misremember that
18:21:00FromDiscord<Elegantbeef> Thinking about it yard your idea falls apart with generics
18:21:07*junaid_ joined #nim
18:21:33FromDiscord<Elegantbeef> Only the compiler or someone that manually emits a debug proc can do it
18:21:59FromDiscord<Yardanico> sent a code paste, see https://play.nim-lang.org/#ix=4g9u
18:22:06FromDiscord<Yardanico> did this never work?
18:24:33FromDiscord<Elegantbeef> Is `$` not seen as a infix operator here?
18:24:59FromDiscord<Elegantbeef> Yea it is
18:25:09FromDiscord<Elegantbeef> `a op b` is always an infix operator
18:28:59FromDiscord<ShalokShalom> @jmgomez I installed Rider and the Nim plugin.↵↵Do you create a new dotnet solution, when you want a pure Nim project?
18:29:27FromDiscord<ShalokShalom> The new solution dialog, seems not to offer any Nim solution
18:29:40FromDiscord<ShalokShalom> I would just like an empty file 😄
18:30:05FromDiscord<Yardanico> just open any empty folder :P
18:31:00FromDiscord<ShalokShalom> Ah really?
18:31:01FromDiscord<ShalokShalom> Nice
18:32:47FromDiscord<ShalokShalom> Its really obvious, that the developers of Rider use the software themselves
18:33:37FromDiscord<Arouzing> So I know this is a simple thing. But like love how parentheses aren't required when applying procs to objects.
18:33:41FromDiscord<ShalokShalom> Lets you wonder, in which world we could be, when every product would be made by developers for developers and they simultaneously gain enough money for it
18:34:13FromDiscord<ShalokShalom> In reply to @Arouzing "So I know this": Particularly imperative and oo languages are noisy.
18:34:28FromDiscord<ShalokShalom> Functional languages are more often similar in style to Nim.
18:34:50FromDiscord<ShalokShalom> Its what brought me to Nim in the first place, so I definitely understand you.
18:35:40FromDiscord<Arouzing> It was a little thing that when I learned it made me smile.
18:35:52FromDiscord<haxscramper> By the way @ShalokShalom I wanted to ask -- are you working on some software in nim? I looked at discord history and you've been around for quite some time actually (2020) so you probably have several things you worked on during that time
18:36:51FromDiscord<ShalokShalom> I did not visit the community for several years
18:37:55FromDiscord<ShalokShalom> And I worked mostly on myself in that time 😅
18:39:18FromDiscord<ShalokShalom> Meaning I read a lot of literature, communicated with people online, watched videos, lots of theoretical background stuff.↵↵I know that practical development make huge of a difference, and I appreciate the inspiration 😅
18:40:21FromDiscord<ShalokShalom> And I never wanted to storm ahead and start developing with the first language that I come across.↵↵I am a blank sheet of paper, and haven't made my mind up about which language and framework I wanna specialize about up until very recently
18:40:39FromDiscord<ShalokShalom> I wanted to study the environment, before I actually settle down. 🙂
18:43:02*junaid_ quit (Remote host closed the connection)
18:43:15*jjido joined #nim
18:49:27*xet7 quit (Ping timeout: 256 seconds)
18:49:46FromDiscord<jmgomez> @Yardanico just tested it with both, orc and refc and it's pretty bad. Still good news that they pretend to improve it, ping me out if you ever start looking it lldb. It has been on my roadmap since the very beginning: https://github.com/jmgomez/NimForUE/blob/4f8ff5b64bdce33ef9faac766a3e5931e90087c0/Readme.md?plain=1#L140
18:53:24FromDiscord<ShalokShalom> In reply to @jmgomez "<@177365113899057152> just tested it": If you were right, and my comment caused this, then they had just a few days time
18:53:27*Guest47 joined #nim
18:53:35FromDiscord<ShalokShalom> Maybe they improve more now and commit to it
18:53:54FromDiscord<ShalokShalom> ✌🏻
18:54:00*Guest47 quit (Client Quit)
18:57:14*jmdaemon joined #nim
18:58:09FromDiscord<@thatrandomperson5-6310e3b26da03> How would i turn parsed toml into json object?
18:58:44FromDiscord<Phil> Like you have a nim object and want a JSON string?
19:00:06FromDiscord<Phil> If you want to use std/json, just use the `%` proc, if you're fine with using jsony (another lib for the same purpose but faster and imo better), use `toJson()` after importing jsony
19:00:48FromDiscord<user2m> sent a code paste, see https://play.nim-lang.org/#ix=4g9D
19:00:58FromDiscord<jmgomez> you can use toJSon with the std one too
19:01:04FromDiscord<jmgomez> (edit) "toJSon" => "toJson"
19:01:19FromDiscord<Jessa> sent a code paste, see https://play.nim-lang.org/#ix=4g9E
19:01:20FromDiscord<Elegantbeef> `(kind, path) in lsdirseq`
19:01:41FromDiscord<Elegantbeef> `kind, path in lsdirseq` calls `pairs` which yields `(int, tuple)`
19:02:13FromDiscord<Elegantbeef> you need `\\` on any `\` that are supposed to be in the string↵(@Jessa)
19:02:22FromDiscord<Jessa> yes
19:02:23FromDiscord<Jessa> i do
19:02:24FromDiscord<Elegantbeef> At the very end i see `\]`
19:02:35FromDiscord<user2m> In reply to @Elegantbeef "`kind, path in lsdirseq`": perfect!
19:02:43FromDiscord<Jessa> wait
19:03:01FromDiscord<Jessa> so, i need 4`\`'s for every escaped `\`?
19:03:04FromDiscord<Elegantbeef> !eval echo ']'
19:03:09NimBot]
19:03:12FromDiscord<Jessa> (edit) "so, i need 4`\`'s for every escaped `\`? ... " added "in nim regex"
19:03:13FromDiscord<Elegantbeef> Shit
19:03:14FromDiscord<Elegantbeef> Anyway
19:03:35FromDiscord<Elegantbeef> No
19:03:42FromDiscord<Elegantbeef> You need to escape `\` in the literal
19:04:13FromDiscord<Elegantbeef> You also might be able to do `fmt"""yourregexhere"""`
19:04:26FromDiscord<Elegantbeef> or \`fmt"yourregexhere"\~
19:04:41FromDiscord<Elegantbeef> raw string literals do not do escaping
19:04:45FromDiscord<Elegantbeef> both of the above are raw string literals
19:04:52FromDiscord<ZaZi> Hello
19:04:58FromDiscord<Jessa> ii see
19:05:20FromDiscord<Phil> It's the `\` near whitelist that are murdering you... well it compiles if you double up the backslashes on those
19:05:29FromDiscord<Elegantbeef> Though i'm still dubious of regex
19:05:41FromDiscord<Phil> I have no idea what that regex is supposed to look like either
19:05:51FromDiscord<Phil> Also, cheers ZaZi
19:05:56FromDiscord<Elegantbeef> It's not supposed to look like regex
19:06:08FromDiscord<Elegantbeef> What's the format of what you're attempting to capture?
19:06:29FromDiscord<Elegantbeef> I dislike regex so i'm probably going to be an idiot about this
19:07:22FromDiscord<Phil> I personally don't mind them, but the last time I had to use them was ages ago and learning the individual steps to actually make one in a given language, what needs additional escaping where etc. is always a bit of a re-learn
19:07:29FromDiscord<Jessa> sent a long message, see http://ix.io/4g9H
19:07:48FromDiscord<Elegantbeef> I mean i want to know what you're attempting to capture
19:07:58FromDiscord<Elegantbeef> The pattern doesnt help me much since i dont use regex 😄
19:08:14FromDiscord<Jessa> how do you mean, what i'm trying to capture?
19:08:21FromDiscord<Elegantbeef> I avoid it like the plague as it's a horrid API that is unreadable and unmaintainable
19:08:32FromDiscord<Elegantbeef> What are you attempting to do with the regex
19:08:37FromDiscord<Jessa> In reply to @Jessa "simiplified regex i'm trying": ^
19:08:41FromDiscord<Elegantbeef> Match, search, .... parse
19:08:51FromDiscord<Phil> Jessa wants the string `"[potato]"` to match I believe, but not `"\\[potato]"`
19:08:56FromDiscord<Phil> (edit) "`"\\[potato]"`" => "`"\[potato]"`"
19:09:10FromDiscord<Jessa> yes-
19:09:13FromDiscord<Phil> R being a placeholder for whatever
19:09:23FromDiscord<ZaZi> Im new to Nim and have a few question before I might learn can Nim compile for riscv?
19:09:36FromDiscord<Phil> is R just anything in the whitelist?
19:09:41FromDiscord<Phil> Or is it literally anything?
19:10:18FromDiscord<Jessa> whitelist will be compiled of whatever i decide to put in there
19:10:25FromDiscord<Elegantbeef> sent a code paste, see https://play.nim-lang.org/#ix=4g9I
19:11:00FromDiscord<Elegantbeef> then you can do `if myData in myWhiteList`
19:11:19FromDiscord<Elegantbeef> No clue if it's technically supported but it's likely capable↵(@ZaZi)
19:11:24FromDiscord<Phil> I think it's not `$+`, it's one of "list of entries in a seq[string]"
19:11:26FromDiscord<Jessa> honestly, the regex works fine, that's not the problem↵it's just not compiiling
19:11:42FromDiscord<Elegantbeef> I mean i gave the solution for the regex
19:11:54FromDiscord<Elegantbeef> `\]` is an invalid character
19:12:00FromDiscord<Elegantbeef> you need to escape any `\` with `\\`
19:12:07FromDiscord<Elegantbeef> or use raw string lits
19:12:28FromDiscord<Elegantbeef> This latter part is me disliking regex cause it's awful 😛
19:12:31FromDiscord<Jessa> yes, and i'm wondering if to check for `\` in regex, ii need `\\` or `\\\\`
19:12:31FromDiscord<Elegantbeef> I said i was being an idiot!
19:12:31FromDiscord<Phil> All the unnecessary `()` brackets are kinda throwing me off unless there's extra logic involved
19:12:49FromDiscord<Elegantbeef> you need `\\`
19:12:53FromDiscord<Elegantbeef> I dont get why you'd need 4
19:13:08FromDiscord<Elegantbeef> `\` is the start of a character literal `\\` is a character `'\'`
19:14:47FromDiscord<Elegantbeef> Like i said this is easier though
19:14:48FromDiscord<Elegantbeef> sent a code paste, see https://play.nim-lang.org/#ix=4g9L
19:15:37FromDiscord<Jessa> In reply to @Isofruit "All the unnecessary `()`": let me writie out the regex explenation
19:16:23FromDiscord<qb> sent a code paste, see https://play.nim-lang.org/#ix=4g9N
19:16:51FromDiscord<qb> (edit) "https://play.nim-lang.org/#ix=4g9N" => "https://play.nim-lang.org/#ix=4g9O"
19:17:07FromDiscord<Jessa> sent a code paste, see https://play.nim-lang.org/#ix=4g9P
19:18:14FromDiscord<Jessa> (edit) "https://play.nim-lang.org/#ix=4g9P" => "https://play.nim-lang.org/#ix=4g9Q"
19:18:22FromDiscord<Elegantbeef> sent a code paste, see https://play.nim-lang.org/#ix=4g9R
19:18:38FromDiscord<Jessa> (edit) "https://play.nim-lang.org/#ix=4g9Q" => "https://play.nim-lang.org/#ix=4g9S"
19:18:50FromDiscord<Jessa> sent a code paste, see https://play.nim-lang.org/#ix=4g9T
19:23:49FromDiscord<DarkSky> How can i get current date in `yyy-MM-dd`?
19:23:57FromDiscord<DarkSky> i went through the whole docs and can
19:24:02FromDiscord<DarkSky> (edit) "can" => "can't find it"
19:24:10FromDiscord<DarkSky> (sorry im new)
19:27:22FromDiscord<Elegantbeef> !eval import std/times; echo now().format("yyyy-MM-dd")
19:27:31NimBotCompile failed: 2022-11-17
19:27:43FromDiscord<Elegantbeef> Close enough
19:28:14FromDiscord<DarkSky> oooooooooooooooooooooooooooooh lol that makes sense
19:28:22FromDiscord<DarkSky> my bad, i started learning today
19:28:26FromDiscord<DarkSky> trying to get used to the syntax
19:30:54FromDiscord<DarkSky> sent a code paste, see https://play.nim-lang.org/#ix=4g9V
19:31:16FromDiscord<DarkSky> (edit) "https://play.nim-lang.org/#ix=4g9V" => "https://play.nim-lang.org/#ix=4g9W"
19:31:54FromDiscord<ZaZi> does nim have pointers?
19:32:03FromDiscord<.tochka> yes
19:32:38FromDiscord<.tochka> In reply to @ZaZi "does nim have pointers?": https://nim-lang.org/docs/manual.html#types-reference-and-pointer-types
19:32:41FromDiscord<@thatrandomperson5-6310e3b26da03> Anyone know how i would convert parsed toml into json?
19:34:07FromDiscord<@thatrandomperson5-6310e3b26da03> Nvm im stupid
19:34:35FromDiscord<DarkSky> sent a code paste, see https://play.nim-lang.org/#ix=4g9X
19:35:02*xet7 joined #nim
19:35:03*arkurious joined #nim
19:35:55FromDiscord<qb> sent a code paste, see https://play.nim-lang.org/#ix=4g9Z
20:21:53FromDiscord<voxal> sent a code paste, see https://play.nim-lang.org/#ix=4ga9
20:26:26FromDiscord<voxal> sent a code paste, see https://play.nim-lang.org/#ix=4gab
20:35:54FromDiscord<albassort> is there anyway to get all the variables on a object
20:38:45FromDiscord<Elegantbeef> https://play.nim-lang.org/#ix=4gae this is a bit ugly, but it's likely more efficient↵(@qb)
20:38:55FromDiscord<Elegantbeef> Basically we check if the end/start match
20:39:06FromDiscord<Elegantbeef> For what reason?↵(@albassort)
20:39:26FromDiscord<albassort> serialization stuff\
20:39:27FromDiscord<Elegantbeef> compile with `--mm:refc`↵(@voxal)
20:39:29FromDiscord<albassort> (edit) "stuff\" => "stuff"
20:39:59FromDiscord<Elegantbeef> sent a code paste, see https://play.nim-lang.org/#ix=4gaf
20:40:04FromDiscord<Elegantbeef> Otherwise i suggest using disruptek's assume
20:40:17FromDiscord<Elegantbeef> it's typeit works well for object variants
20:40:22FromDiscord<Elegantbeef> You could also just use frosty in that case
20:41:21FromDiscord<Elegantbeef> whoops `myobj.fieldpairs`
20:41:26FromDiscord<Elegantbeef> or `for field in myObj.fields`
20:41:26FromDiscord<albassort> i realized my idea is stupid
20:41:28FromDiscord<albassort> nevermind
20:41:35FromDiscord<albassort> hmm actually
20:41:43FromDiscord<albassort> nah actually its stupid
20:41:46FromDiscord<albassort> unless
20:42:56FromDiscord<Jessa> i'm curious↵would there be a way to get all functions / procs within the nim file?
20:43:16FromDiscord<Elegantbeef> There is not
20:43:23FromDiscord<voxal> In reply to @Elegantbeef "compile with `--mm:refc` (<@290952090560364545>)": thanks, what does this flag mean exactly?
20:43:26FromDiscord<Elegantbeef> There are some hacky ways but there is not really a way to do it
20:43:33FromDiscord<Jessa> i see
20:43:38FromDiscord<Elegantbeef> it uses the gc instead of orc which is the default o ndevel
20:43:46FromDiscord<voxal> ah i see
20:43:58FromDiscord<Elegantbeef> jester seems to not be written in an orc friendly way
20:44:10FromDiscord<Elegantbeef> httpx i think is orc friendly
20:44:21FromDiscord<albassort> i can think of a few very hacky ways
20:44:29FromDiscord<albassort> but like
20:44:30FromDiscord<voxal> ill look into it thanks
20:44:34FromDiscord<albassort> nothing you 'd want to practically do
20:45:22FromDiscord<Elegantbeef> I might have meant prologue
20:46:26FromDiscord<Elegantbeef> albassort if you mean the list all procs in a file you basically parse the file using `parseStmt` then iterate it
20:46:30FromDiscord<Elegantbeef> It's very much not a good idea
20:46:38FromDiscord<albassort> yea
20:47:04FromDiscord<albassort> im going to make a bidirectional table by using stale memory
20:47:04FromDiscord<Elegantbeef> There very much needs to be a macro for `allExportedSymbols`
20:48:06FromDiscord<Elegantbeef> sent a code paste, see https://paste.rs/FiI
20:48:55FromDiscord<albassort> I just realized why bidrectional hastables are hard
20:49:27FromDiscord<albassort> my idea was to allocate a block of memory and then alternate key value pairs
20:49:36FromDiscord<albassort> say int to int
20:49:43FromDiscord<albassort> 3929320123921
20:49:55FromDiscord<albassort> (edit) "3929320123921" => "390|209|320|123|921"
20:50:04FromDiscord<albassort> but thats kinda blegh
21:04:35FromDiscord<albassort> its going to be bi-tri-directonal
21:05:08FromDiscord<Generic> I have not looked into other implementations, but I guess it is a big know your usecase thing
21:05:28FromDiscord<Generic> like dependind on whether you access more often via one side
21:05:29FromDiscord<albassort> I'm looking for implementations
21:05:36FromDiscord<Generic> or whether the key is lightweight or not
21:07:15FromDiscord<albassort> obvious the worst case scenario, the one im heading for, is O(n)
21:07:30FromDiscord<albassort> scalling up a block of memory
21:07:59FromDiscord<albassort> i dont know if a O(1) solution is possible for a directional map
21:26:48FromDiscord<Phil> I felt tempted to use mold since apparently it speeds up compilation.↵Then I realized I deploy my only larger project in an alpine container and compile with musl-gcc, which isn't compatible with mold it appears.↵Now I'm just saddened
21:27:50FromDiscord<Phil> (edit) "I felt tempted to use mold ... sincecompilation" added "linker" | "compilation.↵Then" => "compilation in the lto phase quite significantly.↵Then"
21:28:25FromDiscord<Yardanico> In reply to @Isofruit "I felt tempted to": use zig cc with mold?
21:28:36FromDiscord<Yardanico> and also mold will only speed up linking, not compilation
21:28:52FromDiscord<Yardanico> LTO wouldn't be managed by mold anyway
21:29:03FromDiscord<Phil> Doesn't linking count as part of the compilation phase ?
21:29:21FromDiscord<Yardanico> you can say that, true, but again, mold is only useful for projects that are big
21:29:27FromDiscord<Yardanico> like hundreds of MBs of object files
21:29:29FromDiscord<.tochka> In reply to @albassort "i dont know if": for lookup?
21:29:46FromDiscord<Phil> Alrighty, then at least I didn't get my terminology entirely wrong
21:31:06FromDiscord<albassort> In reply to @.tochka "for lookup?": well, yea... taking from memory address the lookup specifies will usually take O(n) of the size of the pointer or block of data
21:31:09FromDiscord<.tochka> you usually dont have consatnt O(1) in any sort of map, as bucket clashes are a thing
21:31:24FromDiscord<albassort> yes
21:31:35FromDiscord<albassort> for a one directional map
21:31:49FromDiscord<albassort> but i cant find an algorithm for a bidirectional map
21:31:56FromDiscord<albassort> so that makes me think it'll be O(1)
21:32:31FromDiscord<.tochka> my stupid idea for optimized lookup bidirectional, but it would be memory hungry and a mess to keep the states on mutations https://media.discordapp.net/attachments/371759389889003532/1042915161725472828/image.png
21:32:59FromDiscord<albassort> the only benefit to bidirectional is memory
21:33:20FromDiscord<albassort> if you need state you might as well just use two tables
21:33:44FromDiscord<.tochka> thats pretty much just two tables ye, just with specialized items
21:37:09FromDiscord<qb> sent a code paste, see https://play.nim-lang.org/#ix=4gas
21:37:11FromDiscord<qb> Shouldn't that raise an error?
21:37:25FromDiscord<albassort> nah
21:37:40FromDiscord<albassort> overflow is fine
21:37:45FromDiscord<Elegantbeef> Unsigned integers are not checked for overflow
21:37:50FromDiscord<Elegantbeef> And underflow
21:37:53FromDiscord<albassort> ^
21:37:55FromDiscord<qb> Oh
21:38:47FromDiscord<albassort> https://media.discordapp.net/attachments/371759389889003532/1042916739966574742/image.png
21:40:01FromDiscord<qb> sent a code paste, see https://play.nim-lang.org/#ix=4gat
21:40:26FromDiscord<qb> Or could I prevent overflowing / underflowing in some way
21:40:39FromDiscord<albassort> i would make my own +
21:41:16FromDiscord<.tochka> ye you can define new integer type also
21:41:59FromDiscord<vindaar> Yeah, I'd define a `CheckedUint8 = distinct uint8` with custom math operations if you really need that. Makes sure you can never forget to do the check
21:42:18FromDiscord<qb> Alrighty thanks
21:43:21FromDiscord<albassort> sent a code paste, see https://play.nim-lang.org/#ix=4gax
21:43:30FromDiscord<albassort> (edit) "https://play.nim-lang.org/#ix=4gax" => "https://play.nim-lang.org/#ix=4gay"
21:43:46FromDiscord<albassort> or something
21:43:48FromDiscord<albassort> (edit) "https://play.nim-lang.org/#ix=4gay" => "https://play.nim-lang.org/#ix=4gaz"
21:43:54FromDiscord<.tochka> lol
21:44:10FromDiscord<albassort> (edit) "https://play.nim-lang.org/#ix=4gaz" => "https://play.nim-lang.org/#ix=4gaA"
21:45:06FromDiscord<.tochka> sent a code paste, see https://play.nim-lang.org/#ix=4gaB
21:48:48FromDiscord<.tochka> sent a code paste, see https://play.nim-lang.org/#ix=4gaE
21:48:48FromDiscord<.tochka> :D
21:49:25FromDiscord<.tochka> would not work for uint8 and uint16 doe, gcc and clang dont define it for those
21:49:28FromDiscord<albassort> beef please stop this person
21:50:02FromDiscord<albassort> no way that compile s
21:50:06FromDiscord<Elegantbeef> Nah i got them here
21:50:16FromDiscord<.tochka> (edit) "https://play.nim-lang.org/#ix=4gaE" => "https://play.nim-lang.org/#ix=4gaF"
21:50:16FromDiscord<Elegantbeef> It doesnt compile
21:50:19FromDiscord<Elegantbeef> They forgot to convert `a` and `b` to the C counterparts
21:50:20FromDiscord<.tochka> In reply to @albassort "no way that compile": i havent checked tbh
21:50:32FromDiscord<albassort> :KEK:
21:50:54FromDiscord<Elegantbeef> Sorry for unleashing tochka upon this realm
21:53:36FromDiscord<Horizon [She/Her]> In reply to @.tochka "my stupid idea for": Why not two sequences/arrays that keep the same index?
21:54:17FromDiscord<Horizon [She/Her]> `a["key"]` uses the sequence that stores the keys, it gets the index and uses it on the sequence storing the values
21:54:35FromDiscord<Horizon [She/Her]> `a["value"]` this does the same, but reversed
21:54:44FromDiscord<Horizon [She/Her]> In reply to @.tochka "my stupid idea for": ^^
21:55:01FromDiscord<.tochka> In reply to @Event Horizon "Why not two sequences/arrays": index is supposed to be corresponding to key you're looking for
21:55:08FromDiscord<Horizon [She/Her]> Yeah
21:55:08FromDiscord<.tochka> otherwise you have to do linear search
21:55:25FromDiscord<Horizon [She/Her]> What's the difference between a value and key map?
21:55:42FromDiscord<Horizon [She/Her]> I mean map and sequence sorry
21:55:48FromDiscord<.tochka> one stores values, other keys. technically they both key and values at the same time
21:55:58FromDiscord<.tochka> (edit) "values" => "value" | "valueat the same time ... " added "for each other"
21:58:54FromDiscord<albassort> In reply to @Event Horizon "I mean map and": they uses hasehs and buckets to be really cool and efficient
21:59:00FromDiscord<albassort> (edit) "hasehs" => "hashes"
21:59:04FromDiscord<.tochka> In reply to @Event Horizon "I mean map and": map has hash to item correspondence, where it doesnt matter when and how you got this hash you can search the map and get the value, even if it mutates. in sequence you have to know that given index has appropriate value, and indexes could change on mutation of sequence
21:59:50FromDiscord<albassort> making a sequence for this lol
22:00:00FromDiscord<albassort> fuck it
22:00:28FromDiscord<.tochka> good choice most of the time tbh
22:00:49FromDiscord<albassort> what do you think this is, lisp
22:00:50Amun-Racan I somehow return an object matching concept without inheritance, as in: https://play.nim-lang.org/#ix=4gaL
22:00:51FromDiscord<albassort> >:O
22:01:13FromDiscord<.tochka> linear search over sequence is actually not bad for small data sets, and in fact a lot more efficient, even if its O(n) vs O(1)
22:01:43FromDiscord<Elegantbeef> Amun concepts are compile time only
22:01:46FromDiscord<.tochka> tho complexity formulas are misleading smh
22:02:11FromDiscord<Elegantbeef> https://play.nim-lang.org/#ix=4gaO
22:02:12FromDiscord<.tochka> In reply to @albassort "what do you think": i didnt say linked list ;p
22:02:14FromDiscord<Elegantbeef> Works but it doesnt do what you want
22:02:26FromDiscord<albassort> In reply to @Elegantbeef "Amun concepts are compile": it doesn't need to
22:02:57FromDiscord<albassort> sent a code paste, see https://play.nim-lang.org/#ix=4gaP
22:02:58FromDiscord<albassort> >:)
22:03:01FromDiscord<Elegantbeef> Wrong reply?
22:03:22FromDiscord<albassort> write compile time macro and do some disgusting shit
22:03:22FromDiscord<.tochka> correct reply
22:03:30FromDiscord<Elegantbeef> Count point https://github.com/beef331/traitor https://github.com/beef331/nimtrest/blob/master/goface.nim https://github.com/yglukhov/iface
22:03:40FromDiscord<Elegantbeef> It's really not that disgusting
22:03:52FromDiscord<Elegantbeef> You need to have a pointer indirection though amun cause the values can be different sizes
22:04:13Amun-Rahmm
22:04:39FromDiscord<albassort> should i make my ime gpu accelerated
22:04:52FromDiscord<.tochka> ime?
22:04:55FromDiscord<Elegantbeef> Stack inheritance does exist, but it's not really usable for polymorphism without so many hacks
22:05:18FromDiscord<albassort> In reply to @.tochka "ime?": im doing some native language stuff and im kinda worried about speed because it needs to be as fast as you type so
22:05:27FromDiscord<.tochka> get rid of nim, write everything to stack in asm, no pointers needed
22:05:40FromDiscord<albassort> wouldn't everything be a pointer in asm
22:05:53FromDiscord<albassort> just the distinction of pointer not exist
22:06:15FromDiscord<Elegantbeef> Everything is untyped 64bit
22:06:20FromDiscord<.tochka> omre like everything is a value with potential to be used for addressing
22:06:28FromDiscord<.tochka> (edit) "omre" => "more"
22:06:30FromDiscord<albassort> i guess?
22:06:48FromDiscord<albassort> in my brain when you use a byte for addressing then it becomes a pointer
22:07:06FromDiscord<Elegantbeef> I guess 64bit is kinda wrong given that there are simd registers
22:07:07FromDiscord<albassort> even if its type is bits
22:07:22FromDiscord<albassort> In reply to @Elegantbeef "I guess 64bit is": yea it doesn't need to be 64bit all the time
22:07:23FromDiscord<Elegantbeef> Asm is typless
22:07:26FromDiscord<Elegantbeef> typeless\
22:07:29FromDiscord<Elegantbeef> There are no integers
22:08:01FromDiscord<albassort> its not literally a byte, theres nothing stopping you from just using it some other wya
22:08:06FromDiscord<albassort> (edit) "wya" => "way"
22:08:11FromDiscord<.tochka> theres probably some cpus with typed registers
22:08:30FromDiscord<Elegantbeef> Let's run JS on them
22:08:37FromDiscord<Elegantbeef> Just to really piss the designers off
22:08:37FromDiscord<albassort> no way
22:08:39FromDiscord<.tochka> i guess you can count fpus as that?
22:08:39FromDiscord<albassort> no possible way
22:08:48FromDiscord<albassort> JAVA cpu
22:08:54FromDiscord<albassort> fuckin OOP cpu
22:09:08FromDiscord<Elegantbeef> Anyway amun what are you actually wanting?
22:09:18FromDiscord<Elegantbeef> Like i know some type of runtime polymorphism
22:14:15Amun-RaElegantbeef: I'm working on video driver interface, I think I'll end with sth like https://play.nim-lang.org/#ix=4gaQ
22:15:26FromDiscord<Elegantbeef> is the `# do stuff` the same?
22:15:34FromDiscord<Elegantbeef> And does each `Driver` have different fields?
22:16:36Amun-Rayes
22:16:53FromDiscord<Elegantbeef> To both questions?
22:18:40Amun-Rado stuff is the same, fields aren't
22:18:57Amun-RaElegantbeef: that's excerpt from the code https://play.nim-lang.org/#ix=4gaR
22:20:30Amun-Raall the drivers are known at ct so I'm fine with that
22:20:50Amun-Raall the driver init proc may fail at rt tho
22:24:02Amun-Rathat sample lacks return at the end of "do stuff" in try clause
22:24:55FromDiscord<Elegantbeef> I really have too much fun writing hacks using macros https://play.nim-lang.org/#ix=4gaT is the whole hack on using methods with stack inheritance thanks to Nim being a prick about it, but doesnt help you
22:25:33Amun-Rahmm
22:25:59FromDiscord<Elegantbeef> You need some pointer indirection and type information to use concepts at runtime
22:26:09Amun-Radriver object are not of the same size but I have to carefully read your example
22:26:28Amun-Raobjects*
22:26:53FromDiscord<Elegantbeef> You'd need to allocate the largest object always if that was the case
22:27:01FromDiscord<Elegantbeef> So you could still use that but's not really advisable
22:27:12Amun-Rathanks
22:27:48FromDiscord<Elegantbeef> Why are you avoiding inheritance?
22:29:28Amun-RaI had inheritance before; I didn't like having proc foo(drv: Driver) = cast[Driver1](drv).foo for every interface callback
22:29:44FromDiscord<Elegantbeef> Why are you casting?
22:29:59FromDiscord<Elegantbeef> `Driver1(drv).foo` or just use methods then do `drv.foo`
22:30:39Amun-Rawell… perhaps because I haven't implemented callback as object fields… ;>
22:33:18Amun-RaElegantbeef: I ended up with https://play.nim-lang.org/#ix=4gaW
22:33:52Amun-Rashe'll be right
22:35:40FromDiscord<Elegantbeef> So that whole "allocate the largest" is done here https://play.nim-lang.org/#ix=4gaY
22:35:56FromDiscord<Elegantbeef> You might say i'm just writing lowlevel code for fun
22:36:31Amun-Rathat's a nice approach
22:36:34FromDiscord<Elegantbeef> All stack based inheritance there, for no real reason aside from why not
22:36:53Amun-RaI like that
22:36:55Amun-Ratbh
22:38:02Amun-RaI think I may use a variation of that; thank you
22:42:37FromDiscord<Elegantbeef> One minor issue is that if you want to unpack it outside of a method you have to cast like so https://play.nim-lang.org/#ix=4gaZ
22:42:38FromDiscord<Elegantbeef> If you only want stack allocations this is pretty much the best you can do, cause of Nim's anger at type mismatch at runtime
22:42:50FromDiscord<Elegantbeef> Well dont yell at me if it breaks!
22:43:07FromDiscord<Elegantbeef> I'm only a slightly sophisticated monkey at a keyboard
23:07:27FromDiscord<albassort> can i make a macro which initializes variables in the proc
23:08:06FromDiscord<albassort> sent a code paste, see https://play.nim-lang.org/#ix=4gb3
23:08:58FromDiscord<albassort> (edit) "https://play.nim-lang.org/#ix=4gb3" => "https://play.nim-lang.org/#ix=4gb5"
23:09:08FromDiscord<albassort> (edit) "https://play.nim-lang.org/#ix=4gb5" => "https://play.nim-lang.org/#ix=4gb6"
23:12:41FromDiscord<albassort> sent a code paste, see https://play.nim-lang.org/#ix=4gb7
23:15:33FromDiscord<Elegantbeef> Again i will say if you can write it macros can make it
23:15:34FromDiscord<Elegantbeef> So yes you can
23:15:47*derpydoo quit (Ping timeout: 256 seconds)
23:16:23FromDiscord<albassort> well yes
23:16:28FromDiscord<albassort> but i haven't seen other people do it
23:16:35FromDiscord<albassort> and im inexperienced with them
23:17:04FromDiscord<xixixi> hi.. is there a simple way to do atomic file read/writes? it's for a simple text configuration file, but i don't want to deal with file locking myself
23:19:22FromDiscord<Elegantbeef> Well i have plent of macros that operate on procs
23:19:27FromDiscord<Elegantbeef> https://github.com/beef331/constructor/blob/master/src/constructor/constructor.nim↵https://github.com/beef331/nettyrpc/blob/master/src/nettyrpc.nim
23:20:35FromDiscord<albassort> In reply to @Elegantbeef "Well i have plent": ones that specifically inject variables tho :\
23:20:48FromDiscord<albassort> time to get reading
23:20:54FromDiscord<Elegantbeef> It's all the same shit
23:21:17FromDiscord<albassort> you're all the same shit
23:21:32*vicecea quit (Remote host closed the connection)
23:25:04FromDiscord<Elegantbeef> Yep
23:39:30*TakinOver quit (Ping timeout: 240 seconds)
23:40:37FromDiscord<! Nilts> Is there any good way in nim json to be like `createJson(kind: JInt, value: 0)` without having a diffrent name for each value
23:43:20FromDiscord<Elegantbeef> An array?
23:43:25FromDiscord<juan_carlos> In reply to @not logged in "Is there any good": `newJint` ?
23:45:22FromDiscord<! Nilts> In reply to @juan_carlos "`newJint` ?": but that will only work with int, not all the other JsonNodeKinds
23:46:15FromDiscord<juan_carlos> How to chain `and` 's in a macro for a `seq[NimNode]` ?, like https://play.nim-lang.org/#ix=4gb8 🤔
23:46:45FromDiscord<! Nilts> In reply to @Elegantbeef "An array?": ?
23:52:08FromDiscord<juan_carlos> In reply to @not logged in "but that will only": Do a `case node.kind` and call the `newJint` etc
23:54:21FromDiscord<vindaar> feel free to adjust https://github.com/SciNim/Unchained/blob/master/src/unchained/utils.nim#L19-L29 to your use case↵(@juan_carlos)
23:55:43FromDiscord<! Nilts> In reply to @juan_carlos "Do a `case node.kind`": but that is a pain. whatever, ill do it