00:00:00 | FromDiscord | <IzanamiのMegumi> sent a long message, see http://ix.io/3Zf3 |
00:00:06 | FromDiscord | <IzanamiのMegumi> will return 02468 |
00:00:07 | FromDiscord | <IzanamiのMegumi> and |
00:00:44 | FromDiscord | <IzanamiのMegumi> sent a long message, see https://paste.rs/GkE |
00:00:59 | FromDiscord | <IzanamiのMegumi> (edit) "https://paste.rs/LxE" => "http://ix.io/3Zf5" |
00:01:06 | FromDiscord | <Elegantbeef> Yes code is order dependant 😄 |
00:01:14 | FromDiscord | <IzanamiのMegumi> (edit) "http://ix.io/3Zf5" => "http://ix.io/3Zf6" |
00:01:26 | FromDiscord | <IzanamiのMegumi> (edit) "http://ix.io/3Zf7" => "https://paste.rs/PfV" |
00:01:28 | FromDiscord | <IzanamiのMegumi> (edit) "http://ix.io/3Zf6" => "https://paste.rs/kY7" |
00:02:05 | FromDiscord | <IzanamiのMegumi> why didn't it return 10 in the first time though? |
00:02:25 | FromDiscord | <Elegantbeef> cause it increments and then checks it |
00:03:33 | FromDiscord | <Elegantbeef> The while loop doesnt exist when the value meets 10 it exits after the iteration finishes and the value hits 10 |
00:26:41 | FromDiscord | <sOkam!> In reply to @Patitotective "https://github.com/Patitotective/ImTemplate hehe": handy ✍️ |
00:31:22 | * | lumo_e joined #nim |
00:31:52 | * | vicfred quit (Quit: Leaving) |
00:35:42 | FromDiscord | <sOkam!> Is there any nice database type to use with nim? |
00:54:37 | FromDiscord | <Andreas> hi, i have C-fn `set_pointer(T a, T b)` and for b i can give it a `nim_var.unsafeAddr` and for a it expect a pointer-to-a-pointer ? how is that doable in Nim ? |
00:54:44 | FromDiscord | <Andreas> (edit) "expect" => "expects" |
00:55:01 | FromDiscord | <Andreas> (edit) "b" => "`b`" |
00:55:27 | FromDiscord | <Andreas> (edit) "a" => "`a`" |
01:40:50 | * | lumo_e quit (Quit: Quit) |
01:42:11 | FromDiscord | <Zectbumo> In reply to @ss219 "Do you think long": I'm fairly new and I see great potential here |
01:43:40 | FromDiscord | <demotomohiro> In reply to @Andreas "hi, i have C-fn": You can declare a pointer like `var p: ptr T` and pass it to the function with `p.addr`. |
02:00:54 | FromDiscord | <Yepoleb> sent a code paste, see https://play.nim-lang.org/#ix=3Zfo |
02:01:13 | FromDiscord | <Elegantbeef> `uniform[: Mat4f]` |
02:02:37 | FromDiscord | <Yepoleb> In reply to @Elegantbeef "`uniform[: Mat4f]`": thanks, what syntax magic is this? |
02:03:19 | FromDiscord | <Andreas> In reply to @demotomohiro "You can declare a": ty, tried that before, but cannot keep that 'var ptr T' around - the C-fns purpose is to exchange b with a - the double-indirection has smth. to do with generics, that i don't understand. |
02:04:10 | FromDiscord | <Elegantbeef> `The method call syntax conflicts with explicit generic instantiations: p[T](x) cannot be written as x.p[T] because x.p[T] is always parsed as (x.p)[T]`↵https://nim-lang.org/docs/manual.html#procedures-method-call-syntax |
02:07:52 | FromDiscord | <Yepoleb> thanks! |
02:08:07 | FromDiscord | <Yepoleb> sorry for not reading the manual |
02:21:36 | FromDiscord | <Elegantbeef> Hey dont apologize it's learning! |
02:29:33 | FromDiscord | <demotomohiro> @Yepoleb Many people asked the same quesion here. |
02:31:00 | FromDiscord | <demotomohiro> Many people encouter `x.p[:T](a)` trap. |
02:35:22 | FromDiscord | <demotomohiro> If Nim used unicode parenthesis like '【' and '】' for generics instead of '[' and ']', we don't need to add `:` in generic parameter.↵In Vim, you can type '【' with `ctrl+k ("` in insert mode. |
02:36:41 | FromDiscord | <Elegantbeef> Most people dont have a way to easily write unicode so i mean you're right but it makes life a bit more tedious |
02:37:17 | FromDiscord | <Yepoleb> Unicode outside string literals is kinda asking for trouble |
02:37:40 | FromDiscord | <Elegantbeef> Like since i write english and have a NA keyboard i'm fucking lost to write the unicode operators, since there is no ergonomic way |
02:38:02 | FromDiscord | <Elegantbeef> Yes yes i can memorize the code point and type |
02:38:07 | FromDiscord | <Korven> that'd just be extra work for no reason methinks |
02:38:15 | FromDiscord | <Elegantbeef> I agree |
02:38:24 | FromDiscord | <Elegantbeef> It's a nice idea to remove the ambiguity but it's much more work |
02:38:37 | FromDiscord | <Elegantbeef> One could just use `<>` for generics and it also solves it |
02:38:45 | FromDiscord | <Korven> ye true |
02:38:49 | FromDiscord | <Yepoleb> A custom compose key combination would make it easier |
02:39:01 | FromDiscord | <Yepoleb> But that's a bit of work to set up |
02:39:05 | FromDiscord | <Korven> kinda always have associated generics with angled brackets |
02:39:10 | FromDiscord | <Elegantbeef> Oh of course, but how many people are going to have that setup 😄 |
02:39:37 | FromDiscord | <Elegantbeef> Given `{}` is hardly ever used could use a macro for that and dont need compiler support |
02:40:25 | FromDiscord | <demotomohiro> '<' and '>' are used as binary operator. Im not they can really fix the issue. |
02:40:30 | FromDiscord | <Elegantbeef> `result.thingy.uniform{myGeneric}("proj")` would turn it into the `uniform[myGeneric](result.thingy, "proj")` |
02:40:44 | FromDiscord | <Elegantbeef> Where are they used for binary operators in Nim? |
02:40:56 | FromDiscord | <Elegantbeef> `<>` are used for comparisons in Nim |
02:41:13 | FromDiscord | <Yepoleb> I think it's not a big issue if the user knows about it |
02:41:28 | FromDiscord | <Yepoleb> It's ugly 🤷 |
02:41:30 | FromDiscord | <Elegantbeef> I know it's very NA thing for me to say but i really dont want to use a language that requires a keyboard setup 😄 |
02:42:17 | FromDiscord | <Elegantbeef> The unicode operators i understand since they're uncommon math/science related things, but unicode in the language's common syntax is just tedium, but ymmv |
02:42:21 | FromDiscord | <demotomohiro> `a < b and c > d()`. |
02:42:30 | FromDiscord | <Korven> maybe it's time a new pair of brackets was invented |
02:42:41 | FromDiscord | <Korven> haven't had a new one in quite a while🤔 |
02:43:05 | FromDiscord | <Korven> would suffer the same setup problem ofc, but it's be quite cool |
02:43:40 | FromDiscord | <Elegantbeef> I guess i have a 70% keyboard so i could use my f-keys for unicode brackets |
02:43:55 | FromDiscord | <Elegantbeef> But think about those with 60% or even 50%s 😄 |
02:44:06 | FromDiscord | <Elegantbeef> They already have to hit 3 button combinations just to go to end of line |
02:44:10 | FromDiscord | <Yepoleb> I have added "write a compiler hint about method syntax with generics" to my todo-when-i-got-gud list, that's probably the best fix for now |
02:44:38 | FromDiscord | <Yepoleb> In reply to @Elegantbeef "They already have to": That's their fetish |
02:44:38 | FromDiscord | <demotomohiro> Remove reraly used charactor from ascii code and add new parenthesis like charactor and create corresponding keyboard standard :p. |
02:44:58 | FromDiscord | <Yepoleb> So many control characters to recycle |
02:45:13 | FromDiscord | <Elegantbeef> Demo do i get a free new set of keycaps?! |
02:45:34 | FromDiscord | <Yepoleb> You get a set of stickers |
02:45:49 | FromDiscord | <Yepoleb> Or a pdf you can print |
02:46:05 | FromDiscord | <Yepoleb> And glue on with epoxy |
02:47:26 | FromDiscord | <Korven> In reply to @Elegantbeef "They already have to": untrue sire XD maybe it's cuz of my emacs keybinds tho |
02:47:46 | FromDiscord | <Korven> i have a 60% |
02:48:37 | FromDiscord | <Yepoleb> Le emacs user has arrived |
02:54:12 | FromDiscord | <demotomohiro> @Elegantbeef pick keycaps you want from here: https://shop.yushakobo.jp/collections/artisan-keycaps |
02:54:37 | FromDiscord | <Elegantbeef> I'd rather go get razer blades and tape them to my key stems |
02:54:41 | FromDiscord | <huantian> I hear keyboard I have been summoned |
02:55:15 | FromDiscord | <Andreas> sent a code paste, see https://play.nim-lang.org/#ix=3Zfu |
02:55:49 | FromDiscord | <Andreas> (edit) "https://play.nim-lang.org/#ix=3Zfu" => "https://paste.rs/z0D" |
02:56:06 | FromDiscord | <Andreas> (edit) "https://play.nim-lang.org/#ix=3Zfv" => "https://paste.rs/3B6" |
02:56:11 | FromDiscord | <Elegantbeef> Fuck i only have a mechanical keyboard due to my friend giving me one |
02:56:43 | FromDiscord | <Andreas> (edit) "https://play.nim-lang.org/#ix=3Zfx" => "https://play.nim-lang.org/#ix=3Zfw" |
02:57:10 | FromDiscord | <huantian> I kinda wanna build a Sofie v2 https://josefadamcik.github.io/SofleKeyboard/ |
02:57:24 | FromDiscord | <huantian> what kinda retro looking? Like MT3 style retro? |
02:58:45 | FromDiscord | <Elegantbeef> Commedore keycaps mostly 😄 |
02:58:52 | FromDiscord | <huantian> actually I was also thinking of getting qpbd terminal, I kinda like the aesthetic↵https://vala.supply/collections/keycap-sets/products/qpbt-terminal |
02:59:17 | FromDiscord | <demotomohiro> @Andreas `T` in that function signature should represent some type. |
02:59:37 | FromDiscord | <Elegantbeef> But i'm not one that really cares |
03:00:19 | FromDiscord | <huantian> MT3 is made to be similar to that old style of keycap https://drop.com/buy/drop-mt3-white-on-black-keycap-set |
03:00:37 | FromDiscord | <huantian> this is kinda off topic lol |
03:00:45 | FromDiscord | <Elegantbeef> "kinda" |
03:01:56 | FromDiscord | <demotomohiro> @Andreas Is that C library actually have a such function and type T? |
03:10:18 | FromDiscord | <Andreas> In reply to @demotomohiro "<@754284517316886598> Is that C": no, that C-lib accepts anything that i throw at it, any T seems to be ok - and this for sure can't be true. The fn `set_pointer( a, b)` does a simple pointer-exchange `a = b` the double-star has smth. todo with C-generics. When i pass in my `a`(ptr to old value) and `b`(ptr to new value) values then i end up with a empty `a`. It's not `nil` - the type is correct, the result |
03:11:12 | FromDiscord | <Andreas> (edit) "values" => "-values" | "-valuesthen i end up with a empty `a`. It's not `nil` - the type is correct, the result is kinda ... `new(a)`in" added "doing" | "then i end up with a empty `a`. It's not `nil` - the type is correct, the result is kindadoing`new(a)` ... ?" added "in nim." |
03:17:18 | FromDiscord | <demotomohiro> So `set_pointer` actually do `a = b;`? |
03:20:03 | FromDiscord | <demotomohiro> Most of C functions use pointer to pointer parameter like `T a` to create a new `T` and write an address of it to `a`. |
03:21:44 | FromDiscord | <Andreas> In reply to @demotomohiro "So `set_pointer` actually do": `a` and `b` are of the same type `ref-object`s. in nim i's do `a=b`. The C-fn is supposed to do the same - without any knowledge of my nim-types. and if the C-fn would take two pointers `set_pointer( a, b)` all would be fine - but the `` ptr-to-ptr is smth i cannot provide and it must have some relevance i don't get.. |
03:22:26 | FromDiscord | <Elegantbeef> pointer to pointer is generally an array of arrays if my C knowledge remembers correctly |
03:23:07 | FromDiscord | <Andreas> (edit) "i's" => "i'd" |
03:23:58 | FromDiscord | <huantian> or a pointer to an array sometimes |
03:24:23 | FromDiscord | <demotomohiro> Pointer in C can point to single variable or array. |
03:24:42 | FromDiscord | <huantian> I think in this case you pass a pointer to the pointer that you want to be changed |
03:28:33 | FromDiscord | <demotomohiro> If that pointer to pointer is not used for passing array of pointer or array of array, I only know `var a: ptr T; set_pointer(a.addr, b.addr)`. |
03:28:51 | FromDiscord | <Andreas> In reply to @demotomohiro "Most of C functions": so then i should pass-in a constructor ? in a closure, so that the value arrives.. |
03:29:25 | FromDiscord | <huantian> agah |
03:29:31 | FromDiscord | <huantian> sent a code paste, see https://play.nim-lang.org/#ix=3ZfD |
03:29:34 | FromDiscord | <demotomohiro> @Andreas Please tell us URL of the C library you are talking. |
03:29:52 | FromDiscord | <huantian> sent a code paste, see https://play.nim-lang.org/#ix=3ZfE |
03:30:52 | FromDiscord | <Andreas> its the RCU-lib here https://lwn.net/Articles/573439/#qq2answer in the section "URCU read-side API", 2-nd page |
03:31:19 | FromDiscord | <Andreas> (edit) "read-side" => "update-side" |
03:32:00 | FromDiscord | <Andreas> (edit) "page" => "page, points 5/6/7" |
03:40:12 | FromDiscord | <demotomohiro> It is hard to understand about c function and how to use it correclty only from C function signature and small part of text. I need to read whole manual of the c libaray to fully understsnd what you are talking :(. |
03:49:15 | FromDiscord | <Andreas> In reply to @demotomohiro "It is hard to": the purpose of this pointer-exchange is a simple atomic(in most cases, depens on the platform)-swap and to make the lib aware that there was a change. I can do the exchange in nim, but then then the rcu-lib would not know about it. |
03:49:30 | FromDiscord | <Andreas> (edit) "depens" => "depends" |
03:51:57 | FromDiscord | <demotomohiro> I dont know whether URCU-library works safely with Nim' ref types or are you trying manual memory management? |
03:55:12 | FromDiscord | <Andreas> In reply to @demotomohiro "I dont know whether": that lib is supposed to be agnostic of user-types - it's purpose is to notice changes (anonymous types = pointers ) which are published/announced by the provided user-facing-API. |
04:06:18 | FromDiscord | <demotomohiro> Why do you need to URCU library? |
04:08:46 | FromDiscord | <Andreas> In reply to @demotomohiro "Why do you need": it enables lockless concurrent data-structures and is battle-tested since 2002. I'm working on a tree-structure and to enable lockless-reads from multiple threads, i thought URCU could be a good fit. |
04:25:42 | FromDiscord | <demotomohiro> Are you trying to use URCU with Nim's ref types? |
04:28:49 | FromDiscord | <demotomohiro> If both `a` and `b` are ref types, `a = b` do not only copy pointer but also increment ref counts.↵If you copy ref types with C function, it can copy poitner but doesn't increment ref count.↵So it can cause memory leak or read after free. |
04:29:06 | FromDiscord | <Andreas> In reply to @demotomohiro "Are you trying to": well in my first test yes, `ref object` i follow the idea of a naive linked-list, which is more or or less a chain of ref-objects (no buckets, slots etc). just to simulate a couple of reader-threads that read random part while at the same time a writer-thread makes insertions or removes cells from the chain. That would be completly lock-less.. |
04:30:52 | FromDiscord | <demotomohiro> So you might need to do manual memory management if you use URCU with Nim. |
04:31:20 | FromDiscord | <Andreas> In reply to @demotomohiro "If both `a` and": my initial problem was that nim's GC was too quick in disposing objects. So i found GC_ref to mark them as "please don't release them right now" and later use GC_unref to release.. |
04:31:55 | FromDiscord | <Elegantbeef> Yea gcref can approximate manual memory management |
04:32:50 | * | fallback quit (Ping timeout: 260 seconds) |
04:33:25 | FromDiscord | <demotomohiro> GC_ref/GC_unref allows C code to hold ref types even when last ref variable in Nim get out from the scope. |
04:33:43 | FromDiscord | <Andreas> In reply to @demotomohiro "So you might need": the lib offers a call-back solution - basically passing nim's free-proc or destroy-proc to the lib and then it will care for the deferred disposal.. But yes i had manual-memory-mgmt on my mind - maybe later.. |
04:43:49 | FromDiscord | <demotomohiro> sent a code paste, see https://play.nim-lang.org/#ix=3ZfO |
04:49:05 | FromDiscord | <Andreas> In reply to @demotomohiro "If I understand correctly,": thx, that did the trick.. |
04:49:32 | * | fallback joined #nim |
04:50:46 | FromDiscord | <Andreas> (edit) "In reply to @demotomohiro "If I understand correctly,": thx, that did the trick.. ... " added "- man great, ty" |
04:51:46 | FromDiscord | <demotomohiro> Maybe you dont't need to call `GC_ref/GC_unref` if `b` exists while `a` is used. |
04:59:43 | FromDiscord | <Andreas> sent a long message, see https://paste.rs/598 |
05:00:52 | FromDiscord | <Andreas> (edit) "http://ix.io/3ZfQ" => "http://ix.io/3ZfP" |
05:04:54 | * | rockcavera quit (Remote host closed the connection) |
05:14:34 | * | rockcavera joined #nim |
05:14:34 | * | rockcavera quit (Changing host) |
05:14:34 | * | rockcavera joined #nim |
06:36:41 | * | jjido joined #nim |
07:02:02 | * | gsalazar joined #nim |
07:04:49 | FromDiscord | <Korven> What's the go to plugin for Nim on Sublime Text? I'm looking at the wiki and I see two options. The `nimlsp` github mentions that we should use `NimLime`, but the other one on the wiki, `SublimeNim`, is for Sublime Text 4. |
07:04:58 | FromDiscord | <Korven> any ideas? 🤔 |
07:12:18 | * | dtomato joined #nim |
07:12:38 | FromDiscord | <huantian> Is sublime 4 an old version of sublime? |
07:12:53 | FromDiscord | <Elegantbeef> new |
07:19:30 | FromDiscord | <Korven> it's the latest release |
07:19:57 | FromDiscord | <Korven> I do intend to run ST4 |
07:23:29 | * | PMunch joined #nim |
07:23:53 | FromDiscord | <uncle jim> PIL:python::pixie:nim? |
07:30:07 | * | ltriant quit (Ping timeout: 240 seconds) |
07:37:14 | FromDiscord | <j-james> in terms of features, no, i believe pixie has a wider scope (ex. typesetting) |
07:37:38 | FromDiscord | <j-james> in terms of being the best imaging library for the language yes |
07:41:18 | * | xet7 quit (Remote host closed the connection) |
07:42:28 | * | xet7 joined #nim |
08:01:26 | PMunch | Hmm, what is the state of Android app development in Nim nowadays? Haven't really heard a lot about it lately |
08:12:30 | PMunch | This certainly looks like a way that could work: https://github.com/marcomq/nimview |
08:13:44 | PMunch | Or this: https://github.com/akavel/hellomello, but I don't think that has any usable UI stuff at the moment (although maybe both could be combined to use a webview but still no Android Studio) |
08:29:32 | FromDiscord | <j-james> what's the state of android app development in non-jvm languages (aside from react and dart)? |
08:31:26 | FromDiscord | <j-james> i always thought you had to interface with java at a pretty low level |
08:38:11 | PMunch | Well |
08:38:31 | PMunch | There is the Android NDK (Native Development Kit) which is meant to write native code for Java apps |
08:39:44 | PMunch | I've written a game in Nim which ran on Android before, that was using Nim with SDL2 through the NDK and a thin Android shim which was basically just setting up a canvas and hooking into some events and passing everything along to the NDK |
08:40:21 | PMunch | https://github.com/akavel/hellomello <- This seems to bypass the Java code somehow, which is neat |
08:41:21 | PMunch | So if it is possible to set up a webview using nothing but the JNI (Java Native Interface, part of the NDK) then you could have a kind-of pure Nim application with Nim code driving the webpage for the UI |
08:42:10 | PMunch | Of course if it is possible to set up the webview it is also possible to set up the Android UI stuff, which means you technically don't need the web-stuff. But I'm guessing that it's more comfortable to use that than to work with the Android UI through the JNI.. |
08:44:25 | * | jjido quit (Quit: My MacBook Air has gone to sleep. ZZZzzz…) |
08:58:11 | NimEventer | New post on r/nim by dsrw: Inky: Isolation. A 90 minute game built with Enu, Nim and Godot, see https://reddit.com/r/nim/comments/v3v5fj/inky_isolation_a_90_minute_game_built_with_enu/ |
09:08:36 | FromDiscord | <uncle jim> sent a code paste, see https://paste.rs/7I2 |
09:09:26 | FromDiscord | <Elegantbeef> you dont have an image variable |
09:09:59 | FromDiscord | <uncle jim> In reply to @Elegantbeef "you dont have an": oh |
09:11:05 | FromDiscord | <uncle jim> and what should be in the `image` variable? |
09:11:20 | FromDiscord | <Elegantbeef> It should be an image? |
09:11:29 | FromDiscord | <uncle jim> In reply to @Elegantbeef "It should be an": a string? |
09:11:42 | FromDiscord | <Elegantbeef> `let image = newImage(256, 256)` |
09:11:50 | FromDiscord | <uncle jim> bruh |
09:12:13 | FromDiscord | <Elegantbeef> https://github.com/treeform/pixie/blob/master/examples/square.nim |
09:18:07 | FromDiscord | <luteva> Hi! I am thinking about solution that can be used to do complex calculations (e.g. video processing) in the user's browser with webassembly and continiously transfers the processed data to a server. Then, whenever the connection gets lost, the server continues the work (at the point the connection was lost).↵Are there any solutions (libraries or whatever) that face this situation? Any ideas, links or info? |
09:18:10 | * | jmdaemon quit (Ping timeout: 244 seconds) |
09:18:37 | FromDiscord | <luteva> (edit) "lost," => "lost (or processing is too slow)," |
09:26:02 | * | jjido joined #nim |
09:27:32 | FromDiscord | <voidwalker> distributed video encoding ? |
09:42:29 | * | ltriant joined #nim |
09:44:11 | FromDiscord | <luteva> yes kind of... |
09:44:32 | * | jjido quit (Quit: My MacBook Air has gone to sleep. ZZZzzz…) |
09:46:02 | FromDiscord | <luteva> the main thing is not the distribution but trying to do the work on the client and having a failover on the server. |
09:46:36 | FromDiscord | <voidwalker> 1 server, how many clients, how many concurrent "works" ? |
09:46:57 | FromDiscord | <luteva> and all that in webassembly in the browser and (for the failover) on the server |
09:48:33 | FromDiscord | <luteva> each video being processed in one client browser only (so no distribution is needed, here). but one the client closes the connection, the work should continue on a server |
09:49:00 | FromDiscord | <voidwalker> yes, but if 100 clients close the connection, the server will get overwhelmed, so it has to be distributed, or queued |
09:50:49 | FromDiscord | <luteva> yes of course. but this is not the problem i am facing now. there are dozens of servers ready for taking over the work. but they shouldn't be used, unless a clients connection is closed. |
09:51:56 | FromDiscord | <luteva> the idea is to use the clients resources whenver possible and only use the servers resources when necessary |
10:00:24 | * | arkurious joined #nim |
10:04:19 | * | xet7 quit (Remote host closed the connection) |
10:36:13 | FromDiscord | <Korven> that feels like abusing client resources. while I understand it's possible to use client resources since they are just there, it sucks to see a tab take lots of resources up 🤔 |
10:49:50 | FromDiscord | <luteva> sent a long message, see https://paste.rs/Hsx |
10:53:21 | FromDiscord | <luteva> this of course implies that the computation already being done (like the first few minutes of an edited video clip) must be transferred to the server continiously. |
10:53:52 | FromDiscord | <Korven> or some sort of checksum/track of how far the computation has progressed |
10:57:10 | FromDiscord | <luteva> well in my case, not just a checksum must be transferred but the clip itself. as the whole video clip must be on the server when the computation has finished. as the clip then needs to be transferred to the TV studio and/or social media channels (and more).... |
10:57:41 | FromDiscord | <luteva> (edit) "studio" => "station/studio" |
11:36:26 | NimEventer | New thread by Georgeethan: What are the best hosting companies to host systems written in the Nim language?, see https://forum.nim-lang.org/t/9196 |
11:38:52 | FromDiscord | <voidwalker> What a nonsensical question |
11:44:27 | PMunch | It's not so strange if you consider that they're coming from Wordpress |
11:50:28 | NimEventer | New thread by Georgeethan: Where can I find information about Nim architecture? , see https://forum.nim-lang.org/t/9197 |
12:23:45 | FromDiscord | <enthus1ast> Video encoding in js?? Total waste of resources imho↵(@Korven) |
12:24:14 | FromDiscord | <Korven> where'd js come from :o |
12:25:26 | * | xet7 joined #nim |
12:25:53 | FromDiscord | <Rika> he said wasm afaik |
12:26:12 | FromDiscord | <Korven> ah yeah he did |
12:27:06 | FromDiscord | <enthus1ast> is wasm significant faster? Compared to a tuned state of the art video codec? |
12:28:12 | FromDiscord | <Rika> no |
12:28:19 | FromDiscord | <Korven> it won't be as fast as encoding it on a GPU, or something of the sort, per se |
12:28:20 | FromDiscord | <Rika> wasm is ofc not as fast as native so |
12:28:22 | FromDiscord | <Korven> but faster than js aye |
12:28:38 | FromDiscord | <enthus1ast> what i mean is, there are encoder chips on most machines, that are blazingly fast |
12:34:46 | * | tiorock joined #nim |
12:34:46 | * | tiorock quit (Changing host) |
12:34:46 | * | tiorock joined #nim |
12:34:46 | * | rockcavera quit (Killed (silver.libera.chat (Nickname regained by services))) |
12:34:46 | * | tiorock is now known as rockcavera |
13:04:24 | FromDiscord | <windowsboy111> someone might need to update the fedora installation thing on the website |
13:04:49 | FromDiscord | <windowsboy111> last update on the package was like 4 years ago |
13:13:32 | * | om3ga quit (Quit: Bye) |
13:18:12 | * | vicfred joined #nim |
13:22:37 | * | Guest72 joined #nim |
13:28:11 | * | jjido joined #nim |
13:33:10 | Guest72 | (help for noob). hello, I have an array of objects. each obj contains a thread. I want to joinThreads(objs.map(x => x.thr)). I get the error '=copy' is not available for type <Thread>. joinThreads(objs.[0].thr, objs.[1].thr) works. Any ideas? |
13:36:57 | * | xet7 quit (Read error: Connection reset by peer) |
13:43:22 | * | jjido quit (Quit: My MacBook Air has gone to sleep. ZZZzzz…) |
13:50:19 | FromDiscord | <qb> Nims equivalent to `for (int i = 0; i < 360; i += 10)` would be `for i in countUp(0, 360, 10)` right? |
13:51:37 | FromDiscord | <Yardanico> @qb no, countup is inclusive |
13:51:42 | FromDiscord | <Yardanico> so it'll also return 360 for your expression |
13:51:47 | FromDiscord | <Yardanico> so you probably want 359 instead |
13:55:06 | FromDiscord | <Rika> I eluded to that when he accidentally posted in #jobs |
13:55:11 | FromDiscord | <Rika> :XD: |
13:56:13 | FromDiscord | <demotomohiro> @Guest72 `Thread` type is uncopyable and you cannot create a seq of Thread from a seq objects containing Thread. I think you need to change data structure that separate seq of object and seq of Thread. |
13:59:06 | FromDiscord | <br4n_d0n> Is the plan for Nim to always use a third party compiler? |
13:59:10 | Guest72 | demotomohiro: as a 'workaround', I just use a for loop and call joinThread (this is what joinThreads does). Changing the structure is not a good solution. A collection of objects containing threads is perfectly good data structure desing imho. |
13:59:33 | FromDiscord | <Rika> In reply to @br4n_d0n "Is the plan for": I believe so |
14:00:05 | FromDiscord | <Rika> Most languages do though I believe |
14:01:59 | * | PMunch quit (Quit: Leaving) |
14:05:53 | FromDiscord | <nwilburn> sent a code paste, see https://paste.rs/MPa |
14:06:41 | FromDiscord | <Rika> Procedures don’t use : for keyword arguments |
14:06:44 | FromDiscord | <Rika> Use = |
14:07:02 | FromDiscord | <Yardanico> @Rika no, that's correct usage |
14:07:08 | FromDiscord | <Yardanico> you can specify the type even if you specify the default value |
14:07:21 | FromDiscord | <Rika> ? Look at the last line? |
14:07:27 | FromDiscord | <Yardanico> yeah, i thought you meant the proc sig :) |
14:07:31 | FromDiscord | <Yardanico> then you're right |
14:07:49 | FromDiscord | <nwilburn> oh damnit |
14:07:50 | FromDiscord | <Prestige> I've always found that a bit weird tbh |
14:07:50 | FromDiscord | <nwilburn> thanks guys |
14:07:52 | FromDiscord | <Yardanico> @nwilburn in nim `:` is used in object and table construction syntax, not in proc calls |
14:09:11 | FromDiscord | <br4n_d0n> The other day I found that someone thinks Nim is a "toy" programming language because "it's a pre-processor over the C compiler" and I don't quite get that |
14:09:49 | FromDiscord | <Yardanico> In reply to @br4n_d0n "The other day I": yeah, that's totally false |
14:09:51 | FromDiscord | <Prestige> bad opinion, really |
14:10:14 | FromDiscord | <Yardanico> Nim treats C like a proper backend, there's even nlvm which is an LLVM backend for Nim, and it only adds a couple patches on top of the nim compiler frontend |
14:13:14 | FromDiscord | <Rika> In reply to @br4n_d0n "The other day I": Yeah and C is a preprocessor over assembly |
14:16:57 | FromDiscord | <d4rckh> if i have↵` |
14:17:56 | FromDiscord | <d4rckh> sent a code paste, see https://paste.rs/9gs |
14:18:10 | FromDiscord | <d4rckh> (edit) "https://play.nim-lang.org/#ix=3ZhL" => "https://paste.rs/7lL" |
14:19:35 | FromDiscord | <Rika> Deep or shallow? |
14:20:05 | FromDiscord | <demotomohiro> You want to do `a1[] = a2[]`? |
14:20:17 | FromDiscord | <d4rckh> yes |
14:20:56 | FromDiscord | <d4rckh> In reply to @Rika "Deep or shallow?": deep |
14:20:58 | FromDiscord | <Rika> If there is a reference in the fields then the reference won’t be copied deeply |
14:21:14 | FromDiscord | <Rika> In reply to @demotomohiro "You want to do": Given this, I mean |
14:21:38 | FromDiscord | <d4rckh> In reply to @Rika "If there is a": thats ok |
14:21:47 | FromDiscord | <Rika> Then you want shallow |
14:22:41 | FromDiscord | <d4rckh> In reply to @demotomohiro "You want to do": is this the right way of doing it? |
14:23:13 | FromDiscord | <enthus1ast> with this logic typescript is also a toy since its just a preprocessor over js↵(@br4n_d0n) |
14:23:33 | FromDiscord | <enthus1ast> i mean who cares really, its just a tool to get things done |
14:23:40 | FromDiscord | <demotomohiro> It works as if a1.x = a2.x for each fields. |
14:24:26 | FromDiscord | <demotomohiro> But if they have ref type field, it is not deeply copied. |
14:24:58 | FromDiscord | <d4rckh> thanks |
14:24:58 | FromDiscord | <d4rckh> that worked |
14:26:18 | FromDiscord | <demotomohiro> There is deepCopy proc: https://nim-lang.org/docs/system.html#deepCopy%2CT%2CT |
14:40:39 | FromDiscord | <d4rckh> hmm |
14:42:25 | FromDiscord | <Geiseric> sent a code paste, see https://paste.rs/dR3 |
14:42:59 | FromDiscord | <Geiseric> The compilenim contains the following and it's a bash script: `nim c -d:release -d:danger --cc:gcc -d:strip --opt:size --passL:-s --passc=-flto --passl=-flto -d=mingw --cpu=amd64 --hint[Pattern]:off $1` |
14:43:29 | FromDiscord | <Geiseric> (edit) removed "The" |
14:44:46 | FromDiscord | <Yardanico> if you (or c2) use(s) any `emit` s it will not work, the term-rewriting macro seems to get the string passed to emit, but even if I specifically check it and not handle it, then it fails to compile because macro'd string doesn't seem to get accepted by emit |
14:45:41 | FromDiscord | <Geiseric> Oh yes, i have few emits but it's weird, in another project i've emits too but strenc works without issues |
14:53:12 | * | Guest72 quit (Quit: Client closed) |
14:54:04 | FromDiscord | <demotomohiro> Are you using Nim with root account? |
14:55:02 | FromDiscord | <d4rckh> looks like it |
14:55:50 | FromDiscord | <d4rckh> how do i supply something to a `var T`? i forgot the syntax 😓 |
14:57:18 | FromDiscord | <Yardanico> you have your own variable as `var` |
14:57:24 | FromDiscord | <Yardanico> or have a ref and refer to its field |
14:57:32 | FromDiscord | <d4rckh> hmm |
14:57:33 | FromDiscord | <d4rckh> thanks |
14:59:16 | FromDiscord | <Geiseric> In reply to @demotomohiro "Are you using Nim": Are you talking to me? If so, wdym by "root account"? |
15:01:44 | FromDiscord | <d4rckh> `root@WinDev2110Eval` |
15:02:14 | FromDiscord | <d4rckh> uhh, what does this mean? `Error: 'client' is of type <var Client> which cannot be captured as it would violate memory safety, declared here: ...; using '-d:nimNoLentIterators' helps in some cases` |
15:02:23 | FromDiscord | <d4rckh> the code it points to is `while client.connected:` |
15:03:17 | FromDiscord | <demotomohiro> @Geiseric Yes. Your log says you installed nim in /root. |
15:03:48 | FromDiscord | <Geiseric> In reply to @demotomohiro "<@253937871348563970> Yes. Your log": Yes, i'm using WSL |
15:03:56 | FromDiscord | <Yardanico> In reply to @d4rckh "uhh, what does this": it's not possible to use a var of something in a closure |
15:04:12 | FromDiscord | <Yardanico> and async is built on closures, so if you're using async, you're using closures |
15:04:17 | FromDiscord | <Yardanico> a workaround for that is to use `ref` |
15:04:19 | FromDiscord | <demotomohiro> Using root means you might accidentally delete or change imortant files. |
15:04:37 | FromDiscord | <Yardanico> In reply to @demotomohiro "Using root means you": it's WSL |
15:04:51 | FromDiscord | <Yardanico> doesn't really matter, he can delete all of his windows files even from a user account in WSL |
15:04:57 | FromDiscord | <Korven> is the `object` type allocated on the stack? |
15:04:58 | FromDiscord | <d4rckh> In reply to @Yardanico "a workaround for that": well client is already ref of object |
15:05:02 | FromDiscord | <d4rckh> (edit) "In reply to @Yardanico "a workaround for that": well client is already ... ref" added "a type of" | removed "of" |
15:05:14 | FromDiscord | <Yardanico> then why are you doing `var Client`? it's only needed if you want to change the underlying ref |
15:05:18 | FromDiscord | <jmgomez> sent a code paste, see https://play.nim-lang.org/#ix=3Zi9 |
15:05:24 | FromDiscord | <d4rckh> yeah i wanna change the ref to another ref |
15:05:24 | FromDiscord | <Yardanico> fields of a ref object are mutable anyway, you don't have to pass it as `var Client` |
15:05:31 | FromDiscord | <Yardanico> oh, then you have to use a double ref i guess... |
15:05:46 | FromDiscord | <d4rckh> amazing |
15:05:55 | FromDiscord | <demotomohiro> Linux user use root only when really need to be but it is different in WSL? |
15:06:04 | FromDiscord | <d4rckh> i didnt have to use root in wsl |
15:06:05 | FromDiscord | <d4rckh> 🤔 |
15:06:33 | FromDiscord | <Geiseric> I just prefer using root when i'm on linux, wether is wsl or a classic linux machine |
15:07:15 | FromDiscord | <d4rckh> how do i create a ref? 😓 |
15:07:21 | FromDiscord | <demotomohiro> @Korven https://internet-of-tomohiro.netlify.app/nim/faq.en.html#type-when-to-use-ref-object-vs-plain-object-qmark |
15:07:41 | FromDiscord | <Korven> netlify, nice. |
15:08:16 | FromDiscord | <Korven> wait are these notes from the official tutorial? 🤔 |
15:10:06 | FromDiscord | <demotomohiro> I have accidentally deleted import directly with root several times before. I hope you dont make any mistake like me. @Geiseric |
15:10:37 | FromDiscord | <Geiseric> I hope it too ahahah |
15:24:10 | FromDiscord | <jmgomez> should when declared x work when x is an argument in a bigger scope? |
15:24:53 | FromDiscord | <d4rckh> what was the keyword for creating a ref of something? |
15:26:29 | FromDiscord | <demotomohiro> `var a = Foo(x: 123)` if Foo is ref object. |
15:26:49 | FromDiscord | <d4rckh> yes |
15:26:54 | FromDiscord | <d4rckh> i want to create a ref of Foo |
15:26:56 | FromDiscord | <d4rckh> in that case |
15:27:02 | FromDiscord | <d4rckh> so its a ref of ref |
15:27:39 | FromDiscord | <jmgomez> not sure if you can do that but I guess getting the addr may work? |
15:28:45 | FromDiscord | <demotomohiro> In reply to @d4rckh "yes": https://nim-lang.org/docs/system.html#new%2Ctypedesc |
15:29:11 | FromDiscord | <demotomohiro> So you want a ref of existing variable? |
15:29:56 | FromDiscord | <d4rckh> sent a code paste, see https://play.nim-lang.org/#ix=3Zig |
15:31:23 | FromDiscord | <demotomohiro> What is the type of `Client` in your code? |
15:36:31 | FromDiscord | <demotomohiro> You cannot create a ref that points to a variable on stack. If you want to refer variables, https://nim-lang.org/docs/manual_experimental.html#view-types |
15:36:58 | * | om3ga joined #nim |
15:38:06 | FromDiscord | <d4rckh> Client is ref object |
15:38:31 | FromDiscord | <d4rckh> i just want to modify a variable from a proc |
15:38:37 | FromDiscord | <d4rckh> (edit) "a" => "an async" |
15:49:17 | NimEventer | New thread by Clavismax: How to run testament Exe-Test-Files in a different Folder, see https://forum.nim-lang.org/t/9198 |
15:52:57 | FromDiscord | <demotomohiro> In reply to @d4rckh "i just want to": https://wandbox.org/permlink/JE6zyVqjK9DqFgg1 |
15:53:57 | FromDiscord | <demotomohiro> If you want to modify int variable from an async proc: https://wandbox.org/permlink/1GO0F6glxsdNQrZE |
15:57:12 | FromDiscord | <d4rckh> In reply to @demotomohiro "https://wandbox.org/permlink/JE6zyVqjK9DqFgg1": Yes, but I want to change the reference itself |
15:57:19 | FromDiscord | <d4rckh> Like swap the client object |
15:57:24 | FromDiscord | <d4rckh> With another reference |
16:11:59 | FromDiscord | <demotomohiro> @d4rckh Is this what you want? https://wandbox.org/permlink/q9JCo3Q2fbudQVxu |
16:27:18 | FromDiscord | <d4rckh> In reply to @demotomohiro "<@648552095531663361> Is this what": yes! |
16:29:17 | * | xet7 joined #nim |
17:03:35 | * | sagax joined #nim |
17:18:04 | * | jjido joined #nim |
17:39:15 | FromDiscord | <yttriy> Is there a proc for mapping a range of values to another? |
17:39:43 | FromDiscord | <huantian> what kind of mapping are you looking for? |
17:42:08 | FromDiscord | <yttriy> In reply to @huantian "what kind of mapping": For example I have numbers from 1 to 10 and I want to convert them to numbers from 1 to 5. Is there a proc for that in std? |
17:42:35 | FromDiscord | <huantian> well there's no built-in function to do that specific task, but you can just use a floor division |
17:42:37 | FromDiscord | <Rika> divide or clamp? |
17:43:00 | FromDiscord | <Rika> so 6 -> 3 or 6 -> 5? |
17:45:02 | FromDiscord | <yttriy> In reply to @Rika "so 6 -> 3": 6 -> 3 |
17:45:18 | FromDiscord | <Rika> `((number + 1) div 2)`? |
17:46:23 | FromDiscord | <yttriy> In reply to @Rika "`((number + 1) div": Yes, but I am asking is there a proc for that |
17:46:29 | FromDiscord | <Rika> no |
17:46:48 | FromDiscord | <yttriy> Ok thanks |
17:48:09 | FromDiscord | <yttriy> (edit) "In reply to @Rika "`((number + 1) div": Yes, but I am asking ... is" added "if there" | removed "there" |
18:49:17 | * | jmdaemon joined #nim |
19:00:28 | FromDiscord | <dziki> sent a long message, see http://ix.io/3Zj8 |
19:05:31 | FromDiscord | <Yardanico> https://github.com/johnnovak/illwill |
19:12:37 | * | LuxuryMode joined #nim |
19:22:31 | * | jjido quit (Quit: My MacBook Air has gone to sleep. ZZZzzz…) |
19:36:47 | * | jjido joined #nim |
19:37:28 | * | om3ga quit (Quit: Bye) |
19:42:01 | FromDiscord | <dziki> In reply to @Yardanico "https://github.com/johnnovak/illwill": Thank You! It's more than I could wish for 🙂 |
20:24:57 | FromDiscord | <Bubblie> Has the import bug been fixed yet? |
20:25:21 | FromDiscord | <Yardanico> what bug? |
20:26:28 | FromDiscord | <Bubblie> In reply to @Elegantbeef "`../` is not parsed": . |
20:26:48 | FromDiscord | <Bubblie> I was trying to fix it myself but I couldnt find where nim handles the parsing |
20:29:38 | FromDiscord | <Yardanico> In reply to @Bubblie "I was trying to": well, I don't think it's easy to fix considering that import statements' paths must be valid nim syntax unless you use "" |
20:29:49 | FromDiscord | <Yardanico> same reason you can't do `import proc` |
20:30:09 | FromDiscord | <Yardanico> (well, a bit different, because then you can't refer to it by the module name) |
20:31:01 | FromDiscord | <Bubblie> This is a minor inconvenience for me but I hope at some point it is fixed 😅 but for now ill deal with it it isnt a big deal |
20:31:11 | FromDiscord | <Bubblie> In reply to @Yardanico "well, I don't think": Ah okay |
20:35:17 | * | sagax quit (Remote host closed the connection) |
20:42:46 | * | vicfred quit (Quit: Leaving) |
20:59:21 | FromDiscord | <clifonlintic> I'll help 10 individuals how to earn $20,000 in just 72 hours from the crypto market. But you will pay me 10% commission when you receive your profit. if interested send me a direct message via WhatsApp by asking me HOW for more details on how to get started↵+1 (2297781881 |
21:00:54 | FromDiscord | <Yardanico> wow |
21:01:45 | FromDiscord | <Andreas> sent a code paste, see https://play.nim-lang.org/#ix=3ZjB |
21:02:24 | FromDiscord | <Yardanico> nim expects a thread proc to be GC-safe (that is, not accessing any GC'd data created outside of it, or globals) |
21:02:39 | FromDiscord | <Yardanico> of course you can always override that behaviour if you really want |
21:02:49 | FromDiscord | <Yardanico> but don't forget that with refc GC is local heap |
21:02:56 | FromDiscord | <Andreas> In reply to @Yardanico "of course you can": that sounds great - let"s try this.. |
21:03:00 | FromDiscord | <Yardanico> so your `item` won't be accessible from `defer_rcu` with refc |
21:03:00 | FromDiscord | <Elegantbeef> Oh fuck yea my Pragma mismatch message exists! |
21:04:40 | FromDiscord | <Andreas> @Yardanico @ElegantBeef so the clean solution would be to use a channel and have the C-call outside the thread-proc ? is that correct ? |
21:17:52 | FromDiscord | <System64 ~ Flandre Scarlet> sent a code paste, see https://play.nim-lang.org/#ix=3ZjE |
21:18:33 | NimEventer | New thread by Icedquinn: Connect protocol, see https://forum.nim-lang.org/t/9199 |
21:38:31 | FromDiscord | <Elegantbeef> The answe is always going to be yes↵(@System64 ~ Flandre Scarlet) |
21:41:06 | * | sagax joined #nim |
21:42:01 | FromDiscord | <Elegantbeef> sent a code paste, see https://play.nim-lang.org/#ix=3ZjK |
21:42:07 | FromDiscord | <Elegantbeef> There you go @System64 ~ Flandre Scarlet you have C interfaces |
21:42:43 | FromDiscord | <System64 ~ Flandre Scarlet> Is it possible to have something more Nim friendly? |
21:43:21 | FromDiscord | <Elegantbeef> Yea use methods or object variants |
21:43:43 | FromDiscord | <System64 ~ Flandre Scarlet> Nim has Methods? |
21:43:50 | FromDiscord | <exelotl> I have a very similar setup in my game. Except it has to `{.emit.}` C code so that the `ActorClass` objects are actually `const` and the actors have pointers to them |
21:43:51 | FromDiscord | <Elegantbeef> Yes |
21:43:56 | FromDiscord | <Elegantbeef> Nim has single parent inheritance |
21:44:08 | FromDiscord | <exelotl> but yes if you're not targetting an embedded platform then methods are the way to go |
21:44:19 | FromDiscord | <Elegantbeef> Also exelotl did my template show you anything new that you didnt know? Or was it redundant? |
21:44:54 | FromDiscord | <System64 ~ Flandre Scarlet> In reply to @Elegantbeef "Nim has single parent": So I should use inheritance? |
21:46:03 | FromDiscord | <exelotl> In reply to @Elegantbeef "Also exelotl did my": oh yeah I actually hadn't considered using parameterless templates for that purpose, but sadly it doesn't solve the case where you did `destroy(foo)` inside a block and then accessed `foo` outside the block |
21:47:31 | FromDiscord | <Yardanico> you can probably do some more magic, like having some compile time variable tracking destruction :P |
21:47:37 | FromDiscord | <Yardanico> reimplementing DFA as a macro XD |
21:50:21 | FromDiscord | <Elegantbeef> Ah shame |
21:50:59 | FromDiscord | <Elegantbeef> It'd be dumb but you could use TRMs to reason it |
21:51:06 | FromDiscord | <Elegantbeef> But good bye compile times 😄 |
21:59:15 | FromDiscord | <System64 ~ Flandre Scarlet> Not sure if inheritence is the way to go |
22:01:32 | * | vicecea quit (Remote host closed the connection) |
22:02:04 | * | vicecea joined #nim |
22:06:08 | FromDiscord | <Andreas> sent a long message, see http://ix.io/3ZjR |
22:09:15 | FromDiscord | <Elegantbeef> Well what are you after↵(@System64 ~ Flandre Scarlet) |
22:09:33 | FromDiscord | <Elegantbeef> You can do the exact same thing as C |
22:09:59 | FromDiscord | <Elegantbeef> You can use pointer procs as interfaces, you can use methods, you can make your own trait system, you can use iface or similar.... |
22:12:21 | * | LuxuryMode quit (Quit: Connection closed for inactivity) |
22:12:41 | FromDiscord | <System64 ~ Flandre Scarlet> sent a code paste, see https://play.nim-lang.org/#ix=3ZjT |
22:13:05 | FromDiscord | <Elegantbeef> All the systems i mentioned give that |
22:14:58 | FromDiscord | <System64 ~ Flandre Scarlet> wait, every system needs something like Switch statement? |
22:15:18 | FromDiscord | <Elegantbeef> All the systems i mentioned allow you to do that without a switch statement |
22:15:28 | FromDiscord | <System64 ~ Flandre Scarlet> ah alright |
22:17:48 | FromDiscord | <System64 ~ Flandre Scarlet> sent a code paste, see https://play.nim-lang.org/#ix=3ZjU |
22:18:04 | FromDiscord | <Elegantbeef> Why are you using a seq, we have enum indexed arrays |
22:18:24 | FromDiscord | <Elegantbeef> Also for one that didnt want to use OOP you're using OOP |
22:18:34 | FromDiscord | <Elegantbeef> `ref object of RootObj` is a inheritable reference object |
22:18:47 | FromDiscord | <Elegantbeef> `constructActor` returns a dangling pointer |
22:18:56 | FromDiscord | <Elegantbeef> Nothing about this code is afe 😩 |
22:19:07 | FromDiscord | <Elegantbeef> Uhhh that's supposed to be 🙂 but i muspressed |
22:19:32 | FromDiscord | <Elegantbeef> Also `ptr Actor` when `Actor` is a `ref object` is a pointer to a pointer |
22:21:43 | FromDiscord | <System64 ~ Flandre Scarlet> Ah alright |
22:22:31 | FromDiscord | <br4n_d0n> Is that last proc always initializing Actor's with default values? If so, why not define that in the type? |
22:22:51 | FromDiscord | <Elegantbeef> Nim doesnt have default values without macros |
22:23:10 | FromDiscord | <br4n_d0n> Really? |
22:23:25 | FromDiscord | <Elegantbeef> Yes it 0 init's all values you need constructors to do it otherwise |
22:23:30 | FromDiscord | <System64 ~ Flandre Scarlet> sent a code paste, see https://paste.rs/pzo |
22:23:39 | FromDiscord | <Elegantbeef> 0 init'd values are a thing for 2.0 |
22:23:47 | FromDiscord | <Elegantbeef> No it's not you're not allocating the Actor |
22:23:53 | FromDiscord | <Elegantbeef> Did you even run that code it'll error nil ref |
22:25:26 | FromDiscord | <System64 ~ Flandre Scarlet> Didn't I init an empty Actor at the start? |
22:25:31 | FromDiscord | <Elegantbeef> No |
22:25:43 | FromDiscord | <Elegantbeef> It's a reference object it 0 inits |
22:25:57 | FromDiscord | <System64 ~ Flandre Scarlet> ah so what should I do? |
22:26:25 | FromDiscord | <Elegantbeef> sent a code paste, see https://play.nim-lang.org/#ix=3ZjV |
22:27:22 | FromDiscord | <System64 ~ Flandre Scarlet> Ah alright |
22:29:20 | FromDiscord | <br4n_d0n> Is there a roadmap/timeline for Nim anywhere? I tried searching the website and github, but was unable to find anything |
22:29:32 | FromDiscord | <System64 ~ Flandre Scarlet> Why? https://media.discordapp.net/attachments/371759389889003532/982410731603492924/unknown.png |
22:29:34 | FromDiscord | <Elegantbeef> There's the 2.0 rfc on nim-lang/rfcs |
22:29:51 | FromDiscord | <br4n_d0n> In reply to @Elegantbeef "There's the 2.0 rfc": Thanks, I'll check that out |
22:30:29 | FromDiscord | <Elegantbeef> The fuck is `behaviourTable[Player, result]`? |
22:30:45 | FromDiscord | <Elegantbeef> It's an array why do you have 2 indicies |
22:31:12 | FromDiscord | <System64 ~ Flandre Scarlet> wait I'm dumb |
22:33:35 | FromDiscord | <System64 ~ Flandre Scarlet> sent a code paste, see https://play.nim-lang.org/#ix=3ZjW |
22:33:40 | FromDiscord | <Elegantbeef> Dont need the `return result` but sure |
22:33:58 | FromDiscord | <Elegantbeef> Still dont know why you're using `flags: byte` |
22:34:11 | FromDiscord | <Elegantbeef> This is Nim not C we dont use silliness |
22:35:01 | FromDiscord | <System64 ~ Flandre Scarlet> it's like a propertie |
22:35:47 | FromDiscord | <Elegantbeef> What? |
22:36:24 | FromDiscord | <System64 ~ Flandre Scarlet> For exemple in Mario, you have green and red Koopa↵They're both Koopas but the difference is the red one is careful about void |
22:37:42 | FromDiscord | <Elegantbeef> sent a code paste, see https://play.nim-lang.org/#ix=3ZjZ |
22:38:00 | FromDiscord | <Elegantbeef> It's the exact same code just one is much much more Nim and clean |
22:38:07 | FromDiscord | <System64 ~ Flandre Scarlet> Ah yeah true |
22:38:19 | FromDiscord | <Elegantbeef> Ah sorry that should be `1, 2, 4, 8` |
22:38:43 | FromDiscord | <System64 ~ Flandre Scarlet> I have 8 bits for the flag |
22:38:53 | FromDiscord | <Elegantbeef> Ok? |
22:39:25 | FromDiscord | <Elegantbeef> The `set[ActorFlag]` uses 8 bits aswell |
22:39:35 | FromDiscord | <Elegantbeef> It's actually dynamically sized to use the fewest amount of bits possible |
22:40:03 | FromDiscord | <br4n_d0n> @ElegantBeef ... that RFC repo doesn't seem to have much in it and they are from like 2-3 years ago. Am I missing something? |
22:40:21 | FromDiscord | <Elegantbeef> https://github.com/nim-lang/RFCs/issues/437 |
22:40:25 | FromDiscord | <Elegantbeef> Did you look at the issues? |
22:41:33 | FromDiscord | <Elegantbeef> In the case of nim bitsets if you have 20 elements it uses 3 bytes |
22:41:54 | FromDiscord | <Elegantbeef> It's a packed bitset just much much more ergonomic to the C variant |
22:42:13 | FromDiscord | <br4n_d0n> Ah, seems strange to have in the "issues" section, but whatever, I now can look at it |
22:53:09 | FromDiscord | <System64 ~ Flandre Scarlet> Is it a good idea to make the Actor seq global? |
22:56:10 | FromDiscord | <Elegantbeef> That's up to you |
22:56:44 | FromDiscord | <System64 ~ Flandre Scarlet> Isn't a.update() supposed to be allowed? https://media.discordapp.net/attachments/371759389889003532/982417584399990804/unknown.png |
22:56:56 | FromDiscord | <Elegantbeef> It's a pointer proc |
22:57:00 | FromDiscord | <Elegantbeef> `a.update(a)` |
22:57:34 | FromDiscord | <System64 ~ Flandre Scarlet> ah yeah true |
22:58:52 | FromDiscord | <Elegantbeef> Using OOP wouldnt have that issue |
22:59:50 | FromDiscord | <System64 ~ Flandre Scarlet> will be OOP more CPU intensive? |
23:01:13 | FromDiscord | <Elegantbeef> Negligably |
23:01:18 | FromDiscord | <Elegantbeef> You're already using reference objects |
23:01:47 | FromDiscord | <System64 ~ Flandre Scarlet> ah alright↵So I guess it would be better to use OOP |
23:01:58 | * | jjido quit (Quit: My MacBook Air has gone to sleep. ZZZzzz…) |
23:02:07 | FromDiscord | <System64 ~ Flandre Scarlet> and so with OOP I wouldn't need a behavior table |
23:02:20 | FromDiscord | <Bubblie> In reply to @Yardanico "wow": ? |
23:04:13 | FromDiscord | <Elegantbeef> Exactly system each actor would be it's own type and would override the update procedure |
23:05:10 | FromDiscord | <Bubblie> In reply to @Bubblie "?": Im a bit confused with the wow reply 💀 |
23:05:17 | FromDiscord | <Bubblie> Not sure if it was directed towards me or sometjing |
23:05:55 | FromDiscord | <Elegantbeef> There was a deleted scam message |
23:06:20 | FromDiscord | <Elegantbeef> > I'll help 10 individuals how to earn $20,000 in just 72 hours from the crypto market. But you will pay me 10% commission when you receive your profit. ... |
23:06:22 | FromDiscord | <Bubblie> Oh |
23:06:28 | FromDiscord | <Bubblie> LMAO |
23:07:25 | FromDiscord | <Elegantbeef> Relatively common matrix spam it seems |
23:10:37 | FromDiscord | <System64 ~ Flandre Scarlet> So this is Method? https://media.discordapp.net/attachments/371759389889003532/982421075612819516/unknown.png |
23:11:35 | * | ltriant quit (Ping timeout: 255 seconds) |
23:14:18 | FromDiscord | <huantian> look at <https://nim-lang.org/docs/tut2.html#object-oriented-programming-dynamic-dispatch> |
23:18:19 | FromDiscord | <System64 ~ Flandre Scarlet> sent a code paste, see https://play.nim-lang.org/#ix=3Zk5 |
23:19:30 | FromDiscord | <huantian> sent a code paste, see https://play.nim-lang.org/#ix=3Zk6 |
23:19:40 | FromDiscord | <System64 ~ Flandre Scarlet> ah alright |
23:19:53 | FromDiscord | <System64 ~ Flandre Scarlet> btw Actor and Player are in different files |
23:26:29 | FromDiscord | <Elegantbeef> Doesnt matter as long as `Player` imports `Actor` |
23:29:30 | FromDiscord | <System64 ~ Flandre Scarlet> sent a code paste, see https://play.nim-lang.org/#ix=3Zk8 |
23:30:31 | FromDiscord | <huantian> send code pls? |
23:30:52 | FromDiscord | <huantian> it works just fine on my end https://play.nim-lang.org/#ix=3Zk9 |
23:31:09 | FromDiscord | <Elegantbeef> They probably didnt export `Actor` or `constructActor` |
23:31:15 | FromDiscord | <Elegantbeef> Errors are a magical thing |
23:32:09 | FromDiscord | <System64 ~ Flandre Scarlet> sent a code paste, see https://play.nim-lang.org/#ix=3Zkb |
23:32:19 | FromDiscord | <huantian> well yeah that wont' work because constructActor returns an Actor |
23:32:22 | FromDiscord | <huantian> not a Player |
23:32:35 | FromDiscord | <System64 ~ Flandre Scarlet> but a Player is an Actor |
23:32:44 | FromDiscord | <huantian> but not all Actors are Players |
23:32:47 | FromDiscord | <System64 ~ Flandre Scarlet> true |
23:33:30 | FromDiscord | <System64 ~ Flandre Scarlet> So I have to rewrite the same code in Player? |
23:34:00 | FromDiscord | <Elegantbeef> Then you can do `new result` `result.construct` and then set your player specific variables |
23:35:27 | FromDiscord | <System64 ~ Flandre Scarlet> sent a code paste, see https://play.nim-lang.org/#ix=3Zkc |
23:35:42 | FromDiscord | <Elegantbeef> No |
23:36:08 | FromDiscord | <Elegantbeef> make a procedure inside actor that takes in a `Actor` and sets the fields of that actor |
23:36:46 | FromDiscord | <Elegantbeef> sent a code paste, see https://play.nim-lang.org/#ix=3Zkd |
23:36:58 | FromDiscord | <System64 ~ Flandre Scarlet> Ah alright |
23:37:13 | FromDiscord | <Elegantbeef> sent a code paste, see https://play.nim-lang.org/#ix=3Zke |
23:37:18 | FromDiscord | <System64 ~ Flandre Scarlet> aaaah alright |
23:42:45 | FromDiscord | <System64 ~ Flandre Scarlet> Yeeees! It works! https://media.discordapp.net/attachments/371759389889003532/982429160637075526/unknown.png |
23:44:18 | FromDiscord | <Elegantbeef> Weird how methods work 😄 |
23:48:25 | * | ltriant joined #nim |