00:11:49 | FromDiscord | <Yardanico> https://github.com/nim-lang/Nim/issues/18863 fun stuff |
00:38:24 | * | vicfred joined #nim |
00:56:21 | * | vicfred quit (Quit: Leaving) |
01:02:55 | FromDiscord | <@bracketmaster-5a708063d73408ce4> I'm trying to do some basic graph traversal in nim, and `c` is clearly a child of `b`, but nim doesn't think so... |
01:02:57 | FromDiscord | <@bracketmaster-5a708063d73408ce4> oops |
01:03:00 | FromDiscord | <@bracketmaster-5a708063d73408ce4> https://play.nim-lang.org/#ix=3zil |
01:03:02 | FromDiscord | <@bracketmaster-5a708063d73408ce4> there |
01:03:07 | FromDiscord | <@bracketmaster-5a708063d73408ce4> sent a long message, see https://paste.rs/3dO |
01:03:38 | FromDiscord | <Elegantbeef> you're not using a ref object |
01:03:44 | FromDiscord | <Yardanico> `object` is a value |
01:04:14 | FromDiscord | <Yardanico> "object"s are passed by-value and not references |
01:04:45 | FromDiscord | <Yardanico> maybe https://forum.nim-lang.org/t/8426 can help you understand the differences a bit |
01:05:17 | FromDiscord | <@bracketmaster-5a708063d73408ce4> heh - I knew that |
01:05:29 | FromDiscord | <@bracketmaster-5a708063d73408ce4> thx |
01:08:33 | nrds | <Prestige99> @Elegantbeef I don't suppose you have a written guide on concepts, do you? The experimental features page isn't super clear to me |
01:08:48 | FromDiscord | <Elegantbeef> I can write one if need be \:D |
01:08:50 | * | arkurious quit (Quit: Leaving) |
01:09:16 | FromDiscord | <Elegantbeef> Basically old concepts are just a case of for each statement inside of it it needs to return true to pass |
01:09:39 | nrds | <Prestige99> I'm trying to use them like interfaces, saying my type will have a proc foo(f: float) |
01:10:14 | FromDiscord | <Elegantbeef> Ok so to reference my concept from last night |
01:10:25 | nrds | <Prestige99> or rather type T has proc foo(t: T, f: float) |
01:10:34 | FromDiscord | <Yardanico> you can't really use them like interfaces because interfaces can be used at runtime (e.g. you can create seq[MyInterface]) but you can't do that with concepts |
01:10:43 | FromDiscord | <Yardanico> but if you only need compile-time matching, then concepts will work |
01:10:54 | FromDiscord | <Elegantbeef> `concept f` is the same as a variable `var a: Frameable` |
01:10:59 | nrds | <Prestige99> Yeah I think compile time would be fine in my case |
01:11:05 | FromDiscord | <Elegantbeef> `type F` is the same as `typeof(a)` |
01:11:18 | FromDiscord | <Yardanico> btw, if you specifically need something similar to interfaces, you can use https://github.com/yglukhov/iface |
01:11:24 | FromDiscord | <Elegantbeef> i guess `var f: Frameable` is more accurate |
01:11:31 | FromDiscord | <Elegantbeef> Yardanico shush for a bit please |
01:11:48 | FromDiscord | <Yardanico> sure, but I'm trying to help too :P |
01:12:22 | FromDiscord | <Elegantbeef> Flooding with unneeded information presently, he's just trying to understand how the concept was used/expand in my example code from last night |
01:13:11 | nrds | <Prestige99> Is there any way to enforce a type to implement a concept at compile time? |
01:13:16 | FromDiscord | <Elegantbeef> so prestige it's now just a case of `foo(f, 1.0)` |
01:13:25 | FromDiscord | <Elegantbeef> I mean you write a procedure for it |
01:13:40 | FromDiscord | <Elegantbeef> You cannot enforce a concept match without it matching procedures you defined as "needed" |
01:14:02 | FromDiscord | <Elegantbeef> It doesnt make sense to force a match given you're laying out a case of "What i need for this to work" |
01:14:45 | FromDiscord | <Elegantbeef> The nice thing is prestige you can handle most math logic with just a generic |
01:15:04 | nrds | <Prestige99> Hmm okay |
01:15:22 | FromDiscord | <Elegantbeef> Well give you a modifcation that has a generic lerp |
01:16:46 | nrds | <Prestige99> iface looks neat too, think it reads better at least |
01:16:58 | FromDiscord | <Elegantbeef> It's also not for the same thing though |
01:16:59 | FromDiscord | <Yardanico> well new-style concepts are also like that |
01:17:18 | FromDiscord | <Elegantbeef> Yea new style concepts also exist which are just proc definitions |
01:17:46 | FromDiscord | <Elegantbeef> `proc foo(t: Self, f: float)` would be what you do in a new style concept |
01:17:56 | FromDiscord | <Elegantbeef> But they're also more limited... |
01:18:05 | FromDiscord | <QueenFuckingAdrielle> does anyone have a parquet reader for nim? |
01:18:33 | FromDiscord | <QueenFuckingAdrielle> I'm not really sure how to begin coding that... |
01:18:54 | FromDiscord | <Yardanico> there seems to be a C wrapper, not sure how well it works though |
01:18:55 | FromDiscord | <Yardanico> https://github.com/emef/nimarrow_glib |
01:19:36 | FromDiscord | <QueenFuckingAdrielle> gotcha, what sort of rabbit hole would it be to implement a reader/writer in pure nim? |
01:20:03 | FromDiscord | <Yardanico> it's hard to tell, but it's just like implementing any other protocol |
01:20:10 | FromDiscord | <QueenFuckingAdrielle> just for parquet, not the entirety of arrow |
01:20:31 | FromDiscord | <Yardanico> doesn't look to be too complex |
01:20:43 | FromDiscord | <Elegantbeef> Prestige here is an exampl(relies on vmath) for a generic lerp https://play.nim-lang.org/#ix=3zir |
01:21:04 | FromDiscord | <QueenFuckingAdrielle> its a decent format, ive been mainly using msgpack,json,csv |
01:21:15 | nrds | <Prestige99> Thanks beef :) |
01:21:15 | FromDiscord | <Elegantbeef> Aslong as you can do `+`, `-`, `` the lerp will be usable |
01:21:16 | FromDiscord | <QueenFuckingAdrielle> but parquet is becoming standard now |
01:21:20 | FromDiscord | <Yardanico> you can probably recreate it pretty well from https://github.com/apache/parquet-format/blob/master/src/main/thrift/parquet.thrift |
01:21:24 | FromDiscord | <Yardanico> seems to be pretty readable |
01:21:29 | FromDiscord | <Gustavo6046> is a floating-point math operator that is immediately used to store an integer variable replaced by an equivalent integer one? |
01:21:36 | FromDiscord | <Gustavo6046> for example, `/` is floating point div but `div` is integer |
01:22:12 | FromDiscord | <Yardanico> sorry, didn't quite understand the question :P |
01:22:26 | FromDiscord | <Gustavo6046> sent a code paste, see https://play.nim-lang.org/#ix=3zis |
01:22:27 | FromDiscord | <Elegantbeef> That seems like an optimization that doesnt make sense to do |
01:22:36 | FromDiscord | <Elegantbeef> No it shouldnt since `/` returns float |
01:22:44 | FromDiscord | <Yardanico> no, that won't work @Gustavo6046 |
01:22:50 | FromDiscord | <Gustavo6046> but it's only used to set an integer |
01:22:54 | FromDiscord | <Gustavo6046> oh |
01:23:03 | FromDiscord | <Gustavo6046> implicit cast can differ from the equivalent integer result? |
01:23:05 | FromDiscord | <Elegantbeef> but `/` returns float explictly |
01:23:07 | FromDiscord | <Elegantbeef> if you want integer division use `div` |
01:23:13 | FromDiscord | <Yardanico> In reply to @Gustavo6046 "implicit cast can differ": there are no implicit casts |
01:23:17 | FromDiscord | <QueenFuckingAdrielle> yea thats not the most confusing protocol. Do you think my performance would crap out if i subprocessed supported lang script and piped the data over to nim> |
01:23:22 | FromDiscord | <Gustavo6046> then what is mynumber set to? |
01:23:23 | FromDiscord | <QueenFuckingAdrielle> (edit) "nim>" => "nim?" |
01:23:25 | FromDiscord | <Elegantbeef> There is no provided implict type conversion in nim |
01:23:32 | FromDiscord | <Gustavo6046> oh |
01:23:33 | FromDiscord | <Yardanico> In reply to @Gustavo6046 "then what is mynumber": that code won't |
01:23:33 | FromDiscord | <Gustavo6046> compiler error |
01:23:33 | FromDiscord | <Elegantbeef> nothing it errors |
01:23:37 | FromDiscord | <Yardanico> exactly |
01:23:42 | FromDiscord | <Gustavo6046> I figured |
01:23:44 | FromDiscord | <Gustavo6046> if it doesn't cast |
01:23:46 | FromDiscord | <Gustavo6046> then that is error |
01:23:49 | FromDiscord | <Yardanico> in this case you're using `/` proc that takes two integers and returns a float |
01:23:49 | FromDiscord | <Gustavo6046> ooooh |
01:23:50 | FromDiscord | <Gustavo6046> that explains a lot |
01:23:54 | FromDiscord | <Elegantbeef> `std/leniantops ` |
01:24:00 | FromDiscord | <Yardanico> std/lenientops |
01:24:01 | FromDiscord | <Gustavo6046> \:) thanks! |
01:24:22 | FromDiscord | <Elegantbeef> Yardanico taking over for rika on being my spell check |
01:24:33 | FromDiscord | <Elegantbeef> Hopefully you werent to offended by me telling you to shush \:D |
01:24:33 | FromDiscord | <Yardanico> In reply to @QueenFuckingAdrielle "yea thats not the": if there's a python module you can use https://github.com/yglukhov/nimpy which might be faster than doing subprocessing |
01:24:49 | FromDiscord | <Yardanico> nah, it's fine :) |
01:25:22 | FromDiscord | <QueenFuckingAdrielle> ah okay, thats a good point, I haven't touched nimpy yet. I'll look at that. thnx! |
01:26:42 | * | neurocyte013 joined #nim |
01:26:42 | * | neurocyte013 quit (Changing host) |
01:26:42 | * | neurocyte013 joined #nim |
01:29:05 | * | neurocyte01 quit (Ping timeout: 268 seconds) |
01:29:05 | * | neurocyte013 is now known as neurocyte01 |
01:29:12 | FromDiscord | <Elegantbeef> Hopefully that's an ok api prestige i imagine you'd want to manually handle enums and any other values such as strings or objects |
01:29:51 | FromDiscord | <Elegantbeef> Cause for enums you'd probably only want to change to the b value in the lerp when the time is \>= 1 |
01:48:52 | FromDiscord | <QueenFuckingAdrielle> how is the health of the nim community going? been a bit outta touch |
01:49:15 | FromDiscord | <Yardanico> "health" as in what? |
01:49:35 | FromDiscord | <Yardanico> there haven't been any major events in the nim community lately, everything's going as usual |
01:50:10 | FromDiscord | <Elegantbeef> So there are 10 people surrounding a barrel fire |
01:54:15 | FromDiscord | <QueenFuckingAdrielle> gotcha, nim is still my favorite language lol just wondernig |
01:54:54 | FromDiscord | <QueenFuckingAdrielle> I'm frustrated with the direction of a lot of languages |
02:18:16 | FromDiscord | <Anuke> Is it possible to have a template/macro that accepts optional parameters, but with a mandatory untyped block at the end? https://play.nim-lang.org/#ix=3ziG |
02:20:47 | FromDiscord | <@bracketmaster-5a708063d73408ce4> ok - why on earth is append sting in nim `&` and not `+` |
02:21:46 | FromDiscord | <leorize> because `+` is for math \:p |
02:22:52 | FromDiscord | <amadan> In reply to @Anuke "Is it possible to": it works in devel for meβ΅This PR added the feature https://github.com/nim-lang/Nim/pull/18631 |
02:23:32 | FromDiscord | <Anuke> nice, I recalled seeing that PR earlier but couldn't find it |
02:25:50 | FromDiscord | <Anuke> I'd rather not switch to devel if at all possible (not easy to use on CI), is there some sort of workaround available? |
02:27:42 | FromDiscord | <Elegantbeef> Simples it s https://play.nim-lang.org/#ix=3ziM |
02:31:03 | FromDiscord | <Elegantbeef> The silence means "anuke didnt like that" π |
02:32:54 | FromDiscord | <pietroppeter> In reply to @@bracketmaster-5a708063d73408ce4 "ok - why on": One good reason is that + usually denotes a commutative operation and append is not commutative: βaβ & βbβ != βbβ & βaβ |
02:35:07 | FromDiscord | <Elegantbeef> One could also argue it shows allocations π |
03:21:49 | FromDiscord | <jakefromstatefarm> Nim is so cool, the fact that it compiles to basically every system is really useful and super neat. |
03:35:58 | FromDiscord | <Rika> + can mean non-commutative addition depending on mathematical context |
03:36:04 | FromDiscord | <Rika> Still itβs used for math |
03:58:56 | FromDiscord | <amadan> In reply to @Anuke "I'd rather not switch": Workaround I've used before is to take in `varargs[untyped` as the only parameter then parse the other parameters from that |
03:59:05 | FromDiscord | <amadan> (edit) "`varargs[untyped`" => "`varargs[untyped]`" |
03:59:44 | FromDiscord | <amadan> not the cleanest of methods (and someone probably knows a better way) but gets the job done |
04:06:01 | * | supakeen quit (Quit: WeeChat 3.2.1) |
04:06:31 | * | supakeen joined #nim |
04:36:33 | FromDiscord | <pietroppeter> sent a long message, see http://ix.io/3zja |
04:51:35 | nisstyre | For some reason trying to access a slice of a sequence like xs[1..^1] causes my programs to crash with a call depth limit reached error... |
04:51:40 | nisstyre | even though I'm not doing any recursion |
04:52:37 | FromDiscord | <Elegantbeef> Code example? |
04:53:01 | nisstyre | I think it might be because it's a custom type |
04:53:07 | nisstyre | and I defined the $ function |
04:53:13 | nisstyre | but not sure |
04:53:34 | nisstyre | I don't have a minimal example that's runnable |
04:54:04 | FromDiscord | <Elegantbeef> are you echoing a slice of a cyclical reference type? |
04:54:52 | nisstyre | let me try and make it run outside of this |
04:54:54 | nisstyre | it is a ref object |
04:55:01 | nisstyre | but it happens even without echo |
04:55:20 | FromDiscord | <Elegantbeef> It being a ref doesnt matter as much as being cyclical |
04:56:26 | nisstyre | this crashes https://play.nim-lang.org/#ix=3zjc |
04:56:53 | nisstyre | oh is it the "discard" |
04:56:55 | nisstyre | my bad |
04:57:12 | nisstyre | I bet that's it |
04:57:22 | FromDiscord | <Elegantbeef> What discard? |
04:57:27 | FromDiscord | <Elegantbeef> The ones in the typedef? |
04:57:28 | nisstyre | in the type |
04:57:30 | nisstyre | yeah |
04:57:36 | nisstyre | could that be causing it? |
04:57:42 | FromDiscord | <Elegantbeef> No |
04:57:50 | nisstyre | any ideas? |
04:57:52 | FromDiscord | <Elegantbeef> It's recursively calling `$` |
04:58:02 | nisstyre | ok so what I thought then |
04:58:13 | FromDiscord | <Elegantbeef> You're recursively calling `$fracProgram` |
04:58:20 | nisstyre | that makes sense |
04:58:22 | nisstyre | ah |
04:58:28 | FromDiscord | <Elegantbeef> Remove that proc it works |
04:58:30 | nisstyre | yep |
04:58:37 | FromDiscord | <Elegantbeef> sequences have a `$` operator built in π |
04:58:56 | nisstyre | yeah I don't know why I defined that originally |
04:59:09 | FromDiscord | <Elegantbeef> you can also call the specific system one by doing `system.`$`(yourSeq)` |
04:59:32 | FromDiscord | <Elegantbeef> But yea no point redeclaring it since it's a type alias and not a distinct |
05:06:03 | * | pch quit (Read error: Connection reset by peer) |
05:06:21 | * | pch joined #nim |
05:15:18 | * | max22- joined #nim |
06:24:17 | FromDiscord | <cabboose> Hey y'all check out our package |
06:24:23 | FromDiscord | <cabboose> https://github.com/shayanhabibi/loony |
06:24:47 | FromDiscord | <cabboose> Good luck with it; don't burn your CPUs |
06:30:35 | FromDiscord | <Rika> Does CPS async work under ARC? |
06:31:36 | FromDiscord | <cabboose> CPS is lower level than async/await; but this queue does work under ARC |
06:31:42 | FromDiscord | <cabboose> Works with any ref object |
06:32:23 | FromDiscord | <cabboose> Really this queue means theres no limitations with sync/async operations on multi threaded code |
06:32:46 | FromDiscord | <cabboose> Disruptek ran 500 million continuations over 24,000 queues successfully |
06:32:59 | FromDiscord | <Rika> I know it is |
06:33:40 | FromDiscord | <Rika> I ask because such package does not work under ORC and regular async has cyclic objects |
06:33:57 | FromDiscord | <Rika> Which is why I ask if async using CPS works without ORC |
06:34:17 | FromDiscord | <cabboose> oh nah cps and async gel well together |
06:34:18 | FromDiscord | <cabboose> under orc/arc |
06:34:29 | FromDiscord | <cabboose> but that queue does not work with any ref object under ORC for some reason |
06:34:56 | FromDiscord | <cabboose> for whatever reason the last `=destroy` we would call on an object would just cause a crash |
06:35:06 | FromDiscord | <cabboose> whether it was a string or continuation |
06:35:22 | FromDiscord | <cabboose> ORC is strange π€·π½ββοΈ |
06:36:04 | FromDiscord | <Rika> I know they gel well together but does async still generate cyclic objects using CPS |
06:36:58 | FromDiscord | <cabboose> if it does in the std lib it will with cps |
06:39:34 | NimEventer | New question by SlightlyKosumi: How to instantiate an app with ProcessStartInfo in this winim library, see https://stackoverflow.com/questions/69240927/how-to-instantiate-an-app-with-processstartinfo-in-this-winim-library |
07:55:34 | FromDiscord | <dain> at 41:43 in this video: https://youtu.be/QM1iUe6IofM?t=2503β΅he proposes a language construct that works like a new scope, but you have to explicitly pass in all of the names you want to be visible. inside the block it doesn't see anything else from the enclosing scope. is it possible to implement this in nim as a macro? |
07:59:33 | FromDiscord | <dain> i was thinking something that would walk the AST and replace every name with a gen-symmed version of it except for the ones that get passed in. but maybe there's a cleaner way? also is there a way to distinguish between names that are available at top level vs inner levels? it would suck to have to pass in all of the imported functions you wanted to use as well |
07:59:49 | FromDiscord | <dain> (edit) "it" => "itself" |
07:59:50 | FromDiscord | <Elegantbeef> That's way to fucking mess |
08:02:21 | FromDiscord | <Elegantbeef> https://play.nim-lang.org/#ix=3zjL |
08:02:22 | FromDiscord | <Elegantbeef> Here we go did it |
08:03:29 | FromDiscord | <Elegantbeef> If you want to ensure you dont use other symbols you can iterate over the entire scope checking if the symbol comes from a var stmt and not equal to the passed symbols |
08:03:37 | FromDiscord | <Elegantbeef> Can show that aswell |
08:06:08 | FromDiscord | <dain> yeah thats the idea |
08:07:40 | FromDiscord | <dain> how do you inspect the current scope? |
08:08:02 | FromDiscord | <Elegantbeef> I mean you dont need to you iterate the body |
08:08:13 | FromDiscord | <dain> oh |
08:08:40 | FromDiscord | <Elegantbeef> Commas i should use |
08:08:57 | FromDiscord | <dain> is it possible to check whether a symbol comes from the module level scope? |
08:08:57 | FromDiscord | <Elegantbeef> You dont need to inspect the current scope, you just iterate the body looking for any symbol that is a var that wasnt passed in |
08:09:10 | FromDiscord | <Elegantbeef> ehhhh maybe? |
08:09:20 | FromDiscord | <Elegantbeef> Probably not |
08:19:43 | FromDiscord | <Elegantbeef> It's atleast a start https://play.nim-lang.org/#ix=3zjM |
08:24:05 | FromDiscord | <Elegantbeef> Ooh can actually solve that case of "does this sym come from inside here" π |
08:33:01 | FromDiscord | <Elegantbeef> Getting even fancier https://play.nim-lang.org/#ix=3zjR |
08:34:41 | FromDiscord | <Elegantbeef> @dain\: i now leave it to you to continue my legacy! π |
08:37:36 | FromDiscord | <saem> For the most part you can use the owner and walk up the AST in a loop until you hit an sk module, just check for nil and repeats. The latter meaning generic instantiation |
08:38:01 | FromDiscord | <dain> In reply to @Elegantbeef "<@225449938258100225>\: i now leave": thanks :) |
08:38:33 | FromDiscord | <Elegantbeef> You can get the owner in a macro? |
08:38:48 | FromDiscord | <Elegantbeef> Never knew that |
08:41:28 | FromDiscord | <impbox [ftsf]> what does ownership mean in nim? |
08:41:54 | FromDiscord | <Elegantbeef> In macros? |
08:42:29 | FromDiscord | <Elegantbeef> Assuming yes, it tells you what scope owns the symbol i believe be it a procedure, a block stmt, or a module |
08:42:51 | FromDiscord | <dain> that's cool |
08:43:10 | FromDiscord | <dain> so the macro can look "outside" of itself into where it is being used? |
08:43:39 | FromDiscord | <Elegantbeef> Well typed parameters are semantically checked so you have a ton of information |
08:43:44 | FromDiscord | <impbox [ftsf]> big if true! nice |
08:44:08 | FromDiscord | <Elegantbeef> So if you have a symbol you can check what it's type is as a nimnode and look that up as well |
08:44:33 | FromDiscord | <Elegantbeef> So you can go from a variable to at type declaration doing what you will, tons of introspective capabillities |
08:44:45 | FromDiscord | <Elegantbeef> As much as saem doesnt like macros they do their job well π |
08:46:04 | FromDiscord | <Elegantbeef> The macro cache is also pretty powerful for cross module stuffs, or even cross macro invocation stuff |
08:46:14 | FromDiscord | <saem> They're bad, mmmmkay. |
08:46:48 | FromDiscord | <Elegantbeef> An example of that cross macro invocation stuff https://play.nim-lang.org/#ix=3zdG |
08:47:03 | FromDiscord | <Elegantbeef> Scroll to bottom to see the actual use case |
08:47:33 | FromDiscord | <Elegantbeef> Basically you can set key frames for a specific field then when you call animate with a float it will handle the "animations" |
09:26:49 | FromDiscord | <surajvb> is there a sample snippet to learn about iterating through something equivalent of zipped iterables? |
10:03:06 | * | PersonMcGuy joined #nim |
10:04:19 | PersonMcGuy | Hello, does anyone know the internal structure of a seq? I found a resource showing it once, but I can't seem to find it again. Is it a pointer and a few int fields? |
10:05:44 | PersonMcGuy | Oh, nevermind. I think I just found what I was searching for. |
10:05:47 | * | PersonMcGuy quit (Client Quit) |
10:19:29 | * | Vladar joined #nim |
10:29:44 | arfy | hi. I just want to check my understanding is correct about the way modules with import and include work. If I have, file A, and I import this into File B, which is, in turn, imported into file C, the public symbols only show up in the scope of file B directly? or do the public symbols go global. |
10:30:14 | arfy | if i used include on the other hand, it would be as if i just copy 'n asted the files together. |
10:38:25 | FromDiscord | <cabboose> Essentiallyβ΅(<@709044657232936960_arfy=5b=49=52=43=5d>) |
10:38:52 | FromDiscord | <cabboose> not unless File B exports the symbols of File C by doing `export c`β΅(<@709044657232936960_arfy=5b=49=52=43=5d>) |
10:39:35 | FromDiscord | <cabboose> often nimble packages top level files are just a list of imports and then exports |
10:40:00 | arfy | nice. |
10:49:00 | * | max22- quit (Ping timeout: 260 seconds) |
10:51:41 | * | max22- joined #nim |
11:18:57 | FromDiscord | <dom96> cabboose: can CPS beat Httpbeast yet? π |
11:20:10 | FromDiscord | <cabboose> Hahaha looking into combining the queue with continuations and io but I don't have a choice since I have windows ;\_; |
11:22:01 | FromDiscord | <cabboose> I don't think we have anything to compare the queue to in nim though; i don't think it can be as fast as MPSCs but will be an interesting comparison |
11:22:24 | FromDiscord | <dom96> hm, not sure what queues have to do with this |
11:22:53 | FromDiscord | <cabboose> Just in general |
11:23:01 | FromDiscord | <cabboose> I am excited that it's working is all |
11:23:50 | FromDiscord | <cabboose> But as for httpbeast that is yet to be taken to arms! ;) |
11:24:05 | FromDiscord | <cabboose> I assume you had seen the loony queue though |
11:24:16 | FromDiscord | <dom96> what's the blocker? |
11:26:09 | FromDiscord | <cabboose> In reference to challenging you and httpbeast? Because I know nothing about networking and no one else seems to care about making it good for windows but me \:') |
11:26:20 | * | max22- quit (Ping timeout: 260 seconds) |
11:26:37 | FromDiscord | <dom96> in terms of making a performant http server |
11:27:08 | FromDiscord | <dom96> I don't think of it as a challenge to me, rather a challenge to other http servers out there. I want to see Nim at the top |
11:29:16 | FromDiscord | <cabboose> Well |
11:29:18 | FromDiscord | <cabboose> the short answer is |
11:29:22 | FromDiscord | <cabboose> I'm learning as I'm going |
11:29:26 | FromDiscord | <cabboose> and I'm a knob at networking things |
11:29:56 | FromDiscord | <cabboose> AFAIK multithreading and async IO is quite a PITA everywhere |
11:31:49 | FromDiscord | <cabboose> Don't ask me too many smart things; I drank a lot last night and my eyes still bleed looking at words on the screen |
11:46:11 | FromDiscord | <Gumber> bleh |
11:46:19 | FromDiscord | <Gumber> last sentence made me glad I barely touch the stuff anymore |
11:46:32 | FromDiscord | <Gumber> and grateful to wake up not hung over π |
11:47:14 | FromDiscord | <Gumber> sorry - not trying to rub it in lol |
11:47:15 | FromDiscord | <cabboose> It was a 30th and 10 year high school reunion afterwards; I am in pain |
11:47:21 | FromDiscord | <Gumber> ooph |
11:47:43 | FromDiscord | <Gumber> I skipped my ten year but I guess my 20th is coming up in 2? |
11:47:56 | FromDiscord | <Gumber> probs will skip that too - fuck HS lol |
11:48:15 | FromDiscord | <Gumber> In reply to @cabboose "AFAIK multithreading and async": also this is true |
11:48:38 | FromDiscord | <Gumber> well maybe not universally - like async IO is quite not the PITA if you're using green threads with a good scheduler |
11:48:52 | FromDiscord | <Gumber> like it's not a bad situation with Erlang or Golang or Pony, etc... |
11:49:11 | FromDiscord | <Gumber> sharing memory between them becomes triivial |
11:49:15 | FromDiscord | <Gumber> because it doesn't happen |
11:49:43 | FromDiscord | <Gumber> but in the world of concurrency and Nim where you rely on traditional concurrency primitives |
11:49:50 | FromDiscord | <Gumber> the situation is the same as in C or C++ or wherever and it used to be worse |
11:50:16 | FromDiscord | <cabboose> Yeah; they have their own overheads though, golang for instance has a bunch of IO threads waiting to do work |
11:50:19 | FromDiscord | <Gumber> when you had no option BUT to have a separate runtime with its own GC in every shared library you built with nim |
11:50:25 | FromDiscord | <Gumber> oh I'm not saying it's not without cost |
11:50:32 | FromDiscord | <Gumber> or complexity |
11:50:35 | FromDiscord | <cabboose> mmm |
11:50:59 | FromDiscord | <Gumber> but like - typically in those languages you just throw work at a scheduler and don't have to worry about much |
11:51:09 | FromDiscord | <Gumber> I think CPS is making things much better for Nim |
11:51:22 | FromDiscord | <Gumber> but like they're probably worthless for me for a while |
11:51:25 | FromDiscord | <Gumber> because I use the cpp backend |
11:51:34 | FromDiscord | <Gumber> last I checked work hadn't started on that yet |
11:51:40 | FromDiscord | <Gumber> or at least not in earnest |
11:52:09 | FromDiscord | <cabboose> try the MPMC queue; works with any ref object and i'd love to hear how it works on other backends |
11:52:13 | FromDiscord | <Gumber> tis okay though - I'm pretty good at multithreaded programming and fibers |
11:52:19 | FromDiscord | <Gumber> I'll check it out |
11:52:46 | FromDiscord | <Gumber> anyway, back to working on this vulkan renderer |
11:53:14 | FromDiscord | <Gumber> got my render graph library all set up, just need to keep writing this C interface and writing glue code and in maybe another day or two I'll have something drawing to the screen xD |
11:53:44 | FromDiscord | <cabboose> pain |
11:53:48 | FromDiscord | <cabboose> draw pain |
11:53:49 | FromDiscord | <Gumber> oh yeah and I went to bed with this error I couldn't figure out damnit... hopefully it was just because I was falling asleep at the keyboard |
11:53:59 | FromDiscord | <Gumber> yeah - but I've done a lot of 3d work so it's just Vulkan |
11:54:03 | FromDiscord | <Gumber> and all the boilerplate |
11:54:11 | FromDiscord | <Gumber> even with vk-bootstrap it's a pain |
11:54:34 | FromDiscord | <Gumber> but to make matters worse on myself I picked a rendergraph library written in C++ that uses C++20 |
11:54:40 | FromDiscord | <Gumber> so I get to wrap it with my own C interface |
11:54:48 | FromDiscord | <Gumber> since Nim can't handle C++20/latest |
11:55:03 | FromDiscord | <cabboose> shit |
11:55:07 | FromDiscord | <cabboose> why even |
11:55:13 | FromDiscord | <Gumber> it's better than writing it myself |
11:55:24 | FromDiscord | <Gumber> it has like eight dependencies, depends on shit like spir-v cross etc |
11:55:32 | FromDiscord | <Gumber> would probably take a couple of months to port |
11:55:47 | FromDiscord | <Gumber> just not worth the time and I'd probably end up having to do the same thing elsewhere eventually |
11:56:11 | FromDiscord | <Gumber> and if you want to write a performant vulkan renderer |
11:56:19 | FromDiscord | <Gumber> you either need to know wtf you're doing (which I don't) |
11:56:34 | FromDiscord | <Gumber> or you need to rely on someone smarter than you who does, and use their shit |
11:56:47 | FromDiscord | <Gumber> or you can pretend you know what you're doing like the author of Godot |
11:56:54 | FromDiscord | <Gumber> (okay I swear, I swear, I'm done xD) |
11:57:23 | FromDiscord | <Gumber> but uh yeah, I picked option B and I'm sticking with it - I can write the renderer I just don't know how to architect / design one to be relatively bottleneck-free |
11:57:50 | FromDiscord | <Gumber> and I don't to spend three years learning how - so I'm just going to use this guy's rendergraph - it seems pretty baller even if he did pick C++20/latest to write it in |
11:57:58 | FromDiscord | <Gumber> they sorry |
11:58:18 | FromDiscord | <Gumber> they didn't pick it for ridiculous reasons either - seems like they wanted to use features of C++20 that are actually useful, like spans |
11:58:30 | FromDiscord | <Gumber> https://github.com/martty/vuk |
12:01:51 | FromDiscord | <haxscramper> Technically nim can handle all of the C++, it is only a matter of how ugly you are willing to go |
12:02:13 | FromDiscord | <haxscramper> But if we speak native support we don't even cover C++11 with variadic templates |
12:02:17 | FromDiscord | <haxscramper> And OOP etc. |
12:03:04 | FromDiscord | <Gumber> well yeah |
12:03:17 | FromDiscord | <Gumber> I could patch the stdlib I guess |
12:03:41 | FromDiscord | <Gumber> but it seemed like less work to just write a C interface |
12:06:02 | * | supakeen quit (Quit: WeeChat 3.2.1) |
12:06:31 | * | supakeen joined #nim |
12:11:25 | FromDiscord | <dom96> HS reunions, such a US thing |
12:11:58 | FromDiscord | <cabboose> Am aus doe |
12:12:40 | FromDiscord | <Rika> me in asia with grade school reunions: |
12:31:19 | FromDiscord | <Gumber> I don't have much, or really any interest in going to them |
12:31:42 | FromDiscord | <Gumber> two of my best friends I went to HS with but they're literally the only people from my HS I talk to |
12:32:39 | FromDiscord | <Gumber> might be fun to go back and jone on people but other than that... |
12:33:02 | FromDiscord | <Gumber> Australian HS reunions sound fun to me |
12:33:25 | FromDiscord | <Gumber> but that's just because everything about Australia sounds fun - except all of the wildlife that can kill you |
12:33:47 | FromDiscord | <cabboose> That's the best part thoughβ΅(@Gumber aka Zachary Carter) |
12:33:51 | FromDiscord | <Rika> australia right now is kinda hectic wrt covid though |
12:33:56 | FromDiscord | <cabboose> That's why reunions are so magical |
12:33:57 | FromDiscord | <impbox [ftsf]> i think my HS class had a reunion, but i didn't go, happy to never see those people again |
12:34:01 | FromDiscord | <Gumber> thank goodness I just had it then! |
12:34:44 | FromDiscord | <impbox [ftsf]> @Rika it's the worst it's been here, but it still seems like it's better than a lot of other places in the world wrt covid |
12:35:00 | FromDiscord | <Rika> cabboose can you sell me on cps im still trying to understand |
12:35:05 | FromDiscord | <Gumber> it's bad here - I think maybe it's getting better than it was in August but ??? |
12:35:12 | FromDiscord | <Gumber> Rika learn what a continuation is first |
12:35:14 | FromDiscord | <Rika> In reply to @impbox "<@!259277943275126785> it's the worst": oh totally eyes the US |
12:35:20 | FromDiscord | <Gumber> go read about them |
12:35:22 | FromDiscord | <Gumber> in other languages |
12:35:26 | FromDiscord | <Gumber> and then you'll start to get it |
12:35:30 | FromDiscord | <Rika> i know what continuations are |
12:35:32 | FromDiscord | <Gumber> okay |
12:35:38 | FromDiscord | <impbox [ftsf]> I think I get CPS now... It basically takes a normal function and turns it into lots of little functions that chain themselves or something |
12:35:40 | FromDiscord | <Gumber> so CPS is just a compile time transformation |
12:35:43 | FromDiscord | <Rika> ive read the paper so many times |
12:35:46 | FromDiscord | <Rika> yes i know |
12:35:56 | FromDiscord | <Rika> i mean understand[ the benefits] |
12:35:56 | FromDiscord | <Rika> sorry |
12:36:02 | FromDiscord | <Gumber> you want to understand the implementation |
12:36:03 | FromDiscord | <Gumber> I got you |
12:36:08 | FromDiscord | <Rika> god damn it |
12:36:09 | FromDiscord | <Gumber> yeah I dunno that shits over my head |
12:36:14 | FromDiscord | <impbox [ftsf]> magic |
12:36:18 | FromDiscord | <Gumber> exactly |
12:36:23 | FromDiscord | <Gumber> for the birds |
12:36:31 | FromDiscord | <Gumber> I'm just gonna make my programs go brrrrrrrrrr with it |
12:36:39 | FromDiscord | <Gumber> when it works with the cpp backend anyway |
12:37:22 | FromDiscord | <Gumber> I took the fibers from my job system and figured out how to replace them with continuatoins |
12:37:27 | FromDiscord | <Gumber> (edit) "continuatoins" => "continuations" |
12:37:40 | FromDiscord | <Gumber> right before I went on my trip back in June to get married |
12:38:22 | FromDiscord | <Gumber> but I'll have to revisit it later - I don't even know if I'm going to end up using that job system in my game - I'll implement some kind of job system just not sure what yet |
12:38:36 | FromDiscord | <cabboose> Sure I can sell you on it |
12:38:38 | FromDiscord | <Gumber> maybe weave will finally be ready for games and be stable by the time I need one |
12:38:40 | FromDiscord | <cabboose> what do you want to do |
12:38:47 | FromDiscord | <Rika> just regular async |
12:38:51 | FromDiscord | <Gumber> no |
12:38:58 | FromDiscord | <Rika> i dont want to really write my own dispatcher... |
12:39:08 | FromDiscord | <Rika> i just want to see if it's easy perf gain |
12:39:13 | FromDiscord | <cabboose> fair enough |
12:39:19 | FromDiscord | <Rika> if not then ill stay |
12:39:26 | FromDiscord | <Rika> on regular async i mnea |
12:39:27 | FromDiscord | <Rika> mean |
12:39:31 | FromDiscord | <Gumber> oh Rika wants async |
12:39:32 | FromDiscord | <Gumber> gotcha |
12:39:41 | FromDiscord | <cabboose> oh yeah I reckon it definitely is. Do you want multithreaded or single threaded |
12:39:54 | FromDiscord | <Rika> i dont know how to mesh threading with async yet |
12:40:04 | FromDiscord | <Rika> i would like to know how some day (maybe now) |
12:40:19 | * | arkurious joined #nim |
12:40:20 | FromDiscord | <Rika> wait im fucking shivering for some reason one moment |
12:40:38 | FromDiscord | <Gumber> you have a scheduler running on each thread |
12:40:53 | FromDiscord | <Gumber> and the scheduler schedulers work on each cpu |
12:40:55 | FromDiscord | <dom96> The only benefit I see is perf improvement and ability to decide where to alloc these continuations |
12:41:02 | FromDiscord | <Gumber> or you have a scheduler that schedulers work across them |
12:41:06 | FromDiscord | <Gumber> but each one has an event loop |
12:41:07 | FromDiscord | <dom96> still waiting to see that perf improvement π |
12:41:15 | FromDiscord | <cabboose> me and zevv are looking at a threadpool implementation |
12:41:20 | FromDiscord | <Gumber> nice |
12:41:22 | FromDiscord | <cabboose> for async multithreading |
12:41:28 | FromDiscord | <Gumber> maybe talk to @mratsim |
12:41:34 | FromDiscord | <Gumber> oh shit he had dnd on, my bad |
12:41:41 | FromDiscord | <Rika> dnd doesnt dispatch notifs |
12:41:42 | FromDiscord | <dom96> In reply to @Rika "i dont know how": You can simply run an async loop in each thread (what httpbeast does) |
12:42:04 | FromDiscord | <Rika> i get that |
12:42:15 | FromDiscord | <Rika> okay |
12:42:18 | FromDiscord | <Gumber> yeah I guess closure iterators vs continuations is the thing right |
12:42:22 | FromDiscord | <Gumber> are they really faster |
12:42:35 | FromDiscord | <Gumber> and I guess the proof will be in the pudding |
12:42:41 | FromDiscord | <Gumber> once someone writes something and does some benchmarking |
12:42:44 | FromDiscord | <Anuke> In reply to @Elegantbeef "Simples it s https://play.nim-lang.org/#ix=3ziM": The amount of optional parameters looks more like this, so adding overloads for every parameter isn't a great option https://media.discordapp.net/attachments/371759389889003532/889129379098132500/unknown.png |
12:43:22 | FromDiscord | <Rika> when i encounter procs with many parameters like that i convert some of them to an object |
12:43:40 | FromDiscord | <Rika> like a "SmthOptions" object |
12:43:47 | FromDiscord | <Gumber> tuples |
12:43:48 | FromDiscord | <Rika> most of the time theyre shared anyway |
12:43:53 | FromDiscord | <Gumber> tuples are great for this |
12:44:24 | FromDiscord | <Gumber> no overhead of object |
12:44:25 | FromDiscord | <Gumber> but anyway |
12:45:10 | FromDiscord | <cabboose> @Rika\: give me a day or two to see if we can iron out a implementation for async continuations that doesn't necessarily use the std dispatcher and i'll get back to you |
12:45:32 | FromDiscord | <cabboose> otherwise with continuations you would still have to run the dispatcher |
12:45:34 | FromDiscord | <Rika> hey wait i didnt mean spend time on smth like that |
12:45:37 | FromDiscord | <cabboose> I usually hide it inbetween me doing different continuations |
12:45:44 | FromDiscord | <cabboose> I'm already doing it though |
12:45:55 | FromDiscord | <Rika> oh if its something you had to do even without me asking then ok |
12:46:01 | FromDiscord | <cabboose> yep |
12:47:59 | FromDiscord | <Gumber> but wait |
12:48:06 | FromDiscord | <Gumber> are continuations going to start being used in the stdlib? |
12:48:19 | FromDiscord | <Gumber> like is that the plan? |
12:48:48 | FromDiscord | <Rika> afaik |
12:48:49 | FromDiscord | <Rika> yes |
12:48:57 | FromDiscord | <dom96> there is no plan |
12:48:58 | FromDiscord | <Gumber> okay so someone convinced Araq |
12:48:59 | FromDiscord | <cabboose> π€·ββοΈ |
12:49:03 | FromDiscord | <Gumber> oh okay |
12:49:07 | FromDiscord | <cabboose> Nope |
12:49:12 | FromDiscord | <Gumber> there is no plan? that sounds ominous |
12:49:20 | FromDiscord | <Gumber> I hope there's a plan... |
12:49:28 | FromDiscord | <Gumber> a plan for something... |
12:49:31 | FromDiscord | <haxscramper> https://github.com/nim-lang/RFCs/issues/295 |
12:49:36 | * | max22- joined #nim |
12:49:37 | FromDiscord | <haxscramper> if you are willinng to dig througgh this |
12:49:41 | FromDiscord | <Gumber> thanks |
12:50:20 | FromDiscord | <dom96> The only plan as far as I know is: help CPS be implemented and see where it goes |
12:50:45 | FromDiscord | <haxscramper> from what I see large problems for CPS is untyped AST being unspecified |
12:50:58 | FromDiscord | <haxscramper> Since there is no spec, and compiler does all sort of weird things |
12:51:03 | FromDiscord | <dom96> but I know that Araq was trying to push for CPS to be implemented in the compiler as well |
12:51:18 | FromDiscord | <haxscramper> I'd rather have speced typed AST |
12:51:34 | FromDiscord | <haxscramper> This will benefit everyone |
12:51:55 | FromDiscord | <cabboose> Mmmm, I reckon if more people used or wanted those types of changes and made their voices known about it then they would have to make progress on it |
12:52:09 | FromDiscord | <cabboose> Haxscramper will start a change.org petition XD |
12:52:27 | FromDiscord | <Rika> and get like 5 signatures |
12:52:42 | FromDiscord | <haxscramper> Well, current opinon is that typed ast is approximately int he middle of the tetrahedron of pain |
12:52:43 | FromDiscord | <dom96> "There are dozens of us".meme.png |
12:52:45 | FromDiscord | <cabboose> that's 5 more than what we have now |
12:52:50 | FromDiscord | <Gumber> dom96: you know of very few people who use threads because Nim's memory model was terrible for threading for the longest time |
12:52:51 | FromDiscord | <haxscramper> generics, types, ast |
12:52:58 | FromDiscord | <Gumber> come on now |
12:53:10 | FromDiscord | <Gumber> for years were like like - how do we write multithreaded code with Nim |
12:53:13 | FromDiscord | <Gumber> and crickets... |
12:53:14 | FromDiscord | <dom96> hm? what do you mean? |
12:53:32 | FromDiscord | <Gumber> you either had to already know an s ton about computer science and concurrent programming |
12:53:45 | FromDiscord | <Gumber> or you had to be Araq and know about the experimental GC's and how channels etc were implemented |
12:53:58 | FromDiscord | <Gumber> because it was like a bi-weekly topic for a couple of years in this IRC |
12:54:04 | FromDiscord | <Gumber> and then eventually we got arenas |
12:54:09 | FromDiscord | <Gumber> and then we got ARC/ORC |
12:54:17 | FromDiscord | <Gumber> but for the longest time no one touched threads because spawn never worked |
12:54:19 | FromDiscord | <Gumber> parallel never worked |
12:54:22 | FromDiscord | <Gumber> threadpool never worked |
12:54:27 | FromDiscord | <Gumber> every DLL had its own GC |
12:54:32 | FromDiscord | <cabboose> continuations works \:') |
12:54:38 | FromDiscord | <Gumber> Nim's multithreading picture was abhorrent |
12:54:38 | FromDiscord | <cabboose> with loony \:') |
12:54:41 | FromDiscord | <cabboose> \:') |
12:54:54 | FromDiscord | <Gumber> so it's a wonder no one used threads and everyone used async - it was the only realistic option for a lot of people |
12:55:02 | FromDiscord | <Gumber> but IMO threads are better in every way |
12:55:02 | FromDiscord | <dom96> You're implying that I am saying that multithreading was good, but I'm confused where I am saying that |
12:55:07 | FromDiscord | <Gumber> no you're saying it's not good |
12:55:11 | FromDiscord | <Gumber> I'm saying it is |
12:55:21 | FromDiscord | <Gumber> and I use threads all the time |
12:55:30 | FromDiscord | <dom96> threading is a necessity π |
12:55:36 | FromDiscord | <Rika> well yeah |
12:55:47 | FromDiscord | <cabboose> lets get that petition going |
12:55:57 | FromDiscord | <cabboose> π |
12:55:58 | FromDiscord | <Rika> you have 6 signatures now how nice |
12:56:03 | FromDiscord | <dom96> but yeah, I've disliked this gc-safety stuff from the beginning |
12:56:12 | FromDiscord | <haxscramper> In reply to @Rika "you have 6 signatures": We can write RFC ... |
12:56:15 | FromDiscord | <dom96> afaik ORC/ARC is meant to solve this |
12:56:21 | FromDiscord | <haxscramper> Well, |
12:56:22 | FromDiscord | <Rika> hax im joking ;;; |
12:56:25 | FromDiscord | <Gumber> no it's not |
12:56:36 | FromDiscord | <Gumber> look sharing memory between threads is not safe at all |
12:56:38 | FromDiscord | <dom96> but then I hear that it isn't actually atomic... |
12:56:40 | FromDiscord | <Gumber> arc and orc dont' fix that |
12:56:45 | FromDiscord | <Gumber> (edit) "dont'" => "don't" |
12:56:53 | FromDiscord | <Gumber> they give you a shared heap |
12:56:58 | FromDiscord | <Gumber> that isn't thread local |
12:57:07 | FromDiscord | <dom96> yeah, and it's playing with pointers again |
12:57:09 | FromDiscord | <Gumber> but you still have to use locks and other concurrency primitives |
12:57:11 | FromDiscord | <dom96> this is what should be fixed |
12:57:22 | FromDiscord | <Gumber> use channels then |
12:57:28 | FromDiscord | <cabboose> whispers about CPS and loony |
12:57:32 | FromDiscord | <Gumber> or CPS and loony |
12:57:35 | FromDiscord | <Rika> cab pls |
12:57:35 | FromDiscord | <Gumber> or just use pointers |
12:57:45 | FromDiscord | <dom96> I don't want to use pointers |
12:57:49 | FromDiscord | <Gumber> π€· |
12:57:52 | FromDiscord | <dom96> I want safety |
12:57:59 | FromDiscord | <dom96> there is a reason I don't use C/C++ |
12:57:59 | FromDiscord | <Gumber> your requirements are diffefrent from mine |
12:58:10 | FromDiscord | <Gumber> (edit) "diffefrent" => "different" |
12:58:14 | FromDiscord | <dom96> and channels can't be used for everything |
12:58:18 | FromDiscord | <dom96> sometimes I need a shared state |
12:58:29 | FromDiscord | <Rika> eh what why wouldnt channels be ideal for that |
12:58:39 | FromDiscord | <Rika> i mean |
12:58:41 | FromDiscord | <Rika> not ideal |
12:58:42 | FromDiscord | <Rika> usable |
12:59:08 | FromDiscord | <dom96> hm, maybe they would be enough |
12:59:11 | FromDiscord | <Gumber> I never claimed channels weren't cumbersome |
12:59:14 | FromDiscord | <dom96> just trying to think of some common cases |
12:59:21 | FromDiscord | <Gumber> but every abstraction has its cost |
12:59:28 | FromDiscord | <dom96> I guess the most common is wanting to share a db connection between threads |
12:59:39 | FromDiscord | <Gumber> if you care that much about safety |
12:59:45 | FromDiscord | <Rika> wait what why |
12:59:47 | FromDiscord | <dom96> but then you could just have a db connection per thread too lol |
12:59:52 | FromDiscord | <Rika> idk why youd need to share the connection |
12:59:52 | FromDiscord | <Rika> yeah |
13:00:13 | FromDiscord | <Gumber> you're waiting around like everyone else for someone to figure out it π until then we have threads locks mutexes semaphores conditions and pointers |
13:00:17 | FromDiscord | <Gumber> and now continuations π |
13:00:21 | FromDiscord | <Gumber> oh and closure iterators |
13:00:34 | FromDiscord | <Gumber> but threads are great |
13:00:59 | FromDiscord | <dom96> I think most programmers just want to go for a shared global variable by default |
13:01:09 | FromDiscord | <Gumber> I've used them 100x more than any stdlib async stuff from Nim in the past year or so |
13:01:16 | FromDiscord | <dom96> but maybe channels/state per thread is the right mindset |
13:01:20 | FromDiscord | <dom96> in that case, we're done lol |
13:01:26 | FromDiscord | <dom96> where is our problem? π |
13:01:46 | FromDiscord | <cabboose> @dom96\: a bit offtopic but do I have to wait for another reviewer to check the nimble pull request for it to be accepted? |
13:02:03 | FromDiscord | <Rika> In reply to @dom96 "I think most programmers": a good middleground is to probably make an abstraction that simulates shared state with channels |
13:02:17 | FromDiscord | <Rika> ofc still comes with a cost |
13:02:52 | FromDiscord | <Gumber> sometimes you have to have a shared state |
13:04:28 | FromDiscord | <Gumber> but regardless, memory safety issues are like the last problem I fight on a regular basis |
13:04:40 | FromDiscord | <dom96> okay, so can you give an example of when a shared state is necessary? |
13:04:42 | FromDiscord | <Gumber> and when I do have to fight them I generally know where they're lurking |
13:05:19 | FromDiscord | <Gumber> sure - let's say you have a main thread that is managing a bunch of worker threads and they're spawning closure iterators or continuations |
13:05:43 | FromDiscord | <Gumber> you need the closure iterator context or fiber stack or whatever on all threads |
13:06:02 | FromDiscord | <Gumber> because you're jumping between them |
13:07:14 | FromDiscord | <Gumber> now you could certainly try to copy and synchronize changes to this shared mutable state but you'd be creating more contention trying to synchronize all of the changes between copies |
13:07:44 | FromDiscord | <Gumber> not to mention, you are already going to be locking and putting threads to sleep while they wait for work |
13:08:11 | FromDiscord | <Gumber> so you already have a very complicated situation with a lot of moving pieces |
13:08:44 | FromDiscord | <Gumber> and you'll most likely just make matters worse if you try to distribute copies of this state and synchronize them |
13:08:58 | FromDiscord | <Gumber> is it possible? sure |
13:09:00 | FromDiscord | <Gumber> is it a good idea? no |
13:09:30 | FromDiscord | <dom96> I see, makes sense. Sounds like a very specialised case though, which makes me think that for vast majority of cases shared state isn't necessary and thus making it hard is fine. |
13:09:48 | FromDiscord | <Gumber> it's pretty much any work stealing / task scheduling job system out there involving threads |
13:10:13 | FromDiscord | <Gumber> like pretty much any thick client application that wants to parallelize work across threads is going to be gunning for something like this |
13:10:18 | FromDiscord | <Gumber> lots of little short lived tasks |
13:10:23 | FromDiscord | <Gumber> that take very little CPU time |
13:10:47 | FromDiscord | <Gumber> games are just one example |
13:11:00 | FromDiscord | <Gumber> and they have some unique requirements just because of their reliance on the GPU |
13:11:16 | FromDiscord | <Gumber> but I don't think it's as uncommon as one might expect in the world of systems programming |
13:11:27 | FromDiscord | <Gumber> there's a really good podcast on this topic by the guys from the machinery if anyone is interested |
13:11:58 | FromDiscord | <Gumber> https://anchor.fm/ourmachinery/episodes/S3-EP2-Fiber-Based-Job-Systems-em88k4 |
13:12:05 | * | arfy waves hi |
13:12:13 | FromDiscord | <Gumber> these guys are fucking awesome - if you're not reading their blog or listening to their podcast you should be |
13:12:22 | * | arfy randomly notes statement modifiers, as in perl would be nice sometimes. |
13:12:44 | FromDiscord | <Rika> ? |
13:12:51 | FromDiscord | <Gumber> https://ourmachinery.com/post/ blog is here |
13:13:48 | arfy | cart.title = title if title. |
13:14:12 | arfy | in other words, set the title only if the new variable has a value |
13:14:17 | FromDiscord | <Gumber> `cart.title = if title: title else: ""` |
13:14:33 | FromDiscord | <Gumber> (edit) "title:" => "title.len > 0:" |
13:14:42 | arfy | huh wait that works? |
13:14:44 | FromDiscord | <Gumber> yes |
13:14:45 | FromDiscord | <Rika> yes |
13:14:46 | FromDiscord | <Gumber> ternary |
13:14:50 | FromDiscord | <Gumber> equivalent of a ternary |
13:14:59 | FromDiscord | <Rika> if expression technically |
13:15:06 | arfy | right |
13:15:21 | FromDiscord | <Anuke> How would I get the entire AST of a proc that was not passed into a macro? |
13:15:36 | FromDiscord | <Gumber> `dumpAST` |
13:15:39 | FromDiscord | <Gumber> but that's a macro |
13:15:40 | FromDiscord | <Gumber> so.... |
13:16:11 | FromDiscord | <Rika> i believe its complicated to get the ast of something outside the macro's scope but i think its possible |
13:16:15 | FromDiscord | <Rika> just a bit hard |
13:16:43 | FromDiscord | <leorize> @Anuke\: if you have the symbol\: getImpl |
13:17:36 | FromDiscord | <Anuke> I have the proc right next to the macro, but I don't have its symbol. Is it possible to look up a symbol? |
13:18:21 | FromDiscord | <Rika> is your macro typed |
13:19:00 | FromDiscord | <leorize> hmm, what exactly are you trying to do? |
13:20:21 | FromDiscord | <Anuke> In reply to @amadan "Workaround I've used before": What I'm trying to do is implement what is mentioned in this comment here. I want a macro that tags varargs[untyped], and calls a proc with optional arguments automatically "filled in". To do this, I want to grab the AST from the proc I want to call, loop through the argument and append them to a `call` if they're not present in the varargs. |
13:20:29 | FromDiscord | <Anuke> (edit) "tags" => "takes" |
13:20:33 | FromDiscord | <Anuke> tags -> takes |
13:20:58 | FromDiscord | <leorize> you need typed |
13:21:15 | * | max22- quit (Ping timeout: 260 seconds) |
13:21:23 | FromDiscord | <leorize> but if you use typed then it can't sem... |
13:21:59 | FromDiscord | <leorize> the other solution is to pass the symbol and the parameters separately |
13:22:14 | FromDiscord | <Anuke> But the last argument is a code block that needs to be further transformed by another macro, I don't think that can be typed |
13:24:45 | FromDiscord | <Anuke> This is getting really complicated, so I think I'll actually use an object for all the optional arguments instead like Rika suggested, at least until a newer nim version is released |
13:24:48 | FromDiscord | <Anuke> thanks anyway |
13:25:26 | FromDiscord | <leorize> how about this\: `call_opt foo(a, b)` -\> `call_opt foo, a, b` |
13:25:39 | FromDiscord | <leorize> type the first argument only |
13:25:58 | FromDiscord | <leorize> so you get the proc symbol, but the rest will be figured out later |
13:26:46 | FromDiscord | <leorize> you will be basically redoing sigmatch so maybe it's not worth it |
13:33:38 | * | max22- joined #nim |
13:39:21 | FromDiscord | <mratsim> In reply to @cabboose "me and zevv are": https://github.com/status-im/nim-taskpools this is Weave simplified |
13:39:48 | Zevv | without the casting and the raw pointers? |
13:39:51 | FromDiscord | <mratsim> less than 1000 loc |
13:39:55 | Zevv | because that was a total show stopper for me on weave |
13:42:05 | FromDiscord | <mratsim> mmm you would have to point me to where you saw this on Weave. I remember raw pointers as workaround to Nim limitations and casting for the custom mempool |
13:42:34 | Zevv | I mean the things like `let bufIn = cast[ptr UncheckedArray[float32]](input[0].unsafeAddr)` |
14:09:50 | FromDiscord | <Gumber> I have two C++ functions that return pointers to opaque types |
14:10:20 | FromDiscord | <Gumber> well they return a std:vector of these types, wrapped in result type |
14:10:33 | FromDiscord | <Gumber> the two types are `VkImage` and `VkImageView` |
14:10:54 | FromDiscord | <Gumber> when I call the function that is supposed to return the result vector of `VkImageViews` however |
14:10:58 | FromDiscord | <Gumber> I get a weird error: |
14:11:07 | FromDiscord | <Gumber> sent a code paste, see https://play.nim-lang.org/#ix=3zlq |
14:11:27 | FromDiscord | <Gumber> I looked in the generated C++ code and there are some aliases defined for result<std::vector<VkImage>> |
14:11:39 | FromDiscord | <Gumber> but nothing for `result<std::vector<VkImageView>>>` |
14:11:59 | FromDiscord | <Gumber> sent a code paste, see https://play.nim-lang.org/#ix=3zlt |
14:12:13 | FromDiscord | <Gumber> sent a code paste, see https://play.nim-lang.org/#ix=3zlu |
14:12:25 | FromDiscord | <Gumber> sent a code paste, see https://play.nim-lang.org/#ix=3zlv |
14:12:29 | FromDiscord | <Gumber> `Result[T] {.importcpp: "vkb::detail::Result", header: vkbHeader.} = object` |
14:12:48 | FromDiscord | <Gumber> anyone have any idea? |
14:12:53 | FromDiscord | <Gumber> the C++ type is defined by a macro |
14:13:07 | FromDiscord | <Gumber> sent a code paste, see https://play.nim-lang.org/#ix= |
14:13:15 | FromDiscord | <Gumber> `VK_DEFINE_NON_DISPATCHABLE_HANDLE(VkImageView)` |
14:13:31 | FromDiscord | <Gumber> I'm calling `get_images()` right before that line and the codegen seems to be fine with that one |
14:16:27 | FromDiscord | <Gumber> oh and here's the C++ for `get_images` and `get_image_views` |
14:16:48 | FromDiscord | <Gumber> sent a code paste, see https://play.nim-lang.org/#ix=3zlx |
14:17:05 | FromDiscord | <Gumber> (edit) "https://play.nim-lang.org/#ix=3zlx" => "https://play.nim-lang.org/#ix=3zly" |
14:17:44 | FromDiscord | <Gumber> seems to me like it couldn't construct the `std::vector` for some reason |
14:17:57 | FromDiscord | <Gumber> but I have no clue why.... |
14:18:10 | FromDiscord | <Gumber> maybe I need to make the alised types for it? I dunno let me try that |
14:20:40 | FromDiscord | <Gumber> nope, no dice |
14:21:25 | FromDiscord | <Gumber> this is making my brain hurt... going to go get coffee |
14:32:38 | FromDiscord | <fae> Is the automatic deref experimental feature popular? I donβt see it used in many codebases |
14:33:44 | FromDiscord | <fae> Like are there downsides to using it? Does it make code less clear what is a ref and what is not? And if so is that an issue |
14:41:27 | FromDiscord | <leorize> it's not frequently used because not many people use ref afaik |
14:43:48 | FromDiscord | <fae> If you need to do some type of unsafe casting ref/ptr are your only options right? Since their size is the same |
14:43:53 | FromDiscord | <dom96> do you have a link to the docs for this experimental feature? |
14:44:24 | FromDiscord | <fae> https://nim-lang.org/docs/manual_experimental.html#automatic-dereferencing |
14:45:24 | FromDiscord | <leorize> yea, if you want the unsafe stuff |
14:47:21 | FromDiscord | <dom96> the reason you wouldn't use it is because you'd pass the ref to every function |
14:47:32 | FromDiscord | <dom96> it's not typical to have some that take the non-ref and some that take the ref |
14:48:08 | FromDiscord | <fae> So itβs overall just not a very useful feature |
14:48:19 | FromDiscord | <fae> Or at least, a niche one |
14:49:44 | FromDiscord | <dom96> yep |
14:51:19 | NimEventer | New Nimble package! loony - Lock-free threadsafe MPMC with high throughput, see https://github.com/shayanhabibi/loony |
14:52:50 | FromDiscord | <Gumber> No one has a any ideas for my cpp issue? |
14:53:41 | FromDiscord | <Gumber> @haxscramper is probably my only hope |
14:55:21 | FromDiscord | <Gumber> Maybe I can just reinterpret cast the result |
14:55:34 | FromDiscord | <Gumber> Doubt it tho |
15:00:48 | FromDiscord | <deech> Are there any compile time procs for getting the current time? `now()` and `getTime()` use `importc`, I can shell out to `date` but thought I'd ask first. |
15:02:45 | FromDiscord | <xflywind> `getTime` can be used with `--experimental:vmopsDanger` at compile time. |
15:06:02 | FromDiscord | <deech> `static: echo getTime()` with that flag gives the error: `Error: cannot evaluate at compile time: localInstance` |
15:06:27 | FromDiscord | <xflywind> devel? |
15:06:54 | FromDiscord | <deech> sent a code paste, see https://play.nim-lang.org/#ix=3zlS |
15:09:12 | NimEventer | New thread by HJarausch: --gc:orc when is it usable (huge compile times), see https://forum.nim-lang.org/t/8439 |
15:11:44 | FromDiscord | <xflywind> In reply to @deech "`static: echo getTime()` with": It may be a bug. |
15:18:31 | FromDiscord | <Yardanico> In reply to @deech "Are there any compile": Yes |
15:18:47 | FromDiscord | <Yardanico> CompileTime and CompileDate, although they're constants |
15:18:55 | FromDiscord | <Yardanico> and represented as strings |
15:20:39 | FromDiscord | <xflywind> this works |
15:20:47 | FromDiscord | <xflywind> sent a code paste, see https://play.nim-lang.org/#ix=3zlU |
15:22:12 | FromDiscord | <deech> That does work! I wonder why `echo getTime()` doesn't. |
15:23:03 | FromDiscord | <xflywind> it call procs uses threadvar variables and `$` is not registered in vmops. |
15:23:26 | FromDiscord | <xflywind> (edit) "call procs" => "calls a proc" | "threadvar" => "`threadvar`" | "uses`threadvar`variables and ... `$`proc" added "the" | "uses`threadvar`variables andthe`$` ... is" added "proc" |
15:40:23 | * | Gustavo6046 quit (Quit: ZNC 1.8.2 - https://znc.in) |
15:42:36 | FromDiscord | <dom96> huh, I could have sworn exporting modules was now a thing |
15:43:12 | FromDiscord | <Yardanico> what do you mean? you can export modules by "export module" after importing one, yes |
15:43:15 | FromDiscord | <dom96> oh, I just can't do `export dir / module` |
15:43:19 | FromDiscord | <dom96> I have to do `export module` |
15:43:22 | FromDiscord | <dom96> do we have a bug for this? |
15:43:35 | FromDiscord | <Yardanico> is it really a bug though? export works on a module const name symbol |
15:43:36 | FromDiscord | <Gumber> It's been like that forever |
15:43:39 | FromDiscord | <Gumber> It's not a bug |
15:43:56 | FromDiscord | <Gumber> Forever means five years |
15:43:59 | FromDiscord | <Gumber> At least |
15:44:05 | FromDiscord | <Gumber> Since I joined |
15:44:42 | FromDiscord | <dom96> seems like it's something that should be supported at least |
15:44:48 | FromDiscord | <Gumber> Why |
15:44:56 | FromDiscord | <Gumber> It works as intended |
15:45:05 | FromDiscord | <Gumber> I don't see any benefit |
15:45:30 | FromDiscord | <dom96> if I end up with two modules of the same name then I'll have to rename one |
15:45:33 | FromDiscord | <Gumber> Just adding complexity for the sake of it |
15:45:37 | FromDiscord | <Yardanico> In reply to @dom96 "if I end up": of course |
15:45:40 | FromDiscord | <Yardanico> export is not related to that at all |
15:45:42 | FromDiscord | <Gumber> Yeah |
15:45:46 | FromDiscord | <Yardanico> you have to use "import x as y" |
15:45:48 | FromDiscord | <Gumber> You have to do that anyway |
15:46:02 | FromDiscord | <Gumber> If you want to qualify symbols |
15:46:34 | FromDiscord | <dom96> I suppose |
15:46:37 | FromDiscord | <fae> You want to export without importing first? |
15:46:53 | FromDiscord | <dom96> thinking about `export` taking an identifier rather than a path makes sense |
15:47:04 | FromDiscord | <Gumber> yeah it's like you resolve a path and it gets stored in an alias |
15:47:13 | FromDiscord | <Gumber> which is how the module is referred to in that compilation unit |
15:47:18 | FromDiscord | <Gumber> and then you can also export that symbol if you want |
15:47:35 | FromDiscord | <Gumber> I think the way it is designed is the right way |
15:47:47 | FromDiscord | <Gumber> the only beef I ever have with Nim imports |
15:47:50 | FromDiscord | <dom96> I wonder how easy we could make the error message nicer: "Cannot import dir / module" is far too vague. Should be fairly easy to append "; have you tried `export module`? |
15:47:53 | FromDiscord | <haxscramper> Is that correct? |
15:47:53 | FromDiscord | <haxscramper> sent a code paste, see https://play.nim-lang.org/#ix=3zm6 |
15:48:01 | FromDiscord | <Gumber> not exactly hax |
15:48:11 | FromDiscord | <Gumber> well I'm not sure really |
15:48:17 | FromDiscord | <Gumber> because for Vulkan there's the C++ headers and the C headers |
15:48:30 | FromDiscord | <Yardanico> In reply to @dom96 "I wonder how easy": don't really get you there, how is "cannot import dir/module" related to "export module"? |
15:48:38 | FromDiscord | <Gumber> let me grab the C++ headers for the Vkimage and VkImageView one sec |
15:48:43 | FromDiscord | <dom96> er sorry, s/import/export/ |
15:48:48 | FromDiscord | <haxscramper> You need to have s simplified model of the API you are trying to interface with, then this can be debugged easier |
15:49:01 | FromDiscord | <Gumber> I tried to make one |
15:49:03 | FromDiscord | <Gumber> but it compiled |
15:49:17 | FromDiscord | <Gumber> okay nevermind |
15:49:21 | FromDiscord | <haxscramper> Bane of all C++ interop |
15:49:22 | FromDiscord | <Gumber> let me share the example I put together |
15:49:24 | FromDiscord | <haxscramper> "it compiled" |
15:49:35 | FromDiscord | <Gumber> maybe it will shine some light |
15:49:36 | FromDiscord | <Gumber> yeah exactly |
15:49:42 | FromDiscord | <Gumber> like I DON'T want it to compile lol |
15:49:43 | FromDiscord | <Gumber> https://play.nim-lang.org/#ix=3zlV |
15:49:44 | FromDiscord | <Gumber> bad compiler! |
15:50:04 | FromDiscord | <Gumber> I tried to make it more concise by omitting all the `Result` crap |
15:50:07 | FromDiscord | <Gumber> but it compiled too |
15:50:12 | FromDiscord | <Gumber> soo... `Result` is there |
15:50:25 | FromDiscord | <Gumber> also in the real C++ code |
15:50:35 | FromDiscord | <Gumber> Swapchain is split into a header and implementation file |
15:50:42 | FromDiscord | <Gumber> I tried to do that in the `emit` block but it produced errors |
15:50:49 | FromDiscord | <haxscramper> wandbox.org allows to have multiple files in different languages |
15:50:59 | FromDiscord | <haxscramper> just if you find it more convenient |
15:51:00 | FromDiscord | <Gumber> oh shit - will do that next time thanks for the protip |
15:51:30 | FromDiscord | <Yardanico> In reply to @haxscramper "wandbox.org allows to have": it also allows for compilation flags (like --gc:orc) which is very useful too :) |
15:51:40 | FromDiscord | <Gumber> wowwwww this thing is amazing |
15:51:42 | FromDiscord | <haxscramper> also has nimb devel |
15:51:49 | FromDiscord | <haxscramper> though not nim packages |
15:52:04 | FromDiscord | <Gumber> anyway - yeah I can't figure out wtf is going on |
15:52:06 | FromDiscord | <Gumber> or how to fix it |
15:52:17 | FromDiscord | <Gumber> I'm offering money to any one who can lol $15 USD via paypal is the current bounty |
15:52:51 | FromDiscord | <Gumber> and I can put my code up somewhere but as far as getting it to compile - not going to go through that jungle gym with anyone |
15:55:40 | FromDiscord | <haxscramper> I'm looking into it right now |
15:55:50 | FromDiscord | <Gumber> and about your question earlier `VkImage` and `VkImageView` are both defined using that macro `VK_DEFINE_NON_DISPATCHABLE_HANDLE` which on my cpu-arch resolves to `#define VK_DEFINE_NON_DISPATCHABLE_HANDLE(object) typedef struct object##_T object;` |
15:55:53 | FromDiscord | <Gumber> sweet - thank you |
15:56:04 | FromDiscord | <haxscramper> I would have to deal with this crap fountain pattern at some point, so I might as well do it right now |
15:56:04 | FromDiscord | <Gumber> so they're just pointers to opaque types |
15:56:19 | FromDiscord | <Gumber> and make $15 |
15:56:22 | FromDiscord | <Gumber> in the process |
16:04:33 | federico3 | @dom96 any feedback on https://github.com/nim-lang/nimble/issues/921 ? It's been a while. |
16:06:38 | FromDiscord | <dom96> Really not much feedback to give other than that I support implementing it |
16:07:01 | FromDiscord | <haxscramper> https://github.com/nim-lang/RFCs/issues/398 |
16:07:10 | FromDiscord | <dom96> but I think it overlaps a lot with https://github.com/nim-lang/nimble/issues/80 |
16:07:33 | FromDiscord | <haxscramper> Well, I will at least link it, though digging throught #398 is nearly impossible unless you want to spend quite some time |
16:10:06 | FromDiscord | <haxscramper> @Gumber aka Zachary Carter do you have a full wrappers somewher? |
16:10:23 | FromDiscord | <haxscramper> I will try to mimimize them instead |
16:15:22 | FromDiscord | <Gumber> yeah |
16:15:34 | FromDiscord | <Gumber> well not really |
16:15:35 | FromDiscord | <Gumber> full |
16:15:43 | FromDiscord | <haxscramper> just thing that fails for you |
16:15:52 | FromDiscord | <haxscramper> I need to reproduce your error, nothing more |
16:16:10 | FromDiscord | <Gumber> okay let me upload my code one sec |
16:16:42 | FromDiscord | <Goel> sent a code paste, see https://play.nim-lang.org/#ix=3zmg |
16:16:59 | FromDiscord | <haxscramper> `if rgbaSeq[n] in [alphaA, alphaB]` |
16:17:25 | FromDiscord | <haxscramper> idk about hidden overhead wrt. to intermediate array construction |
16:22:52 | FromDiscord | <Gumber> https://github.com/zacharycarter/FRAG |
16:22:54 | FromDiscord | <Gumber> @haxscramper |
16:23:22 | FromDiscord | <Gumber> I'm on windows and use vcc to compile everything |
16:23:39 | FromDiscord | <Gumber> I don't know if that's an issue or not |
16:24:38 | FromDiscord | <haxscramper> what file I have to compile |
16:25:14 | FromDiscord | <Gumber> frag.nim |
16:25:18 | FromDiscord | <Gumber> you can just do `nimble install -y` |
16:25:33 | FromDiscord | <Gumber> but there's a lot of C++ libraries that need manual compilation atm |
16:25:43 | FromDiscord | <Gumber> I can try to write some commands to compile them |
16:25:59 | FromDiscord | <Gumber> they're all in `thirdparty` |
16:26:43 | FromDiscord | <Gumber> the ones that need building are `vuk` , `glfw` and `shaderc` |
16:27:04 | FromDiscord | <Gumber> they're all linked statically |
16:27:11 | FromDiscord | <Gumber> and I think all three use cmake |
16:27:21 | FromDiscord | <Gumber> `vk-bootstrap` is compiled inside the `vkb.nim` module |
16:27:45 | FromDiscord | <Gumber> `vuk.nim` `vkb.nim` and `glfw.nim` have some pragmas that may need modifying |
16:27:53 | FromDiscord | <haxscramper> Just so you know ` {.error: "platform not supported!".}` is not really informative, writing what platform is actually supported is more user-friently |
16:27:55 | FromDiscord | <Gumber> vulkan SDK also has to be installed on your system and the paths to it have to be correct |
16:27:59 | FromDiscord | <haxscramper> I'm being picky here, but still |
16:28:04 | FromDiscord | <Gumber> this is all just very fast code |
16:28:09 | FromDiscord | <Gumber> it will all be refactored |
16:28:44 | FromDiscord | <Gumber> I'm not intending for anyone to use this really either - not anytime soon anyway - it's more just to remind myself that that section is platform specific |
16:29:41 | FromDiscord | <Gumber> everything needs to be compiled with `/MTd` |
16:30:17 | FromDiscord | <Gumber> I had to go into Visual Studio and right click on the projects that were generated by `vuk`'s `CMakeLists.txt` and adjust them to be so |
16:30:42 | FromDiscord | <haxscramper> I'm not on windows so it looks like I'm going to have some troubles compiling this, at least I can't do this without going over all `compile:` etc. things, which I certainly not be doing. So I will just examine wrappers and try to replicate them |
16:30:52 | FromDiscord | <Gumber> alrighty |
16:31:03 | FromDiscord | <Gumber> yeah that's what I tried with the minimal reproducible example - but maybe you'll have more luck than me |
16:32:43 | FromDiscord | <Gumber> if you walk back from https://github.com/zacharycarter/FRAG/blob/master/src/fragpkg/app.nim#L35-L47 |
16:33:20 | FromDiscord | <Gumber> and more specifically - https://github.com/zacharycarter/FRAG/blob/master/src/fragpkg/app.nim#L54 |
16:33:33 | FromDiscord | <Gumber> (edit) "https://github.com/zacharycarter/FRAG/blob/master/src/fragpkg/app.nim#L35-L47" => "https://github.com/zacharycarter/FRAG/blob/master/src/fragpkg/app.nim#L35-L60" |
16:33:47 | FromDiscord | <Gumber> that's the line that is problematic in the generated C++ |
16:37:09 | FromDiscord | <Ayy Lmao> Is there a way to do something similar to varargs coercion but with a single value? Ideally not using a converter. So sort of like a converter that only works for a specific function. |
16:38:27 | FromDiscord | <haxscramper> https://media.discordapp.net/attachments/371759389889003532/889188697696788550/unknown.png |
16:39:30 | FromDiscord | <Gumber> lol |
16:39:46 | FromDiscord | <haxscramper> Why in the world each god-damn C++ library feels like Iβm tasked with unearthing some kind of dinosaur and piecing it back together using nothing but a hammer and perforator |
16:39:55 | FromDiscord | <haxscramper> And five megaton nuke |
16:39:57 | FromDiscord | <Gumber> yeah, this is my life |
16:39:59 | FromDiscord | <Gumber> for the past few days |
16:40:26 | FromDiscord | <Gumber> think I started on this nonsense journey on Thursday last week |
16:40:30 | FromDiscord | <haxscramper> Where does `<VkBootstrap.h>` comes from |
16:40:34 | FromDiscord | <haxscramper> Is it auto-generated? |
16:40:38 | FromDiscord | <Gumber> vk-bootstrap in third party |
16:40:50 | FromDiscord | <Gumber> under the src dir |
16:40:51 | FromDiscord | <Gumber> of course |
16:41:19 | FromDiscord | <Gumber> actually |
16:41:25 | FromDiscord | <Gumber> that's probably the sanest library of them all |
16:41:29 | FromDiscord | <Gumber> minus the lack of an include dir |
16:41:39 | FromDiscord | <Gumber> but I mean, not like that's a hard rule or anything |
16:41:52 | FromDiscord | <haxscramper> ah, yes, I got destroyed by git again |
16:41:56 | FromDiscord | <haxscramper> cloned non-recursive |
16:42:02 | FromDiscord | <Gumber> ah yeah my bad should have warned you |
16:42:12 | FromDiscord | <Gumber> also why does C++ just embrace the ever living fuck out of ambiguity? |
16:42:27 | FromDiscord | <Gumber> like I always felt that way about C |
16:42:37 | FromDiscord | <Gumber> but it's just because of the lack of an ABI and the fact it needs to be that way to be portable |
16:42:54 | FromDiscord | <Gumber> C++ has an ABI and isn't portable but it still tries to just give you 10,000 ways to do things |
16:43:26 | FromDiscord | <Gumber> and most of the time only like four of them are really practical / useful |
16:43:39 | FromDiscord | <Gumber> sometimes more choices / options is not better |
16:44:28 | FromDiscord | <haxscramper> Want some `(T1 arg1, T2 arg2, decltype(arg1 + arg2)& result)` |
16:45:05 | FromDiscord | <Gumber> https://media.discordapp.net/attachments/371759389889003532/889190368053194823/6KXBnnAAlbCsV5A-4d23dS-FrxjNxyO5FGVMKIL_SCk.mp4 |
16:46:39 | FromDiscord | <Gumber> In reply to @haxscramper "Want some `(T1 arg1,": I mean that looks like what I need |
16:46:54 | * | Gustavo6046 joined #nim |
16:47:18 | FromDiscord | <haxscramper> and btw, never, ever use discard when minimizing C++ shit |
16:47:27 | FromDiscord | <haxscramper> assign to some garbage, but not discard |
16:47:33 | FromDiscord | <Gumber> ah okay |
16:47:38 | FromDiscord | <haxscramper> because nim compiler might try to get smart with you |
16:48:34 | FromDiscord | <haxscramper> It is not guaranteed to happen, but just a safety precaution |
16:49:16 | FromDiscord | <Gumber> here we go |
16:49:19 | FromDiscord | <Gumber> https://play.nim-lang.org/#ix=3zmr |
16:49:22 | FromDiscord | <Ayy Lmao> Discard isn't safe on c++ functions? |
16:49:25 | FromDiscord | <Gumber> I think that might b ethe same error |
16:49:29 | FromDiscord | <Gumber> (edit) "b ethe" => "be the" |
16:49:34 | FromDiscord | <Gumber> just from GCC |
16:49:54 | FromDiscord | <Gumber> In reply to @Ayy Lmao "Discard isn't safe on": it's not that - it's just Nim will generate different C++ when you discard vs assign |
16:50:04 | FromDiscord | <Gumber> so when you're trying to track down a Nim cpp codegen issue |
16:50:22 | FromDiscord | <Gumber> discarding the result from a C++ function you've bound to, won't produce the same result as if you assigned the result to some variable |
16:50:31 | FromDiscord | <Gumber> which is why my minimal reproducible example compiled previously |
16:50:41 | FromDiscord | <Gumber> and now that I've fixed it to not discard the results, it isn't compiling anymore |
16:50:46 | FromDiscord | <Gumber> so I guess now I've reproduced it |
16:50:52 | FromDiscord | <Gumber> just on a different compiler toolchain |
16:50:56 | FromDiscord | <Gumber> and cpu arch |
16:51:00 | FromDiscord | <Gumber> sorry OS |
16:51:11 | FromDiscord | <Gumber> I don't know what cpu-arch the playground is running on |
16:52:14 | FromDiscord | <Gumber> but yay that's progress |
16:53:39 | * | stkrdknmibalz joined #nim |
16:53:41 | FromDiscord | <Gumber> I'm going to get ready to mow the lawn - will have my phone on me. @haxscramper PM me your paypal account email and I'll shoot you over the $15 USD |
16:53:49 | FromDiscord | <Gumber> You've already provided me with $15 of help anyway |
16:53:57 | FromDiscord | <haxscramper> sent a code paste, see https://play.nim-lang.org/#ix=3zmu |
16:54:29 | FromDiscord | <Gumber> I have so many gd chores to do because I was on the couch for like 11 days straight with COVID |
16:54:44 | FromDiscord | <Gumber> but it feels good to be able to do chores again lol |
16:55:20 | FromDiscord | <haxscramper> Nim should use `--error-format:json` from G++ |
16:55:29 | FromDiscord | <Gumber> https://tenor.com/view/chefs-kiss-french-chef-perfect-dish-excellent-food-perfection-gif-20341505 |
16:55:39 | FromDiscord | <Gumber> @dom96 really? can we fix gif embeds? |
16:55:42 | FromDiscord | <Gumber> that is lame af |
16:55:48 | FromDiscord | <Rika> no |
16:55:53 | FromDiscord | <Gumber> that's a discord gif embed |
16:55:54 | FromDiscord | <Gumber> not a link |
16:55:57 | FromDiscord | <Rika> image embeds are not separate from website embeds |
16:56:03 | FromDiscord | <Gumber> yo that is terrible |
16:56:09 | FromDiscord | <Gumber> why is discord so bad |
16:56:19 | FromDiscord | <Gumber> it's literally one of the worst pieces of software I've used in a while |
16:56:22 | FromDiscord | <Rika> i mean |
16:56:30 | FromDiscord | <Rika> its w/e |
16:56:33 | FromDiscord | <Rika> you get used to it |
16:56:36 | FromDiscord | <Gumber> no log files, can't differentiate b/w external links and internal ones |
16:56:44 | FromDiscord | <Rika> i dont know any other chat app that distinguishes embeds like that |
16:56:45 | FromDiscord | <Gumber> I don't want my software to make me get used to things |
16:56:49 | FromDiscord | <Gumber> I want it to do the things it should do |
16:56:56 | FromDiscord | <Gumber> I can't imagine it's that difficult |
16:57:01 | FromDiscord | <Rika> "discord gifs" are not internal |
16:57:05 | FromDiscord | <Rika> theyre from tenor |
16:57:05 | FromDiscord | <Gumber> serve them up with some query parameter |
16:57:09 | FromDiscord | <Gumber> okay so proxy them |
16:57:31 | FromDiscord | <Rika> it's "disable link embeds" not "disable external link embeds" |
16:58:54 | FromDiscord | <Rika> w/e |
17:00:55 | FromDiscord | <haxscramper> ahhhffs, |
17:01:02 | FromDiscord | <haxscramper> `Result` is not default constructible |
17:01:46 | FromDiscord | <haxscramper> sent a code paste, see https://play.nim-lang.org/#ix=3zmA |
17:01:49 | FromDiscord | <Gumber> crap... |
17:02:06 | FromDiscord | <Gumber> In reply to @Rika "it's "disable link embeds"": yeah but that's what I want |
17:02:25 | FromDiscord | <Gumber> In reply to @haxscramper "this is not the": yeah the error you quoted is the one I got locally |
17:02:51 | FromDiscord | <haxscramper> sent a code paste, see https://play.nim-lang.org/#ix=3zmB |
17:02:54 | FromDiscord | <haxscramper> `no matching function for call to βResult<std::vector<int> >::Result()β` |
17:02:59 | FromDiscord | <haxscramper> waiut a sec |
17:03:25 | FromDiscord | <haxscramper> In reply to @Gumber "https://play.nim-lang.org/#ix=3zmr": yes, it is the same one |
17:04:13 | FromDiscord | <haxscramper> I need to explicitly handle non-default-constructible types in hcparse, I forgot about that, again |
17:06:15 | FromDiscord | <Gumber> oh okay |
17:06:44 | FromDiscord | <Gumber> In reply to @haxscramper "I need to explicitly": so does that mean it is indeed a nim codegen bug? |
17:06:51 | FromDiscord | <Gumber> or is it like - I can abuse importcpp or something to make it work? |
17:08:21 | FromDiscord | <haxscramper> No, it means you need to mark `gget_image_views` as `{.constructor.}` and you can't have globals of type `Result` |
17:08:54 | FromDiscord | <haxscramper> Because nim genreates globals as top-level variables, which have to be initialized, but without arguments you can't do this |
17:09:02 | FromDiscord | <haxscramper> works |
17:09:08 | FromDiscord | <haxscramper> sent a code paste, see https://play.nim-lang.org/#ix=3zmD |
17:09:16 | FromDiscord | <haxscramper> sent a code paste, see https://paste.rs/kpa |
17:09:33 | FromDiscord | <haxscramper> sent a code paste, see https://play.nim-lang.org/#ix=3zmF |
17:09:41 | FromDiscord | <Gumber> fml |
17:09:52 | FromDiscord | <Gumber> because a constructor |
17:09:56 | FromDiscord | <Gumber> that's not really a constructor |
17:10:01 | FromDiscord | <Gumber> makes so much sense |
17:10:06 | FromDiscord | <Gumber> I love importcpp |
17:10:19 | FromDiscord | <Gumber> okay thank you for solving this for me - I'm now going to bang my head against the wall for a few minutes |
17:10:22 | FromDiscord | <haxscramper> But this is still not the same error |
17:10:25 | FromDiscord | <Gumber> oh |
17:10:34 | FromDiscord | <haxscramper> Yes, we just came up with new unrelated error |
17:10:38 | FromDiscord | <Gumber> lolol |
17:11:38 | FromDiscord | <haxscramper> sent a code paste, see https://play.nim-lang.org/#ix=3zmG |
17:12:05 | FromDiscord | <haxscramper> sent a code paste, see https://play.nim-lang.org/#ix=3zmH |
17:12:24 | FromDiscord | <Gumber> okay thanks - I'll give this a go |
17:12:27 | FromDiscord | <haxscramper> My guess is that somewhere you mixed types |
17:12:32 | FromDiscord | <Gumber> probably |
17:12:43 | FromDiscord | <haxscramper> so `get_images` is declared as returning T on the nim side |
17:12:50 | FromDiscord | <haxscramper> but in reality it returns Z |
17:13:11 | FromDiscord | <haxscramper> but nim genreates `T temp;` and then does `temp = <>` |
17:14:03 | FromDiscord | <Gumber> yeah |
17:14:22 | FromDiscord | <Gumber> just gotta go through all the layers I guess and figure it out - tried that a few times but to no success |
17:14:29 | FromDiscord | <Gumber> okay thanks - again PM me so I can paypal you lol |
17:14:43 | FromDiscord | <Gumber> going to take a break and work on the lawn, but I'll be back in a bit and try to continue fixing this crap |
18:05:49 | * | neurocyte01 quit (Ping timeout: 252 seconds) |
18:24:12 | * | max22- quit (Ping timeout: 245 seconds) |
18:32:53 | FromDiscord | <Smarc> sent a code paste, see https://play.nim-lang.org/#ix=3zn5 |
18:35:09 | FromDiscord | <Recruit_main707> you need to compile with `--threads:on` |
18:39:30 | FromDiscord | <Smarc> sent a code paste, see https://play.nim-lang.org/#ix=3zn8 |
18:40:03 | FromDiscord | <Smarc> nvm, I fucked up |
18:40:46 | FromDiscord | <enthus1ast> @dom96\: can you check if i have crashed the forum? |
18:40:53 | FromDiscord | <enthus1ast> it seems like it |
18:42:43 | FromDiscord | <gerwy> Hiβ΅is Aporia still good? It seems it wasn't updated in a while and also when i want to build it, it says it cannot import asyncio, which i checked and there is no library like that, maybe it changed the name in the past |
18:42:55 | FromDiscord | <gerwy> i guess it could be `asyncdispatch` |
18:43:15 | FromDiscord | <enthus1ast> or who else has access to server logs \:) |
18:43:15 | FromDiscord | <enthus1ast> i can reproduce this\: |
18:43:16 | FromDiscord | <enthus1ast> image.png https://media.discordapp.net/attachments/371759389889003532/889220111515418644/image.png |
18:44:22 | FromDiscord | <gerwy> i have access to forum normally |
18:44:46 | FromDiscord | <gerwy> (edit) removed "normally" |
18:47:38 | FromDiscord | <dom96> In reply to @Gumber "<@!132595483838251008> really? can we": save gif -> reupload and it should work |
18:48:06 | FromDiscord | <dom96> enthus1ast: report it on the issue tracker |
18:48:23 | FromDiscord | <Yardanico> In reply to @Life Sucks "Hi is Aporia still": it haven't been maintained for a long time, so even after you fix all deprecated/removed code (I did a bit of that in my fork around a year ago) a lot of stuff might still not work |
18:48:25 | FromDiscord | <Yardanico> also it relies on gtk2 |
18:48:33 | FromDiscord | <dom96> In reply to @Life Sucks "Hi is Aporia still": Aporia is quite old by now |
18:48:40 | FromDiscord | <gerwy> :< |
18:48:47 | FromDiscord | <gerwy> It seemed like a cool project |
18:48:47 | FromDiscord | <enthus1ast> should i report a live crash on the issue tracker? @dom96 ? |
18:49:16 | FromDiscord | <dom96> sure, there are others already there |
18:49:19 | FromDiscord | <dom96> PRs welcome π |
18:49:56 | FromDiscord | <enthus1ast> ok |
18:50:35 | FromDiscord | <enthus1ast> i mean if someone wants evil to nim project, the forum would be down all the time ;) |
18:51:31 | FromDiscord | <dom96> yeah, maybe |
18:52:03 | FromDiscord | <dom96> I'd probably just configure nginx to disallow those requests |
18:53:00 | FromDiscord | <enthus1ast> in my case its nothing special, i even don't know exactly if i crash it |
18:53:10 | FromDiscord | <enthus1ast> it seems like |
18:53:25 | FromDiscord | <enthus1ast> maybe you can see it in the server logs |
18:53:39 | FromDiscord | <enthus1ast> if it was restarted by systemd? |
18:54:11 | FromDiscord | <dom96> I can but not right now |
18:54:32 | FromDiscord | <enthus1ast> ok |
18:58:10 | FromDiscord | <Smarc> sent a code paste, see https://play.nim-lang.org/#ix=3znh |
18:58:34 | * | max22- joined #nim |
18:59:22 | FromDiscord | <Yardanico> that library are you using for sounds? |
18:59:30 | FromDiscord | <Smarc> slappy |
18:59:46 | FromDiscord | <Yardanico> but generally the error is because you're using a global variable in another thread, and nim with the default GC (refc) has thread-local heap |
18:59:58 | FromDiscord | <Yardanico> In reply to @Smarc "slappy": does it actually support threading? |
19:00:53 | FromDiscord | <Smarc> Hm it doesn't mention it in the readme, so I don't really know.. |
19:01:24 | FromDiscord | <dom96> Try to avoid globals if possible |
19:02:39 | FromDiscord | <Smarc> sent a code paste, see https://play.nim-lang.org/#ix=3znk |
19:02:45 | FromDiscord | <Smarc> So I guess slappy is not suited for threading? Is is there some way around? |
19:03:37 | FromDiscord | <Yardanico> try using --gc:orc and wrap the code that errors with a {.cast(gcsafe).} block |
19:03:52 | FromDiscord | <Yardanico> sent a code paste, see https://play.nim-lang.org/#ix=3znl |
19:04:24 | FromDiscord | <Yardanico> see https://nim-lang.org/docs/manual.html#threads-gc-safety |
19:04:53 | FromDiscord | <Smarc> same result unfortunately |
19:06:47 | FromDiscord | <Yardanico> can you show the code? |
19:07:30 | FromDiscord | <enthus1ast> @Smarc maybe give the thread the path to the audio file to play |
19:07:39 | FromDiscord | <Smarc> sent a code paste, see https://play.nim-lang.org/#ix=3znm |
19:07:40 | FromDiscord | <Yardanico> nonono |
19:07:47 | FromDiscord | <Yardanico> you should put the cast inside the proc |
19:08:00 | FromDiscord | <Smarc> oh |
19:08:06 | FromDiscord | <Yardanico> and compile with --gc:orc |
19:09:26 | FromDiscord | <Smarc> It compiles and runs! Thank you for your help guys :) |
19:09:43 | FromDiscord | <Yardanico> just be careful, if you use same global variables from different threads at the same time you need locks |
19:10:01 | FromDiscord | <Smarc> Although the random offset does not really work out, since the file are a bunch of clicking-sounds and sometimes it (obviously) just plays the ending noise |
19:10:13 | FromDiscord | <Smarc> But I did not find a better way to work with an ogg file |
19:10:18 | FromDiscord | <dom96> ORC still isn't gc-safe, right? |
19:10:27 | FromDiscord | <Yardanico> In reply to @dom96 "ORC still isn't gc-safe,": it depends on what you mean by that |
19:10:37 | FromDiscord | <dom96> I'm wondering whether it's safe to do that cast |
19:10:39 | FromDiscord | <Yardanico> current gcsafe analysis is incorrect for gc:orc as you can use global variables in different threads, you just need locking |
19:10:39 | FromDiscord | <dom96> with ORC |
19:10:55 | FromDiscord | <Yardanico> to not read/write same variable from different threads at the same time |
19:11:01 | FromDiscord | <Yardanico> arc/orc have a shared heap |
19:11:05 | FromDiscord | <dom96> afaik you still cannot because allocs/deallocs aren't atomic |
19:11:14 | FromDiscord | <Yardanico> wdym? |
19:11:18 | FromDiscord | <Yardanico> it's a shared heap |
19:11:29 | FromDiscord | <dom96> you still need to use alloc0 etc. for shared heap |
19:11:33 | FromDiscord | <Yardanico> no |
19:11:35 | FromDiscord | <dom96> (edit) "alloc0" => "allocShared" |
19:11:43 | FromDiscord | <Yardanico> arc/orc with --threads:on use a shared heap by default |
19:11:54 | FromDiscord | <dom96> do you have any sources/docs for this? |
19:12:35 | FromDiscord | <Yardanico> https://nim-lang.org/docs/gc.html |
19:13:05 | FromDiscord | <Yardanico> it has been thoroughly discussed before in forum threads, and it's one of the advantages of arc/orc over refc |
19:13:30 | FromDiscord | <Yardanico> https://forum.nim-lang.org/t/6549 |
19:13:35 | FromDiscord | <Yardanico> "Offers a shared heap. Enabled via --threads:on." |
19:14:33 | FromDiscord | <dom96> right, and then there is: https://forum.nim-lang.org/t/6549#43004 |
19:15:10 | FromDiscord | <Yardanico> yes, so as I said you need to use locks |
19:15:15 | FromDiscord | <Yardanico> if you access the same variable from multiple threads |
19:15:28 | FromDiscord | <Yardanico> or atomics of course |
19:15:37 | FromDiscord | <dom96> what if Nim decrements the ref count outside my lock? |
19:17:11 | FromDiscord | <dom96> also I discussed this earlier today which gave me the message that this isn't safe https://irclogs.nim-lang.org/19-09-2021.html#12:56:36 |
19:17:29 | FromDiscord | <dom96> CC @Gumber aka Zachary Carter |
19:17:36 | FromDiscord | <Yardanico> "but you still have to use locks and other concurrency primitives" |
19:17:40 | FromDiscord | <Yardanico> as I said, you have to use locks |
19:17:57 | FromDiscord | <Gumber> I mean by nature it's unsafe |
19:18:08 | FromDiscord | <Gumber> you can never be certain about what is reading or writing to that memory |
19:18:17 | FromDiscord | <Gumber> unless you use concurrency primitives to synchronize those actions |
19:18:35 | FromDiscord | <Gumber> you also can't be certain about the order in which code will execute in critical sections a lot of time |
19:18:53 | FromDiscord | <Gumber> so yeah - sharing memory between threads without thinking about these things will almost always result in data races or dead locks |
19:19:05 | FromDiscord | <Gumber> and just slapping on locks isn't going to help unless you understand what you're doing |
19:19:20 | FromDiscord | <Gumber> you need to understand how system threads behave and how they're implemented to some degree along with schedulers |
19:19:23 | FromDiscord | <Gumber> on the OS |
19:19:33 | FromDiscord | <Gumber> and you need to understand about thread contention etc... |
19:19:56 | FromDiscord | <Gumber> so there's a lot to learn - I don't know half of it but you have to start somewhere if you want to eventually understand everything about the topic |
19:23:27 | FromDiscord | <dom96> we need an article about this |
19:23:40 | FromDiscord | <dom96> and possibly a change to Nim so that it gives clearer warnings |
19:23:52 | FromDiscord | <Gumber> it's not a specific Nim thing |
19:23:53 | FromDiscord | <Gumber> though |
19:24:01 | FromDiscord | <dom96> Like: "This is unsafe under --gc:default, but is fine under --gc:orc" |
19:24:03 | FromDiscord | <Gumber> it's any language that has the capability to schedule system threads on the OS |
19:24:16 | FromDiscord | <Gumber> sharing memory between threads isn't safe on the default gc either |
19:24:17 | FromDiscord | <dom96> yes, but I only worry about this gc safety concept |
19:24:19 | FromDiscord | <Gumber> only if you use channels |
19:24:22 | FromDiscord | <dom96> which most other languages don't have |
19:24:33 | FromDiscord | <Gumber> on the default gc every thread has its own local heap |
19:26:11 | FromDiscord | <Gumber> so you allocate memory on the thread heap |
19:26:27 | FromDiscord | <Gumber> and then if you want another thread to be able to use it you have to pass it to that thread as a pointer or through a channel |
19:26:51 | FromDiscord | <Gumber> and it will be copied if it goes through a channel |
19:27:08 | FromDiscord | <Gumber> so if you don't pass a ref or a pointer through the channel |
19:27:14 | FromDiscord | <Gumber> it will pass a copy of whatever is in memory there |
19:27:18 | FromDiscord | <Gumber> now... |
19:27:40 | FromDiscord | <Gumber> the GC knows the ref count on the object went up but it isnt' aware it crossed thread boundaries |
19:27:56 | FromDiscord | <Gumber> so you need to think about how that could cause issues |
19:28:08 | FromDiscord | <Gumber> another thing is - if you have let's say a separate Nim process that you're loading symbols from |
19:28:18 | FromDiscord | <Gumber> let's say you compile your Nim code to a shared library (dll on windows) (so on linux) |
19:28:36 | FromDiscord | <Gumber> and you're `dlopen` `dlclose` ing symbols from that library |
19:28:42 | FromDiscord | <Gumber> like you might do in let's say a plugin architecture |
19:28:53 | FromDiscord | <Gumber> each Nim process is going to have it's own runtime and own GC |
19:28:59 | FromDiscord | <Gumber> and they're not going to be aware of one another |
19:29:12 | FromDiscord | <dom96> okay, I think I see it more clearly now |
19:29:15 | FromDiscord | <Gumber> so you could have them stomping on eachother and collecding memory from eachother |
19:29:27 | FromDiscord | <Gumber> to mitigate this - Nim had this flag like `-d:useNimRealtimeRTL` or something |
19:29:39 | FromDiscord | <Gumber> and it would prevent this situation from happening - but then half the stdlib wouldn't work |
19:29:49 | FromDiscord | <Gumber> so yeah - this is the problem summarized as concisely as I can |
19:29:52 | FromDiscord | <dom96> so I think still, with arc/orc you need to be careful. It all depends where Nim adds code to inc/dev ref count |
19:29:54 | FromDiscord | <dom96> (edit) "inc/dev" => "inc/dec" |
19:30:01 | FromDiscord | <Gumber> if your'e passing GC'd refs yes |
19:30:09 | FromDiscord | <Gumber> if you're passing pointers |
19:30:13 | FromDiscord | <Gumber> you don't need to worry about it |
19:30:22 | FromDiscord | <Gumber> and even with GC'd refs you'll need locks etc |
19:30:33 | FromDiscord | <Gumber> unless you use channels |
19:30:34 | FromDiscord | <dom96> well, you do because your pointer could be freed from under you |
19:30:47 | FromDiscord | <Gumber> I mean you don't need to worry about incrementing any ref count |
19:30:58 | FromDiscord | <Gumber> your pointer assuming it's not GC traced won't be freed by the runtime |
19:31:02 | FromDiscord | <Gumber> you're responsible for freeing it |
19:31:12 | FromDiscord | <Gumber> because you allocated it or something you called did |
19:31:26 | FromDiscord | <dom96> That's assuming you alloc it yourself, I thought you meant: pass a pointer to a GC ref |
19:31:32 | FromDiscord | <Gumber> well yeah |
19:31:38 | FromDiscord | <Gumber> but that's not what I meant by pointer |
19:31:41 | FromDiscord | <Gumber> I meant raw pointer |
19:31:49 | FromDiscord | <Gumber> with a pointer to a GC ref yes you still have to inc and dec ref counts |
19:31:58 | FromDiscord | <Gumber> and it gets tricky because when you start nesting objects |
19:32:09 | FromDiscord | <Gumber> you need to think about that too |
19:32:18 | FromDiscord | <Gumber> IMO unless the runtime has a way to generate all that stuff for you |
19:32:21 | FromDiscord | <Gumber> it's way easier to just use pointers |
19:32:26 | FromDiscord | <Gumber> and alloc the memory yourself |
19:32:31 | FromDiscord | <Gumber> way less of a headache |
19:32:31 | FromDiscord | <dom96> right, just forget about pointers |
19:32:38 | FromDiscord | <dom96> and any other unsafe Nim features |
19:32:42 | FromDiscord | <Gumber> I mean I use them constantly so |
19:32:52 | FromDiscord | <Gumber> but I also know what I'm doing π |
19:32:58 | FromDiscord | <Gumber> most of the time anyway |
19:33:14 | FromDiscord | <dom96> if I have a global ref in ARC/ORC then I need to make sure any thread touching it has a lock around it |
19:33:24 | FromDiscord | <Gumber> no not necessarily |
19:33:51 | FromDiscord | <Gumber> if things are just reading from memory and the underlying memory isn't being touched by any other thread |
19:33:55 | FromDiscord | <Gumber> then a lock would just cause issues |
19:33:59 | FromDiscord | <Gumber> and contention around the reads |
19:34:17 | FromDiscord | <Gumber> see this is why multithreaded programming is hard |
19:34:25 | FromDiscord | <Gumber> it's not like a pattern you can just apply everywhere |
19:34:27 | FromDiscord | <Gumber> or a few patterns |
19:34:43 | FromDiscord | <Gumber> it's like every situation where you want to toss threads at a problem - you really need to think deeply about what's happening at the system level |
19:35:00 | FromDiscord | <Gumber> and if you dont' grokk that you're probably not going to be using threads very sucessfully |
19:35:09 | FromDiscord | <Gumber> (edit) "dont' grokk" => "don't grok" |
19:35:10 | FromDiscord | <dom96> even if you're just reading you're still changing the ref count though afaik |
19:35:18 | FromDiscord | <dom96> so you will need a lock |
19:35:34 | FromDiscord | <dom96> I don't have a clear idea of when exactly ref counts change though |
19:35:40 | FromDiscord | <Gumber> okay in the case where we have a reference counting gc yes |
19:35:57 | FromDiscord | <Gumber> and now you're basically doing atomic reference counting |
19:36:06 | FromDiscord | <Gumber> π |
19:36:53 | FromDiscord | <Gumber> just instead of synchronizing the ref count mutation with a lock |
19:36:57 | FromDiscord | <Gumber> you use an atomic |
19:37:08 | FromDiscord | <dom96> yeah, and this is imo the source of the unsafety |
19:37:11 | FromDiscord | <Gumber> and that gets really really hariy because atomics are implemented with different builtins |
19:37:17 | FromDiscord | <dom96> (edit) "imo" => "afaik" |
19:37:31 | FromDiscord | <dom96> arc/orc really should support atomic ref counts |
19:37:32 | FromDiscord | <Gumber> it's not the source of the unsafety |
19:37:36 | FromDiscord | <Gumber> no it shouldn't |
19:37:38 | FromDiscord | <Gumber> because it's slow |
19:37:41 | FromDiscord | <Gumber> you can add it if you want |
19:37:50 | FromDiscord | <Gumber> but I don't want it - I have zero desire for atomic ref counting |
19:38:00 | FromDiscord | <Gumber> and would immediately stop game programming with nim it it were added and made mandatory |
19:38:13 | FromDiscord | <Gumber> I'd stop using Nim alltogether |
19:38:24 | FromDiscord | <Gumber> (edit) "alltogether" => "all together" |
19:38:24 | FromDiscord | <dom96> it doesn't necessarily have to be forced on every ref, I'm sure there are some approaches that only apply it to shared memory |
19:38:29 | FromDiscord | <Gumber> no |
19:38:33 | FromDiscord | <Gumber> I don't want it on any shared memory lol |
19:38:39 | FromDiscord | <Gumber> I want control |
19:38:44 | FromDiscord | <dom96> well then you can use pointers |
19:38:48 | FromDiscord | <Gumber> I dont' want the runtime doing things for me that I don't have say over |
19:39:05 | FromDiscord | <Gumber> look arc is useful already without atomic ref counting |
19:39:07 | FromDiscord | <Gumber> I say that if youwa nt it |
19:39:13 | FromDiscord | <Gumber> add it in via a macro or someting |
19:39:16 | FromDiscord | <Gumber> or something in userland |
19:39:21 | FromDiscord | <Gumber> don't add it into the language and compiler |
19:39:35 | FromDiscord | <Gumber> that's where apple fucked up with Swift |
19:39:41 | FromDiscord | <Gumber> well one place anyway |
19:39:51 | FromDiscord | <Gumber> also if we just wanted atomic reference counting |
19:39:57 | FromDiscord | <Gumber> araq wouldn't have had to spend years figuring out ARC / ORC |
19:40:14 | FromDiscord | <dom96> IMO this sort of thing is what makes threading in Nim more complex than in other languages |
19:40:22 | FromDiscord | <Gumber> it's not more complex though in other languages |
19:40:28 | FromDiscord | <Gumber> other languages just have different concurrency model |
19:40:31 | FromDiscord | <Gumber> s |
19:40:33 | FromDiscord | <Gumber> Nim isn't trying to win that game and never has |
19:40:40 | FromDiscord | <Gumber> Nim isn't pony or erlang |
19:40:45 | FromDiscord | <Gumber> and I'm glad for it |
19:40:52 | FromDiscord | <Gumber> Nim is like a swiss army knife |
19:41:11 | FromDiscord | <Gumber> you start making mandates on the runtime like that and you're going to lose a lot of users and contributors |
19:41:23 | FromDiscord | <Gumber> atomic ref counting was avoided exactly because it's slow |
19:41:40 | FromDiscord | <Gumber> and araq saw what happened with swift as it was happening |
19:41:48 | FromDiscord | <Gumber> you can still achieve memory safety with Nim and ARC/ORC now with threads |
19:41:57 | FromDiscord | <Gumber> you just have to use channels |
19:42:10 | FromDiscord | <Gumber> or you have to write your program in a way that there are no shared reads or writes |
19:42:19 | FromDiscord | <Gumber> so everything is moved / sunk |
19:42:31 | FromDiscord | <dom96> I'm fairly sure shared reads/writes is what most programmers expect to be easy |
19:42:33 | FromDiscord | <Gumber> it's not like there's no way to achieve gc safety you just have to work at it and it's not necessarily easy |
19:42:37 | FromDiscord | <dom96> Right now it isn't easy in Nim and hasn't been ever |
19:42:39 | FromDiscord | <Gumber> they are |
19:42:43 | FromDiscord | <Gumber> but not when it comes to multithreading |
19:42:47 | FromDiscord | <dom96> This is what we need to solve |
19:42:51 | FromDiscord | <Gumber> try to write a multithreaded program in C or C++ or Java |
19:42:54 | FromDiscord | <Gumber> we don't need to |
19:42:56 | FromDiscord | <Gumber> you might need to |
19:43:00 | FromDiscord | <Gumber> but a lot of us don't |
19:43:15 | FromDiscord | <Gumber> a lot of us I think are perfectly happy with the concurrency scene in Nim right now |
19:43:20 | FromDiscord | <dom96> Really? |
19:43:21 | FromDiscord | <Gumber> minus the stdlib features not being there |
19:43:26 | FromDiscord | <Gumber> as far as the building blocks go? yes |
19:43:27 | FromDiscord | <dom96> I feel like everybody is unhappy with it |
19:43:29 | FromDiscord | <Gumber> continuation sare very nice |
19:43:32 | FromDiscord | <Gumber> (edit) "continuation sare" => "continuations are" |
19:43:41 | FromDiscord | <Gumber> I'm not saying the threadpool and spawn and parallel and async are good |
19:43:42 | FromDiscord | <Gumber> they're not |
19:43:52 | FromDiscord | <Gumber> but that's not because the langauge capabiltieis aren't there to make them good |
19:43:53 | FromDiscord | <Gumber> they are |
19:43:55 | FromDiscord | <Gumber> just the implementations are bad |
19:44:02 | FromDiscord | <dom96> Well I disagree |
19:44:06 | FromDiscord | <Gumber> and I'm not trivializing how hard it is to do those things |
19:44:12 | FromDiscord | <Gumber> and make good implementations |
19:44:16 | FromDiscord | <dom96> The language needs to be better here |
19:44:41 | FromDiscord | <Gumber> well I would fight you tooth and nail on a RFC to make atomic ref counting mandatory for the nim runtime |
19:44:55 | FromDiscord | <Gumber> and if it happened (which it wouldn't) like I said, the community would be down one member |
19:44:56 | FromDiscord | <dom96> I'm not saying that is the solution, just one of many |
19:45:10 | FromDiscord | <Gumber> again I don't think there needs to b ea solution |
19:45:14 | FromDiscord | <Gumber> delivered by the language |
19:45:23 | FromDiscord | <Gumber> and if ther eis one |
19:45:25 | FromDiscord | <dom96> Then what do you think needs to be here? |
19:45:26 | FromDiscord | <Gumber> it better be opt-in |
19:45:41 | FromDiscord | <Gumber> a better implementation of threadpool, spawn, parallel and async |
19:45:56 | FromDiscord | <Gumber> maybe not a better implementation of async |
19:46:15 | FromDiscord | <Gumber> but maybe some convenience / sugar / renaming to make it more ergonomic and not as confusing |
19:46:40 | FromDiscord | <Gumber> asyncdispatch has always been really really confusing to new folks |
19:47:49 | FromDiscord | <dom96> better spawn/threadpool won't solve the memory sharing ergonomics |
19:47:53 | FromDiscord | <dom96> I believe that needs to improve |
19:47:55 | FromDiscord | <Gumber> no but one that works would be nice |
19:48:02 | FromDiscord | <dom96> async ergonomics too, stack traces need to be improved a lot |
19:48:10 | FromDiscord | <Gumber> I mean look - no one has figured out a magic way to share memory betwene threads in any language |
19:48:14 | FromDiscord | <Gumber> that doesn't have a huge runtime cost |
19:48:22 | FromDiscord | <Gumber> you're basically saying - I'm going to trade memory safety for a big runtime cost |
19:48:28 | FromDiscord | <dom96> I don't mind _some_ runtime cost |
19:48:31 | FromDiscord | <Gumber> and make that decision for every user of the language |
19:48:32 | FromDiscord | <Gumber> YOU don't |
19:48:36 | FromDiscord | <Gumber> but YOU don't own Nim lol |
19:48:47 | FromDiscord | <dom96> yeah, I can say the same to YOU π |
19:48:52 | FromDiscord | <Gumber> there are a lot of people that write embedded and realtime applications with Nim |
19:49:04 | FromDiscord | <dom96> But really it comes down to how big this runtime cost is |
19:49:05 | FromDiscord | <Gumber> they're not all going to want some new runtime change like atomic ref counting forced on them |
19:49:07 | FromDiscord | <dom96> everything is a tradeoff |
19:49:19 | FromDiscord | <Gumber> yeah but you do realize that when people are writing system level stuff |
19:49:28 | FromDiscord | <Gumber> and again Nim is billed as "a systems level programming lanaguage" |
19:49:34 | FromDiscord | <Gumber> they don't always care about everything being safe |
19:49:39 | FromDiscord | <Gumber> if they did - they'd go use Rust |
19:49:44 | FromDiscord | <Gumber> and deal with that horseshitg |
19:49:48 | FromDiscord | <Gumber> if you want Rust go use Rust lol |
19:49:53 | FromDiscord | <Gumber> or Swift |
19:49:56 | FromDiscord | <Gumber> I mean - I don't know what to tell you |
19:50:13 | FromDiscord | <Gumber> like you're just forgetting about a huge portion of Nim's community |
19:50:17 | FromDiscord | <Gumber> and arguably Nim's most advanced users |
19:50:27 | FromDiscord | <Gumber> in terms of technical and computing knowledge |
19:50:58 | FromDiscord | <Gumber> and you're also talking about a change that would probably break tons of existing code |
19:51:10 | FromDiscord | <Gumber> which is why a userland solution is the best |
19:51:12 | FromDiscord | <dom96> I think you're reading too much into what I'm saying |
19:51:15 | FromDiscord | <Gumber> I'm not |
19:51:26 | FromDiscord | <dom96> It's not like me saying this stuff will change anything |
19:51:26 | FromDiscord | <Gumber> you're talking about changing the default algorithm for the gc |
19:51:30 | FromDiscord | <Gumber> I know it won't |
19:51:41 | FromDiscord | <Gumber> but I'm trying to explain to you why the idea is problematic |
19:51:44 | FromDiscord | <dom96> and I'm not even saying it should be done |
19:51:54 | FromDiscord | <dom96> I don't know what the right approach is |
19:51:56 | FromDiscord | <Gumber> you're saying Nim needs something to improve the concurrency situation |
19:52:02 | FromDiscord | <Gumber> but I"m saying I don't think Nim needs to change |
19:52:09 | FromDiscord | <Gumber> someone needs to write a library or something |
19:52:29 | FromDiscord | <Gumber> figure out how to automate the atomic ref counts |
19:52:36 | FromDiscord | <Gumber> like patch the compiler or something |
19:52:41 | FromDiscord | <Gumber> and make it opt-in only |
19:52:43 | FromDiscord | <Gumber> that'd be fine |
19:52:53 | FromDiscord | <dom96> At the very least Nim does need to change how it communicates GC safety issues |
19:52:56 | FromDiscord | <Gumber> but I imagine you'd get a ton of push back if you tried to mainline it |
19:53:14 | FromDiscord | <Gumber> well yeah - and I think there's probably a lot of effort that's already gone into that |
19:53:29 | FromDiscord | <Gumber> I think the whole like verification tool dr nim or whatever was kind of working towards that goal |
19:53:35 | FromDiscord | <Gumber> static verification tool rather |
19:53:43 | FromDiscord | <Gumber> but I'm not sure where it ended up |
19:54:01 | FromDiscord | <Gumber> I think something like that would be way more beneficial than ARC/ORC |
19:54:11 | FromDiscord | <Gumber> err sorry |
19:54:13 | FromDiscord | <Gumber> I mean atomic ref counting |
19:54:28 | FromDiscord | <Gumber> something where it can just analyze your program at compile time and be like |
19:54:31 | FromDiscord | <Gumber> you have a potential data race here |
19:54:47 | FromDiscord | <Gumber> but that's really difficult to do too |
19:54:52 | FromDiscord | <Gumber> and I'm sure you can imagine why |
20:14:28 | FromDiscord | <QueenFuckingAdrielle> is there proper naming convention for .nim files? snake case, camel case, capitalized... etc |
20:14:40 | FromDiscord | <Yardanico> yes |
20:14:47 | FromDiscord | <QueenFuckingAdrielle> i found the style guide but i didnt see anything about file names unless im just blind |
20:15:14 | FromDiscord | <Yardanico> well generally you either use short single words or snake_case |
20:15:23 | FromDiscord | <Yardanico> but no one's stopping you from using camelCase if you want |
20:15:32 | FromDiscord | <QueenFuckingAdrielle> okay cool, ive been doing snake case |
20:15:34 | FromDiscord | <Yardanico> you can use any name as long as it's a valid nim identifier |
20:16:22 | ehmry | snake case is nice for those that are still using DOS |
20:20:09 | FromDiscord | <Gumber> I tend to follow C style conventions when programming in Nim |
20:20:14 | FromDiscord | <Gumber> it's difficult though |
20:20:19 | FromDiscord | <Gumber> because of Nim's handling of underscores |
20:20:24 | FromDiscord | <Gumber> or lacktherof I guess |
20:20:47 | FromDiscord | <Gumber> lately I've been migrating to using C++ style mixed with some functional brevity that Nim has which is nice |
20:20:51 | FromDiscord | <Gumber> like omitting parens etc |
20:20:59 | FromDiscord | <Gumber> I think the most important thing is you should decide on a style and stick to it |
20:21:06 | FromDiscord | <Gumber> because Nim has a lot of options for how you can style your code |
20:21:20 | FromDiscord | <Gumber> and if you're not consistent you end up with a codebase that isn't at all uniform and looks like it was written while someone was high |
20:21:34 | FromDiscord | <QueenFuckingAdrielle> lol |
20:21:57 | FromDiscord | <QueenFuckingAdrielle> yea, ive been torn on my programming paradigms as well |
20:22:53 | FromDiscord | <QueenFuckingAdrielle> there are so many ways to code with nim, I love it, but now that i have more freedom with it I have to ask myself what i think is good form |
20:23:18 | FromDiscord | <Gumber> yeah like I think it all boils down to your personal preferences and wha tother language you program in |
20:23:26 | FromDiscord | <Gumber> I came from Java and hated object oriented programming after it |
20:23:33 | FromDiscord | <Gumber> I wanted to learn C/C++ so I used Nim kind of as a brdige |
20:23:33 | FromDiscord | <QueenFuckingAdrielle> yea i hate oop as well |
20:23:35 | FromDiscord | <Gumber> bridge |
20:23:41 | FromDiscord | <Gumber> once I learned C I started to code my Nim like I wrote my C |
20:23:47 | FromDiscord | <QueenFuckingAdrielle> ah gotcha |
20:23:49 | FromDiscord | <Gumber> and now that I interop mostly with C++ and a mix of C |
20:24:05 | FromDiscord | <Gumber> I've started adopting C++ style conventions just because it's a bit more idiomatic I feel like given the rest of the Nim community |
20:24:26 | FromDiscord | <Gumber> everyone likes the universal function call syntax |
20:24:32 | FromDiscord | <QueenFuckingAdrielle> I went java (school only) - > python -> c -> cython -> nim |
20:24:35 | FromDiscord | <Gumber> so instead of like the C style where you go like |
20:24:48 | FromDiscord | <Gumber> `function(object_function_belongs_to, param_one, param_two);` |
20:24:56 | FromDiscord | <Gumber> Nim can also do |
20:25:07 | FromDiscord | <Gumber> `object_function_belongs_to.function(param_one, param_two);` |
20:25:12 | FromDiscord | <Gumber> like C++ and other OOP languages |
20:25:21 | FromDiscord | <Gumber> both are equivalent |
20:25:24 | FromDiscord | <QueenFuckingAdrielle> ah gotcha, i def prefer the first |
20:25:30 | FromDiscord | <Gumber> I did for a long time too |
20:25:37 | FromDiscord | <Gumber> when it comes to naming constants for instance |
20:25:54 | FromDiscord | <Gumber> like in C world you see `const int MY_CONSTANT = 1` |
20:26:05 | FromDiscord | <QueenFuckingAdrielle> i like objects and functions to be separate, with very simple object types |
20:26:07 | FromDiscord | <Gumber> and you will see people declare consts like that in Nim |
20:26:30 | FromDiscord | <Gumber> but a lot of people just use `const MyConstant = 1` or `const myConstant = 1` |
20:26:42 | FromDiscord | <Gumber> there's no real consistent standard across the community - it's all just individual preference |
20:26:45 | FromDiscord | <Gumber> but the important thing is to be consistent |
20:26:58 | FromDiscord | <Gumber> and using a tool like nimpretty can at least help with enforcing spacing and things like that |
20:27:07 | FromDiscord | <QueenFuckingAdrielle> i think thats good, brings out more innovation. |
20:27:12 | FromDiscord | <Gumber> also - just like a protip and something that I think everyone eventually ends up doing |
20:27:18 | FromDiscord | <Gumber> don't use four spaces to indent use two |
20:27:22 | FromDiscord | <Gumber> and obviously no tabs |
20:27:25 | FromDiscord | <Gumber> tabs and Nim don't mix |
20:27:28 | FromDiscord | <QueenFuckingAdrielle> yea i use 2 spaces |
20:27:39 | FromDiscord | <QueenFuckingAdrielle> i love that about nim |
20:27:41 | FromDiscord | <Gumber> some people use four and it's maddening |
20:27:49 | FromDiscord | <dom96> In reply to @Gumber "some people use four": yessss |
20:27:51 | FromDiscord | <Gumber> like - why do you want so much extra whitespace for your eyes to have to gloss over |
20:27:53 | FromDiscord | <QueenFuckingAdrielle> lol yea i think it looks cruddy |
20:27:58 | FromDiscord | <Gumber> it's just more strain on the eyes I think |
20:28:06 | FromDiscord | <Gumber> if you read from right to left anyway |
20:28:11 | FromDiscord | <Gumber> errr |
20:28:12 | FromDiscord | <Gumber> left to right sorry |
20:28:14 | FromDiscord | <QueenFuckingAdrielle> lol |
20:28:16 | FromDiscord | <QueenFuckingAdrielle> yea |
20:28:17 | FromDiscord | <Gumber> brain got confused for a sec |
20:28:55 | FromDiscord | <QueenFuckingAdrielle> ive been putting off figure out how to use cuda kernels and opencl in this project for the longest time |
20:29:03 | FromDiscord | <Gumber> ooph sounds not fun |
20:29:03 | FromDiscord | <QueenFuckingAdrielle> ill have to deal with it soon enough haha |
20:29:16 | FromDiscord | <Gumber> I'm glad I don't have to mess with CUDA as a game programmer |
20:29:23 | FromDiscord | <Gumber> I mean I guess i could if I really wanted to experience pain in life |
20:29:28 | FromDiscord | <Gumber> like there are certainly appliactions |
20:29:32 | FromDiscord | <Gumber> I could invent or find |
20:29:38 | FromDiscord | <QueenFuckingAdrielle> yea, you guys get to have fun with vulkan π jk |
20:29:41 | FromDiscord | <Gumber> but it's by no means necessary |
20:30:03 | FromDiscord | <Gumber> yeah I'm actually like growing a gray hair right as I type this because of Vulkan and how many gd layers of C and C++ I"m calling in and out of from my nNim code |
20:30:08 | FromDiscord | <QueenFuckingAdrielle> i tried learning vulkan and it was the hardest package/api ive ever tried. I just gave up lol |
20:30:40 | FromDiscord | <Gumber> I use Vuklan in combination with https://github.com/charles-lunarg/vk-bootstrap and https://github.com/martty/vuk |
20:30:55 | FromDiscord | <QueenFuckingAdrielle> i have an indie game I'm working on but its engine based |
20:30:58 | FromDiscord | <Gumber> and `vuk` uses a bunch of ther libraries like `spirv-cross` and `shaderc` and `vulkan-memory-allocator` etc... |
20:31:05 | FromDiscord | <Gumber> yeah I write / roll all my own tech |
20:31:09 | FromDiscord | <Gumber> I mean to a certain point |
20:31:12 | FromDiscord | <QueenFuckingAdrielle> nice |
20:31:31 | FromDiscord | <Gumber> but I've been doing this for close to sixteen years at this point so.... |
20:31:33 | FromDiscord | <QueenFuckingAdrielle> im primarily an hpc/deeplearning person |
20:31:39 | FromDiscord | <Gumber> ah cool |
20:31:47 | FromDiscord | <Gumber> there are some other folks in Nim that are really into that stuff |
20:31:55 | FromDiscord | <Gumber> should check out the #science community channel |
20:32:00 | FromDiscord | <Gumber> I think those nerds hang out in there |
20:32:02 | FromDiscord | <Gumber> (just kidding) |
20:32:03 | * | def- quit (Quit: -) |
20:32:08 | FromDiscord | <QueenFuckingAdrielle> yea ive met a few, this is a very cool community for it |
20:32:09 | FromDiscord | <QueenFuckingAdrielle> lol |
20:32:13 | * | def- joined #nim |
20:32:25 | FromDiscord | <Gumber> yeah - I've been an active member of the Nim community since like 2015? |
20:32:28 | FromDiscord | <Gumber> maybe the tail end of 2014 |
20:32:33 | FromDiscord | <Gumber> some good people here |
20:32:34 | FromDiscord | <Gumber> for sure |
20:32:43 | FromDiscord | <Gumber> some really smart one stoo |
20:32:53 | FromDiscord | <Gumber> like they will make your head hurt smart |
20:32:56 | FromDiscord | <QueenFuckingAdrielle> ive been working on a robotics framework in nim+c+python for like 3 years now |
20:33:03 | FromDiscord | <Gumber> (edit) "one stoo" => "ones too" |
20:33:11 | FromDiscord | <Gumber> sounds neat |
20:33:17 | FromDiscord | <Gumber> yeah Nim is great for embedded stuff too |
20:33:29 | FromDiscord | <Gumber> got a whole IoT scene in one channel I think |
20:33:30 | FromDiscord | <QueenFuckingAdrielle> yea I had to take a break for some other research consulting i was doing |
20:33:38 | FromDiscord | <Gumber> oh yeah - #embedded haha |
20:33:43 | FromDiscord | <Gumber> gotcha |
20:33:52 | FromDiscord | <QueenFuckingAdrielle> mainly deeplearning+covid research |
20:33:56 | FromDiscord | <Gumber> yeah I wish I was more into robotics and FGPAs and deep learning and stuff like that |
20:34:07 | FromDiscord | <Gumber> it's just like not enough time in the universe for me to do everything I want / am interested in exploring |
20:34:13 | FromDiscord | <Gumber> and games are challenging enough |
20:34:16 | FromDiscord | <QueenFuckingAdrielle> yea i hear you lol |
20:34:21 | FromDiscord | <Gumber> oh covid research huh? |
20:34:23 | FromDiscord | <QueenFuckingAdrielle> i have a million hobbies |
20:34:24 | FromDiscord | <Gumber> should have talked to me last week |
20:34:26 | FromDiscord | <QueenFuckingAdrielle> yea |
20:34:29 | FromDiscord | <Gumber> I would have been a great source of information |
20:34:31 | FromDiscord | <Gumber> or data |
20:34:39 | FromDiscord | <QueenFuckingAdrielle> ugh oh lol |
20:34:44 | FromDiscord | <QueenFuckingAdrielle> how are you doing now? |
20:34:45 | FromDiscord | <Gumber> can talk to my wife right now if you want lol |
20:34:47 | FromDiscord | <Gumber> she' sin bed with it |
20:34:54 | FromDiscord | <Gumber> I'm fine - have some weird ass lingering leftover symptoms |
20:35:05 | FromDiscord | <QueenFuckingAdrielle> yea my gf and i both caught it at the same time about a year ago |
20:35:08 | FromDiscord | <Gumber> like I feel like my blood pressure is elevated a bit and I have some weird GI issues |
20:35:19 | FromDiscord | <Gumber> like I feel bloated all the time |
20:35:22 | FromDiscord | <QueenFuckingAdrielle> yep i remember that, screw that |
20:35:25 | FromDiscord | <Gumber> but other than that I'm good - there was one day that was scary |
20:35:42 | FromDiscord | <Gumber> but I did it to myself - I had a really bad post nasal drip and a dry cough so like not productive at all |
20:35:53 | FromDiscord | <Gumber> I woke up and took some dayquick - that was mistake number one |
20:36:06 | FromDiscord | <Gumber> the cough supressant made it so I couldn't cough up anything, so my chest was just filling up with mucus |
20:36:13 | FromDiscord | <QueenFuckingAdrielle> oh god |
20:36:16 | FromDiscord | <Gumber> then when that was wearing off I was like - I need an expectorant |
20:36:18 | FromDiscord | <Gumber> some mucienx |
20:36:38 | FromDiscord | <Gumber> so I go to the store - parents call me to ask how I"m doing, tell them I'm getting mucinex and they're like oh make sure you get the dm stuff it will help out so much |
20:36:48 | FromDiscord | <Gumber> don't really look at it too much get some mucinex DM from the drive through pharmacy thing |
20:36:51 | FromDiscord | <Gumber> take that |
20:37:00 | FromDiscord | <Gumber> for like an hour or so I can coughs tuff up and life is okay again |
20:37:02 | FromDiscord | <mratsim> where am I :? |
20:37:06 | FromDiscord | <QueenFuckingAdrielle> yea i stayed away from cough/cold medicine when i had it |
20:37:09 | FromDiscord | <Yardanico> is this #main ? π€ |
20:37:10 | FromDiscord | <QueenFuckingAdrielle> lol |
20:37:13 | FromDiscord | <Yardanico> i thought it was #covid-discussion |
20:37:14 | FromDiscord | <Gumber> but then it starts happening again and I slowly realize I took cough suppressant AGAIN |
20:37:19 | FromDiscord | <QueenFuckingAdrielle> lol |
20:37:20 | FromDiscord | <Gumber> well we WERE talking about Nim |
20:37:22 | FromDiscord | <Gumber> we were the only ones |
20:37:28 | FromDiscord | <Gumber> now it's off topic an deveryone wants to have a fit |
20:37:37 | FromDiscord | <Yardanico> but you know, if you do a lot of offtopic #offtopic might be better suited |
20:37:47 | FromDiscord | <Gumber> you guys are like fair weather admmins / mods |
20:37:55 | FromDiscord | <QueenFuckingAdrielle> lol |
20:37:57 | FromDiscord | <Gumber> and I'm a mod |
20:38:06 | FromDiscord | <Gumber> you made me one! |
20:38:21 | FromDiscord | <QueenFuckingAdrielle> I'm just weird goth chick |
20:38:24 | FromDiscord | <Gumber> but anyway yeah - long story short (not really) don't take cough supressant if you can't cough stuff up and have covid |
20:38:28 | FromDiscord | <QueenFuckingAdrielle> i dont live here |
20:38:47 | FromDiscord | <Gumber> and Nim discussion can resume - because I'm going outside to finish mowing the lawn |
20:39:01 | FromDiscord | <QueenFuckingAdrielle> good talking tho, catch ya later |
20:57:25 | nrds | <Prestige99> Hey @Elegantbeef would you be available to voice chat some point today? Messing around with another implementation of the animation code, would like to poke your brain |
20:58:03 | FromDiscord | <Gumber> In reply to @nrds "<Prestige> Hey <@145405730571288577> would": sounds hot |
20:58:05 | FromDiscord | <Elegantbeef> Probably |
20:58:10 | FromDiscord | <Gumber> I'm kidding, I'm kidding.... |
20:58:13 | nrds | <Prestige99> Lol |
20:58:27 | FromDiscord | <Gumber> I'm a 12 year old trapped in a 36 year old body |
20:58:29 | FromDiscord | <Gumber> I apologize |
20:58:29 | FromDiscord | <Elegantbeef> We were only going to have a steamy shower with webcams, you'd probably like it |
20:58:46 | nrds | <Prestige99> I thought we were doing a hottub stream this time |
20:58:56 | FromDiscord | <Elegantbeef> That's next week |
20:59:03 | FromDiscord | <Gumber> patience is a virtue |
20:59:40 | FromDiscord | <SivadNai> if you can afford to wait |
21:01:06 | FromDiscord | <Gumber> next week is the most difficult week of my life |
21:01:21 | FromDiscord | <Gumber> also I think I won this thread - https://forum.nim-lang.org/t/8440 |
21:01:27 | FromDiscord | <Gumber> I'm (carterza) |
21:01:55 | FromDiscord | <SivadNai> what does the @ char mean in Nim? (sorry to talk code) |
21:02:11 | FromDiscord | <Gumber> it's an operator take an array and create a sequence from it |
21:02:28 | FromDiscord | <Gumber> but I mean you could overload it to do whatever you wanted |
21:02:41 | FromDiscord | <Gumber> though that's what it's implementation provides by default in the stdlib |
21:02:46 | FromDiscord | <haxscramper> `typeof([1,2,3]) is array[3, int]`, `typeof(@[1,2,3]) is seq[int])` |
21:03:06 | FromDiscord | <Elegantbeef> `@` is just an operator it can do anything but unary on array turns into seq |
21:03:27 | FromDiscord | <SivadNai> okay that makes sense, I was looking at a CLR example in winim with @ Process |
21:04:43 | FromDiscord | <SivadNai> I've only seen it with seq before, clearly haven't coded enough |
21:04:44 | * | Vladar quit (Quit: Leaving) |
21:08:23 | FromDiscord | <Elegantbeef> @dain\: i did add the smart module/type level stuff for use if interested https://play.nim-lang.org/#ix=3znM |
21:10:50 | FromDiscord | <dain> thanks |
21:11:13 | FromDiscord | <dain> you should write that up somewhere, it seems to be quite obscure |
21:11:50 | FromDiscord | <Elegantbeef> Yea i really should make some more written tutorials for macros |
21:12:02 | FromDiscord | <Elegantbeef> Or even a vidja |
21:14:21 | FromDiscord | <dain> yeah i'm making some notes for how you port the python with statement using a macro |
21:14:42 | FromDiscord | <dain> i know there are forum posts about that already but im trying to match python's semantics more closely, and also extend it to do more things |
21:14:45 | FromDiscord | <dain> like have a return value |
21:15:50 | FromDiscord | <dain> for macros there needs to be more stuff in the topright quadrant from here https://documentation.divio.com/ |
21:15:58 | FromDiscord | <Elegantbeef> With the use macro one major issue is that nim has an implicit `result` variable so to have a return value with use requires some fancy logic to not have to use return everywhere |
21:16:27 | FromDiscord | <Elegantbeef> I agree and i'm probably one of the people to do it given the amount of macros i throw out for people in here π |
21:17:53 | FromDiscord | <dain> i really like this post and i think there need to be more like it https://nim-lang.org/blog/2021/03/10/fusion-and-pattern-matching.html |
21:18:11 | FromDiscord | <dain> except that one is waaay complicated and is also explaining two things at once (pattern matching and macros) |
21:18:21 | FromDiscord | <Elegantbeef> Yea all i've got is https://dev.to/beef331/demystification-of-macros-in-nim-13n8 |
21:18:36 | FromDiscord | <dain> i think it would be good to have a series of posts that are like: here is a feature from language X, and this is how you port it to nim |
21:18:48 | FromDiscord | <Elegantbeef> I could do as such |
21:18:51 | FromDiscord | <dain> they don't have to be complicated either, it could just be a 4 line template |
21:18:56 | FromDiscord | <Elegantbeef> Can you get me a list of features? π |
21:19:19 | FromDiscord | <dain> ha, well there's the with statement like I said |
21:20:08 | FromDiscord | <dain> sent a code paste, see https://play.nim-lang.org/#ix=3znN |
21:20:47 | FromDiscord | <Elegantbeef> Was super confused about that case statement for a good second or two π |
21:20:55 | FromDiscord | <Elegantbeef> You're using matching |
21:21:04 | FromDiscord | <dain> yeah |
21:21:15 | FromDiscord | <dain> it's easier than wrangling the AST directly |
21:22:38 | FromDiscord | <dain> oh also i didn't see an explanation for what gensym is and why you'd use it in the official macro tutorial. would be good to have that explained somewhere |
21:22:42 | FromDiscord | <dain> since it's pretty important |
21:26:43 | FromDiscord | <Elegantbeef> I'm a simple man |
21:26:43 | FromDiscord | <Elegantbeef> Hax i think it's also a writeup of how to do/reason about things |
21:26:44 | FromDiscord | <haxscramper> I think I have some other examples |
21:26:44 | FromDiscord | <Elegantbeef> Examples of macros are plentiful but why/how is rather limited |
21:26:45 | FromDiscord | <haxscramper> If you need some examplesβ΅β elixir-style pattern overloading, https://play.nim-lang.org/#ix=2RnUβ΅β matching based on ast expressions, https://play.nim-lang.org/#ix=3tBr |
21:26:46 | FromDiscord | <haxscramper> Yes, but coming up with idea of what to write about can be challenging |
21:26:46 | FromDiscord | <Elegantbeef> I dont disagree |
21:26:46 | FromDiscord | <haxscramper> Well, I just dumped links, don't expect me to aactually think about problem at hand |
21:26:46 | FromDiscord | <haxscramper> I'm like 0.01% brainpower mode right now |
21:26:48 | FromDiscord | <haxscramper> C++ is slowly pushing me out of the "generally sane" area |
21:30:47 | FromDiscord | <dain> ya these need to be written up somewhere for ppl to find |
21:30:47 | FromDiscord | <leorize> I think there is some docs for gensym in macros but I agree, it doesn't say anything about why you would want it |
21:31:01 | FromDiscord | <dain> like a "nim macros cookbook" or something |
21:34:31 | * | max22- quit (Quit: Leaving) |
22:42:15 | nrds | <Prestige99> Elegantbeef: The point I'm stuck at here (error I'm not sure what it means) https://play.nim-lang.org/#ix=3zo3 - I also was trying out openArray instead of seq but I think that was causing another prob |
22:42:18 | nrds | <Prestige99> if you have any insight |
22:42:39 | nrds | <Prestige99> (I'm probably overlooking something) |
22:44:19 | FromDiscord | <Elegantbeef> You're not properly binding `SomeNumber` |
22:44:24 | FromDiscord | <leorize> `T: SomeNumber` instead of repeating it please \:p |
22:44:38 | nrds | <Prestige99> I tried that as well, had the same error iirc |
22:45:36 | FromDiscord | <Elegantbeef> I swear i'm going to come to your house and burn your PC if you use a named tuple |
22:45:49 | nrds | <Prestige99> Lol why? It's easier to type |
22:46:11 | FromDiscord | <Elegantbeef> Here you go anyway |
22:46:12 | FromDiscord | <Elegantbeef> https://play.nim-lang.org/#ix=3zo4 |
22:46:27 | FromDiscord | <Elegantbeef> I dont like named tuples since they're just aliases and not technically type safe |
22:50:03 | FromDiscord | <Elegantbeef> Also what's the point of exporting `sample` |
22:50:04 | FromDiscord | <Elegantbeef> It cannot be accessed as you do not inject it |
22:51:35 | FromDiscord | <Elegantbeef> As such you might as well do https://play.nim-lang.org/#ix=3zo7 |
22:54:04 | FromDiscord | <Elegantbeef> I still dont get why people write proc/template defs like that if there arent many args just hard to read to me |
22:56:06 | nrds | <Prestige99> oh the issue was sample had a generic |
22:56:36 | FromDiscord | <Elegantbeef> More you used `T` for sample |
22:56:41 | FromDiscord | <Elegantbeef> Or... not \:P |
22:57:20 | FromDiscord | <Elegantbeef> Yea it was you used `SomeNumber` which was the same as the one above |
22:57:37 | nrds | <Prestige99> the generic for sample had to be removed yeah |
22:57:53 | FromDiscord | <Elegantbeef> No it didnt need to be removed you needed to bind a different symbol |
22:58:27 | FromDiscord | <Elegantbeef> Do to you using `[SomeNumber]` you caused some fucking binding logic |
22:58:38 | nrds | <Prestige99> I mean that was the reason why it wasn't compiling |
22:58:57 | nrds | <Prestige99> I was doing T: SomeNumber previously but had the same issue, just didn't know why |
22:59:12 | FromDiscord | <Elegantbeef> Well it's not due to the generic |
22:59:29 | FromDiscord | <Elegantbeef> It's due template binding + your odd binding |
22:59:36 | FromDiscord | <Elegantbeef> https://play.nim-lang.org/#ix=3zo8 works for instance |
23:00:17 | FromDiscord | <Elegantbeef> It was using `SomeNumber` as a generic name not a type constraint |
23:00:49 | FromDiscord | <Elegantbeef> As such `sample[SomeNumber]` was getting a type instead of a generic name/constraint |
23:01:09 | FromDiscord | <Elegantbeef> Remember generic parameters arent special they're identifiers like anything else can be any number of letters |
23:01:14 | nrds | <Prestige99> Yeah ik |
23:01:25 | nrds | <Prestige99> just saying i didnt see it, but that was the issue |
23:01:38 | FromDiscord | <Elegantbeef> So then why the fuck were you using SomeNumber as a generic parameter name π |
23:01:56 | nrds | <Prestige99> unintentional, I was using T: SomeNumber previously |
23:02:58 | nrds | <Prestige99> was shifting things around trying to debug |
23:03:24 | FromDiscord | <Elegantbeef> Well my proclivities aside it works now so i'll shush and quit jokingly belittling you |
23:04:45 | nrds | <Prestige99> thanks for the help, just didn't know where to look cuz the error message was useless |
23:05:07 | FromDiscord | <Elegantbeef> Well it's 100% accurate, but yea |
23:05:18 | FromDiscord | <Elegantbeef> Doesnt give much information |
23:06:17 | nrds | <Prestige99> or a location |
23:07:09 | FromDiscord | <Elegantbeef> The issue is on expansion i figure so the error line is the line the template is called on i think |
23:07:52 | FromDiscord | <Elegantbeef> Cause until instantiation `SomeNumber` is just a generic param, but on instantiation it's a type i believe |
23:15:33 | FromDiscord | <Elegantbeef> Looking sadly it seems there isnt presently any extra information there to really grab |
23:48:38 | * | rockcavera joined #nim |
23:48:39 | * | rockcavera quit (Changing host) |
23:48:39 | * | rockcavera joined #nim |