00:00:18 | * | kayabaNerve joined #nim |
00:04:15 | * | dtomato quit (Quit: The Lounge - https://thelounge.chat) |
00:05:04 | * | dtomato joined #nim |
00:30:49 | * | kayabaNerve quit (Ping timeout: 248 seconds) |
00:34:20 | * | zeus-supreme joined #nim |
00:37:31 | * | zeus-supreme1 quit (Read error: Connection reset by peer) |
00:43:47 | FromDiscord | <TryAngle> sent a code paste, see https://play.nim-lang.org/#ix=3Uvp |
00:43:59 | FromDiscord | <TryAngle> (edit) "https://play.nim-lang.org/#ix=3Uvp" => "https://paste.rs/NpU" |
00:49:32 | FromDiscord | <Generic> yes that should work |
00:50:57 | * | noeontheend joined #nim |
01:20:07 | * | neurocyte8614492 joined #nim |
01:20:30 | * | noeontheend quit (Ping timeout: 268 seconds) |
01:22:21 | * | neurocyte861449 quit (Ping timeout: 268 seconds) |
01:22:21 | * | neurocyte8614492 is now known as neurocyte861449 |
01:28:00 | * | Gustavo6046 joined #nim |
01:38:58 | * | noeontheend joined #nim |
01:52:11 | * | noeontheend quit (Ping timeout: 256 seconds) |
02:03:37 | FromDiscord | <TryAngle> does nim support the builder pattern somehow? I tried it but I cna't get it to work 🤔 |
02:06:08 | FromDiscord | <Elegantbeef> sent a code paste, see https://play.nim-lang.org/#ix=3UvC |
02:06:24 | FromDiscord | <Elegantbeef> You can also use `var MyObject` if you assign to a variable first |
02:08:25 | termer | does anyone know the memory implications of using the insert proc on strings? |
02:08:36 | termer | looking at the implementation, it looks like it uses shallow copy |
02:08:56 | termer | shallowCopy doesn't actually copy the underlying memory, right? |
02:09:08 | * | SamuelMarks quit (Ping timeout: 252 seconds) |
02:09:25 | termer | I'm trying to make a proc that replaces certain characters in a string with something else |
02:09:31 | termer | & => & |
02:09:31 | FromDiscord | <Elegantbeef> it's probably going to allocate once more |
02:09:32 | termer | for example |
02:09:35 | FromDiscord | <TryAngle> ............. |
02:09:36 | termer | hmm |
02:09:40 | FromDiscord | <TryAngle> I did it right the whole time |
02:09:43 | FromDiscord | <TryAngle> I just forgot |
02:09:45 | FromDiscord | <TryAngle> the |
02:09:47 | FromDiscord | <TryAngle> .... |
02:10:04 | termer | I'm fine with reallocating, there's no other way to do it |
02:10:18 | termer | but I'd rather just enlarge the string by allocating more space |
02:10:20 | termer | but not copying anything |
02:10:50 | FromDiscord | <Elegantbeef> Well strings store binary data so it has to copy that |
02:10:55 | termer | if my string is "Tom & Jerry", it's going to initially be 11 bytes but after processing it to "Tom & Jerry" it's going to be 15 |
02:11:27 | FromDiscord | <Rika> In reply to @termer "but I'd rather just": How would you do that? It’s not guaranteed the space next to a string is not used |
02:11:47 | termer | so I will have to copy? |
02:12:02 | FromDiscord | <Elegantbeef> Either you have a buffer certainly larger than your string(not possible given &&&&&&&&&&&&&&&&&&&&&&&&&&& can be a string) or you grow the string |
02:12:03 | FromDiscord | <Elegantbeef> Well yea |
02:12:19 | termer | maybe I can stream the string instead |
02:12:19 | FromDiscord | <Elegantbeef> You want a string to have more data, you need to copy the characters from string A to string B |
02:12:31 | FromDiscord | <Elegantbeef> What is this string for? |
02:12:42 | termer | I'm getting data from a server and rendering it to a webpage |
02:12:48 | termer | the contents needs to be sanitized |
02:13:06 | termer | I want to use as little memory as possible |
02:14:09 | FromDiscord | <Elegantbeef> Replacing is pretty much the only way to go, you could iterate over the string and output the replacement string when you hit the mask string, but that's still going to have a third buffer |
02:15:00 | FromDiscord | <Rika> Ensure that your capacity is big enough for MOST of the time and accept that you will copy for SOME of the time |
02:16:02 | termer | I could do that |
02:16:54 | termer | the question would then be, what's an acceptable percentage extra to allocate |
02:16:59 | termer | guess that takes a bit more research |
02:17:15 | FromDiscord | <Rika> Yeah up to you to figure that out xd |
02:21:08 | termer | ah fuck it I'll just stream the string |
02:21:40 | termer | then I don't have to keep much in memory at all |
02:42:44 | * | arkurious quit (Quit: Leaving) |
02:44:05 | FromDiscord | <aph> sent a code paste, see https://play.nim-lang.org/#ix=3UvI |
02:44:07 | FromDiscord | <aph> i tried debugging and echo result, i got nil |
02:44:12 | FromDiscord | <Elegantbeef> `ref object` |
02:44:21 | FromDiscord | <aph> ohh |
02:44:27 | FromDiscord | <Elegantbeef> `ref Object`s are initialised to `nil` |
02:47:23 | FromDiscord | <aph> so uh, if i remove the `ref` it should work? |
02:48:03 | FromDiscord | <Rika> No |
02:48:26 | FromDiscord | <Rika> Start of the new proc do “result = Bdef1()” |
02:48:38 | FromDiscord | <aph> ohh |
02:48:46 | FromDiscord | <aph> many thanks |
02:49:13 | FromDiscord | <Elegantbeef> or do `BDef1(bone1Index: 1, bone1Weight: 1)` |
02:50:11 | FromDiscord | <aph> thanks 2x! |
03:04:35 | * | v9fk1yn3nu quit (Remote host closed the connection) |
03:19:10 | FromDiscord | <TryAngle> @ElegantBeef u are good with macros / templates I suppose↵can I make a macro / template somehow that takes any proc and runs it, with other content inside it? |
03:19:39 | FromDiscord | <Elegantbeef> You cannot inject code into code that already exists, you can run code after it |
03:21:12 | FromDiscord | <TryAngle> sent a code paste, see https://paste.rs/49R |
03:21:33 | FromDiscord | <Elegantbeef> You dont need macros or templates for that |
03:21:45 | FromDiscord | <Elegantbeef> `prroc run(window: Window, myProc: proc())` |
03:22:32 | FromDiscord | <TryAngle> lol↵thiking abt it I dind't know myself fully what I wanted 🤔 ↵I think this should work thanks! |
03:22:44 | * | rockcavera quit (Remote host closed the connection) |
03:23:45 | FromDiscord | <demotomohiro> You can create a template that run given code block between `window.clear()` and `window.swapBuffers()`. |
03:24:12 | FromDiscord | <Rika> not really needed though if its a proc |
03:24:50 | FromDiscord | <Elegantbeef> There is 0 benefit for using a template |
03:25:01 | FromDiscord | <Elegantbeef> There is nothing in this case a template gives you a proc doesnt |
03:25:08 | FromDiscord | <TryAngle> ah now I remember!! |
03:25:15 | FromDiscord | <TryAngle> I want to type full nim there |
03:25:23 | FromDiscord | <Rika> ?? |
03:25:24 | FromDiscord | <TryAngle> arent' there some restriction to lamdas 🤔 ? |
03:25:33 | FromDiscord | <Elegantbeef> sent a code paste, see https://paste.rs/99G |
03:25:34 | FromDiscord | <Rika> no, this isnt a lambda specificall |
03:25:35 | FromDiscord | <Rika> (edit) "specificall" => "specifically" |
03:25:41 | FromDiscord | <Rika> its just a proc that you pass |
03:25:43 | * | SamuelMarks joined #nim |
03:25:49 | FromDiscord | <Elegantbeef> This is a procedure it can do anything you can type inside that template |
03:26:15 | FromDiscord | <Elegantbeef> The only difference is the template can do things like declare global varaibles |
03:26:29 | FromDiscord | <Elegantbeef> Aside from that they're pretty much 1\:1 parity |
03:26:41 | FromDiscord | <TryAngle> hmmm ok I guess I had an misunderstanding there |
03:26:48 | FromDiscord | <TryAngle> thanks ! 🥺 |
03:27:08 | FromDiscord | <Elegantbeef> Personally for my main loop i have a `proc(dt: float32)` for update and a `proc()` for my draw |
03:27:22 | FromDiscord | <Elegantbeef> Then i just do `program.run(windowSize, update, draw)` |
03:27:41 | FromDiscord | <TryAngle> yes that's what I wanted to do but I kinda mixed everything in my head around for zero |
03:27:42 | FromDiscord | <TryAngle> thanks |
03:27:48 | FromDiscord | <TryAngle> (edit) "yes that's ... what" added "exactly" |
03:28:11 | FromDiscord | <Elegantbeef> https://github.com/beef331/truss3d/blob/master/src/truss3D.nim#L64-L86 if you want reference |
03:29:35 | FromDiscord | <Rika> i dont recall |
03:29:36 | FromDiscord | <Rika> sent a code paste, see https://play.nim-lang.org/#ix=3UvN |
03:30:10 | FromDiscord | <Elegantbeef> Nah with `proc()` it doesnt |
03:30:27 | FromDiscord | <TryAngle> @ElegantBeef small joke question ↵what is ur opinion on the beef programming language? |
03:30:36 | FromDiscord | <Rika> nth time thats been asked |
03:30:39 | FromDiscord | <Elegantbeef> it's C# but lower level |
03:30:55 | FromDiscord | <TryAngle> In reply to @Rika "nth time thats been": I was thinking the same but I had to 😔 |
03:32:14 | FromDiscord | <Elegantbeef> Oh hey they finally changed their icon from that stolen game asset |
03:32:23 | FromDiscord | <creikey> In reply to @TryAngle "<@145405730571288577> small joke question": the installer has a sound effect |
03:32:29 | FromDiscord | <creikey> that is all you need to know imo |
03:33:04 | FromDiscord | <TryAngle> crazy their website almost works completely without any javascript 😳 |
03:33:43 | FromDiscord | <Elegantbeef> https://github.com/beefytech/Beef/issues/14 is my favourite part of it |
03:34:12 | FromDiscord | <Elegantbeef> But jokes aside i dont know it's a C#-like C# isnt the most tremendously ergonomic language imo |
03:35:35 | FromDiscord | <spoon> lol what is that |
03:36:07 | FromDiscord | <Elegantbeef> What is that? |
03:36:42 | FromDiscord | <spoon> the issue |
03:36:58 | FromDiscord | <creikey> In reply to @Elegantbeef "https://github.com/beefytech/Beef/issues/14 is my f": https://media.discordapp.net/attachments/371759389889003532/961469607074484304/unknown.png |
03:37:03 | FromDiscord | <spoon> i think ive heard of that language from gamesfromscratch? |
03:37:09 | FromDiscord | <spoon> In reply to @creikey "": LOL |
03:37:10 | * | xet7 quit (Remote host closed the connection) |
03:38:25 | FromDiscord | <spoon> with nim i get results on how to implement the game of nim in different languages still if i dont put "nim lang" |
03:38:54 | FromDiscord | <Elegantbeef> Wait people search in search engines for solutions? |
03:39:33 | * | xet7 joined #nim |
03:40:18 | FromDiscord | <spoon> what else would i search in for very specific questions |
03:40:41 | * | SamuelMarks quit (Ping timeout: 248 seconds) |
03:41:17 | FromDiscord | <Elegantbeef> Dont search specific questions 😄 |
03:42:36 | FromDiscord | <creikey> In reply to @Elegantbeef "Wait people search in": why do I keep asking you for specific questions, what is the general strategy I can use to solve nim questions? |
03:42:43 | FromDiscord | <creikey> like where do I search for things |
03:42:52 | FromDiscord | <creikey> if not gogole |
03:42:54 | FromDiscord | <creikey> (edit) "gogole" => "google" |
03:43:20 | FromDiscord | <Elegantbeef> I dont follow |
03:43:31 | FromDiscord | <Elegantbeef> If it's nim specific looking here https://nim-lang.org/docs/theindex.html is best imo |
03:46:11 | FromDiscord | <Rika> In reply to @creikey "why do I keep": Look for the general algorithm in a pseudo language |
03:51:11 | FromDiscord | <TryAngle> LOL @ElegantBeef it works 😳 |
03:51:22 | FromDiscord | <TryAngle> thanks 🥺 🙏 https://media.discordapp.net/attachments/371759389889003532/961473233612341288/unknown.png |
03:51:35 | FromDiscord | <Elegantbeef> What'd i do? |
03:51:51 | FromDiscord | <TryAngle> builder pattern↵main loop |
03:52:11 | FromDiscord | <creikey> In reply to @TryAngle "thanks 🥺 🙏": why is there stuff after build |
03:53:06 | FromDiscord | <TryAngle> In reply to @creikey "why is there stuff": based + nimpilled programming style 😎 |
03:53:19 | FromDiscord | <creikey> In reply to @TryAngle "based + nimpilled programming": lol |
03:53:19 | FromDiscord | <TryAngle> no but tbh, I have to construct the GLFW Window |
03:53:50 | FromDiscord | <creikey> nimpilled programming style??? |
03:54:52 | FromDiscord | <Rika> In reply to @creikey "why is there stuff": What do you mean lmao |
03:55:01 | FromDiscord | <TryAngle> In reply to @creikey "nimpilled programming style???": just forget that it's almost 6:00 for me and I'm going crazy 😩 |
03:55:38 | FromDiscord | <Rika> Cringe |
03:55:53 | FromDiscord | <spoon> no nimpilled is in webster dictionary |
03:58:35 | FromDiscord | <TryAngle> In reply to @spoon "no nimpilled is in": it is not 😔 |
03:59:14 | FromDiscord | <spoon> its in the next revision |
03:59:37 | * | slowButPresent quit (Quit: leaving) |
05:06:09 | * | Gustavo6046_ joined #nim |
05:08:03 | * | Gustavo6046 quit (Ping timeout: 268 seconds) |
05:09:09 | nrds | <Prestige99> my god nimble makes no sense |
05:09:43 | FromDiscord | <Elegantbeef> Time to use nimph |
05:10:06 | nrds | <Prestige99> maybe I sohuld |
05:10:07 | nrds | <Prestige99> should |
05:10:19 | FromDiscord | <Elegantbeef> What's your issue today? |
05:11:22 | nrds | <Prestige99> Have an exampleGame dir in my project that lives at the same level as the .nimble file, and this dir isn't being downloaded with my hybrid package (but I want it to) |
05:11:58 | nrds | <Prestige99> Tried defining installDirs but it assumes everything lives in the srcDir, if I remove the srcDir it complains about the package structure |
05:12:25 | FromDiscord | <Rika> Don’t listen to the complainers |
05:12:29 | FromDiscord | <Rika> Complaints I mean |
05:13:17 | FromDiscord | <Elegantbeef> Yea what rika said |
05:13:25 | FromDiscord | <Elegantbeef> Who gives a shit what nimble thinks is correct it's your project |
05:13:45 | nrds | <Prestige99> Mostly worried about it possibly breaking my package in the future |
05:13:49 | FromDiscord | <Rika> There’s bound to be backlash from a few of us if it starts being enforced xd |
05:14:14 | FromDiscord | <Rika> Then would be when we stop recommending nimble at all heh |
05:14:23 | FromDiscord | <Elegantbeef> Well if it does break nimph exists |
05:14:33 | nrds | <Prestige99> Yeah looking into nimph now |
05:14:44 | FromDiscord | <Elegantbeef> It does things nimble cant do like install some of disrupteks packages 😜 |
05:15:35 | FromDiscord | <Rika> ~~and actually work in most of the cases~~ |
05:15:51 | FromDiscord | <Rika> It gets annoying reinstalling packages to the right versions |
05:17:18 | FromDiscord | <TryAngle> is there a way to use nim constants & simple types from C / CPP ? |
05:17:44 | FromDiscord | <Elegantbeef> Primitives are built in with `c` proceding them |
05:17:49 | FromDiscord | <Elegantbeef> `cint` `cfloat` ... |
05:17:59 | FromDiscord | <Elegantbeef> Dont know what you mean about nimconstants |
05:18:01 | FromDiscord | <Rika> Constants no, those disappear from the code Nim generates |
05:18:29 | FromDiscord | <TryAngle> sent a code paste, see https://play.nim-lang.org/#ix=3Uwb |
05:18:39 | FromDiscord | <Rika> No those get inlined into the code |
05:18:53 | FromDiscord | <Elegantbeef> You could do `var` and `exportC` on them |
05:19:01 | FromDiscord | <Rika> Or emit a define |
05:19:02 | FromDiscord | <Elegantbeef> Just to be certain what are we talking about anyway |
05:19:07 | FromDiscord | <Rika> Also known as being cursed |
05:19:12 | FromDiscord | <TryAngle> ok so writing a script is the way then 🤔 |
05:19:18 | FromDiscord | <TryAngle> that translate those to C constants |
05:19:22 | FromDiscord | <Elegantbeef> What are we doing |
05:19:57 | FromDiscord | <TryAngle> a friend of mine is doing something "similar" to me but different, before he rewrites all the constants I've collected I thought we could "share" them |
05:20:26 | FromDiscord | <TryAngle> and he is a C/C++ fanboy |
05:20:38 | FromDiscord | <Elegantbeef> It's ok you can say "he's wrong" |
05:20:45 | FromDiscord | <TryAngle> XD |
05:21:04 | FromDiscord | <TryAngle> no I'm helping him translating them to his fav lang then |
05:21:08 | * | Gustavo6046_ quit (Quit: Goodbye! Leave messages at my XMPP @ [email protected] or my Discord Gustavo6046#9009 or possibly my Mastodon [email protected] – I don't check my email often since it's full of crap, but in any case, [email protected]) |
05:21:26 | FromDiscord | <TryAngle> I don't judge dw |
05:21:27 | FromDiscord | <TryAngle> (mostly) |
05:23:37 | FromDiscord | <TryAngle> different thing,↵does std/json somehow allow autorenames to camelCase, snake case and field ranames? Or do I have to write a proc for that |
05:23:53 | FromDiscord | <TryAngle> (edit) "different thing,↵does std/json somehow allow autorenames to camelCase, snake case and ... field" added "manual" |
05:24:39 | * | kayabaNerve joined #nim |
05:25:12 | FromDiscord | <Elegantbeef> you can use jsonhooks for converting inbetween |
05:25:27 | FromDiscord | <Elegantbeef> https://nim-lang.org/docs/jsonutils.html |
05:28:40 | nrds | <Prestige99> hell |
05:28:55 | nrds | <Prestige99> If I end up writing my own nim package manager I'm going to lose my mind |
05:30:01 | FromDiscord | <TryAngle> In reply to @Elegantbeef "you can use jsonhooks": thanks looks good 👍 |
05:30:03 | nrds | <Prestige99> who am I kidding I lost that a while ago |
05:30:20 | FromDiscord | <TryAngle> In reply to @nrds "<Prestige> If I end": is there an issue with nimble? |
05:31:00 | FromDiscord | <Elegantbeef> Good luck getting anyone to use it prestige |
05:31:47 | FromDiscord | <Elegantbeef> Disruptek has the same isssues |
05:34:10 | nrds | <Prestige99> I don't really care if anyone else uses it tbh |
05:34:13 | nrds | <Prestige99> just need something workign |
05:34:36 | FromDiscord | <Elegantbeef> Then why do you care if the nimble project structure isnt right? |
05:34:49 | nrds | <Prestige99> cuz dom might break it at some point |
05:34:54 | nrds | <Prestige99> or whoever updates it |
05:35:31 | FromDiscord | <Elegantbeef> But if that's the case just use git sub modules and call it a day |
05:35:40 | FromDiscord | <Elegantbeef> Dont need a package manager for that |
05:35:50 | nrds | <Prestige99> perhaps |
05:41:10 | FromDiscord | <Elegantbeef> Atleast you can use nimble until it no longer supports your setup and then move to submodules, though it's been like this for years now with no movement |
05:41:47 | nrds | <Prestige99> I'll have to think about it |
05:42:04 | nrds | <Prestige99> but I think I'm going to just stop using nimble either way |
05:42:11 | FromDiscord | <Elegantbeef> Or you can use nimph and say "use nimph to install it, cause nimble just dont work" |
05:42:38 | FromDiscord | <Elegantbeef> I'd say at most make issues on the nimble repo for this stuff if they presently dont exist to atleast document iiit |
05:48:10 | nrds | <Prestige99> Yeah i'll make some issues |
05:56:37 | FromDiscord | <TryAngle> how does nim serialize Enums? Is there a way to give an enum variant that doesn't match? |
05:56:54 | FromDiscord | <Elegantbeef> What do you mean? |
05:58:26 | FromDiscord | <TryAngle> sent a code paste, see https://paste.rs/t6R |
05:58:30 | FromDiscord | <Elegantbeef> Enums are ordinal values |
05:58:34 | FromDiscord | <TryAngle> (edit) "https://play.nim-lang.org/#ix=3Uwl" => "https://play.nim-lang.org/#ix=3Uwk" |
05:58:48 | FromDiscord | <Elegantbeef> So if `val notin EventType.low.ord..EventType.high` |
05:59:47 | FromDiscord | <TryAngle> 🤔 |
06:00:20 | FromDiscord | <TryAngle> so I do `val notin EventType.Create..EventType.Delete` => `val = EventType.Other` ? |
06:00:28 | FromDiscord | <TryAngle> manually |
06:01:01 | FromDiscord | <Elegantbeef> Sure or you know just raise an exception |
06:01:35 | FromDiscord | <Elegantbeef> there is a `parseEnum[T]` inside `strutils` |
06:01:42 | FromDiscord | <TryAngle> hmmm I will try that once I get there also good idea, raise exception and then "fix that" exception |
06:20:45 | * | PMunch joined #nim |
06:45:34 | FromDiscord | <morgan> so uh it's probably something simple but im getting a really confusing error |
06:46:14 | FromDiscord | <morgan> sent a code paste, see https://play.nim-lang.org/#ix=3Uwp |
06:46:33 | FromDiscord | <morgan> it seems like it's not seeing the other params |
06:47:03 | FromDiscord | <Elegantbeef> `shortname = 'a', callback = foo_a, shared = false` |
06:47:10 | FromDiscord | <Elegantbeef> named parameters use `=` object constructors use `:` |
06:48:00 | FromDiscord | <morgan> oh i see |
06:49:01 | FromDiscord | <morgan> at this point i don't actually need the names since i refaced a ton of procs (took like 15 minutes sigh) but thanks |
06:49:13 | FromDiscord | <Elegantbeef> Yea i dont even see why you have that many add procs |
06:49:47 | FromDiscord | <Elegantbeef> A single add proc that ensures specific values are set seems better to me |
06:50:18 | FromDiscord | <morgan> so there's 3 ways it can have a name (short, long, or both) and two ways it can affect the users' code (setting a reference or calling a callback) |
06:50:23 | FromDiscord | <morgan> and 5 types |
06:50:35 | FromDiscord | <morgan> so 3 2 5 |
06:51:04 | FromDiscord | <morgan> if it needed both names that would def simplify it |
06:51:20 | FromDiscord | <Elegantbeef> sent a code paste, see https://play.nim-lang.org/#ix=3Uwq |
06:52:02 | FromDiscord | <morgan> well the reason is that the flag type is a bit large |
06:52:18 | FromDiscord | <Elegantbeef> So what? |
06:52:27 | FromDiscord | <morgan> there's three sets of variant typing |
06:52:44 | FromDiscord | <Elegantbeef> Ok then |
06:52:46 | FromDiscord | <morgan> idk i felt this would be easier for someone using it |
06:53:10 | FromDiscord | <Elegantbeef> Well if you have constructors for the variants a single add is more ergonomic |
06:53:11 | FromDiscord | <morgan> https://media.discordapp.net/attachments/371759389889003532/961518984665116702/unknown.png |
06:54:33 | FromDiscord | <morgan> and the flags table is (at least atm) accessible outside the file (i think that's the scope sets) so a user could add one manually if they so desired |
06:54:41 | FromDiscord | <morgan> tho i might change that |
06:56:41 | FromDiscord | <Elegantbeef> sent a code paste, see https://play.nim-lang.org/#ix=3Uwr |
06:57:32 | FromDiscord | <Elegantbeef> So you could do `int.newFlagVariant(short = 'a', callback = (proc(a: int) = echo "Hello))` |
06:58:55 | FromDiscord | <morgan> is there a way to make procs chainable, like `object.one(...).two(...)`? |
06:59:06 | FromDiscord | <morgan> i have it returning the object |
06:59:16 | FromDiscord | <morgan> but the second one complains about taking in a proc |
06:59:21 | FromDiscord | <morgan> instead of the object |
07:00:10 | FromDiscord | <Elegantbeef> Actually dont even really need the `flag.valid` assuming you validate it inside the constructor |
07:00:24 | FromDiscord | <Elegantbeef> Yea return the type you want |
07:00:45 | FromDiscord | <Elegantbeef> What are the procedure defiinitions? |
07:00:57 | FromDiscord | <Elegantbeef> Nim's MCS means we get chaning for free |
07:01:08 | FromDiscord | <morgan> wait so i should do return instead of result = |
07:01:20 | FromDiscord | <Elegantbeef> I generally dont |
07:01:34 | FromDiscord | <morgan> like in this case |
07:01:40 | FromDiscord | <morgan> i usually do result = |
07:01:45 | FromDiscord | <Elegantbeef> You only use return when you need it |
07:01:53 | FromDiscord | <Elegantbeef> result is implicitly returned |
07:02:12 | FromDiscord | <Elegantbeef> when i said you return the type, i mean you annotate the proc with the type you're returning |
07:02:22 | FromDiscord | <morgan> i am |
07:02:47 | FromDiscord | <Elegantbeef> Then it should work |
07:02:48 | FromDiscord | <Elegantbeef> Show the error message or proc definitions |
07:02:51 | FromDiscord | <morgan> https://media.discordapp.net/attachments/371759389889003532/961521420318441522/unknown.png |
07:03:04 | FromDiscord | <morgan> https://media.discordapp.net/attachments/371759389889003532/961521477004439592/unknown.png |
07:03:25 | FromDiscord | <Elegantbeef> "is imutable not var" |
07:03:41 | FromDiscord | <Elegantbeef> `var CommandVariant` |
07:03:57 | FromDiscord | <morgan> so `): var CommandVariant`? |
07:04:04 | FromDiscord | <Elegantbeef> This is kinda why this API sucks anyway |
07:04:08 | FromDiscord | <Elegantbeef> Yes |
07:04:17 | FromDiscord | <Elegantbeef> You dont have a `add` that takes a `@[]` |
07:04:24 | FromDiscord | <Elegantbeef> you have this builder pattern for 0 reason |
07:04:35 | * | zeus-supreme1 joined #nim |
07:04:43 | FromDiscord | <morgan> oh yea a seq of them would be handy |
07:04:54 | FromDiscord | <morgan> that would be so many more procs |
07:06:07 | FromDiscord | <morgan> hm actually it could be one add proc that would then delegate to the existing procs |
07:06:26 | FromDiscord | <morgan> tho what it would use as a type the seq contains i dunno |
07:06:39 | FromDiscord | <morgan> cos callback vs reference |
07:07:37 | * | zeus-supreme quit (Ping timeout: 248 seconds) |
07:08:59 | FromDiscord | <Elegantbeef> sent a code paste, see https://paste.rs/pKn |
07:09:17 | * | xet7 quit (Remote host closed the connection) |
07:09:22 | FromDiscord | <Elegantbeef> Just do this type of thing |
07:09:33 | FromDiscord | <Elegantbeef> guess it should be `valBool: val` |
07:10:37 | FromDiscord | <Elegantbeef> sent a code paste, see https://paste.rs/wJw |
07:10:53 | FromDiscord | <Elegantbeef> And that add is just iterating the add of a single value |
07:10:57 | FromDiscord | <Elegantbeef> it composes so much nicer |
07:11:36 | FromDiscord | <Elegantbeef> For shared and the like you can use tuples so `(true, myFlag)` |
07:12:33 | FromDiscord | <morgan> i see i see |
07:13:05 | FromDiscord | <Elegantbeef> `type FlagTypes = int or bool or float or string` if it wasnt clear whatever your object variant supports |
07:21:13 | * | ltriant_ quit (Ping timeout: 260 seconds) |
07:35:27 | * | jjido joined #nim |
07:42:01 | FromDiscord | <aph> is there a `div=` thing btw, i can't seem to find it |
07:42:06 | FromDiscord | <aph> or do i have to manually assign it |
07:42:27 | Amun-Ra | assign to operator? |
07:42:38 | FromDiscord | <aph> yeah |
07:42:49 | Amun-Ra | ah, something like +=? no |
07:42:55 | FromDiscord | <aph> sad |
07:43:24 | FromDiscord | <aph> but i can make a macro for that probably |
07:43:38 | FromDiscord | <Elegantbeef> Jesus people always jump to hydrogen bombs |
07:44:01 | FromDiscord | <aph> 😈 |
07:44:16 | Amun-Ra | `div=` looks like a setter |
07:44:16 | FromDiscord | <Elegantbeef> You cant really though since it'd be `a.div = b` |
07:44:24 | Amun-Ra | ^ |
07:44:50 | FromDiscord | <Elegantbeef> only symbol operators can be used with `=` |
07:45:34 | FromDiscord | <aph> In reply to @Elegantbeef "You cant really though": :( |
07:46:07 | Amun-Ra | you can implement proc somename[T](a: var T, b: T) |
07:46:37 | FromDiscord | <aph> that'd work, but i'm just doing this for 1 thing. probably not needed |
07:46:38 | FromDiscord | <aph> heh |
07:46:42 | Amun-Ra | I'd still prefer a = a mod b |
07:49:58 | * | ltriant joined #nim |
08:12:40 | PMunch | Depends, if a is a C# style name with 17 syllables I prefer the non-repeating version |
08:13:17 | FromDiscord | <Elegantbeef> Didnt know you were writing java |
08:14:33 | PMunch | Haha, I'm unfortunate enough to work with C# at work, and it tends to leak over a bit |
08:19:33 | Amun-Ra | in Java you'd have to setup stream for integer division first in a few levels of nesting |
08:30:07 | * | gsalazar joined #nim |
08:30:40 | * | jjido quit (Quit: My MacBook Air has gone to sleep. ZZZzzz…) |
08:40:07 | * | gsalazar quit (Ping timeout: 260 seconds) |
08:46:08 | FromDiscord | <Zoom> Start with double capacity. BTW, what's Nim strategy on reallocations? How much the capacity grows by? I suppose it doubles.↵(<@709044657232936960_termer=5b=49=52=43=5d>) |
08:46:36 | FromDiscord | <Elegantbeef> It doubles up to a point |
08:46:58 | FromDiscord | <Elegantbeef> It's not documented anywhere but the seq/string logic |
08:48:04 | FromDiscord | <Elegantbeef> It uses a growth pattern that is generally the best |
08:48:36 | FromDiscord | <Zoom> That's what I thought |
08:48:59 | FromDiscord | <Elegantbeef> It should really be documented somewhere but i guess it's considered an implementation detail |
08:49:33 | FromDiscord | <vindaar> iirc it's 3/2, but I'd have to check again |
08:49:47 | FromDiscord | <Elegantbeef> I know it's 2 up to a point with seqv1 |
08:50:27 | * | gsalazar joined #nim |
08:51:00 | FromDiscord | <Elegantbeef> https://github.com/nim-lang/Nim/blob/devel/lib/system/seqs_v2.nim#L50-L97 if you want to look into it |
08:52:02 | FromDiscord | <Elegantbeef> https://github.com/nim-lang/Nim/blob/8ccde68f132be4dba330eb6ec50f4679e564efac/lib/system/strs_v2.nim#L37-L40 |
08:52:15 | FromDiscord | <Elegantbeef> Yea it's 2 up to uint16 then it's 3/2 |
08:52:25 | FromDiscord | <Elegantbeef> Or V2 atleast |
08:52:30 | * | jjido joined #nim |
08:54:00 | FromDiscord | <vindaar> ah, thanks for checking! |
08:54:55 | * | gsalazar quit (Ping timeout: 256 seconds) |
08:55:10 | FromDiscord | <vindaar> I wanted to check locally, but uhhh, something happened I've never experienced. My emacs is in a weird state. Cannot kill it, cannot close it, I can "use" it, but it errors on pretty much everything. wtf |
08:55:24 | FromDiscord | <Elegantbeef> Emacs is bloatfree i heard |
08:55:27 | FromDiscord | <vindaar> haha |
08:56:03 | FromDiscord | <vindaar> it's like your computer tells you "oh sorry I cannot find that shutdown executable!" |
08:56:17 | FromDiscord | <vindaar> that's what they do when they become sentient |
08:57:13 | * | gsalazar joined #nim |
08:57:15 | FromDiscord | <Zoom> I don't get why Ar@q is so against documenting implementation details. Suppose he wants his head to be free of caring about keeping them in sync? |
08:57:31 | FromDiscord | <Elegantbeef> Not a clue |
08:57:49 | FromDiscord | <Elegantbeef> Somethings should be documented and accessible, would be nice to have a readonly `cap` |
08:58:05 | PMunch | Readonly cap would be great |
08:58:35 | PMunch | But yeah, I guess the documentation details aren't documented because then they're assumed to be sorta stable |
08:58:52 | PMunch | So if they change people are going to be mad, because they depended on that behaviour |
08:59:14 | FromDiscord | <vindaar> hell yeah, read only `cap` please |
08:59:20 | FromDiscord | <Elegantbeef> RFC it bitches |
08:59:21 | FromDiscord | <Zoom> How much chance this particular one is going to change like ever?↵(<@709044657232936960_=50=4dunch=5b=49=52=43=5d>) |
08:59:35 | FromDiscord | <Elegantbeef> Zoom there is another str impl somewhere i think |
08:59:35 | * | gsalazar quit (Remote host closed the connection) |
08:59:39 | PMunch | This comes to mind: https://xkcd.com/1172/ |
08:59:41 | FromDiscord | <Elegantbeef> So it looks like it might change |
08:59:47 | * | gsalazar joined #nim |
09:00:38 | FromDiscord | <Zoom> Let's go one step forward\: Please, Views everywhere. |
09:00:39 | FromDiscord | <Elegantbeef> Hey use `openArray[T]` more and that's already a nicer life |
09:01:02 | FromDiscord | <Elegantbeef> Also steal slicerators `[a..b]` iterator |
09:01:21 | FromDiscord | <Elegantbeef> I cant believe since like pre 1.0.0 `[]` didnt work as an iterator |
09:01:26 | FromDiscord | <Elegantbeef> That's maddening |
09:03:08 | PMunch | Does openarray[byte] accept a string? Or is that just openarray[char]? |
09:03:25 | PMunch | I currently have `key: seq[byte] or seq[uint8] or seq[char] or string`.. |
09:03:31 | FromDiscord | <Elegantbeef> Just char but you can do `.toOpenArrayByte(0, len)` |
09:03:56 | FromDiscord | <Elegantbeef> You do realize `seq[byte]` and `seq[uint8]` are identical |
09:04:26 | FromDiscord | <TryAngle> sent a code paste, see https://play.nim-lang.org/#ix=3UwM |
09:04:33 | * | gsalazar quit (Ping timeout: 256 seconds) |
09:04:33 | FromDiscord | <Zoom> [Elegantbeef](https://matrix.to/#/@elegantbeef:matrix.org)\: btw, talking about OpenArrays\: I've replied to your review to my r |
09:05:00 | FromDiscord | <Elegantbeef> Lol |
09:05:07 | PMunch | @Elegantbeef, they are? |
09:05:10 | FromDiscord | <Elegantbeef> You've got to be shitting me |
09:05:21 | FromDiscord | <Elegantbeef> yea `byte` is an alias to uin8 |
09:05:58 | FromDiscord | <Zoom> That's called holey enums↵(@TryAngle) |
09:06:06 | FromDiscord | <Elegantbeef> the proc needs to be defined `[T: FlowVarBase](flowVars: openArray[T])` |
09:06:34 | FromDiscord | <Elegantbeef> If you want to ignore the numbers have an array and a non holey enum |
09:07:37 | FromDiscord | <TryAngle> In reply to @Elegantbeef "If you want to": ah that is a good idea |
09:07:38 | FromDiscord | <Elegantbeef> sent a code paste, see https://paste.rs/T8N |
09:07:39 | FromDiscord | <TryAngle> thanks |
09:07:40 | FromDiscord | <Elegantbeef> Formatted properly and also closed `[]` |
09:08:20 | FromDiscord | <Zoom> I suppose he was really asking about order. And yep, the order inside decl does not matter, if you manually assign the ord values. |
09:09:22 | FromDiscord | <Elegantbeef> I wonder if a RFC to make all procedures using inheritable objects use them as a typeclass would be accepted 😛 |
09:09:45 | FromDiscord | <Elegantbeef> Solves the issue we ran into Zoom |
09:10:12 | FromDiscord | <Zoom> Should I change this signature for this one? |
09:10:32 | FromDiscord | <Elegantbeef> It would make it work, but it can also make code that compiled no longer compile |
09:11:21 | FromDiscord | <Elegantbeef> Like if you relied on inheritance and upcasted all your types to `FlowVarBase` it would stop working |
09:11:36 | FromDiscord | <Elegantbeef> Wait it's marked unstable, so perhaps it'd be accpeted |
09:11:54 | FromDiscord | <Elegantbeef> sent a code paste, see https://play.nim-lang.org/#ix=3UwN |
09:12:02 | FromDiscord | <Elegantbeef> So it really seems like it should just make it a generic, but i dont know |
09:16:21 | FromDiscord | <Zoom> I leave the question there, just in case anyone else reads it \:) |
09:16:37 | FromDiscord | <Elegantbeef> ok |
09:16:58 | FromDiscord | <Shiba> where is the config file located in linux ? |
09:19:14 | FromDiscord | <hmmm> sent a code paste, see https://play.nim-lang.org/#ix=3UwQ |
09:19:28 | FromDiscord | <Zoom> That's kinda sad, such a basic element of threading is so quirky |
09:19:30 | FromDiscord | <Zoom> Which one? Nim configs in use are outputted on each compilation. |
09:19:41 | FromDiscord | <Yardanico> In reply to @Shiba "where is the config": there are multiple |
09:19:46 | FromDiscord | <Elegantbeef> I mean like i said prior in an ideal world it's an iterator anyway, no clue why it's not |
09:19:49 | FromDiscord | <Yardanico> the main nim one located in the nim distribution |
09:19:55 | FromDiscord | <Yardanico> the main user one you can create in ~/.config/nim/nim.cfg |
09:20:00 | PMunch | Hmm, I have a pointer to some data and a length, is there a simple way to copy this into a seq[byte]? |
09:20:04 | FromDiscord | <Yardanico> then project-specific ones |
09:20:11 | FromDiscord | <Yardanico> In reply to @PMunch "Hmm, I have a": copyMem? :P |
09:20:21 | FromDiscord | <Elegantbeef> sent a code paste, see https://paste.rs/Uku |
09:20:30 | PMunch | I mean I could do `newSeq[byte](length); copyMem(mySeq[0].addr, data)` |
09:20:32 | FromDiscord | <Yardanico> https://nim-lang.org/docs/system.html#copyMem%2Cpointer%2Cpointer%2CNatural |
09:20:38 | FromDiscord | <Yardanico> yeah |
09:20:40 | FromDiscord | <Elegantbeef> yea that's the simplest |
09:21:21 | FromDiscord | <Elegantbeef> Why do you need to turn it into a seq, is it related with that procedure call? |
09:22:19 | FromDiscord | <Shiba> In reply to @Yardanico "there are multiple": ok found it, it's in "/etc/nim/" |
09:22:21 | FromDiscord | <Elegantbeef> If it is, openarray is the answer, no need to copy the data! |
09:22:21 | FromDiscord | <Zoom> I remember being surprised Nim doesn't have `from_raw_parts` analogue https://doc.rust-lang.org/std/vec/struct.Vec.html#method.from_raw_parts |
09:22:31 | FromDiscord | <Yardanico> In reply to @Shiba "ok found it, it's": it's better to use the user config one though |
09:22:51 | FromDiscord | <Yardanico> also that's the main nim distribution one as I said |
09:22:54 | FromDiscord | <Elegantbeef> To be fair nim does have `toOpenArray` which works similar |
09:23:04 | FromDiscord | <Yardanico> it's in /etc/nim if you installed Nim via the package manager |
09:23:34 | FromDiscord | <Shiba> In reply to @Yardanico "it's better to use": where is it |
09:23:35 | FromDiscord | <Elegantbeef> The issue with that and Nim Zoom is that Nim's size/cap is next to the data iirc |
09:23:38 | FromDiscord | <Shiba> (edit) "it" => "it?" |
09:23:40 | FromDiscord | <Yardanico> In reply to @Shiba "where is it?": ~/.config/nim/nim.cfg |
09:23:45 | FromDiscord | <Yardanico> if nim folder doesn't exist, just create it |
09:23:47 | * | jjido quit (Quit: My MacBook Air has gone to sleep. ZZZzzz…) |
09:23:51 | FromDiscord | <Yardanico> and then create nim.cfg and put the stuff you want there |
09:24:14 | FromDiscord | <Shiba> ahh ok |
09:25:11 | FromDiscord | <Zoom> Figured this |
09:25:31 | FromDiscord | <Elegantbeef> Think It was done explicitly to reduce stack allocations for embedded |
09:27:06 | FromDiscord | <Elegantbeef> I noticed pmunch never responded to my question, clearly he was ashamed 😛 |
09:28:52 | PMunch | Huh, what questios? |
09:29:07 | FromDiscord | <Elegantbeef> What are you doing with the seq? |
09:29:11 | PMunch | Oh, I need to complete a Future |
09:29:30 | FromDiscord | <Elegantbeef> Ah, thought it was related with that `seq[byte]` stuff |
09:30:01 | FromDiscord | <Elegantbeef> `openarray[char or byte]` is your friend, invite it inside |
09:31:50 | PMunch | Ooh, that works? |
09:31:51 | PMunch | Nice |
09:32:42 | FromDiscord | <Elegantbeef> yes |
09:32:58 | FromDiscord | <Elegantbeef> Though string doesnt convert to it |
09:35:17 | FromDiscord | <Elegantbeef> https://play.nim-lang.org/#ix=3UwR is what i'd say to do |
09:36:06 | FromDiscord | <Elegantbeef> Which means you get so much flexibillity, got a pointer to a byte array, just use `toOpenArray` on it, got an array or seq just pass it, got a string just call `.toOa` |
09:36:26 | FromDiscord | <Elegantbeef> And with this rant i go sleep |
09:38:19 | FromDiscord | <Shiba> what https://media.discordapp.net/attachments/371759389889003532/961560542907080764/Screenshot_2022-04-07_11-38-07.png |
09:39:14 | FromDiscord | <Yardanico> -lm |
09:39:40 | FromDiscord | <Yardanico> to the C compiler |
09:39:51 | FromDiscord | <Yardanico> https://github.com/nim-lang/Nim/issues/19041 |
09:43:07 | FromDiscord | <hmmm> broskis stupid question, if I have a big module and split it in two, I will need to send to the second module all the vars that were accessed natively before, that means that I need to change all the signatures of the procs.....there is no way around that right? |
09:43:25 | FromDiscord | <Yardanico> wdym? |
09:43:30 | FromDiscord | <hmmm> hmm |
09:43:34 | FromDiscord | <Yardanico> I don't get the "vars that were accessed natively" |
09:43:51 | FromDiscord | <hmmm> like my procs used global vars lol |
09:43:53 | FromDiscord | <Yardanico> you mean unexported global variables from that module? |
09:44:02 | FromDiscord | <Yardanico> then yes, you have to export them to use in another module |
09:44:12 | FromDiscord | <Yardanico> or change procedures so they rely less on global state |
09:44:18 | FromDiscord | <hmmm> hmmm |
09:44:29 | FromDiscord | <hmmm> hmmmmmmmmm |
09:44:40 | FromDiscord | <hmmm> I don't want to but the module just became huge |
09:45:52 | FromDiscord | <pointystick> If you're just splitting them up because it's too big, you could use 'include' instead |
09:46:07 | FromDiscord | <Yardanico> yes but that's not really "splitting" |
09:46:33 | FromDiscord | <Yardanico> but if you mentally don't like files with too much code, then yes, it is a viable solution |
09:46:49 | FromDiscord | <Yardanico> @pointystick also, it's not that simple |
09:47:12 | FromDiscord | <Yardanico> if he wants to split his module in two parts, and both parts use each other |
09:47:15 | FromDiscord | <Yardanico> then include won't work |
09:50:29 | FromDiscord | <hmmm> yardy on what you said before about exporting vars I don't think I can do that because hmm the main module will import the new one, and there is the dependency of 2 modules that forbids me to importing both at the same time. Basically my understanding is that I can only change the procs signatures so I can send the vars to the second module and get them back. But I might be wrong very wrong ofc lol |
09:51:20 | FromDiscord | <Solitude> just write everything in one module, your code is doomed |
09:51:24 | FromDiscord | <hmmm> lol |
09:51:42 | FromDiscord | <hmmm> ty solibro that was already a fact 😃 |
09:51:47 | FromDiscord | <hmmm> since it was written by me |
09:51:48 | FromDiscord | <Yardanico> In reply to @hmmm "lol": but really, if you want to split your module then you have to rework the code |
09:51:56 | FromDiscord | <Yardanico> there's no "simple" solution if it's all interwinded |
09:52:08 | FromDiscord | <Yardanico> you either leave it as is, or change the logic of the code so you can separate it into different parts |
09:52:20 | FromDiscord | <hmmm> hmm I see |
09:52:25 | FromDiscord | <hmmm> ty yardy ❤️ |
09:57:55 | FromDiscord | <Rika> Globals are awful smh |
09:59:18 | FromDiscord | <Yardanico> it depends, but there's no need to abuse them, yes |
10:00:38 | * | jmdaemon quit (Ping timeout: 272 seconds) |
10:01:21 | FromDiscord | <Zoom> @hmmm\: you really need to watch that Dijkstra's interview |
10:01:22 | FromDiscord | <Zoom> https://youtu.be/mLEOZO1GwVc?t=259 |
10:22:34 | PMunch | Or you can split them and have a new module that includes part1 and part2 |
10:22:47 | PMunch | If you just want to split it in two but keep them as one logical module |
10:36:55 | * | kayabaNerve quit (Ping timeout: 256 seconds) |
10:54:50 | PMunch | Damn.. I somehow managed to forget about procedure overloads in Nim when writing Futhark.. |
10:55:08 | PMunch | It's full of `when not defined()` which will obviously trigger for overloaded procs.. |
11:35:00 | PMunch | Hot damn, I was able to wrap the libcoap C library with Futhark and add destructors and async handling to give it a really nice Nim API :) |
11:43:53 | PMunch | Which means I went from this: http://ix.io/3Ux9/nim to this: http://ix.io/3Uxa/nim |
11:45:02 | PMunch | Those do the same thing, the updated version will throw CoapError for all the scenarios which in the first just triggers a cleanup and exit |
12:00:24 | * | wyrd quit (Remote host closed the connection) |
12:01:21 | * | wyrd joined #nim |
12:04:44 | FromDiscord | <Solitude> zamn |
12:05:15 | * | toulene joined #nim |
12:21:56 | PMunch | It's pretty neat :) |
12:25:41 | * | slowButPresent joined #nim |
12:30:46 | * | SamuelMarks joined #nim |
12:33:31 | * | rockcavera joined #nim |
12:33:31 | * | rockcavera quit (Changing host) |
12:33:31 | * | rockcavera joined #nim |
12:39:03 | * | SamuelMarks quit (Ping timeout: 260 seconds) |
12:55:05 | FromDiscord | <aph> :wow: |
12:55:14 | FromDiscord | <aph> that's damn small now |
13:02:42 | PMunch | Yup, and it ties into the Nim async system now |
13:02:56 | PMunch | Which simplifies my program logic a lot |
13:04:36 | FromDiscord | <Phil> I know that feeling |
13:04:50 | FromDiscord | <Phil> In a similar vein, the last week of my project consisted of me applying my generic controllers |
13:04:55 | FromDiscord | <Phil> And deleting tons of controller and service code |
13:06:09 | PMunch | For the web stuff? |
13:07:32 | FromDiscord | <Phil> Yeh |
13:08:24 | FromDiscord | <VideoCarp> I ran an algorithm that had ~80-100% CPU usage on several programming languages: C, Rust, Go and F#.↵Surprisingly, Nim only had ~30% CPU usage, and was almost the fastest in terms of time.↵↵Is Nim always this efficient? |
13:08:32 | PMunch | autotemplates works pretty well now, maybe the next step is writing autorouter |
13:08:57 | FromDiscord | <Phil> In reply to @VideoCarp "I ran an algorithm": It always depends on what you do and how you do it |
13:09:35 | FromDiscord | <Phil> It's not a "Nim is generally efficient" it's more a "The code that nim tends to guide you towards because it feels 'good' to write that way is particularly efficient on task X" |
13:09:38 | PMunch | @VideoCarp, Nim in general is pretty fast, but those numbers seem a bit strange |
13:10:11 | FromDiscord | <VideoCarp> In reply to @PMunch "<@725906143272239178>, Nim in general": They're accurate, though. Used operating system to measure usage. |
13:10:19 | FromDiscord | <Phil> There are also tasks where the "naive" first draft of code you'd throw in will be slow and you'll need to get fancy |
13:10:45 | PMunch | @VideoCarp, what kind of algorithm is it? |
13:11:22 | FromDiscord | <VideoCarp> This: https://paste.gg/p/anonymous/93ae2e03d25d43dc889e6e0a91def93d |
13:12:53 | FromDiscord | <Phil> So you just count up from 0 to large number and echo the large number and the time it took to get there |
13:12:56 | FromDiscord | <Phil> hmmm |
13:13:47 | FromDiscord | <VideoCarp> In reply to @Isofruit "So you just count": Yes. Not the best benchmark, though obviously. |
13:14:42 | FromDiscord | <Valdar> I would expect pretty much any compiled language would get you similar results |
13:16:30 | FromDiscord | <Valdar> No idea about the CPU usage discrepancy though, unless the others were threaded? |
13:16:46 | FromDiscord | <Yardanico> In reply to @VideoCarp "Yes. Not the best": any decent C compiler will optimize this to a constant value if you compile with -O1 and up |
13:16:54 | FromDiscord | <Yardanico> so --opt:speed or -d:release or -d:danger with Nim |
13:17:05 | FromDiscord | <Yardanico> so it's totally pointless to benchmark this |
13:17:17 | FromDiscord | <VideoCarp> wdym? |
13:17:27 | * | gsalazar joined #nim |
13:17:46 | PMunch | A compiler will see that you're not actually doing any work in that loop and just optimise the whole thing away |
13:17:51 | PMunch | Or at least it could |
13:17:52 | FromDiscord | <Yardanico> ah yeah, sorry, misunderstood the code |
13:17:54 | FromDiscord | <Yardanico> PMunch is right |
13:18:16 | FromDiscord | <Phil> In reply to @PMunch "For the web stuff?": Aaaaaaaaalll of these are mostly me deleting the corresponding <X>Controller.nim file and deleting 90% of the code in the corresponding <X>Service.nim file https://media.discordapp.net/attachments/371759389889003532/961615897993306242/unknown.png |
13:18:50 | FromDiscord | <Yardanico> In reply to @VideoCarp "wdym?": yeah sorry PMunch is right, in your case the C compiler will see that it can just remove the while loop without changing the behaviour of the program |
13:19:15 | FromDiscord | <VideoCarp> wait so it is not actually running these operations? |
13:19:22 | FromDiscord | <Yardanico> of course not |
13:19:31 | FromDiscord | <Yardanico> C compilers are quite smart nowadays |
13:19:41 | FromDiscord | <Yardanico> well, unless you compile without any optimizations enabled, but that is also pointless |
13:19:42 | FromDiscord | <VideoCarp> that says a lot.↵but why does it take 600 milliseconds? |
13:19:52 | FromDiscord | <VideoCarp> (edit) "milliseconds?" => "milliseconds with optimizations?" |
13:19:52 | FromDiscord | <Yardanico> how are you compiling? |
13:20:04 | FromDiscord | <Yardanico> if you're just doing `nim c file.nim` then there are no optimizations |
13:20:06 | FromDiscord | <VideoCarp> optimized nim compile |
13:20:16 | FromDiscord | <VideoCarp> i forgot the command |
13:20:27 | FromDiscord | <VideoCarp> but it is not just that |
13:20:36 | FromDiscord | <Yardanico> In reply to @VideoCarp "that says a lot.": are you sure it's 600ms? |
13:20:37 | FromDiscord | <Phil> You can do d:release and d:danger |
13:20:43 | FromDiscord | <Phil> there's also different GC's |
13:20:43 | FromDiscord | <Yardanico> for me it showed `4.529999999999985e-05` with -d:danger |
13:21:19 | FromDiscord | <VideoCarp> In reply to @Yardanico "are you sure it's": it showed 0.6 |
13:21:27 | FromDiscord | <Phil> Though I don't think the GC's would have a large impact here I don't think. I say that as a naive simpleton so I'm happy to get educated on that one |
13:21:42 | FromDiscord | <Yardanico> yeah you're right @Phil, the GC here has minimal impact |
13:21:51 | FromDiscord | <Yardanico> In reply to @VideoCarp "it showed 0.6": so did you compile with `nim c -d:danger file.nim` ? |
13:22:07 | FromDiscord | <Yardanico> ah right I think i know |
13:22:12 | FromDiscord | <Yardanico> you compiled with `--opt:speed` |
13:22:18 | FromDiscord | <VideoCarp> yes that |
13:22:20 | FromDiscord | <Yardanico> that makes Nim pass -O3 to the C compiler, but all Nim optimizations are disabled |
13:22:24 | FromDiscord | <Yardanico> so you still have the stack traces and stuff |
13:22:29 | FromDiscord | <Yardanico> so it's much slower still |
13:22:41 | FromDiscord | <Yardanico> and maybe the C compiler didn't manage to optimize away the loop with all those stack traces enabled |
13:23:16 | FromDiscord | <Yardanico> ah yeah it's the safety checks that are preventing the C compiler from optimizing it |
13:23:37 | FromDiscord | <Yardanico> with -d:release the time is about the same as with --opt:speed (2-3x faster), but with `-d:danger` it's magnitudes faster |
13:24:03 | FromDiscord | <Yardanico> but again, that's not a good way to benchmark stuff :) you should make something that makes real external computations |
13:24:17 | FromDiscord | <Yardanico> although I still think that microbenchmarks are mostly pointless, there are repos like https://github.com/kostya/benchmarks |
13:24:43 | FromDiscord | <Yardanico> for example brainfuck https://media.discordapp.net/attachments/371759389889003532/961617519532212244/unknown.png |
13:26:04 | FromDiscord | <Phil> Given how simple writing nim code can be, the performance is a bit crazy |
13:26:20 | FromDiscord | <Yardanico> the fact that these benchmarks have to read external input is what makes the benchmarks at least somewhat reliable |
13:26:34 | FromDiscord | <Yardanico> the C compiler can't just optimize the whole computation away for the result |
13:27:37 | FromDiscord | <Phil> Naturally it gets harder the more features of nim you use with all the pragmas but those are features that you can very well grow into |
13:27:56 | FromDiscord | <Yardanico> if I input 999999999 it takes 0.000111 on my machine |
13:28:00 | FromDiscord | <Yardanico> sent a code paste, see https://play.nim-lang.org/#ix=3Uxt |
13:28:12 | FromDiscord | <Yardanico> ah right i'm stupid |
13:28:39 | FromDiscord | <Yardanico> it can still optimize the loop away here :P |
13:28:53 | FromDiscord | <Yardanico> and I need to move `guess` declaration above `t0` so it's not counted towards the total runtime |
13:29:44 | FromDiscord | <Yardanico> sent a code paste, see https://play.nim-lang.org/#ix=3Uxu |
13:30:07 | FromDiscord | <Yardanico> it gives 30-40 microseconds for me for any number input |
13:30:12 | FromDiscord | <Yardanico> (edit) "https://play.nim-lang.org/#ix=3Uxu" => "https://paste.rs/aXD" |
13:30:41 | FromDiscord | <Yardanico> also yeah, monotimes are a better way to measure time than cpuTime, also you get pretty output of the difference if you import both times and monotimes |
13:30:44 | FromDiscord | <Yardanico> "Time: 31 microseconds and 640 nanoseconds" |
13:33:45 | FromDiscord | <Valdar> Is there an idiomatic syntax for an enumin Nim? all lowercase, all upper, first letter caps? I've seen it all these ways from different sources |
13:34:20 | FromDiscord | <Valdar> (edit) "enumin" => "enum in" |
13:34:35 | FromDiscord | <Yardanico> In reply to @Valdar "Is there an idiomatic": nep-1 does mention enums, but pure vs non-pure difference is quite small nowadays |
13:34:36 | FromDiscord | <Yardanico> https://media.discordapp.net/attachments/371759389889003532/961620006511214592/unknown.png |
13:34:38 | FromDiscord | <Yardanico> https://nim-lang.org/docs/nep1.html |
13:34:45 | * | zeus-supreme joined #nim |
13:34:55 | FromDiscord | <Yardanico> but generally this is still followed in stdlib and outside of it |
13:36:13 | FromDiscord | <Valdar> ah, OK. what is the 'pure' specification mean? |
13:36:22 | * | SamuelMarks joined #nim |
13:36:28 | FromDiscord | <aph> In reply to @Valdar "ah, OK. what is": won't collide if there's same name |
13:37:17 | FromDiscord | <aph> sent a code paste, see https://play.nim-lang.org/#ix=3Uxz |
13:37:25 | FromDiscord | <Yardanico> well, that's not exactly a correct description :) |
13:37:28 | FromDiscord | <Yardanico> "An enum type can be marked as pure. Then access of its fields always requires full qualification." |
13:37:35 | * | zeus-supreme1 quit (Ping timeout: 246 seconds) |
13:37:39 | FromDiscord | <Yardanico> but nowadays you don't need for qualification for pure enums |
13:37:49 | FromDiscord | <Yardanico> so it became what aph describes |
13:38:47 | * | gsalazar quit (Ping timeout: 260 seconds) |
13:39:16 | FromDiscord | <Valdar> Got it, thx. That actually kinda follows the snippets that I've seen as for the full qualification |
13:39:45 | FromDiscord | <Yardanico> the Nim manual generally has a lot of information, but it's quite big :) |
13:39:47 | FromDiscord | <Yardanico> https://nim-lang.org/docs/manual.html#pragmas-pure-pragma |
13:44:49 | * | SamuelMarks quit (Ping timeout: 268 seconds) |
13:46:37 | * | arkurious joined #nim |
13:49:36 | FromDiscord | <Valdar> I go back and read over that stuff till it hurts my brain, then I leave it till I feel brave again 🙂 |
13:49:57 | FromDiscord | <Phil> The "best practice" I've seen so far is prefix the individual choices with the enum acronym |
13:50:33 | * | SamuelMarks joined #nim |
13:50:51 | FromDiscord | <Phil> sent a code paste, see https://play.nim-lang.org/#ix=3UxA |
13:51:16 | PMunch | @Phil, ugh why would you do that? |
13:51:32 | FromDiscord | <Phil> (edit) "https://play.nim-lang.org/#ix=3UxC" => "https://play.nim-lang.org/#ix=3UxB" |
13:51:53 | FromDiscord | <Phil> In reply to @PMunch "<@180601887916163073>, ugh why would": IIRC that's the way it's often done in the std libs... I know I've seen this before in a lot of code that wasn't mine |
13:52:31 | PMunch | I can vaguely remember seeing that for some C wrapping stuff |
13:52:37 | PMunch | I wouldn't put that in my code |
13:53:02 | FromDiscord | <Valdar> They do it here https://nim-by-example.github.io/types/enums/ |
13:53:15 | FromDiscord | <auxym> it's nep-1 convention for non-pure enums |
13:53:59 | FromDiscord | <Solitude> In reply to @PMunch "<@180601887916163073>, ugh why would": i do that and i hate it. when enumOverloading becomes default im removing prefixes from all my enums |
13:54:12 | FromDiscord | <Phil> Look, I have no room to judge |
13:54:26 | FromDiscord | <Phil> I do enums in all uppercase and separating words with `_` |
13:54:37 | FromDiscord | <Phil> Pascal case it was called I think? |
13:54:41 | FromDiscord | <Solitude> you could've kept this a secret |
13:54:55 | FromDiscord | <Phil> But then you wouldn't be cringing in front of your monitor |
13:55:06 | FromDiscord | <Phil> That would be a loss for the world |
13:55:26 | PMunch | All uppercase and underscores are SCREAMING_CASE |
13:55:44 | PMunch | PascalCase is like camelCase but with the first character also uppercase |
13:55:52 | FromDiscord | <Phil> Ah, check |
13:56:00 | FromDiscord | <Phil> MY_ENUMS_SCREAM_AT_YOU |
13:56:22 | FromDiscord | <Valdar> In reply to @Isofruit "Pascal case it was": Pascal case is different. basically just uppercase for each 'word' in the name |
13:56:47 | nrds | <Prestige99> I like screaming case for enums |
13:57:03 | FromDiscord | <Valdar> like PascalCase |
13:57:07 | PMunch | Ditto |
13:57:16 | FromDiscord | <Phil> Pascal case reserved for types |
13:57:16 | PMunch | PascalCase that is |
13:57:27 | FromDiscord | <Yardanico> i like PascalCase for enums and constants |
13:57:46 | FromDiscord | <Solitude> yeah? |
13:58:29 | FromDiscord | <Valdar> Pascal case works for it. I was just looking at the assimp wrapper and that is how it's used there |
13:58:34 | FromDiscord | <Rika> i dont use scream case, pascal case reserved for types, camel case for anything else is how i go |
13:58:54 | FromDiscord | <Rika> i guess pascal goes on enum vals too |
13:59:26 | FromDiscord | <Valdar> Screaming case is for constants as well, is it not? |
13:59:47 | FromDiscord | <Yardanico> screaming case is discouraged in Nim fwiw |
14:00:00 | FromDiscord | <Yardanico> i mean if you want to write idiomatic nim :P |
14:00:05 | FromDiscord | <Yardanico> of course no one stops you from using screaming case |
14:00:06 | FromDiscord | <Rika> In reply to @Valdar "Screaming case is for": your choice |
14:00:37 | FromDiscord | <Valdar> In reply to @Yardanico "screaming case is discouraged": I'm fine with no scream case. it's UGGGLY |
14:00:43 | FromDiscord | <Yardanico> classic quote from nep1 |
14:00:44 | FromDiscord | <Yardanico> "For constants coming from a C/C++ wrapper, ALL_UPPERCASE are allowed, but ugly. (Why shout CONSTANT? Constants do no harm, variables do!)" |
14:00:59 | * | PMunch quit (Quit: Leaving) |
14:01:04 | FromDiscord | <Yardanico> also "In the age of HTTP, HTML, FTP, TCP, IP, UTF, WWW it is foolish to pretend these are somewhat special words requiring all uppercase. Instead treat them as what they are: Real words. So it's parseUrl rather than parseURL, checkHttpHeader instead of checkHTTPHeader etc." |
14:03:11 | * | jjido joined #nim |
14:05:48 | FromDiscord | <Rika> i pronounce "Url" like urn xdd |
14:06:40 | FromDiscord | <Valdar> Well, those are technically not words, but acronyms, so that's kinda apple/oranges |
14:07:18 | FromDiscord | <Rika> yeah |
14:07:23 | nrds | <Prestige99> The main thing I dislike from nep1 is having enum names like nnkFoo where nnk is short for the name of the enum |
14:07:55 | FromDiscord | <Rika> well that's only for now while we dont have overloadable enums, and technically not needed either because you can always qualify the enum without using pure |
14:08:26 | nrds | <Prestige99> Yeah, I've stopped using that style |
14:09:57 | FromDiscord | <Valdar> For me, I just like to be able to look at the code and realize that I'm calling a proc with an enum rather than thinking it's a variable |
14:11:26 | FromDiscord | <aph> how to check if a value is not yet modified, or which approach should i take to make it be able to check that this thing is modified (yes confusing, i'm not sure how to phrase this properly) |
14:11:46 | FromDiscord | <aph> like `0.0` `0` `""` `nil` etc |
14:12:15 | FromDiscord | <Rika> you cant check if something is modified since it might have been modified into the default value, unless you dont mind that |
14:12:43 | FromDiscord | <Rika> `default(Type)` gives you the default value of that type so you could do `if val != default(val.typeof)` |
14:12:52 | FromDiscord | <aph> ohh |
14:13:03 | FromDiscord | <aph> I haven't thought of that it'll be the default value |
14:13:07 | FromDiscord | <aph> maybe I'll use an array |
14:13:13 | FromDiscord | <aph> ¯\\_(ツ)\_/¯ |
14:13:35 | FromDiscord | <Rika> you could use options here |
14:15:08 | FromDiscord | <aph> how do i change the default value? i think maybe changing it to something unreachable will do |
14:19:13 | * | rockcavera quit (Remote host closed the connection) |
14:21:12 | FromDiscord | <aph> oh probably `newObj` I'll test later. thanks rika! |
14:24:01 | FromDiscord | <jmgomez> Is anyone on here using vscode? |
14:24:44 | FromDiscord | <aph> In reply to @jmgomez "Is anyone on here": ✋ |
14:24:55 | FromDiscord | <aph> I use saem's extension for nim |
14:25:25 | FromDiscord | <jmgomez> In MacOs I got the linter working, when on windows and WSL (ubuntu) or regular windows it doesnt work. In regular windows even autocomplete doesnt work.. So wanted to ask, does the linter (nim check) works for you? |
14:26:46 | FromDiscord | <aph> idk, mine doesn't have autocomplete at all |
14:27:18 | FromDiscord | <jmgomez> :/ |
14:27:26 | FromDiscord | <jmgomez> what platform are you using? |
14:28:55 | FromDiscord | <Valdar> Auto complete doesn't work well, or sometimes not at all. |
14:29:28 | FromDiscord | <Valdar> VSCode's suggestions are just annoying anyway |
14:29:34 | FromDiscord | <Phil> On linux, you get some level of autocomplete but the linter I haven't ever gotten to work |
14:29:56 | FromDiscord | <jmgomez> That's too bad.. in macos everything to work kinda fine |
14:30:20 | FromDiscord | <jmgomez> (edit) removed "to" |
14:30:57 | nrds | <Prestige99> what linter? |
14:31:24 | FromDiscord | <Valdar> At least 'Go To Definition' usually works (in my case), but I'd love it if I could get code complete to work |
14:32:00 | FromDiscord | <jmgomez> In reply to @nrds "<Prestige> what linter?": nim check (which it isnt a linter but they call it linter in the extension) |
14:32:18 | nrds | <Prestige99> ah |
14:32:44 | FromDiscord | <xflywind> it works for me on windows and wsl2. |
14:33:15 | FromDiscord | <Valdar> In reply to @nrds "<Prestige> what linter?": How is it not a linter? |
14:33:51 | FromDiscord | <xflywind> In reply to @jmgomez "In MacOs I got": what about running `nim check` on command line? |
14:33:52 | nrds | <Prestige99> Didn't know what linter they were referring to |
14:33:53 | * | om3ga quit (Remote host closed the connection) |
14:34:02 | FromDiscord | <jmgomez> In reply to @flywind "it works for me": Im in wsl 1. But do you have the linter working too? Like this https://media.discordapp.net/attachments/371759389889003532/961634961872531466/Screenshot_2022-04-07_at_15.33.02.png |
14:34:20 | nrds | <Prestige99> I have that working ^ |
14:34:28 | FromDiscord | <Valdar> In reply to @flywind "it works for me": it used to work for me too, at least sometimes. I think maybe I buggered my VSCode settings by turning off some popup stuff |
14:35:13 | FromDiscord | <jmgomez> In reply to @nrds "<Prestige> I have that": where? |
14:35:50 | FromDiscord | <xflywind> In reply to @jmgomez "Im in wsl 1.": https://media.discordapp.net/attachments/371759389889003532/961635419294924840/unknown.png |
14:35:52 | FromDiscord | <Valdar> yeah, warnings and errors work |
14:36:27 | FromDiscord | <Valdar> code completion doesn't, at least for me |
14:37:55 | FromDiscord | <jmgomez> I have the opposite in WSL 1. Code completion working and the linter doesnt |
14:38:35 | FromDiscord | <jmgomez> I think I will end up virtualizing mac os on windows as a patch just for have everything working |
14:38:47 | FromDiscord | <jmgomez> (edit) "for" => "to" |
14:38:54 | FromDiscord | <xflywind> In reply to @jmgomez "I have the opposite": the extension just calls `nim check`. Can you execute `nim check yourfile.nim` on command line? |
14:39:15 | FromDiscord | <xflywind> (edit) "In reply to @jmgomez "I have the opposite": the extension just calls `nim check`. Can you execute `nim check yourfile.nim` ... on" added "successfully" |
14:39:42 | * | SamuelMarks quit (Ping timeout: 268 seconds) |
14:39:55 | FromDiscord | <jmgomez> In reply to @flywind "the extension just calls": yes |
14:40:35 | FromDiscord | <xflywind> which extension do you use? |
14:40:36 | FromDiscord | <huantian> Doesn’t vscode extension normally use c and check is used instead when enabled |
14:41:03 | * | gsalazar joined #nim |
14:42:14 | FromDiscord | <xflywind> In reply to @Valdar "code completion doesn't, at": code completions work for me. But nimsuggest comsume too much memory. So I disable it in settings. You can also use Tabnine for autocomplete. |
14:43:01 | FromDiscord | <jmgomez> Does tab nine works better than copilot? |
14:43:03 | FromDiscord | <spoon> tabnine?? does the ai suggest stuff from libraries? |
14:43:28 | FromDiscord | <Generic> In reply to @jmgomez "Does tab nine works": in my experience it's about par or worse |
14:43:34 | FromDiscord | <spoon> In reply to @jmgomez "Does tab nine works": havent used tabnine in like a year because it didnt work, maybe its better now |
14:43:41 | FromDiscord | <spoon> but copilots been pretty good |
14:44:17 | FromDiscord | <jmgomez> indieed. it surprised me a couple of times, sometimes it introduces python in the code but it's quite good |
14:44:22 | FromDiscord | <jmgomez> (edit) "indieed." => "indeed." |
14:45:45 | * | gsalazar quit (Ping timeout: 248 seconds) |
14:49:51 | FromDiscord | <Valdar> you have to have an account with tab nine? |
14:51:25 | FromDiscord | <jmgomez> okay, got it working in WSL by switching extensions |
14:51:39 | FromDiscord | <jmgomez> (both linter and autocomplete) |
15:00:56 | * | gsalazar joined #nim |
15:02:12 | * | PMunch joined #nim |
15:02:53 | * | gsalazar quit (Remote host closed the connection) |
15:03:06 | * | gsalazar joined #nim |
15:07:00 | * | gsalazar quit (Remote host closed the connection) |
15:07:12 | * | gsalazar joined #nim |
15:11:31 | * | Gustavo6046 joined #nim |
15:12:14 | * | gsalazar quit (Ping timeout: 272 seconds) |
15:17:55 | FromDiscord | <Yardanico> In reply to @jmgomez "Does tab nine works": not sure, but in most cases copilot also shows up Python suggestions for Nim |
15:17:57 | FromDiscord | <Yardanico> or even some other languages |
15:25:02 | * | gsalazar joined #nim |
15:26:52 | * | Gustavo6046 quit (Remote host closed the connection) |
15:30:16 | * | gsalazar quit (Ping timeout: 268 seconds) |
15:33:23 | * | Gustavo6046 joined #nim |
15:33:57 | * | Gustavo6046 quit (Remote host closed the connection) |
15:34:39 | * | kayabaNerve joined #nim |
15:43:13 | * | kayabaNerve quit (Ping timeout: 268 seconds) |
15:45:55 | * | SamuelMarks joined #nim |
15:55:53 | FromDiscord | <aph> In reply to @jmgomez "what platform are you": whoops, sorry! didn't check messages. it's windows |
15:58:59 | * | Gustavo6046 joined #nim |
15:59:44 | * | Gustavo6046 quit (Remote host closed the connection) |
16:14:40 | * | SamuelMarks quit (Ping timeout: 268 seconds) |
16:26:53 | * | gsalazar joined #nim |
16:28:19 | * | Gustavo6046 joined #nim |
16:28:55 | * | vicfred joined #nim |
16:32:11 | FromDiscord | <felix_lipski> I installed the nim.vim plugin, but I don't want the `make` building feature, because it conflicts with my current vim scripts. Does anyone know of a way of disabling it without building the plugin from source? |
16:32:51 | * | gsalazar quit (Ping timeout: 260 seconds) |
16:37:23 | FromDiscord | <Recruit_main707> sent a code paste, see https://play.nim-lang.org/#ix=3Uyj |
16:47:58 | * | SamuelMarks joined #nim |
16:48:53 | * | xet7 joined #nim |
16:50:12 | FromDiscord | <Solitude> drop `= 1` and it looks alrigth |
17:19:35 | * | jjido quit (Quit: My MacBook Air has gone to sleep. ZZZzzz…) |
17:23:10 | FromDiscord | <Hamid_Bluri> sent a code paste, see https://play.nim-lang.org/#ix=3Uyr |
17:23:28 | FromDiscord | <Hamid_Bluri> (edit) "https://play.nim-lang.org/#ix=3Uyr" => "https://paste.rs/0Tp" |
17:23:39 | FromDiscord | <Recruit_main707> @Solitude but then i have to specify an ugly generic even when i dont need it |
17:23:58 | * | jjido joined #nim |
17:29:48 | FromDiscord | <Rika> `type SimBody1 = SimBody[1]` |
17:45:34 | FromDiscord | <jmgomez> is there a way to skip noSideEffects inside a func (to debug) so it doesnt propagate up? |
17:46:07 | Amun-Ra | Elegantbeef: ping |
17:47:03 | FromDiscord | <ynfle> In reply to @jmgomez "is there a way": Yes |
17:47:06 | Amun-Ra | jmgomez: if you debug with echo use debugEcho instead |
17:47:57 | FromDiscord | <jmgomez> yes! thanks |
17:48:33 | Amun-Ra | I thought you were doing that ;> been there done that |
17:52:57 | * | SamuelMarks quit (Ping timeout: 248 seconds) |
17:58:43 | FromDiscord | <Solitude> In reply to @Recruit_main707 "<@104136074569211904> but then i": yes, you have to. there are no "generic defaults". |
18:00:44 | * | SamuelMarks joined #nim |
18:05:28 | FromDiscord | <Recruit_main707> In reply to @Rika "`type SimBody1* = SimBody[1]`": thanks |
18:05:46 | * | neurocyte861449 quit (Read error: Connection reset by peer) |
18:07:21 | * | neurocyte8614492 joined #nim |
18:07:26 | * | jmdaemon joined #nim |
18:18:21 | FromDiscord | <jmgomez> I have a file with functions in nimble_root/src/file and I want to import it in a file from nimble_root/tests/test1.nim how can I import it? |
18:18:29 | FromDiscord | <Yardanico> import ../src/file |
18:18:33 | FromDiscord | <Yardanico> but there's a better way |
18:18:36 | * | SamuelMarks quit (Ping timeout: 240 seconds) |
18:18:49 | FromDiscord | <Yardanico> when you do `nimble init`, nimble automatically sets up a nim.cfg which sets the projectPath to a correct folder so you can import stuff without relative paths |
18:19:05 | FromDiscord | <Yardanico> this is how nimble does it - https://github.com/treeform/jsony/blob/master/tests/config.nims |
18:19:58 | FromDiscord | <jmgomez> that's perfect! Thanks @Yardanico |
18:25:15 | * | rockcavera joined #nim |
18:25:15 | * | rockcavera quit (Changing host) |
18:25:15 | * | rockcavera joined #nim |
18:26:28 | * | LuxuryMode quit (Quit: Connection closed for inactivity) |
18:31:56 | * | SamuelMarks joined #nim |
18:32:32 | FromDiscord | <jmgomez> can you specify to the nim compiler what config.nims to use via a parameter? I need a task that will feed different parameters to the compiler based on the environment |
18:34:23 | FromDiscord | <ynfle> What do you mean by the environment? |
18:34:41 | FromDiscord | <ynfle> You can have `when` and `if` statement in the config.nims |
18:34:45 | FromDiscord | <ynfle> I'm pretty sure |
18:35:30 | FromDiscord | <jmgomez> yeah, but I already have the config.nims for the build target and I have a custom task that does an exec for building a library |
18:36:21 | FromDiscord | <jmgomez> I would like to specify a specific file just for that case (I quite new to nim so if you feel there is a better way to approach it, pls let me know) |
18:36:28 | FromDiscord | <jmgomez> (edit) "(I" => "(Im" |
18:37:05 | FromDiscord | <ynfle> What is the different case? |
18:37:09 | FromDiscord | <ynfle> Debug versus release? |
18:37:13 | FromDiscord | <ynfle> Staged versus prod? |
18:38:54 | Amun-Ra | jmgomez: when compiling foo.nim nim will try to read foo.nim.cfg, perhaps this will help |
18:39:07 | FromDiscord | <jmgomez> no, one is building a executable and the other is building a library. For the library, I want to do custom stuff like for example notice if the dll is currently being used from another program |
18:39:33 | FromDiscord | <ynfle> Do you have separate nimble commands? |
18:39:42 | FromDiscord | <jmgomez> In reply to @ynfle "Do you have separate": yes |
18:39:51 | FromDiscord | <jmgomez> In reply to @Amun-Ra "<@726017160115126333>: when compiling foo.nim": thanks but it wont 😦 |
18:40:04 | FromDiscord | <ynfle> So what do you want to differentiate in the config file |
18:40:12 | * | SamuelMarks quit (Ping timeout: 268 seconds) |
18:40:43 | * | v9fk joined #nim |
18:41:03 | FromDiscord | <jmgomez> I want to change the compiler options based on the enviroment, for example the parameter --out or the passC: one |
18:43:05 | FromDiscord | <ynfle> You can just specify those in your nimble task |
18:43:15 | FromDiscord | <ynfle> It doesn't have to be in the config.nims |
18:43:58 | FromDiscord | <ynfle> Or, you can do `-d:binary` or `-d:dll` and have a when statement in your config.nims |
18:44:17 | Amun-Ra | jmgomez: https://play.nim-lang.org/#ix=3UyM |
18:44:22 | Amun-Ra | something like this? |
18:45:12 | FromDiscord | <jmgomez> more elaborate, because it has to look into the filesystem and do stuff like |
18:45:25 | FromDiscord | <jmgomez> sent a code paste, see https://play.nim-lang.org/#ix=3UyN |
18:46:20 | FromDiscord | <jmgomez> I think a config.nims could do it |
18:46:29 | FromDiscord | <jmgomez> but that's already taken |
18:46:33 | Amun-Ra | I wonder if there's a way of checking app type in nim.cfg |
18:46:43 | FromDiscord | <ynfle> In reply to @jmgomez "but that's already taken": Why? |
18:46:46 | Amun-Ra | it should be doable in config.nims |
18:46:57 | FromDiscord | <jmgomez> because of the nimble build |
18:47:11 | FromDiscord | <jmgomez> can I differentiate between tasks inside it? |
19:02:01 | * | v9fk quit (Remote host closed the connection) |
19:02:14 | * | v9fk joined #nim |
19:03:45 | * | v9fk quit (Remote host closed the connection) |
19:04:39 | * | v9fk joined #nim |
19:06:04 | * | v9fk quit (Remote host closed the connection) |
19:06:18 | * | v9fk joined #nim |
19:09:11 | * | vicecea quit (Remote host closed the connection) |
19:09:39 | * | vicecea joined #nim |
19:18:33 | FromDiscord | <Recruit_main707> case statements check for multiple things at one, something like: ` case (this.shape, that.shape):`? |
19:19:59 | Amun-Ra | only ordinals, floats or strings |
19:20:28 | FromDiscord | <Yardanico> In reply to @Recruit_main707 "case statements check for": you need a pattern matching library for that |
19:29:03 | * | SamuelMarks joined #nim |
19:32:36 | * | vicfred quit (Quit: Leaving) |
20:04:14 | * | zeus-supreme1 joined #nim |
20:07:25 | * | zeus-supreme quit (Read error: Connection reset by peer) |
20:08:23 | * | neurocyte8614492 quit (Ping timeout: 268 seconds) |
20:15:15 | * | vicfred joined #nim |
20:23:00 | * | jjido quit (Quit: My MacBook Air has gone to sleep. ZZZzzz…) |
20:28:42 | * | SamuelMarks quit (Ping timeout: 260 seconds) |
20:46:16 | * | PMunch quit (Quit: leaving) |
20:48:14 | * | kayabaNerve joined #nim |
21:25:00 | * | kayabaNerve quit (Ping timeout: 240 seconds) |
21:38:49 | * | SamuelMarks joined #nim |
21:43:15 | * | wyrd quit (Ping timeout: 240 seconds) |
21:47:56 | * | SamuelMarks quit (Ping timeout: 246 seconds) |
21:50:24 | * | wyrd joined #nim |
22:03:31 | * | vicfred quit (Quit: Leaving) |
22:11:02 | nrds | <Prestige99> Is there a way to have nimble install a branch of a package when given a github link? |
22:11:13 | nrds | <Prestige99> I tried but got "Error: 'hg' not in PATH` |
22:12:28 | nrds | <Prestige99> hmm https://github.com/nim-lang/nimble/issues/715#issuecomment-535276021 |
22:18:08 | * | SamuelMarks joined #nim |
22:18:15 | FromDiscord | <Elegantbeef> What's the point of the version if you're hard requiring a commit |
22:19:01 | nrds | <Prestige99> just wanted to try installing a branch |
22:19:26 | FromDiscord | <Elegantbeef> Ah you arent doing a hard commit? |
22:19:27 | nrds | <Prestige99> trying to test out nimble install on my package, changing stuff in my .nimble file to see how it behaves |
22:19:32 | nrds | <Prestige99> nah |
22:19:46 | nrds | <Prestige99> but have to do it on the master branch I guess |
22:38:44 | * | SamuelMarks quit (Ping timeout: 272 seconds) |
22:39:34 | nrds | <Prestige99> finally got it working, super janky but oh well |
22:58:23 | * | SamuelMarks joined #nim |
23:03:21 | * | SamuelMarks quit (Ping timeout: 248 seconds) |
23:33:35 | * | SamuelMarks joined #nim |
23:42:10 | * | v9fk quit (Remote host closed the connection) |