<< 02-07-2023 >>

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:28FromDiscord<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:17FromDiscord<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:24FromDiscord<teyako> sent a long message, see http://ix.io/4zyg
00:12:57FromDiscord<teyako> the issue is the of > numberToKeep, but I haven't found an example on how to do this so far
00:13:36FromDiscord<teyako> (edit) "http://ix.io/4zyi" => "http://ix.io/4zyh"
00:14:47FromDiscord<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:56FromDiscord<Elegantbeef> nim doesnt have this type of matching
00:15:15FromDiscord<Elegantbeef> `numberToKeep..int.high` if `numbeToKeep` is a constant
00:15:20FromDiscord<Elegantbeef> Otherwise no you cannot do this
00:15:46FromDiscord<Elegantbeef> You may need an if statement
00:16:44FromDiscord<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:06FromDiscord<Elegantbeef> Technically this can be done with case but it's not much nicer
00:19:40FromDiscord<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:52FromDiscord<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:11FromDiscord<Elegantbeef> In Nim a file is a module
03:59:59FromDiscord<odexine> nim does not separate the concept of files and modules, yeah
04:00:31FromDiscord<odexine> the first option forces namespacing (possibly undesirable, depends), the other is optional (also maybe undesirable)
04:00:40FromDiscord<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:59FromDiscord<Elegantbeef> In nim the best way to namespace is not to namespace 😄
04:01:08FromDiscord<ajusa> I've been using Nim for almost 7 years now but I realize I never actually dug into namespacing
04:01:36FromDiscord<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:37FromDiscord<Elegantbeef> I don't know if I agree, it's up to whether that works for you 😄
04:09:44FromDiscord<michaelb.eth> namespace can be a powerful concept, but the implementation needs to be robust at the lang-level
04:10:40FromDiscord<michaelb.eth> I've Clojure's namespaces, for example, a pleasure to work with
04:12:14FromDiscord<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:30FromDiscord<michaelb.eth> (edit) "I've ... Clojure's" added "found"
04:13:51FromDiscord<Elegantbeef> Yea, I don't really get the point of namespaces aside from a module like system
04:14:40FromDiscord<Elegantbeef> C# namespaces are mostly just annotations for a import path
04:17:55FromDiscord<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:12FromDiscord<Elegantbeef> What?
04:19:16FromDiscord<michaelb.eth> sent a code paste, see https://play.nim-lang.org/#ix=4zyI
04:19:34FromDiscord<Elegantbeef> What's the problem?
04:19:46FromDiscord<michaelb.eth> yeah, that's not what I meant, sorry
04:20:10FromDiscord<michaelb.eth> sent a code paste, see https://play.nim-lang.org/#ix=4zyJ
04:20:23FromDiscord<Elegantbeef> It's a deeply rooted problem
04:20:42FromDiscord<Elegantbeef> How do you even consume this type?
04:20:58FromDiscord<Elegantbeef> let's image `typedesc` as type information
04:21:02FromDiscord<Elegantbeef> imagine\
04:21:19FromDiscord<Elegantbeef> You want to instantiate it, how do you instantiate it? 😄
04:21:35FromDiscord<michaelb.eth> sent a code paste, see https://paste.rs/nwQnz
04:21:47FromDiscord<Elegantbeef> The above is valid tohugh 😄
04:21:49FromDiscord<Elegantbeef> though\
04:22:33FromDiscord<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:46FromDiscord<michaelb.eth> but... it's also possible I was complecting the setup
04:22:58FromDiscord<Elegantbeef> That works
04:23:02FromDiscord<Elegantbeef> sent a code paste, see https://paste.rs/PV77H
04:23:22FromDiscord<Elegantbeef> Why do you even want `x: typedesc`?
04:23:38FromDiscord<michaelb.eth> type hole
04:24:04FromDiscord<Elegantbeef> I wish people didnt speak in riddles
04:24:19FromDiscord<michaelb.eth> something that can be filled in later, in a more concrete context
04:24:30FromDiscord<Elegantbeef> so a generic parameter
04:25:47FromDiscord<michaelb.eth> sure, I ended up going that way
04:26:10FromDiscord<Elegantbeef> I'm just confused how `typedesc` is any better than just a generic parameter
04:26:53FromDiscord<Elegantbeef> Personally i'd see `a: typedesc` and assume it was type information
04:28:05FromDiscord<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:18FromDiscord<michaelb.eth> generics are a hard problem, I guess
04:28:32FromDiscord<Elegantbeef> Harder with all the ad hoc solutions Nim has 😄
04:28:51FromDiscord<Elegantbeef> I don't even know how you'd give a value to that typedesc
04:29:24FromDiscord<Elegantbeef> If there was object construction type inference atleast `a: auto` makes some sense as a implicit generic parameter
04:29:34FromDiscord<Elegantbeef> But that assumes you can construct generics without specifying them
04:31:18FromDiscord<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:27FromDiscord<michaelb.eth> late binding and all that
04:31:58FromDiscord<Elegantbeef> I'm a big proponent of generics and concepts, so yea I know you can do a lot with them
04:32:12FromDiscord<Elegantbeef> My gooey framework thingy is wholly vector and renderer agnostic due to my use of generics, inheritance, and concepts 😄
04:34:49FromDiscord<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:53FromDiscord<michaelb.eth> Any insights on how to delineate that?
04:36:40FromDiscord<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:59FromDiscord<Elegantbeef> The definitions people use immediate and retained for are not what the conventional definitions are I believe
04:37:41FromDiscord<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:31FromDiscord<odexine> I think one could describe it as nouns vs verbs
04:42:20FromDiscord<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:45FromDiscord<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:07FromDiscord<odexine> Immediate is more imperative
04:44:35FromDiscord<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:17FromDiscord<odexine> Immediate mode does indeed translate very very well into functional programming but it is commonly implemented as imperative
04:46:27FromDiscord<Phil> Ahhh check
04:46:29FromDiscord<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:30FromDiscord<ambient3332> How do I use the Nim command line flags inside a {.compile.} pragma?
05:57:59*disso-peach joined #nim
06:16:11FromDiscord<xtrayambak> oh wait
06:16:13FromDiscord<xtrayambak> sent a code paste, see https://play.nim-lang.org/#ix=4zyW
06:16:16FromDiscord<xtrayambak> someone already answered it
06:16:30FromDiscord<xtrayambak> (edit) "https://play.nim-lang.org/#ix=4zyW" => "https://play.nim-lang.org/#ix=4zyX"
06:20:46*ntat joined #nim
06:51:43FromDiscord<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:00FromDiscord<jeremyjaydan> (edit) "down," => "down now,"
06:52:14FromDiscord<Elegantbeef> Present me says your welcome for past me
06:52:40FromDiscord<Elegantbeef> It's nice when real time chats arent ephemeral
06:53:19FromDiscord<jeremyjaydan> rightt
06:54:41FromDiscord<Elegantbeef> Well if you have any questions feel free to ask, I've got nothing better to do
06:59:45FromDiscord<jeremyjaydan> In reply to @Elegantbeef "Well if you have": I appreciate that!
07:02:49FromDiscord<jeremyjaydan> sent a code paste, see https://play.nim-lang.org/#ix=4zz2
07:03:07FromDiscord<Yardanico> In reply to @jeremyjaydan "ok I've got something,": no, nim does not have return type overloading
07:03:08FromDiscord<Elegantbeef> Nope there is no way to disambiguate those
07:03:13FromDiscord<jeremyjaydan> ok
07:03:19FromDiscord<Elegantbeef> Nim's disambiguation only happens inside the `()` of a call
07:03:27FromDiscord<Yardanico> if ytou really want something a bit close to this you could use object variants
07:03:29FromDiscord<Yardanico> but it's not the same
07:03:30FromDiscord<jeremyjaydan> that makes sense
07:03:43FromDiscord<jeremyjaydan> hm ok
07:05:02FromDiscord<jeremyjaydan> ty
07:05:33FromDiscord<jeremyjaydan> I'll letcha know if I have any other questions, I'm onto templates now
07:06:16FromDiscord<Elegantbeef> sent a code paste, see https://paste.rs/cmjgl
07:06:39FromDiscord<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:55FromDiscord<jeremyjaydan> ah yea
07:15:41FromDiscord<jeremyjaydan> I can't think of a use case for return based overload, maybe type conversion could handle the use case too
07:16:00FromDiscord<jeremyjaydan> that's something I haven't actually wrapped my head around completely
07:16:03FromDiscord<Elegantbeef> Well languages have it, it's just a bit odd
07:17:05FromDiscord<jeremyjaydan> the only language that exists is nim
07:17:09FromDiscord<Elegantbeef> Given that you supposedly understand open/closed symbols, what other languages have you used?
07:17:29FromDiscord<jeremyjaydan> (edit) "the only language that exists is nim ... " added "/s"
07:17:46FromDiscord<jeremyjaydan> I'm coming from the javascript ecosystem, node.js
07:18:11FromDiscord<Elegantbeef> Ah, so hell
07:18:24FromDiscord<jeremyjaydan> I've learned the surface level typescript stuff, defining types lol
07:18:31FromDiscord<jeremyjaydan> In reply to @Elegantbeef "Ah, so hell": yeah lol
07:19:05FromDiscord<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:38FromDiscord<jeremyjaydan> and typescript makes a lot more sense to me now
07:21:39FromDiscord<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:37FromDiscord<Elegantbeef> Oh noes, more web stuff
07:24:19FromDiscord<ambient3332> I hope there's some way to delete Javascript entirely from the web
07:24:33FromDiscord<Elegantbeef> Only you can prevent the usage of dynamic websites
07:24:57FromDiscord<Elegantbeef> I'm doing my part, I axed the runtime usage of karax and just generated static code
07:26:04FromDiscord<Elegantbeef> I guess generated my site statically, not code 😄
07:26:24FromDiscord<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:13FromDiscord<ambient3332> Maybe Webassembly will improve things
07:28:56FromDiscord<Elegantbeef> Doubtful
07:30:14FromDiscord<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:21FromDiscord<jeremyjaydan> (edit) "to," => "too,"
07:30:38FromDiscord<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:12FromDiscord<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:37FromDiscord<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:04FromDiscord<Phil> As a frequent user of std/logging - that is a fair point
07:33:37FromDiscord<ambient3332> sent a code paste, see https://play.nim-lang.org/#ix=4zz7
07:33:53FromDiscord<Elegantbeef> Jesus people need to stop manually writing out string sequences
07:34:10FromDiscord<Phil> I see `&` used for string concatenation, I think heresy
07:34:27FromDiscord<Elegantbeef> `import std/terminal` `ansiForegroundColor(fgYellow)` ez pz
07:34:31FromDiscord<ambient3332> Complaining about achieves nothing, if nobody actually writes good documentation and tutorials
07:35:12FromDiscord<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:38FromDiscord<Elegantbeef> TS type unions are how they represent multiple types in a single variable
07:35:53FromDiscord<jeremyjaydan> gotcha
07:35:54FromDiscord<Phil> In reply to @jeremyjaydan "Not sure what type": In a sense it takes over the jobs of enums to a degree
07:36:01FromDiscord<Elegantbeef> It's statically typed but you can store different types in a variable
07:36:07FromDiscord<Elegantbeef> Dont you say it takes over the jobs of enums
07:36:10FromDiscord<Elegantbeef> I'll come over there and slap you
07:36:29FromDiscord<jeremyjaydan> lol
07:36:44FromDiscord<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:54FromDiscord<Elegantbeef> only $500CAD to slap phil, worth
07:37:36FromDiscord<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:26FromDiscord<jeremyjaydan> and implementation lookups in vscode go to ts definition lookups for a lot of stuff, no idea why
07:40:35FromDiscord<Elegantbeef> If you think that tooling is bad wait until you write Nim
07:41:28FromDiscord<jeremyjaydan> I'm actually super excited lol
07:42:14FromDiscord<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:13FromDiscord<jeremyjaydan> I think it's the low level system programming aspect, that part is super interesting coming from high level
07:43:17FromDiscord<4zv4l> https://github.com/nim-lang/Nim/blob/71ba2e7f3c5815d956b1ae0341b0743242b8fec6/lib/pure/logging.nim#L187
07:43:18FromDiscord<Elegantbeef> I'm more talking like the suggest tooling suddenly dying and not coming back LD
07:43:19FromDiscord<4zv4l> anyone knows why
07:43:19FromDiscord<Phil> TBH unless you start going into the more fiddly stuff the language itself holds up nicely
07:43:23FromDiscord<4zv4l> there are two DEBUG in the array ?
07:43:38*azimut quit (Ping timeout: 240 seconds)
07:43:46FromDiscord<Elegantbeef> `lvlAll`
07:44:34FromDiscord<Elegantbeef> I guess they figured that was easier than a `array[range[succ(lvlAll)..lvlNone]]`
07:45:01FromDiscord<Phil> Why make it an array and not a set is more my contemplation
07:47:00FromDiscord<Elegantbeef> Cause it's a Enum -\> String?
07:47:01FromDiscord<Elegantbeef> How does a set work there
07:47:23*Jjp137 quit (Ping timeout: 264 seconds)
07:47:42*Jjp137 joined #nim
07:47:47FromDiscord<Elegantbeef> 4zv4l why dont you just make your own console logger that appends the formatting?
07:48:21FromDiscord<Elegantbeef> Or file logger
07:48:27FromDiscord<Elegantbeef> Whatever you need
07:49:14FromDiscord<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:28FromDiscord<Phil> Why not write a conversion proc that takes the `$enum`, cuts off the "lvl" and capitalizes the rest?
07:49:30FromDiscord<Elegantbeef> Yes `names[yourLvl]`
07:49:39FromDiscord<Elegantbeef> Cause this is Nim and not whatever the fuck that is
07:49:47FromDiscord<Elegantbeef> We have enum indexed arrays, we use them
07:49:51FromDiscord<Phil> That is "reducing data to a single point of truth"
07:50:27FromDiscord<Elegantbeef> It's also doing string operations for literally no reason
07:51:18FromDiscord<Phil> It doesn't really matter for runtime operations, this is a compile-time operation either way
07:51:39FromDiscord<Elegantbeef> Sure and why would you do string operations when you could just write the name out
07:51:43FromDiscord<Phil> And you just removed the risk of somebody forgetting that changing the enum automatically also means adjusting the array underneath
07:52:23FromDiscord<Elegantbeef> At any rate you could just do `lvlAll = "Debug"` and so forth
07:52:27FromDiscord<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:36FromDiscord<Elegantbeef> Oh god
07:52:43FromDiscord<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:00FromDiscord<Elegantbeef> They're within 10 lines of code of eachother
07:53:09FromDiscord<4zv4l> I tried to specify the `{.locks: 0}` but it doesn't go away
07:53:10FromDiscord<Elegantbeef> You ignore it cause lock levels don't matter
07:53:25FromDiscord<Elegantbeef> Like I said though just make your own logger using inheritance
07:53:48FromDiscord<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:50FromDiscord<4zv4l> or there is this function in std/logging `substituteLog`
07:54:03FromDiscord<Elegantbeef> What?
07:54:17FromDiscord<4zv4l> https://nim-lang.org/docs/logging.html#substituteLog%2Cstring%2CLevel%2Cvarargs%5Bstring%2C%5D
07:54:18FromDiscord<4zv4l> here
07:54:19FromDiscord<Elegantbeef> Even with `lvlAll = "Debug"` enums are still ordinals
07:54:41FromDiscord<Elegantbeef> Phil you're being too clever
07:54:45FromDiscord<Elegantbeef> Never be too clever
07:55:16FromDiscord<Phil> That has nothing to do with clever, wth
07:55:57FromDiscord<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:10FromDiscord<Elegantbeef> some joker could write `lvlAll = "someUselessString"`
07:56:29FromDiscord<Elegantbeef> And now `lvlAll` if it gets through logs `SomeUselessString` 😄
07:57:52FromDiscord<Phil> That was solely on the basis of how much time you have for a refactor
08:01:31FromDiscord<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:05FromDiscord<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:36FromDiscord<Elegantbeef> You have to understand what that proc is doing and the importance of it 😄
08:02:56FromDiscord<Phil> That is still going to be more stable than the enum array combo every time.
08:03:36FromDiscord<Elegantbeef> Yes more stable assuming everything goes your way
08:04:00FromDiscord<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:06FromDiscord<Elegantbeef> someone doesnt label the enum `lvl...` or if they do `lvlName = "..."` and it suddenly fails
08:06:28FromDiscord<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:02FromDiscord<Elegantbeef> Pointless meandering aside @4zv4l https://play.nim-lang.org/#ix=4zzd
08:08:12FromDiscord<Elegantbeef> Much more sane than doing anything inside `std/logging`
08:11:45FromDiscord<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:18FromDiscord<4zv4l> In reply to @Elegantbeef "Pointless meandering aside <@329196212282458112>": I get an error with the colors 🥹
08:14:42FromDiscord<Elegantbeef> sent a code paste, see https://play.nim-lang.org/#ix=4zze
08:14:55FromDiscord<Elegantbeef> Fix the spelling of grey cause apparently it was added in devel
08:20:18FromDiscord<4zv4l> https://nim-lang.org/docs/terminal.html#progress-bar↵↵what does `cmd: -r:off` means ?
08:21:06FromDiscord<Elegantbeef> Fairly certain that's a hack to get it to render the code but not run it in the docs
08:28:58FromDiscord<4zv4l> any way to replace the first occurence of a word with strutils ?
09:17:56FromDiscord<4zv4l> well just added it↵https://github.com/4zv4l/colored_logger
09:18:24FromDiscord<Elegantbeef> Lol at your comments
09:18:43FromDiscord<Elegantbeef> you can do `[lvlAll: colWhite, lvlDebug: colWhite, ...`
09:22:20NimEventerNew thread by elcritch: Fame and fortune for Nim?, see https://forum.nim-lang.org/t/10315
09:25:39FromDiscord<jeremyjaydan> Hey is this old behaviour? https://media.discordapp.net/attachments/371759389889003532/1124994284815405106/image.png
09:25:52FromDiscord<jeremyjaydan> https://media.discordapp.net/attachments/371759389889003532/1124994338699620383/image.png
09:25:57FromDiscord<jeremyjaydan> https://media.discordapp.net/attachments/371759389889003532/1124994361478877255/image.png
09:26:54FromDiscord<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:15FromDiscord<jeremyjaydan> intuitively I feel like `m.abclev` resulting in `levB` makes sense
09:36:21FromDiscord<ntzeno> sent a code paste, see https://play.nim-lang.org/#ix=4zzH
09:43:10FromDiscord<demotomohiro> In reply to @ntzeno "Hello, how can I": You need to use ref and inheritance or object variants
09:43:32FromDiscord<ntzeno> In reply to @demotomohiro "You need to use": I'll research onto them, ty
09:43:57FromDiscord<demotomohiro> https://nim-lang.org/docs/manual.html#types-reference-and-pointer-types
09:44:40FromDiscord<ntzeno> Thanks a lot!
09:52:49NimEventerNew 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:22FromDiscord<spotlightkid> Nice. But what if some wants to use `$levelid` instead of `$levelname`? @4zv4l↵(<@709044657232936960_=4eim=45venter=5b=49=52=43=5d>)
10:06:08FromDiscord<4zv4l> In reply to @4zv4l "any way to replace": if I find this then I can do it
10:06:18FromDiscord<4zv4l> I made it quickly
10:06:34FromDiscord<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:01FromDiscord<4zv4l> getting close I guess xD↵I added padding as well https://media.discordapp.net/attachments/371759389889003532/1125005196259512330/image.png
10:17:58FromDiscord<spotlightkid> sent a code paste, see https://paste.rs/Yav05
10:18:44FromDiscord<spotlightkid> sent a code paste, see https://play.nim-lang.org/#ix=4zzQ
10:30:07FromDiscord<4zv4l> That indeed seems better
10:30:12FromDiscord<4zv4l> Gonna change that
10:43:08FromDiscord<4zv4l> the `NOTICE` one is annoying
10:43:17FromDiscord<4zv4l> makes a too big space gap to my taste xD
10:47:27*derpydoo quit (Quit: derpydoo)
11:19:55FromDiscord<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:26FromDiscord<intellj_gamer> You could use `os.splitPath` and then lookup that extension in the db via `getMimeType`
11:43:54FromDiscord<intellj_gamer> (edit) "`getMimeType`" => "`mimetypes.getMimeType`"
11:44:26*disso-peach quit (Quit: Leaving)
13:20:45FromDiscord<michaelb.eth> @4zv4l did you have a look at nim-chronicles?↵https://github.com/status-im/nim-chronicles
13:21:37FromDiscord<michaelb.eth> its multi-line `textblocks` format is pretty nice
13:40:14FromDiscord<4zv4l> yeah I had a look but I didn't understand well how to use it and how to remove the `tid`
15:20:18FromDiscord<_alkamist_> If you define `=destroy` for something, do you take on the responsibility of manually freeing any refs that it contains?
15:24:27FromDiscord<_alkamist_> sent a code paste, see https://paste.rs/umpyz
15:36:28*om3ga quit (Read error: Connection reset by peer)
15:48:37FromDiscord<Yardanico> yes, you have to call =destroy on fields yourself
15:49:16FromDiscord<Yardanico> sent a code paste, see https://play.nim-lang.org/#ix=4zBm
15:49:36FromDiscord<_alkamist_> Doesn't that kind of mess with the idea of refs though? Like what if a field is referenced somewhere else?
15:51:05Amun-Rarefcount → refcount - 1
15:51:44FromDiscord<_alkamist_> So does calling `=destroy` just reduce the ref count or something?
15:52:26Amun-Raif the object is referenced multiple times, you won't really destroy it
15:53:04FromDiscord<_alkamist_> Ok so `=destroy` is safe to call on something that is still referenced somewhere else
15:53:19Amun-Rayes
15:53:28FromDiscord<_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:45FromDiscord<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:40FromDiscord<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:54FromDiscord<xrfez> https://gist.github.com/khchen/190bed34c449b8e0a0eead4c005189bf#file-appidpolicyhandler-nim-L34-L37
20:35:54FromDiscord<xrfez> sent a code paste, see https://play.nim-lang.org/#ix=4zCe
20:47:26FromDiscord<System64 ~ Flandre Scarlet> Is there some Fourier Transform libraries please?
20:55:37FromDiscord<that_dude.> Current best best afaik https://nimble.directory/search?query=fft
21:05:30FromDiscord<System64 ~ Flandre Scarlet> In reply to @that_dude. "Current best best afaik": Oh thanks↵And can KissFFT do an inverse FFT?
21:05:49FromDiscord<that_dude.> No idea sorry
21:06:15FromDiscord<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:42FromDiscord<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:58FromDiscord<System64 ~ Flandre Scarlet> I think I should give it a try
21:23:41*derpydoo joined #nim
21:25:26FromDiscord<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:53FromDiscord<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:04FromDiscord<Elegantbeef> It's not in your include path
21:51:29FromDiscord<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:28FromDiscord<Elegantbeef> No clue
21:52:55FromDiscord<System64 ~ Flandre Scarlet> and is it possible to get the path of the Nim file itself?
21:54:17FromDiscord<spotlightkid> `currentSourcePath`
21:56:02*derpydoo quit (Ping timeout: 245 seconds)
21:56:54FromDiscord<spotlightkid> Use `{.passC: ... .}` to pass the include path to the compiler
21:58:51FromDiscord<System64 ~ Flandre Scarlet> I fixed this
21:59:17FromDiscord<System64 ~ Flandre Scarlet> But now I have something even weirder https://media.discordapp.net/attachments/371759389889003532/1125183942350356530/message.txt
22:02:56FromDiscord<spotlightkid> I suggest using a pastebin site (e.g. cpaste.org) to post output and link it here.
22:03:48FromDiscord<System64 ~ Flandre Scarlet> https://pastebin.com/u80kUChP
22:06:40FromDiscord<System64 ~ Flandre Scarlet> This is a weird error
22:20:20FromDiscord<spotlightkid> Without seeing your code we can only guess. Try building a minimal example, which fails.
22:20:24FromDiscord<takemichihanagaki3129> In reply to @hamidb80 "finally did it with": Impressive! What is this package?
22:20:34FromDiscord<takemichihanagaki3129> (edit) "In reply to @hamidb80 "finally did it with": Impressive! What is this package? ... " added "(Or DSL)"
22:21:28FromDiscord<System64 ~ Flandre Scarlet> sent a code paste, see https://paste.rs/WsJ0F
22:23:37FromDiscord<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:08FromDiscord<System64 ~ Flandre Scarlet> Oh↵lemme do this then
22:35:15FromDiscord<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:42FromDiscord<Elegantbeef> `ref T` makes it a heap allocated object with a managed pointer
22:35:52FromDiscord<Elegantbeef> The latter is inheritance
22:36:33FromDiscord<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:44FromDiscord<Elegantbeef> It's a value type
22:36:55FromDiscord<Elegantbeef> So if declared in local scope yes, if declared in a sequence, no
22:37:14FromDiscord<takemichihanagaki3129> In reply to @Elegantbeef "So if declared in": I see!
22:38:32FromDiscord<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:40FromDiscord<System64 ~ Flandre Scarlet> so it works with my MRI, so I messed up somewhere
23:01:54FromDiscord<Chronos [She/Her]> sent a code paste, see https://play.nim-lang.org/#ix=4zCB
23:02:20FromDiscord<Chronos [She/Her]> It's the global config thing
23:02:32FromDiscord<Chronos [She/Her]> I'm assuming that the flag I'm passing is just processed too late?
23:04:49FromDiscord<Chronos [She/Her]> Ah might be a different issue... That's annoying
23:28:37FromDiscord<Chronos [She/Her]> Question: How much of system.nim depends on WASI related stuff?
23:29:01FromDiscord<Chronos [She/Her]> Like, do seqs rely on needing WASI? I'd hope not since there's an allocator in Nim right?
23:30:34FromDiscord<Elegantbeef> if you use `-d:useMalloc` of course not
23:33:16FromDiscord<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:27FromDiscord<Elegantbeef> nim's allocator uses memfiles
23:33:54FromDiscord<Chronos [She/Her]> Also I definitely expect files and stuff to use WASI but hm
23:33:58FromDiscord<Elegantbeef> https://nim-lang.org/docs/nimc.html#nim-for-embedded-systems-nimallocpagesviamalloc
23:34:14FromDiscord<Chronos [She/Her]> Is Nim's allocator written in Nim too?
23:34:16FromDiscord<gamedroit> sent a code paste, see https://paste.rs/Q8BUU
23:34:25FromDiscord<Elegantbeef> Of course
23:34:37FromDiscord<Elegantbeef> No it's not possible to infer the type like that
23:35:07FromDiscord<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:09FromDiscord<Chronos [She/Her]> In reply to @Elegantbeef "https://nim-lang.org/docs/nimc.html#nim-for-embedde": Ah neat
23:35:46FromDiscord<Elegantbeef> At that point you could just write `proc foo(...)`
23:36:16FromDiscord<Elegantbeef> https://github.com/nim-lang/Nim/blob/devel/lib/system/alloc.nim
23:37:16FromDiscord<Chronos [She/Her]> Thanks o7
23:44:01*ntat quit (Quit: Leaving)