<< 26-02-2022 >>

00:13:35*shalokshalom quit (Remote host closed the connection)
02:57:30*jjido quit (Quit: My MacBook Air has gone to sleep. ZZZzzz…)
03:16:03*ltriant joined #nim
03:16:34FromDiscord<⎝⪩﹏⪨⎠> I don't know why my code can't detect `(` and `)`. https://media.discordapp.net/attachments/371759389889003532/946968953887006720/unknown.png https://media.discordapp.net/attachments/371759389889003532/946968954411315210/unknown.png https://media.discordapp.net/attachments/371759389889003532/946968954952351794/unknown.png https://media.discordapp.net/attachments/371759389889003532/946968955141107712/unknown.png
03:18:37FromDiscord<⎝⪩﹏⪨⎠> `insertToken`: https://media.discordapp.net/attachments/371759389889003532/946969472579817552/unknown.png
03:20:22FromDiscord<Elegantbeef> Is there really any reason to use regex here?
03:20:55*ltriant quit (Ping timeout: 256 seconds)
03:21:33NimEventerNew thread by Geohuz: Is there any kalman filter package in Nim?, see https://forum.nim-lang.org/t/8954
03:22:41FromDiscord<⎝⪩﹏⪨⎠> In reply to @Elegantbeef "Is there really any": Should I use it only for the numbers?
03:22:46FromDiscord<⎝⪩﹏⪨⎠> Let me try.
03:22:50FromDiscord<Elegantbeef> I dont think so
03:24:44FromDiscord<Elegantbeef> sent a code paste, see https://play.nim-lang.org/#ix=3QM0
03:24:51FromDiscord<⎝⪩﹏⪨⎠> In reply to @Elegantbeef "You can just iterate": Hmm...
03:25:37FromDiscord<⎝⪩﹏⪨⎠> I did use Regex 'cause one time used the patterns matching from Lua, and I wanted to try it on Nim.
03:25:46FromDiscord<⎝⪩﹏⪨⎠> (edit) "patterns" => "pattern"
03:26:19*arkurious quit (Quit: Leaving)
03:26:27FromDiscord<Elegantbeef> Ah i dont like regex generally so i'm biased
03:26:32FromDiscord<Elegantbeef> We have things like `parseutils`
03:27:08FromDiscord<⎝⪩﹏⪨⎠> I come fresh from ending the chapter 3 of the "nim tutorial", what did you expected.
03:28:14FromDiscord<Elegantbeef> I mean it's fine i have a dislike of regex
03:28:30FromDiscord<Elegantbeef> https://nim-lang.org/docs/parseutils.html has a tonnes of things that makes this easy
03:46:43nrds<Prestige99> Am I the only one that loves regex? 🤔
03:47:14FromDiscord<⎝⪩﹏⪨⎠> In reply to @nrds "<Prestige> Am I the": I like Regex (well, at least Lua's one).
03:47:23FromDiscord<Elegantbeef> Perhaps scanf/parseutils is nicer imo
03:48:12FromDiscord<⎝⪩﹏⪨⎠> And I thing kind of didn't work: https://media.discordapp.net/attachments/371759389889003532/946976919075819551/unknown.png
03:48:56FromDiscord<⎝⪩﹏⪨⎠> wait what
03:49:30FromDiscord<⎝⪩﹏⪨⎠> Hmm... I think I know what I'm missing.
03:50:15FromDiscord<⎝⪩﹏⪨⎠> Done.
03:52:05FromDiscord<⎝⪩﹏⪨⎠> Ok, I have the Lexer done, now I need to build the Parser.
03:52:27*Gustavo6046 quit (Ping timeout: 250 seconds)
04:01:38*krux02 quit (Remote host closed the connection)
04:02:10FromDiscord<⎝⪩﹏⪨⎠> And that's the part I've always struggled with: I don't have any idea of how to build a parser.
04:02:18FromDiscord<⎝⪩﹏⪨⎠> Ill ask that in another server.
04:02:34FromDiscord<Elegantbeef> There is the #langdev channel
04:04:46FromDiscord<⎝⪩﹏⪨⎠> In reply to @Elegantbeef "There is the <#763409397716090902>": I'm in a server about more generalized programming and with more members than this one.
04:06:01*supakeen quit (Quit: WeeChat 3.4)
04:06:32*supakeen joined #nim
04:37:51FromDiscord<retkid> is there any 3d rendering libraries for nim
04:38:13FromDiscord<Elegantbeef> You can use raylib, or opengl
04:38:19FromDiscord<Elegantbeef> The former is much easier 😀
04:38:55FromDiscord<retkid> I'll try raylib and if not I'll use it as an excuse to try another language
04:39:15FromDiscord<Elegantbeef> One could also use Godot with the nim bindings
04:39:22FromDiscord<retkid> I can, yes
04:39:33FromDiscord<retkid> but I don't think that suits my project
04:39:47FromDiscord<retkid> I might do it in a JS framework for browser embeds
04:40:08FromDiscord<Elegantbeef> Raylib has wasm support
04:40:23FromDiscord<retkid> isn't compiling nim wasm a MASSIVE pain in the tits
04:40:27FromDiscord<retkid> i tried to one time
04:40:38FromDiscord<Elegantbeef> No it's a single config file
04:40:59FromDiscord<Elegantbeef> Dont know if it's a single config file with raylib, but yea it's a single config otherwise
04:41:16FromDiscord<Elegantbeef> https://github.com/treeform/nim_emscripten_tutorial
04:41:21FromDiscord<Elegantbeef> Not a real big pain
04:41:54FromDiscord<retkid> treeform is a gift to the community and he is so productive it is insane
04:42:34FromDiscord<retkid> I wish i could focus on anything as much as he does
04:42:43FromDiscord<retkid> stuff takes me so long because i doze and look at my wall and not workj
04:42:45FromDiscord<retkid> (edit) "workj" => "work"
05:05:42FromDiscord<creikey> In reply to @retkid "stuff takes me so": this happens to me too, how to avoid this?
05:06:31FromDiscord<Rika> somehow build discipline ig
05:17:47NimEventerNew thread by JohnLuck: OrderedTable missing Seq methods, see https://forum.nim-lang.org/t/8955
05:37:07*slowButPresent quit (Quit: leaving)
06:11:32FromDiscord<Deceptive> In reply to @treeform "Here is how you": Damn, this looks a bit easier. Thanks!
07:00:02NimEventerNew thread by Elcritch: Fidget UI: scrolling on OpenGL backend, see https://forum.nim-lang.org/t/8956
07:17:38*ltriant joined #nim
07:22:35*ltriant quit (Ping timeout: 256 seconds)
08:11:35*shalokshalom joined #nim
08:13:25*pro joined #nim
08:15:57*shalokshalom quit (Ping timeout: 240 seconds)
08:16:33*shalokshalom joined #nim
08:18:46*shalokshalom quit (Client Quit)
08:18:59*shalokshalom joined #nim
08:47:31*shalokshalom quit (Remote host closed the connection)
08:49:34*shalokshalom joined #nim
08:55:06*jmd_ joined #nim
08:55:32*jmdaemon quit (Ping timeout: 240 seconds)
08:57:27FromDiscord<tracy> is there a way i can use my nim procedures in c#?
08:57:53FromDiscord<Elegantbeef> You can use `--app:lib` and use it as a system library
08:58:07FromDiscord<Elegantbeef> Suggested to use `arc` or `orc` for your gc in that regard so you do not need to setup the GC
08:58:19FromDiscord<tracy> whas a gc
08:58:38FromDiscord<tracy> oh nvm im slow
08:58:47FromDiscord<Elegantbeef> Nim has multiple memory management systems, the default is a garbage collector
08:58:47FromDiscord<tracy> In reply to @Elegantbeef "You can use `--app:lib`": oooh alr
09:00:21FromDiscord<Elegantbeef> You'l also want https://nim-lang.org/docs/manual.html#foreign-function-interface-dynlib-pragma-for-export
09:00:38FromDiscord<rakgew> and the other way around? can nim look somehow into .net clr libs and use their logic?
09:00:51FromDiscord<Elegantbeef> Yes winim has CLR support
09:01:02FromDiscord<rakgew> ah nice! thx.
09:09:35FromDiscord<tracy> sent a code paste, see https://play.nim-lang.org/#ix=3QMT
09:09:37FromDiscord<tracy> why doesnt this work?
09:09:50FromDiscord<tracy> sent a code paste, see https://play.nim-lang.org/#ix=3QMU
09:10:27FromDiscord<Elegantbeef> That shouldnt be `string` it should be `char` or w/e C# has
09:11:01FromDiscord<tracy> sent a code paste, see https://play.nim-lang.org/#ix=3QMV
09:11:31FromDiscord<Elegantbeef> yea
09:12:02FromDiscord<tracy> sent a code paste, see https://paste.rs/PuJ
09:12:05FromDiscord<Elegantbeef> Going to have to do some unsafe C# possibly, supposedly `StringBuilder` is the same as `char`
09:12:10FromDiscord<Elegantbeef> No it's returning a `cstring`
09:12:21FromDiscord<Elegantbeef> Which is a pointer to a char
09:14:36FromDiscord<Elegantbeef> Yea seems like for a `Cstring` inside C# `StringBuilder` is the go to
09:17:34FromDiscord<tracy> In reply to @Elegantbeef "Yea seems like for": i think stringbuilder is to buildf strings
09:17:38FromDiscord<tracy> build strings
09:17:49FromDiscord<tracy> like that
09:17:51FromDiscord<Elegantbeef> I'm reading a lot that it's usable in place of `cstring`
09:17:53FromDiscord<tracy> sent a code paste, see https://play.nim-lang.org/#ix=3QMX
09:17:57FromDiscord<Elegantbeef> sorry `char`
09:18:15FromDiscord<tracy> maybe a char array will work
09:18:53FromDiscord<Elegantbeef> You can use `char` but i'm reading it seems fine to use StringBuilder, which is why i mentioned it
09:19:13FromDiscord<Elegantbeef> I've never done C interop with C#, so looking into it a bit
09:30:08FromDiscord<Elegantbeef> Seems they might be talking about managed libraries with the `StringBuilder` given https://docs.microsoft.com/en-us/dotnet/framework/interop/marshaling-data-with-platform-invoke
09:30:23FromDiscord<Elegantbeef> So i guess yay for my annoying abillities
09:37:28FromDiscord<tracy> sent a code paste, see https://play.nim-lang.org/#ix=3QN1
09:37:33FromDiscord<tracy> cuz i tried but i get a memory error
09:40:21FromDiscord<Elegantbeef> You'd need to get the file handle of the C# stdout and then open that and set the stdout file to that
09:41:05FromDiscord<tracy> In reply to @Elegantbeef "You'd need to get": what is "the file handle of the c# stdout"
09:42:16FromDiscord<Elegantbeef> Basically an id of the opened file
09:42:44FromDiscord<tracy> how i even begin to get that 🤔
09:42:56FromDiscord<tracy> never heard of it
09:43:53FromDiscord<tracy> idk what i did but it just worked
09:44:12FromDiscord<tracy> just works
09:44:13FromDiscord<tracy> sent a code paste, see https://play.nim-lang.org/#ix=3QN3
09:44:13FromDiscord<tracy> for some reason
09:44:19FromDiscord<Elegantbeef> Guess i'm just dumb
09:44:29FromDiscord<Elegantbeef> Figured there was an issue with it getting stdout, but yea that's dumb
09:44:51FromDiscord<Elegantbeef> Who lets me type messages here
09:50:32FromDiscord<⎝⪩﹏⪨⎠> What do you think about my way of seeing if parenthesis are ok: https://media.discordapp.net/attachments/371759389889003532/947068105883004978/unknown.png
09:51:06*jjido joined #nim
09:51:39FromDiscord<ShalokShalom> @ElegantBeef Do you have any idea, how we can put the union syntax into something more concise?
09:52:06FromDiscord<ShalokShalom> Like, with a macro?
09:52:31FromDiscord<Elegantbeef> https://github.com/alaviss/union https://github.com/beef331/sumtypes https://github.com/andreaferretti/patty https://github.com/chocobo333/AlgebraicDataTypes
09:52:52FromDiscord<Elegantbeef> Oh right that embeds all of them doesnt it
09:53:19FromDiscord<Elegantbeef> The parenthesis method seems fine but i dont get why you're doing string comparisons for a character
09:54:52FromDiscord<ShalokShalom> Patty looks a lot like the examples you have shown me
09:55:06FromDiscord<ShalokShalom> Is pattern matching and tagged unions the same in Nim?
09:55:20FromDiscord<Elegantbeef> https://github.com/andreaferretti/patty#constructing-variant-objects
09:55:48FromDiscord<ShalokShalom> aaah
09:55:50FromDiscord<ShalokShalom> nice
09:56:36FromDiscord<Elegantbeef> My package is silly and just use union if you want that, it was deprecated by leorize almost instantly 😀
09:56:42FromDiscord<Elegantbeef> Probably should add that to the read me
09:57:35FromDiscord<ShalokShalom> looks good to me
09:58:20FromDiscord<ShalokShalom> This looks exactly like what I was looking for
09:58:29FromDiscord<Elegantbeef> Anyway union/sumtypes are for easy to make object variants for heterogeneous holding of types, the last two are for more complex ADT
09:58:32FromDiscord<Elegantbeef> Patty?
09:58:39FromDiscord<ShalokShalom> The last link, yeah
09:58:49FromDiscord<ShalokShalom> Object variants in patty
09:58:59FromDiscord<ShalokShalom> A shortcut to the syntax you showed me yesterdaay
09:59:19FromDiscord<Elegantbeef> Yep the joy of macros small core can be expanded in userspace
09:59:39FromDiscord<Elegantbeef> The syntax is very similar to Rust's ADTs
09:59:52*kayabaNerve joined #nim
09:59:56FromDiscord<ShalokShalom> And kind is just a tradition, not a keyword
10:00:18FromDiscord<ShalokShalom> Thats nice, since I can use something more descriptive to me 🙂
10:00:22FromDiscord<Elegantbeef> It's a convention, it can be anything
10:00:27FromDiscord<ShalokShalom> Yeah, nice
10:00:50FromDiscord<Elegantbeef> You can also have nested variants, but that requires the tedious api
10:01:10FromDiscord<Elegantbeef> Or an inner object for a specific field
10:06:14FromDiscord<ShalokShalom> Well, I see object variants in Patty seem to expand to some more than just the initial setup of the unions
10:06:30FromDiscord<ShalokShalom> https://github.com/andreaferretti/patty#constructing-variant-objects
10:07:27FromDiscord<Elegantbeef> If you dont want them time to fork it 😛
10:07:51FromDiscord<ShalokShalom> Those things seem so basic to me, I really wish someone could just explain to me, how to use Nim in a functional manner.
10:08:32FromDiscord<Elegantbeef> It's not a functional language, so you can do some things functionally but it's not going to be like F#
10:08:49FromDiscord<Elegantbeef> Wait what's basic?
10:10:07FromDiscord<ShalokShalom> unions
10:10:14FromDiscord<ShalokShalom> well, but it can do all those things
10:10:30FromDiscord<ShalokShalom> so, when you can use it as a functional language, why not attract more users by a simple guide
10:10:46FromDiscord<Elegantbeef> Well it's not capable of using it as a functional language
10:10:52FromDiscord<Elegantbeef> There are things it just cannot do
10:12:51FromDiscord<Elegantbeef> https://forum.nim-lang.org/t/8927 is related to this, but the gist is, it's imperative and will take compelling things from FP where it makes sense(strict funcs for instance)
10:12:57FromDiscord<ShalokShalom> There are things, Nim can do, that FSharp cant, like checking on side effect
10:13:14FromDiscord<ShalokShalom> I am just asking for records, unions, pattern matching and stuff
10:13:22FromDiscord<ShalokShalom> But more guides
10:14:28FromDiscord<ShalokShalom> And I am not asking to make it pure
10:14:34FromDiscord<ShalokShalom> Just .. functional
10:14:34*rockcavera quit (Read error: Connection reset by peer)
10:15:25*rockcavera joined #nim
10:15:25*rockcavera quit (Changing host)
10:15:25*rockcavera joined #nim
10:15:42FromDiscord<Elegantbeef> Well if i had any idea how to write FP I'd probably make a guide, but I'm not a FP user and there are very few here, so I guess time for you to be the one that writes guides in a few months 😛
10:15:43FromDiscord<tracy> In reply to @Elegantbeef "Well it's not capable": what does functional lagnauge mean
10:16:07FromDiscord<tracy> language
10:16:28FromDiscord<Elegantbeef> A language that is based off mathematics and strives for sideeffect free procedures, is what i generally say
10:16:53FromDiscord<ShalokShalom> I would like to port the tutorial, I linked yesterday
10:17:06FromDiscord<ShalokShalom> That is targeted to show people how to do basic fp
10:17:11FromDiscord<Elegantbeef> https://en.wikipedia.org/wiki/Functional_programming will explain better than anyone here
10:17:14FromDiscord<ShalokShalom> It can be used as guide then.
10:17:17FromDiscord<Elegantbeef> The tutorial?
10:17:34FromDiscord<ShalokShalom> https://github.com/thedevaspect/aspect-fsharp
10:17:48FromDiscord<tracy> so nim isnt functional right
10:17:58FromDiscord<ShalokShalom> Its not purely functional
10:18:03FromDiscord<Elegantbeef> It's procedural
10:18:11FromDiscord<ShalokShalom> Every language is functional, to a certain extend
10:18:17FromDiscord<ShalokShalom> func is functional
10:18:25FromDiscord<ShalokShalom> const/let in a sense also
10:18:35FromDiscord<ShalokShalom> immutability
10:18:35FromDiscord<Elegantbeef> In a very loose sense 😛
10:18:50FromDiscord<ShalokShalom> I am fine with the feature set
10:18:56FromDiscord<ShalokShalom> Just not with the documentation.
10:19:02FromDiscord<Elegantbeef> Functional is a whole paradigm mutability is just a small segment of FP
10:19:15FromDiscord<ShalokShalom> Yeah, but as an example.
10:19:31FromDiscord<ShalokShalom> Nim has functional features. I am not complaining about the feature set.
10:19:50FromDiscord<Elegantbeef> Never said you are, i tend to make jokes
10:20:12FromDiscord<Elegantbeef> Well t hat's a 300 loc program it seems, doesnt seem too bad to port to Nim
10:20:16FromDiscord<Elegantbeef> Though i dont understand a lot of FP so... 😀
10:20:37FromDiscord<ShalokShalom> Yeah, its just using basics
10:20:47FromDiscord<ShalokShalom> You could start, by looking the tutorial on Youtube 😛
10:20:52FromDiscord<ShalokShalom> Then you know more about FP
10:21:16FromDiscord<Elegantbeef> that implies i'd like to
10:21:27FromDiscord<ShalokShalom> You could 🙂
10:23:24FromDiscord<ShalokShalom> https://www.youtube.com/watch?v=hsTmLhnzRhE
10:24:12FromDiscord<Elegantbeef> The typedefs you should be able to port
10:24:57FromDiscord<ShalokShalom> ok
10:26:56FromDiscord<Elegantbeef> What things have you stymied anyway?
11:01:01FromDiscord<ShalokShalom> How to do a single case union?
11:02:24FromDiscord<ShalokShalom> Is it that way enough?
11:02:36FromDiscord<ShalokShalom> sent a code paste, see https://paste.rs/XvV
11:14:08FromDiscord<Rika> Why would you need to do such? Nonetheless I believe that is right
11:19:13*ltriant joined #nim
11:19:17FromDiscord<b4mbus> `nimble run -d:ssl`↵I do that and it does compile and run my project but it doesn't pass `-d:ssl` to the compiler, so then I get SSL errors
11:19:27FromDiscord<b4mbus> what can I do with it
11:22:05FromDiscord<tracy> In reply to @b4mbus "`nimble run -d:ssl` I": compile it with -d:ssl
11:22:14FromDiscord<tracy> oh wait
11:22:28FromDiscord<tracy> isnt nimble the package manager
11:23:07FromDiscord<b4mbus> it is
11:23:26FromDiscord<b4mbus> but it's also some kinda build system, I was told
11:23:34FromDiscord<tracy> In reply to @b4mbus "but it's also some": nim c -r -d:ssl test.nim
11:23:43FromDiscord<b4mbus> and a project is also called a package
11:23:52FromDiscord<tracy> In reply to @b4mbus "and a project is": just compile it normally and try it
11:23:56FromDiscord<b4mbus> In reply to @tracy "nim c -r -d:ssl": I know I can use the nim compiler but it's not a problem
11:24:00FromDiscord<b4mbus> (edit) "a" => "the"
11:24:04FromDiscord<ShalokShalom> sent a code paste, see https://play.nim-lang.org/#ix=3QNs
11:24:14FromDiscord<b4mbus> In reply to @b4mbus "I know I can": the problem is that `nimble` doesn't pass the arguments to the compiler itself
11:24:22FromDiscord<b4mbus> and Im using exeternal dependencies
11:24:29FromDiscord<b4mbus> (edit) "exeternal" => "external" | "externaldependencies ... " added "(namely - dimscord and dimscmd)"
11:24:52FromDiscord<b4mbus> nimble should do that for me
11:25:10FromDiscord<tracy> have u tried to compile it with nim c
11:25:23FromDiscord<b4mbus> yes I did
11:25:29FromDiscord<b4mbus> and as I said
11:25:43FromDiscord<b4mbus> the issue is that nimble doesn't forward the arguments to the compiler
11:26:14FromDiscord<ShalokShalom> sent a code paste, see https://paste.rs/laH
11:26:18FromDiscord<ShalokShalom> How is that semantically different from above
11:27:19FromDiscord<dom96> In reply to @b4mbus "**the issue** is that": afaik that is indeed an issue with `nimble run` specifically
11:27:32FromDiscord<b4mbus> alright, so that is a known issue
11:27:38FromDiscord<b4mbus> is there someone resolving that already?
11:28:05FromDiscord<b4mbus> https://github.com/nim-lang/nimble/issues/986
11:28:06FromDiscord<b4mbus> I see
11:28:16*ltriant quit (Ping timeout: 272 seconds)
11:28:55FromDiscord<b4mbus> Id love to file a PR but I just started with nim a few days ago and I would do more harm than good
11:31:34*jjido quit (Quit: My MacBook Air has gone to sleep. ZZZzzz…)
11:32:10*pro quit (Quit: pro)
11:32:33FromDiscord<dom96> it should be an easy fix
11:32:44FromDiscord<dom96> great way to make a first contribution 🙂
11:33:25FromDiscord<Rika> In reply to @ShalokShalom "When I capitalize the": because the syntax highlighters use the first letter capitalisation to distinguish "regular idents" to "type idents"
11:34:01FromDiscord<Rika> though i believe it shouldnt do that in all cases like when its a field since thats definitely never a type
11:36:05FromDiscord<dom96> you shouldn't name your field names that way, syntax highlighting should nudge you away from that
11:37:11FromDiscord<ShalokShalom> how else?
11:37:18FromDiscord<Rika> lowercase first letter
11:37:26FromDiscord<Rika> feel free to use either snake or camel
11:37:31FromDiscord<ShalokShalom> Yeah, like in the first example?
11:37:33*PMunch joined #nim
11:37:35FromDiscord<Rika> yeah
11:37:39FromDiscord<ShalokShalom> In reply to @ShalokShalom "When I capitalize the": Like that?
11:37:49FromDiscord<Rika> the types should be pascal
11:37:53FromDiscord<Rika> north: Exit
11:37:56FromDiscord<ShalokShalom> ok
11:38:05FromDiscord<Rika> its just convention
11:38:15FromDiscord<Rika> you can disobey, but you might not have such a good time
11:40:13FromDiscord<ShalokShalom> types in Pascal is a convention?
11:41:35FromDiscord<Rika> pascal case
11:41:48FromDiscord<ShalokShalom> ah, ok cool
11:41:50FromDiscord<Rika> which is camel case with a capitalised first letter
11:41:58FromDiscord<ShalokShalom> yep
11:42:13FromDiscord<ShalokShalom> someone told me lowercase first for types are fine
11:42:17FromDiscord<ShalokShalom> so I was confused
11:42:21Amun-Raspeaking of conventions, I'd like nimgrep to have an option for suggesting snake case variant
11:42:28FromDiscord<ShalokShalom> why does syntax highlighting also change its color here as well?
11:42:30FromDiscord<Rika> theyre fine since its just a convention
11:42:31FromDiscord<ShalokShalom> when its just a convention
11:42:34FromDiscord<Rika> because its the convention
11:42:39FromDiscord<Rika> (edit) "the" => "the"
11:42:40FromDiscord<ShalokShalom> Ah, ok
11:42:44Amun-Rashalokshalom: lower case is fine for consts
11:43:14FromDiscord<ShalokShalom> ok..
11:45:23FromDiscord<ShalokShalom> How to form a list type?
11:45:41FromDiscord<ShalokShalom> sent a code paste, see https://play.nim-lang.org/#ix=3QNB
11:45:42FromDiscord<ShalokShalom> I like to make the Items type a list
11:46:10Amun-Rayou can make it seq[type]
11:46:17FromDiscord<ShalokShalom> Thanks
11:46:26FromDiscord<ShalokShalom> seq[Items] yes?
11:46:31Amun-Raor array, if the size is known compile time
11:46:43Amun-Raseq[TypeOfAnItem]
11:47:09Amun-Rashalokshalom: type Items = seq[byte]
11:47:12Amun-Rafor example
11:47:13FromDiscord<Rika> In reply to @ShalokShalom "seq[Items] yes?": tes
11:47:22FromDiscord<Rika> well
11:47:26FromDiscord<Rika> what is `Items`?
11:47:41Amun-Raif "Items" is a list alike type
11:47:41FromDiscord<Rika> its prolly more appropriate to name it `Item` if you're doing `seq[Item]`
11:47:46FromDiscord<ShalokShalom> a type from before
11:47:47Amun-Rayes
11:48:05FromDiscord<ShalokShalom> sent a code paste, see https://paste.rs/jkk
11:48:19Amun-Raif you don't need to have an explicite list type by name just have seq[ElementType]
11:48:55FromDiscord<ShalokShalom> true, singular is also written in the original source, from that I port it
11:49:31Amun-Rashalokshalom: https://play.nim-lang.org/#ix=3QND
11:50:09FromDiscord<ShalokShalom> sent a code paste, see https://play.nim-lang.org/#ix=3QNE
11:50:34Amun-Ramhm
11:51:13FromDiscord<ShalokShalom> Thats fine?
11:51:45Amun-Rasure
11:52:12FromDiscord<dom96> nitpicking: convention is also to use 2 spaces vs 4 for indentation 🙂
11:52:17Amun-Raand speaking of coding stype, Nim typically has 2 space indents
11:54:05FromDiscord<ShalokShalom> Yeah, I am porting F# to Nim
11:54:11FromDiscord<ShalokShalom> And trying to hold it so close as possible
11:54:16FromDiscord<ShalokShalom> To compare it 1:1
11:55:31FromDiscord<ShalokShalom> Is there a formatter?
11:55:48Amun-Rathere's nimpretty
11:57:10FromDiscord<tracy> can someone help me convert some c# code to nim?
11:57:41Amun-Rapaste somewhere the part you have trouble with
11:58:04*Amun-Ra 's knowledge of C# is a litle rusty
11:59:23FromDiscord<tracy> alright let me find it, im just trying to convert it but im rlly new to nim so idrk where to start
11:59:24FromDiscord<tracy> 1 sec
12:04:03FromDiscord<tracy> sent a code paste, see https://play.nim-lang.org/#ix=3QNR
12:06:01*supakeen quit (Quit: WeeChat 3.4)
12:06:31*supakeen joined #nim
12:06:34Amun-Rahttps://nim-lang.org/docs/streams.html
12:06:55FromDiscord<tracy> how do i do the rest tho
12:07:14FromDiscord<tracy> it reads the current exe, and then splits it by "" to get the text after it
12:08:06FromDiscord<Rika> https://nim-lang.org/docs/strutils.html ?
12:08:29FromDiscord<tracy> and then last thing, its reading the current exe running
12:08:51FromDiscord<Rika> good luck with that, i dont know
12:09:25FromDiscord<Rika> something in https://nim-lang.org/docs/system.html maybe like the app name or w/e
12:15:23FromDiscord<tracy> sent a code paste, see https://paste.rs/aE1
12:15:24FromDiscord<tracy> what does this mena
12:15:25FromDiscord<tracy> mean
12:15:28FromDiscord<tracy> i get it when trying to compile
12:16:13FromDiscord<Rika> you dont have a c compiler?
12:16:16*PMunch quit (Quit: leaving)
12:16:22FromDiscord<tracy> https://media.discordapp.net/attachments/371759389889003532/947104803719356416/unknown.png
12:16:30FromDiscord<tracy> gcc is c compiler right ?
12:16:39FromDiscord<ShalokShalom> How do I map between two objects?
12:16:44FromDiscord<ShalokShalom> In another object
12:16:59FromDiscord<ShalokShalom> This is the original code
12:16:59FromDiscord<ShalokShalom> sent a code paste, see https://play.nim-lang.org/#ix=3QNU
12:17:08FromDiscord<ShalokShalom> Map from RoomId to Room
12:17:15FromDiscord<ShalokShalom> How to do that?
12:20:52NimEventerNew thread by Tcheran: Linux moving to C11, see https://forum.nim-lang.org/t/8958
12:21:45NimEventerNew post on r/nim by wrestlingwithbadgers: db_postgres handles only strings?, see https://reddit.com/r/nim/comments/t1vvul/db_postgres_handles_only_strings/
12:21:47FromDiscord<Rika> nim compiles to c99 no? i dont see reasons for anything to break
12:26:17FromDiscord<ShalokShalom> @ElegantBeef See, how far I come https://media.discordapp.net/attachments/371759389889003532/947107300529827890/Screenshot_20220226_132534.png
12:26:33FromDiscord<ShalokShalom> Is this all correct?
12:29:09FromDiscord<Rika> String -> string, since its a builtin nim type and those are (ODDLY) lowercase
12:35:31FromDiscord<b4mbus> https://nim-lang.org/docs/nimc.html#compiler-usage-commandminusline-switches↵\> https://nim-lang.org/docs/nimc.html#compiler-usage-commandminusline-switches
12:35:42FromDiscord<b4mbus> (edit) "https://nim-lang.org/docs/nimc.html#compiler-usage-commandminusline-switches" => "ResultUsed Warn about the usage of the built-in result variable."
12:35:48FromDiscord<b4mbus> why would that be a warning?
12:36:30FromDiscord<b4mbus> what's so wrong about using the result variable?
12:37:25FromDiscord<Rika> if you want it
12:37:26FromDiscord<Rika> its a choice
12:38:12FromDiscord<b4mbus> okay but why would that be a warning? Warnings should notify users about potentially misleading/dangerous actions taken in code
12:38:50FromDiscord<b4mbus> and using the result variable is not only kind of an idiom but just a standard practice in nim isnt it, and defining a new variable of the same name actually uses that variable, instead of the built-in one
12:39:23FromDiscord<b4mbus> \> and defining a new variable of the same name actually uses that variable, instead of the built-in one↵oh that's my bad actually
12:39:42FromDiscord<b4mbus> (edit) "actually" => "actually, it does not use the variable, it uses the built-in"
12:39:43FromDiscord<b4mbus> ok I see now, me being a dumb bitch again, sorry
12:39:57FromDiscord<Deceptive> yo guys i am trying to integrate the library which i made in nim, what i want is to unity load this library in the game itself
12:45:07FromDiscord<auxym> yo, ok, sounds cool
12:53:58FromDiscord<ShalokShalom> How could someone shorten 17 - 30 on the Nim side?
12:54:12FromDiscord<ShalokShalom> On the right side is F# https://media.discordapp.net/attachments/371759389889003532/947114325879975946/Screenshot_20220226_135252.png
12:54:54FromDiscord<ShalokShalom> It amounts to line 11 - 14
12:55:10FromDiscord<haxscramper> You need to use macros for variant object declarations
12:55:41FromDiscord<ShalokShalom> Yeah, I think beef has already send me some libraries, but I cant really make sense of it
12:56:15FromDiscord<ShalokShalom> I like the {}-less approach of Nim
12:56:22FromDiscord<ShalokShalom> Looks even cleaner. 🙂
13:02:34FromDiscord<Rika> In reply to @ShalokShalom "How could someone shorten": I think it’s already pretty concise
13:11:17*jmd_ quit (Ping timeout: 240 seconds)
13:13:35*slowButPresent joined #nim
13:22:58FromDiscord<konsumlamm> In reply to @b4mbus "okay but why would": using `result` can be potentially misleading/dangerous, for example when you forget to initialize it in one code path and then return
13:26:20FromDiscord<ShalokShalom> In reply to @Rika "I think it’s already": 4 lines vs 13 lines is short?
13:26:46FromDiscord<Rika> Lines can be inflated or deflated
13:26:58FromDiscord<Rika> I would be more worried about a 10 vs 80 line difference
13:27:09FromDiscord<ShalokShalom> well, its overall less boilerplate code on the right side
13:27:21FromDiscord<ShalokShalom> i like, that its more vertically on Nim side
13:27:27FromDiscord<Rika> Not really, there’s only like an estimated 5 of boilerplate
13:27:51FromDiscord<ShalokShalom> Hax says, there are macros, to make it shorter
13:27:56FromDiscord<ShalokShalom> I am only interested in this
13:28:24FromDiscord<Rika> Can’t help you, some were suggested above I believe
13:31:46FromDiscord<deech> Is there any documentation on getting a Nim dev environment up on Windows 10?
13:33:05FromDiscord<ShalokShalom> There is documentation on how to install Nim. And you can choose VSCode plus Extension. What else do you think about?
13:39:02FromDiscord<deech> I've seen the official docs, I was thinking a step by step on how to build from scratch with `vcc` ( I'd rather not work with MinGW).
13:42:28FromDiscord<ShalokShalom> choosenim works without MinGW, it seems: https://github.com/dom96/choosenim#dependencies
13:53:32FromDiscord<tracy> In reply to @ShalokShalom "<@!145405730571288577> See, how far": theme?!
13:57:40*kenran joined #nim
14:08:05nrds<Prestige99> I'm on Linux trying to cross compile something with mingw, but having errors about libwinpthread-1.dll not found. Anyone know what I am missing here? I do have mingw-w64-winpthreads installed, do I have to copy the dll locally and dynamically link it?
14:09:02FromDiscord<ShalokShalom> In reply to @tracy "theme?!": https://marketplace.visualstudio.com/items?itemName=benjaminmandersen.midnight-pastel
14:10:56NimEventerNew question by Kevin Whitefoot: How can one do a pixel by pixel comparison of an image created by cairo and an image loaded from a file, see https://stackoverflow.com/questions/71277311/how-can-one-do-a-pixel-by-pixel-comparison-of-an-image-created-by-cairo-and-an-i
14:13:35FromDiscord<tracy> sent a code paste, see https://play.nim-lang.org/#ix=3QOt
14:13:39FromDiscord<tracy> what about this can have side effects?
14:13:44FromDiscord<tracy> https://media.discordapp.net/attachments/371759389889003532/947134341899747408/unknown.png
14:20:25FromDiscord<auxym> I assume opening a file is considered a side effect
14:24:51supakeenand in general that functions return value is not dependent solely on its inputs
14:27:21FromDiscord<ShalokShalom> isnt func supposed to prohibit that?
14:27:28FromDiscord<ShalokShalom> although I heard of some limitations
14:31:01FromDiscord<tracy> i meant to put proc
14:31:01FromDiscord<tracy> oops
14:47:16NimEventerNew thread by Rad: Embedded STM32 - Bare Metal Bootstrap, see https://forum.nim-lang.org/t/8959
14:53:16FromDiscord<tracy> how do i get the length of a filestream 🤔
14:53:41FromDiscord<tracy> im trying to write to the end of a exe file but i have to set the position of the filestream to the end of the stream
14:53:47FromDiscord<tracy> and idk how to get the length
14:59:38FromDiscord<tracy> would this be getting the stream length
14:59:38FromDiscord<tracy> ?
14:59:38FromDiscord<tracy> sent a code paste, see https://paste.rs/P2g
15:01:16*arkurious joined #nim
15:02:48FromDiscord<tracy> sent a code paste, see https://play.nim-lang.org/#ix=3QOS
15:14:28FromDiscord<haolian9 (高浩亮)> as it is a file, i think posix.stat is good enough; or open the file in fmAppend mode
15:14:57FromDiscord<haolian9 (高浩亮)> does `cstring` need to be freed explictly?↵there is a pr related to [daniel-j/nim-mpv#1](https://github.com/daniel-j/nim-mpv/pull/1), i think it's unnecessary, and the `free()` does not really exist.
15:15:41FromDiscord<ShalokShalom> How to use macros for variant object declarations?
15:16:22FromDiscord<leorize> depends on how you got the string
15:16:59FromDiscord<leorize> if it comes from a Nim string, it's memory is managed by the originating string so you don't have to
15:18:06FromDiscord<leorize> if it is allocated manually or originating from a C API for example, then it might have to be manually freed, but consult the API documentation in that case
15:19:21FromDiscord<leorize> wdym?↵(@ShalokShalom)
15:19:43FromDiscord<ShalokShalom> I was told, I can shorten my code this way
15:19:56FromDiscord<tracy> sent a code paste, see https://play.nim-lang.org/#ix=3QP1
15:20:00FromDiscord<tracy> and when i run my c# code, it just crashes
15:20:03FromDiscord<tracy> im trying to use nim in c# as a dllw
15:20:07FromDiscord<tracy> why does this happen? 🤔
15:20:45FromDiscord<tracy> i wrote the args wrong, but i didnt in the actual code
15:21:14FromDiscord<haolian9 (高浩亮)> sent a code paste, see https://play.nim-lang.org/#ix=3QP2
15:21:24FromDiscord<ShalokShalom> leorize: line 17 - 30, see 11 - 14 as comparison https://media.discordapp.net/attachments/371759389889003532/947151369318580334/Screenshot_20220226_135252.png
15:21:46FromDiscord<ShalokShalom> I like to do it in a more memorable way
15:22:07FromDiscord<ShalokShalom> This looks like, I have to look up its syntax more often than I am willing to
15:22:36FromDiscord<ShalokShalom> Its not really a dedicated syntax, more a combination of basic structures.
15:24:17FromDiscord<tracy> the error:
15:24:21FromDiscord<tracy> sent a code paste, see https://play.nim-lang.org/#ix=3QP7
15:24:31*ltriant joined #nim
15:28:16FromDiscord<haolian9 (高浩亮)> thank you! @leorize\:envs.net
15:30:29*ltriant quit (Ping timeout: 256 seconds)
15:31:36FromDiscord<ShalokShalom> @tracyIs this Jetbrains?
15:31:37*kayabaNerve quit (Ping timeout: 256 seconds)
15:32:20FromDiscord<tracy> In reply to @ShalokShalom "<@!946209778584137768>Is this Jetbrains?": is what
15:32:31FromDiscord<ShalokShalom> your screenshot
15:32:36FromDiscord<ShalokShalom> do you use the IDE?
15:32:38FromDiscord<ShalokShalom> for NIm
15:32:52FromDiscord<tracy> In reply to @tracy "": this error is from when i was calling it from c#
15:32:58FromDiscord<tracy> its a winform in vs
15:32:58FromDiscord<ShalokShalom> Ah
15:33:04FromDiscord<ShalokShalom> (edit) "NIm" => "Nim"
15:47:00FromDiscord<coldfussion> sent a code paste, see https://paste.rs/Avg
16:04:09FromDiscord<demotomohiro> Maybe how `cstringArray` and return value of `glfwGetRequi...` hold length of the array differently?
16:04:26FromDiscord<tracy> In reply to @tracy "": any1 kno a fix for this 🙁
16:07:56FromDiscord<coldfussion> idk, `glfwGetRequiredInstanceExtensions` returns `const char` in C which should perfectly map to `cstringArray` in nim..↵(@demotomohiro)
16:08:26Amun-Rasometimes ptr cstring is more preferrable to cstringArray
16:10:08FromDiscord<demotomohiro> https://nim-lang.org/docs/system.html#cstringArrayToSeq%2CcstringArray%2CNatural↵`cstringArrayToSeq()` has `len` parameter but your code doesn't set it.
16:11:39Amun-Rayou have to iterate over cstingArray to know the length
16:13:10FromDiscord<coldfussion> oh, yeah, that worked. it just has two versions, one without length, it worked in other cases, so i figured why bother with length... Thanks!↵(@demotomohiro)
16:15:37FromDiscord<demotomohiro> https://github.com/nim-lang/Nim/blob/d7370ce26962b3b82e6b9be6562f6e88ba7ff86c/lib/system.nim#L2267↵without length version suppose `cstringArray` is terminated by nil.
16:16:46Amun-Rayes
16:17:15Amun-RacstringArray == ptr UncheckedArray[cstring]
16:17:20FromDiscord<coldfussion> oh, so the output of `glfwGetRequiredInstanceExtensions` wasn't nil terminated. makes sense now)
16:18:04FromDiscord<Phil> Maybe this is sports exhaustion speaking out of me... but how did I loop over a seq of objects again and mutate it's entries again?
16:18:58Amun-Rafor item in mitems the_sequence: do_sth
16:19:28FromDiscord<Phil> sent a code paste, see https://play.nim-lang.org/#ix=3QPo
16:19:40FromDiscord<Phil> mitems iterator? riiiiight
16:23:11Amun-Rathere's mpairs iterator too (if you need to know the index value)
16:27:34FromDiscord<ShalokShalom> How do I map between two objects?
16:28:33FromDiscord<haxscramper> `std/tables`
16:28:41FromDiscord<haxscramper> (edit) "`std/tables`" => "`std/tables.Table`"
16:35:22*kayabaNerve joined #nim
16:36:11*Gustavo6046 joined #nim
16:36:18FromDiscord<ShalokShalom> I had a look through the documentation, and while it seems very comprehensive, it doesnt seem to cover my simple use case.
16:37:26FromDiscord<ShalokShalom> sent a code paste, see https://paste.rs/yfi
16:38:00FromDiscord<ShalokShalom> So to basically map one object to another, within an object.
16:38:54FromDiscord<tracy> how to check if string in any item of an array
16:38:54FromDiscord<tracy> ?
16:39:46FromDiscord<Phil> sequtils lib has what you're searching for tracy
16:40:48FromDiscord<tracy> In reply to @Isofruit "sequtils lib has what": whats the proc called 🤔
16:40:53FromDiscord<Phil> you want an `any` proc, essentially you feed that an anonymous proc that determines whether an individual entry in the array passes or fails the test.↵If any of the entries in that array fails, "any" will return false
16:41:34FromDiscord<tracy> oh okay, tyy!! :))
16:41:37FromDiscord<Phil> (edit) "test.↵If" => "test. The "test" being your anonymous proc that returns a boolean, passing being "true" returning↵If"
16:42:33FromDiscord<haxscramper> In reply to @ShalokShalom "I had a look": `Table[RoomId, Room]`
16:42:38FromDiscord<ShalokShalom> Thanks a lot
16:43:24FromDiscord<ShalokShalom> Do you see such an example of the official homepage?
16:43:54FromDiscord<Phil> In reply to @tracy "oh okay, tyy!! :))": No problemo
16:44:55FromDiscord<tracy> In reply to @Isofruit "No problemo": how do i use it i barely knwo this language im v new jmsadkf
16:45:13FromDiscord<Phil> In reply to @tracy "how do i use": Ah, you ever done functional programming?
16:45:28FromDiscord<tracy> In reply to @Isofruit "Ah, you ever done": is c# or python functional 🤔
16:45:50FromDiscord<ShalokShalom> Is this correct code?
16:45:51FromDiscord<ShalokShalom> sent a code paste, see https://paste.rs/tQw
16:46:05FromDiscord<ShalokShalom> fine
16:46:06FromDiscord<auxym> In reply to @tracy "is c# or python": Imagine you were doing everything in LINQ
16:46:07FromDiscord<tracy> sent a code paste, see https://play.nim-lang.org/#ix=3QPv
16:46:14FromDiscord<ShalokShalom> In reply to @tracy "is c# or python": Both have functional features
16:46:51FromDiscord<ShalokShalom> Both, LINQ and generics, as well as a whole bunch of other implementations come straight out of F#
16:47:01FromDiscord<Phil> In reply to @tracy "is c# or python": python has the capability to use functional programming patterns. In python the closest thing would be ... god what was it called again, these types of expressions `[e for e in myArray]`
16:47:05FromDiscord<ShalokShalom> Generics in C# are actually done by the F# creator
16:47:45FromDiscord<auxym> In reply to @Isofruit "python has the capability": list comprehensions
16:47:48FromDiscord<ShalokShalom> And Python has this: https://github.com/cognitedata/Expression↵and this: http://coconut-lang.org/
16:47:56FromDiscord<Phil> In reply to @tracy "is c# or python": thank you! Blanked on the name
16:47:58FromDiscord<ShalokShalom> And Fable can transpile F# into Python
16:48:12FromDiscord<Phil> (edit) "In reply to @tracy "is c# or python": thank you! Blanked on the name ... " added "@auxym (this was an accident, wanted to respond to tracy)"
16:48:13FromDiscord<tracy> sent a code paste, see https://play.nim-lang.org/#ix=3QPw
16:48:14FromDiscord<tracy> In reply to @ShalokShalom "And Fable can transpile": whats fabel
16:48:15FromDiscord<tracy> fable
16:48:36FromDiscord<Phil> Anyway, the idea is, that not only can you pass variables as parameters into a proc/function/whatever, you can also pass other procs into them as parameters
16:48:57FromDiscord<Phil> So that the proc you're handing parameters can call that specific proc at one point in its code
16:49:35FromDiscord<ShalokShalom> @haxscramper Would you agree, that its sensible to include an example, that explains my use case? Like in the documentation
16:49:54FromDiscord<ShalokShalom> https://fable.io/
16:50:03FromDiscord<ShalokShalom> Mainly a F# > JS compiler
16:50:12FromDiscord<ShalokShalom> But it can also do Python, to a certain extend.
16:50:16FromDiscord<ShalokShalom> That feature is new.
16:51:14FromDiscord<ShalokShalom> (edit)
16:51:55FromDiscord<Phil> sent a code paste, see https://play.nim-lang.org/#ix=3QPx
16:51:58FromDiscord<auxym> In reply to @ShalokShalom "<@!608382355454951435> Would you agree,": there's of examples of tables here? https://nim-lang.org/docs/tables.html
16:53:22FromDiscord<tracy> sent a code paste, see https://play.nim-lang.org/#ix=3QPy
16:53:52FromDiscord<Phil> What'll happen in my code example is, that the "any" proc will essentially call "largerThan4" on every entry in the array "blablaSeq" one after another. If an entry causes "largerThan4" to output "false", "any" completes immediately with "false". Otherwise it runs through the entire array, gets "true" every time and thus returns "true" itself
16:54:55FromDiscord<Phil> seqs have the "contains" proc if you have exact matches
16:55:32FromDiscord<Phil> sent a code paste, see https://play.nim-lang.org/#ix=3QPz
16:56:19FromDiscord<Phil> (edit) "https://play.nim-lang.org/#ix=3QPz" => "https://play.nim-lang.org/#ix=3QPA"
16:57:01*acidsys joined #nim
16:57:07FromDiscord<tracy> this language so hard
16:57:08FromDiscord<tracy> 😭
16:57:15FromDiscord<huantian> In reply to @tracy "im tryna do like": Does this not just work?
16:57:25FromDiscord<tracy> In reply to @huantian "Does this not just": thats python code
16:57:43FromDiscord<tracy> wait let me try it
16:58:03FromDiscord<tracy> oh wait it does
16:58:03FromDiscord<tracy> LOL
17:00:31FromDiscord<Phil> Seeing that nim has its own list comprehension syntax
17:00:35FromDiscord<Phil> Does anyone actually use that?
17:00:44FromDiscord<tracy> use what
17:00:45FromDiscord<tracy> 🤔
17:01:10FromDiscord<locriacyber> collect↵(@Phil)
17:01:13FromDiscord<Phil> list comprehensions when "map, any, some, filter" etc. are readily available and seem easier to write and understand
17:02:04FromDiscord<tracy> In reply to @Isofruit "list comprehensions when "map,": map any some and filter seem hard idek what them mean
17:02:42FromDiscord<huantian> In reply to @Isofruit "list comprehensions when "map,": Collect is a lot fore readable when you are trying to do more complex things, like nesting for loops and ifs
17:03:08FromDiscord<huantian> Otherwise you’d get a tree of doom
17:03:14FromDiscord<Phil> In reply to @tracy "map any some and": They aren't really, you'll want to get into functional programming patterns either way sooner or later, wrapping your head around what happens when you pass a function to a function is fairly beneficial
17:03:22FromDiscord<Phil> In reply to @huantian "Otherwise you’d get a": tree as in AST
17:03:33FromDiscord<huantian> More as in indentation
17:03:34FromDiscord<Phil> (edit) "AST" => "AST?"
17:03:44FromDiscord<huantian> /visually
17:03:52FromDiscord<Phil> Ah, that. my solution tends to be dedicated procs because when you do something that complicated it deserves a name
17:05:03FromDiscord<Phil> Which I guess is why the usecase for collect hasn't happened for me yet, fair
17:06:48*Gustavo6046_ joined #nim
17:06:58FromDiscord<tracy> do u guys think cpp or nim is better
17:07:01FromDiscord<tracy> 🤔
17:07:15FromDiscord<Phil> Got curious because I'd be surprised if C# didn't support functional programming features in one way or another. Turns out it does have those features
17:07:52FromDiscord<Phil> I'm not sure what answer you're expecting from literally the main channel of the nim discord server
17:08:37FromDiscord<tracy> idek what r pros n cons
17:08:56FromDiscord<Phil> Specifically to a question that pretty much has no answer without narrowing down its scope as to better in what regard
17:09:01*Gustavo6046 quit (Ping timeout: 240 seconds)
17:09:26FromDiscord<Phil> And even there it's insanely hard to answer due to the billion bells and whistles at your disposal typically
17:10:40FromDiscord<tracy> should i be learning nim as a noobish programmer cuz unlike python (a high level language) nim is like the opposite
17:11:10FromDiscord<Phil> Is it more memory safe? Certainly.↵Can it reach C++'s performance? Almost anything can if you're enough of a language expert and spend sufficient time optimizing your code.↵Is it more productive? 60% of that depends on the developer, though I'd naturally argue that nim is near the top of the list in terms of being comprehensible.
17:12:26FromDiscord<tracy> In reply to @Isofruit "Is it more memory": i tried writing cpp code and it is so hard to understand imo syntax wize n stuff
17:12:52FromDiscord<Phil> The mere nature of having to also deal with memory management opens you up to a whole host of avoidable bugs
17:13:21FromDiscord<Phil> (edit) "bugs" => "bugs↵And thus also to more complexity. As such nim is by nature simpler if you don't plan on removing the GC that is"
17:13:37FromDiscord<Phil> Which is something you can actually do in NIM IIRC
17:13:42FromDiscord<Phil> (edit) "NIM" => "nim"
17:15:44FromDiscord<Phil> As someone who started out with python/js/java knowledge and went to nim I'd say it's pretty nice to learn.
17:16:28FromDiscord<tracy> In reply to @Isofruit "As someone who started": ya i wanted to switch cuz the things i wanted to do in python were just not doable (low level kinda stuff)
17:17:15FromDiscord<Phil> In reply to @tracy "ya i wanted to": I'd suggest with keeping at it.↵One thing you might want to start wrapping your head around is code that runs at compile-time vs. code that runs at runtime
17:18:21FromDiscord<Phil> That's a significant difference to keep in mind that allows you to do quite a lot to speed up code.↵That and metaprogramming but I'd keep that under wraps for after a month or so of experience
17:18:31FromDiscord<tracy> oh, i also switched cuz i didnt like my source code being so easy to decompile
17:19:18FromDiscord<Phil> Can't say much about that
17:19:54*jjido joined #nim
17:36:08FromDiscord<ShalokShalom> In reply to @auxym "there's of examples of": Not in the way I was looking for them.
17:37:09FromDiscord<ShalokShalom> Like, this is how I have done it, and I think my use case is much more simple, than most of what is covered: https://github.com/ShalokShalom/fsharp-nim/blob/master/dev-aspect.nim#L58
17:37:49FromDiscord<ShalokShalom> I frequently get the impression, that Nims documentation is generally covering a lot of niche cases, and adding a lot of details to everything.
17:38:04FromDiscord<ShalokShalom> And basically not covering basics in some cases.
18:07:44*Gustavo6046_ quit (Quit: Leaving)
18:07:57*Gustavo6046 joined #nim
18:09:37*ltriant joined #nim
18:14:49*ltriant quit (Ping timeout: 256 seconds)
18:37:40NimEventerNew post on r/nim by Familiar_Ad_8919: is the vscode extension still being worked on?, see https://reddit.com/r/nim/comments/t23udx/is_the_vscode_extension_still_being_worked_on/
18:38:45FromDiscord<b4mbus> What does really `isMainModule` mean? What does Nim consider as a `main module`?
18:39:18FromDiscord<b4mbus> > True only when accessed in the main module. This works thanks to compiler magic. It is useful to embed testing code in a module.
18:39:23FromDiscord<b4mbus> The docs dont really say much to me
18:39:59NimEventerNew thread by Gcao: Anyone working on a new Nim book or second edition of Nim in Action?, see https://forum.nim-lang.org/t/8960
18:59:47NimEventerNew post on r/nim by plutoniator: Trouble trying to import a Cython module, see https://reddit.com/r/nim/comments/t24btz/trouble_trying_to_import_a_cython_module/
19:04:12Amun-Rab4mbus: are you familiar with python?
19:04:36Amun-Rab4mbus: isMainModule is true if you compile the file directly, it's false if you import it
19:05:04Amun-Rait's python's equivalent of if __file__ == '__main__'
19:08:03FromDiscord<b4mbus> I see, makes sense
19:08:12FromDiscord<b4mbus> another question - is there some kind of a `string_view` in Nim?
19:08:17FromDiscord<b4mbus> (edit) "`string_view`" => " C++'s `std::string_view`"
19:08:29FromDiscord<b4mbus> afair string and cstring always allocate?
19:10:18Amun-Rawhat's the diff. between std::string and std::string_view?
19:11:36FromDiscord<b4mbus> `std::string` is a heap allocated string with SSO, `std::string_view` is just an immutable view for strings, ptr to the beggining + size (kinda like openArray is for seqs and arrays, string_view is for const char's, std::strings, etc.)
19:11:54FromDiscord<b4mbus> basically string_view doesnt allocate, it only "views" some data
19:12:03FromDiscord<b4mbus> I also dont suppose there are references in nim, some kinda:
19:12:27FromDiscord<b4mbus> sent a code paste, see https://play.nim-lang.org/#ix=3QQ9
19:12:28FromDiscord<b4mbus> I only want to view message here
19:12:37FromDiscord<b4mbus> `proc foo(message: string)` will copy, wont it?
19:12:41Amun-Rano
19:12:45FromDiscord<b4mbus> idk nim that much
19:12:46FromDiscord<b4mbus> oh?
19:12:53Amun-RaI mean it will for very small objects
19:13:50Amun-Rayou can just pass a string
19:15:16FromDiscord<b4mbus> oh hmm
19:15:18FromDiscord<b4mbus> strings are immutable
19:15:19FromDiscord<b4mbus> I see
19:15:31FromDiscord<b4mbus> so nim uses COW refcounted strings I suppose
19:15:44Amun-Ranot in that case
19:15:51Amun-Raproc foo(s: string)
19:15:58Amun-Ras will always be immutable
19:16:49Amun-Raproc foo(s: var string) is sth like foo(s: &std::string)
19:18:07Amun-Raproc foo(s: string) == foo(s: const &std::string)
19:18:35Amun-Ramore or less
19:20:34Amun-Ra(there are also ref and var ref variants)
19:35:24*perro joined #nim
19:37:24*Gustavo6046 quit (Ping timeout: 240 seconds)
19:41:14FromDiscord<tracy> sent a code paste, see https://play.nim-lang.org/#ix=3QQ4
19:41:21FromDiscord<tracy> why doesnt this get the code from the end of the file?
19:49:26*Gustavo6046 joined #nim
19:59:02FromDiscord<b4mbus> sent a code paste, see https://play.nim-lang.org/#ix=3QQn
19:59:08FromDiscord<b4mbus> (edit) "https://play.nim-lang.org/#ix=3QQn" => "https://play.nim-lang.org/#ix=3QQo"
20:08:27*jjido quit (Quit: My MacBook Air has gone to sleep. ZZZzzz…)
20:12:50FromDiscord<b4mbus> actually the cannot evaluate at compile time is only `nimls` trippin
20:12:57FromDiscord<b4mbus> the other is still there tho
20:13:22FromDiscord<b4mbus> `[long path](34, 45) Error: identifier expected, but found '(needle) => msgCopy'`
20:13:27FromDiscord<b4mbus> I get nothing but that....
20:53:20FromDiscord<Phil> @tracy recall how I wanted to point out to keep in mind when code runs at compile time and when at runtime?
20:53:38FromDiscord<Phil> Variable assignment has one of those things
20:54:31FromDiscord<Phil> let = variable assignment at runtime but variable is immutable ↵var = variable assignment at runtime, but variable is mutable↵const = variable assignment at compile time (which means no CPU cycles will be wasted assigning a value to this variable, it'll exist like that in the binary)
20:54:48FromDiscord<tracy> so can i write a const into the code or sm
20:55:08FromDiscord<Phil> Pretty much, keep in mind though that this also means you can't assign anything to a const var that isn't available at compile time
20:55:27FromDiscord<Phil> so you can access e.g. type definitions no problems
20:55:28FromDiscord<Phil> (edit) "problems" => "problem"
20:55:35FromDiscord<tracy> In reply to @Isofruit "Pretty much, keep in": how would i add in "const settings = "test"
20:55:35FromDiscord<Phil> (edit) "problem" => "problem. Those are there at compile time"
20:55:49FromDiscord<Phil> Specific object instances are not available at compile time though
20:55:52FromDiscord<Phil> add in where?
20:55:56FromDiscord<tracy> the exe
20:56:01FromDiscord<tracy> wait what are we talking aobut
20:57:09FromDiscord<Phil> sent a code paste, see https://play.nim-lang.org/#ix=3QQH
20:59:48FromDiscord<Phil> sent a code paste, see https://play.nim-lang.org/#ix=3QQI
21:00:53FromDiscord<Phil> This is for elaborating on what using "const" means
21:01:54FromDiscord<Phil> Since enthus1ast wanted to point you towards using const buffers or whatnot
21:02:05FromDiscord<tracy> what
21:02:05FromDiscord<tracy> is
21:02:06FromDiscord<tracy> buffer
21:02:07FromDiscord<tracy> 😭
21:03:19FromDiscord<enthus1ast> const buffers for directly writing the configuration into the binary (withouth recompilation) i though that was the goal
21:03:26FromDiscord<tracy> yes it is
21:03:27FromDiscord<tracy> i just dont know
21:03:28FromDiscord<tracy> what a buffer is
21:03:46FromDiscord<enthus1ast> just a string or a array
21:03:49FromDiscord<Phil> That you can ask enthus1ast, never done file reading that way, I tend to use the bog standard solution:↵https://github.com/nim-lang/Nim/wiki/Nim-for-Python-Programmers#Reading-and-writing-files
21:05:23FromDiscord<Phil> A buffer is typically just something that temporarily stores something, amassing it until something is triggered and then acting on it all at once to make one big call rather than 50 small ones
21:05:26FromDiscord<Phil> e.g. writing a file
21:05:49FromDiscord<Phil> It makes more sense to first collect a bunch of text to write to disc and then hand all of it at once to the system to write into a file
21:06:02FromDiscord<Phil> Than it does making 500.000 individual requests for every single character
21:06:37FromDiscord<Phil> Buffer mechanisms are generally there to reduce the number of operations being made in a general sense
21:06:59FromDiscord<tracy> oh alr
21:07:08FromDiscord<Phil> Another scenario would be log messages
21:07:57FromDiscord<Phil> Where you can say "buffer me 100.000 log messages first before you send them all to my logging server"↵That way you make 1 big request towards your logging server rather than 100.000 individual ones
21:08:05FromDiscord<Phil> (edit) "server"↵That" => "server for storage"↵That"
21:09:02FromDiscord<Phil> Triggering a buffer to do its thing in the context of writing to disc is often referred to as flushing the buffer to disc
21:09:16FromDiscord<Phil> (edit) "Triggering a buffer to do its thing ... in" added "and send all of its contained data away"
21:25:50*jjido joined #nim
21:49:34FromDiscord<tracy> how i convert int64 to itn
21:49:35FromDiscord<tracy> int
21:50:51nrds<Prestige99> let i: int = (int) someInt64Variable
21:51:01FromDiscord<tracy> In reply to @nrds "<Prestige> let i: int": whats prestige
21:51:08nrds<Prestige99> That's me
21:51:11FromDiscord<tracy> oh mb
21:51:12FromDiscord<tracy> 😭
21:51:17nrds<Prestige99> haha np
21:54:04FromDiscord<b4mbus> how do I determine if given Nim's data structures are thread safe or not?
21:54:06nrds<Prestige99> also you don't need the parentheses, I just do that out of habit
21:54:35FromDiscord<b4mbus> For example I have my own ErrorQueue, internally it uses a HeapQueue and I dont know if I should lock on every push operation or if the HeapQueue already does that
21:54:41FromDiscord<b4mbus> docs dont give any info
21:54:51FromDiscord<ynfle> In reply to @b4mbus "For example I have": Is it global?
21:55:11FromDiscord<b4mbus> In reply to @ynfle "Is it global?": is what global?
21:55:19FromDiscord<ynfle> In reply to @b4mbus "is what global?": The queue
21:55:24FromDiscord<ynfle> Is it a global variable?
21:55:47FromDiscord<b4mbus> if you mean the one of type ErrorQueue, not quite, it's a part of a bigger Application type, but yes, it's shared across different thread
21:56:01FromDiscord<b4mbus> I mean, ErrorQueue is a part of an ErrorHandler which is a part of Application
21:56:42FromDiscord<b4mbus> sent a code paste, see https://play.nim-lang.org/#ix=3QQV
21:57:22FromDiscord<b4mbus> Im not sure if that's a Nim idiomatic way but that's how I would do that in C++ so that's how Im doing it in Nim
21:57:43FromDiscord<b4mbus> IM going to post the full code for CR anyway
21:57:54FromDiscord<b4mbus> for now Im just gonnna implement it with locks; we'll see later
21:58:59FromDiscord<tracy> how do i write at a certain position with file streams
22:03:00*jmdaemon joined #nim
22:11:11*ltriant joined #nim
22:15:57*ltriant quit (Ping timeout: 256 seconds)
22:18:09rockcaveratracy https://nim-lang.org/docs/streams.html#setPosition%2CStream%2Cint
22:19:20*kenran quit (Quit: WeeChat info:version)
22:40:31nrds<Prestige99> Is there any noticeable mistake with this c binding? https://i.imgur.com/lbgL5Bs.png
22:41:26nrds<Prestige99> It seems like, when I'm running the code, that `zoom` is actually the x value and `zNear` is the y value
22:43:36*jmdaemon quit (Quit: ZNC 1.8.2 - https://znc.in)
22:51:58*jmdaemon joined #nim
23:08:22FromDiscord<Elegantbeef> @ShalokShalom\: seems fine, though i'd use a single `type` block fo them all, and the more important thing is the PIP Expanse watching 😛
23:09:21FromDiscord<Elegantbeef> That seems fine prestige
23:11:09FromDiscord<Elegantbeef> Perhaps throw `{.packed.}` on it?
23:12:47FromDiscord<b4mbus> sent a code paste, see https://play.nim-lang.org/#ix=3QRj
23:13:12FromDiscord<Elegantbeef> `const defaultLoggingString = "[$levelname $date::$time]"`
23:14:54*jjido quit (Quit: My MacBook Air has gone to sleep. ZZZzzz…)
23:24:36FromDiscord<ShalokShalom> In reply to @Elegantbeef "<@208199869301522432>\: seems fine, though": single type?
23:25:12FromDiscord<Elegantbeef> sent a code paste, see https://play.nim-lang.org/#ix=3QRn
23:28:54FromDiscord<b4mbus> In reply to @Elegantbeef "`const defaultLoggingString = "[$levelname": https://media.discordapp.net/attachments/371759389889003532/947274050294644766/unknown.png
23:28:56FromDiscord<b4mbus> not really?
23:29:19FromDiscord<b4mbus> but I guess it's bad design anyway I only use it in `newErrorHandler`
23:29:23FromDiscord<auxym> unindent it
23:29:34FromDiscord<auxym> it should not be part of the `type` block
23:30:01FromDiscord<b4mbus> so it's not possible to do what I want
23:30:14FromDiscord<b4mbus> I meant something like static class variables
23:30:21FromDiscord<Elegantbeef> No nim does not have default values for types
23:30:24FromDiscord<Elegantbeef> It defaults to `0`
23:30:45FromDiscord<Elegantbeef> You need to make constructors for the default behaviour
23:31:35FromDiscord<b4mbus> yeah
23:31:41FromDiscord<Elegantbeef> sent a code paste, see https://play.nim-lang.org/#ix=3QRo
23:31:53FromDiscord<Elegantbeef> Which lets you do `ErrorHandler.defaultLoggingString`
23:32:01FromDiscord<b4mbus> that's a thing yeah
23:32:03FromDiscord<Elegantbeef> make it return a `static string` if you want aswell to get it to kick in at CT
23:32:18FromDiscord<b4mbus> how do you even know you can do `typedesc[ErrorHandler]` when Nim's docs don't mention shit about it
23:32:24FromDiscord<b4mbus> except `magic type blah`
23:32:40FromDiscord<Elegantbeef> https://nim-lang.org/docs/manual.html#special-types-typedesc-t
23:33:10FromDiscord<b4mbus> oh?
23:33:19FromDiscord<b4mbus> manual vs docs
23:33:23FromDiscord<b4mbus> yeah right
23:33:45FromDiscord<b4mbus> sent a code paste, see https://paste.rs/GpY
23:33:46FromDiscord<b4mbus> (edit) "right" => "right, thanks"
23:34:08FromDiscord<Elegantbeef> You editted it so i cannot see it here, resend it 😛
23:34:14FromDiscord<b4mbus> sure
23:34:39FromDiscord<b4mbus> sent a code paste, see https://play.nim-lang.org/#ix=3QRq
23:35:32FromDiscord<Elegantbeef> Ah a sugar issue, uhhh one second
23:35:46FromDiscord<Elegantbeef> Dont use lambda/anonymous procs much so might take a me a minute to reason
23:36:18FromDiscord<b4mbus> (generally I resolved this issue differently because this approach was wrong on a couple levels, but I still wanna know what is wrong with this)
23:37:11FromDiscord<Elegantbeef> Generially i say use `applyit` over apply, but yea i'll see if i can make that work
23:37:46FromDiscord<Elegantbeef> Hmm i cannot get it to play even remotely nice
23:39:36FromDiscord<Elegantbeef> No clue if that works in your case
23:39:37FromDiscord<Elegantbeef> sent a code paste, see https://play.nim-lang.org/#ix=3QRu
23:40:32FromDiscord<b4mbus> hmm?
23:40:39FromDiscord<b4mbus> why did u put `()` in there?
23:40:54FromDiscord<Elegantbeef> To make it know exactly what statement to use
23:41:14FromDiscord<b4mbus> okay so it's about how nim parses this
23:41:25FromDiscord<Elegantbeef> Well i didnt get the same error as you
23:41:32FromDiscord<Elegantbeef> So clearly i did something wrongish
23:41:49FromDiscord<b4mbus> oh, also
23:41:55FromDiscord<b4mbus> why do I have to specify the type here?
23:42:14FromDiscord<Elegantbeef> Like i said i dont use sugar, so i just guessed
23:42:17FromDiscord<b4mbus> nim doesnt even have generic lambdas?
23:42:20FromDiscord<b4mbus> okay, thanks anyway
23:42:30FromDiscord<Elegantbeef> generic lambdas dont make any sense imo
23:42:52FromDiscord<Elegantbeef> Firstly it's reversed type inference, secondly a specific type needs to be instantiated
23:43:08FromDiscord<Elegantbeef> Nim doesnt do reversed type inference
23:43:16FromDiscord<b4mbus> theyre nice, you dont always want to specify the type explicitly, especially if it doesnt matter or is inferable from an expression literally two characters later
23:44:12FromDiscord<Elegantbeef> Eh i generally stay away from anonymous procs, so no comment
23:44:19FromDiscord<b4mbus> ... also std/sugar shows examples of it working without specyfing the type
23:44:30FromDiscord<Elegantbeef> Well maybe i was wrong to add the type?
23:44:38FromDiscord<b4mbus> no, you were right
23:44:41FromDiscord<b4mbus> it doesnt compile without it
23:45:10FromDiscord<b4mbus> but I guess its because its a template
23:45:17FromDiscord<b4mbus> in C++ sich a thing wouldnt compile either
23:45:22FromDiscord<b4mbus> it would require lifting
23:45:26FromDiscord<Elegantbeef> It's not a template?
23:45:28FromDiscord<b4mbus> which is more work that simply specyfing the type
23:45:31FromDiscord<b4mbus> https://nim-lang.org/docs/sequtils.html#apply%2CopenArray%5BT%5D%2Cproc%28T%29_3
23:45:38FromDiscord<b4mbus> > proc apply[T](s: openArray[T]; op: proc (x: T) {.closure.}) {.inline,↵> effectsOf: op.}
23:45:39FromDiscord<b4mbus> I mean, sorry
23:45:41FromDiscord<Elegantbeef> It's not a template
23:45:42FromDiscord<b4mbus> a generic
23:45:47FromDiscord<b4mbus> Nim has a different teminology
23:45:47FromDiscord<Elegantbeef> Ah
23:46:07FromDiscord<Elegantbeef> \~\~I'd argue more correct\~\~ 😛
23:46:11FromDiscord<b4mbus> (edit) "> proc apply[T](s: openArray[T]; op: proc (x: T) {.closure.}) {.inline,↵> effectsOf: op.}" => "sent a code paste, see https://play.nim-lang.org/#ix=3QRv"
23:46:29FromDiscord<b4mbus> well yeah
23:46:33FromDiscord<huantian> maybe just use applyIt for now
23:46:44FromDiscord<Elegantbeef> Damn was just writing that `applyit` is just better
23:46:49FromDiscord<b4mbus> it took me some time to understand that templates in nim are not what templates in C++ are
23:47:03FromDiscord<b4mbus> hmm
23:47:06FromDiscord<b4mbus> yeah I see
23:47:41FromDiscord<Elegantbeef> Actually it doesnt work either it seems
23:47:44FromDiscord<b4mbus> Im not using it anyway, because as I stated before the apply thing was wrong anyway
23:47:53FromDiscord<b4mbus> But its still a valuable advice, thanksk
23:47:56FromDiscord<b4mbus> (edit) "thanksk" => "thanks"
23:48:02FromDiscord<Elegantbeef> Yea applyit expects a mutable collection
23:48:18FromDiscord<huantian> sent a code paste, see https://play.nim-lang.org/#ix=3QRx
23:48:22FromDiscord<Elegantbeef> sent a code paste, see https://paste.rs/HUb
23:48:54FromDiscord<huantian> you might want map for what you're doing?
23:49:16FromDiscord<b4mbus> Ill repeat it third time ;d
23:49:17FromDiscord<b4mbus> Im not using it anyway, because as I stated before the apply thing was wrong anyway
23:49:32FromDiscord<b4mbus> (edit) "Im not using it anyway, because as I stated before the apply thing was wrong anyway ... " added "(Im not using apply or any similiar operation)"
23:49:50FromDiscord<huantian> sent a code paste, see https://play.nim-lang.org/#ix=3QRy
23:50:14FromDiscord<Elegantbeef> you might want to usue apply it 😜
23:50:16FromDiscord<Elegantbeef> So it's a really mess
23:50:16FromDiscord<Elegantbeef> real\
23:50:19FromDiscord<Elegantbeef> sent a code paste, see https://play.nim-lang.org/#ix=3QRz
23:50:24FromDiscord<b4mbus> sent a code paste, see https://play.nim-lang.org/#ix=3QRA
23:50:24FromDiscord<b4mbus> thats how I do it now
23:51:16FromDiscord<Elegantbeef> That's quite a inefficient way of doing it
23:51:37FromDiscord<b4mbus> I dont know shit about Nim :P
23:51:41FromDiscord<Elegantbeef> Probably doesnt matter though
23:51:47FromDiscord<huantian> In reply to @Elegantbeef "Joke aside to use": you'd probably want to use a discard map so you don't have to do a dup
23:51:47FromDiscord<b4mbus> so if there's anything to change, yeah, please correct me
23:51:51FromDiscord<ynfle> In reply to @b4mbus "if you mean the": So the queue is a global variable? I don't think it's threadsafe for writes
23:52:00FromDiscord<huantian> In reply to @huantian "you'd probably want to": but honestly a for loop is just better in this case if you're not using the result
23:52:33FromDiscord<b4mbus> In reply to @ynfle "So the queue is": its not literally global, but it is supppsed to be shared accross threads, yes
23:52:43FromDiscord<b4mbus> I implemented it with locks
23:53:00FromDiscord<b4mbus> if the locks are reduntant because seq/HeapQueue is threadsafe already Ill just remove that later
23:53:01FromDiscord<ynfle> In reply to @b4mbus "its not literally global,": So how do you share it? You pass a ref?
23:53:11FromDiscord<ynfle> In reply to @b4mbus "if the locks are": I don't think it is
23:53:21FromDiscord<b4mbus> In reply to @ynfle "So how do you": I havent gotten to that part of the implementation yet
23:53:23FromDiscord<Elegantbeef> Well the way to do it more efficiently is to iterate over the string if you hit a `$` check if the following characters are the replacement characters and if so plop in the new string and carry on the string from the end of it
23:53:27FromDiscord<b4mbus> Im starting from the very bits of the app
23:54:48FromDiscord<ajusa> sent a code paste, see https://play.nim-lang.org/#ix=3QRD
23:55:34FromDiscord<b4mbus> In reply to @Elegantbeef "Well the way to": oh actually, sorry
23:55:44FromDiscord<b4mbus> Ive pasted the wrong, old impl here, my bad
23:56:01FromDiscord<Elegantbeef> sent a code paste, see https://play.nim-lang.org/#ix=3QRE
23:56:04FromDiscord<Elegantbeef> dont need parseutils i guess
23:56:14FromDiscord<Elegantbeef> Ah
23:56:20FromDiscord<b4mbus> sent a code paste, see https://paste.rs/nf1
23:56:28FromDiscord<b4mbus> this is the correct impl
23:56:32FromDiscord<b4mbus> and I guess I dont need dup here?
23:56:52FromDiscord<Elegantbeef> Ah still similar issue, multiple iterations, so if ever care about performance of this easy thing to tend to
23:56:53FromDiscord<b4mbus> sent a code paste, see https://paste.rs/2CG
23:57:19FromDiscord<Elegantbeef> Cause replace chained like that iterates the entire string mutliple times instead of once
23:57:27FromDiscord<b4mbus> hmm true
23:57:29FromDiscord<Elegantbeef> I was just commenting on a possible performance increase
23:57:32FromDiscord<huantian> or you can use multiReplace
23:57:41FromDiscord<b4mbus> great heavens
23:57:43FromDiscord<Elegantbeef> Oh right multi replace
23:57:54FromDiscord<Elegantbeef> Everyone forgets about multi replace
23:58:00FromDiscord<b4mbus> I was wondering why doesnt replace have any overload with an openArray or shi
23:58:05FromDiscord<b4mbus> Im going to check it out rn
23:58:20FromDiscord<Elegantbeef> I wonder does multiReplace store a set of the starting characters to optimize it?
23:58:39FromDiscord<Elegantbeef> It does!
23:58:45FromDiscord<Elegantbeef> So it's super efficient
23:59:06FromDiscord<b4mbus> oh not really
23:59:12FromDiscord<b4mbus> I cant really use multiReplace
23:59:18FromDiscord<Elegantbeef> Why not?
23:59:21FromDiscord<b4mbus> oh, no
23:59:24FromDiscord<b4mbus> sorry, my bad
23:59:36FromDiscord<b4mbus> it takes a string and a var array of tuples (original, replace)
23:59:40FromDiscord<Elegantbeef> Was going to say it's literally doing what you're doing just vastly more efficient
23:59:40FromDiscord<b4mbus> neeaaatt
23:59:45FromDiscord<ajusa> In reply to @ajusa "Any reason I could": figured out that error - it's because the type of `[]` is not possible to infer. How can I tell it that `[]` is of type `openArray[string, string]`? I tried a cast and that didn't work