<< 08-03-2023 >>

00:03:25FromDiscord<demotomohiro> @Nilts I dont know how it is broken, but if you think so, you probably need to fix code in https://github.com/nim-lang/Nim/tree/devel/lib/packages/docutils
00:06:40FromDiscord<Nilts> In reply to @demotomohiro "<@910899642236043294> I dont know": It is putting normal text in code, and wont render singular lines of code with lang defined
00:11:11FromDiscord<demotomohiro> `rstParse` in `rst.nim` parse RST text and construct rst ast. Then `rstToHtml` in `rstgen.nim` converts rst ast to html string.
00:46:57FromDiscord<Gennadiy> In reply to @ElegantBeef "<@714506728749793330> no clue if": Thanks, I will go through it.
01:53:23FromDiscord<jtv> Reference counting is a form of garbage collection full stop. It got a whole chapter on the first book on garbage collection like 30 years ago. From a theory perspective, they're two sides of a coin. On one side you keep track of live objects, on the other you keep track of dead objects. But there are plenty of real systems that are mostly one but do a bit of the other. Now it's true that reference counting hasn't been as well automated i
01:53:35FromDiscord<jtv> (edit) "Reference counting is a form of garbage collection full stop. It got a whole chapter on the first book on garbage collection like 30 years ago. From a theory perspective, they're two sides of a coin. On one side you keep track of live objects, on the other you keep track of dead objects. But there are plenty of real systems that are mostly one but do a bit of the other. Now it's true that reference counting hasn't been as well aut
01:53:57FromDiscord<Elegantbeef> Yea but some people are antsy about it 😄
01:58:40FromDiscord<jtv> Well if they want to be blissfully ignorant they should just stay quiet 🙂
01:58:57FromDiscord<Elegantbeef> Tell people that say Rust has no GC 😛
02:00:30FromDiscord<jtv> I mean, I don't even bother considering Rust... their answer to making memory management safer than C is to... make it far less readable and harder to use... than C!!
02:00:42FromDiscord<jtv> Rust is the Perl of this millenium
02:00:46FromDiscord<jtv> Write-only
02:21:37FromDiscord<Rika> In reply to @jtv "Rust is the Perl": Ngl I imagined you having a good opinion of rust
02:21:51FromDiscord<jtv> Why? 🙂
02:22:21FromDiscord<jtv> I have done some Rust programming, but I tend not to like languages that are implicitly exclusionary
02:22:46FromDiscord<Rika> I don’t know, just felt like you would have had it
02:23:48FromDiscord<jtv> Rust was my handle on the internet 30 years ago and I have spent that time writing a lot of C while wanting a better statically typed language so I really wanted to like it, but I sure as hell do not 🙂
02:24:32FromDiscord<Elegantbeef> See jtv likes carbon 😛
02:24:58FromDiscord<ieltan> Hello, it is I the Nim noob
02:25:10FromDiscord<Rika> Hello
02:25:53FromDiscord<jtv> Well I don't really like OOP so trying to do a better C++ also doesn't excite me
02:26:26FromDiscord<Elegantbeef> OOP is the future past and present of making code hard to maintain!
02:26:33FromDiscord<jtv> Exactly
02:26:57FromDiscord<Rika> We talking about the bastardised OOP or the “legitimate” OOP
02:27:18FromDiscord<jtv> You familiar with the "Fragile Base Class" problem?
02:27:22FromDiscord<Elegantbeef> The contemporary understanding that everything should be an object that describes what it does
02:27:24FromDiscord<jtv> Doesn't matter which language
02:27:30FromDiscord<ieltan> I just wanted to ask: would using something like `nim-result` in my program in place for exceptions be agasint 'the flow' or would it not be an issue? I am not making a library.
02:27:38FromDiscord<ieltan> (edit) "for" => "of"
02:27:45FromDiscord<Elegantbeef> If it works for you it works for you
02:27:48FromDiscord<Rika> I am
02:27:50FromDiscord<Rika> I think
02:27:59FromDiscord<Elegantbeef> Though i'll judge you since i dislike results
02:28:00FromDiscord<jtv> Data "objects" are good but inheritance should be minimally used at best. Why unnecessarily obfuscale control flow?
02:28:37FromDiscord<ieltan> In reply to @Elegantbeef "Though i'll judge you": Can you tell me why you don't like them?
02:28:54FromDiscord<ieltan> Just want to know about the potential trade-off and all
02:29:22FromDiscord<ieltan> In reply to @haxscramper "1. Not 'deprecated', just": Thanks!
02:29:33FromDiscord<Elegantbeef> They force the programmer to handle them
02:29:34FromDiscord<Rika> In reply to @ieltan "Just want to know": Beef usually cites readability as the issue
02:29:41FromDiscord<Rika> Oh wait that’s prolly Phil
02:29:51FromDiscord<Rika> Beef says explicit use instead
02:29:53FromDiscord<Elegantbeef> If i'm writing code that does not care about exceptions, why the hell do i need to care
02:30:27FromDiscord<Elegantbeef> "Just use `?` or whatever to bubble it up", nice i now need to explicitly say I do not care about an error
02:30:33FromDiscord<Elegantbeef> Exceptions are much better in this regard
02:30:53FromDiscord<Elegantbeef> If you do not care you do not care, if you do you do and with Nim's raises tracking you get the same assurances as results
02:30:56FromDiscord<ieltan> Mmm thats true
02:31:29FromDiscord<huantian> ngl I tried writing rust a bit and I just spammed ? everywhere
02:31:34FromDiscord<ieltan> I am not experience with nim's raise tracking
02:31:39FromDiscord<huantian> but maybe i should try more rust
02:31:40FromDiscord<ieltan> (edit) "experience" => "experienced"
02:31:41FromDiscord<Rika> Yes pretty much what most people do at the start
02:31:46FromDiscord<Rika> Spam ? And unwrap
02:31:55FromDiscord<Elegantbeef> Nim unlike other exception languages has a `raises` list which states what exceptions a function will raise. This means if you want to enforce all errors are handled you can do `proc doThing {.raises: [].}`
02:32:01FromDiscord<Rika> And also forget the difference between the two string type
02:32:04FromDiscord<Rika> (edit) "type" => "types"
02:32:43FromDiscord<Elegantbeef> This raise list is also automatically filled out by procedures, so you do not need to do what java does and annotated procedures
02:32:56FromDiscord<Elegantbeef> It's just generally a better API imo, though there are the performance penalties
02:33:08FromDiscord<Elegantbeef> Exceptions are heap allocated and use inheritance to differentiate
02:33:25FromDiscord<Elegantbeef> This means in the case an exception is raised the code will be slower
02:33:48FromDiscord<ieltan> Are nim exceptions 'costless' at the happy path?
02:33:52FromDiscord<Elegantbeef> Though compiling with `--panics:on` can aid performance a bit
02:34:04FromDiscord<Elegantbeef> In the happy path it's just a nil check
02:34:18FromDiscord<Elegantbeef> `if currentException != nil: goto errorPath`
02:34:27FromDiscord<Rika> I don’t actually understand a scenario where exceptions have big cost in the usual code route
02:34:48FromDiscord<jtv> BTW Rika, this article isn't bad. I thought I'd written a public article on OOP, but I think it must have just been for my old PL class. https://www.tedinski.com/2018/02/13/inheritance-modularity.html
02:35:00FromDiscord<Elegantbeef> The nice thing ieltan is since Nim outputs C you can actually see what exceptions map to
02:35:07FromDiscord<Elegantbeef> That is if you know how to read C
02:35:14FromDiscord<ieltan> In reply to @Elegantbeef "Nim unlike other exception": I need to read up on this raises pragma
02:35:20FromDiscord<Rika> Damn I have way too many articles to read nowadays lol I’ll give it a whirl
02:35:31FromDiscord<Elegantbeef> Raises is really simple, it's just a list of exceptions a function is allowed to raise
02:35:43FromDiscord<Elegantbeef> By default the compiler just infers it's all the exceptions that the procedure raises
02:35:57FromDiscord<ieltan> In reply to @Elegantbeef "That is if you": The only C I have done is high school level 😅
02:36:00FromDiscord<Elegantbeef> When you override the compiler you state "I want to only raise X exceptions"
02:36:02FromDiscord<ieltan> That is
02:36:07FromDiscord<Elegantbeef> I mean i've never wrote C really
02:36:18FromDiscord<Rika> “With such a setup, one can happily cast a struct derived to a struct base and everything is okay. This cute trick was embraced and leveraged into a language feature called inheritance.”↵💀💀💀
02:36:22FromDiscord<ieltan> I can 'read' C but I can hardly follow its semantics
02:36:23FromDiscord<jtv> There are high schools that taught C?? 🙂
02:36:34FromDiscord<Rika> In reply to @jtv "There are high schools": Yes
02:36:38FromDiscord<jtv> I mean, after like 1990
02:36:41FromDiscord<Rika> Pretty poorly I would say
02:36:42FromDiscord<Rika> Yes
02:36:48FromDiscord<jtv> Wow
02:36:56FromDiscord<jtv> Even before '90 it was mainly pascal
02:36:58FromDiscord<ieltan> In reply to @Elegantbeef "I mean i've never": I did read Nim's C output once to debug tho
02:37:03FromDiscord<Rika> I’m no older than 25 and I got C in my high school
02:37:11FromDiscord<Rika> I mean the class, we don’t grade in letters
02:37:12FromDiscord<ieltan> If it just this level of 'reading' comprehension
02:37:15FromDiscord<jtv> What high school was that??
02:37:31FromDiscord<Rika> Well I don’t live in the US so lol
02:37:38FromDiscord<ieltan> Then sure enough for what I had to deal with it wasn't complicated
02:38:18FromDiscord<jtv> Still, that's very unusual! I'm not sure if it's good or its bad 🙂
02:38:23FromDiscord<Rika> I think it’s bad
02:38:28FromDiscord<ieltan> For example Nim generated some c function that had a missing argument for some reason
02:38:29FromDiscord<Rika> Especially since it’s not well taught
02:38:46FromDiscord<Rika> Doubly so that most students don’t pay attention
02:38:49FromDiscord<ieltan> In reply to @jtv "There are high schools": Yes
02:38:54FromDiscord<jtv> Yeah, when I was in high school, you were most likely to get BASIC, and the teacher probably didn't even know it
02:39:00FromDiscord<ieltan> We do some basic albeit practical projects in it
02:39:14FromDiscord<Rika> Programming classes are pretty much worthless at high school level
02:39:23FromDiscord<ieltan> Well that's also true
02:39:34FromDiscord<Rika> No comment on college level
02:39:37FromDiscord<ieltan> But I enjoyed it a little
02:39:47FromDiscord<jtv> IDK, I have seem some good Python classes, often based on Lego Mindstorms 🙂
02:39:53FromDiscord<ieltan> It wasn't what got me started on programming tho
02:40:03FromDiscord<Rika> Wait what the fuck since when did mind storms have python support
02:40:12FromDiscord<jtv> For a long long time
02:40:19FromDiscord<Rika> I’ve only used the NXT model
02:40:23FromDiscord<ieltan> Oh mindstroms!
02:40:32FromDiscord<ieltan> (edit) "mindstroms!" => "mindstorms!"
02:41:00FromDiscord<jtv> You could do Python back with NXT. It wasn't the default (and still isn't), but tends to be what serious people use
02:41:19FromDiscord<jtv> ie, kids who get more serious about competitions, etc
02:41:25FromDiscord<Elegantbeef> Anyway the nice thing is that you can just see the flow without needing to decipher ASM
02:41:42FromDiscord<Elegantbeef> the generated C isnt exactly human readable, but it's a whole hell of a lot more readable than ASM
02:42:07FromDiscord<ieltan> In reply to @Elegantbeef "Anyway the nice thing": Yup! I experienced that
02:42:50FromDiscord<ieltan> Still was pretty surprised I had to dig there but it was a relief when it was relatively painless
02:43:24FromDiscord<ieltan> In reply to @Elegantbeef "the generated C isnt": We don't have an option to make it more readable I assume?
02:43:29FromDiscord<Elegantbeef> Hey it's not too different to having to dig into MIR or LLVMIR to see what the compiler is doing
02:43:35FromDiscord<Elegantbeef> Nope
02:43:44FromDiscord<Rika> In reply to @jtv "You could do Python": Cool
02:44:01FromDiscord<Elegantbeef> You can do `-d:danger` to reduce noise
02:45:22FromDiscord<Elegantbeef> sent a code paste, see https://play.nim-lang.org/#ix=4qdu
02:45:22FromDiscord<Elegantbeef> It's not the most readable
02:45:56FromDiscord<Rika> What the fuck you could also use Ada on the NXT LOL
02:46:12FromDiscord<jtv> LOL 83? Or 90?
02:46:53FromDiscord<ieltan> Didn't know you could write 'Mission-Critical grade' code on the NXT
02:47:13FromDiscord<ieltan> Wait that's spark
02:47:19FromDiscord<Elegantbeef> Hey it's a toy for children, imagine if the low torque motor doesnt stop cause of an overflow
02:47:31FromDiscord<Elegantbeef> You might cause some amount of harm to a child
02:48:15FromDiscord<Rika> Doesn’t say which kind
02:48:24FromDiscord<Rika> I’m just reading this https://en.m.wikipedia.org/wiki/Lego_Mindstorms#Programming_languages
02:51:45FromDiscord<T0lk1en> Hey does anyone know how to connect to tor over nim on windows
02:52:15FromDiscord<T0lk1en> I was looking at the Torim library but I can’t get it to work
03:02:45*lumo_e quit (Ping timeout: 255 seconds)
03:13:22FromDiscord<Nilts> sent a code paste, see https://play.nim-lang.org/#ix=4qdw
03:19:18*tiorock joined #nim
03:19:18*tiorock quit (Changing host)
03:19:18*tiorock joined #nim
03:19:18*rockcavera quit (Killed (tantalum.libera.chat (Nickname regained by services)))
03:19:18*tiorock is now known as rockcavera
03:32:11*derpydoo joined #nim
03:32:51FromDiscord<tfp> is the =destroy hook not called on things created with `let`?
03:33:01FromDiscord<Elegantbeef> It is
03:33:15NimEventerNew post on r/nim by cell_me_C_twos: Connect to tor w nim, see https://reddit.com/r/nim/comments/11ll04c/connect_to_tor_w_nim/
03:33:33FromDiscord<tfp> ok it seems to be, but i can't call it manually
03:33:45FromDiscord<tfp> because =destroy expects var
03:33:49FromDiscord<tfp> so how does nim call it
03:35:03FromDiscord<tfp> also without being able to call the default destructor-- i tried iterating over the fields and calling the `=destroy` hook manually, but if there's a cycle this results in an infinite loop
03:36:14FromDiscord<tfp> wait actually i'm confusing myself, hold up
03:36:23FromDiscord<tfp> ok one at a time
03:36:43FromDiscord<tfp> sent a code paste, see https://play.nim-lang.org/#ix=4qdA
03:36:56FromDiscord<tfp> for some reason the destructor isn't called in this case, i'm using orc
03:37:04FromDiscord<tfp> is that expected?
03:37:15FromDiscord<Elegantbeef> Give me a full example please
03:37:16FromDiscord<tfp> with GC_fullCollect instead of return, it's called no problem
03:37:40FromDiscord<tfp> sent a code paste, see https://play.nim-lang.org/#ix=4qdB
03:37:44FromDiscord<tfp> the rc macro expands to
03:38:10FromDiscord<tfp> the destructor macro expands to
03:38:10FromDiscord<tfp> sent a code paste, see https://paste.rs/s1E
03:38:43FromDiscord<tfp> sent a code paste, see https://play.nim-lang.org/#ix=4qdE
03:40:29FromDiscord<tfp> (edit) "https://play.nim-lang.org/#ix=4qdE" => "https://play.nim-lang.org/#ix=4qdG"
03:47:11FromDiscord<tfp> are cycles not collected immediately?
03:47:26FromDiscord<Elegantbeef> They should be
03:47:45FromDiscord<Elegantbeef> Perhaps they're not
03:51:45FromDiscord<Elegantbeef> I seem to remember araq saying there should be a `RunOrc` or similar so perhaps not
03:53:36FromDiscord<Elegantbeef> Yea there is a `GC_runOrc`
03:53:58*arkurious quit (Quit: Leaving)
03:54:10FromDiscord<tfp> oh
03:54:22FromDiscord<tfp> well shit
03:54:31FromDiscord<Elegantbeef> https://nim-lang.org/blog/2022/11/11/a-cost-model-for-nim.html yea this goes over it
03:55:48FromDiscord<Elegantbeef> What's the "shit" about 😄
03:58:23FromDiscord<tfp> i was planning on relying on deterministic collection to do a few things
03:58:54FromDiscord<tfp> the most important one was logic to handle when all listeners on an observer are dropped
03:59:11FromDiscord<tfp> like Rx style, but in Rx you manually have to unhook a bunch of stuff which is annoying
04:01:07FromDiscord<tfp> it looks like the threshold can be adjusted but i'm skeptical the performance would hold up
04:10:03FromDiscord<tfp> ok that's disappointing but probably can't be helped, all in all it was naive to think it worked like that (even though pretty much everything i read made it sound like it did)
04:10:34FromDiscord<Elegantbeef> To be fair I thought it called orc at the end of the scope if there were any cyclical graphs 😄
04:14:44FromDiscord<tfp> fwiw there are 3 rust crates that implement the same algorithm that nim uses for orc now
04:15:05FromDiscord<tfp> if anyone is interested in that kind of thing
04:15:12FromDiscord<Elegantbeef> Lol
04:15:39FromDiscord<Elegantbeef> Rust no likely cyclical graphs, wonder how much unsafe there
04:17:26FromDiscord<tfp> well you still can't do stuff like hold two mutable refs to the same data
04:17:39FromDiscord<tfp> so it doesn't really feel that useful to have gc in rust anyway imo
04:17:56FromDiscord<tfp> since you kind of get stuck at some point if you're messy with the data anyway
04:18:24FromDiscord<Elegantbeef> Also if you wanted to have it a bit more deterministic you could call a `Gc_RunOrc` in your destructors 😛
04:18:51FromDiscord<tfp> if you could restrict that to just one subgraph i would consider it maybe for a few really important types
04:19:07FromDiscord<tfp> but i think im just gonna forget about using RAII like a madman
04:19:12FromDiscord<tfp> prolly wouldn't have worked out that well anyway
05:02:18FromDiscord<T0lk1en> Yo anyone do tor in i2p. Library isn’t working for me
05:12:45FromDiscord<furtidev> what isn't working?
05:24:14*lumidify joined #nim
05:50:40*rockcavera quit (Remote host closed the connection)
06:10:40*derpydoo quit (Ping timeout: 248 seconds)
06:34:42NimEventerNew thread by Naterlarsen: Compile error “no socket”, see https://forum.nim-lang.org/t/9973
06:47:44*frenchboy[m] joined #nim
06:48:15*advesperacit joined #nim
07:06:18FromDiscord<Elegantbeef> @pietroppeteram I blind, or is there no way(without hacks) to make markdown headers linkable for nimib?
07:07:44FromDiscord<Elegantbeef> I guess the correct term is heading 😄
07:08:48FromDiscord<Elegantbeef> Ah actually using github search i see it's in an issue
07:11:04*kenran joined #nim
07:14:17*azimut_ quit (Ping timeout: 255 seconds)
08:08:21*kenran quit (Remote host closed the connection)
08:08:38*kenran joined #nim
08:43:34FromDiscord<Coachonko> What's a map called in Nim?
08:43:45FromDiscord<Coachonko> Like a key-value structure
08:46:03FromDiscord<Elegantbeef> `std/tables`
08:46:48FromDiscord<Coachonko> Thanks beefman
08:47:44FromDiscord<Coachonko> Why do I have to import std/tables btw? I thought it is a somewhat core collection
08:52:25FromDiscord<ringabout> It seems https://github.com/nim-lang/Nim/pull/21489 fixes lots of endless loop issues. And now they give codegen errors or env not found errors 🤣
09:09:55FromDiscord<Coachonko> If I want a proc to return a table type, how do I annotate it?
09:10:09Zevv_annotate?
09:11:08Zevv_proc foo(): Table[Tkey, Tval]
09:17:40FromDiscord<Coachonko> Alright then I did right
09:17:45FromDiscord<Coachonko> Something else must be wrong
10:12:31*PMunch joined #nim
10:14:01*void09 quit (Ping timeout: 246 seconds)
10:19:11*randomuser464876 joined #nim
10:20:47FromDiscord<Coachonko> Is there a simple way to go from OrderedTableRef to Table?
10:40:25FromDiscord<Coachonko> I've done this but it feels stupid https://media.discordapp.net/attachments/371759389889003532/1082976109043384360/image.png
10:53:41FromDiscord<tandy> how can I specify the gcc compiler with nim? trying to cross compile to armv7
11:00:03Amun-Ra--gcc.exe=gcc --gcc.linkerexe=gcc etc.
11:08:03FromDiscord<tandy> That worked in my config.nims it says\:↵Error\: undeclared identifier\: 'gcc'
11:08:13FromDiscord<tandy> sent a code paste, see https://play.nim-lang.org/#ix=4qeU
11:13:31FromDiscord<tandy> https://forum.nim-lang.org/t/6678
11:13:34FromDiscord<tandy> this helped^
11:17:09*randomuser464876 quit (Quit: Client closed)
11:23:21*randomuser464876 joined #nim
12:00:48FromDiscord<Phil> What is the more beautiful version of this:↵`{1,2,3}.items.toSeq().toHashSet()`↵I know toHashSet works on `openarray`, but `set` does not match `openarray`, to currently I don't see another way
12:00:58FromDiscord<Phil> (edit) "What is the more beautiful version of this:↵`{1,2,3}.items.toSeq().toHashSet()`↵I know toHashSet works on `openarray`, but `set` does not match `openarray`, to currently I don't see another way" => "sent a long message, see http://ix.io/4qf7"
12:01:11FromDiscord<Phil> (edit) "http://ix.io/4qf7" => "http://ix.io/4qf8"
12:09:30PMunchSeems like a silly omission in the hashsets module to not be able to convert a set to a hashset
12:09:35PMunchOn the other hand, why would you have to?
12:11:40FromDiscord<Phil> Users shall be able to instantiate sets of css classes specified via enums.↵It makes no sense to allow repetive CSS classes, so you allow users to do the `set` notation with those enums.
12:12:03FromDiscord<Phil> Fairly special usecase and you shouldn't limit the css-classes via enum in the first place anyway, but I'm just modifying an existing codebase here, not the author
12:12:30PMunchYeah, but why do you have a set in the first place?
12:12:38PMunchWhy not just start by creating a HashSet?
12:12:49PMunchOr just always stay with a set
12:15:05FromDiscord<Phil> Because as a user I'd rather just go `style = {ButtonSuggested, ButtonActive}` than writing the longer one-liner that instantiates the hashset
12:15:44FromDiscord<Phil> In the end all the user wants to do as hand you a set of css classes, ideally strings even, that should be done as simply in syntax as possible because there's no logic in that process
12:15:56FromDiscord<Phil> Other than type conversion logic
12:16:25PMunchWell you could change the syntax to `style = [ButtonSuggested, ButtonActive]` and turn that into a HashSet
12:17:13FromDiscord<ee7> If you wanted a set of ints, consider whether `std/intsets` is more appropriate.
12:17:43PMunchI mean if you want to support strings as custom classes you wouldn't be able to pass them in as a set anyways
12:18:22FromDiscord<ee7> And if you're working with an enum, why shouldn't that be a bitset?
12:18:47FromDiscord<ee7> Also, `std/setutils` has `toSet` and `fullSet`.
12:19:22FromDiscord<Phil> Please allow me to emphasize: Not my codebase, the pattern existed beforehand already, I'm just trying to go with it instead of starting a larger refactor over how that's handled
12:20:22PMunch@ee7, well if they want to allow the user to pass a custom CSS class as a string the bitset wouldn't work (unless you did some trickery with a Custom enum value and out-of-band storage..)
12:28:02PMunch@ee7, had a look at the TOML issue by the way. The testsuite it was tested against has updated past the supported version of the library. Go seems to have changed how they deal with packages, so I couldn't just pin it to an older version without figuring out which Go version to use first. The best solution would of course be to make parsetoml compliant with the latest version of the TOML spec, not sure how much work that would be though
12:29:13*azimut joined #nim
12:29:18*termer quit (Ping timeout: 265 seconds)
12:29:39*termer joined #nim
12:33:37FromDiscord<ee7> @PMunch Yeah, I figured something like that. Passing the 1.0.0 test suite would be great, if it's not too much work. Status' TOML parser does, but it has a large dependency graph due to faststreams/chronos/bearssl IIRC.
12:34:45PMunchYeah I'm not a huge fan of the Status libraries. They typically support more stuff, but are less convenient to use..
12:36:09FromDiscord<ee7> @Phil To answer the original question of how to avoid `items.toSeq().toHashSet()`, you could just write a small proc. I probably haven't understood exactly what's going on, but I'll drop this in case it helps: https://play.nim-lang.org/#ix=4qfm
12:36:15PMunchI'm not the one who wrote the original parser, I just took over maintenance (before it got passed over to NimParsers). So the structure of the parser is a bit foreign to me even after having spent quite a bit of time with it
12:37:27FromDiscord<Phil> In reply to @ee7 "<@180601887916163073> To answer the": It was mostly a "Am I missing the obvious 'nim'-way to do this ?" - question↵As I anticipated there to be some simpler way
12:37:52PMunchMight want to throw in a small `initialSize = s.card` to the `initHashSet` call to make it ever so slightly more performant
12:38:31PMunch@Phil, once you make a PR to add that procedure to the stdlib there will be :)
13:03:59FromDiscord<ee7> To be clear, I'd question whether that should be in the stdlib. `HashSet` of an ordinal type seems like code smell. Is the best argument that it allows you to write `var ints = {1, 2, 3}.toHashSet()` then later `ints.incl n` where `n > 2^16`? (The max size of a `set` is 2^16). But yes, as PMunch mentioned, you can write `[1, 2, 3].toHashSet()`.
13:04:42FromDiscord<ooojpeg> Hey all. I'm just getting started with nim and was wondering if nim is good for gui applications as well as systems apps? Thanks.
13:09:17PMunch@ee7, I agree that it's a weird thing to do, but it feels weirder that you can't do it
13:09:43PMunch@ooojpeg, Nim is good for pretty much anything. The hardest part is probably picking a GUI library, but that's always a pain
13:21:55FromDiscord<ooojpeg> Thanks for your reply. Yeah I know from other languages that it can be a nightmare. Are there any common libs that are good to get started with? ↵(<@709044657232936960_=50=4dunch=5b=49=52=43=5d>)
13:23:25PMunchIt depends a bit on what you want/need
13:23:45PMunchI tend to just use Gtk or WxWidgets if I need a UI
13:26:48*rockcavera joined #nim
13:31:04FromDiscord<ooojpeg> Awesome. Thanks. I have used gtk before so might just stick with something familiar↵(<@709044657232936960_=50=4dunch=5b=49=52=43=5d>)
13:35:30PMunchThen you might want to check this out: https://github.com/PMunch/gtkgenui
13:36:00*xaltsc quit (Ping timeout: 265 seconds)
13:40:52FromDiscord<ShalokShalom> GTK2 is unmaintained?
13:41:15PMunchDoesn't mean it doesn't still work :P
13:41:41PMunchBut if that bothers you there is of course also this option: https://github.com/PMunch/gtkgenui
13:41:49PMunchOops: https://github.com/PMunch/gtk3genui
13:42:08FromDiscord<ShalokShalom> GTK3 is about to become unmaintained 😛
13:47:52*Notxor joined #nim
13:49:26PMunchgtkgenui and gtk3genui is pretty much identical, should be fairly simple to change to gtk4
13:50:29FromDiscord<Takemichi Hanagaki> sent a long message, see http://ix.io/4qfY
13:50:55PMunchNo, that has no impact on performance
13:51:11FromDiscord<Takemichi Hanagaki> Sure, thank you!
13:54:25FromDiscord<ooojpeg> Do you have any other recommendations other than gtk?↵(@ShalokShalom)
14:10:37*xet7 quit (Quit: Leaving)
14:11:49FromDiscord<ShalokShalom> On Nim? No, Owlkettle seems to be a great GTK abstraction
14:12:08FromDiscord<ShalokShalom> And GTK is really still good for at least a couple of years. ↵↵I am joking 😉
14:12:55FromDiscord<ShalokShalom> There is also a Qt Widget and a Qt Quick implementation↵↵I prefer Qt personally, and I see the Owlkettle implementation as superior
14:13:13FromDiscord<ShalokShalom> From very shortly looking 😛
14:13:26FromDiscord<ShalokShalom> Guess there are a couple of others.
14:13:54FromDiscord<Phil> Owlkettle is much talked about and I'm contributing currently to get it to the point where I want it.↵It's easy to get going with imo, but it does have some things missing (or rather: Some things aren't yet clean in a sense, though generally available), like easily customizing CSS classes
14:14:21FromDiscord<Phil> (edit) "Owlkettle is much talked about and I'm contributing currently to get it to the point where I want it.↵It's easy to get going with imo, but it does have some things missing (or rather: Some things aren't yet clean in a sense, though generally available), like easily customizing ... CSS" added "elements with custom"
14:14:33FromDiscord<ShalokShalom> Easily and CSS in one sentence
14:14:34FromDiscord<Phil> And of course: More docs
14:14:47FromDiscord<ShalokShalom> Phil is on a run today 😅
14:14:49FromDiscord<Phil> Though it already has considerable amounts of docs
14:15:03FromDiscord<Phil> In reply to @ShalokShalom "Easily and CSS in": CSS is okay, structuring it is a pain
14:15:14FromDiscord<Phil> But that's typically what you separate stuff into smaller components for
14:22:09FromDiscord<ooojpeg> Thanks for the recommendations. I'll have a play around with a few of them and see how they work.
14:25:55FromDiscord<Phil> Just for reference, if you want a better overview over the owlkettle docs, check out https://philippmdoerner.github.io/owlkettle/README.html↵Those are the future docs for owlkettle.↵Still in PR because the repo owner still has to make an imprint and set some stuff up, but the contents are solid.↵Contains all the various examples and other documentation markdown files in the repository in a handier overview webpage
14:26:13FromDiscord<Phil> (edit) "solid.↵Contains" => "as is what will be merged.↵Contains"
14:26:54FromDiscord<ooojpeg> Great. Thank you. I'll take a look.↵(@Phil)
14:28:07FromDiscord<ShalokShalom> https://github.com/jerous86/nimqt
14:43:25*Notxor quit (Quit: Leaving)
14:48:27FromDiscord<Coachonko> `if not resultTable.hasKey(key):`↵assuming resultTable.hasKey(key) is true, does the statement resolve to false?
14:48:55FromDiscord<Coachonko> Also is it equal to `if !resultTable.hasKey(key):`
14:49:00FromDiscord<Coachonko> (edit) "!resultTable.hasKey(key):`" => "!resultTable.hasKey(key):`?"
14:57:22FromDiscord<Rika> Nim doesn’t have !
14:57:34FromDiscord<Rika> In reply to @Coachonko "`if not resultTable.hasKey(key):` assuming": Yes
14:57:49FromDiscord<ee7> Consider `if key notin resultTable`
14:58:27FromDiscord<Coachonko> In reply to @Rika "Nim doesn’t have !": That's why I am confused owo
14:59:03FromDiscord<Rika> In reply to @Coachonko "That's why I am": Why?
14:59:28FromDiscord<Coachonko> I am just used to flip bools with !
15:00:05FromDiscord<Coachonko> In reply to @ee7 "Consider `if key notin": Is `if not resultTable.hasKey(key):` equal to `if key notin resultTable:`?
15:01:42FromDiscord<Rika> Yes
15:01:57FromDiscord<Coachonko> In reply to @Rika "Why?": There is a `!` here though, does that mean something else https://nim-lang.github.io/Nim/manual.html#lexical-analysis-operators
15:02:09FromDiscord<Rika> Yes
15:02:29FromDiscord<Rika> It means that Nim considers it an operator in lexical analysis (“when the program reads your code”)
15:02:45FromDiscord<Rika> It doesn’t mean that it exists as a boolean flipper in the standard library
15:02:58FromDiscord<Rika> Naturally you can make it yourself
15:05:11FromDiscord<Coachonko> Makes sense thanks
15:05:21FromDiscord<ee7> In reply to @Coachonko "Is `if not resultTable.hasKey(key):`": To expand slightly: yes, it's replaced at compile time by `not contains`: https://github.com/nim-lang/Nim/blob/2f89f1eb780a/lib/system.nim#L729
15:05:25FromDiscord<Rika> sent a code paste, see https://play.nim-lang.org/#ix=4qgi
15:47:06*arkurious joined #nim
15:59:59FromDiscord<Nerve> Is https://github.com/jangko on this server? I want to ask about `msgpack4nim`
16:05:33*kenran quit (Remote host closed the connection)
16:06:58*oddish_ quit (Remote host closed the connection)
16:07:06*oddish joined #nim
16:07:52*lumo_e joined #nim
16:13:21*xet7 joined #nim
16:16:04*xet7 quit (Read error: Connection reset by peer)
16:16:29FromDiscord<tandy> anyone have any good futhark examples?
16:16:29FromDiscord<tandy> I'm struggling a little with the readme one
16:17:11*xet7 joined #nim
16:19:04FromDiscord<jmgomez> what does `callsite` does? First time I saw it, it said it's deprecated
16:19:14*azimut quit (Ping timeout: 255 seconds)
16:19:25FromDiscord<Array in a Matrix> probably better to create an issue asking ur question↵(@Nerve)
16:19:26FromDiscord<jmgomez> (edit) "saw" => "see"
16:21:20*azimut joined #nim
16:24:43*xet7 quit (Ping timeout: 248 seconds)
16:29:56FromDiscord<Phil> In reply to @tandy "anyone have any good": PMunch , do you have a good futhark example for this fellow here?
16:43:35*NimBot joined #nim
16:47:41*Notxor joined #nim
17:13:25FromDiscord<djazz> tandy: what are you wrapping?
17:14:04FromDiscord<tandy> I just realised futhark doesnt work for embedded so no worries \:)
17:14:38FromDiscord<djazz> What?
17:14:46FromDiscord<djazz> I use it on the Raspberry Pico
17:14:49FromDiscord<djazz> https://github.com/daniel-j/nim-picosdk/blob/master/src/picostdlib/lib/cyw43_driver.nim
17:15:06FromDiscord<djazz> For the wifi driver etc
17:27:56*zgasma joined #nim
17:36:40FromDiscord<Hourglass [She/Her]> What's the recommended way to get the first byte of an int32?
17:36:55FromDiscord<Hourglass [She/Her]> I could do a cast, but I want to know if there's a safer way
17:37:33FromDiscord<Phil> Like the 2^0 byte?
17:37:55FromDiscord<Phil> I mean, that stands for the number 1 or 0 in what gets added together at the end.↵If you check if the number is even or not you'll get your answer
17:37:56FromDiscord<enthus1ast> you could map and or shift
17:38:32FromDiscord<Phil> (edit) "byte?" => "bit?"
17:38:41FromDiscord<Phil> Oh wait, you want the entire first of 4 bytes
17:38:49FromDiscord<Hourglass [She/Her]> In reply to @Isofruit "Oh wait, you want": Yeah
17:39:00FromDiscord<Phil> Yeah enthus1ast's suggestion
17:39:11FromDiscord<Hourglass [She/Her]> I'm trying to serialise an int32 to be sent as a VarInt over the network so
17:39:24FromDiscord<Hourglass [She/Her]> In reply to @enthus1ast "you could map and": How does mapping work?
17:39:46FromDiscord<enthus1ast> this i always forget and must google ^^
17:40:23*rockcavera quit (Remote host closed the connection)
17:42:58FromDiscord<Hourglass [She/Her]> It's probably worth noting that `cast[int8]` does exactly what I need in this case
17:43:07FromDiscord<Hourglass [She/Her]> I'll look at mapping now
17:53:39FromDiscord<Hourglass [She/Her]> Good news for pmunch: I can use the plugin system :)
17:53:44FromDiscord<enthus1ast> @Hourglass [She/Her]\: i've played with it a little, https://play.nim-lang.org/#ix=4qh7
17:53:49FromDiscord<Hourglass [She/Her]> ...it'll just need a bit of a rewrite because of the mess it is
17:54:06FromDiscord<enthus1ast> idk maybe just cast to array and call it a day
17:54:15FromDiscord<enthus1ast> but others might know better
17:56:25FromDiscord<Hourglass [She/Her]> In reply to @enthus1ast "<@909883978717204561>\: i've played with": Ah neat! Thanks enthusiast!
17:57:09FromDiscord<Hourglass [She/Her]> Anyone have advice for structuring projects in a way that they're not messy?
17:57:24FromDiscord<enthus1ast> no \:)
17:57:34FromDiscord<Hourglass [She/Her]> Because right now my code is structured very messily 😅
17:57:48FromDiscord<enthus1ast> i think, one person projects tend to be messy
17:58:18FromDiscord<enthus1ast> add one or two others then they usually get better because all must understand the stuff
17:58:19FromDiscord<Hourglass [She/Her]> Definitely but I want to not make it as messy as it was before aha
17:58:28FromDiscord<Hourglass [She/Her]> I have no-one to do it with lmao
17:58:33FromDiscord<enthus1ast> maybe, write tests
17:58:39FromDiscord<enthus1ast> and add them to a testsuite
17:58:49FromDiscord<Hourglass [She/Her]> I don't think I can actually automate the tests with this :p
17:59:07FromDiscord<enthus1ast> this way, you structure you codebase into good chunks
17:59:16FromDiscord<enthus1ast> why not?
17:59:26FromDiscord<Hourglass [She/Her]> Unless I get a bot client too, but that's a bit hard to integrate when there's not one implemented in Nim
17:59:58FromDiscord<Hourglass [She/Her]> Ah, splitting this all up into libraries may actually be a good way to make this nicer
18:00:36FromDiscord<Hourglass [She/Her]> Especially since, they should have a hopefully somewhat stable API lol
18:01:19FromDiscord<Hourglass [She/Her]> In reply to @enthus1ast "why not?": It's for a Minecraft server implementation and I'm not exactly sure how I'd automate it easily
18:01:28FromDiscord<Hourglass [She/Her]> But it's fine, I'll figure it out at some point lol
18:02:08*randomuser464876 quit (Ping timeout: 260 seconds)
18:03:59FromDiscord<enthus1ast> maybe you could add test binary blobs in an seq, that simulate certain kinds of input
18:04:10FromDiscord<enthus1ast> eg "player jumped"
18:04:26FromDiscord<enthus1ast> this you could maybe even record from a real minecraft client
18:04:46FromDiscord<enthus1ast> then you add the outcome of such packages
18:04:56FromDiscord<enthus1ast> and test if your server does the right thing
18:05:03FromDiscord<Rika> https://nim-lang.org/docs/bitops.html
18:05:13FromDiscord<Rika> Use one of the procedures in this module
18:05:19FromDiscord<Rika> Whichever you think is most appropriate
18:07:40FromDiscord<Hourglass [She/Her]> In reply to @enthus1ast "maybe you could add": Oh that is true, I'll likely work on implementing that if possible then
18:09:12FromDiscord<Hourglass [She/Her]> Bit slice may be what I need
18:09:15FromDiscord<Hourglass [She/Her]> Thanks Rika!
18:27:41FromDiscord<Hourglass [She/Her]> For naming, is it better for me to do `decodeNum` or `readNum`? Same thing for `encodeNum` and `writeNum`
18:27:50FromDiscord<Hourglass [She/Her]> I realised I used both for some reason
18:28:31Amun-RaI voute for read it the proc does an actual read
18:28:41Amun-Radecode if it's just decode
18:29:05Amun-Ravote*
18:29:57FromDiscord<Hourglass [She/Her]> It does both ig? Reads a value from a stream/socket and then decodes it into a Nim type
18:31:48*Notxor quit (Remote host closed the connection)
18:38:10FromDiscord<enthus1ast> getNum putNum ?
18:38:14*sforman left #nim (#nim)
18:38:34FromDiscord<enthus1ast> mh its away after the call so maybe get does not fit
18:39:40FromDiscord<Hourglass [She/Her]> Yeaah
18:40:03FromDiscord<Hourglass [She/Her]> I hate naming because of this reason 🤦‍♀️
18:44:34FromDiscord<Rika> readType to read raw data then decode to type
18:45:00FromDiscord<Rika> Have a separate proc to read and return raw data, dont use read type as before
18:45:53FromDiscord<Hourglass [She/Her]> That feels a lot less intuitive than I'd like
18:46:05FromDiscord<Hourglass [She/Her]> I ending up going with `read` and `write`
18:50:57FromDiscord<Rika> I mean that "readType" does both read and decode
18:51:10FromDiscord<Rika> And some other read raw proc does as raw
18:53:22FromDiscord<Hourglass [She/Her]> Ah alright then!
18:58:12FromDiscord<Phil> GUI question into the round
18:59:40FromDiscord<Phil> sent a long message, see http://ix.io/4qhl
19:01:20FromDiscord<Phil> sent a code paste, see https://play.nim-lang.org/#ix=4qhn
19:02:02FromDiscord<Phil> (edit) "https://play.nim-lang.org/#ix=4qhn" => "https://play.nim-lang.org/#ix=4qho"
19:03:58*junaid_ joined #nim
19:04:05FromDiscord<Phil> On the one hand - You get guarantees with the second approach.↵On the other - That's a lot of typing and inflexibility which imo doesn't really lend itself well when you e.g. consider using scss in the future
19:06:39*junaid_ quit (Remote host closed the connection)
19:26:15*ehmry quit (Ping timeout: 260 seconds)
19:27:41*Notxor joined #nim
19:30:07FromDiscord<etra> In reply to @Hourglass, When the Hour Strikes "What's the recommended way": you mean like https://nim-lang.org/docs/bitops.html#testBit%2CT%2CBitsRange%5BT%3A%20SomeInteger%5D?
19:30:09FromDiscord<etra> (edit) "https://nim-lang.org/docs/bitops.html#testBit%2CT%2CBitsRange%5BT%3A%20SomeInteger%5D?" => "https://nim-lang.org/docs/bitops.html#testBit%2CT%2CBitsRange%5BT%3A%20SomeInteger%5D"
19:30:12FromDiscord<etra> (edit) "In reply to @Hourglass, When the Hour Strikes "What's the recommended way": you mean like https://nim-lang.org/docs/bitops.html#testBit%2CT%2CBitsRange%5BT%3A%20SomeInteger%5D ... " added "?"
19:30:40FromDiscord<etra> oh nvmind first byte
20:12:44*rockcavera joined #nim
20:15:41FromDiscord<auxym> https://nim-lang.org/docs/bitops.html#bitsliced%2CT%2CSlice%5Bint%5D
20:16:14FromDiscord<auxym> `x.bitsliced(7..0)`
20:17:03FromDiscord<whisper> How does one start with something like Karax? I think i need a simple grid with rows. I want to implement something like a timeline
20:21:22FromDiscord<4zv4l> any proc in the stdlib to get the smallest
20:21:32FromDiscord<4zv4l> (edit) "any proc in the stdlib to get the smallest ... " added "`float` in a `Table[string, float]` ?"
20:22:04FromDiscord<4zv4l> I see one but only for `CountTable`
20:22:12FromDiscord<hotdog> In reply to @whisper "How does one start": How much html/css do you know?
20:23:05FromDiscord<hotdog> Do you have a data structure you want to display already?
20:31:53FromDiscord<Nerve> Why might I be getting a segfault on `write_file` with `-d:release` on a co-worker's computer, but on that same machine a `--debugger:native` build works fine?
20:32:07FromDiscord<Nerve> (edit) "`write_file`" => "`write_file()`"
20:46:57Amun-Raadd sanitizers and check the result
20:51:25Amun-RaI mean --passc='-fsanitize=address,undefined' --passl='-lasan -lubsan'
20:55:28FromDiscord<whisper> In reply to @hotdog "How much html/css do": Not reall that much. I have a fairly trivial json
20:58:20FromDiscord<hotdog> In reply to @whisper "Not reall that much.": Ok. Should be pretty easy with a table element
21:00:22FromDiscord<hotdog> sent a code paste, see https://play.nim-lang.org/#ix=4qhF
21:01:45FromDiscord<hotdog> If you have problems it may be best to post in #webdev, sometimes web questions get lost in main
21:08:35*junaid_ joined #nim
21:10:44*junaid_ quit (Remote host closed the connection)
21:11:42FromDiscord<Nerve> In reply to @Amun-Ra "I mean --passc='-fsanitize=address,undefined' --pas": Giving this a try, nice to have all of gcc's tools available to me
21:53:34*advesperacit quit ()
22:03:49*azimut_ joined #nim
22:05:42anddamhttps://github.com/dom96/choosenim#windows has "Extract the zip archive and run the runme.bat", I cannot find such batch in the v0.8.4 release zipball
22:05:44*azimut quit (Ping timeout: 255 seconds)
22:06:23anddamI assume I have to get `choosenim-installer-0.8.4_windows_amd64-download-this-not-the-exe.zip`, mostly due to the "download-this-not-the-exe" part
22:06:37anddamI am referencing https://github.com/dom96/choosenim/releases/tag/v0.8.4
22:07:26FromDiscord<Elegantbeef> The runme.bat is at the root of the zip
22:07:34FromDiscord<Elegantbeef> Does windows defender remove ".bat" files?
22:07:40FromDiscord<Elegantbeef> Is this the stage we're at.... 😄
22:10:03FromDiscord<Phil> custom css class support in owlkettle, coming: sooooooon
22:10:38FromDiscord<Phil> Oh? Choosenim? Is it mucking up on windows again?
22:13:20FromDiscord<Elegantbeef> You mean is windows mucking it up
22:23:01anddamElegantbeef: the zip I get has only choosenim.exe inside
22:23:08anddamoh wait
22:23:36anddamI did "extract here" and the archive didn't have a containing folder
22:23:40anddamI blame fucking windows
22:23:53anddamsorry for the noise
22:24:01FromDiscord<Elegantbeef> Windows isnt for developing, it's for pissing people off 😛
22:24:41anddamin fact I am vastly pissed since a few months, cannot wait to ditch this sheet and go to a welcoming linux system
22:30:45FromDiscord<Elegantbeef> For shame!
22:48:59FromDiscord<Nilts> In reply to @not logged in "Anyone know a good": Did anyone answer this? I kinda feel like my messages are not getting thru/i am being ignored
22:51:01*Notxor quit (Remote host closed the connection)
22:51:21FromDiscord<Elegantbeef> You do ask obscure things about JS, a small part of Nim users use the JS backend
22:53:34anddammmm I have been here before, I installed imgui using nimble install https://github.com/nimgl/imgui.git then got the nimgl imgui example https://raw.githubusercontent.com/nimgl/nimgl/master/examples/timgui.nim had to install nimgl for that, then build using `nim c -r timgui.nim`
22:54:22anddam the resulting .exe is missing cimgui.dll
22:54:43anddamam I supposed to clone the repo aside and build the lib? then where should I put the dll?
22:54:49FromDiscord<Nilts> In reply to @Elegantbeef "You do ask obscure": Ok, for my question I only specified js backend because of the timeout handling, which is probably re-creatable in the c backend. So, you don't really need to know the js backend
22:55:06FromDiscord<jmgomez> Why you dont use futures to do it?
22:55:08anddamI figure "near the exe" is fine, but I wonder if there's a proper place in the nim toolchain/nimble package hier I should target
22:55:36FromDiscord<jmgomez> Is this https://rxjs.dev/api/operators/debounce what you are trying to do?
22:56:00FromDiscord<Elegantbeef> You need to use the C++ backend if you do not want to use the `dll`
22:57:11FromDiscord<amadan> sent a code paste, see https://play.nim-lang.org/#ix=4qia
22:58:25FromDiscord<Nilts> In reply to @amadan "Sorry I actually meant": ok, maybe i am stupid and did not compile. Let me re-compile and try again.
23:00:24anddamElegantbeef: hrmmm, more ELI5?
23:00:41FromDiscord<Elegantbeef> `nim cpp -r timgui.nim`
23:00:51anddamIIRC that's because dear imgui is C++ and cimgui is a C binding of that, right?
23:00:54FromDiscord<Elegantbeef> Otherwise you need to build cimgui and ship that
23:01:05FromDiscord<Elegantbeef> Correct
23:01:15anddamok, I just searched "nim imgui" and went with the result
23:01:17FromDiscord<Elegantbeef> nimgl has bindings for the C++ code, but also supports the C-api
23:01:23anddamwhy is nimgl using a C module?
23:01:32anddamI mean if the underlying lib is C++?
23:01:38FromDiscord<Elegantbeef> The Nim C backend uses the C-Api, the Nim C++ backend uses the C++ api
23:01:49FromDiscord<Elegantbeef> Cause Nim has a C and a C++ backend
23:02:15anddamno, yea, that much I figured, I mean why did nimgl use the C backend?
23:02:28FromDiscord<Elegantbeef> The C backend cannot interop with C++ source code, the C++ backend can interop with C++ source code
23:02:29anddamx/backend/ c/binding/
23:02:46FromDiscord<Elegantbeef> Cause `nim c` defualts to the C backend
23:02:57FromDiscord<Elegantbeef> Nimgl supports two apis depending on what backend you're using
23:03:24anddammore than defaults I figure I am just stating it there `nim c`
23:03:42FromDiscord<Elegantbeef> `nim c` is `nim compile`
23:03:44anddamok the demo works, does this actually make some difference for me, the humble developer?
23:03:50FromDiscord<Elegantbeef> You can change in a config the default backend
23:03:54anddamand nim ubernoob?
23:04:16FromDiscord<Elegantbeef> Well the C++ backend is less used, but it generally works
23:04:19anddamI just wanted to toss a desktop GUI there, thought could be the right excuse to try nim
23:04:46FromDiscord<Elegantbeef> C++ and C should behave identically and just work
23:05:00anddamok, in order to provide the C library I get cimgui, somehow build the project, get a .dll and place it where?
23:05:05FromDiscord<Elegantbeef> So it should not matter and you should be able to just write Nim
23:05:21FromDiscord<Elegantbeef> With windows you place the `.dll` next to your binary
23:05:22FromDiscord<Elegantbeef> or in the working path
23:05:35anddammy goal would be write nim, build and embed the GUI lib
23:05:41anddamworking path as in CWD?
23:05:49FromDiscord<Elegantbeef> Well you can just use the C++ backend
23:05:55FromDiscord<Elegantbeef> It does not require a DLL
23:06:03anddamseems easier right now
23:06:15FromDiscord<Elegantbeef> Yes working path as in CWD
23:06:17FromDiscord<Nilts> sent a code paste, see https://play.nim-lang.org/#ix=4qid
23:06:35anddamslightly different topic, I see ocornut/imgui is a separate module and its README mention using that without nimgl
23:06:42FromDiscord<Elegantbeef> If i recall correctly windows library search is. Next to binary, in current working path, in the system32/syswow64 file
23:06:53anddambut I had to get nimgl because the https://raw.githubusercontent.com/nimgl/nimgl/master/examples/timgui.nim source explicitly imports it right?
23:07:00FromDiscord<sOkam!> sent a code paste, see https://play.nim-lang.org/#ix=4qie
23:07:18anddamso I should get acquainted with the API and strip nimgl, then I can just depend on imgui nim library
23:07:30FromDiscord<Elegantbeef> No this is not valid syntax
23:07:32anddamis "libray" the proper term for "stuff you install with nimble"?
23:07:46FromDiscord<amadan> In reply to @not logged in "<@259999449995018240>, I did not": You should be assigning the `inner` outside the function and then calling it inside↵or else it will recreate the timer everytime the `onChange` event is called
23:07:48FromDiscord<Elegantbeef> Get union sokam and it can be valid syntax
23:07:50FromDiscord<sOkam!> In reply to @anddam "so I should get": afaik nimgl offers separate repos for each of the modules 🤔
23:08:02FromDiscord<sOkam!> In reply to @Elegantbeef "Get union sokam and": how? have an example?
23:08:12FromDiscord<Elegantbeef> Get union
23:08:16FromDiscord<Elegantbeef> The package union
23:08:16FromDiscord<Elegantbeef> go down load it and look at it
23:08:34FromDiscord<Elegantbeef> You should be able to use nimgl/imgui by itself without depending on nimgl
23:08:37FromDiscord<amadan> In reply to @amadan "You should be assigning": But I see it needs the data↵Maybe make the `debounce` take an optional timer parameter? And then like create the timer outside the function↵that way every call shares the timer
23:08:48FromDiscord<Elegantbeef> The examples use nimgl since it's easier that way
23:08:56FromDiscord<sOkam!> this? https://github.com/alaviss/union
23:08:56FromDiscord<Nilts> In reply to @amadan "You should be assigning": Let me try something using generics.
23:09:19FromDiscord<Elegantbeef> Yes sokam
23:09:49FromDiscord<Elegantbeef> To use just `nimgl/imgui` it looks like you have to install it using the git url
23:09:57FromDiscord<Elegantbeef> https://github.com/nimgl/imgui#installation following
23:11:08FromDiscord<Elegantbeef> Nim does not have anonymous unions, so you have to either make an object variant or use something like union
23:11:50FromDiscord<Elegantbeef> You could also use OOP if you really wanted to
23:12:00FromDiscord<Elegantbeef> But that's just dumb
23:12:16FromDiscord<Elegantbeef> https://internet-of-tomohiro.netlify.app/nim/faq.en.html#coding-how-to-store-different-types-in-seqqmark
23:12:49FromDiscord<Elegantbeef> In your case you could make a `method uploadUniform` and implement it for each type you support
23:14:26FromDiscord<sOkam!> but the issue is that I won't be storing the data in the uniform
23:14:48FromDiscord<Elegantbeef> Then what is the point of the sequence?
23:15:06FromDiscord<sOkam!> having many uniforms in one shader, whithout explicitely listing them
23:15:58FromDiscord<sOkam!> if explicit, then I would need one type of shader object for each type of rendering pipeline, which seems dummi if the goal is just to store an id and a name
23:16:13anddamElegantbeef: that's what I did, but there's no "read the docs" explaining how to use the binding, so I got the nimgl example
23:16:27FromDiscord<sOkam!> (edit) "id" => "id, a name" | "name" => "typedef"
23:16:35FromDiscord<sOkam!> (edit) "typedef" => "typedesc"
23:16:50FromDiscord<sOkam!> unless typedesc could be stored in some other way 🤷‍♂️
23:17:33FromDiscord<Elegantbeef> typedescs do not exist at runtime
23:17:39FromDiscord<Nilts> In reply to @amadan "But I see it": I will try to make a macro instead.
23:18:32FromDiscord<sOkam!> sounds like union or enum is the way then 😔
23:19:02anddamElegantbeef: thanks
23:19:58FromDiscord<jmgomez> I would recommend you to wrap the timer with a function that returns a future and then it will make it much more easy to reason about. Take a look at the rxjs implementation, it's the same thing
23:20:36FromDiscord<amadan> sent a code paste, see https://play.nim-lang.org/#ix=4qif
23:21:02FromDiscord<amadan> (edit) "https://play.nim-lang.org/#ix=4qif" => "https://play.nim-lang.org/#ix=4qig"
23:28:41FromDiscord<Elegantbeef> Sokam you may want to consider using a tuple for distincting your types
23:28:41FromDiscord<Elegantbeef> `Shader[(float32, float32, Vec2, Vec2, Vec3)]`
23:28:41FromDiscord<Elegantbeef> Or something like that
23:28:42FromDiscord<Elegantbeef> You then can always add in `Shader[(height: float32, theRange: float32, pos: Vec2, Vec2, Vec3)]`
23:30:53FromDiscord<Nilts> In reply to @amadan "think that might be": It works! Thanks!
23:31:31FromDiscord<sOkam!> In reply to @Elegantbeef "`Shader[(float32, float32, Vec2, Vec2,": but that's not compatible with Shader = object, right? 🤔
23:31:42FromDiscord<Elegantbeef> What?
23:32:04FromDiscord<Elegantbeef> `type Shader[T: tuple] = object`
23:32:07FromDiscord<sOkam!> sent a code paste, see https://play.nim-lang.org/#ix=4qik
23:32:09FromDiscord<Elegantbeef> Or use a concept like i do for yeacs to limit it
23:32:25FromDiscord<sOkam!> oh you restrict the type further
23:33:00FromDiscord<Elegantbeef> If you want to statically ensure shaders do not mismatch and also provide the kinds of uniforms(and optionally names) the above is the best you can do
23:33:10FromDiscord<sOkam!> what happens with procs when you pass a restricted type?
23:35:45FromDiscord<sOkam!> sent a code paste, see https://play.nim-lang.org/#ix=4qil
23:35:58FromDiscord<Elegantbeef> It'd error statically
23:36:18FromDiscord<Elegantbeef> It's a type mismatch
23:36:21FromDiscord<Elegantbeef> It's no different to a `seq[int]` and `seq[float]`
23:36:24FromDiscord<Elegantbeef> They're different types
23:36:50FromDiscord<sOkam!> then the library cannot give support for shader generation at all, and it would all be offloaded to the app (which i strongly not want to do)
23:37:03FromDiscord<Elegantbeef> Well then why did you even bring up typedescs
23:37:05FromDiscord<Elegantbeef> You want enums 😄
23:37:21FromDiscord<sOkam!> i thought it might be cleaner, but seems like enums are the way indeed 🙂
23:37:35FromDiscord<Elegantbeef> Types are for static analysis
23:37:45FromDiscord<Elegantbeef> That's their sole reason for existing
23:40:07FromDiscord<sOkam!> is it possible to use typedesc in a case statement in some way? or do i need separate when conditions?
23:40:22FromDiscord<sOkam!> trying but the lsp is saying that i wants an ord 🤔
23:40:24FromDiscord<Elegantbeef> Correct you need when elifs
23:40:29FromDiscord<sOkam!> kk
23:40:57FromDiscord<Elegantbeef> You can use a macro though
23:41:00FromDiscord<Elegantbeef> coughhttps://github.com/beef331/nimtrest/blob/master/staticcases.nim#L59-L63
23:41:22FromDiscord<sOkam!> can you use `int | float` in the when condition at least?
23:41:43FromDiscord<Elegantbeef> `when a is (int or float)` works of course since `int or float` is a type
23:42:02FromDiscord<sOkam!> ✍️
23:42:41FromDiscord<sOkam!> In reply to @Elegantbeef "You can use a": yeah, macros are always the solution 😔↵but my brain not like them ⚰️