00:09:54 | * | hohlerde quit (Quit: Connection closed for inactivity) |
00:25:14 | FromDiscord | <Chronos [She/Her]> `std/sugar` provides the `=>` macro right? |
00:25:28 | FromDiscord | <Chronos [She/Her]> For `(arg: Type) => function body` |
00:34:39 | * | Guest99 joined #nim |
00:35:08 | Guest99 | Block and Break without name is deprecated. Why |
00:35:26 | Guest99 | In nim 2.0 that stands out with red lights attached. |
00:36:41 | Guest99 | Naming things is incredibly hard and now you want to force me to name local scope for what reason? Please explain the rationale for limiting something for no good reason I can think of |
00:37:13 | FromDiscord | <Elegantbeef> It made flow control hard to reason |
00:37:28 | FromDiscord | <Elegantbeef> it also made it possible to have a block you could not escape |
00:37:31 | FromDiscord | <Elegantbeef> sent a code paste, see https://play.nim-lang.org/#ix= |
00:37:32 | FromDiscord | <Elegantbeef> Whoops |
00:37:51 | FromDiscord | <Elegantbeef> sent a code paste, see https://paste.rs/JH3nU |
00:41:06 | Guest99 | Isn't this just the same argument for named for Loops |
00:41:18 | FromDiscord | <Elegantbeef> Not really |
00:41:47 | FromDiscord | <Elegantbeef> sent a code paste, see https://play.nim-lang.org/#ix=4Cw3 |
00:42:14 | * | Guest99 quit (Quit: Client closed) |
00:42:33 | * | Guest79 joined #nim |
00:42:33 | Guest79 | 9 |
00:42:53 | Guest79 | Damn phone... Sorry can you send the Last Link again? |
00:43:06 | FromDiscord | <Elegantbeef> Uhh I'm not sending links manually |
00:43:51 | Guest79 | I tired to open a code example and the irc window got eaten by Firefox |
00:44:06 | FromDiscord | <Elegantbeef> https://play.nim-lang.org/#ix=4Cw3 |
00:44:29 | Guest79 | Anyways you're saying that there are not just a "naming things are good" argument to this? |
00:45:01 | FromDiscord | <Elegantbeef> I'm saying that if you just are scoping use `if true` otherwise a named block is fine |
00:45:33 | FromDiscord | <Bloss> In reply to @Guest99 "Block and Break without": You can still name block, you cannot break it tho 😛 |
00:45:47 | FromDiscord | <Bloss> I mean you can still use block without name |
00:46:25 | FromDiscord | <Elegantbeef> Well it's a warning right now but will be an error eventually |
00:47:48 | Guest79 | I will do my homework on this. It's just something I feel strongly about that it's a big Mental workload to have to name things all of the time. I don't like my local variables to spill over. Example. Say you need a transient variable in a switch case. Using curly braces in C is standard solution. No names required. |
00:49:06 | FromDiscord | <Elegantbeef> If you really want to make it cleaner a simple `template scoped(body: untyped): untyped = if true: body` works |
00:49:55 | Amun-Ra | 99% of my blocks are not named |
00:50:08 | FromDiscord | <Elegantbeef> Do you break out of them? |
00:50:22 | Amun-Ra | nope |
00:50:37 | FromDiscord | <Elegantbeef> Then `if true` or `scoped` is what you really want |
00:51:10 | Amun-Ra | I use them to narrow down the scope |
00:51:15 | Guest79 | "scoped"? |
00:51:21 | FromDiscord | <bostonboston> I think for me the only time I have ever used a block was to break |
00:51:23 | FromDiscord | <Elegantbeef> The template I just wrote |
00:51:49 | FromDiscord | <Elegantbeef> I swear if you accidently disconnected from IRC again I'll fly to your house and force you to use matrix |
00:52:23 | FromDiscord | <Elegantbeef> People often misuse block for scoping, and it can create issues |
00:52:36 | Guest79 | https://play.nim-lang.org/#ix=4Cw6 this Works in Nim right now like in all other languages I Know that has a block scope. It would be sad to see it limited. |
00:52:54 | Guest79 | I think that is the problem. I use block for scoping |
00:52:56 | FromDiscord | <Elegantbeef> sent a code paste, see https://play.nim-lang.org/#ix=4Cw7 |
00:53:03 | FromDiscord | <Elegantbeef> Right |
00:53:07 | FromDiscord | <Elegantbeef> `if true` does that |
00:53:15 | FromDiscord | <Elegantbeef> And if you want to be more explicit use that template I showed |
00:53:32 | Amun-Ra | how is that ambiguous? |
00:53:32 | FromDiscord | <Elegantbeef> The actual use case of block is akin to goto |
00:54:58 | FromDiscord | <Elegantbeef> This is the the desired use case of blocks |
00:55:02 | FromDiscord | <Elegantbeef> sent a code paste, see https://play.nim-lang.org/#ix=4Cw8 |
00:56:00 | FromDiscord | <Elegantbeef> Like I said though unnamed blocks are quite easy to replace with `if true` or a template call and suggested by araq |
00:56:16 | FromDiscord | <Elegantbeef> An alternative is to make an RFC to make unnamed blocks equivalent to `if true` |
00:56:26 | FromDiscord | <Elegantbeef> But that's a breaking change |
00:56:31 | FromDiscord | <Elegantbeef> Cause it changes the semantics |
00:57:06 | Guest79 | Because you cannot Break out of a if |
00:57:23 | Guest79 | But also Why do I expect to be able to break out of a template |
00:57:29 | Guest79 | That's a hidden internal |
00:57:49 | Guest79 | The macro should not allow break it should break the for loop |
00:57:51 | FromDiscord | <Elegantbeef> That's the point though, you do not expect to be able to break out of a template you expect to be able to break out of your loop |
00:58:06 | FromDiscord | <Elegantbeef> And if the template expands into a for loop |
00:59:01 | Guest79 | Then that should be part of the API |
00:59:10 | FromDiscord | <Elegantbeef> It shouldnt be |
00:59:21 | FromDiscord | <Elegantbeef> You should just not use block for scoping as it's not intended to be used that way |
00:59:42 | Guest79 | I'm allergic to the throw exemption mess in Python and the I think this is in that direction |
01:00:01 | FromDiscord | <Elegantbeef> The what mess? |
01:00:11 | FromDiscord | <Elegantbeef> Are you even a Nim user? |
01:00:31 | Guest79 | You don't degine clearly what exception a method is allowed to throw |
01:00:45 | FromDiscord | <Elegantbeef> Cool Nim allows you to with `{.raises:[].}` |
01:00:47 | Amun-Ra | in nim? you do |
01:00:49 | FromDiscord | <bostonboston> How is that even remotely related |
01:00:49 | FromDiscord | <Elegantbeef> So next complaint? |
01:01:01 | Amun-Ra | second non-issue |
01:01:40 | FromDiscord | <Elegantbeef> That's so tangential physicists use it too calculate torque |
01:02:08 | Guest79 | Your suggestions here that a user or a macro Should rely on magic names for breaking forloops sounds more to me like a mess. Make the symbols explicit. If I need to break out of a generated for Loop make that symbol part of the instantiation of the macro |
01:02:26 | FromDiscord | <Elegantbeef> Lol |
01:02:38 | Amun-Ra | uhm |
01:02:43 | FromDiscord | <bostonboston> What |
01:03:06 | FromDiscord | <Elegantbeef> All templates/macros need to have a `template breakOutOfThisSpecificLoop(): untyped = break` |
01:03:14 | FromDiscord | <Elegantbeef> Cause that makes sense |
01:03:44 | FromDiscord | <Elegantbeef> Nested macros, well you see we just keep adding 4 to the ident cause I rolled a die and it guaranteed it was random |
01:04:24 | FromDiscord | <Elegantbeef> It's funny that it's no longer having named blocks that is getting complained about |
01:04:25 | Guest79 | Sure that can get the job done. And then this things turn up;) |
01:04:25 | FromDiscord | <Elegantbeef> Changing `block` to `scoped` or `if true` is super simple and gives the exact same API |
01:04:25 | FromDiscord | <Elegantbeef> "But I don't wanna" |
01:04:43 | FromDiscord | <Elegantbeef> Have you actually written a sufficiently sized Nim program? |
01:05:03 | Guest79 | I have my ways I like to write my code. And I like to continue doing so |
01:05:17 | FromDiscord | <bostonboston> The point beef was trying to make that the intended use case for blocks results in ambiguous control flow if the blocks are unnamed, and if you are not using blocks for control flow you should not be using blocks (i think) |
01:05:20 | Guest79 | If someone thinks it's bad they should be able to stop doing that |
01:05:51 | Guest79 | Everyone wins. Different use cases and context |
01:05:54 | FromDiscord | <Elegantbeef> So you're not a Nim programmer complaining that a change has caused you to not write Nim code the same way you were not writing Nim code? |
01:06:21 | FromDiscord | <Elegantbeef> Everybody wins when no one uses `block` in a way it was not intended |
01:06:35 | Guest79 | That Works for me? |
01:06:44 | FromDiscord | <bostonboston> And migration to this new change is simple, find and replace `block:` with `if true:` or a macro, and anything youre left with give a name |
01:06:58 | FromDiscord | <Elegantbeef> Templates and macros work, it's clear where you're breaking, but it's different so you don't like it |
01:07:11 | Guest79 | Now I need to add if true: instead. Which is confusing because in Python say it doesn't create context |
01:07:24 | FromDiscord | <bostonboston> okay? |
01:07:25 | FromDiscord | <Elegantbeef> Cool Nim isnt Python the last I checked |
01:07:33 | Guest79 | Neither in C unless you add curlys |
01:07:33 | FromDiscord | <Elegantbeef> I'll check again just to make sure |
01:07:48 | FromDiscord | <Elegantbeef> Nope... it's not Python or C |
01:07:51 | FromDiscord | <bostonboston> in c is a pointer but `proc doThing()` isnt a pointer type? |
01:07:59 | FromDiscord | <bostonboston> (edit) "" => "``" |
01:08:03 | FromDiscord | <that_dude.> Is something forcing you to use the latest release? You could just stay on a version that doesn't throw the warning |
01:08:07 | FromDiscord | <Elegantbeef> I know it might be confusing but `.nim` `.py` and `.c` have no overlap |
01:08:16 | FromDiscord | <Elegantbeef> You could even just disable the warning |
01:08:21 | Guest79 | That is fine. Not being C or Python |
01:08:22 | FromDiscord | <Elegantbeef> Crazy I know |
01:08:41 | Guest79 | BUT. If you against the mainstream. It should do so for a very good reason |
01:08:49 | FromDiscord | <bostonboston> `let` in JS and Nim mean different things, do we need to change that too |
01:09:01 | FromDiscord | <Elegantbeef> C doesnt have a block keyword |
01:09:02 | FromDiscord | <Elegantbeef> It has `{}` |
01:09:07 | Amun-Ra | a var has completely different scope in js, too |
01:09:25 | Guest79 | I don't understand var så i never use it TBH |
01:09:26 | FromDiscord | <Elegantbeef> So cannot use C as reference |
01:09:36 | FromDiscord | <Elegantbeef> Does python have a `block` keyword? |
01:09:51 | FromDiscord | <bostonboston> what |
01:09:56 | FromDiscord | <bostonboston> you dont understand var? |
01:10:08 | FromDiscord | <bostonboston> in Nim or JS |
01:10:36 | Guest79 | I think they just introduced it but I haven't really used it in Python yet as my Python standard is 15 years old I only use generators that are newer than 2.7... :) |
01:10:40 | FromDiscord | <Elegantbeef> There is no feature in python that creates a block that I can tell |
01:10:40 | FromDiscord | <Elegantbeef> So cannot reference python either |
01:11:00 | Guest79 | It might have check 3.10.or even 3.12 |
01:11:09 | Guest79 | 3.11* |
01:11:22 | Guest79 | Maybe it works like you say |
01:11:29 | Amun-Ra | this is how var works in JS: https://onecompiler.com/javascript/3zgpmhwjp |
01:11:49 | Guest79 | But Java Fortran and these they allow optional naming |
01:12:02 | FromDiscord | <Elegantbeef> Java has a named block syntax? |
01:12:15 | Guest79 | Sorry for loops |
01:12:24 | Guest79 | Fortran has named blocks |
01:12:31 | Guest79 | Optional named |
01:12:42 | FromDiscord | <Elegantbeef> Ah yes mainstream languages like fortran |
01:12:43 | Guest79 | Since 95 or 2003 |
01:12:59 | FromDiscord | <bostonboston> We should all move to forth |
01:13:19 | Guest79 | Fortran has been around for 70 years Id pay attention to their wisdom in language design |
01:14:38 | FromDiscord | <Elegantbeef> Lol |
01:14:38 | FromDiscord | <Elegantbeef> C has been around for nearly as long and it's language design is that of a wet paper bag |
01:14:38 | FromDiscord | <Elegantbeef> Longevity does not mean good design |
01:15:24 | FromDiscord | <bostonboston> I suppose that means we should move Nim to a fortran backend |
01:16:21 | Amun-Ra | no punched cards support in nim? what a mess… |
01:16:30 | FromDiscord | <that_dude.> I'd argue that a long history means that they're even more afraid to improve design out of fear of breaking anything |
01:17:02 | FromDiscord | <bostonboston> Thats JS problem and they havent even been around that long |
01:17:07 | Amun-Ra | well, they like to add/remove meaningless things in C |
01:18:13 | FromDiscord | <Elegantbeef> Well bikeshedding has been fun, anyone have something of merit to talk about? 😄 |
01:18:27 | FromDiscord | <bostonboston> sprintf_s was a good addition |
01:19:50 | Amun-Ra | but it's optional |
01:20:31 | FromDiscord | <bostonboston> I like my buffer overflows |
01:20:33 | Guest79 | More things are made optional in c11/c14 |
01:21:08 | Guest79 | Basically wreaking the previous standard |
01:22:00 | Guest79 | Sorry I went of to see if I could find a mention of block In a recent Python changelog.. I could not. Strange it seems like such a Good Idea |
01:22:21 | FromDiscord | <bostonboston> I think the only way to scope in python is make a new class |
01:22:27 | FromDiscord | <bostonboston> I love classes so much |
01:22:32 | Guest79 | They have with context instead. Which isn't a context LoL |
01:24:19 | Guest79 | I was raised with Pascal so OOP is forever not natural to me, data and algorithms go together like oil and water. ;) |
01:24:27 | FromDiscord | <that_dude.> sent a code paste, see https://play.nim-lang.org/#ix=4Cwd |
01:24:44 | FromDiscord | <that_dude.> sent a code paste, see https://play.nim-lang.org/#ix=4Cwe |
01:25:55 | FromDiscord | <varriount> In reply to @Elegantbeef "There is no feature": As far as I know, Python doesn't have anything like Nim's `block`. |
01:26:11 | Amun-Ra | nope |
01:26:27 | FromDiscord | <bostonboston> The like 3rd language i sorta learned was Object Pascal (: |
01:26:59 | FromDiscord | <bostonboston> Delphi xe8 baybe |
01:27:17 | FromDiscord | <Elegantbeef> Look at these wild languages, while I just learned C# then Nim |
01:27:44 | FromDiscord | <that_dude.> sent a code paste, see https://play.nim-lang.org/#ix=4Cwf |
01:27:50 | Guest79 | I think block names are symbols so variable names would be not allowed. |
01:28:22 | Guest79 | Fortran (sry) allows numerical values as labels for tradition. ;) |
01:28:49 | FromDiscord | <that_dude.> Though that may not worked for typing reasons ig |
01:28:55 | FromDiscord | <that_dude.> (edit) "worked" => "work" |
01:29:02 | Guest79 | So I could just give my blocks meaning names like 42 |
01:29:03 | FromDiscord | <that_dude.> (edit) "Though that may not work ... for" added "be possible" |
01:29:05 | FromDiscord | <bostonboston> I took a class with C, python and matlab then forgot all of it, sort of used Forth for a minecraft mod, took more classes that taught ASM -> C, then Verilog if you want to consider that, then got a job i concurrently had to use C# and Delphi and start learning Nim during all that |
01:30:04 | FromDiscord | <bostonboston> On my list is also to learn JS and HTML/CSS but i really do not want to |
01:31:09 | Guest79 | Don't learn frameworks. They will rot your Mind. First look at UI development from the old days. Like Deluxe paint from 1984 in KR C |
01:31:57 | FromDiscord | <bostonboston> Just riding on the idea of convincing my boss to switch to Nim for web dev (: |
01:32:05 | Guest79 | Anyways good helpful discussion at least I Know where the Idea comes from now. Thx 🙏 |
01:33:04 | * | Guest79 quit (Quit: Client closed) |
02:25:42 | FromDiscord | <Chronos [She/Her]> Hey y'all, I remember when I first started using Nim in nanorc, the original nanorc I found was kinda shit, and because of that, I've been tweaking and updating it over time, just wanna say if anyone wants a copy of it, hmu |
02:26:12 | FromDiscord | <Chronos [She/Her]> It's definitely still very incomplete but much, much better than the original I found |
03:25:13 | * | lucasta quit (Quit: Leaving) |
05:02:03 | FromDiscord | <odexine> I kinda do wonder now about named loops, what kind of reasoning would one go with that instead of blocks for breaking and stuff |
05:02:50 | FromDiscord | <odexine> In reply to @yu.vitaqua.fer.chronos "Hey y'all, I remember": Better to upload it to gist and post it on the forums for searchability |
05:10:28 | FromDiscord | <.matrixagent> In reply to @odexine "Better to upload it": Who is kanon |
05:10:41 | FromDiscord | <odexine> Anime girl on my avatar |
05:10:47 | FromDiscord | <.matrixagent> Where is she from |
05:11:31 | FromDiscord | <.matrixagent> In reply to @Elegantbeef "Look at these wild": C# gonna get as fast as C++ |
05:11:40 | FromDiscord | <.matrixagent> Microsoft pumping too much money in it |
05:13:43 | FromDiscord | <Elegantbeef> Who cares if it's as fast as C++ |
05:16:41 | FromDiscord | <terrygillis> sent a long message, see http://ix.io/4CwU |
05:19:51 | FromDiscord | <Elegantbeef> `method` is a nim keyword, juan made the odd choice of using `metod` |
05:27:26 | FromDiscord | <.matrixagent> In reply to @Elegantbeef "Who cares if it's": Me |
05:28:53 | FromDiscord | <odexine> In reply to @.matrixagent "Where is she from": Love live superstar |
05:29:27 | FromDiscord | <.matrixagent> In reply to @odexine "Love live superstar": Looks mid |
05:29:28 | FromDiscord | <odexine> In reply to @Elegantbeef "`method` is a nim": Maybe jsmethod would have been better |
05:29:47 | FromDiscord | <odexine> In reply to @.matrixagent "Looks mid": I mean up to you if it’s good to you or not |
05:30:06 | FromDiscord | <.kanaxa> "...By default, the Nim compiler generates a large number of runtime checks aiming for your _debugging pleasure_. With `-d:release` some checks are turned off and optimizations are turned on."↵↵I like Araq's cheekiness on the "debugging pleasure" part - though I've to admit that debugging can be fun sometimes, it's a bit like a puzzle game |
05:53:17 | FromDiscord | <.kanaxa> I find the backwards index operator (`^`) to be quite sexy |
05:53:27 | FromDiscord | <.kanaxa> But just checking my understanding: it only works with arrays/seqs? |
05:53:43 | FromDiscord | <.kanaxa> sent a code paste, see https://play.nim-lang.org/#ix=4CwX |
05:54:01 | * | ntat joined #nim |
05:54:01 | FromDiscord | <.kanaxa> (edit) "https://play.nim-lang.org/#ix=4CwX" => "https://play.nim-lang.org/#ix=4CwY" |
05:54:48 | FromDiscord | <.kanaxa> (edit) "https://play.nim-lang.org/#ix=4CwY" => "https://play.nim-lang.org/#ix=4CwZ" |
06:02:24 | FromDiscord | <Phil> In reply to @.kanaxa "But just checking my": I mean what does a range like this look like? |
06:02:38 | FromDiscord | <Phil> Like conceptually, what would you expect 0 to ^10 to be? |
06:06:30 | FromDiscord | <Phil> sent a code paste, see https://play.nim-lang.org/#ix=4Cx4 |
06:07:22 | FromDiscord | <Phil> (edit) "https://play.nim-lang.org/#ix=4Cx4" => "https://play.nim-lang.org/#ix=4Cx5" |
06:15:10 | FromDiscord | <.kanaxa> In reply to @isofruit "Like conceptually, what would": Like I thought it would be 0 - 9, since it starts counting from the back |
06:15:34 | FromDiscord | <.kanaxa> I thought it was a range-like syntax, glad to know it's an array shorthand |
06:15:38 | FromDiscord | <.kanaxa> (edit) "I thought it was a range-like syntax, glad to know it's an array ... shorthand" added "access" |
06:17:14 | FromDiscord | <.kanaxa> In reply to @isofruit "But yeah, there are": Oh, this is really interesting - I didn't know you couldn't iterate over tuples in Nim! |
06:18:09 | FromDiscord | <.kanaxa> In my head I'm visualizing this as there being no underlying `iter` method, haha |
06:19:52 | FromDiscord | <.kanaxa> Now that I think about it, `echo a[^1]` in Nim feels like `print(a[-1])` in Python |
06:22:53 | FromDiscord | <Phil> sent a code paste, see https://play.nim-lang.org/#ix=4Cx6 |
06:23:56 | FromDiscord | <Phil> In reply to @.kanaxa "In my head I'm": Which is pretty much what's happening here. Just in the python context, you have `iter` directly associated with an object.↵Here the implicitly called iter method can be wherever, it just needs to be accessible imported or defined in the context where you're trying to iterate |
06:25:38 | FromDiscord | <Phil> sent a code paste, see https://play.nim-lang.org/#ix=4Cx8 |
06:25:45 | FromDiscord | <.kanaxa> Which makes me wonder then: how can I make a tuple in Nim iterable? can I give it some sort of iter property |
06:25:54 | FromDiscord | <.kanaxa> In reply to @isofruit "You can, just not": Oh, a `fields` property? Interesting |
06:26:08 | FromDiscord | <.kanaxa> (edit) "property?" => "iterator?" |
06:26:31 | FromDiscord | <Phil> In reply to @.kanaxa "Oh, a `fields` iterator?": "iterator" is a specific concept just like proc etc.↵Objects and tuple have iterators such as `fields`, `fieldPairs`, etc defined for them |
06:28:56 | FromDiscord | <.kanaxa> sent a code paste, see https://play.nim-lang.org/#ix=4Cx9 |
06:30:23 | FromDiscord | <Phil> In reply to @.kanaxa "I was wondering as": https://nim-lang.org/docs/manual.html#iterators-and-the-for-statement-implicit-itemsslashpairs-invocations↵Because they're identical, one just calls items implicitly.↵Another default iterator is "pairs" |
06:31:18 | FromDiscord | <Phil> which gets called on↵`for index, value in ["la", "le", "li", "Lo", "lu"]: echo index, ": ", value` |
06:31:58 | FromDiscord | <.kanaxa> The `pairs` one makes sense, but this implicit calling for `items`is new to me, and glad there's a documentation for it, didn't see it - now it makes sense |
06:31:59 | FromDiscord | <.kanaxa> (edit) "The `pairs` one makes sense, but this implicit calling for `items`is new to me, and glad there's a documentation for it, didn't see it - now it makes sense ... " added "to me" |
06:32:55 | * | thomasross quit (Ping timeout: 240 seconds) |
06:32:59 | FromDiscord | <Elegantbeef> Oh speaking of pairs Phil, pairs actually works on variants, it's the parallel iterator that does not |
06:33:42 | FromDiscord | <Phil> never dealt with parallel, I assume that one implicitly goes into multithreading? |
06:34:01 | FromDiscord | <Phil> (edit) "goes into multithreading?" => "loops over the iterable concurrently?" |
06:34:39 | FromDiscord | <Phil> In reply to @.kanaxa "The `pairs` one makes": That one in particular is the equivalent to Rusts "The Book", it is the manual containing the entire language spec |
06:35:05 | FromDiscord | <Elegantbeef> I mean `for fieldA, fieldB in fields(a, b)` |
06:35:08 | FromDiscord | <Phil> If you're trying to figure out "how does this syntax construct work", the manual likely has something on it |
06:35:29 | FromDiscord | <Phil> Waaaait a minute, don't we have zip or sth for that? |
06:36:42 | FromDiscord | <Elegantbeef> How would zip work for unrolling two loops over a non homogenous data type |
06:37:11 | FromDiscord | <Phil> Having no good answer to that one: In would work magically |
06:37:17 | FromDiscord | <Phil> (edit) "In" => "It" |
06:37:31 | FromDiscord | <Phil> Just do the thing I have in my mind every time |
06:39:40 | FromDiscord | <Phil> Actually couldn't you do it as long as they have the same number of fields? |
06:40:07 | FromDiscord | <Elegantbeef> I mean it's used on fields of the same type yield mutable fields |
06:40:13 | FromDiscord | <Elegantbeef> objects of the same type\ |
06:40:29 | FromDiscord | <Elegantbeef> It's also unrolled cause each branch is different for each field |
06:40:33 | FromDiscord | <Phil> the loop is going to unroll based on the order the fields are defined in anyway.↵So take the first field of each object, pack them in a tuple, return that for the loop.↵Then do that for the next field.↵etc. |
06:41:08 | FromDiscord | <Elegantbeef> Nice now you no longer have a reference and have a copy |
06:41:29 | FromDiscord | <Phil> Perfect, exactly as intended, everything's broken! |
06:41:39 | FromDiscord | <blackmius> In reply to @Elegantbeef "How would zip work": returning generic tuples?↵iterator zip[A, B](a: OpenArray[A], b: openArray[B]): Tuple[A, B] |
06:42:16 | FromDiscord | <Elegantbeef> Like I said you now have a copy and not unrolled |
06:45:08 | FromDiscord | <blackmius> ok, then only macros can |
07:13:26 | FromDiscord | <.kanaxa> Just thought I'd say: thanks for being kind and for sharing the Nim knowledge guys, y'all are really helpful |
07:17:31 | * | ntat quit (Quit: leaving) |
07:23:18 | * | azimut quit (Ping timeout: 240 seconds) |
07:50:00 | FromDiscord | <Phil> God writing a macro and having it work within like the first 5 tries is such a rush |
07:50:07 | FromDiscord | <Phil> (edit) "God" => "God," |
07:51:03 | FromDiscord | <odexine> lmao |
07:51:06 | FromDiscord | <odexine> god bless genast? |
07:51:23 | FromDiscord | <Phil> dumpAstGen and ruthlessly copy pasting |
07:51:24 | FromDiscord | <terrygillis> In reply to @Elegantbeef "`method` is a nim": strange choice indeed, but what was the `method` keyword reserved for? I thought uses `proc` and `func` for procs with no side effect? |
07:51:33 | FromDiscord | <terrygillis> (edit) "In reply to @Elegantbeef "`method` is a nim": strange choice indeed, but what was the `method` keyword reserved for? I thought ... uses" added "nim" |
07:53:18 | FromDiscord | <odexine> method is for inheritance |
07:53:22 | FromDiscord | <odexine> dynamic dispatch |
07:53:35 | FromDiscord | <odexine> its an actual feature and not just reserved like "end" is |
07:53:38 | FromDiscord | <Phil> sent a code paste, see https://play.nim-lang.org/#ix=4CBY |
07:54:02 | FromDiscord | <Phil> Basically got most of it, just the default initialization for ref-types I'm currently writing |
08:00:15 | FromDiscord | <terrygillis> In reply to @odexine "method is for inheritance": I just did some googling, it seems `method` can only be used for refs as per manual: "Procedures always use static dispatch. Methods use dynamic dispatch. For dynamic dispatch to work on an object it should be a reference type." Why is that? |
08:00:50 | FromDiscord | <terrygillis> Also I wanted to try some Nim code but the playground is currently down where I live. |
08:03:05 | FromDiscord | <odexine> I don’t know, I don’t use methods so I’m not aware of the details |
08:03:11 | FromDiscord | <odexine> At least, I don’t remember |
08:06:26 | FromDiscord | <Phil> I mean, this is full on just conjecture on my part, but I'd assume it's because using dynamic dispatch means your objects need to carry pointers to their methods around.↵As a value type that gets copied a lot that seems less nice. |
08:06:47 | FromDiscord | <Phil> (edit) "nice." => "nice.↵Meanwhile with a ref-type you're just copying the reference to the heap where the object lives." |
08:07:24 | FromDiscord | <Phil> (edit) "I mean, this is full on just conjecture on my part, but I'd assume it's because using dynamic dispatch means your objects need to carry pointers to their methods around.↵As a value type that gets copied a lot that seems less nice.↵Meanwhile with a ref-type you're just copying the reference to the heap where the object ... lives." added "with all its method pointers" |
08:08:49 | FromDiscord | <Phil> actually never mind, you could have a single table of methods for each class and then your object just needs a pointer to that method-table for its class, solving that problem... wait is that what a vtable is? |
08:08:59 | FromDiscord | <Phil> (edit) "class" => "type" |
08:22:18 | FromDiscord | <Phil> sent a code paste, see https://paste.rs/kOhk1 |
08:22:22 | ehmry | did something change with isNil, dereferencing, and orc? this code gives me segfaults now https://git.syndicate-lang.org/ehmry/preserves-nim/src/branch/trunk/src/preserves.nim#L892 |
08:22:32 | FromDiscord | <Phil> (edit) "https://play.nim-lang.org/#ix=4CC2" => "https://play.nim-lang.org/#ix=4CC1" |
08:23:06 | FromDiscord | <odexine> In reply to @isofruit "actually never mind, you": IIRC |
08:34:14 | FromDiscord | <.maverk> ``%`` is not a modulo what is it in nim language ? |
08:34:32 | FromDiscord | <.maverk> to perform a modulo operation i can use mod |
08:34:36 | FromDiscord | <odexine> `mod` |
08:34:38 | FromDiscord | <odexine> Yes |
08:34:40 | FromDiscord | <.maverk> yes |
08:34:43 | FromDiscord | <.maverk> i know |
08:34:45 | FromDiscord | <.maverk> but |
08:34:47 | FromDiscord | <.maverk> % |
08:34:48 | FromDiscord | <.maverk> ? |
08:34:52 | FromDiscord | <odexine> % is not a binary operator in Nim |
08:35:01 | FromDiscord | <.maverk> what is it ??? |
08:35:04 | FromDiscord | <odexine> Nothing |
08:35:06 | FromDiscord | <odexine> Not defined |
08:35:28 | FromDiscord | <odexine> At least for two parameter operations IIRC it is not defined |
08:35:40 | FromDiscord | <.maverk> https://media.discordapp.net/attachments/371759389889003532/1137665279594352651/Capture.PNG |
08:35:45 | FromDiscord | <odexine> Yes |
08:36:00 | FromDiscord | <odexine> That just means if someone defines an operator % that will be the precedence |
08:36:12 | FromDiscord | <odexine> That does not mean that it is an operator in the standard library |
08:36:31 | FromDiscord | <.maverk> aaah oky so i will abstain from using it |
08:36:36 | FromDiscord | <odexine> I mean |
08:36:39 | FromDiscord | <odexine> You can |
08:36:40 | FromDiscord | <.maverk> ? |
08:36:47 | FromDiscord | <.maverk> what can i use it for ? |
08:36:56 | FromDiscord | <odexine> If you want to define it you can, it’s not defined on the standard library precisely for one to define their own |
08:36:59 | FromDiscord | <odexine> Up to you I guess |
08:37:18 | * | ntat joined #nim |
08:37:20 | FromDiscord | <.maverk> hmmm |
08:37:25 | FromDiscord | <.maverk> how can i define it ? |
08:37:43 | FromDiscord | <Elegantbeef> It's quite amazing someone can find the operator precedence table and not the operator manual a few places before it |
08:38:15 | FromDiscord | <.maverk> you are a bot you should not speak |
08:38:17 | FromDiscord | <.maverk> hhhhh |
08:38:45 | FromDiscord | <elegantbeef> It's quite amazing someone can find the operator precedence table and not the operator manual a few places before it |
08:39:00 | FromDiscord | <.maverk> now you can speak |
08:39:18 | FromDiscord | <odexine> <:Utano_XD:652223800804507662> |
08:39:23 | FromDiscord | <.maverk> hhhh |
08:41:32 | FromDiscord | <djazz> h |
08:43:48 | FromDiscord | <intellij_gamer> sent a code paste, see https://play.nim-lang.org/#ix=4CC4 |
08:44:03 | FromDiscord | <Elegantbeef> Imagine encouraging not reading |
08:45:32 | FromDiscord | <intellij_gamer> reading is for nerds =P /j↵But always saves people complaining about getting "RTFM" responses |
08:45:54 | FromDiscord | <Elegantbeef> True, but how do you get to the precedence table before operators |
08:46:13 | FromDiscord | <Elegantbeef> There's putting the cart before the horse, then there's putting the wheels on the horse |
08:46:44 | FromDiscord | <intellij_gamer> Guess they got so excited by how cool the language is they skipped past it? |
08:46:54 | FromDiscord | <intellij_gamer> or lazy, flip a coin and choose |
08:47:36 | FromDiscord | <Elegantbeef> They even skipped the tutorial and went straight to the manual supposedly |
08:48:49 | FromDiscord | <Phil> Personally, the ultimate response imo is to link to the corresponding docs |
08:54:36 | FromDiscord | <odexine> that's still kinda rtfm tho |
08:54:54 | FromDiscord | <odexine> i think people will still complain about it |
08:55:20 | FromDiscord | <Elegantbeef> It's RTFM whilst being a search engine that took 4 billion years to evolve |
08:56:22 | FromDiscord | <odexine> oh so "beef is like the asshole iteration of chatgpt", got it |
08:57:06 | FromDiscord | <.maverk> docs are loved only by english native speakers |
08:57:28 | FromDiscord | <.maverk> when a non native asks they start complaining |
08:57:28 | FromDiscord | <Elegantbeef> Well given I'm an english speaker how is my help going to go over any better |
08:57:33 | FromDiscord | <.maverk> and blh blah |
08:58:13 | FromDiscord | <odexine> i am arguably a native english speaker, depends on your definition |
08:58:36 | FromDiscord | <.maverk> i am not a native speaker |
08:58:40 | FromDiscord | <.maverk> i am from dubai |
08:58:44 | FromDiscord | <Elegantbeef> I'm clearly not a native english speaker given how badly I fuck up the language |
08:58:50 | FromDiscord | <.maverk> i mostly use arabic |
08:58:57 | FromDiscord | <Elegantbeef> Wait it says here I am |
08:59:18 | FromDiscord | <.maverk> no need for negative words |
08:59:23 | FromDiscord | <.maverk> we all can say them |
08:59:26 | FromDiscord | <odexine> well it's difficult for a small language to support languages of which not many natives of such use |
08:59:39 | FromDiscord | <Elegantbeef> What negative words |
08:59:40 | FromDiscord | <odexine> (edit) "well it's difficult for a small ... languagenatural" added "prog." | "prog.language to support ... languages" added "natural" |
08:59:41 | FromDiscord | <Elegantbeef> Like minus and bad? |
09:00:18 | FromDiscord | <.maverk> oky i don't wanna continue speaking to you ok big talk done ? |
09:00:31 | FromDiscord | <odexine> up to you |
09:01:09 | FromDiscord | <odexine> in this case, ultimately it is your loss, i'd say |
09:01:25 | FromDiscord | <.maverk> i hate nonsense |
09:01:34 | FromDiscord | <.maverk> just blah blah without any benefit |
09:01:49 | FromDiscord | <.maverk> waste of time and energy |
09:03:06 | FromDiscord | <odexine> without this "nonsense", the mood would be too serious |
09:03:31 | FromDiscord | <Elegantbeef> Well rika you best get a suit on, I gotta go buy one. Think there is a suit shop open at 3am? |
09:03:58 | FromDiscord | <odexine> book a flight for a country thats still in daylight xd |
09:04:22 | FromDiscord | <odexine> i dont got any formalwear so |
09:05:43 | FromDiscord | <ratogbm> Is there a `exit()` in nim? (Similar to python) |
09:05:48 | FromDiscord | <odexine> `quit()` |
09:06:01 | FromDiscord | <odexine> dont ask me why its quit and not exit |
09:06:04 | FromDiscord | <ratogbm> I checked the documentation, it says everyting will break |
09:06:11 | FromDiscord | <ratogbm> (edit) "break" => "burn" |
09:06:14 | FromDiscord | <odexine> what do you mean? |
09:06:18 | FromDiscord | <ratogbm> (edit) "burn" => "burn, break etc." |
09:06:28 | FromDiscord | <Elegantbeef> Do not use `quit` |
09:06:41 | FromDiscord | <odexine> https://nim-lang.org/docs/system.html#quit%2Cint |
09:06:44 | FromDiscord | <ratogbm> sent a code paste, see https://play.nim-lang.org/#ix=4CCc |
09:07:12 | FromDiscord | <ratogbm> In reply to @Elegantbeef "Do not use `quit`": What do I use then? |
09:07:22 | FromDiscord | <ratogbm> I just want my program to stop |
09:07:24 | FromDiscord | <Elegantbeef> sent a code paste, see https://paste.rs/ROUVT |
09:07:41 | FromDiscord | <odexine> that also calls `quit` in the end though |
09:07:56 | FromDiscord | <odexine> what would the effective difference be between such |
09:07:59 | FromDiscord | <Elegantbeef> If you use `quit` it'll stop but all of your destructors will not be called |
09:08:01 | FromDiscord | <odexine> other than information |
09:08:17 | FromDiscord | <Elegantbeef> Read the danger on quit |
09:08:21 | FromDiscord | <odexine> why is that the case for quit |
09:08:33 | FromDiscord | <Elegantbeef> It instantly stops and does not abide by Nim flow control |
09:08:49 | FromDiscord | <odexine> well again why is that the design |
09:08:51 | FromDiscord | <ratogbm> I think it is easier to just but the rest of my code into an else statement |
09:08:59 | FromDiscord | <ratogbm> (edit) "but" => "put" |
09:09:14 | FromDiscord | <Elegantbeef> Don't look at me rika I didnt design it |
09:09:19 | FromDiscord | <odexine> ok |
09:10:42 | FromDiscord | <ratogbm> sent a code paste, see https://play.nim-lang.org/#ix=4CCi |
09:10:45 | FromDiscord | <Elegantbeef> Right then quite doesnt matter |
09:10:52 | FromDiscord | <Elegantbeef> But why not just throw that in a proc and return 😄 |
09:11:15 | FromDiscord | <ratogbm> Throw the "rest of the code" into a proc? |
09:12:23 | FromDiscord | <odexine> like in c |
09:12:24 | FromDiscord | <odexine> with a main |
09:12:51 | FromDiscord | <ratogbm> btw, why does global code not see functions that are declared bellow it, but functions do? |
09:14:24 | FromDiscord | <ratogbm> it's so inconvienient, you have to scroll all the way to the bottom to see what the code is doing... |
09:14:26 | FromDiscord | <odexine> functions dont either? example? |
09:14:44 | FromDiscord | <ratogbm> In reply to @odexine "functions dont either? example?": Then how do recursive functions work? |
09:15:13 | FromDiscord | <ratogbm> (edit) "In reply to @odexine "functions dont either? example?": Then how do recursive functions work? ... " added "(w functions calling each other)" |
09:15:40 | FromDiscord | <Phil> ?↵The call of the recursive function is later than the definition of the function, so your compiler at the point of calling that other function knows of the existance of it |
09:15:41 | FromDiscord | <odexine> forward declaration |
09:16:00 | FromDiscord | <Phil> Huh, appears my reasoning was wrong for that one then. |
09:16:26 | FromDiscord | <ratogbm> In reply to @isofruit "? The call of": Ok, this conceptual model makes more sense. |
09:17:42 | FromDiscord | <odexine> sent a code paste, see https://play.nim-lang.org/#ix=4CCj |
09:18:21 | FromDiscord | <ratogbm> But I mean like, if I was a compiler, I would scrape all the functions and then work from there... |
09:18:59 | FromDiscord | <ratogbm> (edit) "work from there..." => "everything else..." |
09:19:28 | FromDiscord | <odexine> that has a time cost |
09:19:43 | FromDiscord | <odexine> compilation time would probably be excessively long |
09:19:44 | FromDiscord | <ratogbm> In reply to @odexine "that has a time": ok |
09:20:08 | FromDiscord | <odexine> though i would say it's worth the time cost |
09:21:34 | FromDiscord | <Elegantbeef> Well Zig and Odin are fast, but zig atleast does lazy semming |
09:27:16 | FromDiscord | <roupi.rb> the nim playground is down ? |
09:29:22 | FromDiscord | <roupi.rb> why i can use .age = in line 17 but not on line 23 ? https://media.discordapp.net/attachments/371759389889003532/1137678790420598784/image.png |
09:33:25 | FromDiscord | <demotomohiro> In reply to @roupi.rb "the nim playground is": In Nim, parameters are immutable in default.↵You need to write `proc lol(p: var Person): Person =` if you want to modify the argument. |
09:36:47 | FromDiscord | <roupi.rb> hum map wont let me mutate the values https://media.discordapp.net/attachments/371759389889003532/1137680662166511676/image.png |
09:39:05 | FromDiscord | <Phil> In reply to @roupi.rb "hum map wont let": sequtils procs are taken from functional concepts.↵So a map-proc creates a new sequence of whatever output your lol proc produces and it can not mutate. |
09:40:09 | FromDiscord | <roupi.rb> is there an easy way to make a copy of p ? |
09:40:34 | FromDiscord | <Phil> sent a code paste, see https://play.nim-lang.org/#ix=4CCo |
09:41:35 | FromDiscord | <Phil> sent a code paste, see https://play.nim-lang.org/#ix=4CCp |
09:43:29 | FromDiscord | <Phil> sent a code paste, see https://play.nim-lang.org/#ix=4CCq |
09:44:08 | FromDiscord | <Phil> (edit) "https://play.nim-lang.org/#ix=4CCq" => "https://paste.rs/i5BQq" |
09:44:47 | FromDiscord | <Phil> Though generally not using ref-types is preferred I'd say. |
09:44:55 | FromDiscord | <roupi.rb> is there a way to convert a type to ref |
09:45:07 | FromDiscord | <roupi.rb> after i defined it without ref |
09:46:29 | FromDiscord | <demotomohiro> ref type can reference only ref type. |
09:46:34 | FromDiscord | <Phil> sent a code paste, see https://play.nim-lang.org/#ix=4CCr |
09:47:44 | FromDiscord | <Phil> You won't need to think about the distinction there too often but it does come up (e.g. with `$`/ `echo` or when comparing two instances of a ref-type) |
09:48:46 | FromDiscord | <Phil> And `==` does different things for ref-types than you'd expect |
09:49:19 | FromDiscord | <.kanaxa> In reply to @.maverk "oky i don't wanna": Dude, stop being rude |
09:49:41 | FromDiscord | <.kanaxa> Beef is helpful and knows his stuff, you don't need to be like this |
09:51:25 | FromDiscord | <Phil> sent a code paste, see https://play.nim-lang.org/#ix=4CCt |
09:52:04 | FromDiscord | <Phil> (edit) "https://play.nim-lang.org/#ix=4CCt" => "https://play.nim-lang.org/#ix=4CCu" |
09:53:40 | FromDiscord | <Phil> I'm sure checking for pointer equality is something that on the lower levels you might care about at some point when working with ref-types, but for my purposes I have never found it useful on any language that uses it, which is every language I'm aware of bar Groovy |
09:59:36 | FromDiscord | <roupi.rb> what would be the average compile time for a medium webserver written in nim ? |
10:00:00 | FromDiscord | <Phil> Define "medium" |
10:00:11 | FromDiscord | <Phil> And development release or production release? |
10:00:17 | FromDiscord | <Phil> (edit) "release" => "build" | "release?" => "build?" |
10:00:17 | FromDiscord | <odexine> i'd say no more than a couple of minutes? |
10:01:34 | FromDiscord | <Phil> And webserver (e.g. compiling something like httpbeast, tomcat etc.) or webapplication (e.g. something that is built with spring, django, prologue, jester etc.) ? |
10:02:07 | FromDiscord | <roupi.rb> like a prologue web server with an orm and about 20 api endpoints |
10:02:19 | FromDiscord | <roupi.rb> and for development |
10:02:49 | FromDiscord | <Phil> I have a prologue web server with an orm, around 80 or so api endpoints and for development I'm under 15 seconds pretty sure, one sec |
10:13:43 | FromDiscord | <Phil> I stand corrected.↵Complete cold compile is around 30-35 seconds |
10:14:07 | FromDiscord | <Phil> During typical development you just have stuff cached that brings that time down |
10:14:36 | * | xet7 quit (Remote host closed the connection) |
10:16:06 | * | xet7 joined #nim |
10:17:38 | * | ntat quit (Quit: leaving) |
10:24:32 | FromDiscord | <Phil> I stand corrected again, it's more around 120 endpoints |
10:54:10 | FromDiscord | <.kanaxa> How do you find the complexity of managing a Prologue server vs Django @Phil |
10:57:05 | FromDiscord | <Phil> In reply to @.kanaxa "How do you find": Prologue is just much more explicit than Django.↵That does lead to me writing more code (though I'm currently writing some tooling to improve upon that) but also means that these "Wha? Which weird incantation is not working as expected?" are far rarer. |
10:59:21 | FromDiscord | <Phil> I can basically eliminate N+1 problems because I'm not having to learn some weird way in which I can fix avoid those on Django.↵I can eliminate fetching unnecessary data because I can just write read-only models with norm.↵I can eliminate having to check what HTTP-request type my handler is getting because my request-handler is only registered for Http Get. |
10:59:36 | FromDiscord | <Phil> (edit) "norm.↵I" => "norm that only fetch the fields I actually need.↵I" |
11:01:03 | FromDiscord | <Phil> What would've been are compile-time checked URLs. Like you check at compile-time that the url parameters you define in your code must be present by name in the url that the request-handler is registered with |
11:01:10 | FromDiscord | <Phil> (edit) "What would've been ... are" added "fire" |
11:02:00 | FromDiscord | <Phil> I'm basically dealing with the root problem of Django directly.↵Not with how to solve that problem with an abstraction somebody else hands me |
11:02:11 | FromDiscord | <Phil> (edit) "me" => "me.↵Which makes things easier" |
11:02:33 | * | FromDiscord quit (Remote host closed the connection) |
11:02:46 | * | FromDiscord joined #nim |
11:04:51 | FromDiscord | <Phil> However I benefit from already having webdev experience.↵So I know how I'd want to structure my webdev application from the get go. |
11:05:51 | FromDiscord | <Phil> For getting started with webdev prologue invariably will be harder than Django.↵Because Django provides you some guides that show you how to do the magic invocations to get something going.↵You don't have to understand how you got from A to B, just how to do the magic invocations |
11:05:58 | FromDiscord | <.kanaxa> In reply to @isofruit "I can basically eliminate": Fascinating |
11:06:56 | FromDiscord | <.kanaxa> In reply to @isofruit "For getting started with": I'm just looking at Prologue at the moment, seeing if there's a viable need for me to go down that path instead of sticking with Django |
11:07:36 | FromDiscord | <.kanaxa> The idea of 'compiling' a serve also feels a bit odd to me, since I'm just used to running gunicorn + Nginx off a bunch of Django scripts |
11:07:41 | FromDiscord | <.kanaxa> (edit) "serve" => "server" |
11:07:56 | FromDiscord | <.kanaxa> Never done it before although I think it'd be a good experiment for me to try |
11:13:27 | FromDiscord | <Phil> I found it pretty rewarding because it demonstrates that the problem you're trying to solve isn't that hard |
11:13:49 | FromDiscord | <Phil> Frameworks Tend to make it hard by their over encompassing nature |
11:14:06 | FromDiscord | <Phil> And oo doesn't necessarily help in my opinion |
11:21:46 | FromDiscord | <.maverk> how can i check a statement at a compiliting time in nim language ??? assert doesn't do the work |
11:21:58 | FromDiscord | <.maverk> (edit) "compiliting" => "compile" |
11:22:58 | FromDiscord | <.maverk> assert here supposed to block the compiling process but it doesn't as you can see the executable file came https://media.discordapp.net/attachments/371759389889003532/1137707384559632464/665.PNG |
11:31:15 | FromDiscord | <Phil> You can use static: to create a code block that executes at compile time |
11:32:17 | FromDiscord | <.maverk> i thought assert here as python |
11:32:20 | FromDiscord | <Phil> But what that will tell you is that name can't be used at compile time |
11:33:14 | FromDiscord | <Phil> Assert is runtime first and foremost.↵You want a code block to execute at compile time you use static |
11:33:14 | FromDiscord | <.maverk> hmmm |
11:33:25 | FromDiscord | <.maverk> so assert raises an error at running time |
11:33:32 | FromDiscord | <.maverk> (edit) "running time" => "run-time" |
11:33:56 | FromDiscord | <.maverk> ok perfect |
11:34:12 | FromDiscord | <Phil> Yes ↵Also you need to have a const to assert anything at compile time |
11:34:44 | FromDiscord | <Phil> There are exceptions to that in compile-time procs but that doesn't apply here for now |
11:35:03 | FromDiscord | <.maverk> aaah i understand |
11:35:03 | FromDiscord | <Phil> (edit) "There are exceptions to that in compile-time procs ... but" added "and some other places" |
11:35:33 | FromDiscord | <Phil> Actually you might get away with using let if it is in a static block |
11:35:48 | FromDiscord | <Phil> Because static would already make it compile-time |
11:35:59 | FromDiscord | <.maverk> i know i can make object constant with let |
11:36:05 | FromDiscord | <.maverk> it is really good |
11:36:21 | FromDiscord | <.maverk> thank you so much brother |
11:36:37 | FromDiscord | <Phil> Nah I meant that in a static block both let and var are compile-time |
11:36:46 | FromDiscord | <Phil> Const is always compile-time |
11:36:55 | FromDiscord | <.maverk> var is a compile-time ? |
11:37:03 | FromDiscord | <Phil> Let and var are runtime by default |
11:37:04 | FromDiscord | <.maverk> you mean the type or var itself ? |
11:37:10 | FromDiscord | <.maverk> aaah |
11:37:13 | FromDiscord | <.maverk> ok ok i get it |
11:37:17 | FromDiscord | <Phil> A static block means that everything in it gets executed at compile time |
11:37:31 | FromDiscord | <.maverk> i will try it |
11:39:39 | FromDiscord | <.maverk> butht exe still comes |
11:40:07 | FromDiscord | <.maverk> it is compile-time |
11:40:46 | FromDiscord | <.maverk> compile-time means the process of compiling will not be done if some requirements are not met |
11:41:06 | FromDiscord | <.maverk> if the requirements met the exe file will come |
11:41:15 | FromDiscord | <.maverk> but exe comes anyways |
11:44:53 | FromDiscord | <Phil> Show the code 😛 |
11:45:03 | FromDiscord | <.maverk> hhh no it worked now |
11:45:41 | FromDiscord | <.maverk> static makes the compiler checks everything at compile-time |
11:46:08 | FromDiscord | <Phil> It is one of the ways to execute at compile time, yeah.↵There are others as well |
11:46:20 | FromDiscord | <.maverk> wow amazing |
11:46:59 | FromDiscord | <Phil> You can force a proc to execute at compile-time for example by running const X = myproc() |
11:47:40 | FromDiscord | <Phil> Because to assign to X, myproc must first be fully evaluated and the result of that is then assigned to X at compile time |
11:48:39 | FromDiscord | <.maverk> i like compile-time stuff |
11:48:39 | FromDiscord | <roupi.rb> In reply to @isofruit "Prologue is just much": i wonder why there is no nim webframework that makes heavy use of dsl and metaprogramming like rails yet |
11:48:51 | FromDiscord | <.maverk> it makes a lot of alot of sense |
11:49:05 | FromDiscord | <Phil> In reply to @roupi.rb "i wonder why there": I mean there is jester, but generally I'm not the person to ask there |
11:50:28 | FromDiscord | <Phil> I like my frameworks explicit in general and rather without DSL magic.↵There are exceptions if they're really well done like they are in owlkettle (a gtk wrapper for desktop apps) but those are the exception to me |
11:50:48 | FromDiscord | <Phil> Jester has plenty macro magic |
11:51:10 | FromDiscord | <Phil> I think mummy also has some in they way controllers get defined |
11:53:44 | FromDiscord | <roupi.rb> does nim have a equivalent to bundler/npm/cargo/shards ? |
11:54:09 | FromDiscord | <jordan4ibanez> sent a code paste, see https://play.nim-lang.org/#ix=4CD8 |
11:54:24 | FromDiscord | <Phil> Nimble and more gently with more limited scope atlas |
11:54:33 | FromDiscord | <Phil> (edit) "gently" => "recently" |
11:55:00 | FromDiscord | <jordan4ibanez> I've found I can also do ``var blah = new Vector3i`` so now I am unsure |
11:55:05 | FromDiscord | <Phil> sent a code paste, see https://paste.rs/XzWD0 |
11:55:07 | FromDiscord | <jordan4ibanez> Ah okay, good :D |
11:55:08 | FromDiscord | <jordan4ibanez> Thank ya |
11:55:15 | FromDiscord | <Phil> You can check that by echoing |
11:55:36 | FromDiscord | <Phil> $ is not defined for ref types so the echo will fail |
11:56:00 | FromDiscord | <Phil> Using [] to unref will make it work again |
12:00:44 | FromDiscord | <jordan4ibanez> Very nice, time to do something stupid |
12:28:42 | FromDiscord | <raynei486> is there nim equivalents like C's `LINE` |
12:28:55 | FromDiscord | <raynei486> trying to get some nice logging output |
12:38:45 | FromDiscord | <Phil> I only know std/logging when it comes to logging, sorry |
12:40:36 | FromDiscord | <intellij_gamer> There is [instantiationInfo](https://nim-lang.org/docs/system.html#instantiationInfo%2Cint) which returns the line info |
12:40:50 | FromDiscord | <intellij_gamer> oh nice, markdown URLs are out |
12:42:32 | FromDiscord | <raynei486> ooh thanks |
12:42:54 | FromDiscord | <raynei486> also sweet discord finally added markdown links |
12:43:13 | FromDiscord | <raynei486> condenses stuff a lot |
12:58:54 | * | lucasta joined #nim |
12:59:56 | * | lucasta quit (Remote host closed the connection) |
13:00:21 | * | lucasta joined #nim |
13:01:41 | FromDiscord | <x.hat> I noticed that the prebuilt binaries are currently x86 / x86_64. Is there a way to contribute arm builds? |
13:02:01 | FromDiscord | <x.hat> Alternatively, where could I ask a Nim core team member this |
13:02:15 | FromDiscord | <x.hat> Is the forum the source of truth? IRC? |
13:20:47 | FromDiscord | <.maverk> wow nim has exceptions |
13:25:38 | FromDiscord | <Phil> Forums or internals channel |
13:33:01 | * | jmdaemon quit (Ping timeout: 246 seconds) |
13:41:53 | FromDiscord | <.maverk> does nim have struct and match or switch ? |
13:42:01 | FromDiscord | <.maverk> and does it have the socket library ? |
13:48:00 | FromDiscord | <Chronos [She/Her]> In reply to @.maverk "does nim have struct": In the manual look at `type` and `case` |
13:48:08 | FromDiscord | <Chronos [She/Her]> In reply to @.maverk "and does it have": Yeah it does |
13:49:19 | FromDiscord | <.maverk> In reply to @yu.vitaqua.fer.chronos "Yeah it does": what is its name |
13:49:20 | FromDiscord | <.maverk> ? |
13:49:25 | FromDiscord | <.maverk> socket or net or what ? |
13:53:25 | FromDiscord | <Chronos [She/Her]> It's `std/net` |
13:53:38 | FromDiscord | <.maverk> so i should do import std/net ? |
13:53:40 | FromDiscord | <Chronos [She/Her]> There's also `std/asyncnet` for an asynchronous wrapper too |
13:53:44 | FromDiscord | <Phil> Just ws |
13:53:58 | FromDiscord | <Phil> Assuming you mean WebSocket |
13:53:59 | FromDiscord | <Chronos [She/Her]> In reply to @.maverk "so i should do": Yes, but first you should read the manual |
13:54:13 | FromDiscord | <.maverk> In reply to @yu.vitaqua.fer.chronos "Yes, but first you": yeah ofc i was just curious |
13:54:16 | FromDiscord | <Chronos [She/Her]> In reply to @isofruit "Just ws": They said sockets not ws so I'm assuming sockets aha |
13:54:27 | FromDiscord | <.maverk> yeah maybe |
13:54:32 | FromDiscord | <.maverk> ws = web socket |
13:54:46 | FromDiscord | <Chronos [She/Her]> There's a difference between a websocket and a socket |
13:54:59 | FromDiscord | <.maverk> yeah since he said ws |
13:55:06 | FromDiscord | <Chronos [She/Her]> I'm just assuming sockets, TCP/UDP (since the code is similar) |
13:55:06 | FromDiscord | <.maverk> that was just an expectation |
13:55:35 | FromDiscord | <Phil> I very rarely see folks asking for actual sockets instead of just sockets, thus my assumption |
13:55:46 | FromDiscord | <Phil> (edit) "sockets," => "websockets," |
13:55:49 | FromDiscord | <.maverk> hmmm |
13:55:51 | FromDiscord | <Chronos [She/Her]> Ah fair |
13:56:05 | FromDiscord | <.maverk> i really appreciate your help guys |
13:56:08 | FromDiscord | <.maverk> thanks |
13:56:11 | FromDiscord | <Chronos [She/Her]> Of course! |
13:58:07 | FromDiscord | <odexine> In reply to @isofruit "I very rarely see": You’re mainly in the high level server programming space though |
13:58:38 | FromDiscord | <Phil> That is entirely fair |
14:08:40 | Amun-Ra | general q: do you often use .inline. pragma or let the compiler to the job? |
14:08:49 | Amun-Ra | s/to/do/ |
14:09:40 | Amun-Ra | or even use templates |
14:12:31 | FromDiscord | <Phil> Never ever use it |
14:12:38 | FromDiscord | <Phil> But I don't do low level |
14:16:24 | * | Guest76 joined #nim |
14:29:45 | FromDiscord | <exelotl> Yes, if you have a small proc that is going to be called across module bounds and are not compiling with LTO, it's not a bad idea to slap {.inline.} on there to avoid the function call overhead |
14:30:17 | * | Guest76 quit (Quit: Client closed) |
14:30:53 | FromDiscord | <exelotl> If its only called within the same module then there's no point in using {.inline.} because the compiler can do it anyway |
14:34:20 | FromDiscord | <odexine> In reply to @exelotl "If its only called": Which? The Nim compiler inlines by itself? Cool |
14:58:46 | Amun-Ra | C compiler |
15:00:59 | FromDiscord | <ehfarah> @.maverk\: hi |
15:40:40 | * | ntat joined #nim |
15:46:01 | FromDiscord | <.maverk> In reply to @ehfarah "<@1021771961040375900>\: hi": hi |
15:50:36 | * | lucasta quit (Quit: Leaving) |
16:01:11 | * | junaid_ joined #nim |
16:13:33 | FromDiscord | <.maverk> are ``true`` and ``false`` considered identifiers or boolean literals ? |
16:15:34 | FromDiscord | <Phil> In macro land: identifier |
16:32:24 | * | azimut joined #nim |
16:41:58 | * | azimut quit (Ping timeout: 240 seconds) |
16:56:31 | * | azimut joined #nim |
16:59:20 | * | lucasta joined #nim |
17:00:12 | * | lucasta quit (Remote host closed the connection) |
17:00:38 | * | lucasta joined #nim |
17:19:07 | FromDiscord | <.maverk> sent a code paste, see https://play.nim-lang.org/#ix=4CEx |
17:27:24 | * | thomasross joined #nim |
17:30:30 | FromDiscord | <.kanaxa> In reply to @isofruit "Never ever use it": Thank you for the indicator, I was like wondering if I had any need for that today |
17:30:44 | FromDiscord | <.kanaxa> I'm looking at this example on inline iterator though: https://forum.nim-lang.org/t/845#4958 |
17:30:50 | FromDiscord | <.kanaxa> Is there are benefit to inlining an iterator? |
17:31:17 | FromDiscord | <.kanaxa> Because it appears to transform in-place a yield syntax to an echo syntax |
17:32:07 | FromDiscord | <.kanaxa> Is this a performance thing? If I were not concerned with performance (for simpler apps especially), is there a need for the `{.inline.}` pragma? |
17:32:22 | FromDiscord | <.kanaxa> (edit) "iterator" => "iterators" |
17:32:49 | FromDiscord | <.kanaxa> (edit) "Because it" => "It" |
17:35:15 | FromDiscord | <odexine> sent a code paste, see https://play.nim-lang.org/#ix=4CEB |
17:35:43 | FromDiscord | <.maverk> In reply to @odexine "https://nim-lang.org/docs/manual.html#lexical-analy": i did not understand |
17:35:46 | FromDiscord | <.maverk> 😦 |
17:36:20 | FromDiscord | <.maverk> sent a code paste, see https://play.nim-lang.org/#ix=4CEC |
17:37:15 | FromDiscord | <odexine> > means increase the indentation↵= means the indentation doesn’t change |
17:37:22 | FromDiscord | <odexine> (edit) ">" => "\>" |
17:37:53 | FromDiscord | <odexine> Ded means decrease the indentation |
17:37:57 | FromDiscord | <odexine> Roughly |
17:40:10 | * | thomasross quit (Quit: Leaving) |
17:43:07 | FromDiscord | <.maverk> and used only in expressions like this |
17:43:22 | FromDiscord | <.maverk> sent a code paste, see https://paste.rs/LfLzi |
17:47:35 | FromDiscord | <odexine> I don’t think it’s that important for most beginners to understand |
17:47:59 | FromDiscord | <odexine> It’s just a formal expression of the indentation rules |
17:48:11 | FromDiscord | <.maverk> hmmmm |
17:48:22 | FromDiscord | <.maverk> may i know where exactly used in ? |
17:48:29 | FromDiscord | <odexine> Basically it’s a detailed explanation of how Nim treats jndentation |
17:48:30 | FromDiscord | <.maverk> i am curu=ious |
17:48:33 | FromDiscord | <odexine> Indentation |
17:48:39 | FromDiscord | <.maverk> i see |
17:48:59 | FromDiscord | <odexine> It’s just to note down how Nim works with indentation |
17:49:58 | FromDiscord | <.maverk> i see |
18:20:05 | * | lucasta quit (Ping timeout: 245 seconds) |
19:10:41 | NimEventer | New thread by RedDirt: Nim Project Setup, see https://forum.nim-lang.org/t/10382 |
19:25:47 | * | ntat quit (Quit: leaving) |
20:04:28 | FromDiscord | <Phil> Today I learned that you can actually have project local dependencies with nimble |
20:05:42 | FromDiscord | <Phil> (edit) "Today I learned that you can actually have project local dependencies with nimble ... " added "by just having a nimbledeps folder" |
20:10:24 | FromDiscord | <Phil> Okay I don't understand, how is my entire webserver in terms of dependencies only like 8 MB in size?↵I know I have warped expectations here because of java, JS and rust all having ecosystems where a project basically laughs at you if the file-size of your dependencies isn't measured in 100Mb+, but wth |
20:10:50 | FromDiscord | <Phil> (edit) "file-size" => "folder-size" | "dependencies" => "dependency-folder" |
20:11:20 | FromDiscord | <Elegantbeef> Are you using std/httpclient? |
20:11:45 | FromDiscord | <Phil> I distinctly recall that a freshly setup project in rust-rocket was already like 300MB so what is going on |
20:12:04 | FromDiscord | <Phil> I dunno, I use prologue, which uses httpx, which is a fork of httpbeast.↵Never checked if httpbeast uses std/httpclient |
20:12:07 | * | ced1 joined #nim |
20:12:44 | FromDiscord | <Phil> Ah, should've been more precise in my wording:↵My webapplication (which includes the httpx server) is only like 8MB in size |
20:12:57 | * | ced1 is now known as cedb |
20:13:18 | FromDiscord | <Elegantbeef> Wait is the binary or source 300mb |
20:13:28 | FromDiscord | <Phil> the 300MB was rust with source |
20:13:34 | FromDiscord | <Phil> Back when I tried it |
20:14:01 | FromDiscord | <Phil> With nim I have in my nimbledeps folder of my webserver project only 8 MB of... I think code, let me check |
20:14:13 | FromDiscord | <Elegantbeef> Interesting that rust is so big |
20:14:14 | FromDiscord | <Phil> Source |
20:14:33 | FromDiscord | <Phil> I mean, java with Spring is also a gargantuan monster in any setup |
20:14:41 | FromDiscord | <Elegantbeef> Perhaps they had some libraries pulled in to make it more close to zero external deps |
20:15:09 | om3ga | macports compile now whole sources of whole internet |
20:15:10 | FromDiscord | <Phil> And let me check my django folder on my server that I still haven't deleted |
20:15:26 | om3ga | rust compilation took 4 hours |
20:16:20 | FromDiscord | <Phil> Ah wait, I don't have the dependencies of the python thingie easily accessible... well no clue how large the Django project is then |
20:16:45 | FromDiscord | <Phil> Anyway, in JS basically farting already nets you a node_module folder approaching 100Mb |
20:17:12 | FromDiscord | <Phil> So based on these 3 languages I kinda anticipated just... a fatter dependency folder |
20:18:06 | FromDiscord | <Phil> Scratch approaching, node_modules easily apparently surpass a gig |
20:18:28 | FromDiscord | <Phil> I can only assume they're including video files in their stuff |
20:18:29 | FromDiscord | <Elegantbeef> Well yea cause node includes everything |
20:18:46 | FromDiscord | <Elegantbeef> I don't doubt you depend on your own project inside of a node package |
20:19:08 | FromDiscord | <Elegantbeef> A big endless graph |
20:19:13 | om3ga | why then node is so popular? |
20:19:26 | FromDiscord | <Elegantbeef> Cause JS programmers have no taste |
20:19:39 | om3ga | I can't even understand what they're doing there |
20:19:47 | FromDiscord | <Phil> Cause it allowed to run servers and ... yeah JS and no taste and so on |
20:19:59 | FromDiscord | <Phil> I mean Deno has been out for a while and apparently node itself still dominates |
20:34:40 | * | rockcavera quit (Ping timeout: 245 seconds) |
20:36:10 | * | rockcavera joined #nim |
20:49:34 | * | junaid_ quit (Remote host closed the connection) |
21:04:39 | * | jmd_ joined #nim |
21:05:00 | FromDiscord | <summarity> Is there a way I can choose where Nim puts the generated C/C++ files during compilation? Fishing them out of the cache dir is slightly inconvenient |
21:08:14 | FromDiscord | <that_dude.> In reply to @summarity "Is there a way": Something like this? https://nim-lang.org/docs/nimc.html#compiler-usage-generated-c-code-directory |
21:11:17 | FromDiscord | <Chronos [She/Her]> Hey y'all, how hard would it be to recreate `nano` in Nim? |
21:11:53 | FromDiscord | <Chronos [She/Her]> Since that way I have an editor close to what I like already that I can understand the internals of, in a cleaner language |
21:12:00 | FromDiscord | <Chronos [She/Her]> My issue is just the TUI is painful lmao |
21:18:36 | FromDiscord | <summarity> i once tried to do that in Bash (https://github.com/turbo/bee), so Nim's probably going to be easier 😄 |
21:24:49 | FromDiscord | <shalokshalom> @Chronos [She/Her] I would actually look into micro |
21:25:01 | FromDiscord | <shalokshalom> that has a much cleaner codebase |
21:27:45 | FromDiscord | <shalokshalom> @summarity I don't know if I am impressed, sad, upset or should applaud you |
21:27:52 | FromDiscord | <shalokshalom> Probably all of that 😅 |
21:38:07 | FromDiscord | <summarity> Can I run other commands than instrumenting `nim` from a nimble task (pre/post build stuff)? |
21:40:09 | FromDiscord | <srmordred> Table is supposed to be slow? ↵not sure if i'm abusing key length, or there is something else wrong. ↵if so, there are some good lib alternative? |
21:40:42 | * | azimut quit (Remote host closed the connection) |
21:41:11 | * | azimut joined #nim |
21:47:11 | FromDiscord | <Elegantbeef> What's the key? |
21:51:12 | FromDiscord | <Elegantbeef> @srmordred |
21:55:25 | FromDiscord | <srmordred> strings and ints. |
21:55:43 | FromDiscord | <Elegantbeef> Are you benchmarking in release? |
21:58:05 | FromDiscord | <Elegantbeef> Tables are a hashtable so if you have a long string it'll be a expensive operation |
22:01:37 | FromDiscord | <srmordred> sent a long message, see http://ix.io/4CFC |
22:02:20 | FromDiscord | <Elegantbeef> Are you indexing or iterating? |
22:04:56 | FromDiscord | <Elegantbeef> If iterating stop it, that's the slowest API of a hashtable |
22:06:48 | FromDiscord | <srmordred> sent a long message, see http://ix.io/4CFE |
22:07:04 | FromDiscord | <Elegantbeef> That's 4 hashes so of course that's going to be slow |
22:08:22 | FromDiscord | <srmordred> it should? ↵i thought that i need some thousands of hash indexing to make some difference. |
22:11:20 | FromDiscord | <Elegantbeef> He I don't know what you're doing or if you profiled |
22:11:21 | FromDiscord | <Elegantbeef> hey\ |
22:12:28 | FromDiscord | <srmordred> anyway, i'll probably change the second argument. ↵Datetime could be linear search since don´t have many, and the ints could be an seq with some logic. that will cut most of the hash indexing. |
22:12:53 | FromDiscord | <Elegantbeef> Profile before you change |
22:13:34 | FromDiscord | <Elegantbeef> Use perf, callgrind/cachegrind, or any other tool to profile properly |
22:13:40 | FromDiscord | <Elegantbeef> `--debugger:native` is required |
22:14:10 | FromDiscord | <srmordred> will take a look at that, thanks @elegantbeef 🙂 |
22:20:59 | FromDiscord | <Chronos [She/Her]> In reply to @shalokshalom "<@909883978717204561> I would actually": Wouldn't want to use Go aha, also the idea is, if I can make a minimal reimplementation, I'll have a more intimate understanding of it to do what I want |
22:21:19 | FromDiscord | <Elegantbeef> Go use illwill or ansiwave and start making your text editor! |
22:21:40 | FromDiscord | <Chronos [She/Her]> In reply to @summarity "i once tried to": Simultaneously impressive and horrific lol |
22:21:54 | FromDiscord | <Chronos [She/Her]> In reply to @Elegantbeef "Go use illwill or": That is the plan lol |
22:22:10 | FromDiscord | <Chronos [She/Her]> Also uh what should I name it? |
22:22:14 | FromDiscord | <Elegantbeef> I actually do not know, to text editors use a rope system |
22:22:20 | FromDiscord | <Chronos [She/Her]> I can't do naming for my life |
22:22:39 | FromDiscord | <Chronos [She/Her]> In reply to @Elegantbeef "I actually do not": Rope system? As in, units? |
22:24:08 | FromDiscord | <Chronos [She/Her]> Immediately I already like Nimwave more than Illwill |
22:24:11 | FromDiscord | <Elegantbeef> God thing it doesnt matter |
22:24:11 | FromDiscord | <Elegantbeef> Since I have a small brain I'd name it planck |
22:24:38 | FromDiscord | <Chronos [She/Her]> Hmmm |
22:25:00 | FromDiscord | <Chronos [She/Her]> What if I named it Niditor |
22:25:14 | FromDiscord | <Chronos [She/Her]> ...that sounds like a slur in some vague way |
22:25:35 | FromDiscord | <Elegantbeef> Unless it's a pun, don't do it |
22:26:16 | FromDiscord | <Chronos [She/Her]> Yeah definitely not |
22:26:24 | FromDiscord | <Elegantbeef> there is no reason to call all software `n`thesoftwaretype |
22:26:35 | FromDiscord | <Chronos [She/Her]> Iditor |
22:26:40 | FromDiscord | <Chronos [She/Her]> Lmao |
22:27:23 | FromDiscord | <Chronos [She/Her]> ChatGPT recommended Scriptor but pretty sure it's taken lol |
22:28:17 | FromDiscord | <Elegantbeef> Flatline, it's the last editor you'll ever need |
22:29:43 | FromDiscord | <Chronos [She/Her]> Honestly that'd be funny lmao |
22:30:03 | FromDiscord | <Chronos [She/Her]> Especially because I only want to make it purely as a learning experience |
22:35:58 | * | lucasta joined #nim |
22:36:07 | FromDiscord | <Chronos [She/Her]> > "Flatline, it's the last editor you'll ever need"↵- [ElegantBeef](https://matrix.to/#/!EtGqjSRNQoJCbpCJSF:matrix.org/$1691360892153476JFmXW:matrix.org?via=matrix.org&via=t2bot.io&via=gitter.im) |
22:37:02 | FromDiscord | <Chronos [She/Her]> That's going on the readme |
22:46:36 | FromDiscord | <Chronos [She/Her]> Trying to think of the best way to allow the user to edit large files without it crashing the program bc of RAM |
22:46:49 | FromDiscord | <Chronos [She/Her]> Streams seem really ideal for this, unless they have a catch |
22:49:35 | FromDiscord | <Elegantbeef> I don't know never really looked into it, feel like a rope system is a good idea, but streams/files are required |
22:51:06 | FromDiscord | <Chronos [She/Her]> I don't get what you mean by a rope system? |
22:51:21 | FromDiscord | <Elegantbeef> https://nim-lang.org/docs/ropes.html |
22:53:19 | FromDiscord | <Chronos [She/Her]> In reply to @Elegantbeef "https://nim-lang.org/docs/ropes.html": Ah |
22:55:30 | FromDiscord | <Chronos [She/Her]> I was actually thinking of just storing 3 things for every line while iterating over a stream, which was the position of the first character that can be read, the last character that can be read in the entire line, and the last character visible on screen |
22:55:59 | FromDiscord | <Chronos [She/Her]> Then only storing the characters that can be viewed on the screen at the present moment |
23:05:19 | FromDiscord | <konsumlamm> In reply to @srmordred "indexing. the structure": you could try using a `(string, DateTime, int, int)` tuple as key instead |
23:10:11 | skulk | anyone have any general tips for debugging arc/orc segfaults (that tend to occur when porting pre-ORC code)? |
23:10:15 | FromDiscord | <Elegantbeef> Profile before changing anything |
23:11:20 | FromDiscord | <Elegantbeef> valgrind plus `--debugger:native -d:useMalloc` |
23:11:33 | skulk | thanks, will try that |
23:11:40 | FromDiscord | <Elegantbeef> I'd argue that most refc code that errors under orc does so due to some incorrect usage |
23:12:06 | skulk | no doubt I'm doing some moderately shady stuff with refs, but it was working perfectly fine pre-orc |
23:12:34 | skulk | huh, crash doesn't reproduce with -d:useMalloc |
23:13:34 | FromDiscord | <Elegantbeef> Is it multithreaded code? |
23:14:04 | skulk | nope |
23:14:15 | FromDiscord | <srmordred> In reply to @konsumlamm "you could try using": i was thinking about that too |
23:15:29 | FromDiscord | <Elegantbeef> Well enable `-debugger:native` and use valgrind, think it'll help, don't recall |
23:15:35 | skulk | hmm, lots of "use of uninitialized value" from valgrind. I'll clean up as much of thta as I can and see what happens |
23:15:47 | FromDiscord | <sasha4599> Where can I get help with a nim error? (compiling error) |
23:16:20 | FromDiscord | <Elegantbeef> Here |
23:17:33 | FromDiscord | <sasha4599> sent a code paste, see https://play.nim-lang.org/#ix=4CFY |
23:17:43 | FromDiscord | <sasha4599> im really lost rn |
23:18:50 | FromDiscord | <Elegantbeef> isnt that an old mingw? |
23:19:16 | FromDiscord | <sasha4599> i dont think so |
23:19:31 | FromDiscord | <Elegantbeef> Atleast my mingw on linux is 12 |
23:19:39 | FromDiscord | <sasha4599> Im on windows 11 |
23:19:53 | FromDiscord | <sasha4599> i forgot to mentionit |
23:19:54 | FromDiscord | <sasha4599> (edit) "mentionit" => "mention it" |
23:20:01 | FromDiscord | <Elegantbeef> Sure but it's still versioned the same afaik |
23:22:05 | skulk | Elegantbeef: what does -d:useMalloc do exactly? or rather, what happens without it? It makes my problem go away completely even (and now there are no valgrind errors) |
23:22:19 | FromDiscord | <Elegantbeef> It uses C's malloc instead of Nim's allocator |
23:22:42 | FromDiscord | <Elegantbeef> What does valgrind say when you use nim's allocator? |
23:24:17 | skulk | ...nothing. but if I run the program without valgrind it crashes... double checking to see if I'm doing anything wrong |
23:24:55 | FromDiscord | <Elegantbeef> What's Nim's stack trace? |
23:25:44 | skulk | yeah, with nim's allocator and --debugger:native the program crashes if run directly it crashes with this stack trace: https://gist.github.com/sid-code/a927570e45393794a36b6b91d7f751fd |
23:26:28 | skulk | but works fine under valgrind |
23:26:45 | FromDiscord | <Elegantbeef> `/home/sid/misc/nmoo/src/nmoo/tasks.nim(392) :anonymous`? |
23:26:50 | FromDiscord | <Elegantbeef> What's that closure procedure? |
23:28:04 | skulk | it's my code, equivalent line is here (offset in my stack trace a bit by my local changes): https://github.com/sid-code/nmoo/blob/master/src/nmoo/tasks.nim#L391 |
23:28:20 | skulk | it's a proc defined by a template |
23:28:49 | skulk | in this case it's an implementation of an instruction for a bytecode VM |
23:31:45 | FromDiscord | <Chronos [She/Her]> In reply to @yu.vitaqua.fer.chronos "Then only storing the": Oh wait I see where I'd need ropes, for the actual editing and stuff |
23:31:46 | FromDiscord | <Elegantbeef> Hmmmmmm, seems odd that anything here would cause an issue |
23:32:12 | FromDiscord | <Chronos [She/Her]> But how would I handle large files when editing massive lines of code of obfuscated code, for example? |
23:32:19 | skulk | yeah, it was working fine in nim 1.6.14 but now that I've upgraded to 2.0.0 it's broken which leads me to believe there is a bug in the compiler |
23:32:40 | FromDiscord | <Elegantbeef> In Nim 1.6.14 with `--mm:orc` |
23:32:49 | FromDiscord | <Elegantbeef> ? |
23:32:57 | skulk | is that not the default? |
23:33:05 | FromDiscord | <Elegantbeef> It was not |
23:33:08 | FromDiscord | <Elegantbeef> It was refc in 1.6.14 |
23:33:17 | skulk | ah i see, yeah I was just using the default |
23:33:52 | skulk | should have paid more attention to the change log lol |
23:34:12 | FromDiscord | <Elegantbeef> What is the `129` call? |
23:34:37 | FromDiscord | <Elegantbeef> `/home/sid/misc/nmoo/src/nmoo/tasks.nim(129) builtinCall` to make that less obscure |
23:34:53 | skulk | https://github.com/sid-code/nmoo/blob/master/src/nmoo/tasks.nim#L128 |
23:35:11 | skulk | it looks up a proc from a table and calls it |
23:35:23 | FromDiscord | <Elegantbeef> What's the proc type? |
23:35:40 | skulk | https://github.com/sid-code/nmoo/blob/master/src/nmoo/types.nim#L176 |
23:37:35 | FromDiscord | <Elegantbeef> Hmmm quite odd that it errors there |
23:38:50 | skulk | I stepped throuhg it in gdb and while I couldn't figure out exactly where it's erroring, I'm pretty sure it's in a compiler-inserted call to a destructor or copy constructor |
23:39:04 | FromDiscord | <Elegantbeef> Well yea |
23:39:20 | FromDiscord | <Elegantbeef> `nimDecRefIsLast` is error related to `ref` |
23:40:02 | FromDiscord | <Elegantbeef> It seems you have a cycle created that is incorrectly traversed and crashes |
23:41:10 | FromDiscord | <Elegantbeef> Hard to reproduce this in a non complex way but if you could that'd be swell |
23:41:10 | skulk | I see. I have a decent idea where that might be happening, I'll try to break it |
23:41:37 | skulk | yeah, it's really hard to reproduce. I have like 30 unit tests that run before this that do similar things and work perfectly fine |
23:41:45 | FromDiscord | <Elegantbeef> Otherwise compile with `--mm:refc` and cry that it's hard to reproduce 😄 |
23:43:57 | skulk | might there be a ORC-internal proc I can call to try to suss out the cycle manually? |
23:44:13 | FromDiscord | <Elegantbeef> `GcRunOrc` |
23:45:25 | FromDiscord | <Elegantbeef> There is nothing else one can really do, you could always modify the compiler to print the pointer it's trying to free mixed with printing whenever the Nim allocator allocates |
23:46:31 | FromDiscord | <Elegantbeef> You can also compile with `-d:nimArcIds` |
23:47:05 | FromDiscord | <Elegantbeef> https://github.com/nim-lang/Nim/blob/devel/lib/system/orc.nim if you want to look at the ORC gc 😄 |
23:49:39 | FromDiscord | <Chronos [She/Her]> Wait I may be able to just avoid ropes and not have to read entire lines to memory |
23:50:56 | FromDiscord | <Elegantbeef> For a compiler atleast Araq sorta regrets using ropes |
23:51:01 | FromDiscord | <Chronos [She/Her]> I could use a seq with a custom type storing the string to be written at an index of the string, and simply `insert` it there, same with backspaces too, and then I'd just first start with the highest index |
23:51:04 | FromDiscord | <Elegantbeef> So probably ideal to avoid |
23:51:17 | FromDiscord | <Chronos [She/Her]> Fair |
23:51:36 | FromDiscord | <Elegantbeef> But I do think for a text editor not using strings might be better, but idk |
23:51:53 | FromDiscord | <Chronos [She/Her]> I know I'm probably overthinking this a lot but I'm hoping to make it so the text editor can edit massive files of obfuscated code for example |
23:52:03 | FromDiscord | <Chronos [She/Her]> Since storing that all in memory would be a bit painful |
23:52:27 | FromDiscord | <Elegantbeef> Why the hell would you modify obfuscated code |
23:53:55 | skulk | reverse-engineering, sometimes |
23:55:40 | FromDiscord | <Chronos [She/Her]> ^^^ |
23:56:13 | FromDiscord | <Chronos [She/Her]> For example: Vendetta is a client mod for Discord (can do mods for the RN client on Android and iOS) and for PC/web |
23:56:23 | FromDiscord | <Chronos [She/Her]> Obviously you have to deal with obfuscated code a lot of the time |
23:56:27 | FromDiscord | <Chronos [She/Her]> Which is obviously painful |
23:58:25 | FromDiscord | <Elegantbeef> Oh I know why you'd do it, but I mean why would you do it in TUI and not in like ghidra |
23:58:50 | FromDiscord | <Chronos [She/Her]> I program on my phone with nano a lot of the time, you're really asking me? :p ¯\_(ツ)_/¯ |
23:59:10 | FromDiscord | <Elegantbeef> Oh right I forgot your disabillity |
23:59:16 | skulk | does ghidra work for obfuscated JS? |
23:59:24 | FromDiscord | <Chronos [She/Her]> 😭 disability? |
23:59:39 | FromDiscord | <Chronos [She/Her]> We learnt programming on our phone bruv it's not that bad 😭 |