<< 09-03-2022 >>

00:22:50FromDiscord<Girvo> Morning all ๐Ÿ™‚
00:23:06FromDiscord<Girvo> Can you destructure-assign a `ptr` to an anonymous tuple?
00:24:04FromDiscord<Elegantbeef> `res[]`
00:24:04FromDiscord<Girvo> sent a code paste, see https://paste.rs/zBh
00:24:13FromDiscord<Girvo> sent a code paste, see https://play.nim-lang.org/#ix=3RJD
00:24:13FromDiscord<Girvo> Yeah that does work. Only way?
00:25:06FromDiscord<Elegantbeef> you need to dereference it so either `[]` or a `proc unpack(data: ptr tuple): typeof data[] = data[]`
00:25:16FromDiscord<Girvo> Okay sweet
00:25:18FromDiscord<Girvo> Cheers!
00:26:01FromDiscord<Elegantbeef> well it doesnt implicitly call unpack i should note
00:26:10FromDiscord<Elegantbeef> you still need to manually do `res.unpack`
00:26:11FromDiscord<Girvo> Oh yeah I understood haha
00:26:50FromDiscord<Elegantbeef> I do want to make an rfc for making a `=unpack` procedure called implicitly
00:27:15FromDiscord<Girvo> That would be really nice. Add to the ergonomics
00:33:03FromDiscord<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:32FromDiscord<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:19FromDiscord<Elegantbeef> `create((Lock, Guard))` but idk what you mean
00:36:20FromDiscord<Elegantbeef> Afaik there is no definitive way to say "Safe to address"
00:37:45FromDiscord<Girvo> Yeah that's fair
00:39:07FromDiscord<Girvo> `create()` is what I was missing (and `dealloc`). Awesome, thanks
00:42:41FromDiscord<Elegantbeef> `create` is just syntax sugar for `cast[ptr T](alloc(sizeof(T)))`
00:45:52FromDiscord<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:49FromDiscord<Girvo> Is there a generic type for a guarded variable? Or is that compiler magic more than anything else?
00:52:03FromDiscord<Girvo> `var t {.guard: lock.} = "Hello, from a locked variable"`โ†ตwhat is the type of `t`?
00:52:18FromDiscord<Elegantbeef> `echo typeof(t)` ๐Ÿ˜›
00:52:23FromDiscord<Girvo> Oh lol
00:55:49FromDiscord<Girvo> Just a `string`
00:56:03FromDiscord<Elegantbeef> Then it's all compiler magic
00:56:41FromDiscord<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:09FromDiscord<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:16FromDiscord<Elegantbeef> And a gcsafe annotated proc doesnt work why?
01:06:39FromDiscord<Girvo> Oh no, it does!
01:07:07FromDiscord<Elegantbeef> So what's the issue?
01:07:14FromDiscord<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:00FromDiscord<Elegantbeef> Oh you dont get the guard error?
01:08:33FromDiscord<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:12FromDiscord<Elegantbeef> Yea the type erasure is going to be a bitch
01:10:38FromDiscord<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:51FromDiscord<Elegantbeef> Actually is the string even guarded?
01:11:00FromDiscord<Elegantbeef> Like how are you calling this?
01:11:08FromDiscord<Girvo> `var t {.guard: lock.} = "Hello, from a locked variable"`
01:11:33FromDiscord<Girvo> sent a code paste, see https://play.nim-lang.org/#ix=3RJK
01:11:37FromDiscord<Elegantbeef> Sure but you're doing `t` which is a copy
01:11:58FromDiscord<Girvo> Oh yeah
01:12:01FromDiscord<Girvo> (edit) "https://play.nim-lang.org/#ix=3RJK" => "https://play.nim-lang.org/#ix=3RJL"
01:12:19FromDiscord<Elegantbeef> sent a code paste, see https://play.nim-lang.org/#ix=3RJM
01:12:54FromDiscord<Girvo> Lemme have a look
01:12:55FromDiscord<Elegantbeef> The above is probably what you want
01:12:59FromDiscord<Girvo> Yeah I think so too
01:13:13FromDiscord<Elegantbeef> Where the compiler knows `data` is guarded with `lock`
01:13:42FromDiscord<Girvo> Oh yeah then it should still pick up that its a guarded access to it. I'll give it a try
01:13:47FromDiscord<Elegantbeef> Guarding a global variable with lock only protects it on access of that variable
01:14:06FromDiscord<Girvo> Yeah so if a copy is triggering, it loses that (obviously)
01:15:13*arkurious quit (Quit: Leaving)
01:15:16FromDiscord<Elegantbeef> Sequences and strings behave as value types, so `=` is a copy generally(move semantics do apply)
01:15:28FromDiscord<Girvo> Yep makes sense
01:16:04FromDiscord<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:13FromDiscord<Elegantbeef> Me writting `Guarded`
01:17:21FromDiscord<Girvo> Hahaha
01:17:49FromDiscord<Girvo> Okay yeah! It does work, at least it seems so. I get proper guarded access to `thing.data` nice
01:18:06FromDiscord<Elegantbeef> Yay!
01:18:31FromDiscord<Girvo> I'll have a play with this, but it should work nicely for what I'm after here! Cheers ๐Ÿ™‚
01:18:54FromDiscord<Elegantbeef> Still need your `rtosThread` and `posixThread` macros ๐Ÿ˜›
01:19:16FromDiscord<Girvo> Hahaha I was literally just writing a message to say thats my next task ๐Ÿ˜‚
01:20:01FromDiscord<Elegantbeef> Ah, well micros is now public, but subject to change, if you want a easy api ๐Ÿ˜›
01:20:16FromDiscord<Girvo> Oooooh! I'll check it out for sure
01:20:29FromDiscord<Elegantbeef> Cant really beat this imo https://github.com/beef331/micros/blob/master/tests/test1.nim#L37-L50
01:20:47FromDiscord<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:00FromDiscord<Elegantbeef> Ah sounds fun
01:21:31FromDiscord<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:34FromDiscord<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:41FromDiscord<Elegantbeef> last year project\
01:22:56FromDiscord<Girvo> oh no haha
01:23:22FromDiscord<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:34FromDiscord<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:46FromDiscord<Elegantbeef> Lol
01:24:04FromDiscord<Girvo> With everything accessing/storing shit in a heap of (shared) global C++ objects
01:24:40FromDiscord<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:47FromDiscord<Elegantbeef> Hey I mainly do game dev, and most of IO is global, dont knock it till you try it ๐Ÿ˜›
01:25:53FromDiscord<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:19FromDiscord<Elegantbeef> Well here's hoping that Nim's macros/compiler allows you to get good programs
01:26:22FromDiscord<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:31FromDiscord<Girvo> Yeah thats the hope!
01:27:21FromDiscord<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:32FromDiscord<Elegantbeef> Now just if the EEs use distincts and sub range types
01:28:38FromDiscord<Elegantbeef> I'm only half joking, those two things seem very helpful in the world of embedded
01:48:11FromDiscord<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:24FromDiscord<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:44FromDiscord<Girvo> Ergonomic, hardware-constraint-aware APIs, safety, and speed. Whats not to love
01:58:24FromDiscord<Elegantbeef> As someone that has fixed many "X doesnt work but should" type compiler errors, the compiler errors ๐Ÿ˜›โ†ต(@Girvo)
02:00:44FromDiscord<Girvo> hehehehe
02:01:02FromDiscord<Girvo> Though hey, it could always be worse. looks at the errors in our C++ firmware when building
02:03:11FromDiscord<Girvo> Oooooh. Elcritch (the Nesper/Nephyr dev) has a great thread on some of what I'm trying to do right now
02:03:11FromDiscord<Girvo> https://forum.nim-lang.org/t/6976
02:06:30FromDiscord<Girvo> Hah, yeah passing `ptr ref T` is exactly what he was doing too after all for cross-thread variables
02:11:50FromDiscord<Elegantbeef> Yea that's a complicated thing to do
02:18:55FromDiscord<sOkam!> Is this correct? Switch can accept variables, right? https://media.discordapp.net/attachments/371759389889003532/950940718095007784/unknown.png
02:19:18FromDiscord<Elegantbeef> Should probably be `const`
02:19:28FromDiscord<sOkam!> Also, does the "path" switch accept multiple folders in some way?
02:19:59FromDiscord<Elegantbeef> Think you can just do `--path"a"; --path"b"`
02:23:28FromDiscord<sOkam!> sent a code paste, see https://play.nim-lang.org/#ix=3RJT
02:23:51FromDiscord<Elegantbeef> I think so
02:47:57*neurocyte0917090 quit (Ping timeout: 240 seconds)
03:00:45FromDiscord<Girvo> sent a code paste, see https://play.nim-lang.org/#ix=3RJY
03:00:54FromDiscord<Girvo> sent a code paste, see https://play.nim-lang.org/#ix=3RJZ
03:01:32FromDiscord<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:20FromDiscord<Girvo> https://media.discordapp.net/attachments/371759389889003532/950951897131532368/unknown.png
03:03:48FromDiscord<Girvo> Locked/guarded access to a shared variable between thread, and talking over UART to a (real) SIM7000 2G/4G modem
03:05:25FromDiscord<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:32FromDiscord<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:55FromDiscord<Elegantbeef> Congrats
03:17:09FromDiscord<Girvo> Thanks for your help beef, made a lot of things way clearer
03:17:21FromDiscord<Girvo> Now to wrap all this up in some nice macros/templates ๐Ÿ˜‰
03:17:27FromDiscord<Elegantbeef> Clear like mud is what i say
03:17:34FromDiscord<Girvo> yeah haha
03:18:03FromDiscord<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:02FromDiscord<Girvo> `{.global.}` is global life-time, not global visibility yeah?
03:27:20FromDiscord<Elegantbeef> it's equivlent to `static T name`
03:27:34FromDiscord<Elegantbeef> Yea global live span of course
03:27:50FromDiscord<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:53NimEventerNew thread by Ethernaut: SDL in a M1 Mac - can't find dylib, see https://forum.nim-lang.org/t/8990
04:14:25FromDiscord<Valdar> Is there a native way "add" two seqs to a third, or do I have to iterate through them?
04:15:45FromDiscord<Valdar> I should say 'add the values of each' as opposed to adding one to the end of the other
04:16:19FromDiscord<Elegantbeef> What do you mean?
04:18:00FromDiscord<Valdar> I have two seqs, same size, and I want to add the values of one to the other
04:18:08FromDiscord<Elegantbeef> https://nim-lang.org/docs/sequtils.html#foldl.t%2C%2C%2C ?
04:18:32FromDiscord<Valdar> In this case, it's two layers of noise that I want to combine
04:21:37FromDiscord<Valdar> I don't think fold will help
04:22:29FromDiscord<huantian> sent a code paste, see https://paste.rs/WW3
04:22:44FromDiscord<huantian> (edit) "https://paste.rs/Atq" => "https://paste.rs/8iX"
04:23:01FromDiscord<huantian> wow all the typos
04:23:09FromDiscord<huantian> (edit) "https://play.nim-lang.org/#ix=3RKb" => "https://play.nim-lang.org/#ix=3RKa"
04:27:03FromDiscord<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:59FromDiscord<huantian> I don't think there's any way to do this faster
04:28:17FromDiscord<huantian> one thing that could be improved in my solution is using `newSeqOfCap` to avoid allocations
04:29:04*jmdaemon joined #nim
04:29:38FromDiscord<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:56FromDiscord<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:52FromDiscord<congusbongus> sent a code paste, see https://paste.rs/WnZ
05:54:26FromDiscord<Elegantbeef> Presently Nim does not allow this so you'd need to do `ref Foo`
05:56:07*Gustavo6046 joined #nim
05:57:50FromDiscord<Elegantbeef> sent a code paste, see https://play.nim-lang.org/#ix=3RKu
06:05:08FromDiscord<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:39FromDiscord<Elegantbeef> https://nim-lang.org/docs/macros.html
06:06:10FromDiscord<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:15FromDiscord<Mysterysib> Thanks!
06:06:32FromDiscord<Elegantbeef> Can go even faster with `-d:danger` ๐Ÿ˜›
06:07:33FromDiscord<Mysterysib> Is there any way to create a type object with a dynamic amount of variables?
06:07:39FromDiscord<Valdar> haha, now that you mention it, I forgot that I have my setting for debug build lol
06:08:23FromDiscord<Elegantbeef> I assume you mean fields?
06:08:25FromDiscord<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:26FromDiscord<Elegantbeef> If so use tuples
06:08:45FromDiscord<Mysterysib> What do you mean by fields?
06:09:05FromDiscord<Mysterysib> Ohhh
06:09:08FromDiscord<Mysterysib> Yeah, exactly
06:09:42FromDiscord<Valdar> Beef, 7 milliseconds on danger ๐Ÿ™‚
06:10:08*Gustavo6046 quit (Ping timeout: 250 seconds)
06:11:50FromDiscord<Mysterysib> Are there docs for tuples?
06:12:03FromDiscord<Mysterysib> I found the docs for tuples in macros, but docs on tuples in general?
06:15:28FromDiscord<Valdar> https://nim-lang.org/docs/manual.html#types-tuples-and-object-types
06:15:47FromDiscord<Elegantbeef> Nim doesnt have dynamic objects by default
06:16:37FromDiscord<Mysterysib> if I make some fields of a sequence type, can I then append or remove values? Is there a list type?
06:17:16FromDiscord<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:21FromDiscord<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:45FromDiscord<Mysterysib> In reply to @Elegantbeef "There is `seq` but": Would a dynamic sequence in an object work?
06:18:29FromDiscord<Elegantbeef> I dont know what you're after
06:18:38FromDiscord<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:41FromDiscord<Elegantbeef> You could use a `Table[string, int]` if it's a single type
06:19:04FromDiscord<Elegantbeef> Json object is dynamic
06:19:11FromDiscord<Elegantbeef> It's the closest you can get to dynamic in Nim
06:19:19FromDiscord<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:28FromDiscord<Elegantbeef> You could
06:19:48FromDiscord<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:11FromDiscord<Elegantbeef> https://nim-lang.org/docs/json.html#delete%2CJsonNode%2Cstring
06:20:22FromDiscord<Elegantbeef> https://nim-lang.org/docs/json.html#add%2CJsonNode%2Cstring%2CJsonNode
06:20:34FromDiscord<Elegantbeef> Or https://nim-lang.org/docs/json.html#%5B%5D%3D%2CJsonNode%2Cstring%2CJsonNode
06:21:04FromDiscord<Mysterysib> Thanks, that's pretty simple!
06:22:02FromDiscord<Mysterysib> What is the purpose of having a static object, versus say, simply defining a table or JsonObject as a dynamic variable?
06:22:11FromDiscord<Mysterysib> Is there a speed advantage?
06:22:22FromDiscord<Elegantbeef> Massive, plus static typing
06:22:37FromDiscord<Elegantbeef> tables are slow
06:22:59FromDiscord<Mysterysib> are sequences faster?
06:23:08FromDiscord<Elegantbeef> Yes
06:23:17FromDiscord<Elegantbeef> Tables are slow purely due to indexing being a hash procedure
06:23:37FromDiscord<Elegantbeef> Sequences are fast since indexing is a cheap `ptrToStart + index`
06:24:11NimEventerNew 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:28FromDiscord<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:40FromDiscord<Mysterysib> (edit) "table" => "object"
06:24:43FromDiscord<Mysterysib> static object
06:25:04*Gustavo6046 joined #nim
06:25:34FromDiscord<Mysterysib> since accessing the dynamic data is all internal, indices in a sequence work without a problem
06:25:46FromDiscord<Elegantbeef> Sequence only really works if you want a key value relation
06:25:58FromDiscord<Elegantbeef> If you're iterating looking for a key it's going to be slower than a table
06:26:12FromDiscord<Elegantbeef> I mean "only really works if you dont want"
06:26:28*ltriant quit (Ping timeout: 272 seconds)
06:26:35FromDiscord<Mysterysib> oh, even if I leave the indices as numerical? like 0, 1, 2, etc
06:27:12FromDiscord<Elegantbeef> That's not really a key value relation
06:27:25FromDiscord<Elegantbeef> I'm talking about using a field
06:27:28FromDiscord<Elegantbeef> field name\
06:28:13FromDiscord<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:34FromDiscord<Mysterysib> yeah, some extra memory used, but my data is small enough that the impact would be minimal
06:28:40FromDiscord<Elegantbeef> That's how a sequence works
06:29:16FromDiscord<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:31FromDiscord<Elegantbeef> I dont follow
06:29:38FromDiscord<Mysterysib> I'll write an example
06:29:41FromDiscord<Elegantbeef> Then again i dont get why someone wants this dynamism
06:32:58FromDiscord<Mysterysib> sent a code paste, see https://paste.rs/qQW
06:33:44FromDiscord<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:47FromDiscord<Elegantbeef> get the `union` package then you can do `dynamicResponses: seq[union(string, int)]`
06:34:15FromDiscord<Mysterysib> Yay, cool ๐Ÿ™‚
06:34:42FromDiscord<Elegantbeef> Sorry it's `string | int` not `,`
06:37:12FromDiscord<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:11FromDiscord<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:01FromDiscord<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:18FromDiscord<Mysterysib> although that was against second data, not daily data
06:41:34FromDiscord<Mysterysib> so it was a lot data ๐Ÿ˜„
06:41:39FromDiscord<Mysterysib> (edit) "so it was a lot ... data" added "of"
06:42:12NimEventerNew 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:56FromDiscord<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:53FromDiscord<Elegantbeef> image.png https://media.discordapp.net/attachments/371759389889003532/951008155666640906/image.png
06:46:53FromDiscord<Elegantbeef> You can get stuff like
06:47:05FromDiscord<Elegantbeef> Just gotta get my config for you ๐Ÿ™‚
06:47:34FromDiscord<Mysterysib> Perhaps this? https://github.com/PMunch/nimlsp
06:47:39FromDiscord<Elegantbeef> https://github.com/dense-analysis/ale think i'm using this
06:48:04FromDiscord<Elegantbeef> sent a code paste, see https://play.nim-lang.org/#ix=3RKG
06:48:32FromDiscord<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:30FromDiscord<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:48FromDiscord<Mysterysib> although I love vim
06:51:20FromDiscord<Mysterysib> @ElegantBeef is union in the official package repo, or do I have to pull it from github?
06:51:23FromDiscord<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:30FromDiscord<Elegantbeef> https://github.com/alaviss/union
06:52:01FromDiscord<Mysterysib> Oh yeah I'm using Kate with Jetbrains and I get no errors as well
06:52:03FromDiscord<Mysterysib> I wish that worked
06:53:30FromDiscord<Elegantbeef> "Kate with jetbrains"?
06:54:31FromDiscord<sOkam!> sent a code paste, see https://play.nim-lang.org/#ix=3RKH
06:54:46FromDiscord<sOkam!> (edit) "https://play.nim-lang.org/#ix=3RKH" => "https://paste.rs/Rwt"
06:54:54FromDiscord<Elegantbeef> You did install the plugin right?
06:55:00FromDiscord<sOkam!> ๐Ÿคทโ€โ™‚๏ธ
06:55:07FromDiscord<sOkam!> im using vimplug
06:55:10FromDiscord<Mysterysib> Oh I confused Kite with Kate
06:55:20FromDiscord<Mysterysib> I think Kite just gives autocomplete
06:55:22FromDiscord<Elegantbeef> So you added the URL and then ran the install command?
06:55:39FromDiscord<sOkam!> i think so, yep. let me recheck just in case
06:56:07FromDiscord<Elegantbeef> I have been meaning to debug the NimLSP with kate
06:56:10FromDiscord<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:13FromDiscord<Elegantbeef> Guess not time like the present
06:56:18FromDiscord<Mysterysib> (edit) "up," => "up properly somehow,"
06:56:30FromDiscord<Elegantbeef> Well it's a from scratch implementation
06:56:37FromDiscord<Elegantbeef> So it's behind nimsuggest/nimlsp
06:56:50FromDiscord<sOkam!> https://media.discordapp.net/attachments/371759389889003532/951010656457461791/unknown.png
06:58:09FromDiscord<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:33FromDiscord<Elegantbeef> You say OSX like that's the most common Nim programmer OS ๐Ÿ˜›
07:00:33FromDiscord<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:21FromDiscord<Elegantbeef> I guess nowadays most motherboards have a clear cmos button eh?
07:01:32FromDiscord<Elegantbeef> Instead of having to remove the cr2032 or taking off a jumper
07:02:03FromDiscord<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:59FromDiscord<Mysterysib> Oh so CMOS battery = cr2032, learned smthn new
07:03:17FromDiscord<Elegantbeef> Yea it's the type of the battery
07:04:17FromDiscord<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:38FromDiscord<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:41FromDiscord<Elegantbeef> Given the gpu shortage i can only say "Oh noes, what a shame" ๐Ÿ˜›
07:06:42FromDiscord<Mysterysib> with all this past trauma I might just go for a 16 inch M1 macbook when I can afford it
07:08:18FromDiscord<Mysterysib> I still prefer mac over windows because it's at least unix-based
07:09:05FromDiscord<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:15FromDiscord<Elegantbeef> PMUUUUUUNCH, what does a debug nimlsp give me, i see no outputs anywhere?!
07:09:30FromDiscord<Mysterysib> (edit) "Some time ago it was possible to gain full access to the root ... filesystem," added "/ system"
07:10:07FromDiscord<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:23FromDiscord<retkid> can i use macros to modify other procs and add code to them?
07:32:45FromDiscord<Elegantbeef> Macros can only mutate downward
07:33:25FromDiscord<retkid> now, I don't quite know what you mean by that
07:33:39FromDiscord<Elegantbeef> You cannot use a macro to mutate something not inside the macro's scope
07:34:16FromDiscord<retkid> can I use a macro to take a proc, and mutate it within its scope and execute that modified verion?
07:34:28FromDiscord<Elegantbeef> You can emit a new procedure yes
07:35:17NimEventerNew thread by Mohan24: Want Nim online code playground to be mobile and desktop friendly., see https://forum.nim-lang.org/t/8991
07:36:12FromDiscord<retkid> sent a code paste, see https://paste.rs/CqU
07:36:19FromDiscord<retkid> obviously this is useless but still
07:36:33FromDiscord<retkid> (edit) "obviously this ... is" added "specific example"
07:36:35FromDiscord<Elegantbeef> Like i said you can do it inside the macro yes
07:36:46FromDiscord<Elegantbeef> You can emit a new procedure or type inside a macro
07:36:47FromDiscord<retkid> I shall learn more about macros
07:37:03FromDiscord<retkid> I am afraid of macros for some reason
07:37:54FromDiscord<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:29FromDiscord<Rika> quick
07:38:32FromDiscord<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:40FromDiscord<Rika> every day you lose 24 hours of time
07:38:44FromDiscord<retkid> In reply to @Rika "every day you lose": I KNOW
07:38:55FromDiscord<Rika> every minute in africa, 60 seconds pass
07:39:17FromDiscord<Elegantbeef> Eh if i get micros to a usable state everyone should be 93.5% less scared of macros
07:39:30FromDiscord<Rika> ive never been scared of macros
07:39:48FromDiscord<Rika> newTree newTree newTree newTree newTree newTree newTree newTree newTree newTree newTree newTree newTree
07:39:49FromDiscord<Elegantbeef> But until then i'm ramming my face into trying to get kate to show errors with nimlsp
07:40:20FromDiscord<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:33FromDiscord<Elegantbeef> I mean i have vim showing errors
07:40:47FromDiscord<Elegantbeef> There's a whole post about getting Nim linting working with vim afaik
07:41:08FromDiscord<Mysterysib> oh that's great. There's some nice clients like OniVim that are more of an IDE but still use vim
07:41:56FromDiscord<retkid> I've just found i write the same threading code over and over again
07:42:00FromDiscord<retkid> I'm just gonna write threading macros
07:42:45FromDiscord<Rika> i honestly stopped trying to get errors on my editor
07:42:53FromDiscord<Rika> i just made myself know when something is wrong ๐Ÿ‘€
07:43:57FromDiscord<retkid> well
07:44:00FromDiscord<retkid> I wish i had that power
07:44:11FromDiscord<retkid> but sometimes because of dyslexia I cant see my spelling mistakes
07:44:25FromDiscord<Rika> my font size is like 32 or something
07:44:32FromDiscord<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:35FromDiscord<retkid> and im so confused
07:44:50FromDiscord<retkid> this happens a lot with x.attters
07:44:53FromDiscord<retkid> (edit) "this happens a lot with x.attters ... " added "or x.attrs"
07:44:55FromDiscord<Mysterysib> In reply to @retkid "but sometimes because of": dyslexia font?
07:45:05FromDiscord<Elegantbeef> comicsans!
07:45:07FromDiscord<retkid> I dont know if that would help?
07:45:11FromDiscord<Mysterysib> Look
07:45:20FromDiscord<retkid> comicsans has been show to help dyslexics tho
07:46:12FromDiscord<retkid> I will install opendyslexic
07:46:29FromDiscord<Rika> closeddyslexic
07:46:56FromDiscord<Mysterysib> Yeah open dyslexic Nerd font
07:47:08FromDiscord<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:24FromDiscord<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:38FromDiscord<retkid> I dont always have dyslexia but when i do, it helps
07:47:50FromDiscord<Mysterysib> Pretty much that ^
07:48:06FromDiscord<Rika> tiny font
07:48:17FromDiscord<Rika> im blind as fuck ig
07:48:36FromDiscord<Mysterysib> I use a 13 inch Screen ๐Ÿ˜‚ and my left eye doesnโ€™t work
07:48:50FromDiscord<Mysterysib> But I have 20/20 vision nonetheless
07:48:54FromDiscord<Rika> beat me: my right eye is farsighted and my left eye is nearsighted
07:48:58FromDiscord<Mysterysib> I just have other vision problems
07:49:02FromDiscord<retkid> https://media.discordapp.net/attachments/371759389889003532/951023793701269514/2022-03-09_02-48.png
07:49:09FromDiscord<retkid> thats my font size
07:49:12FromDiscord<Mysterysib> Well I used to see the world in two separate images overlaying one another until I got surgery
07:49:16FromDiscord<Rika> 24 small
07:49:16FromDiscord<retkid> i zoom in with my DE
07:49:23FromDiscord<retkid> usually
07:49:34FromDiscord<retkid> but this works fine with glasses on
07:49:41FromDiscord<retkid> without glasses lemme see where it needs to be
07:50:12FromDiscord<Mysterysib> Oh wow Iโ€™m 11
07:50:22FromDiscord<retkid> https://media.discordapp.net/attachments/371759389889003532/951024127144255558/2022-03-09_02-50.png
07:50:36FromDiscord<Mysterysib> Which IDE is that?
07:50:39FromDiscord<retkid> this is almost comfortable without glasses
07:50:48FromDiscord<retkid> This is vscode
07:50:51FromDiscord<Mysterysib> And what font?
07:50:54FromDiscord<Mysterysib> Looks nice
07:51:03FromDiscord<Mysterysib> When I donโ€™t use dyslexic I use MonaLisa
07:51:13FromDiscord<retkid> Fira Code
07:51:23FromDiscord<Mysterysib> That oneโ€™s good too
07:51:33FromDiscord<Mysterysib> MonoLisa
07:51:33FromDiscord<Elegantbeef> There is 0 information i can extract to understand why there LSP isnt reporting diagnostics
07:51:34FromDiscord<Elegantbeef> Shame
07:51:57FromDiscord<retkid> https://media.discordapp.net/attachments/371759389889003532/951024528295870464/js-dark.png
07:52:00FromDiscord<retkid> this looks like the fucki0n
07:52:01FromDiscord<retkid> uhhh
07:52:06FromDiscord<retkid> Inteliji font
07:52:11FromDiscord<retkid> (edit) "fucki0n" => "fuckin"
07:52:27FromDiscord<Mysterysib> This is MonoLisa https://media.discordapp.net/attachments/371759389889003532/951024652975751168/unknown.png
07:52:43FromDiscord<retkid> I like it but its not a lot of character
07:53:26FromDiscord<Mysterysib> Also this ones super cool, it's called DaddyTimeMono https://media.discordapp.net/attachments/371759389889003532/951024900343234630/unknown.png
07:54:05FromDiscord<retkid> https://media.discordapp.net/attachments/371759389889003532/951025066068541460/2022-03-09_02-53.png
07:54:08FromDiscord<retkid> something about thsi font
07:54:11FromDiscord<retkid> is much less readable to me
07:54:20FromDiscord<retkid> sure i can read it faster but its uhh
07:54:23FromDiscord<Mysterysib> it's not the ideal programming font
07:54:28FromDiscord<retkid> it feels claustrophobic
07:54:37FromDiscord<Mysterysib> Maybe you can adjust the kerning
07:54:42FromDiscord<Mysterysib> but the font itself isnt great for writing code
07:54:48FromDiscord<kiell> how do i quit nim secret?
07:54:56FromDiscord<retkid> ctrl-d
07:55:46FromDiscord<kiell> for mac?
07:56:15FromDiscord<retkid> for linux?
07:56:20FromDiscord<Elegantbeef> control + C?
07:56:48FromDiscord<retkid> ctrl-d works on mien
07:57:00FromDiscord<retkid> ctrl-c as well
07:57:02FromDiscord<retkid> and ctrl-z
07:57:03FromDiscord<Mysterysib> type quit()
07:57:04FromDiscord<Mysterysib> boom
07:57:34FromDiscord<kiell> omg ty
07:58:52FromDiscord<retkid> but yea i wanna learn haskell or something and learn opengl
07:59:24FromDiscord<Mysterysib> what does haskell have to do with opengl
07:59:32FromDiscord<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:57FromDiscord<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:58FromDiscord<Mysterysib> when I was younger I used opengl to draw the wallhacks I used to code for CSGO lol
08:00:27FromDiscord<Mysterysib> It's not that difficult, it's like learning to use a library
08:00:37FromDiscord<Elegantbeef> Ehh, i kinda want to get into writing hacks for fun
08:00:44FromDiscord<Elegantbeef> Opengl is quite simple, just tedious
08:00:44FromDiscord<Mysterysib> what was more difficult was attaching to the CSGO application and reading memory and signatures
08:00:48PMunch@Elegantbeef, you are correct, I did leave my IRC open again :P
08:00:55FromDiscord<Mysterysib> It's really fun actually
08:01:03FromDiscord<Mysterysib> There's different ways you can go about it
08:01:03FromDiscord<retkid> In reply to @Mysterysib "what was more difficult": I know someone that does it
08:01:07FromDiscord<retkid> I don't really see the appeal
08:01:10FromDiscord<Elegantbeef> Opengl is nicer with distinct types
08:01:28PMunchDebug nimlsp logs more stuff to the nimlsp log file
08:01:30FromDiscord<Mysterysib> you can write internal hacks by injecting a library (dll) into an application, or external hacks just by reading memory
08:01:35PMunchWhich by default is in /tmp
08:01:37FromDiscord<Mysterysib> with internal hacks you can use the game's own API
08:01:41FromDiscord<Elegantbeef> Yea i found it all out
08:01:44FromDiscord<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:44FromDiscord<Elegantbeef> It didnt help me any
08:01:58PMunchSo you're not getting errors?
08:02:13PMunchAs in "write something with an error; save the file; no errors show up"?
08:02:18FromDiscord<Elegantbeef> In the log, there are some issues of "RequestMessage" not parsable
08:02:32FromDiscord<Elegantbeef> Yea it's not getting diagnostics
08:02:47FromDiscord<Elegantbeef> Kate is relatively easy to get if you care to test it yourself
08:02:58FromDiscord<Elegantbeef> Certainly in your package manager ๐Ÿ˜›
08:03:25FromDiscord<Mysterysib> @ElegantBeef did you put `let g:lsp_log_file = expand('/tmp/vim-lsp.log')` in your config?
08:03:45FromDiscord<Elegantbeef> Kate, i was testing kate
08:03:46*ltriant joined #nim
08:03:57FromDiscord<Mysterysib> Ohhhh
08:04:34FromDiscord<Mysterysib> How did you install the kate plugin? Maybe I can try it
08:04:47FromDiscord<Mysterysib> I never used kate before
08:04:55FromDiscord<Elegantbeef> Kate is a text editor!
08:05:01FromDiscord<sOkam!> sent a code paste, see https://play.nim-lang.org/#ix=3RKR
08:05:04FromDiscord<Mysterysib> Yeah, I know
08:05:07FromDiscord<Elegantbeef> it has a LSP toggle
08:05:22FromDiscord<Elegantbeef> No Nim doesnt return on assignment
08:05:32FromDiscord<Elegantbeef> you'd do `var on = (two = doThing(); two)`
08:05:45FromDiscord<Mysterysib> Was your Kate built with debug binaries?
08:06:02FromDiscord<Elegantbeef> It's from the ubuntu repo so i hope not
08:06:35FromDiscord<Hamid_Bluri> sent a code paste, see https://play.nim-lang.org/#ix=3RKS
08:06:44FromDiscord<Hamid_Bluri> https://github.com/hamidb80/iterrr#inline-reducer
08:07:43FromDiscord<Mysterysib> How did you install nim lsp in Kate?
08:07:59FromDiscord<Elegantbeef> It's on the nimlsp readme
08:08:01PMunch@Elegantbeef, sounds like Kate is sending messages which are technically not up to the LSP spec
08:08:20PMunchNimLSP is pretty strict about what it parses, it has already generated bug reports to more than one LSP client :P
08:10:26FromDiscord<enthus1ast> can i store a pragmas in a variable or i want to combine multiple pragmas under one new pragma
08:10:42FromDiscord<Hamid_Bluri> pragma pragma
08:10:49FromDiscord<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:00FromDiscord<enthus1ast> @Hamid_Bluri\: have a syntax example?
08:11:02FromDiscord<Hamid_Bluri> https://nim-lang.org/docs/manual.html#userminusdefined-pragmas-pragma-pragma
08:11:08FromDiscord<Mysterysib> do I have to install dependencies manually>?
08:11:25PMunch@Mysterysib, read the rest of the install instructions as well
08:11:45PMunchThat is one of the most common issues and should be described in the README
08:12:24FromDiscord<Mysterysib> This might be because I installed nim on OSX using Homebrew, but I cannot build a single nim library
08:12:45FromDiscord<Mysterysib> Various errors for everything, including unions
08:12:54PMunchIn general installing Nim via Homebrew is a bad idea
08:12:59FromDiscord<sOkam!> does each field/key in a new typed object need to be ``, even if the type itself is marked with ?
08:13:03PMunchWhat version of Nim does it ship with nowadays?
08:13:17FromDiscord<Elegantbeef> Nim allows you to specify each field's export so yes
08:13:22madprops1.6.4
08:13:40madpropshttps://formulae.brew.sh/formula/nim
08:13:42PMunchmadprops, in Homebrew?
08:13:43FromDiscord<Mysterysib> Should I just download the precompiled binary then?
08:13:49PMunchNope, use choosenim
08:14:11PMunchSomeone 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:25PMunchI assume there are some stars there I can't see
08:14:45FromDiscord<Elegantbeef> Yes there are
08:15:29FromDiscord<Mysterysib> Is 1.6.4 the latest stable?
08:15:48FromDiscord<enthus1ast> @Hamid_Bluri\: thank you works
08:20:43PMunch@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:19FromDiscord<sOkam!> sent a code paste, see https://play.nim-lang.org/#ix=3RKV
08:28:33PMunchYes, those three are equivalent. But neither of them follow the Nim style guide
08:29:04PMunch`let thing1* = 1` would probably be the most stylistically correct
08:29:30PMunchOr `let thing1*: int = 1` if you for some reason insist on declaring it with a type
08:30:24FromDiscord<Elegantbeef> Speaking of masochism ๐Ÿ˜›
08:31:00PMunchHaha, 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:11FromDiscord<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:39FromDiscord<Elegantbeef> Jesus the hardest code base to work with
08:35:07FromDiscord<sOkam!> with a simple skim i read:โ†ต- all of these are constโ†ต- they are all public constโ†ต- these are their values
08:35:16FromDiscord<sOkam!> (edit) "constโ†ต-" => "intโ†ต-"
08:35:36FromDiscord<sOkam!> non-programmer-brain issues i guess ๐Ÿ˜”
08:35:45FromDiscord<sOkam!> In reply to @Elegantbeef "Jesus the hardest code": wdym?
08:36:05FromDiscord<Elegantbeef> Horizontally aligned code with weird conventions
08:37:24*Zectbumo quit (Remote host closed the connection)
08:45:30FromDiscord<Rika> someones gonna get mad at you for not using enums
08:45:48FromDiscord<untoreh> typing `var out:` makes nimlsp crash
08:46:22FromDiscord<Rika> out is a keyword
08:47:26FromDiscord<untoreh> yeah...that's a good hint for debugging ๐Ÿ˜› but other kws don't crash
08:47:37FromDiscord<Rika> pmunch ^ lol
08:47:54FromDiscord<fbpyr> sent a code paste, see https://play.nim-lang.org/#ix=3RKX
08:48:22PMunchDon't look at me, that's 95% certainly a nimsuggest bug
08:49:40FromDiscord<Rika> should lsp crash when suggest crash though
08:53:02PMunchYup
08:53:07PMunchThat's by design
08:53:24PMunchNimLSP is nimsuggest, it's just a different front-end
08:53:58PMunchWe should fix bugs in nimsuggest, not put lipstick on a pig and build complex management systems into NimLSP
08:54:08PMunchBesides, your editor is supposed to restart NimLSP if it crashes
08:55:17PMunchSince 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:02FromDiscord<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:05FromDiscord<Elegantbeef> `export types`
09:12:52FromDiscord<Elegantbeef> You're exporting a symbol not a path
09:16:23FromDiscord<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:28FromDiscord<retkid> ๐Ÿ˜ญ
09:16:37FromDiscord<Elegantbeef> Dont learn vulkan ๐Ÿ˜›
09:17:31FromDiscord<retkid> you cant stop me, {parental gender}
09:17:37FromDiscord<retkid> (edit) "{parental gender}" => "{parental.gender}"
09:19:11FromDiscord<retkid> how bad can vulkan really be
09:19:25FromDiscord<Elegantbeef> 2000 lines of code for a triangle ๐Ÿ˜›
09:19:45FromDiscord<retkid> then how do people...
09:19:45FromDiscord<retkid> like
09:19:48FromDiscord<retkid> use it?
09:20:09*jjido quit (Quit: My MacBook Air has gone to sleep. ZZZzzzโ€ฆ)
09:20:33FromDiscord<Elegantbeef> They make abstractions over top the verbose compatibility code
09:21:05FromDiscord<retkid> I'm sure it wont be 2000 lines of code for gpu acceleration in my weird projects
09:21:12FromDiscord<retkid> famous last words
09:21:51FromDiscord<Elegantbeef> Well your gpu doesnt support vulkan
09:21:58FromDiscord<Elegantbeef> So why would you use it?
09:22:03FromDiscord<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:28PMunch@Rika, maybe some day someone will
09:22:46PMunchIf they get fed up with NimLSP crashing on them
09:22:57FromDiscord<Rika> Or maybe some day it will be revamped as a rewrite which is more likely
09:23:26FromDiscord<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:27FromDiscord<ripluke> In reply to @michaelb.eth "yes, though there are": Thats cool
09:23:37FromDiscord<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:45PMunch@Rika, sure that's also an option
09:23:50FromDiscord<Rika> In reply to @retkid "because i wanna look": Parallelisation is not easy
09:24:17FromDiscord<retkid> its possible in Vulkan, and I want to see how far I'd get before giving up
09:25:43FromDiscord<Elegantbeef> Or you could use ogl and actually make something
09:26:20FromDiscord<retkid> but it may be 2% faster in certain hardware configurations with vulkan
09:26:26FromDiscord<Rika> Possible sure, how long will it take you to do it though, let alone properly
09:26:53FromDiscord<Rika> That extra 2% wonโ€™t get utilised if you make stuff wrong
09:27:10FromDiscord<Elegantbeef> Opengl is plenty fast if written well
09:27:18FromDiscord<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:44FromDiscord<retkid> well, I dont wanna draw things I want to do parallelized math and data processing
09:27:58FromDiscord<retkid> which is a whole separate field of pain
09:28:03FromDiscord<Rika> Then Vulcan isnโ€™t your framework
09:28:11FromDiscord<Rika> Vulkan sorry
09:28:32FromDiscord<retkid> its ok its not an english word and English K rules suck
09:28:48FromDiscord<retkid> Italian only has a C and Its much better for it
09:28:55FromDiscord<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:32FromDiscord<retkid> I was wondering if Cuda is good
09:29:32FromDiscord<sOkam!> he said that vulkan is not worth it, unless you plan on working specifically in graphics exclusively
09:30:03FromDiscord<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:04FromDiscord<retkid> I think Cuda is what i'm really looking for
09:30:22FromDiscord<Rika> In reply to @retkid "I think Cuda is": Perhaps, that sounds more appropriate
09:30:49FromDiscord<retkid> however, Cuda is exclusive to Nvidia and opencl isn't really a perect alternative
09:30:53FromDiscord<pruno> sent a code paste, see https://play.nim-lang.org/#ix=3RL3
09:30:58FromDiscord<retkid> perfect
09:31:10FromDiscord<pruno> (edit) "https://play.nim-lang.org/#ix=3RL3" => "https://play.nim-lang.org/#ix=3RL4"
09:31:28FromDiscord<Rika> In reply to @retkid "however, Cuda is exclusive": Parallelisation is platform specific
09:31:44FromDiscord<retkid> https://tenor.com/view/pepe-why-pepe-pepehands-crying-gif-12683546
09:32:32FromDiscord<Rika> Itโ€™s not even just architecturally specific even
09:32:49FromDiscord<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:59FromDiscord<pruno> In reply to @retkid "are you having trouble": Compiling it
09:33:43FromDiscord<Elegantbeef> Are you attempting to call it at compile time?
09:34:38FromDiscord<Rika> In reply to @Rika "Parallelisation is platform specific": In the end, whatโ€™s your overarching goal?
09:34:57FromDiscord<Rika> You want to do parallelised data processing in what situation s
09:35:15FromDiscord<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:27FromDiscord<Rika> Then whatโ€™s wrong with just going with CUDA?
09:35:43FromDiscord<retkid> func toByteSeq(str: string): seq[byte] {.inline.} =โ†ต ## Converts a string to the corresponding byte sequence.โ†ต @(str.toOpenArrayByte(0, str.high))
09:35:55FromDiscord<retkid> https://media.discordapp.net/attachments/371759389889003532/951050692586528768/2022-03-09_04-35.png
09:36:36FromDiscord<Rika> You literally have no choice but to get a GPU
09:36:39FromDiscord<Rika> Or rent one
09:36:44FromDiscord<Rika> Renting one is very expensive
09:36:50FromDiscord<retkid> also Nvidia platform exclusivity, a company which isn't the most driver friendly for linux
09:37:01FromDiscord<retkid> which is my goat in the race
09:37:27FromDiscord<Rika> Maybe this will interest you
09:37:29FromDiscord<Rika> https://github.com/ROCm-Developer-Tools/HIP
09:37:35FromDiscord<Elegantbeef> Well use an opengl compute shader ๐Ÿ˜›
09:37:41FromDiscord<demotomohiro> sent a long message, see http://ix.io/3RL5
09:37:56FromDiscord<pruno> In reply to @Elegantbeef "Are you attempting to": It was indeed the issue, thanks :)
09:38:14FromDiscord<retkid> In reply to @Rika "https://github.com/ROCm-Developer-Tools/HIP": this is the coolest thing since I discovered poc1 yesterday
09:38:28FromDiscord<Rika> In reply to @Elegantbeef "Well use an opengl": Hmm good point
09:38:43FromDiscord<Elegantbeef> Except i dont think that gpu supports it
09:38:47FromDiscord<retkid> pocl
09:39:28FromDiscord<Rika> In reply to @Elegantbeef "Except i dont think": It probably doesnโ€™t since itโ€™s old
09:41:27FromDiscord<demotomohiro> In reply to @retkid "": Try `glxinfo | grep compute_shader` to see if compute shader is supported
09:41:48FromDiscord<Rika> Seems like it might https://media.discordapp.net/attachments/371759389889003532/951052175067480064/IMG_6667.png
09:41:49FromDiscord<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:19FromDiscord<Rika> But itโ€™s DX
09:42:27FromDiscord<retkid> https://i.imgur.com/gA2qjGI.png
09:42:34FromDiscord<Rika> Ah says below GL compute
09:43:08FromDiscord<retkid> https://media.discordapp.net/attachments/371759389889003532/951052511211577395/2022-03-09_04-43.png
09:43:16FromDiscord<retkid> looks like we have compute shaders, yes
09:43:18FromDiscord<Rika> Congrats
09:45:38FromDiscord<Rika> @retkid if youโ€™re still on the fence https://media.discordapp.net/attachments/371759389889003532/951053137429557288/IMG_6668.png
09:45:42FromDiscord<Rika> https://shader-tutorial.dev/basics/introduction/
09:46:26FromDiscord<retkid> this is for opengl compute shaders, correct?
09:46:29FromDiscord<retkid> and the shady-nim stuff
09:46:40FromDiscord<retkid> or the RCOM-HIP you sent me
09:46:53FromDiscord<Rika> Uh shaders
09:46:55FromDiscord<Rika> Itโ€™s for shaders
09:48:26FromDiscord<sOkam!> shady looks dope af
09:48:58FromDiscord<retkid> shady does look very cool
09:49:10FromDiscord<retkid> I shall research this further and write code soon^tm
10:00:19FromDiscord<mratsim> In reply to @retkid "I shall research this": what do you want to do?
10:00:56FromDiscord<mratsim> otherwise you target LLVM IR and you have LLVM JIT code for Nvidia, AMD, DX12, OpenGL, Vulkan, Qualcomm Hexagon, ...
10:01:08FromDiscord<mratsim> but you need LLVM on the user machine.
10:01:17FromDiscord<mratsim> (edit) "but you need LLVM ... on" added "runtime"
10:02:28FromDiscord<retkid> DX12 and Vulken aren't really what I need
10:02:36FromDiscord<Rika> Oh really? You can do that? Cool
10:03:19FromDiscord<retkid> I am unable to focus on anything rn in order to properly understand stuff
10:03:34FromDiscord<retkid> I cant focus on anything and am searching for a podcast to help
10:16:40FromDiscord<Schelz> sent a code paste, see https://paste.rs/x1t
10:17:20FromDiscord<Schelz> ImDrawData is struct, so i have do make a type object and use it as an args in proc ?
10:18:22FromDiscord<Elegantbeef> What's the special args?
10:18:50FromDiscord<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:36FromDiscord<Schelz> But if i want to import it from cpp it would be type ImDrawData {.importcpp ....} = object ?
10:22:51FromDiscord<Elegantbeef> I believe so
10:23:26FromDiscord<Schelz> Aha cause i search for examples and the only example was used to define the return type for proc
10:23:32FromDiscord<Schelz> (edit) "Aha" => "Aha,"
10:23:37PMunchHmm, interesting issue with Futhark..
10:24:51PMunchSo 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:06PMunchSo if I generate a definition for it there is no way to call it
11:06:37FromDiscord<Mysterysib> Why is awk so difficult
11:22:55*Gustavo6046 quit (Quit: Leaving)
11:28:00Amun-Raawk is awkward
11:29:46FromDiscord<Rika> Wrong channel? Hehe
11:30:33Amun-Ra;>
11:32:45FromDiscord<retkid> could i theoretically get a nim program to run forever or would there be GC issues?
11:33:54FromDiscord<Rika> You can
11:34:01FromDiscord<Rika> How else do server programs work
11:34:08FromDiscord<retkid> look
11:34:27FromDiscord<Rika> I am looking ๐Ÿ‘€
11:34:50FromDiscord<retkid> sometimes I think about the story about Lisp at Nasa
11:34:50Amun-RaGC issues? like some kind of cyclic deps resulting in growing memory usage?
11:35:07FromDiscord<retkid> something eventually leading to a segfault
11:35:21Amun-RaI don't think segfaults are gc related
11:35:21FromDiscord<Rika> That wouldnโ€™t be an issue unless a reference to such cycle was held unnecessarily
11:35:31FromDiscord<Rika> In reply to @Amun-Ra "I don't think segfaults": They can be in some way
11:35:33FromDiscord<retkid> sometimes they are
11:35:40Amun-RaRika: you know what I mean
11:35:50FromDiscord<Rika> No I do not, they can be
11:35:55Amun-Rayes, but usually it's a dangling pointer
11:35:59Amun-Raetc.
11:36:01FromDiscord<retkid> no
11:36:17FromDiscord<retkid> I'm not doing anything directly that does anything with pointers
11:36:22FromDiscord<Rika> Okay I guess I understand what you mean now
11:36:29FromDiscord<Rika> In reply to @retkid "I'm not doing anything": Thatโ€™s not what he means
11:36:34FromDiscord<retkid> well I mean that
11:36:36FromDiscord<Rika> References are ultimately just pointers
11:37:04FromDiscord<retkid> sometimes things are freed unexpectedly and stuff just cascades unexpectedly
11:37:30FromDiscord<retkid> or something
11:37:32FromDiscord<retkid> brain hazey
11:37:35FromDiscord<Rika> That means your GC is misbehaving aka a bug
11:37:43FromDiscord<Rika> Or you did something wrong
11:37:51FromDiscord<Rika> A cast or a conversion that was improper
11:38:07FromDiscord<Rika> Conversions usually donโ€™t break though so itโ€™s usually a casts fault
11:38:29FromDiscord<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:55FromDiscord<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:01FromDiscord<retkid> or find a workaround
11:42:13FromDiscord<retkid> sometimes arbitrarily rewriting code makes it better
11:50:42FromDiscord<Require Support> sent a code paste, see https://paste.rs/EZh
11:52:21*ltriant quit (Ping timeout: 256 seconds)
11:53:33FromDiscord<Require Support> looks like it might be in std/tables
11:56:11FromDiscord<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:20FromDiscord<congusbongus> yes it's tablesโ†ตno it's not enums, they're different
12:24:04FromDiscord<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:34FromDiscord<madman> sent a code paste, see https://play.nim-lang.org/#ix=3RLR
13:06:20*ltriant joined #nim
13:09:58FromDiscord<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:49PMunch@Require_Support, looks like you might want a tuple TBH
13:28:08FromDiscord<madman> In reply to @auxym "well does the z:": `Z:/` is a network drive. `xxx.yyy.zzz.aaa://Test/Art`
13:33:37PMunchWhat?! A new release of Futhark so soon after the last one? Crazy! https://github.com/PMunch/futhark/releases/tag/v0.5.0
13:38:16FromDiscord<System64 ~ Flandre Scarlet> Paths still not fixed :/
13:39:36FromDiscord<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:56PMunch@System64_~_Flandre_Scarlet, no unfortunately not. I still don't have Windows :(
13:48:10PMunch@ajusa, yup I've seen it, but I haven't had a chance to look at it yet
13:48:20FromDiscord<madman> sent a code paste, see https://play.nim-lang.org/#ix=3RM1
13:48:31PMunchBut you mentioned that you weren't able to build the playground docker containers?
13:48:36FromDiscord<madman> prolly something with windows
13:50:44FromDiscord<Schelz> typedef struct in cpp imports the same in nim as simple struct ?
13:50:55PMunchHmm, that line points at some windows file info structure to Nim file info object conversion logic
13:50:59FromDiscord<Schelz> (edit) "simple struct" => ""simple "struct"
13:51:06PMunchPlease report that on GitHub
13:51:15PMunchIf an issue doesn't exist for it already
13:51:28PMunch@Schelz, what do you mean?
13:52:41FromDiscord<Schelz> sent a code paste, see https://play.nim-lang.org/#ix=3RM3
13:53:07FromDiscord<Rika> looks right to me
13:53:11FromDiscord<Schelz> so for typedef struct its use the same method ?
13:53:34FromDiscord<Schelz> (edit) "its" => "do i"
13:54:30FromDiscord<Schelz> sent a code paste, see https://play.nim-lang.org/#ix=3RM4
13:55:31PMunchYes, but then your `importcpp` becomes `struct IDirect3DDevice9`
13:55:49FromDiscord<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:50PMunchWell, it's probably typedef-ed to something else
13:56:08PMunchSo you can choose whether or not you want the struct version or the typedefed version
13:56:19FromDiscord<Schelz> In reply to @PMunch "Yes, but then your": ok thx
13:56:25PMunchDo you have the error @ajusa?
13:56:47PMunchIt's probably just that it is missing the required version file to pick the version it should build
13:57:01PMunchThat container is built by a script which passes in the version to build through a file
13:57:09FromDiscord<ajusa> I did add the version file correctly
13:57:22PMunchAnd what was the error then?
13:57:34FromDiscord<ajusa> It fails after that, and I don't remember the error (it was last week)
13:58:04PMunchShould've created an issue so I could've fixed it for you
14:00:45FromDiscord<ajusa> Yeah, I'll do that. Would it be possible for you to confirm that the docker build without packages works?
14:00:54FromDiscord<ajusa> We need readme instructions on the setup anyway
14:14:18FromDiscord<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:12FromDiscord<exelotl> sent a code paste, see https://play.nim-lang.org/#ix=3RMc
14:15:44FromDiscord<exelotl> sent a code paste, see https://paste.rs/6BX
14:16:42Amun-Radon't use int when importc, use cint
14:16:48FromDiscord<exelotl> sent a code paste, see https://paste.rs/Njn
14:17:18FromDiscord<Rika> ah yes that discussion
14:17:23FromDiscord<exelotl> this code is only targetting 32-bit ARM so it's safe to use `int`
14:17:49FromDiscord<Rika> sent a code paste, see https://paste.rs/ZYg
14:18:03FromDiscord<Rika> i personally think the nicest is the last, but the middle is ok too
14:18:29FromDiscord<exelotl> yeah, it's just that in this case the init is initialising the module, not an instance of a type ๐Ÿ˜…
14:18:34FromDiscord<Rika> either way can utilise passed typedescs like from generics or so
14:18:39FromDiscord<Rika> oh really
14:18:45FromDiscord<Rika> hmm
14:18:48FromDiscord<Rika> let me think about that then
14:19:09FromDiscord<Rika> maybe name it differently than just "init" then
14:19:21FromDiscord<Rika> maybe moduleInit or initModule whichever ya like
14:20:14FromDiscord<Rika> either way (initT vs init[T]) works imo, maybe first over second since theres (probably?) no benefit to generics
14:30:28FromDiscord<Mysterysib> Who's the maintainer of choosenim?
14:31:34Amun-Radom?
14:31:55FromDiscord<Rika> yes
14:43:05PMunch@ajusa, I've updated my machine since I started it. So I'd have to reboot my machine to try it
14:43:20PMunchAnd I'm done at work in 15 minutes and will go home
14:43:44PMunchAnd I'm going to be away in London until Tuesday, so I won't be able to check anything soon :P
14:44:05FromDiscord<ajusa> Alright, not a problem lol
14:45:46PMunchHmm, 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:56PMunchI'm running the script on the server now to see if it errors out
14:46:06FromDiscord<Rika> inb4 enospc
15:03:46PMunch@ajusa, seems to build just fine on the server
15:04:12*rockcavera quit (Ping timeout: 240 seconds)
15:04:30FromDiscord<ajusa> Well I'm stumped then, no clue why I can get it to work on my machine
15:04:38FromDiscord<ajusa> (edit) "can" => "can't"
15:05:53PMunchAt least 1.2.14 bulids fine
15:06:04PMunch1.6.0 seems to have some trouble with rand..
15:08:52NimEventerNew thread by Mardiyah: On Warning: Deprecated since v1.4; there should not be high, see https://forum.nim-lang.org/t/8992
15:09:17FromDiscord<hotdog> In reply to @PMunch "And I'm going to": Welcome to London! ๐Ÿด๓ ง๓ ข๓ ฅ๓ ฎ๓ ง๓ ฟ ๐Ÿฅณ
15:15:05PMunchThank you :)
15:16:11*PMunch quit (Quit: Leaving)
15:38:16FromDiscord<lantos> @dom96 is there anything special you need to do to get nim sdl2 working on m1?
15:39:01FromDiscord<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:27FromDiscord<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:53FromDiscord<Rika> it will not be gced at all i believe
17:02:28FromDiscord<gibson> Ohhh. dang.
17:04:37FromDiscord<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:46FromDiscord<Schelz> sent a code paste, see https://play.nim-lang.org/#ix=3RMZ
17:07:04FromDiscord<Schelz> cause its not a namespace and i have no clue ๐Ÿ˜„
17:07:45*Zectbumo joined #nim
17:24:59FromDiscord<Rika> wdym? `{.importcpp: "::GetDeviceCaps".}`? idk
17:27:26*rwb is now known as rb
17:31:52FromDiscord<Schelz> idk if that work hmmm
17:32:10FromDiscord<Rika> it was a guess, im not sure either
17:32:35FromDiscord<Schelz> first i thought its a namespace from other header but its not
17:32:43FromDiscord<Schelz> some cpp thingy
17:34:11FromDiscord<Rika> idk cpp that well so
17:34:45FromDiscord<Schelz> sent a code paste, see https://play.nim-lang.org/#ix=3RN2
17:35:10FromDiscord<Schelz> and thats weird cause its not used in the header but error me that its not defined
17:35:34FromDiscord<Schelz> example https://media.discordapp.net/attachments/371759389889003532/951171397273649182/unknown.png
17:41:52FromDiscord<Schelz> sent a code paste, see https://paste.rs/ODd
17:43:36*jjido joined #nim
17:54:04FromDiscord<madman> In reply to @Schelz "so i found out": https://github.com/khchen/winimโ†ตmaybe this will help u make cpp bindings
17:56:46FromDiscord<Schelz> sent a code paste, see https://play.nim-lang.org/#ix=3RNa
17:57:08FromDiscord<Schelz> lame ik but i will remake it after i see some results
17:58:15FromDiscord<madman> binding to c is way easier
17:58:23FromDiscord<madman> fuck cpp
17:58:33FromDiscord<madman> (edit) "fuck" => "fk"
17:58:58FromDiscord<Schelz> ik but if you know that to bind and how its ez ๐Ÿ˜›
17:59:04FromDiscord<Schelz> (edit) "that" => "what "
17:59:12FromDiscord<Schelz> (edit) removed ""
18:00:34FromDiscord<madman> yeah sure, it also depends on if there is a build system to what ur binding to
18:00:46FromDiscord<madman> in my experience, that makes things way messier
18:01:01FromDiscord<madman> https://github.com/IbrahimHindawi/Knim
18:01:58FromDiscord<madman> i guess it is the oop stuff that makes binding to cpp a bit more convoluted, anw best of luck
18:02:49FromDiscord<Schelz> thx
18:06:34*jjido quit (Quit: My MacBook Air has gone to sleep. ZZZzzzโ€ฆ)
18:06:47FromDiscord<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:19FromDiscord<gibson> @Schelz Worth a shot to ask if you've tried one of the c++ helper wrappers? https://github.com/n0bra1n3r/cinterop
18:31:25FromDiscord<gibson> They apparently used it to wrap the Diligent 3D Engine
18:33:33FromDiscord<dom96> In reply to @lantos "<@!132595483838251008> is there anything": no idea, don't have an m1
18:34:02FromDiscord<lantos> ahh whoops thought you were using a mac
18:35:08FromDiscord<dom96> still running my 2014 boy ๐Ÿ™‚
18:35:33FromDiscord<dom96> in any case, you should be able to find some answers online hopefully
18:35:39FromDiscord<dom96> this shouldn't be Nim-specific
18:52:50*jjido quit (Quit: My MacBook Air has gone to sleep. ZZZzzzโ€ฆ)
19:00:34FromDiscord<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:38FromDiscord<lantos> (edit) "specifi," => "specific,"
19:00:56FromDiscord<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:15FromDiscord<lantos> (edit)
19:07:38*Zectbumo quit (Remote host closed the connection)
19:11:10*jjido joined #nim
19:24:06FromDiscord<Waldecir Santos> Do we have a tutorial explaining the diference between `ref object` and `object` when declaring an new object/type ?
19:24:34FromDiscord<Waldecir Santos> I've checked https://nim-lang.org/docs/tut1.html#advanced-types-reference-and-pointer-types but still some confusion
19:24:59FromDiscord<Phil> Wasn't "ref object" just a "pass any object of this type by reference and not by value" type of deal?
19:27:10FromDiscord<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:19FromDiscord<Waldecir Santos> because my code works ok with or without it
19:28:26*neurocyte0917090 joined #nim
19:35:45FromDiscord<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:48FromDiscord<Waldecir Santos> Sure I got that, but for example how it behaves without it ?
19:37:34FromDiscord<Rika> in many situations there is no behavioural difference
19:37:42FromDiscord<Rika> aside from performance, perhaps
19:38:39FromDiscord<Waldecir Santos> You mean the code should be more performant with `ref` ?
19:48:36FromDiscord<Rika> no
19:48:45FromDiscord<Rika> the performance will differ depending on usage'
19:59:27FromDiscord<exelotl> non-ref objects have by-value semantics, same as integers and other primitive types
20:02:26FromDiscord<exelotl> sent a code paste, see https://play.nim-lang.org/#ix=3RNL
20:11:21FromDiscord<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:45FromDiscord<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:10FromDiscord<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:12FromDiscord<ynfle> In reply to @Waldecir Santos "Is there a way": What do you mean by transparent?
21:46:45FromDiscord<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:53FromDiscord<demotomohiro> How about to use `is` operaator and `ref` type class?
21:47:11FromDiscord<Waldecir Santos> That is a good idea
21:47:15FromDiscord<ynfle> sent a code paste, see https://play.nim-lang.org/#ix=3ROh
21:48:03FromDiscord<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:24FromDiscord<Waldecir Santos> In reply to @ynfle "What do want to": I can't when accessing `fieldPairs`
21:48:42FromDiscord<ynfle> In reply to @Waldecir Santos "I can't when accessing": Ah
21:49:06FromDiscord<Waldecir Santos> That's whyI need a "transparent" way of accessing ref and non-ref
21:51:28FromDiscord<ynfle> https://play.nim-lang.org/#ix=3ROj
21:52:04FromDiscord<Waldecir Santos> In reply to @ynfle "https://play.nim-lang.org/#ix=3ROj": Yeap that is awesome, thank you
21:55:26FromDiscord<ynfle> ๐Ÿ‘
21:58:28*ltriant joined #nim
22:08:08*jjido joined #nim
22:13:22anddamis the C comparison at https://youtu.be/D_G9h7DcIqM even valid C code with the = in the declaration?
22:13:29anddamthat is https://youtu.be/D_G9h7DcIqM?t=1309 sorry
22:17:18FromDiscord<Generic> what do you mean?
22:18:22FromDiscord<Rika> have you considered that this might be C++ or did araq mention it was explicitly C
22:28:02FromDiscord<demotomohiro> If I remember correctly, C dont have default value for function parameter. C++ has.
22:31:16FromDiscord<Schelz> In reply to @gibson "<@!354911589029380097> Worth a shot": For what reason aint that hard to compile with headers and importcpp
22:31:44FromDiscord<gibson> Oh sorry, I thought you were having difficulty wrapping OOP c++ stuff.
22:32:24FromDiscord<Schelz> maybe d3d9 but for imgui_impl_win32 and imgui_impl_dx9 its ez, thx tho for the tip
22:32:35anddamI 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:27FromDiscord<Elegantbeef> It's not valid afaik
22:35:15anddamok, now I have an odder request
22:35:37anddamcan someone from discord put a space in its displayed name?
22:36:11FromDiscord<Elegantbeef> Nah the space doesnt work well for mentioning ๐Ÿ˜›
22:36:56anddamI 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:17anddamthrew a couple typos in there as well
22:37:49FromDiscord<Elegantbeef> typos are always fun
22:37:55FromDiscord<Elegantbeef> Fuck the magical thing is i'm not even on discord ๐Ÿ˜›
22:38:21anddamwhat are you using?
22:38:52anddamyour messages are being relayed by FromDiscord bot though
22:39:22anddamany 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:01FromDiscord<wsantos> fixed ๐Ÿ˜„
22:43:06FromDiscord<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:21anddamwsantos: no, please put a space back
22:43:42anddamI did edit the script, now you're taking away my test case
22:44:03FromDiscord<wsantos> Actually my nick is wsantos, but I never noticed that Discord had my name like that.
22:44:36FromDiscord<Elegantbeef> I'm using matrix and it's bridge through discord
22:44:51anddamok, 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:08anddamx/stare a/ a/t/
22:45:34FromDiscord<Elegantbeef> Gibson i dont know what you're saying
22:46:09FromDiscord<Elegantbeef> It's unsafe if the cstrings point to any string that is mutated or to be destroyed
22:47:42FromDiscord<demo tomohiro> done
22:48:20FromDiscord<demo tomohiro> I put space in user name. Is your script work?
22:48:27anddamnoice, it's correctly rewriting the nick
22:48:32anddamdemotomohiro: thx
22:48:44FromDiscord<Waldecir Santos> sure, here we go again ๐Ÿ˜„
22:48:54FromDiscord<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:55FromDiscord<Elegantbeef> Well you can use cstring assuming the life time of the string in Nim is longer then your use case
22:50:05FromDiscord<Elegantbeef> If you mutate the string or if the pointer outlives the cstring you're going to have dragons
22:50:10anddamWaldecir Santos: yours is fine too
22:50:56FromDiscord<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:16FromDiscord<Waldecir Santos> Nice, I'll go back to wsantos tomorrow ๐Ÿ˜„
22:51:17FromDiscord<Elegantbeef> Well Nim has a "free" `cstring` conversion for strings
22:51:30FromDiscord<Elegantbeef> You just have to ensure you replace the element when the string mutates
22:51:32FromDiscord<gibson> Right, but it seems not to work on a seq of strings.
22:52:18FromDiscord<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:33FromDiscord<gibson> (edit) "strings." => "cstrings."
22:52:48termerIs it possible to inherit multiple objects?
22:52:48FromDiscord<gibson> (edit) "cstrings." => "strings."
22:52:56FromDiscord<Elegantbeef> I mean it still "works" you just have to do `import std/sequtils; var myCstrings = myStrings.mapit(cstring it)`
22:53:04termerlike "ref of object Thing1, Thing2"
22:53:09FromDiscord<Elegantbeef> No MI is not in Nim
22:53:13termerThanks
22:53:17FromDiscord<Elegantbeef> Well you do not want to dealloc the cstring
22:53:28FromDiscord<gibson> Oh really?
22:53:39FromDiscord<gibson> Okay. I'll just overwrite it with a new cstring then?
22:53:44FromDiscord<Elegantbeef> Assuming your `Cstring` is from `cstring myStr`\
22:54:18FromDiscord<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:01FromDiscord<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:32FromDiscord<Elegantbeef> In that case i think `"Abc"` is in your program data then it converts it to a cstring
22:58:11FromDiscord<gibson> I see. So really `cstring` is not a datatype, and I should remember that.
22:58:20FromDiscord<Elegantbeef> It's a pointer really
22:59:12FromDiscord<gibson> Okay, this clarified a lot. Thank you.
22:59:35FromDiscord<Elegantbeef> sent a code paste, see https://paste.rs/LFw
23:00:31FromDiscord<Elegantbeef> Make a bunch of operations like above and then you'll have a concurrent str, cstring collection that is safe
23:01:37FromDiscord<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:01FromDiscord<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:06FromDiscord<gibson> Thanks for the demo!
23:04:18FromDiscord<Elegantbeef> No problem
23:04:28*noeontheend joined #nim
23:06:39*noeontheend quit (Remote host closed the connection)
23:07:31FromDiscord<Elegantbeef> If you do use the above i'd probably suggest a macro for making life easy
23:08:29FromDiscord<Elegantbeef> sent a code paste, see https://play.nim-lang.org/#ix=3ROv
23:10:45FromDiscord<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