00:22:50 | FromDiscord | <Girvo> Morning all ๐ |
00:23:06 | FromDiscord | <Girvo> Can you destructure-assign a `ptr` to an anonymous tuple? |
00:24:04 | FromDiscord | <Elegantbeef> `res[]` |
00:24:04 | FromDiscord | <Girvo> sent a code paste, see https://paste.rs/zBh |
00:24:13 | FromDiscord | <Girvo> sent a code paste, see https://play.nim-lang.org/#ix=3RJD |
00:24:13 | FromDiscord | <Girvo> Yeah that does work. Only way? |
00:25:06 | FromDiscord | <Elegantbeef> you need to dereference it so either `[]` or a `proc unpack(data: ptr tuple): typeof data[] = data[]` |
00:25:16 | FromDiscord | <Girvo> Okay sweet |
00:25:18 | FromDiscord | <Girvo> Cheers! |
00:26:01 | FromDiscord | <Elegantbeef> well it doesnt implicitly call unpack i should note |
00:26:10 | FromDiscord | <Elegantbeef> you still need to manually do `res.unpack` |
00:26:11 | FromDiscord | <Girvo> Oh yeah I understood haha |
00:26:50 | FromDiscord | <Elegantbeef> I do want to make an rfc for making a `=unpack` procedure called implicitly |
00:27:15 | FromDiscord | <Girvo> That would be really nice. Add to the ergonomics |
00:33:03 | FromDiscord | <Girvo> I have a funny question about heap/stack, but I need to get this example into the right shape for. Basically trying to work out where variables defined outside of the app_main stuff lives in-memory, and whether an `addr` to them is safe or not, so I can pass a `ptr` to a tuple of a lock + guarded variable to `pthread_create` |
00:33:32 | FromDiscord | <Girvo> I can obviously `new` it, but thats a ref not a ptr and I can't really pass a ref to pthread_create |
00:33:56 | * | noeontheend joined #nim |
00:36:19 | FromDiscord | <Elegantbeef> `create((Lock, Guard))` but idk what you mean |
00:36:20 | FromDiscord | <Elegantbeef> Afaik there is no definitive way to say "Safe to address" |
00:37:45 | FromDiscord | <Girvo> Yeah that's fair |
00:39:07 | FromDiscord | <Girvo> `create()` is what I was missing (and `dealloc`). Awesome, thanks |
00:42:41 | FromDiscord | <Elegantbeef> `create` is just syntax sugar for `cast[ptr T](alloc(sizeof(T)))` |
00:45:52 | FromDiscord | <Girvo> Nice, thats exactly what I'm after for this. Not going to be used for everything, in fact, barely used lol. But for certain bits where I need to cross this C boundary its handy |
00:51:49 | FromDiscord | <Girvo> Is there a generic type for a guarded variable? Or is that compiler magic more than anything else? |
00:52:03 | FromDiscord | <Girvo> `var t {.guard: lock.} = "Hello, from a locked variable"`โตwhat is the type of `t`? |
00:52:18 | FromDiscord | <Elegantbeef> `echo typeof(t)` ๐ |
00:52:23 | FromDiscord | <Girvo> Oh lol |
00:55:49 | FromDiscord | <Girvo> Just a `string` |
00:56:03 | FromDiscord | <Elegantbeef> Then it's all compiler magic |
00:56:41 | FromDiscord | <Girvo> Yeah, damn. Oh well for this stuff I might ditch the gcsafe block around it. Its just for locking access to certain resources across multiple threads |
00:59:09 | FromDiscord | <Girvo> I think I gotta go stare at some -d:danger C output for a while to really understand the best way of achieving this. Trying to get the compile-time benefits of {.gcsafe.} in a straight `pthread` or FreeRTOS `Task` context, both of which are very much C "pass void pointers around" interfaces lol |
01:02:16 | FromDiscord | <Elegantbeef> And a gcsafe annotated proc doesnt work why? |
01:06:39 | FromDiscord | <Girvo> Oh no, it does! |
01:07:07 | FromDiscord | <Elegantbeef> So what's the issue? |
01:07:14 | FromDiscord | <Girvo> For this purpose ๐ But I no longer need the `{.gcsafe.}` block as dereferencing a pointer to a guarded string breaks the compiler magic |
01:08:00 | FromDiscord | <Elegantbeef> Oh you dont get the guard error? |
01:08:33 | FromDiscord | <Girvo> Yeah, because it seems the compiler (which makes sense) can't trace that a `ptr` to a `(Lock, string)` tuple is referecing a guarded string in its second index |
01:09:12 | FromDiscord | <Elegantbeef> Yea the type erasure is going to be a bitch |
01:10:38 | FromDiscord | <Girvo> Still, `gcsafe` on the proc gets me enough of what I'm after, and there really aren't gonna be many locks/guarded vars anyway, so a decent trade off I think |
01:10:42 | * | noeontheend quit (Ping timeout: 250 seconds) |
01:10:51 | FromDiscord | <Elegantbeef> Actually is the string even guarded? |
01:11:00 | FromDiscord | <Elegantbeef> Like how are you calling this? |
01:11:08 | FromDiscord | <Girvo> `var t {.guard: lock.} = "Hello, from a locked variable"` |
01:11:33 | FromDiscord | <Girvo> sent a code paste, see https://play.nim-lang.org/#ix=3RJK |
01:11:37 | FromDiscord | <Elegantbeef> Sure but you're doing `t` which is a copy |
01:11:58 | FromDiscord | <Girvo> Oh yeah |
01:12:01 | FromDiscord | <Girvo> (edit) "https://play.nim-lang.org/#ix=3RJK" => "https://play.nim-lang.org/#ix=3RJL" |
01:12:19 | FromDiscord | <Elegantbeef> sent a code paste, see https://play.nim-lang.org/#ix=3RJM |
01:12:54 | FromDiscord | <Girvo> Lemme have a look |
01:12:55 | FromDiscord | <Elegantbeef> The above is probably what you want |
01:12:59 | FromDiscord | <Girvo> Yeah I think so too |
01:13:13 | FromDiscord | <Elegantbeef> Where the compiler knows `data` is guarded with `lock` |
01:13:42 | FromDiscord | <Girvo> Oh yeah then it should still pick up that its a guarded access to it. I'll give it a try |
01:13:47 | FromDiscord | <Elegantbeef> Guarding a global variable with lock only protects it on access of that variable |
01:14:06 | FromDiscord | <Girvo> Yeah so if a copy is triggering, it loses that (obviously) |
01:15:13 | * | arkurious quit (Quit: Leaving) |
01:15:16 | FromDiscord | <Elegantbeef> Sequences and strings behave as value types, so `=` is a copy generally(move semantics do apply) |
01:15:28 | FromDiscord | <Girvo> Yep makes sense |
01:16:04 | FromDiscord | <Girvo> The word `Guard` has lost all meaning to me and now doesn't look like a real word |
01:16:10 | * | jmdaemon joined #nim |
01:16:13 | FromDiscord | <Elegantbeef> Me writting `Guarded` |
01:17:21 | FromDiscord | <Girvo> Hahaha |
01:17:49 | FromDiscord | <Girvo> Okay yeah! It does work, at least it seems so. I get proper guarded access to `thing.data` nice |
01:18:06 | FromDiscord | <Elegantbeef> Yay! |
01:18:31 | FromDiscord | <Girvo> I'll have a play with this, but it should work nicely for what I'm after here! Cheers ๐ |
01:18:54 | FromDiscord | <Elegantbeef> Still need your `rtosThread` and `posixThread` macros ๐ |
01:19:16 | FromDiscord | <Girvo> Hahaha I was literally just writing a message to say thats my next task ๐ |
01:20:01 | FromDiscord | <Elegantbeef> Ah, well micros is now public, but subject to change, if you want a easy api ๐ |
01:20:16 | FromDiscord | <Girvo> Oooooh! I'll check it out for sure |
01:20:29 | FromDiscord | <Elegantbeef> Cant really beat this imo https://github.com/beef331/micros/blob/master/tests/test1.nim#L37-L50 |
01:20:47 | FromDiscord | <Girvo> See if I can't clean up the abstractions over all this. The developers who'll be working on the rest of the "app code" in firmware are... not professional C developers, so it'll go a long way if I can make it as foolproof as possible to work with all this |
01:21:00 | FromDiscord | <Elegantbeef> Ah sounds fun |
01:21:31 | FromDiscord | <Girvo> Our old firmware has race conditions, unsafe data access, and memory leaks all over the place haha. Electrical engineers make awesome boards, but write, uh, not the best software to run on them it seems |
01:22:34 | FromDiscord | <Elegantbeef> Yea my one friend is in that field and as a last year someone was making a clock and doing `sleep(1000)` for the seconds and was confused why the entire program locked up |
01:22:41 | FromDiscord | <Elegantbeef> last year project\ |
01:22:56 | FromDiscord | <Girvo> oh no haha |
01:23:22 | FromDiscord | <Elegantbeef> My other friend was there and suggest a main loop timer but the poor soul didnt understand how it worked so stuck to freezing the main thread |
01:23:34 | FromDiscord | <Girvo> The EE who built our prototype board and wrote the firmware has a hilarious mixture of `xTaskCreate` and Arduino-style `loop()` functions, which FreeRTOS/IDF tells you explicitly _not_ to do |
01:23:46 | FromDiscord | <Elegantbeef> Lol |
01:24:04 | FromDiscord | <Girvo> With everything accessing/storing shit in a heap of (shared) global C++ objects |
01:24:40 | FromDiscord | <Girvo> the only mutexes are what he was forced to do to get I2C and Serial working. Nothing else has them, so data randomly gets clobbered by other threads. Its fun ๐ |
01:24:47 | FromDiscord | <Elegantbeef> Hey I mainly do game dev, and most of IO is global, dont knock it till you try it ๐ |
01:25:53 | FromDiscord | <Girvo> Haha I know I know, I do too ๐ Would be fine if there was any sequencing at all, but theres random vTaskDelays everywhere to get everything to stop crashing/clobbering each other. Its hilarious/frustrating as some of our sensor data is stale in the packets that come back, and some isn't. yayyyyy |
01:26:19 | FromDiscord | <Elegantbeef> Well here's hoping that Nim's macros/compiler allows you to get good programs |
01:26:22 | FromDiscord | <Girvo> Hence why I've been tasked to re-do it, and I ain't using C++ even with a gun to my head lol (for this task anyway) |
01:26:31 | FromDiscord | <Girvo> Yeah thats the hope! |
01:27:21 | FromDiscord | <Girvo> It has in the past with other production stuff I worked on (a homomorphic encryption system for inter-company query results without ever sharing real data) |
01:27:32 | FromDiscord | <Elegantbeef> Now just if the EEs use distincts and sub range types |
01:28:38 | FromDiscord | <Elegantbeef> I'm only half joking, those two things seem very helpful in the world of embedded |
01:48:11 | FromDiscord | <Girvo> Haha no you're completely right. Nesper uses them a fair bit, and its great! Even just making sure you're using the right bytes/kb/mb types for the various APIs, auto conversion between them and so on. subrange types are gonna be super handy for some of the other APIs too |
01:49:13 | * | krux02_ quit (Remote host closed the connection) |
01:49:24 | FromDiscord | <Girvo> I really do think that Nim has so much potential in the embedded space. Zephyr (and Nephyr the Nim bindings for it) have so much promise. Sadly ESP32 isn't working well with it with Nephyr yet, and I figured it was simpler to stick with ESP-IDF anyway for now, but when we move off ESP32 and on to ARM in the future we'll revisit it for sure. |
01:49:44 | FromDiscord | <Girvo> Ergonomic, hardware-constraint-aware APIs, safety, and speed. Whats not to love |
01:58:24 | FromDiscord | <Elegantbeef> As someone that has fixed many "X doesnt work but should" type compiler errors, the compiler errors ๐โต(@Girvo) |
02:00:44 | FromDiscord | <Girvo> hehehehe |
02:01:02 | FromDiscord | <Girvo> Though hey, it could always be worse. looks at the errors in our C++ firmware when building |
02:03:11 | FromDiscord | <Girvo> Oooooh. Elcritch (the Nesper/Nephyr dev) has a great thread on some of what I'm trying to do right now |
02:03:11 | FromDiscord | <Girvo> https://forum.nim-lang.org/t/6976 |
02:06:30 | FromDiscord | <Girvo> Hah, yeah passing `ptr ref T` is exactly what he was doing too after all for cross-thread variables |
02:11:50 | FromDiscord | <Elegantbeef> Yea that's a complicated thing to do |
02:18:55 | FromDiscord | <sOkam!> Is this correct? Switch can accept variables, right? https://media.discordapp.net/attachments/371759389889003532/950940718095007784/unknown.png |
02:19:18 | FromDiscord | <Elegantbeef> Should probably be `const` |
02:19:28 | FromDiscord | <sOkam!> Also, does the "path" switch accept multiple folders in some way? |
02:19:59 | FromDiscord | <Elegantbeef> Think you can just do `--path"a"; --path"b"` |
02:23:28 | FromDiscord | <sOkam!> sent a code paste, see https://play.nim-lang.org/#ix=3RJT |
02:23:51 | FromDiscord | <Elegantbeef> I think so |
02:47:57 | * | neurocyte0917090 quit (Ping timeout: 240 seconds) |
03:00:45 | FromDiscord | <Girvo> sent a code paste, see https://play.nim-lang.org/#ix=3RJY |
03:00:54 | FromDiscord | <Girvo> sent a code paste, see https://play.nim-lang.org/#ix=3RJZ |
03:01:32 | FromDiscord | <Girvo> But it _is_ working, unlike my attempts with xTaskCreate with that wrapper. And with more documentation on how to use pthreads than FreeRTOS tasks I think its the way to go |
03:03:20 | FromDiscord | <Girvo> https://media.discordapp.net/attachments/371759389889003532/950951897131532368/unknown.png |
03:03:48 | FromDiscord | <Girvo> Locked/guarded access to a shared variable between thread, and talking over UART to a (real) SIM7000 2G/4G modem |
03:05:25 | FromDiscord | <Girvo> Now to add some stack-size stuff, esp_pthread extensions to control things, attributes, and pthread_join on the list of threads so I can remove the `while true: vTaskDelay(1)` in main lol |
03:13:32 | FromDiscord | <Girvo> Okay that was way easier than I thought it would be lol. Yay. Working pthreads with locks and guarded shared refs on an ESP32. Nice. |
03:16:55 | FromDiscord | <Elegantbeef> Congrats |
03:17:09 | FromDiscord | <Girvo> Thanks for your help beef, made a lot of things way clearer |
03:17:21 | FromDiscord | <Girvo> Now to wrap all this up in some nice macros/templates ๐ |
03:17:27 | FromDiscord | <Elegantbeef> Clear like mud is what i say |
03:17:34 | FromDiscord | <Girvo> yeah haha |
03:18:03 | FromDiscord | <Girvo> Though sadly I have to put it down for a week and go back to Typescript land. But I'll be back on this soon enough! |
03:27:02 | FromDiscord | <Girvo> `{.global.}` is global life-time, not global visibility yeah? |
03:27:20 | FromDiscord | <Elegantbeef> it's equivlent to `static T name` |
03:27:34 | FromDiscord | <Elegantbeef> Yea global live span of course |
03:27:50 | FromDiscord | <Girvo> Perfect, cheers |
03:36:30 | * | noeontheend joined #nim |
03:51:48 | * | jmdaemon quit (Ping timeout: 240 seconds) |
04:04:25 | * | rockcavera quit (Remote host closed the connection) |
04:06:02 | * | supakeen quit (Quit: WeeChat 3.4) |
04:06:32 | * | supakeen joined #nim |
04:12:53 | NimEventer | New thread by Ethernaut: SDL in a M1 Mac - can't find dylib, see https://forum.nim-lang.org/t/8990 |
04:14:25 | FromDiscord | <Valdar> Is there a native way "add" two seqs to a third, or do I have to iterate through them? |
04:15:45 | FromDiscord | <Valdar> I should say 'add the values of each' as opposed to adding one to the end of the other |
04:16:19 | FromDiscord | <Elegantbeef> What do you mean? |
04:18:00 | FromDiscord | <Valdar> I have two seqs, same size, and I want to add the values of one to the other |
04:18:08 | FromDiscord | <Elegantbeef> https://nim-lang.org/docs/sequtils.html#foldl.t%2C%2C%2C ? |
04:18:32 | FromDiscord | <Valdar> In this case, it's two layers of noise that I want to combine |
04:21:37 | FromDiscord | <Valdar> I don't think fold will help |
04:22:29 | FromDiscord | <huantian> sent a code paste, see https://paste.rs/WW3 |
04:22:44 | FromDiscord | <huantian> (edit) "https://paste.rs/Atq" => "https://paste.rs/8iX" |
04:23:01 | FromDiscord | <huantian> wow all the typos |
04:23:09 | FromDiscord | <huantian> (edit) "https://play.nim-lang.org/#ix=3RKb" => "https://play.nim-lang.org/#ix=3RKa" |
04:27:03 | FromDiscord | <Valdar> yeah, that's the idea. I can iterate through them like that, but I thought maybe there was something in sequtils that would do it (maybe quicker than my looping through) |
04:27:59 | FromDiscord | <huantian> I don't think there's any way to do this faster |
04:28:17 | FromDiscord | <huantian> one thing that could be improved in my solution is using `newSeqOfCap` to avoid allocations |
04:29:04 | * | jmdaemon joined #nim |
04:29:38 | FromDiscord | <Valdar> Thx, I just wanted to be sure that I wasn't missing a better way. I haven't tried a loop yet. It may be plenty fast. |
04:50:11 | * | noeontheend quit (Ping timeout: 256 seconds) |
04:52:56 | FromDiscord | <Elegantbeef> Nim's for loops are free, so it's going to be relatively fast |
05:27:12 | * | slowButPresent quit (Quit: leaving) |
05:50:37 | * | Gustavo6046 quit (Remote host closed the connection) |
05:53:52 | FromDiscord | <congusbongus> sent a code paste, see https://paste.rs/WnZ |
05:54:26 | FromDiscord | <Elegantbeef> Presently Nim does not allow this so you'd need to do `ref Foo` |
05:56:07 | * | Gustavo6046 joined #nim |
05:57:50 | FromDiscord | <Elegantbeef> sent a code paste, see https://play.nim-lang.org/#ix=3RKu |
06:05:08 | FromDiscord | <Mysterysib> Hi, so I'm learning about macros and I see stuff being used like `newNimNode(nnkRecList)` and `newIdentNode("new" & $typeName)` Where are these calls, like `newNimNode`, `nnkRecList`, `newIdentNode`, eg eg coming from? Are there docs for this? |
06:05:39 | FromDiscord | <Elegantbeef> https://nim-lang.org/docs/macros.html |
06:06:10 | FromDiscord | <Valdar> In reply to @Elegantbeef "Nim's for loops are": It is plenty fast... Took 117 milliseconds to add 3 seqs of 1 million floats each, so I'm happy with that. |
06:06:15 | FromDiscord | <Mysterysib> Thanks! |
06:06:32 | FromDiscord | <Elegantbeef> Can go even faster with `-d:danger` ๐ |
06:07:33 | FromDiscord | <Mysterysib> Is there any way to create a type object with a dynamic amount of variables? |
06:07:39 | FromDiscord | <Valdar> haha, now that you mention it, I forgot that I have my setting for debug build lol |
06:08:23 | FromDiscord | <Elegantbeef> I assume you mean fields? |
06:08:25 | FromDiscord | <Mysterysib> Like, if I want to add a new variable to say that example of mutable references, something like `append b.foo = z` and then `b.foo.z = 10` |
06:08:26 | FromDiscord | <Elegantbeef> If so use tuples |
06:08:45 | FromDiscord | <Mysterysib> What do you mean by fields? |
06:09:05 | FromDiscord | <Mysterysib> Ohhh |
06:09:08 | FromDiscord | <Mysterysib> Yeah, exactly |
06:09:42 | FromDiscord | <Valdar> Beef, 7 milliseconds on danger ๐ |
06:10:08 | * | Gustavo6046 quit (Ping timeout: 250 seconds) |
06:11:50 | FromDiscord | <Mysterysib> Are there docs for tuples? |
06:12:03 | FromDiscord | <Mysterysib> I found the docs for tuples in macros, but docs on tuples in general? |
06:15:28 | FromDiscord | <Valdar> https://nim-lang.org/docs/manual.html#types-tuples-and-object-types |
06:15:47 | FromDiscord | <Elegantbeef> Nim doesnt have dynamic objects by default |
06:16:37 | FromDiscord | <Mysterysib> if I make some fields of a sequence type, can I then append or remove values? Is there a list type? |
06:17:16 | FromDiscord | <Elegantbeef> There is `seq` but what you're after is dynamic it seems, and that's very much against Nim. You cannot add/remove fields |
06:17:21 | FromDiscord | <Mysterysib> or perhaps there is a sort of macro I can define for this use-case, something like the example of classes in the nim by example macros tutorial? |
06:17:45 | FromDiscord | <Mysterysib> In reply to @Elegantbeef "There is `seq` but": Would a dynamic sequence in an object work? |
06:18:29 | FromDiscord | <Elegantbeef> I dont know what you're after |
06:18:38 | FromDiscord | <Mysterysib> Basically I want a data structure similar to JsonObject, but one that is dynamic. And perhaps once the Datastructure is defined, then it can be made static |
06:18:41 | FromDiscord | <Elegantbeef> You could use a `Table[string, int]` if it's a single type |
06:19:04 | FromDiscord | <Elegantbeef> Json object is dynamic |
06:19:11 | FromDiscord | <Elegantbeef> It's the closest you can get to dynamic in Nim |
06:19:19 | FromDiscord | <Mysterysib> In reply to @Elegantbeef "You could use a": Yeah, something like that, and then I can define multiple table fields of different types, right? |
06:19:28 | FromDiscord | <Elegantbeef> You could |
06:19:48 | FromDiscord | <Mysterysib> Oooohh okay. Do you know the command to append or remove fields from a JsonObj? Couldn't figure that out when I was working with that. |
06:20:11 | FromDiscord | <Elegantbeef> https://nim-lang.org/docs/json.html#delete%2CJsonNode%2Cstring |
06:20:22 | FromDiscord | <Elegantbeef> https://nim-lang.org/docs/json.html#add%2CJsonNode%2Cstring%2CJsonNode |
06:20:34 | FromDiscord | <Elegantbeef> Or https://nim-lang.org/docs/json.html#%5B%5D%3D%2CJsonNode%2Cstring%2CJsonNode |
06:21:04 | FromDiscord | <Mysterysib> Thanks, that's pretty simple! |
06:22:02 | FromDiscord | <Mysterysib> What is the purpose of having a static object, versus say, simply defining a table or JsonObject as a dynamic variable? |
06:22:11 | FromDiscord | <Mysterysib> Is there a speed advantage? |
06:22:22 | FromDiscord | <Elegantbeef> Massive, plus static typing |
06:22:37 | FromDiscord | <Elegantbeef> tables are slow |
06:22:59 | FromDiscord | <Mysterysib> are sequences faster? |
06:23:08 | FromDiscord | <Elegantbeef> Yes |
06:23:17 | FromDiscord | <Elegantbeef> Tables are slow purely due to indexing being a hash procedure |
06:23:37 | FromDiscord | <Elegantbeef> Sequences are fast since indexing is a cheap `ptrToStart + index` |
06:24:11 | NimEventer | New Nimble package! logit - Dependency-free, cross-platform and small logging library for Nim, with a simple and comfortable API, see https://github.com/Miqueas/Logit |
06:24:28 | FromDiscord | <Mysterysib> Okay thanks, I think the best way to go then is to define a static table with regular fields for the static data types and sequence fields for the data that is dynamic |
06:24:40 | FromDiscord | <Mysterysib> (edit) "table" => "object" |
06:24:43 | FromDiscord | <Mysterysib> static object |
06:25:04 | * | Gustavo6046 joined #nim |
06:25:34 | FromDiscord | <Mysterysib> since accessing the dynamic data is all internal, indices in a sequence work without a problem |
06:25:46 | FromDiscord | <Elegantbeef> Sequence only really works if you want a key value relation |
06:25:58 | FromDiscord | <Elegantbeef> If you're iterating looking for a key it's going to be slower than a table |
06:26:12 | FromDiscord | <Elegantbeef> I mean "only really works if you dont want" |
06:26:28 | * | ltriant quit (Ping timeout: 272 seconds) |
06:26:35 | FromDiscord | <Mysterysib> oh, even if I leave the indices as numerical? like 0, 1, 2, etc |
06:27:12 | FromDiscord | <Elegantbeef> That's not really a key value relation |
06:27:25 | FromDiscord | <Elegantbeef> I'm talking about using a field |
06:27:28 | FromDiscord | <Elegantbeef> field name\ |
06:28:13 | FromDiscord | <Mysterysib> it'd be cool if there was something that just allocated the same number of bytes to each value in the sequence, so say mydynamicdata[2].value would do something like `ptrToStart + valueBytes2` |
06:28:34 | FromDiscord | <Mysterysib> yeah, some extra memory used, but my data is small enough that the impact would be minimal |
06:28:40 | FromDiscord | <Elegantbeef> That's how a sequence works |
06:29:16 | FromDiscord | <Mysterysib> Oh okay, what I meant is defining the sequence as a field in the object, not the sequence values as fields in the sequence |
06:29:31 | FromDiscord | <Elegantbeef> I dont follow |
06:29:38 | FromDiscord | <Mysterysib> I'll write an example |
06:29:41 | FromDiscord | <Elegantbeef> Then again i dont get why someone wants this dynamism |
06:32:58 | FromDiscord | <Mysterysib> sent a code paste, see https://paste.rs/qQW |
06:33:44 | FromDiscord | <Mysterysib> So all the static data can be assigned right away, but the dynamic data depends on the amount and the data types of the responses in the JsonObj I filter |
06:33:47 | FromDiscord | <Elegantbeef> get the `union` package then you can do `dynamicResponses: seq[union(string, int)]` |
06:34:15 | FromDiscord | <Mysterysib> Yay, cool ๐ |
06:34:42 | FromDiscord | <Elegantbeef> Sorry it's `string | int` not `,` |
06:37:12 | FromDiscord | <Mysterysib> After I finish this proj I'm working on sort of just as a learning thing but it could also be a useful tool it'll be fun to work on a quant finance library for nim since I don't see any atm. I have this book on quant finance in R so I can use the math from there to write those functions in nim |
06:38:11 | FromDiscord | <Mysterysib> I used to do that in Python just for fun and made an API for a crypto exchange, although the trading algo I wrote was not profitable |
06:39:01 | FromDiscord | <Mysterysib> I wrote a backtest feature against historical data from scratch, but probably because of poor coding skills combined with Python being slow it would take hours to backtest a strategy against a year |
06:40:17 | * | vicecea quit (Remote host closed the connection) |
06:40:45 | * | vicecea joined #nim |
06:41:18 | FromDiscord | <Mysterysib> although that was against second data, not daily data |
06:41:34 | FromDiscord | <Mysterysib> so it was a lot data ๐ |
06:41:39 | FromDiscord | <Mysterysib> (edit) "so it was a lot ... data" added "of" |
06:42:12 | NimEventer | New Nimble package! SLAP - A SLow And Powerless programming language written in Nim, see https://github.com/bichanna/slap/blob/master/docs/index.md#slap |
06:45:56 | FromDiscord | <sOkam!> Anyone here using neovim/vim?โตAny clue how to get this type of error checking in them?โต_(this sshot is the nim extension running in vscodium)_ https://media.discordapp.net/attachments/371759389889003532/951007916952010803/unknown.png |
06:46:53 | FromDiscord | <Elegantbeef> image.png https://media.discordapp.net/attachments/371759389889003532/951008155666640906/image.png |
06:46:53 | FromDiscord | <Elegantbeef> You can get stuff like |
06:47:05 | FromDiscord | <Elegantbeef> Just gotta get my config for you ๐ |
06:47:34 | FromDiscord | <Mysterysib> Perhaps this? https://github.com/PMunch/nimlsp |
06:47:39 | FromDiscord | <Elegantbeef> https://github.com/dense-analysis/ale think i'm using this |
06:48:04 | FromDiscord | <Elegantbeef> sent a code paste, see https://play.nim-lang.org/#ix=3RKG |
06:48:32 | FromDiscord | <Mysterysib> You can use https://github.com/autozimu/LanguageClient-neovim with https://github.com/PMunch/nimlsp, but I'm not sure if that's any better |
06:49:30 | FromDiscord | <Mysterysib> but I use Jetbrains as my IDE, you get it for free with a .edu email and ever since I discovered it it's been my fav |
06:49:48 | FromDiscord | <Mysterysib> although I love vim |
06:51:20 | FromDiscord | <Mysterysib> @ElegantBeef is union in the official package repo, or do I have to pull it from github? |
06:51:23 | FromDiscord | <Elegantbeef> I've been using Kate with the LSP and it works pretty good, seems like there is an issue with diagnostics though so no errors |
06:51:30 | FromDiscord | <Elegantbeef> https://github.com/alaviss/union |
06:52:01 | FromDiscord | <Mysterysib> Oh yeah I'm using Kate with Jetbrains and I get no errors as well |
06:52:03 | FromDiscord | <Mysterysib> I wish that worked |
06:53:30 | FromDiscord | <Elegantbeef> "Kate with jetbrains"? |
06:54:31 | FromDiscord | <sOkam!> sent a code paste, see https://play.nim-lang.org/#ix=3RKH |
06:54:46 | FromDiscord | <sOkam!> (edit) "https://play.nim-lang.org/#ix=3RKH" => "https://paste.rs/Rwt" |
06:54:54 | FromDiscord | <Elegantbeef> You did install the plugin right? |
06:55:00 | FromDiscord | <sOkam!> ๐คทโโ๏ธ |
06:55:07 | FromDiscord | <sOkam!> im using vimplug |
06:55:10 | FromDiscord | <Mysterysib> Oh I confused Kite with Kate |
06:55:20 | FromDiscord | <Mysterysib> I think Kite just gives autocomplete |
06:55:22 | FromDiscord | <Elegantbeef> So you added the URL and then ran the install command? |
06:55:39 | FromDiscord | <sOkam!> i think so, yep. let me recheck just in case |
06:56:07 | FromDiscord | <Elegantbeef> I have been meaning to debug the NimLSP with kate |
06:56:10 | FromDiscord | <Mysterysib> This plugin (https://plugins.jetbrains.com/plugin/15128-nim) is really broken or I just need to set it up, because barely any of the features it lists work |
06:56:13 | FromDiscord | <Elegantbeef> Guess not time like the present |
06:56:18 | FromDiscord | <Mysterysib> (edit) "up," => "up properly somehow," |
06:56:30 | FromDiscord | <Elegantbeef> Well it's a from scratch implementation |
06:56:37 | FromDiscord | <Elegantbeef> So it's behind nimsuggest/nimlsp |
06:56:50 | FromDiscord | <sOkam!> https://media.discordapp.net/attachments/371759389889003532/951010656457461791/unknown.png |
06:58:09 | FromDiscord | <Mysterysib> I think the JB plugin was designed for Windows or something, because it has some really good reviews and then a few really bad ones, so it's likely not being set up properly on OSX |
06:58:33 | FromDiscord | <Elegantbeef> You say OSX like that's the most common Nim programmer OS ๐ |
07:00:33 | FromDiscord | <Mysterysib> Well my desktop with openSUSE broke after trying to configure bios RAID0 on intel RST with NVMEs (I still have no idea what happened, but I've tried everything to flashing the bios, taking the thing apart and putting it back together, and it will not post) so I'm stuck programming on my 13inch macbook |
07:01:21 | FromDiscord | <Elegantbeef> I guess nowadays most motherboards have a clear cmos button eh? |
07:01:32 | FromDiscord | <Elegantbeef> Instead of having to remove the cr2032 or taking off a jumper |
07:02:03 | FromDiscord | <Mysterysib> It had a jumper pin that you could move from pos 1-2 to 2-3 to reset the bios, but that didn't work. And removing the CMOS battery hasn't worked either. |
07:02:59 | FromDiscord | <Mysterysib> Oh so CMOS battery = cr2032, learned smthn new |
07:03:17 | FromDiscord | <Elegantbeef> Yea it's the type of the battery |
07:04:17 | FromDiscord | <Mysterysib> I've had terrible luck with computers. I remember I build an ETH miner with 4 GPUs and I stayed up for 2 days to get it to work, and then the motherboard literally burns out with smoke and I ended up selling the rest of the parts. |
07:04:38 | FromDiscord | <Mysterysib> Then when i tried building my own computer the BIOS would not post either despite me triple checking all the components were compatible |
07:05:41 | FromDiscord | <Elegantbeef> Given the gpu shortage i can only say "Oh noes, what a shame" ๐ |
07:06:42 | FromDiscord | <Mysterysib> with all this past trauma I might just go for a 16 inch M1 macbook when I can afford it |
07:08:18 | FromDiscord | <Mysterysib> I still prefer mac over windows because it's at least unix-based |
07:09:05 | FromDiscord | <Mysterysib> Some time ago it was possible to gain full access to the root filesystem, but ever since the last two major OSX versions you can't |
07:09:15 | FromDiscord | <Elegantbeef> PMUUUUUUNCH, what does a debug nimlsp give me, i see no outputs anywhere?! |
07:09:30 | FromDiscord | <Mysterysib> (edit) "Some time ago it was possible to gain full access to the root ... filesystem," added "/ system" |
07:10:07 | FromDiscord | <Elegantbeef> I think pmunch accidently left his IRC open again, even checked the logs to see if he logged out |
07:24:25 | * | jjido joined #nim |
07:32:23 | FromDiscord | <retkid> can i use macros to modify other procs and add code to them? |
07:32:45 | FromDiscord | <Elegantbeef> Macros can only mutate downward |
07:33:25 | FromDiscord | <retkid> now, I don't quite know what you mean by that |
07:33:39 | FromDiscord | <Elegantbeef> You cannot use a macro to mutate something not inside the macro's scope |
07:34:16 | FromDiscord | <retkid> can I use a macro to take a proc, and mutate it within its scope and execute that modified verion? |
07:34:28 | FromDiscord | <Elegantbeef> You can emit a new procedure yes |
07:35:17 | NimEventer | New thread by Mohan24: Want Nim online code playground to be mobile and desktop friendly., see https://forum.nim-lang.org/t/8991 |
07:36:12 | FromDiscord | <retkid> sent a code paste, see https://paste.rs/CqU |
07:36:19 | FromDiscord | <retkid> obviously this is useless but still |
07:36:33 | FromDiscord | <retkid> (edit) "obviously this ... is" added "specific example" |
07:36:35 | FromDiscord | <Elegantbeef> Like i said you can do it inside the macro yes |
07:36:46 | FromDiscord | <Elegantbeef> You can emit a new procedure or type inside a macro |
07:36:47 | FromDiscord | <retkid> I shall learn more about macros |
07:37:03 | FromDiscord | <retkid> I am afraid of macros for some reason |
07:37:54 | FromDiscord | <retkid> maybe not today, I need to accept that this project is going nowhere and complete it before my bones age into dust |
07:38:29 | FromDiscord | <Rika> quick |
07:38:32 | FromDiscord | <Mysterysib> @retkid this helped me a bit on top of the official nim docs https://dev.to/beef331/demystification-of-macros-in-nim-13n8 |
07:38:40 | FromDiscord | <Rika> every day you lose 24 hours of time |
07:38:44 | FromDiscord | <retkid> In reply to @Rika "every day you lose": I KNOW |
07:38:55 | FromDiscord | <Rika> every minute in africa, 60 seconds pass |
07:39:17 | FromDiscord | <Elegantbeef> Eh if i get micros to a usable state everyone should be 93.5% less scared of macros |
07:39:30 | FromDiscord | <Rika> ive never been scared of macros |
07:39:48 | FromDiscord | <Rika> newTree newTree newTree newTree newTree newTree newTree newTree newTree newTree newTree newTree newTree |
07:39:49 | FromDiscord | <Elegantbeef> But until then i'm ramming my face into trying to get kate to show errors with nimlsp |
07:40:20 | FromDiscord | <Mysterysib> if you ever figure out how to get kate or vim to show nim errors then please share that config on github |
07:40:33 | FromDiscord | <Elegantbeef> I mean i have vim showing errors |
07:40:47 | FromDiscord | <Elegantbeef> There's a whole post about getting Nim linting working with vim afaik |
07:41:08 | FromDiscord | <Mysterysib> oh that's great. There's some nice clients like OniVim that are more of an IDE but still use vim |
07:41:56 | FromDiscord | <retkid> I've just found i write the same threading code over and over again |
07:42:00 | FromDiscord | <retkid> I'm just gonna write threading macros |
07:42:45 | FromDiscord | <Rika> i honestly stopped trying to get errors on my editor |
07:42:53 | FromDiscord | <Rika> i just made myself know when something is wrong ๐ |
07:43:57 | FromDiscord | <retkid> well |
07:44:00 | FromDiscord | <retkid> I wish i had that power |
07:44:11 | FromDiscord | <retkid> but sometimes because of dyslexia I cant see my spelling mistakes |
07:44:25 | FromDiscord | <Rika> my font size is like 32 or something |
07:44:32 | FromDiscord | <retkid> so i will not know why things aren't compiling, get angry, then copy code from somewhere else then it just suddenly works |
07:44:35 | FromDiscord | <retkid> and im so confused |
07:44:50 | FromDiscord | <retkid> this happens a lot with x.attters |
07:44:53 | FromDiscord | <retkid> (edit) "this happens a lot with x.attters ... " added "or x.attrs" |
07:44:55 | FromDiscord | <Mysterysib> In reply to @retkid "but sometimes because of": dyslexia font? |
07:45:05 | FromDiscord | <Elegantbeef> comicsans! |
07:45:07 | FromDiscord | <retkid> I dont know if that would help? |
07:45:11 | FromDiscord | <Mysterysib> Look |
07:45:20 | FromDiscord | <retkid> comicsans has been show to help dyslexics tho |
07:46:12 | FromDiscord | <retkid> I will install opendyslexic |
07:46:29 | FromDiscord | <Rika> closeddyslexic |
07:46:56 | FromDiscord | <Mysterysib> Yeah open dyslexic Nerd font |
07:47:08 | FromDiscord | <retkid> I've had this install for less than a week and its already bloated to shit https://media.discordapp.net/attachments/371759389889003532/951023317186404362/2022-03-09_02-46.png |
07:47:24 | FromDiscord | <Mysterysib> I donโt always use it but it helps https://media.discordapp.net/attachments/371759389889003532/951023384895041536/59D13EAB-0A2A-4FB5-84F7-071CC4DEC942.jpg |
07:47:38 | FromDiscord | <retkid> I dont always have dyslexia but when i do, it helps |
07:47:50 | FromDiscord | <Mysterysib> Pretty much that ^ |
07:48:06 | FromDiscord | <Rika> tiny font |
07:48:17 | FromDiscord | <Rika> im blind as fuck ig |
07:48:36 | FromDiscord | <Mysterysib> I use a 13 inch Screen ๐ and my left eye doesnโt work |
07:48:50 | FromDiscord | <Mysterysib> But I have 20/20 vision nonetheless |
07:48:54 | FromDiscord | <Rika> beat me: my right eye is farsighted and my left eye is nearsighted |
07:48:58 | FromDiscord | <Mysterysib> I just have other vision problems |
07:49:02 | FromDiscord | <retkid> https://media.discordapp.net/attachments/371759389889003532/951023793701269514/2022-03-09_02-48.png |
07:49:09 | FromDiscord | <retkid> thats my font size |
07:49:12 | FromDiscord | <Mysterysib> Well I used to see the world in two separate images overlaying one another until I got surgery |
07:49:16 | FromDiscord | <Rika> 24 small |
07:49:16 | FromDiscord | <retkid> i zoom in with my DE |
07:49:23 | FromDiscord | <retkid> usually |
07:49:34 | FromDiscord | <retkid> but this works fine with glasses on |
07:49:41 | FromDiscord | <retkid> without glasses lemme see where it needs to be |
07:50:12 | FromDiscord | <Mysterysib> Oh wow Iโm 11 |
07:50:22 | FromDiscord | <retkid> https://media.discordapp.net/attachments/371759389889003532/951024127144255558/2022-03-09_02-50.png |
07:50:36 | FromDiscord | <Mysterysib> Which IDE is that? |
07:50:39 | FromDiscord | <retkid> this is almost comfortable without glasses |
07:50:48 | FromDiscord | <retkid> This is vscode |
07:50:51 | FromDiscord | <Mysterysib> And what font? |
07:50:54 | FromDiscord | <Mysterysib> Looks nice |
07:51:03 | FromDiscord | <Mysterysib> When I donโt use dyslexic I use MonaLisa |
07:51:13 | FromDiscord | <retkid> Fira Code |
07:51:23 | FromDiscord | <Mysterysib> That oneโs good too |
07:51:33 | FromDiscord | <Mysterysib> MonoLisa |
07:51:33 | FromDiscord | <Elegantbeef> There is 0 information i can extract to understand why there LSP isnt reporting diagnostics |
07:51:34 | FromDiscord | <Elegantbeef> Shame |
07:51:57 | FromDiscord | <retkid> https://media.discordapp.net/attachments/371759389889003532/951024528295870464/js-dark.png |
07:52:00 | FromDiscord | <retkid> this looks like the fucki0n |
07:52:01 | FromDiscord | <retkid> uhhh |
07:52:06 | FromDiscord | <retkid> Inteliji font |
07:52:11 | FromDiscord | <retkid> (edit) "fucki0n" => "fuckin" |
07:52:27 | FromDiscord | <Mysterysib> This is MonoLisa https://media.discordapp.net/attachments/371759389889003532/951024652975751168/unknown.png |
07:52:43 | FromDiscord | <retkid> I like it but its not a lot of character |
07:53:26 | FromDiscord | <Mysterysib> Also this ones super cool, it's called DaddyTimeMono https://media.discordapp.net/attachments/371759389889003532/951024900343234630/unknown.png |
07:54:05 | FromDiscord | <retkid> https://media.discordapp.net/attachments/371759389889003532/951025066068541460/2022-03-09_02-53.png |
07:54:08 | FromDiscord | <retkid> something about thsi font |
07:54:11 | FromDiscord | <retkid> is much less readable to me |
07:54:20 | FromDiscord | <retkid> sure i can read it faster but its uhh |
07:54:23 | FromDiscord | <Mysterysib> it's not the ideal programming font |
07:54:28 | FromDiscord | <retkid> it feels claustrophobic |
07:54:37 | FromDiscord | <Mysterysib> Maybe you can adjust the kerning |
07:54:42 | FromDiscord | <Mysterysib> but the font itself isnt great for writing code |
07:54:48 | FromDiscord | <kiell> how do i quit nim secret? |
07:54:56 | FromDiscord | <retkid> ctrl-d |
07:55:46 | FromDiscord | <kiell> for mac? |
07:56:15 | FromDiscord | <retkid> for linux? |
07:56:20 | FromDiscord | <Elegantbeef> control + C? |
07:56:48 | FromDiscord | <retkid> ctrl-d works on mien |
07:57:00 | FromDiscord | <retkid> ctrl-c as well |
07:57:02 | FromDiscord | <retkid> and ctrl-z |
07:57:03 | FromDiscord | <Mysterysib> type quit() |
07:57:04 | FromDiscord | <Mysterysib> boom |
07:57:34 | FromDiscord | <kiell> omg ty |
07:58:52 | FromDiscord | <retkid> but yea i wanna learn haskell or something and learn opengl |
07:59:24 | FromDiscord | <Mysterysib> what does haskell have to do with opengl |
07:59:32 | FromDiscord | <retkid> because even though I don't do graphics programming I'd like to learn about how you can translate traditionally programming concepts to shaders |
07:59:57 | FromDiscord | <retkid> In reply to @Mysterysib "what does haskell have": Because I wonder if it would be better to learn a new language with a new form of programming together to associate it better in your brain-thingy |
07:59:58 | FromDiscord | <Mysterysib> when I was younger I used opengl to draw the wallhacks I used to code for CSGO lol |
08:00:27 | FromDiscord | <Mysterysib> It's not that difficult, it's like learning to use a library |
08:00:37 | FromDiscord | <Elegantbeef> Ehh, i kinda want to get into writing hacks for fun |
08:00:44 | FromDiscord | <Elegantbeef> Opengl is quite simple, just tedious |
08:00:44 | FromDiscord | <Mysterysib> what was more difficult was attaching to the CSGO application and reading memory and signatures |
08:00:48 | PMunch | @Elegantbeef, you are correct, I did leave my IRC open again :P |
08:00:55 | FromDiscord | <Mysterysib> It's really fun actually |
08:01:03 | FromDiscord | <Mysterysib> There's different ways you can go about it |
08:01:03 | FromDiscord | <retkid> In reply to @Mysterysib "what was more difficult": I know someone that does it |
08:01:07 | FromDiscord | <retkid> I don't really see the appeal |
08:01:10 | FromDiscord | <Elegantbeef> Opengl is nicer with distinct types |
08:01:28 | PMunch | Debug nimlsp logs more stuff to the nimlsp log file |
08:01:30 | FromDiscord | <Mysterysib> you can write internal hacks by injecting a library (dll) into an application, or external hacks just by reading memory |
08:01:35 | PMunch | Which by default is in /tmp |
08:01:37 | FromDiscord | <Mysterysib> with internal hacks you can use the game's own API |
08:01:41 | FromDiscord | <Elegantbeef> Yea i found it all out |
08:01:44 | FromDiscord | <retkid> "ah yes well i figured out how to replace the assembly goto lookup table and slightly modify the code with embedded C and now I can move 0.2% faster" |
08:01:44 | FromDiscord | <Elegantbeef> It didnt help me any |
08:01:58 | PMunch | So you're not getting errors? |
08:02:13 | PMunch | As in "write something with an error; save the file; no errors show up"? |
08:02:18 | FromDiscord | <Elegantbeef> In the log, there are some issues of "RequestMessage" not parsable |
08:02:32 | FromDiscord | <Elegantbeef> Yea it's not getting diagnostics |
08:02:47 | FromDiscord | <Elegantbeef> Kate is relatively easy to get if you care to test it yourself |
08:02:58 | FromDiscord | <Elegantbeef> Certainly in your package manager ๐ |
08:03:25 | FromDiscord | <Mysterysib> @ElegantBeef did you put `let g:lsp_log_file = expand('/tmp/vim-lsp.log')` in your config? |
08:03:45 | FromDiscord | <Elegantbeef> Kate, i was testing kate |
08:03:46 | * | ltriant joined #nim |
08:03:57 | FromDiscord | <Mysterysib> Ohhhh |
08:04:34 | FromDiscord | <Mysterysib> How did you install the kate plugin? Maybe I can try it |
08:04:47 | FromDiscord | <Mysterysib> I never used kate before |
08:04:55 | FromDiscord | <Elegantbeef> Kate is a text editor! |
08:05:01 | FromDiscord | <sOkam!> sent a code paste, see https://play.nim-lang.org/#ix=3RKR |
08:05:04 | FromDiscord | <Mysterysib> Yeah, I know |
08:05:07 | FromDiscord | <Elegantbeef> it has a LSP toggle |
08:05:22 | FromDiscord | <Elegantbeef> No Nim doesnt return on assignment |
08:05:32 | FromDiscord | <Elegantbeef> you'd do `var on = (two = doThing(); two)` |
08:05:45 | FromDiscord | <Mysterysib> Was your Kate built with debug binaries? |
08:06:02 | FromDiscord | <Elegantbeef> It's from the ubuntu repo so i hope not |
08:06:35 | FromDiscord | <Hamid_Bluri> sent a code paste, see https://play.nim-lang.org/#ix=3RKS |
08:06:44 | FromDiscord | <Hamid_Bluri> https://github.com/hamidb80/iterrr#inline-reducer |
08:07:43 | FromDiscord | <Mysterysib> How did you install nim lsp in Kate? |
08:07:59 | FromDiscord | <Elegantbeef> It's on the nimlsp readme |
08:08:01 | PMunch | @Elegantbeef, sounds like Kate is sending messages which are technically not up to the LSP spec |
08:08:20 | PMunch | NimLSP is pretty strict about what it parses, it has already generated bug reports to more than one LSP client :P |
08:10:26 | FromDiscord | <enthus1ast> can i store a pragmas in a variable or i want to combine multiple pragmas under one new pragma |
08:10:42 | FromDiscord | <Hamid_Bluri> pragma pragma |
08:10:49 | FromDiscord | <Mysterysib> I wonder why I get the error ` Error: cannot open file: /usr/local/Cellar/nim/HEAD-b2c5d7b/nim/nimsuggest/nimsuggest.nim` when trying to install nimlsp |
08:11:00 | FromDiscord | <enthus1ast> @Hamid_Bluri\: have a syntax example? |
08:11:02 | FromDiscord | <Hamid_Bluri> https://nim-lang.org/docs/manual.html#userminusdefined-pragmas-pragma-pragma |
08:11:08 | FromDiscord | <Mysterysib> do I have to install dependencies manually>? |
08:11:25 | PMunch | @Mysterysib, read the rest of the install instructions as well |
08:11:45 | PMunch | That is one of the most common issues and should be described in the README |
08:12:24 | FromDiscord | <Mysterysib> This might be because I installed nim on OSX using Homebrew, but I cannot build a single nim library |
08:12:45 | FromDiscord | <Mysterysib> Various errors for everything, including unions |
08:12:54 | PMunch | In general installing Nim via Homebrew is a bad idea |
08:12:59 | FromDiscord | <sOkam!> does each field/key in a new typed object need to be ``, even if the type itself is marked with ? |
08:13:03 | PMunch | What version of Nim does it ship with nowadays? |
08:13:17 | FromDiscord | <Elegantbeef> Nim allows you to specify each field's export so yes |
08:13:22 | madprops | 1.6.4 |
08:13:40 | madprops | https://formulae.brew.sh/formula/nim |
08:13:42 | PMunch | madprops, in Homebrew? |
08:13:43 | FromDiscord | <Mysterysib> Should I just download the precompiled binary then? |
08:13:49 | PMunch | Nope, use choosenim |
08:14:11 | PMunch | Someone should have a look at the bots to figure out if there's a better way to do parsing: https://irclogs.nim-lang.org/09-03-2022.html#08:12:59 |
08:14:25 | PMunch | I assume there are some stars there I can't see |
08:14:45 | FromDiscord | <Elegantbeef> Yes there are |
08:15:29 | FromDiscord | <Mysterysib> Is 1.6.4 the latest stable? |
08:15:48 | FromDiscord | <enthus1ast> @Hamid_Bluri\: thank you works |
08:20:43 | PMunch | @Mysterysib, yes it's the latest stable. But Homebrew tend to install it weirdly which breaks building of many projects |
08:27:00 | * | rb quit (Ping timeout: 240 seconds) |
08:27:19 | FromDiscord | <sOkam!> sent a code paste, see https://play.nim-lang.org/#ix=3RKV |
08:28:33 | PMunch | Yes, those three are equivalent. But neither of them follow the Nim style guide |
08:29:04 | PMunch | `let thing1* = 1` would probably be the most stylistically correct |
08:29:30 | PMunch | Or `let thing1*: int = 1` if you for some reason insist on declaring it with a type |
08:30:24 | FromDiscord | <Elegantbeef> Speaking of masochism ๐ |
08:31:00 | PMunch | Haha, that's going to look super out of context for those who don't read #offtopic :P |
08:34:06 | * | rwb joined #nim |
08:34:11 | FromDiscord | <sOkam!> In reply to @PMunch "Yes, those three are": yeah i imagine. the problem is symbols next to words are very distracting for me for whatever reason ๐คทโโ๏ธ โตGoal is to do something like this. I know its not nep, but... https://media.discordapp.net/attachments/371759389889003532/951035156297302016/unknown.png |
08:34:39 | FromDiscord | <Elegantbeef> Jesus the hardest code base to work with |
08:35:07 | FromDiscord | <sOkam!> with a simple skim i read:โต- all of these are constโต- they are all public constโต- these are their values |
08:35:16 | FromDiscord | <sOkam!> (edit) "constโต-" => "intโต-" |
08:35:36 | FromDiscord | <sOkam!> non-programmer-brain issues i guess ๐ |
08:35:45 | FromDiscord | <sOkam!> In reply to @Elegantbeef "Jesus the hardest code": wdym? |
08:36:05 | FromDiscord | <Elegantbeef> Horizontally aligned code with weird conventions |
08:37:24 | * | Zectbumo quit (Remote host closed the connection) |
08:45:30 | FromDiscord | <Rika> someones gonna get mad at you for not using enums |
08:45:48 | FromDiscord | <untoreh> typing `var out:` makes nimlsp crash |
08:46:22 | FromDiscord | <Rika> out is a keyword |
08:47:26 | FromDiscord | <untoreh> yeah...that's a good hint for debugging ๐ but other kws don't crash |
08:47:37 | FromDiscord | <Rika> pmunch ^ lol |
08:47:54 | FromDiscord | <fbpyr> sent a code paste, see https://play.nim-lang.org/#ix=3RKX |
08:48:22 | PMunch | Don't look at me, that's 95% certainly a nimsuggest bug |
08:49:40 | FromDiscord | <Rika> should lsp crash when suggest crash though |
08:53:02 | PMunch | Yup |
08:53:07 | PMunch | That's by design |
08:53:24 | PMunch | NimLSP is nimsuggest, it's just a different front-end |
08:53:58 | PMunch | We should fix bugs in nimsuggest, not put lipstick on a pig and build complex management systems into NimLSP |
08:54:08 | PMunch | Besides, your editor is supposed to restart NimLSP if it crashes |
08:55:17 | PMunch | Since it crashed we now know that something is wrong, @untoreh can create an issue in the nimsuggest bug tracker, and someone can fix the bug. If NimLSP had just silently restarted we wouldn't get anywhere |
09:10:02 | FromDiscord | <sOkam!> Is this incorrect in some way? ๐ค โตI'm getting `.... /types.nim(2, 14) Error: cannot export: render / types` https://media.discordapp.net/attachments/371759389889003532/951044180359127091/unknown.png |
09:12:05 | FromDiscord | <Elegantbeef> `export types` |
09:12:52 | FromDiscord | <Elegantbeef> You're exporting a symbol not a path |
09:16:23 | FromDiscord | <retkid> I want to learn vulcan and start getting depressed by its verbose code but I dont have a gpu that supports it |
09:16:28 | FromDiscord | <retkid> ๐ญ |
09:16:37 | FromDiscord | <Elegantbeef> Dont learn vulkan ๐ |
09:17:31 | FromDiscord | <retkid> you cant stop me, {parental gender} |
09:17:37 | FromDiscord | <retkid> (edit) "{parental gender}" => "{parental.gender}" |
09:19:11 | FromDiscord | <retkid> how bad can vulkan really be |
09:19:25 | FromDiscord | <Elegantbeef> 2000 lines of code for a triangle ๐ |
09:19:45 | FromDiscord | <retkid> then how do people... |
09:19:45 | FromDiscord | <retkid> like |
09:19:48 | FromDiscord | <retkid> use it? |
09:20:09 | * | jjido quit (Quit: My MacBook Air has gone to sleep. ZZZzzzโฆ) |
09:20:33 | FromDiscord | <Elegantbeef> They make abstractions over top the verbose compatibility code |
09:21:05 | FromDiscord | <retkid> I'm sure it wont be 2000 lines of code for gpu acceleration in my weird projects |
09:21:12 | FromDiscord | <retkid> famous last words |
09:21:51 | FromDiscord | <Elegantbeef> Well your gpu doesnt support vulkan |
09:21:58 | FromDiscord | <Elegantbeef> So why would you use it? |
09:22:03 | FromDiscord | <Rika> In reply to @PMunch "Since it crashed we": Unless that same bug has been there for years and no one has wanted to try to fix it ๐ |
09:22:28 | PMunch | @Rika, maybe some day someone will |
09:22:46 | PMunch | If they get fed up with NimLSP crashing on them |
09:22:57 | FromDiscord | <Rika> Or maybe some day it will be revamped as a rewrite which is more likely |
09:23:26 | FromDiscord | <Rika> In reply to @PMunch "If they get fed": They could just stop using LSP and move to a plugin that does the weird management shit |
09:23:27 | FromDiscord | <ripluke> In reply to @michaelb.eth "yes, though there are": Thats cool |
09:23:37 | FromDiscord | <retkid> In reply to @Elegantbeef "So why would you": because i wanna look at all of the data i can get from parallelization, the amount of dopamine could cure my depression |
09:23:45 | PMunch | @Rika, sure that's also an option |
09:23:50 | FromDiscord | <Rika> In reply to @retkid "because i wanna look": Parallelisation is not easy |
09:24:17 | FromDiscord | <retkid> its possible in Vulkan, and I want to see how far I'd get before giving up |
09:25:43 | FromDiscord | <Elegantbeef> Or you could use ogl and actually make something |
09:26:20 | FromDiscord | <retkid> but it may be 2% faster in certain hardware configurations with vulkan |
09:26:26 | FromDiscord | <Rika> Possible sure, how long will it take you to do it though, let alone properly |
09:26:53 | FromDiscord | <Rika> That extra 2% wonโt get utilised if you make stuff wrong |
09:27:10 | FromDiscord | <Elegantbeef> Opengl is plenty fast if written well |
09:27:18 | FromDiscord | <sOkam!> In reply to @retkid "how bad can vulkan": everything new you have to code yourself. the structure gives you raw access, so starting to just draw something is a nightmareโตonce you have that going, and you create your own interface/api for your architecture, I heard it becomes just like any other apiโตproblem is getting to that point is hell |
09:27:44 | FromDiscord | <retkid> well, I dont wanna draw things I want to do parallelized math and data processing |
09:27:58 | FromDiscord | <retkid> which is a whole separate field of pain |
09:28:03 | FromDiscord | <Rika> Then Vulcan isnโt your framework |
09:28:11 | FromDiscord | <Rika> Vulkan sorry |
09:28:32 | FromDiscord | <retkid> its ok its not an english word and English K rules suck |
09:28:48 | FromDiscord | <retkid> Italian only has a C and Its much better for it |
09:28:55 | FromDiscord | <sOkam!> i've been recommended to go gl4 until vulkan gets a "simpler" api, by a friend who has been working in the field for over a decade. so.... I will trust that and stick to gl4 for now myself |
09:29:32 | FromDiscord | <retkid> I was wondering if Cuda is good |
09:29:32 | FromDiscord | <sOkam!> he said that vulkan is not worth it, unless you plan on working specifically in graphics exclusively |
09:30:03 | FromDiscord | <Rika> Itโs kinda like buying a Bugatti as your first car, sure itโs fast but do you know how to use it to its full potential |
09:30:04 | FromDiscord | <retkid> I think Cuda is what i'm really looking for |
09:30:22 | FromDiscord | <Rika> In reply to @retkid "I think Cuda is": Perhaps, that sounds more appropriate |
09:30:49 | FromDiscord | <retkid> however, Cuda is exclusive to Nvidia and opencl isn't really a perect alternative |
09:30:53 | FromDiscord | <pruno> sent a code paste, see https://play.nim-lang.org/#ix=3RL3 |
09:30:58 | FromDiscord | <retkid> perfect |
09:31:10 | FromDiscord | <pruno> (edit) "https://play.nim-lang.org/#ix=3RL3" => "https://play.nim-lang.org/#ix=3RL4" |
09:31:28 | FromDiscord | <Rika> In reply to @retkid "however, Cuda is exclusive": Parallelisation is platform specific |
09:31:44 | FromDiscord | <retkid> https://tenor.com/view/pepe-why-pepe-pepehands-crying-gif-12683546 |
09:32:32 | FromDiscord | <Rika> Itโs not even just architecturally specific even |
09:32:49 | FromDiscord | <retkid> In reply to @pruno "Hello, i have an": are you having trouble compiling the proc or are you calling that proc thats the trouble |
09:32:59 | FromDiscord | <pruno> In reply to @retkid "are you having trouble": Compiling it |
09:33:43 | FromDiscord | <Elegantbeef> Are you attempting to call it at compile time? |
09:34:38 | FromDiscord | <Rika> In reply to @Rika "Parallelisation is platform specific": In the end, whatโs your overarching goal? |
09:34:57 | FromDiscord | <Rika> You want to do parallelised data processing in what situation s |
09:35:15 | FromDiscord | <retkid> In reply to @Rika "In the end, whatโs": learn more about executing code on a gpu to increase data throughput when the need arises \ |
09:35:27 | FromDiscord | <Rika> Then whatโs wrong with just going with CUDA? |
09:35:43 | FromDiscord | <retkid> func toByteSeq(str: string): seq[byte] {.inline.} =โต ## Converts a string to the corresponding byte sequence.โต @(str.toOpenArrayByte(0, str.high)) |
09:35:55 | FromDiscord | <retkid> https://media.discordapp.net/attachments/371759389889003532/951050692586528768/2022-03-09_04-35.png |
09:36:36 | FromDiscord | <Rika> You literally have no choice but to get a GPU |
09:36:39 | FromDiscord | <Rika> Or rent one |
09:36:44 | FromDiscord | <Rika> Renting one is very expensive |
09:36:50 | FromDiscord | <retkid> also Nvidia platform exclusivity, a company which isn't the most driver friendly for linux |
09:37:01 | FromDiscord | <retkid> which is my goat in the race |
09:37:27 | FromDiscord | <Rika> Maybe this will interest you |
09:37:29 | FromDiscord | <Rika> https://github.com/ROCm-Developer-Tools/HIP |
09:37:35 | FromDiscord | <Elegantbeef> Well use an opengl compute shader ๐ |
09:37:41 | FromDiscord | <demotomohiro> sent a long message, see http://ix.io/3RL5 |
09:37:56 | FromDiscord | <pruno> In reply to @Elegantbeef "Are you attempting to": It was indeed the issue, thanks :) |
09:38:14 | FromDiscord | <retkid> In reply to @Rika "https://github.com/ROCm-Developer-Tools/HIP": this is the coolest thing since I discovered poc1 yesterday |
09:38:28 | FromDiscord | <Rika> In reply to @Elegantbeef "Well use an opengl": Hmm good point |
09:38:43 | FromDiscord | <Elegantbeef> Except i dont think that gpu supports it |
09:38:47 | FromDiscord | <retkid> pocl |
09:39:28 | FromDiscord | <Rika> In reply to @Elegantbeef "Except i dont think": It probably doesnโt since itโs old |
09:41:27 | FromDiscord | <demotomohiro> In reply to @retkid "": Try `glxinfo | grep compute_shader` to see if compute shader is supported |
09:41:48 | FromDiscord | <Rika> Seems like it might https://media.discordapp.net/attachments/371759389889003532/951052175067480064/IMG_6667.png |
09:41:49 | FromDiscord | <retkid> In reply to @Rika "https://github.com/ROCm-Developer-Tools/HIP": I like this quite a bit, now all i need to do is find bindings in usable language |
09:42:19 | FromDiscord | <Rika> But itโs DX |
09:42:27 | FromDiscord | <retkid> https://i.imgur.com/gA2qjGI.png |
09:42:34 | FromDiscord | <Rika> Ah says below GL compute |
09:43:08 | FromDiscord | <retkid> https://media.discordapp.net/attachments/371759389889003532/951052511211577395/2022-03-09_04-43.png |
09:43:16 | FromDiscord | <retkid> looks like we have compute shaders, yes |
09:43:18 | FromDiscord | <Rika> Congrats |
09:45:38 | FromDiscord | <Rika> @retkid if youโre still on the fence https://media.discordapp.net/attachments/371759389889003532/951053137429557288/IMG_6668.png |
09:45:42 | FromDiscord | <Rika> https://shader-tutorial.dev/basics/introduction/ |
09:46:26 | FromDiscord | <retkid> this is for opengl compute shaders, correct? |
09:46:29 | FromDiscord | <retkid> and the shady-nim stuff |
09:46:40 | FromDiscord | <retkid> or the RCOM-HIP you sent me |
09:46:53 | FromDiscord | <Rika> Uh shaders |
09:46:55 | FromDiscord | <Rika> Itโs for shaders |
09:48:26 | FromDiscord | <sOkam!> shady looks dope af |
09:48:58 | FromDiscord | <retkid> shady does look very cool |
09:49:10 | FromDiscord | <retkid> I shall research this further and write code soon^tm |
10:00:19 | FromDiscord | <mratsim> In reply to @retkid "I shall research this": what do you want to do? |
10:00:56 | FromDiscord | <mratsim> otherwise you target LLVM IR and you have LLVM JIT code for Nvidia, AMD, DX12, OpenGL, Vulkan, Qualcomm Hexagon, ... |
10:01:08 | FromDiscord | <mratsim> but you need LLVM on the user machine. |
10:01:17 | FromDiscord | <mratsim> (edit) "but you need LLVM ... on" added "runtime" |
10:02:28 | FromDiscord | <retkid> DX12 and Vulken aren't really what I need |
10:02:36 | FromDiscord | <Rika> Oh really? You can do that? Cool |
10:03:19 | FromDiscord | <retkid> I am unable to focus on anything rn in order to properly understand stuff |
10:03:34 | FromDiscord | <retkid> I cant focus on anything and am searching for a podcast to help |
10:16:40 | FromDiscord | <Schelz> sent a code paste, see https://paste.rs/x1t |
10:17:20 | FromDiscord | <Schelz> ImDrawData is struct, so i have do make a type object and use it as an args in proc ? |
10:18:22 | FromDiscord | <Elegantbeef> What's the special args? |
10:18:50 | FromDiscord | <Elegantbeef> It's just a `ptr ImDrawData` you can use `create` and `dealloc` or use a stack value and pass the `addr` of it |
10:22:36 | FromDiscord | <Schelz> But if i want to import it from cpp it would be type ImDrawData {.importcpp ....} = object ? |
10:22:51 | FromDiscord | <Elegantbeef> I believe so |
10:23:26 | FromDiscord | <Schelz> Aha cause i search for examples and the only example was used to define the return type for proc |
10:23:32 | FromDiscord | <Schelz> (edit) "Aha" => "Aha," |
10:23:37 | PMunch | Hmm, interesting issue with Futhark.. |
10:24:51 | PMunch | So a header file which contains a `static inline` function will simply be inlined and won't be generated in e.g. a dynamic library |
10:25:06 | PMunch | So if I generate a definition for it there is no way to call it |
11:06:37 | FromDiscord | <Mysterysib> Why is awk so difficult |
11:22:55 | * | Gustavo6046 quit (Quit: Leaving) |
11:28:00 | Amun-Ra | awk is awkward |
11:29:46 | FromDiscord | <Rika> Wrong channel? Hehe |
11:30:33 | Amun-Ra | ;> |
11:32:45 | FromDiscord | <retkid> could i theoretically get a nim program to run forever or would there be GC issues? |
11:33:54 | FromDiscord | <Rika> You can |
11:34:01 | FromDiscord | <Rika> How else do server programs work |
11:34:08 | FromDiscord | <retkid> look |
11:34:27 | FromDiscord | <Rika> I am looking ๐ |
11:34:50 | FromDiscord | <retkid> sometimes I think about the story about Lisp at Nasa |
11:34:50 | Amun-Ra | GC issues? like some kind of cyclic deps resulting in growing memory usage? |
11:35:07 | FromDiscord | <retkid> something eventually leading to a segfault |
11:35:21 | Amun-Ra | I don't think segfaults are gc related |
11:35:21 | FromDiscord | <Rika> That wouldnโt be an issue unless a reference to such cycle was held unnecessarily |
11:35:31 | FromDiscord | <Rika> In reply to @Amun-Ra "I don't think segfaults": They can be in some way |
11:35:33 | FromDiscord | <retkid> sometimes they are |
11:35:40 | Amun-Ra | Rika: you know what I mean |
11:35:50 | FromDiscord | <Rika> No I do not, they can be |
11:35:55 | Amun-Ra | yes, but usually it's a dangling pointer |
11:35:59 | Amun-Ra | etc. |
11:36:01 | FromDiscord | <retkid> no |
11:36:17 | FromDiscord | <retkid> I'm not doing anything directly that does anything with pointers |
11:36:22 | FromDiscord | <Rika> Okay I guess I understand what you mean now |
11:36:29 | FromDiscord | <Rika> In reply to @retkid "I'm not doing anything": Thatโs not what he means |
11:36:34 | FromDiscord | <retkid> well I mean that |
11:36:36 | FromDiscord | <Rika> References are ultimately just pointers |
11:37:04 | FromDiscord | <retkid> sometimes things are freed unexpectedly and stuff just cascades unexpectedly |
11:37:30 | FromDiscord | <retkid> or something |
11:37:32 | FromDiscord | <retkid> brain hazey |
11:37:35 | FromDiscord | <Rika> That means your GC is misbehaving aka a bug |
11:37:43 | FromDiscord | <Rika> Or you did something wrong |
11:37:51 | FromDiscord | <Rika> A cast or a conversion that was improper |
11:38:07 | FromDiscord | <Rika> Conversions usually donโt break though so itโs usually a casts fault |
11:38:29 | FromDiscord | <Rika> In reply to @Rika "Or you did something": You or someone else in the case of a library |
11:41:24 | * | jmdaemon quit (Ping timeout: 240 seconds) |
11:41:55 | FromDiscord | <retkid> a good 15% of the time my code just breaks and i cant figure out why so i rewrite it to be better |
11:42:01 | FromDiscord | <retkid> or find a workaround |
11:42:13 | FromDiscord | <retkid> sometimes arbitrarily rewriting code makes it better |
11:50:42 | FromDiscord | <Require Support> sent a code paste, see https://paste.rs/EZh |
11:52:21 | * | ltriant quit (Ping timeout: 256 seconds) |
11:53:33 | FromDiscord | <Require Support> looks like it might be in std/tables |
11:56:11 | FromDiscord | <Papel> I think the nim equivalent are enumโตhttps://nim-by-example.github.io/types/enums/ |
12:06:02 | * | supakeen quit (Quit: WeeChat 3.4) |
12:06:31 | * | supakeen joined #nim |
12:13:20 | FromDiscord | <congusbongus> yes it's tablesโตno it's not enums, they're different |
12:24:04 | FromDiscord | <enthus1ast> i've just released Hot Code Reloading for Nimja, please check it out and give feedback \:) โตhttps://forum.nim-lang.org/t/8384โตhttps://github.com/enthus1ast/nimja |
12:24:31 | * | arkurious joined #nim |
12:33:19 | * | arkurious quit (Quit: Leaving) |
12:38:34 | FromDiscord | <madman> sent a code paste, see https://play.nim-lang.org/#ix=3RLR |
13:06:20 | * | ltriant joined #nim |
13:09:58 | FromDiscord | <auxym> well does the z: path exist? Also what line is the stacktrace pointing to? |
13:11:00 | * | ltriant quit (Ping timeout: 240 seconds) |
13:16:46 | * | rockcavera joined #nim |
13:16:46 | * | rockcavera quit (Changing host) |
13:16:46 | * | rockcavera joined #nim |
13:27:49 | PMunch | @Require_Support, looks like you might want a tuple TBH |
13:28:08 | FromDiscord | <madman> In reply to @auxym "well does the z:": `Z:/` is a network drive. `xxx.yyy.zzz.aaa://Test/Art` |
13:33:37 | PMunch | What?! A new release of Futhark so soon after the last one? Crazy! https://github.com/PMunch/futhark/releases/tag/v0.5.0 |
13:38:16 | FromDiscord | <System64 ~ Flandre Scarlet> Paths still not fixed :/ |
13:39:36 | FromDiscord | <ajusa> Hey PMunch, have you seen my PR for the playground? Just confirming you know it exists, not rushing you to take a look at it |
13:47:56 | PMunch | @System64_~_Flandre_Scarlet, no unfortunately not. I still don't have Windows :( |
13:48:10 | PMunch | @ajusa, yup I've seen it, but I haven't had a chance to look at it yet |
13:48:20 | FromDiscord | <madman> sent a code paste, see https://play.nim-lang.org/#ix=3RM1 |
13:48:31 | PMunch | But you mentioned that you weren't able to build the playground docker containers? |
13:48:36 | FromDiscord | <madman> prolly something with windows |
13:50:44 | FromDiscord | <Schelz> typedef struct in cpp imports the same in nim as simple struct ? |
13:50:55 | PMunch | Hmm, that line points at some windows file info structure to Nim file info object conversion logic |
13:50:59 | FromDiscord | <Schelz> (edit) "simple struct" => ""simple "struct" |
13:51:06 | PMunch | Please report that on GitHub |
13:51:15 | PMunch | If an issue doesn't exist for it already |
13:51:28 | PMunch | @Schelz, what do you mean? |
13:52:41 | FromDiscord | <Schelz> sent a code paste, see https://play.nim-lang.org/#ix=3RM3 |
13:53:07 | FromDiscord | <Rika> looks right to me |
13:53:11 | FromDiscord | <Schelz> so for typedef struct its use the same method ? |
13:53:34 | FromDiscord | <Schelz> (edit) "its" => "do i" |
13:54:30 | FromDiscord | <Schelz> sent a code paste, see https://play.nim-lang.org/#ix=3RM4 |
13:55:31 | PMunch | Yes, but then your `importcpp` becomes `struct IDirect3DDevice9` |
13:55:49 | FromDiscord | <ajusa> In reply to @PMunch "But you mentioned that": Yes, I was unable to get the containers working. The one with the nimble packages errors due to a package not building, and the one without nimble packages errors when installing Nim |
13:55:50 | PMunch | Well, it's probably typedef-ed to something else |
13:56:08 | PMunch | So you can choose whether or not you want the struct version or the typedefed version |
13:56:19 | FromDiscord | <Schelz> In reply to @PMunch "Yes, but then your": ok thx |
13:56:25 | PMunch | Do you have the error @ajusa? |
13:56:47 | PMunch | It's probably just that it is missing the required version file to pick the version it should build |
13:57:01 | PMunch | That container is built by a script which passes in the version to build through a file |
13:57:09 | FromDiscord | <ajusa> I did add the version file correctly |
13:57:22 | PMunch | And what was the error then? |
13:57:34 | FromDiscord | <ajusa> It fails after that, and I don't remember the error (it was last week) |
13:58:04 | PMunch | Should've created an issue so I could've fixed it for you |
14:00:45 | FromDiscord | <ajusa> Yeah, I'll do that. Would it be possible for you to confirm that the docker build without packages works? |
14:00:54 | FromDiscord | <ajusa> We need readme instructions on the setup anyway |
14:14:18 | FromDiscord | <exelotl> Say I'm wrapping a C library with a bunch of different init functions depending on what "mode" you want to use it in. |
14:15:12 | FromDiscord | <exelotl> sent a code paste, see https://play.nim-lang.org/#ix=3RMc |
14:15:44 | FromDiscord | <exelotl> sent a code paste, see https://paste.rs/6BX |
14:16:42 | Amun-Ra | don't use int when importc, use cint |
14:16:48 | FromDiscord | <exelotl> sent a code paste, see https://paste.rs/Njn |
14:17:18 | FromDiscord | <Rika> ah yes that discussion |
14:17:23 | FromDiscord | <exelotl> this code is only targetting 32-bit ARM so it's safe to use `int` |
14:17:49 | FromDiscord | <Rika> sent a code paste, see https://paste.rs/ZYg |
14:18:03 | FromDiscord | <Rika> i personally think the nicest is the last, but the middle is ok too |
14:18:29 | FromDiscord | <exelotl> yeah, it's just that in this case the init is initialising the module, not an instance of a type ๐
|
14:18:34 | FromDiscord | <Rika> either way can utilise passed typedescs like from generics or so |
14:18:39 | FromDiscord | <Rika> oh really |
14:18:45 | FromDiscord | <Rika> hmm |
14:18:48 | FromDiscord | <Rika> let me think about that then |
14:19:09 | FromDiscord | <Rika> maybe name it differently than just "init" then |
14:19:21 | FromDiscord | <Rika> maybe moduleInit or initModule whichever ya like |
14:20:14 | FromDiscord | <Rika> either way (initT vs init[T]) works imo, maybe first over second since theres (probably?) no benefit to generics |
14:30:28 | FromDiscord | <Mysterysib> Who's the maintainer of choosenim? |
14:31:34 | Amun-Ra | dom? |
14:31:55 | FromDiscord | <Rika> yes |
14:43:05 | PMunch | @ajusa, I've updated my machine since I started it. So I'd have to reboot my machine to try it |
14:43:20 | PMunch | And I'm done at work in 15 minutes and will go home |
14:43:44 | PMunch | And I'm going to be away in London until Tuesday, so I won't be able to check anything soon :P |
14:44:05 | FromDiscord | <ajusa> Alright, not a problem lol |
14:45:46 | PMunch | Hmm, it seems like the server hasn't auto-built the 1.6.4 version either. So maybe there is something wrong with the script |
14:45:56 | PMunch | I'm running the script on the server now to see if it errors out |
14:46:06 | FromDiscord | <Rika> inb4 enospc |
15:03:46 | PMunch | @ajusa, seems to build just fine on the server |
15:04:12 | * | rockcavera quit (Ping timeout: 240 seconds) |
15:04:30 | FromDiscord | <ajusa> Well I'm stumped then, no clue why I can get it to work on my machine |
15:04:38 | FromDiscord | <ajusa> (edit) "can" => "can't" |
15:05:53 | PMunch | At least 1.2.14 bulids fine |
15:06:04 | PMunch | 1.6.0 seems to have some trouble with rand.. |
15:08:52 | NimEventer | New thread by Mardiyah: On Warning: Deprecated since v1.4; there should not be high, see https://forum.nim-lang.org/t/8992 |
15:09:17 | FromDiscord | <hotdog> In reply to @PMunch "And I'm going to": Welcome to London! ๐ด๓ ง๓ ข๓ ฅ๓ ฎ๓ ง๓ ฟ ๐ฅณ |
15:15:05 | PMunch | Thank you :) |
15:16:11 | * | PMunch quit (Quit: Leaving) |
15:38:16 | FromDiscord | <lantos> @dom96 is there anything special you need to do to get nim sdl2 working on m1? |
15:39:01 | FromDiscord | <lantos> sent a code paste, see https://play.nim-lang.org/#ix=3RMJ |
16:12:08 | * | ltriant joined #nim |
16:16:36 | * | ltriant quit (Ping timeout: 240 seconds) |
16:43:16 | * | vicfred joined #nim |
16:48:57 | * | slowButPresent joined #nim |
16:52:31 | * | vicfred quit (Quit: Leaving) |
16:54:27 | FromDiscord | <gibson> If I declare a `var name: cstring` will that be GCed correctly? Is the only downside to using cstring the fact that there are fewer helper utilities? I ask because I'm using `seq[cstring]` so I can pass the underlying data around for read-only access cheaply to external libraries. |
16:58:53 | FromDiscord | <Rika> it will not be gced at all i believe |
17:02:28 | FromDiscord | <gibson> Ohhh. dang. |
17:04:37 | FromDiscord | <gibson> Confirmed: `GC_unref()` on cstring probably shows `Error: type mismatch: got (cstring) but expected one of: system.GC_unref(x: seq[T]) system.GC_unref(x: string) system.GC_unref(x: ref T)` |
17:06:46 | FromDiscord | <Schelz> sent a code paste, see https://play.nim-lang.org/#ix=3RMZ |
17:07:04 | FromDiscord | <Schelz> cause its not a namespace and i have no clue ๐ |
17:07:45 | * | Zectbumo joined #nim |
17:24:59 | FromDiscord | <Rika> wdym? `{.importcpp: "::GetDeviceCaps".}`? idk |
17:27:26 | * | rwb is now known as rb |
17:31:52 | FromDiscord | <Schelz> idk if that work hmmm |
17:32:10 | FromDiscord | <Rika> it was a guess, im not sure either |
17:32:35 | FromDiscord | <Schelz> first i thought its a namespace from other header but its not |
17:32:43 | FromDiscord | <Schelz> some cpp thingy |
17:34:11 | FromDiscord | <Rika> idk cpp that well so |
17:34:45 | FromDiscord | <Schelz> sent a code paste, see https://play.nim-lang.org/#ix=3RN2 |
17:35:10 | FromDiscord | <Schelz> and thats weird cause its not used in the header but error me that its not defined |
17:35:34 | FromDiscord | <Schelz> example https://media.discordapp.net/attachments/371759389889003532/951171397273649182/unknown.png |
17:41:52 | FromDiscord | <Schelz> sent a code paste, see https://paste.rs/ODd |
17:43:36 | * | jjido joined #nim |
17:54:04 | FromDiscord | <madman> In reply to @Schelz "so i found out": https://github.com/khchen/winimโตmaybe this will help u make cpp bindings |
17:56:46 | FromDiscord | <Schelz> sent a code paste, see https://play.nim-lang.org/#ix=3RNa |
17:57:08 | FromDiscord | <Schelz> lame ik but i will remake it after i see some results |
17:58:15 | FromDiscord | <madman> binding to c is way easier |
17:58:23 | FromDiscord | <madman> fuck cpp |
17:58:33 | FromDiscord | <madman> (edit) "fuck" => "fk" |
17:58:58 | FromDiscord | <Schelz> ik but if you know that to bind and how its ez ๐ |
17:59:04 | FromDiscord | <Schelz> (edit) "that" => "what " |
17:59:12 | FromDiscord | <Schelz> (edit) removed "" |
18:00:34 | FromDiscord | <madman> yeah sure, it also depends on if there is a build system to what ur binding to |
18:00:46 | FromDiscord | <madman> in my experience, that makes things way messier |
18:01:01 | FromDiscord | <madman> https://github.com/IbrahimHindawi/Knim |
18:01:58 | FromDiscord | <madman> i guess it is the oop stuff that makes binding to cpp a bit more convoluted, anw best of luck |
18:02:49 | FromDiscord | <Schelz> thx |
18:06:34 | * | jjido quit (Quit: My MacBook Air has gone to sleep. ZZZzzzโฆ) |
18:06:47 | FromDiscord | <madman> u can always go straight MASM64/DX11 โตhttps://github.com/IbrahimHindawi/masm64dx<a:kirby_vibes:815995887750217859> |
18:26:27 | * | jjido joined #nim |
18:30:19 | FromDiscord | <gibson> @Schelz Worth a shot to ask if you've tried one of the c++ helper wrappers? https://github.com/n0bra1n3r/cinterop |
18:31:25 | FromDiscord | <gibson> They apparently used it to wrap the Diligent 3D Engine |
18:33:33 | FromDiscord | <dom96> In reply to @lantos "<@!132595483838251008> is there anything": no idea, don't have an m1 |
18:34:02 | FromDiscord | <lantos> ahh whoops thought you were using a mac |
18:35:08 | FromDiscord | <dom96> still running my 2014 boy ๐ |
18:35:33 | FromDiscord | <dom96> in any case, you should be able to find some answers online hopefully |
18:35:39 | FromDiscord | <dom96> this shouldn't be Nim-specific |
18:52:50 | * | jjido quit (Quit: My MacBook Air has gone to sleep. ZZZzzzโฆ) |
19:00:34 | FromDiscord | <lantos> snap nokia of laptops?โตโตmm yeah your right its not really nim specifi, nim is trying to dynamically link from /usr/local/lib /usr/lib but on mac brew installs librarys to /opt/homebrew/โตI just ln -s the two but not sure why nim isn't respecting LIBRARY_PATH envar which is set to /opt/homebrew |
19:00:38 | FromDiscord | <lantos> (edit) "specifi," => "specific," |
19:00:56 | FromDiscord | <lantos> (edit) "snap nokia of laptops?โตโตmm yeah your right its not really nim specific, nim is trying to dynamically link from /usr/local/lib ... /usr/liblibrary's" added "or" | "librarys" => "library's" |
19:02:15 | FromDiscord | <lantos> (edit) |
19:07:38 | * | Zectbumo quit (Remote host closed the connection) |
19:11:10 | * | jjido joined #nim |
19:24:06 | FromDiscord | <Waldecir Santos> Do we have a tutorial explaining the diference between `ref object` and `object` when declaring an new object/type ? |
19:24:34 | FromDiscord | <Waldecir Santos> I've checked https://nim-lang.org/docs/tut1.html#advanced-types-reference-and-pointer-types but still some confusion |
19:24:59 | FromDiscord | <Phil> Wasn't "ref object" just a "pass any object of this type by reference and not by value" type of deal? |
19:27:10 | FromDiscord | <Waldecir Santos> I understand that ref is a traced pointer for GC to work, but I don't get what is the diference without it |
19:27:19 | FromDiscord | <Waldecir Santos> because my code works ok with or without it |
19:28:26 | * | neurocyte0917090 joined #nim |
19:35:45 | FromDiscord | <huantian> Ref types essentially allow multiple variable to point to the same value (mutate one object -> each variable changes), and itโs also used whenever you need to have one object point to another |
19:36:48 | FromDiscord | <Waldecir Santos> Sure I got that, but for example how it behaves without it ? |
19:37:34 | FromDiscord | <Rika> in many situations there is no behavioural difference |
19:37:42 | FromDiscord | <Rika> aside from performance, perhaps |
19:38:39 | FromDiscord | <Waldecir Santos> You mean the code should be more performant with `ref` ? |
19:48:36 | FromDiscord | <Rika> no |
19:48:45 | FromDiscord | <Rika> the performance will differ depending on usage' |
19:59:27 | FromDiscord | <exelotl> non-ref objects have by-value semantics, same as integers and other primitive types |
20:02:26 | FromDiscord | <exelotl> sent a code paste, see https://play.nim-lang.org/#ix=3RNL |
20:11:21 | FromDiscord | <exelotl> There are some subtleties: If the type is large (bigger than 3 ints, I believe) then Nim will still secretly pass it by reference to procedures. The semantics don't change though (since you can't mutate arguments unless they're `var` params) and you can use the {.bycopy.} and {.byref.} pragmas to control this optimisation. I guess it's important to note that passing by reference is not the same as 'ref' types. |
20:14:59 | * | ltriant joined #nim |
20:19:50 | * | ltriant quit (Ping timeout: 256 seconds) |
20:27:12 | * | jjido quit (Quit: My MacBook Air has gone to sleep. ZZZzzzโฆ) |
20:27:45 | FromDiscord | <Waldecir Santos> Perfect Thank you @exelotl I'll play around with it |
21:11:57 | * | Gustavo6046 joined #nim |
21:12:55 | * | Gustavo6046 quit (Remote host closed the connection) |
21:13:14 | * | Gustavo6046 joined #nim |
21:18:36 | * | krux02 joined #nim |
21:41:55 | * | wyrd quit (Ping timeout: 240 seconds) |
21:44:04 | * | wyrd joined #nim |
21:45:10 | FromDiscord | <Waldecir Santos> Is there a way to know if the object is a ref ? e.g isRef ? I'd like to have a proc that dereference if it's a ref so it's transparent |
21:46:12 | FromDiscord | <ynfle> In reply to @Waldecir Santos "Is there a way": What do you mean by transparent? |
21:46:45 | FromDiscord | <Waldecir Santos> I mean I want a proc that can receive a non-ref and a ref object, and I want it to "automatically deref" it |
21:46:53 | FromDiscord | <demotomohiro> How about to use `is` operaator and `ref` type class? |
21:47:11 | FromDiscord | <Waldecir Santos> That is a good idea |
21:47:15 | FromDiscord | <ynfle> sent a code paste, see https://play.nim-lang.org/#ix=3ROh |
21:48:03 | FromDiscord | <ynfle> In reply to @Waldecir Santos "I mean I want": What do want to do with deferencing? You can automcatically access fields for ref objects with out dereferncing |
21:48:24 | FromDiscord | <Waldecir Santos> In reply to @ynfle "What do want to": I can't when accessing `fieldPairs` |
21:48:42 | FromDiscord | <ynfle> In reply to @Waldecir Santos "I can't when accessing": Ah |
21:49:06 | FromDiscord | <Waldecir Santos> That's whyI need a "transparent" way of accessing ref and non-ref |
21:51:28 | FromDiscord | <ynfle> https://play.nim-lang.org/#ix=3ROj |
21:52:04 | FromDiscord | <Waldecir Santos> In reply to @ynfle "https://play.nim-lang.org/#ix=3ROj": Yeap that is awesome, thank you |
21:55:26 | FromDiscord | <ynfle> ๐ |
21:58:28 | * | ltriant joined #nim |
22:08:08 | * | jjido joined #nim |
22:13:22 | anddam | is the C comparison at https://youtu.be/D_G9h7DcIqM even valid C code with the = in the declaration? |
22:13:29 | anddam | that is https://youtu.be/D_G9h7DcIqM?t=1309 sorry |
22:17:18 | FromDiscord | <Generic> what do you mean? |
22:18:22 | FromDiscord | <Rika> have you considered that this might be C++ or did araq mention it was explicitly C |
22:28:02 | FromDiscord | <demotomohiro> If I remember correctly, C dont have default value for function parameter. C++ has. |
22:31:16 | FromDiscord | <Schelz> In reply to @gibson "<@!354911589029380097> Worth a shot": For what reason aint that hard to compile with headers and importcpp |
22:31:44 | FromDiscord | <gibson> Oh sorry, I thought you were having difficulty wrapping OOP c++ stuff. |
22:32:24 | FromDiscord | <Schelz> maybe d3d9 but for imgui_impl_win32 and imgui_impl_dx9 its ez, thx tho for the tip |
22:32:35 | anddam | I mean I am listening to the presentation, I assume araq is Rumpf's nickname and he did said "C", IIRC C does not have optional args |
22:34:27 | FromDiscord | <Elegantbeef> It's not valid afaik |
22:35:15 | anddam | ok, now I have an odder request |
22:35:37 | anddam | can someone from discord put a space in its displayed name? |
22:36:11 | FromDiscord | <Elegantbeef> Nah the space doesnt work well for mentioning ๐ |
22:36:56 | anddam | I tweaked a bit my irc script to convert nicknames from message relayed over IRC, but I should wwait until "Waldecir Santos" write again and messes up my client |
22:37:17 | anddam | threw a couple typos in there as well |
22:37:49 | FromDiscord | <Elegantbeef> typos are always fun |
22:37:55 | FromDiscord | <Elegantbeef> Fuck the magical thing is i'm not even on discord ๐ |
22:38:21 | anddam | what are you using? |
22:38:52 | anddam | your messages are being relayed by FromDiscord bot though |
22:39:22 | anddam | any taker? I do not know Discord so I don't know if it's a quick task to change one's nick on-the-fly |
22:42:01 | FromDiscord | <wsantos> fixed ๐ |
22:43:06 | FromDiscord | <gibson> Would a `seq[cstring]` be relatively safe if I only ever read from it to `string`s and `dealloc` each element of the seq at its end of life? |
22:43:21 | anddam | wsantos: no, please put a space back |
22:43:42 | anddam | I did edit the script, now you're taking away my test case |
22:44:03 | FromDiscord | <wsantos> Actually my nick is wsantos, but I never noticed that Discord had my name like that. |
22:44:36 | FromDiscord | <Elegantbeef> I'm using matrix and it's bridge through discord |
22:44:51 | anddam | ok, and can you please put a space back for a couple minutes? I had to stare a perl code to fix this, I did not enjoy it |
22:45:08 | anddam | x/stare a/ a/t/ |
22:45:34 | FromDiscord | <Elegantbeef> Gibson i dont know what you're saying |
22:46:09 | FromDiscord | <Elegantbeef> It's unsafe if the cstrings point to any string that is mutated or to be destroyed |
22:47:42 | FromDiscord | <demo tomohiro> done |
22:48:20 | FromDiscord | <demo tomohiro> I put space in user name. Is your script work? |
22:48:27 | anddam | noice, it's correctly rewriting the nick |
22:48:32 | anddam | demotomohiro: thx |
22:48:44 | FromDiscord | <Waldecir Santos> sure, here we go again ๐ |
22:48:54 | FromDiscord | <gibson> I need to pass a giant list of strings back and forth from nim to C++ and would rather not copy them. I'm willing to go through the mild pain of only making cstrings if that's what it takes. Hopefully I'm overlooking something far more obvious! |
22:49:55 | FromDiscord | <Elegantbeef> Well you can use cstring assuming the life time of the string in Nim is longer then your use case |
22:50:05 | FromDiscord | <Elegantbeef> If you mutate the string or if the pointer outlives the cstring you're going to have dragons |
22:50:10 | anddam | Waldecir Santos: yours is fine too |
22:50:56 | FromDiscord | <gibson> It is indeed. If I mutate the string, my understanding is I need to dealloc and then assign the new cstring value to be hygienic with memory. |
22:51:16 | FromDiscord | <Waldecir Santos> Nice, I'll go back to wsantos tomorrow ๐ |
22:51:17 | FromDiscord | <Elegantbeef> Well Nim has a "free" `cstring` conversion for strings |
22:51:30 | FromDiscord | <Elegantbeef> You just have to ensure you replace the element when the string mutates |
22:51:32 | FromDiscord | <gibson> Right, but it seems not to work on a seq of strings. |
22:52:18 | FromDiscord | <gibson> Okay, yes I'll be replacing the element when the cstring mutates, and first I'll dealloc the existing cstring since it seems it's not under GC? |
22:52:33 | FromDiscord | <gibson> (edit) "strings." => "cstrings." |
22:52:48 | termer | Is it possible to inherit multiple objects? |
22:52:48 | FromDiscord | <gibson> (edit) "cstrings." => "strings." |
22:52:56 | FromDiscord | <Elegantbeef> I mean it still "works" you just have to do `import std/sequtils; var myCstrings = myStrings.mapit(cstring it)` |
22:53:04 | termer | like "ref of object Thing1, Thing2" |
22:53:09 | FromDiscord | <Elegantbeef> No MI is not in Nim |
22:53:13 | termer | Thanks |
22:53:17 | FromDiscord | <Elegantbeef> Well you do not want to dealloc the cstring |
22:53:28 | FromDiscord | <gibson> Oh really? |
22:53:39 | FromDiscord | <gibson> Okay. I'll just overwrite it with a new cstring then? |
22:53:44 | FromDiscord | <Elegantbeef> Assuming your `Cstring` is from `cstring myStr`\ |
22:54:18 | FromDiscord | <Elegantbeef> `cstring myStr` gives you a ptr to the first element in the string, if you use that for your `cstring` freeing that memory is 100% unsafe and will crash |
22:57:01 | FromDiscord | <gibson> I think my code has been working by chance. I assign cstrings from temporaries to test it, like: `var mylist:seq[cstring]; mylist.add "abc"` |
22:57:32 | FromDiscord | <Elegantbeef> In that case i think `"Abc"` is in your program data then it converts it to a cstring |
22:58:11 | FromDiscord | <gibson> I see. So really `cstring` is not a datatype, and I should remember that. |
22:58:20 | FromDiscord | <Elegantbeef> It's a pointer really |
22:59:12 | FromDiscord | <gibson> Okay, this clarified a lot. Thank you. |
22:59:35 | FromDiscord | <Elegantbeef> sent a code paste, see https://paste.rs/LFw |
23:00:31 | FromDiscord | <Elegantbeef> Make a bunch of operations like above and then you'll have a concurrent str, cstring collection that is safe |
23:01:37 | FromDiscord | <Elegantbeef> Cause the lifetime of the strings will be directly connected to the cstrings lifetime meaning the pointers will be pretty much never invalidated |
23:03:25 | * | supakeen_t joined #nim |
23:04:01 | FromDiscord | <gibson> Yeah, I realize I need to keep the original strings around somewhere because cstring is just a pointer. In that way, updating my seq of cstring at time of calling an external Fn will actually not be that computationally expensive. |
23:04:06 | FromDiscord | <gibson> Thanks for the demo! |
23:04:18 | FromDiscord | <Elegantbeef> No problem |
23:04:28 | * | noeontheend joined #nim |
23:06:39 | * | noeontheend quit (Remote host closed the connection) |
23:07:31 | FromDiscord | <Elegantbeef> If you do use the above i'd probably suggest a macro for making life easy |
23:08:29 | FromDiscord | <Elegantbeef> sent a code paste, see https://play.nim-lang.org/#ix=3ROv |
23:10:45 | FromDiscord | <Elegantbeef> Replace is a bad example since it doesnt change the length but alas |
23:20:57 | * | supakeen_t quit (Quit: issued !quit command) |
23:22:47 | * | jmdaemon joined #nim |
23:28:34 | * | supakeen_test joined #nim |
23:33:54 | * | jmdaemon quit (Quit: ZNC 1.8.2 - https://znc.in) |
23:36:43 | * | jmdaemon joined #nim |