00:08:05 | NimEventer | New Nimble package! cocktaildb - TheCocktailDB API client, see https://github.com/thechampagne/cocktaildb-nim |
00:14:00 | * | duuude joined #nim |
00:17:50 | FromDiscord | <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:00 | FromDiscord | <Yardanico> In reply to @Yardanico "funny thing is that": made the repo - https://github.com/Yardanico/mimalloc_nim |
00:48:08 | FromDiscord | <Yardanico> went a little too overboard with the readme |
01:12:53 | FromDiscord | <Elegantbeef> @spoon\: damn you i may have spent more time than i like |
01:12:54 | FromDiscord | <Elegantbeef> image.png https://media.discordapp.net/attachments/371759389889003532/969405883559866418/image.png |
01:14:02 | FromDiscord | <spoon> ah, i also modified your example yesterday |
01:14:18 | FromDiscord | <Elegantbeef> Yea there was so much wrong with it |
01:14:24 | FromDiscord | <Elegantbeef> But as a POC and explanation i think it was ok |
01:14:59 | FromDiscord | <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:58 | FromDiscord | <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:42 | FromDiscord | <Elegantbeef> No clue i've not really looked into the logic much, i watched a video for a few minutes 😄 |
01:18:08 | FromDiscord | <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:08 | FromDiscord | <spoon> did you change the algorithm at all? |
01:18:19 | FromDiscord | <Elegantbeef> https://github.com/beef331/nimtrest/blob/master/wavefunctioncollapse.nim |
01:18:35 | FromDiscord | <Elegantbeef> I changed a lot |
01:18:42 | FromDiscord | <Elegantbeef> I've toyed with it quite a bit since it's quite fun |
01:18:43 | FromDiscord | <spoon> ah nice |
01:19:27 | FromDiscord | <spoon> (also aren't github gists used for single file repos?) |
01:19:39 | FromDiscord | <Elegantbeef> This isnt a single file repo |
01:19:48 | FromDiscord | <Yardanico> In reply to @spoon "(also aren't github gists": not really, gists can have multiple files |
01:19:50 | FromDiscord | <Elegantbeef> This is heap for anything i write i think is nifty |
01:20:02 | FromDiscord | <spoon> In reply to @Yardanico "not really, gists can": oh, then what's the advantage then? |
01:20:14 | FromDiscord | <Yardanico> well, it still feels more like a "paste" service so you don' |
01:20:19 | FromDiscord | <Elegantbeef> If you notice i also have vershun my static typed data migration tool |
01:20:19 | FromDiscord | <Yardanico> t have to create a repo for every paste |
01:20:28 | FromDiscord | <Yardanico> yeah @beef i have a similar repo https://github.com/Yardanico/nim-snippets |
01:20:33 | FromDiscord | <Yardanico> and a few other nim people also do |
01:23:19 | FromDiscord | <Elegantbeef> Yea i was tired of having to search for links for my one off stuffs |
01:23:20 | FromDiscord | <Elegantbeef> This resolves that |
01:30:01 | FromDiscord | <spoon> is random pick just selecting a random tile til it fits? |
01:30:25 | FromDiscord | <Elegantbeef> Yea |
01:30:42 | FromDiscord | <Elegantbeef> Ah there is `sample` |
01:30:48 | FromDiscord | <spoon> yeah |
01:30:52 | FromDiscord | <spoon> was gonna say |
01:42:44 | FromDiscord | <morgan> i’m considering using wavefunction collapse but not like at one scale |
01:43:01 | FromDiscord | <morgan> and the randomness would be based on a seed so deterministic |
01:43:42 | FromDiscord | <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:10 | FromDiscord | <Yardanico> In reply to @MorganAlyssa "and the randomness would": you can easily pass a seed to nim's random module |
01:44:12 | FromDiscord | <morgan> and then it would generate far more distance for the larger ones as the player moves around |
01:44:23 | FromDiscord | <Yardanico> randomize either takes no arguments or a single argument being the starting seed |
01:44:26 | FromDiscord | <Yardanico> https://nim-lang.org/docs/random.html#randomize%2Cint64 |
01:44:35 | FromDiscord | <morgan> yeah some sort of seed plus world coords to get the value |
01:45:00 | FromDiscord | <Elegantbeef> Yea any good procgen is deterministic |
01:45:03 | FromDiscord | <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:37 | FromDiscord | <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:38 | FromDiscord | <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:38 | nrds | <Prestige99> Can you label a for loop to break out of it? |
02:26:44 | nrds | <Prestige99> Like in a case with nested for loops |
02:26:59 | FromDiscord | <Elegantbeef> you can `block myName` |
02:27:13 | nrds | <Prestige99> can you give an example? |
02:27:24 | nrds | <Prestige99> like create a scope around the for loop? |
02:28:07 | FromDiscord | <huantian> sent a code paste, see https://play.nim-lang.org/#ix=3Wxa |
02:28:10 | FromDiscord | <Elegantbeef> sent a code paste, see https://play.nim-lang.org/#ix=3Wxb |
02:28:20 | nrds | <Prestige99> cool |
02:29:55 | FromDiscord | <morgan> handy |
02:30:33 | FromDiscord | <huantian> very nesty |
02:34:03 | * | kayabaNerve quit (Ping timeout: 256 seconds) |
02:35:12 | FromDiscord | <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:51 | FromDiscord | <Elegantbeef> break it in to procedures where you can |
02:38:06 | FromDiscord | <Elegantbeef> Many times when you used break out of blocks it can be done with a procedure |
02:44:18 | FromDiscord | <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:38 | FromDiscord | <Elegantbeef> Eh it's' generally much cleaner imo to use a procedure than break but ymmv |
02:46:33 | FromDiscord | <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:57 | FromDiscord | <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:11 | FromDiscord | <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:38 | FromDiscord | <morgan> oh neat |
04:23:37 | FromDiscord | <Elegantbeef> Why is it a macro? |
04:26:32 | FromDiscord | <demotomohiro> It looks simpler than writing named block and while loop. |
04:26:46 | FromDiscord | <Elegantbeef> I mean why isnt it a template 😄 |
04:30:41 | FromDiscord | <morgan> i think it's the checking to allow using nil to have only one of the two jump points |
04:31:00 | FromDiscord | <morgan> tho maybe it could be done with a template |
04:33:15 | FromDiscord | <Elegantbeef> I see `cond, outer, inner, body` and `cond, outer, body` as the only valid use cases of it bt ymmv |
04:33:54 | FromDiscord | <morgan> wait yeah wouldn't it work with overloading, tho then you could only have just outer or just inner |
04:34:11 | FromDiscord | <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:11 | FromDiscord | <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:56 | FromDiscord | <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:19 | FromDiscord | <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:39 | FromDiscord | <Rika> Both are valid |
04:52:43 | FromDiscord | <Elegantbeef> single `_` is allowed |
04:52:50 | FromDiscord | <Rika> What is the error? |
04:52:58 | FromDiscord | <Elegantbeef> It cannot start with or end with `_` and there cannot be two `_` next to eachother |
04:53:50 | nrds | <Prestige99> Where are simple array and seq functions documented? E.g. add and remove |
04:54:08 | FromDiscord | <Elegantbeef> They're apart of system |
04:54:29 | FromDiscord | <Elegantbeef> https://nim-lang.org/docs/system.html#add%2Cseq%5BT%5D%2CopenArray%5BT%5D |
04:54:57 | * | kayabaNerve joined #nim |
04:55:00 | nrds | <Prestige99> Thanks |
04:55:13 | nrds | <Prestige99> Always forget where that is and can't find it by googling |
04:55:40 | FromDiscord | <Elegantbeef> https://nim-lang.org/docs/lib.html https://nim-lang.org/docs/theindex.html |
04:56:57 | FromDiscord | <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:10 | FromDiscord | <Elegantbeef> What? |
04:57:29 | FromDiscord | <morgan> https://media.discordapp.net/attachments/371759389889003532/969462402242445342/unknown.png |
04:57:44 | FromDiscord | <Elegantbeef> why not just `name_outer`? |
04:58:12 | FromDiscord | <Elegantbeef> Ah nevermind i see you're using template magic |
04:58:13 | FromDiscord | <morgan> does it still use the value of name in that case? |
04:58:18 | FromDiscord | <Elegantbeef> why do you need `_` |
04:58:22 | FromDiscord | <Elegantbeef> just do `name outer` |
04:58:26 | FromDiscord | <Elegantbeef> there is no benefit to using `_` here |
04:58:30 | FromDiscord | <morgan> to visually separate them |
04:58:39 | FromDiscord | <Elegantbeef> Visually seperate them where? |
04:58:49 | FromDiscord | <Elegantbeef> You dont see these declared |
04:59:04 | FromDiscord | <morgan> they would get used in break calls |
04:59:22 | FromDiscord | <Elegantbeef> So what `myName_outer` and `myNameOuter` are identical in nim |
04:59:39 | FromDiscord | <morgan> oh huh |
04:59:42 | FromDiscord | <morgan> cool |
05:02:29 | FromDiscord | <Elegantbeef> sent a code paste, see https://play.nim-lang.org/#ix=3Wxr |
05:03:22 | FromDiscord | <Elegantbeef> needs `{.dirty.}` to inject the break names |
05:05:24 | FromDiscord | <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:51 | FromDiscord | <retkid> should i learn Reason |
05:33:22 | FromDiscord | <Solitude> yeah |
05:34:01 | FromDiscord | <retkid> In reply to @Solitude "yeah": thinking about learning clio |
05:34:09 | FromDiscord | <retkid> i need to see if its faster then nim |
05:34:31 | FromDiscord | <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:12 | FromDiscord | <Rika> “Faster than Nim” is dependent on the programmer as always |
05:41:09 | FromDiscord | <retkid> In reply to @Rika "“Faster than Nim” is": in wasm in this situation |
05:41:28 | FromDiscord | <retkid> depends probably more on the compiler |
05:41:39 | FromDiscord | <retkid> but im now looking into webgpu |
05:44:49 | FromDiscord | <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:30 | FromDiscord | <Phil> (edit) "torn" => "token" |
05:53:27 | * | irfanns quit (Ping timeout: 246 seconds) |
05:54:09 | * | irfanns joined #nim |
06:07:05 | FromDiscord | <Phil> The culprit is effing toBase64, that does not deal well with Unicode |
06:09:57 | * | irfanns quit (Ping timeout: 256 seconds) |
06:10:54 | FromDiscord | <Phil> Something in there about the proc encodeurlsafe which uses the proc toopenarraybyte ducks up my Unicode |
06:22:43 | FromDiscord | <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:34 | FromDiscord | <morgan> sent a code paste, see https://play.nim-lang.org/#ix=3WxH |
06:28:55 | FromDiscord | <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:14 | FromDiscord | <morgan> sent a code paste, see https://paste.rs/9AB |
06:33:19 | FromDiscord | <morgan> i think this does what i want |
06:33:38 | FromDiscord | <Elegantbeef> try finaly perhaps |
06:36:07 | FromDiscord | <morgan> oh so it always runs the block again if it errors? |
06:36:12 | FromDiscord | <morgan> (edit) "block" => "body" |
06:38:29 | FromDiscord | <morgan> i would guess that it would then run into the same issue in the body after that |
06:48:59 | FromDiscord | <Asbjørn F> @Phil Hey, just saw your message now. Will do if something comes up! Thanks a bunch |
06:57:36 | FromDiscord | <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:31 | FromDiscord | <Asbjørn F> Cool |
07:05:07 | * | PMunch joined #nim |
07:08:14 | FromDiscord | <d4rckh> sent a code paste, see https://paste.rs/g1V |
07:08:15 | FromDiscord | <d4rckh> what 😶 |
07:09:16 | FromDiscord | <Elegantbeef> Do you have two types named `Socket`? |
07:09:23 | FromDiscord | <Elegantbeef> Full code |
07:09:25 | FromDiscord | <d4rckh> (edit) "https://play.nim-lang.org/#ix=3WxQ" => "https://play.nim-lang.org/#ix=3WxR" |
07:09:45 | FromDiscord | <d4rckh> problem is, i dont know what to send you lol |
07:10:30 | FromDiscord | <d4rckh> oh!! |
07:10:46 | FromDiscord | <d4rckh> i didnt import `net` and it used the socket type of another library which i imported |
07:12:19 | PMunch | Solitude, thanks for replying to the NimLSP issue. Sometimes I wonder how people will go to write an issue before checking the README.. |
07:12:57 | FromDiscord | <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:14 | FromDiscord | <xflywind> https://github.com/nim-lang/RFCs/issues/252#issuecomment-705113779 |
07:14:17 | FromDiscord | <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:30 | FromDiscord | <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:14 | FromDiscord | <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:16 | FromDiscord | <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:00 | FromDiscord | <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:17 | FromDiscord | <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:28 | FromDiscord | <Elegantbeef> It'll let you give a default state with constant values |
07:16:33 | FromDiscord | <Elegantbeef> So no it doesnt solve that issue afaik |
07:16:48 | FromDiscord | <xflywind> Anything which doesn't default to zero has the same problem. |
07:16:53 | FromDiscord | <Elegantbeef> Will ranges have an opt in for allowing the `low` be default? |
07:17:36 | FromDiscord | <Elegantbeef> I guess i need to read the RFC for that |
07:18:32 | FromDiscord | <Phil> In reply to @Elegantbeef "It'll let you give": So I can look at it more like... basically constructor/defaults ? |
07:18:50 | FromDiscord | <xflywind> Yeah |
07:19:14 | FromDiscord | <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:21 | FromDiscord | <Elegantbeef> Yea it'll be compiller supported version of my defaults |
07:20:45 | FromDiscord | <d4rckh> sent a code paste, see https://play.nim-lang.org/#ix=3WxT |
07:20:51 | FromDiscord | <d4rckh> this is what i run.. `nim c -r --threads:on -d:server .\server\server.nim` |
07:21:18 | FromDiscord | <d4rckh> wait what it worked |
07:21:23 | FromDiscord | <d4rckh> (edit) "wait what it worked ... " added "after 5th time" |
07:21:34 | PMunch | @d4rckh, that error looks really weird |
07:21:41 | PMunch | Are you using some strange library? |
07:21:54 | PMunch | Nim shouldn't try to touch .gitignore.. |
07:21:55 | FromDiscord | <Elegantbeef> It's an unhandled exception from their code afaict |
07:22:11 | FromDiscord | <d4rckh> im using winim, thats probably the strangest library im using |
07:22:16 | FromDiscord | <Elegantbeef> Pmunch i had a look and yep derivedtypes still remains a mystery to me |
07:22:22 | FromDiscord | <d4rckh> In reply to @Elegantbeef "It's an unhandled exception": its not actually running my code |
07:22:38 | FromDiscord | <d4rckh> it didnt get to the link process https://media.discordapp.net/attachments/371759389889003532/969498929089622036/unknown.png |
07:23:06 | PMunch | @Elegantbeef, haha what's so mysterious about them? |
07:23:24 | FromDiscord | <Elegantbeef> Dont quite follow the purpose of the arguments |
07:23:28 | FromDiscord | <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:15 | FromDiscord | <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:38 | FromDiscord | <Elegantbeef> Phil was talking about my macro library 😄 |
07:27:09 | FromDiscord | <Asbjørn F> Just no magic stuff in the constructors 🚫 |
07:28:37 | PMunch | @Elegantbeef, yeat the names aren't great |
07:28:46 | PMunch | Anything in particular that confused you? |
07:29:05 | PMunch | I mean deriveable is pretty simple, it just takes a list of procedures to add to the list |
07:29:18 | FromDiscord | <Elegantbeef> I dont know what the stuff in the `[]` does |
07:29:25 | FromDiscord | <d4rckh> hmm, how can i hook the esc key in my terminal app? similarly how you can hook the ctrl+c combo |
07:30:33 | FromDiscord | <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:46 | FromDiscord | <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:04 | PMunch | derive 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:39 | PMunch | (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:49 | PMunch | ) |
07:34:17 | FromDiscord | <Rika> In reply to @Asbjørn F "Just no magic stuff": What does “magic stuff” mean to you |
07:35:19 | FromDiscord | <Elegantbeef> Yea i'm too dumb to my suggestion here 😄 |
07:35:32 | FromDiscord | <Elegantbeef> I've lost the point of this again so i'm in the weeds |
07:37:07 | FromDiscord | <Phil> sent a long message, see http://ix.io/3WxV |
07:37:53 | FromDiscord | <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:55 | FromDiscord | <Rika> Doesn’t that new(T) clobber the new in system, even if it’s a valid overload |
07:38:06 | FromDiscord | <Rika> I’d prolly be kinda annoyed in that case |
07:38:22 | FromDiscord | <Elegantbeef> You choose |
07:38:24 | FromDiscord | <Elegantbeef> So i mean you do you |
07:38:28 | FromDiscord | <Rika> Okay |
07:38:32 | FromDiscord | <Rika> Can’t it be a different name? |
07:38:33 | FromDiscord | <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:44 | FromDiscord | <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:44 | FromDiscord | <Elegantbeef> You can usue whatever name you want with `constr` |
07:38:47 | FromDiscord | <Phil> (edit) "proc" => "procs" |
07:39:13 | FromDiscord | <Rika> If I can then okay, I mean a different name with (T) param |
07:39:16 | FromDiscord | <Rika> If so then okay |
07:39:18 | FromDiscord | <Elegantbeef> sent a code paste, see https://paste.rs/jfa |
07:39:36 | FromDiscord | <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:39 | FromDiscord | <Elegantbeef> Default assumes you want either `T.new` or `newT` |
07:39:44 | FromDiscord | <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:02 | FromDiscord | <Elegantbeef> Default constructors would not be able to, they're going to forced static |
07:40:20 | FromDiscord | <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:46 | FromDiscord | <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:00 | FromDiscord | <Asbjørn F> In reply to @Isofruit "Believe me, you'll know": That's always a nice guarantee |
07:41:24 | FromDiscord | <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:14 | FromDiscord | <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:07 | FromDiscord | <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:09 | FromDiscord | <Asbjørn F> I see |
07:54:54 | nrds | <Prestige99> Is there any way to use std/os with nimscript? |
07:55:10 | FromDiscord | <Elegantbeef> Some but it's done annoyingly |
07:55:32 | nrds | <Prestige99> Trying to write a nimble script to copy files with different extensions, depending on which os is running the script |
07:55:50 | nrds | <Prestige99> but can't seem to be able to do globs or anything useful |
07:56:09 | FromDiscord | <Elegantbeef> The os impl sucks |
07:56:17 | nrds | <Prestige99> at least it works tho |
07:56:30 | FromDiscord | <Elegantbeef> I mean the nimscript os impl sucks |
07:56:34 | nrds | <Prestige99> o |
07:56:55 | FromDiscord | <Elegantbeef> Need an RFC to fix it |
07:59:30 | nrds | <Prestige99> dang |
07:59:34 | nrds | <Prestige99> also no extractFilename? |
08:00:06 | FromDiscord | <Elegantbeef> That should work |
08:00:23 | FromDiscord | <Elegantbeef> There isnt an OS part of that |
08:00:36 | nrds | <Prestige99> neat neat |
08:05:48 | FromDiscord | <Elegantbeef> For OS operations it's a hit or miss if it'll work |
08:23:32 | FromDiscord | <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:59 | FromDiscord | <d4rckh> (edit) "`import("file.nim").proc()`" => "`let file = import("file.nim")`" |
08:24:19 | FromDiscord | <d4rckh> then to access procs from that file id just do `file.myProc()` |
08:24:54 | FromDiscord | <Elegantbeef> Then everything else is the same |
08:24:55 | FromDiscord | <Elegantbeef> sent a code paste, see https://play.nim-lang.org/#ix=3Wy6 |
08:27:41 | * | oprypin quit (Quit: Bye) |
08:27:50 | FromDiscord | <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:27 | FromDiscord | <Elegantbeef> `import myCommand as nil` |
08:28:45 | FromDiscord | <Elegantbeef> Or just use an object |
08:28:57 | FromDiscord | <Solitude> or write a macro |
08:29:55 | FromDiscord | <d4rckh> sent a code paste, see https://paste.rs/JaO |
08:30:10 | FromDiscord | <Elegantbeef> You can do the same with a macro without it |
08:30:19 | FromDiscord | <d4rckh> (edit) "https://play.nim-lang.org/#ix=3Wya" => "https://play.nim-lang.org/#ix=3Wy9" |
08:30:20 | FromDiscord | <d4rckh> so i dont have to import everything by hand |
08:30:31 | FromDiscord | <d4rckh> and auto generate a sequence of Command objects |
08:30:37 | FromDiscord | <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:52 | FromDiscord | <d4rckh> oh, i see, thanks |
08:40:13 | PMunch | @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:41 | FromDiscord | <d4rckh> yeah, thats what im doing, looking at elegantbeef's code, seems like exactly waht i need |
08:46:56 | madprops | elegant code |
08:47:38 | madprops | he helped me correct a bunch of problems in this thing https://madprops.github.io/numberstring/ |
08:47:57 | madprops | maybe it will be useful as reference at some point |
08:49:59 | FromDiscord | <d4rckh> nnkInfix the dot `.` iirc? |
08:50:33 | FromDiscord | <Solitude> In reply to @d4rckh "nnkInfix the dot `.`": what? |
08:50:37 | FromDiscord | <d4rckh> nvm, |
08:50:42 | FromDiscord | <d4rckh> trying to figure out the ast |
08:50:51 | FromDiscord | <Elegantbeef> My macro is very ugly |
08:51:00 | FromDiscord | <Elegantbeef> I linked it before in a cleaned up state if you want to search and search |
09:01:52 | FromDiscord | <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:41 | FromDiscord | <Elegantbeef> @aph\: can you make a thunk? |
09:16:14 | FromDiscord | <Elegantbeef> `setRenderer proc(): Vnode = createDom("hello")` type thing should work |
09:17:15 | * | om3ga joined #nim |
09:18:16 | * | xet7 joined #nim |
09:20:12 | FromDiscord | <aph> thanks! |
09:22:26 | * | rawrrr quit (Quit: Connection closed for inactivity) |
09:33:45 | FromDiscord | <d4rckh> sent a code paste, see https://play.nim-lang.org/#ix=3Wyz |
09:33:51 | FromDiscord | <d4rckh> i dont think im doing it properly, my commands are located in `../commands` |
09:35:21 | FromDiscord | <Elegantbeef> `echo result.repr` |
09:35:39 | FromDiscord | <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:35 | FromDiscord | <Asbjørn F> After about 700 days I'd be getting in trouble, assuming the workload |
09:37:29 | FromDiscord | <Elegantbeef> In nim `int` is platform specific and on 64bit it's 64bit |
09:37:53 | FromDiscord | <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:00 | FromDiscord | <Asbjørn F> I'm using postgreSQL |
09:38:02 | FromDiscord | <Phil> Ohhh that |
09:38:03 | FromDiscord | <Phil> sent a code paste, see https://play.nim-lang.org/#ix=3WyB |
09:39:20 | FromDiscord | <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:38 | FromDiscord | <Asbjørn F> Roger |
09:39:50 | FromDiscord | <Asbjørn F> I just saw it was able to generate tables and got curious |
09:39:57 | FromDiscord | <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:00 | FromDiscord | <Phil> Oh it is capable of that |
09:40:11 | FromDiscord | <Phil> But the ability is imo not mature enough to properly make use of |
09:40:20 | FromDiscord | <Asbjørn F> Right |
09:40:33 | FromDiscord | <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:44 | FromDiscord | <Asbjørn F> makes sense |
09:40:47 | FromDiscord | <d4rckh> In reply to @Elegantbeef "`echo result.repr`": whats result? |
09:40:57 | FromDiscord | <Elegantbeef> The result variable |
09:41:11 | FromDiscord | <Phil> In reply to @d4rckh "whats result?": As in, in general? Result is an implicitly created variable in every proc |
09:41:20 | FromDiscord | <Elegantbeef> every |
09:41:39 | FromDiscord | <Phil> Oh right, I don't think it exists in procs without return types? |
09:41:56 | FromDiscord | <Elegantbeef> Damn well better not void is uninstantiatble |
09:42:18 | FromDiscord | <Elegantbeef> sent a code paste, see https://play.nim-lang.org/#ix=3WyC |
09:42:26 | FromDiscord | <Elegantbeef> Refer to https://dev.to/beef331/demystification-of-macros-in-nim-13n8 otherwise |
09:42:27 | FromDiscord | <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:46 | FromDiscord | <Phil> result implicitly is "" at the start of the proc and created |
09:42:47 | FromDiscord | <Elegantbeef> Or just `proc lalal: string = "bla"` cause we're in 2022 😛 |
09:43:05 | FromDiscord | <Phil> yeah but then I couldn't show off that bla exists 😛 |
09:43:11 | FromDiscord | <Phil> errr result I mean |
09:43:18 | FromDiscord | <Asbjørn F> sent a long message, see http://ix.io/3WyD |
09:43:35 | FromDiscord | <Elegantbeef> Anyway i'm off so phill whill totally help you with all your troubles |
09:43:37 | FromDiscord | <d4rckh> okay, i got ↵`↵import↵ /commands / []` |
09:43:45 | FromDiscord | <d4rckh> (edit) "okay, i got ↵`↵import↵ /commands / []`" => "sent a code paste, see https://paste.rs/pSt" |
09:43:59 | FromDiscord | <d4rckh> i need to add `..` before `/commands` |
09:44:01 | FromDiscord | <Elegantbeef> Yea that's clearly wrong so time to learn macros using my writeup |
09:44:13 | FromDiscord | <Elegantbeef> `../` is a single operator |
09:45:08 | FromDiscord | <Asbjørn F> wow that's a well written write-up |
09:45:16 | FromDiscord | <Asbjørn F> (edit) "well written" => "well-written" |
09:45:28 | FromDiscord | <Elegantbeef> sent a code paste, see https://play.nim-lang.org/#ix=3WyE |
09:46:04 | FromDiscord | <Elegantbeef> Me an well written, that's a joke |
09:46:07 | FromDiscord | <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:13 | FromDiscord | <Phil> (edit) "views, or making calls that aggregate your data" => "views" |
09:46:16 | FromDiscord | <Elegantbeef> i only read nisane as inane |
09:46:34 | FromDiscord | <Elegantbeef> I prefer using nissan myself |
09:46:35 | FromDiscord | <Phil> I forgot that norm also can deal with some level of data aggregation for stuff like simple counts etc. |
09:47:03 | FromDiscord | <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:08 | FromDiscord | <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:14 | FromDiscord | <Asbjørn F> And devs need to be able to create a local copy and yadda yadda |
09:47:17 | FromDiscord | <Elegantbeef> The fuck is a string |
09:47:26 | FromDiscord | <Elegantbeef> That untyped thingy?! |
09:47:27 | FromDiscord | <Asbjørn F> In reply to @Elegantbeef "The fuck is a": pain |
09:47:31 | FromDiscord | <Elegantbeef> Ok now i'm really going |
09:47:35 | FromDiscord | <Phil> In reply to @Elegantbeef "The fuck is a": It's what people use that can't use enums |
09:47:48 | FromDiscord | <Asbjørn F> people use strings as enums? |
09:47:51 | FromDiscord | <Phil> As in, technically can't because DB stuff etc. |
09:47:53 | FromDiscord | <d4rckh> fixed it |
09:48:07 | FromDiscord | <d4rckh> sent a code paste, see https://play.nim-lang.org/#ix=3WyF |
09:48:13 | FromDiscord | <d4rckh> (edit) "https://play.nim-lang.org/#ix=3WyF" => "https://play.nim-lang.org/#ix=3WyG" |
09:48:41 | FromDiscord | <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:51 | FromDiscord | <Phil> (edit) "it," => "at," |
09:48:55 | FromDiscord | <Asbjørn F> ah, right |
09:49:17 | FromDiscord | <Asbjørn F> if I need enums I usually have an enum table so I get numbers |
09:49:57 | FromDiscord | <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:35 | FromDiscord | <Phil> That's the reason you'll always know when norm makes a query, because you need to pass it connection objects |
09:50:42 | FromDiscord | <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:05 | FromDiscord | <Phil> norm supports currently only postgres and sqlite IIRC |
09:51:15 | FromDiscord | <Asbjørn F> good enough for me |
09:51:31 | FromDiscord | <Asbjørn F> I think we have clients with transact-sql though aka MSSQL |
09:51:32 | FromDiscord | <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:13 | FromDiscord | <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:42 | FromDiscord | <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:52 | FromDiscord | <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:03 | FromDiscord | <Asbjørn F> thanks |
09:55:47 | FromDiscord | <d4rckh> sent a code paste, see https://paste.rs/Us6 |
09:55:47 | FromDiscord | <d4rckh> ouch |
09:56:05 | FromDiscord | <Rika> Why the as nil anyway? |
09:56:20 | FromDiscord | <Rika> You don’t need that for qualified function calls |
09:56:24 | FromDiscord | <Rika> It’s only for enforcing |
09:56:29 | FromDiscord | <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:56 | FromDiscord | <Rika> You don’t need to enforce this way either if they’re ambiguous calls, because it’s already technically enforced |
09:58:24 | FromDiscord | <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:01 | FromDiscord | <d4rckh> oh, okay |
09:59:03 | FromDiscord | <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:55 | FromDiscord | <Phil> sent a code paste, see https://play.nim-lang.org/#ix=3WyI |
10:00:02 | FromDiscord | <Asbjørn F> ah I see |
10:00:06 | FromDiscord | <Phil> That was for using full-text-search tables on sqlite |
10:01:05 | FromDiscord | <Phil> Aaaanyway, likely radio silence from me for the next 4-5h because work. webdev channel is also really useful though ^^ |
10:01:13 | FromDiscord | <Asbjørn F> ty |
10:04:41 | FromDiscord | <d4rckh> sent a code paste, see https://paste.rs/p3V |
10:09:37 | FromDiscord | <d4rckh> if i change the path to ./commands it still doesnt return anything |
10:09:41 | FromDiscord | <Rika> It’s based on PWD where you run it |
10:09:51 | FromDiscord | <d4rckh> i also tried `commands` `.\\commands` and `..\\commands` |
10:10:03 | FromDiscord | <d4rckh> but its not returning anything |
10:10:31 | FromDiscord | <d4rckh> if i create a file in the root directory of my project and walkDir `commands` it returns everything just fine |
10:10:56 | FromDiscord | <Solitude> it runs relative to process pwd not the path of the source file |
10:11:11 | FromDiscord | <d4rckh> yeah i tried relative to pwd and to the source file, both didnt work |
10:11:13 | FromDiscord | <Rika> Try the name of the folder only |
10:11:25 | FromDiscord | <d4rckh> did try |
10:12:11 | FromDiscord | <Rika> Where are you running this |
10:12:22 | FromDiscord | <d4rckh> in the root directory |
10:12:28 | FromDiscord | <d4rckh> one step up from the commands directory |
10:12:46 | FromDiscord | <Rika> Can you check again to make sure if you don’t mind |
10:13:15 | FromDiscord | <d4rckh> yes |
10:13:20 | FromDiscord | <d4rckh> my pwd is `D:\Projects\2022\test` |
10:13:34 | FromDiscord | <d4rckh> utils.nim is at `D:\Projects\2022\test\server\utils.nim` |
10:13:43 | FromDiscord | <d4rckh> and commands is at `D:\Projects\2022\test\commands` |
10:13:51 | FromDiscord | <d4rckh> if i use the absolute path, it works just fine |
10:14:15 | FromDiscord | <Rika> How are you running it |
10:14:40 | FromDiscord | <d4rckh> from a batch script that just runs `nim c -r --threads:on -d:server .\server\server.nim` |
10:15:00 | FromDiscord | <Josef> Is there a nim plugin that shows documentation? |
10:15:45 | FromDiscord | <Josef> And what is the meaning of `` in `proc foo(...`? |
10:16:07 | FromDiscord | <d4rckh> In reply to @Josef "And what is the": exports the proc |
10:16:18 | FromDiscord | <d4rckh> so you can import in another file |
10:16:59 | FromDiscord | <Josef> I like how Nim is very elegant. But this is too much 😄 |
10:17:16 | FromDiscord | <Rika> What do you mean |
10:17:27 | FromDiscord | <d4rckh> okay, when i just run the command it works @Rika |
10:17:28 | FromDiscord | <d4rckh> so weird |
10:17:35 | FromDiscord | <Josef> (edit) "is very" => "aims to be" |
10:17:48 | FromDiscord | <Rika> Batch files probably don’t inherit the current working directory |
10:17:52 | FromDiscord | <Rika> I don’t know |
10:17:55 | FromDiscord | <Rika> That would be strange |
10:18:01 | FromDiscord | <Rika> I don’t use windows I wouldn’t know |
10:18:07 | FromDiscord | <d4rckh> fair enough haha |
10:20:18 | FromDiscord | <d4rckh> i hate this nim extension for vs code |
10:21:05 | FromDiscord | <d4rckh> always trolling me with errors, when i actually dont have them |
10:21:30 | FromDiscord | <Josef> Where is nimble documentation located? |
10:21:48 | FromDiscord | <Rika> What do you mean? Usage documentation? |
10:21:48 | FromDiscord | <Solitude> in nimble readme |
10:28:53 | * | duuude joined #nim |
10:39:09 | FromDiscord | <Josef> `Error: attempt to redefine: '_'` |
10:39:22 | FromDiscord | <Josef> You can't discard variables with `_`? |
10:39:58 | FromDiscord | <Josef> `DllMain(_: HINSTANCE, reason: DWORD, _: LPVOID)` |
10:41:57 | FromDiscord | <Josef> (edit) "`DllMain(_:" => "`proc DllMain(_:" |
10:44:03 | FromDiscord | <d4rckh> In reply to @Elegantbeef "Infact i already have": i dont get how you are making that commandTable 🤔 |
10:45:45 | FromDiscord | <Yardanico> In reply to @Josef "You can't discard variables": not really, _ is just a special-cased allowed identifier |
10:45:48 | FromDiscord | <Yardanico> but in your proc you have multiple of it |
10:46:25 | FromDiscord | <Josef> Well, that's hilarious. |
10:47:02 | FromDiscord | <Yardanico> it's not advertised for discarding unused variables though |
10:47:18 | FromDiscord | <Yardanico> it's only mentioned in the manual for tuple unpacking |
10:47:58 | FromDiscord | <Josef> I can't imagine a situation where you would want to use a variable named `_`. |
10:48:12 | FromDiscord | <Josef> Unless you enjoy APL. |
10:49:12 | FromDiscord | <Yardanico> https://media.discordapp.net/attachments/371759389889003532/969550913809305640/unknown.png |
10:49:40 | FromDiscord | <Josef> Yea, except you don't ignore them, if the `_` is variable name, |
10:49:45 | FromDiscord | <Josef> And not a special cosntruct. |
10:50:02 | FromDiscord | <Josef> It would still allow you to use it down the line. |
10:50:54 | FromDiscord | <Yardanico> In reply to @Josef "It would still allow": nope |
10:51:17 | FromDiscord | <Josef> Well, then it's not an identifier. |
10:51:54 | FromDiscord | <Yardanico> it is a "special" identifier :) |
10:52:45 | FromDiscord | <SirElephant> how do i use the colors lib? |
10:52:48 | FromDiscord | <Josef> Hm, then I don't see why you can't use it multiple times. |
10:53:00 | FromDiscord | <Solitude> In reply to @Josef "Hm, then I don't": its a bug |
10:53:43 | FromDiscord | <Solitude> and it only affect proc signature, i think |
10:54:54 | FromDiscord | <SirElephant> is it used to output colored strings? |
10:55:15 | FromDiscord | <d4rckh> i just use the terminal library |
10:55:46 | FromDiscord | <SirElephant> In reply to @d4rckh "i just use the": is that in the std lib? |
10:55:54 | FromDiscord | <d4rckh> yes |
10:56:16 | FromDiscord | <d4rckh> https://nim-lang.org/docs/terminal.html |
10:59:35 | PMunch | @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:13 | PMunch | But 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:26 | nrds | <Prestige99> how do I pass a pointer to an object to a function? myObject.addr? |
11:06:34 | FromDiscord | <Yardanico> yes |
11:06:35 | FromDiscord | <Josef> How do you get `pid` of `Process`? |
11:07:53 | PMunch | @Josef, https://nim-lang.org/docs/osproc.html#processID%2CProcess |
11:08:42 | FromDiscord | <Josef> I hit `CTRL+F` for `pid` instead of `id` 🤦 |
11:19:07 | PMunch | @Josef, yeah the documentation for that procedure should probably mention the word PID so it's easier to search for. PR welcome |
11:58:33 | FromDiscord | <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:52 | FromDiscord | <Yardanico> yes, but only in limited cases |
12:00:17 | FromDiscord | <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:25 | FromDiscord | <Yardanico> nimeventer imports sub-packages that import the main package |
12:00:47 | FromDiscord | <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:15 | FromDiscord | <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:16 | FromDiscord | <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:21 | FromDiscord | <Yardanico> that's how it's usually solved in nim projects |
12:02:32 | FromDiscord | <Knedlik> Okay, so basically exported things first and then the import? |
12:02:41 | FromDiscord | <Yardanico> yeah kind of |
12:02:52 | FromDiscord | <Yardanico> but I haven't tested this approach for bigger projects, so I don't know how it'll work |
12:03:01 | FromDiscord | <Yardanico> actually I've only used recursive imports in nimeventer out of all my stuff |
12:03:10 | FromDiscord | <Yardanico> (edit) "recursive" => "cyclic" |
12:03:12 | FromDiscord | <Knedlik> It's only for one thing really |
12:11:17 | FromDiscord | <Zoom> Hey, how is the table literal `{"foo": 1, "bar": 2}` called properly? |
12:12:06 | FromDiscord | <Solitude> called? |
12:12:07 | FromDiscord | <Yardanico> In reply to @Zoom "Hey, how is the": table constructor |
12:12:17 | FromDiscord | <Yardanico> but it doesn't exist, it's just sugar for an array of tuple pairs |
12:12:18 | FromDiscord | <Yardanico> https://nim-lang.org/docs/manual.html#statements-and-expressions-table-constructor |
12:12:43 | FromDiscord | <Zoom> Yep, I was surprised when I found out it's actually an array |
12:13:06 | FromDiscord | <Zoom> So why didn't I made a conclusion it actually doesn't exist then \:P |
12:14:14 | FromDiscord | <Rika> Because it’s not expected by the average programmer |
12:15:02 | FromDiscord | <Zoom> That was inconsiderate of you, but I'll take it! \:D↵(@Rika) |
12:15:22 | FromDiscord | <Rika> You know that’s not what I mean by average |
12:15:50 | FromDiscord | <Zoom> We're all are special snowflakes here! 💕 |
12:16:16 | FromDiscord | <Knedlik> We are all are |
12:28:44 | FromDiscord | <Knedlik> sent a code paste, see https://play.nim-lang.org/#ix=3Wzj |
12:29:20 | FromDiscord | <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:00 | FromDiscord | <Yardanico> In reply to @Knedlik "Ummmm guys what does": you passed `Graphic` but the proc expects `ref Graphic` |
12:30:12 | FromDiscord | <Yardanico> oh, ref Graphic:ObjectType, hm |
12:30:17 | FromDiscord | <Yardanico> can you show the code and type definition? |
12:30:23 | PMunch | @FireLite, welcome! I'm not sure if anyone has written a Nim-specific library for that, but Nim can use C libraries |
12:31:04 | FromDiscord | <Knedlik> sent a code paste, see https://paste.rs/wBk |
12:31:12 | FromDiscord | <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:37 | FromDiscord | <Yardanico> sent a code paste, see https://paste.rs/xuT |
12:31:44 | FromDiscord | <Knedlik> the graphic file is here https://github.com/Periapsis-Studios/Periapsis-Engine/blob/main/src/private/imageGraphic.nim |
12:31:55 | FromDiscord | <Knedlik> entity is here https://github.com/Periapsis-Studios/Periapsis-Engine/blob/main/src/private/entity.nim |
12:32:40 | FromDiscord | <Yardanico> hmmm, and can you paste the full error message then? |
12:33:01 | FromDiscord | <Yardanico> not just these lines, but the whole error message, as it usually has useful context |
12:33:58 | PMunch | @FireLite, there might be something useful here though: https://github.com/byt3bl33d3r/OffensiveNim/ |
12:34:16 | FromDiscord | <FireLite> In reply to @PMunch "<@600281115676114964>, there might be": Thanks |
12:34:21 | FromDiscord | <Knedlik> sent a code paste, see https://play.nim-lang.org/#ix=3Wzl |
12:34:57 | FromDiscord | <Knedlik> The only thing I ommited is the rest of the path, to make the message shorter |
12:35:21 | FromDiscord | <Yardanico> and where is logoEntity? |
12:35:28 | FromDiscord | <Yardanico> i can't find it in your repo |
12:35:38 | FromDiscord | <Knedlik> Because it's not in a repo rn |
12:35:46 | FromDiscord | <Knedlik> It's not a part of the engine |
12:35:54 | FromDiscord | <Yardanico> just paste it here with `` |
12:35:56 | FromDiscord | <Yardanico> triple quotes |
12:36:00 | FromDiscord | <Yardanico> or a gist/playground |
12:36:03 | FromDiscord | <Knedlik> sent a code paste, see https://paste.rs/Ohw |
12:37:42 | FromDiscord | <Yardanico> sorry, still can't figure it out :( quite a weird error indeed |
12:37:55 | FromDiscord | <Yardanico> if the code isn't private you can push it to some branch |
12:38:39 | FromDiscord | <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:33 | FromDiscord | <Yardanico> ok ill try to figure it out |
12:41:42 | FromDiscord | <Knedlik> Thank you |
12:45:25 | FromDiscord | <Yardanico> @Knedlik why are you using `include`? |
12:45:29 | FromDiscord | <Yardanico> this is why your error happens |
12:45:42 | FromDiscord | <Yardanico> when you `include` stuff, the code from the files literally gets pasted into the file where you have `include` |
12:45:53 | FromDiscord | <Yardanico> you should instead use `import` + `export` in periapsisEngine.nim |
12:46:43 | FromDiscord | <Yardanico> sent a code paste, see https://paste.rs/Jmu |
12:47:01 | FromDiscord | <Knedlik> hmmmm |
12:47:10 | FromDiscord | <Knedlik> I'll try, thanks |
12:47:18 | FromDiscord | <Yardanico> by using `include` you made it so that there are two different `Graphic` types defined |
12:47:27 | FromDiscord | <Yardanico> and even if they're the same name, they're different types in the end |
12:52:43 | FromDiscord | <Phil> Alright, back from work, now to figure out why base 64 conversion is figuratively Satan |
12:57:30 | FromDiscord | <Knedlik> Wouldn't base 64 be hexadecimal, just with 6 binary places in the conversion? |
12:58:04 | FromDiscord | <Knedlik> I never looked into it tbh, and I'm not sure if you mean to binary or to deci |
13:02:12 | PMunch | Hexadecimal is base 16, so base 64 is two bits extra, ie. 6 bits |
13:02:28 | PMunch | There is also a bit of logic to do the padding at the end |
13:02:58 | PMunch | Since it doesn't always line up with a byte |
13:06:27 | PMunch | Or rather with three bytes |
13:07:23 | PMunch | The 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:46 | FromDiscord | <ajusa> Are there any proto libraries that support maps? |
13:17:09 | FromDiscord | <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:14 | FromDiscord | <Yardanico> with msvc it seems as fast or even faster |
13:18:17 | FromDiscord | <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:58 | PMunch | @ajusa, you can use this workaround: https://developers.google.com/protocol-buffers/docs/proto3#backwards_compatibility |
13:19:43 | FromDiscord | <ajusa> I'm working with an existing proto definition, I guess I can make a copy and modify it though |
13:20:35 | PMunch | Yeah 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:53 | FromDiscord | <Phil> sent a code paste, see https://paste.rs/zLF |
13:21:18 | PMunch | @ajusa, this might actually work: https://github.com/oskaritimperi/nimpb |
13:21:28 | FromDiscord | <Phil> (edit) "https://play.nim-lang.org/#ix=3WzE" => "https://play.nim-lang.org/#ix=3WzD" |
13:21:29 | FromDiscord | <Yardanico> In reply to @Isofruit "I.... I don't understand.": because it escapes " ? |
13:21:38 | FromDiscord | <Phil> (edit) "https://play.nim-lang.org/#ix=3WzD" => "https://play.nim-lang.org/#ix=3WzF" |
13:21:42 | FromDiscord | <Yardanico> this is quite normal |
13:22:00 | FromDiscord | <Phil> Nono, not the " |
13:22:09 | FromDiscord | <Phil> I don't care about that one, that goes away with parsing the JSON |
13:22:09 | FromDiscord | <Yardanico> the unicode - it's the same |
13:22:11 | FromDiscord | <Yardanico> in JSON \ |
13:22:12 | FromDiscord | <Phil> Look at "Jozai" |
13:22:12 | FromDiscord | <Yardanico> \ |
13:22:15 | FromDiscord | <Yardanico> yes that's normal |
13:22:25 | FromDiscord | <Yardanico> \u008 is how unicode is encoded in JSON |
13:22:29 | FromDiscord | <Yardanico> d |
13:22:42 | FromDiscord | <Yardanico> I'm still not sure what is the problem you're having with this |
13:22:44 | FromDiscord | <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:09 | FromDiscord | <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:10 | FromDiscord | <Yardanico> again |
13:23:21 | FromDiscord | <Yardanico> try printing a specific field instead of the whole json |
13:23:42 | FromDiscord | <Phil> That's my browser output of the parsed JSON there https://media.discordapp.net/attachments/371759389889003532/969589797964357652/unknown.png |
13:24:30 | FromDiscord | <Yardanico> is this a surrogate by any chance |
13:24:32 | FromDiscord | <Yardanico> hmm |
13:24:53 | FromDiscord | <Phil> For reference how a similar token from my Django backend gets parsed |
13:24:55 | FromDiscord | <Phil> https://media.discordapp.net/attachments/371759389889003532/969590104429588531/unknown.png |
13:25:33 | FromDiscord | <Knedlik> I love that I have to convert this to ASCII https://vladar4.github.io/sdl2_nim/private/keycode.html#Keymod |
13:25:47 | FromDiscord | <Knedlik> Any idea how not to do a case for everything? |
13:25:50 | FromDiscord | <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:47 | FromDiscord | <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:41 | PMunch | Not quite sure what you mean @Knedlik |
13:28:39 | FromDiscord | <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:06 | PMunch | What do you mean by "Convert it to ASCII" |
13:29:15 | FromDiscord | <Yardanico> just check where the letter starts and subtract/add it to get the ascii code |
13:29:16 | FromDiscord | <Yardanico> simple |
13:29:32 | PMunch | That works for the letters |
13:29:39 | FromDiscord | <Knedlik> What? |
13:29:41 | PMunch | But not for the numbers or the rest of it |
13:29:57 | FromDiscord | <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:02 | FromDiscord | <Knedlik> Yeah, if we take the scancodes, it's USB format |
13:30:23 | FromDiscord | <Yardanico> ah wait not 6 lol |
13:30:43 | FromDiscord | <Knedlik> lowercase a is 61 |
13:30:45 | FromDiscord | <Yardanico> yes |
13:31:01 | FromDiscord | <Yardanico> the same for numbers and other things |
13:31:01 | FromDiscord | <Yardanico> sent a code paste, see https://play.nim-lang.org/#ix=3WzH |
13:31:07 | FromDiscord | <Yardanico> just check the offset between your scancode enum and the ascii table |
13:31:40 | FromDiscord | <Knedlik> Except it's the wrong order for ACII |
13:31:46 | FromDiscord | <Knedlik> (edit) "ACII" => "ASCII" |
13:31:53 | FromDiscord | <Yardanico> no? |
13:31:58 | FromDiscord | <Yardanico> it goes from a to z |
13:31:59 | PMunch | Wouldn't scancodeToKeycode work? |
13:32:07 | FromDiscord | <Yardanico> that too :P |
13:32:16 | PMunch | I think they meant lowercase before uppercase |
13:32:19 | FromDiscord | <Knedlik> Yes, a to z, but what about other chars? |
13:32:33 | FromDiscord | <Yardanico> In reply to @Knedlik "Yes, a to z,": you handle them differently of course? |
13:32:41 | FromDiscord | <Yardanico> i showed you one branch in a case statement, you add numbers and other stuff |
13:32:48 | FromDiscord | <Yardanico> also @Knedlik do you want to use this for actual text input? |
13:32:52 | FromDiscord | <Knedlik> No |
13:32:53 | PMunch | @Knedlik, `scancodeToKeycode(myscancode).char`, try that |
13:34:14 | FromDiscord | <Knedlik> Wait, is Keycode ASCII? |
13:34:54 | FromDiscord | <Knedlik> My god I think it is |
13:35:34 | FromDiscord | <d4rckh> how can i return stuff from an async function? |
13:35:57 | FromDiscord | <Yardanico> In reply to @d4rckh "how can i return": not sure what you mean, `return` just works |
13:36:05 | FromDiscord | <Yardanico> asyncmacro takes care of it |
13:36:06 | PMunch | What 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:19 | FromDiscord | <Phil> I feel like nim and json parse the b64 string differently |
13:36:25 | FromDiscord | <Yardanico> In reply to @Isofruit "I feel like nim": doubt it |
13:36:30 | FromDiscord | <d4rckh> In reply to @Yardanico "not sure what you": nothing like resolve from javascript? |
13:36:33 | PMunch | @d4rckh, but your return type needs to be `Future[<actual return type>]` |
13:36:35 | FromDiscord | <Yardanico> In reply to @d4rckh "nothing like resolve from": what does this do? |
13:36:48 | FromDiscord | <Yardanico> my guess is that it gets converted into a utf-16 surrogate or something like that |
13:36:55 | FromDiscord | <Phil> (edit) "json" => "js" |
13:37:11 | FromDiscord | <d4rckh> In reply to @PMunch "<@648552095531663361>, but your return": oh, okay, thanks |
13:37:14 | FromDiscord | <Phil> sent a code paste, see https://paste.rs/6Zo |
13:37:15 | PMunch | @Phil, that sounds highly unlikely |
13:37:34 | FromDiscord | <Phil> Wups, forgot the output one sec |
13:37:44 | FromDiscord | <Yardanico> but the result is the same |
13:38:01 | FromDiscord | <Phil> Only kinda, I want the damn unicode interpreted correctly |
13:38:04 | FromDiscord | <Phil> (edit) "https://play.nim-lang.org/#ix=3WzL" => "https://play.nim-lang.org/#ix=3WzK" |
13:38:18 | FromDiscord | <Yardanico> but _it is_ correct |
13:38:28 | FromDiscord | <Yardanico> ok, let me show you |
13:38:31 | FromDiscord | <Yardanico> `Å\u008` - two unicode letters |
13:38:39 | PMunch | @Phil, not sure if I get the issue? http://ix.io/3WzM/ |
13:38:48 | FromDiscord | <Yardanico> Å is U+00C5 and \u008d is U+008D |
13:38:56 | FromDiscord | <Yardanico> check ō - it's 0xC5 0x8D |
13:39:14 | FromDiscord | <Yardanico> it's two bytes, yes |
13:39:29 | FromDiscord | <aph> reminds me of scary utf16 things, not sure if related |
13:39:37 | FromDiscord | <Yardanico> your browser just can't handle two-byte unicode symbols in that console for some reason |
13:40:08 | PMunch | @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:24 | PMunch | But it uses a different escape format from the browser |
13:40:43 | FromDiscord | <Yardanico> In reply to @Isofruit "": can you paste base64 of that django token? |
13:41:02 | FromDiscord | <Phil> > "eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJ0b2tlbl90eXBlIjoiYWNjZXNzIiwiZXhwIjoxNjUxMTg0OTQzLCJqdGkiOiIwN2YwMDgxMjFjMzQ0ZTFkYTJlODVlZWI4ZmJiMjYzYyIsInVzZXJfaWQiOjEwLCJ1c2VyX25hbWUiOiJDYWl0cmlvbmEiLCJpc0FkbWluIjpmYWxzZSwiaXNTdXBlclVzZXIiOmZhbHNlLCJjYW1wYWlnbl9tZW1iZXJzaGlwcyI6eyJhbGRydW5lIjoibWVtYmVyIiwialx1MDE0ZHphaSBjb3JwIjoiYWRtaW4ifX0.qDUopyykgnTA2jae6Ixw5uPAbhu_uWlbKHeu45pghzY"↵Full token for one user |
13:42:00 | FromDiscord | <Yardanico> j\u014d |
13:42:14 | FromDiscord | <Rika> In reply to @Yardanico "with msvc it seems": “Duh, Microsoft made it after all” lol |
13:42:16 | FromDiscord | <Yardanico> so in this case it's a utf-16 character |
13:42:25 | FromDiscord | <Yardanico> In reply to @Rika "“Duh, Microsoft made it": it's also fast on linux |
13:42:30 | FromDiscord | <Rika> I was joking ;; |
13:42:32 | FromDiscord | <Phil> So the encoding is different |
13:42:52 | FromDiscord | <Rika> In reply to @Yardanico "it's also fast on": Could be a coincidence xd |
13:43:00 | PMunch | @Phil: http://ix.io/3WzN/ |
13:43:10 | FromDiscord | <Rika> Or rather doesn’t Microsoft like Linux now too xdd |
13:43:17 | PMunch | It seems the token is split into parts with .'s (those aren't valid base64) |
13:43:28 | FromDiscord | <Yardanico> yeah, but the main part about the unicode thing is still there |
13:43:57 | FromDiscord | <Phil> This just makes me want to forbid non ascii everywhere dear lord |
13:44:10 | PMunch | Yardanico, which unicode part? |
13:44:18 | FromDiscord | <Yardanico> In reply to @PMunch "<@177365113899057152>, which unicode part?": j\\u014dzai corp |
13:44:31 | PMunch | Oh right |
13:44:43 | FromDiscord | <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:49 | FromDiscord | <Yardanico> https://www.compart.com/en/unicode/U+014D |
13:45:14 | FromDiscord | <Rika> Why is it defaulting to UTF-16 though |
13:45:18 | FromDiscord | <2F42BBA1> sent a code paste, see https://paste.rs/6Ju |
13:45:39 | FromDiscord | <Yardanico> In reply to @2F42BBA1 "How this python code": naked except is a really bad practice, but whatever: |
13:45:42 | PMunch | Better? http://ix.io/3WzN/ |
13:45:51 | PMunch | You just need to parse JSON as JSON |
13:46:04 | FromDiscord | <Yardanico> sent a code paste, see https://paste.rs/u3t |
13:46:05 | PMunch | @Rika, because Windows |
13:46:40 | FromDiscord | <Rika> It should only matter when interfacing with windows no |
13:46:46 | FromDiscord | <2F42BBA1> sent a code paste, see https://paste.rs/yFc |
13:46:46 | FromDiscord | <Yardanico> In reply to @Rika "It should only matter": no |
13:46:54 | PMunch | Microsoft 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:48 | FromDiscord | <Phil> I'll start googling for some sort of way for JS to convert unicode chars |
13:47:58 | PMunch | @Phil, did you see my codepaste? |
13:48:07 | PMunch | Which does exactly that? |
13:48:21 | FromDiscord | <Yardanico> @PMunch it's not exactly readable ;) |
13:48:28 | FromDiscord | <Yardanico> newlines got eaten by something |
13:48:40 | PMunch | Oh, remove the trailing slash in the URL |
13:48:45 | FromDiscord | <Yardanico> ah right |
13:49:00 | PMunch | It's just ix trying to pass it through some Python library and failing miserably |
13:49:40 | PMunch | Wait, it didn't update |
13:49:42 | FromDiscord | <Phil> Oh that looks SO Much more readable, I've been scanning through that for a solid 5 minutes now |
13:50:15 | FromDiscord | <Rika> Lol |
13:50:15 | PMunch | http://ix.io/3WzP |
13:50:27 | PMunch | There, that's the improved version which actually parses the JSON |
13:50:35 | PMunch | @Phil, oh sorry about that :P |
13:50:53 | PMunch | I'm seriously considering writing my own paste service.. |
13:50:54 | FromDiscord | <Yardanico> In reply to @PMunch "<@873685814071132200>, that's the improved": poor soul who named themselves "there" |
13:50:59 | FromDiscord | <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:00 | FromDiscord | <Yardanico> (on discord) |
13:51:04 | PMunch | Just for myself, ix has been a bit unreliable |
13:51:41 | PMunch | @Phil, why can't you just use that on the frontend? |
13:52:04 | FromDiscord | <Phil> Angular frontend |
13:52:07 | FromDiscord | <Phil> Not karax |
13:52:13 | PMunch | Yardanico, haha that's indeed a poor choice of username |
13:52:45 | FromDiscord | <Phil> And with browser JS I still get... wait |
13:52:59 | PMunch | @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:48 | PMunch | Oh well, I'm off |
13:53:54 | * | PMunch quit (Quit: Leaving) |
14:05:28 | FromDiscord | <Phil> `decodeURIComponent(escape(x))` to the rescue |
14:07:05 | FromDiscord | <2F42BBA1> sent a code paste, see https://play.nim-lang.org/#ix=3WzR |
14:07:18 | FromDiscord | <2F42BBA1> it seems it expect a type? |
14:07:23 | FromDiscord | <Yardanico> change the name |
14:07:32 | FromDiscord | <Yardanico> your proc name conflicts with the `clip` from cliptomania |
14:07:47 | FromDiscord | <Yardanico> to be fair, cliptomania should've named the type `Clip` instead of just `clip` |
14:07:54 | FromDiscord | <Yardanico> but it is what it is, so rename your proc to something else |
14:14:13 | FromDiscord | <2F42BBA1> In reply to @Yardanico "but it is what": YES I DID IT |
14:14:19 | FromDiscord | <Yardanico> okay |
14:14:19 | FromDiscord | <2F42BBA1> FINALLY IT COMPILES! |
14:14:34 | FromDiscord | <2F42BBA1> second nim thing is done 🚎 |
14:23:50 | FromDiscord | <exelotl> is there a safe way to navigate XML trees? |
14:24:12 | FromDiscord | <exelotl> I wanna do like `let author = entry.child("author").child("name")[0].text` |
14:24:40 | FromDiscord | <exelotl> but if anything along the way is nil it segfaults |
14:31:29 | FromDiscord | <Solitude> In reply to @exelotl "is there a safe": there is a wrapnils module written by timo |
14:31:35 | FromDiscord | <Solitude> but its written by timo |
14:31:41 | FromDiscord | <Knedlik> sent a code paste, see https://paste.rs/jpp |
14:32:04 | FromDiscord | <Solitude> In reply to @Knedlik "Hey guys, another problem": thats crazy |
14:32:12 | FromDiscord | <Knedlik> What's crazy? |
14:32:27 | FromDiscord | <Solitude> what you're telling us |
14:32:30 | FromDiscord | <Solitude> bonkers |
14:32:41 | FromDiscord | <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:44 | FromDiscord | <Knedlik> I mean when running output |
14:33:01 | FromDiscord | <Knedlik> what? |
14:33:07 | FromDiscord | <Yardanico> In reply to @Knedlik "what?": your Vector2 is a ref |
14:33:11 | FromDiscord | <Yardanico> you have to initialize it as well |
14:33:19 | FromDiscord | <Yardanico> but I have absolutely no clue why would you ever want Vector2 to be a ref |
14:33:42 | FromDiscord | <Knedlik> Pretty sure it is initialized in the engine |
14:33:56 | FromDiscord | <Yardanico> In reply to @Knedlik "Pretty sure it *is*": ??? how |
14:33:57 | FromDiscord | <Knedlik> But... text isn't init |
14:34:03 | FromDiscord | <Yardanico> this is how you create it https://media.discordapp.net/attachments/371759389889003532/969607497306480640/unknown.png |
14:34:05 | FromDiscord | <Knedlik> Could that be the problem? |
14:34:12 | FromDiscord | <Yardanico> you don't initialize pos here |
14:34:25 | FromDiscord | <Knedlik> oh wait I get it |
14:34:35 | FromDiscord | <Yardanico> but seriously, please make Vector2 a proper value type |
14:34:44 | FromDiscord | <Yardanico> this is not java, you don't need pointer indirections everywhere |
14:35:30 | FromDiscord | <Yardanico> sent a code paste, see https://paste.rs/DPl |
14:38:44 | FromDiscord | <Ruby fan.rb> In reply to @Yardanico "this is not java,": java has pointerS? |
14:38:56 | FromDiscord | <Yardanico> In reply to @Ruby fan.rb "java has pointerS?": references are pointers internally |
14:39:01 | FromDiscord | <Ruby fan.rb> well |
14:39:03 | FromDiscord | <Yardanico> so yes, it's still a "pointer indirection" |
14:39:09 | FromDiscord | <Ruby fan.rb> this is an interesting advancement |
14:39:14 | FromDiscord | <Yardanico> meaning that you have to dereference a pointer to get its value |
14:39:37 | * | duuude joined #nim |
14:42:58 | FromDiscord | <d4rckh> how do i check if an element exists at an index in a sequence?\ |
14:43:23 | FromDiscord | <Solitude> you check if index is less than sequence length? |
14:43:25 | FromDiscord | <Solitude> what? |
14:43:31 | FromDiscord | <d4rckh> good idea, thanks |
14:46:03 | FromDiscord | <Ruby fan.rb> sent a code paste, see https://play.nim-lang.org/#ix=3WA0 |
14:46:29 | FromDiscord | <d4rckh> thanks |
14:46:48 | FromDiscord | <spoon> wouldn't it be arrayIndex - 1? |
14:48:41 | FromDiscord | <Knedlik> I don't think I understand the difference between `ref object` and `object` |
14:50:19 | FromDiscord | <d4rckh> its just arrayIndex |
14:50:25 | FromDiscord | <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:48 | FromDiscord | <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:11 | FromDiscord | <Knedlik> And why do I get can't assign to `object.field`? |
14:51:11 | FromDiscord | <Yardanico> `ref object` ideally should only be used for shared ownership, in all other cases you don't need it |
14:51:20 | FromDiscord | <Yardanico> In reply to @Knedlik "And why do I": maybe show an error? |
14:51:28 | NimEventer | New thread by Foderking: Intersection types in nim?, see https://forum.nim-lang.org/t/9131 |
14:51:30 | FromDiscord | <Knedlik> one moment |
14:52:30 | FromDiscord | <Knedlik> sent a code paste, see https://play.nim-lang.org/#ix=3WA1 |
14:52:51 | FromDiscord | <Yardanico> first of all, `object`'s don't need `method` |
14:53:00 | FromDiscord | <Yardanico> `method` is only needed if you need dynamic dispatch (so inheritance) |
14:53:18 | FromDiscord | <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:24 | FromDiscord | <Yardanico> so `graphic: var Graphic` instead of just `graphic: Graphic` |
14:53:36 | FromDiscord | <Knedlik> Ooooh |
14:53:45 | FromDiscord | <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:46 | FromDiscord | <d4rckh> how could i view the output a command im running via e.g. execCmdEx in real time? |
14:58:08 | FromDiscord | <Yardanico> In reply to @d4rckh "how could i view": poParentStreams |
14:58:32 | FromDiscord | <Yardanico> `discard execCmdEx("cmd", {poStdErrToStdOut, poUsePath, poParentStreams})` |
14:58:48 | FromDiscord | <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:57 | FromDiscord | <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:11 | FromDiscord | <Solitude> yes, windows is shit |
15:00:16 | FromDiscord | <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:21 | FromDiscord | <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:25 | FromDiscord | <Yardanico> and detect innocent Nim code as dangerous |
15:00:36 | FromDiscord | <Yardanico> see https://github.com/nim-lang/Nim/issues/17820 for the main discussion |
15:00:47 | FromDiscord | <sour> oh damn that's shitty pr |
15:00:50 | FromDiscord | <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:06 | FromDiscord | <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:16 | FromDiscord | <d4rckh> yeah but its never finishing |
15:01:21 | FromDiscord | <Yardanico> hm |
15:01:28 | FromDiscord | <d4rckh> and i want to debug this a bit, thats why trying to view the output of the command |
15:01:34 | FromDiscord | <d4rckh> (edit) "and i want to debug this a bit, thats why ... trying" added "im" |
15:01:38 | FromDiscord | <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:03 | FromDiscord | <spoon> love virustotaling nim programs i compiled myself |
15:04:29 | FromDiscord | <Knedlik> Pretty sure 1.7.1 doesn't have this issue |
15:04:30 | FromDiscord | <spoon> norton doesn't seem to mind anymore but virustotal says malwarebytes thinks its a trojan |
15:04:47 | FromDiscord | <Knedlik> Atleast not with Avast |
15:04:54 | FromDiscord | <spoon> the polymorph example project is |
15:05:06 | FromDiscord | <Yardanico> In reply to @Knedlik "Atleast not with Avast": it's not about nim version |
15:05:14 | FromDiscord | <Yardanico> it's about a specific combination of version + compiler |
15:06:31 | FromDiscord | <spoon> what malware decided to use nim anyway? |
15:07:25 | FromDiscord | <Yardanico> In reply to @spoon "what malware decided to": you can find some news articles from 2020-2021 |
15:07:53 | FromDiscord | <Solitude> In reply to @spoon "what malware decided to": its infamous door-o-bot malware |
15:08:02 | FromDiscord | <Solitude> dont look it up |
15:08:03 | FromDiscord | <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:46 | FromDiscord | <spoon> why are they detecting all nim programs, though? are they reading symbols? |
15:08:56 | FromDiscord | <Knedlik> I have one more question with ref objs - should objects inheriting stuff be refs or not? |
15:08:58 | FromDiscord | <Yardanico> https://medium.com/walmartglobaltech/investigation-into-the-state-of-nim-malware-part-2-a28bffffa671 |
15:09:24 | FromDiscord | <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:24 | FromDiscord | <d4rckh> In reply to @Yardanico "hm": do you have any idea why that happens? |
15:09:33 | FromDiscord | <Yardanico> In reply to @Knedlik "I have one more": if you need dynamic dispatch, yes, otherwise not |
15:09:34 | FromDiscord | <spoon> In reply to @Knedlik "I have one more": ref objects are used for inheritance, yes |
15:09:41 | FromDiscord | <Yardanico> In reply to @spoon "ref objects are used": not quite |
15:09:44 | FromDiscord | <Yardanico> you don't need ref for inheritance |
15:09:58 | FromDiscord | <spoon> hm |
15:10:27 | FromDiscord | <Yardanico> sent a code paste, see https://play.nim-lang.org/#ix=3WAg |
15:10:39 | FromDiscord | <Yardanico> but again, typically with object inheritance you also want dynamic dispatch, so then you really have to use `ref` |
15:12:51 | FromDiscord | <Knedlik> Uhh |
15:13:46 | FromDiscord | <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:00 | FromDiscord | <Yardanico> normal loop calls `items` |
15:14:04 | FromDiscord | <Yardanico> for mutable iteration you want `mitems` |
15:14:24 | FromDiscord | <Yardanico> sent a code paste, see https://play.nim-lang.org/#ix=3WAj |
15:14:32 | FromDiscord | <Knedlik> ahhh |
15:14:34 | FromDiscord | <Yardanico> nim is full of sugar, for loops don't actually exist |
15:14:40 | FromDiscord | <Knedlik> Why not just make it simple |
15:14:45 | FromDiscord | <Yardanico> In reply to @Knedlik "Why not just make": how? |
15:14:49 | FromDiscord | <Knedlik> idk |
15:14:51 | FromDiscord | <Yardanico> that would prevent optimizations |
15:15:02 | FromDiscord | <Yardanico> if you don't want to mutate, then the loop can for example only give you a view |
15:15:16 | FromDiscord | <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:41 | FromDiscord | <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:57 | FromDiscord | <Yardanico> that said, nimFrame is only there in debug releases |
15:16:04 | FromDiscord | <Yardanico> it's for stack traces |
15:16:17 | FromDiscord | <spoon> i'll try scanning again with -d:danger |
15:16:19 | FromDiscord | <Yardanico> if you compile with a lot of flags then you only have a few nim-specific symbols left |
15:16:25 | FromDiscord | <Yardanico> also don't forget to strip away the names from the binray |
15:16:28 | FromDiscord | <Yardanico> (edit) "binray" => "binary" |
15:16:38 | FromDiscord | <spoon> what flags? |
15:17:22 | FromDiscord | <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:31 | FromDiscord | <Yardanico> and for linux binaries you can also add `--os:any -d:posix` |
15:17:42 | * | rez joined #nim |
15:18:14 | FromDiscord | <Yardanico> https://github.com/Yardanico/mimalloc_nim/commit/fb44c9727334fe3cb4e19c568fd0e477c457cc21 man-made horrors beyond comprehension |
15:18:18 | FromDiscord | <Yardanico> sent a code paste, see https://paste.rs/Ez6 |
15:19:21 | FromDiscord | <spoon> malwarebytes still recognizes it as trojan.cobaltstrike |
15:19:32 | FromDiscord | <Knedlik> sent a code paste, see https://play.nim-lang.org/#ix=3WAl |
15:19:42 | FromDiscord | <Knedlik> (edit) "https://paste.rs/BSr" => "https://play.nim-lang.org/#ix=3WAl" |
15:19:48 | FromDiscord | <Yardanico> sent a code paste, see https://paste.rs/xKD |
15:19:53 | FromDiscord | <Knedlik> Oh man am I blind af |
15:19:56 | FromDiscord | <Yardanico> also, if you still want to keep using inheritance with dynamic dispatch, give up on non-ref objects |
15:20:11 | FromDiscord | <Knedlik> this is the root |
15:20:14 | FromDiscord | <Yardanico> yes |
15:20:28 | FromDiscord | <Knedlik> it only inherits RootObj, do I really need ref? |
15:20:44 | FromDiscord | <Yardanico> no, I mean if you need dynamic dispatch |
15:20:55 | FromDiscord | <Knedlik> You wouldn't ever even use the root anyway |
15:20:56 | FromDiscord | <Yardanico> e.g. have a seq of two objects that inherit from same base and call their methods |
15:21:02 | FromDiscord | <Yardanico> then you need ref and methods |
15:21:03 | FromDiscord | <Knedlik> You only use children |
15:21:20 | FromDiscord | <treeform> In reply to @Isofruit "I think so far": Does it work with quickjwt? |
15:21:45 | FromDiscord | <Yardanico> btw @treeform have you tried mimalloc for your programs? to speed them up maybe |
15:21:59 | FromDiscord | <Yardanico> although it's only relevant in allocation-heavy code and your libraries are usually already very well optimized :) |
15:33:00 | FromDiscord | <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:30 | FromDiscord | <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:52 | FromDiscord | <huantian> Wait browser don’t use UTF8? |
15:34:00 | FromDiscord | <huantian> (edit) "browser" => "browsers" | "browsersdon’t use UTF8? ... " added "Didn’t know that" |
15:34:01 | FromDiscord | <Yardanico> In reply to @huantian "Wait browsers don’t use": json utf-16 |
15:34:12 | FromDiscord | <Phil> That's what I got from this question: https://stackoverflow.com/questions/13356493/decode-utf-8-with-javascript |
15:34:27 | FromDiscord | <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:35 | FromDiscord | <Phil> From one of the comments there |
15:34:59 | FromDiscord | <2F42BBA1> is there a way to keep an app run forever? |
15:35:00 | FromDiscord | <Phil> "escape" has been deprecated for 7 years now btw and still is the only way to properly solve my problem |
15:35:10 | FromDiscord | <2F42BBA1> when i open it, my thing instantly quits |
15:35:21 | FromDiscord | <Rika> In reply to @2F42BBA1 "is there a way": A while loop that never ends? |
15:36:57 | FromDiscord | <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:05 | FromDiscord | <SirElephant> how do make a folder using nim? |
15:38:17 | FromDiscord | <SirElephant> i am making a clone of `cargo run` |
15:38:17 | FromDiscord | <Yardanico> In reply to @SirElephant "how do make": check the `os` module |
15:38:25 | FromDiscord | <Yardanico> https://nim-lang.org/docs/os.html |
15:38:29 | FromDiscord | <SirElephant> thenks |
15:38:58 | FromDiscord | <Rika> In reply to @SirElephant "i am making a": Nimble has a run sub command? |
15:39:28 | FromDiscord | <SirElephant> sor? |
15:39:31 | FromDiscord | <SirElephant> (edit) "sor?" => "sory?" |
15:39:47 | FromDiscord | <SirElephant> i am not mking a cli |
15:39:53 | FromDiscord | <Yardanico> 🤔 |
15:40:07 | FromDiscord | <SirElephant> just run the exe and get the folder and stuff |
15:40:33 | FromDiscord | <SirElephant> ik it's dumb |
15:47:18 | * | lumo_e quit (Ping timeout: 250 seconds) |
15:58:14 | FromDiscord | <Rika> Cargo is CLI though? |
15:58:16 | * | vicfred quit (Quit: Leaving) |
15:58:25 | FromDiscord | <Rika> I’m confused |
16:01:00 | FromDiscord | <spoon> simply rewrite another languages package manager in nim |
16:06:36 | FromDiscord | <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:26 | FromDiscord | <huantian> For value type objects, when you initialize it without a value, it uses the default value of each field |
16:07:45 | FromDiscord | <huantian> So there is no difference between not setting it and using a default value |
16:08:02 | FromDiscord | <huantian> Only ref objects can be nil |
16:08:44 | FromDiscord | <Knedlik> sent a code paste, see https://paste.rs/yML |
16:09:00 | FromDiscord | <huantian> If you would like a distinct empty value for your object, use `Option` from `std/options` |
16:09:05 | FromDiscord | <Knedlik> Like if it was init |
16:09:32 | FromDiscord | <aph> `x == default(Object)`? im not too sure if to get the default value of object is `default` |
16:09:41 | FromDiscord | <aph> brb lemme go to docs |
16:10:35 | FromDiscord | <huantian> That’ll work if you know that you will never set the object |
16:10:40 | FromDiscord | <huantian> (edit) "That’ll work if you know that you will never set the object ... " added "to its default value" |
16:10:53 | FromDiscord | <aph> true |
16:11:24 | FromDiscord | <Knedlik> Is there not a proc to find out if a variable was initialized? |
16:12:40 | FromDiscord | <huantian> All variables are initialized |
16:12:45 | FromDiscord | <huantian> Automatically |
16:13:45 | FromDiscord | <Knedlik> sent a code paste, see https://paste.rs/fhQ |
16:14:29 | FromDiscord | <Solitude> y-yeah?.. |
16:14:53 | FromDiscord | <Knedlik> Ah fu- |
16:15:03 | FromDiscord | <Rika> ?? |
16:15:17 | FromDiscord | <Rika> In reply to @huantian "If you would like": Use this if you need optionals |
16:15:49 | FromDiscord | <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:43 | FromDiscord | <d4rckh> @Yardanico i figured out why it was hanging 😂 |
16:16:54 | FromDiscord | <d4rckh> nim also ran the program |
16:17:02 | FromDiscord | <Rika> ???? |
16:17:06 | FromDiscord | <Yardanico> In reply to @d4rckh "nim also ran the": classic |
16:17:15 | FromDiscord | <Rika> Oh you mean on compile? |
16:17:19 | FromDiscord | <d4rckh> ye haha |
16:17:31 | FromDiscord | <Rika> Man’s left the r argument |
16:17:42 | FromDiscord | <d4rckh> yeah exactly |
16:17:44 | FromDiscord | <d4rckh> 🤣 |
16:17:54 | FromDiscord | <d4rckh> omg ive been wasting too much time on this |
16:18:22 | * | disso_peach quit (Quit: Leaving) |
16:20:31 | FromDiscord | <Rika> In reply to @d4rckh "omg ive been wasting": The life of every single programmer man |
16:20:36 | FromDiscord | <Rika> (edit) "programmer" => "programmer," |
16:22:13 | FromDiscord | <2F42BBA1> tbh it sucks ass that most clipboard libraries suck ass |
16:22:18 | FromDiscord | <2F42BBA1> including cliptomania one |
16:22:33 | FromDiscord | <2F42BBA1> probably soonish gotta use winim i guess |
16:23:39 | FromDiscord | <Rika> Clipboard management sucks ass |
16:37:27 | * | gsalazar quit (Ping timeout: 276 seconds) |
16:37:28 | * | rez quit (Quit: much snoozes...) |
16:47:13 | FromDiscord | <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:40 | FromDiscord | <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:31 | FromDiscord | <2F42BBA1> In reply to @Yardanico "btw <@107140179025735680> have you": i would like to use that seems like a cool thing |
17:04:11 | FromDiscord | <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:36 | FromDiscord | <2F42BBA1> In reply to @Knedlik "Hey guys, is it": I know that it's possible C# to load Nim libs |
17:04:46 | FromDiscord | <2F42BBA1> But vice versa no probably |
17:04:49 | FromDiscord | <ajusa> In reply to @Yardanico "made the repo -": Now I gotta try this out with Jester/Httpbeast |
17:05:22 | FromDiscord | <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:45 | FromDiscord | <Knedlik> Yeah, that’s pretty much what I’m looking for |
17:06:01 | FromDiscord | <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:06 | FromDiscord | <2F42BBA1> this thing helped us |
17:06:10 | FromDiscord | <Knedlik> Thx |
17:06:34 | FromDiscord | <2F42BBA1> you are welcome |
17:07:16 | FromDiscord | <Knedlik> Hmmm, now I’m thinking if it’s possible to use Nim in Java lol |
17:07:25 | FromDiscord | <2F42BBA1> In reply to @Knedlik "Hmmm, now I’m thinking": Nah |
17:07:39 | FromDiscord | <2F42BBA1> It's not possible (maybe i am wrong) |
17:07:48 | FromDiscord | <2F42BBA1> But I do know it does work with C# |
17:08:09 | euantorano | 2FA2BBA1: of note, remember to call NimMain() |
17:08:35 | euantorano | When I wrote that blog post all those years ago, there was a Nim bug where NimMain wasn’t exported |
17:09:09 | FromDiscord | <2F42BBA1> In reply to @euantorano "When I wrote that": Well, this post helped me lel |
17:09:13 | FromDiscord | <ajusa> In reply to @Knedlik "Hmmm, now I’m thinking": You can use Java from Nim at least |
17:10:00 | euantorano | And I believe it should be possible to do something similar from Java land using JNI. I’ve never experimented with that though |
17:12:23 | duuude | cool having a domain being same as the irc handle |
17:12:38 | duuude | everytime it gets mentioned you get notified |
17:12:49 | euantorano | Yep |
17:13:35 | euantorano | Yep |
17:15:41 | FromDiscord | <Knedlik> In reply to @2F42BBA1 "Nah": Is is, just not really worth it if you want multi-platform stuff |
17:15:50 | FromDiscord | <Knedlik> (edit) "Is" => "It" |
17:16:27 | FromDiscord | <Knedlik> I think if I really wanted to use my engine in Java, it would be better to just rewrite it |
17:19:57 | FromDiscord | <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:19 | FromDiscord | <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:27 | FromDiscord | <treeform> you are probably right |
17:20:36 | FromDiscord | <treeform> can you give me an example of a token you are trying to do that is breaking |
17:20:38 | FromDiscord | <treeform> i'll add that as a test? |
17:20:55 | FromDiscord | <Phil> The JSON for it? Sure! |
17:21:26 | FromDiscord | <treeform> I would also test what this site does: https://jwt.io/ |
17:21:40 | FromDiscord | <treeform> if it agrees with you then great, if not, its probably the other end that is broken |
17:23:23 | FromDiscord | <treeform> Is this what you get? https://media.discordapp.net/attachments/371759389889003532/969650115340017664/unknown.png |
17:28:32 | FromDiscord | <Phil> on jwt.io? Yeah.↵Within a browser? No |
17:28:39 | FromDiscord | <Phil> (tested with firefox and brave) |
17:30:19 | * | xet7 quit (Remote host closed the connection) |
17:31:11 | FromDiscord | <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:55 | FromDiscord | <Phil> sent a code paste, see https://play.nim-lang.org/#ix=3WAU |
17:33:06 | FromDiscord | <Phil> (edit) |
17:33:14 | FromDiscord | <Phil> (edit) |
17:34:24 | FromDiscord | <Phil> Anyway, if you want to include the testcase, you've got the string for it now ^^ |
17:42:56 | FromDiscord | <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:47 | FromDiscord | <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:51 | FromDiscord | <Knedlik> Guys can a ref object inherit a non-ref object? |
18:29:08 | FromDiscord | <leorize> yes |
18:29:48 | FromDiscord | <Knedlik> but |
18:29:51 | FromDiscord | <Knedlik> sent a code paste, see https://play.nim-lang.org/#ix=3WBa |
18:30:03 | FromDiscord | <Knedlik> sent a code paste, see https://play.nim-lang.org/#ix=3WBc |
18:30:12 | FromDiscord | <leorize> you have to dereference your object |
18:30:30 | FromDiscord | <Knedlik> oh |
18:30:33 | FromDiscord | <Knedlik> thx lol |
18:32:57 | FromDiscord | <Knedlik> hmmmm |
18:33:12 | FromDiscord | <Knedlik> sent a code paste, see https://play.nim-lang.org/#ix=3WBd |
18:33:28 | FromDiscord | <Knedlik> this throws `SIGSEGV: Illegal storage access. (Attempt to read from nil?)` on `graphic.w = surface[].w` |
18:33:58 | FromDiscord | <Knedlik> like wtf |
18:35:47 | * | pch quit (Remote host closed the connection) |
18:39:38 | * | pch joined #nim |
18:45:52 | FromDiscord | <Knedlik> sent a code paste, see https://play.nim-lang.org/#ix=3WBe |
18:46:03 | FromDiscord | <Knedlik> With https://github.com/Periapsis-Studios/Periapsis-Engine |
18:46:25 | FromDiscord | <Knedlik> I'm really losing my mind |
18:52:52 | FromDiscord | <Alea> What in the sam hell does this mean https://media.discordapp.net/attachments/371759389889003532/969672633991962654/Screenshot_20220429-145228.jpg |
19:02:19 | FromDiscord | <TheFallen0ne> sent a code paste, see https://play.nim-lang.org/#ix=3WBh |
19:07:07 | FromDiscord | <Solitude> In reply to @TheFallen0ne "hello guys! I am": whats wrong with instantiationInfo? |
19:08:26 | FromDiscord | <TheFallen0ne> I need the full path of the actual executable. It returns "Script.nim". |
19:09:06 | FromDiscord | <Solitude> you need path of executable or of the nim file? |
19:09:11 | FromDiscord | <enthus1ast> os.getAppFilename |
19:09:30 | FromDiscord | <enthus1ast> import os↵echo getAppFilename |
19:09:52 | FromDiscord | <TheFallen0ne> In reply to @enthus1ast "import os echo getAppFilename": works!!!! Thank you soooo much. : ) |
19:10:17 | FromDiscord | <TheFallen0ne> In reply to @Solitude "you need path of": the exe. getAppFilename seems to do the trick 😄 |
19:10:20 | FromDiscord | <Solitude> thats completely different from what you asked initially |
19:12:02 | FromDiscord | <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:15 | FromDiscord | <enthus1ast> better use\:↵↵echo getAppDir() / getAppFilename() |
19:16:49 | FromDiscord | <TheFallen0ne> In reply to @enthus1ast "better use\: echo": oh ok thanks 😄 |
19:17:19 | * | lumo_e quit (Ping timeout: 272 seconds) |
19:29:16 | FromDiscord | <kaletaa> my name jefff |
19:30:36 | FromDiscord | <spoon> hi jeff |
19:30:45 | FromDiscord | <kaletaa> are you spoonm from the telegram |
19:30:51 | FromDiscord | <ynfle> ? |
19:30:54 | FromDiscord | <ynfle> sent a code paste, see https://play.nim-lang.org/#ix=3WBm |
19:31:00 | FromDiscord | <spoon> who the heck is telegram |
19:31:06 | FromDiscord | <kaletaa> ok!!!| |
19:32:10 | FromDiscord | <spoon> i don't think there's a discord <-> telegram bridge |
19:32:23 | FromDiscord | <spoon> if not i have never used telegram in my life |
19:32:53 | FromDiscord | <kaletaa> it's fine, there was a guy named spoonm on telegram |
19:33:00 | FromDiscord | <kaletaa> think he used haskell but i don't remember exactly |
19:33:11 | FromDiscord | <spoon> i have also never used haskell in my life |
19:33:13 | FromDiscord | <Knedlik> In reply to @ynfle "What's the code": https://github.com/Periapsis-Studios/Periapsis-Engine |
19:33:21 | FromDiscord | <kaletaa> In reply to @spoon "i have also never": heretic |
19:34:28 | FromDiscord | <spoon> i used it on the homepage just now so i'm good |
19:35:28 | FromDiscord | <kaletaa> you dont get it.... |
19:35:36 | * | ehmry quit (Ping timeout: 246 seconds) |
19:36:05 | FromDiscord | <spoon> i'm a haskell developer now |
19:36:25 | FromDiscord | <spoon> now i don't have to deal with it ever again |
19:37:15 | FromDiscord | <spoon> haskell isn't the one with lots of lambda functions, is it? |
19:37:27 | FromDiscord | <kaletaa> well |
19:37:31 | FromDiscord | <kaletaa> that depends |
19:37:36 | FromDiscord | <kaletaa> on how you use it |
19:37:39 | FromDiscord | <spoon> rather known for its lambda functions |
19:37:51 | FromDiscord | <kaletaa> most FP languages are lambda heavy |
19:39:12 | * | noeontheend joined #nim |
19:40:54 | FromDiscord | <spoon> sent a code paste, see https://play.nim-lang.org/#ix=3WBo |
19:41:19 | FromDiscord | <spoon> even when casting to int |
19:46:05 | * | ehmry joined #nim |
19:50:41 | FromDiscord | <ynfle> You definition doesn't expect a return value of int |
19:51:15 | FromDiscord | <ynfle> sent a code paste, see https://play.nim-lang.org/#ix=3WBq |
19:51:39 | FromDiscord | <ynfle> In reply to @Knedlik "https://github.com/Periapsis-Studios/Periapsis-Engi": Your code is what calls the engine isn't it? |
19:52:24 | FromDiscord | <Knedlik> I’m afraid I don’t understand the question - my code calls setActive() on a child of Scene |
19:55:26 | FromDiscord | <Knedlik> sent a code paste, see https://play.nim-lang.org/#ix=3WBt |
20:06:05 | * | noeontheend quit (Ping timeout: 272 seconds) |
20:29:29 | FromDiscord | <Knedlik> @ynfle so any idea? |
20:33:15 | * | noeontheend joined #nim |
20:41:31 | * | lumo_e joined #nim |
20:55:04 | FromDiscord | <spoon> sent a code paste, see https://play.nim-lang.org/#ix=3WBG |
20:55:19 | FromDiscord | <spoon> i think it should just be `surface.w` and `surface.h` |
20:55:40 | FromDiscord | <Knedlik> Pretty sure that threw me an error, surface is a pointer |
20:56:46 | FromDiscord | <spoon> ah surface is also a type in sdl2_nim |
20:57:33 | FromDiscord | <spoon> does loadJPG_RW return a sdl.Surface? |
20:57:46 | FromDiscord | <Knedlik> It should, lemme check |
20:58:18 | FromDiscord | <Knedlik> Yep |
20:58:49 | FromDiscord | <spoon> https://github.com/Vladar4/sdl2_nim/blob/43bbdb99e01aa3d2117fc536dd6b0ed3280791a9/examples/ex402_panning.nim#L248 |
20:59:39 | FromDiscord | <Knedlik> Interesting |
20:59:58 | FromDiscord | <spoon> still square brackets shouldn't be there |
21:00:02 | FromDiscord | <spoon> (edit) "still ... square" added "think" |
21:00:35 | FromDiscord | <spoon> they're just components of a Surface object |
21:00:48 | FromDiscord | <spoon> w and h are |
21:01:20 | FromDiscord | <Knedlik> I’ll try tommorow, thx |
21:02:42 | * | jmdaemon joined #nim |
21:03:35 | * | noeontheend quit (Ping timeout: 256 seconds) |
21:21:39 | FromDiscord | <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:41 | FromDiscord | <Phytolizer> sent a code paste, see https://play.nim-lang.org/#ix=3WBQ |
21:49:38 | FromDiscord | <Elegantbeef> Yes |
21:50:56 | FromDiscord | <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:01 | FromDiscord | <ambient> they are inputs to some OpenGL commands |
21:52:16 | FromDiscord | <Elegantbeef> I'd say you dont |
21:52:29 | FromDiscord | <Elegantbeef> Save the image as a coresponding file format and load it at compile time |
21:53:24 | FromDiscord | <Elegantbeef> Nim isnt C you can do this without the tedium of including a long array like this |
21:54:43 | FromDiscord | <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:00 | FromDiscord | <Elegantbeef> I mean it's not really required for Nim |
21:55:11 | FromDiscord | <Elegantbeef> You make a file contain the binary stream you want then do `staticRead` |
21:55:22 | FromDiscord | <Elegantbeef> there is no need of declaring arrays like this |
21:56:00 | FromDiscord | <ambient> ok I'll look into it |
21:56:09 | FromDiscord | <Elegantbeef> If you must you just make an array |
21:56:52 | FromDiscord | <Elegantbeef> sent a code paste, see https://play.nim-lang.org/#ix=3WBS |
21:56:56 | FromDiscord | <Elegantbeef> Jeez i messed that up |
21:57:04 | FromDiscord | <ambient> it's just that I'm converting a C library that only has that header file, no actual image files |
21:57:15 | FromDiscord | <ambient> so I have to construct completely different image atlas |
21:57:19 | FromDiscord | <Elegantbeef> sent a code paste, see https://play.nim-lang.org/#ix=3WBT |
21:58:10 | FromDiscord | <Elegantbeef> The latter would be `muRect: array[requiredSize, array[4, int]]` |
21:58:19 | FromDiscord | <ambient> ok thanks |
21:58:32 | FromDiscord | <Elegantbeef> But yea modern languages generally skip the middle man and just load files directly |
21:58:51 | FromDiscord | <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:14 | rockcavera | it seems to me that the progress of the language (compiler, stdlib, official libs, etc.) has slowed down this year or is it just me? |