00:00:28 | FromDiscord | <ElegantBeef> Matrix4f.Identity is a procedure? if so you need to invoke it |
00:00:40 | FromDiscord | <ElegantBeef> `var identity = Matrix4f.Identity()` |
00:00:51 | * | irchaxwell joined #nim |
00:01:06 | FromDiscord | <ElegantBeef> What package are you using? |
00:01:18 | FromDiscord | <~355/113 Man> In reply to @ElegantBeef "What package are you": my own |
00:01:20 | FromDiscord | <~355/113 Man> sent a code paste, see https://play.nim-lang.org/#ix=2P6r |
00:01:26 | FromDiscord | <~355/113 Man> with opengl and sdl2 |
00:01:39 | FromDiscord | <ElegantBeef> ah |
00:01:50 | FromDiscord | <ElegantBeef> So `Matrix4f` is a module |
00:01:54 | FromDiscord | <~355/113 Man> yea |
00:01:58 | FromDiscord | <~355/113 Man> and a type |
00:02:09 | FromDiscord | <~355/113 Man> is that bad to have a type the same name as a module? |
00:02:31 | FromDiscord | <ElegantBeef> I mean it works doesnt it? |
00:02:36 | FromDiscord | <~355/113 Man> yea |
00:03:13 | FromDiscord | <ElegantBeef> I see you're using PascalCase function names so i assume C#? π |
00:04:08 | FromDiscord | <~355/113 Man> uhhhhh π
actually no..... (well yes but actually no)β΅it's a "constructor" for an identity matrix, my function names are actually cammelCase |
00:04:24 | FromDiscord | <~355/113 Man> i'm coming from a mix of C and C++ |
00:04:33 | FromDiscord | <~355/113 Man> as a hobyist programmer |
00:04:38 | FromDiscord | <ElegantBeef> Worth noting since Identity is constant you could just make it a `const` since i assume it's `object` |
00:05:14 | FromDiscord | <~355/113 Man> no, it's `Matrix4f = discrete array[16, float32]` |
00:05:35 | FromDiscord | <ElegantBeef> It's considered a value type |
00:05:48 | FromDiscord | <ElegantBeef> Which is what i mean by an object |
00:05:58 | FromDiscord | <~355/113 Man> `object` is considered value? |
00:06:09 | FromDiscord | <ElegantBeef> object is just a C struct |
00:06:16 | FromDiscord | <~355/113 Man> oh cool |
00:06:27 | FromDiscord | <ElegantBeef> `ref object` is just a managed pointer to a C struct |
00:06:52 | FromDiscord | <ElegantBeef> But anyway the const thing still applies |
00:08:38 | FromDiscord | <ElegantBeef> No clue the consensus with math types but constructors in Nim tend to default to `initType` |
00:10:52 | FromDiscord | <~355/113 Man> would assigning `identity` create a copy of `identity`? |
00:11:30 | FromDiscord | <ElegantBeef> Well it's a value type |
00:11:54 | FromDiscord | <ElegantBeef> !eval const I = 100; var a = I; a = 3; echo a |
00:11:56 | NimBot | Compile failed: /usercode/in.nim(1, 29) Error: invalid token: (\29) |
00:12:05 | FromDiscord | <ElegantBeef> Fuck |
00:12:22 | FromDiscord | <ElegantBeef> Guess take this link https://play.nim-lang.org/#ix=2P6u |
00:13:23 | FromDiscord | <~355/113 Man> yep ok, just making sure |
00:18:52 | FromDiscord | <acek7> sup |
00:33:13 | asdflkj_2 | sup |
00:34:53 | * | NimBot joined #nim |
00:41:53 | FromDiscord | <~355/113 Man> can I not multiply a float and an int together without converting? |
00:45:53 | FromDiscord | <ElegantBeef> https://nim-lang.org/docs/lenientops.html |
00:45:55 | * | Jesin quit (Quit: Leaving) |
00:46:13 | FromDiscord | <Avatarfighter> wtf i didn't know that library existed |
00:46:28 | FromDiscord | <ElegantBeef> The stdlib is full of magic treats |
00:47:16 | FromDiscord | <ElegantBeef> Like we have `mimetypes` |
00:47:30 | FromDiscord | <Avatarfighter> wtf |
00:48:11 | FromDiscord | <ElegantBeef> Hell there is a module to open urls in your default browser |
00:48:13 | FromDiscord | <Avatarfighter> if you continue listing libraries beef you're going to put all the helper libraries I created for my projects out of business |
00:48:42 | FromDiscord | <ElegantBeef> Cant tell if you're serious π |
00:50:30 | FromDiscord | <Avatarfighter> im not |
00:50:31 | FromDiscord | <Avatarfighter> well |
00:51:08 | FromDiscord | <Avatarfighter> @ElegantBeef i can't share all my secrets |
00:51:53 | FromDiscord | <ElegantBeef> lol |
00:52:22 | FromDiscord | <ElegantBeef> The Nim stdlib has some super interesting things in it, i suggest all visit it at times |
00:52:57 | FromDiscord | <ElegantBeef> Got a full on console logger π https://nim-lang.org/docs/logging.html |
00:53:05 | leorize[m] | we should update lib.rst to point people to those instead |
00:53:18 | leorize[m] | we still have logging? thought we moved that to graveyard |
00:53:26 | FromDiscord | <ElegantBeef> apparently |
00:54:01 | FromDiscord | <ElegantBeef> It's still in devel |
00:54:07 | FromDiscord | <~355/113 Man> is there a list of libraries? |
00:54:13 | FromDiscord | <ElegantBeef> https://nim-lang.org/docs/theindex.html |
00:54:26 | FromDiscord | <ElegantBeef> There are some hidden modules aswell |
00:54:34 | FromDiscord | <ElegantBeef> like `termios` and the like |
00:54:50 | FromDiscord | <ElegantBeef> Think posix is also hidden |
00:55:42 | FromDiscord | <ElegantBeef> Leorize do you have any clue why some modules are listed in the index? |
00:55:48 | FromDiscord | <ElegantBeef> (edit) "are" => "arent" |
00:56:09 | * | Jesin joined #nim |
00:56:13 | FromDiscord | <ElegantBeef> Is it cause "you arent supposed to use it unless you know you need it"? |
00:56:23 | FromDiscord | <~355/113 Man> ooh there's a `math` |
00:59:18 | FromDiscord | <ElegantBeef> Cause it's sorta weird to things like `underscored_calls` in the index but not `posix` |
00:59:32 | * | xet7 quit (Remote host closed the connection) |
00:59:41 | FromDiscord | <~355/113 Man> oh it's pretty much just functions on scalars |
00:59:59 | FromDiscord | <ElegantBeef> Well what'd you expect? |
01:01:15 | FromDiscord | <~355/113 Man> was hoping for linear algebra stuff too, lol not sure wht |
01:01:16 | FromDiscord | <~355/113 Man> (edit) "wht" => "why" |
01:01:35 | FromDiscord | <ElegantBeef> You mean like matricies and vectors? |
01:01:39 | FromDiscord | <~355/113 Man> yea |
01:01:51 | FromDiscord | <ElegantBeef> https://github.com/treeform/vmath |
01:02:41 | FromDiscord | <ElegantBeef> Not in stdlib of course but it's better than rewriting it yourself π |
01:03:54 | FromDiscord | <~355/113 Man> I rewrite a lot of things myself anyways |
01:04:26 | FromDiscord | <ElegantBeef> Well have fun π |
01:05:04 | FromDiscord | <~355/113 Man> maybe I should just try a copy/paste of my C++ Matrix4f |
01:05:30 | FromDiscord | <~355/113 Man> but i'm also trying to use tests for the first time ever |
01:13:34 | FromDiscord | <~355/113 Man> is it normal to not have assignment (so like `=`) not return anything? |
01:14:47 | Avahe[m] | What do you mean? |
01:15:23 | FromDiscord | <~355/113 Man> sent a code paste, see https://play.nim-lang.org/#ix=2P6J |
01:16:24 | BitPuffin | <FromDiscord "<Rika> well ive never met you is"> Yeah haha. Well I'm not really active in the nim community recently |
01:23:44 | Avahe[m] | I don't think assignment usually returns anything |
01:24:01 | Avahe[m] | I'm on my phone though, so I haven't double checked |
01:27:40 | FromDiscord | <~355/113 Man> it does in C and C++ and I think C# and maybe Java |
01:28:19 | Avahe[m] | You could try it or look at the Nim sauce |
01:28:58 | FromDiscord | <~355/113 Man> I did try it, would require the use of discard a lot though |
01:30:13 | FromDiscord | <InventorMatt> Unless you want to use discard alot or you are chaining functions its probably better to not return anything |
01:30:24 | FromDiscord | <~355/113 Man> yea, that's what I decided |
01:33:21 | * | Tanger quit (Quit: Leaving) |
01:34:12 | * | Tanger joined #nim |
01:35:05 | leorize[m] | @ElegantBeef not in theindex? probably because the docgen script didn't add them |
01:35:17 | leorize[m] | not in lib.rst then it's just because no one updated it |
01:46:56 | * | a_chou joined #nim |
01:50:36 | FromDiscord | <ElegantBeef> In reply to @~355/113 Man "I did try it,": `{.discardable.}` on the proc |
01:50:48 | FromDiscord | <ElegantBeef> But it's very weird to see in Nim code |
01:52:07 | * | abm quit (Read error: Connection reset by peer) |
01:53:31 | FromDiscord | <ElegantBeef> @~355/113 Man implementation https://play.nim-lang.org/#ix=2P6O |
02:18:22 | FromDiscord | <Pixtum> is there any chance that a future update would remove the need for nimscript files to have a file extension? |
02:24:03 | FromDiscord | <ElegantBeef> No technical reason why it has to have `.nims` so plausibly? π |
02:32:03 | FromDiscord | <Pixtum> ok, it's just kinda odd imo, if I want to distribute a small program in nimscript that I have to leave that tag or wrap it in something |
02:33:23 | FromDiscord | <ElegantBeef> i mean it tells you what interpreter to use, so it's pretty ok |
02:33:30 | FromDiscord | <ElegantBeef> What are you distributing if i may ask? |
02:54:18 | * | a_chou quit (Remote host closed the connection) |
02:54:36 | * | a_chou joined #nim |
03:13:09 | * | asdflkj_2 quit (Ping timeout: 264 seconds) |
03:13:18 | * | j-james joined #nim |
03:24:41 | * | wasted_youth2 quit (Quit: Leaving) |
03:41:36 | FromDiscord | <Rika> BitPuffin any plans on coming back? xd |
03:46:14 | * | muffindrake quit (Ping timeout: 264 seconds) |
03:47:58 | * | muffindrake joined #nim |
03:51:13 | * | rockcavera quit (Remote host closed the connection) |
04:01:07 | * | vicfred quit (Quit: Leaving) |
04:02:48 | * | j-james quit (Quit: WeeChat 3.0) |
04:46:07 | * | spiderstew_ quit (Ping timeout: 260 seconds) |
04:46:20 | * | spiderstew joined #nim |
04:50:43 | * | njoseph joined #nim |
04:59:16 | * | njoseph quit (Quit: http://quassel-irc.org - Chat comfortably. Anywhere.) |
04:59:40 | * | njoseph joined #nim |
05:10:25 | * | njoseph quit (Quit: http://quassel-irc.org - Chat comfortably. Anywhere.) |
05:10:33 | * | njoseph joined #nim |
05:11:41 | * | njoseph quit (Client Quit) |
05:11:48 | * | njoseph joined #nim |
05:23:22 | FromGitter | <timotheecour> yikes: https://www.bleepingcomputer.com/news/security/trickbots-bazarbackdoor-malware-is-now-coded-in-nim-to-evade-antivirus/ ; not sure we need this kind of publicity |
05:32:52 | FromDiscord | <ElegantBeef> I mean it's bound to occur |
05:34:47 | FromDiscord | <Zeus> https://media.discordapp.net/attachments/371759389889003532/809658740894466058/unknown.png |
05:34:59 | FromDiscord | <Zeus> Maybe they just really like Nim :-p |
05:35:38 | FromDiscord | <~355/113 Man> I wouldn't blame them, i've been using nim for only 2 days and I already love it |
05:41:19 | leorize[m] | it just to show that antivirus are horrible :p |
05:43:01 | * | waleee-cl quit (Quit: Connection closed for inactivity) |
06:14:19 | * | opal joined #nim |
06:15:26 | * | a_chou quit (Remote host closed the connection) |
06:16:00 | * | a_chou joined #nim |
06:32:12 | * | a_chou quit (Remote host closed the connection) |
06:45:56 | FromDiscord | <~355/113 Man> sent a code paste, see https://play.nim-lang.org/#ix=2P7E |
06:46:50 | * | opal left #nim ("i'm never coming back") |
06:47:33 | FromDiscord | <~355/113 Man> (eps is a public var double btw) |
06:47:44 | FromDiscord | <~355/113 Man> (edit) "btw)" => "btw `var eps = 0.0001`)" |
06:50:20 | FromDiscord | <InventorMatt> because eps is a variable it needs to be a constant to avoid side effects |
06:51:05 | FromDiscord | <~355/113 Man> hmm, is there a way to have eps not constant? (and avoid side effects) |
06:51:43 | FromDiscord | <~355/113 Man> or is the side effect that if eps is changed the output of the function will change |
06:51:55 | FromDiscord | <InventorMatt> yes, that is the side effect |
06:52:03 | FromDiscord | <~355/113 Man> ah ok, i'll just make it a proc then |
07:53:52 | FromGitter | <offbeat-stuff> anyone know how to sort merge and intersect and intervals on the surface of a sphere |
07:55:26 | FromGitter | <offbeat-stuff> Like I have many shapes Which I know cover a certain fov from a point around in 2d space |
07:55:58 | FromGitter | <offbeat-stuff> I want to create intervals to those angles |
08:02:04 | * | PMunch joined #nim |
08:12:33 | * | Tanger quit (Ping timeout: 264 seconds) |
09:02:49 | FromDiscord | <ElegantBeef> Pmunch does options-utils have anything similar to this? https://play.nim-lang.org/#ix=2P7j |
09:03:09 | PMunch | Yup |
09:04:36 | FromDiscord | <ElegantBeef> What does it, i couldnt find it myself earlier |
09:05:08 | PMunch | https://github.com/PMunch/nim-optionsutils/blob/master/tests/toptionsutils.nim#L24 |
09:05:42 | FromDiscord | <ElegantBeef> That's not what then does |
09:05:59 | PMunch | Ooh |
09:06:02 | FromDiscord | <ElegantBeef> then takes the value and converts it to an option only if the condition is met |
09:06:11 | PMunch | Sorry, I misread that snippet |
09:06:13 | FromDiscord | <ElegantBeef> Otherwise it's a none |
09:06:14 | FromDiscord | <ElegantBeef> Ah |
09:06:20 | PMunch | Hmm, I don't think it has that no |
09:06:34 | PMunch | But I'm happy to accept a PR request for it |
09:06:35 | FromDiscord | <ElegantBeef> Yea i seen that Rust had it and it seemed like a nice api |
09:07:25 | PMunch | Yeah it looks pretty neat |
09:10:12 | * | MarderIII joined #nim |
09:10:47 | FromDiscord | <ElegantBeef> Oh cool i thought there would be an issue with if you have `false` and a procedure call as the val but it seems it doesnt invoke the proc |
09:11:27 | FromDiscord | <ElegantBeef> I guess that makes sense considering the fact the type is figured at CT |
09:12:29 | FromDiscord | <ElegantBeef> Also did i ever show that tiled web browser? |
09:12:49 | FromDiscord | <ElegantBeef> It's not usable as a daily driver, but it's pretty interesting |
09:14:53 | PMunch | Tiled web browser? |
09:15:00 | PMunch | No you definitely didn't show me that! |
09:15:04 | FromDiscord | <ElegantBeef> https://github.com/mlajtos/mosaic |
09:15:38 | FromDiscord | <ElegantBeef> It doesnt have keyboard shortcuts nor is it really usable, but yea it's pretty cool |
09:19:14 | PMunch | Hmm, Vivaldi (the browser I used to use (and consider switching back to)) also has this feature |
09:19:28 | PMunch | And it's much more useable :P |
09:19:56 | FromDiscord | <ElegantBeef> Ah |
09:20:04 | FromDiscord | <ElegantBeef> I never seen it before |
09:20:12 | FromDiscord | <ElegantBeef> Did it support keyboard navigation? |
09:20:26 | PMunch | Well it has the usual stuff |
09:20:32 | PMunch | But I had Vimium installed |
09:20:44 | PMunch | Which gave me more convenient shortcuts |
09:20:53 | PMunch | And the ability to click links |
09:21:06 | PMunch | I've also been playing with nyxt over the past couple of days |
09:23:25 | PMunch | Well shit.. I've had a headache since yesterday morning. Turns out it was just a lack of coffee.. |
09:23:32 | PMunch | Maybe I should cut back a bit |
09:24:30 | FromDiscord | <ElegantBeef> Possibly π |
09:24:36 | liblq-dev | LMAO |
09:24:43 | liblq-dev | you pinged ache-of-head by saying headache |
09:24:56 | PMunch | :P |
09:25:29 | FromDiscord | <ElegantBeef> I've been trying to use Moe a bit more, i cannot wait for LSP support in it, linting and actual suggestions would vbe cool |
09:25:42 | FromDiscord | <ElegantBeef> You just pinged someone named ed, so take that |
09:32:35 | PMunch | But seriously, I was massively unproductive all yesterday and when I woke up today I was a bit worried how long the headache would last. Turns out my first cup of coffee was how long it would last |
09:32:57 | FromDiscord | <ElegantBeef> Druggie! |
09:33:07 | PMunch | I can stop whenever I want! |
09:33:25 | PMunch | And it isn't hurting anyone! |
09:33:29 | PMunch | Mind your own business! |
09:33:50 | headache | i can stop whenever you want as well |
09:34:18 | PMunch | Haha, good to see that you left my head and decided to join IRC instead :P |
09:34:43 | PMunch | By the way @Elegant, if it wasn't clear enough that was just a joke :P |
09:34:45 | headache | i'm on matrix right now, checking it out |
09:34:47 | FromDiscord | <ElegantBeef> There you go pmunch got a pr |
09:35:02 | PMunch | @Elegant, sweet! |
09:35:04 | FromDiscord | <ElegantBeef> Wait you can joke, i always thought you were just an asshole? |
09:35:10 | FromDiscord | <ElegantBeef> See that's a joke |
09:35:22 | FromDiscord | <Rika> Was it |
09:35:33 | PMunch | Haha |
09:35:36 | FromDiscord | <Solitude> it was, im laughing |
09:35:57 | FromDiscord | <ElegantBeef> Rika doesnt like my jokes ever |
09:36:05 | headache | dam |
09:36:19 | FromDiscord | <Rika> Hey I like your parents jokes at least |
09:37:04 | FromDiscord | <ElegantBeef> Yea well they dont, my mom when i was born said "What a treasure!" and my dad responded "You think, i'll get the shovel to bury it" |
09:37:24 | headache | oh no |
09:37:48 | FromDiscord | <Solitude> wait, this isnt offtopic. MODS, ban these guys |
09:37:55 | FromDiscord | <Rika> Gtg lol have to walk 3 km |
09:38:09 | FromDiscord | <ElegantBeef> Have fun, remember shit goes down hill |
09:38:28 | PMunch | @Rika just coming in here setting things ablaze and then running away :P |
09:39:14 | PMunch | But yeah, this should probably have gone in offtopic |
09:39:54 | FromDiscord | <ElegantBeef> He i was talking about moe |
09:40:03 | FromDiscord | <ElegantBeef> (edit) "He" => "Hey" |
09:40:03 | FromDiscord | <ElegantBeef> That's written in Nim, cannot be more on topic than that! |
09:40:03 | Yardanico | dafaq happened to discord |
09:40:19 | FromDiscord | <Yardanico> Ah nvm it's back |
09:40:20 | PMunch | That's true @Elegant, moe and optionsutils :) |
09:40:24 | FromDiscord | <ElegantBeef> Yea was ssuper laggy |
09:40:41 | FromDiscord | <Yardanico> for me the client wrote "server is unavailable due to temporary outage" for the Nim server |
09:40:45 | FromDiscord | <ElegantBeef> Rust also has a `then_some` but i couldnt figure out the purpose |
09:40:58 | FromDiscord | <ElegantBeef> It seems to be a impl for their functions |
09:41:06 | FromDiscord | <ElegantBeef> Those are works for free as far as i can see |
09:41:13 | FromDiscord | <ElegantBeef> You pass it a function call it doesnt care |
09:41:22 | PMunch | It's to be able to write `100 and then_some` |
09:41:43 | FromDiscord | <ElegantBeef> lol |
09:42:26 | FromDiscord | <ElegantBeef> Ah sorry their `then` was different https://doc.rust-lang.org/std/primitive.bool.html#method.then |
09:44:02 | FromDiscord | <ElegantBeef> I think that only exists for function calls? idk it's weird, i liked then so we get it |
09:44:18 | PMunch | By the way, care to add it to the documentation as well? |
09:44:45 | FromDiscord | <ElegantBeef> You dont just use nim's docgen? π |
09:45:59 | PMunch | Well I have this as well: https://github.com/PMunch/nim-optionsutils/blob/master/src/optionsutils.nim#L1-L126 |
09:46:13 | PMunch | Still part of Nims docgen, but explains it a bit further with examples and such |
09:46:26 | PMunch | But I guess `then` is easy enough not to warrant that |
09:47:00 | FromDiscord | <ElegantBeef> I could add a runnable example |
09:47:09 | FromDiscord | <ElegantBeef> Forgot to do that |
09:50:08 | FromDiscord | <ElegantBeef> Wait you dont export options in the module |
09:50:17 | FromDiscord | <ElegantBeef> Docgen wouldnt cause of that π |
09:54:06 | liblq-dev | @ElegantBeef rust closures compared to nim closures are dirt cheap |
09:54:16 | FromDiscord | <ElegantBeef> Ok? |
09:55:36 | FromDiscord | <ElegantBeef> Sorry i just dont know why you said that |
09:56:46 | * | Vladar joined #nim |
09:59:19 | FromDiscord | <ElegantBeef> Pmunch you've got another PR |
10:00:55 | FromDiscord | <ElegantBeef> Oh |
10:01:57 | FromDiscord | <ElegantBeef> You dont want to all of options? |
10:02:16 | FromDiscord | <ElegantBeef> I see i should be using `toOpt` instead of `some`? |
10:04:16 | liblq-dev | @ElegantBeef i said that because you mentioned "Those are works for free as far as i can see" |
10:05:02 | FromDiscord | <ElegantBeef> yea i meant "for those, our work for free" since the macro works for both |
10:05:03 | liblq-dev | so i just confirmed that they work for free |
10:11:09 | PMunch | The reason why `option` isn't exported is if people want to use `safeoptions` which makes it so that you can't call `get` and `unsafeGet`. This ensures that only the chaining and block versions that optionsutils supply can be used meaning you won't have exceptions. |
10:11:47 | FromDiscord | <ElegantBeef> yea i realized that you dont want to export all of options as far as i can telll |
10:11:57 | FromDiscord | <ElegantBeef> And to answer that disppearing new line, no friggin clue π |
10:20:54 | PMunch | Haha, I was worried this was some new Nim style-trend |
10:21:10 | FromDiscord | <ElegantBeef> Dont expect that from me i dont have style |
10:24:41 | FromDiscord | <Yardanico> so uhh |
10:24:59 | FromDiscord | <Yardanico> is it a known bug that hints/warnings from a module don't work if you import it with "../"? same also happens with nimble-installed modules |
10:25:28 | FromDiscord | <Solitude> amazing |
10:25:50 | FromDiscord | <ElegantBeef> Might be intended no? So you dont get warnings from other package creators |
10:26:03 | FromDiscord | <Solitude> lol |
10:26:25 | PMunch | Pretty sure that's not intended |
10:26:42 | FromDiscord | <ElegantBeef> Well the hints could be, but the warnings certainly are not |
10:26:43 | FromDiscord | <Solitude> thats wrong reproduction, boys, pack it up |
10:27:49 | FromDiscord | <ElegantBeef> I dont need no stinking import hint from a nimble package π |
10:29:44 | FromDiscord | <Yardanico> not import hints |
10:29:47 | FromDiscord | <Yardanico> you didn't understand |
10:29:55 | FromDiscord | <ElegantBeef> No i did |
10:30:07 | FromDiscord | <Yardanico> @ElegantBeef when a package has {.hint: "test.} or {.warning: "test".} when you import it, those hints or warnings should be printed IMO |
10:30:09 | FromDiscord | <Yardanico> but they are not |
10:30:17 | FromDiscord | <Yardanico> they are when you use normal relative imports without nimble |
10:30:19 | FromDiscord | <ElegantBeef> Yea that's what i understood |
10:36:31 | * | wasted_youth2 joined #nim |
10:37:22 | ForumUpdaterBot | New thread by Alexeypetrushin: Nim Design Patterns?, see https://forum.nim-lang.org/t/7498 |
10:58:06 | FromDiscord | <dom96> In reply to @timotheecour "yikes: https://www.bleepingcomputer.com/news/securi": @timotheecour: if anything it just shows that Nim is great for portable software π |
10:58:30 | FromDiscord | <Yardanico> yeah, nothing wrong with nim being used for writing malware :P |
10:58:40 | FromDiscord | <Yardanico> except that nim binaries will probably get false detections by antivirus software |
10:58:42 | FromDiscord | <Yardanico> more |
11:00:13 | FromDiscord | <dom96> hah |
11:00:27 | FromDiscord | <dom96> "nim" in readFile(binary.exe): return "Yep, that's a virus" |
11:00:49 | FromGitter | <Araq> https://github.com/nim-lang/Nim/pull/17020 interesting discussion here |
11:01:02 | FromGitter | <Araq> and it's about the lexer so everybody has an opinion |
11:01:19 | FromGitter | <Araq> (it's also a really important feature, no irony) |
11:02:24 | FromDiscord | <Rika> Sounds strong but that would mean a change in spec would it? |
11:02:38 | Yardanico | @Araq is it intended that user hints/warnings are not displayed if they come from nimble packages? I get why normal warnings/hints aren't displayed if they come from nimble files, but why should it be the case for developer-made hints/warnings? |
11:02:50 | Yardanico | changing compiler/options.nim line 431 to const foreignPackageNotesDefault* = {warnUser, hintUser, hintProcessing, warnUnknownMagic, hintQuitCalled, hintExecuting} fixes that |
11:03:27 | Yardanico | s/nimble files/nimble packages |
11:03:36 | FromGitter | <Araq> yes, that's a feature |
11:04:06 | Yardanico | even for user hints/warns? |
11:04:48 | FromGitter | <Araq> hardly. but it's done "consistently" so you cannot complain. |
11:05:02 | FromDiscord | <Solitude> i can |
11:05:14 | Yardanico | well, I just know that I used user warnings in my package and thought that they will be displayed |
11:05:17 | FromGitter | <Araq> I learned consistency is a value in itself. That's why I will only use the letter A from now on. |
11:05:25 | Yardanico | I can actually check how many packages use user hints/warns |
11:05:28 | FromDiscord | <Solitude> whats the point of user hints then? |
11:05:32 | FromGitter | <Araq> AA. |
11:05:39 | FromDiscord | <Ardek> AA |
11:05:48 | FromDiscord | <Rika> I think heβs being extra sarcastic haha |
11:05:57 | Yardanico | aaaaaaaaaaaaaaaaaaa |
11:08:30 | FromDiscord | <dom96> Do other langs do this too? |
11:08:40 | FromGitter | <Araq> AA. |
11:09:20 | FromDiscord | <dom96> I think open source work has finally made Araq snap |
11:09:20 | Yardanico | ok, packages that have user hints: asynctools, chipmunk6, contra, nimcx, nimlapack, Nimscripter, nimx, nsh, numnim, rapid, sigv4, timezones |
11:09:29 | Yardanico | and I mean {.hint: "some message.} |
11:09:31 | Yardanico | " |
11:10:48 | FromGitter | <Araq> ok, enough of this. yeah, let's please fix this |
11:10:56 | FromGitter | <Araq> user messages are not package specific |
11:11:23 | FromGitter | <Araq> it also kept me from warning about async + gc:arc ("use gc:orc instead") |
11:13:05 | FromDiscord | <dom96> warn? that should be an error |
11:13:28 | Yardanico | well, we give the users a choice |
11:13:32 | Yardanico | so they can leak memory if they want :D |
11:21:18 | Yardanico | https://github.com/nim-lang/Nim/pull/17024 |
11:23:39 | * | leorize quit (Remote host closed the connection) |
11:24:17 | * | sekao[m] joined #nim |
11:24:24 | * | leorize joined #nim |
11:24:32 | FromDiscord | <Rika> Do we have something that makes all warnings into errors? |
11:24:37 | FromDiscord | <Rika> Or categories of such |
11:25:11 | FromDiscord | <Yardanico> yes |
11:25:35 | FromDiscord | <Rika> Then indeed the orc thing should be a warning |
11:25:35 | FromDiscord | <Yardanico> we even have "hints as errors" |
11:26:01 | FromDiscord | <Yardanico> only in devel though |
11:30:45 | * | abm joined #nim |
11:33:41 | FromDiscord | <Yardanico> it's a bit surprising that some packages like weave had those user warnings but no one noticed that they're not displayed :P |
11:33:50 | FromDiscord | <Yardanico> https://media.discordapp.net/attachments/371759389889003532/809749100270452736/unknown.png |
11:41:06 | FromDiscord | <mratsim> tlsEmulation was disabled on MacOS following a change by timotheecour I think |
11:41:30 | FromDiscord | <Yardanico> @mratsim no, I mean that no one who installed weave from nimble saw any of your warnings |
11:41:50 | FromDiscord | <Yardanico> e.g. this wasn't displayed https://media.discordapp.net/attachments/371759389889003532/809751109060788254/unknown.png |
11:41:54 | FromDiscord | <mratsim> no one must use Weave then :p |
11:42:03 | FromDiscord | <pouriya.jamshidi> Hey everyoneβ΅Is there a way to tinker with socket or nativesocket to not send an ack upon receiving syn/ack?β΅β΅we're trying to make a custom tool to test our firewalls |
11:42:28 | FromDiscord | <mratsim> In reply to @Yardanico "e.g. this wasn't displayed": this one was to detect compiler bugs/regressions |
11:42:37 | FromDiscord | <Yardanico> @mratsim oh okay |
11:43:14 | FromDiscord | <mratsim> this: https://github.com/nim-lang/Nim/issues/14118 |
11:44:08 | FromDiscord | <mratsim> I don't remember why I made this a warning and not an error though |
11:45:10 | FromDiscord | <Yardanico> yeah seems like a few packages use {.warning where it should've been an {.error |
11:45:57 | FromDiscord | <mratsim> it used to be an error, that's how i detected the bug in the first place |
11:46:40 | FromDiscord | <Yardanico> also nimcx has the biggest user "hint" of all packages :P |
11:46:41 | FromDiscord | <Yardanico> https://media.discordapp.net/attachments/371759389889003532/809752333914472488/unknown.png |
11:46:57 | FromDiscord | <Yardanico> something like this https://media.discordapp.net/attachments/371759389889003532/809752398159151124/unknown.png |
11:47:13 | FromDiscord | <mratsim> wtf? lol |
11:47:17 | FromDiscord | <Yardanico> for some reason he put it in almost all nimcx files |
11:47:26 | FromDiscord | <Yardanico> https://media.discordapp.net/attachments/371759389889003532/809752521349267477/unknown.png |
11:47:34 | FromDiscord | <Yardanico> https://media.discordapp.net/attachments/371759389889003532/809752553817767976/unknown.png |
11:47:45 | FromDiscord | <Yardanico> ah, different submodules |
11:48:51 | FromDiscord | <Yardanico> so when you import "cx" itself you'll see this https://media.discordapp.net/attachments/371759389889003532/809752877753040916/unknown.png |
11:50:58 | FromDiscord | <Rika> Eh |
11:51:00 | FromDiscord | <Rika> Why |
11:51:04 | FromDiscord | <Yardanico> ask nimcx's author :D |
11:51:17 | FromDiscord | <Yardanico> https://github.com/qqtop/NimCx |
11:51:28 | FromDiscord | <Solitude> he look to much at npm packages |
11:51:31 | FromDiscord | <Solitude> (edit) "look" => "looked" |
11:51:35 | FromDiscord | <Solitude> (edit) "to" => "too" |
11:53:28 | FromDiscord | <Ardek> npm is an example to follow |
12:19:10 | * | irchazwell_ joined #nim |
12:21:31 | * | rockcavera joined #nim |
12:22:41 | * | irchaxwell quit (Ping timeout: 265 seconds) |
12:23:36 | * | lritter joined #nim |
12:23:50 | FromDiscord | <dom96> In reply to @pouriya.jamshidi "Hey everyone Is there": For that you should look up how to do it in C and then just use the nativesockets/POSIX APIs as they are used in the C examples |
12:37:22 | * | haxscramper joined #nim |
12:49:12 | FromDiscord | <Rika> Is the c++ backend of Nim usually slower? Or faster? |
12:49:24 | FromDiscord | <Rika> Rather I guess my question is more of |
12:49:42 | FromDiscord | <Rika> Why donβt people use the c++ backend as much as the c one |
12:50:56 | FromDiscord | <pouriya.jamshidi> In reply to @dom96 "For that you should": thanks |
12:51:59 | FromDiscord | <Yardanico> @Rika because the default backend is C :) |
12:52:39 | FromDiscord | <Rika> Well are there significant dis/advantages to using the c++ backend |
12:52:44 | FromDiscord | <Yardanico> I don't think so |
12:52:58 | FromDiscord | <Rika> Okay, thanks, time to figure out QT |
12:53:00 | FromDiscord | <Yardanico> IIRC even 4raq says that Nim C++ backend should be used more often |
12:53:01 | FromDiscord | <Rika> Qt |
12:56:50 | FromDiscord | <Zachary Carter> gl! |
13:01:39 | FromGitter | <Araq> the C++ backend still has more bugs though. The test coverage has become really good, `koch boot` works with C++ too |
13:02:44 | FromGitter | <Araq> in theory the C++ backend has the much faster exception handling implementation, in practice I haven't seen it to make much of a difference, --goto:exceptions closed the gap |
13:15:34 | planetis[m] | so which one is better, exceptions or result types? |
13:17:09 | * | Guest91629 quit (K-Lined) |
13:19:57 | FromDiscord | <konsumlamm> depends on your preferred style ig? exceptions are used in the standard library (while result types aren't), so that's one point in favor of them |
13:20:21 | * | asdflkj_2 joined #nim |
13:39:03 | * | irchazwell_ quit (Ping timeout: 265 seconds) |
13:40:03 | FromGitter | <Araq> result type doesn't work for `[](x: var Container): var T` |
13:59:31 | * | Vladar quit (Remote host closed the connection) |
14:03:27 | * | Vladar joined #nim |
14:09:13 | federico3 | https://www.bleepingcomputer.com/news/security/trickbots-bazarbackdoor-malware-is-now-coded-in-nim-to-evade-antivirus/ |
14:10:44 | FromGitter | <Araq> yes, Timothee also told us |
14:15:19 | FromDiscord | <dom96> This is cool https://github.com/jimblandy/context-switch |
14:32:42 | PMunch | federico3, isn't their assumption a bit weird? Would Nim create significantly different binary structures to a program written directly in C? |
14:33:22 | FromDiscord | <mratsim> In reply to @PMunch "<@420949929062563842>, isn't their assumption": Antivirus are dumb pattern matching engine |
14:33:33 | FromDiscord | <mratsim> pattern is different, "does not match" |
14:33:39 | PMunch | Yeah I know, but I thought that was based on fingerprinting |
14:33:52 | PMunch | So as soon as a Nim program is fingerprinted it would be the same thing |
14:34:09 | federico3 | @mratsim: some have heuristics and some even more |
14:34:33 | FromGitter | <Araq> yeah, but it's a quick way to fight the antivir until it catches up |
14:34:50 | FromDiscord | <Rika> what is the fundamental difference of rust's "async" and everyone elses? |
14:35:04 | PMunch | This seems to be more about disecting the binary structure and finding "suspicious" things so the binary can be flagged |
14:35:51 | federico3 | yet the article is very vague and even writes "focused on traditional binaries compiled in C/C++ style languages"... but Nim binaries are usually generated from C |
14:35:58 | PMunch | TBH I think it's less about detection and more about low level of technical debt and company structure means you can try out whichever language you want |
14:36:25 | FromDiscord | <Rika> i think its more because nim is another layer of translation |
14:36:33 | PMunch | Exactly, that's why I was wondering if Nim did something weird to the binary structure itself, which I don't think it does |
14:36:36 | FromDiscord | <Rika> ya know, more translations mean more confusion |
14:36:48 | PMunch | Hmm, maybe |
14:36:58 | PMunch | I would be interested in seeing some Nim malware |
14:37:20 | PMunch | Curious to see how well-written it is |
14:37:46 | FromDiscord | <mratsim> malware that you can see is probably not a good malware, nowadays they are hidden ;;) |
14:37:49 | FromDiscord | <mratsim> https://github.com/byt3bl33d3r/OffensiveNim |
14:37:59 | * | vicfred joined #nim |
14:38:15 | federico3 | no, if anything an application written in plain C has less known patterns than one in Nim |
14:38:25 | FromGitter | <Araq> the Nim idioms translate to C that uses Nim's runtime and is easily quite different from "native C" |
14:38:53 | PMunch | I think these points are more of the reason to pick Nim: https://github.com/byt3bl33d3r/OffensiveNim#why-nim |
14:38:53 | FromGitter | <Araq> you can usually also tell if a binary was produced by C++ rather than C for the same reasons |
14:39:02 | FromDiscord | <mratsim> still, when you look at the assembly, it really ressembles C |
14:39:23 | FromDiscord | <mratsim> I stare at Nim / C assembly quite often. |
14:39:24 | * | asdflkj_2 quit (Ping timeout: 240 seconds) |
14:39:46 | FromDiscord | <mratsim> not sure for branchy code though, Nim for/while/gogo label transformations might do weird things |
14:39:50 | federico3 | however some heuristics might be looking for patterns generated by popular libraries in C |
14:40:06 | PMunch | Slim binaries that can be compiled to anywhere. 0-layer access to C/C++ and assembly so if you need to do some "tricks" it would be trivial. |
14:40:10 | federico3 | and alarm if they find such thing in unexpected places |
14:40:28 | PMunch | And the point "Avoids making you actually write in C/C++" I think we can all relate to |
14:41:02 | FromDiscord | <dom96> Let's just hope they don't add even more stupid rules that will autoflag any Nim programs as malware |
14:41:07 | FromGitter | <Araq> give me a binary file and I can tell you which language it comes from. Unless it's mratsim's code, of course |
14:41:14 | FromDiscord | <Rika> no one answered my rust vs everyone's async question π¦ |
14:41:31 | FromDiscord | <mratsim> In reply to @Araq "give me a binary": Uh? what did my code do xD |
14:41:35 | PMunch | @Rika, sorry I have no idea, but I'm curious as well. |
14:41:39 | FromDiscord | <dom96> From my experience there are many stupid antiviruses, some freak out if your binary dares to staticRead an executable |
14:41:40 | FromDiscord | <Rika> the link dom sent makes it really sound like rust's async changes everything |
14:41:47 | PMunch | @dom96, are you planning on doing a similar experiment with Nim async? |
14:41:56 | FromDiscord | <Rika> which i, of course, have a hard time believing |
14:42:21 | FromDiscord | <mratsim> In reply to @Rika "the link dom sent": I think the benchmark are flawed, Rust async context switch looks really slow given their design choice |
14:42:32 | FromDiscord | <dom96> PMunch: I don't think so, I'd rather focus on making Nim's async work better with Nim's parallelism |
14:42:40 | FromDiscord | <mratsim> they should switch in less than 4 nanoseconds |
14:42:46 | PMunch | @Rika, if anything it looks like "async might not be as good compared to a threadpool as you think" |
14:43:05 | FromGitter | <Araq> mratsim: C++'s runtime is different from Nim's which is different from C's which is different from Rust's |
14:43:17 | FromGitter | <Araq> that's all I meant to say |
14:43:24 | FromDiscord | <mratsim> and my code runtime? |
14:43:26 | PMunch | @dom96, probably a good idea, I was just curious. I've been playing around a bit with similar ideas just for fun |
14:43:31 | FromDiscord | <Rika> whats so special with mratsim's code tho lmao |
14:43:42 | FromGitter | <Araq> and usually nobody avoids the runtime on the startup sequence and in non-critical code sections |
14:44:11 | FromGitter | <Araq> so you can tell, it doesn't matter that your super optimized inner loops look like handcoded assembler |
14:44:15 | PMunch | I was thinking of combining my fibers/coroutine stuff with my colourless async, and my simple work-stealing algorithm and see if I could get something similar to async running across thread without having to flag everything as async |
14:44:32 | FromDiscord | <mratsim> color is good |
14:44:40 | FromDiscord | <mratsim> I want to know if a proc can suspend |
14:45:03 | PMunch | You will still have colour |
14:45:04 | FromDiscord | <mratsim> there is a reason why evolution gave us the ability to perceive colors. |
14:45:09 | PMunch | Just no discrimination based on colour :P |
14:45:15 | FromDiscord | <dom96> haha |
14:45:24 | FromGitter | <Araq> different colors are inconsistent |
14:45:32 | PMunch | So you can call async from a non-async and non-async from async |
14:45:34 | FromDiscord | <mratsim> are you an artist now? |
14:45:35 | FromGitter | <Araq> colors were a bad idea. |
14:45:51 | FromDiscord | <mratsim> colors are the spice to the world |
14:45:52 | FromDiscord | <dom96> All you need is a mechanism by which to change red into green π |
14:45:57 | PMunch | Along with passing async things into places that expects a sync callback for example |
14:46:16 | FromDiscord | <mratsim> you will have an issue with fibers and calling convention. |
14:46:27 | PMunch | Oh? |
14:46:30 | FromDiscord | <Rika> i wish i saw the difference between red and green |
14:46:40 | FromDiscord | <mratsim> you have things to do to save/restor stackframes |
14:46:59 | FromDiscord | <mratsim> meaning calling a fiber and a non-fiber is differet == color |
14:47:08 | FromDiscord | <mratsim> or you compile 2 versions |
14:47:13 | FromDiscord | <mratsim> which is what Cilk does. |
14:48:09 | FromDiscord | <mratsim> Embrace continuations and make both async and threading use continuation as the base layer. |
14:48:17 | FromDiscord | <mratsim> and then no compat issue. |
14:48:38 | FromGitter | <Araq> mratsim: please write the RFC |
14:49:02 | FromDiscord | <mratsim> https://github.com/weavers-guild/weave-io/blob/master/design/design_2_continuations.md |
14:49:20 | FromDiscord | <mratsim> still WIP because I need to (re)write an implementation |
14:49:48 | FromDiscord | <mratsim> but there are examples in this branch on where I stopped: https://github.com/disruptek/cps/tree/mratsim-public-api-proposal/mratsim |
14:52:17 | FromGitter | <Araq> tell me one thing please (I will also study your article): since you have a thread pool, every thread runs a task on its own stack but then you said you don't need "cactus" stacks |
14:53:05 | FromDiscord | <mratsim> I don't understand the question. |
14:53:26 | FromGitter | <Araq> so you need to do some copying into the task. but only if the task will run on a different thread. otherwise you could skip the copy step |
14:53:55 | FromGitter | <Araq> do you do anything like that or do you always copy? |
14:54:44 | FromGitter | <Araq> (for example, how to send 'var buf: array[5000, char]' to the task queue) |
14:55:06 | FromDiscord | <mratsim> Cactus stacks are needed in 2 cases:β΅- You use fibers and you manipulate the stask pointers on function entryβ΅- You want to do continuation-stealing (Cilk style) because it's more efficient than child-stealing (OpenMP, TBB, Weave): https://github.com/weavers-guild/weave-io/blob/master/research/n3872%20-%20work-stealing%20continuations%20or%20child%20tasks.pdf |
14:55:57 | FromDiscord | <mratsim> for buffers, you copy or send a pointer (and you have to deal with ownership) |
14:56:22 | FromGitter | <Araq> you cannot send a pointer, the stack frame is about to disappear |
14:56:29 | FromDiscord | <mratsim> The buffer issues is creating problems in Rust to support completion ased API like io-uring and IOCP |
14:56:46 | FromGitter | <Araq> (in the general case) |
14:57:24 | FromGitter | <Araq> what you can do is to have the buffer inside a .consumable proc and then the compiler creates it on the heap from the beginning |
14:57:37 | FromDiscord | <mratsim> yes, that's the problem of Rust zero-cost futures and IOCP, there are cases where the buffer needs to be on the heap with clear ownership: https://github.com/weavers-guild/weave-io/blob/master/research/async_await_cancellation_rust_matthias247.md |
14:57:52 | FromGitter | <Araq> so the buffer always is the environment and doesn't have to be copied |
14:58:01 | FromGitter | <Araq> no matter if the same thread picks it up or not |
14:58:10 | FromDiscord | <mratsim> yes |
14:59:18 | * | clyybber joined #nim |
14:59:26 | * | asdflkj_2 joined #nim |
14:59:50 | FromDiscord | <mratsim> but your buffer is passed as a parameter to the function? `proc readFrom(buf: var buffer[4096], conn: Socket) {.resumable.}` or is it created internally? |
15:01:43 | FromGitter | <Araq> if it's a parameter, there is little you can do. |
15:02:06 | FromGitter | <Araq> if it's created "internally", there is hope the compiler puts it into the environment |
15:02:26 | FromDiscord | <mratsim> if it's internal and it crosses a suspension point it will be part of the environment. regarding the copyno-copy it's an optimization. |
15:02:48 | FromDiscord | <mratsim> this is similar to "heap allocation elision" |
15:03:23 | FromDiscord | <mratsim> if the compiler sees that the continuations/coroutines is only used in the creating scope, there is no need to put it on the heap |
15:04:06 | FromDiscord | <mratsim> In C++, Clang is able to do constant folding across stack coroutines: https://godbolt.org/g/26viuZ |
15:04:34 | FromGitter | <Araq> I don't mind heap elision optimizations and we have the technology ready for it (it's not that different from escape analysis, deep immutability or anything we already do) |
15:05:09 | FromDiscord | <mratsim> for the copy no-copy, I'm pretty sure disruptek's code does directly create the environment |
15:05:25 | FromDiscord | <mratsim> and then use template a: untyped = env.a |
15:05:40 | FromGitter | <Araq> but I wonder if an explicit `task` isn't the better idea |
15:06:30 | FromGitter | <Araq> I'm also not a big fan of our traditional closures for the same reason |
15:06:39 | FromDiscord | <mratsim> I somewhat hint at this i think. A Future is a coroutine for example |
15:06:58 | FromGitter | <Araq> it's a poor man's object system that is problematic for serializations |
15:09:28 | FromDiscord | <mratsim> What I'd like is for closures is: being able to capture variables myself, and the resulting closure can be manually memory managed |
15:10:03 | FromDiscord | <mratsim> I don't mind having to specify the variables to capture. |
15:10:10 | FromDiscord | <mratsim> This is what i do in Weave. |
15:10:57 | FromDiscord | <mratsim> and for sequences/arrays, I'm not too sure how that can work, would have to look into Rust, but having to do foo[0].unsafeAddr is very annoying. |
15:11:25 | FromDiscord | <mratsim> I assume Async and openarrays is similarly problematic. |
15:14:11 | FromDiscord | <konsumlamm> would it be viable to automatically use rlwrap for `nim secret`? |
15:15:17 | FromDiscord | <mratsim> ssshhhhhh you said the forbidden word |
15:15:29 | FromDiscord | <mratsim> I'm sad to let you go, you were a valuable member of the community |
15:15:58 | FromDiscord | <konsumlamm> k, one last question, is the forbidden word "secret" or "viable"? |
15:16:06 | FromDiscord | <Rika> you did too mratsim ,you're not allowed to say rst uncensored |
15:16:13 | FromDiscord | <mratsim> please reflect on your action in the corner :p |
15:16:15 | FromDiscord | <Rika> ~~dont mind me doing such as well a few minutes ago~~ |
15:16:48 | FromDiscord | <mratsim> nim scret is really a stopgap and any change would have to be really small and not cause maintenance burden. |
15:17:15 | Clonkk[m] | Inim is a better REPL than the REPL we shouldn't talk about (apparently) |
15:17:30 | FromDiscord | <mratsim> "nim voldemort" |
15:17:45 | Clonkk[m] | Because Nim doesn't have a nose ? |
15:17:46 | FromDiscord | <mratsim> (that was a joke btw) |
15:18:06 | FromDiscord | <konsumlamm> i mean, it works pretty well for small test cases, but the missing navigation is a huge bummer |
15:18:15 | Clonkk[m] | ``nimble install inim`` |
15:18:28 | Clonkk[m] | And all your dreams will come true |
15:19:07 | FromDiscord | <Rika> if i install inim will i immediately become as smart as mratsim? |
15:19:41 | Clonkk[m] | So anyway how's the weather today ? |
15:21:50 | FromDiscord | <konsumlamm> or i do `alias inim='rlwrap nim secret'` :P |
15:21:56 | FromDiscord | <konsumlamm> (sorry, i said it again) |
15:22:01 | FromGitter | <Araq> mratsim: defunctionalize the continuation |
15:22:06 | FromGitter | <Araq> http://www.pathsensitive.com/2019/07/the-best-refactoring-youve-never-heard.html |
15:22:24 | FromDiscord | <haxscramper> sent a code paste, see https://play.nim-lang.org/#ix=2Pax |
15:22:35 | * | MarderIII quit (Quit: Leaving) |
15:22:35 | FromDiscord | <haxscramper> Though it is kind of strange, because just using REPL api https://github.com/haxscramper/hax-nim/blob/master/compilerapi/test6.nim seems to work just fine |
15:22:50 | FromDiscord | <haxscramper> I.e. is error-resistant |
15:25:02 | haxscramper | After reading python's pattern matching comments from HN (mostly just flames) I decided to test some of the patterns from pep 636 to test overall similarity. In the end I found out that our implementation is *very* similar API-wise, but has almost none of the pitfalls that people were annoyed in comments |
15:25:10 | FromDiscord | <konsumlamm> i just realized that `fusion/matching` supports view patterns (<https://gitlab.haskell.org/ghc/ghc/-/wikis/view-patterns>) through object patterns |
15:26:03 | FromDiscord | <konsumlamm> well, we have no by-position matching for objects (while python does) |
15:26:27 | FromDiscord | <mratsim> In reply to @Araq "http://www.pathsensitive.com/2019/07/the-best-refac": @Araq, what do you mean defunctionalizing continuations? LLVM devs while looking into C++ and Swift coroutines found out that keeping a coroutines as function as long as possible was way more optimization friendly than turning it into a state machines. Compilers are very good at folding across functions: https://llvm.org/devmtg/2016-11/Slides/Nishanov-LLVMCoroutine |
15:26:56 | FromDiscord | <konsumlamm> but i feel like most complaints are about `a` binding a variable instead of comparing to an existing `a`, which is kinda stupid to assume for pattern matching, given that that's how it works basically everywhere |
15:26:58 | FromDiscord | <haxscramper> In reply to @konsumlamm "well, we have no": we do have it in form of custom unpackers, but yes, this is different, and to be honestly I never understood the need for positional match in objects |
15:27:06 | FromDiscord | <haxscramper> Because this is insanely error-prone |
15:27:21 | FromDiscord | <haxscramper> Just add field somewhere in the middle and now all patterns are broken |
15:27:29 | FromDiscord | <konsumlamm> it's not for things like Option or Result |
15:29:12 | FromDiscord | <konsumlamm> in Rust for example, if your variants/types have fields (structs, "enum structs"), you can only atch by fields and if they don't, you can only match by position (classic enums, tuple structs) |
15:29:18 | Clonkk[m] | <FromDiscord "<haxscramper> In reply to @konsu"> I think it's just a matter of people being comfortable with writing this way. |
15:31:42 | FromDiscord | <konsumlamm> though tbf, for Nim that distinction doesn't exist |
15:31:48 | FromGitter | <Araq> mratsim: I'm well aware but I care more about being able to send things or store it to disk than I care about 4% differences in performance, esp if it's connected to my ability to understand the code |
15:32:52 | FromDiscord | <mratsim> your continuation is always proc cont(env: var Env) |
15:32:58 | FromDiscord | <mratsim> the env is serializable |
15:33:24 | FromGitter | <Araq> "you cannot send a function" is a perfect summary, it's why I use enum flags and not callbacks if I can |
15:33:32 | FromDiscord | <haxscramper> In reply to @konsumlamm "though tbf, for Nim": We have named tuples that kind of blur the line - you can do `(name: 12)[0]` and `(name: 12).name` , and they are used quite often |
15:34:50 | FromDiscord | <konsumlamm> mm, though named tuples aren't distinct, are they? |
15:35:22 | FromDiscord | <haxscramper> !eval let test: tuple[a: int, b: int] = (1, 2); echo test |
15:35:24 | NimBot | (a: 1, b: 2) |
15:35:30 | FromDiscord | <haxscramper> !eval let test = (1, 2); echo test |
15:35:32 | NimBot | (1, 2) |
15:36:41 | FromDiscord | <haxscramper> But actually right now `(name: <pattern>, <pattern>)` is explicitly checked for and disallowed |
15:36:53 | FromDiscord | <konsumlamm> i mean if you do two `type A = tuple ...`, they'll just be aliases |
15:37:18 | FromDiscord | <haxscramper> Yes, just aliases |
15:37:56 | FromDiscord | <konsumlamm> so matching by position with the type name wouldn't make much sense there anyway |
15:42:07 | * | PMunch quit (Quit: leaving) |
15:44:09 | FromDiscord | <mratsim> In reply to @Araq ""you cannot send a": @Araq, how do you execute your object? |
15:45:32 | FromDiscord | <mratsim> either you have a function that is a state machine and there is an enum token that tells what branch of the state machine you can resume, this is similar to the current closure iterators |
15:45:58 | FromDiscord | <mratsim> or you have a function that just calls other functions, which is similar to disruptek's CPS. |
15:48:56 | FromDiscord | <mratsim> you can't serialize a JS payload when you put your continuations/coroutines to disk. you have to assume that the receiver as the address of the next function to call in the binary. |
15:49:10 | FromDiscord | <mratsim> has the address |
15:55:29 | FromGitter | <Araq> if the enum token is hidden you cannot send it easily |
16:00:14 | * | jaens[m] quit (Quit: Idle for 30+ days) |
16:14:47 | FromDiscord | <mratsim> the enum token is in the env |
16:15:16 | FromDiscord | <mratsim> is it not for Nim closur e iterators? |
16:15:28 | FromGitter | <Araq> it is. |
16:17:32 | * | MarderIII joined #nim |
16:18:14 | FromDiscord | <mratsim> then what do you want to serialize that causes issue? |
16:18:24 | FromGitter | <Araq> if the continuation is a proc like `proc cont(env: var Env)` that's harder to send than an enum. |
16:19:20 | FromDiscord | <mratsim> I think there is a misunderstanding |
16:20:25 | FromDiscord | <mratsim> Here are the inner impl of a continuation: https://github.com/weavers-guild/weave-io/tree/master/implementation#the-innards-of-resumable-functions |
16:20:54 | FromDiscord | <mratsim> the env/frame which is data, is the only thing you need to send |
16:27:13 | FromGitter | <Araq> because you keep an enum in the Env and that's used for dispatching? |
16:28:39 | FromDiscord | <mratsim> yes |
16:28:58 | FromDiscord | <mratsim> if you use the state machine version that's what you do |
16:29:13 | FromDiscord | <mratsim> if you use the proc version, you change the proc address. |
16:29:19 | FromGitter | <Araq> thanks, good to know. |
16:29:27 | FromGitter | <Araq> ah so you have two versions |
16:30:00 | FromGitter | <Araq> the proc version is probably easier to use as the transformation doesn't have to see the full async body |
16:30:05 | FromDiscord | <mratsim> Disruptek has a proc version, either mutating proc where it's modified in-place or immutable, where a continuationProc is `proc foo(c: Continuation): COntinuation` |
16:30:31 | FromDiscord | <mratsim> He and Zevv thought I could explore the state machine version especially given that I have SYnthesis. |
16:31:29 | FromDiscord | <mratsim> personally I doesn't really matter. I think that unfortunately the "disappearing coroutines" from C++ will be too hard to do, first of all it seems to be very sensitive to what construct you use |
16:31:36 | leorize | a small reminder that disruptek's cps is still blocked by compiler bugs |
16:31:36 | FromDiscord | <mratsim> and neither GCC or MSVC supports it. |
16:31:52 | leorize | though I'm not sure how important it would be now that disruptek stopped development on all nim stuff |
16:32:13 | FromDiscord | <mratsim> it's blocked by bugs related to types and macro no? :/ |
16:32:44 | FromDiscord | <mratsim> CPS is still important |
16:33:53 | FromGitter | <Araq> I've said it elsewhere. if the transformation is too complex for today's macro system, write it as a transformation in the Nim compiler. |
16:34:10 | FromGitter | <Araq> the ASTs are identical |
16:34:46 | leorize | it's just a testament of how broken the current macro system is |
16:35:10 | leorize | if we fix the bugs blocking cps, we will end up fixing a lot of macro issues |
16:35:21 | leorize | cps is not too complicated that it can't be done in Nim's macro |
16:35:31 | FromDiscord | <mratsim> it's not macros that are buggy |
16:35:37 | FromGitter | <Araq> well we don't even have a spec for `typed` ASTs |
16:35:42 | FromDiscord | <mratsim> it's what you get from `getTypeInst` and friends |
16:35:53 | FromGitter | <Araq> it's futile to "fix" it all without a spec |
16:35:59 | FromDiscord | <mratsim> sometimes you get T, sometimes you get seq[int] |
16:36:16 | FromDiscord | <mratsim> and sometimes you get Alias |
16:36:33 | FromDiscord | <mratsim> well not exactly but you see what I mean |
16:37:02 | FromDiscord | <mratsim> and "sameType" doesn't work properly |
16:37:19 | FromDiscord | <mratsim> and you can't use "is" because typedesc are turned into NimNode. |
16:39:58 | FromGitter | <Araq> same, `getTypeInst` has no real spec, I don't know how it needs to work really, can't fix it then |
16:40:17 | FromGitter | <Araq> previously the development was based on "ugh, I think this should work..." |
16:40:48 | FromGitter | <Araq> I'm tired of "I think this should work" based language evolution |
16:41:58 | FromGitter | <Araq> extra points for mentioning "consistency" in your bug reports |
16:42:43 | * | MarderIII quit (Quit: Leaving) |
16:43:39 | FromDiscord | <ElegantBeef> I've never felt so attack by a sentence before |
16:43:43 | FromDiscord | <ElegantBeef> (edit) "attack" => "attacked" |
16:45:40 | * | leorize quit (Ping timeout: 268 seconds) |
16:54:51 | * | asdflkj_2 quit (Quit: WeeChat 2.8) |
16:55:07 | * | asdflkj_2 joined #nim |
17:07:28 | * | krux02 joined #nim |
17:11:07 | FromGitter | <Araq> Chronos is green with --gc:orc :-) |
17:12:08 | FromDiscord | <Yardanico> @treeform thanks for flatty! I wonder if you can add support for OrderedTable and CountTable as well to normal Table s - I tried doing this without duplicating the procs but then it doesn't really work |
17:13:59 | FromDiscord | <Yardanico> ok I think I made it work |
17:14:03 | FromDiscord | <Yardanico> but I'm not sure if my way is the best |
17:14:10 | FromDiscord | <Yardanico> proc toFlatty[K, V](s: var string, x: Table[K, V] | OrderedTable[K, V] | CountTable[K])β΅proc fromFlatty[K, V; T: Table[K, V] | OrderedTable[K, V] | CountTable[K]](s: string, i: var int, x: var T) |
17:14:21 | FromDiscord | <Yardanico> `proc toFlatty[K, V](s: var string, x: Table[K, V] | OrderedTable[K, V] | CountTable[K])` |
17:14:23 | FromDiscord | <Yardanico> `proc fromFlatty[K, V; T: Table[K, V] | OrderedTable[K, V] | CountTable[K]](s: string, i: var int, x: var T)` |
17:14:38 | FromDiscord | <Yardanico> So when you change proc definitions for the Table procs to this it all seems to work |
17:16:57 | FromDiscord | <Yardanico> ah wait, this is wrong for CountTable |
17:23:13 | Amun_Ra | are there plans to add timeout to asyncsocket's recvline? I often find recvline just hangs on closed socket without returning an empty string |
17:25:54 | FromDiscord | <Yardanico> you can use withTimeout |
17:26:23 | FromDiscord | <Yardanico> no async socket procs have a timeout because there's https://nim-lang.org/docs/asyncdispatch.html#withTimeout%2CFuture%5BT%5D%2Cint |
17:32:34 | Amun_Ra | Yardanico: I haven't noticed that, thanks |
17:41:45 | FromDiscord | <konsumlamm> is there any difference between `cast[int]` and `ord` for ordinals? |
17:42:04 | FromDiscord | <Yardanico> the former is considered unsafe :) |
17:42:13 | FromDiscord | <Yardanico> also yes, there is difference |
17:42:37 | FromDiscord | <Yardanico> in some cases |
17:43:54 | FromDiscord | <Yardanico> hmm weird |
17:45:51 | FromDiscord | <Yardanico> Apparently `ord` is broken (and behaves just like cast[int]) when you try to ord a 64-bit int on a 32-bit platform |
17:46:27 | FromDiscord | <Yardanico> well, it's because ord returns the platforms' int which is 32-bit in case of 32-bit platform |
17:50:50 | FromDiscord | <exelotl> it could be neat if `[:` syntax worked with casting |
17:51:08 | FromDiscord | <Yardanico> you mean .cast[:in32] ? |
17:51:11 | FromDiscord | <Yardanico> (edit) ".cast[:in32]" => ".cast[:int32]" |
17:51:14 | FromDiscord | <Yardanico> (edit) ".cast[:int32]" => "val.cast[:int32]" |
17:51:17 | FromDiscord | <exelotl> yeah |
17:51:21 | FromDiscord | <~355/113 Man> do cases have to use compile time known values? |
17:51:34 | FromDiscord | <Yardanico> wdym? you can "case" on a runtime value |
17:51:51 | FromDiscord | <~355/113 Man> oh wait nvm, I forgot to remove an `==` when converting from if to case |
17:51:53 | FromDiscord | <Yardanico> but values in branches have to be compile time known values (i mean `of value`) |
17:51:56 | FromDiscord | <~355/113 Man> weird error |
17:52:06 | FromDiscord | <~355/113 Man> `cannot evaluate at compile time: event` that was the error |
17:54:04 | FromDiscord | <Yardanico> @konsumlamm to answer your question: I think they both will return the same value, but using `ord` is better |
17:54:54 | FromDiscord | <exelotl> sent a code paste, see https://play.nim-lang.org/#ix=2Pbu |
17:55:18 | FromDiscord | <exelotl> is the same as doing `case: of false:` |
17:55:40 | FromDiscord | <exelotl> but if you change x and y to `let` or `var` it's no longer legal |
17:56:58 | FromDiscord | <Yardanico> IMO for branches like these it's better to use `elif` to show their "difference" |
17:57:52 | FromDiscord | <Yardanico> wait nvm |
17:57:56 | FromDiscord | <exelotl> yeah I don't think I would ever write a branch like this, just trying to illustrate what the compiler was thinking when it gave that error x) |
17:58:55 | FromDiscord | <~355/113 Man> sent a code paste, see https://play.nim-lang.org/#ix=2Pbx |
17:59:24 | FromDiscord | <Yardanico> so yeah, the error then was because one of the parts in your == expression was not evaluatable at compile-time |
17:59:27 | FromDiscord | <~355/113 Man> ~~also I have like 20 nim tabs open on firefox now lol~~ |
17:59:33 | FromDiscord | <Yardanico> I mean it can look like a bad error, but it's logical |
17:59:39 | * | tane joined #nim |
17:59:50 | FromDiscord | <~355/113 Man> so the `of` statements have to be compiletime? |
17:59:54 | FromDiscord | <Yardanico> yes |
18:00:05 | FromDiscord | <~355/113 Man> yep ok, that error makes sense then |
18:00:19 | FromDiscord | <Yardanico> "Because case statements are checked for exhaustiveness during semantic analysis, the value in every of branch must be a constant expression. This restriction also allows the compiler to generate more performant code." |
18:00:37 | FromDiscord | <konsumlamm> @Yardanico the reason i'm asking is because `packedsets` uses `cast[int]` in a few plces for no apparent reason |
18:02:31 | FromDiscord | <Yardanico> you can make a PR |
18:05:08 | FromDiscord | <konsumlamm> kk |
18:06:30 | FromDiscord | <konsumlamm> conversion between `int` and `uint` can be done by using the types like functions, right? |
18:06:51 | FromDiscord | <Yardanico> yes, if you want to convert (have the same number value) |
18:08:32 | FromDiscord | <konsumlamm> oh, so there it makes a difference if i use `cast` |
18:08:42 | FromDiscord | <Yardanico> yes |
18:08:43 | FromDiscord | <mratsim> cast and convert are equivalent for integers |
18:08:50 | FromDiscord | <mratsim> except that convert does runtime value checks |
18:09:00 | FromDiscord | <mratsim> it's a bit unfortunate. |
18:09:24 | FromDiscord | <konsumlamm> but `ord` doesn't do any runtime checks, does it? |
18:09:49 | FromDiscord | <mratsim> you can cast[uint8](uint64) even though they don't have the same size iirc and that's only possible for integer |
18:10:09 | FromDiscord | <Yardanico> @mratsim but they're not equivalent between int and uint, are they? |
18:10:13 | FromDiscord | <mratsim> ord is basically byte(char) |
18:10:27 | FromDiscord | <mratsim> In reply to @Yardanico "<@!570268431522201601> but they're not": yes, there are runtime check for signed conversion |
18:10:39 | FromDiscord | <mratsim> so no no check |
18:10:45 | FromDiscord | <mratsim> because all char maps to an integer |
18:11:38 | FromDiscord | <mratsim> it's just the rule about "you can only cast between types of the same size" that doesn't apply to integer that I find unfortunate |
18:16:12 | FromDiscord | <treeform> @Yardanico thank you for the PR. |
18:16:16 | FromDiscord | <Yardanico> np :) |
18:16:20 | FromDiscord | <treeform> π |
18:16:44 | FromDiscord | <Yardanico> will you make a new release? |
18:16:56 | FromDiscord | <treeform> no, I will now |
18:17:52 | FromDiscord | <treeform> done 0.2.1 |
18:18:29 | FromDiscord | <treeform> (edit) removed "no," |
18:24:07 | FromDiscord | <Yardanico> @treeform oh, there's a problem with ref tables - they don't take the table code path but rather the generic one, here's one way to make them do so - https://gist.github.com/Yardanico/1e9a75874ace4672689e1fce085fc804 |
18:24:35 | FromDiscord | <Yardanico> it basically checks if flatty has toFlatty proc for T from ref T, and if it does, uses that instead of the generic path |
18:25:18 | FromDiscord | <treeform> neat |
18:25:44 | FromDiscord | <Yardanico> this will work for any other refs of types that have flatty-specific procs as well |
18:28:06 | FromDiscord | <treeform> hmm does not appear to work |
18:28:40 | FromDiscord | <treeform> getting nil errors, tried `new(x)` |
18:28:49 | FromDiscord | <Yardanico> huh? |
18:30:58 | FromDiscord | <treeform> can you PR the code that you have? |
18:31:12 | FromDiscord | <treeform> the patch crashes for me, maybe you have extra stuff some place else? |
18:31:16 | * | hyiltiz quit (Ping timeout: 265 seconds) |
18:31:39 | * | hyiltiz joined #nim |
18:33:21 | FromDiscord | <treeform> No need I figured it out, I put the new() in the toFlatty case! |
18:33:26 | FromDiscord | <treeform> me dump |
18:34:56 | FromDiscord | <treeform> https://github.com/treeform/flatty/commit/5c57a24840fd1fc45c96622ea14b294d5c41a386 |
18:54:22 | * | SebastianM joined #nim |
18:57:45 | * | xet7 joined #nim |
18:59:36 | FromDiscord | <dom96> hello hello |
19:00:16 | FromDiscord | <treeform> Hey, dom96 how are you? |
19:00:38 | FromDiscord | <hamidb80> Did anyone try Karax? |
19:00:57 | FromDiscord | <treeform> I think dom96 tried it once. |
19:00:59 | FromDiscord | <dom96> I'm alright, happy that it's Friday |
19:01:03 | FromDiscord | <dom96> How are you? π |
19:01:09 | FromDiscord | <treeform> Fridays are great, no meetings. |
19:01:13 | FromDiscord | <dom96> @hamidb80 I've built Nimforum using it |
19:01:28 | FromDiscord | <dom96> We've got no meetings wednesdays |
19:01:49 | FromDiscord | <treeform> I have that too, but its a bonus when it happens on Fridays |
19:01:53 | FromDiscord | <hamidb80> In reply to @dom96 "<@!745944009918251010> I've built Nimforum": Really? This? https://forum.nim-lang.org/ |
19:01:59 | FromDiscord | <dom96> In reply to @hamidb80 "Really? This? https://forum.nim-lang.org/": yep |
19:02:02 | FromDiscord | <treeform> yep |
19:02:18 | FromDiscord | <hamidb80> In reply to @dom96 "yep": Is it open source? |
19:02:32 | FromDiscord | <dom96> Yep: https://github.com/nim-lang/nimforum/ |
19:02:34 | FromDiscord | <~355/113 Man> can nim compile to dll? |
19:02:46 | FromDiscord | <hamidb80> In reply to @dom96 "Yep: https://github.com/nim-lang/nimforum/": Tnx |
19:03:13 | FromDiscord | <treeform> In reply to @~355/113 Man "can nim compile to": yes `nim c --app:lib` |
19:03:23 | FromDiscord | <~355/113 Man> or in another way be used as a lib for a C++ project? |
19:03:26 | FromDiscord | <~355/113 Man> cool |
19:04:32 | FromDiscord | <treeform> In reply to @~355/113 Man "or in another way": is probably best to make a c style lib and use that from C++. Some thing like this maybe: https://github.com/sdwfrost/nim-shared-object-example |
19:05:17 | FromDiscord | <treeform> I have integrated with C++ and ObjC before but its more pain and not as a dll. |
19:05:28 | * | waleee-cl joined #nim |
19:06:32 | FromDiscord | <~355/113 Man> C is fine |
19:07:06 | FromGitter | <Araq> nobody cheers :-/ Chronos works with --gc:orc |
19:07:20 | FromDiscord | <~355/113 Man> is there anything I need to pay attention to on the nim side as far as things like function/proc names and types and calls? |
19:07:45 | FromDiscord | <~355/113 Man> I might make the first VR game written mostly in Nim lol |
19:07:55 | FromDiscord | <~355/113 Man> (if it hasn't been done already) |
19:08:34 | FromDiscord | <treeform> Araq, what is Chronos? |
19:09:09 | FromDiscord | <treeform> this https://github.com/status-im/nim-chronos better async? |
19:09:13 | FromGitter | <Araq> yes |
19:09:46 | FromDiscord | <treeform> why was it hard? We don't know. Would love more marketing materials in form of blog posts/videos. |
19:09:54 | FromDiscord | <treeform> We don't know what to cheer for if we don't know what it is. |
19:10:07 | FromDiscord | <haxscramper> In reply to @~355/113 Man "is there anything I": IIRC you should look into `{.bycopy.}` pragma (though it is necessary for using C code in nim, not sure if it is mandatory the other way around). `ARC` would give you better results (probably) when creating C/C++ library in nim |
19:10:34 | FromDiscord | <~355/113 Man> `ARC`? |
19:10:38 | FromDiscord | <haxscramper> `{.exportc: .` can (?) take function name, so you don't need to specifically play around it |
19:10:53 | FromDiscord | <haxscramper> In reply to @~355/113 Man "`ARC`?": `--gc:arc` https://nim-lang.org/blog/2020/10/15/introduction-to-arc-orc-in-nim.html |
19:11:32 | * | xet7 quit (Remote host closed the connection) |
19:11:41 | FromDiscord | <haxscramper> Our new memory management system |
19:12:01 | FromGitter | <Araq> treeform: it took a couple of days |
19:12:17 | * | xet7 joined #nim |
19:12:42 | FromDiscord | <treeform> Araq, its kind of odd to me, I feel like I follow nim everyday, but I seem miss all of the important nim milestones... have no clue what fusion, chronos etc... what are the top nim priorities now... I wish those things would be more visible some how π¦ |
19:13:03 | FromGitter | <Araq> @leorize is trying to tell me how to do that |
19:13:13 | FromGitter | <Araq> I'm listening but so far I don't know |
19:13:34 | federico3 | treeform: https://forum.nim-lang.org/t/7457 |
19:14:10 | FromDiscord | <haxscramper> In reply to @treeform "Araq, its kind of": Maybe we could reiterate on key points in "this month in nim" |
19:14:49 | FromDiscord | <mratsim> In reply to @treeform "Araq, its kind of": I never used fusion and never missed it. Change my mind. |
19:15:09 | FromDiscord | <haxscramper> sad pattern matching sounds |
19:15:33 | FromDiscord | <mratsim> maybe i should try the ast builder in there as well |
19:15:44 | FromDiscord | <haxscramper> But I doubt you really need fusion, especially considering what you are working on most of the time |
19:15:45 | FromDiscord | <mratsim> but I'm fine with planting newTree |
19:16:35 | FromGitter | <Araq> mratsim: fwiw we figured out how Fusion should work |
19:16:38 | FromDiscord | <mratsim> a doc generator would be a good incentive to try fusion π |
19:16:49 | FromDiscord | <mratsim> with hudrogen? |
19:16:53 | FromDiscord | <~355/113 Man> can I specify compile args in `.nimble` config? |
19:17:00 | FromDiscord | <mratsim> (edit) "hudrogen?" => "hydrogen?" |
19:17:06 | FromDiscord | <~355/113 Man> (I assume I can but idk how) |
19:17:09 | FromDiscord | <mratsim> use a nim.cfg or config.nims |
19:17:23 | FromDiscord | <~355/113 Man> oh, so not in the `.nimble` |
19:17:46 | FromGitter | <Araq> should work in the `.nimble` file too |
19:17:51 | FromGitter | <Araq> bbl |
19:17:59 | FromDiscord | <mratsim> didn't know |
19:18:43 | FromDiscord | <mratsim> then this should work in both config.nim or .nimble: https://github.com/status-im/nimbus-eth2/blob/stable/config.nims#L25-L27 |
19:19:00 | FromDiscord | <mratsim> and the nim.cfg version: https://github.com/mratsim/Arraymancer/blob/master/nim.cfg#L9-L25 |
19:19:54 | FromDiscord | <mratsim> and you can scope the flags: https://github.com/status-im/nimbus-eth2/blob/stable/tests/all_tests.nim.cfg |
19:20:08 | FromDiscord | <mratsim> by using filename.nim.cfg |
19:20:31 | FromDiscord | <~355/113 Man> so β΅`switch("passL, "--gc:ocr")`? |
19:20:31 | FromDiscord | <dom96> I also never used fusion |
19:20:39 | FromDiscord | <dom96> also don't see why there is still effort put into it |
19:20:57 | FromDiscord | <dom96> just install the packages you need |
19:21:16 | FromDiscord | <mratsim> `switch("gc, "orc")` |
19:21:26 | FromDiscord | <mratsim> it's the battery included part. |
19:21:53 | FromDiscord | <mratsim> a certain standard of review/quality as well (or at least I hope) |
19:22:26 | federico3 | I'd be curious to see something like https://hotwire.dev/ in karax or as a karax alternative |
19:22:34 | FromDiscord | <dom96> so far it just seems like a dumping ground for what should be perfectly good packages that stand on their own |
19:22:52 | FromDiscord | <haxscramper> In reply to @dom96 "also don't see why": I view it mostly as consolidation effort for cases where we have multiple existing implementation, to the point it is clear that some standartisation is necessary |
19:23:01 | FromDiscord | <dom96> federico3: json is plenty fast |
19:23:06 | FromDiscord | <haxscramper> But not that necessary to put into stdlib |
19:23:08 | FromDiscord | <~355/113 Man> do I have to put in in a `task build` in the `.nimble`? |
19:23:18 | FromDiscord | <~355/113 Man> or can I just have it global |
19:23:32 | FromDiscord | <haxscramper> As well as various helper tools and data structures. |
19:23:40 | FromDiscord | <dom96> federico3: although server-side rendering for karax would be nice |
19:24:10 | FromDiscord | <haxscramper> The problem is that fusion is not advertised enough (like parts of our stdlib too, which has a lot of interesting things) |
19:24:22 | FromDiscord | <haxscramper> In reply to @mratsim "a certain standard of": And that holds true as well |
19:24:29 | federico3 | dom96: it's not only about speed |
19:24:55 | FromDiscord | <mratsim> In reply to @dom96 "federico3: json is plenty": json is slow |
19:25:11 | FromDiscord | <Recruit_main707> @~355/113 Man i think global is fine |
19:25:16 | FromDiscord | <mratsim> the only slowest compiled language than us is Swift |
19:25:25 | FromDiscord | <mratsim> and all the others are 2x 3x faster |
19:25:41 | FromDiscord | <mratsim> just look at @treeform benches |
19:25:54 | FromDiscord | <dom96> @mratsim you're missing the context |
19:25:57 | federico3 | yep, even Python |
19:25:58 | FromDiscord | <Recruit_main707> we cannot advertise speed with this json performance >.> |
19:26:01 | FromDiscord | <dom96> it's plenty fast for Karax |
19:27:05 | federico3 | that depends on you hardware on both server and client side... |
19:28:03 | FromDiscord | <mratsim> It's embarassing that languages can be 10x faster here: https://github.com/kostya/benchmarks#json |
19:28:50 | Prestige | Why is our json parsing so slow |
19:29:05 | FromDiscord | <dom96> I've learned over the years that it's enough to worry about the majority who have good enough hardware on both sides |
19:29:55 | FromDiscord | <Recruit_main707> tbh even packedJson is not that much faster |
19:30:03 | federico3 | Prestige: good question |
19:30:05 | FromDiscord | <Recruit_main707> but at least we are on top of python and c# |
19:30:07 | FromDiscord | <dom96> even so, I ended up writing a thrift binary protocol implementation for stardust |
19:30:27 | FromDiscord | <dom96> but json for a real-time online game would have been laughable |
19:33:34 | Prestige | I'm guessing our parsing algo is just bad? |
19:34:18 | FromDiscord | <~355/113 Man> oh I see there is a benchmark for multiplying matrices, is this a special thing I can take advantage of? |
19:34:46 | FromDiscord | <Recruit_main707> take advantage in what way? |
19:35:47 | FromDiscord | <~355/113 Man> like some special annotation or proc rather than just individually calculating each component, like hardware acceleration or something? |
19:36:50 | federico3 | I opened https://github.com/nim-lang/Nim/issues/12152 but it has been closed |
19:42:53 | * | SebastianM quit (Quit: -a- IRC for Android 2.1.59) |
19:44:25 | Prestige | Interesting read |
19:45:16 | Prestige | So it's recommended to use packedjson and not the standard library? |
19:47:53 | FromDiscord | <ElegantBeef> I believe it depends completely on what you want, cause the `json` module in stdlib is one of the few that allows you to manually interact with the json tree afaik |
19:48:43 | FromDiscord | <ElegantBeef> It's how all the other json libraries get their speed, they dont have an intermediate Nim object representation, atleast i think that's what treeform said for jsony |
19:49:42 | Prestige | Yeah that makes sense |
19:50:39 | federico3 | IMO loading and then modifying JSON data is a very uncommon need |
19:51:04 | FromDiscord | <ElegantBeef> Yea manually interacting with the json is very unlikely |
19:51:49 | federico3 | also, often you don't need to access every value, only some |
19:51:51 | FromDiscord | <ElegantBeef> It happens but it's rare, since i use a json file for the config of my auto builder i do it there for more informational error messages/edge case handling |
19:52:32 | federico3 | ...therefore the stdib json could be optimized for fast "read-only" load |
19:53:35 | FromDiscord | <~355/113 Man> does Nim have function pointers or something similar? |
19:53:43 | FromDiscord | <~355/113 Man> (edit) "similar?" => "similar like function objects?" |
19:53:54 | FromDiscord | <~355/113 Man> for callbacks |
19:53:58 | FromDiscord | <~355/113 Man> (edit) "for callbacks ... " added "ish" |
19:54:30 | FromDiscord | <ElegantBeef> !eval let a = proc(i: int) = echo i; a(100) |
19:54:32 | NimBot | Compile failed: /usercode/in.nim(1, 32) Error: undeclared identifier: 'a' |
19:54:38 | FromDiscord | <ElegantBeef> Damn it! |
19:54:44 | FromDiscord | <ElegantBeef> Yes it does |
19:55:36 | FromDiscord | <~355/113 Man> π |
19:55:50 | FromDiscord | <~355/113 Man> am I asking too many questions π |
19:56:07 | FromDiscord | <ElegantBeef> Nah as long as there is someone willing to answer it's not too many |
19:56:08 | Prestige | Nah, ask away |
20:02:05 | FromDiscord | <~355/113 Man> if I do an import in a sub module, is the import from the project local directory or the sub module local directory? |
20:04:39 | FromDiscord | <ElegantBeef> It's module relative |
20:05:10 | FromDiscord | <ElegantBeef> so up is `../` and down is `/foldername/module` |
20:05:19 | FromDiscord | <~355/113 Man> got it |
20:05:54 | FromDiscord | <ElegantBeef> @Recruit_main707 did you ever test `\` on windows again? |
20:17:38 | FromDiscord | <konsumlamm> would be cool if someone could take a look at this PR of mine: https://github.com/nim-lang/Nim/pull/16961 |
20:18:07 | FromDiscord | <ElegantBeef> You didnt resolve any of timothees reviews π |
20:21:42 | FromDiscord | <konsumlamm> he also said to leave this to future PRs tho :P |
20:22:20 | FromDiscord | <konsumlamm> and one of the comments is about possibly changing the API |
20:23:48 | FromDiscord | <ElegantBeef> Yea jokes aside seems better, are you sure the backticked variables render properly in docs? |
20:25:17 | FromDiscord | <ElegantBeef> Thought the entire reason for the double back ticks was that the doc replaces those with a div to render them as a block, and the single backticks render as is |
20:26:36 | FromDiscord | <ElegantBeef> Ah guess i'm wrong |
20:27:43 | FromDiscord | <konsumlamm> double and single backticks have the same effect |
20:27:49 | FromDiscord | <ElegantBeef> Yea i had to check to make sure |
20:29:55 | * | asdflkj_2 quit (Ping timeout: 272 seconds) |
20:31:39 | FromDiscord | <~355/113 Man> can I make an assets directory where `readFile` will try to read from first instead of the modules local directory? |
20:35:46 | FromDiscord | <~355/113 Man> doesn't look like it |
20:36:00 | FromDiscord | <ElegantBeef> Not without writing code for it, Nico does that exactly |
20:36:36 | FromDiscord | <ElegantBeef> Implements an assets folder so you can drop files in there then just use the Nico asset load procedures with paths relative to that folder |
20:38:11 | * | nekits07 quit (Quit: The Lounge - https://thelounge.chat) |
20:38:47 | * | NimBot joined #nim |
20:39:07 | * | nekits07 joined #nim |
20:45:30 | FromDiscord | <~355/113 Man> sent a code paste, see https://play.nim-lang.org/#ix=2Pcv |
20:46:22 | FromDiscord | <~355/113 Man> is it because the string being passed into the function is a literal? |
20:46:39 | * | asdflkj_2 joined #nim |
20:46:58 | FromDiscord | <ElegantBeef> yess |
20:46:59 | FromDiscord | <ElegantBeef> (edit) "yess" => "yes" |
20:47:20 | FromDiscord | <treeform> In reply to @mratsim "It's embarassing that languages": We should make that use my json lib. |
20:47:25 | FromDiscord | <~355/113 Man> hmm, any way to get this to work with literals? or am I going to have to save the literals to a variable |
20:48:15 | FromDiscord | <ElegantBeef> What are you doing exactly? `"yourShaderHere".compileShader(type)`? |
20:48:35 | FromDiscord | <~355/113 Man> sent a code paste, see https://play.nim-lang.org/#ix=2Pcx |
20:48:47 | FromDiscord | <~355/113 Man> sent a code paste, see https://play.nim-lang.org/#ix=2Pcy |
20:48:59 | FromDiscord | <ElegantBeef> Ok, so yea that's not going to work for two reasons there is no `var string` and you probably want `unsafeaddr` of that cstring |
20:49:48 | FromDiscord | <ElegantBeef> literals are immutable so that should've threw an error before that addr issue |
20:50:10 | FromDiscord | <~355/113 Man> i'm not editing the string though |
20:50:22 | FromDiscord | <ElegantBeef> you pass it into a function that takes a `var string` |
20:50:59 | FromDiscord | <~355/113 Man> the `shaderSource: var string` is the result of `readFile` |
20:51:28 | FromDiscord | <~355/113 Man> which I guess would be fine making that a variable and passing the variable |
20:51:57 | FromDiscord | <ElegantBeef> But yea i see two issues there |
20:52:28 | FromDiscord | <ElegantBeef> Dont really need `var string` and you use `addr` instead of `unsafeaddr` |
20:52:36 | FromDiscord | <~355/113 Man> the `var string` was to try and allow getting an address |
20:52:49 | FromDiscord | <~355/113 Man> unsafeAddr didn't change anything |
20:52:59 | FromDiscord | <ElegantBeef> ah then need to bound that cstring first |
20:53:37 | FromDiscord | <ElegantBeef> Although Nim strings are nul terminated iirc, so you can just `string[0].unsafeaddr` right? |
20:54:10 | FromDiscord | <~355/113 Man> then cast that to `ptr cstring`? |
20:54:41 | FromDiscord | <ElegantBeef> yea, probably wiser though to just convert the string to a cstring then pass the first element's addr |
20:55:20 | FromDiscord | <ElegantBeef> `let yourPtr= input.cstring[0].unsafeAddr` should work, but i should shut up considering my track record with anything like this π |
20:55:54 | FromDiscord | <~355/113 Man> that gets a `ptr char` |
20:56:47 | FromDiscord | <~355/113 Man> hmm, it seems it doesn't like the conversion |
20:56:50 | FromDiscord | <ElegantBeef> Ah yea then remove the index of first element, when i toyed with the xlib bindings they wanted `ptr cchar` |
20:57:08 | FromDiscord | <~355/113 Man> I made the input cstring and now I can get an address |
20:57:25 | FromDiscord | <~355/113 Man> but with the input string and a conversion to cstring it didin't work |
20:57:35 | FromDiscord | <ElegantBeef> What didnt work? |
20:59:35 | FromDiscord | <~355/113 Man> sent a long message, see http://ix.io/2PcC |
21:00:39 | FromDiscord | <ElegantBeef> https://play.nim-lang.org/#ix=2PcG |
21:00:49 | FromDiscord | <ElegantBeef> Ah yea the first wont work |
21:01:04 | FromDiscord | <ElegantBeef> i was dumb with my let π |
21:01:23 | FromDiscord | <ElegantBeef> without assignment it doesnt have an address cause all it did was convert a constant |
21:02:07 | FromDiscord | <Solitude> In reply to @ElegantBeef "`let yourPtr= input.cstring[0].unsafeAddr` should": glShaderSource takes ptr ptr char, not ptr char |
21:02:32 | FromDiscord | <ElegantBeef> Yea like i said i should've shushed π |
21:18:29 | * | rockcavera quit (Read error: Connection reset by peer) |
21:18:57 | * | rockcavera joined #nim |
21:54:17 | FromDiscord | <exelotl> about allowing foo.cast[:uint32] syntax for casting... Should that be an issue or RFC? |
21:54:33 | FromDiscord | <exelotl> it's literally a 1 sentence feature request lol |
21:55:02 | FromDiscord | <exelotl> well, it does depend on the future of the [: syntax I guess |
22:03:27 | FromGitter | <Araq> I like the [: syntax and doubt it will go away |
22:03:53 | FromGitter | <Araq> however, `cast` is designed to be ugly to use and at the same time is easily made better with a custom template |
22:04:22 | FromGitter | <Araq> so I cannot imagine your RFC would be accepted, sorry |
22:04:35 | FromGitter | <Araq> but you can try, I rarely use my veto powers |
22:09:08 | ForumUpdaterBot | New thread by Mantielero: Templates and include, see https://forum.nim-lang.org/t/7499 |
22:10:32 | FromDiscord | <exelotl> hehe, okay I'll think about it a bit more before making an RFC |
22:15:30 | ForumUpdaterBot | New question by Alex Craft: How to write macro list.findBy(key, value) in Nim?, see https://stackoverflow.com/questions/66179729/how-to-write-macro-list-findbykey-value-in-nim |
22:39:10 | * | clyybber quit (Quit: WeeChat 3.0.1) |
22:45:02 | FromDiscord | <ElegantBeef> @treeform so when you see the PR for the googleapi, i read a total of one stack oveflow and the docs for `Cache-Control` so i have no clue if all of the string conversions are properly handled or what actually changes with them, but using `NoCache` and `NoStore` with my unity build system does resolve my friends launcher cache requesting problems |
22:45:31 | FromDiscord | <ElegantBeef> Suppose i should've added that to the PR, now that the tests show it works as intended π |
23:01:57 | FromDiscord | <treeform> Cool, I am away now, but will take a look at the pr |
23:19:21 | FromDiscord | <ElegantBeef> Yea it's not that big of a deal, using my fork atm for the build system so it seems fine |
23:36:05 | FromDiscord | <~355/113 Man> hmm, any reason `not` takes precedence over `==`? |
23:36:44 | FromDiscord | <~355/113 Man> actually wait, i'm stupid I could just use `!=` |
23:37:12 | FromDiscord | <ElegantBeef> It doesnt take precedence over it's the same level https://media.discordapp.net/attachments/371759389889003532/809931139330474044/unknown.png |
23:38:18 | FromDiscord | <ElegantBeef> In the manual here if you want to read about it https://nim-lang.org/docs/manual.html#syntax-precedence |
23:43:58 | FromDiscord | <~355/113 Man> hmm, I don't seem to be able to open a file and i'm not sure why |
23:44:40 | FromDiscord | <~355/113 Man> i'm pretty sure the file path is correct, but i'm getting IO Error |
23:44:53 | * | xet7 quit (Remote host closed the connection) |
23:44:55 | FromDiscord | <Recruit_main707> relative to the exe? |
23:45:11 | FromDiscord | <~355/113 Man> oh |
23:45:24 | FromDiscord | <~355/113 Man> I had it relative to the module |
23:45:39 | FromDiscord | <~355/113 Man> derp yea that makes sense |
23:45:50 | FromDiscord | <Recruit_main707> try that then, im not 100% sure it will work tho |
23:46:04 | FromDiscord | <Recruit_main707> i always have to try both things and always forget xd |
23:46:19 | FromDiscord | <~355/113 Man> actually I don't think that worked either |
23:46:35 | FromDiscord | <~355/113 Man> nope |
23:46:36 | * | tane quit (Quit: Leaving) |
23:47:26 | FromDiscord | <~355/113 Man> ah, it's local to the .nimble file |
23:48:40 | FromDiscord | <ElegantBeef> Well it's relative to your CWD |
23:48:49 | FromDiscord | <~355/113 Man> ooooh |
23:49:02 | FromDiscord | <ElegantBeef> That's just how binaries tend to work π |
23:49:31 | FromDiscord | <~355/113 Man> so it's relative to where the exe is executed from not where the exe is? |
23:50:05 | FromDiscord | <ElegantBeef> Just imagine https://nim-lang.org/docs/os.html#getCurrentDir is before all your relative paths |
23:51:58 | FromDiscord | <Clyybber> In reply to @ElegantBeef "It doesnt take precedence": but that table is for binary operators only |
23:51:58 | FromDiscord | <~355/113 Man> hmm, but the built binary is in bin which where I would need to back out one folder to get to the assets folder, but it `nimble run` only works if I don't back out |
23:52:16 | FromDiscord | <Clyybber> unary ops always bind closer |
23:52:28 | FromDiscord | <ElegantBeef> Well change the current dir in the binary, or in the a nimble run task |
23:52:31 | FromDiscord | <Clyybber> which can be considered "weird" since not looks like a command invocation too |
23:52:50 | FromDiscord | <ElegantBeef> https://github.com/ftsf/nico/blob/master/exampleApp/exampleApp.nimble look at what nico does |
23:53:06 | * | haxscramper quit (Remote host closed the connection) |
23:53:32 | FromDiscord | <ElegantBeef> Yea i mean it says that |
23:53:55 | FromDiscord | <ElegantBeef> I guess `not` is a unary op so yea it's bound first, but the same result appears |
23:55:13 | FromDiscord | <ElegantBeef> The changing of the directory in the binary will be kinda annoying to do, since it'll move where your terminal is afaik |
23:55:25 | FromDiscord | <ElegantBeef> I could be wrong |
23:57:06 | FromDiscord | <~355/113 Man> can I use the .nimble to copy the assets folder into bin? |
23:57:53 | FromDiscord | <ElegantBeef> https://nim-lang.org/docs/nimscript.html#mvFile%2Cstring%2Cstring |
23:58:03 | FromDiscord | <ElegantBeef> got `mvfile` and `mvdir` |
23:58:31 | FromDiscord | <ElegantBeef> clyybber do you know if the nim compiler will ever ship with libffi enabled by default? |
23:58:45 | FromDiscord | <Recruit_main707> Why is multiprocessing with Nim so unusual, I canβt find any examples |