00:00:04 | * | cyraxjoe quit (*.net *.split) |
00:00:05 | * | rwb quit (*.net *.split) |
00:00:05 | * | Goodbye_Vincent quit (*.net *.split) |
00:00:05 | * | tanami quit (*.net *.split) |
00:00:05 | * | djanatyn1 quit (*.net *.split) |
00:00:05 | * | termer quit (*.net *.split) |
00:00:05 | * | joast quit (*.net *.split) |
00:00:05 | * | mal`` quit (*.net *.split) |
00:00:17 | * | tanami joined #nim |
00:00:28 | * | djanatyn1 joined #nim |
00:00:32 | * | Goodbye_Vincent joined #nim |
00:01:50 | * | rwb joined #nim |
00:01:50 | * | rockcavera joined #nim |
00:02:07 | * | rockcavera quit (Changing host) |
00:02:07 | * | rockcavera joined #nim |
00:02:38 | * | termer joined #nim |
00:03:22 | * | cyraxjoe joined #nim |
00:07:20 | * | mal`` joined #nim |
00:14:20 | FromDiscord | <Elegantbeef> No |
00:19:02 | * | joast joined #nim |
00:19:15 | FromDiscord | <Prestige> Well, dang |
00:19:56 | FromDiscord | <frobnicate> In reply to @Avahe "I.. don't think I": Sorry I meant inject not emit |
00:19:57 | FromDiscord | <Elegantbeef> And it's just a tedious thing to debug dude to the 1.4.x to 1.6.x transition |
00:20:19 | FromDiscord | <Elegantbeef> Nim templates are hygenic so you need to use `inject` to emit identifiers that are accessible outside the template |
00:20:37 | FromDiscord | <frobnicate> Oh I see |
00:47:11 | FromDiscord | <Tibix> sent a code paste, see https://play.nim-lang.org/#ix=44Ly |
00:47:14 | FromDiscord | <Tibix> Any tips would be much appreciated. |
00:47:32 | FromDiscord | <Elegantbeef> you need to give it a type |
00:47:53 | FromDiscord | <Elegantbeef> So it should be `kvPair[int]` or something similar |
00:47:57 | FromDiscord | <Elegantbeef> `T` doesnt exist in this context |
00:48:02 | FromDiscord | <Tibix> But I can't, `kvPair` stands for key-value pair. I can't know beforehand what type it will be. |
00:48:19 | FromDiscord | <Tibix> (edit) "it" => "the value" |
00:48:23 | FromDiscord | <Elegantbeef> How do you think the Nim table implementation works? |
00:48:42 | FromDiscord | <Elegantbeef> You do `var a = initTable[string, int]()` and get a `string` -\> `int` table |
00:49:12 | FromDiscord | <Tibix> In reply to @Elegantbeef "How do you think": I do not know anything about the language other than the small examples I've read in Learn Nim by Example. |
00:49:28 | FromDiscord | <Tibix> So what you're telling me that declaring an array with generic key-value pairs is impossible? |
00:49:37 | FromDiscord | <Elegantbeef> Well yes nim is not dynamically typed |
00:49:59 | FromDiscord | <Elegantbeef> Generally speaking in Nim you have a heterogeneous collection |
00:50:37 | FromDiscord | <Elegantbeef> So this means you do something like `proc initTable[T](): array[1024, kvPair[T]] = default result` |
00:50:46 | FromDiscord | <Elegantbeef> then you can do `var map = initTable[int]()` |
00:51:20 | FromDiscord | <Elegantbeef> The point of generics is they give flexibility without repetition |
00:51:43 | FromDiscord | <Tibix> oh, I understand |
00:51:58 | FromDiscord | <Tibix> in this case is there a different kind of project I can make that's useful for learning? |
00:52:16 | FromDiscord | <Elegantbeef> In general or generics? |
00:52:21 | FromDiscord | <Tibix> In general |
00:52:37 | FromDiscord | <Elegantbeef> command line interface programs are pretty great to get the basics |
00:53:39 | FromDiscord | <Tibix> I've done quite a few those back in the days where I was first learning programming, but maybe something more exact? |
00:53:57 | FromDiscord | <Tibix> In webdev for example a todo list is pretty much the hello world for JavaScript, maybe something similar exists here |
00:54:10 | FromDiscord | <Tibix> maybe I'll make a cli todo list lmao |
00:54:14 | FromDiscord | <Elegantbeef> Hard to say i'm mostly a gamedev so my suggestion is always "make arcade games" |
00:54:40 | FromDiscord | <Tibix> that's an interesting suggestion, however I'd need some knowledge of graphics libraries and ECS for that right? |
00:54:53 | FromDiscord | <Elegantbeef> Nico exists |
00:54:58 | FromDiscord | <Elegantbeef> So you can do it relatively high level |
00:55:29 | FromDiscord | <Tibix> oh this is really interesting, thanks |
00:57:43 | FromDiscord | <Elegantbeef> The nice thing is you can do pong/snake in like 100 lines 😄 |
01:03:43 | FromDiscord | <Tibix> I will try |
01:04:07 | * | jmdaemon joined #nim |
01:07:28 | * | wallabra joined #nim |
01:09:07 | FromDiscord | <# Luke> Anyone got a good dithering tutorial |
01:18:13 | FromDiscord | <# Luke> Also how can I handle text input with nimja |
01:27:23 | FromDiscord | <Tibix> sent a code paste, see https://play.nim-lang.org/#ix=44LN |
01:27:26 | FromDiscord | <Tibix> https://media.discordapp.net/attachments/371759389889003532/998762959318831115/unknown.png |
01:27:53 | FromDiscord | <Tibix> (if I don't want a sequence) |
01:28:17 | FromDiscord | <Elegantbeef> `len: static int` |
01:28:26 | FromDiscord | <Elegantbeef> also `array(len, kvPair` is invalid\` |
01:28:45 | FromDiscord | <Tibix> why so? |
01:29:01 | FromDiscord | <Elegantbeef> to which? |
01:29:10 | FromDiscord | <Tibix> ?? |
01:29:10 | FromDiscord | <Elegantbeef> The `static int` is required cause you need to give it a length at compile time |
01:29:15 | FromDiscord | <Elegantbeef> and `static` is a compile time constant |
01:29:30 | FromDiscord | <Tibix> hmm, but what if the user needs to enter the length in cli? |
01:29:58 | FromDiscord | <Elegantbeef> You use `seq` |
01:30:27 | FromDiscord | <Tibix> nim works very very differently to what I'm used 😅 |
01:30:47 | FromDiscord | <Elegantbeef> It's a statically typed language so yes 😛 |
01:31:18 | FromDiscord | <Elegantbeef> Types have to be resolved at compile time dynamism is to be avoided as much as possible |
01:31:19 | FromDiscord | <# Luke> It's like python + ruby + elixir + c |
01:31:30 | FromDiscord | <Tibix> can I make a fixed length seq? |
01:31:38 | FromDiscord | <# Luke> In reply to @Tibix "can I make a": Yea |
01:31:43 | FromDiscord | <Tibix> awesome |
01:31:44 | FromDiscord | <Elegantbeef> Just dont use add 😄 |
01:31:51 | FromDiscord | <Tibix> 🤔 |
01:31:58 | FromDiscord | <Tibix> that's kinda exactly what I wanted to use though |
01:32:10 | FromDiscord | <# Luke> In reply to @Tibix "can I make a": seq[type](len) |
01:32:18 | FromDiscord | <Elegantbeef> If you want a fixed length you dont want to use add |
01:32:23 | FromDiscord | <Elegantbeef> You want to do `newSeq[type](len)` and never call `add` |
01:32:23 | FromDiscord | <# Luke> In reply to @Tibix "that's kinda exactly what": On a fixed Len seq? |
01:32:37 | FromDiscord | <# Luke> In reply to @Elegantbeef "If you want a": Yea |
01:33:01 | FromDiscord | <# Luke> In reply to @Elegantbeef "You want to do": Oh yeah make a new seq |
01:33:20 | FromDiscord | <Tibix> well then I will get rid of length then I guess |
01:34:21 | FromDiscord | <Tibix> can I initially return an empty sequence somehow? |
01:34:28 | FromDiscord | <Elegantbeef> `@[]` |
01:34:47 | FromDiscord | <Elegantbeef> Or just `discard` |
01:34:53 | FromDiscord | <Elegantbeef> the default value of a sequence is empty |
01:35:30 | FromDiscord | <Tibix> https://media.discordapp.net/attachments/371759389889003532/998764988397264936/unknown.png |
01:35:31 | FromDiscord | <Tibix> jeez |
01:35:56 | FromDiscord | <# Luke> In reply to @Elegantbeef "`@[]`": Yea |
01:36:17 | FromDiscord | <# Luke> In reply to @Tibix "": What are you trying to do? |
01:36:21 | FromDiscord | <Tibix> so like this? this will be the correct type when returned? https://media.discordapp.net/attachments/371759389889003532/998765204001280060/unknown.png |
01:36:57 | FromDiscord | <# Luke> In reply to @Tibix "so like this? this": It'll be an empty sequence |
01:37:04 | FromDiscord | <Tibix> In reply to @ripluke "What are you trying": I see |
01:37:12 | FromDiscord | <# Luke> Huh? |
01:37:17 | FromDiscord | <Prestige> I like your color scheme |
01:37:21 | FromDiscord | <Tibix> In reply to @ripluke "It'll be an empty": I see |
01:37:30 | FromDiscord | <Tibix> In reply to @ripluke "Huh?": Wrong reply to the wrong message 😄 |
01:37:36 | FromDiscord | <# Luke> Lol |
01:37:48 | FromDiscord | <# Luke> In reply to @Avahe "I like your color": Lol same |
01:37:48 | FromDiscord | <Tibix> In reply to @Avahe "I like your color": Thanks, it's called Ayu Mirage |
01:38:01 | FromDiscord | <Prestige> Thanks I'mma look it up |
01:38:14 | FromDiscord | <Tibix> Np |
01:38:38 | FromDiscord | <Tibix> is there a combination of return types in nim? |
01:38:39 | FromDiscord | <Tibix> like |
01:38:59 | FromDiscord | <Tibix> for ts for example there is `string | null` |
01:39:13 | FromDiscord | <huantian> if you want `string | null` you want `Option[string]` in nim |
01:39:16 | FromDiscord | <huantian> from std/options |
01:39:47 | FromDiscord | <# Luke> What if you want like a string or a sequence of strings? |
01:39:59 | FromDiscord | <# Luke> Rn I just put that single trying in a sequence |
01:40:00 | FromDiscord | <Elegantbeef> You use an object variant |
01:40:09 | FromDiscord | <huantian> or you just return a sequence with a single string in it |
01:40:27 | FromDiscord | <# Luke> In reply to @Elegantbeef "You use an object": Is it the create your own type thingy |
01:40:36 | FromDiscord | <# Luke> In reply to @huantian "or you just return": Yea that's what I'm doing rn |
01:40:40 | FromDiscord | <Elegantbeef> Or leorize's union |
01:40:47 | FromDiscord | <Elegantbeef> But yes you'd create an object variant |
01:41:23 | FromDiscord | <Elegantbeef> sent a code paste, see https://play.nim-lang.org/#ix=44LR |
01:42:02 | FromDiscord | <Prestige> Being able to return more than 1 type is a mistake imo |
01:42:08 | FromDiscord | <# Luke> Hmm does nimble have something like nodemon |
01:42:12 | FromDiscord | <Prestige> Makes code harder to work with |
01:42:20 | FromDiscord | <huantian> you shouldn't use it lightly |
01:42:24 | FromDiscord | <Prestige> nodemon being hot code reloading? |
01:42:33 | FromDiscord | <# Luke> In reply to @Avahe "Makes code harder to": That's why I haven't really used it |
01:42:49 | FromDiscord | <huantian> anonymous unions should only be used when they have to and they're the most elegant way to do it |
01:43:05 | FromDiscord | <Prestige> This looks neat ty for color scheme https://media.discordapp.net/attachments/371759389889003532/998766897254383706/unknown.png |
01:43:08 | FromDiscord | <# Luke> In reply to @Avahe "nodemon being hot code": Well by hot reloading if you mean that every time a file with a .js extension changes then it reruns the provided command |
01:43:18 | FromDiscord | <# Luke> (edit) ".js" => ".js/ts" |
01:43:19 | FromDiscord | <Elegantbeef> Could've asked me forever ago↵(@Prestige) |
01:43:34 | FromDiscord | <Prestige> You use the same? I don't think I've seen you code |
01:43:49 | FromDiscord | <# Luke> In reply to @Avahe "This looks neat ty": Nimdow? Lol I recognize that border color |
01:43:58 | FromDiscord | <Elegantbeef> He's the author of nimdow |
01:44:01 | FromDiscord | <Prestige> ^ yep haha |
01:44:05 | FromDiscord | <# Luke> In reply to @Elegantbeef "He's the author of": I do know that |
01:44:07 | FromDiscord | <# Luke> Lop |
01:44:10 | FromDiscord | <# Luke> (edit) "Lop" => "Lol" |
01:44:24 | FromDiscord | <Elegantbeef> Unlike me prestige actually uses what he programs |
01:44:32 | FromDiscord | <Elegantbeef> I just throw it out in the weekly garbage day |
01:45:03 | FromDiscord | <# Luke> In reply to @Elegantbeef "I just throw it": I just throw mine in a GitHub repo archive 💀 |
01:46:53 | FromDiscord | <# Luke> In reply to @ripluke "Hmm does nim have": Does it lol? If not I'll make my own ig |
01:47:10 | FromDiscord | <# Luke> Webdev is hard without nodemon 💀 |
01:48:29 | FromDiscord | <Tibix> https://cdn.discordapp.com/emojis/406598738925322250.webp?size=64 https://media.discordapp.net/attachments/371759389889003532/998768259480420432/unknown.png |
01:48:38 | FromDiscord | <Tibix> 🤔 https://media.discordapp.net/attachments/371759389889003532/998768298533593118/unknown.png |
01:48:41 | FromDiscord | <huantian> In reply to @ripluke "Webdev is hard without": i'd wager there's a vscode extension that does that |
01:48:53 | FromDiscord | <huantian> or is logical comparison |
01:49:00 | FromDiscord | <huantian> eg `true or false` |
01:49:03 | FromDiscord | <# Luke> In reply to @huantian "i'd wager there's a": The problem is I don't use vscode |
01:49:17 | FromDiscord | <# Luke> In reply to @Tibix "🤔": Can't use or like that |
01:49:25 | FromDiscord | <# Luke> It's more of a conditional |
01:49:35 | FromDiscord | <Tibix> In reply to @ripluke "Can't use or like": https://tenor.com/view/crying-emoji-dies-gif-21956120 |
01:49:38 | FromDiscord | <Tibix> teach me how |
01:49:43 | FromDiscord | <# Luke> Like ↵if this or that |
01:49:43 | FromDiscord | <Elegantbeef> Nim isnt TS 😄 |
01:50:02 | FromDiscord | <# Luke> In reply to @Tibix "https://tenor.com/view/crying-emoji-dies-gif-219561": No embed |
01:50:27 | FromDiscord | <huantian> In reply to @Tibix "🤔": what do you expect `"a string" or "another string"` to do? |
01:50:35 | FromDiscord | <Tibix> In reply to @ripluke "No embed": rip |
01:50:40 | FromDiscord | <huantian> strings can't be null in nim |
01:50:47 | FromDiscord | <Tibix> In reply to @huantian "strings can't be null": that's new |
01:50:50 | FromDiscord | <huantian> oh is it an `Option[string]`? |
01:50:58 | FromDiscord | <# Luke> If null:↵ Return ""↵Else: ↵ Return other thingy |
01:51:02 | FromDiscord | <Elegantbeef> There you go |
01:51:06 | FromDiscord | <Elegantbeef> sent a code paste, see https://paste.rs/Ok7 |
01:51:12 | FromDiscord | <# Luke> In reply to @ripluke "If null: ": Replace null with what can be null |
01:51:22 | FromDiscord | <Elegantbeef> remove the `)` on line 2 |
01:52:39 | FromDiscord | <huantian> sent a code paste, see https://play.nim-lang.org/#ix=44LT |
01:52:49 | FromDiscord | <Tibix> sent a code paste, see https://play.nim-lang.org/#ix=44LU |
01:52:51 | FromDiscord | <Tibix> and what will this return if nothing is found? |
01:53:02 | FromDiscord | <huantian> `none()` |
01:53:11 | FromDiscord | <Tibix> and I have to check for that like |
01:53:12 | FromDiscord | <Tibix> if |
01:53:17 | FromDiscord | <Elegantbeef> I dont really like return cause if you have needed logic after you might fuck itup↵(@huantian) |
01:53:29 | FromDiscord | <huantian> mm yeah ig |
01:53:30 | FromDiscord | <Elegantbeef> It does work here |
01:53:37 | FromDiscord | <Elegantbeef> But eh just a habit i have |
01:53:43 | FromDiscord | <Tibix> `if getValue("hello") == none()` |
01:53:43 | FromDiscord | <Elegantbeef> Only return when you really need to |
01:53:48 | FromDiscord | <Tibix> In reply to @Tibix "`if getValue("hello") == none()`": I need to check it like that? |
01:53:54 | FromDiscord | <huantian> In reply to @Tibix "`if getValue("hello") == none()`": `if getValue("hello").isNone` |
01:53:59 | FromDiscord | <Tibix> ooh, thanks |
01:54:04 | FromDiscord | <Tibix> well time to sleep and continue this tomorrow |
01:54:15 | FromDiscord | <huantian> there's also `isSome` that does what you think it does |
01:54:18 | FromDiscord | <Tibix> thanks for the help guys, I would've given up without you a long time ago |
01:54:32 | FromDiscord | <Elegantbeef> Well spoonfeeding gets old quick |
01:54:37 | FromDiscord | <Elegantbeef> So.... stick with it |
01:55:25 | FromDiscord | <# Luke> i remember when i first joined the server how i thought that beef was just some very good ai chatbot 🤣 |
01:55:32 | FromDiscord | <Elegantbeef> I am |
01:55:44 | FromDiscord | <Elegantbeef> Wait i'm not?!' |
01:55:44 | FromDiscord | <# Luke> oh |
01:56:22 | FromDiscord | <# Luke> pls send your source code if u are a bot :P |
01:56:50 | FromDiscord | <Elegantbeef> sent a code paste, see https://play.nim-lang.org/#ix=44LW |
01:57:23 | FromDiscord | <# Luke> nice, i have just figured how to make ai that can beat google's |
02:10:32 | FromDiscord | <# Luke> Beef I found your code |
02:10:33 | FromDiscord | <# Luke> https://github.com/nim-lang/nimbot |
02:17:15 | FromDiscord | <carlosri> sent a long message, see http://ix.io/44M2 |
02:17:56 | FromDiscord | <# Luke> In reply to @carlosri "Hi, i have a": Ok and what do u want to do with them lol |
02:18:07 | FromDiscord | <carlosri> (edit) "http://ix.io/44M2" => "https://paste.rs/qne" |
02:19:05 | FromDiscord | <huantian> all the objects with a given fuente, or fore each different fuente |
02:19:28 | FromDiscord | <sharpcdf> is it possible to call a shell command without having the output be printed? |
02:19:37 | FromDiscord | <# Luke> In reply to @sharpcdf "is it possible to": Yes |
02:19:47 | FromDiscord | <sharpcdf> how would you do it |
02:20:03 | FromDiscord | <# Luke> discard exCmdEx(your command as a string here) |
02:20:17 | FromDiscord | <# Luke> Also u have to import osproc from the Nim stdlib |
02:20:42 | FromDiscord | <sharpcdf> oh yea ive been using `execShellCmd` |
02:21:04 | FromDiscord | <# Luke> In reply to @sharpcdf "oh yea ive been": Yea that prints the output and returns the exitcode iirc |
02:21:41 | FromDiscord | <sharpcdf> yea |
02:22:05 | FromDiscord | <sharpcdf> wait do you need to explicitely use `execCmdEx` or can you use `execCmd` |
02:22:12 | FromDiscord | <carlosri> In reply to @huantian "all the objects with": all objects with the same fuente but i dont want to give the fuente it has to look for it in the sequence |
02:22:59 | FromDiscord | <# Luke> In reply to @sharpcdf "wait do you need": execCmdEx |
02:23:07 | FromDiscord | <# Luke> Because it doesn't print output |
02:23:16 | FromDiscord | <# Luke> While execCommand does |
02:23:29 | FromDiscord | <# Luke> (edit) "execCommand" => "execCmd" |
02:24:11 | FromDiscord | <sharpcdf> oh i see now |
02:24:15 | FromDiscord | <sharpcdf> it returns the output |
02:24:45 | FromDiscord | <# Luke> In reply to @sharpcdf "it returns the output": Yea, and by discarding it you get no output |
02:36:56 | FromDiscord | <Dale> Whoop, I think my threaded logger is actually finished. That was more of Nim exercise than I originally thought, but I learned a lot about templates! Thanks to Mr. Beef for helping out so much :D https://media.discordapp.net/attachments/371759389889003532/998780447528079370/unknown.png |
02:38:02 | FromDiscord | <Dale> sent a code paste, see https://play.nim-lang.org/#ix=44M9 |
02:38:24 | FromDiscord | <Dale> Actually that string in `open` does nothing now, it resolves the filename automaticalluy, should get rid of that |
02:38:28 | FromDiscord | <Dale> (edit) "automaticalluy," => "automatically," |
02:42:11 | FromDiscord | <# Luke> Is it on nimble? |
02:42:52 | FromDiscord | <Dale> The logger? |
02:43:09 | FromDiscord | <Dale> Nah, it's integrated into the engine. I could maybe split it out at some point |
02:43:28 | FromDiscord | <# Luke> In reply to @Dale "Nah, it's integrated into": That'd be cool |
02:43:32 | FromDiscord | <# Luke> In reply to @Dale "The logger?": Yes |
02:43:33 | FromDiscord | <Dale> It's a little better than the std one since it uses a lot of compile time stuff, and no `if`s |
02:43:57 | FromDiscord | <Dale> That's the main reason I didn't use the std one |
02:44:37 | FromDiscord | <# Luke> Oh |
02:44:57 | FromDiscord | <sharpcdf> how can i check if a file has an extension |
02:44:59 | FromDiscord | <Dale> There is a case block, but it's in the writer thread |
02:45:09 | FromDiscord | <Dale> There's a proc for that in `os` |
02:45:23 | FromDiscord | <sharpcdf> ah ok |
02:45:42 | FromDiscord | <# Luke> In reply to @sharpcdf "how can i check": spliteFile(name).ext |
02:45:50 | FromDiscord | <# Luke> Will return file extension |
02:45:56 | FromDiscord | <# Luke> (edit) "spliteFile(name).ext" => "splitFile(name).ext" |
02:46:53 | FromDiscord | <sharpcdf> oh yea |
02:46:58 | FromDiscord | <Dale> Yeah splitfile returns a tuple, but there's also `fineFileExt` if you don't want to waste the extra data (and have to label them as used) |
02:47:09 | FromDiscord | <sharpcdf> already used it 20 and i still dont remember it lmao |
02:47:19 | FromDiscord | <sharpcdf> (edit) "already used it 20 ... and" added "time" |
02:47:22 | FromDiscord | <sharpcdf> (edit) "time" => "times" |
02:47:23 | FromDiscord | <Dale> Ah, it's `searchExtPos` |
02:48:02 | FromDiscord | <sharpcdf> my app is short living so it shouldnt be a big deal |
02:50:59 | FromDiscord | <# Luke> Lol can someone help me in #webdev |
03:16:53 | * | noeontheend joined #nim |
03:37:47 | FromDiscord | <b1rdf00d> In reply to @carlosri "Hi, i have a": sounds like a good fit for using a dataframe - is datamancer the way to go? |
04:12:41 | * | noeontheend quit (Ping timeout: 255 seconds) |
04:29:02 | FromDiscord | <sharpcdf> whats a good way to parse command line flags |
04:29:10 | FromDiscord | <sharpcdf> like `--version` and whatnot |
04:31:37 | FromDiscord | <Prestige> https://nim-lang.org/docs/parseopt.html @sharpcdf |
04:39:53 | * | arkurious quit (Quit: Leaving) |
04:41:17 | * | duuude joined #nim |
04:41:28 | duuude | how to parse html on nim? |
04:51:10 | FromDiscord | <sharpcdf> In reply to @Avahe "https://nim-lang.org/docs/parseopt.html <@459463405": ohhh, i didnt know this existed, thanks! |
04:58:45 | * | rockcavera quit (Remote host closed the connection) |
05:05:57 | FromDiscord | <Elegantbeef> https://nim-lang.org/docs/htmlparser.html#parseHtml%2C↵(<@709044657232936960_duuude=5b=49=52=43=5d>) |
05:11:53 | duuude | thank you Elegantbeef |
05:12:46 | duuude | btw I wasn't pinged and when I clicked on the link the ↵ was in the link too (not sure if bridge's fault) |
05:13:16 | FromDiscord | <Rika> It’s the bridge |
05:13:25 | FromDiscord | <Rika> It goes from matrix to discord to IRC |
05:17:27 | FromDiscord | <j-james> the bridge could use some improvements |
05:17:50 | FromDiscord | <j-james> it doesn't propagate matrix ==> discord edits, and there's the username thing |
05:18:08 | FromDiscord | <j-james> also it delays and/or drops messages from matrix some times |
05:18:36 | FromDiscord | <j-james> i heard that was a performance issue with matrix's federation though |
05:18:52 | FromDiscord | <j-james> (edit) "though" => "though, not sure if that's true" |
05:19:25 | duuude | matrix to libera bridges are straightforward and supported by the matrix/libera teams themselves. |
05:19:39 | duuude | that is the way libera makes money |
05:20:08 | duuude | matrix->IRC discord->IRC could work |
05:20:08 | * | j-james joined #nim |
05:20:40 | FromDiscord | <Rika> That loses out on the rich editing both discord and matrix share |
05:20:55 | duuude | bridges from IRC to other stuff are hard to do stuff wrong, since they are just text. |
05:21:45 | duuude | well, one shouldn't let perfection to get in the way of good enough |
05:22:01 | FromDiscord | <j-james> that discord edit doesn't look too bad on irc |
05:22:15 | duuude | yeah, I quite like this one |
05:22:33 | duuude | unlike the matrix bridge edit |
05:23:18 | FromDiscord | <j-james> what about matrix edits? |
05:23:18 | FromDiscord | <Rika> Well one thing is that the matrix bridge is not by the same people as those who made the discord bridge |
05:23:34 | FromDiscord | <Rika> The discord bridge is actually by Yardanico lol |
05:23:50 | duuude | make the discord-bridge people make matrix bridges :P |
05:23:51 | FromDiscord | <j-james> what about matrix edits? |
05:24:00 | FromDiscord | <j-james> what about matrix edits? |
05:24:22 | j-james | looks like matrix edits aren't going through right now? hmm |
05:24:23 | duuude | matrix edits are: *the new message content |
05:24:35 | duuude | discord edits are nice diffs |
05:24:41 | duuude | sometimes with color even |
05:25:11 | duuude | haha, you keep pinging yourself on irc |
05:25:19 | FromDiscord | <Rika> Instead of having a linear bridge system why don’t we just bridge everything to everything else with the bridges ignoring each other |
05:25:22 | FromDiscord | <Rika> xddd |
05:25:46 | duuude | nice idea |
05:26:06 | duuude | why ignore, that is rude |
05:26:10 | duuude | make it a full loop |
05:26:30 | FromDiscord | <Rika> You want the bridge to bridge itself to itself? |
05:26:46 | duuude | yeah |
05:26:48 | FromDiscord | <Rika> Discord -> IRC -> matrix -> discord… |
05:27:09 | duuude | would be cool if it removes the original |
05:27:18 | duuude | it degrades everything to the worst level |
05:27:23 | duuude | makes it fair |
05:28:48 | madprops | irc > disco > maytricks |
05:28:56 | FromDiscord | <Rika> You do you |
05:40:48 | * | duuude quit (Quit: Konversation terminated!) |
05:41:04 | * | duuude joined #nim |
05:48:44 | FromDiscord | <Dale> I miss IRC :( |
05:49:04 | FromDiscord | <Dale> I really dislike how discord basically killed it |
05:49:17 | FromDiscord | <Dale> IRC + mumble is where it’s at |
05:50:57 | FromDiscord | <Rika> Well discord is a “better” service in terms of ease of use |
05:51:13 | FromDiscord | <frobnicate> Doesn't really feel like it |
05:51:26 | FromDiscord | <frobnicate> I think it just had more marketing |
05:51:37 | FromDiscord | <frobnicate> It's always the marketing and the normies |
05:52:39 | FromDiscord | <Dale> The only thing I like about discord is that you can screen share easily. I prefer IRC and mumble in every other way |
05:52:45 | FromDiscord | <Rika> I mean for IRC you have to know the server then make an account for each of them and find the channel somehow and then maybe even nick serv and … |
05:53:09 | FromDiscord | <Dale> Yeah but that stuff is trivial, especially for programmers |
05:53:19 | FromDiscord | <Dale> And there are clients that handle all of that for you |
05:53:19 | FromDiscord | <Rika> Most people aren’t programmers 🙂 |
05:53:33 | FromDiscord | <Rika> You overestimate what trivial for people could be |
05:53:42 | FromDiscord | <Rika> Are the clients easy to use |
05:53:49 | FromDiscord | <Dale> Well I used IRC before I could program |
05:54:03 | FromDiscord | <Rika> Wow a sample size of 1 |
05:54:09 | FromDiscord | <Rika> How statistically significant |
05:54:57 | FromDiscord | <Dale> No need to be rude. I’m just saying that I like it more, and it’s not actually that complicated. People on here understand commands and stuff |
05:55:36 | FromDiscord | <Dale> It’s nice and simple, doesn’t have obnoxious marketing, and doesn’t have junk features |
05:55:54 | FromDiscord | <Dale> (Also bot electron haha) |
05:55:59 | FromDiscord | <Dale> (edit) "bot" => "not" |
05:56:30 | FromDiscord | <Rika> What I mean is that there’s a good reason discord was able to kill it |
05:57:17 | FromDiscord | <Dale> = most people don’t know how to use computers |
05:57:34 | FromDiscord | <Dale> Which is even more sad :( |
05:57:42 | FromDiscord | <Dale> But okay I guess |
05:57:43 | duuude | Electron bad |
05:58:16 | FromDiscord | <Dale> There’s a new project called Tauru that aims to replace it, seems promising |
05:58:30 | FromDiscord | <Dale> (edit) "Tauru" => "Tauri" |
05:58:45 | FromDiscord | <Rika> In reply to @Dale "Which is even more": I can’t imagine how |
06:00:26 | FromDiscord | <Dale> Yo does Tauri have nim binds? Hmm |
06:01:23 | duuude | web bad |
06:03:14 | FromDiscord | <Dale> Ban network cards when |
06:04:15 | * | vicecea quit (Read error: Connection reset by peer) |
06:05:10 | * | vicecea joined #nim |
06:05:16 | FromDiscord | <ajusa> can you generate a type using templates? |
06:05:22 | FromDiscord | <ajusa> or do you have to use a macro? |
06:06:25 | duuude | net good |
06:06:26 | duuude | web bad |
06:06:39 | duuude | no web brings net good |
06:08:26 | FromDiscord | <Rika> In reply to @ajusa "can you generate a": What do you mean? Yeah? I’m not sure what you meant |
06:09:36 | * | CyberTailor joined #nim |
06:11:00 | FromDiscord | <ajusa> Like can I create a custom type based on parameters passed into a template |
06:12:24 | FromDiscord | <ajusa> sent a code paste, see https://play.nim-lang.org/#ix=44ME |
06:18:23 | FromDiscord | <Rika> Should work but "typedesc type" -> "typ: typedesc" and type -> typ for the value:type part |
06:36:01 | FromDiscord | <sharpcdf> sent a code paste, see https://play.nim-lang.org/#ix=44MI |
06:36:05 | FromDiscord | <sharpcdf> please help its so ugly |
06:37:12 | FromDiscord | <Rika> Put them in procs |
06:37:31 | FromDiscord | <Rika> The ends with one in a “compatible extension” one |
06:38:01 | FromDiscord | <Rika> The contains one in an “architecture” one |
06:38:12 | FromDiscord | <Rika> The other one in an operating system one |
06:38:29 | FromDiscord | <sharpcdf> ill try it |
06:38:47 | FromDiscord | <sharpcdf> ive been up for so long i just want to go to sleep but my brain wont let me until i get this right 🥲 |
06:40:32 | FromDiscord | <# Luke> In reply to @Dale "There’s a new project": Yea it's really nice |
06:40:48 | FromDiscord | <# Luke> In reply to @Dale "Yo does Tauri have": Tauri takes in js right? |
06:40:57 | FromDiscord | <# Luke> Then just compile Nim to js |
06:41:16 | FromDiscord | <# Luke> (edit) "compile Nim to" => "use nims" | "use nimsjs ... " added "backend" |
06:41:19 | FromDiscord | <amadan> Nim is on their roadmap iirc |
06:41:27 | FromDiscord | <# Luke> Oh |
06:42:01 | FromDiscord | <amadan> They just gotta do a lot of other stuff first rip https://media.discordapp.net/attachments/371759389889003532/998842130304872498/Screenshot_20220719-164135391_1.jpg |
06:42:08 | * | j-james quit (Quit: leaving) |
06:42:54 | FromDiscord | <# Luke> I don't get the point of that tho |
06:43:24 | FromDiscord | <# Luke> It's supposed to be a way to make apps with web tech |
06:43:43 | FromDiscord | <# Luke> What's the point of supporting Nim or python or cpp |
06:44:22 | FromDiscord | <# Luke> Those langs have there own app frameworks |
06:44:29 | FromDiscord | <# Luke> (edit) "What's the point of supporting Nim or python or cpp ... " added "or go" |
06:44:33 | FromDiscord | <j-james> it's supposed to be a way to make apps with web frontends |
06:44:48 | FromDiscord | <sharpcdf> oh neat i thought tauri was rust only |
06:45:11 | FromDiscord | <# Luke> In reply to @j-james "it's supposed to be": Wait so I can make 1 app that I can also use as a website |
06:45:18 | FromDiscord | <j-james> because every other gui framework sucks lmao |
06:45:42 | FromDiscord | <# Luke> In reply to @sharpcdf "oh neat i thought": No the backend is written in rust |
06:45:58 | FromDiscord | <# Luke> But it's mainly supposed to support js/html/css |
06:46:08 | FromDiscord | <# Luke> It also supports rust tho I think |
06:46:22 | FromDiscord | <j-james> yeah i think the idea is your traditional frontend/backend webapps can be ported to the desktop easily |
06:46:26 | FromDiscord | <j-james> hmm wait that might not be right |
06:47:16 | FromDiscord | <amadan> Isn't it marketed as an electron replacement?↵Rust logic, JS UI |
06:47:37 | FromDiscord | <# Luke> Wait but let's say I don't have anything, then I make an app in tauri, can I deploy that app to the web, and then also have a standalone application? |
06:48:00 | FromDiscord | <j-james> i know that cinny uses it, which is weird, because cinny is pure js |
06:48:11 | FromDiscord | <Rika> Why not that one thing I forgot the name of |
06:48:39 | FromDiscord | <# Luke> In reply to @Rika "Why not that one": Hmm if I knew it's name I'd tell you why not 😁 |
06:48:49 | FromDiscord | <amadan> Neel maybe? |
06:49:07 | FromDiscord | <Rika> Sciter |
06:49:59 | FromDiscord | <amadan> Guess main difference is sciter doesn't support all CSS so you cant just chuck in a CSS library (idk I might be remembering wrong lol) |
06:59:19 | FromDiscord | <sharpcdf> In reply to @Rika "Put them in procs": i did that, and while its definitely much cleaner its still downloading a file that has darwin in teh name 😩 |
06:59:26 | FromDiscord | <sharpcdf> (edit) "teh" => "the" |
07:01:31 | FromDiscord | <Elegantbeef> Tauri is a lighter runtime than electron↵(@j-james) |
07:01:52 | FromDiscord | <Rika> In reply to @sharpcdf "i did that, and": That’s a logic issue now |
07:02:20 | FromDiscord | <sharpcdf> sent a code paste, see https://play.nim-lang.org/#ix=44MN |
07:02:23 | * | duuude quit (Ping timeout: 272 seconds) |
07:02:53 | FromDiscord | <j-james> it seems they plan to make mobile apps using tauri too |
07:02:55 | FromDiscord | <j-james> which is interesting |
07:04:38 | FromDiscord | <Rika> sent a code paste, see https://play.nim-lang.org/#ix=44MQ |
07:05:01 | FromDiscord | <Rika> not (x or y or a) != not x or not y or not z |
07:05:07 | FromDiscord | <Rika> (edit) "a)" => "z)" |
07:05:48 | FromDiscord | <Elegantbeef> It's a big old sign you're doing it wrong 😄 |
07:07:01 | FromDiscord | <Elegantbeef> sent a code paste, see https://play.nim-lang.org/#ix=44MR |
07:07:21 | FromDiscord | <sharpcdf> In reply to @Rika "This says that if": yea but how is it reading like `and` when im using `or`? i thought it would be that if the file doesnt contain darwin or etc. then return true |
07:07:31 | FromDiscord | <Rika> In reply to @Rika "not (x or y": Read this |
07:07:43 | FromDiscord | <sharpcdf> whats the difference |
07:07:46 | FromDiscord | <Rika> not a or not b == not (a and b) |
07:07:52 | FromDiscord | <Rika> De Morgan’s law |
07:08:57 | FromDiscord | <Rika> sent a code paste, see https://play.nim-lang.org/#ix=44MS |
07:09:06 | FromDiscord | <Rika> What are you checking anyway |
07:09:10 | FromDiscord | <Rika> In plain English |
07:09:16 | FromDiscord | <Rika> Just to make sure we’re getting it right |
07:10:08 | FromDiscord | <sharpcdf> > The negation of a disjunction is the conjunction of the negations↵> The negation of a conjunction is the disjunction of the negations↵i get it now |
07:10:18 | FromDiscord | <sharpcdf> In reply to @Rika "What are you checking": im checking the name of github release files |
07:10:23 | FromDiscord | <Rika> “not (A or B) = (not A) and (not B)↵not (A and B) = (not A) or (not B),” |
07:10:29 | FromDiscord | <sharpcdf> yea lmao |
07:10:38 | FromDiscord | <sharpcdf> kinda confusing but oh well |
07:10:48 | FromDiscord | <Rika> Yeah you have to be careful with this |
07:10:52 | FromDiscord | <sharpcdf> sent a code paste, see https://play.nim-lang.org/#ix=44MT |
07:11:09 | FromDiscord | <Rika> In reply to @sharpcdf "ok so i have": You can do the same for loop trick with the other ones |
07:11:16 | FromDiscord | <sharpcdf> yea |
07:11:19 | * | toluene quit (Quit: Ping timeout (120 seconds)) |
07:11:22 | FromDiscord | <Rika> “Trick” |
07:11:36 | FromDiscord | <Rika> Not really a trick if it’s the point of a for loop haha |
07:11:44 | FromDiscord | <sharpcdf> i was kind of avoiding using `for` loops because i feel like they have worse performance than if statements which makes no sense and is bullshit |
07:11:57 | FromDiscord | <sharpcdf> well thanks anyways lol |
07:11:57 | FromDiscord | <sharpcdf> o7 |
07:14:49 | * | toluene joined #nim |
07:16:25 | * | duuude joined #nim |
07:21:03 | FromDiscord | <sOkam!> In reply to @sharpcdf "> The negation of": 😵💫 |
07:21:43 | FromDiscord | <sharpcdf> sent a code paste, see https://play.nim-lang.org/#ix=44MV |
07:22:10 | FromDiscord | <sOkam!> I think those sentences left me more confounded than when I started reading them↵Sry, i meant contjucted,.... or confused... i don't remember anymore |
07:22:10 | FromDiscord | <sharpcdf> sent a code paste, see https://play.nim-lang.org/#ix=44MW |
07:22:40 | FromDiscord | <Rika> In reply to @sOkam! "I think those sentences": Negated |
07:22:51 | FromDiscord | <sOkam!> Accurate |
07:22:55 | FromDiscord | <sharpcdf> dijunctitored |
07:23:18 | FromDiscord | <sharpcdf> In reply to @sharpcdf "still doesnt work <:nimRawr:712689930668867633>": damn it i just forgot to put the `not` back in |
07:23:56 | FromDiscord | <sOkam!> you forgot to negate it, so nothing not not works |
07:24:10 | FromDiscord | <sharpcdf> correct |
07:25:44 | FromDiscord | <sharpcdf> In reply to @sharpcdf "damn it i just": NOW ITS ALSO SHOWING DARWIN ARM |
07:25:50 | FromDiscord | <sharpcdf> WHICH ISNT SUPPOSED TO HAPPEN |
07:25:52 | FromDiscord | <sharpcdf> AAAAAAAAAAAAAAAAA |
07:26:20 | FromDiscord | <Elegantbeef> you need to return false in that case otherwise return true |
07:26:24 | FromDiscord | <sOkam!> sent a code paste, see https://paste.rs/t28 |
07:27:36 | FromDiscord | <sharpcdf> YES!!!!!!!!!! |
07:27:59 | FromDiscord | <sharpcdf> I HAD TO ADD `notin` TO THE PROC THAT CHECKS THE ARCHITECTURE |
07:28:03 | FromDiscord | <sharpcdf> i am |
07:28:06 | FromDiscord | <sharpcdf> unbelievably |
07:28:08 | FromDiscord | <sharpcdf> happy |
07:28:13 | FromDiscord | <sharpcdf> so |
07:28:14 | FromDiscord | <sharpcdf> happy |
07:28:20 | FromDiscord | <sharpcdf> its 3:30 am |
07:28:21 | FromDiscord | <Elegantbeef> sent a code paste, see https://play.nim-lang.org/#ix=44MZ |
07:28:53 | FromDiscord | <sharpcdf> sent a code paste, see https://play.nim-lang.org/#ix=44N0 |
07:29:14 | FromDiscord | <Elegantbeef> if you have a return inside that will exist on the first check |
07:29:35 | FromDiscord | <Elegantbeef> sent a code paste, see https://play.nim-lang.org/#ix=44N1 |
07:29:54 | FromDiscord | <sharpcdf> In reply to @Elegantbeef "if you have a": wdym |
07:31:06 | FromDiscord | <Elegantbeef> sent a code paste, see https://paste.rs/ht8 |
07:31:52 | FromDiscord | <sharpcdf> what, would that not work properly? |
07:31:53 | FromDiscord | <Elegantbeef> So only in the case that `os` is in `a` will it do another iteration |
07:32:13 | FromDiscord | <sharpcdf> no |
07:32:36 | FromDiscord | <sharpcdf> ah i see, i need to add to `result`? |
07:32:51 | FromDiscord | <Elegantbeef> Or just do what i showed |
07:33:29 | FromDiscord | <Elegantbeef> https://play.nim-lang.org/#ix=44N3 |
07:34:48 | FromDiscord | <sharpcdf> oh i see |
07:34:53 | FromDiscord | <sharpcdf> yea ill do that |
07:35:29 | FromDiscord | <sharpcdf> yea im stupid, i shouldve done that first lol |
07:40:13 | FromDiscord | <sharpcdf> sent a code paste, see https://play.nim-lang.org/#ix=44N6 |
07:40:34 | FromDiscord | <sharpcdf> good thing i know the error or i would be crying right now |
08:00:56 | FromDiscord | <sharpcdf> sent a code paste, see https://play.nim-lang.org/#ix=44Nd |
08:03:44 | FromDiscord | <Elegantbeef> You have early returns |
08:03:48 | FromDiscord | <Elegantbeef> Why do you not use my code? |
08:03:52 | FromDiscord | <sharpcdf> i did |
08:03:53 | FromDiscord | <sharpcdf> did i not |
08:03:55 | FromDiscord | <Elegantbeef> Also use a const |
08:03:57 | FromDiscord | <Elegantbeef> No you did not |
08:04:03 | FromDiscord | <Elegantbeef> you have early returns |
08:04:15 | FromDiscord | <Elegantbeef> I wrote my code in a specific way cause it only early returns in the case it matches |
08:04:32 | FromDiscord | <sharpcdf> oh i didnt see `result = true` |
08:04:34 | FromDiscord | <sharpcdf> let me fix that |
08:04:39 | FromDiscord | <Elegantbeef> Result is set to true on the first line and the procedure only returns false if the name is in the string |
08:04:45 | FromDiscord | <Elegantbeef> use const instead of var for os |
08:06:04 | FromDiscord | <sharpcdf> In reply to @Elegantbeef "use const instead of": whats the difference? |
08:06:06 | FromDiscord | <sharpcdf> performance? |
08:06:24 | FromDiscord | <Elegantbeef> Possibly, also it's the proper way to write Nim |
08:06:32 | FromDiscord | <Elegantbeef> constants should be constants |
08:06:40 | FromDiscord | <sharpcdf> fair enough |
08:06:45 | FromDiscord | <sharpcdf> but why not immutable |
08:07:00 | FromDiscord | <Elegantbeef> What? |
08:07:09 | FromDiscord | <Elegantbeef> `let` is a runtime "constant" |
08:07:17 | FromDiscord | <Elegantbeef> `const` is a compile time constant |
08:07:43 | FromDiscord | <Elegantbeef> you cannot mutate a `const` no matter how much you try |
08:07:57 | FromDiscord | <sharpcdf> yea i know |
08:08:03 | FromDiscord | <sharpcdf> why not use `let` instead of const |
08:08:16 | FromDiscord | <Elegantbeef> Cause it's still a runtime value |
08:08:38 | FromDiscord | <Elegantbeef> You use the most restrictive declaration possible |
08:08:56 | FromDiscord | <Elegantbeef> If you can use const you do, if you can use let you do |
08:09:37 | FromDiscord | <Elegantbeef> Using a constant instead of a let means the program doesnt have to allocate new strings inside of that array |
08:10:54 | FromDiscord | <sharpcdf> In reply to @Elegantbeef "Using a constant instead": ah ok |
08:11:01 | FromDiscord | <sharpcdf> well anyways heres the fruits of my labor |
08:11:03 | FromDiscord | <sharpcdf> https://media.discordapp.net/attachments/371759389889003532/998864533684764712/unknown.png |
08:11:08 | FromDiscord | <sharpcdf> some more but this is the main part |
08:11:38 | FromDiscord | <sharpcdf> i do want to see if theres some cli library for choosing versions to install/remove |
08:13:33 | * | syl quit (Quit: C-x C-c) |
08:13:43 | FromDiscord | <Elegantbeef> "adding executables to bin" |
08:13:52 | FromDiscord | <Elegantbeef> This is a user defined bin path right 😄 |
08:14:58 | FromDiscord | <sharpcdf> In reply to @Elegantbeef "This is a user": its in `~/.jitter/bin` |
08:15:03 | FromDiscord | <sharpcdf> and the user adds it to path |
08:15:13 | * | syl joined #nim |
08:15:18 | FromDiscord | <sharpcdf> im sorry |
08:15:19 | FromDiscord | <sharpcdf> but |
08:15:29 | FromDiscord | <sharpcdf> i plan on making a config file where you can choose the bin |
08:16:02 | FromDiscord | <Elegantbeef> Seems sensible to me |
08:18:09 | FromDiscord | <sharpcdf> 😄 |
08:18:28 | FromDiscord | <sharpcdf> i want to have it so everything is still changeable but by default everything is in one place |
08:18:57 | FromDiscord | <sharpcdf> tomorrow i fix the rest f the bugs and work on gitlab support |
08:19:03 | FromDiscord | <sharpcdf> (edit) "f" => "of" |
08:20:12 | * | pch quit (Quit: Leaving) |
08:31:27 | * | toluene quit (Quit: Ping timeout (120 seconds)) |
08:33:28 | * | toluene joined #nim |
08:45:09 | FromDiscord | <Phil> Question, is there a way to ensure that a variable with a ref-type can't be nil? |
08:47:57 | FromDiscord | <Phil> As in, get compile time assurance that it won't be? |
08:48:02 | FromDiscord | <flywind> No good solution, check thr strictnotbil experiemental feature. |
08:48:06 | FromDiscord | <Elegantbeef> https://nim-lang.org/docs/manual_experimental.html#strict-not-nil-checking |
08:48:09 | FromDiscord | <flywind> (edit) "thr" => "the" |
08:48:20 | FromDiscord | <flywind> (edit) "strictnotbil" => "strictnotnil" |
08:48:21 | FromDiscord | <Elegantbeef> strict not bullet bill\ |
08:48:45 | FromDiscord | <Elegantbeef> It ensures all enemies you meet are atleast koopas |
08:49:02 | FromDiscord | <flywind> lol, I typed on the phone |
08:50:14 | FromDiscord | <Phil> Check. If I wanted to only assure this only for my own project code (I've made bad experiences with e.g. system.nim failing for some "WarningAsError" and "HintAsError" flags), do I have to add the pragma to every single `.nim` file? |
08:50:22 | FromDiscord | <Phil> (edit) removed "only" |
08:50:50 | FromDiscord | <flywind> Feel free to make prs to system.nim. |
08:51:13 | FromDiscord | <flywind> (edit) "system.nim." => "system.nim to remove warnings." |
08:52:03 | FromDiscord | <Phil> Can I take that as a yes for the "Add pragma to every file" question? |
08:52:34 | FromDiscord | <flywind> I mean the warningAsError issues. |
08:52:50 | FromDiscord | <flywind> Only the modules you used this feature Imo. |
08:53:22 | FromDiscord | <Phil> Yeh, I'll likely take a look at it if I can find the time, next to other obligations and the stuff I've got going with norm |
08:53:58 | FromDiscord | <Phil> In reply to @flywind "Only the modules you": I'd want blanko "check for not nil", though only for my own code, thus the question. |
08:54:05 | FromDiscord | <flywind> push and pop pragmas may work for you case |
08:54:26 | FromDiscord | <Phil> Ah right, I could push the pragma on the root file and never pop it? |
08:54:45 | FromDiscord | <j-james> really wish object fields didn't initialize as `nil` |
08:56:34 | FromDiscord | <flywind> In reply to @Isofruit "Ah right, I could": Yeah, stdlib does this for some cases. |
08:57:32 | FromDiscord | <flywind> And you need to include it in your projects, |
08:57:34 | FromDiscord | <flywind> https://github.com/nim-lang/Nim/blob/efcb89fa702da5bd5d2cf000ace759df90152895/lib/system/inclrtl.nim#L51 |
08:58:41 | FromDiscord | <flywind> https://nim-lang.org/docs/manual.html#pragmas-push-and-pop-pragmas works for some experimental features but it depends on its implementation, not sure which ones work. |
09:31:40 | * | jmdaemon quit (Ping timeout: 272 seconds) |
09:35:52 | * | syl quit (Quit: C-x C-c) |
09:36:11 | * | syl joined #nim |
09:36:39 | * | syl quit (Remote host closed the connection) |
09:36:54 | * | syl joined #nim |
09:48:23 | * | vicecea quit (Ping timeout: 255 seconds) |
10:14:06 | * | duuude quit (Ping timeout: 272 seconds) |
10:28:20 | FromDiscord | <RedBeard0531 (Mathias Stearn)> Has anyone had success bridging nim closure types into a C++ `std::function`? Or for that matter exposing nim closure types to C++ at all? |
11:01:52 | FromDiscord | <Phil> In reply to @Elegantbeef "https://nim-lang.org/docs/manual_experimental.html#": Oh sweet, strict not nil only throws warnings, not errors.↵Just ran it over my code. It... flagged a lot. Like, a ton of jsony code as well. Hmm |
11:21:34 | FromDiscord | <Tibix> good morning, am I missing something? https://media.discordapp.net/attachments/371759389889003532/998912478488576060/unknown.png |
11:22:13 | FromDiscord | <planetis> pbl not var |
11:22:16 | FromDiscord | <Tibix> sent a code paste, see https://play.nim-lang.org/#ix=44NT |
11:22:19 | FromDiscord | <planetis> yep |
11:22:32 | FromDiscord | <planetis> hashMap: var seq[kvPair] |
11:23:04 | FromDiscord | <Tibix> oh that worked tysm |
11:23:49 | FromDiscord | <Tibix> sent a code paste, see https://play.nim-lang.org/#ix=44NU |
11:24:28 | FromDiscord | <RedBeard0531 (Mathias Stearn)> Have you considered just using https://nim-lang.org/docs/tables.html |
11:24:58 | FromDiscord | <Tibix> I am implementing my own hashmap purely for fun |
11:25:02 | FromDiscord | <Tibix> And to learn Nim |
11:25:27 | FromDiscord | <RedBeard0531 (Mathias Stearn)> I don't know if "bad practice" is what I'd say, but do you have a plan for how to handle hash colisions? It looks like it won't be possible since you don't have the unhashed key. |
11:25:27 | FromDiscord | <Tibix> I will probably make something that doesn't exist yet next haha |
11:25:44 | FromDiscord | <Tibix> In reply to @RedBeard0531 (Mathias Stearn) "I don't know if": Oh yes, hash collisions come later, I will just use rehashing |
11:27:01 | FromDiscord | <RedBeard0531 (Mathias Stearn)> It is certainly confusing to name something `key` but have it actually be a hash |
11:27:39 | FromDiscord | <RedBeard0531 (Mathias Stearn)> Usually a hash table will either store both the raw key and the hash, or just the raw key and have the hash re-computed on demand when needed. |
11:30:03 | FromDiscord | <Tibix> That's fair yeah |
11:30:08 | FromDiscord | <Tibix> Well rip https://media.discordapp.net/attachments/371759389889003532/998914634545377320/unknown.png |
11:30:41 | FromDiscord | <Tibix> I tried to replicate the C function in Nim |
11:30:42 | FromDiscord | <Tibix> https://gist.github.com/MohamedTaha98/ccdf734f13299efb73ff0b12f7ce429f |
11:30:56 | FromDiscord | <Tibix> apparently I fucked something up? |
11:30:57 | FromDiscord | <Tibix> sent a code paste, see https://play.nim-lang.org/#ix=44NW |
11:33:44 | FromDiscord | <carlosri> In reply to @b1rdf00d "sounds like a good": thanks I'll look into it |
11:33:49 | FromDiscord | <RedBeard0531 (Mathias Stearn)> I think you want `%` rather than `` since you want wrapping behavior on overflow. https://nim-lang.org/docs/system.html#%2A%25%2Cint%2Cint |
11:34:22 | FromDiscord | <enthus1ast> Nim also has shift left shl() |
11:34:30 | FromDiscord | <RedBeard0531 (Mathias Stearn)> Or just use `uint` rather than `int` |
11:35:18 | FromDiscord | <RedBeard0531 (Mathias Stearn)> hashes should basically never use signed ints because hashes aren't really numbers, they are just bags of bits |
11:46:16 | FromDiscord | <RedBeard0531 (Mathias Stearn)> Is there a canonical binding library for the c++ stdlib (things like `std::vector`and `std::string`) to use when interfacing with C++ libs or does everyone roll their own every time? |
11:57:50 | * | wallabra_ joined #nim |
11:59:14 | * | rockcavera joined #nim |
11:59:14 | * | rockcavera quit (Changing host) |
11:59:14 | * | rockcavera joined #nim |
12:00:40 | * | wallabra quit (Ping timeout: 260 seconds) |
12:02:35 | * | wallabra_ quit (Ping timeout: 268 seconds) |
12:15:40 | * | kenran joined #nim |
12:23:33 | * | kenran quit (Ping timeout: 276 seconds) |
13:03:20 | FromDiscord | <Professor Actual Factual> In reply to @RedBeard0531 (Mathias Stearn) "Is there a canonical": You kinda make your own every time, but c2nim should take away most of the pain in interop |
13:14:02 | FromDiscord | <voidwalker> hey @enthus1ast ! db consulting time again 🙂 |
13:15:18 | FromDiscord | <voidwalker> I want to turn what is a column of strings in the input file, in a column of ints pointing to another table with id -> string |
13:16:28 | FromDiscord | <voidwalker> I am thinking two small ints (<=32 ) will take up less space than the string |
13:17:06 | FromDiscord | <voidwalker> Is there any standard method to do this conversion from SQL, when importing? |
13:23:33 | * | pch joined #nim |
13:38:34 | FromDiscord | <demotomohiro> @RedBeard0531 (Mathias Stearn) https://github.com/Clonkk/nim-cppstl |
13:41:00 | FromDiscord | <RedBeard0531 (Mathias Stearn)> @\_discord\_288750616510201856\:t2bot.io thanks. That helps, but is still extremely limited. It does at least cover string and vector, but not much else. |
13:43:29 | * | xet7 quit (Remote host closed the connection) |
13:52:58 | FromDiscord | <Rika> PR additions so that it does become the de facto cpp stl to go to |
14:07:48 | FromDiscord | <Tibix> In reply to @RedBeard0531 (Mathias Stearn) "Or just use `uint`": THis worked, thanks |
14:10:27 | FromDiscord | <trevor> Hey folks, is there an easy way to inspect the generated source of a macro? |
14:11:56 | FromDiscord | <aMOPel> What framework would you use for creating a gui app or web app in nim atm? nimx, fidget, karax, jester, prologue or smth else? What's most fleshed out and usable? |
14:13:00 | FromDiscord | <Prestige> @trevor `dumpMacros` |
14:13:11 | FromDiscord | <Prestige> woops, `expandMacros` |
14:13:15 | FromDiscord | <Prestige> https://nim-lang.org/docs/macros.html#expandMacros.m%2Ctyped |
14:14:42 | * | wallabra joined #nim |
14:19:41 | FromDiscord | <Phil> In reply to @voidwalker "I want to turn": The input file is an actual file or are we talking sqlite? |
14:23:03 | FromDiscord | <Phil> If it's a file you'd need to write a script to send the SQL queries for inserts either way and cold do it in there.↵↵If this is 2 tables in the same database, sqlite does have methods for splitting and type casting. Together with "insert into select" it should be possible to write the SQL for that |
14:27:48 | FromDiscord | <Phil> In reply to @aMOPel "What framework would you": Only the front-end? If you really want to use nim I've heard good things about karax.↵The backend? Jester and prologue are widespread, I personally use prologue. Nexus is in development but might interest you since it's planned to have an ORM included, where jester and prologue tell you to plug in and wire up your own. |
14:29:13 | FromDiscord | <Phil> For ORMs for prologue and jester only norm did what I wanted to have, which supports postgres and sqlite. |
14:29:45 | FromDiscord | <aMOPel> and what did you try on the frontend side so far? |
14:30:34 | FromDiscord | <Phil> Since it's web I prefer to work directly with js Frameworks rather than have Nim compile to js. There I use angular |
14:31:45 | FromDiscord | <aMOPel> I see. yeah seeing the frontend web frameworks I was wondering how easily they integrate with other frontend tooling like css preprocessors and tailwind and stuff |
14:31:59 | FromDiscord | <aMOPel> and did you try gui frameworks? |
14:32:40 | FromDiscord | <voidwalker> well i am using csv to import data, and would like the end result to be in sqlite |
14:32:55 | FromDiscord | <Phil> In reply to @aMOPel "and did you try": I haven't done any native gui's ever. But other folks here have and likely can give better input |
14:33:39 | FromDiscord | <aMOPel> did you use backend frameworks in other languages and can give a comparison? |
14:33:42 | FromDiscord | <Phil> Heard good things about owlkettle, and there are nim bindings for gtk |
14:34:15 | FromDiscord | <voidwalker> I am sure this is a very common methid in SQL databases, so I'd rather not write anything but use existing SQL code |
14:36:01 | FromDiscord | <voidwalker> I have two uses cases. A set of singular string values present in a column, and a set of comma separate values present in a column. For the later, as there are no arrays in sqlite, I'd have to implement one in code, or have extra 2 tables, one with (id_of_thing, name) and the other with (key_id, id_of thing1..n) |
14:38:11 | FromDiscord | <Phil> sent a long message, see http://ix.io/44OH |
14:38:15 | * | arkurious joined #nim |
14:39:42 | FromDiscord | <Phil> Ah, maybe should state that I rewrote a django backend in Nim. Made use of an ORM, replicated Django signals, copied the way django does encryption etc |
14:41:06 | FromDiscord | <aMOPel> you used norm and a signal and encryption library for that or built it from the ground up? |
14:41:49 | FromDiscord | <Phil> In reply to @voidwalker "I am sure this": I found https://linuxhint.com/sqlite-import-csv/↵But that requires your CSV to already have the desired format. And the import itself isn't handled via SQL, but a separate functionality |
14:42:57 | FromDiscord | <voidwalker> .import /home/linux/DATA.csv DATA interesting, I wonder if this is available as an SQL query as well |
14:43:07 | FromDiscord | <voidwalker> well, I already wrote the csv to sqlite import thing in nim |
14:43:40 | FromDiscord | <Phil> In reply to @aMOPel "you used norm and": For encryption used the openssl wrapper. For signals I had to build something from scratch. Same for connection pooling. And yeah, v used norm ( for simple queries) and nisane(for complex queries line recursive queries or sqlite fts queries) |
14:44:20 | FromDiscord | <voidwalker> I think normalization is the term I am looking for |
14:44:33 | FromDiscord | <Phil> The good news is, my connection pooling code I turned into a lib so you can use that if you want |
14:45:17 | FromDiscord | <Phil> And I also contributed a couple things I need to norm that weren't there before |
14:45:45 | FromDiscord | <Phil> (edit) "need" => "needes" | "before" => "before, so higher chances it has all the functionality you might need" |
14:46:15 | FromDiscord | <Phil> Norm can't deal well with raw SQL (compared to e.g. Django) , that's where nisane comes in handy |
14:50:02 | FromDiscord | <aMOPel> Nisane looks pretty handy |
14:52:36 | FromDiscord | <Phil> Other than that, jsony for dealing with JSON and zippy for gzip commission have both been fantastic |
14:53:00 | FromDiscord | <Phil> (edit) "commission" => "compression" |
14:54:03 | FromDiscord | <Phil> In reply to @voidwalker ".import /home/linux/DATA.csv DATA interesting,": I wouldn't bet on it, haven't seen it yet at least |
14:56:56 | FromDiscord | <Phil> In terms of docs I found prologue to be pretty good and fairly workable. I haven't worked with jester myself but given that a fair chunk of webdev folks here use it I have to assume it's good as well |
15:01:17 | FromDiscord | <voidwalker> Delivery guy called, will have Mastering nim in 5-6 mins : D |
15:11:44 | FromDiscord | <Phil> In reply to @voidwalker "Delivery guy called, will": Nice! |
15:20:24 | FromDiscord | <voidwalker> Welp, disappointment. Pages are small, not too many, mostly code, and very wide spacing |
15:21:24 | FromDiscord | <voidwalker> This should've been a PDF. does not feel like a reading book, more like a refference doc :\ |
15:22:18 | FromDiscord | <Phil> It provides a starting point for macro's, that alone I'd assume is pretty valuable |
15:22:38 | FromDiscord | <voidwalker> Well, at least I hope it help support nim development, for what it's worth. And that it's concise and ceal enough for a beginner to intermediate programmer like myself to make use of it |
15:22:49 | FromDiscord | <voidwalker> (edit) "ceal" => "clear" |
15:23:15 | FromDiscord | <Phil> I just really wish araq would put the book as a patreon reward |
15:24:08 | FromDiscord | <Phil> ~~i don't wanna unsub for a couple months to finance the book with what would otherwise have been patron money~~ |
15:24:55 | FromDiscord | <Prestige> I also have the physical book, but still want a PDF version |
15:25:18 | FromDiscord | <voidwalker> It kinda sux we're wasting paper, giving amazon a big chunk of the money, for what 90% of use would preffer as a PDF |
15:25:33 | FromDiscord | <voidwalker> Yeah, I payed 70 EUR (w taxes and shipping for it) and I still have to scan it :\ |
15:25:51 | FromDiscord | <Prestige> I really don't want to spend the time scanning every page |
15:26:04 | FromDiscord | <voidwalker> I understand Araq has some feelings about physical books, which I share, but other people might feel different things |
15:26:50 | FromDiscord | <Prestige> The feeling of the paper in this book bothers me a bit, strangely enough |
15:27:24 | FromDiscord | <voidwalker> Yeah this is not the art of computer programming.. |
15:28:26 | FromDiscord | <voidwalker> the quality of the print is also not that great, contrast is bad.. letters are no black enough |
15:28:35 | FromDiscord | <aMOPel> In reply to @Isofruit "Django and spring (python": I was wondering, did you feel like it was worth it to keep it in nim and put all this extra effort? Or was it more of a passion project? |
15:28:38 | FromDiscord | <voidwalker> (edit) "no" => "not" | "enough" => "enough. Feels like a quick laser print" |
15:35:51 | FromDiscord | <voidwalker> @Prestige you know what, you are right.. scanning every page of 300 is a huge waste of time. Going to wait for my ADF scanner to arrive and I'm gonna chop the book up :\ |
15:37:50 | FromDiscord | <Prestige> Good thinking |
15:38:02 | FromDiscord | <flywind> Imo not every part needs to be scanned, for instance part 2. |
15:38:33 | FromDiscord | <Prestige> I think someone else was talking about scanning + OCR'ing it |
15:38:36 | FromDiscord | <Prestige> forget who |
15:39:08 | * | Guest21 joined #nim |
15:39:14 | * | Guest21 quit (Client Quit) |
15:39:53 | FromDiscord | <voidwalker> Hm not sure if I am right, not familiar with the nim community so well, but I could see so far at least 2-3 rather strong and unpopular opinions/perspectives from Araq.. is this root cause for the nimskull fork ? |
15:42:04 | FromDiscord | <Prestige> Could read https://github.com/nim-works/nimskull#FAQ |
15:42:43 | FromDiscord | <haxscramper> more or less |
15:43:57 | FromDiscord | <haxscramper> it was partially converted from the manual, according to author↵(@voidwalker) |
15:45:35 | FromDiscord | <Prestige> God I hate element |
15:45:44 | FromDiscord | <Prestige> Can't figure out how to join a room from an invite link |
15:47:12 | FromDiscord | <voidwalker> Haha yeah same here, been using it for a year and it still felt alien. Now I use nheko, but it's lacking some stuff |
15:47:48 | FromDiscord | <Prestige> I miss when everyone just used irc |
15:48:12 | FromDiscord | <haxscramper> we have IRC |
15:48:34 | FromDiscord | <Prestige> I mean another community I was going to join seems to only exist on matrix |
15:48:58 | FromDiscord | <haxscramper> IIRC you every matrix room has an IRC one somehow |
15:49:04 | FromDiscord | <haxscramper> or maybe it was the other way around |
15:49:11 | FromDiscord | <haxscramper> can join IRC using matrix client |
15:51:08 | FromDiscord | <Phil> In reply to @aMOPel "I was wondering, did": I wanted to learn Nim through this and the speed up was a beneficial side effect.↵If I wanted to write something simple, I likely would pick Django.↵If I wanted to write something fast, given all the ecosystem now has almost all the tooling I could want? Nim every time, particularly since wiring up the existing pieces isn't that much more work, you just need to have an idea on how you want to |
15:54:08 | FromDiscord | <Phil> What I appreciate more than anything in nim over python is the compiler telling you you're doing stuff wrong. You can eliminate entire error classes through this, which you'd need separate tooling for in python (iirc it has a static type checker) |
15:57:27 | FromDiscord | <Phil> I've particularly come to like compile time procs to check some pieces of logic, e.g. for generating many to many queries |
15:59:07 | FromDiscord | <Phil> In reply to @voidwalker "Hm not sure if": I'd wager that him having a short fuse sometimes (from what I've seen on e.g. a recent issue about packaging support) also contributed |
15:59:44 | FromDiscord | <voidwalker> Well short fuses can be fun sometimes. Like Linus has : D |
15:59:53 | FromDiscord | <voidwalker> had.. until he was corrected |
16:00:06 | FromDiscord | <Phil> Man, that dude can explode |
16:01:02 | FromDiscord | <Phil> "you should be retroactively aborted" is a strong take. Not a good one IMO, but that leaves an impression. |
16:27:03 | FromDiscord | <lantos> has anyone got like an automated way to patch nim locally in your own package? |
16:27:43 | FromDiscord | <Yardanico> If you mean the stdlib, there's patchFile |
16:30:06 | FromDiscord | <lantos> sent a code paste, see https://play.nim-lang.org/#ix=44PL |
16:31:04 | FromDiscord | <Rika> must be in nimscript |
16:42:52 | * | kenran joined #nim |
16:43:19 | * | kenran quit (Client Quit) |
16:51:51 | FromDiscord | <lantos> wo it worked. Nim is actually good. |
17:43:05 | FromDiscord | <# Luke> In reply to @Avahe "Can't figure out how": It's easy |
17:43:28 | FromDiscord | <# Luke> Just paste it in this box |
17:43:48 | FromDiscord | <# Luke> https://media.discordapp.net/attachments/371759389889003532/999008667229761627/IMG_1687.png |
17:44:16 | FromDiscord | <dom96> In reply to @Isofruit ""you should be retroactively": wow, didn't hear that quote before |
17:44:55 | FromDiscord | <Prestige> In reply to @ripluke "Just paste it in": Didn't work for me |
17:45:21 | FromDiscord | <Phil> In reply to @dom96 "wow, didn't hear that": I've actually contemplated whether that quote was a bit too harsh to be posted here about 5 minutes after posting it |
17:45:53 | FromDiscord | <Phil> But yeah, Torvalds can be a bit of an ass |
17:46:05 | FromDiscord | <Phil> To put it mildly |
17:46:10 | FromDiscord | <# Luke> In reply to @Avahe "Didn't work for me": Hmm send me a link and I'll try it |
17:47:12 | FromDiscord | <Phil> In reply to @dom96 "wow, didn't hear that": Also! If you have time, I posted an architectural webdev question in the webdev channel, I would also be interested in your opinion ! |
17:47:30 | FromDiscord | <Prestige> I got it working with Cinny, they have an input box for invite links |
17:47:57 | FromDiscord | <dom96> In reply to @Isofruit "Also! If you have": Sure thing, will take a look :) |
18:20:37 | FromDiscord | <Tuatarian> What is the purpose of backticks around a func name if yourw not declaring q custom operator? |
18:21:24 | FromDiscord | <Tuatarian> Say for example is there a difference between func `sgnmod` and func sgnmod? |
18:21:42 | FromDiscord | <Tuatarian> Discord formatting did that one a little dirty |
18:22:23 | FromDiscord | <Tuatarian> sent a code paste, see https://play.nim-lang.org/#ix=44Q7 |
18:24:57 | FromDiscord | <Phil> I...err... Don't think it does anything (?) |
18:46:18 | FromDiscord | <Yardanico> In reply to @iWonderAboutTuatara "What is the purpose": there's no difference, backticks are used when a name you want to use isn't a valid Nim identifier |
18:46:27 | FromDiscord | <Yardanico> useful when doing FFI or some serialization stuff with names from foreign places |
18:46:41 | FromDiscord | <Tuatarian> I see |
18:47:03 | FromDiscord | <Tuatarian> Why are =destroy and such wrapped in backtick? |
18:47:13 | FromDiscord | <Yardanico> because = is not valid in a Nim identifier |
18:47:28 | FromDiscord | <Tuatarian> I see |
18:47:30 | FromDiscord | <Yardanico> you can't do `let =myname = 5` |
18:47:38 | FromDiscord | <Tuatarian> Right |
18:47:41 | FromDiscord | <Tuatarian> Thanks |
18:48:11 | * | noeontheend joined #nim |
19:03:51 | * | duuude joined #nim |
19:04:29 | * | pch quit (Quit: Leaving) |
19:06:23 | * | krux02 joined #nim |
19:18:55 | FromDiscord | <sharpcdf> should i manage downloaded packages in a json file or should i just go through the directory that holds them and manage it directly |
19:19:31 | FromDiscord | <sharpcdf> like look to see if a package exists in a json file or just go through the directory and see if its there |
19:19:47 | FromDiscord | <sharpcdf> right now im doing the latter but idk if the json file would be better |
19:32:15 | FromDiscord | <!Patitotective> In reply to @sharpcdf "should i manage downloaded": why do you want to do that? |
19:32:53 | FromDiscord | <!Patitotective> not sure if `nimble list -i` works in your case |
19:34:56 | FromDiscord | <sharpcdf> In reply to @Patitotective "why do you want": not nimble packages |
19:35:08 | FromDiscord | <sharpcdf> basically folders that im downloading |
19:36:05 | FromDiscord | <sharpcdf> im making a package manager |
19:36:54 | FromDiscord | <!Patitotective> then i think the best would be to go though a directory because someone can maybe delete a folder manually and the json file would be obsolete |
19:37:05 | FromDiscord | <sharpcdf> yea thats what i was thinking |
19:37:07 | FromDiscord | <sharpcdf> thanks |
19:41:41 | FromDiscord | <creikey> Is there any way for a nim library to expose functions to the nimble file?↵Like I want to make a library that does https://github.com/treeform/nim_emscripten_tutorial webassembly stuff for you, so you can do↵`requires "library > 1.0.0"`↵`doWasm()` |
19:42:25 | FromDiscord | <sharpcdf> In reply to @creikey "Is there any way": i dont think nimble files can use user libraries |
19:42:30 | FromDiscord | <sharpcdf> so id assume not |
19:42:32 | FromDiscord | <creikey> In reply to @sharpcdf "i dont think nimble": it can use std though |
19:42:34 | FromDiscord | <creikey> like import nimscript |
19:42:50 | FromDiscord | <sharpcdf> yea but nimscript cant do like `import zippy` |
19:45:52 | FromDiscord | <creikey> https://nimble.directory/pkg/nimterlingua it imports this in the exmaple |
19:45:55 | FromDiscord | <creikey> (edit) "exmaple" => "example" |
19:46:04 | FromDiscord | <creikey> https://media.discordapp.net/attachments/371759389889003532/999039439760269342/unknown.png |
19:46:40 | FromDiscord | <sharpcdf> In reply to @creikey "": thats not nimscript |
19:46:41 | FromDiscord | <sharpcdf> its nim |
19:46:49 | FromDiscord | <sharpcdf> oh wait |
19:46:52 | FromDiscord | <Yardanico> In reply to @sharpcdf "i dont think nimble": they can |
19:46:53 | FromDiscord | <sharpcdf> there is a nimscript example |
19:46:58 | FromDiscord | <Yardanico> .nimble is a nimscript file |
19:47:01 | FromDiscord | <Yardanico> so you can `import` and stuff |
19:47:03 | FromDiscord | <sharpcdf> i guess so |
19:47:05 | FromDiscord | <creikey> https://media.discordapp.net/attachments/371759389889003532/999039698175545424/unknown.png |
19:47:15 | FromDiscord | <sharpcdf> In reply to @creikey "": yea lol i had no idea |
19:47:20 | FromDiscord | <creikey> it can't find this file though https://media.discordapp.net/attachments/371759389889003532/999039758875512892/unknown.png |
19:47:35 | FromDiscord | <aMOPel> Is there some information on how fidget 2 is coming along? |
19:47:44 | FromDiscord | <creikey> https://media.discordapp.net/attachments/371759389889003532/999039861535289485/unknown.png |
19:49:42 | FromDiscord | <!Patitotective> In reply to @creikey "it can't find this": you can import .nim modules in nimscript but you can't import .nims "modules" in .nim/.nims modules |
19:49:49 | FromDiscord | <creikey> oh yeha |
19:49:50 | FromDiscord | <creikey> (edit) "yeha" => "yeah" |
19:49:53 | FromDiscord | <!Patitotective> you should make `helper.nims` `helper.nim` |
19:50:05 | FromDiscord | <creikey> cool it works |
19:50:18 | FromDiscord | <creikey> are `requires` ran before the import or after |
19:50:24 | FromDiscord | <creikey> like can I import a library I requries |
19:50:28 | FromDiscord | <creikey> (edit) "requries" => "requires" |
19:51:06 | FromDiscord | <!Patitotective> i dont think you can but let me try |
19:51:13 | FromDiscord | <creikey> no they arne't |
19:51:16 | FromDiscord | <creikey> (edit) "arne't" => "aren't" |
19:51:19 | FromDiscord | <creikey> I just tested that's a bummer |
19:52:07 | FromDiscord | <!Patitotective> why are you using dependencies in the nimble ? |
19:52:10 | FromDiscord | <!Patitotective> (edit) "nimble ?" => "nimble?" |
19:52:22 | FromDiscord | <creikey> I want to make a library that has easy webassembly support |
19:52:42 | FromDiscord | <!Patitotective> (edit) "nimble?" => "nimble file?" |
19:53:01 | FromDiscord | <creikey> so you can do like `nimble webassembly` or something after doing in the nimble:↵`requires "mylibrary"`↵`import mylibrary`↵`makeWasmTask("webassembly")` |
19:53:56 | FromDiscord | <!Patitotective> why not a cli tool? |
19:54:21 | FromDiscord | <creikey> requiring a separate build tool for people to install is so much worse than just a nimble library |
19:54:36 | FromDiscord | <creikey> now your program needs an external binary you have to update to be built |
19:55:04 | FromDiscord | <creikey> I mean if it's also managed with nimble maybe not so bad |
19:55:19 | FromDiscord | <# Luke> In reply to @Patitotective "why are you using": You can do that? |
19:55:19 | FromDiscord | <creikey> a nimble package like `easywasm` or something you do `nimble install easywasm` then `./easywasm myproj.nimble` |
19:55:25 | FromDiscord | <!Patitotective> you can take a look at↵https://github.com/c-blake/cligen↵or↵https://bitbucket.org/maxgrenderjones/therapist/src/master/ |
19:55:27 | FromDiscord | <!Patitotective> In reply to @ripluke "You can do that?": no |
19:55:33 | FromDiscord | <# Luke> Oh |
19:55:58 | FromDiscord | <!Patitotective> In reply to @creikey "a nimble package like": yea well, when you install easywasm it should install all the deps where the cli tool is |
19:56:12 | FromDiscord | <creikey> wait wait |
19:56:20 | FromDiscord | <!Patitotective> (edit) "at↵https://github.com/c-blake/cligen↵or↵https://bitbucket.org/maxgrenderjones/therapist/src/master/" => "at↵https://github.com/c-blake/cligen↵or↵https://bitbucket.org/maxgrenderjones/therapist" |
19:56:24 | FromDiscord | <creikey> so in the library I'm making I can also provide a cli tool to build nim projects to webassembly |
19:56:35 | FromDiscord | <!Patitotective> yep |
19:56:37 | FromDiscord | <creikey> and they're like together |
19:56:40 | FromDiscord | <creikey> I just provide a binary target in the library's nimble |
19:56:41 | FromDiscord | <creikey> neat |
19:56:46 | FromDiscord | <creikey> this is a good solution thank you |
19:57:01 | FromDiscord | <!Patitotective> :] |
20:02:49 | FromDiscord | <lantos> sent a code paste, see https://play.nim-lang.org/#ix=44QE |
20:03:54 | FromDiscord | <!Patitotective> In reply to @lantos "how can do you": does this fail? |
20:04:54 | FromDiscord | <!Patitotective> In reply to @lantos "how can do you": since it is an `{.async.}` procedure i think it return type must be of type `Future` |
20:04:58 | FromDiscord | <!Patitotective> (edit) "it" => "its" |
20:05:46 | FromDiscord | <lantos> yeah it fails that way |
20:05:58 | FromDiscord | <!Patitotective> In reply to @lantos "yeah it fails that": which way? |
20:06:05 | FromDiscord | <huantian> you'd have to return a `Future[FutureStream[string]]` ig? |
20:06:16 | FromDiscord | <lantos> Expected return type of 'Future' got 'FutureStream'↵asyncmacro.nim(261, 29): async↵asyncmacro.nim(162, 21): asyncSingleProc↵asyncmacro.nim(121, 10): verifyReturnType |
20:06:43 | FromDiscord | <sharpcdf> how can i get colors other than `fgBlue`, etc. in `std.terminal` and use them |
20:07:13 | FromDiscord | <lantos> sent a code paste, see https://play.nim-lang.org/#ix=44QF |
20:07:34 | FromDiscord | <!Patitotective> but if you're awaiting for `bodyStream` it won't be a future? |
20:07:37 | FromDiscord | <!Patitotective> (edit) "future?" => "future (?)" |
20:08:08 | FromDiscord | <Rika> In reply to @sharpcdf "how can i get": What do you mean by other colours |
20:08:26 | FromDiscord | <huantian> yeah you would just return res.bodyStream |
20:08:45 | FromDiscord | <!Patitotective> In reply to @sharpcdf "how can i get": https://nim-lang.org/docs/colors.html#Color ? |
20:09:10 | FromDiscord | <!Patitotective> (edit) "?" => "?↵https://nim-lang.org/docs/terminal.html#setBackgroundColor%2CFile%2CColor" |
20:09:47 | FromDiscord | <Rika> You have to be wary of terminal colours |
20:09:58 | FromDiscord | <sharpcdf> how so |
20:09:59 | FromDiscord | <Rika> There are terminals that do not support colours in that sense |
20:10:42 | FromDiscord | <Rika> There are terminals that only support 2 colours, 8 colours, 16 colours, 256, and full 24 bit |
20:11:14 | FromDiscord | <sharpcdf> then what would the best way of terminal coloring be |
20:11:21 | FromDiscord | <Rika> Anything except 24 bit is “palette based” and you can’t rely on the names of the colours matching the actual colour shown because of theming |
20:11:28 | * | jmdaemon joined #nim |
20:11:40 | FromDiscord | <Rika> You can assume terminals have at least 16 colours |
20:12:27 | FromDiscord | <sharpcdf> In reply to @Rika "Anything except 24 bit": should i use ascii coloring? |
20:12:59 | FromDiscord | <Rika> What do you mean |
20:13:16 | FromDiscord | <Rika> You mean ANSI? |
20:13:24 | FromDiscord | <sharpcdf> oh yea |
20:13:26 | FromDiscord | <sharpcdf> lol |
20:13:33 | * | CyberTailor quit (Quit: Konversation terminated!) |
20:13:43 | FromDiscord | <lantos> In reply to @Patitotective "but if you're awaiting": oops fixed that |
20:13:45 | FromDiscord | <Rika> I believe the terminal library uses that under the hood |
20:13:57 | FromDiscord | <sharpcdf> oh ok |
20:14:28 | FromDiscord | <sharpcdf> i think ill just stick with what im doing right now and change it if i encounter any problems |
20:17:07 | FromDiscord | <sharpcdf> In reply to @Patitotective "https://nim-lang.org/docs/colors.html#Color ? https": is there any way to use it with `styledEcho`? |
20:20:45 | FromDiscord | <!Patitotective> In reply to @sharpcdf "is there any way": doesn't seem so :/ |
20:20:53 | FromDiscord | <sharpcdf> rip |
20:21:57 | * | duuude quit (Ping timeout: 276 seconds) |
20:23:25 | FromDiscord | <!Patitotective> can't you just use set the background/foreground color before styledEcho? |
20:24:12 | FromDiscord | <Hi02Hi> In reply to @creikey "I just provide a": nico is an example of this with nicoboot |
20:27:44 | FromDiscord | <!Patitotective> actually @sharpcdf you can just convert your `Color` using `ansiForegroundColorCode` or `ansiBackgroundColorCode` |
20:28:27 | * | noeontheend quit (Ping timeout: 244 seconds) |
20:29:15 | FromDiscord | <!Patitotective> sent a code paste, see https://play.nim-lang.org/#ix=44QM |
20:29:21 | FromDiscord | <!Patitotective> where `fgBlue` is your `Color` |
20:41:19 | FromDiscord | <dankey> sent a code paste, see https://play.nim-lang.org/#ix=44QO |
20:43:31 | FromDiscord | <!Patitotective> what is `i` |
20:43:40 | FromDiscord | <treeform> it expands the i to full the args of print |
20:43:57 | FromDiscord | <treeform> `print(i)` -> `print(i[0], i[1])` |
20:44:14 | FromDiscord | <treeform> There is probably a macro one could write |
20:44:23 | FromDiscord | <treeform> but this is just not the code that should happen often in nim |
20:44:47 | FromDiscord | <treeform> in python you operate on "unstructured" data a ton, like lists or tuples of random types |
20:44:54 | FromDiscord | <treeform> in Nim you should just not do that |
20:44:57 | FromDiscord | <dankey> sent a code paste, see https://play.nim-lang.org/#ix=44QR |
20:45:10 | FromDiscord | <dankey> (edit) |
20:45:25 | FromDiscord | <dankey> In reply to @treeform "in Nim you should": tnx but idc i just want to explore the lang |
20:45:30 | FromDiscord | <dankey> if anyone got a suggestion id like that |
20:46:07 | FromDiscord | <treeform> I think in nim all call arguments needs to be known at compile time |
20:46:32 | FromDiscord | <treeform> `print(range(i))` is not possible with dynamic range |
20:46:44 | FromDiscord | <treeform> if range(i) is known at compile time that can work |
20:47:06 | FromDiscord | <dankey> let's say that it is |
20:47:13 | FromDiscord | <treeform> if you only care about printing you can write a custom print that just prints the list |
20:47:34 | FromDiscord | <dankey> sure |
20:47:41 | * | duuude joined #nim |
20:47:41 | FromDiscord | <dankey> not what i wanted tho |
20:51:59 | FromDiscord | <treeform> https://play.nim-lang.org/#ix=44QS |
20:52:47 | FromDiscord | <treeform> I don't remember how range works in python is it inclusive or exclusive? |
20:52:53 | FromDiscord | <treeform> you can change to what you need |
20:53:30 | FromDiscord | <treeform> what does it print in python? |
20:58:24 | FromDiscord | <dankey> exclusive |
20:58:32 | FromDiscord | <dankey> thank you ill check it one in a minute |
20:58:53 | FromDiscord | <dankey> meanwhile is there a better way to annotate a tuple than `tuple[a: int, b: int]` ? |
20:59:25 | FromDiscord | <!Patitotective> In reply to @dankey "meanwhile is there a": `tuple[a, b: int]` lol |
21:00:02 | FromDiscord | <dankey> In reply to @Patitotective "`tuple[a, b: int]` lol": how about if i already know it's always size 2 |
21:00:09 | FromDiscord | <dankey> is there maybe another ds for that? |
21:00:32 | FromDiscord | <dankey> more suited one i mean |
21:00:38 | FromDiscord | <!Patitotective> sent a code paste, see https://play.nim-lang.org/#ix=44QV |
21:00:43 | FromDiscord | <!Patitotective> In reply to @dankey "how about if i": nope |
21:00:53 | FromDiscord | <dankey> tnx! |
21:10:23 | * | krux02 quit (Remote host closed the connection) |
21:10:46 | NimEventer | New thread by Patitotective: Nim v1.6.6 support for Codewars, see https://forum.nim-lang.org/t/9310 |
21:14:33 | FromDiscord | <huantian> @!Patitotective what does it mean for a kata to need an update? for example I just did this one <https://www.codewars.com/kata/53da3dbb4a5168369a0000fe/nim>↵ which was super hard, but I got it |
21:14:39 | FromDiscord | <huantian> but it didn't seem to have any issues |
21:15:44 | FromDiscord | <huantian> oh ig it's in the test cases? |
21:21:07 | FromDiscord | <huantian> huh so once it's fixed, where is this fabled publish button |
21:21:50 | FromDiscord | <!Patitotective> https://media.discordapp.net/attachments/371759389889003532/999063536774942720/unknown.png |
21:21:56 | FromDiscord | <huantian> ah I had to save first |
21:22:30 | FromDiscord | <huantian> <https://www.codewars.com/kumite/62d7206318c60fa0b705f758?sel=62d7206318c60fa0b705f758>↵wow I'm a profession nimmer! |
21:22:50 | FromDiscord | <!Patitotective> nice :] |
21:28:58 | * | noeontheend joined #nim |
21:33:09 | FromDiscord | <pouriya.jamshidi> sent a long message, see http://ix.io/44R1 |
21:33:31 | FromDiscord | <pouriya.jamshidi> (edit) "long message," => "code paste," | "http://ix.io/44R1" => "https://play.nim-lang.org/#ix=44R2" |
21:34:03 | FromDiscord | <pouriya.jamshidi> (edit) |
21:35:07 | FromDiscord | <sOkam!> Is `{.varargs.} {.cdecl.}` the same as `{.varargs, cdecl.}`? |
21:36:06 | FromDiscord | <!Patitotective> In reply to @sOkam! "Is `{.varargs.} {.cdecl.}` the": yes... |
21:37:28 | * | noeontheend quit (Remote host closed the connection) |
21:38:12 | FromDiscord | <!Patitotective> sent a code paste, see https://play.nim-lang.org/#ix=44R4 |
21:38:58 | FromDiscord | <pouriya.jamshidi> In reply to @Patitotective "what do you mean": correct. but those are the default values. I modified my question and added the way I run the command |
21:39:35 | FromDiscord | <pouriya.jamshidi> (edit) "command" => "command. The value I provide in the terminal is not shown in the program" |
21:42:07 | FromDiscord | <!Patitotective> well @pouriya.jamshidi thats because you're initializing the opt parser with `--recv_q=600 --send_q=600` not with `commandLineParams` |
21:43:29 | * | duuude quit (Ping timeout: 268 seconds) |
21:44:22 | FromDiscord | <pouriya.jamshidi> In reply to @Patitotective "well <@807159997627891752> thats because": ah I see. So I have to utilize `commandLineParams` and then feed it to opt parser? |
21:44:44 | FromDiscord | <!Patitotective> checkout https://nim-lang.org/docs/parseopt.html#getopt.i%2Cseq%5Bstring%5D%2Cset%5Bchar%5D%2Cseq%5Bstring%5D |
21:45:49 | FromDiscord | <!Patitotective> also you might want to check↵- https://github.com/c-blake/cligen↵- https://bitbucket.org/maxgrenderjones/therapist |
21:47:35 | FromDiscord | <pouriya.jamshidi> In reply to @Patitotective "also you might want": thanks a lot. I was trying to just utilize the standard library and learn to read them 😄 ↵↵really appreciate your help. |
21:51:44 | * | noeontheend joined #nim |
21:51:56 | * | noeontheend quit (Client Quit) |
21:52:15 | FromDiscord | <!Patitotective> sent a code paste, see https://play.nim-lang.org/#ix=44R5 |
21:54:13 | * | noeontheend joined #nim |
22:00:36 | FromDiscord | <sOkam!> sent a code paste, see https://play.nim-lang.org/#ix=44R9 |
22:01:14 | FromDiscord | <jan0809> isnt rotation something youd do to a tensor? |
22:01:24 | FromDiscord | <!Patitotective> In reply to @sOkam! "What's the correct way": doesnt `\"` work? |
22:01:31 | FromDiscord | <jan0809> or what kind of rotating |
22:01:36 | FromDiscord | <sOkam!> In reply to @Patitotective "doesnt `\"` work?": don't know, asking |
22:01:51 | FromDiscord | <sOkam!> since I currently have no way of testing it, that I know of |
22:02:01 | FromDiscord | <creikey> I'm trying to wrap my head around how treeform's jsony works: https://github.com/treeform/jsony/blob/master/src/jsony.nim#L563 , how does nim know which function to call after this one? |
22:02:11 | FromDiscord | <creikey> and why is x a parameter, it seems unused? |
22:02:12 | FromDiscord | <!Patitotective> In reply to @sOkam! "since I currently have": well it shouldnt compile if it doesnt work |
22:02:26 | FromDiscord | <sOkam!> yes, but i dont have anything that compiles with that |
22:02:35 | FromDiscord | <sOkam!> so can't really test yet |
22:03:13 | FromDiscord | <huantian> In reply to @creikey "and why is x": x lets you specify the return type (and thus the type of `result`) without using a generic parameter with `[]` |
22:03:30 | FromDiscord | <huantian> once nim knows the type of `result`, it can use overloading to determine which `parseHook` to call |
22:03:33 | FromDiscord | <sOkam!> the lsp does mark it as escaped `"`, so I guess i will trust it for now 🤔 |
22:03:57 | FromDiscord | <!Patitotective> In reply to @sOkam! "the lsp does mark": nimlsp has some bugs but yeah lol |
22:04:08 | FromDiscord | <creikey> In reply to @huantian "x lets you specify": why not use the generic form? |
22:04:15 | FromDiscord | <!Patitotective> In reply to @jan0809 "or what kind of": string |
22:04:21 | FromDiscord | <!Patitotective> In reply to @jan0809 "isnt rotation something youd": i dunno |
22:04:36 | FromDiscord | <huantian> you have to use `[:T]` form when using generic procs with UFC |
22:04:46 | FromDiscord | <jan0809> what would rotating a string do? |
22:04:51 | FromDiscord | <huantian> so this just saves you from having to do that |
22:05:17 | FromDiscord | <!Patitotective> sent a code paste, see https://play.nim-lang.org/#ix=44Ra |
22:05:35 | FromDiscord | <huantian> `"""{"some": "json"}""".fromJson(SomeType)` |
22:05:47 | FromDiscord | <huantian> instead of `"""{"some": "json"}""".fromJson[:SomeType]` |
22:06:21 | FromDiscord | <creikey> the compiles macro is crazy |
22:06:26 | FromDiscord | <creikey> I think I get how jsony works now |
22:06:31 | FromDiscord | <creikey> this is so cool |
22:10:21 | FromDiscord | <huantian> jsony is awesome |
22:10:39 | FromDiscord | <creikey> I wish there was fromJson(j: JsonNode) |
22:10:46 | FromDiscord | <creikey> I don't think it's really possible though |
22:10:53 | FromDiscord | <Dale> Are there any good libs for yaml? |
22:10:54 | FromDiscord | <!Patitotective> sent a code paste, see https://play.nim-lang.org/#ix=44Rb |
22:11:04 | FromDiscord | <huantian> Isn’t there one called yaml |
22:11:18 | FromDiscord | <creikey> In reply to @Dale "Are there any good": https://nimyaml.org/ |
22:11:31 | FromDiscord | <# Luke> In reply to @creikey "https://nimyaml.org/": Was just about to send that lol |
22:11:47 | FromDiscord | <creikey> jsony is a work of art |
22:12:00 | FromDiscord | <creikey> so simple |
22:12:06 | FromDiscord | <Dale> Ah thanks that looks about as good as jsony |
22:12:47 | FromDiscord | <sOkam!> What's the difference between `ptr` and `pointer`? Are they different? |
22:13:11 | FromDiscord | <huantian> In reply to @creikey "I wish there was": Do you mean json string to json node or json node to object |
22:13:59 | FromDiscord | <creikey> In reply to @huantian "Do you mean json": json node to object |
22:14:29 | FromDiscord | <huantian> In reply to @sOkam! "What's the difference between": Yeah that’s not really possible without rewriting all the parsehooks to go from json node to T as well |
22:14:41 | FromDiscord | <creikey> so the struct is like |
22:14:42 | FromDiscord | <creikey> sent a code paste, see https://play.nim-lang.org/#ix=44Rc |
22:14:47 | FromDiscord | <!Patitotective> In reply to @sOkam! "What's the difference between": `ptr T` is a pointer to an object of a certain type↵even though it gets later converted into an untyped pointer `pointer` |
22:15:04 | FromDiscord | <creikey> sent a code paste, see https://paste.rs/sVO |
22:15:09 | FromDiscord | <sOkam!> In reply to @Patitotective "`ptr T` is a": makes sense, ty |
22:15:15 | FromDiscord | <creikey> and want to only set the fields that exist in newPlayer on a Player |
22:15:31 | FromDiscord | <huantian> Why not just use optionals |
22:15:42 | FromDiscord | <creikey> lot of fields would need an optional for every singlef ield |
22:15:43 | FromDiscord | <creikey> (edit) "singlef ield" => "single field" |
22:15:59 | FromDiscord | <creikey> and then `if newPlayer.field1.isSome()` ... |
22:16:00 | FromDiscord | <creikey> (edit) "..." => "etc" |
22:16:28 | FromDiscord | <huantian> You could probably make a macro to do that for you 😛 but that might just be unnecessary complexity |
22:16:32 | FromDiscord | <creikey> yeah |
22:16:44 | FromDiscord | <creikey> I mean right now I just have a separate message for each field of player that needs to be changed |
22:16:56 | FromDiscord | <huantian> Though maybe you could generalize it just with fieldPairs and templates |
22:17:37 | FromDiscord | <creikey> can you set object fields by runtime strings? |
22:17:46 | FromDiscord | <creikey> or like refer to a field of an object with a variable |
22:18:01 | FromDiscord | <creikey> I think this is runtime time information right |
22:18:03 | FromDiscord | <jan0809> ah is there a way to make a field of custom type validate against regex |
22:18:25 | FromDiscord | <jan0809> a string field obviously |
22:18:28 | FromDiscord | <Elegantbeef> Creikey you can do it without type information |
22:18:34 | * | duuude joined #nim |
22:18:50 | FromDiscord | <creikey> In reply to @Elegantbeef "Creikey you can do": how you need to know the names of the fields on the struct ight |
22:18:52 | FromDiscord | <creikey> (edit) "ight" => "right" |
22:18:54 | FromDiscord | <creikey> at runtime to compare to |
22:19:08 | FromDiscord | <creikey> and then set the corresponding field on the struct from the name |
22:19:21 | FromDiscord | <creikey> https://media.discordapp.net/attachments/371759389889003532/999078018838442016/unknown.png |
22:19:47 | FromDiscord | <Elegantbeef> sent a code paste, see https://play.nim-lang.org/#ix=44Ri |
22:19:52 | FromDiscord | <creikey> sent a code paste, see https://play.nim-lang.org/#ix=44Rk |
22:20:14 | FromDiscord | <creikey> https://media.discordapp.net/attachments/371759389889003532/999078235029655642/unknown.png |
22:20:17 | FromDiscord | <creikey> what's up with this bug |
22:20:25 | FromDiscord | <Elegantbeef> What bug? |
22:20:29 | FromDiscord | <creikey> In reply to @Elegantbeef "What bug?": the warning |
22:20:32 | FromDiscord | <creikey> sent a code paste, see https://play.nim-lang.org/#ix=44Rl |
22:20:43 | FromDiscord | <Elegantbeef> Loop unrolling is an important note, the other part i dont know |
22:20:59 | FromDiscord | <Elegantbeef> I've never ran into the latter issue, though i think it might be related to `fmt` like macros |
22:21:10 | FromDiscord | <creikey> nim is getting too crazy |
22:21:19 | FromDiscord | <Elegantbeef> "getting" |
22:21:36 | FromDiscord | <creikey> so complicated but so simple |
22:21:52 | FromDiscord | <Elegantbeef> Worth noting `fieldPairs` and `fields` does not work on variants |
22:21:53 | FromDiscord | <Dale> Have you thought about using a hashmap creiky ? |
22:22:00 | FromDiscord | <creikey> In reply to @Dale "Have you thought about": yeah |
22:22:00 | FromDiscord | <creikey> meh |
22:22:02 | FromDiscord | <Elegantbeef> You'd want to use disruptek/assume/typeit |
22:22:07 | FromDiscord | <creikey> not typesafe on fields |
22:22:28 | FromDiscord | <sOkam!> sent a code paste, see https://play.nim-lang.org/#ix=44Rm |
22:22:29 | FromDiscord | <Dale> You can use asserts? |
22:22:41 | FromDiscord | <creikey> In reply to @Dale "You can use asserts?": all the values aren't the same either |
22:22:55 | FromDiscord | <sOkam!> (edit) "https://play.nim-lang.org/#ix=44Rm" => "https://play.nim-lang.org/#ix=44Rn" |
22:22:58 | FromDiscord | <Elegantbeef> It means it offsets the pointer by 1 byte |
22:23:01 | FromDiscord | <Dale> What about a hashmap of procs? |
22:23:21 | FromDiscord | <Dale> The map points to get/sets |
22:23:23 | FromDiscord | <creikey> hashmap might actually be faster because this call might be happening often |
22:23:52 | FromDiscord | <huantian> Would it be hard to use a macro to generate an PlayerUpdate object that wraps all the fields with Option, then make another update proc which uses fieldPairs to automate checking the options and assigning the new value? |
22:24:34 | FromDiscord | <creikey> sent a code paste, see https://play.nim-lang.org/#ix=44Ro |
22:24:45 | FromDiscord | <Elegantbeef> Of course it's a simple solution |
22:24:46 | FromDiscord | <creikey> In reply to @huantian "Would it be hard": not worth now that I'm looking at jsony and it's already doing what I'd do on the JsonNode |
22:25:04 | FromDiscord | <creikey> I think I can half the size of the server code with this |
22:25:40 | FromDiscord | <creikey> I made like 5 message types for different updates on the player but I can just do one called `PlayerUpdate` now where you provide the updated fields |
22:25:45 | FromDiscord | <sOkam!> In reply to @Elegantbeef "It means it offsets": right, but what does it mean to offset a pointer by -1?↵I get that +1 is "get the next element"... but why offsetting on the opposite way? what if its a value of `0`?.... or can't it not be 0 at all? |
22:26:05 | FromDiscord | <Elegantbeef> I can only tell you what it does if it's not documented i dont know why |
22:26:24 | FromDiscord | <sOkam!> ✍️ |
22:26:48 | FromDiscord | <creikey> I don't understand how fieldpairs works, is it some compiler magic? how does it write to the value of the struct without the value being a ref type? |
22:26:50 | FromDiscord | <sOkam!> ok. lets say i want to offset a pointer by some `N` value in nim↵is that possible? |
22:27:39 | FromDiscord | <!Patitotective> Is `@['a', 'b', 'c'].join` the best way to join a seq of chars to make a stirng? |
22:27:53 | FromDiscord | <Dale> I think so |
22:28:36 | FromDiscord | <creikey> I wish jsony let you skip fields for dumphook |
22:28:42 | FromDiscord | <creikey> like fields of objects |
22:28:55 | FromDiscord | <creikey> In reply to @Patitotective "Is `@['a', 'b', 'c'].join`": no, doesn't this allocate a new string? |
22:29:06 | FromDiscord | <creikey> if it's a sequence you can append a null terminator then cast to string I think |
22:29:17 | FromDiscord | <creikey> subtract one from the length after doing that |
22:29:19 | FromDiscord | <creikey> I think |
22:31:36 | FromDiscord | <!Patitotective> do you guys think making a PR to add the rotations algorithm to std/algorithm is worth? 🤔 |
22:31:52 | FromDiscord | <!Patitotective> sent a code paste, see https://play.nim-lang.org/#ix=44Rr |
22:32:36 | FromDiscord | <# Luke> Sure ig they might come in handy to someone |
22:33:14 | FromDiscord | <Elegantbeef> Aslong as it's efficiently written |
22:33:21 | FromDiscord | <sOkam!> sent a code paste, see https://play.nim-lang.org/#ix=44Rs |
22:33:40 | FromDiscord | <NiChrosia> cast[pointer](cast[int](ptrToData) + offset)) |
22:33:47 | FromDiscord | <NiChrosia> at the very least |
22:33:54 | FromDiscord | <NiChrosia> not sure if there's special functions for pointer math |
22:34:29 | FromDiscord | <Elegantbeef> `cast[ptr UncheckedArray[T]](myPtr)[-1]` if it's a collection you want to offset a collection |
22:34:46 | FromDiscord | <Elegantbeef> There isnt pointer arithmetic built into Nim there are libraries for it |
22:35:09 | FromDiscord | <sOkam!> In reply to @Elegantbeef "`cast[ptr UncheckedArray[T]](myPtr)[-1]` if it's": wdym by collection? |
22:35:17 | FromDiscord | <NiChrosia> (edit) "cast[pointer](cast[int](ptrToData)" => "`cast[pointer](cast[int](ptrToData)" | "offset))" => "offset))`" |
22:35:21 | FromDiscord | <sOkam!> isn't a pointer just an int? not sure i follow |
22:35:27 | FromDiscord | <Elegantbeef> Heap allocated array that you hold a pointer to |
22:35:40 | FromDiscord | <Elegantbeef> the example is just `cast[int](myAddr) - 1` |
22:35:44 | FromDiscord | <sOkam!> there is nothing storying anything |
22:35:50 | FromDiscord | <sOkam!> its just types definitions so far |
22:36:15 | FromDiscord | <sOkam!> one of the type definitions is a pointer to some other type, but offset by -1 |
22:36:26 | FromDiscord | <sOkam!> (edit) "one of the type definitions is a pointer to some other ... type," added "pointer" |
22:36:28 | FromDiscord | <Elegantbeef> That's not at type definition |
22:36:41 | FromDiscord | <sOkam!> well, that's what the C code is doing tho 😔 |
22:36:44 | FromDiscord | <!Patitotective> no way they already existed https://nim-lang.org/docs/algorithm.html#rotateLeft%2CopenArray%5BT%5D%2Cint |
22:36:44 | FromDiscord | <Elegantbeef> That's a static pointer proc |
22:36:54 | FromDiscord | <sOkam!> ah tru |
22:37:17 | FromDiscord | <!Patitotective> but it's weird there is no `permutations` or `rotations` just left/right |
22:37:32 | FromDiscord | <Elegantbeef> There are permuations |
22:37:46 | FromDiscord | <Elegantbeef> https://nim-lang.org/docs/algorithm.html#nextPermutation%2CopenArray%5BT%5D |
22:38:24 | FromDiscord | <!Patitotective> In reply to @Elegantbeef "There are permuations": yes but only `nextPermutation` not a `permutations` procedure that returns all the permutations |
22:38:52 | FromDiscord | <Elegantbeef> Cause `collect` and `toSeq` exists |
22:39:18 | FromDiscord | <!Patitotective> 🤨 |
22:39:24 | FromDiscord | <!Patitotective> can you show an example |
22:39:27 | FromDiscord | <Elegantbeef> Also> If you start with an unsorted array/seq, the repeated permutations will not give you all permutations but stop with the last. |
22:40:27 | FromDiscord | <Elegantbeef> I might be wrong though |
22:40:28 | FromDiscord | <Elegantbeef> sent a code paste, see https://play.nim-lang.org/#ix=44Rt |
22:40:57 | FromDiscord | <Prestige> Elegantbeef maybe I should take a stab at fixing the issue you had a solution for |
22:41:06 | FromDiscord | <Prestige> Which will probably mostly consist of bugging Araq |
22:41:19 | FromDiscord | <Prestige> This https://github.com/nim-lang/Nim/issues/19371 |
22:41:28 | FromDiscord | <Elegantbeef> I mean the issue is just down to multiple steps of nimsuggest |
22:42:03 | FromDiscord | <Prestige> I just have 0 knowledge of it, but I'm down to learn at this point |
22:42:13 | FromDiscord | <Prestige> tired of having to disable nimsuggest |
22:42:33 | FromDiscord | <Elegantbeef> Well have fun he explained how to find where |
22:42:44 | FromDiscord | <Elegantbeef> But i looked found where and didnt get how to solve it |
22:44:36 | FromDiscord | <!Patitotective> is there a table to seq of tuples proc? |
22:45:01 | FromDiscord | <Elegantbeef> `myTable.pairs.toSeq` |
22:47:15 | FromDiscord | <creikey> wonder why this is true https://media.discordapp.net/attachments/371759389889003532/999085037645467738/unknown.png |
22:47:19 | FromDiscord | <creikey> wait |
22:47:22 | FromDiscord | <creikey> field loops are probably just unrolled |
22:47:25 | FromDiscord | <creikey> that's what it said |
22:47:29 | FromDiscord | <Elegantbeef> "probably" 😄 |
22:47:41 | FromDiscord | <creikey> In reply to @Elegantbeef ""probably" 😄": I could be being trolled by the docs you neve rknow |
22:47:43 | FromDiscord | <creikey> (edit) "neve rknow" => "never know" |
22:48:04 | FromDiscord | <Elegantbeef> You just do thing with a `when` instead |
22:48:19 | FromDiscord | <Elegantbeef> how do you have a for loop that is heterogenous? |
22:48:46 | FromDiscord | <demotomohiro> sent a long message, see http://ix.io/44Rv |
22:52:05 | FromDiscord | <creikey> trying to add skiphook to jsony right now |
22:52:10 | FromDiscord | <creikey> https://media.discordapp.net/attachments/371759389889003532/999086271710363738/unknown.png |
22:52:10 | FromDiscord | <creikey> like this |
22:52:28 | FromDiscord | <creikey> sent a code paste, see https://play.nim-lang.org/#ix=44Rw |
22:52:42 | FromDiscord | <creikey> want skipField to not be in the serialized json |
22:52:47 | FromDiscord | <creikey> skip over the work of serializing it |
22:52:57 | FromDiscord | <Elegantbeef> Just make your own json hook |
22:53:01 | FromDiscord | <!Patitotective> sent a code paste, see https://play.nim-lang.org/#ix=44Rx |
22:53:10 | FromDiscord | <creikey> In reply to @Elegantbeef "Just make your own": for dumping the whole object? |
22:53:42 | FromDiscord | <Elegantbeef> Yes |
22:54:09 | FromDiscord | <creikey> like this https://media.discordapp.net/attachments/371759389889003532/999086769830121543/unknown.png |
22:54:13 | FromDiscord | <creikey> you're so right honestly |
22:54:18 | FromDiscord | <creikey> this is not that much code |
22:54:36 | FromDiscord | <sOkam!> sent a code paste, see https://play.nim-lang.org/#ix=44Rz |
22:55:43 | FromDiscord | <Elegantbeef> sent a code paste, see https://play.nim-lang.org/#ix=44RB |
22:56:08 | FromDiscord | <huantian> well dumphook of the field wont' give you the eky |
22:56:12 | FromDiscord | <creikey> sent a code paste, see https://play.nim-lang.org/#ix=44RC |
22:56:13 | FromDiscord | <Elegantbeef> It made a static pointer proc so make that `var sysCall = proc(syscalPtr: pointer) =...`↵(@sOkam!) |
22:56:14 | FromDiscord | <huantian> it's just the field value |
22:56:27 | FromDiscord | <Elegantbeef> I've never used jsony |
22:56:31 | FromDiscord | <Elegantbeef> So give me a break |
22:56:43 | FromDiscord | <creikey> I think to do it you need to copy paste the object dumphook |
22:57:00 | FromDiscord | <Elegantbeef> I much prefer the stdlib json hooks |
22:57:17 | FromDiscord | <Elegantbeef> but yes they're slower |
22:57:58 | FromDiscord | <huantian> In reply to @creikey "like this": but yeah your skipHook should be a compile time proc and you should use `when not...` instead of `if not...` |
22:58:24 | FromDiscord | <Elegantbeef> Wait jsony supports skiphooks already? |
22:58:27 | FromDiscord | <sOkam!> sent a code paste, see https://play.nim-lang.org/#ix=44RE |
22:58:31 | FromDiscord | <creikey> In reply to @Elegantbeef "Wait jsony supports skiphooks": no I added that |
22:58:34 | FromDiscord | <creikey> but it doesn't seem to be working |
22:58:36 | FromDiscord | <Elegantbeef> Nim doesnt have a `...` operator |
22:58:44 | FromDiscord | <huantian> I'm using ... to mean the rest of the line lol |
22:58:54 | FromDiscord | <creikey> because the skiphook isn't called because the type isn't the type i define the skiphook on it's just `object` |
22:59:01 | FromDiscord | <sOkam!> ok, didn't know. so it means that thing? |
23:03:18 | FromDiscord | <sOkam!> sent a code paste, see https://play.nim-lang.org/#ix=44RH |
23:10:44 | FromDiscord | <sOkam!> sent a code paste, see https://play.nim-lang.org/#ix=44RL |
23:14:08 | FromDiscord | <!Patitotective> ~~futhark~~ |
23:14:20 | FromDiscord | <sOkam!> its a dll interface |
23:14:25 | FromDiscord | <sOkam!> else i would |
23:19:19 | FromDiscord | <sOkam!> In reply to @sOkam! "Code that its giving": @mratsim I discovered that the pointer needs to be offset by -1↵Any clue? About this? 🤔 |
23:21:45 | FromDiscord | <Elegantbeef> Ah yes the most specific version is used↵(@creikey) |
23:22:10 | FromDiscord | <creikey> https://github.com/treeform/jsony/issues/50 made an issue for it |
23:24:24 | FromDiscord | <Elegantbeef> Personally i'd go for a `template jsonySkip{.pragma.}` so you can just do `conn {.jsonySkip.}: WebSocket` |
23:24:53 | FromDiscord | <Elegantbeef> I'd also say a `template jsonyName(name: string){.pragma.}` would be nice |
23:24:54 | FromDiscord | <Elegantbeef> So you can give custom names |
23:24:55 | FromDiscord | <Elegantbeef> Without a user defined hook |
23:25:33 | FromDiscord | <huantian> plus one on the pragmas |
23:26:06 | FromDiscord | <Elegantbeef> It's a bit odd serialisation libraries dont use pragmas more |
23:26:51 | FromDiscord | <Elegantbeef> You can do so manything in a less redundant way |
23:29:48 | FromDiscord | <Elegantbeef> The `newHook` could be just a `{.jsonDefault:someVal.}` for the most part |
23:30:18 | FromDiscord | <huantian> also this is one way to do per-field serialization |
23:30:19 | FromDiscord | <Elegantbeef> Rename hook would just be the `jsonName` |
23:30:24 | FromDiscord | <creikey> I'm not sure I understand |
23:30:30 | FromDiscord | <creikey> In reply to @Elegantbeef "Personally i'd go for": this |
23:30:37 | FromDiscord | <creikey> how do you see if a field has that tempalte |
23:30:38 | FromDiscord | <Elegantbeef> Use pragmas to replace hooks cause hooks are tedious |
23:30:39 | FromDiscord | <creikey> (edit) "tempalte" => "template" |
23:30:43 | FromDiscord | <Elegantbeef> It doesnt |
23:30:59 | FromDiscord | <Elegantbeef> Nim allows you to make template pragmas and you can then access them with macros |
23:31:07 | FromDiscord | <creikey> well like adding that jsonySkip pragma doesn't change jsony behavior right |
23:31:08 | FromDiscord | <Elegantbeef> They're basically markers |
23:31:17 | FromDiscord | <Elegantbeef> No but it should is what i'm saying |
23:31:19 | FromDiscord | <creikey> you need to check for it in the fieldpairs loop over its fields |
23:31:24 | FromDiscord | <creikey> yeah how do you check for it |
23:31:35 | FromDiscord | <creikey> `when field.has(jsonySkip)` |
23:31:37 | FromDiscord | <creikey> this is what I mean |
23:32:03 | FromDiscord | <Elegantbeef> sent a code paste, see https://play.nim-lang.org/#ix=44RQ |
23:32:13 | FromDiscord | <creikey> that's pretty good |
23:32:27 | FromDiscord | <Elegantbeef> you can also do `getCustomPragmaVal` |
23:33:15 | FromDiscord | <Elegantbeef> https://play.nim-lang.org/#ix=44tI it's not for json but this is an example i wrote the otherday for dale |
23:33:29 | FromDiscord | <Elegantbeef> Suffice to say you can do alot with pragmas |
23:33:39 | FromDiscord | <creikey> pretty cool code |
23:37:36 | FromDiscord | <Elegantbeef> I might miss the point of the `newHook` and the `postHook` of jsony, but to me it seems those can be just done inside the `parseHook` |
23:38:30 | FromDiscord | <huantian> mm sometimes for postHook you can say process your data to get rid of stuff you dont' want |
23:39:44 | FromDiscord | <Elegantbeef> Doesnt a parseHook already do that? |
23:40:36 | FromDiscord | <sharpcdf> should my search proc print every repo that has the term in the name or ever repo thats name == the term |
23:40:44 | FromDiscord | <sharpcdf> `jtr search term` |
23:40:54 | FromDiscord | <Elegantbeef> sent a code paste, see https://play.nim-lang.org/#ix=44RS |
23:41:08 | FromDiscord | <sharpcdf> (edit) "ever" => "every" |
23:41:14 | FromDiscord | <Elegantbeef> Depends on how useful you want the search↵(@sharpcdf) |
23:41:25 | FromDiscord | <Elegantbeef> Exact matches suck |
23:41:28 | FromDiscord | <sharpcdf> In reply to @Elegantbeef "Depends on how useful": max usefulness?? |
23:41:31 | FromDiscord | <sharpcdf> ah ok |
23:41:41 | FromDiscord | <creikey> can `FieldDefect` be caught? |
23:41:47 | FromDiscord | <Elegantbeef> Why are you even searching and not just using the github api |
23:41:55 | FromDiscord | <sharpcdf> In reply to @Elegantbeef "Why are you even": i am using the api |
23:41:58 | FromDiscord | <sharpcdf> to search |
23:42:00 | FromDiscord | <Elegantbeef> It's a defect it's not meant to be but you can if you have `--panics:off`↵(@creikey) |
23:42:03 | * | qwr joined #nim |
23:42:15 | FromDiscord | <creikey> In reply to @Elegantbeef "It's a defect it's": does the nim playground have this by default? |
23:42:20 | FromDiscord | <Elegantbeef> No |
23:42:32 | FromDiscord | <sharpcdf> In reply to @Elegantbeef "Why are you even": but the thing is i plan on searching through 4 different sources so if it isnt an exact match than its gonna print a shit ton of repos |
23:42:37 | FromDiscord | <creikey> In reply to @Elegantbeef "No": https://play.nim-lang.org/#ix=44RT |
23:43:09 | FromDiscord | <Elegantbeef> defects can be caught in debug |
23:43:20 | FromDiscord | <sOkam!> Can a type be restricted to only being a pointer? |
23:43:36 | FromDiscord | <sOkam!> (edit) "pointer?" => "pointer of that type?" |
23:43:59 | FromDiscord | <sOkam!> or is that done during assignment only? |
23:44:07 | FromDiscord | <Elegantbeef> What? |
23:44:19 | FromDiscord | <Elegantbeef> `ptr T` is a pointer of T |
23:44:38 | qwr | there seems to be something fishy with ARC when passing lambdas around, i've got in few days another case where it breaks down, but trying to simplify the test-cases is hard, in both cases the bug tends to disappear with simpler code... |
23:44:39 | FromDiscord | <sOkam!> sent a code paste, see https://play.nim-lang.org/#ix=44RV |
23:44:43 | FromDiscord | <sOkam!> not a function, a pointer function |
23:45:02 | FromDiscord | <Elegantbeef> Just assign a proc to a variable |
23:45:31 | FromDiscord | <Elegantbeef> Creikey the proper way to do what you're doing is check the `kind` of the json node and if it's not a bool raise an exception then handle that |
23:45:56 | FromDiscord | <Elegantbeef> Qwr are your lambdas capturing complex objects? |
23:46:13 | qwr | not really complex, just local variables |
23:46:14 | FromDiscord | <Elegantbeef> I dont even know what you're considering a lambda |
23:46:21 | FromDiscord | <Elegantbeef> So it's a closure |
23:46:24 | qwr | yes |
23:46:36 | qwr | why would i use lambda without closure? :) |
23:46:41 | FromDiscord | <Elegantbeef> How does it break |
23:46:59 | FromDiscord | <Elegantbeef> I might be wrong but anonymous procedures can also be called 'lambdas' |
23:47:07 | qwr | the variables tend to get replaced with default value |
23:47:18 | qwr | like empty string |
23:47:39 | FromDiscord | <Elegantbeef> Can i see the scope the closure is declared in? |
23:50:24 | FromDiscord | <Elegantbeef> So Google's making a C++ successor that's curly braced Nim 😄 |
23:50:33 | FromDiscord | <Elegantbeef> image.png https://media.discordapp.net/attachments/371759389889003532/999100965028368434/image.png |
23:51:44 | * | duuude quit (Ping timeout: 272 seconds) |
23:51:51 | FromDiscord | <Prestige> What language is that |
23:51:59 | FromDiscord | <Elegantbeef> Google's experimental carbon |
23:52:10 | FromDiscord | <Prestige> really does look similar |
23:52:28 | FromDiscord | <Elegantbeef> It's google so it's going to die in a year or two probably |
23:53:02 | FromDiscord | <Elegantbeef> It's supposedly backwards compatible with C++ code bases |
23:53:26 | FromDiscord | <Prestige> Idk why anyone bothers with c++ tbh |
23:53:28 | FromDiscord | <Elegantbeef> But yea it's pretty much a Rust and Nim baby with 'seamless' C++ interop |
23:53:49 | FromDiscord | <Elegantbeef> Cause they have codebases in C++ and it's easier to make a compatible language than convert their code to something saner |
23:54:20 | FromDiscord | <Elegantbeef> > Unfortunately, the designs of these languages present significant barriers to adoption and migration from C++. |
23:54:33 | qwr | https://paste.debian.net/1247758/ |
23:54:41 | FromDiscord | <Elegantbeef> The biggest issue with all new system languages is that it's not easy to use C++ code |
23:54:43 | FromDiscord | <Elegantbeef> I mean D and Nim are the only two "major" languages that can interop with C++ |
23:54:43 | qwr | here is the code with testcase |
23:55:39 | FromDiscord | <Elegantbeef> Google has a massive NIH complex so it had to make their own variant |
23:55:55 | qwr | and it actually wasn't even default value, as it writes into file "\0\0\0" - i didn't notice it from console log |
23:56:08 | FromDiscord | <Elegantbeef> I think i can guess the issue |
23:56:15 | FromDiscord | <Elegantbeef> you dont use `capture` or `closureScope` |
23:57:26 | FromDiscord | <Elegantbeef> Due to how iterators work you need to use `capture` or `closureScope` to capture iterator variables |
23:57:45 | qwr | does it needs to be done by hand, and i don't get any error/warning? it works with mm:refc ? |
23:59:00 | FromDiscord | <Elegantbeef> https://play.nim-lang.org/#ix=44RX |
23:59:25 | FromDiscord | <Elegantbeef> Here's an example |