00:02:35 | * | Lord_Nightmare quit (Ping timeout: 240 seconds) |
00:04:30 | * | dulsi_ joined #nim |
00:07:24 | * | dulsi quit (Ping timeout: 256 seconds) |
00:08:21 | * | hnOsmium0001 joined #nim |
00:19:17 | FromDiscord | <exelotl> Bleh I have this annoying problem in my project where the nim compiler crashes when I pass a varargs[untyped] to another template that also takes a varargs[untyped] |
00:19:25 | * | oddp quit (Ping timeout: 240 seconds) |
00:19:53 | FromDiscord | <exelotl> I tried making a minimal example but I can't reproduce it :( |
00:22:22 | * | opal joined #nim |
00:26:52 | * | abm quit (Read error: Connection reset by peer) |
01:26:08 | * | unihernandez22 joined #nim |
01:26:49 | * | unihernandez22 quit (Client Quit) |
02:00:03 | * | apahl quit (Ping timeout: 260 seconds) |
02:01:56 | * | apahl joined #nim |
02:03:53 | * | theelous3 quit (Read error: Connection reset by peer) |
02:49:05 | * | rockcavera joined #nim |
02:51:23 | * | muffindrake quit (Ping timeout: 260 seconds) |
02:53:32 | * | muffindrake joined #nim |
03:05:58 | * | waleee-cl quit (Quit: Connection closed for inactivity) |
03:13:23 | * | leorize quit (Ping timeout: 240 seconds) |
03:15:45 | * | leorize joined #nim |
03:24:14 | * | Cthalupa quit (Ping timeout: 264 seconds) |
03:24:29 | Zevv | yeah but be honest. who would ever think of doing such a thing |
03:25:06 | Zevv | varargs[untyped] |
03:25:09 | disruptek | the manual says you're doing it wrong. |
03:32:35 | * | Jjp137 quit (Ping timeout: 240 seconds) |
03:33:21 | * | Jjp137 joined #nim |
03:33:38 | FromDiscord | <downpour> i haven't really touched code in half a decade the crux of my experience was a 4 in ap computer science, and I wanted to try my hand at nim, being stuck in quarantine in all. i definitely have looked through the site and there's a very comprehensive beginner guide (https://narimiran.github.io/nim-basics/) but i tend to be a visual/auditory learner and i was wondering if anyone could recommend a video series with the same jist as this gui |
03:34:14 | disruptek | kilonie has a series on youtube. |
03:34:30 | FromDiscord | <downpour> alright, i will check it out! thank you ๐ |
03:41:32 | disruptek | Zevv: am i crazy to introduce an optional flag to emit unicode so that, eg. Foo:Object turns into Foo๊Object instead of Foocolon_Object? |
03:45:06 | Zevv | yeah, that stuff is ungreppable |
03:45:22 | Zevv | why not Foo__Object or similar? |
03:45:44 | Zevv | well its not ungreppab |
03:45:56 | Zevv | bu itll confuse people |
03:46:15 | disruptek | because if you're looking for the $ for something, you don't wanna search for __. |
03:46:18 | Zevv | utf8 is everywere, except for where it isnt |
03:46:33 | Zevv | also not for your magic unicode identifiers |
03:46:42 | Zevv | also, im not even sure if that is valid C |
03:47:06 | disruptek | it's valid if it's \u1234, which is fine with us -- we're generating it, after all. |
03:47:53 | disruptek | probably right to just suck it up, though. |
03:48:05 | Zevv | ok, im on mobile, i assume this is about the funny : right? |
03:48:28 | disruptek | yes? |
03:48:44 | Zevv | maybe foo_colon_object |
03:48:54 | Zevv | but really, stick to ascii is my gut feeling |
03:48:57 | disruptek | that's what it is now, chucklhead. |
03:49:09 | disruptek | yeah, was just looking for you to say that. ๐ |
03:49:22 | Zevv | noo now its FooColon_object |
03:49:29 | disruptek | i'm out. another wasted day on mangling. cya in a few. |
03:49:33 | disruptek | well, true. |
03:49:52 | Zevv | dont let the bad bugs bite |
03:50:11 | Zevv | like, you know, ticks and the like |
03:50:45 | disruptek | ah, bloodsuckers. |
03:51:10 | disruptek | it's worms i have a problem with. |
03:51:39 | disruptek | probably shouldn't have skipped shower day. ๐คท |
04:06:01 | * | supakeen quit (Quit: WeeChat 2.8) |
04:06:37 | * | supakeen joined #nim |
04:10:03 | * | Lord_Nightmare joined #nim |
04:19:17 | * | Cthalupa joined #nim |
04:51:38 | voltist | Any lawyers on? :) |
04:53:03 | * | rockcavera quit (Remote host closed the connection) |
04:57:53 | * | Lord_Nightmare quit (Quit: ZNC - http://znc.in) |
04:57:55 | FromDiscord | <Doof Doof> Is it possible to define an alternative entry point for compilation output? So instead of main it would be a user defined function name? |
04:58:04 | Yardanico | --noMain |
04:58:11 | Yardanico | and define your own main or DllMain or whatever |
04:58:14 | Yardanico | don't forget to exportc |
04:58:40 | FromDiscord | <Doof Doof> That's what I'm doing but I was asking about what I said |
04:59:05 | Yardanico | libc expects the default "main" function to be present |
04:59:12 | Yardanico | or the compiler, I'm not exactly sure |
04:59:26 | * | Lord_Nightmare joined #nim |
04:59:36 | Yardanico | but why do you need that? |
05:02:27 | * | vicfred quit (Quit: Leaving) |
05:04:24 | FromDiscord | <Doof Doof> Well I just realized it probably wouldn't make a difference in my case since I don't actually need a new name every compilation - but it would be nice to not need to wrap my entry point in a c function that's only purpose is to invoke ninstart and my custom main. I'm not in control of that scenario without changing a framework I'm using. |
05:38:34 | FromDiscord | <Skaruts> I'm using the official lua bindings to make a dll I can load up in lua, and I have a bit of a problem here |
05:38:38 | FromDiscord | <Skaruts> How do I register a lua table to create a namespace in lua? |
05:38:42 | FromDiscord | <Skaruts> (So I don't have my entire lib in lua globals) |
05:38:44 | FromDiscord | <Skaruts> I'd like to do the equivalent of the C code I included here: https://play.nim-lang.org/#ix=2tKW |
05:40:54 | * | maier joined #nim |
06:09:59 | * | PMunch joined #nim |
06:17:22 | * | solitudesf joined #nim |
06:24:46 | * | bung_ joined #nim |
06:27:49 | * | bung quit (Ping timeout: 264 seconds) |
07:18:25 | PMunch | Zevv, are you around? I'm apparently too dumb to figure out how npeg works.. |
07:25:46 | * | kwilczynski quit (Ping timeout: 256 seconds) |
07:26:17 | FromDiscord | <Varriount> PMunch: I can help, though I'll be going to bed soon |
07:26:25 | * | kwilczynski joined #nim |
07:29:37 | PMunch | Oh great :) |
07:29:47 | PMunch | Right now I'm just trying to match a string |
07:30:04 | PMunch | AKA starts with ", followed by any character but ", and ends with " |
07:30:44 | PMunch | I've got '"' * +1 * '"' but it doesn't match anything.. |
07:31:44 | PMunch | https://play.nim-lang.org/#ix=2tLj |
07:32:02 | PMunch | (npeg works in the playground, so you can run that right on the playground) |
07:32:18 | PMunch | @Varriount ^ |
07:34:25 | FromDiscord | <Varriount> Hm |
07:35:28 | FromDiscord | <Varriount> @PMunch: NPeg doesn't backtrack repetitions |
07:36:07 | FromDiscord | <Varriount> The 1 needs to explicitly be any character plus 1 |
07:36:25 | FromDiscord | <Varriount> Er, any character but " |
07:36:34 | PMunch | Wait. I thought 1 was any character.. |
07:37:32 | PMunch | This doesn't work either though: https://play.nim-lang.org/#ix=2tLm |
07:37:58 | FromDiscord | <Rika> you're not capturing it |
07:38:07 | FromDiscord | <Rika> lol |
07:38:20 | FromDiscord | <Rika> >+ instead of just + ๐ |
07:38:33 | PMunch | Aaaah |
07:38:35 | PMunch | Durr |
07:38:43 | FromDiscord | <Varriount> Yeah, https://play.nim-lang.org/#ix=2tLn |
07:39:12 | FromDiscord | <Varriount> Though, I always use >() for stylistic reasons |
07:39:57 | FromDiscord | <Varriount> PMunch: This may help you: https://github.com/Varriount/commandant/blob/master/commandant/lexer.nim#L150 |
07:40:47 | FromDiscord | <Varriount> Or it might confuse you. |
07:44:21 | * | opi joined #nim |
07:44:54 | FromDiscord | <Varriount> PMunch: What are you writing? |
07:44:57 | PMunch | Got strings working, but struggling a bit with escapes.. https://play.nim-lang.org/#ix=2tLp |
07:45:11 | PMunch | I'm writing stacklang v2 |
07:45:20 | PMunch | And I wanted to add a string data type |
07:45:49 | PMunch | So now I need something slightly more complex than splitWhitespace to parse the input :P |
07:48:13 | PMunch | Ah, another backtracking issue |
07:48:47 | PMunch | Switching the order of 1-'"' and ('\\' * '"') helped |
07:49:51 | * | moerm joined #nim |
07:50:12 | moerm | Hello everyone ;) |
07:50:20 | FromDiscord | <Rika> hello |
07:53:55 | * | NimBot joined #nim |
07:55:20 | FromDiscord | <Varriount> PMunch: The 1 is going to match a backwards slash too. Reverse the order |
07:56:05 | PMunch | Yeah I realised |
07:57:05 | FromDiscord | <Varriount> PMunch: You might want to use multiple rules. |
07:57:21 | PMunch | Haha, I've already split it :) |
07:57:51 | PMunch | https://play.nim-lang.org/#ix=2tLs |
08:05:51 | * | oddp joined #nim |
08:17:33 | FromDiscord | <Varriount> PMunch: I'm going to head off to bed. Any other questions? |
08:38:36 | * | Vladar joined #nim |
08:46:02 | * | abm joined #nim |
08:50:06 | FromDiscord | <lqdev> PMunch: the way zevv does it in his json example is instead of matching 1 he matches for a rule stringChar or sth like that and that matches any character except \, if it's a \ then it matches an escape sequence |
09:01:42 | * | Senketsu joined #nim |
09:05:01 | * | krux02 joined #nim |
09:12:54 | moerm | Have a nice day everyone |
09:13:00 | * | moerm quit (Quit: Leaving) |
09:13:45 | * | Senketsu quit (Ping timeout: 240 seconds) |
09:14:27 | * | endragor_ joined #nim |
09:14:27 | * | endragor quit (Read error: Connection reset by peer) |
09:16:43 | alehander92 | you too |
09:16:44 | alehander92 | :) |
09:16:52 | alehander92 | morning/lunch |
09:17:41 | * | hnOsmium0001 quit (Quit: Connection closed for inactivity) |
09:21:03 | * | Perkol joined #nim |
09:21:52 | PMunch | Sorry I got yanked off to a meeting. @lqdev, that is actually not a bad way of doing it |
09:45:33 | FromDiscord | <Byte> Hey :D |
09:45:38 | FromDiscord | <Clyybber> hey |
09:47:07 | FromDiscord | <Byte> Sup |
09:57:00 | FromDiscord | <Byte> Aight nice to hear |
10:19:00 | * | fililip joined #nim |
10:19:32 | * | fililip left #nim (#nim) |
10:26:44 | * | Senketsu joined #nim |
10:31:16 | * | Perkol quit (Remote host closed the connection) |
11:18:54 | * | PMunch quit (Quit: Leaving) |
11:20:03 | * | PMunch joined #nim |
11:32:30 | FromDiscord | <vieru> hi |
11:32:35 | FromDiscord | <vieru> winim users online ? |
11:32:55 | * | Cthalupa quit (Ping timeout: 246 seconds) |
11:38:42 | * | Cthalupa joined #nim |
11:40:04 | * | opi quit (Remote host closed the connection) |
11:58:41 | PMunch | @vieru, doesn't seem like it. What's your issue? |
11:59:22 | FromDiscord | <vieru> sry for bothering I fixed it, that's why i deleted my messages lol |
11:59:52 | FromDiscord | <vieru> on irc i think they still show up |
12:00:04 | PMunch | Ah yes, IRC doesn't have a concept of deleting messages |
12:01:27 | * | Cthalupa quit (Ping timeout: 260 seconds) |
12:03:02 | Zevv | PMunch: zup |
12:03:58 | * | Cthalupa joined #nim |
12:03:58 | PMunch | Hi :) |
12:04:14 | PMunch | I just needed some help with npeg earlier, but I've figured it out now |
12:04:23 | Zevv | wasn't that hard, was it :) |
12:06:01 | * | supakeen quit (Quit: WeeChat 2.8) |
12:06:34 | * | supakeen joined #nim |
12:06:45 | PMunch | Nope, as soon as I got used to the whole no-backreference thing |
12:07:00 | Zevv | no-backreference thing? |
12:07:16 | PMunch | Well I was trying to parse strings |
12:08:00 | Zevv | https://github.com/zevv/npeg/blob/master/tests/performance.nim#L74 |
12:08:27 | PMunch | And for detecting escapes for example I had *(1-'"') | *('\\' * '"') |
12:08:50 | PMunch | Which didn't work because it had already consumed the \ by the time it failed :P |
12:08:57 | Zevv | but you got it now, I assume? |
12:09:19 | PMunch | Yeah |
12:09:24 | Zevv | sweet |
12:09:28 | PMunch | Not as fancy as that escaping though |
12:09:33 | Zevv | so was it as good for you as it was for me, your first time |
12:09:35 | Zevv | doing Npeg |
12:09:42 | PMunch | Just \" supported |
12:09:55 | PMunch | Haha, yeah I really like npegging now |
12:09:59 | Zevv | \o/ |
12:10:16 | PMunch | The * to concatenate got me in the beginning though ngl |
12:10:39 | Zevv | that is exactly the reason I removed this one sentences from the Nim manual the other day |
12:10:55 | Zevv | "you can't change syntax wiht macros, but that's ok becaue Nims syntax is flexible enouygh anyway" |
12:11:12 | PMunch | Hehe, what is it usually in PEG? |
12:11:14 | Zevv | it's still on the website I see: "Macros cannot change Nim's syntax because there is no need for it โ the syntax is flexible enough." |
12:11:18 | Zevv | it's implicit |
12:11:20 | Zevv | there is no operator |
12:11:30 | PMunch | Aah |
12:12:26 | FromDiscord | <Clyybber> we could actually support postfix operators, at least in some cases |
12:12:40 | Zevv | yeah I know, but they were too limited |
12:12:50 | FromDiscord | <Clyybber> oh, no I mean we *could* as in we don't |
12:13:11 | FromDiscord | <Clyybber> but now I'm curious |
12:13:14 | FromDiscord | <Clyybber> what did you mean |
12:13:23 | Zevv | I think there are a few 'postfixy' things already |
12:15:17 | Zevv | "There is no way to declare postfix operators: all postfix operators are built-in and handled by the grammar explicitly." |
12:16:15 | FromDiscord | <Clyybber> yeah |
12:16:26 | FromDiscord | <Clyybber> but I mean in theory you could allow it without being ambiguous |
12:17:15 | Zevv | how come you're so sure of that. You know https://nim-lang.github.io/Nim/manual.html#syntax-grammar by heart? :) |
12:17:26 | FromDiscord | <Clyybber> it recently occured to me |
12:17:36 | FromDiscord | <Clyybber> its simple |
12:17:52 | FromDiscord | <Clyybber> when an operator is immediately following some expression without a space in between |
12:17:58 | Zevv | don't go there |
12:18:07 | FromDiscord | <Clyybber> *and* if the next line has <= indentation |
12:18:09 | Zevv | "without a space in between" |
12:18:12 | FromDiscord | <Clyybber> then its a postifx operator |
12:18:22 | FromDiscord | <Clyybber> Zevv: Do you know how the prefix operators work :p |
12:18:26 | * | arecacea1 quit (Remote host closed the connection) |
12:18:26 | FromDiscord | <Clyybber> they work exactly like that |
12:18:34 | Zevv | yeah it's bad enough already :) |
12:18:34 | FromDiscord | <Clyybber> put a space in between and its an infix :) |
12:18:38 | FromDiscord | <Clyybber> no thats elegant |
12:18:47 | Zevv | well wait that's not true |
12:19:11 | * | arecacea1 joined #nim |
12:19:28 | FromDiscord | <Clyybber> !eval echo $ 1 |
12:19:29 | NimBot | Compile failed: /usercode/in.nim(1, 6) Error: type mismatch: got <proc (x: varargs[typed]){.gcsafe, locks: 0.}, int literal(1)> |
12:19:46 | FromDiscord | <Clyybber> see :) |
12:20:00 | FromDiscord | <Clyybber> of course there are some cases where its unambiguous |
12:20:00 | Zevv | hold it |
12:20:22 | * | opi joined #nim |
12:22:21 | Zevv | https://play.nim-lang.org/#ix=2tNb |
12:23:06 | FromDiscord | <Clyybber> yeah because its unambiguous there |
12:24:01 | FromDiscord | <Clyybber> same as it would be in some cases with postfix |
12:24:26 | FromDiscord | <Clyybber> you could allow postfix with spaces in between most of the time |
12:24:34 | Zevv | well, go for it! |
12:24:38 | FromDiscord | <Clyybber> as long as the next line is indented less or equal |
12:24:39 | Zevv | npeg 2.0 is on the way |
12:24:49 | FromDiscord | <Clyybber> whats new? |
12:28:06 | Zevv | nothing at all, we're totally blocked by all these nim bugs :P) |
12:34:03 | Oddmonger | mod(10,5) is not correct ? |
12:34:17 | Oddmonger | seen here, not invented: https://nim-lang.org/docs/system.html#mod,int,int |
12:35:36 | PMunch | !eval `mod`(10, 5) # this works |
12:35:37 | NimBot | Compile failed: /usercode/in.nim(1, 6) Error: expression '0' is of type 'int literal(0)' and has to be discarded |
12:35:45 | PMunch | !eval echo `mod`(10, 5) # this works |
12:35:47 | NimBot | 0 |
12:35:49 | Oddmonger | han |
12:35:53 | Oddmonger | `` needed |
12:35:56 | PMunch | Yup |
12:36:04 | PMunch | mod is an operator like + and - |
12:36:16 | Oddmonger | thought it was `` as in markdown syntax, for the doc |
12:36:22 | PMunch | !eval echo `+`(10, 5) # works the same way here |
12:36:24 | NimBot | 15 |
12:36:30 | Oddmonger | so i could do: 10 mod 5 then |
12:36:36 | PMunch | Mhm |
12:36:43 | PMunch | That's how you'd normally use it |
12:36:46 | Oddmonger | yes |
12:36:53 | FromDiscord | <AvW> Hi all. I am trying to use package niup (gui). I did a nimble install niup. Compiling the simplest gui program, says: could not load niup.dll. Then I went to iup site here: https://sourceforge.net/projects/iup/files/3.30/Windows%20Libraries/Dynamic/ but I do'nt know which to choose here. Any ideas? |
12:37:19 | FromDiscord | <AvW> Ans iup 3.30 is the latest ... |
12:37:29 | Oddmonger | ok thank you PMunch , i had forgotten the ยซ == 0 ยป in my test |
12:37:39 | Oddmonger | that is : if x mod y == 0: |
12:37:58 | Oddmonger | without == 0 , no bools |
12:38:09 | PMunch | Ah, yes. Same issue as you had the other day :) |
12:38:17 | PMunch | Nim doesn't auto-convert integers to bools |
12:38:21 | Oddmonger | you have good memory :) |
12:38:39 | PMunch | (unless of course you add a "converter intToBool(x: int): bool = x == 0 |
12:38:44 | PMunch | ") |
12:39:14 | PMunch | I have good memory for completely random stuff like this :P Terrible for stuff like names and birthdays.. |
12:41:13 | PMunch | @AvW, you should pick the one that fits your platform.. |
12:41:21 | PMunch | See under the Available Platforms in the documentation |
12:47:37 | FromDiscord | <AvW> @PMunch[IRC] Thx. I'll try the most promising one. |
12:48:48 | FromDiscord | <AvW> And it works. Thx again. |
12:49:08 | * | OMGOMG joined #nim |
12:49:25 | * | opi quit (Remote host closed the connection) |
13:02:31 | * | rockcavera joined #nim |
13:05:11 | * | dulsi_ is now known as dulsi |
13:06:58 | FromDiscord | <Zachary Carter> Just FYI you can't `@` someone who is on IRC through discord |
13:07:37 | FromDiscord | <Zachary Carter> you can ping them using their IRC nick the way you'd normally ping someone on IRC |
13:09:45 | * | apahl quit (Ping timeout: 272 seconds) |
13:10:09 | * | apahl joined #nim |
13:12:57 | * | waleee-cl joined #nim |
13:17:47 | Zevv | so wow, I think Im done with npeg now. Even pmunch is using it, what else could I ask for |
13:17:59 | Zevv | time for something new then |
13:21:23 | * | opal quit (Ping timeout: 240 seconds) |
13:24:41 | * | Cthalupa quit (Ping timeout: 244 seconds) |
13:26:11 | * | opi joined #nim |
13:28:01 | * | Cthalupa joined #nim |
13:36:17 | * | opal joined #nim |
13:38:54 | PMunch | Zevv, I've just been waiting for a usecase :) |
13:39:36 | PMunch | If you're bored though I have a little project you could attempt |
13:40:32 | PMunch | Make a macro that generates a huffman tree and decoder for a string of characters. So essentially compressing some arbitrary binary and making an efficient decompressor on compile-time |
13:40:44 | PMunch | I think it could be cool to have for Arduino stuff |
13:43:26 | FromDiscord | <Kiloneie> Objects are constructable via a type section right ? |
13:43:37 | FromDiscord | <Kiloneie> only * |
13:43:38 | FromDiscord | <Clyybber> whatever that means :p |
13:43:57 | FromDiscord | <Clyybber> oh, yeah you can only define object types in a type section |
13:44:05 | FromDiscord | <Kiloneie> thanks |
13:48:09 | * | Kaivo joined #nim |
13:49:51 | disruptek | ๐โฝ |
14:00:46 | * | PMunch quit (Quit: Leaving) |
14:03:36 | * | arecacea1 quit (Remote host closed the connection) |
14:04:23 | * | arecacea1 joined #nim |
14:31:38 | * | Guest73425 quit (Read error: Connection reset by peer) |
14:36:13 | * | dadada joined #nim |
14:36:36 | * | dadada is now known as Guest67791 |
14:44:22 | Zevv | pmunch: yo |
14:44:41 | Zevv | u mee compress at compil time, decompress *run* time I assume? |
15:02:05 | * | Senketsu quit (Ping timeout: 240 seconds) |
15:18:20 | Zevv | chocolate salty |
15:35:07 | FromDiscord | <Rebel> Is there a way to have a nim's output PE contain a .reloc (base relocation table) section? Such as passing special flags to the compiler to be consumed by gcc or mingw? |
15:38:16 | shashlick | there's passC and passL CLI flags and pragmas |
15:39:42 | FromDiscord | <kodkuce> @dom96 i think i saw some post that wasm is getting real threads so meybe now webasambly>js for browser |
15:40:02 | FromDiscord | <kodkuce> i know i saw your post long about how you thested both and found js to be better |
15:40:03 | dom96 | JS supports threads too, no? |
15:40:34 | dom96 | Yep https://developer.mozilla.org/en-US/docs/Web/API/Web_Workers_API/Using_web_workers |
15:41:36 | dom96 | I am going to add a todo to write about what I found, either I'll learn something new or others will. Webasm seems overhyped to me |
15:51:43 | FromDiscord | <kodkuce> sorry afk , head to go to kitchen fast it smelled wronk ๐ |
15:52:08 | FromDiscord | <kodkuce> hmm i think i saw they say WA got real threads not like JS one |
15:52:13 | FromDiscord | <kodkuce> can google try find link |
15:52:47 | disruptek | i have that all the time. damn kitchen is adjacent to the can. |
15:55:34 | FromDiscord | <kodkuce> https://developers.google.com/web/updates/2018/10/wasm-threads or meybe i saw this old post somehow, or somone linked it, i know i saw that difrence betwin js threads and wasm you can share memeory state so its possible is this one just duno how i saw it like last weak |
15:56:01 | FromDiscord | <kodkuce> i like 90% search with last month enable |
15:59:00 | FromDiscord | <kodkuce> so possible sorry ๐ tough duno what i saw i was it in 01:00 was treveling hacker news or reddit tech/programming or something before sleap |
16:05:00 | FromDiscord | <vieru> hi can anyone help me translate this c code into nim ? |
16:05:09 | FromDiscord | <vieru> sent a code paste, see https://play.nim-lang.org/#ix=2tOa |
16:05:26 | FromDiscord | <vieru> im interested in the `static_cast` part |
16:05:51 | FromDiscord | <vieru> is it just like a nim cast ? |
16:18:05 | * | Cthalupa quit (Ping timeout: 246 seconds) |
16:18:41 | dom96 | nope, `static_cast` is the safest cast in C++ as far as I can see |
16:19:03 | dom96 | `cast` in Nim is basically unsafe, you're telling the compiler "I know what I'm doing, don't complain" |
16:19:40 | FromDiscord | <vieru> you have any idea how to convert the code ? |
16:20:06 | FromDiscord | <vieru> or at least point me in the right direction |
16:21:08 | dom96 | Search around, I found one example of a library that already does this for you |
16:21:18 | dom96 | and if you look at its source code you can see how it's done https://github.com/Guevara-chan/Cliptomania/blob/master/src/cliptomania.nim |
16:21:36 | dom96 | that code is pretty ugly though lol |
16:21:45 | FromDiscord | <vieru> i was looking at the same lib lol |
16:21:59 | * | Cthalupa joined #nim |
16:22:18 | dom96 | You can pretty much write the same code as the C++ in Nim |
16:22:29 | dom96 | You just need to wrap the `GetClipboardData` call |
16:22:32 | dom96 | and the others used there |
16:22:37 | dom96 | you can see how that's done in cliptomania |
16:23:02 | dom96 | you might want to find an example in C |
16:23:06 | dom96 | could be easier to translate |
16:24:05 | FromDiscord | <vieru> thanks, ill read that lib's source for now, and see if i understand it |
16:26:05 | shashlick | you want to work with the clipboard? |
16:26:26 | FromDiscord | <vieru> yep |
16:26:52 | shashlick | there's also https://github.com/genotrance/nimclipboard |
16:26:58 | shashlick | libclipboard wrapper |
16:27:59 | * | apahl quit (Ping timeout: 272 seconds) |
16:28:03 | FromDiscord | <vieru> thanks but i want to stick to the windows apiโตim not making this cross platform lol |
16:28:22 | * | apahl joined #nim |
16:29:50 | shashlick | cool |
16:51:13 | * | maier quit (Ping timeout: 264 seconds) |
16:54:41 | * | letto quit (Quit: Konversation terminated!) |
16:56:55 | * | superbia1 joined #nim |
16:59:28 | * | superbia quit (Ping timeout: 246 seconds) |
17:11:46 | * | letto joined #nim |
17:23:45 | Zevv | well well well |
17:24:16 | disruptek | well don't threaten me with a good time. |
17:25:19 | Zevv | say, what was the reason for frosty |
17:25:36 | disruptek | i forget. |
17:25:52 | disruptek | i don't even think i'm using it anywhere. |
17:26:05 | disruptek | zedeus uses it over sockets. |
17:26:07 | Zevv | fair enough |
17:26:15 | disruptek | he says it works. |
17:26:24 | Zevv | that's cool |
17:26:42 | disruptek | i need to take another look at variant objects. |
17:27:11 | disruptek | that, and taking out the recursion. then it will be okay. |
17:27:29 | Zevv | how would you go without the recursion then |
17:27:43 | disruptek | oh, and it might be interesting to see what we can do with isolates, too. |
17:29:48 | Zevv | I'd like to see if we could do go-like stuff |
17:29:58 | Zevv | because I did enjoy my escapade |
17:30:15 | shashlick | autodup is fun - processed 50gb of video files for dups in 1.4 seconds |
17:30:16 | Zevv | it would be a nice match with CPS to have go-like channels |
17:30:31 | Zevv | shashlick: 0 dups found, yah |
17:30:46 | Zevv | or your hash is so broken *everything* is a dup. And your disk is now empty |
17:30:46 | * | kungtotte quit (Read error: Connection reset by peer) |
17:30:48 | Zevv | one lonely file left |
17:30:50 | shashlick | only had to hash 4 of 316 files |
17:31:06 | shashlick | only need to hash if there's a file size match |
17:31:08 | * | kungtotte joined #nim |
17:31:09 | Zevv | sure |
17:31:43 | disruptek | zevv: the other one to look at for inspiration is clojure's. |
17:31:56 | Zevv | I never clojured |
17:32:07 | Zevv | I would love to elixir one day |
17:32:18 | disruptek | https://www.youtube.com/watch?v=drmNlZVkUeE |
17:32:26 | shashlick | disruptek - will push my meow changes to the repo |
17:32:32 | disruptek | nice. |
17:32:45 | Zevv | let me watch that for 44:24 |
17:32:57 | disruptek | yeah, i will definitively use that shashlick. thank you. |
17:33:28 | disruptek | Zevv: i didn't know what hickey sounded like for a year or so because i never watch him below 1.5x speed. |
17:33:59 | Zevv | i thought he had a skin condition, but it's freak lighting through his freak glasses |
17:34:08 | disruptek | lol |
17:34:49 | * | oddp quit (Ping timeout: 256 seconds) |
17:35:35 | alehander92 | i have a skin condition |
17:35:39 | alehander92 | but it's very small |
17:35:54 | Zevv | disruptek: he has a good story in that talk |
17:35:58 | Zevv | nim needs a good story like that |
17:36:09 | Zevv | yes alehander92, we're listening |
17:36:12 | disruptek | i know. i've been saying this for a year now. |
17:36:32 | Zevv | yea i know same here |
17:37:08 | Zevv | that guy seems smart. can we hire him |
17:37:24 | disruptek | clojure is pretty cool. |
17:37:29 | alehander92 | i still dont get the love for dynamic typing |
17:37:39 | Zevv | no, you were talking about your skin condition, remember |
17:37:42 | Zevv | let's get it over with |
17:37:47 | alehander92 | well it's vitiligo |
17:38:27 | Zevv | A freind of my has that in his hair |
17:38:33 | alehander92 | is he a dog |
17:38:39 | alehander92 | dogs have multi-colored hair |
17:38:43 | disruptek | some bitches would say yes. |
17:38:44 | Zevv | he as well |
17:38:47 | Zevv | it's pretty cool |
17:38:56 | alehander92 | i do have white hairs |
17:39:02 | alehander92 | in my hair |
17:39:07 | alehander92 | is it like color patches? |
17:39:11 | Zevv | yeah |
17:39:12 | disruptek | big deal, i have white hair. |
17:39:14 | disruptek | pffbt. |
17:39:20 | * | vicfred joined #nim |
17:39:59 | alehander92 | disruptek you're like 18 |
17:40:11 | Zevv | yeah, more compliments, that's what he needs right |
17:41:25 | alehander92 | zevv when is your talk show coming on air |
17:41:37 | Zevv | what should I talk about then |
17:41:42 | alehander92 | did you send araq in a retirement lambda |
17:41:52 | disruptek | oh, thanks for reminding me. |
17:41:54 | alehander92 | he is just offline somehwere |
17:41:58 | Zevv | sometimes |
17:42:05 | Zevv | I still bashes my PR for spelling mistakes |
17:42:10 | Zevv | /he/ |
17:42:39 | alehander92 | zevv well you can just ask insightful questions |
17:42:44 | alehander92 | to people on the street |
17:42:54 | alehander92 | if there are any pedestrians left |
17:42:57 | alehander92 | in netherlands |
17:42:59 | Zevv | still got a black i from the last time i did that |
17:43:13 | alehander92 | we can put you behind a glass |
17:43:16 | Zevv | oh pedestrians galore. |
17:43:23 | alehander92 | it's very anti-covid |
17:43:32 | Zevv | that's really a non-issue here |
17:43:37 | alehander92 | you can just cold call famous people |
17:43:47 | alehander92 | e.g. the swift compiler guys |
17:43:49 | disruptek | i mean, we can build "core.async" for nim. |
17:43:51 | Zevv | I think I have seen masks on the street 3 or 4 times since februari |
17:43:59 | alehander92 | "can you add disruptors to your constructors" |
17:44:14 | alehander92 | and then you just provide a living Human abstraction |
17:44:26 | * | FromDiscord quit (Remote host closed the connection) |
17:44:27 | alehander92 | huh, good for you |
17:44:33 | alehander92 | oh bye discord |
17:44:41 | * | FromDiscord joined #nim |
17:44:45 | alehander92 | we are losing whole social networks |
17:44:52 | Zevv | good riddance |
17:45:05 | Zevv | irc - one protocol to rule them all |
17:45:27 | disruptek | it does what it says on the tin and it does it well. |
17:45:46 | alehander92 | it really chats |
17:45:56 | Zevv | man does it chat |
17:47:15 | alehander92 | what happened to yardanico |
17:47:17 | * | oddp joined #nim |
17:47:37 | alehander92 | i remember the time when many brave people spammed from all of the hemisphere |
17:48:03 | alehander92 | good thing pmunch came back from the war |
17:48:13 | * | opi quit (Ping timeout: 264 seconds) |
17:48:53 | alehander92 | the compression idea seems kinda cool |
17:49:27 | Zevv | bwah. I already embed pngs in my nim |
17:49:29 | Zevv | what's new |
17:53:48 | * | krux02 quit (Remote host closed the connection) |
17:54:50 | * | krux02 joined #nim |
18:04:29 | disruptek | did you finish that talk? |
18:06:59 | Zevv | sure |
18:07:42 | disruptek | is copying good design, good design? |
18:08:53 | Zevv | technically, yes |
18:09:36 | disruptek | well, wanna build it? |
18:09:51 | Zevv | but maan it seems like soooo much woooork |
18:10:11 | disruptek | how do you figure? |
18:10:31 | Zevv | all this thinking all the time |
18:10:44 | disruptek | relax, you're good at it. |
18:12:50 | Zevv | can't relax... must think... all the time... |
18:18:14 | FromGitter | <pebauer68> How would you read a single char non-blocking from stdin in Nim ? |
18:28:33 | shashlick | disruptek: https://github.com/disruptek/meow |
18:28:56 | disruptek | awesome. |
18:29:46 | disruptek | the docs link doesn't work. |
18:29:58 | shashlick | i just pushed it |
18:30:01 | disruptek | ah |
18:30:04 | shashlick | might take a bit for it to show |
18:30:11 | alehander92 | disruptek what about transducers |
18:30:22 | disruptek | what's that? |
18:30:57 | shashlick | the gh-pages branch is there but for some reason the link isn't working |
18:31:10 | alehander92 | i think it was a famous clojure concept |
18:33:09 | disruptek | had to configure it on github. |
18:33:22 | shashlick | nift - it works |
18:33:45 | shashlick | there's also a meow binary to create hashes on the command line |
18:33:48 | shashlick | or compare two files |
18:33:55 | disruptek | lol sweet. |
18:34:01 | disruptek | this will be really fun to benchmark. |
18:34:48 | shashlick | https://github.com/nim-lang/packages/pull/1591 |
18:34:49 | disbot | โฅ Add package meow |
18:40:50 | pulux | hi, do you know a module to read/write python's numpy npz-files (zip with binary numpy-array, npy)? |
18:47:59 | * | maier joined #nim |
18:52:57 | * | vicfred quit (Quit: Leaving) |
18:53:01 | * | maier quit (Ping timeout: 264 seconds) |
18:53:48 | * | hnOsmium0001 joined #nim |
19:14:13 | * | clemens3 quit (Ping timeout: 246 seconds) |
19:15:29 | * | Vladar quit (Quit: Leaving) |
19:25:33 | * | lritter joined #nim |
19:27:50 | * | clemens3 joined #nim |
19:32:24 | * | kenran joined #nim |
20:04:32 | disruptek | shashlick: just noticed that nimph doesn't work with jbb for me anymore. |
20:04:44 | disruptek | 0.8.10 is fine and 1.0.0 doesn't clone due to a cert error. |
20:05:09 | * | kenran quit (Quit: leaving) |
20:06:05 | * | Guest67791 quit (Ping timeout: 240 seconds) |
20:08:15 | * | dadada joined #nim |
20:08:25 | shashlick | oh |
20:08:28 | shashlick | let me check |
20:08:40 | * | dadada is now known as Guest85438 |
20:10:22 | shashlick | unrelated, looks like cligen now depends on pcre |
20:17:24 | disruptek | eh? |
20:17:33 | disruptek | it's a bad error message? |
20:21:25 | * | abm quit (Ping timeout: 240 seconds) |
20:22:09 | disruptek | nimph uses cligen-v0.9.45. seems pretty easy to repro. |
20:26:34 | shashlick | no not related to your issue |
20:48:54 | * | maier joined #nim |
20:53:23 | * | maier quit (Ping timeout: 240 seconds) |
20:55:23 | shashlick | disruptek: was a toml issue - have fixed it - please try again |
20:58:01 | FromGitter | <benash> Does nim support any way to destructure an object, like this: โ โ ```let { id, name } = myObject``` [https://gitter.im/nim-lang/Nim?at=5f31b4d99231d665df6be97f] |
20:59:02 | disruptek | shashlick: what did you do? |
20:59:37 | disruptek | i can clone git:// urls but not https. |
21:03:07 | * | mbuchel joined #nim |
21:03:28 | shashlick | They are hosted on bintray |
21:03:38 | Yardanico | @benash no, but there's destructuring for tuples |
21:03:38 | * | FromDiscord quit (Remote host closed the connection) |
21:03:44 | disruptek | i just found a new bug in nimph. |
21:03:55 | * | FromDiscord joined #nim |
21:04:07 | Yardanico | @benash you shouldn't use objects if you want destructuring |
21:04:21 | shashlick | So 1.0.0 worked? |
21:04:26 | disruptek | no. |
21:04:32 | shashlick | There's also 1.0.1 since you wanted that |
21:04:38 | mbuchel | how do you use addTimer in asyncdispatch? |
21:05:39 | Yardanico | you give it a callback to be called |
21:06:12 | disruptek | `doctor` doesn't work because it follows a package-based codepath that discovers https:// urls for packages. whereas, the github search supplies git with git:// urls and those work fine. |
21:06:36 | mbuchel | i did that but i get this: No handles or timers registered in dispatcher. [ValueError] |
21:06:43 | Yardanico | mbuchel: what's your code? |
21:06:46 | disruptek | but also, it looks like "segmentation >= 0.8" is getting parsed as "0.8.*" for some dumb reason. |
21:07:05 | disruptek | mbuchel: did you discard the future? |
21:07:13 | mbuchel | there is no future |
21:07:31 | Yardanico | lol |
21:07:33 | mbuchel | i want to run a function every 30 seconds |
21:08:00 | Yardanico | mbuchel: I don't understand your problem - https://play.nim-lang.org/#ix=2tPY |
21:08:08 | Yardanico | but if you use addTimer other parts of your program should be async as well |
21:08:12 | Yardanico | if they're not, use threads |
21:09:16 | mbuchel | i have virtually the same code you wrote |
21:09:22 | mbuchel | in the playground |
21:09:27 | Yardanico | but something is different, right? |
21:09:52 | mbuchel | i am calling a few functions which are not actually async |
21:10:01 | mbuchel | to determine WiFis in the area |
21:10:04 | Yardanico | the exception you posted usually comes when you're using something like poll() |
21:10:09 | Yardanico | but there are no futures to run |
21:10:14 | Yardanico | no callbacks, nothing |
21:10:34 | Yardanico | you should use poll together with hasPendingOperations |
21:13:25 | * | lritter quit (Ping timeout: 264 seconds) |
21:14:17 | FromDiscord | <Rika> @๐ฌ๐คฃ why would you need a sync http server tho? |
21:14:36 | mbuchel | i am calling execCmdEx in a function with this async could this change things? |
21:15:07 | disruptek | what color is your function? |
21:15:07 | mbuchel | the code is virtually the same as what you wrote in the play.nim i am looking for the minimal way to reproduce the error |
21:15:10 | FromDiscord | <Rika> also can't you just do `waitFor server.serve(...)` anyway? |
21:16:29 | FromDiscord | <๐ฌ๐คฃ> I was sure there was one before |
21:16:47 | Yardanico | yes, but it was removed |
21:16:50 | Yardanico | because no one used it |
21:16:52 | Yardanico | why do you want it? |
21:16:57 | * | dulsi quit (Ping timeout: 256 seconds) |
21:17:21 | disruptek | the sync http server was removed? |
21:17:21 | FromDiscord | <๐ฌ๐คฃ> just to make code simpler, no biggie |
21:17:40 | mbuchel | OH ok i found the issue |
21:17:45 | Yardanico | disruptek: did you sleep for an eternity? |
21:17:47 | mbuchel | i was returning true in the callback |
21:17:50 | Yardanico | it was removed in 0.20.0 |
21:17:53 | mbuchel | for the mycb |
21:18:01 | disruptek | that's ridiculous. |
21:18:03 | Yardanico | that's good |
21:18:06 | disruptek | no. |
21:18:08 | Yardanico | yes |
21:18:12 | FromDiscord | <Rika> @๐ฌ๐คฃ it wont be that much simpler |
21:18:50 | disruptek | so i /have/ to use async to have a web-server in current nim? |
21:18:57 | Yardanico | with stdlib - yes |
21:19:03 | Yardanico | you can always make your own or use that old httpserver code |
21:19:11 | mbuchel | https://play.nim-lang.org/#ix=2tQ1 |
21:19:15 | disruptek | guess i don't have a fuckin' choice, now do i? |
21:19:17 | mbuchel | this is the code that fails |
21:19:17 | Yardanico | mbuchel: yeah don't do that |
21:19:25 | Yardanico | if you return true it stops the callback |
21:19:30 | mbuchel | what does the result from the callback do? |
21:19:37 | mbuchel | AH ok thank you |
21:21:19 | FromGitter | <benash> @Yardanico Interesting, haven't heard that advice before. I'm reading some command-line arguments (using the simple_parseopt library). Do you see a better way than this: โ โ ```code paste, see link``` [https://gitter.im/nim-lang/Nim?at=5f31ba4fe20413052e7be8ca] |
21:21:23 | FromDiscord | <dom96> disruptek: it was removed because it was broken. It didn't function properly at all. |
21:21:23 | * | dulsi joined #nim |
21:21:39 | disruptek | but now what? |
21:21:49 | Yardanico | @benash not sure what simple_parseopt is |
21:21:49 | FromDiscord | <dom96> It made some pretty embarrassingly bad assumptions. |
21:21:54 | Yardanico | have you tried normal parseopt or cligen or docopt? :) |
21:22:04 | disruptek | i know. but i still have a ton of lambda based on it. |
21:22:32 | FromDiscord | <dom96> huh |
21:23:52 | disruptek | i got milk and i got cream, i'm good. |
21:25:52 | FromGitter | <benash> @Yardanico It seems like I'd need quite a bit more code with `parseopt`, having to iterate and check each arg. I haven't seen docopt; I'll take a look at that now. |
21:25:59 | Yardanico | what about cligen/docopt? |
21:26:33 | Yardanico | sorry, just cligen I mean :P |
21:30:03 | * | NimBot joined #nim |
21:46:30 | * | solitudesf quit (Ping timeout: 260 seconds) |
22:02:53 | FromGitter | <benash> @Yardanico OK, cligen seems to be a cool way of doing it. So you don't find a need for object destructuring in general? You're saying it might be a code smell of sorts if you want to use such a thing? |
22:03:23 | Yardanico | I just don't understand why would you need object destructuring |
22:03:27 | Yardanico | objects aren't supposed to be destructured |
22:03:30 | Yardanico | they're supposed to be objects |
22:03:34 | Yardanico | there are tuples if you want destructuring |
22:04:19 | Yardanico | I don't even know any popular languages which have destructuring of structs/classes/objects |
22:04:29 | FromDiscord | <Rika> javascript? |
22:04:45 | Yardanico | objects? |
22:04:54 | Yardanico | oh I see |
22:04:57 | Yardanico | but JS is JS :) |
22:05:01 | FromDiscord | <Rika> lol |
22:05:20 | FromDiscord | <Rika> they dont have tuples so they have to go with objects |
22:05:28 | FromDiscord | <Rika> (do they?) |
22:05:41 | Yardanico | they don't |
22:05:47 | Yardanico | typescript does, but not JS |
22:08:41 | FromDiscord | <Rika> anyway yeah i only know js has object destructuring |
22:10:10 | FromGitter | <benash> Yeah, it seems to happen all the time in JS codebases that I look at, say to extract fields out of a JSON structure into a differently shaped structure |
22:11:15 | FromDiscord | <Rika> i think object destructuring doesnt really work in the land of static typing |
22:11:37 | Yardanico | i mean in nim you can always make a macro |
22:11:40 | Yardanico | like unpack macro but for objects |
22:11:41 | Yardanico | but why |
22:14:00 | FromDiscord | <Rika> i mean yes but that would make an """anonymous""" object definition either way |
22:14:14 | FromDiscord | <Rika> and you wouldnt be able to do much with that new object |
22:23:04 | FromGitter | <benash> Well if I have a complex nested object structure that I just read JSON into, and I'd like to use a handful of those fields, destructuring might reduce some boilerplate. It seems like the types should still be inferred OK. โ โ ```let { id, name } = myObj โ # vs โ let โ id = myObj.id โ name = myObj.name``` [https://gitter.im/nim-lang/Nim?at=5f31c8c8a4768b6856861c1b] |
22:24:52 | Yardanico | let (id, name) = (myObj.id, myObj.name) if you REALLY want that syntax |
22:25:06 | FromGitter | <benash> Although that syntax that I used doesn't seem very "nim-like", maybe something indentation-based would fit better |
22:28:13 | FromDiscord | <dom96> you should be able to write a macro for this fairly easily |
22:28:22 | FromDiscord | <dom96> maybe we can add it to nim's `sugar` module |
22:28:54 | FromDiscord | <Elegant Beef> i dont get the benefit of unpacking an object, you still have to do the exact same amount of typing but do it weirdly |
22:29:01 | * | oddp quit (Ping timeout: 264 seconds) |
22:30:19 | * | azed joined #nim |
22:30:37 | * | azed quit (Max SendQ exceeded) |
22:30:50 | FromGitter | <benash> Elegant Beef not in the code example I just pasted. You only have to write the name of the object once, as opposed to once per field you're extracting. |
22:31:36 | FromDiscord | <Elegant Beef> Eh, you now have to have the exact ident spelling, seems very prone to issue imo |
22:32:24 | FromDiscord | <Elegant Beef> But i digress, make the macro and be merry ๐ |
22:34:55 | FromGitter | <benash> Scala too has something similar with destructuring (or extracting) case class fields through pattern matching |
22:35:07 | Yardanico | well as we said, you can do it with a macro :) |
22:35:32 | FromGitter | <benash> Although Scala's might just be positional, more like tuples |
22:35:56 | FromDiscord | <XxDiCaprioxX> If I want to hash type1 with string and type2 with string do I need two different hash procs? |
22:36:06 | FromGitter | <benash> Macros, got it! |
22:36:07 | Yardanico | yes, thery're different types |
22:36:16 | FromDiscord | <XxDiCaprioxX> Because the hash proc takes a parameter |
22:36:24 | Yardanico | even if types have the same exact fields, they're still different |
22:36:29 | FromDiscord | <XxDiCaprioxX> But how do I name them? |
22:36:33 | Yardanico | name what? |
22:36:38 | FromDiscord | <XxDiCaprioxX> Because I can't name both procs hash |
22:36:40 | Yardanico | you can |
22:36:43 | Yardanico | since the types are different |
22:36:49 | FromDiscord | <XxDiCaprioxX> Oh I did not know that |
22:36:51 | Yardanico | nim has overloading |
22:36:54 | FromDiscord | <XxDiCaprioxX> amazing, thank you |
22:37:05 | FromDiscord | <XxDiCaprioxX> makes it 10x easier |
22:38:27 | FromDiscord | <XxDiCaprioxX> Do I put Hash or Table as a parameter in a type? |
22:38:53 | Yardanico | wdym? |
22:39:23 | FromDiscord | <XxDiCaprioxX> sent a code paste, see https://play.nim-lang.org/#ix=2tQ9 |
22:39:35 | FromDiscord | <XxDiCaprioxX> Does it have to be Hash or Table |
22:39:35 | Yardanico | hash just like that |
22:39:40 | FromDiscord | <XxDiCaprioxX> Okay nice |
22:39:43 | Yardanico | https://nim-lang.org/docs/hashes.html |
22:39:44 | Yardanico | wait |
22:39:48 | Yardanico | you want a table or a hash? |
22:39:59 | Yardanico | Hash is not a "hashmap" if that's what you wanted |
22:40:22 | FromDiscord | <XxDiCaprioxX> I thought you had to use hashes because table won't take complex types as keys |
22:40:33 | Yardanico | yes, but you don't have to store them in the type |
22:40:41 | Yardanico | you need to have a hash proc defined for your type |
22:40:47 | FromDiscord | <Elegant Beef> You use a hash proc.... ^ |
22:40:51 | Yardanico | https://nim-lang.org/docs/hashes.html see docs here |
22:41:01 | FromDiscord | <XxDiCaprioxX> I want the type to contain a hashmap-similar thing |
22:41:08 | FromDiscord | <Elegant Beef> When you put a type in the key of a table it calls the T.hash proc to hash it |
22:41:35 | FromDiscord | <XxDiCaprioxX> Okay I'll put my code completely |
22:41:54 | FromDiscord | <XxDiCaprioxX> sent a code paste, see https://play.nim-lang.org/#ix=2tQa |
22:42:11 | FromDiscord | <XxDiCaprioxX> The hash procs are not important and one is unfini9shed |
22:42:12 | Yardanico | what is "variations" field in Opening for? |
22:42:32 | FromDiscord | <XxDiCaprioxX> That is exactly what I am asking about |
22:42:35 | Yardanico | ??????? |
22:42:39 | FromDiscord | <XxDiCaprioxX> It is about chess |
22:42:39 | Yardanico | what do you want it to be? |
22:42:42 | FromDiscord | <Elegant Beef> What is it supposed to be |
22:42:48 | FromDiscord | <XxDiCaprioxX> A hashmap |
22:42:59 | FromDiscord | <XxDiCaprioxX> Of Variations |
22:43:10 | Yardanico | Table |
22:43:12 | FromDiscord | <Elegant Beef> Then you want it as a `Table[key,Variations]` |
22:43:15 | Yardanico | https://nim-lang.org/docs/tables.html |
22:43:22 | FromDiscord | <XxDiCaprioxX> Okay and I can use string as a key? |
22:43:25 | Yardanico | yes |
22:43:30 | FromDiscord | <XxDiCaprioxX> So I can remove all the hash stuff? |
22:43:32 | Yardanico | no |
22:43:36 | FromDiscord | <XxDiCaprioxX> crap |
22:43:37 | FromDiscord | <Elegant Beef> No you'll need it for variations |
22:43:42 | Yardanico | you need to have hash for your Variation type |
22:43:46 | Yardanico | actually no wait |
22:43:52 | Yardanico | if it's a value, you don't need to |
22:43:56 | Yardanico | you can remove both |
22:43:58 | FromDiscord | <XxDiCaprioxX> ?????????? |
22:44:00 | FromDiscord | <Elegant Beef> Yea was going to say we both got it wrong |
22:44:12 | FromDiscord | <Elegant Beef> Hash is only needed for the key since you need a way to hash keys |
22:44:13 | Yardanico | @XxDiCaprioxX please read docs in tables module :) |
22:44:18 | Yardanico | hash is for the key only, yes |
22:44:22 | Yardanico | and strings already have a hash proc defined |
22:44:27 | FromDiscord | <XxDiCaprioxX> So I put Table[string, Variation] instead of Hash in Opening and remove the hash procs? |
22:44:30 | Yardanico | yes |
22:44:34 | FromDiscord | <XxDiCaprioxX> Okay perfect |
22:44:37 | FromDiscord | <XxDiCaprioxX> Thanks a lot |
22:47:16 | FromDiscord | <XxDiCaprioxX> I don't understand the sql documentation and examples |
22:47:25 | Yardanico | why? |
22:47:29 | Yardanico | you mean db_sqlite ? |
22:47:32 | Yardanico | or db_mysql ? |
22:47:37 | FromDiscord | <XxDiCaprioxX> the second one |
22:47:51 | Yardanico | well it's just a wrapper of mysql |
22:47:52 | FromDiscord | <XxDiCaprioxX> I want to have a bot with a database editable from discord |
22:47:55 | Yardanico | and mariadb |
22:48:02 | Yardanico | are you sure you want mysql specifically though? |
22:48:07 | Yardanico | what about something like sqlite |
22:48:33 | Yardanico | https://nim-lang.org/docs/db_mysql.html#examples-larger-example |
22:48:35 | Yardanico | pretty big example |
22:48:36 | FromDiscord | <XxDiCaprioxX> I need a databse of Opening objects |
22:48:54 | Yardanico | you might also want to use an ORM |
22:48:56 | Yardanico | like https://github.com/moigagoo/norm |
22:49:00 | FromDiscord | <XxDiCaprioxX> I read the example but I am not able to understand it |
22:49:07 | Yardanico | wdym? |
22:49:15 | Yardanico | well, to understrand db_mysql you need to know SQL :) |
22:49:29 | * | maier joined #nim |
22:49:39 | Yardanico | you open the database, delete the table if it exists, create a new table, do a transaction where you insert 1000 values |
22:49:53 | Yardanico | commit that transaction, then print all of the values from the database by selecting |
22:49:55 | FromDiscord | <XxDiCaprioxX> Okay |
22:50:00 | Yardanico | then add another item and find it |
22:50:03 | FromDiscord | <XxDiCaprioxX> So basically I have to learn sql first |
22:50:07 | FromDiscord | <XxDiCaprioxX> Is it hard? |
22:50:11 | Yardanico | not really |
22:50:14 | Yardanico | or use something like https://github.com/moigagoo/norm |
22:50:21 | Yardanico | it supports SQLite and PostgreSQL |
22:50:47 | FromDiscord | <XxDiCaprioxX> Okay, I'll keep the tabs open but v0.0.1 will be without anyways |
22:50:48 | Yardanico | not sure why would you want mysql specifically :) |
22:51:02 | Yardanico | nowadays it's sqlite for smaller DBs or postgresql |
22:51:07 | Yardanico | for everything else |
22:51:08 | FromDiscord | <XxDiCaprioxX> Doesn't have to be mysql |
22:51:16 | Yardanico | well, except the key: value DBs of course, i mean relational DBs |
22:51:22 | Yardanico | do you even need a relational DB? |
22:51:42 | FromDiscord | <XxDiCaprioxX> I need a database that can be edited with discord commands |
22:51:51 | Yardanico | that doesn't explain anything |
22:51:56 | Yardanico | you can make any database editable with discord commands |
22:52:03 | FromDiscord | <XxDiCaprioxX> I was told using a json is not an option because of performance and security |
22:52:55 | FromDiscord | <Elegant Beef> What is your end goal? |
22:53:20 | FromDiscord | <XxDiCaprioxX> The size will be at max 60 instances of Opening each with at max 10 instances of Variation |
22:53:46 | FromDiscord | <XxDiCaprioxX> However you should be able to add these while the bot is active |
22:54:22 | * | maier quit (Ping timeout: 246 seconds) |
22:54:25 | FromDiscord | <XxDiCaprioxX> So basically can I just keep the database as a simple variable in my bot file? Or do I need something like sqlite? |
22:54:47 | Yardanico | well you can always use simple files to store data, but it wouldn't be the best |
22:54:48 | FromDiscord | <Elegant Beef> I think it's a case of what are you doing, and do you need to run a DB for it |
22:55:13 | FromDiscord | <XxDiCaprioxX> It is about performance in that aspect |
22:55:18 | Yardanico | sqlite will do just fine |
22:55:31 | Yardanico | not sure what "performance" you're aiming at |
22:55:37 | Yardanico | 1k commands per second? |
22:55:38 | Yardanico | 10k? |
22:55:47 | FromDiscord | <XxDiCaprioxX> Not at all that much |
22:56:06 | FromDiscord | <XxDiCaprioxX> At least not in the beginning |
22:56:08 | Yardanico | then you wouldn't really need to care about performance that much |
22:56:15 | Yardanico | but just use Norm if you need relational |
22:56:16 | FromDiscord | <XxDiCaprioxX> Okay |
22:56:21 | Yardanico | or some key:value DB if you don't need relations |
22:56:48 | FromDiscord | <XxDiCaprioxX> So if I keep it in the main.nim file it is okay if it only runs on a single server? |
22:57:01 | Yardanico | I don't understand how file is related to a server |
22:57:14 | FromDiscord | <Elegant Beef> I dont understand anything ๐ |
22:57:23 | * | azed joined #nim |
22:57:33 | FromDiscord | <XxDiCaprioxX> If I put the table inside the bots source code file |
22:57:55 | Yardanico | well, if your app restarts, you'll lose all data |
22:58:18 | FromDiscord | <XxDiCaprioxX> okay, that's good to know |
22:59:01 | FromDiscord | <XxDiCaprioxX> And if I use sqlite where does it get saved? |
23:00:58 | Yardanico | in a file |
23:01:06 | Yardanico | you can always just backup it |
23:01:16 | FromDiscord | <XxDiCaprioxX> Okay but I can do the same with a json, right? |
23:01:28 | Yardanico | yes, but it'll be slower to serialize/deserialize :) |
23:01:30 | Yardanico | probably |
23:01:33 | Yardanico | and more size |
23:01:39 | FromDiscord | <Elegant Beef> You can do the same with any file format, i think the biggest question is still what are you doing imo |
23:02:27 | FromDiscord | <XxDiCaprioxX> I want a bot to print out Information about chess openings for my chess server |
23:02:38 | Yardanico | yes, so what's the problem? it doesn't sound too hard |
23:02:59 | FromDiscord | <XxDiCaprioxX> 1. I'm new to nim 2. I never made a bot before |
23:03:03 | FromDiscord | <Elegant Beef> Ok so then just store all chess openings in a compiletime table and there you go |
23:03:07 | Yardanico | haha |
23:03:12 | Yardanico | well he needs to add them via commands |
23:03:13 | Yardanico | so no |
23:03:26 | FromDiscord | <XxDiCaprioxX> But while I'm thinking about it |
23:03:29 | Yardanico | @XxDiCaprioxX just use simple json or sqlite (maybe with Norm if you're new to SQL) |
23:03:48 | FromDiscord | <Elegant Beef> I mean name is the command and the data gets sent in response |
23:03:54 | FromDiscord | <Elegant Beef> ๐ |
23:04:07 | FromDiscord | <XxDiCaprioxX> Mean xD |
23:04:28 | FromDiscord | <XxDiCaprioxX> Yardanico I'll just go for json and change it later |
23:04:48 | FromDiscord | <XxDiCaprioxX> The performance should be good enough and changing it should not be too much wrk |
23:05:58 | FromDiscord | <XxDiCaprioxX> So thanks for your time |
23:06:14 | * | Jjp137 quit (Read error: Connection reset by peer) |
23:08:09 | * | Jjp137 joined #nim |
23:15:35 | * | Jjp137 quit (Read error: Connection reset by peer) |
23:15:50 | * | Jjp137 joined #nim |
23:16:02 | FromDiscord | <XxDiCaprioxX> So this may sound dumb but how do I instantiate my types? ``` var najdorf = Variation(parameters) ``` gives me `invalid type: 'untyped' for var` |
23:28:01 | Yardanico | Variation(field1: value1, field2: value2) |
23:28:24 | Yardanico | or write a constructor (just a normal proc which makes a new type) |
23:28:29 | Yardanico | a new object of that type* |
23:33:33 | FromDiscord | <XxDiCaprioxX> I did it actually |
23:33:46 | FromDiscord | <XxDiCaprioxX> I forgot my messages don't get deleted on your platform, sorry for that |
23:44:47 | FromDiscord | <XxDiCaprioxX> How can I access a member of a table? |
23:47:01 | FromDiscord | <Rika> with[] |
23:47:06 | FromDiscord | <Rika> table[key] |
23:47:21 | FromDiscord | <XxDiCaprioxX> does not work for me |
23:47:23 | FromDiscord | <XxDiCaprioxX> how weird |
23:47:26 | FromDiscord | <Rika> what is the error |
23:47:46 | FromDiscord | <XxDiCaprioxX> Nevermind |
23:47:56 | FromDiscord | <XxDiCaprioxX> I wrote string instead of the variable on accident |
23:48:00 | * | krux02_ joined #nim |
23:49:33 | FromDiscord | <XxDiCaprioxX> sent a code paste, see https://play.nim-lang.org/#ix=2tQm |
23:50:10 | Yardanico | uhh |
23:50:13 | Yardanico | what do you want to add? |
23:50:18 | FromDiscord | <Elegant Beef> do you know how tables work? |
23:50:24 | Yardanico | you said you want a mapping from string to Variation |
23:50:26 | Yardanico | so |
23:50:28 | FromDiscord | <Elegant Beef> `dataBase.add(name,variation)` |
23:50:31 | Yardanico | no |
23:50:36 | FromDiscord | <XxDiCaprioxX> no |
23:50:37 | Yardanico | database[name] = variation |
23:50:38 | FromDiscord | <Elegant Beef> no |
23:50:42 | * | krux02 quit (Ping timeout: 244 seconds) |
23:50:46 | FromDiscord | <XxDiCaprioxX> not what I want |
23:50:50 | Yardanico | but what do you want? |
23:50:56 | FromDiscord | <XxDiCaprioxX> database hold openings, openings hold variations |
23:51:01 | Yardanico | you said you want a table of mappings string to Variation |
23:51:31 | FromDiscord | <XxDiCaprioxX> give me a minute |
23:51:35 | Yardanico | table is a mapping from one type to another |
23:51:40 | FromDiscord | <XxDiCaprioxX> yes |
23:51:43 | Yardanico | where one type acts as a key, and another as a value |
23:51:51 | FromDiscord | <XxDiCaprioxX> and I have a table of openings called database |
23:52:03 | FromDiscord | <XxDiCaprioxX> Wait I'll do full code |
23:52:11 | Yardanico | just tell what you actually want to do |
23:52:19 | FromDiscord | <XxDiCaprioxX> sent a code paste, see https://paste.rs/aa0 |
23:52:31 | FromDiscord | <XxDiCaprioxX> I want to add a variations to an opening inside database |
23:52:38 | Yardanico | well okay |
23:52:46 | Yardanico | but then |
23:52:57 | Yardanico | you need to have an add proc for your opening |
23:53:17 | FromDiscord | <XxDiCaprioxX> ``` proc newOpening(name: string, position: string, variations: Table[string, Variation]) =โต let opening = Opening(name: name, position: position, variations: variations) ``` |
23:53:38 | FromDiscord | <XxDiCaprioxX> This one does not have the add thing yet but whatever |
23:53:43 | Yardanico | but you need to |
23:53:47 | Yardanico | "database[opening].add(name, variation)" |
23:53:53 | Yardanico | you get an opening from the table |
23:53:57 | Yardanico | and call .add proc on that opening |
23:54:03 | Yardanico | which doesn't exist |
23:54:06 | Yardanico | so the compiler complains |
23:54:16 | FromDiscord | <XxDiCaprioxX> (edit) 'variations)' => 'variations)โต database.add(name, opening)' |
23:54:32 | FromDiscord | <XxDiCaprioxX> Oh okay makes sense |
23:54:41 | FromDiscord | <XxDiCaprioxX> But opening is a table too |
23:55:00 | FromDiscord | <XxDiCaprioxX> Oh no it does not |
23:55:13 | FromDiscord | <XxDiCaprioxX> I found the mistake |
23:55:27 | FromDiscord | <XxDiCaprioxX> I was taking Opening as the table while in fact opening only holds a table |
23:55:45 | FromDiscord | <XxDiCaprioxX> Figured it out |
23:55:48 | FromDiscord | <XxDiCaprioxX> Thank you |
23:56:37 | * | krux02_ quit (Remote host closed the connection) |
23:56:56 | * | vicfred joined #nim |