<< 29-04-2022 >>

00:08:05NimEventerNew Nimble package! cocktaildb - TheCocktailDB API client, see https://github.com/thechampagne/cocktaildb-nim
00:14:00*duuude joined #nim
00:17:50FromDiscord<amadan> That is a weird api imo (the original cocktailDB api)↵https://www.thecocktaildb.com/api/json/v1/1/search.php?s=margarita↵Uses multiple keys instead of an array
00:19:08*vicfred quit (Quit: Leaving)
00:48:00FromDiscord<Yardanico> In reply to @Yardanico "funny thing is that": made the repo - https://github.com/Yardanico/mimalloc_nim
00:48:08FromDiscord<Yardanico> went a little too overboard with the readme
01:12:53FromDiscord<Elegantbeef> @spoon\: damn you i may have spent more time than i like
01:12:54FromDiscord<Elegantbeef> image.png https://media.discordapp.net/attachments/371759389889003532/969405883559866418/image.png
01:14:02FromDiscord<spoon> ah, i also modified your example yesterday
01:14:18FromDiscord<Elegantbeef> Yea there was so much wrong with it
01:14:24FromDiscord<Elegantbeef> But as a POC and explanation i think it was ok
01:14:59FromDiscord<spoon> ye, i replaced the whole while loop thing at the end with just a `select` statement, also changed `none` to be a set of all possibilities and removed two if statements from that
01:16:58FromDiscord<spoon> but, if you were generating a world as the player roamed around it, and they decided to do a giant circle and you ended up with a sand two tiles away from a forest, would that not be an appropriate place to include the whole superposition thing?
01:17:42FromDiscord<Elegantbeef> No clue i've not really looked into the logic much, i watched a video for a few minutes 😄
01:18:08FromDiscord<Elegantbeef> I watched a brief part of a video like a week ago and implemented what i assumed was how it's done
01:18:08FromDiscord<spoon> did you change the algorithm at all?
01:18:19FromDiscord<Elegantbeef> https://github.com/beef331/nimtrest/blob/master/wavefunctioncollapse.nim
01:18:35FromDiscord<Elegantbeef> I changed a lot
01:18:42FromDiscord<Elegantbeef> I've toyed with it quite a bit since it's quite fun
01:18:43FromDiscord<spoon> ah nice
01:19:27FromDiscord<spoon> (also aren't github gists used for single file repos?)
01:19:39FromDiscord<Elegantbeef> This isnt a single file repo
01:19:48FromDiscord<Yardanico> In reply to @spoon "(also aren't github gists": not really, gists can have multiple files
01:19:50FromDiscord<Elegantbeef> This is heap for anything i write i think is nifty
01:20:02FromDiscord<spoon> In reply to @Yardanico "not really, gists can": oh, then what's the advantage then?
01:20:14FromDiscord<Yardanico> well, it still feels more like a "paste" service so you don'
01:20:19FromDiscord<Elegantbeef> If you notice i also have vershun my static typed data migration tool
01:20:19FromDiscord<Yardanico> t have to create a repo for every paste
01:20:28FromDiscord<Yardanico> yeah @beef i have a similar repo https://github.com/Yardanico/nim-snippets
01:20:33FromDiscord<Yardanico> and a few other nim people also do
01:23:19FromDiscord<Elegantbeef> Yea i was tired of having to search for links for my one off stuffs
01:23:20FromDiscord<Elegantbeef> This resolves that
01:30:01FromDiscord<spoon> is random pick just selecting a random tile til it fits?
01:30:25FromDiscord<Elegantbeef> Yea
01:30:42FromDiscord<Elegantbeef> Ah there is `sample`
01:30:48FromDiscord<spoon> yeah
01:30:52FromDiscord<spoon> was gonna say
01:42:44FromDiscord<morgan> i’m considering using wavefunction collapse but not like at one scale
01:43:01FromDiscord<morgan> and the randomness would be based on a seed so deterministic
01:43:42FromDiscord<morgan> so basically the first layer spits out like a mountain here, an ocean there, a desert over there, and then the following layers refine it adding more details
01:44:10FromDiscord<Yardanico> In reply to @MorganAlyssa "and the randomness would": you can easily pass a seed to nim's random module
01:44:12FromDiscord<morgan> and then it would generate far more distance for the larger ones as the player moves around
01:44:23FromDiscord<Yardanico> randomize either takes no arguments or a single argument being the starting seed
01:44:26FromDiscord<Yardanico> https://nim-lang.org/docs/random.html#randomize%2Cint64
01:44:35FromDiscord<morgan> yeah some sort of seed plus world coords to get the value
01:45:00FromDiscord<Elegantbeef> Yea any good procgen is deterministic
01:45:03FromDiscord<Elegantbeef> Otherwise it's garbage
01:45:37*Gustavo6046 quit (Quit: Goodbye! Leave messages at my XMPP @ [email protected] or my Discord Gustavo6046#9009 or possibly my Mastodon [email protected] – I don't check my email often since it's full of crap, but in any case, [email protected])
01:45:37FromDiscord<morgan> so then each layer of the wave function collapse doesn’t need super complicated long distance rules to look good because it’s done at multiple scales
01:47:10*Gustavo6046 joined #nim
02:05:38FromDiscord<morgan> tho in my case it would be a little more complicated because i’m thinking about trying to make a plate tectonics approximation to start out the process, so if i do that it would be that first and that influencing later world gen, but still using multi-scale wavefunction collapse to fill in a lot of the details
02:20:39*Gustavo6046 quit (Ping timeout: 240 seconds)
02:26:38nrds<Prestige99> Can you label a for loop to break out of it?
02:26:44nrds<Prestige99> Like in a case with nested for loops
02:26:59FromDiscord<Elegantbeef> you can `block myName`
02:27:13nrds<Prestige99> can you give an example?
02:27:24nrds<Prestige99> like create a scope around the for loop?
02:28:07FromDiscord<huantian> sent a code paste, see https://play.nim-lang.org/#ix=3Wxa
02:28:10FromDiscord<Elegantbeef> sent a code paste, see https://play.nim-lang.org/#ix=3Wxb
02:28:20nrds<Prestige99> cool
02:29:55FromDiscord<morgan> handy
02:30:33FromDiscord<huantian> very nesty
02:34:03*kayabaNerve quit (Ping timeout: 256 seconds)
02:35:12FromDiscord<morgan> i have a long proc with a bunch of conditionals and a few nested loops, i should do that to make it clearer where i'm breaking to
02:37:51FromDiscord<Elegantbeef> break it in to procedures where you can
02:38:06FromDiscord<Elegantbeef> Many times when you used break out of blocks it can be done with a procedure
02:44:18FromDiscord<morgan> yeah i may be able to break it up into a few but i don't want to do that if i'm only using it once
02:44:38FromDiscord<Elegantbeef> Eh it's' generally much cleaner imo to use a procedure than break but ymmv
02:46:33FromDiscord<morgan> ok i found one section where i repeat some code. tho it's one thing in a while and then another copy of that code which runs after the loop breaks, so it would probably be cleaner to change up the looping part of it rather than break it out
02:47:39*Gustavo6046 joined #nim
02:49:05*Gustavo6046 quit (Max SendQ exceeded)
02:49:39*Gustavo6046 joined #nim
02:49:39*Gustavo6046 quit (Client Quit)
02:49:54*Gustavo6046 joined #nim
02:50:57FromDiscord<morgan> ok yeah did that
02:56:30*arkurious quit (Quit: Leaving)
03:02:40*duuude quit (Quit: Konversation terminated!)
03:03:01*duuude joined #nim
03:24:39*irfanns quit (Ping timeout: 240 seconds)
03:30:57*irfanns joined #nim
03:39:24*irfanns quit (Ping timeout: 276 seconds)
03:47:21*Gustavo6046 quit (Remote host closed the connection)
04:01:29*bananahead quit (Quit: The Lounge - https://thelounge.chat)
04:02:12*bananahead joined #nim
04:02:13*Gustavo6046 joined #nim
04:03:27*Gustavo6046 quit (Max SendQ exceeded)
04:03:59*Gustavo6046 joined #nim
04:06:11FromDiscord<demotomohiro> I wrote a macro that creates a while statement with named blocks so that you can easily leave or continue the while loop in double (or deeper) loop:↵https://github.com/demotomohiro/littlesugar/blob/main/src/littlesugar/namedWhile.nim
04:06:44*Gustavo6046 quit (Client Quit)
04:06:56*Gustavo6046 joined #nim
04:08:03*Gustavo6046 quit (Max SendQ exceeded)
04:08:29*Gustavo6046 joined #nim
04:11:22*duuude quit (Ping timeout: 250 seconds)
04:15:38FromDiscord<morgan> oh neat
04:23:37FromDiscord<Elegantbeef> Why is it a macro?
04:26:32FromDiscord<demotomohiro> It looks simpler than writing named block and while loop.
04:26:46FromDiscord<Elegantbeef> I mean why isnt it a template 😄
04:30:41FromDiscord<morgan> i think it's the checking to allow using nil to have only one of the two jump points
04:31:00FromDiscord<morgan> tho maybe it could be done with a template
04:33:15FromDiscord<Elegantbeef> I see `cond, outer, inner, body` and `cond, outer, body` as the only valid use cases of it bt ymmv
04:33:54FromDiscord<morgan> wait yeah wouldn't it work with overloading, tho then you could only have just outer or just inner
04:34:11FromDiscord<demotomohiro> You can optionaly create inner/outer named block. If you want to create only inner named block, you give nil to outer block name. That require macro.
04:35:11FromDiscord<morgan> so maybe two names for it, either one with two args gives you both break points and with just one it gives you either inner or outer depending on the name
04:35:56FromDiscord<morgan> and could also have another one where if it's one arg it uses it as a prefix so like `break loop1inner` by passing in "loop1"
04:38:43*Gustavo6046 quit (Remote host closed the connection)
04:42:52*slowButPresent quit (Quit: leaving)
04:46:59*Gustavo6046 joined #nim
04:52:19FromDiscord<morgan> so what's the specifics on underscore validity in identifiers? i was trying to do an identifier construction and wanted to do inputtext_outer and inputtext_inner but nim complains about the \_
04:52:39FromDiscord<Rika> Both are valid
04:52:43FromDiscord<Elegantbeef> single `_` is allowed
04:52:50FromDiscord<Rika> What is the error?
04:52:58FromDiscord<Elegantbeef> It cannot start with or end with `_` and there cannot be two `_` next to eachother
04:53:50nrds<Prestige99> Where are simple array and seq functions documented? E.g. add and remove
04:54:08FromDiscord<Elegantbeef> They're apart of system
04:54:29FromDiscord<Elegantbeef> https://nim-lang.org/docs/system.html#add%2Cseq%5BT%5D%2CopenArray%5BT%5D
04:54:57*kayabaNerve joined #nim
04:55:00nrds<Prestige99> Thanks
04:55:13nrds<Prestige99> Always forget where that is and can't find it by googling
04:55:40FromDiscord<Elegantbeef> https://nim-lang.org/docs/lib.html https://nim-lang.org/docs/theindex.html
04:56:57FromDiscord<morgan> so shouldn't i be able to construct an identifier with an _ between a variable and a fixed bit of text? is there some way to indicate that a section of an identifier construction is not an identifier to try to insert the value of?
04:57:10FromDiscord<Elegantbeef> What?
04:57:29FromDiscord<morgan> https://media.discordapp.net/attachments/371759389889003532/969462402242445342/unknown.png
04:57:44FromDiscord<Elegantbeef> why not just `name_outer`?
04:58:12FromDiscord<Elegantbeef> Ah nevermind i see you're using template magic
04:58:13FromDiscord<morgan> does it still use the value of name in that case?
04:58:18FromDiscord<Elegantbeef> why do you need `_`
04:58:22FromDiscord<Elegantbeef> just do `name outer`
04:58:26FromDiscord<Elegantbeef> there is no benefit to using `_` here
04:58:30FromDiscord<morgan> to visually separate them
04:58:39FromDiscord<Elegantbeef> Visually seperate them where?
04:58:49FromDiscord<Elegantbeef> You dont see these declared
04:59:04FromDiscord<morgan> they would get used in break calls
04:59:22FromDiscord<Elegantbeef> So what `myName_outer` and `myNameOuter` are identical in nim
04:59:39FromDiscord<morgan> oh huh
04:59:42FromDiscord<morgan> cool
05:02:29FromDiscord<Elegantbeef> sent a code paste, see https://play.nim-lang.org/#ix=3Wxr
05:03:22FromDiscord<Elegantbeef> needs `{.dirty.}` to inject the break names
05:05:24FromDiscord<morgan> ah thanks, i had looked at that but didn't finish reading thru it before having to walk away from my computer for a min
05:07:45*vicfred joined #nim
05:31:51FromDiscord<retkid> should i learn Reason
05:33:22FromDiscord<Solitude> yeah
05:34:01FromDiscord<retkid> In reply to @Solitude "yeah": thinking about learning clio
05:34:09FromDiscord<retkid> i need to see if its faster then nim
05:34:31FromDiscord<retkid> but im thinking about a really stupid project that does browser rendering
05:35:32*irfanns joined #nim
05:35:36*rockcavera quit (Remote host closed the connection)
05:38:12FromDiscord<Rika> “Faster than Nim” is dependent on the programmer as always
05:41:09FromDiscord<retkid> In reply to @Rika "“Faster than Nim” is": in wasm in this situation
05:41:28FromDiscord<retkid> depends probably more on the compiler
05:41:39FromDiscord<retkid> but im now looking into webgpu
05:44:49FromDiscord<Phil> In reply to @treeform "Sounds like a json": I think so far it's sth in the jwt conversion. The json itself before it gets turned into a torn looks correct. It's after when it becomes a mess... God do I dislike when encodings mess up
05:45:30FromDiscord<Phil> (edit) "torn" => "token"
05:53:27*irfanns quit (Ping timeout: 246 seconds)
05:54:09*irfanns joined #nim
06:07:05FromDiscord<Phil> The culprit is effing toBase64, that does not deal well with Unicode
06:09:57*irfanns quit (Ping timeout: 256 seconds)
06:10:54FromDiscord<Phil> Something in there about the proc encodeurlsafe which uses the proc toopenarraybyte ducks up my Unicode
06:22:43FromDiscord<morgan> ok so i was thinking about the while templates i made and had an idea for another different one, and decided maybe i should make a repo and package for them and then a name popped into my head: whileitol, since it's syntax sugar, and sugar alcohols (a common sugar substitute i'm very familiar with) basically all end in -itol, and whileitol rhymes with xylitol, a commonly used one
06:25:34FromDiscord<morgan> sent a code paste, see https://play.nim-lang.org/#ix=3WxH
06:28:55FromDiscord<morgan> hm tho it would be nice to have a way to break and do the body one last time without having to change the condition to be able to falsify it first
06:33:14FromDiscord<morgan> sent a code paste, see https://paste.rs/9AB
06:33:19FromDiscord<morgan> i think this does what i want
06:33:38FromDiscord<Elegantbeef> try finaly perhaps
06:36:07FromDiscord<morgan> oh so it always runs the block again if it errors?
06:36:12FromDiscord<morgan> (edit) "block" => "body"
06:38:29FromDiscord<morgan> i would guess that it would then run into the same issue in the body after that
06:48:59FromDiscord<Asbjørn F> @Phil Hey, just saw your message now. Will do if something comes up! Thanks a bunch
06:57:36FromDiscord<Phil> In reply to @Asbjørn F "<@180601887916163073> Hey, just saw": Happy to help, mostly because I'm always on the look out for more "general" solutions to my problems and typically there's always a way to improve upon sth.↵And if there's further improvements I can make on norm (moigagoo is the maintainer, not me, just to make sure I don't hog any glory here) that'd also be useful for me with what I learn from your usecases, then all the bet
07:01:31FromDiscord<Asbjørn F> Cool
07:05:07*PMunch joined #nim
07:08:14FromDiscord<d4rckh> sent a code paste, see https://paste.rs/g1V
07:08:15FromDiscord<d4rckh> what 😶
07:09:16FromDiscord<Elegantbeef> Do you have two types named `Socket`?
07:09:23FromDiscord<Elegantbeef> Full code
07:09:25FromDiscord<d4rckh> (edit) "https://play.nim-lang.org/#ix=3WxQ" => "https://play.nim-lang.org/#ix=3WxR"
07:09:45FromDiscord<d4rckh> problem is, i dont know what to send you lol
07:10:30FromDiscord<d4rckh> oh!!
07:10:46FromDiscord<d4rckh> i didnt import `net` and it used the socket type of another library which i imported
07:12:19PMunchSolitude, thanks for replying to the NimLSP issue. Sometimes I wonder how people will go to write an issue before checking the README..
07:12:57FromDiscord<xflywind> In reply to @Isofruit "Happy to help, mostly": Nim 2.0 is gona to support const defaults for objects, I think it can be probably useful for orm.
07:14:14FromDiscord<xflywind> https://github.com/nim-lang/RFCs/issues/252#issuecomment-705113779
07:14:17FromDiscord<Phil> In reply to @flywind "Nim 2.0 is gona": Neat! Though, quesiton, is nim 2.0 close enough on the horizon to start planning for that kind of thing? I was under the impression that's still a mountain of work until there
07:14:30FromDiscord<xflywind> (edit) "something likehttps://github.com/nim-lang/RFCs/issues/252#issuecomment-705113779 ... " added "will be implemented."
07:14:57*gsalazar joined #nim
07:15:14FromDiscord<Phil> Also, will this also cover defaults for contentious types such as DateTime which will explode in your face at every opportunity if you have a field that isn't explicitly initialized?
07:15:16FromDiscord<xflywind> In reply to @Isofruit "Neat! Though, quesiton, is": I'm working on the default fields now. I hope I can finish it one day in the next week.
07:16:00FromDiscord<Phil> Not sure if there are also other fields that explode if not initialized, so far only had that problem with DateTime fields
07:16:17FromDiscord<Phil> (edit) "Not sure if there are also other fields that explode if not initialized, so far only had that problem with DateTime fields ... " added "(and my derivate DjangoDateTime)"
07:16:28FromDiscord<Elegantbeef> It'll let you give a default state with constant values
07:16:33FromDiscord<Elegantbeef> So no it doesnt solve that issue afaik
07:16:48FromDiscord<xflywind> Anything which doesn't default to zero has the same problem.
07:16:53FromDiscord<Elegantbeef> Will ranges have an opt in for allowing the `low` be default?
07:17:36FromDiscord<Elegantbeef> I guess i need to read the RFC for that
07:18:32FromDiscord<Phil> In reply to @Elegantbeef "It'll let you give": So I can look at it more like... basically constructor/defaults ?
07:18:50FromDiscord<xflywind> Yeah
07:19:14FromDiscord<Phil> Really neat! I love constructor and if that or sth like it makes it into the main language it can only benefit!
07:19:21FromDiscord<Elegantbeef> Yea it'll be compiller supported version of my defaults
07:20:45FromDiscord<d4rckh> sent a code paste, see https://play.nim-lang.org/#ix=3WxT
07:20:51FromDiscord<d4rckh> this is what i run.. `nim c -r --threads:on -d:server .\server\server.nim`
07:21:18FromDiscord<d4rckh> wait what it worked
07:21:23FromDiscord<d4rckh> (edit) "wait what it worked ... " added "after 5th time"
07:21:34PMunch@d4rckh, that error looks really weird
07:21:41PMunchAre you using some strange library?
07:21:54PMunchNim shouldn't try to touch .gitignore..
07:21:55FromDiscord<Elegantbeef> It's an unhandled exception from their code afaict
07:22:11FromDiscord<d4rckh> im using winim, thats probably the strangest library im using
07:22:16FromDiscord<Elegantbeef> Pmunch i had a look and yep derivedtypes still remains a mystery to me
07:22:22FromDiscord<d4rckh> In reply to @Elegantbeef "It's an unhandled exception": its not actually running my code
07:22:38FromDiscord<d4rckh> it didnt get to the link process https://media.discordapp.net/attachments/371759389889003532/969498929089622036/unknown.png
07:23:06PMunch@Elegantbeef, haha what's so mysterious about them?
07:23:24FromDiscord<Elegantbeef> Dont quite follow the purpose of the arguments
07:23:28FromDiscord<Elegantbeef> Only looked at it briefly
07:24:58*Gustavo6046 quit (Quit: Goodbye! Leave messages at my XMPP @ [email protected] or my Discord Gustavo6046#9009 or possibly my Mastodon [email protected] – I don't check my email often since it's full of crap, but in any case, [email protected])
07:26:15FromDiscord<Asbjørn F> In reply to @Isofruit "Really neat! I love": I love constructors to the point that it's only default values and no magic
07:26:38FromDiscord<Elegantbeef> Phil was talking about my macro library 😄
07:27:09FromDiscord<Asbjørn F> Just no magic stuff in the constructors 🚫
07:28:37PMunch@Elegantbeef, yeat the names aren't great
07:28:46PMunchAnything in particular that confused you?
07:29:05PMunchI mean deriveable is pretty simple, it just takes a list of procedures to add to the list
07:29:18FromDiscord<Elegantbeef> I dont know what the stuff in the `[]` does
07:29:25FromDiscord<d4rckh> hmm, how can i hook the esc key in my terminal app? similarly how you can hook the ctrl+c combo
07:30:33FromDiscord<xflywind> In reply to @Elegantbeef "Will ranges have an": I hope we can have a RFC covering that stuff in addition to `=default` hook solution.
07:30:46FromDiscord<xflywind> (edit) "In reply to @Elegantbeef "Will ranges have an": I hope we can have a RFC covering that stuff in addition to ... `=default`" added "the"
07:31:04PMunchderive has two arguments, the first is a list of types that the derived proc will have, the second is a list of procedures to derive. So e.g. `derive(Request, myProc)` would create `proc myProc(r: Request): <whatever the original return was>` and `derive([int, Request], myProc)` would give `proc myProc(i: int, r: Request): <same>`
07:32:39PMunch(derive is designed so that it can be used as a pragma, so `proc myProc(x: int, y: string): string {.derive: [Request, int].}` would create `proc myProc(r: Request, i: int): string`
07:32:49PMunch)
07:34:17FromDiscord<Rika> In reply to @Asbjørn F "Just no magic stuff": What does “magic stuff” mean to you
07:35:19FromDiscord<Elegantbeef> Yea i'm too dumb to my suggestion here 😄
07:35:32FromDiscord<Elegantbeef> I've lost the point of this again so i'm in the weeds
07:37:07FromDiscord<Phil> sent a long message, see http://ix.io/3WxV
07:37:53FromDiscord<Phil> It's particularly useful when using norm, because norm-procs very often demand you pass an already created model-instance to them, that they then fill with values from the database.
07:37:55FromDiscord<Rika> Doesn’t that new(T) clobber the new in system, even if it’s a valid overload
07:38:06FromDiscord<Rika> I’d prolly be kinda annoyed in that case
07:38:22FromDiscord<Elegantbeef> You choose
07:38:24FromDiscord<Elegantbeef> So i mean you do you
07:38:28FromDiscord<Rika> Okay
07:38:32FromDiscord<Rika> Can’t it be a different name?
07:38:33FromDiscord<Phil> In reply to @Rika "Doesn’t that new(T) clobber": I haven't tried that, I wrote my own `newModel` proc to make these procs "special"
07:38:44FromDiscord<Asbjørn F> In reply to @Rika "What does “magic stuff”": Anything that isn't just setting default values and deferring to any default values if it contains other structs. God help you if it makes any DB calls
07:38:44FromDiscord<Elegantbeef> You can usue whatever name you want with `constr`
07:38:47FromDiscord<Phil> (edit) "proc" => "procs"
07:39:13FromDiscord<Rika> If I can then okay, I mean a different name with (T) param
07:39:16FromDiscord<Rika> If so then okay
07:39:18FromDiscord<Elegantbeef> sent a code paste, see https://paste.rs/jfa
07:39:36FromDiscord<Phil> In reply to @Asbjørn F "Anything that isn't just": Believe me, you'll know when norm makes DB calls. You'll know every time.
07:39:39FromDiscord<Elegantbeef> Default assumes you want either `T.new` or `newT`
07:39:44FromDiscord<Rika> In reply to @Asbjørn F "Anything that isn't just": Default constructors would probably not do that but user defined ones prolly could
07:40:02FromDiscord<Elegantbeef> Default constructors would not be able to, they're going to forced static
07:40:20FromDiscord<Elegantbeef> If the value isnt known at compile time it's not valid for the to be added hooks
07:40:24*Zectbumo quit (Remote host closed the connection)
07:40:46FromDiscord<Phil> I recommend repository pattern even if you do use norm. Write a generic repository that wraps norm procs with an API you find useful and go from there. I can recommend my approach because I find it useful, but that does require you to use constructor and absolutely requires you to define `newModel` proc for all your norm-models
07:41:00FromDiscord<Asbjørn F> In reply to @Isofruit "Believe me, you'll know": That's always a nice guarantee
07:41:24FromDiscord<Phil> (edit) "I recommend repository pattern even if you do use norm. Write a generic repository that wraps norm procs with an API you find useful and go from there. I can recommend my approach because I find it useful, but that does ... require" added "somewhat"
07:42:14FromDiscord<Phil> (edit) "I recommend repository pattern even if you do use norm. Write" => "sent" | "generic repository that wraps norm procs with an API you find useful and go from there. I can recommend my approach because I find it useful, but that does somewhat require you to use constructor and absolutely requires you to define `newModel` proc for all your norm-models" => "long message, see http://ix.io/3WxW"
07:45:07FromDiscord<Phil> https://github.com/PhilippMDoerner/NimStoryFont/blob/master/src/applications/genericArticleRepository.nim↵That's my generic repository for example, which I can't recommend to just straight up copy paste because there's a bunch of assumptions in there that are only true for my data model, namely that some of the procs there assume there's a "name" column, other's assume there's a link to a campaign-table with a name field etc.
07:47:15*firq joined #nim
07:48:09FromDiscord<Asbjørn F> I see
07:54:54nrds<Prestige99> Is there any way to use std/os with nimscript?
07:55:10FromDiscord<Elegantbeef> Some but it's done annoyingly
07:55:32nrds<Prestige99> Trying to write a nimble script to copy files with different extensions, depending on which os is running the script
07:55:50nrds<Prestige99> but can't seem to be able to do globs or anything useful
07:56:09FromDiscord<Elegantbeef> The os impl sucks
07:56:17nrds<Prestige99> at least it works tho
07:56:30FromDiscord<Elegantbeef> I mean the nimscript os impl sucks
07:56:34nrds<Prestige99> o
07:56:55FromDiscord<Elegantbeef> Need an RFC to fix it
07:59:30nrds<Prestige99> dang
07:59:34nrds<Prestige99> also no extractFilename?
08:00:06FromDiscord<Elegantbeef> That should work
08:00:23FromDiscord<Elegantbeef> There isnt an OS part of that
08:00:36nrds<Prestige99> neat neat
08:05:48FromDiscord<Elegantbeef> For OS operations it's a hit or miss if it'll work
08:23:32FromDiscord<d4rckh> is there any way i can import a file by using it's path? for example doing `import("file.nim").proc()` would be cool
08:23:59FromDiscord<d4rckh> (edit) "`import("file.nim").proc()`" => "`let file = import("file.nim")`"
08:24:19FromDiscord<d4rckh> then to access procs from that file id just do `file.myProc()`
08:24:54FromDiscord<Elegantbeef> Then everything else is the same
08:24:55FromDiscord<Elegantbeef> sent a code paste, see https://play.nim-lang.org/#ix=3Wy6
08:27:41*oprypin quit (Quit: Bye)
08:27:50FromDiscord<d4rckh> well, i am making some sort of command line interface and i have a `commands\` directory that contains all of my commands, each file contains a `const description`, `const usage` and `proc executeCommand` which i want to import
08:27:59*oprypin joined #nim
08:28:27FromDiscord<Elegantbeef> `import myCommand as nil`
08:28:45FromDiscord<Elegantbeef> Or just use an object
08:28:57FromDiscord<Solitude> or write a macro
08:29:55FromDiscord<d4rckh> sent a code paste, see https://paste.rs/JaO
08:30:10FromDiscord<Elegantbeef> You can do the same with a macro without it
08:30:19FromDiscord<d4rckh> (edit) "https://play.nim-lang.org/#ix=3Wya" => "https://play.nim-lang.org/#ix=3Wy9"
08:30:20FromDiscord<d4rckh> so i dont have to import everything by hand
08:30:31FromDiscord<d4rckh> and auto generate a sequence of Command objects
08:30:37FromDiscord<Elegantbeef> Infact i already have a discord bot that does that if that's what you're doing https://github.com/GaryM-exkage/GDGW-Maverick-Bot
08:38:52FromDiscord<d4rckh> oh, i see, thanks
08:40:13PMunch@d4rckh, easiest would probably be a macro that imports everything from the "commands" folder with `import x as nil` and then you can call the command as `x.executeCommand()`.
08:40:41FromDiscord<d4rckh> yeah, thats what im doing, looking at elegantbeef's code, seems like exactly waht i need
08:46:56madpropselegant code
08:47:38madpropshe helped me correct a bunch of problems in this thing https://madprops.github.io/numberstring/
08:47:57madpropsmaybe it will be useful as reference at some point
08:49:59FromDiscord<d4rckh> nnkInfix the dot `.` iirc?
08:50:33FromDiscord<Solitude> In reply to @d4rckh "nnkInfix the dot `.`": what?
08:50:37FromDiscord<d4rckh> nvm,
08:50:42FromDiscord<d4rckh> trying to figure out the ast
08:50:51FromDiscord<Elegantbeef> My macro is very ugly
08:51:00FromDiscord<Elegantbeef> I linked it before in a cleaned up state if you want to search and search
09:01:52FromDiscord<aph> is it possible to have `setRenderer` in karax input arguments to the target function? my `proc createDom(name: string): VNode` needs an argument to work.
09:14:56*om3ga quit (Quit: Bye)
09:15:41FromDiscord<Elegantbeef> @aph\: can you make a thunk?
09:16:14FromDiscord<Elegantbeef> `setRenderer proc(): Vnode = createDom("hello")` type thing should work
09:17:15*om3ga joined #nim
09:18:16*xet7 joined #nim
09:20:12FromDiscord<aph> thanks!
09:22:26*rawrrr quit (Quit: Connection closed for inactivity)
09:33:45FromDiscord<d4rckh> sent a code paste, see https://play.nim-lang.org/#ix=3Wyz
09:33:51FromDiscord<d4rckh> i dont think im doing it properly, my commands are located in `../commands`
09:35:21FromDiscord<Elegantbeef> `echo result.repr`
09:35:39FromDiscord<Asbjørn F> @Phil This might be a dumb question, but the system I'm building has a workload of about 3 million requests daily, with many, many rows. I noticed Norm uses `INTEGER` for id. Do you think with the amounts of id's I'll be generating, I'll get into trouble since the max is only 2,147,483,647
09:36:35FromDiscord<Asbjørn F> After about 700 days I'd be getting in trouble, assuming the workload
09:37:29FromDiscord<Elegantbeef> In nim `int` is platform specific and on 64bit it's 64bit
09:37:53FromDiscord<Asbjørn F> Well I noticed it produced `CREATE TABLE IF NOT EXISTS "User"(email TEXT NOT NULL, id INTEGER NOT NULL PRIMARY KEY)`
09:38:00FromDiscord<Asbjørn F> I'm using postgreSQL
09:38:02FromDiscord<Phil> Ohhh that
09:38:03FromDiscord<Phil> sent a code paste, see https://play.nim-lang.org/#ix=3WyB
09:39:20FromDiscord<Phil> My personal recommendation is writing table definitions by hand tbh.↵I use norm solely for handling converting stuff for me and even that only for simple queries.↵There's some stuff that norm does not handle gracefully, it covers the base case of "query row from table and convert to object" well and has the necessary helper procs, that's around it.
09:39:38FromDiscord<Asbjørn F> Roger
09:39:50FromDiscord<Asbjørn F> I just saw it was able to generate tables and got curious
09:39:57FromDiscord<Phil> If you wish to write views etc., you'll (for now) likely have to use nisane on top of norm (You'll notice that my sqlite FTS5 search table uses nisane)
09:40:00FromDiscord<Phil> Oh it is capable of that
09:40:11FromDiscord<Phil> But the ability is imo not mature enough to properly make use of
09:40:20FromDiscord<Asbjørn F> Right
09:40:33FromDiscord<Phil> At least for me, as I intend to throw a lot of constraints everywhere that isn't on a tree by the count of three
09:40:44FromDiscord<Asbjørn F> makes sense
09:40:47FromDiscord<d4rckh> In reply to @Elegantbeef "`echo result.repr`": whats result?
09:40:57FromDiscord<Elegantbeef> The result variable
09:41:11FromDiscord<Phil> In reply to @d4rckh "whats result?": As in, in general? Result is an implicitly created variable in every proc
09:41:20FromDiscord<Elegantbeef> every
09:41:39FromDiscord<Phil> Oh right, I don't think it exists in procs without return types?
09:41:56FromDiscord<Elegantbeef> Damn well better not void is uninstantiatble
09:42:18FromDiscord<Elegantbeef> sent a code paste, see https://play.nim-lang.org/#ix=3WyC
09:42:26FromDiscord<Elegantbeef> Refer to https://dev.to/beef331/demystification-of-macros-in-nim-13n8 otherwise
09:42:27FromDiscord<Phil> but either way, if you want to create a string, you can go:↵`proc lala(): string = result.add("bla")` --> returns new string "bla"
09:42:46FromDiscord<Phil> result implicitly is "" at the start of the proc and created
09:42:47FromDiscord<Elegantbeef> Or just `proc lalal: string = "bla"` cause we're in 2022 😛
09:43:05FromDiscord<Phil> yeah but then I couldn't show off that bla exists 😛
09:43:11FromDiscord<Phil> errr result I mean
09:43:18FromDiscord<Asbjørn F> sent a long message, see http://ix.io/3WyD
09:43:35FromDiscord<Elegantbeef> Anyway i'm off so phill whill totally help you with all your troubles
09:43:37FromDiscord<d4rckh> okay, i got ↵`↵import↵ /commands / []`
09:43:45FromDiscord<d4rckh> (edit) "okay, i got ↵`↵import↵ /commands / []`" => "sent a code paste, see https://paste.rs/pSt"
09:43:59FromDiscord<d4rckh> i need to add `..` before `/commands`
09:44:01FromDiscord<Elegantbeef> Yea that's clearly wrong so time to learn macros using my writeup
09:44:13FromDiscord<Elegantbeef> `../` is a single operator
09:45:08FromDiscord<Asbjørn F> wow that's a well written write-up
09:45:16FromDiscord<Asbjørn F> (edit) "well written" => "well-written"
09:45:28FromDiscord<Elegantbeef> sent a code paste, see https://play.nim-lang.org/#ix=3WyE
09:46:04FromDiscord<Elegantbeef> Me an well written, that's a joke
09:46:07FromDiscord<Phil> In reply to @Asbjørn F "<@180601887916163073> So the workflow": 4) use nisane if you start doing remotely fancy stuff, such as support for views, or making calls that aggregate your data
09:46:13FromDiscord<Phil> (edit) "views, or making calls that aggregate your data" => "views"
09:46:16FromDiscord<Elegantbeef> i only read nisane as inane
09:46:34FromDiscord<Elegantbeef> I prefer using nissan myself
09:46:35FromDiscord<Phil> I forgot that norm also can deal with some level of data aggregation for stuff like simple counts etc.
09:47:03FromDiscord<Asbjørn F> I guess that's fine then. I'm more used to working with strings anyway, since each client needs their own prod and dev db and all that
09:47:08FromDiscord<Phil> Nisane is what you can use to go full barebones on the db, write rawsql, get Rows back and convert them to objects
09:47:14FromDiscord<Asbjørn F> And devs need to be able to create a local copy and yadda yadda
09:47:17FromDiscord<Elegantbeef> The fuck is a string
09:47:26FromDiscord<Elegantbeef> That untyped thingy?!
09:47:27FromDiscord<Asbjørn F> In reply to @Elegantbeef "The fuck is a": pain
09:47:31FromDiscord<Elegantbeef> Ok now i'm really going
09:47:35FromDiscord<Phil> In reply to @Elegantbeef "The fuck is a": It's what people use that can't use enums
09:47:48FromDiscord<Asbjørn F> people use strings as enums?
09:47:51FromDiscord<Phil> As in, technically can't because DB stuff etc.
09:47:53FromDiscord<d4rckh> fixed it
09:48:07FromDiscord<d4rckh> sent a code paste, see https://play.nim-lang.org/#ix=3WyF
09:48:13FromDiscord<d4rckh> (edit) "https://play.nim-lang.org/#ix=3WyF" => "https://play.nim-lang.org/#ix=3WyG"
09:48:41FromDiscord<Phil> In reply to @Asbjørn F "people use strings as": Nah, but often times you can replace magic strings with enums was what I was jabbing it, doesn't really help in the context of DBs though because they just give you strings everywhere
09:48:51FromDiscord<Phil> (edit) "it," => "at,"
09:48:55FromDiscord<Asbjørn F> ah, right
09:49:17FromDiscord<Asbjørn F> if I need enums I usually have an enum table so I get numbers
09:49:57FromDiscord<Phil> If you want connection pooling I can get off my ass and finally add support for anything other than sqlite to tinypool
09:50:35FromDiscord<Phil> That's the reason you'll always know when norm makes a query, because you need to pass it connection objects
09:50:42FromDiscord<Asbjørn F> Well I'm testing on PostgreSQL but I'm not sure which db software will have to be used in prod
09:51:05FromDiscord<Phil> norm supports currently only postgres and sqlite IIRC
09:51:15FromDiscord<Asbjørn F> good enough for me
09:51:31FromDiscord<Asbjørn F> I think we have clients with transact-sql though aka MSSQL
09:51:32FromDiscord<Phil> Which is a limitation caused by an underlying package norm uses IIRC, at least that's the answer I got last time I asked
09:53:13FromDiscord<Phil> In that case nisane is your friend. Nisane is, as stated, not quite an ORM, but a way to convert Row objects to objects of whatever type you want. It's a fair bit more finnicky than norm, but for where I had to use it, it works
09:53:42FromDiscord<Phil> And I don't think it has any limitations as to with which DB it can be used. Enthus1ast would know more about that
09:54:52FromDiscord<Phil> https://github.com/PhilippMDoerner/NimStoryFont/blob/master/src/applications/search/searchRepository.nim↵Here a usage example.↵Nisane's main job is providing the "to" proc at the end of the method basically.
09:55:03FromDiscord<Asbjørn F> thanks
09:55:47FromDiscord<d4rckh> sent a code paste, see https://paste.rs/Us6
09:55:47FromDiscord<d4rckh> ouch
09:56:05FromDiscord<Rika> Why the as nil anyway?
09:56:20FromDiscord<Rika> You don’t need that for qualified function calls
09:56:24FromDiscord<Rika> It’s only for enforcing
09:56:29FromDiscord<Phil> In reply to @Asbjørn F "thanks": Do note how the columns in the sql query are exactly in the order of the fields in the SearchHit type.
09:56:56FromDiscord<Rika> You don’t need to enforce this way either if they’re ambiguous calls, because it’s already technically enforced
09:58:24FromDiscord<Phil> (edit) "type." => "type.↵Nisane basically goes in order through the entries in the row, parses them to the data-type within your object and inserts them, that's it."
09:59:01FromDiscord<d4rckh> oh, okay
09:59:03FromDiscord<Asbjørn F> In reply to @Isofruit "Do note how the": So I don't need to define the SearchHit? It's just like an array?
09:59:55FromDiscord<Phil> sent a code paste, see https://play.nim-lang.org/#ix=3WyI
10:00:02FromDiscord<Asbjørn F> ah I see
10:00:06FromDiscord<Phil> That was for using full-text-search tables on sqlite
10:01:05FromDiscord<Phil> Aaaanyway, likely radio silence from me for the next 4-5h because work. webdev channel is also really useful though ^^
10:01:13FromDiscord<Asbjørn F> ty
10:04:41FromDiscord<d4rckh> sent a code paste, see https://paste.rs/p3V
10:09:37FromDiscord<d4rckh> if i change the path to ./commands it still doesnt return anything
10:09:41FromDiscord<Rika> It’s based on PWD where you run it
10:09:51FromDiscord<d4rckh> i also tried `commands` `.\\commands` and `..\\commands`
10:10:03FromDiscord<d4rckh> but its not returning anything
10:10:31FromDiscord<d4rckh> if i create a file in the root directory of my project and walkDir `commands` it returns everything just fine
10:10:56FromDiscord<Solitude> it runs relative to process pwd not the path of the source file
10:11:11FromDiscord<d4rckh> yeah i tried relative to pwd and to the source file, both didnt work
10:11:13FromDiscord<Rika> Try the name of the folder only
10:11:25FromDiscord<d4rckh> did try
10:12:11FromDiscord<Rika> Where are you running this
10:12:22FromDiscord<d4rckh> in the root directory
10:12:28FromDiscord<d4rckh> one step up from the commands directory
10:12:46FromDiscord<Rika> Can you check again to make sure if you don’t mind
10:13:15FromDiscord<d4rckh> yes
10:13:20FromDiscord<d4rckh> my pwd is `D:\Projects\2022\test`
10:13:34FromDiscord<d4rckh> utils.nim is at `D:\Projects\2022\test\server\utils.nim`
10:13:43FromDiscord<d4rckh> and commands is at `D:\Projects\2022\test\commands`
10:13:51FromDiscord<d4rckh> if i use the absolute path, it works just fine
10:14:15FromDiscord<Rika> How are you running it
10:14:40FromDiscord<d4rckh> from a batch script that just runs `nim c -r --threads:on -d:server .\server\server.nim`
10:15:00FromDiscord<Josef> Is there a nim plugin that shows documentation?
10:15:45FromDiscord<Josef> And what is the meaning of `` in `proc foo(...`?
10:16:07FromDiscord<d4rckh> In reply to @Josef "And what is the": exports the proc
10:16:18FromDiscord<d4rckh> so you can import in another file
10:16:59FromDiscord<Josef> I like how Nim is very elegant. But this is too much 😄
10:17:16FromDiscord<Rika> What do you mean
10:17:27FromDiscord<d4rckh> okay, when i just run the command it works @Rika
10:17:28FromDiscord<d4rckh> so weird
10:17:35FromDiscord<Josef> (edit) "is very" => "aims to be"
10:17:48FromDiscord<Rika> Batch files probably don’t inherit the current working directory
10:17:52FromDiscord<Rika> I don’t know
10:17:55FromDiscord<Rika> That would be strange
10:18:01FromDiscord<Rika> I don’t use windows I wouldn’t know
10:18:07FromDiscord<d4rckh> fair enough haha
10:20:18FromDiscord<d4rckh> i hate this nim extension for vs code
10:21:05FromDiscord<d4rckh> always trolling me with errors, when i actually dont have them
10:21:30FromDiscord<Josef> Where is nimble documentation located?
10:21:48FromDiscord<Rika> What do you mean? Usage documentation?
10:21:48FromDiscord<Solitude> in nimble readme
10:28:53*duuude joined #nim
10:39:09FromDiscord<Josef> `Error: attempt to redefine: '_'`
10:39:22FromDiscord<Josef> You can't discard variables with `_`?
10:39:58FromDiscord<Josef> `DllMain(_: HINSTANCE, reason: DWORD, _: LPVOID)`
10:41:57FromDiscord<Josef> (edit) "`DllMain(_:" => "`proc DllMain(_:"
10:44:03FromDiscord<d4rckh> In reply to @Elegantbeef "Infact i already have": i dont get how you are making that commandTable 🤔
10:45:45FromDiscord<Yardanico> In reply to @Josef "You can't discard variables": not really, _ is just a special-cased allowed identifier
10:45:48FromDiscord<Yardanico> but in your proc you have multiple of it
10:46:25FromDiscord<Josef> Well, that's hilarious.
10:47:02FromDiscord<Yardanico> it's not advertised for discarding unused variables though
10:47:18FromDiscord<Yardanico> it's only mentioned in the manual for tuple unpacking
10:47:58FromDiscord<Josef> I can't imagine a situation where you would want to use a variable named `_`.
10:48:12FromDiscord<Josef> Unless you enjoy APL.
10:49:12FromDiscord<Yardanico> https://media.discordapp.net/attachments/371759389889003532/969550913809305640/unknown.png
10:49:40FromDiscord<Josef> Yea, except you don't ignore them, if the `_` is variable name,
10:49:45FromDiscord<Josef> And not a special cosntruct.
10:50:02FromDiscord<Josef> It would still allow you to use it down the line.
10:50:54FromDiscord<Yardanico> In reply to @Josef "It would still allow": nope
10:51:17FromDiscord<Josef> Well, then it's not an identifier.
10:51:54FromDiscord<Yardanico> it is a "special" identifier :)
10:52:45FromDiscord<SirElephant> how do i use the colors lib?
10:52:48FromDiscord<Josef> Hm, then I don't see why you can't use it multiple times.
10:53:00FromDiscord<Solitude> In reply to @Josef "Hm, then I don't": its a bug
10:53:43FromDiscord<Solitude> and it only affect proc signature, i think
10:54:54FromDiscord<SirElephant> is it used to output colored strings?
10:55:15FromDiscord<d4rckh> i just use the terminal library
10:55:46FromDiscord<SirElephant> In reply to @d4rckh "i just use the": is that in the std lib?
10:55:54FromDiscord<d4rckh> yes
10:56:16FromDiscord<d4rckh> https://nim-lang.org/docs/terminal.html
10:59:35PMunch@SirElephant, I wrote termcolours in order to have easier colours for the terminal (Linux only, or rather ANSI escape-code compatible shells only)
11:00:13PMunchBut if by colours lib you mean something like chroma you just install it with nimble and then import it like a normal module
11:06:26nrds<Prestige99> how do I pass a pointer to an object to a function? myObject.addr?
11:06:34FromDiscord<Yardanico> yes
11:06:35FromDiscord<Josef> How do you get `pid` of `Process`?
11:07:53PMunch@Josef, https://nim-lang.org/docs/osproc.html#processID%2CProcess
11:08:42FromDiscord<Josef> I hit `CTRL+F` for `pid` instead of `id` 🤦
11:19:07PMunch@Josef, yeah the documentation for that procedure should probably mention the word PID so it's easier to search for. PR welcome
11:58:33FromDiscord<Knedlik> Hey guys, can I somehow use something from `fileA` in `fileB` while using something from `fileB` in `fileA` without it throwing a recursive dependency?
11:59:52FromDiscord<Yardanico> yes, but only in limited cases
12:00:17FromDiscord<Yardanico> see e.g. https://github.com/Yardanico/nimeventer/blob/master/src/nimeventer.nim#L83 and https://github.com/Yardanico/nimeventer/blob/master/src/nimeventer/packages.nim
12:00:25FromDiscord<Yardanico> nimeventer imports sub-packages that import the main package
12:00:47FromDiscord<Yardanico> the thing that matters is that you have to place all symbols that other modules will use from the main module _before_ importing them in the main file
12:01:15FromDiscord<Yardanico> that's why i'm importing subpackages on line 83 after defining some helper procs/templates that I use inside sub-packages
12:02:16FromDiscord<Yardanico> if you can't make your project adhere to this, then an easier way would be to make a third module and let both modules import it instead
12:02:21FromDiscord<Yardanico> that's how it's usually solved in nim projects
12:02:32FromDiscord<Knedlik> Okay, so basically exported things first and then the import?
12:02:41FromDiscord<Yardanico> yeah kind of
12:02:52FromDiscord<Yardanico> but I haven't tested this approach for bigger projects, so I don't know how it'll work
12:03:01FromDiscord<Yardanico> actually I've only used recursive imports in nimeventer out of all my stuff
12:03:10FromDiscord<Yardanico> (edit) "recursive" => "cyclic"
12:03:12FromDiscord<Knedlik> It's only for one thing really
12:11:17FromDiscord<Zoom> Hey, how is the table literal `{"foo": 1, "bar": 2}` called properly?
12:12:06FromDiscord<Solitude> called?
12:12:07FromDiscord<Yardanico> In reply to @Zoom "Hey, how is the": table constructor
12:12:17FromDiscord<Yardanico> but it doesn't exist, it's just sugar for an array of tuple pairs
12:12:18FromDiscord<Yardanico> https://nim-lang.org/docs/manual.html#statements-and-expressions-table-constructor
12:12:43FromDiscord<Zoom> Yep, I was surprised when I found out it's actually an array
12:13:06FromDiscord<Zoom> So why didn't I made a conclusion it actually doesn't exist then \:P
12:14:14FromDiscord<Rika> Because it’s not expected by the average programmer
12:15:02FromDiscord<Zoom> That was inconsiderate of you, but I'll take it! \:D↵(@Rika)
12:15:22FromDiscord<Rika> You know that’s not what I mean by average
12:15:50FromDiscord<Zoom> We're all are special snowflakes here! 💕
12:16:16FromDiscord<Knedlik> We are all are
12:28:44FromDiscord<Knedlik> sent a code paste, see https://play.nim-lang.org/#ix=3Wzj
12:29:20FromDiscord<FireLite> Hi! I was told that this language is good for writing internal cheats and doing memory operations overall. What library is good for this? (Finding signatures in process and managing them)
12:30:00FromDiscord<Yardanico> In reply to @Knedlik "Ummmm guys what does": you passed `Graphic` but the proc expects `ref Graphic`
12:30:12FromDiscord<Yardanico> oh, ref Graphic:ObjectType, hm
12:30:17FromDiscord<Yardanico> can you show the code and type definition?
12:30:23PMunch@FireLite, welcome! I'm not sure if anyone has written a Nim-specific library for that, but Nim can use C libraries
12:31:04FromDiscord<Knedlik> sent a code paste, see https://paste.rs/wBk
12:31:12FromDiscord<Yardanico> there's https://github.com/qb-0/PyMeow which also has a python binding, but you can probably easily use it from nim
12:31:37FromDiscord<Yardanico> sent a code paste, see https://paste.rs/xuT
12:31:44FromDiscord<Knedlik> the graphic file is here https://github.com/Periapsis-Studios/Periapsis-Engine/blob/main/src/private/imageGraphic.nim
12:31:55FromDiscord<Knedlik> entity is here https://github.com/Periapsis-Studios/Periapsis-Engine/blob/main/src/private/entity.nim
12:32:40FromDiscord<Yardanico> hmmm, and can you paste the full error message then?
12:33:01FromDiscord<Yardanico> not just these lines, but the whole error message, as it usually has useful context
12:33:58PMunch@FireLite, there might be something useful here though: https://github.com/byt3bl33d3r/OffensiveNim/
12:34:16FromDiscord<FireLite> In reply to @PMunch "<@600281115676114964>, there might be": Thanks
12:34:21FromDiscord<Knedlik> sent a code paste, see https://play.nim-lang.org/#ix=3Wzl
12:34:57FromDiscord<Knedlik> The only thing I ommited is the rest of the path, to make the message shorter
12:35:21FromDiscord<Yardanico> and where is logoEntity?
12:35:28FromDiscord<Yardanico> i can't find it in your repo
12:35:38FromDiscord<Knedlik> Because it's not in a repo rn
12:35:46FromDiscord<Knedlik> It's not a part of the engine
12:35:54FromDiscord<Yardanico> just paste it here with ``
12:35:56FromDiscord<Yardanico> triple quotes
12:36:00FromDiscord<Yardanico> or a gist/playground
12:36:03FromDiscord<Knedlik> sent a code paste, see https://paste.rs/Ohw
12:37:42FromDiscord<Yardanico> sorry, still can't figure it out :( quite a weird error indeed
12:37:55FromDiscord<Yardanico> if the code isn't private you can push it to some branch
12:38:39FromDiscord<Knedlik> In reply to @Yardanico "if the code isn't": Made a push here https://github.com/Periapsis-Studios/Beyond-the-Sphere/tree/nim
12:41:33FromDiscord<Yardanico> ok ill try to figure it out
12:41:42FromDiscord<Knedlik> Thank you
12:45:25FromDiscord<Yardanico> @Knedlik why are you using `include`?
12:45:29FromDiscord<Yardanico> this is why your error happens
12:45:42FromDiscord<Yardanico> when you `include` stuff, the code from the files literally gets pasted into the file where you have `include`
12:45:53FromDiscord<Yardanico> you should instead use `import` + `export` in periapsisEngine.nim
12:46:43FromDiscord<Yardanico> sent a code paste, see https://paste.rs/Jmu
12:47:01FromDiscord<Knedlik> hmmmm
12:47:10FromDiscord<Knedlik> I'll try, thanks
12:47:18FromDiscord<Yardanico> by using `include` you made it so that there are two different `Graphic` types defined
12:47:27FromDiscord<Yardanico> and even if they're the same name, they're different types in the end
12:52:43FromDiscord<Phil> Alright, back from work, now to figure out why base 64 conversion is figuratively Satan
12:57:30FromDiscord<Knedlik> Wouldn't base 64 be hexadecimal, just with 6 binary places in the conversion?
12:58:04FromDiscord<Knedlik> I never looked into it tbh, and I'm not sure if you mean to binary or to deci
13:02:12PMunchHexadecimal is base 16, so base 64 is two bits extra, ie. 6 bits
13:02:28PMunchThere is also a bit of logic to do the padding at the end
13:02:58PMunchSince it doesn't always line up with a byte
13:06:27PMunchOr rather with three bytes
13:07:23PMunchThe way it's designed it requires blocks of four characters, which means 3 bytes. If you only want to encoding 1 byte it's still a four character message.
13:16:46FromDiscord<ajusa> Are there any proto libraries that support maps?
13:17:09FromDiscord<Yardanico> did more stuff with mimalloc - one sad thing is that it seems like it's much slower than default nim's allocator when compiling with mingw
13:17:14FromDiscord<Yardanico> with msvc it seems as fast or even faster
13:18:17FromDiscord<Yardanico> and it's faster than orc + threads by 2x as usual, the same as on Linux for that same benchmark
13:18:23*slowButPresent joined #nim
13:18:58PMunch@ajusa, you can use this workaround: https://developers.google.com/protocol-buffers/docs/proto3#backwards_compatibility
13:19:43FromDiscord<ajusa> I'm working with an existing proto definition, I guess I can make a copy and modify it though
13:20:35PMunchYeah it's a bit unfortunate, PRs welcome for my protobuf library :) It should just be a matter of making the parser see that syntax as that kind of message IIRC
13:20:53FromDiscord<Phil> sent a code paste, see https://paste.rs/zLF
13:21:18PMunch@ajusa, this might actually work: https://github.com/oskaritimperi/nimpb
13:21:28FromDiscord<Phil> (edit) "https://play.nim-lang.org/#ix=3WzE" => "https://play.nim-lang.org/#ix=3WzD"
13:21:29FromDiscord<Yardanico> In reply to @Isofruit "I.... I don't understand.": because it escapes " ?
13:21:38FromDiscord<Phil> (edit) "https://play.nim-lang.org/#ix=3WzD" => "https://play.nim-lang.org/#ix=3WzF"
13:21:42FromDiscord<Yardanico> this is quite normal
13:22:00FromDiscord<Phil> Nono, not the "
13:22:09FromDiscord<Phil> I don't care about that one, that goes away with parsing the JSON
13:22:09FromDiscord<Yardanico> the unicode - it's the same
13:22:11FromDiscord<Yardanico> in JSON \
13:22:12FromDiscord<Phil> Look at "Jozai"
13:22:12FromDiscord<Yardanico> \
13:22:15FromDiscord<Yardanico> yes that's normal
13:22:25FromDiscord<Yardanico> \u008 is how unicode is encoded in JSON
13:22:29FromDiscord<Yardanico> d
13:22:42FromDiscord<Yardanico> I'm still not sure what is the problem you're having with this
13:22:44FromDiscord<Phil> But why does this not go away when parsing the string?↵I don't have that issue when parsing the JWT token from my django backend
13:23:09FromDiscord<Yardanico> In reply to @Isofruit "But why does this": it does go away when parsing the string, but if you output parsed _json_ itself again, it encodes it in that form
13:23:10FromDiscord<Yardanico> again
13:23:21FromDiscord<Yardanico> try printing a specific field instead of the whole json
13:23:42FromDiscord<Phil> That's my browser output of the parsed JSON there https://media.discordapp.net/attachments/371759389889003532/969589797964357652/unknown.png
13:24:30FromDiscord<Yardanico> is this a surrogate by any chance
13:24:32FromDiscord<Yardanico> hmm
13:24:53FromDiscord<Phil> For reference how a similar token from my Django backend gets parsed
13:24:55FromDiscord<Phil> https://media.discordapp.net/attachments/371759389889003532/969590104429588531/unknown.png
13:25:33FromDiscord<Knedlik> I love that I have to convert this to ASCII https://vladar4.github.io/sdl2_nim/private/keycode.html#Keymod
13:25:47FromDiscord<Knedlik> Any idea how not to do a case for everything?
13:25:50FromDiscord<Phil> That's what I'm getting so confused by, one treats my unicode as I anticipated, the other doesn't
13:25:58*arkurious joined #nim
13:26:12*duuude quit (Ping timeout: 240 seconds)
13:26:47FromDiscord<Phil> And the issue is not the conversion into base64 itself, because if it were then reverting it via base64.decode wouldn't deliver a flawless result
13:27:27*rockcavera joined #nim
13:27:27*rockcavera quit (Changing host)
13:27:27*rockcavera joined #nim
13:27:41PMunchNot quite sure what you mean @Knedlik
13:28:39FromDiscord<Knedlik> Or this, I have an enum from SDL with scancodes, and I want to know if it's possible to convert it to ASCII without doing Case-Of for everything in the enum https://vladar4.github.io/sdl2_nim/private/scancode.html
13:29:06PMunchWhat do you mean by "Convert it to ASCII"
13:29:15FromDiscord<Yardanico> just check where the letter starts and subtract/add it to get the ascii code
13:29:16FromDiscord<Yardanico> simple
13:29:32PMunchThat works for the letters
13:29:39FromDiscord<Knedlik> What?
13:29:41PMunchBut not for the numbers or the rest of it
13:29:57FromDiscord<Yardanico> In reply to @Knedlik "What?": e.g. SCANCODE_A starts at 4, so to get the ascii code of lowercase a you just add 6
13:30:02FromDiscord<Knedlik> Yeah, if we take the scancodes, it's USB format
13:30:23FromDiscord<Yardanico> ah wait not 6 lol
13:30:43FromDiscord<Knedlik> lowercase a is 61
13:30:45FromDiscord<Yardanico> yes
13:31:01FromDiscord<Yardanico> the same for numbers and other things
13:31:01FromDiscord<Yardanico> sent a code paste, see https://play.nim-lang.org/#ix=3WzH
13:31:07FromDiscord<Yardanico> just check the offset between your scancode enum and the ascii table
13:31:40FromDiscord<Knedlik> Except it's the wrong order for ACII
13:31:46FromDiscord<Knedlik> (edit) "ACII" => "ASCII"
13:31:53FromDiscord<Yardanico> no?
13:31:58FromDiscord<Yardanico> it goes from a to z
13:31:59PMunchWouldn't scancodeToKeycode work?
13:32:07FromDiscord<Yardanico> that too :P
13:32:16PMunchI think they meant lowercase before uppercase
13:32:19FromDiscord<Knedlik> Yes, a to z, but what about other chars?
13:32:33FromDiscord<Yardanico> In reply to @Knedlik "Yes, a to z,": you handle them differently of course?
13:32:41FromDiscord<Yardanico> i showed you one branch in a case statement, you add numbers and other stuff
13:32:48FromDiscord<Yardanico> also @Knedlik do you want to use this for actual text input?
13:32:52FromDiscord<Knedlik> No
13:32:53PMunch@Knedlik, `scancodeToKeycode(myscancode).char`, try that
13:34:14FromDiscord<Knedlik> Wait, is Keycode ASCII?
13:34:54FromDiscord<Knedlik> My god I think it is
13:35:34FromDiscord<d4rckh> how can i return stuff from an async function?
13:35:57FromDiscord<Yardanico> In reply to @d4rckh "how can i return": not sure what you mean, `return` just works
13:36:05FromDiscord<Yardanico> asyncmacro takes care of it
13:36:06PMunchWhat else would it be? It's the code of the key you pressed, so if you press the A button then a is your keycode.
13:36:19FromDiscord<Phil> I feel like nim and json parse the b64 string differently
13:36:25FromDiscord<Yardanico> In reply to @Isofruit "I feel like nim": doubt it
13:36:30FromDiscord<d4rckh> In reply to @Yardanico "not sure what you": nothing like resolve from javascript?
13:36:33PMunch@d4rckh, but your return type needs to be `Future[<actual return type>]`
13:36:35FromDiscord<Yardanico> In reply to @d4rckh "nothing like resolve from": what does this do?
13:36:48FromDiscord<Yardanico> my guess is that it gets converted into a utf-16 surrogate or something like that
13:36:55FromDiscord<Phil> (edit) "json" => "js"
13:37:11FromDiscord<d4rckh> In reply to @PMunch "<@648552095531663361>, but your return": oh, okay, thanks
13:37:14FromDiscord<Phil> sent a code paste, see https://paste.rs/6Zo
13:37:15PMunch@Phil, that sounds highly unlikely
13:37:34FromDiscord<Phil> Wups, forgot the output one sec
13:37:44FromDiscord<Yardanico> but the result is the same
13:38:01FromDiscord<Phil> Only kinda, I want the damn unicode interpreted correctly
13:38:04FromDiscord<Phil> (edit) "https://play.nim-lang.org/#ix=3WzL" => "https://play.nim-lang.org/#ix=3WzK"
13:38:18FromDiscord<Yardanico> but _it is_ correct
13:38:28FromDiscord<Yardanico> ok, let me show you
13:38:31FromDiscord<Yardanico> `Å\u008` - two unicode letters
13:38:39PMunch@Phil, not sure if I get the issue? http://ix.io/3WzM/
13:38:48FromDiscord<Yardanico> Å is U+00C5 and \u008d is U+008D
13:38:56FromDiscord<Yardanico> check ō - it's 0xC5 0x8D
13:39:14FromDiscord<Yardanico> it's two bytes, yes
13:39:29FromDiscord<aph> reminds me of scary utf16 things, not sure if related
13:39:37FromDiscord<Yardanico> your browser just can't handle two-byte unicode symbols in that console for some reason
13:40:08PMunch@Phil, if you add `.repr` you get this: `0x7f2fcae13060"{\"campaign_memberships\":{\"Aldrune\":\"member\",\"J\197\141zai Corp\":\"admin\",\"id_1\":\"member\",\"id_2\":\"admin\"}}"` which is very similar to the browser output
13:40:24PMunchBut it uses a different escape format from the browser
13:40:43FromDiscord<Yardanico> In reply to @Isofruit "": can you paste base64 of that django token?
13:41:02FromDiscord<Phil> > "eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJ0b2tlbl90eXBlIjoiYWNjZXNzIiwiZXhwIjoxNjUxMTg0OTQzLCJqdGkiOiIwN2YwMDgxMjFjMzQ0ZTFkYTJlODVlZWI4ZmJiMjYzYyIsInVzZXJfaWQiOjEwLCJ1c2VyX25hbWUiOiJDYWl0cmlvbmEiLCJpc0FkbWluIjpmYWxzZSwiaXNTdXBlclVzZXIiOmZhbHNlLCJjYW1wYWlnbl9tZW1iZXJzaGlwcyI6eyJhbGRydW5lIjoibWVtYmVyIiwialx1MDE0ZHphaSBjb3JwIjoiYWRtaW4ifX0.qDUopyykgnTA2jae6Ixw5uPAbhu_uWlbKHeu45pghzY"↵Full token for one user
13:42:00FromDiscord<Yardanico> j\u014d
13:42:14FromDiscord<Rika> In reply to @Yardanico "with msvc it seems": “Duh, Microsoft made it after all” lol
13:42:16FromDiscord<Yardanico> so in this case it's a utf-16 character
13:42:25FromDiscord<Yardanico> In reply to @Rika "“Duh, Microsoft made it": it's also fast on linux
13:42:30FromDiscord<Rika> I was joking ;;
13:42:32FromDiscord<Phil> So the encoding is different
13:42:52FromDiscord<Rika> In reply to @Yardanico "it's also fast on": Could be a coincidence xd
13:43:00PMunch@Phil: http://ix.io/3WzN/
13:43:10FromDiscord<Rika> Or rather doesn’t Microsoft like Linux now too xdd
13:43:17PMunchIt seems the token is split into parts with .'s (those aren't valid base64)
13:43:28FromDiscord<Yardanico> yeah, but the main part about the unicode thing is still there
13:43:57FromDiscord<Phil> This just makes me want to forbid non ascii everywhere dear lord
13:44:10PMunchYardanico, which unicode part?
13:44:18FromDiscord<Yardanico> In reply to @PMunch "<@177365113899057152>, which unicode part?": j\\u014dzai corp
13:44:31PMunchOh right
13:44:43FromDiscord<Yardanico> from django it's encoded as \u014d so it's UTF-16, with Nim it's encoded as UTF-8 with two bytes 0xC5 0x8D
13:44:49FromDiscord<Yardanico> https://www.compart.com/en/unicode/U+014D
13:45:14FromDiscord<Rika> Why is it defaulting to UTF-16 though
13:45:18FromDiscord<2F42BBA1> sent a code paste, see https://paste.rs/6Ju
13:45:39FromDiscord<Yardanico> In reply to @2F42BBA1 "How this python code": naked except is a really bad practice, but whatever:
13:45:42PMunchBetter? http://ix.io/3WzN/
13:45:51PMunchYou just need to parse JSON as JSON
13:46:04FromDiscord<Yardanico> sent a code paste, see https://paste.rs/u3t
13:46:05PMunch@Rika, because Windows
13:46:40FromDiscord<Rika> It should only matter when interfacing with windows no
13:46:46FromDiscord<2F42BBA1> sent a code paste, see https://paste.rs/yFc
13:46:46FromDiscord<Yardanico> In reply to @Rika "It should only matter": no
13:46:54PMunchMicrosoft in their infinite wisdom converted everything they had to UTF-16 to support all languages. Then UTF-8 came along and everyone agreed an that instead, with Microsoft having bet on the wrong horse
13:47:48FromDiscord<Phil> I'll start googling for some sort of way for JS to convert unicode chars
13:47:58PMunch@Phil, did you see my codepaste?
13:48:07PMunchWhich does exactly that?
13:48:21FromDiscord<Yardanico> @PMunch it's not exactly readable ;)
13:48:28FromDiscord<Yardanico> newlines got eaten by something
13:48:40PMunchOh, remove the trailing slash in the URL
13:48:45FromDiscord<Yardanico> ah right
13:49:00PMunchIt's just ix trying to pass it through some Python library and failing miserably
13:49:40PMunchWait, it didn't update
13:49:42FromDiscord<Phil> Oh that looks SO Much more readable, I've been scanning through that for a solid 5 minutes now
13:50:15FromDiscord<Rika> Lol
13:50:15PMunchhttp://ix.io/3WzP
13:50:27PMunchThere, that's the improved version which actually parses the JSON
13:50:35PMunch@Phil, oh sorry about that :P
13:50:53PMunchI'm seriously considering writing my own paste service..
13:50:54FromDiscord<Yardanico> In reply to @PMunch "<@873685814071132200>, that's the improved": poor soul who named themselves "there"
13:50:59FromDiscord<Phil> Yeh, now I just need to also get that to work in my frontend and not show up with its unicode-placeholders
13:51:00FromDiscord<Yardanico> (on discord)
13:51:04PMunchJust for myself, ix has been a bit unreliable
13:51:41PMunch@Phil, why can't you just use that on the frontend?
13:52:04FromDiscord<Phil> Angular frontend
13:52:07FromDiscord<Phil> Not karax
13:52:13PMunchYardanico, haha that's indeed a poor choice of username
13:52:45FromDiscord<Phil> And with browser JS I still get... wait
13:52:59PMunch@Phil, well that sucks. I guess you could parse the tokens on the server, then redo them as UTF-8 before you pass them along
13:53:48PMunchOh well, I'm off
13:53:54*PMunch quit (Quit: Leaving)
14:05:28FromDiscord<Phil> `decodeURIComponent(escape(x))` to the rescue
14:07:05FromDiscord<2F42BBA1> sent a code paste, see https://play.nim-lang.org/#ix=3WzR
14:07:18FromDiscord<2F42BBA1> it seems it expect a type?
14:07:23FromDiscord<Yardanico> change the name
14:07:32FromDiscord<Yardanico> your proc name conflicts with the `clip` from cliptomania
14:07:47FromDiscord<Yardanico> to be fair, cliptomania should've named the type `Clip` instead of just `clip`
14:07:54FromDiscord<Yardanico> but it is what it is, so rename your proc to something else
14:14:13FromDiscord<2F42BBA1> In reply to @Yardanico "but it is what": YES I DID IT
14:14:19FromDiscord<Yardanico> okay
14:14:19FromDiscord<2F42BBA1> FINALLY IT COMPILES!
14:14:34FromDiscord<2F42BBA1> second nim thing is done 🚎
14:23:50FromDiscord<exelotl> is there a safe way to navigate XML trees?
14:24:12FromDiscord<exelotl> I wanna do like `let author = entry.child("author").child("name")[0].text`
14:24:40FromDiscord<exelotl> but if anything along the way is nil it segfaults
14:31:29FromDiscord<Solitude> In reply to @exelotl "is there a safe": there is a wrapnils module written by timo
14:31:35FromDiscord<Solitude> but its written by timo
14:31:41FromDiscord<Knedlik> sent a code paste, see https://paste.rs/jpp
14:32:04FromDiscord<Solitude> In reply to @Knedlik "Hey guys, another problem": thats crazy
14:32:12FromDiscord<Knedlik> What's crazy?
14:32:27FromDiscord<Solitude> what you're telling us
14:32:30FromDiscord<Solitude> bonkers
14:32:41FromDiscord<Yardanico> In reply to @Knedlik "Hey guys, another problem": because you use `ref`s everywhere and you didn't initialize `pos` for your `logoEntity`
14:32:44FromDiscord<Knedlik> I mean when running output
14:33:01FromDiscord<Knedlik> what?
14:33:07FromDiscord<Yardanico> In reply to @Knedlik "what?": your Vector2 is a ref
14:33:11FromDiscord<Yardanico> you have to initialize it as well
14:33:19FromDiscord<Yardanico> but I have absolutely no clue why would you ever want Vector2 to be a ref
14:33:42FromDiscord<Knedlik> Pretty sure it is initialized in the engine
14:33:56FromDiscord<Yardanico> In reply to @Knedlik "Pretty sure it *is*": ??? how
14:33:57FromDiscord<Knedlik> But... text isn't init
14:34:03FromDiscord<Yardanico> this is how you create it https://media.discordapp.net/attachments/371759389889003532/969607497306480640/unknown.png
14:34:05FromDiscord<Knedlik> Could that be the problem?
14:34:12FromDiscord<Yardanico> you don't initialize pos here
14:34:25FromDiscord<Knedlik> oh wait I get it
14:34:35FromDiscord<Yardanico> but seriously, please make Vector2 a proper value type
14:34:44FromDiscord<Yardanico> this is not java, you don't need pointer indirections everywhere
14:35:30FromDiscord<Yardanico> sent a code paste, see https://paste.rs/DPl
14:38:44FromDiscord<Ruby fan.rb> In reply to @Yardanico "this is not java,": java has pointerS?
14:38:56FromDiscord<Yardanico> In reply to @Ruby fan.rb "java has pointerS?": references are pointers internally
14:39:01FromDiscord<Ruby fan.rb> well
14:39:03FromDiscord<Yardanico> so yes, it's still a "pointer indirection"
14:39:09FromDiscord<Ruby fan.rb> this is an interesting advancement
14:39:14FromDiscord<Yardanico> meaning that you have to dereference a pointer to get its value
14:39:37*duuude joined #nim
14:42:58FromDiscord<d4rckh> how do i check if an element exists at an index in a sequence?\
14:43:23FromDiscord<Solitude> you check if index is less than sequence length?
14:43:25FromDiscord<Solitude> what?
14:43:31FromDiscord<d4rckh> good idea, thanks
14:46:03FromDiscord<Ruby fan.rb> sent a code paste, see https://play.nim-lang.org/#ix=3WA0
14:46:29FromDiscord<d4rckh> thanks
14:46:48FromDiscord<spoon> wouldn't it be arrayIndex - 1?
14:48:41FromDiscord<Knedlik> I don't think I understand the difference between `ref object` and `object`
14:50:19FromDiscord<d4rckh> its just arrayIndex
14:50:25FromDiscord<Yardanico> In reply to @Knedlik "I don't think I": see e.g. https://forum.nim-lang.org/t/1207, in short - `ref object` is a heap-allocated object, it is a reference to an object and you must first allocate it (via `new` or object construction). On each access to `ref object` your code will get the value from the reference
14:50:48FromDiscord<Yardanico> `object` is a plain object, you don't need to allocate it as it's allocated on the stack, and passed in procs around by copy unless it's too big (but that's just an internal detail)
14:51:11FromDiscord<Knedlik> And why do I get can't assign to `object.field`?
14:51:11FromDiscord<Yardanico> `ref object` ideally should only be used for shared ownership, in all other cases you don't need it
14:51:20FromDiscord<Yardanico> In reply to @Knedlik "And why do I": maybe show an error?
14:51:28NimEventerNew thread by Foderking: Intersection types in nim?, see https://forum.nim-lang.org/t/9131
14:51:30FromDiscord<Knedlik> one moment
14:52:30FromDiscord<Knedlik> sent a code paste, see https://play.nim-lang.org/#ix=3WA1
14:52:51FromDiscord<Yardanico> first of all, `object`'s don't need `method`
14:53:00FromDiscord<Yardanico> `method` is only needed if you need dynamic dispatch (so inheritance)
14:53:18FromDiscord<Yardanico> and the error is because for normal objects you have to explicitly mention in the arguments list that you want to modify the original object
14:53:24FromDiscord<Yardanico> so `graphic: var Graphic` instead of just `graphic: Graphic`
14:53:36FromDiscord<Knedlik> Ooooh
14:53:45FromDiscord<Knedlik> makes sense, thx
14:54:39*duuude quit (Remote host closed the connection)
14:55:59*rockcavera quit (Read error: Connection reset by peer)
14:56:50*rockcavera joined #nim
14:56:51*rockcavera quit (Changing host)
14:56:51*rockcavera joined #nim
14:57:18*duuude joined #nim
14:57:18*lumo_e joined #nim
14:57:46FromDiscord<d4rckh> how could i view the output a command im running via e.g. execCmdEx in real time?
14:58:08FromDiscord<Yardanico> In reply to @d4rckh "how could i view": poParentStreams
14:58:32FromDiscord<Yardanico> `discard execCmdEx("cmd", {poStdErrToStdOut, poUsePath, poParentStreams})`
14:58:48FromDiscord<Yardanico> the first two options are provided by default, but when you need to add a custom one, you have to provide all of them explicitly
14:59:57FromDiscord<sour> hi, is everything ok with the default 64bit windows zip download of nim? firefox says it has a virus, and bitdefender said the same thing
15:00:11FromDiscord<Solitude> yes, windows is shit
15:00:16FromDiscord<sour> (edit) "hi, is everything ok with the default 64bit windows zip download of nim? firefox says it has a virus, and bitdefender said the same thing ... " added "(after i unzipped the file)"
15:00:21FromDiscord<Yardanico> In reply to @sour "hi, is everything ok": that's a known issue, some people have taken a liking to writing malware in nim, so lazy AV vendors do bad signatures
15:00:25FromDiscord<Yardanico> and detect innocent Nim code as dangerous
15:00:36FromDiscord<Yardanico> see https://github.com/nim-lang/Nim/issues/17820 for the main discussion
15:00:47FromDiscord<sour> oh damn that's shitty pr
15:00:50FromDiscord<d4rckh> btw i have another problem with execCmdEx, i am just compiling a nim program with it, but it just hangs in my async function
15:01:06FromDiscord<Yardanico> In reply to @d4rckh "btw i have another": execCmdEx blocks the whole thread, so other async stuff can't run while it's running
15:01:16FromDiscord<d4rckh> yeah but its never finishing
15:01:21FromDiscord<Yardanico> hm
15:01:28FromDiscord<d4rckh> and i want to debug this a bit, thats why trying to view the output of the command
15:01:34FromDiscord<d4rckh> (edit) "and i want to debug this a bit, thats why ... trying" added "im"
15:01:38FromDiscord<d4rckh> (edit) "and i want to debug this a bit, thats why im trying to view the output of the command ... " added "in real time"
15:04:03FromDiscord<spoon> love virustotaling nim programs i compiled myself
15:04:29FromDiscord<Knedlik> Pretty sure 1.7.1 doesn't have this issue
15:04:30FromDiscord<spoon> norton doesn't seem to mind anymore but virustotal says malwarebytes thinks its a trojan
15:04:47FromDiscord<Knedlik> Atleast not with Avast
15:04:54FromDiscord<spoon> the polymorph example project is
15:05:06FromDiscord<Yardanico> In reply to @Knedlik "Atleast not with Avast": it's not about nim version
15:05:14FromDiscord<Yardanico> it's about a specific combination of version + compiler
15:06:31FromDiscord<spoon> what malware decided to use nim anyway?
15:07:25FromDiscord<Yardanico> In reply to @spoon "what malware decided to": you can find some news articles from 2020-2021
15:07:53FromDiscord<Solitude> In reply to @spoon "what malware decided to": its infamous door-o-bot malware
15:08:02FromDiscord<Solitude> dont look it up
15:08:03FromDiscord<Yardanico> https://medium.com/walmartglobaltech/investigation-into-the-state-of-nim-malware-14cc543af811↵https://www.bleepingcomputer.com/news/security/trickbots-bazarbackdoor-malware-is-now-coded-in-nim-to-evade-antivirus/↵etc
15:08:46FromDiscord<spoon> why are they detecting all nim programs, though? are they reading symbols?
15:08:56FromDiscord<Knedlik> I have one more question with ref objs - should objects inheriting stuff be refs or not?
15:08:58FromDiscord<Yardanico> https://medium.com/walmartglobaltech/investigation-into-the-state-of-nim-malware-part-2-a28bffffa671
15:09:24FromDiscord<Yardanico> In reply to @spoon "why are they detecting": because the people who made the signatures were stupid and probably made it so that default nim programs also get caught
15:09:24FromDiscord<d4rckh> In reply to @Yardanico "hm": do you have any idea why that happens?
15:09:33FromDiscord<Yardanico> In reply to @Knedlik "I have one more": if you need dynamic dispatch, yes, otherwise not
15:09:34FromDiscord<spoon> In reply to @Knedlik "I have one more": ref objects are used for inheritance, yes
15:09:41FromDiscord<Yardanico> In reply to @spoon "ref objects are used": not quite
15:09:44FromDiscord<Yardanico> you don't need ref for inheritance
15:09:58FromDiscord<spoon> hm
15:10:27FromDiscord<Yardanico> sent a code paste, see https://play.nim-lang.org/#ix=3WAg
15:10:39FromDiscord<Yardanico> but again, typically with object inheritance you also want dynamic dispatch, so then you really have to use `ref`
15:12:51FromDiscord<Knedlik> Uhh
15:13:46FromDiscord<Knedlik> I have an object with another object as a field (seq of objects), but it tells me it's immutable when trying to `for` loop it
15:14:00FromDiscord<Yardanico> normal loop calls `items`
15:14:04FromDiscord<Yardanico> for mutable iteration you want `mitems`
15:14:24FromDiscord<Yardanico> sent a code paste, see https://play.nim-lang.org/#ix=3WAj
15:14:32FromDiscord<Knedlik> ahhh
15:14:34FromDiscord<Yardanico> nim is full of sugar, for loops don't actually exist
15:14:40FromDiscord<Knedlik> Why not just make it simple
15:14:45FromDiscord<Yardanico> In reply to @Knedlik "Why not just make": how?
15:14:49FromDiscord<Knedlik> idk
15:14:51FromDiscord<Yardanico> that would prevent optimizations
15:15:02FromDiscord<Yardanico> if you don't want to mutate, then the loop can for example only give you a view
15:15:16FromDiscord<spoon> In reply to @Yardanico "because the people who": yeah, was just wondering if they decided to pick up on these symbols from nim binaries (i don't write AV software but it's the only explanation i can think of) https://media.discordapp.net/attachments/371759389889003532/969617874094264390/unknown.png
15:15:41FromDiscord<Yardanico> In reply to @spoon "yeah, was just wondering": yeah maybe I should spend some time trying to figure that out, but I don't really have the experience with AVs
15:15:57FromDiscord<Yardanico> that said, nimFrame is only there in debug releases
15:16:04FromDiscord<Yardanico> it's for stack traces
15:16:17FromDiscord<spoon> i'll try scanning again with -d:danger
15:16:19FromDiscord<Yardanico> if you compile with a lot of flags then you only have a few nim-specific symbols left
15:16:25FromDiscord<Yardanico> also don't forget to strip away the names from the binray
15:16:28FromDiscord<Yardanico> (edit) "binray" => "binary"
15:16:38FromDiscord<spoon> what flags?
15:17:22FromDiscord<Yardanico> In reply to @spoon "i'll try scanning again": `-d:danger --gc:orc -d:useMalloc --panics:on -d:noSignalHandler`, also maybe `-d:lto` for smaller binary size and better performance
15:17:31FromDiscord<Yardanico> and for linux binaries you can also add `--os:any -d:posix`
15:17:42*rez joined #nim
15:18:14FromDiscord<Yardanico> https://github.com/Yardanico/mimalloc_nim/commit/fb44c9727334fe3cb4e19c568fd0e477c457cc21 man-made horrors beyond comprehension
15:18:18FromDiscord<Yardanico> sent a code paste, see https://paste.rs/Ez6
15:19:21FromDiscord<spoon> malwarebytes still recognizes it as trojan.cobaltstrike
15:19:32FromDiscord<Knedlik> sent a code paste, see https://play.nim-lang.org/#ix=3WAl
15:19:42FromDiscord<Knedlik> (edit) "https://paste.rs/BSr" => "https://play.nim-lang.org/#ix=3WAl"
15:19:48FromDiscord<Yardanico> sent a code paste, see https://paste.rs/xKD
15:19:53FromDiscord<Knedlik> Oh man am I blind af
15:19:56FromDiscord<Yardanico> also, if you still want to keep using inheritance with dynamic dispatch, give up on non-ref objects
15:20:11FromDiscord<Knedlik> this is the root
15:20:14FromDiscord<Yardanico> yes
15:20:28FromDiscord<Knedlik> it only inherits RootObj, do I really need ref?
15:20:44FromDiscord<Yardanico> no, I mean if you need dynamic dispatch
15:20:55FromDiscord<Knedlik> You wouldn't ever even use the root anyway
15:20:56FromDiscord<Yardanico> e.g. have a seq of two objects that inherit from same base and call their methods
15:21:02FromDiscord<Yardanico> then you need ref and methods
15:21:03FromDiscord<Knedlik> You only use children
15:21:20FromDiscord<treeform> In reply to @Isofruit "I think so far": Does it work with quickjwt?
15:21:45FromDiscord<Yardanico> btw @treeform have you tried mimalloc for your programs? to speed them up maybe
15:21:59FromDiscord<Yardanico> although it's only relevant in allocation-heavy code and your libraries are usually already very well optimized :)
15:33:00FromDiscord<Phil> In reply to @treeform "Does it work with": I haven't tried yet, but the source appears to have been that nim encodes in UTF-8 while browsers don't have particularly great UTF-8 support and by default use UTF-16 apparently
15:33:30FromDiscord<Phil> So nothing that quickjwt could've prevented unless it allowed specifying in which encoding it would have the json-string before building the jwt
15:33:52FromDiscord<huantian> Wait browser don’t use UTF8?
15:34:00FromDiscord<huantian> (edit) "browser" => "browsers" | "browsersdon’t use UTF8? ... " added "Didn’t know that"
15:34:01FromDiscord<Yardanico> In reply to @huantian "Wait browsers don’t use": json utf-16
15:34:12FromDiscord<Phil> That's what I got from this question: https://stackoverflow.com/questions/13356493/decode-utf-8-with-javascript
15:34:27FromDiscord<Phil> > I've been asked to add a comment because I downvoted this. But all I can say is that since escape is deprecated, this answer is not acceptable. Why is escape deprecated if it performs an important function? And why is there no native UTF-8 support in JavaScript? And why does no one care (last comment was two years ago).
15:34:35FromDiscord<Phil> From one of the comments there
15:34:59FromDiscord<2F42BBA1> is there a way to keep an app run forever?
15:35:00FromDiscord<Phil> "escape" has been deprecated for 7 years now btw and still is the only way to properly solve my problem
15:35:10FromDiscord<2F42BBA1> when i open it, my thing instantly quits
15:35:21FromDiscord<Rika> In reply to @2F42BBA1 "is there a way": A while loop that never ends?
15:36:57FromDiscord<spoon> In reply to @2F42BBA1 "is there a way": if you're making a terminal app, you can either use stdin to wait for input or just run the app from the terminal to see the output before it instantly closes again, if its gui, just use a while loop that exits when the window should close
15:38:05FromDiscord<SirElephant> how do make a folder using nim?
15:38:17FromDiscord<SirElephant> i am making a clone of `cargo run`
15:38:17FromDiscord<Yardanico> In reply to @SirElephant "how do make": check the `os` module
15:38:25FromDiscord<Yardanico> https://nim-lang.org/docs/os.html
15:38:29FromDiscord<SirElephant> thenks
15:38:58FromDiscord<Rika> In reply to @SirElephant "i am making a": Nimble has a run sub command?
15:39:28FromDiscord<SirElephant> sor?
15:39:31FromDiscord<SirElephant> (edit) "sor?" => "sory?"
15:39:47FromDiscord<SirElephant> i am not mking a cli
15:39:53FromDiscord<Yardanico> 🤔
15:40:07FromDiscord<SirElephant> just run the exe and get the folder and stuff
15:40:33FromDiscord<SirElephant> ik it's dumb
15:47:18*lumo_e quit (Ping timeout: 250 seconds)
15:58:14FromDiscord<Rika> Cargo is CLI though?
15:58:16*vicfred quit (Quit: Leaving)
15:58:25FromDiscord<Rika> I’m confused
16:01:00FromDiscord<spoon> simply rewrite another languages package manager in nim
16:06:36FromDiscord<Knedlik> Hey guys, me again, how do I check if an object var is empty, aka wasn't set yet? `isNil()` doesn't work for me..
16:07:26FromDiscord<huantian> For value type objects, when you initialize it without a value, it uses the default value of each field
16:07:45FromDiscord<huantian> So there is no difference between not setting it and using a default value
16:08:02FromDiscord<huantian> Only ref objects can be nil
16:08:44FromDiscord<Knedlik> sent a code paste, see https://paste.rs/yML
16:09:00FromDiscord<huantian> If you would like a distinct empty value for your object, use `Option` from `std/options`
16:09:05FromDiscord<Knedlik> Like if it was init
16:09:32FromDiscord<aph> `x == default(Object)`? im not too sure if to get the default value of object is `default`
16:09:41FromDiscord<aph> brb lemme go to docs
16:10:35FromDiscord<huantian> That’ll work if you know that you will never set the object
16:10:40FromDiscord<huantian> (edit) "That’ll work if you know that you will never set the object ... " added "to its default value"
16:10:53FromDiscord<aph> true
16:11:24FromDiscord<Knedlik> Is there not a proc to find out if a variable was initialized?
16:12:40FromDiscord<huantian> All variables are initialized
16:12:45FromDiscord<huantian> Automatically
16:13:45FromDiscord<Knedlik> sent a code paste, see https://paste.rs/fhQ
16:14:29FromDiscord<Solitude> y-yeah?..
16:14:53FromDiscord<Knedlik> Ah fu-
16:15:03FromDiscord<Rika> ??
16:15:17FromDiscord<Rika> In reply to @huantian "If you would like": Use this if you need optionals
16:15:49FromDiscord<Knedlik> I guess the code I have doesn't necessarily need to check that, since it doesn't hurt to do it when it wasn't 'set'
16:16:43FromDiscord<d4rckh> @Yardanico i figured out why it was hanging 😂
16:16:54FromDiscord<d4rckh> nim also ran the program
16:17:02FromDiscord<Rika> ????
16:17:06FromDiscord<Yardanico> In reply to @d4rckh "nim also ran the": classic
16:17:15FromDiscord<Rika> Oh you mean on compile?
16:17:19FromDiscord<d4rckh> ye haha
16:17:31FromDiscord<Rika> Man’s left the r argument
16:17:42FromDiscord<d4rckh> yeah exactly
16:17:44FromDiscord<d4rckh> 🤣
16:17:54FromDiscord<d4rckh> omg ive been wasting too much time on this
16:18:22*disso_peach quit (Quit: Leaving)
16:20:31FromDiscord<Rika> In reply to @d4rckh "omg ive been wasting": The life of every single programmer man
16:20:36FromDiscord<Rika> (edit) "programmer" => "programmer,"
16:22:13FromDiscord<2F42BBA1> tbh it sucks ass that most clipboard libraries suck ass
16:22:18FromDiscord<2F42BBA1> including cliptomania one
16:22:33FromDiscord<2F42BBA1> probably soonish gotta use winim i guess
16:23:39FromDiscord<Rika> Clipboard management sucks ass
16:37:27*gsalazar quit (Ping timeout: 276 seconds)
16:37:28*rez quit (Quit: much snoozes...)
16:47:13FromDiscord<treeform> In reply to @Yardanico "btw <@107140179025735680> have you": I have not but I saw your post and excited about where that is going. You know I am all about speed.
16:48:40FromDiscord<treeform> In reply to @Isofruit "I haven't tried yet,": I have an utf encoder here https://github.com/treeform/encode , is this something I should add to quick JS?
16:53:31FromDiscord<2F42BBA1> In reply to @Yardanico "btw <@107140179025735680> have you": i would like to use that seems like a cool thing
17:04:11FromDiscord<Knedlik> Hey guys, is it possible to use C# libs in Nim and the other way ‘round?
17:04:18*PMunch joined #nim
17:04:36FromDiscord<2F42BBA1> In reply to @Knedlik "Hey guys, is it": I know that it's possible C# to load Nim libs
17:04:46FromDiscord<2F42BBA1> But vice versa no probably
17:04:49FromDiscord<ajusa> In reply to @Yardanico "made the repo -": Now I gotta try this out with Jester/Httpbeast
17:05:22FromDiscord<2F42BBA1> In reply to @2F42BBA1 "I know that it's": src: Friend and I had a game on Unity which loaded Nim dll
17:05:45FromDiscord<Knedlik> Yeah, that’s pretty much what I’m looking for
17:06:01FromDiscord<2F42BBA1> In reply to @Knedlik "Yeah, that’s pretty much": https://www.euantorano.co.uk/posts/2016/09/30/nim-with-c-sharp-net/
17:06:06FromDiscord<2F42BBA1> this thing helped us
17:06:10FromDiscord<Knedlik> Thx
17:06:34FromDiscord<2F42BBA1> you are welcome
17:07:16FromDiscord<Knedlik> Hmmm, now I’m thinking if it’s possible to use Nim in Java lol
17:07:25FromDiscord<2F42BBA1> In reply to @Knedlik "Hmmm, now I’m thinking": Nah
17:07:39FromDiscord<2F42BBA1> It's not possible (maybe i am wrong)
17:07:48FromDiscord<2F42BBA1> But I do know it does work with C#
17:08:09euantorano2FA2BBA1: of note, remember to call NimMain()
17:08:35euantoranoWhen I wrote that blog post all those years ago, there was a Nim bug where NimMain wasn’t exported
17:09:09FromDiscord<2F42BBA1> In reply to @euantorano "When I wrote that": Well, this post helped me lel
17:09:13FromDiscord<ajusa> In reply to @Knedlik "Hmmm, now I’m thinking": You can use Java from Nim at least
17:10:00euantoranoAnd I believe it should be possible to do something similar from Java land using JNI. I’ve never experimented with that though
17:12:23duuudecool having a domain being same as the irc handle
17:12:38duuudeeverytime it gets mentioned you get notified
17:12:49euantoranoYep
17:13:35euantoranoYep
17:15:41FromDiscord<Knedlik> In reply to @2F42BBA1 "Nah": Is is, just not really worth it if you want multi-platform stuff
17:15:50FromDiscord<Knedlik> (edit) "Is" => "It"
17:16:27FromDiscord<Knedlik> I think if I really wanted to use my engine in Java, it would be better to just rewrite it
17:19:57FromDiscord<Phil> In reply to @treeform "I have an utf": It might make sense to have the default encoding of the json-string be UTF-16, solely for browser support. Or to have an optional parameter that allows users to specify various utf encodings
17:20:19FromDiscord<Phil> But that's very much a "nice-to-have" feature I think, it's likely that my problem is a pretty edgy edgecase
17:20:27FromDiscord<treeform> you are probably right
17:20:36FromDiscord<treeform> can you give me an example of a token you are trying to do that is breaking
17:20:38FromDiscord<treeform> i'll add that as a test?
17:20:55FromDiscord<Phil> The JSON for it? Sure!
17:21:26FromDiscord<treeform> I would also test what this site does: https://jwt.io/
17:21:40FromDiscord<treeform> if it agrees with you then great, if not, its probably the other end that is broken
17:23:23FromDiscord<treeform> Is this what you get? https://media.discordapp.net/attachments/371759389889003532/969650115340017664/unknown.png
17:28:32FromDiscord<Phil> on jwt.io? Yeah.↵Within a browser? No
17:28:39FromDiscord<Phil> (tested with firefox and brave)
17:30:19*xet7 quit (Remote host closed the connection)
17:31:11FromDiscord<Phil> Within a browser I get one of these: https://media.discordapp.net/attachments/371759389889003532/969652078014234655/unknown.png https://media.discordapp.net/attachments/371759389889003532/969652079004094605/unknown.png
17:32:55FromDiscord<Phil> sent a code paste, see https://play.nim-lang.org/#ix=3WAU
17:33:06FromDiscord<Phil> (edit)
17:33:14FromDiscord<Phil> (edit)
17:34:24FromDiscord<Phil> Anyway, if you want to include the testcase, you've got the string for it now ^^
17:42:56FromDiscord<Yardanico> In reply to @ajusa "Now I gotta try": From my limited testing it is sadly slower for that than default allocator
17:46:37*lumo_e joined #nim
18:02:06*duuude quit (Read error: Connection reset by peer)
18:02:16*duuude joined #nim
18:02:37*Zectbumo joined #nim
18:04:52*Gustavo6046 joined #nim
18:07:46*duuude quit (Remote host closed the connection)
18:13:47FromDiscord<d4rckh> tables? i should use them more in my program
18:14:52*duuude joined #nim
18:18:12*genpaku quit (Ping timeout: 276 seconds)
18:23:13*genpaku joined #nim
18:26:13*pch joined #nim
18:28:51FromDiscord<Knedlik> Guys can a ref object inherit a non-ref object?
18:29:08FromDiscord<leorize> yes
18:29:48FromDiscord<Knedlik> but
18:29:51FromDiscord<Knedlik> sent a code paste, see https://play.nim-lang.org/#ix=3WBa
18:30:03FromDiscord<Knedlik> sent a code paste, see https://play.nim-lang.org/#ix=3WBc
18:30:12FromDiscord<leorize> you have to dereference your object
18:30:30FromDiscord<Knedlik> oh
18:30:33FromDiscord<Knedlik> thx lol
18:32:57FromDiscord<Knedlik> hmmmm
18:33:12FromDiscord<Knedlik> sent a code paste, see https://play.nim-lang.org/#ix=3WBd
18:33:28FromDiscord<Knedlik> this throws `SIGSEGV: Illegal storage access. (Attempt to read from nil?)` on `graphic.w = surface[].w`
18:33:58FromDiscord<Knedlik> like wtf
18:35:47*pch quit (Remote host closed the connection)
18:39:38*pch joined #nim
18:45:52FromDiscord<Knedlik> sent a code paste, see https://play.nim-lang.org/#ix=3WBe
18:46:03FromDiscord<Knedlik> With https://github.com/Periapsis-Studios/Periapsis-Engine
18:46:25FromDiscord<Knedlik> I'm really losing my mind
18:52:52FromDiscord<Alea> What in the sam hell does this mean https://media.discordapp.net/attachments/371759389889003532/969672633991962654/Screenshot_20220429-145228.jpg
19:02:19FromDiscord<TheFallen0ne> sent a code paste, see https://play.nim-lang.org/#ix=3WBh
19:07:07FromDiscord<Solitude> In reply to @TheFallen0ne "hello guys! I am": whats wrong with instantiationInfo?
19:08:26FromDiscord<TheFallen0ne> I need the full path of the actual executable. It returns "Script.nim".
19:09:06FromDiscord<Solitude> you need path of executable or of the nim file?
19:09:11FromDiscord<enthus1ast> os.getAppFilename
19:09:30FromDiscord<enthus1ast> import os↵echo getAppFilename
19:09:52FromDiscord<TheFallen0ne> In reply to @enthus1ast "import os echo getAppFilename": works!!!! Thank you soooo much. : )
19:10:17FromDiscord<TheFallen0ne> In reply to @Solitude "you need path of": the exe. getAppFilename seems to do the trick 😄
19:10:20FromDiscord<Solitude> thats completely different from what you asked initially
19:12:02FromDiscord<TheFallen0ne> Sorry to confuse you i just wanted the equivalent of Assembly.GetEntryAssembly().Location on Nim.↵I just wanted to get the path of the compiled file.↵Now with joinPath(".".absolutePath, getAppFilename()) I seem to have done just that
19:13:15FromDiscord<enthus1ast> better use\:↵↵echo getAppDir() / getAppFilename()
19:16:49FromDiscord<TheFallen0ne> In reply to @enthus1ast "better use\: echo": oh ok thanks 😄
19:17:19*lumo_e quit (Ping timeout: 272 seconds)
19:29:16FromDiscord<kaletaa> my name jefff
19:30:36FromDiscord<spoon> hi jeff
19:30:45FromDiscord<kaletaa> are you spoonm from the telegram
19:30:51FromDiscord<ynfle> ?
19:30:54FromDiscord<ynfle> sent a code paste, see https://play.nim-lang.org/#ix=3WBm
19:31:00FromDiscord<spoon> who the heck is telegram
19:31:06FromDiscord<kaletaa> ok!!!|
19:32:10FromDiscord<spoon> i don't think there's a discord <-> telegram bridge
19:32:23FromDiscord<spoon> if not i have never used telegram in my life
19:32:53FromDiscord<kaletaa> it's fine, there was a guy named spoonm on telegram
19:33:00FromDiscord<kaletaa> think he used haskell but i don't remember exactly
19:33:11FromDiscord<spoon> i have also never used haskell in my life
19:33:13FromDiscord<Knedlik> In reply to @ynfle "What's the code": https://github.com/Periapsis-Studios/Periapsis-Engine
19:33:21FromDiscord<kaletaa> In reply to @spoon "i have also never": heretic
19:34:28FromDiscord<spoon> i used it on the homepage just now so i'm good
19:35:28FromDiscord<kaletaa> you dont get it....
19:35:36*ehmry quit (Ping timeout: 246 seconds)
19:36:05FromDiscord<spoon> i'm a haskell developer now
19:36:25FromDiscord<spoon> now i don't have to deal with it ever again
19:37:15FromDiscord<spoon> haskell isn't the one with lots of lambda functions, is it?
19:37:27FromDiscord<kaletaa> well
19:37:31FromDiscord<kaletaa> that depends
19:37:36FromDiscord<kaletaa> on how you use it
19:37:39FromDiscord<spoon> rather known for its lambda functions
19:37:51FromDiscord<kaletaa> most FP languages are lambda heavy
19:39:12*noeontheend joined #nim
19:40:54FromDiscord<spoon> sent a code paste, see https://play.nim-lang.org/#ix=3WBo
19:41:19FromDiscord<spoon> even when casting to int
19:46:05*ehmry joined #nim
19:50:41FromDiscord<ynfle> You definition doesn't expect a return value of int
19:51:15FromDiscord<ynfle> sent a code paste, see https://play.nim-lang.org/#ix=3WBq
19:51:39FromDiscord<ynfle> In reply to @Knedlik "https://github.com/Periapsis-Studios/Periapsis-Engi": Your code is what calls the engine isn't it?
19:52:24FromDiscord<Knedlik> I’m afraid I don’t understand the question - my code calls setActive() on a child of Scene
19:55:26FromDiscord<Knedlik> sent a code paste, see https://play.nim-lang.org/#ix=3WBt
20:06:05*noeontheend quit (Ping timeout: 272 seconds)
20:29:29FromDiscord<Knedlik> @ynfle so any idea?
20:33:15*noeontheend joined #nim
20:41:31*lumo_e joined #nim
20:55:04FromDiscord<spoon> sent a code paste, see https://play.nim-lang.org/#ix=3WBG
20:55:19FromDiscord<spoon> i think it should just be `surface.w` and `surface.h`
20:55:40FromDiscord<Knedlik> Pretty sure that threw me an error, surface is a pointer
20:56:46FromDiscord<spoon> ah surface is also a type in sdl2_nim
20:57:33FromDiscord<spoon> does loadJPG_RW return a sdl.Surface?
20:57:46FromDiscord<Knedlik> It should, lemme check
20:58:18FromDiscord<Knedlik> Yep
20:58:49FromDiscord<spoon> https://github.com/Vladar4/sdl2_nim/blob/43bbdb99e01aa3d2117fc536dd6b0ed3280791a9/examples/ex402_panning.nim#L248
20:59:39FromDiscord<Knedlik> Interesting
20:59:58FromDiscord<spoon> still square brackets shouldn't be there
21:00:02FromDiscord<spoon> (edit) "still ... square" added "think"
21:00:35FromDiscord<spoon> they're just components of a Surface object
21:00:48FromDiscord<spoon> w and h are
21:01:20FromDiscord<Knedlik> I’ll try tommorow, thx
21:02:42*jmdaemon joined #nim
21:03:35*noeontheend quit (Ping timeout: 256 seconds)
21:21:39FromDiscord<ynfle> In reply to @Knedlik "<@767093711112241162> so any idea?": You haven't shown your code. Just the typep definition. Did you initialize it or is still null?
21:45:41FromDiscord<Phytolizer> sent a code paste, see https://play.nim-lang.org/#ix=3WBQ
21:49:38FromDiscord<Elegantbeef> Yes
21:50:56FromDiscord<ambient> anyone know how to convert these two arrays into .nim? c2nim doesn't seem to work right. https://github.com/rxi/microui/blob/master/demo/atlas.inl
21:51:01FromDiscord<ambient> they are inputs to some OpenGL commands
21:52:16FromDiscord<Elegantbeef> I'd say you dont
21:52:29FromDiscord<Elegantbeef> Save the image as a coresponding file format and load it at compile time
21:53:24FromDiscord<Elegantbeef> Nim isnt C you can do this without the tedium of including a long array like this
21:54:43FromDiscord<ambient> well if I later do some hardware hacking on microcontrollers that often require stuff like this it would be nice to know
21:55:00FromDiscord<Elegantbeef> I mean it's not really required for Nim
21:55:11FromDiscord<Elegantbeef> You make a file contain the binary stream you want then do `staticRead`
21:55:22FromDiscord<Elegantbeef> there is no need of declaring arrays like this
21:56:00FromDiscord<ambient> ok I'll look into it
21:56:09FromDiscord<Elegantbeef> If you must you just make an array
21:56:52FromDiscord<Elegantbeef> sent a code paste, see https://play.nim-lang.org/#ix=3WBS
21:56:56FromDiscord<Elegantbeef> Jeez i messed that up
21:57:04FromDiscord<ambient> it's just that I'm converting a C library that only has that header file, no actual image files
21:57:15FromDiscord<ambient> so I have to construct completely different image atlas
21:57:19FromDiscord<Elegantbeef> sent a code paste, see https://play.nim-lang.org/#ix=3WBT
21:58:10FromDiscord<Elegantbeef> The latter would be `muRect: array[requiredSize, array[4, int]]`
21:58:19FromDiscord<ambient> ok thanks
21:58:32FromDiscord<Elegantbeef> But yea modern languages generally skip the middle man and just load files directly
21:58:51FromDiscord<Elegantbeef> Especially since you have compile time evaluation which lets you process files after loading them
23:10:43*lumo_e quit (Quit: Quit)
23:43:14rockcaverait seems to me that the progress of the language (compiler, stdlib, official libs, etc.) has slowed down this year or is it just me?