00:03:25 | FromDiscord | <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:40 | FromDiscord | <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:11 | FromDiscord | <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:57 | FromDiscord | <Gennadiy> In reply to @ElegantBeef "<@714506728749793330> no clue if": Thanks, I will go through it. |
01:53:23 | FromDiscord | <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:35 | FromDiscord | <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:57 | FromDiscord | <Elegantbeef> Yea but some people are antsy about it 😄 |
01:58:40 | FromDiscord | <jtv> Well if they want to be blissfully ignorant they should just stay quiet 🙂 |
01:58:57 | FromDiscord | <Elegantbeef> Tell people that say Rust has no GC 😛 |
02:00:30 | FromDiscord | <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:42 | FromDiscord | <jtv> Rust is the Perl of this millenium |
02:00:46 | FromDiscord | <jtv> Write-only |
02:21:37 | FromDiscord | <Rika> In reply to @jtv "Rust is the Perl": Ngl I imagined you having a good opinion of rust |
02:21:51 | FromDiscord | <jtv> Why? 🙂 |
02:22:21 | FromDiscord | <jtv> I have done some Rust programming, but I tend not to like languages that are implicitly exclusionary |
02:22:46 | FromDiscord | <Rika> I don’t know, just felt like you would have had it |
02:23:48 | FromDiscord | <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:32 | FromDiscord | <Elegantbeef> See jtv likes carbon 😛 |
02:24:58 | FromDiscord | <ieltan> Hello, it is I the Nim noob |
02:25:10 | FromDiscord | <Rika> Hello |
02:25:53 | FromDiscord | <jtv> Well I don't really like OOP so trying to do a better C++ also doesn't excite me |
02:26:26 | FromDiscord | <Elegantbeef> OOP is the future past and present of making code hard to maintain! |
02:26:33 | FromDiscord | <jtv> Exactly |
02:26:57 | FromDiscord | <Rika> We talking about the bastardised OOP or the “legitimate” OOP |
02:27:18 | FromDiscord | <jtv> You familiar with the "Fragile Base Class" problem? |
02:27:22 | FromDiscord | <Elegantbeef> The contemporary understanding that everything should be an object that describes what it does |
02:27:24 | FromDiscord | <jtv> Doesn't matter which language |
02:27:30 | FromDiscord | <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:38 | FromDiscord | <ieltan> (edit) "for" => "of" |
02:27:45 | FromDiscord | <Elegantbeef> If it works for you it works for you |
02:27:48 | FromDiscord | <Rika> I am |
02:27:50 | FromDiscord | <Rika> I think |
02:27:59 | FromDiscord | <Elegantbeef> Though i'll judge you since i dislike results |
02:28:00 | FromDiscord | <jtv> Data "objects" are good but inheritance should be minimally used at best. Why unnecessarily obfuscale control flow? |
02:28:37 | FromDiscord | <ieltan> In reply to @Elegantbeef "Though i'll judge you": Can you tell me why you don't like them? |
02:28:54 | FromDiscord | <ieltan> Just want to know about the potential trade-off and all |
02:29:22 | FromDiscord | <ieltan> In reply to @haxscramper "1. Not 'deprecated', just": Thanks! |
02:29:33 | FromDiscord | <Elegantbeef> They force the programmer to handle them |
02:29:34 | FromDiscord | <Rika> In reply to @ieltan "Just want to know": Beef usually cites readability as the issue |
02:29:41 | FromDiscord | <Rika> Oh wait that’s prolly Phil |
02:29:51 | FromDiscord | <Rika> Beef says explicit use instead |
02:29:53 | FromDiscord | <Elegantbeef> If i'm writing code that does not care about exceptions, why the hell do i need to care |
02:30:27 | FromDiscord | <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:33 | FromDiscord | <Elegantbeef> Exceptions are much better in this regard |
02:30:53 | FromDiscord | <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:56 | FromDiscord | <ieltan> Mmm thats true |
02:31:29 | FromDiscord | <huantian> ngl I tried writing rust a bit and I just spammed ? everywhere |
02:31:34 | FromDiscord | <ieltan> I am not experience with nim's raise tracking |
02:31:39 | FromDiscord | <huantian> but maybe i should try more rust |
02:31:40 | FromDiscord | <ieltan> (edit) "experience" => "experienced" |
02:31:41 | FromDiscord | <Rika> Yes pretty much what most people do at the start |
02:31:46 | FromDiscord | <Rika> Spam ? And unwrap |
02:31:55 | FromDiscord | <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:01 | FromDiscord | <Rika> And also forget the difference between the two string type |
02:32:04 | FromDiscord | <Rika> (edit) "type" => "types" |
02:32:43 | FromDiscord | <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:56 | FromDiscord | <Elegantbeef> It's just generally a better API imo, though there are the performance penalties |
02:33:08 | FromDiscord | <Elegantbeef> Exceptions are heap allocated and use inheritance to differentiate |
02:33:25 | FromDiscord | <Elegantbeef> This means in the case an exception is raised the code will be slower |
02:33:48 | FromDiscord | <ieltan> Are nim exceptions 'costless' at the happy path? |
02:33:52 | FromDiscord | <Elegantbeef> Though compiling with `--panics:on` can aid performance a bit |
02:34:04 | FromDiscord | <Elegantbeef> In the happy path it's just a nil check |
02:34:18 | FromDiscord | <Elegantbeef> `if currentException != nil: goto errorPath` |
02:34:27 | FromDiscord | <Rika> I don’t actually understand a scenario where exceptions have big cost in the usual code route |
02:34:48 | FromDiscord | <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:00 | FromDiscord | <Elegantbeef> The nice thing ieltan is since Nim outputs C you can actually see what exceptions map to |
02:35:07 | FromDiscord | <Elegantbeef> That is if you know how to read C |
02:35:14 | FromDiscord | <ieltan> In reply to @Elegantbeef "Nim unlike other exception": I need to read up on this raises pragma |
02:35:20 | FromDiscord | <Rika> Damn I have way too many articles to read nowadays lol I’ll give it a whirl |
02:35:31 | FromDiscord | <Elegantbeef> Raises is really simple, it's just a list of exceptions a function is allowed to raise |
02:35:43 | FromDiscord | <Elegantbeef> By default the compiler just infers it's all the exceptions that the procedure raises |
02:35:57 | FromDiscord | <ieltan> In reply to @Elegantbeef "That is if you": The only C I have done is high school level 😅 |
02:36:00 | FromDiscord | <Elegantbeef> When you override the compiler you state "I want to only raise X exceptions" |
02:36:02 | FromDiscord | <ieltan> That is |
02:36:07 | FromDiscord | <Elegantbeef> I mean i've never wrote C really |
02:36:18 | FromDiscord | <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:22 | FromDiscord | <ieltan> I can 'read' C but I can hardly follow its semantics |
02:36:23 | FromDiscord | <jtv> There are high schools that taught C?? 🙂 |
02:36:34 | FromDiscord | <Rika> In reply to @jtv "There are high schools": Yes |
02:36:38 | FromDiscord | <jtv> I mean, after like 1990 |
02:36:41 | FromDiscord | <Rika> Pretty poorly I would say |
02:36:42 | FromDiscord | <Rika> Yes |
02:36:48 | FromDiscord | <jtv> Wow |
02:36:56 | FromDiscord | <jtv> Even before '90 it was mainly pascal |
02:36:58 | FromDiscord | <ieltan> In reply to @Elegantbeef "I mean i've never": I did read Nim's C output once to debug tho |
02:37:03 | FromDiscord | <Rika> I’m no older than 25 and I got C in my high school |
02:37:11 | FromDiscord | <Rika> I mean the class, we don’t grade in letters |
02:37:12 | FromDiscord | <ieltan> If it just this level of 'reading' comprehension |
02:37:15 | FromDiscord | <jtv> What high school was that?? |
02:37:31 | FromDiscord | <Rika> Well I don’t live in the US so lol |
02:37:38 | FromDiscord | <ieltan> Then sure enough for what I had to deal with it wasn't complicated |
02:38:18 | FromDiscord | <jtv> Still, that's very unusual! I'm not sure if it's good or its bad 🙂 |
02:38:23 | FromDiscord | <Rika> I think it’s bad |
02:38:28 | FromDiscord | <ieltan> For example Nim generated some c function that had a missing argument for some reason |
02:38:29 | FromDiscord | <Rika> Especially since it’s not well taught |
02:38:46 | FromDiscord | <Rika> Doubly so that most students don’t pay attention |
02:38:49 | FromDiscord | <ieltan> In reply to @jtv "There are high schools": Yes |
02:38:54 | FromDiscord | <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:00 | FromDiscord | <ieltan> We do some basic albeit practical projects in it |
02:39:14 | FromDiscord | <Rika> Programming classes are pretty much worthless at high school level |
02:39:23 | FromDiscord | <ieltan> Well that's also true |
02:39:34 | FromDiscord | <Rika> No comment on college level |
02:39:37 | FromDiscord | <ieltan> But I enjoyed it a little |
02:39:47 | FromDiscord | <jtv> IDK, I have seem some good Python classes, often based on Lego Mindstorms 🙂 |
02:39:53 | FromDiscord | <ieltan> It wasn't what got me started on programming tho |
02:40:03 | FromDiscord | <Rika> Wait what the fuck since when did mind storms have python support |
02:40:12 | FromDiscord | <jtv> For a long long time |
02:40:19 | FromDiscord | <Rika> I’ve only used the NXT model |
02:40:23 | FromDiscord | <ieltan> Oh mindstroms! |
02:40:32 | FromDiscord | <ieltan> (edit) "mindstroms!" => "mindstorms!" |
02:41:00 | FromDiscord | <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:19 | FromDiscord | <jtv> ie, kids who get more serious about competitions, etc |
02:41:25 | FromDiscord | <Elegantbeef> Anyway the nice thing is that you can just see the flow without needing to decipher ASM |
02:41:42 | FromDiscord | <Elegantbeef> the generated C isnt exactly human readable, but it's a whole hell of a lot more readable than ASM |
02:42:07 | FromDiscord | <ieltan> In reply to @Elegantbeef "Anyway the nice thing": Yup! I experienced that |
02:42:50 | FromDiscord | <ieltan> Still was pretty surprised I had to dig there but it was a relief when it was relatively painless |
02:43:24 | FromDiscord | <ieltan> In reply to @Elegantbeef "the generated C isnt": We don't have an option to make it more readable I assume? |
02:43:29 | FromDiscord | <Elegantbeef> Hey it's not too different to having to dig into MIR or LLVMIR to see what the compiler is doing |
02:43:35 | FromDiscord | <Elegantbeef> Nope |
02:43:44 | FromDiscord | <Rika> In reply to @jtv "You could do Python": Cool |
02:44:01 | FromDiscord | <Elegantbeef> You can do `-d:danger` to reduce noise |
02:45:22 | FromDiscord | <Elegantbeef> sent a code paste, see https://play.nim-lang.org/#ix=4qdu |
02:45:22 | FromDiscord | <Elegantbeef> It's not the most readable |
02:45:56 | FromDiscord | <Rika> What the fuck you could also use Ada on the NXT LOL |
02:46:12 | FromDiscord | <jtv> LOL 83? Or 90? |
02:46:53 | FromDiscord | <ieltan> Didn't know you could write 'Mission-Critical grade' code on the NXT |
02:47:13 | FromDiscord | <ieltan> Wait that's spark |
02:47:19 | FromDiscord | <Elegantbeef> Hey it's a toy for children, imagine if the low torque motor doesnt stop cause of an overflow |
02:47:31 | FromDiscord | <Elegantbeef> You might cause some amount of harm to a child |
02:48:15 | FromDiscord | <Rika> Doesn’t say which kind |
02:48:24 | FromDiscord | <Rika> I’m just reading this https://en.m.wikipedia.org/wiki/Lego_Mindstorms#Programming_languages |
02:51:45 | FromDiscord | <T0lk1en> Hey does anyone know how to connect to tor over nim on windows |
02:52:15 | FromDiscord | <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:22 | FromDiscord | <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:51 | FromDiscord | <tfp> is the =destroy hook not called on things created with `let`? |
03:33:01 | FromDiscord | <Elegantbeef> It is |
03:33:15 | NimEventer | New 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:33 | FromDiscord | <tfp> ok it seems to be, but i can't call it manually |
03:33:45 | FromDiscord | <tfp> because =destroy expects var |
03:33:49 | FromDiscord | <tfp> so how does nim call it |
03:35:03 | FromDiscord | <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:14 | FromDiscord | <tfp> wait actually i'm confusing myself, hold up |
03:36:23 | FromDiscord | <tfp> ok one at a time |
03:36:43 | FromDiscord | <tfp> sent a code paste, see https://play.nim-lang.org/#ix=4qdA |
03:36:56 | FromDiscord | <tfp> for some reason the destructor isn't called in this case, i'm using orc |
03:37:04 | FromDiscord | <tfp> is that expected? |
03:37:15 | FromDiscord | <Elegantbeef> Give me a full example please |
03:37:16 | FromDiscord | <tfp> with GC_fullCollect instead of return, it's called no problem |
03:37:40 | FromDiscord | <tfp> sent a code paste, see https://play.nim-lang.org/#ix=4qdB |
03:37:44 | FromDiscord | <tfp> the rc macro expands to |
03:38:10 | FromDiscord | <tfp> the destructor macro expands to |
03:38:10 | FromDiscord | <tfp> sent a code paste, see https://paste.rs/s1E |
03:38:43 | FromDiscord | <tfp> sent a code paste, see https://play.nim-lang.org/#ix=4qdE |
03:40:29 | FromDiscord | <tfp> (edit) "https://play.nim-lang.org/#ix=4qdE" => "https://play.nim-lang.org/#ix=4qdG" |
03:47:11 | FromDiscord | <tfp> are cycles not collected immediately? |
03:47:26 | FromDiscord | <Elegantbeef> They should be |
03:47:45 | FromDiscord | <Elegantbeef> Perhaps they're not |
03:51:45 | FromDiscord | <Elegantbeef> I seem to remember araq saying there should be a `RunOrc` or similar so perhaps not |
03:53:36 | FromDiscord | <Elegantbeef> Yea there is a `GC_runOrc` |
03:53:58 | * | arkurious quit (Quit: Leaving) |
03:54:10 | FromDiscord | <tfp> oh |
03:54:22 | FromDiscord | <tfp> well shit |
03:54:31 | FromDiscord | <Elegantbeef> https://nim-lang.org/blog/2022/11/11/a-cost-model-for-nim.html yea this goes over it |
03:55:48 | FromDiscord | <Elegantbeef> What's the "shit" about 😄 |
03:58:23 | FromDiscord | <tfp> i was planning on relying on deterministic collection to do a few things |
03:58:54 | FromDiscord | <tfp> the most important one was logic to handle when all listeners on an observer are dropped |
03:59:11 | FromDiscord | <tfp> like Rx style, but in Rx you manually have to unhook a bunch of stuff which is annoying |
04:01:07 | FromDiscord | <tfp> it looks like the threshold can be adjusted but i'm skeptical the performance would hold up |
04:10:03 | FromDiscord | <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:34 | FromDiscord | <Elegantbeef> To be fair I thought it called orc at the end of the scope if there were any cyclical graphs 😄 |
04:14:44 | FromDiscord | <tfp> fwiw there are 3 rust crates that implement the same algorithm that nim uses for orc now |
04:15:05 | FromDiscord | <tfp> if anyone is interested in that kind of thing |
04:15:12 | FromDiscord | <Elegantbeef> Lol |
04:15:39 | FromDiscord | <Elegantbeef> Rust no likely cyclical graphs, wonder how much unsafe there |
04:17:26 | FromDiscord | <tfp> well you still can't do stuff like hold two mutable refs to the same data |
04:17:39 | FromDiscord | <tfp> so it doesn't really feel that useful to have gc in rust anyway imo |
04:17:56 | FromDiscord | <tfp> since you kind of get stuck at some point if you're messy with the data anyway |
04:18:24 | FromDiscord | <Elegantbeef> Also if you wanted to have it a bit more deterministic you could call a `Gc_RunOrc` in your destructors 😛 |
04:18:51 | FromDiscord | <tfp> if you could restrict that to just one subgraph i would consider it maybe for a few really important types |
04:19:07 | FromDiscord | <tfp> but i think im just gonna forget about using RAII like a madman |
04:19:12 | FromDiscord | <tfp> prolly wouldn't have worked out that well anyway |
05:02:18 | FromDiscord | <T0lk1en> Yo anyone do tor in i2p. Library isn’t working for me |
05:12:45 | FromDiscord | <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:42 | NimEventer | New 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:18 | FromDiscord | <Elegantbeef> @pietroppeteram I blind, or is there no way(without hacks) to make markdown headers linkable for nimib? |
07:07:44 | FromDiscord | <Elegantbeef> I guess the correct term is heading 😄 |
07:08:48 | FromDiscord | <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:34 | FromDiscord | <Coachonko> What's a map called in Nim? |
08:43:45 | FromDiscord | <Coachonko> Like a key-value structure |
08:46:03 | FromDiscord | <Elegantbeef> `std/tables` |
08:46:48 | FromDiscord | <Coachonko> Thanks beefman |
08:47:44 | FromDiscord | <Coachonko> Why do I have to import std/tables btw? I thought it is a somewhat core collection |
08:52:25 | FromDiscord | <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:55 | FromDiscord | <Coachonko> If I want a proc to return a table type, how do I annotate it? |
09:10:09 | Zevv_ | annotate? |
09:11:08 | Zevv_ | proc foo(): Table[Tkey, Tval] |
09:17:40 | FromDiscord | <Coachonko> Alright then I did right |
09:17:45 | FromDiscord | <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:47 | FromDiscord | <Coachonko> Is there a simple way to go from OrderedTableRef to Table? |
10:40:25 | FromDiscord | <Coachonko> I've done this but it feels stupid https://media.discordapp.net/attachments/371759389889003532/1082976109043384360/image.png |
10:53:41 | FromDiscord | <tandy> how can I specify the gcc compiler with nim? trying to cross compile to armv7 |
11:00:03 | Amun-Ra | --gcc.exe=gcc --gcc.linkerexe=gcc etc. |
11:08:03 | FromDiscord | <tandy> That worked in my config.nims it says\:↵Error\: undeclared identifier\: 'gcc' |
11:08:13 | FromDiscord | <tandy> sent a code paste, see https://play.nim-lang.org/#ix=4qeU |
11:13:31 | FromDiscord | <tandy> https://forum.nim-lang.org/t/6678 |
11:13:34 | FromDiscord | <tandy> this helped^ |
11:17:09 | * | randomuser464876 quit (Quit: Client closed) |
11:23:21 | * | randomuser464876 joined #nim |
12:00:48 | FromDiscord | <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:58 | FromDiscord | <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:11 | FromDiscord | <Phil> (edit) "http://ix.io/4qf7" => "http://ix.io/4qf8" |
12:09:30 | PMunch | Seems like a silly omission in the hashsets module to not be able to convert a set to a hashset |
12:09:35 | PMunch | On the other hand, why would you have to? |
12:11:40 | FromDiscord | <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:03 | FromDiscord | <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:30 | PMunch | Yeah, but why do you have a set in the first place? |
12:12:38 | PMunch | Why not just start by creating a HashSet? |
12:12:49 | PMunch | Or just always stay with a set |
12:15:05 | FromDiscord | <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:44 | FromDiscord | <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:56 | FromDiscord | <Phil> Other than type conversion logic |
12:16:25 | PMunch | Well you could change the syntax to `style = [ButtonSuggested, ButtonActive]` and turn that into a HashSet |
12:17:13 | FromDiscord | <ee7> If you wanted a set of ints, consider whether `std/intsets` is more appropriate. |
12:17:43 | PMunch | I 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:22 | FromDiscord | <ee7> And if you're working with an enum, why shouldn't that be a bitset? |
12:18:47 | FromDiscord | <ee7> Also, `std/setutils` has `toSet` and `fullSet`. |
12:19:22 | FromDiscord | <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:22 | PMunch | @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:02 | PMunch | @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:37 | FromDiscord | <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:45 | PMunch | Yeah I'm not a huge fan of the Status libraries. They typically support more stuff, but are less convenient to use.. |
12:36:09 | FromDiscord | <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:15 | PMunch | I'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:27 | FromDiscord | <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:52 | PMunch | Might want to throw in a small `initialSize = s.card` to the `initHashSet` call to make it ever so slightly more performant |
12:38:31 | PMunch | @Phil, once you make a PR to add that procedure to the stdlib there will be :) |
13:03:59 | FromDiscord | <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:42 | FromDiscord | <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:17 | PMunch | @ee7, I agree that it's a weird thing to do, but it feels weirder that you can't do it |
13:09:43 | PMunch | @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:55 | FromDiscord | <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:25 | PMunch | It depends a bit on what you want/need |
13:23:45 | PMunch | I tend to just use Gtk or WxWidgets if I need a UI |
13:26:48 | * | rockcavera joined #nim |
13:31:04 | FromDiscord | <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:30 | PMunch | Then you might want to check this out: https://github.com/PMunch/gtkgenui |
13:36:00 | * | xaltsc quit (Ping timeout: 265 seconds) |
13:40:52 | FromDiscord | <ShalokShalom> GTK2 is unmaintained? |
13:41:15 | PMunch | Doesn't mean it doesn't still work :P |
13:41:41 | PMunch | But if that bothers you there is of course also this option: https://github.com/PMunch/gtkgenui |
13:41:49 | PMunch | Oops: https://github.com/PMunch/gtk3genui |
13:42:08 | FromDiscord | <ShalokShalom> GTK3 is about to become unmaintained 😛 |
13:47:52 | * | Notxor joined #nim |
13:49:26 | PMunch | gtkgenui and gtk3genui is pretty much identical, should be fairly simple to change to gtk4 |
13:50:29 | FromDiscord | <Takemichi Hanagaki> sent a long message, see http://ix.io/4qfY |
13:50:55 | PMunch | No, that has no impact on performance |
13:51:11 | FromDiscord | <Takemichi Hanagaki> Sure, thank you! |
13:54:25 | FromDiscord | <ooojpeg> Do you have any other recommendations other than gtk?↵(@ShalokShalom) |
14:10:37 | * | xet7 quit (Quit: Leaving) |
14:11:49 | FromDiscord | <ShalokShalom> On Nim? No, Owlkettle seems to be a great GTK abstraction |
14:12:08 | FromDiscord | <ShalokShalom> And GTK is really still good for at least a couple of years. ↵↵I am joking 😉 |
14:12:55 | FromDiscord | <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:13 | FromDiscord | <ShalokShalom> From very shortly looking 😛 |
14:13:26 | FromDiscord | <ShalokShalom> Guess there are a couple of others. |
14:13:54 | FromDiscord | <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:21 | FromDiscord | <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:33 | FromDiscord | <ShalokShalom> Easily and CSS in one sentence |
14:14:34 | FromDiscord | <Phil> And of course: More docs |
14:14:47 | FromDiscord | <ShalokShalom> Phil is on a run today 😅 |
14:14:49 | FromDiscord | <Phil> Though it already has considerable amounts of docs |
14:15:03 | FromDiscord | <Phil> In reply to @ShalokShalom "Easily and CSS in": CSS is okay, structuring it is a pain |
14:15:14 | FromDiscord | <Phil> But that's typically what you separate stuff into smaller components for |
14:22:09 | FromDiscord | <ooojpeg> Thanks for the recommendations. I'll have a play around with a few of them and see how they work. |
14:25:55 | FromDiscord | <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:13 | FromDiscord | <Phil> (edit) "solid.↵Contains" => "as is what will be merged.↵Contains" |
14:26:54 | FromDiscord | <ooojpeg> Great. Thank you. I'll take a look.↵(@Phil) |
14:28:07 | FromDiscord | <ShalokShalom> https://github.com/jerous86/nimqt |
14:43:25 | * | Notxor quit (Quit: Leaving) |
14:48:27 | FromDiscord | <Coachonko> `if not resultTable.hasKey(key):`↵assuming resultTable.hasKey(key) is true, does the statement resolve to false? |
14:48:55 | FromDiscord | <Coachonko> Also is it equal to `if !resultTable.hasKey(key):` |
14:49:00 | FromDiscord | <Coachonko> (edit) "!resultTable.hasKey(key):`" => "!resultTable.hasKey(key):`?" |
14:57:22 | FromDiscord | <Rika> Nim doesn’t have ! |
14:57:34 | FromDiscord | <Rika> In reply to @Coachonko "`if not resultTable.hasKey(key):` assuming": Yes |
14:57:49 | FromDiscord | <ee7> Consider `if key notin resultTable` |
14:58:27 | FromDiscord | <Coachonko> In reply to @Rika "Nim doesn’t have !": That's why I am confused owo |
14:59:03 | FromDiscord | <Rika> In reply to @Coachonko "That's why I am": Why? |
14:59:28 | FromDiscord | <Coachonko> I am just used to flip bools with ! |
15:00:05 | FromDiscord | <Coachonko> In reply to @ee7 "Consider `if key notin": Is `if not resultTable.hasKey(key):` equal to `if key notin resultTable:`? |
15:01:42 | FromDiscord | <Rika> Yes |
15:01:57 | FromDiscord | <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:09 | FromDiscord | <Rika> Yes |
15:02:29 | FromDiscord | <Rika> It means that Nim considers it an operator in lexical analysis (“when the program reads your code”) |
15:02:45 | FromDiscord | <Rika> It doesn’t mean that it exists as a boolean flipper in the standard library |
15:02:58 | FromDiscord | <Rika> Naturally you can make it yourself |
15:05:11 | FromDiscord | <Coachonko> Makes sense thanks |
15:05:21 | FromDiscord | <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:25 | FromDiscord | <Rika> sent a code paste, see https://play.nim-lang.org/#ix=4qgi |
15:47:06 | * | arkurious joined #nim |
15:59:59 | FromDiscord | <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:29 | FromDiscord | <tandy> anyone have any good futhark examples? |
16:16:29 | FromDiscord | <tandy> I'm struggling a little with the readme one |
16:17:11 | * | xet7 joined #nim |
16:19:04 | FromDiscord | <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:25 | FromDiscord | <Array in a Matrix> probably better to create an issue asking ur question↵(@Nerve) |
16:19:26 | FromDiscord | <jmgomez> (edit) "saw" => "see" |
16:21:20 | * | azimut joined #nim |
16:24:43 | * | xet7 quit (Ping timeout: 248 seconds) |
16:29:56 | FromDiscord | <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:25 | FromDiscord | <djazz> tandy: what are you wrapping? |
17:14:04 | FromDiscord | <tandy> I just realised futhark doesnt work for embedded so no worries \:) |
17:14:38 | FromDiscord | <djazz> What? |
17:14:46 | FromDiscord | <djazz> I use it on the Raspberry Pico |
17:14:49 | FromDiscord | <djazz> https://github.com/daniel-j/nim-picosdk/blob/master/src/picostdlib/lib/cyw43_driver.nim |
17:15:06 | FromDiscord | <djazz> For the wifi driver etc |
17:27:56 | * | zgasma joined #nim |
17:36:40 | FromDiscord | <Hourglass [She/Her]> What's the recommended way to get the first byte of an int32? |
17:36:55 | FromDiscord | <Hourglass [She/Her]> I could do a cast, but I want to know if there's a safer way |
17:37:33 | FromDiscord | <Phil> Like the 2^0 byte? |
17:37:55 | FromDiscord | <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:56 | FromDiscord | <enthus1ast> you could map and or shift |
17:38:32 | FromDiscord | <Phil> (edit) "byte?" => "bit?" |
17:38:41 | FromDiscord | <Phil> Oh wait, you want the entire first of 4 bytes |
17:38:49 | FromDiscord | <Hourglass [She/Her]> In reply to @Isofruit "Oh wait, you want": Yeah |
17:39:00 | FromDiscord | <Phil> Yeah enthus1ast's suggestion |
17:39:11 | FromDiscord | <Hourglass [She/Her]> I'm trying to serialise an int32 to be sent as a VarInt over the network so |
17:39:24 | FromDiscord | <Hourglass [She/Her]> In reply to @enthus1ast "you could map and": How does mapping work? |
17:39:46 | FromDiscord | <enthus1ast> this i always forget and must google ^^ |
17:40:23 | * | rockcavera quit (Remote host closed the connection) |
17:42:58 | FromDiscord | <Hourglass [She/Her]> It's probably worth noting that `cast[int8]` does exactly what I need in this case |
17:43:07 | FromDiscord | <Hourglass [She/Her]> I'll look at mapping now |
17:53:39 | FromDiscord | <Hourglass [She/Her]> Good news for pmunch: I can use the plugin system :) |
17:53:44 | FromDiscord | <enthus1ast> @Hourglass [She/Her]\: i've played with it a little, https://play.nim-lang.org/#ix=4qh7 |
17:53:49 | FromDiscord | <Hourglass [She/Her]> ...it'll just need a bit of a rewrite because of the mess it is |
17:54:06 | FromDiscord | <enthus1ast> idk maybe just cast to array and call it a day |
17:54:15 | FromDiscord | <enthus1ast> but others might know better |
17:56:25 | FromDiscord | <Hourglass [She/Her]> In reply to @enthus1ast "<@909883978717204561>\: i've played with": Ah neat! Thanks enthusiast! |
17:57:09 | FromDiscord | <Hourglass [She/Her]> Anyone have advice for structuring projects in a way that they're not messy? |
17:57:24 | FromDiscord | <enthus1ast> no \:) |
17:57:34 | FromDiscord | <Hourglass [She/Her]> Because right now my code is structured very messily 😅 |
17:57:48 | FromDiscord | <enthus1ast> i think, one person projects tend to be messy |
17:58:18 | FromDiscord | <enthus1ast> add one or two others then they usually get better because all must understand the stuff |
17:58:19 | FromDiscord | <Hourglass [She/Her]> Definitely but I want to not make it as messy as it was before aha |
17:58:28 | FromDiscord | <Hourglass [She/Her]> I have no-one to do it with lmao |
17:58:33 | FromDiscord | <enthus1ast> maybe, write tests |
17:58:39 | FromDiscord | <enthus1ast> and add them to a testsuite |
17:58:49 | FromDiscord | <Hourglass [She/Her]> I don't think I can actually automate the tests with this :p |
17:59:07 | FromDiscord | <enthus1ast> this way, you structure you codebase into good chunks |
17:59:16 | FromDiscord | <enthus1ast> why not? |
17:59:26 | FromDiscord | <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:58 | FromDiscord | <Hourglass [She/Her]> Ah, splitting this all up into libraries may actually be a good way to make this nicer |
18:00:36 | FromDiscord | <Hourglass [She/Her]> Especially since, they should have a hopefully somewhat stable API lol |
18:01:19 | FromDiscord | <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:28 | FromDiscord | <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:59 | FromDiscord | <enthus1ast> maybe you could add test binary blobs in an seq, that simulate certain kinds of input |
18:04:10 | FromDiscord | <enthus1ast> eg "player jumped" |
18:04:26 | FromDiscord | <enthus1ast> this you could maybe even record from a real minecraft client |
18:04:46 | FromDiscord | <enthus1ast> then you add the outcome of such packages |
18:04:56 | FromDiscord | <enthus1ast> and test if your server does the right thing |
18:05:03 | FromDiscord | <Rika> https://nim-lang.org/docs/bitops.html |
18:05:13 | FromDiscord | <Rika> Use one of the procedures in this module |
18:05:19 | FromDiscord | <Rika> Whichever you think is most appropriate |
18:07:40 | FromDiscord | <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:12 | FromDiscord | <Hourglass [She/Her]> Bit slice may be what I need |
18:09:15 | FromDiscord | <Hourglass [She/Her]> Thanks Rika! |
18:27:41 | FromDiscord | <Hourglass [She/Her]> For naming, is it better for me to do `decodeNum` or `readNum`? Same thing for `encodeNum` and `writeNum` |
18:27:50 | FromDiscord | <Hourglass [She/Her]> I realised I used both for some reason |
18:28:31 | Amun-Ra | I voute for read it the proc does an actual read |
18:28:41 | Amun-Ra | decode if it's just decode |
18:29:05 | Amun-Ra | vote* |
18:29:57 | FromDiscord | <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:10 | FromDiscord | <enthus1ast> getNum putNum ? |
18:38:14 | * | sforman left #nim (#nim) |
18:38:34 | FromDiscord | <enthus1ast> mh its away after the call so maybe get does not fit |
18:39:40 | FromDiscord | <Hourglass [She/Her]> Yeaah |
18:40:03 | FromDiscord | <Hourglass [She/Her]> I hate naming because of this reason 🤦♀️ |
18:44:34 | FromDiscord | <Rika> readType to read raw data then decode to type |
18:45:00 | FromDiscord | <Rika> Have a separate proc to read and return raw data, dont use read type as before |
18:45:53 | FromDiscord | <Hourglass [She/Her]> That feels a lot less intuitive than I'd like |
18:46:05 | FromDiscord | <Hourglass [She/Her]> I ending up going with `read` and `write` |
18:50:57 | FromDiscord | <Rika> I mean that "readType" does both read and decode |
18:51:10 | FromDiscord | <Rika> And some other read raw proc does as raw |
18:53:22 | FromDiscord | <Hourglass [She/Her]> Ah alright then! |
18:58:12 | FromDiscord | <Phil> GUI question into the round |
18:59:40 | FromDiscord | <Phil> sent a long message, see http://ix.io/4qhl |
19:01:20 | FromDiscord | <Phil> sent a code paste, see https://play.nim-lang.org/#ix=4qhn |
19:02:02 | FromDiscord | <Phil> (edit) "https://play.nim-lang.org/#ix=4qhn" => "https://play.nim-lang.org/#ix=4qho" |
19:03:58 | * | junaid_ joined #nim |
19:04:05 | FromDiscord | <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:07 | FromDiscord | <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:09 | FromDiscord | <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:12 | FromDiscord | <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:40 | FromDiscord | <etra> oh nvmind first byte |
20:12:44 | * | rockcavera joined #nim |
20:15:41 | FromDiscord | <auxym> https://nim-lang.org/docs/bitops.html#bitsliced%2CT%2CSlice%5Bint%5D |
20:16:14 | FromDiscord | <auxym> `x.bitsliced(7..0)` |
20:17:03 | FromDiscord | <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:22 | FromDiscord | <4zv4l> any proc in the stdlib to get the smallest |
20:21:32 | FromDiscord | <4zv4l> (edit) "any proc in the stdlib to get the smallest ... " added "`float` in a `Table[string, float]` ?" |
20:22:04 | FromDiscord | <4zv4l> I see one but only for `CountTable` |
20:22:12 | FromDiscord | <hotdog> In reply to @whisper "How does one start": How much html/css do you know? |
20:23:05 | FromDiscord | <hotdog> Do you have a data structure you want to display already? |
20:31:53 | FromDiscord | <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:07 | FromDiscord | <Nerve> (edit) "`write_file`" => "`write_file()`" |
20:46:57 | Amun-Ra | add sanitizers and check the result |
20:51:25 | Amun-Ra | I mean --passc='-fsanitize=address,undefined' --passl='-lasan -lubsan' |
20:55:28 | FromDiscord | <whisper> In reply to @hotdog "How much html/css do": Not reall that much. I have a fairly trivial json |
20:58:20 | FromDiscord | <hotdog> In reply to @whisper "Not reall that much.": Ok. Should be pretty easy with a table element |
21:00:22 | FromDiscord | <hotdog> sent a code paste, see https://play.nim-lang.org/#ix=4qhF |
21:01:45 | FromDiscord | <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:42 | FromDiscord | <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:42 | anddam | https://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:23 | anddam | I 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:37 | anddam | I am referencing https://github.com/dom96/choosenim/releases/tag/v0.8.4 |
22:07:26 | FromDiscord | <Elegantbeef> The runme.bat is at the root of the zip |
22:07:34 | FromDiscord | <Elegantbeef> Does windows defender remove ".bat" files? |
22:07:40 | FromDiscord | <Elegantbeef> Is this the stage we're at.... 😄 |
22:10:03 | FromDiscord | <Phil> custom css class support in owlkettle, coming: sooooooon |
22:10:38 | FromDiscord | <Phil> Oh? Choosenim? Is it mucking up on windows again? |
22:13:20 | FromDiscord | <Elegantbeef> You mean is windows mucking it up |
22:23:01 | anddam | Elegantbeef: the zip I get has only choosenim.exe inside |
22:23:08 | anddam | oh wait |
22:23:36 | anddam | I did "extract here" and the archive didn't have a containing folder |
22:23:40 | anddam | I blame fucking windows |
22:23:53 | anddam | sorry for the noise |
22:24:01 | FromDiscord | <Elegantbeef> Windows isnt for developing, it's for pissing people off 😛 |
22:24:41 | anddam | in fact I am vastly pissed since a few months, cannot wait to ditch this sheet and go to a welcoming linux system |
22:30:45 | FromDiscord | <Elegantbeef> For shame! |
22:48:59 | FromDiscord | <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:21 | FromDiscord | <Elegantbeef> You do ask obscure things about JS, a small part of Nim users use the JS backend |
22:53:34 | anddam | mmm 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:22 | anddam | the resulting .exe is missing cimgui.dll |
22:54:43 | anddam | am I supposed to clone the repo aside and build the lib? then where should I put the dll? |
22:54:49 | FromDiscord | <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:06 | FromDiscord | <jmgomez> Why you dont use futures to do it? |
22:55:08 | anddam | I 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:36 | FromDiscord | <jmgomez> Is this https://rxjs.dev/api/operators/debounce what you are trying to do? |
22:56:00 | FromDiscord | <Elegantbeef> You need to use the C++ backend if you do not want to use the `dll` |
22:57:11 | FromDiscord | <amadan> sent a code paste, see https://play.nim-lang.org/#ix=4qia |
22:58:25 | FromDiscord | <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:24 | anddam | Elegantbeef: hrmmm, more ELI5? |
23:00:41 | FromDiscord | <Elegantbeef> `nim cpp -r timgui.nim` |
23:00:51 | anddam | IIRC that's because dear imgui is C++ and cimgui is a C binding of that, right? |
23:00:54 | FromDiscord | <Elegantbeef> Otherwise you need to build cimgui and ship that |
23:01:05 | FromDiscord | <Elegantbeef> Correct |
23:01:15 | anddam | ok, I just searched "nim imgui" and went with the result |
23:01:17 | FromDiscord | <Elegantbeef> nimgl has bindings for the C++ code, but also supports the C-api |
23:01:23 | anddam | why is nimgl using a C module? |
23:01:32 | anddam | I mean if the underlying lib is C++? |
23:01:38 | FromDiscord | <Elegantbeef> The Nim C backend uses the C-Api, the Nim C++ backend uses the C++ api |
23:01:49 | FromDiscord | <Elegantbeef> Cause Nim has a C and a C++ backend |
23:02:15 | anddam | no, yea, that much I figured, I mean why did nimgl use the C backend? |
23:02:28 | FromDiscord | <Elegantbeef> The C backend cannot interop with C++ source code, the C++ backend can interop with C++ source code |
23:02:29 | anddam | x/backend/ c/binding/ |
23:02:46 | FromDiscord | <Elegantbeef> Cause `nim c` defualts to the C backend |
23:02:57 | FromDiscord | <Elegantbeef> Nimgl supports two apis depending on what backend you're using |
23:03:24 | anddam | more than defaults I figure I am just stating it there `nim c` |
23:03:42 | FromDiscord | <Elegantbeef> `nim c` is `nim compile` |
23:03:44 | anddam | ok the demo works, does this actually make some difference for me, the humble developer? |
23:03:50 | FromDiscord | <Elegantbeef> You can change in a config the default backend |
23:03:54 | anddam | and nim ubernoob? |
23:04:16 | FromDiscord | <Elegantbeef> Well the C++ backend is less used, but it generally works |
23:04:19 | anddam | I just wanted to toss a desktop GUI there, thought could be the right excuse to try nim |
23:04:46 | FromDiscord | <Elegantbeef> C++ and C should behave identically and just work |
23:05:00 | anddam | ok, in order to provide the C library I get cimgui, somehow build the project, get a .dll and place it where? |
23:05:05 | FromDiscord | <Elegantbeef> So it should not matter and you should be able to just write Nim |
23:05:21 | FromDiscord | <Elegantbeef> With windows you place the `.dll` next to your binary |
23:05:22 | FromDiscord | <Elegantbeef> or in the working path |
23:05:35 | anddam | my goal would be write nim, build and embed the GUI lib |
23:05:41 | anddam | working path as in CWD? |
23:05:49 | FromDiscord | <Elegantbeef> Well you can just use the C++ backend |
23:05:55 | FromDiscord | <Elegantbeef> It does not require a DLL |
23:06:03 | anddam | seems easier right now |
23:06:15 | FromDiscord | <Elegantbeef> Yes working path as in CWD |
23:06:17 | FromDiscord | <Nilts> sent a code paste, see https://play.nim-lang.org/#ix=4qid |
23:06:35 | anddam | slightly different topic, I see ocornut/imgui is a separate module and its README mention using that without nimgl |
23:06:42 | FromDiscord | <Elegantbeef> If i recall correctly windows library search is. Next to binary, in current working path, in the system32/syswow64 file |
23:06:53 | anddam | but I had to get nimgl because the https://raw.githubusercontent.com/nimgl/nimgl/master/examples/timgui.nim source explicitly imports it right? |
23:07:00 | FromDiscord | <sOkam!> sent a code paste, see https://play.nim-lang.org/#ix=4qie |
23:07:18 | anddam | so I should get acquainted with the API and strip nimgl, then I can just depend on imgui nim library |
23:07:30 | FromDiscord | <Elegantbeef> No this is not valid syntax |
23:07:32 | anddam | is "libray" the proper term for "stuff you install with nimble"? |
23:07:46 | FromDiscord | <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:48 | FromDiscord | <Elegantbeef> Get union sokam and it can be valid syntax |
23:07:50 | FromDiscord | <sOkam!> In reply to @anddam "so I should get": afaik nimgl offers separate repos for each of the modules 🤔 |
23:08:02 | FromDiscord | <sOkam!> In reply to @Elegantbeef "Get union sokam and": how? have an example? |
23:08:12 | FromDiscord | <Elegantbeef> Get union |
23:08:16 | FromDiscord | <Elegantbeef> The package union |
23:08:16 | FromDiscord | <Elegantbeef> go down load it and look at it |
23:08:34 | FromDiscord | <Elegantbeef> You should be able to use nimgl/imgui by itself without depending on nimgl |
23:08:37 | FromDiscord | <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:48 | FromDiscord | <Elegantbeef> The examples use nimgl since it's easier that way |
23:08:56 | FromDiscord | <sOkam!> this? https://github.com/alaviss/union |
23:08:56 | FromDiscord | <Nilts> In reply to @amadan "You should be assigning": Let me try something using generics. |
23:09:19 | FromDiscord | <Elegantbeef> Yes sokam |
23:09:49 | FromDiscord | <Elegantbeef> To use just `nimgl/imgui` it looks like you have to install it using the git url |
23:09:57 | FromDiscord | <Elegantbeef> https://github.com/nimgl/imgui#installation following |
23:11:08 | FromDiscord | <Elegantbeef> Nim does not have anonymous unions, so you have to either make an object variant or use something like union |
23:11:50 | FromDiscord | <Elegantbeef> You could also use OOP if you really wanted to |
23:12:00 | FromDiscord | <Elegantbeef> But that's just dumb |
23:12:16 | FromDiscord | <Elegantbeef> https://internet-of-tomohiro.netlify.app/nim/faq.en.html#coding-how-to-store-different-types-in-seqqmark |
23:12:49 | FromDiscord | <Elegantbeef> In your case you could make a `method uploadUniform` and implement it for each type you support |
23:14:26 | FromDiscord | <sOkam!> but the issue is that I won't be storing the data in the uniform |
23:14:48 | FromDiscord | <Elegantbeef> Then what is the point of the sequence? |
23:15:06 | FromDiscord | <sOkam!> having many uniforms in one shader, whithout explicitely listing them |
23:15:58 | FromDiscord | <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:13 | anddam | Elegantbeef: 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:27 | FromDiscord | <sOkam!> (edit) "id" => "id, a name" | "name" => "typedef" |
23:16:35 | FromDiscord | <sOkam!> (edit) "typedef" => "typedesc" |
23:16:50 | FromDiscord | <sOkam!> unless typedesc could be stored in some other way 🤷♂️ |
23:17:33 | FromDiscord | <Elegantbeef> typedescs do not exist at runtime |
23:17:39 | FromDiscord | <Nilts> In reply to @amadan "But I see it": I will try to make a macro instead. |
23:18:32 | FromDiscord | <sOkam!> sounds like union or enum is the way then 😔 |
23:19:02 | anddam | Elegantbeef: thanks |
23:19:58 | FromDiscord | <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:36 | FromDiscord | <amadan> sent a code paste, see https://play.nim-lang.org/#ix=4qif |
23:21:02 | FromDiscord | <amadan> (edit) "https://play.nim-lang.org/#ix=4qif" => "https://play.nim-lang.org/#ix=4qig" |
23:28:41 | FromDiscord | <Elegantbeef> Sokam you may want to consider using a tuple for distincting your types |
23:28:41 | FromDiscord | <Elegantbeef> `Shader[(float32, float32, Vec2, Vec2, Vec3)]` |
23:28:41 | FromDiscord | <Elegantbeef> Or something like that |
23:28:42 | FromDiscord | <Elegantbeef> You then can always add in `Shader[(height: float32, theRange: float32, pos: Vec2, Vec2, Vec3)]` |
23:30:53 | FromDiscord | <Nilts> In reply to @amadan "think that might be": It works! Thanks! |
23:31:31 | FromDiscord | <sOkam!> In reply to @Elegantbeef "`Shader[(float32, float32, Vec2, Vec2,": but that's not compatible with Shader = object, right? 🤔 |
23:31:42 | FromDiscord | <Elegantbeef> What? |
23:32:04 | FromDiscord | <Elegantbeef> `type Shader[T: tuple] = object` |
23:32:07 | FromDiscord | <sOkam!> sent a code paste, see https://play.nim-lang.org/#ix=4qik |
23:32:09 | FromDiscord | <Elegantbeef> Or use a concept like i do for yeacs to limit it |
23:32:25 | FromDiscord | <sOkam!> oh you restrict the type further |
23:33:00 | FromDiscord | <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:10 | FromDiscord | <sOkam!> what happens with procs when you pass a restricted type? |
23:35:45 | FromDiscord | <sOkam!> sent a code paste, see https://play.nim-lang.org/#ix=4qil |
23:35:58 | FromDiscord | <Elegantbeef> It'd error statically |
23:36:18 | FromDiscord | <Elegantbeef> It's a type mismatch |
23:36:21 | FromDiscord | <Elegantbeef> It's no different to a `seq[int]` and `seq[float]` |
23:36:24 | FromDiscord | <Elegantbeef> They're different types |
23:36:50 | FromDiscord | <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:03 | FromDiscord | <Elegantbeef> Well then why did you even bring up typedescs |
23:37:05 | FromDiscord | <Elegantbeef> You want enums 😄 |
23:37:21 | FromDiscord | <sOkam!> i thought it might be cleaner, but seems like enums are the way indeed 🙂 |
23:37:35 | FromDiscord | <Elegantbeef> Types are for static analysis |
23:37:45 | FromDiscord | <Elegantbeef> That's their sole reason for existing |
23:40:07 | FromDiscord | <sOkam!> is it possible to use typedesc in a case statement in some way? or do i need separate when conditions? |
23:40:22 | FromDiscord | <sOkam!> trying but the lsp is saying that i wants an ord 🤔 |
23:40:24 | FromDiscord | <Elegantbeef> Correct you need when elifs |
23:40:29 | FromDiscord | <sOkam!> kk |
23:40:57 | FromDiscord | <Elegantbeef> You can use a macro though |
23:41:00 | FromDiscord | <Elegantbeef> cough↵https://github.com/beef331/nimtrest/blob/master/staticcases.nim#L59-L63 |
23:41:22 | FromDiscord | <sOkam!> can you use `int | float` in the when condition at least? |
23:41:43 | FromDiscord | <Elegantbeef> `when a is (int or float)` works of course since `int or float` is a type |
23:42:02 | FromDiscord | <sOkam!> ✍️ |
23:42:41 | FromDiscord | <sOkam!> In reply to @Elegantbeef "You can use a": yeah, macros are always the solution 😔↵but my brain not like them ⚰️ |