00:03:10 | FromDiscord | <Elegantbeef> Use `--os:any` instead |
00:03:38 | FromDiscord | <impbox [ftsf]> hmm that gives↵`Error: OS module not ported to your operating system!` |
00:03:45 | FromDiscord | <Elegantbeef> Arrays and seqs are identical minus the heap allocation↵(@nqeron) |
00:03:53 | FromDiscord | <Elegantbeef> Yep you cannot use os on that OS |
00:04:21 | FromDiscord | <impbox [ftsf]> ahh... didn't think I was using os... but maybe it's included somehow... |
00:05:10 | FromDiscord | <Elegantbeef> https://github.com/PMunch/ratel if you arent using it |
00:05:26 | FromDiscord | <deech> sent a code paste, see https://paste.rs/Qyq |
00:05:57 | FromDiscord | <Elegantbeef> No offence intended but i do enjoy when people say "common" and i've literally never needed it 😄 |
00:06:38 | FromDiscord | <impbox [ftsf]> hmm ratel sounds handy! |
00:06:57 | FromDiscord | <deech> Maybe it's cultural. It's all over the place in FP ecosystems. 🤷 |
00:07:23 | FromDiscord | <Elegantbeef> I dont write conventional software so we'll blame that |
00:17:50 | NimEventer | New thread by inv2004: Ttop - System monitoring service tool with tui and historical data, see https://forum.nim-lang.org/t/9751 |
00:20:18 | FromDiscord | <geekrelief> Is there a way to get the generated C++ symbol name for a genSymed identifier? I'm trying to genSym a variable and pass it's name to an emit pragma which calls a C++ macro. |
00:20:27 | FromDiscord | <geekrelief> (edit) "it's" => "its" |
00:22:51 | FromDiscord | <geekrelief> sent a code paste, see https://play.nim-lang.org/#ix=4jjE |
00:24:22 | FromDiscord | <Elegantbeef> `signatureHash` i think |
00:25:07 | FromDiscord | <geekrelief> thanks beef! |
00:27:36 | FromDiscord | <impbox [ftsf]> ahh std/random imports os |
00:28:44 | FromDiscord | <geekrelief> hmm `signatureHash` isn't working, but maybe there's something else in macros |
00:38:07 | FromDiscord | <geekrelief> sent a code paste, see https://play.nim-lang.org/#ix=4jjI |
00:38:16 | FromDiscord | <geekrelief> (edit) "https://play.nim-lang.org/#ix=4jjI" => "https://play.nim-lang.org/#ix=4jjJ" |
01:38:49 | FromDiscord | <Hoss> anyone using nim on nixos? How should I work with nimler? Should I use the unwrapped package? |
01:39:28 | FromDiscord | <huantian> I use Nim on NixOS but I’ve never heard of nimler |
01:40:10 | FromDiscord | <huantian> nim (wrapped) == nim-unwrapped + nimble-unwrapped + other bundled Nim tools |
01:53:58 | FromDiscord | <Hoss> sorry yeah I meant nimble |
01:54:27 | FromDiscord | <huantian> Yeah you want just `nim` then |
01:54:34 | FromDiscord | <Hoss> so the regular nim package provides nimble, got it |
01:54:34 | FromDiscord | <huantian> That should come with the compiler and nimble |
02:07:59 | FromDiscord | <nqeron> `let (tileParsed, tileErr) = tileStr.parseTile↵↵ if tileErr: ↵ return (default(Game), false)` : Error: unhandled exception: index out of bounds, the container is empty [IndexDefect] |
02:08:25 | FromDiscord | <Elegantbeef> Ensure your index is in the collcetion you're indexing |
02:08:29 | FromDiscord | <nqeron> I've debugged it, and I know tileErr is getting a bool value |
02:08:30 | FromDiscord | <jtv> @ElegantBeef Thanks again for the help yesterday. As I mucked around with it all, I learned that most of my troubles were more likely from not remembering that I can't dot anything before the type parameter's bracket. And whenever I did it, all I got was an extraordinarily unhelpful "T cannot be instantiated", and generally recursion when I debugged 🙂 |
02:09:09 | FromDiscord | <Elegantbeef> Your index defect will give you a line number |
02:09:13 | FromDiscord | <jtv> But I'm all good now. What's the reason why the member access before the type parameters is ambiguous? |
02:09:27 | FromDiscord | <Elegantbeef> What do you mean? |
02:09:28 | FromDiscord | <nqeron> In reply to @Elegantbeef "Ensure your index is": I don't know where it thinks it's trying to access an index - it's pointing to the if statement |
02:09:39 | FromDiscord | <Elegantbeef> Are you sure? |
02:09:51 | FromDiscord | <nqeron> can I share a repo? |
02:09:56 | FromDiscord | <Elegantbeef> Legally? |
02:09:58 | FromDiscord | <Elegantbeef> Yes |
02:10:04 | FromDiscord | <Elegantbeef> Ethically? Probably |
02:10:13 | FromDiscord | <nqeron> it's my repo - for myself |
02:10:13 | FromDiscord | <jtv> If I do something like: foo.func[typeParam]() it usually (though not always) says "Cannot instantiate T" |
02:10:31 | FromDiscord | <Elegantbeef> `foo.func[: typeParam]()` |
02:10:38 | FromDiscord | <nqeron> it has an MIT license - I meant would you actually be able to look at it? |
02:10:40 | FromDiscord | <Elegantbeef> UFCS is ambiguous with generics |
02:10:46 | FromDiscord | <Elegantbeef> I was joking nqeron |
02:10:49 | FromDiscord | <Elegantbeef> Yes it's fine |
02:11:05 | FromDiscord | <Elegantbeef> `foo.func[typeParam]` is parsed as `[](foo.func, typeParam)` |
02:11:09 | FromDiscord | <jtv> Oh, cause it might be an array access |
02:11:10 | FromDiscord | <jtv> Yeah |
02:11:19 | FromDiscord | <jtv> Ahhh |
02:11:28 | FromDiscord | <jtv> Interesting |
02:11:31 | FromDiscord | <Elegantbeef> The `: type` syntax overrides that and you get merry UFCS with generics |
02:11:59 | FromDiscord | <nqeron> https://github.com/nqeron/DitakticBot/tree/feature/display_parse |
02:12:30 | FromDiscord | <jtv> Great, I'll remember that. Might be nice to optionally support easy to type unicode brackets for type params too like « and » |
02:13:31 | FromDiscord | <Elegantbeef> "Easy to type" |
02:13:50 | FromDiscord | <Elegantbeef> It could be considered Nim already has unicode operators |
02:13:58 | FromDiscord | <jtv> On my keyboard (Mac) it's Option-\ and Option-| |
02:14:06 | FromDiscord | <jtv> So yeah, once you know they're there 🙂 |
02:14:12 | FromDiscord | <Elegantbeef> I use linux and have 0 clue how to type unicode |
02:14:37 | FromDiscord | <Elegantbeef> nqeron how do you reproduce the issue? |
02:14:48 | FromDiscord | <Elegantbeef> I compiled and ran your main and no issue |
02:14:55 | FromDiscord | <Elegantbeef> Also you're pushing `.exe`s |
02:15:33 | FromDiscord | <jtv> Depends on what editor you use, emacs? I can give you some elisp for that |
02:15:43 | FromDiscord | <Elegantbeef> I use kate/nvim |
02:16:10 | FromDiscord | <jtv> Ah, I'm not help there 🙂 |
02:16:17 | FromDiscord | <nqeron> In reply to @Elegantbeef "nqeron how do you": I'm running from nimble run |
02:16:42 | FromDiscord | <Elegantbeef> Oh sorry i need to be on a branch |
02:17:10 | FromDiscord | <nqeron> In reply to @Elegantbeef "Also you're pushing `.exe`s": damn - I'll deal with that |
02:17:59 | FromDiscord | <Elegantbeef> Odd the error moves with `--mm:orc` |
02:29:34 | FromDiscord | <Elegantbeef> Very go code 😄 |
02:33:26 | FromDiscord | <Elegantbeef> I do not see why this error appears where it does |
02:36:17 | FromDiscord | <nqeron> I think it's with how I'm initializing the board |
02:36:45 | FromDiscord | <nqeron> something to do with setting the default for nested sequences |
02:38:26 | FromDiscord | <nqeron> the default(Board) gives me, well I'm not sure what |
02:38:47 | FromDiscord | <Elegantbeef> An empty sequence |
02:39:09 | FromDiscord | <nqeron> but I think I want to initialize my sequences so I have a seq[N, seq[N, Tile]] |
02:39:23 | FromDiscord | <Elegantbeef> I know it doesnt help your issue whatsoever but consider looking at `std/options` |
02:39:29 | FromDiscord | <nqeron> because it's trying to access board[][] |
02:40:12 | FromDiscord | <Elegantbeef> Yes you will want to do `import std/sequtils; myBoard = newSeqWith(N, newSeq[T](N))` |
02:40:57 | FromDiscord | <nqeron> ah - thanks |
02:42:03 | FromDiscord | <Elegantbeef> Some of your code is needlessly complex |
02:42:14 | FromDiscord | <Elegantbeef> `(self.ply == 0 and color == black) or (self.ply == 1 and color == white)` is just `(self.ply == ord(color)` |
02:42:26 | FromDiscord | <Elegantbeef> or `1 - ord(color)` |
02:45:10 | FromDiscord | <JeysonFlores> is IntelliJ IDEA Nim Plugin better than Nimsuggest? |
02:45:26 | FromDiscord | <Elegantbeef> Doubtful |
02:45:54 | FromDiscord | <Elegantbeef> Jetbrain's addon doesnt do any compilation on the code so macros/templates are not suggested for afaik |
02:46:47 | FromDiscord | <Elegantbeef> nqeron this is speed related but doing `for x in a[0..^2]` copies the seq so it's faster to do `for x in a.toOpenArray(0, x.high - 1)` |
02:47:02 | FromDiscord | <JeysonFlores> In reply to @Elegantbeef "Jetbrain's addon doesnt do": I see |
02:47:15 | FromDiscord | <Elegantbeef> I've never used the plugin to be clear |
02:47:28 | FromDiscord | <Elegantbeef> I just know they dont use nimsuggest and they clearly havent build a compiler from scratch |
02:47:40 | FromDiscord | <Elegantbeef> So their tooling is going to be lacking for any code that uses macros |
02:47:42 | FromDiscord | <Elegantbeef> Which is a fair bit |
03:01:25 | FromDiscord | <nqeron> In reply to @Elegantbeef "or `1 - ord(color)`": it's a work in progress - I plan on cleaning some of this up |
03:02:00 | FromDiscord | <nqeron> if I have a string with values of "x |
03:02:08 | FromDiscord | <Elegantbeef> If i dont needlessly give suggestions who will?! |
03:02:55 | FromDiscord | <nqeron> (edit) ""x" => ""x(\d)" and I want to replace them with "x,x,x" where x is repeated that number of times, what's the easiest way to do this?" |
03:12:24 | FromDiscord | <nqeron> could not load: pcre64.dll ? |
03:12:44 | FromDiscord | <Elegantbeef> your install doesnt have pcre in the path |
03:12:58 | FromDiscord | <Elegantbeef> It's probably better to use `nim-regex` or not to use regex at all |
03:13:19 | FromDiscord | <nqeron> as opposed to std/re? |
03:13:26 | FromDiscord | <Elegantbeef> Yes |
03:13:44 | FromDiscord | <jtv> Why are people so obsessed w/ regexps 🙂 |
03:13:48 | FromDiscord | <Elegantbeef> `std/re` and `std/nre` both rely on the pcre library |
03:13:52 | FromDiscord | <Elegantbeef> I do not know jtv |
03:13:57 | FromDiscord | <Elegantbeef> I only use them when they make sense |
03:14:02 | FromDiscord | <Elegantbeef> User define searches for instance |
03:14:37 | FromDiscord | <ringabout> There is also a tinyre https://github.com/khchen/tinyre |
03:15:07 | FromDiscord | <ringabout> I'm going to link them in the documentation. |
03:15:09 | FromDiscord | <Elegantbeef> When you need a regex library it's nice to have but many people seem to shoehorn regex into a project |
03:15:54 | FromDiscord | <jtv> Yeah, and basic globbing in particular. But for any actual parsing, even if it can get the job done, it's just far less clear and more error prone than just using even a parser generator |
03:18:14 | FromDiscord | <Elegantbeef> How else do I ensure a string only contains letters?! 😜 |
03:19:18 | FromDiscord | <jtv> Ha |
03:20:00 | FromDiscord | <Rika> parseutils parseutils parseutils parseutils parseutils parseutils parseutils |
03:20:41 | FromDiscord | <Elegantbeef> Hmmm do you hear that? |
03:20:46 | FromDiscord | <Elegantbeef> Sounds a lot like parseutils |
03:20:50 | FromDiscord | <jtv> It's amazing how little "senior" engineers know about strings in general. I know plenty that would still do that with [a-zA-Z], and if you expect them to know anything about Unicode beyond "stuff is generally utf-8 and I don't have to worry..." |
03:21:23 | FromDiscord | <Elegantbeef> hey depending on what i'm doing i'd do `str.allInSet({'a'..'z', 'A'..'Z'}` |
03:21:28 | FromDiscord | <Rika> unicode is hard to understand though so id say understandable |
03:21:49 | FromDiscord | <Elegantbeef> Luckily we have `isAlpha` and friends |
03:22:21 | FromDiscord | <nqeron> this is what I came up with, but it doesn't seem to be working as expected: boardStr.replace(re"x(\d)", newSeqWith(($1).parseInt, "x").join(",")) |
03:22:36 | FromDiscord | <Elegantbeef> Regex t oreplace |
03:22:48 | FromDiscord | <jtv> Well, if you want to understand every nuance of the unicode database sure, but the basics CAN be presented pretty easily |
03:23:04 | FromDiscord | <jtv> Like, understanding what a codepoint is would be a fine start |
03:23:05 | FromDiscord | <Elegantbeef> What is the input string and what's the desired output string? |
03:24:03 | FromDiscord | <Rika> In reply to @jtv "Like, understanding what a": i think the names for those could be improved on |
03:24:22 | FromDiscord | <Rika> codepoint? glyph? grapheme? very confusing for most |
03:24:57 | FromDiscord | <Elegantbeef> Just make strings work with unicode operations |
03:25:05 | FromDiscord | <Elegantbeef> `a[30]` goes brrr |
03:25:32 | FromDiscord | <nqeron> input: "2,x2,1,x2/x4,1,x/x2,2,12,1,x/x2,12C,1,21C,x/x2,2,1S,12,x/1,x,2,x,1,x 2 12" |
03:26:01 | FromDiscord | <Elegantbeef> Yea just use parse utils |
03:26:24 | FromDiscord | <nqeron> I'll look into it |
03:30:13 | FromDiscord | <jtv> Sure, but as a programmer, glyphs and graphemes are rarely important, but knowing the difference between the abstract representation and the encoding is a big thing |
03:31:11 | FromDiscord | <jtv> But you're right. Codepoint's not awesome, but it doesn't help that there's not wide adoption of a single term. "Rune" isn't bad, but it's also not amazing. Codepoint's more clear, if more verbose. |
03:33:45 | FromDiscord | <Elegantbeef> Just call it fancy character and move along 😛 |
03:33:53 | FromDiscord | <jtv> Lol yup |
03:34:12 | FromDiscord | <etra> when you use x86 and do `case`, how does 'optimally' compare strings? is there a intrinsic or something? |
03:34:22 | FromDiscord | <jtv> Frankly, if we don't care about memory anymore, just make it all UTF-32 and be done with all the subtle errors 🙂 |
03:34:24 | FromDiscord | <etra> does it builds a jump table? |
03:34:38 | FromDiscord | <Elegantbeef> It's supposed to hash but from what i hear it doesnt |
03:34:47 | FromDiscord | <etra> oh nim is in godbolt |
03:34:49 | FromDiscord | <etra> nice |
03:35:13 | FromDiscord | <Elegantbeef> Ah yes the one standard that only one company uses 😛↵(@jtv) |
03:35:53 | FromDiscord | <jtv> Is that part of the nim compiler, or left to the underlying pipeline? I'd assume it just ends up in switch() statements and LLVM or gcc takes care of the rest? |
03:36:22 | FromDiscord | <Elegantbeef> Does C have switch statements for strings? |
03:36:28 | FromDiscord | <jtv> Oh, I was not serious |
03:36:51 | FromDiscord | <jtv> No, it doesn't. |
03:36:54 | FromDiscord | <Elegantbeef> It's supposed to be a precomputed hash and comparison |
03:37:17 | FromDiscord | <Elegantbeef> Yea i didnt think it did, but i've never written C so no clue if it actually did and i was living in ignorance |
03:38:26 | FromDiscord | <jtv> But I'm not sure what good hashing the strings does you in terms of speed-up for most cases with fairly small numbers of strings involved |
03:39:01 | FromDiscord | <Elegantbeef> Well it allows you do to fast removal when large amount of strings are involved |
03:39:16 | FromDiscord | <Elegantbeef> But yes indeed for smaller ones it's likely faster to just compare directly and skip the useless int comparison |
03:39:45 | FromDiscord | <jtv> What do you mean by fast removal? Thinking in the context of a case statement I don't get what you're saying |
03:40:15 | FromDiscord | <Elegantbeef> You have an O(1) comparison which is beneficial for many branches |
03:40:26 | FromDiscord | <Elegantbeef> So you only need the O(n) comparison on the hash hits |
03:40:37 | FromDiscord | <emanresu3> any news on Nim 2.0? |
03:40:41 | FromDiscord | <Elegantbeef> RC1 is out |
03:41:52 | FromDiscord | <jtv> Using hashing for amortized O(1) access is good for larger amounts of data, sure. I'm sure at some point you could get value from a jump table that uses a form of hashing (you'd have to go one byte at a time, I forget what the kind of hash is called, basically a tree hash) |
03:41:56 | FromDiscord | <etra> (snip) oh smort, it first compares the lengths of the cases to the length of the input string https://media.discordapp.net/attachments/371759389889003532/1055691697914400908/image.png |
03:42:29 | FromDiscord | <Elegantbeef> Much cheaper than hashing 😄 |
03:42:34 | FromDiscord | <emanresu3> what was the tool to download different nim versions? I forgot I never installed it \:p |
03:42:41 | FromDiscord | <jtv> choosenim |
03:42:46 | FromDiscord | <Elegantbeef> Ironically i dont think the rc1 supports choosenim |
03:42:55 | FromDiscord | <jtv> Lol |
03:42:56 | FromDiscord | <emanresu3> thanks |
03:46:07 | FromDiscord | <jtv> BTW, Elegantbeef, I have done a lot on lock free and wait free data structures in C in the past, will eventually port it all to Nim. Don't agree with Araq's comments in the locking table code; in my experience, I can make some classes of data structures slightly more efficient than the best locking versions I can find; they're basically the same performance wise, except that threads holding locks get swapped out occasionally. |
03:46:11 | FromDiscord | <jtv> See: https://github.com/viega/hatrack.git |
03:46:38 | FromDiscord | <Elegantbeef> > Don't agree with Araq's comments in the locking table code↵> No clue what this means |
03:46:48 | FromDiscord | <Elegantbeef> > Don't agree with Araq's comments in the locking table code↵No clue what this means\ 😛 |
03:47:04 | FromDiscord | <jtv> Oh, there's a table in the stdlib, and a comment in it saying, "While I'd accept lock free contributions, if you need that you're doing it wrong" |
03:47:25 | FromDiscord | <Elegantbeef> Ok so i have no clue why you're talking to me about it |
03:47:40 | FromDiscord | <Elegantbeef> I do multi thread code pretty much never |
03:47:56 | FromDiscord | <jtv> Ah, well there you go then, sorry 🙂 |
03:48:17 | FromDiscord | <Elegantbeef> Unacceptable! |
03:48:40 | FromDiscord | <jtv> Just a lot of people I know who care about high scalability and performance are interested in many dimensions of it, sorry for presuming! |
04:07:38 | FromDiscord | <Bung> In reply to @jtv "BTW, Elegantbeef, I have": when you done this please also provide document |
04:07:48 | * | ltriant quit (Ping timeout: 272 seconds) |
04:08:10 | FromDiscord | <jtv> Will do, certainly. Not sure when I'll get to it... whenever I need it next 🙂 |
04:09:05 | FromDiscord | <Bung> that's nice |
04:11:00 | FromDiscord | <jtv> It's not a small project, in large part since I'd have to deeply understand all the options for memory management in Nim and how it impacts what I need to provide. But I want to find the time at some point! |
04:16:29 | FromDiscord | <Rika> In reply to @Elegantbeef "Ah yes the one": microsoft uses 16 not 32 iirc |
04:20:59 | FromDiscord | <jtv> Yes. Worst of both worlds! |
04:21:24 | FromDiscord | <jtv> Have both memory expansion AND problems when people think random-access indexing is okay! |
04:34:46 | FromDiscord | <elcritch> Random question, what is the proper way to get a data pointer from an openArray? I don't think `addr someOpenArray` works. |
04:35:04 | FromDiscord | <Elegantbeef> `addr someOpenarray[0]` |
04:53:09 | FromDiscord | <Elegantbeef> `addr someOpenarray` is fickle it sometimes returns what you expect and other times doesnt |
04:59:44 | * | Figworm quit (Remote host closed the connection) |
05:00:53 | * | Figworm joined #nim |
05:05:04 | FromDiscord | <elcritch> Yah wouldn't an `openArray` with len 0 throw an index exception though? |
05:05:40 | FromDiscord | <Elegantbeef> An openarray with 0 data has no data pointer |
05:09:36 | FromDiscord | <elcritch> Hmmm, would that just be a nil pointer? I guess doing a length check isn't worse than check if the data pointer is nil. Maybe I was thinking too C like. |
05:09:52 | FromDiscord | <elcritch> @ElegantBeef didn |
05:10:14 | FromDiscord | <elcritch> (edit) "didn" => "didn't you write a remoteref type library? I can't seem to find it on your github" |
05:10:30 | FromDiscord | <Elegantbeef> https://github.com/beef331/nimtrest/blob/master/remoterefs.nim |
05:10:33 | FromDiscord | <Elegantbeef> Never moved it to it's own |
05:27:50 | FromDiscord | <elcritch> ok, I just want to point it out in https://forum.nim-lang.org/t/9745#64166 |
05:28:27 | FromDiscord | <elcritch> We should split it out too! It'd be handy package in EmbeddedNim. |
05:34:01 | FromDiscord | <Elegantbeef> Sadly it doesnt work with `ref` |
05:43:07 | FromDiscord | <elcritch> How so? |
05:43:24 | FromDiscord | <Elegantbeef> You cannot make a `ref` that works with the CustomRef |
05:44:03 | FromDiscord | <Elegantbeef> Same with `seq` and `string` |
05:49:33 | FromDiscord | <elcritch> Sure you can, `ref CustomRef` right? 😉 |
05:50:01 | FromDiscord | <Elegantbeef> That uses Nim's allocator |
05:52:07 | FromDiscord | <elcritch> Oh, you mean to original posters idea. No, but you can wrap a foreign Ref with your RemoteRef right and just treat C's malloc/free? |
05:55:06 | FromDiscord | <Elegantbeef> https://github.com/beef331/nimtrest/blob/master/remoterefs.nim#L18-L21 correct |
05:56:30 | FromDiscord | <Elegantbeef> I more mean you cannot have a customref with a `ref`, `string` or `seq` |
05:56:46 | FromDiscord | <Elegantbeef> You technically can, but it doesnt work how you'd want since it doesnt use those allocators for the type |
05:57:18 | FromDiscord | <Elegantbeef> So like if you use SPI allocators which afaik are persistent if you use a Nim GC'd memory type you lose said memory |
05:57:55 | FromDiscord | <Elegantbeef> That reason is why i disallow anything but stack |
05:59:08 | FromDiscord | <Elegantbeef> I do have a god awful syntax idea that could be used for adding support for `ref` `seq` and `string` |
05:59:11 | FromDiscord | <Elegantbeef> https://forum.nim-lang.org/t/9617#63238 |
06:02:32 | FromDiscord | <Elegantbeef> If you think about allocators like contexts in Zig/Odin you ideally want to use the same allocators for a given type unless otherwise specified |
06:13:23 | FromDiscord | <JeysonFlores> Can't you assign default values for generic params? something like:↵`proc promptInput[T: int | float | string](msg: string, default: T = int: 0 | float: 0 | string: ""): T =↵ # stuff here` |
06:13:40 | FromDiscord | <Elegantbeef> Nope |
06:13:51 | FromDiscord | <JeysonFlores> sh1t |
06:13:55 | FromDiscord | <JeysonFlores> thanks |
06:14:05 | FromDiscord | <Elegantbeef> It's best to make 3 variations |
06:14:22 | FromDiscord | <JeysonFlores> yep, it seems like it. Thanks |
06:14:38 | FromDiscord | <Elegantbeef> The benefit of that is you really get a generic interface now |
06:14:49 | FromDiscord | <Elegantbeef> So you can make the same procedure for anytype easily |
06:17:01 | FromDiscord | <JeysonFlores> what about doing something like:↵`proc promptInput[T: int | float | string](msg: string, default: Option[T]): T =↵ # check if default is None and declare a variable with the default value according to its type` |
06:17:33 | FromDiscord | <Elegantbeef> You can always do this cleaner |
06:20:07 | FromDiscord | <Elegantbeef> sent a code paste, see https://play.nim-lang.org/#ix=4jkr |
06:20:39 | FromDiscord | <Elegantbeef> Remove the `: int | float | string` for the most flexible api that allows more types dynamically |
06:22:07 | FromDiscord | <Elegantbeef> If we use concepts(a bit 'experimental' but work well enough for things like this) we can make this even relatively documented |
06:22:10 | FromDiscord | <Elegantbeef> https://play.nim-lang.org/#ix=4jks |
06:23:03 | FromDiscord | <Elegantbeef> This allows you to plug in your own static defaults or supply a default |
06:24:24 | FromDiscord | <JeysonFlores> holy crap I didn't know about the `default` function |
06:24:44 | FromDiscord | <Elegantbeef> sent a code paste, see https://play.nim-lang.org/#ix=4jkt |
06:25:02 | FromDiscord | <Elegantbeef> `default(T)` returns a 0'd(in 2.0 this isnt true) version of the value |
06:25:26 | FromDiscord | <Elegantbeef> But even there it doesnt really give the most usable API for this |
06:25:47 | FromDiscord | <Elegantbeef> shit that should be `promptInput[Confirmation]` |
06:26:18 | FromDiscord | <Elegantbeef> Point being depending on how nice you want this API you may want to use more generics and define a generic API to parse the inputs to your specialised types to make your life possibly easier |
06:27:17 | FromDiscord | <Elegantbeef> This might be over-engineering for your simple problem though 😛 |
06:28:41 | FromDiscord | <JeysonFlores> haha indeed, I was close to just give up and make one function per type. Thanks! |
07:31:49 | * | rlitp left #nim (#nim) |
08:51:24 | * | pusewicz joined #nim |
08:55:01 | * | pusewicz quit (Client Quit) |
08:55:07 | * | xet7 quit (Remote host closed the connection) |
09:44:03 | FromDiscord | <luteva> is there any (non-linear) video editor written in nim? |
09:46:16 | FromDiscord | <Elegantbeef> I doubt there is even a linear video editor written in nim 😄 |
10:24:44 | FromDiscord | <demotomohiro> @luteva ↵mock up: A framework for developing video editing software↵https://github.com/mock-up/mock-up |
10:25:40 | FromDiscord | <demotomohiro> I dont know whether it is linear or non-linear. |
10:25:40 | Amun-Ra | does pragma (ie. push) have file scope only? |
10:26:58 | * | ltriant joined #nim |
10:33:18 | FromDiscord | <Bung> that's amazing project "video editor written in nim" |
10:33:48 | FromDiscord | <Bung> wait, is there video player in nim ? |
10:38:16 | FromDiscord | <luteva> In reply to @demotomohiro "<@954521401073754212> mock up:": thx! Now i only have to learn japanese, it seems 😄↵anyways: can someone add that project to "awesome-nim"? Maybe some more people will see it, use it and help. |
10:39:30 | FromDiscord | <luteva> e.g. there are no examples and the muml page is written in japanese 🙂↵but anyway great! |
10:41:55 | FromDiscord | <luteva> did someone already used mock-up? Just for a first example on how to use it.... |
10:42:49 | FromDiscord | <luteva> or does: "Mutsuha Asada - momeemt" is here in the chat? |
10:50:06 | FromDiscord | <luteva> In reply to @Bung "wait, is there video": https://github.com/nim-lang-cn/video-player |
10:50:45 | FromDiscord | <Bung> I've checked that before it use `ffplay` |
11:06:05 | FromDiscord | <Phil> Out of curiosity, what is so experimental about the void type? |
11:07:57 | * | xet7 joined #nim |
11:32:23 | FromDiscord | <Bung> it will not produce a c type, it's nil in compiler when get the proc return type |
11:33:11 | FromDiscord | <Bung> well in explictly generic instaiation it is needed |
11:34:01 | FromDiscord | <Bung> so it's sssssssssssspecial handled in compiler compare to other type |
12:00:27 | * | genpaku quit (Read error: Connection reset by peer) |
12:04:42 | * | genpaku joined #nim |
12:37:13 | * | oddish quit (Quit: nyaa~) |
12:38:07 | * | oddish joined #nim |
12:43:27 | FromDiscord | <Phil> TIL that due to the removal of db_ from the standard libs it breaks the `ndb` package, which breaks `norm`, which breaks my application.↵So off to fix ndb and deal with weird docker issues, yaaaaaay |
13:03:14 | FromDiscord | <kaddkaka> sent a code paste, see https://play.nim-lang.org/#ix=4jlK |
13:19:04 | FromDiscord | <kaddkaka> `type Map[N: static[int], T] = array[N, array[N, T]]` seems to do the trick |
13:20:19 | FromDiscord | <chri> In reply to @Elegantbeef "*Imagine in the future": what is distinct? |
13:21:41 | FromDiscord | <kaddkaka> In reply to @chri "what is distinct?": https://nim-lang.org/docs/manual.html#types-distinct-type |
13:27:17 | FromDiscord | <Phil> In reply to @kaddkaka "`type Map[N: static[int], T]": Likely because array stuff needs to all be known as compile time and int is not inherently compile time, static blocks are though |
13:34:23 | FromDiscord | <kaddkaka> Sure I can understand that, the error message is shit tho 😛 |
13:44:05 | FromDiscord | <Phil> Yeeeee fair |
13:46:34 | NimEventer | New thread by mantielero: Question about memory management, see https://forum.nim-lang.org/t/9753 |
13:53:25 | FromDiscord | <kaddkaka> Hmm, nimsuggest (which I think is the tool that supplies me with lint errors) reports a type mismatch, but the code compiles just fine o.O |
13:59:54 | * | redj quit (Quit: http://quassel-irc.org - Chat comfortably. Anywhere.) |
14:03:33 | * | jmdaemon quit (Ping timeout: 252 seconds) |
14:20:03 | FromDiscord | <hotdog> In reply to @kaddkaka "Hmm, nimsuggest (which I": I’ve found this kind of thing happens with versions mismatched between the nimsuggest binary and the nim compiler |
14:20:24 | FromDiscord | <hotdog> Like if your editor is picking up an old nimsuggest on your path |
14:20:55 | FromDiscord | <hotdog> Or can happen when there are different flags (e.g backend) between what nimsuggest is using and what you are compiling with |
14:32:00 | * | oprypin joined #nim |
14:41:13 | FromDiscord | <ringabout> Is there someone familiar with the chrome driver? It really tortures me => https://github.com/nim-lang/nimforum/pull/337 Could someone more experienced please take control of this PR? I'm too inexperienced to work on it. |
14:42:45 | NimEventer | New thread by c4UlMu: How to move variable to other thread, see https://forum.nim-lang.org/t/9754 |
14:43:34 | FromDiscord | <kaddkaka> I just do `:make --run --showAllMismatches:on` with `makeprg=nim c --listFullPaths:on $ %`↵Both nim and nimsuggest seem to be 1.6.6 from 2022-05-05 🤔 |
14:48:39 | FromDiscord | <Phil> In reply to @ringabout "Is there someone familiar": What is the chrome used for? Selenium? |
14:49:17 | FromDiscord | <Phil> (edit) "In reply to @ringabout "Is there someone familiar": What is the chrome ... used" added "driver" |
14:49:27 | FromDiscord | <ringabout> In reply to @Isofruit "What is the chrome": It is used for testing nimforum using webdriver implemented by Nim. |
14:49:44 | FromDiscord | <Phil> Ah, so selenium equivalent |
14:49:51 | FromDiscord | <ringabout> Yes |
14:51:59 | FromDiscord | <ringabout> It is https://github.com/dom96/webdriver |
14:52:51 | FromDiscord | <ringabout> I cannot even test it on the wsl2 since some bugs as to wsl installing chromium. |
14:52:55 | FromDiscord | <ringabout> (edit) "wsl" => "wsl2" |
14:58:15 | FromDiscord | <kaddkaka> sent a code paste, see https://paste.rs/4yn |
14:58:27 | FromDiscord | <kaddkaka> (but compilation is fine) |
14:58:54 | FromDiscord | <Phil> could ensure that N is static by also throwing a static around it |
14:59:08 | * | arkurious joined #nim |
14:59:17 | FromDiscord | <Phil> in the generics definition of the `[]` proc I mean |
15:01:27 | FromDiscord | <kaddkaka> In reply to @Isofruit "could ensure that N": Still the same type mismatch errors |
15:01:31 | FromDiscord | <kaddkaka> (edit) "In reply to @Isofruit "could ensure that N": Still the same type mismatch ... errors" added "lint" |
15:01:52 | FromDiscord | <Phil> In that case no idea.↵I have to admit that I do not really use nimsuggest because for me it barely faster than just running the compiler |
15:01:59 | FromDiscord | <Phil> So I typically just compile on save and be done with it |
15:05:43 | FromDiscord | <kaddkaka> strange it is .. |
15:08:03 | FromDiscord | <Phil> I just read through the newest thread in the saga of antivirus vendors falsely flagging nim binaries: https://forum.nim-lang.org/t/9744↵Reading through the links posted in there, 2 thoughts come to mind:↵1) It seems dumb as hell that basically you're forced to change the APIs you use because AVs just categorically flag this particular API↵2) Awesome work from you ringabout! |
15:26:14 | FromDiscord | <Phil> Hmm how do I stringify an identifier? |
15:26:31 | FromDiscord | <Phil> Not the value of the identifier, the identifier itself, for an error message |
15:29:19 | FromDiscord | <Phil> sent a code paste, see https://paste.rs/dkS |
15:31:35 | FromDiscord | <Phil> sent a code paste, see https://play.nim-lang.org/#ix=4jmn |
15:32:51 | NimEventer | New thread by RodSteward: Foreign thread callbacks causes memory leak, see https://forum.nim-lang.org/t/9755 |
15:42:55 | NimEventer | New thread by wilsonywx2: Uncatchable JsonParsingError when encountered in a macro , see https://forum.nim-lang.org/t/9756 |
15:46:34 | FromDiscord | <Phil> sent a code paste, see https://paste.rs/Fbv |
15:47:32 | FromDiscord | <HitBlast> Could somebody explain why am I getting this error while trying to read the file? https://media.discordapp.net/attachments/371759389889003532/1055874306804031538/Screenshot_2022-12-23_at_9.47.00_PM.png |
15:47:47 | FromDiscord | <jtv> From a macro there's a field in the node you can grab |
15:48:30 | FromDiscord | <jtv> strVal |
15:48:43 | FromDiscord | <Phil> In reply to @jtv "From a macro there's": I'm very low newbie levels of macro knowledge, so the statement is that an identifier is accessible as a macro-node in this kind of template? |
15:48:54 | FromDiscord | <jtv> One minute, let me get you something to do it |
15:50:43 | FromDiscord | <Rika> In reply to @HitBlast "Could somebody explain why": Parse file is relative to the binary and not the source file |
15:52:58 | FromDiscord | <HitBlast> In reply to @Rika "Parse file is relative": What should I put as path since the json file itself (which I'm trying to parse) is located inside a private folder. |
15:53:06 | FromDiscord | <jtv> sent a code paste, see https://play.nim-lang.org/#ix=4jmu |
15:58:29 | FromDiscord | <Phil> sent a code paste, see https://play.nim-lang.org/#ix=4jmw |
16:00:16 | FromDiscord | <Phil> Arrrgh doesn't work nicely within a template though |
16:03:23 | FromDiscord | <Phil> sent a code paste, see https://play.nim-lang.org/#ix=4jmz |
16:10:06 | FromDiscord | <Phil> ElegantBeef, I shall denounce your supreme intelligence status!↵For the stringification of identifiers in templates is but a fever dream |
16:37:44 | * | om3ga quit (Quit: Bye) |
16:41:09 | * | kenran joined #nim |
16:41:14 | * | kenran quit (Remote host closed the connection) |
16:49:51 | FromDiscord | <HitBlast> @Phil Sorry for the ping but could you help me with this?↵↵I'm trying to turn a `JsonNode` into a set of items. Take the `AVRO_VOWELS` variable as an example, it returns a string of characters if printed. Is there a way to make the object iterable? https://media.discordapp.net/attachments/371759389889003532/1055889989222809681/Screenshot_2022-12-23_at_10.48.23_PM.png |
16:50:20 | FromDiscord | <HitBlast> (edit) "make" => "convert" | "convertthe object ... iterable?" added "into an" |
16:50:58 | FromDiscord | <Phil> What is Avro Vowels to begin with? |
16:51:07 | FromDiscord | <Phil> Just a JS object with multiple key value pairs inside of it? |
16:52:10 | FromDiscord | <Phil> Either way, have you already looked at the iterators section of std/json ?↵https://nim-lang.org/docs/json.html#15 |
16:52:14 | FromDiscord | <HitBlast> In reply to @Isofruit "What *is* Avro Vowels": just a pair of key and value https://media.discordapp.net/attachments/371759389889003532/1055890591269003345/Screenshot_2022-12-23_at_10.51.57_PM.png |
16:52:22 | FromDiscord | <HitBlast> with a string as the value |
16:52:59 | FromDiscord | <HitBlast> I'd like to separate each character and convert it into an iterable |
16:55:10 | FromDiscord | <Phil> So are you asking for an iterator over a string or for an iterator over all keys of a jsonnode? |
16:55:32 | FromDiscord | <HitBlast> iterator over a string |
16:55:35 | FromDiscord | <HitBlast> like for each character |
16:55:52 | FromDiscord | <HitBlast> in Python I'd just convert it into a list using `split()` |
16:57:11 | FromDiscord | <Phil> Have you, yknow, tried simply writing a forloop as if the string itself was a iterable like a seq[char] 😛 ? |
16:57:49 | FromDiscord | <Luckayla> I was going to say you don't need to split a string in python to do that |
16:57:57 | FromDiscord | <Luckayla> You can just iterate the string itself |
16:58:03 | FromDiscord | <Phil> sent a code paste, see https://play.nim-lang.org/#ix=4jmO |
17:02:07 | FromDiscord | <HitBlast> sent a code paste, see https://paste.rs/oj9 |
17:09:02 | * | pro joined #nim |
17:12:40 | * | pro left #nim (#nim) |
17:33:31 | FromDiscord | <14k> Where can I find packages to import |
17:33:45 | FromDiscord | <14k> I remember there was a website with tons of them like pipy for python, but I forgot the url |
17:35:24 | FromDiscord | <Phil> In reply to @14k "Where can I find": The generally fastest way is just using nimble search in the terminal |
17:35:32 | FromDiscord | <Phil> If you want a webpage, nimble.directory exists |
17:35:49 | FromDiscord | <14k> Thanks, that's exactly what I wanted |
17:39:23 | FromDiscord | <14k> https://nimble.directory/docs/ down? |
17:39:41 | FromDiscord | <HuskyHacks> Can anyone point me in the direction of the docs on compiling a Windows program with a specified icon? Something like embedding an icon as a resource and setting it as the Windows icon? ty |
17:40:08 | FromDiscord | <14k> In reply to @HuskyHacks "Can anyone point me": Just compile into c and use recource hacker to add an icon |
17:40:53 | FromDiscord | <HuskyHacks> Yeah I was a little confused as to why the icon doesn't show up in Resource Hacker with a native Nim build |
17:43:05 | FromDiscord | <Phil> In reply to @14k "https://nimble.directory/docs/ down?": I don't think I've ever seen that, https://nimble.directory/ is on as normal |
17:43:26 | FromDiscord | <huantian> Nimble directory docs have been dead for a while |
17:43:34 | FromDiscord | <14k> In reply to @Isofruit "I don't think I've": Yes, the main site works, but whenever I try accessing anyone's docs it just doesn't work |
17:43:53 | FromDiscord | <14k> In reply to @huantian "Nimble directory docs have": ddos attack or shitty infrastructure? |
17:45:51 | FromDiscord | <Phil> For me its hit or miss.↵Some of those links link to external documentation which works as normal, others route to nimble based pages and those are borked as far as i can see |
17:52:16 | FromDiscord | <jtv> @Phil I'd assume it would work fine if you leave the macro returning untyped |
17:52:32 | FromDiscord | <jtv> Typing the macro means it can't run as early as you want it to |
17:54:46 | FromDiscord | <jtv> sent a code paste, see https://play.nim-lang.org/#ix=4jmV |
17:55:12 | FromDiscord | <jtv> arg.strVal returns a string, not a Nim Node |
17:56:13 | FromDiscord | <jtv> The thing about macros is you're writing code to operate on parse tree nodes that runs at compile time. But you still are running normal old code, the only big oddity is the semantics of the macro signature (the fact that you get nim nodes as inputs for instance). |
17:56:59 | FromDiscord | <Phil> sent a code paste, see https://paste.rs/L6K |
17:57:10 | FromDiscord | <Phil> That's on 1.9.1 (devel) |
17:57:51 | FromDiscord | <jtv> Ok one sec |
17:58:06 | FromDiscord | <Phil> Were you running 1.6? I'll try it out there |
17:58:21 | FromDiscord | <jtv> No, hang on |
17:58:22 | FromDiscord | <Phil> 1.6.10 prints the same |
17:58:26 | FromDiscord | <Phil> Alrighty |
17:59:07 | * | om3ga joined #nim |
18:04:49 | FromDiscord | <jtv> It's going to take more work to get it working with the dotexpr, so just give me 2 mins |
18:08:16 | FromDiscord | <jtv> sent a code paste, see https://paste.rs/yOL |
18:08:44 | FromDiscord | <jtv> Tho it isn't quite giving the behavior I'd expect |
18:09:14 | FromDiscord | <jtv> I'm going to refine it, one sec |
18:10:05 | FromDiscord | <Phil> I don't think it's reaching the error pragma, it seems to blow up somewhere in the macro beforehand ^^ |
18:10:45 | FromDiscord | <Phil> Though providing almost exactly the intended behaviour for this particular step: Blow up when identifier is not there.↵Next step is "Blow up when identifier is there, but does not match a specified type" |
18:12:43 | FromDiscord | <jtv> sent a code paste, see https://paste.rs/OjM |
18:14:34 | FromDiscord | <jtv> I've been using Nim less than a month, but have done a lot of compiler work over the past 30 years, so the macros aren't dark magic for me. I was thinking at some point I should write some intro articles on interesting topics like that; the lack of docs and the poor tooling is def. an issue for Nim; I know many people who looked at it and bounced out quickly when they hit roadblocks |
18:16:20 | FromDiscord | <Phil> In reply to @jtv "I've been using Nim": I'd like to get into macros but it's a kind of "no usecase no desire to bite my way through the frustration and lack of understanding. But due to no knowledge I can't see the usecase" kind of thing.↵So far I'm of the opinion that just providing dozens of examples and explaining them would already be a massive improvement as they'll inevitably touch all the individual pieces of macro stuff that come |
18:16:34 | FromDiscord | <Phil> (edit) "In reply to @jtv "I've been using Nim": I'd like to get into macros but it's a kind of "no usecase ... no" added " =>" |
18:16:43 | FromDiscord | <jtv> Yup that's what is needed, far and wide through the language |
18:17:04 | FromDiscord | <Phil> ~~I'm doing what I can with the stuff I participate in~~ |
18:17:16 | FromDiscord | <leorize> that macro of yours can be done with a template |
18:17:36 | FromDiscord | <Phil> In reply to @leorize "that macro of yours": The template I tried blew up on me |
18:17:36 | FromDiscord | <jtv> Like reading the docs on concepts in the page on experimental features, it didn't show a single example of using one, and didn't explain why you might or might not want to have `concept x, var n`, etc. Stuff that's basic |
18:18:04 | FromDiscord | <14k> how could I convert an int to a string? |
18:18:17 | FromDiscord | <Phil> Why on earth are the backticks needed in that though? |
18:18:25 | FromDiscord | <jtv> In the template? |
18:18:27 | FromDiscord | <Phil> In reply to @14k "how could I convert": The answer you are looking for is described within the docs of std/strutils |
18:18:30 | FromDiscord | <jtv> Or the macro? |
18:18:34 | FromDiscord | <14k> In reply to @Isofruit "The answer you are": aight |
18:18:40 | FromDiscord | <Phil> In reply to @jtv "Or the macro?": ` {.error: "'" & `fullLit` & " does not exist!".}` |
18:18:44 | FromDiscord | <Phil> In the error pragma |
18:18:45 | FromDiscord | <14k> also why tf is the output of execShellCmd an int and not a string |
18:18:52 | FromDiscord | <Phil> Is that a way of stringifying nimnodes? |
18:18:58 | FromDiscord | <jtv> So the quote() function makes it all work like a template more or less |
18:19:23 | FromDiscord | <jtv> It will substitute local variables, though those variables HAVE to be nim nodes |
18:19:27 | FromDiscord | <jtv> And only works on locals |
18:19:37 | FromDiscord | <jtv> Anything else will give you random crashes |
18:19:42 | FromDiscord | <leorize> I'd avoid strformat tbh↵(@Phil) |
18:19:49 | FromDiscord | <leorize> and use `system.astToStr` |
18:20:14 | FromDiscord | <Phil> In reply to @leorize "I'd avoid strformat tbh": when working with macros maybe, in general in procs and generics I'll use that over string concatenation any day of the week |
18:20:21 | FromDiscord | <jtv> How's that differ from macro.toStrLit() |
18:20:53 | FromDiscord | <leorize> you can use it outside of a macro |
18:21:11 | FromDiscord | <jtv> I don't understand the subtlety of where fmt"x" is different than"x".fmt() yet btw, so might be the issue |
18:21:18 | FromDiscord | <jtv> Ah, got it, thanks |
18:21:45 | FromDiscord | <leorize> `fmt"x"` interprets `"x"` as a raw string |
18:21:50 | FromDiscord | <Phil> In reply to @jtv "So the quote() function": So basically this works because in terms of evaluation order it... first creates the "fullLit" and fills it with a value, then turns the template defined with quote do into actual code and runs it, capturing "fullLit" in a sense? |
18:22:07 | FromDiscord | <Phil> No wait, there's no way fullLit gets evaluated first |
18:22:14 | FromDiscord | <leorize> it's the same as `fmt(r"x")` if you may |
18:22:18 | FromDiscord | <jtv> I don't think quote() is the same implementation of substitution as templates. It's similar but different |
18:22:19 | FromDiscord | <14k> sent a code paste, see https://paste.rs/ofJ |
18:22:29 | FromDiscord | <jtv> Got it, that's very helpful, thanks, leorize |
18:23:10 | FromDiscord | <Phil> sent a code paste, see https://paste.rs/aQM |
18:23:26 | FromDiscord | <14k> whenever someone visits the website at localhost:5000, it executes a command and displays the output on the website |
18:26:05 | FromDiscord | <jtv> Nim giving full access to the parse tree is amazing, and the tooling makes it really pretty easy, but in a way that leads to unreadable code because it was all auto-generated. I think quote do: is better for readability where possible, if you know about how to work around its limitations. Ideally would eventually want to build something like it, that allows you to get node references to parts of the content where you're going to want to make |
18:26:57 | FromDiscord | <jtv> Otherwise I end up building things kind of in reverse order to try to keep the code as clear as possible |
18:27:20 | FromDiscord | <leorize> sent a code paste, see https://paste.rs/DjN |
18:27:31 | FromDiscord | <leorize> sorry for the short names, I'm typing on phone |
18:28:20 | FromDiscord | <Phil> In reply to @14k "whenever someone visits the": I would generally want to question as to why you want to do that in a one-liner.↵As for this though, your issue is that just because you're throwing a comma around it doesn't mean it's concatenated.↵You want to do ` resp "Result: " & $execShellCmd @"cmd"`↵($ is the general nim symbol for stringifying something, basicall nim's version of "toString") |
18:28:51 | FromDiscord | <Phil> In reply to @leorize "sorry for the short": The fact you're trying on phone at all is impressive, I just give up on even trying to type examples while on phone, thanks! |
18:29:16 | FromDiscord | <jtv> Is there a language rationale anywhere? Haven't been able to find one, and often get curious, e.g., why they chose & for string concat |
18:29:41 | FromDiscord | <leorize> `&` because it's not `+` \:p↵(@jtv) |
18:30:04 | FromDiscord | <14k> In reply to @Isofruit "I would generally want": thanks |
18:30:07 | FromDiscord | <Phil> In reply to @leorize "`&` because it's not": Why exactly is + for string concat so frowned upon? |
18:30:21 | FromDiscord | <jtv> Well, a) Why not +? Most languages use it. And b) Why not | which is string concatenation in many formal settings for strings |
18:30:35 | * | elph_ joined #nim |
18:30:35 | FromDiscord | <leorize> more serious answer\: it's the same as array concat, leaving `+` open for other math stuff you can do with arrays |
18:31:12 | FromDiscord | <Phil> So in case I want to view and treat a string as a seq[char] and have better operators for that the `+` symbol is left undefined for that? |
18:31:25 | FromDiscord | <leorize> also, Araq really hates `+` on seqs, so that might have been more important \:p |
18:31:37 | FromDiscord | <Phil> That's... maybe I just don't write enough low-level code to get that one |
18:31:45 | FromDiscord | <Phil> "low-level" in the sense of "close to the compiler" |
18:32:00 | FromDiscord | <leorize> just consistency I'd say↵(@Phil) |
18:32:00 | FromDiscord | <jtv> Okay, got it. It's one of the few choices in the language I don't love, and one of the first things my co-workers I've been forcing to use it have complained about |
18:32:12 | FromDiscord | <leorize> all concat is `&` regardless of containers |
18:32:18 | FromDiscord | <Phil> In reply to @leorize "just consistency I'd say": I'd argue that strings are different from seqs in enough ways that they deserve special treatment |
18:32:41 | FromDiscord | <leorize> there's always something to complain about when you switch languages \:p↵(@jtv) |
18:33:22 | FromDiscord | <jtv> It's not a major thing for me, more a curiosity. People can get over it, and that rationale makes sense. I like to understand why things are the way they are. |
18:33:46 | FromDiscord | <jtv> I think it is helpful for people coming from other langs to understand the WHYs when things are going to be significantly unexpected |
18:34:03 | FromDiscord | <leorize> wait until they try to do threading and you will never hear the end of it |
18:34:49 | FromDiscord | <Phil> ~~See, this is where I'm safe, I let the webservers provided by frameworks I use do the threading so I never have to deal with it~~ |
18:35:00 | FromDiscord | <jtv> Yeah I need to port over my lock-free, wait-free data structures from C, I am somewhat dreading to wading into the threading model and mem management, there's clearly a lot there (lots of options too) |
18:37:07 | FromDiscord | <14k> does nim compile cross platform? |
18:37:17 | FromDiscord | <14k> like can I compile on mac and run it on linux |
18:38:40 | FromDiscord | <jtv> I don't know the compiler toolchain well but it clearly does, since the compilers (and often llvm underneath them) do. Generally cross-compiling is a bit of an anti-pattern these days, you can generally cheaply automate building natively on all common platforms |
18:38:58 | FromDiscord | <14k> In reply to @jtv "I don't know the": nice 👍 |
18:39:22 | FromDiscord | <jtv> The default flow is nim gets compiled down to C code and fed to your C compiler |
18:39:26 | FromDiscord | <14k> this language is amazing ngl |
18:39:35 | FromDiscord | <14k> dunno why more ppl don't talk abt it |
18:39:48 | FromDiscord | <jtv> So if there's not a flag in the nim compiler (I'm also new to the language), you can def stop it when it generates C |
18:40:33 | FromDiscord | <jtv> Yeah, I was just talking about it. It's been getting some buzz lately, but the lack of handholding intro docs def causes many people to bounce out who would otherwise love it |
18:41:01 | FromDiscord | <jtv> And also the tooling ecosystem isn't that advanced or that well documented either |
18:41:12 | FromDiscord | <jtv> But otherwise, I agree, amazing, amazing language |
18:41:40 | FromDiscord | <jtv> I am throwing away C and Python as my two gotos for 30 years |
18:41:57 | FromDiscord | <14k> it's a good combo of the 2 |
18:43:48 | FromDiscord | <14k> All I wanted was a pretty looking compiled language |
18:47:17 | FromDiscord | <Phil> sent a code paste, see https://play.nim-lang.org/#ix=4jn4 |
18:48:43 | FromDiscord | <Phil> sent a code paste, see https://play.nim-lang.org/#ix=4jn5 |
18:50:17 | FromDiscord | <leorize> I guess you can try if `is` work here |
18:51:03 | FromDiscord | <leorize> `someSymbol is typ`, basically |
18:51:21 | FromDiscord | <leorize> or wrap whatever you have in a `compiles()` |
18:51:45 | FromDiscord | <jtv> Sorry I can help, just got stuff going on w/ my wife and holiday |
18:52:32 | FromDiscord | <Phil> In reply to @jtv "Sorry I can help,": All good, I'm experimenting a bit for now |
18:52:35 | FromDiscord | <jtv> But I agree, "is" will probably allow you compare the two types there |
18:54:51 | FromDiscord | <Phil> sent a code paste, see https://paste.rs/vTX |
18:55:09 | FromDiscord | <Phil> `/home/philipp/dev/playground/src/playground.nim(10, 14) Error: 'x' exists but there is no overload with type 'proc (a: int): int'` |
18:55:27 | FromDiscord | <leorize> btw, you can use `elif` |
18:55:53 | FromDiscord | <Phil> In reply to @leorize "btw, you can use": I had some wonky behaviour at one point with elif in the past so I got out of the habit of using it with when, fair point though |
18:55:54 | FromDiscord | <leorize> and exploit `compiles` if you must |
18:55:55 | FromDiscord | <jtv> I think you would need typeof(someSymbol) |
18:56:09 | FromDiscord | <jtv> I can play around w/ it later |
18:56:39 | FromDiscord | <14k> sent a long message, see https://paste.rs/yph |
18:56:42 | FromDiscord | <14k> /usr/lib/nim/pure/concurrency/threadpool.nim(21, 10) Error: Threadpool requires --threads:on option. |
18:56:45 | FromDiscord | <14k> What's this? |
18:56:59 | FromDiscord | <Phil> In reply to @14k "/usr/lib/nim/pure/concurrency/threadpool.nim(21, 10": A compiler flag |
18:57:13 | FromDiscord | <leorize> pass `--threads:on` to `nim c` |
18:57:32 | FromDiscord | <pouriya.jamshidi> sent a code paste, see https://play.nim-lang.org/#ix=4jna |
18:57:32 | FromDiscord | <14k> ight thanks |
18:58:04 | FromDiscord | <Phil> In reply to @pouriya.jamshidi "Hi could anyone": You willing to use an ORM? |
18:58:42 | FromDiscord | <Phil> And if so, are you using sqlite/postgres? |
18:59:09 | FromDiscord | <pouriya.jamshidi> In reply to @Isofruit "You willing to use": I am more interested to know how to keep/utilize the same structure for the Database class.↵Although answers with ORM are welcome |
18:59:15 | FromDiscord | <pouriya.jamshidi> MS SQL |
18:59:45 | FromDiscord | <Phil> Errrr okay, in that case the ORM question goes out the window. There is one (norm) but it only covers postgres and sqlite for now |
19:00:12 | FromDiscord | <pouriya.jamshidi> I see |
19:01:25 | FromDiscord | <Phil> As for ms sql, I don't know if we have a wrapped driver for it |
19:01:28 | FromDiscord | <jtv> There's definitely a package for Python programmers that makes things like `class` available for you so that the syntax is more familiar to you |
19:01:55 | FromDiscord | <Phil> In reply to @jtv "There's definitely a package": the ms sql driver may be a much larger problem than just the class syntax |
19:02:15 | FromDiscord | <jtv> I know, just trying to answer the other part of his question 🙂 |
19:03:48 | FromDiscord | <Arathanis> might have to use raw `db_odbc`, yeah? |
19:03:55 | FromDiscord | <pouriya.jamshidi> that class is just holding statements in it. nothing fancy and we do not do OO here 😄 |
19:04:12 | FromDiscord | <jtv> The language does have inheritance |
19:04:25 | FromDiscord | <jtv> It's just not emphasized, and rightly so 🙂 |
19:04:35 | FromDiscord | <Arathanis> OOP is good |
19:04:39 | FromDiscord | <Arathanis> but like all good tools |
19:04:41 | FromDiscord | <Arathanis> you can overuse it |
19:04:50 | FromDiscord | <Arathanis> important to know when and wear to use tools |
19:04:59 | FromDiscord | <Arathanis> (edit) "wear" => "~~were~~ where" |
19:05:01 | FromDiscord | <Phil> In reply to @pouriya.jamshidi "MS SQL": Yeah can't find an MS-SQL driver package.↵You could tackle that by wrapping it on your own or db_odbc if that even works for this |
19:05:02 | FromDiscord | <Arathanis> also important to know how to spell |
19:05:19 | FromDiscord | <Arathanis> (edit) "~~were~~" => "~~wear~~" |
19:05:56 | FromDiscord | <Phil> In reply to @pouriya.jamshidi "that class is just": You can use OO or not, both works. If you want to use OO, you'll want to use `method` instead of `proc` |
19:05:58 | FromDiscord | <jtv> Sure, but it's super widely used, and the use cases where inheritance is the right abstraction isn't all that large |
19:06:05 | FromDiscord | <Arathanis> In reply to @Isofruit "Yeah can't find an": it mentions MS SQL, albiet its by saying it hasn't been "extensively tested against it" |
19:06:25 | FromDiscord | <Phil> In reply to @Arathanis "it mentions MS SQL,": You googled and CTRL+F'ed better than I did |
19:06:39 | FromDiscord | <Arathanis> In reply to @jtv "Sure, but it's super": google fu strong |
19:06:46 | FromDiscord | <Arathanis> google fu strong |
19:07:11 | FromDiscord | <Arathanis> In reply to @jtv "Sure, but it's super": if your inheritance trees go over depth 2, you should take a hard look at what you are doing. If they go over depth 3, you should stop and rethink what you are doing |
19:07:26 | FromDiscord | <Arathanis> composition will save you |
19:07:50 | FromDiscord | <Arathanis> dislaimer: my opinions |
19:07:53 | FromDiscord | <Arathanis> (edit) "dislaimer:" => "disclaimer:" |
19:08:14 | FromDiscord | <pouriya.jamshidi> In reply to @Arathanis "if your inheritance trees": I used to work at a place with inheritance levels that would go 40~60 levels deep... and they were super proud of it... academics 🙂↵I still have PTSD from that time |
19:08:21 | FromDiscord | <jtv> In general, dynamic dispatch often ends up obfuscating control flow too much leading to fragile base classes, etc |
19:08:27 | FromDiscord | <Arathanis> In reply to @pouriya.jamshidi "I used to work": 😬 |
19:08:48 | FromDiscord | <pouriya.jamshidi> best part is, it was their own DSL, so no IDE help either |
19:08:55 | FromDiscord | <Arathanis> oh god lol |
19:08:58 | FromDiscord | <pouriya.jamshidi> haha |
19:09:05 | FromDiscord | <Phil> Honestly the main reason why I'm playing around with this kind of template-y thing that I've been throwing around is because I want to have "module-wide interfaces".↵Basically an idea lifted from OO with Object interfaces.↵There are like 4+ different packages to basically turn modules into objects, which also would resolve any issue regarding mocking of procs for testing purposes, but that's an OO-style solution and I'd like to see the " |
19:09:08 | FromDiscord | <Arathanis> im super excited for concepts to mature, love me some structural pattern matching |
19:09:35 | FromDiscord | <Arathanis> (edit) "concepts" => "`concepts`" |
19:09:55 | FromDiscord | <Arathanis> its a little too beta right now, i check in on it every few months |
19:10:08 | FromDiscord | <Arathanis> i think work has stagnated, and thats fine. its rather niche and experimental |
19:10:10 | FromDiscord | <Arathanis> i just want it |
19:10:12 | FromDiscord | <Arathanis> lol |
19:13:56 | FromDiscord | <Arathanis> In reply to @Isofruit "Honestly the main reason": if what you are trying to do is not too complex, `concepts` might support your use case despites its currently rough edges. |
19:14:16 | FromDiscord | <Arathanis> lets you declare a structural contract and anything that meets that contract can be used in place of the concept type. |
19:14:47 | FromDiscord | <Phil> In reply to @Arathanis "if what you are": I am aware of concepts, even tried to use them at one point but fell off when it was more work than I wanted to invest into it |
19:15:00 | FromDiscord | <Arathanis> my exerpience to a T, that or just unsupported thinsg |
19:15:09 | FromDiscord | <Arathanis> once they get `each T` working its gonna open the flood gates. |
19:15:19 | FromDiscord | <Arathanis> (edit) "exerpience" => "experience" |
19:15:26 | FromDiscord | <Phil> As for this one in particular, it's really just a simple "ensure that this module has these procs with these type definitions |
19:15:36 | FromDiscord | <jtv> The docs for concepts suck but they work well |
19:16:04 | FromDiscord | <Phil> And maybe a bit of "ensure that this module has this exported variable" |
19:16:06 | FromDiscord | <jtv> They're basically interfaces but more generic |
19:16:11 | FromDiscord | <Arathanis> In reply to @jtv "The docs for concepts": i find it 50/50. theres a mismash of what the docs support and what the still open rework github issue specifies. |
19:16:21 | FromDiscord | <jtv> Sounds cool Ohil |
19:16:25 | FromDiscord | <Arathanis> doesn't help that the docs are straight up not accurate last i checked. |
19:16:42 | FromDiscord | <Arathanis> the examples do not work |
19:16:47 | FromDiscord | <Arathanis> not all of them at least |
19:16:57 | FromDiscord | <Arathanis> lookin' at you Functor. |
19:17:14 | FromDiscord | <Phil> In reply to @jtv "Sounds cool Ohil": I'm honestly not sure there's a usecase outside of databases. Just with databases you so often have absolutely identical code and it only differs in the type of connections being built |
19:19:04 | FromDiscord | <Arathanis> In reply to @Isofruit "I'm honestly not sure": maybe a macro? |
19:19:23 | FromDiscord | <Arathanis> like a initializer / verifier |
19:19:28 | FromDiscord | <Arathanis> (edit) "a" => "an" |
19:20:08 | FromDiscord | <Phil> In reply to @Arathanis "maybe a macro?": If I have to dive into guts that deep I'd like to pull some tooling out of it that allows anyone to solve this kind of problem for themselves. |
19:20:14 | FromDiscord | <Phil> (edit) "In reply to @Arathanis "maybe a macro?": If I have to dive into ... guts" added "compiler" |
19:20:34 | FromDiscord | <Phil> So that nobody else has to |
19:21:06 | FromDiscord | <jtv> Yeah, the examples for concepts don't even show USAGE |
19:21:39 | FromDiscord | <jtv> And there's no explanation without reading the code about when you should declare a var of something on the concept line, etc |
19:22:13 | FromDiscord | <Arathanis> yeah |
19:22:18 | FromDiscord | <Arathanis> and you have to cross reference with this https://github.com/nim-lang/RFCs/issues/168 |
19:22:28 | FromDiscord | <Arathanis> current implementation is a mishmash of these |
19:22:34 | FromDiscord | <jtv> Yup |
19:23:09 | FromDiscord | <Arathanis> sent a code paste, see https://play.nim-lang.org/#ix=4jnk |
19:23:21 | FromDiscord | <jtv> Getting the most out of the type system is tough if you are expecting good docs and error messages |
19:23:28 | FromDiscord | <Arathanis> (edit) "https://paste.rs/qC0" => "https://paste.rs/fMl" |
19:24:38 | FromDiscord | <jtv> It took me forever to realize that an error that was just "cannot instantiate T" was not a recursion issue, it was the whole UFCS ambiguity. Then ElegantBeef told me about [: |
19:25:15 | FromDiscord | <Arathanis> you either solve the issue yourself or wait long enough for beef to tell you how you messed up |
19:25:49 | FromDiscord | <jtv> Yup he was great help |
19:25:58 | FromDiscord | <Phil> sent a code paste, see https://play.nim-lang.org/#ix=4jnm |
19:26:59 | FromDiscord | <Phil> Or rather I need to first get how to even check if a single specific proc is defined with correct type |
19:27:14 | FromDiscord | <Arathanis> i think definitely macros |
19:27:40 | FromDiscord | <Arathanis> ive done similar things before with macros, it definitely works |
19:27:52 | FromDiscord | <Phil> Maybe I should just go with https://github.com/itsumura-h/nim-interface-implements |
19:27:59 | FromDiscord | <leorize> figure the data structure first, and the rest will just follows |
19:28:15 | FromDiscord | <leorize> and doesn't beef have a macro that does it for you? |
19:29:32 | FromDiscord | <Phil> ~~Beef gave me the first borked template~~ |
19:29:51 | FromDiscord | <arkanoid> What's the Nim composition-based idiom/pattern that replaces OO pattern where the user is requested to extend a library class and implement some methods? |
19:30:47 | FromDiscord | <jtv> mixin? |
19:31:15 | FromDiscord | <jtv> Not sure, I've seen the keyword and mixins were often that in other language envs in the past |
19:31:20 | FromDiscord | <Phil> Mixin is for generics |
19:31:40 | FromDiscord | <Phil> generics typically try to draw in symbols that are defined within the module that the generic itself is defined in |
19:31:55 | FromDiscord | <leorize> concepts was supposed to be it |
19:32:01 | FromDiscord | <leorize> it never worked for too long, though |
19:32:11 | FromDiscord | <Phil> By using "mixin" in that generic you tell it to look for that symbol in the module that calls the generic |
19:32:49 | FromDiscord | <@thatrandomperson5-6310e3b26da03> Im getting the issue described here\: [nim-lang/Nim#4555](https://github.com/nim-lang/Nim/issues/4555) on nim 1.6.10 |
19:33:57 | FromDiscord | <@thatrandomperson5-6310e3b26da03> please help |
19:34:28 | FromDiscord | <leorize> please provide a your broken code sample |
19:34:31 | FromDiscord | <Phil> So you can have a generic proc in module B that relies on a proc "flyingPotato" to be around. But there is no flying potato defined in module B or any module it imports.↵Module A imports module B.↵Module A does have flyingPotato defined.↵Due to the usage of mixin, the "flyingPotato" proc from module A is used and module B leaves that symbol "free" or "opens it up" until that code gets to module A, or whatever that is actually called. |
19:34:43 | FromDiscord | <jtv> That's helpful, thanks, Phil |
19:35:09 | FromDiscord | <Phil> Generics are like the one feature of nim that I use very extensively |
19:35:55 | FromDiscord | <jtv> Cool, will def come to you when I am having future challenges with their semantics 🙂 |
19:36:17 | FromDiscord | <Phil> Luckily it's not that hard ^^ |
19:36:21 | FromDiscord | <Phil> But feel free |
19:36:31 | FromDiscord | <Phil> (edit) "^^" => "^^, so I doubt there'll be many questions" |
19:37:56 | FromDiscord | <jtv> Oh, generics in general I'm down with, just have had a lot of obtuse error messages. |
19:38:36 | FromDiscord | <jtv> It's all very well done and powerful. |
19:38:59 | FromDiscord | <jtv> Though I do wish people would try some syntax for type parameters other than making it look like an array access |
19:39:19 | FromDiscord | <Phil> Except for when you go like 3-4 layers of generics down and suddenly the error tells you that this code can't be generated because there's a type mismatch somewhere but it doesn't tell you where >_> |
19:39:34 | FromDiscord | <Phil> Nor what types are mismatching >_> |
19:39:35 | FromDiscord | <jtv> Like how about putting them as actual parameters but with "type" in their name or something like that |
19:39:46 | FromDiscord | <jtv> Yeah, that's what kept happening, I was using recursion |
19:40:08 | FromDiscord | <jtv> And I thought I was doing something wrong, and was just getting "Can't instantiate T" with NO diagnostics |
19:40:32 | FromDiscord | <Arathanis> i guess interface recommendation right now is a tuple of procs? interesting |
19:40:36 | FromDiscord | <jtv> And kept trying 100000 different things, and I eventually figured out it was the UFCS ambiguity, which I think will bite a LOT of novices |
19:40:57 | FromDiscord | <Phil> Solved that one in particular by just assigning those generic proc parameters (often times procs themselves) to a variable with a (generic) type definition first so that this assignment would fail and give me a useful error message |
19:41:06 | FromDiscord | <jtv> Concepts are good for that |
19:41:20 | FromDiscord | <jtv> Ohhh good idea Phil |
19:41:35 | FromDiscord | <Phil> sent a code paste, see https://play.nim-lang.org/#ix=4jnv |
19:42:35 | FromDiscord | <jtv> Thanks 🙂 |
19:43:25 | FromDiscord | <Phil> Happy to help with what I've learned so far |
20:06:18 | * | jmdaemon joined #nim |
20:17:39 | * | Lord_Nightmare quit (Ping timeout: 256 seconds) |
20:47:00 | * | droidrage quit (Remote host closed the connection) |
20:47:00 | * | qwestion quit (Remote host closed the connection) |
20:47:00 | * | ixmpp quit (Remote host closed the connection) |
21:11:33 | FromDiscord | <! Nilts> sent a code paste, see https://play.nim-lang.org/#ix=4jnQ |
21:12:17 | FromDiscord | <! Nilts> (edit) "https://paste.rs/evo" => "https://paste.rs/GRL" |
21:23:56 | Amun-Ra | do you write types first, consts next or the other way? |
21:28:27 | FromDiscord | <Elegantbeef> `astToStr(name)`↵(@Phil) |
21:36:14 | * | Lord_Nightmare joined #nim |
21:48:03 | * | dimi joined #nim |
21:49:39 | * | dimi quit (Client Quit) |
21:50:54 | FromDiscord | <! Nilts> In reply to @not logged in "As my gitter account": I'll need to go in 10 min, if anyone has an answer ping me |
21:58:08 | * | ixmpp joined #nim |
21:59:39 | * | ltriant quit (Ping timeout: 256 seconds) |
22:07:21 | * | redj joined #nim |
22:11:46 | FromDiscord | <JeysonFlores> What's the difference between a template and a macro in Nim? Both execute code at compile time right? |
22:12:01 | FromDiscord | <Elegantbeef> templates are code subsitution |
22:12:03 | FromDiscord | <Elegantbeef> Macros run code on the vm |
22:13:24 | FromDiscord | <JeysonFlores> VM? |
22:13:44 | FromDiscord | <JeysonFlores> I thought that was only used for NimScript |
22:17:39 | * | wallabra quit (Quit: ZNC 1.8.2 - https://znc.in) |
22:18:11 | * | redj quit (Quit: http://quassel-irc.org - Chat comfortably. Anywhere.) |
22:19:08 | * | redj joined #nim |
22:20:11 | * | wallabra joined #nim |
22:27:30 | Amun-Ra | macros tinker with ast, templates work like cpp macros |
22:28:23 | FromDiscord | <arkanoid> https://nim-lang.org/docs/manual.html#generics-mixin-statement↵↵I don't understand mixin statement. The documentation doesn't say much about it |
22:29:09 | Amun-Ra | arkanoid: have you read https://en.wikipedia.org/wiki/Mixin ? |
22:29:58 | FromDiscord | <arkanoid> Nope! Never used them in OOP. Sorry I didn't know it was an OOP concept. Reading now |
22:30:18 | FromDiscord | <Anna Aurora 🏳🌈🏴☠🕳> ugh, Why do I get pinged from this room all the time even though you pals aren't even mentioning me? |
22:30:57 | Amun-Ra | I did, Python-wise |
22:37:34 | FromDiscord | <arkanoid> When trying to convert the software patterns I've learned during my OOP time into nim, I'm finding myself quite lost. I know that OOP in Nim is not as advanced as other programming languages, but I fail to match the corresponding alternative using object variants, or other patterns available at compile time |
22:38:23 | FromDiscord | <arkanoid> I quite need an OOP to procedural manual, leveraging on Nim tools |
22:39:51 | FromDiscord | <Elegantbeef> Mixins in Nim are used in generics to say "Consider the scope of instantiation for this symbol" |
22:39:52 | FromDiscord | <Elegantbeef> Consider a serialiser you might have `serialiseData` and you want to allow overriding it per user type |
22:39:52 | FromDiscord | <Elegantbeef> This allows you to define a generic procedure but implement parts of it inside user code |
22:40:08 | FromDiscord | <Elegantbeef> sent a code paste, see https://paste.rs/sOw |
22:40:37 | FromDiscord | <Elegantbeef> Or whatever you want |
22:40:37 | FromDiscord | <Elegantbeef> sent a code paste, see https://play.nim-lang.org/#ix=4joh |
22:41:00 | FromDiscord | <Elegantbeef> I generally call this a generic interface as it's dispatch at compile time but behaves like a interface in other languages |
22:42:37 | FromDiscord | <arkanoid> Is mixin preferred to method+inheritance in Nim? I mean, is it more idiomatic or gives more advantages? |
22:42:44 | FromDiscord | <Elegantbeef> Depends what you're doing |
22:42:47 | FromDiscord | <Elegantbeef> Mixins are dispatched statically |
22:42:52 | FromDiscord | <Elegantbeef> So if you can do what you want statically, yes |
22:43:04 | FromDiscord | <Elegantbeef> If you cannot then you cannot replicate it with method + inheritance |
22:44:19 | FromDiscord | <Elegantbeef> @albassort\: gintro now should work on your distro |
22:44:54 | FromDiscord | <albassort> Do you send me this like 3 weeks after I wrote all the Gtk code |
22:45:05 | FromDiscord | <Elegantbeef> If only you updated the issue |
22:45:13 | FromDiscord | <albassort> I don't want to bother them |
22:45:16 | FromDiscord | <Elegantbeef> Stefan fixed it relatively quickly |
22:45:16 | FromDiscord | <arkanoid> This seems a big pro |
22:45:34 | FromDiscord | <albassort> Wait do we have nim mixins |
22:45:36 | FromDiscord | <albassort> What did I miss |
22:45:53 | FromDiscord | <albassort> How many years ago did this happen |
22:46:09 | FromDiscord | <Elegantbeef> Nim has had mixins forever |
22:46:15 | FromDiscord | <Elegantbeef> It's apart of the generic dispatch model |
22:46:20 | FromDiscord | <Elegantbeef> It's not mixin like in java |
22:46:22 | FromDiscord | <Elegantbeef> They're generic mixins |
22:46:52 | FromDiscord | <albassort> Yeah I have no idea what that means |
22:47:28 | FromDiscord | <Elegantbeef> sent a code paste, see https://paste.rs/e9C |
22:47:33 | FromDiscord | <Elegantbeef> Whoops mispelled echo |
22:47:40 | FromDiscord | <albassort> It's a bit annoying that my job is making me do stuff involving Microsoft's SQL wrapper and not letting me write SQL into the database because there is no efficient way to do what I'm trying to do and I don't have authorization to make a new view |
22:47:48 | FromDiscord | <albassort> :notlikethis: |
22:47:51 | FromDiscord | <Elegantbeef> But anyway you can define generic interfaces using mixins as it takes in instantiation scope into account when calling a generic |
22:48:07 | FromDiscord | <albassort> Why Microsoft why |
22:48:28 | * | elph_ quit (Quit: Connection closed for inactivity) |
22:48:34 | FromDiscord | <Elegantbeef> the antonym of `mixin` is `bind` which only takes the generics declaration scope into account |
22:48:49 | FromDiscord | <albassort> sent a code paste, see https://play.nim-lang.org/#ix=4joi |
22:48:49 | FromDiscord | <albassort> I might have to read the manual |
22:50:25 | FromDiscord | <arkanoid> If I replace \:auto with T, would it work anyway? Auto as param is confusing me |
22:50:27 | FromDiscord | <Elegantbeef> Of course |
22:50:31 | FromDiscord | <Elegantbeef> Auto is just a shorthand for that |
22:50:56 | FromDiscord | <Elegantbeef> It literally just says "for this symbol consider the scope of instantiation and this declaration scope " |
22:51:01 | FromDiscord | <Elegantbeef> It's not that complicated |
22:51:11 | FromDiscord | <albassort> I understand bind but bind is a bit silly because templates already assume that the variables exist until they're statically evaluated |
22:51:11 | FromDiscord | <Elegantbeef> So when you call `myProcedure` it prefers the current scope that you call it in |
22:51:24 | FromDiscord | <Elegantbeef> notice how there is no `doThing` before `myProcedure` |
22:51:29 | FromDiscord | <Elegantbeef> bind isnt a bit silly |
22:51:41 | FromDiscord | <arkanoid> Yeah I do understand now. It smells like dependency injection, or function registration at runtime |
22:51:49 | FromDiscord | <Elegantbeef> Bind closes the symbol which forces the procedures tobe used that the generic procedure knows |
22:51:52 | FromDiscord | <arkanoid> But at compile time is just better |
22:51:54 | FromDiscord | <Elegantbeef> In some APIs this is desired |
22:52:00 | FromDiscord | <albassort> Maybe I should use mixins to reduce the insane amount of circular dependencies |
22:52:02 | FromDiscord | <Elegantbeef> Cause you do not want to allow the user to overload a procedure |
22:52:03 | FromDiscord | <albassort> Or something |
22:52:19 | FromDiscord | <albassort> I feel like knowing about this can only make my code worse |
22:52:33 | FromDiscord | <Elegantbeef> I mean it's pretty much rust traits |
22:52:47 | FromDiscord | <albassort> Yeah and name 6 good thing in Rust |
22:52:53 | FromDiscord | <albassort> (edit) "thing" => "things" |
22:52:56 | FromDiscord | <Elegantbeef> So if having a generic procedure that can work based off just knowing procedures exists can reduce your cyclical dependancy it might |
22:53:00 | FromDiscord | <arkanoid> I'm just considering then for a library that in OOP world would require the user to extend a provided class and overridde/implement some methods |
22:53:12 | FromDiscord | <Elegantbeef> Traits, everything is an expression, borrowing.... |
22:53:15 | FromDiscord | <Elegantbeef> Fuck only got 3 |
22:53:35 | FromDiscord | <albassort> Now name something that Nim doesn't have |
22:53:39 | FromDiscord | <albassort> In those three |
22:53:45 | FromDiscord | <Elegantbeef> Traits, borrowing |
22:53:51 | FromDiscord | <albassort> We need to add those |
22:54:03 | FromDiscord | <Elegantbeef> Nah i actually dont like traits that much |
22:54:11 | FromDiscord | <albassort> What exactly is borrowing |
22:54:27 | FromDiscord | <arkanoid> I prefer Nim much more than rust. Rust code is not a joy to write, Nim is. |
22:54:29 | FromDiscord | <Elegantbeef> Safely aliasing pointers without leaking or dangling |
22:54:50 | FromDiscord | <Elegantbeef> Fuck |
22:54:51 | FromDiscord | <albassort> I don't know how we could easily do that in them |
22:54:55 | FromDiscord | <Elegantbeef> sent a code paste, see https://paste.rs/ASc |
22:55:05 | FromDiscord | <albassort> In nim |
22:55:09 | FromDiscord | <albassort> I wouldn't really feel safe aliasing a pointer |
22:55:13 | FromDiscord | <Elegantbeef> sent a code paste, see https://play.nim-lang.org/#ix=4joj |
22:55:16 | FromDiscord | <Elegantbeef> We have the experimental views |
22:55:20 | FromDiscord | <Elegantbeef> So we already have the start |
22:55:30 | FromDiscord | <albassort> But if we could alias pointers then c interop would be perfect |
22:55:35 | FromDiscord | <Elegantbeef> Views are borrowing |
22:55:38 | FromDiscord | <albassort> You probably wouldn't even notice you're using C code |
22:55:42 | FromDiscord | <Elegantbeef> What? |
22:55:52 | FromDiscord | <albassort> Perhaps my brain has changed what you said into something it isn't |
22:55:57 | FromDiscord | <Elegantbeef> How does aliasing a pointer have anything todo with C |
22:56:13 | FromDiscord | <Elegantbeef> giving a pointer a new name isnt related to C afaict |
22:57:00 | FromDiscord | <albassort> Just make a ref object of the pointer |
22:57:03 | FromDiscord | <Elegantbeef> sent a code paste, see https://paste.rs/Rc7 |
22:57:08 | FromDiscord | <Elegantbeef> Lol |
22:57:16 | FromDiscord | <Elegantbeef> You cannot raise memory to a reference |
22:57:24 | FromDiscord | <albassort> Well I tried |
22:57:41 | FromDiscord | <albassort> I like your funny words magic man |
22:57:46 | FromDiscord | <Elegantbeef> Anyway arkanoid hope the generic interface pans out |
22:57:54 | FromDiscord | <Elegantbeef> I really like generic interfaces, it makes code so much nicer |
22:58:50 | FromDiscord | <arkanoid> Just to be sure, are you still talking about mixins? |
22:58:58 | FromDiscord | <Elegantbeef> Yes |
22:59:08 | FromDiscord | <Elegantbeef> I dont like calling them mixins as that's not very descriptive |
22:59:56 | FromDiscord | <Elegantbeef> Especially given the definition of mixins deals with OOP |
23:02:29 | FromDiscord | <arkanoid> I'll, try to wrap my head around this. It's an important point to convert my OOP head into procedural and static dispatching, that I like. It's like learning how things used to me done, but with better language |
23:03:14 | FromDiscord | <Elegantbeef> Yea you can sort of think of mixins in Nim like interfaces, but that are dispatched statically 😄 |
23:05:10 | FromDiscord | <PunchCake> hello |
23:05:33 | FromDiscord | <PunchCake> what does stop the world mean in this context https://media.discordapp.net/attachments/371759389889003532/1055984537382953000/image.png |
23:06:26 | FromDiscord | <leorize> that means all of your code stop running until GC is done |
23:07:18 | FromDiscord | <PunchCake> so all the gc's with stop the world equal to No means that my program wont pause at all for GC cycles? thus making it suitable for embedded systems? |
23:07:31 | FromDiscord | <Elegantbeef> Correct |
23:07:36 | FromDiscord | <Elegantbeef> Arc is really embedded's' best friend |
23:07:40 | FromDiscord | <Elegantbeef> Unless you need cycles of course |
23:07:54 | FromDiscord | <PunchCake> it sounds too good to be true. whats the downsides |
23:08:00 | FromDiscord | <Elegantbeef> Actually sorry it will do GC processing ofcourse |
23:08:28 | FromDiscord | <leorize> threading is a bit more complicated |
23:08:51 | FromDiscord | <PunchCake> thats it? |
23:08:55 | FromDiscord | <PunchCake> im sold |
23:09:57 | FromDiscord | <leorize> and you're trading throughput for latency as well |
23:10:10 | FromDiscord | <leorize> which happens to be what you want almost all the time |
23:10:47 | FromDiscord | <PunchCake> so is it worth it to use the arc GC on embedded instead of manual memory management? |
23:10:55 | FromDiscord | <Elegantbeef> Yes |
23:10:56 | FromDiscord | <leorize> yea |
23:11:06 | FromDiscord | <Elegantbeef> If you're using Nim and use no MM you lose most of Nim's stdlib |
23:11:12 | FromDiscord | <PunchCake> huh nim can do it all |
23:11:12 | FromDiscord | <leorize> it's indistinguishable to manual for the most part |
23:11:24 | FromDiscord | <leorize> the distinction comes when you do threading |
23:11:31 | FromDiscord | <PunchCake> i am convinced nim is the only language i'll ever need |
23:11:50 | FromDiscord | <PunchCake> In reply to @leorize "the distinction comes when": yeah i see |
23:12:36 | FromDiscord | <PunchCake> and is it advised to use the arc GC on regular apps such as gui apps or grpc apis |
23:12:50 | FromDiscord | <Elegantbeef> Orc is the suggested GC now |
23:12:53 | FromDiscord | <Elegantbeef> Arc for embedded |
23:12:58 | FromDiscord | <Elegantbeef> Refc for legacy code |
23:13:09 | FromDiscord | <leorize> I'd use orc everywhere tbh |
23:13:12 | FromDiscord | <PunchCake> whats the diff between arc and orc? |
23:13:19 | FromDiscord | <Elegantbeef> Orc can collect cycles |
23:13:27 | FromDiscord | <leorize> just avoid it for hard realtime stuff |
23:13:53 | FromDiscord | <PunchCake> so pretty much the arc gc is suitable for everything right |
23:14:03 | FromDiscord | <Elegantbeef> Nope arc cannot collect cycles |
23:14:18 | FromDiscord | <Elegantbeef> sent a code paste, see https://paste.rs/rZF |
23:14:20 | FromDiscord | <leorize> but if you're doing hard realtime you would be mixing manual for the select spots where you really need it anyway |
23:14:40 | FromDiscord | <Elegantbeef> Hey girvo pretty much doesnt use any allocations |
23:14:58 | FromDiscord | <PunchCake> so how arc works it detects memory leaks first then fixes it i dont understand |
23:15:19 | FromDiscord | <leorize> arc simply keep a counter with your pointer |
23:15:30 | FromDiscord | <leorize> copy adds one |
23:15:36 | FromDiscord | <leorize> remove remove one |
23:15:44 | FromDiscord | <leorize> then when it reaches zero it's gone |
23:15:53 | FromDiscord | <Elegantbeef> It's a scoped based ref counter practically |
23:16:10 | FromDiscord | <Elegantbeef> At end of a scope if a reference is dead decrement the count and if the count is 0 call destructor |
23:16:18 | FromDiscord | <leorize> same as Rust `Ref` afaict |
23:16:18 | FromDiscord | <PunchCake> so let me get this straight↵Embedded -> Arc↵anything else -> orc (and thats the default GC) |
23:16:30 | FromDiscord | <Elegantbeef> orc is default in 2.0 |
23:16:32 | FromDiscord | <leorize> everything -\> orc |
23:16:45 | FromDiscord | <Elegantbeef> 2.0 isnt out yet it's soon |
23:16:45 | FromDiscord | <leorize> if you can't use it you would know |
23:16:57 | FromDiscord | <PunchCake> so whats default now? and is |
23:17:00 | FromDiscord | <PunchCake> (edit) removed "and is" |
23:17:10 | FromDiscord | <Elegantbeef> Yea just use Orc |
23:17:10 | FromDiscord | <Elegantbeef> refc |
23:17:32 | FromDiscord | <PunchCake> does orc have much overhead? |
23:17:56 | FromDiscord | <leorize> a tiny bit for the cycle collector |
23:18:28 | FromDiscord | <leorize> benchmark says it's pretty comparable to manual code iirc |
23:18:51 | FromDiscord | <PunchCake> yeah i gotta make a bash function to put all the args for me im too lazy to keep typing -mm:orc every time |
23:19:07 | FromDiscord | <leorize> you can use a config file if that fancy you |
23:19:07 | FromDiscord | <PunchCake> (edit) "-mm:orc" => "--mm:orc" |
23:19:16 | FromDiscord | <PunchCake> bash function sounds easier |
23:19:23 | FromDiscord | <PunchCake> its like 20 secs |
23:19:57 | FromDiscord | <PunchCake> plus why so many GC's? |
23:20:26 | FromDiscord | <leorize> the config is easier than bash \:p |
23:20:43 | FromDiscord | <leorize> and you don't have to manage it for every other Nim tool you use |
23:20:57 | FromDiscord | <Elegantbeef> Well no one uses anything but refc, orc, arc |
23:21:08 | FromDiscord | <Elegantbeef> The other GCs exist due to historical reasons mostly |
23:21:20 | FromDiscord | <leorize> go and Boehm are for threading when they were introduced |
23:21:29 | FromDiscord | <leorize> I'm pretty sure go was for go interop |
23:21:30 | FromDiscord | <PunchCake> so now they are obsolete? |
23:21:40 | FromDiscord | <Elegantbeef> Plus it's relatively easy to add new GCs |
23:21:43 | FromDiscord | <Elegantbeef> Well allocators |
23:21:56 | FromDiscord | <Elegantbeef> Unless you were doing go interop, go's was already |
23:22:22 | FromDiscord | <Elegantbeef> Boehm is mostly replaced by orc |
23:22:28 | FromDiscord | <PunchCake> why the hell would i choose to interop with go from all of the existing languages |
23:22:31 | FromDiscord | <Elegantbeef> Though multithreading with orc/arc is still quite sad for refc |
23:22:37 | FromDiscord | <leorize> why not? |
23:22:59 | FromDiscord | <Elegantbeef> for refs\ 😄 |
23:23:22 | FromDiscord | <PunchCake> isnt it much more efficient to interop with rust? at least i can make use of some of the gui libs, maybe even tauri! |
23:23:33 | FromDiscord | <leorize> rust didn't exist then |
23:23:39 | FromDiscord | <Elegantbeef> Also rust doesnt have GC |
23:23:41 | FromDiscord | <PunchCake> so it must be very old |
23:23:58 | FromDiscord | <Elegantbeef> The point of using Go's GC is so you can seemlessly send data between the languages |
23:24:11 | FromDiscord | <PunchCake> huh |
23:24:18 | FromDiscord | <Elegantbeef> With rust interop you just use the FFI and treat it like a C library, it's the best you can really do |
23:24:47 | FromDiscord | <PunchCake> yeah |
23:25:08 | FromDiscord | <Hoss> is nim the best lang out there for c++ interop? |
23:25:13 | FromDiscord | <PunchCake> is there any framework for nim js that helps to make frontend apps |
23:25:18 | FromDiscord | <PunchCake> In reply to @Hoss "is nim the best": python is |
23:25:23 | FromDiscord | <Elegantbeef> Karax |
23:25:32 | FromDiscord | <Elegantbeef> It's pretty much the only language aside from D↵(@Hoss) |
23:25:38 | FromDiscord | <Elegantbeef> No carbon doesnt count |
23:25:48 | FromDiscord | <leorize> crystal have pretty banger interop too |
23:26:02 | FromDiscord | <PunchCake> In reply to @Elegantbeef "Karax": is it similar to python flask? |
23:26:19 | FromDiscord | <leorize> they wrapped the entirety of Qt, which is my benchmark for C++ interop |
23:26:21 | FromDiscord | <Elegantbeef> No clue |
23:27:39 | FromDiscord | <Elegantbeef> Hmph i wonder how they did it cause afaik they dont have any special C++ interop |
23:28:43 | FromDiscord | <leorize> they just have people that are really good at C++ ABI |
23:29:08 | FromDiscord | <Elegantbeef> https://github.com/Papierkorb/bindgen ah this is the key |
23:31:26 | FromDiscord | <PunchCake> interop with java when |
23:31:30 | FromDiscord | <Elegantbeef> So it seems to work akin to futhark, where it uses LLVM/CLang? |
23:31:38 | FromDiscord | <Elegantbeef> Nim already has it |
23:31:40 | FromDiscord | <leorize> see\: jnim |
23:31:47 | FromDiscord | <Elegantbeef> Nimpy for python |
23:32:00 | FromDiscord | <PunchCake> no way this is real |
23:32:26 | FromDiscord | <Elegantbeef> Nimscripter for Nimscript(Yes a scripting subset of nim, dont use it though 😛 )↵nimjl for julia |
23:32:35 | FromDiscord | <PunchCake> ah made by the one and only yglukhov |
23:32:44 | FromDiscord | <PunchCake> man he is clearly top g |
23:33:16 | FromDiscord | <Elegantbeef> Huh, bindgen seems to work how one expects, relies on llvm/clang to get the output one wants |
23:33:28 | FromDiscord | <Elegantbeef> Though afaict this means crystal can only use non templated classes and the like |
23:34:31 | FromDiscord | <Elegantbeef> I'd joke "Hey it doesnt even work on windows" but that's too low hanging |
23:34:36 | FromDiscord | <leorize> that project knows how to instantiate templates for containers, though |
23:34:41 | FromDiscord | <PunchCake> plus why is everyone bot here |
23:34:46 | FromDiscord | <Elegantbeef> Matrix |
23:34:52 | FromDiscord | <PunchCake> whats that |
23:35:04 | FromDiscord | <leorize> you see, chatgpt is only a demo of Nim discord |
23:35:05 | FromDiscord | <Elegantbeef> A open protocol |
23:35:14 | FromDiscord | <PunchCake> its like open source discord? |
23:35:21 | FromDiscord | <Elegantbeef> Sorta |
23:35:30 | FromDiscord | <Elegantbeef> It's a modern open standard with many open source clients |
23:35:43 | FromDiscord | <Elegantbeef> image.png https://media.discordapp.net/attachments/371759389889003532/1055992128376938596/image.png |
23:35:43 | FromDiscord | <Elegantbeef> Element is kinda like discord 😛 |
23:36:02 | FromDiscord | <PunchCake> how much ram does it use |
23:36:05 | FromDiscord | <ajusa> In reply to @Elegantbeef "image.png": uh oh, I see the forbidden icon |
23:36:05 | FromDiscord | <Elegantbeef> Though cinny is more like discord |
23:36:18 | FromDiscord | <Elegantbeef> Meh i'm mostly there to joke around |
23:36:38 | FromDiscord | <Elegantbeef> They dont take me seriously there! |
23:37:08 | FromDiscord | <Elegantbeef> There are multiple clients so depends↵(@PunchCake) |
23:37:20 | FromDiscord | <PunchCake> whats it built with |
23:37:25 | FromDiscord | <Elegantbeef> Element is electron based↵Cinny is tauri based |
23:37:31 | FromDiscord | <Elegantbeef> There are GTK and QT clients |
23:37:38 | FromDiscord | <Elegantbeef> Even TUI clients |
23:38:07 | FromDiscord | <Elegantbeef> As a stargate fan i do enjoy 'Tauri' as a name |
23:38:25 | FromDiscord | <PunchCake> tauri sucks |
23:38:37 | FromDiscord | <PunchCake> i perfer to make gui aps with something like GTK or wxwidgets |
23:38:49 | FromDiscord | <PunchCake> at least it wont be a memory hog |
23:38:55 | FromDiscord | <Elegantbeef> There are many clients all at different stages of development |
23:39:12 | FromDiscord | <PunchCake> wait is there nim bindings for gtk? |
23:39:20 | FromDiscord | <leorize> tauri is just electron with another name |
23:39:23 | FromDiscord | <Elegantbeef> There is gintro |
23:39:32 | FromDiscord | <Elegantbeef> Hey tauri is a little lighter on resources |
23:39:34 | FromDiscord | <Elegantbeef> Negligably |
23:39:36 | FromDiscord | <Elegantbeef> But hey |
23:39:42 | FromDiscord | <PunchCake> In reply to @leorize "tauri is just electron": to be fair its much more light weight |
23:39:53 | FromDiscord | <PunchCake> bring back the days where nearly all apps where in C++ or C |
23:40:04 | FromDiscord | <PunchCake> no more memory hog hidden webbrowsers |
23:40:28 | FromDiscord | <Elegantbeef> This is why matrix is cool imo |
23:40:33 | FromDiscord | <leorize> the browsers rose because it was dead easy to write GUI on them |
23:40:35 | FromDiscord | <Elegantbeef> You can take those words and go throw together a client 😛 |
23:41:02 | FromDiscord | <leorize> btw if you like gtk checkout Rust's Relm |
23:41:10 | FromDiscord | <PunchCake> In reply to @leorize "the browsers rose because": pretty much html + js even my grandma can make a gui with it |
23:41:23 | FromDiscord | <PunchCake> with tailwind as well jeez |
23:41:50 | FromDiscord | <leorize> relm brings the elm model to gtk, makes it a lot easier to program |
23:42:20 | FromDiscord | <PunchCake> wtf is elm model |
23:42:42 | FromDiscord | <leorize> elm-lang.org |
23:43:08 | FromDiscord | <PunchCake> oh that |
23:43:49 | FromDiscord | <PunchCake> tbh the desktop app scene is pretty much dead |
23:44:09 | FromDiscord | <PunchCake> wasm is the future |
23:53:46 | * | sagax joined #nim |
23:54:36 | FromDiscord | <<She>Horizon</Her>> Disagreed |
23:56:24 | FromDiscord | <<She>Horizon</Her>> I very much like WebAssembly, and it does have a place in the web, and even outside of it (some uses I've seen and tried experimenting with is using it for scripting in games, i know Beef did that), but WebAssembly will never be as fast as native code, and it also has larger sizes than if you wrote something in JS instead |
23:56:44 | FromDiscord | <Elegantbeef> Larger sizes? |
23:56:52 | FromDiscord | <<She>Horizon</Her>> Larger file sizes |
23:57:01 | FromDiscord | <Elegantbeef> Wasm is byte code though |
23:57:03 | FromDiscord | <<She>Horizon</Her>> Sick rn so not making the most sense |
23:58:30 | FromDiscord | <Elegantbeef> Is a sufficiently large program smaller in JS than Wasm? |
23:58:36 | FromDiscord | <<She>Horizon</Her>> In reply to @Elegantbeef "Wasm is byte code": I was under the impression that larger projects would end up bigger than equivalent JS code? Didn't do much research myself but was told that was a disadvantage over WASM |
23:58:50 | FromDiscord | <Elegantbeef> Well without evidence i dismiss it |
23:58:57 | FromDiscord | <Elegantbeef> It's possible, but i dont know if it's true |
23:59:13 | FromDiscord | <Elegantbeef> Even minified JS is a lot of data |
23:59:13 | FromDiscord | <<She>Horizon</Her>> I'll try looking to see if there's actually any backing to that now |
23:59:28 | FromDiscord | <leorize> I mean, wasm from C is smaller than a JS program from C |