00:00:06 | * | cyraxjoe quit (*.net *.split) |
00:00:09 | * | nyeaa492842301 quit (*.net *.split) |
00:00:09 | * | cm quit (*.net *.split) |
00:00:09 | * | tinystoat quit (*.net *.split) |
00:00:21 | * | nyeaa492842301 joined #nim |
00:02:25 | * | cyraxjoe joined #nim |
00:02:41 | * | cm joined #nim |
00:02:42 | * | tinystoat joined #nim |
00:09:28 | FromDiscord | <teyako> Hi everyone! ↵Kind of a basic question, but I'm trying to use a case statement to evaluate if an input from the user is equal to, lower or higher than a value. However, I get the `cannot evaluate at compile time: myInput` error. ↵What is the correct way to do this? |
00:10:17 | FromDiscord | <huantian> I can’t know for sure unless you show code but I’m assuming you’re using const where you should be using let |
00:12:24 | FromDiscord | <teyako> sent a long message, see http://ix.io/4zyg |
00:12:57 | FromDiscord | <teyako> the issue is the of > numberToKeep, but I haven't found an example on how to do this so far |
00:13:36 | FromDiscord | <teyako> (edit) "http://ix.io/4zyi" => "http://ix.io/4zyh" |
00:14:47 | FromDiscord | <teyako> The numberToKeep is the input which causes the issue, while the numberOfDocuments is the documents found in the database at that time |
00:14:56 | FromDiscord | <Elegantbeef> nim doesnt have this type of matching |
00:15:15 | FromDiscord | <Elegantbeef> `numberToKeep..int.high` if `numbeToKeep` is a constant |
00:15:20 | FromDiscord | <Elegantbeef> Otherwise no you cannot do this |
00:15:46 | FromDiscord | <Elegantbeef> You may need an if statement |
00:16:44 | FromDiscord | <teyako> Ahh, no, numberToKeep is a user input so not a constant then. I'll try with the if statement, thank you both 🙂 |
00:19:06 | FromDiscord | <Elegantbeef> Technically this can be done with case but it's not much nicer |
00:19:40 | FromDiscord | <Elegantbeef> sent a code paste, see https://paste.rs/kEC7B |
00:58:07 | * | cyraxjoe quit (Ping timeout: 250 seconds) |
01:16:02 | * | cyraxjoe joined #nim |
01:30:42 | * | MightyJoe joined #nim |
01:31:26 | * | cyraxjoe quit (Ping timeout: 260 seconds) |
01:58:02 | * | derpydoo joined #nim |
02:03:58 | * | azimut quit (Ping timeout: 240 seconds) |
02:33:17 | * | azimut joined #nim |
03:56:52 | FromDiscord | <ajusa> what are the options for namespacing/grouping related functions together in Nim? As far as I know the two options are using static methods (where the first option to a proc is a typedesc) and actually splitting up the code into separate files which are handled as modules.↵↵Are there others? Is it possible to declare multiple modules in a file? |
03:58:11 | FromDiscord | <Elegantbeef> In Nim a file is a module |
03:59:59 | FromDiscord | <odexine> nim does not separate the concept of files and modules, yeah |
04:00:31 | FromDiscord | <odexine> the first option forces namespacing (possibly undesirable, depends), the other is optional (also maybe undesirable) |
04:00:40 | FromDiscord | <ajusa> gotcha, then as I expected files are the best way to namespace things, since users can prefix function calls with the module name anyway |
04:00:59 | FromDiscord | <Elegantbeef> In nim the best way to namespace is not to namespace 😄 |
04:01:08 | FromDiscord | <ajusa> I've been using Nim for almost 7 years now but I realize I never actually dug into namespacing |
04:01:36 | FromDiscord | <ajusa> Well I'm trying to split up stuff in classical MVC fashion, so a file for the model, a file for the controller, and a file for the view seems reasonable |
04:07:37 | FromDiscord | <Elegantbeef> I don't know if I agree, it's up to whether that works for you 😄 |
04:09:44 | FromDiscord | <michaelb.eth> namespace can be a powerful concept, but the implementation needs to be robust at the lang-level |
04:10:40 | FromDiscord | <michaelb.eth> I've Clojure's namespaces, for example, a pleasure to work with |
04:12:14 | FromDiscord | <michaelb.eth> but with Nim it just seems better to lean very heavily on UFCS and make no assumptions about e.g. a user importing your lib beyond the basic `import pkg/[yourlib]` |
04:12:30 | FromDiscord | <michaelb.eth> (edit) "I've ... Clojure's" added "found" |
04:13:51 | FromDiscord | <Elegantbeef> Yea, I don't really get the point of namespaces aside from a module like system |
04:14:40 | FromDiscord | <Elegantbeef> C# namespaces are mostly just annotations for a import path |
04:17:55 | FromDiscord | <michaelb.eth> is RHS in objects fields, tuples being a typedesc a deep problem re: the current design/implementation of Nim, or something that could change relatively easily if there was momentum around it? |
04:18:12 | FromDiscord | <Elegantbeef> What? |
04:19:16 | FromDiscord | <michaelb.eth> sent a code paste, see https://play.nim-lang.org/#ix=4zyI |
04:19:34 | FromDiscord | <Elegantbeef> What's the problem? |
04:19:46 | FromDiscord | <michaelb.eth> yeah, that's not what I meant, sorry |
04:20:10 | FromDiscord | <michaelb.eth> sent a code paste, see https://play.nim-lang.org/#ix=4zyJ |
04:20:23 | FromDiscord | <Elegantbeef> It's a deeply rooted problem |
04:20:42 | FromDiscord | <Elegantbeef> How do you even consume this type? |
04:20:58 | FromDiscord | <Elegantbeef> let's image `typedesc` as type information |
04:21:02 | FromDiscord | <Elegantbeef> imagine\ |
04:21:19 | FromDiscord | <Elegantbeef> You want to instantiate it, how do you instantiate it? 😄 |
04:21:35 | FromDiscord | <michaelb.eth> sent a code paste, see https://paste.rs/nwQnz |
04:21:47 | FromDiscord | <Elegantbeef> The above is valid tohugh 😄 |
04:21:49 | FromDiscord | <Elegantbeef> though\ |
04:22:33 | FromDiscord | <michaelb.eth> I tried something like that, and it blew up in my face, with compile-timer error messages seeming similar to above that re: `x: typedesc` |
04:22:46 | FromDiscord | <michaelb.eth> but... it's also possible I was complecting the setup |
04:22:58 | FromDiscord | <Elegantbeef> That works |
04:23:02 | FromDiscord | <Elegantbeef> sent a code paste, see https://paste.rs/PV77H |
04:23:22 | FromDiscord | <Elegantbeef> Why do you even want `x: typedesc`? |
04:23:38 | FromDiscord | <michaelb.eth> type hole |
04:24:04 | FromDiscord | <Elegantbeef> I wish people didnt speak in riddles |
04:24:19 | FromDiscord | <michaelb.eth> something that can be filled in later, in a more concrete context |
04:24:30 | FromDiscord | <Elegantbeef> so a generic parameter |
04:25:47 | FromDiscord | <michaelb.eth> sure, I ended up going that way |
04:26:10 | FromDiscord | <Elegantbeef> I'm just confused how `typedesc` is any better than just a generic parameter |
04:26:53 | FromDiscord | <Elegantbeef> Personally i'd see `a: typedesc` and assume it was type information |
04:28:05 | FromDiscord | <michaelb.eth> it's probably not, and I ended up with a better understanding of can/cannot with generics, etc., but definitely wasn't something obvious |
04:28:18 | FromDiscord | <michaelb.eth> generics are a hard problem, I guess |
04:28:32 | FromDiscord | <Elegantbeef> Harder with all the ad hoc solutions Nim has 😄 |
04:28:51 | FromDiscord | <Elegantbeef> I don't even know how you'd give a value to that typedesc |
04:29:24 | FromDiscord | <Elegantbeef> If there was object construction type inference atleast `a: auto` makes some sense as a implicit generic parameter |
04:29:34 | FromDiscord | <Elegantbeef> But that assumes you can construct generics without specifying them |
04:31:18 | FromDiscord | <michaelb.eth> In reply to @Elegantbeef "Harder with all the": yeah, like I recently "discovered" I could create "pseudo proc types" (involving generics) for fields of object variants (involving generics), and it just works |
04:31:27 | FromDiscord | <michaelb.eth> late binding and all that |
04:31:58 | FromDiscord | <Elegantbeef> I'm a big proponent of generics and concepts, so yea I know you can do a lot with them |
04:32:12 | FromDiscord | <Elegantbeef> My gooey framework thingy is wholly vector and renderer agnostic due to my use of generics, inheritance, and concepts 😄 |
04:34:49 | FromDiscord | <michaelb.eth> So, I'm not a young programmer by any stretch, but there are just concepts one hasn't encountered previously. I recently was reading about the differences between "immediate mode" and "retained mode" GUIs. When trying to draw a clear distinction between them in my mind, it gets all tangle up in my head. |
04:35:53 | FromDiscord | <michaelb.eth> Any insights on how to delineate that? |
04:36:40 | FromDiscord | <Elegantbeef> What people call retained is a stateful gui where you make a tree that represents the gui/code. Immediate is when the flow control is explicitly written |
04:36:59 | FromDiscord | <Elegantbeef> The definitions people use immediate and retained for are not what the conventional definitions are I believe |
04:37:41 | FromDiscord | <ambient3332> Immediate mode creates widgets every frame. Other mode creates widgets once and then do callbacks and signals. That's how I understand it. |
04:38:31 | FromDiscord | <odexine> I think one could describe it as nouns vs verbs |
04:42:20 | FromDiscord | <Phil> Sounds like immediate mode is just the more functional approach that converts a set of data entirely into a frame whereas retained mode creates a state-ful machine based on an initial set of data and data-changes now must be propagated throughout the entire machine |
04:42:45 | FromDiscord | <Phil> (edit) "Sounds like immediate mode is just the more functional approach that converts a set of data entirely into a frame whereas retained mode creates a state-ful machine based on an initial set of data ... and" added "that can create frames" |
04:43:07 | FromDiscord | <odexine> Immediate is more imperative |
04:44:35 | FromDiscord | <Phil> I'm fully out off my depth here because I only worked with retained mode GUI stuff (GTK, Angular), but why?↵To me from the way the high-level view on it is presented that seems like a straightforward data transformation from data --> image, I'm not even seeing anything all that side-effect-y |
04:46:17 | FromDiscord | <odexine> Immediate mode does indeed translate very very well into functional programming but it is commonly implemented as imperative |
04:46:27 | FromDiscord | <Phil> Ahhh check |
04:46:29 | FromDiscord | <odexine> That’s all I actually know about it |
05:10:38 | * | azimut quit (Ping timeout: 240 seconds) |
05:11:57 | * | azimut joined #nim |
05:24:30 | FromDiscord | <ambient3332> How do I use the Nim command line flags inside a {.compile.} pragma? |
05:57:59 | * | disso-peach joined #nim |
06:16:11 | FromDiscord | <xtrayambak> oh wait |
06:16:13 | FromDiscord | <xtrayambak> sent a code paste, see https://play.nim-lang.org/#ix=4zyW |
06:16:16 | FromDiscord | <xtrayambak> someone already answered it |
06:16:30 | FromDiscord | <xtrayambak> (edit) "https://play.nim-lang.org/#ix=4zyW" => "https://play.nim-lang.org/#ix=4zyX" |
06:20:46 | * | ntat joined #nim |
06:51:43 | FromDiscord | <jeremyjaydan> In reply to @Elegantbeef "one could probably do": I've been stuck on open/closed symbols all day but I think I got it down, thank you beef ❤️ |
06:52:00 | FromDiscord | <jeremyjaydan> (edit) "down," => "down now," |
06:52:14 | FromDiscord | <Elegantbeef> Present me says your welcome for past me |
06:52:40 | FromDiscord | <Elegantbeef> It's nice when real time chats arent ephemeral |
06:53:19 | FromDiscord | <jeremyjaydan> rightt |
06:54:41 | FromDiscord | <Elegantbeef> Well if you have any questions feel free to ask, I've got nothing better to do |
06:59:45 | FromDiscord | <jeremyjaydan> In reply to @Elegantbeef "Well if you have": I appreciate that! |
07:02:49 | FromDiscord | <jeremyjaydan> sent a code paste, see https://play.nim-lang.org/#ix=4zz2 |
07:03:07 | FromDiscord | <Yardanico> In reply to @jeremyjaydan "ok I've got something,": no, nim does not have return type overloading |
07:03:08 | FromDiscord | <Elegantbeef> Nope there is no way to disambiguate those |
07:03:13 | FromDiscord | <jeremyjaydan> ok |
07:03:19 | FromDiscord | <Elegantbeef> Nim's disambiguation only happens inside the `()` of a call |
07:03:27 | FromDiscord | <Yardanico> if ytou really want something a bit close to this you could use object variants |
07:03:29 | FromDiscord | <Yardanico> but it's not the same |
07:03:30 | FromDiscord | <jeremyjaydan> that makes sense |
07:03:43 | FromDiscord | <jeremyjaydan> hm ok |
07:05:02 | FromDiscord | <jeremyjaydan> ty |
07:05:33 | FromDiscord | <jeremyjaydan> I'll letcha know if I have any other questions, I'm onto templates now |
07:06:16 | FromDiscord | <Elegantbeef> sent a code paste, see https://paste.rs/cmjgl |
07:06:39 | FromDiscord | <Elegantbeef> that `deadCode` is optional of course, just forces an instance to be made, to ensure there is no bugu inside the procs |
07:13:55 | FromDiscord | <jeremyjaydan> ah yea |
07:15:41 | FromDiscord | <jeremyjaydan> I can't think of a use case for return based overload, maybe type conversion could handle the use case too |
07:16:00 | FromDiscord | <jeremyjaydan> that's something I haven't actually wrapped my head around completely |
07:16:03 | FromDiscord | <Elegantbeef> Well languages have it, it's just a bit odd |
07:17:05 | FromDiscord | <jeremyjaydan> the only language that exists is nim |
07:17:09 | FromDiscord | <Elegantbeef> Given that you supposedly understand open/closed symbols, what other languages have you used? |
07:17:29 | FromDiscord | <jeremyjaydan> (edit) "the only language that exists is nim ... " added "/s" |
07:17:46 | FromDiscord | <jeremyjaydan> I'm coming from the javascript ecosystem, node.js |
07:18:11 | FromDiscord | <Elegantbeef> Ah, so hell |
07:18:24 | FromDiscord | <jeremyjaydan> I've learned the surface level typescript stuff, defining types lol |
07:18:31 | FromDiscord | <jeremyjaydan> In reply to @Elegantbeef "Ah, so hell": yeah lol |
07:19:05 | FromDiscord | <jeremyjaydan> went I got to about the 3/4th mark of the manual I had a realization of how javascript is a scripting language that's been around too long |
07:19:38 | FromDiscord | <jeremyjaydan> and typescript makes a lot more sense to me now |
07:21:39 | FromDiscord | <jeremyjaydan> so yea hopefully I can contribute to the web side of things in the nim ecosystem. After the manual I plan on learning the std libraries around http n such |
07:23:37 | FromDiscord | <Elegantbeef> Oh noes, more web stuff |
07:24:19 | FromDiscord | <ambient3332> I hope there's some way to delete Javascript entirely from the web |
07:24:33 | FromDiscord | <Elegantbeef> Only you can prevent the usage of dynamic websites |
07:24:57 | FromDiscord | <Elegantbeef> I'm doing my part, I axed the runtime usage of karax and just generated static code |
07:26:04 | FromDiscord | <Elegantbeef> I guess generated my site statically, not code 😄 |
07:26:24 | FromDiscord | <ambient3332> I'm not entirely against dynamic use, just the huge bloat and requirement for web browsers to implement entire modern Javascript stack to be functional |
07:27:13 | FromDiscord | <ambient3332> Maybe Webassembly will improve things |
07:28:56 | FromDiscord | <Elegantbeef> Doubtful |
07:30:14 | FromDiscord | <jeremyjaydan> In reply to @Elegantbeef "Doubtful": how come? that's what I'm thinking to, I feel like webassembly is the break the web needs |
07:30:21 | FromDiscord | <jeremyjaydan> (edit) "to," => "too," |
07:30:38 | FromDiscord | <Phil> In reply to @jeremyjaydan "and typescript makes a": Type unions are one of the best things TS has ever brought to us. That and generally strict typing |
07:31:12 | FromDiscord | <Phil> In reply to @ambient3332 "I hope there's some": People have tried with Java and failed, JS is a far more formidable foe |
07:32:37 | FromDiscord | <4zv4l> can sounds idiot but do you have a nice library or wrapper around `std/logging` that has colors for the log level ?↵it is sooo much easier to see the relevant logs if you see for example `ERROR` in red or `WARNING` in orange |
07:33:04 | FromDiscord | <Phil> As a frequent user of std/logging - that is a fair point |
07:33:37 | FromDiscord | <ambient3332> sent a code paste, see https://play.nim-lang.org/#ix=4zz7 |
07:33:53 | FromDiscord | <Elegantbeef> Jesus people need to stop manually writing out string sequences |
07:34:10 | FromDiscord | <Phil> I see `&` used for string concatenation, I think heresy |
07:34:27 | FromDiscord | <Elegantbeef> `import std/terminal` `ansiForegroundColor(fgYellow)` ez pz |
07:34:31 | FromDiscord | <ambient3332> Complaining about achieves nothing, if nobody actually writes good documentation and tutorials |
07:35:12 | FromDiscord | <jeremyjaydan> In reply to @isofruit "Type unions are one": Not sure what type unions are, I only learned primitive type definitions in ts. Though I'm open to learning ts more for employability reasons I suppose |
07:35:38 | FromDiscord | <Elegantbeef> TS type unions are how they represent multiple types in a single variable |
07:35:53 | FromDiscord | <jeremyjaydan> gotcha |
07:35:54 | FromDiscord | <Phil> In reply to @jeremyjaydan "Not sure what type": In a sense it takes over the jobs of enums to a degree |
07:36:01 | FromDiscord | <Elegantbeef> It's statically typed but you can store different types in a variable |
07:36:07 | FromDiscord | <Elegantbeef> Dont you say it takes over the jobs of enums |
07:36:10 | FromDiscord | <Elegantbeef> I'll come over there and slap you |
07:36:29 | FromDiscord | <jeremyjaydan> lol |
07:36:44 | FromDiscord | <Phil> I mean, in TS it does for the most part, there are very few jobs/purposes where a TS type union can't do the same job as an enum |
07:36:54 | FromDiscord | <Elegantbeef> only $500CAD to slap phil, worth |
07:37:36 | FromDiscord | <jeremyjaydan> I think the biggest thing in ts I can't get over is the type definitions in a separate file, I know you can write them in the same file but that's not supported throughout the ecosystem (e.g. svelte components) |
07:38:26 | FromDiscord | <jeremyjaydan> and implementation lookups in vscode go to ts definition lookups for a lot of stuff, no idea why |
07:40:35 | FromDiscord | <Elegantbeef> If you think that tooling is bad wait until you write Nim |
07:41:28 | FromDiscord | <jeremyjaydan> I'm actually super excited lol |
07:42:14 | FromDiscord | <jeremyjaydan> I know there's oddities, and there's oddities in js/ts too but for some reason I'd rather put up with nim oddities |
07:43:13 | FromDiscord | <jeremyjaydan> I think it's the low level system programming aspect, that part is super interesting coming from high level |
07:43:17 | FromDiscord | <4zv4l> https://github.com/nim-lang/Nim/blob/71ba2e7f3c5815d956b1ae0341b0743242b8fec6/lib/pure/logging.nim#L187 |
07:43:18 | FromDiscord | <Elegantbeef> I'm more talking like the suggest tooling suddenly dying and not coming back LD |
07:43:19 | FromDiscord | <4zv4l> anyone knows why |
07:43:19 | FromDiscord | <Phil> TBH unless you start going into the more fiddly stuff the language itself holds up nicely |
07:43:23 | FromDiscord | <4zv4l> there are two DEBUG in the array ? |
07:43:38 | * | azimut quit (Ping timeout: 240 seconds) |
07:43:46 | FromDiscord | <Elegantbeef> `lvlAll` |
07:44:34 | FromDiscord | <Elegantbeef> I guess they figured that was easier than a `array[range[succ(lvlAll)..lvlNone]]` |
07:45:01 | FromDiscord | <Phil> Why make it an array and not a set is more my contemplation |
07:47:00 | FromDiscord | <Elegantbeef> Cause it's a Enum -\> String? |
07:47:01 | FromDiscord | <Elegantbeef> How does a set work there |
07:47:23 | * | Jjp137 quit (Ping timeout: 264 seconds) |
07:47:42 | * | Jjp137 joined #nim |
07:47:47 | FromDiscord | <Elegantbeef> 4zv4l why dont you just make your own console logger that appends the formatting? |
07:48:21 | FromDiscord | <Elegantbeef> Or file logger |
07:48:27 | FromDiscord | <Elegantbeef> Whatever you need |
07:49:14 | FromDiscord | <Phil> In reply to @Elegantbeef "Cause it's a Enum": Wait, that array is solely for converting the enum into a string representation via index? |
07:49:28 | FromDiscord | <Phil> Why not write a conversion proc that takes the `$enum`, cuts off the "lvl" and capitalizes the rest? |
07:49:30 | FromDiscord | <Elegantbeef> Yes `names[yourLvl]` |
07:49:39 | FromDiscord | <Elegantbeef> Cause this is Nim and not whatever the fuck that is |
07:49:47 | FromDiscord | <Elegantbeef> We have enum indexed arrays, we use them |
07:49:51 | FromDiscord | <Phil> That is "reducing data to a single point of truth" |
07:50:27 | FromDiscord | <Elegantbeef> It's also doing string operations for literally no reason |
07:51:18 | FromDiscord | <Phil> It doesn't really matter for runtime operations, this is a compile-time operation either way |
07:51:39 | FromDiscord | <Elegantbeef> Sure and why would you do string operations when you could just write the name out |
07:51:43 | FromDiscord | <Phil> And you just removed the risk of somebody forgetting that changing the enum automatically also means adjusting the array underneath |
07:52:23 | FromDiscord | <Elegantbeef> At any rate you could just do `lvlAll = "Debug"` and so forth |
07:52:27 | FromDiscord | <Phil> Because you now have 2 pieces of data that are coupled to each other directly because one is basically inferred from the other, but that is not directly visible in your source code |
07:52:36 | FromDiscord | <Elegantbeef> Oh god |
07:52:43 | FromDiscord | <4zv4l> I can compile the `std/logging` code adding colors↵but I get a warning (even with the vanilla code)↵`logging.nim(339, 8) Warning: method has lock level <unknown>, but another method has 0 [LockLevel]`↵what can I do about it ? https://media.discordapp.net/attachments/371759389889003532/1124970896248016966/image.png |
07:53:00 | FromDiscord | <Elegantbeef> They're within 10 lines of code of eachother |
07:53:09 | FromDiscord | <4zv4l> I tried to specify the `{.locks: 0}` but it doesn't go away |
07:53:10 | FromDiscord | <Elegantbeef> You ignore it cause lock levels don't matter |
07:53:25 | FromDiscord | <Elegantbeef> Like I said though just make your own logger using inheritance |
07:53:48 | FromDiscord | <Phil> That's fair, but at this point I don't know how much of the rest of the code relies on the enums being numbers, so the string conversion is the safer route (though assigning string values is the best if you can spare the time for checking if the number enum values are necessary elsewhere) |
07:53:50 | FromDiscord | <4zv4l> or there is this function in std/logging `substituteLog` |
07:54:03 | FromDiscord | <Elegantbeef> What? |
07:54:17 | FromDiscord | <4zv4l> https://nim-lang.org/docs/logging.html#substituteLog%2Cstring%2CLevel%2Cvarargs%5Bstring%2C%5D |
07:54:18 | FromDiscord | <4zv4l> here |
07:54:19 | FromDiscord | <Elegantbeef> Even with `lvlAll = "Debug"` enums are still ordinals |
07:54:41 | FromDiscord | <Elegantbeef> Phil you're being too clever |
07:54:45 | FromDiscord | <Elegantbeef> Never be too clever |
07:55:16 | FromDiscord | <Phil> That has nothing to do with clever, wth |
07:55:57 | FromDiscord | <Elegantbeef> I mean you're thinking doing string operations on the string representation of the type is better but it introduces the same issue |
07:56:10 | FromDiscord | <Elegantbeef> some joker could write `lvlAll = "someUselessString"` |
07:56:29 | FromDiscord | <Elegantbeef> And now `lvlAll` if it gets through logs `SomeUselessString` 😄 |
07:57:52 | FromDiscord | <Phil> That was solely on the basis of how much time you have for a refactor |
08:01:31 | FromDiscord | <Phil> My statement was↵Enum with more direct assignment of desired string representation > Inferring desired string representation from current string representation >> Having an array with the desired string representation that only stays accurate as long as nobody touches the enum |
08:02:05 | FromDiscord | <Elegantbeef> I disagree on the second point you've now introduced a procedure that will have logic in it that prevents a 1\:1 mapping |
08:02:36 | FromDiscord | <Elegantbeef> You have to understand what that proc is doing and the importance of it 😄 |
08:02:56 | FromDiscord | <Phil> That is still going to be more stable than the enum array combo every time. |
08:03:36 | FromDiscord | <Elegantbeef> Yes more stable assuming everything goes your way |
08:04:00 | FromDiscord | <Phil> Because at the very least you see that the two belong together.↵The enum array combo is linked in a non obvious way, the inferring of the string representation at least is obvious |
08:04:06 | FromDiscord | <Elegantbeef> someone doesnt label the enum `lvl...` or if they do `lvlName = "..."` and it suddenly fails |
08:06:28 | FromDiscord | <Phil> The former scenario would be unlikely because that would go against the pattern inside the enum and the latter is unlikely for the same reason AND it would similarly introduce a "bug". If you add a value to the string representation array below that is identical, all the bug is that the enum now has a worthless string assignment, if you don't you now get to be surprised why `lvlName = "YourString"` does not get represented as `YourString` bu |
08:08:02 | FromDiscord | <Elegantbeef> Pointless meandering aside @4zv4l https://play.nim-lang.org/#ix=4zzd |
08:08:12 | FromDiscord | <Elegantbeef> Much more sane than doing anything inside `std/logging` |
08:11:45 | FromDiscord | <Elegantbeef> Though to be clear Phil I was not defending the array, it should not exist in this case. But writing a procedure that operates on a runtime value is just off to me 😄 |
08:13:18 | FromDiscord | <4zv4l> In reply to @Elegantbeef "Pointless meandering aside <@329196212282458112>": I get an error with the colors 🥹 |
08:14:42 | FromDiscord | <Elegantbeef> sent a code paste, see https://play.nim-lang.org/#ix=4zze |
08:14:55 | FromDiscord | <Elegantbeef> Fix the spelling of grey cause apparently it was added in devel |
08:20:18 | FromDiscord | <4zv4l> https://nim-lang.org/docs/terminal.html#progress-bar↵↵what does `cmd: -r:off` means ? |
08:21:06 | FromDiscord | <Elegantbeef> Fairly certain that's a hack to get it to render the code but not run it in the docs |
08:28:58 | FromDiscord | <4zv4l> any way to replace the first occurence of a word with strutils ? |
09:17:56 | FromDiscord | <4zv4l> well just added it↵https://github.com/4zv4l/colored_logger |
09:18:24 | FromDiscord | <Elegantbeef> Lol at your comments |
09:18:43 | FromDiscord | <Elegantbeef> you can do `[lvlAll: colWhite, lvlDebug: colWhite, ...` |
09:22:20 | NimEventer | New thread by elcritch: Fame and fortune for Nim?, see https://forum.nim-lang.org/t/10315 |
09:25:39 | FromDiscord | <jeremyjaydan> Hey is this old behaviour? https://media.discordapp.net/attachments/371759389889003532/1124994284815405106/image.png |
09:25:52 | FromDiscord | <jeremyjaydan> https://media.discordapp.net/attachments/371759389889003532/1124994338699620383/image.png |
09:25:57 | FromDiscord | <jeremyjaydan> https://media.discordapp.net/attachments/371759389889003532/1124994361478877255/image.png |
09:26:54 | FromDiscord | <jeremyjaydan> the first example produces what should be the output of the 2nd example here https://media.discordapp.net/attachments/371759389889003532/1124994601237872710/image.png |
09:30:15 | FromDiscord | <jeremyjaydan> intuitively I feel like `m.abclev` resulting in `levB` makes sense |
09:36:21 | FromDiscord | <ntzeno> sent a code paste, see https://play.nim-lang.org/#ix=4zzH |
09:43:10 | FromDiscord | <demotomohiro> In reply to @ntzeno "Hello, how can I": You need to use ref and inheritance or object variants |
09:43:32 | FromDiscord | <ntzeno> In reply to @demotomohiro "You need to use": I'll research onto them, ty |
09:43:57 | FromDiscord | <demotomohiro> https://nim-lang.org/docs/manual.html#types-reference-and-pointer-types |
09:44:40 | FromDiscord | <ntzeno> Thanks a lot! |
09:52:49 | NimEventer | New Nimble package! colored_logger - A simple colored logger from std/logging, see https://github.com/4zv4l/colored_logger |
09:53:56 | * | junaid_ joined #nim |
09:54:14 | * | junaid__ joined #nim |
09:54:14 | * | junaid__ quit (Client Quit) |
09:59:01 | * | krux02 joined #nim |
10:00:22 | FromDiscord | <spotlightkid> Nice. But what if some wants to use `$levelid` instead of `$levelname`? @4zv4l↵(<@709044657232936960_=4eim=45venter=5b=49=52=43=5d>) |
10:06:08 | FromDiscord | <4zv4l> In reply to @4zv4l "any way to replace": if I find this then I can do it |
10:06:18 | FromDiscord | <4zv4l> I made it quickly |
10:06:34 | FromDiscord | <4zv4l> I'll try to improve it over time↵I want something that looks like rust `log` `simple_logger` |
10:08:32 | * | junaid_ quit (Remote host closed the connection) |
10:09:01 | FromDiscord | <4zv4l> getting close I guess xD↵I added padding as well https://media.discordapp.net/attachments/371759389889003532/1125005196259512330/image.png |
10:17:58 | FromDiscord | <spotlightkid> sent a code paste, see https://paste.rs/Yav05 |
10:18:44 | FromDiscord | <spotlightkid> sent a code paste, see https://play.nim-lang.org/#ix=4zzQ |
10:30:07 | FromDiscord | <4zv4l> That indeed seems better |
10:30:12 | FromDiscord | <4zv4l> Gonna change that |
10:43:08 | FromDiscord | <4zv4l> the `NOTICE` one is annoying |
10:43:17 | FromDiscord | <4zv4l> makes a too big space gap to my taste xD |
10:47:27 | * | derpydoo quit (Quit: derpydoo) |
11:19:55 | FromDiscord | <heysokam> is there a function to get the mimetype of a file?↵i know there is a module that provides a database to check against... but, is there a function to get the mimetype itself? |
11:23:20 | * | krux02 quit (Remote host closed the connection) |
11:41:30 | * | junaid_ joined #nim |
11:43:26 | FromDiscord | <intellj_gamer> You could use `os.splitPath` and then lookup that extension in the db via `getMimeType` |
11:43:54 | FromDiscord | <intellj_gamer> (edit) "`getMimeType`" => "`mimetypes.getMimeType`" |
11:44:26 | * | disso-peach quit (Quit: Leaving) |
13:20:45 | FromDiscord | <michaelb.eth> @4zv4l did you have a look at nim-chronicles?↵https://github.com/status-im/nim-chronicles |
13:21:37 | FromDiscord | <michaelb.eth> its multi-line `textblocks` format is pretty nice |
13:40:14 | FromDiscord | <4zv4l> yeah I had a look but I didn't understand well how to use it and how to remove the `tid` |
15:20:18 | FromDiscord | <_alkamist_> If you define `=destroy` for something, do you take on the responsibility of manually freeing any refs that it contains? |
15:24:27 | FromDiscord | <_alkamist_> sent a code paste, see https://paste.rs/umpyz |
15:36:28 | * | om3ga quit (Read error: Connection reset by peer) |
15:48:37 | FromDiscord | <Yardanico> yes, you have to call =destroy on fields yourself |
15:49:16 | FromDiscord | <Yardanico> sent a code paste, see https://play.nim-lang.org/#ix=4zBm |
15:49:36 | FromDiscord | <_alkamist_> Doesn't that kind of mess with the idea of refs though? Like what if a field is referenced somewhere else? |
15:51:05 | Amun-Ra | refcount → refcount - 1 |
15:51:44 | FromDiscord | <_alkamist_> So does calling `=destroy` just reduce the ref count or something? |
15:52:26 | Amun-Ra | if the object is referenced multiple times, you won't really destroy it |
15:53:04 | FromDiscord | <_alkamist_> Ok so `=destroy` is safe to call on something that is still referenced somewhere else |
15:53:19 | Amun-Ra | yes |
15:53:28 | FromDiscord | <_alkamist_> Alright, makes sense. Thanks! |
16:33:28 | * | azimut joined #nim |
17:00:13 | * | om3ga joined #nim |
18:01:07 | * | ovenpasta joined #nim |
18:16:45 | FromDiscord | <xrfez> anyone seen an example of passing strings to nim from vba and returning a string from nim to vba. Probably as a BSTR. |
19:13:40 | FromDiscord | <Hamid_Bluri> finally did it with crazy unicodes 😄 https://media.discordapp.net/attachments/371759389889003532/1125142262016385054/image.png |
19:20:16 | * | junaid_ quit (Remote host closed the connection) |
19:29:50 | * | thomasross joined #nim |
20:35:54 | FromDiscord | <xrfez> https://gist.github.com/khchen/190bed34c449b8e0a0eead4c005189bf#file-appidpolicyhandler-nim-L34-L37 |
20:35:54 | FromDiscord | <xrfez> sent a code paste, see https://play.nim-lang.org/#ix=4zCe |
20:47:26 | FromDiscord | <System64 ~ Flandre Scarlet> Is there some Fourier Transform libraries please? |
20:55:37 | FromDiscord | <that_dude.> Current best best afaik https://nimble.directory/search?query=fft |
21:05:30 | FromDiscord | <System64 ~ Flandre Scarlet> In reply to @that_dude. "Current best best afaik": Oh thanks↵And can KissFFT do an inverse FFT? |
21:05:49 | FromDiscord | <that_dude.> No idea sorry |
21:06:15 | FromDiscord | <that_dude.> But I think it said it was binding to the Kiss implimentation so if it can, then the library should be able to too |
21:07:42 | FromDiscord | <that_dude.> There is a spot in the documentation that says `kiss_fft_cfg cfg = kiss_fft_alloc( nfft ,is_inverse_fft ,0,0 );` so I would think it can do some inverse stuff |
21:09:58 | FromDiscord | <System64 ~ Flandre Scarlet> I think I should give it a try |
21:23:41 | * | derpydoo joined #nim |
21:25:26 | FromDiscord | <gamedroit> p-p this whole time I could have used ``getFD(socket).setBlocking(false)``? then accept would no longer block the code. |
21:35:37 | * | ntat quit (Quit: Leaving) |
21:48:53 | FromDiscord | <System64 ~ Flandre Scarlet> The header is there, why do I have an error? https://media.discordapp.net/attachments/371759389889003532/1125181320537059450/message.txt https://media.discordapp.net/attachments/371759389889003532/1125181320897761372/image.png |
21:50:04 | FromDiscord | <Elegantbeef> It's not in your include path |
21:51:29 | FromDiscord | <System64 ~ Flandre Scarlet> In reply to @Elegantbeef "It's not in your": Isn't Nim supposed to find it when it's in the same dir? |
21:52:28 | FromDiscord | <Elegantbeef> No clue |
21:52:55 | FromDiscord | <System64 ~ Flandre Scarlet> and is it possible to get the path of the Nim file itself? |
21:54:17 | FromDiscord | <spotlightkid> `currentSourcePath` |
21:56:02 | * | derpydoo quit (Ping timeout: 245 seconds) |
21:56:54 | FromDiscord | <spotlightkid> Use `{.passC: ... .}` to pass the include path to the compiler |
21:58:51 | FromDiscord | <System64 ~ Flandre Scarlet> I fixed this |
21:59:17 | FromDiscord | <System64 ~ Flandre Scarlet> But now I have something even weirder https://media.discordapp.net/attachments/371759389889003532/1125183942350356530/message.txt |
22:02:56 | FromDiscord | <spotlightkid> I suggest using a pastebin site (e.g. cpaste.org) to post output and link it here. |
22:03:48 | FromDiscord | <System64 ~ Flandre Scarlet> https://pastebin.com/u80kUChP |
22:06:40 | FromDiscord | <System64 ~ Flandre Scarlet> This is a weird error |
22:20:20 | FromDiscord | <spotlightkid> Without seeing your code we can only guess. Try building a minimal example, which fails. |
22:20:24 | FromDiscord | <takemichihanagaki3129> In reply to @hamidb80 "finally did it with": Impressive! What is this package? |
22:20:34 | FromDiscord | <takemichihanagaki3129> (edit) "In reply to @hamidb80 "finally did it with": Impressive! What is this package? ... " added "(Or DSL)" |
22:21:28 | FromDiscord | <System64 ~ Flandre Scarlet> sent a code paste, see https://paste.rs/WsJ0F |
22:23:37 | FromDiscord | <spotlightkid> I should have said\: "... a minimal runnable example". You can't expect us to guess what you did exactly to compile & rund this code. |
22:25:08 | FromDiscord | <System64 ~ Flandre Scarlet> Oh↵lemme do this then |
22:35:15 | FromDiscord | <takemichihanagaki3129> What are the differences between `type ... = object` and `type ... = ref object` exactly?↵I know that object references invokes `system.new` implicity, but I don't think the documentation was clear enough to me.↵And what is the difference between `type ... = ref OtherType` from `type ... = ref object of OtherType`? |
22:35:42 | FromDiscord | <Elegantbeef> `ref T` makes it a heap allocated object with a managed pointer |
22:35:52 | FromDiscord | <Elegantbeef> The latter is inheritance |
22:36:33 | FromDiscord | <takemichihanagaki3129> In reply to @Elegantbeef "`ref T` makes it": Hmmm, so if I don't use the `ref` keyword am I using the stack memory? |
22:36:44 | FromDiscord | <Elegantbeef> It's a value type |
22:36:55 | FromDiscord | <Elegantbeef> So if declared in local scope yes, if declared in a sequence, no |
22:37:14 | FromDiscord | <takemichihanagaki3129> In reply to @Elegantbeef "So if declared in": I see! |
22:38:32 | FromDiscord | <Elegantbeef> I say sequence just as an example |
22:51:11 | * | ovenpasta quit (Ping timeout: 246 seconds) |
22:52:37 | * | ntat joined #nim |
23:01:40 | FromDiscord | <System64 ~ Flandre Scarlet> so it works with my MRI, so I messed up somewhere |
23:01:54 | FromDiscord | <Chronos [She/Her]> sent a code paste, see https://play.nim-lang.org/#ix=4zCB |
23:02:20 | FromDiscord | <Chronos [She/Her]> It's the global config thing |
23:02:32 | FromDiscord | <Chronos [She/Her]> I'm assuming that the flag I'm passing is just processed too late? |
23:04:49 | FromDiscord | <Chronos [She/Her]> Ah might be a different issue... That's annoying |
23:28:37 | FromDiscord | <Chronos [She/Her]> Question: How much of system.nim depends on WASI related stuff? |
23:29:01 | FromDiscord | <Chronos [She/Her]> Like, do seqs rely on needing WASI? I'd hope not since there's an allocator in Nim right? |
23:30:34 | FromDiscord | <Elegantbeef> if you use `-d:useMalloc` of course not |
23:33:16 | FromDiscord | <Chronos [She/Her]> In reply to @Elegantbeef "if you use `-d:useMalloc`": Huh but I thought Nim had it's own allocator why would it rely on the system? |
23:33:27 | FromDiscord | <Elegantbeef> nim's allocator uses memfiles |
23:33:54 | FromDiscord | <Chronos [She/Her]> Also I definitely expect files and stuff to use WASI but hm |
23:33:58 | FromDiscord | <Elegantbeef> https://nim-lang.org/docs/nimc.html#nim-for-embedded-systems-nimallocpagesviamalloc |
23:34:14 | FromDiscord | <Chronos [She/Her]> Is Nim's allocator written in Nim too? |
23:34:16 | FromDiscord | <gamedroit> sent a code paste, see https://paste.rs/Q8BUU |
23:34:25 | FromDiscord | <Elegantbeef> Of course |
23:34:37 | FromDiscord | <Elegantbeef> No it's not possible to infer the type like that |
23:35:07 | FromDiscord | <gamedroit> In reply to @Elegantbeef "No it's not possible": i mean the proc would return it, but yea, it seems mostly impossible to do smth like that |
23:35:09 | FromDiscord | <Chronos [She/Her]> In reply to @Elegantbeef "https://nim-lang.org/docs/nimc.html#nim-for-embedde": Ah neat |
23:35:46 | FromDiscord | <Elegantbeef> At that point you could just write `proc foo(...)` |
23:36:16 | FromDiscord | <Elegantbeef> https://github.com/nim-lang/Nim/blob/devel/lib/system/alloc.nim |
23:37:16 | FromDiscord | <Chronos [She/Her]> Thanks o7 |
23:44:01 | * | ntat quit (Quit: Leaving) |