00:02:52 | FromDiscord | <~355/113 Man> sent a code paste, see https://play.nim-lang.org/#ix=2Plh |
00:03:12 | FromDiscord | <~355/113 Man> do I need a `new` keyword somewhere? |
00:05:06 | FromDiscord | <exelotl> In reply to @arne "and yes, I am": oh god please no, this would ruin all my gba code |
00:05:31 | FromDiscord | <exelotl> int should be the machine's native word size |
00:10:30 | FromDiscord | <exelotl> @~355/113 Man the pointer becomes invalid as soon as the function returns because glArray is on the stack |
00:10:43 | FromDiscord | <~355/113 Man> yea, that's what I figured |
00:11:05 | FromDiscord | <exelotl> are the matrix elements compatible with GLfloat? Or are they float64 while GLfloat is 32 bit? |
00:11:13 | FromDiscord | <~355/113 Man> they are float32 |
00:12:08 | FromDiscord | <exelotl> ah, you could probably literally just return `cast[ptr GLfloat](addr mat[0,0])` |
00:12:15 | FromDiscord | <~355/113 Man> nope |
00:12:26 | FromDiscord | <~355/113 Man> the matrix is row major while opengl expects column major |
00:12:38 | FromDiscord | <~355/113 Man> (I hope I didn't get those terms backwards) |
00:13:20 | FromDiscord | <exelotl> ah I see, in that case I guess your best bet is to return an `array[16, GLfloat]` |
00:13:31 | FromDiscord | <exelotl> and then take the address of the first element separately |
00:13:56 | FromDiscord | <exelotl> that's the only way that you can ensure the array lives long enough |
00:14:09 | FromDiscord | <~355/113 Man> what about heap allocation? |
00:14:15 | FromDiscord | <~355/113 Man> (edit) "allocation?" => "allocation with GC?" |
00:14:48 | FromDiscord | <exelotl> yeah you could return a ref array if those are the semantics you're after |
00:15:17 | FromDiscord | <~355/113 Man> i'm not sure how to use heap in a safe way though |
00:15:22 | FromDiscord | <~355/113 Man> (in Nim) |
00:19:37 | FromDiscord | <exelotl> there's this article but it only briefly touches on how to use ref types http://zevv.nl/nim-memory/#_traced_references_and_the_garbage_collector |
00:21:28 | FromDiscord | <~355/113 Man> yep, i'm reading that right now |
00:21:39 | FromDiscord | <~355/113 Man> btw what's the difference between `ref` and `ptr` |
00:22:23 | FromDiscord | <exelotl> ptr is a non-traced pointer like in C. it's not managed by the GC/ARC |
00:23:33 | FromDiscord | <exelotl> Nim's 3 unsafe features are ptr, addr, cast |
00:25:33 | FromDiscord | <exelotl> if you're using ref, the worst that can happen is that you accidentally tried to dereference a nil reference↵but if you're using ptr, all the C pitfalls apply such as accidental use after free/going out of scope, or forgetting to free, etc. |
00:26:21 | FromDiscord | <ElegantBeef> On devel there is even `not nil` which makes it even harder to deref a nil |
00:26:37 | FromDiscord | <exelotl> ah yeah `not nil` is exciting |
00:26:52 | * | Vladar quit (Quit: Leaving) |
00:27:04 | FromDiscord | <ElegantBeef> https://nim-lang.github.io/Nim/manual_experimental.html#strict-not-nil-checking if interested |
00:27:27 | FromDiscord | <~355/113 Man> so if I get a ref by using new, and return a ptr, what happens? |
00:27:34 | FromDiscord | <~355/113 Man> (edit) "so if I get a ref by using new, and return ... a" added "it as" |
00:27:49 | FromDiscord | <ElegantBeef> You have an unmanaged pointer |
00:28:11 | FromDiscord | <exelotl> yeahh, if nothing is referring to the ref anymore, it gets deallocated and now you have a bogus pointer |
00:28:40 | FromDiscord | <ElegantBeef> Reference objects are managed, so depending on your GC they are scoped locked or until the next gc tick |
00:28:58 | FromDiscord | <ElegantBeef> But very quickly they'll be out of scope and you'll have a dangler |
00:30:00 | FromDiscord | <exelotl> sent a code paste, see https://play.nim-lang.org/#ix=2Pll |
00:30:25 | FromDiscord | <ElegantBeef> Ref is just a pointer that is managed by the memory collection |
00:31:04 | FromDiscord | <ElegantBeef> If you're writing pure Nim it'll almost always be what you prefer, that and `lent` variables |
00:33:46 | FromDiscord | <ElegantBeef> Lent its a read only borrowed reference |
00:48:15 | * | lritter quit (Remote host closed the connection) |
01:05:49 | * | fredrikhr quit (Quit: Disconnecting) |
01:10:11 | FromDiscord | <~355/113 Man> sent a code paste, see https://play.nim-lang.org/#ix=2Pls |
01:13:03 | * | njoseph quit (Quit: http://quassel-irc.org - Chat comfortably. Anywhere.) |
01:13:25 | * | njoseph joined #nim |
01:15:50 | FromDiscord | <Clyybber> saem: Ideally nkIfExpr/Stmt would be a single node too, it's simpler and makes more sense |
01:16:08 | FromDiscord | <Clyybber> The only issue is making that change backwards compatible |
01:20:40 | saem | @Clyybber: I prefer expressions all the time and then have the compiler reason it away, it's nicer for the user for sure. But internally in the compiler differentiating the two is handy, but that doesn't _have_ to be a node kind level. Mostly was wondering if there was a chosen direction. |
01:25:13 | * | asdflkj_ joined #nim |
01:25:25 | saem | Thanks for explaining the background. |
01:26:08 | FromDiscord | <~355/113 Man> actually wait, could I make this a template? |
01:26:15 | saem | Might have chased down the last stability fix. 🤞 |
01:26:52 | saem | Which means I can go back to poking at nkError and thinking about attributed grammars. |
02:09:20 | * | PMunch quit (Quit: Leaving) |
02:32:33 | saem | welp, so much for that. |
02:47:52 | FromDiscord | <exelotl> @~355/113 Man yes you almost certainly shouldn't be doing that 😅 |
02:48:22 | FromDiscord | <~355/113 Man> what about template? |
02:51:48 | FromDiscord | <exelotl> the glArray needs to stay in scope or be referred to somewhere for at least as long as the pointer to it is used. I'm not very familiar with OpenGL though. Does glUniformMatrix4fv need to hold onto the matrix pointer for anything? Or is it OK if it gets freed after the call? |
02:52:42 | FromDiscord | <~355/113 Man> the pointer can be discarded right after the function call |
02:53:00 | FromDiscord | <~355/113 Man> (edit) "discarded" => "freed" |
02:54:43 | FromDiscord | <exelotl> sent a code paste, see https://play.nim-lang.org/#ix=2PlM |
02:54:50 | FromDiscord | <exelotl> wait derp |
02:55:26 | FromDiscord | <exelotl> sent a code paste, see https://play.nim-lang.org/#ix=2PlN |
02:55:27 | FromDiscord | <~355/113 Man> btw I changed it to return a reference and I cast that reference to a pointer |
02:55:50 | FromDiscord | <~355/113 Man> oh, that's nice looking |
02:56:02 | FromDiscord | <~355/113 Man> wait, but that won't work I think |
02:56:25 | FromDiscord | <~355/113 Man> wait nvm didn't see you were storing the array as a variable] |
02:56:29 | FromDiscord | <~355/113 Man> (edit) "variable]" => "variable" |
03:03:59 | FromDiscord | <exelotl> returning the array by value may look slow but there's a decent chance it will be optimised either by Nim or by the C compiler |
03:14:21 | FromDiscord | <~355/113 Man> oh also, how can I run a custom task in the .nimble file? |
03:14:54 | * | wasted_youth2 quit (Quit: Leaving) |
03:14:58 | FromDiscord | <~355/113 Man> I want to do say `nimble example` to run an example implementation of the library |
03:17:30 | * | asdflkj_ quit (Ping timeout: 246 seconds) |
03:23:33 | FromDiscord | <~355/113 Man> sent a code paste, see https://paste.rs/ENx |
03:23:41 | FromDiscord | <~355/113 Man> `Error: undeclared identifier: 'example'` |
03:38:07 | FromDiscord | <ElegantBeef> You need a description |
03:40:53 | FromDiscord | <~355/113 Man> description? |
03:41:49 | FromDiscord | <ElegantBeef> https://nim-lang.org/docs/nimscript.html#task.t%2Cuntyped%2Cstring%2Cuntyped |
03:51:42 | FromDiscord | <GamzWithJamz> I am working on an engine UI for my game engine written in Nim.↵↵I want to be able to obtain all the types that are in the runtime at inherit from a base class. Example: I have an abstract parent type called Component. I have extended from it to create SpriteComponent, TransformComponent, etc. The language Beef has a field on the static Type class that has a list of all types in the runtime. C# has a similar functionality with re |
03:52:10 | FromDiscord | <ElegantBeef> What are you doing with these? |
03:53:15 | FromDiscord | <GamzWithJamz> So I can list them off in the UI. For example "I want to make a sprite. I need to add a SpriteComponent to an Entity" So I need to expose the entity in the UI. |
03:53:19 | FromDiscord | <GamzWithJamz> Now I could hardcode this |
03:53:40 | FromDiscord | <GamzWithJamz> but I also want to allow custom types to show up. |
03:54:04 | FromDiscord | <ElegantBeef> You could have a macro which declares your type and subscribes it to a list of components |
03:54:31 | FromDiscord | <GamzWithJamz> The specific case is "User needs to make a System which interacts with entities that have components X and Y. They need to make the system which interacts with X and Y in a specific way" |
03:55:04 | FromDiscord | <GamzWithJamz> In reply to @ElegantBeef "You could have a": I already have a lot of macros written for system creation, but I still need to be able to show the type in the UI. |
03:55:06 | FromDiscord | <GamzWithJamz> Actually |
03:55:15 | FromDiscord | <GamzWithJamz> I think I have a way this may work after speaking about it |
03:55:22 | FromDiscord | <GamzWithJamz> and without depending upon reflection |
03:55:33 | FromDiscord | <GamzWithJamz> Thanks ElegantBeef |
03:55:56 | FromDiscord | <GamzWithJamz> Thanks @ElegantBeef for being a rubber ducky. :pepeLaugh: |
03:55:57 | FromDiscord | <ElegantBeef> All you're wanting is a list of all components so if you use a macro that subscribes them to a list at compile time it results in the same "Reflection" |
03:56:07 | FromDiscord | <ElegantBeef> But cheers regardless |
03:57:22 | FromDiscord | <ElegantBeef> @~355/113 Man did you get it working? |
03:57:33 | FromDiscord | <~355/113 Man> no, can't figure out how to execute "run" now |
03:57:48 | FromDiscord | <ElegantBeef> `nimble run` though idk if you can alias run |
03:57:50 | FromDiscord | <~355/113 Man> I thought it was `selfExec` but I think that's wrong |
03:58:09 | FromDiscord | <~355/113 Man> do I just type in `nimble run` in the `example` task? |
03:58:15 | FromDiscord | <ElegantBeef> Oh `runTask`? |
03:58:29 | FromDiscord | <ElegantBeef> might be able to just do `runTask()` inside that body |
03:58:46 | FromDiscord | <~355/113 Man> runTask doesn't show up in the nimscript docs |
03:58:49 | FromDiscord | <ElegantBeef> > For a task named foo, this template generates a proc named fooTask. This is useful if you need to call one task in another in your Nimscript. |
03:59:18 | FromDiscord | <ElegantBeef> I am probably wrong, but idk worth a shot 😄 |
03:59:23 | FromDiscord | <~355/113 Man> `Error: undeclared identifier: 'runTask'` |
03:59:32 | FromDiscord | <ElegantBeef> Yea that's what i expected |
04:00:13 | FromDiscord | <ElegantBeef> Self exec should work |
04:00:46 | FromDiscord | <~355/113 Man> selfExec("run") didn't work, should it be "nimble run"? |
04:00:59 | FromDiscord | <ElegantBeef> the docs of self exec say no |
04:01:21 | FromDiscord | <~355/113 Man> `Error: 'run' command not available; rebuild with -d:tinyc` |
04:01:31 | FromDiscord | <ElegantBeef> Check the value of `selfExe()` if it's nimble it should work |
04:01:48 | FromDiscord | <ElegantBeef> Ah when i do `nim run` that's what i gue |
04:01:50 | FromDiscord | <ElegantBeef> (edit) "gue" => "get" |
04:01:54 | FromDiscord | <ElegantBeef> So yea it's not in nimble anymore |
04:02:39 | FromDiscord | <ElegantBeef> you can do `exec "nimble run"` |
04:02:50 | FromDiscord | <ElegantBeef> Though dont think that will use that binary |
04:05:08 | FromDiscord | <ElegantBeef> Seems the best thing to do is just manually build then exec the binary you want to |
04:06:01 | FromDiscord | <~355/113 Man> can I pass arguments into `nimble run` like `nimble run example`? |
04:06:22 | FromDiscord | <~355/113 Man> or wait, I suppose I could just have run do the example anyways since you can't run a library |
04:06:40 | FromDiscord | <ElegantBeef> https://github.com/nim-lang/nimble#nimble-run |
04:20:12 | * | Tanger joined #nim |
04:43:35 | * | spiderstew joined #nim |
04:43:57 | * | spiderstew_ quit (Ping timeout: 272 seconds) |
05:00:10 | * | superbia1 joined #nim |
05:02:21 | * | superbia quit (Ping timeout: 264 seconds) |
05:04:40 | * | letto quit (Quit: Konversation terminated!) |
05:05:23 | * | letto joined #nim |
05:23:17 | * | waleee-cl quit (Quit: Connection closed for inactivity) |
05:29:33 | * | vicfred quit (Quit: Leaving) |
05:31:32 | FromDiscord | <~355/113 Man> ummmmmm, what?↵`Error: 'return' not allowed here` |
05:31:37 | FromDiscord | <~355/113 Man> ` glUniformMatrix4fv(transformID, GLsizei 1, false, cast[ptr GLfloat](transform.toGLfloatRef))↵` |
05:35:27 | FromDiscord | <ElegantBeef> did you change `toGlFloatRef` to a template? |
05:35:41 | FromDiscord | <~355/113 Man> ...... I think so |
05:35:46 | FromDiscord | <ElegantBeef> Do you return inside it? |
05:35:52 | FromDiscord | <~355/113 Man> yes |
05:35:53 | FromDiscord | <ElegantBeef> If so there is your problem |
05:36:00 | FromDiscord | <ElegantBeef> dont return just `yourValue` |
05:36:39 | FromDiscord | <ElegantBeef> Remember templates are pasted as in into your code, so `return` isnt called in the template scope it's called in the proc scope that called it |
05:37:12 | * | gangstacat quit (Quit: Ĝis!) |
05:39:57 | * | gangstacat joined #nim |
05:42:06 | FromDiscord | <~355/113 Man> I went with the array implementation that was suggested |
05:42:54 | FromDiscord | <~355/113 Man> does Nim have namespaces? |
05:45:08 | FromDiscord | <ElegantBeef> Nope |
05:48:19 | FromDiscord | <mattrb> sent a code paste, see https://play.nim-lang.org/#ix=2Pmw |
05:54:24 | FromDiscord | <ElegantBeef> It detected the first error first |
05:54:52 | FromDiscord | <ElegantBeef> Quit doesnt have a return type and you're using that case statement to assign a value |
05:55:54 | FromDiscord | <ElegantBeef> !eval let a = quit() |
05:55:55 | NimBot | Compile failed: /usercode/in.nim(1, 13) Error: expression 'quit(0)' has no type (or is ambiguous) |
05:57:02 | FromDiscord | <mattrb> sent a code paste, see https://play.nim-lang.org/#ix=2PmB |
05:57:55 | FromDiscord | <ElegantBeef> Hmm, it's valid for if statements aswell |
05:59:30 | FromDiscord | <mattrb> The compiler treats case statements without additional branches differently than it does with branches. Also, in theory, anything with a {.noreturn.} should match _any_ type |
06:00:38 | FromDiscord | <~355/113 Man> does Nim have a multimap? |
06:00:54 | FromDiscord | <~355/113 Man> aka a map that allows duplicate keys |
06:01:08 | FromDiscord | <ElegantBeef> Nim's default table did(does?) |
06:01:25 | FromDiscord | <ElegantBeef> https://nim-lang.org/docs/tables.html#add%2CTable%5BA%2CB%5D%2CA%2CsinkB |
06:02:32 | FromDiscord | <~355/113 Man> and when trying to access a key with multiple values do you get a list of values? |
06:02:39 | FromDiscord | <ElegantBeef> Nope 😄 |
06:03:15 | FromDiscord | <ElegantBeef> Why not just have a `seq[T]` as the value? |
06:03:52 | FromDiscord | <~355/113 Man> because i'm going to be inserting as key value pairs, not key seq[value] pairs |
06:04:13 | FromDiscord | <~355/113 Man> however I suppose I could make a wrapper for thsi |
06:04:14 | FromDiscord | <~355/113 Man> (edit) "thsi" => "this" |
06:23:29 | FromDiscord | <~355/113 Man> what's the type for procs? |
06:24:50 | FromDiscord | <Rika> wdym |
06:25:10 | FromDiscord | <Rika> a proc type is denoted by `proc(params: type): returntype` |
06:26:41 | FromDiscord | <~355/113 Man> thank you |
06:34:38 | FromDiscord | <~355/113 Man> sent a code paste, see https://play.nim-lang.org/#ix=2PmF |
06:41:48 | FromDiscord | <Rika> looks fine, anything of note to look at? |
06:43:14 | * | letto quit (Quit: Konversation terminated!) |
06:44:39 | FromDiscord | <~355/113 Man> how do I add to a sequence :thonk: |
06:45:06 | FromDiscord | <~355/113 Man> sent a code paste, see https://play.nim-lang.org/#ix=2PmH |
06:45:13 | * | letto joined #nim |
06:45:32 | FromDiscord | <~355/113 Man> (edit) "https://play.nim-lang.org/#ix=2PmH" => "https://play.nim-lang.org/#ix=2PmI" |
06:47:52 | FromDiscord | <Rika> the map isnt var |
06:48:06 | FromDiscord | <Rika> addEvent(map: var EventMap... |
06:49:31 | FromDiscord | <~355/113 Man> I think I need `import system` too |
06:52:24 | FromDiscord | <~355/113 Man> now it's complaining about `[]` not being defined |
06:56:03 | FromDiscord | <Rika> you dont need import system |
07:07:41 | FromDiscord | <~355/113 Man> `Error: attempting to call undeclared routine: 'addEvent'` |
07:08:09 | FromDiscord | <~355/113 Man> sent a code paste, see https://play.nim-lang.org/#ix=2PmM |
07:08:32 | FromDiscord | <~355/113 Man> sent a code paste, see https://play.nim-lang.org/#ix=2PmN |
07:08:59 | FromDiscord | <~355/113 Man> sent a code paste, see https://play.nim-lang.org/#ix=2PmO |
07:09:06 | FromDiscord | <Rika> show the imports |
07:09:12 | FromDiscord | <~355/113 Man> NimblePiE_Example does not import EventMultiMap, but NimblePiE does |
07:09:24 | FromDiscord | <Rika> export EventMultiMap |
07:09:29 | FromDiscord | <Rika> in NimblePiE |
07:10:17 | * | vegai left #nim (#nim) |
07:10:56 | FromDiscord | <Rika> you dont need that |
07:10:57 | FromDiscord | <~355/113 Man> sent a code paste, see https://play.nim-lang.org/#ix=2PmP |
07:11:42 | FromDiscord | <Rika> sent a code paste, see https://paste.rs/P0R |
07:11:59 | FromDiscord | <~355/113 Man> sent a code paste, see https://play.nim-lang.org/#ix=2PmQ |
07:12:11 | FromDiscord | <Rika> export EventMap as well |
07:12:19 | FromDiscord | <Rika> i think |
07:12:34 | FromDiscord | <Rika> hard to tell because of lack of info |
07:12:49 | FromDiscord | <~355/113 Man> this is called from where EventMultiMap is imported |
07:13:05 | FromDiscord | <~355/113 Man> sent a code paste, see https://play.nim-lang.org/#ix=2PmR |
07:13:26 | FromDiscord | <~355/113 Man> (edit) "https://play.nim-lang.org/#ix=2PmR" => "https://play.nim-lang.org/#ix=2PmS" |
07:13:43 | FromDiscord | <~355/113 Man> (edit) "https://play.nim-lang.org/#ix=2PmS" => "https://play.nim-lang.org/#ix=2PmT" |
07:14:14 | FromDiscord | <~355/113 Man> oh, I think I need to export tables |
07:14:30 | FromDiscord | <Rika> ah yes |
07:22:14 | FromDiscord | <mattrb> sent a code paste, see https://play.nim-lang.org/#ix=2PmW |
07:27:07 | FromDiscord | <Rika> cpu.nim would need to import arm.nim, but in your case that would be infeasible |
07:28:33 | FromDiscord | <Rika> reorganize the code to combine cpu and arm? i dont know |
07:29:31 | FromDiscord | <mattrb> I was afraid that'd be the solution |
07:29:45 | FromDiscord | <mattrb> These are going to be two pretty large files, and it'd be nice to keep them separate :/ |
07:31:37 | FromDiscord | <Rika> i forgot what solutions i did to fix this |
07:31:42 | FromDiscord | <Rika> because i am sure i did before |
07:32:32 | FromDiscord | <mattrb> Please let me know if you remember. I'd love to know an alternate solution |
07:33:22 | FromDiscord | <Rika> im not sure if concepts would help |
07:33:31 | FromDiscord | <Rika> okay |
07:33:32 | FromDiscord | <Rika> wait |
07:33:32 | FromDiscord | <Rika> no |
07:33:47 | FromDiscord | <Rika> you have to move branch out into a file which imports both arm and cpu? |
07:33:49 | FromDiscord | <Rika> maybe? |
07:38:46 | FromDiscord | <mattrb> Effectively all `arm.nim` is is a file that defines a bunch of static generic instruction handlers, a macro that generates an array of those procs, and an `execArm` proc that selects which of those handlers to execute. `cpu.nim#tick` needs `arm.nim#execArm` needs the array which contains `arm.nim#branch` and others which need `cpu.nim#setReg`. What's your suggested structure there? |
07:43:17 | FromDiscord | <mattrb> I could always move `setReg` to a type of "mixin.nim" file that both "cpu.nim" and "arm.nim" import from, but I don't love that |
07:43:37 | FromDiscord | <ElegantBeef> So what is the current module import paths, cpu imports arm? |
07:44:06 | FromDiscord | <mattrb> Yeah cpu imports arm so that it can use the `execArm` proc |
07:44:54 | FromDiscord | <mattrb> And actually, to short-circuit some of the other logic, I'd also like `execArm` to rely on `checkCond`, which lives in cpu |
07:45:57 | FromDiscord | <Rika> you can do this with one file |
07:45:59 | FromDiscord | <Rika> i mean |
07:46:06 | FromDiscord | <Rika> without adding a files |
07:46:08 | FromDiscord | <Rika> (edit) "files" => "file" |
07:46:16 | FromDiscord | <mattrb> I just don't want a huge file :p |
07:46:17 | FromDiscord | <Rika> but you need to move the imports |
07:46:25 | FromDiscord | <Rika> aka the imports wont all be at the top |
07:46:26 | FromDiscord | <ElegantBeef> Well a wisely position `include` 😄 |
07:46:31 | FromDiscord | <ElegantBeef> Or import yea |
07:46:53 | FromDiscord | <Rika> and rearrange the code in cpu |
07:47:16 | FromDiscord | <mattrb> I don't quite follow. What's the pattern here? |
07:47:32 | FromDiscord | <ElegantBeef> Well you can have recursive imports as long as they're don properly |
07:47:32 | FromDiscord | <Rika> move setReg and checkCond as much as possible to the top, then put the `import arm` below the procs |
07:47:34 | FromDiscord | <ElegantBeef> (edit) "don" => "done" |
07:47:46 | FromDiscord | <Rika> then arm can import cpu |
07:48:02 | FromDiscord | <mattrb> Oh |
07:48:16 | FromDiscord | <mattrb> Okay yeah I can make that work then. Is that common in nim? |
07:48:57 | FromDiscord | <ElegantBeef> I've seen it before |
07:49:03 | FromDiscord | <mattrb> Hm it still doesn't like that |
07:49:13 | FromDiscord | <Rika> whats the issue now |
07:49:24 | FromDiscord | <Rika> ah, wait |
07:49:28 | FromDiscord | <Rika> i think i made a mistake |
07:49:36 | FromDiscord | <mattrb> I've moved the `import arm` below the declaration of `setReg`, and it's still giving me the same `Error: attempting to call undeclared routine: 'setReg'` |
07:49:49 | FromDiscord | <ElegantBeef> You still need to `import cpu` in the arm file |
07:50:00 | FromDiscord | <Rika> sent a code paste, see https://play.nim-lang.org/#ix=2Pn1 |
07:50:05 | FromDiscord | <Rika> yeah you have to import cpu in arm |
07:50:32 | FromDiscord | <mattrb> Ah gotcha, makes sense then. Seems to be working at least with the current setup |
07:50:55 | FromDiscord | <mattrb> Okay cool, thank you both. I'll roll with that as a solution for now 🙂 |
07:50:59 | FromDiscord | <ElegantBeef> Yay |
07:51:06 | FromDiscord | <Rika> anything that arm needs goes above its import |
07:51:20 | FromDiscord | <Rika> anything in cpu that needs arm goes under its import |
07:51:21 | FromDiscord | <ElegantBeef> You can also checkout `include` depending on your end goal |
07:52:01 | FromDiscord | <mattrb> Oh interesting |
07:52:08 | FromDiscord | <mattrb> Didn't realize that existed |
07:52:39 | FromDiscord | <mattrb> I think I like that over imports in this case |
09:00:12 | * | BauxnaMatrix[m] quit (Quit: Idle for 30+ days) |
09:19:56 | * | idf joined #nim |
09:37:00 | * | MarderIII joined #nim |
09:45:17 | * | MarderIII quit (Ping timeout: 260 seconds) |
09:51:07 | * | superbia1 is now known as superbia |
09:59:48 | * | MarderIII joined #nim |
10:00:50 | * | avanderneut joined #nim |
10:17:05 | * | bozaloshtsh quit (Ping timeout: 272 seconds) |
10:29:41 | * | MarderIII is now known as warkruid |
10:57:06 | * | Vladar joined #nim |
11:15:05 | * | kenran joined #nim |
11:26:53 | FromDiscord | <Rika> what are the challenges of using io_uring for asyncdispatch over select/epoll/whatever it uses? |
11:29:34 | * | superbia quit (Quit: WeeChat 3.0) |
11:57:05 | * | wasted_youth2 joined #nim |
12:07:56 | FromGitter | <deech> This comment about finalizers refers to GC which will phased out, does it still safe to use with ARC/ORC? https://github.com/nim-lang/Nim/blob/devel/lib/system.nim#L278-L289 |
12:08:55 | FromDiscord | <Yardanico> yes, but it's better in the long term to convert your finalizers into `=destroy` procedures |
12:09:02 | FromDiscord | <Yardanico> finalizers with ARC/ORC are converted to destroy hooks anyway |
12:09:23 | FromDiscord | <Yardanico> also ORC is a GC :P |
12:10:02 | FromDiscord | <Yardanico> and yes, destroy hooks work on refc as well |
12:13:59 | FromGitter | <deech> Thanks! |
12:19:25 | FromDiscord | <konsumlamm> does it make sense to link to fusion in the standard library? |
12:20:47 | FromDiscord | <Yardanico> fusion was removed from the default nim distribution anyway |
12:21:09 | FromDiscord | <Yardanico> but it's already linked in the docs |
12:24:34 | FromDiscord | <konsumlamm> i mean in the documentation for a module |
12:25:32 | FromDiscord | <Rika> In reply to @Yardanico "fusion was removed from": wait what? |
12:29:41 | FromDiscord | <Yardanico> It won't be distributed with Nim by default |
12:30:28 | FromDiscord | <Yardanico> @Rika https://github.com/nim-lang/Nim/pull/16925 |
12:30:39 | FromDiscord | <Yardanico> @konsumlamm for what module? |
12:31:01 | FromDiscord | <Yardanico> I mean it might be useful, but depends on the context |
12:31:27 | FromDiscord | <konsumlamm> for `options`, i think it would be a good idea to mention that `fusion/matching` supports pattern matching on options |
12:31:40 | FromDiscord | <Rika> i thought the point of fusion was to be bundled |
12:33:39 | FromDiscord | <dom96> In reply to @Rika "what are the challenges": There likely aren’t many. Just needs to be implemented. Why the interest in it? Do you have a particular use case? |
12:34:05 | FromDiscord | <Rika> no, i thought it would be cool |
12:34:46 | FromDiscord | <Rika> though there are many projects where i say "maybe ill try", this sounds like one i would actually try since i use async a lot and would like to contribute to it in some way |
12:35:00 | FromDiscord | <Rika> cant wrap my head around continuations too well yet |
12:35:07 | FromDiscord | <Rika> though i know how they work in a high level |
12:37:53 | FromDiscord | <dom96> IIRC io_uring is more akin to IOCP than the readiness-based epoll/select so I'd guess you'd need to copy the Windows implementation of asyncdispatch effectively |
12:38:12 | FromDiscord | <konsumlamm> In reply to @Yardanico "<@259277943275126785> https://github.com/nim-lang/N": one still should be able to use fusion in lib, right? |
12:59:27 | FromDiscord | <haxscramper> Yeah, like any separate package |
12:59:43 | FromDiscord | <haxscramper> Which means you now need to know package manager to get pattern matching |
13:00:19 | FromDiscord | <haxscramper> Don't know why I contributed to fusion, should've pushed for new standalone package from the start or something |
13:00:50 | FromDiscord | <haxscramper> Or pushed for pattern matching inclusion to stdlib |
13:06:34 | FromDiscord | <haxscramper> In reply to @haxscramper "Which means you now": Which is exactly what I wanted to avoid with pattern matching |
13:09:35 | FromDiscord | <haxscramper> And why did we have https://github.com/nim-lang/RFCs/issues/310 anyway |
13:12:13 | FromDiscord | <haxscramper> So now fusion is like c++ boost - random library that is just somehow meant to be more carefully evolved to fill lacking parts in stdlib |
13:12:55 | FromDiscord | <dom96> pattern matching _should_ make it into stdlib |
13:14:09 | FromDiscord | <haxscramper> So some packages would be moved to automatically, or do I need to push for that? |
13:15:00 | FromDiscord | <haxscramper> E.g. create pr, wait for it to be discussed (is it needed or not or whatever) and so on? |
13:16:55 | FromDiscord | <dom96> oh, you'll need to push for that |
13:17:00 | FromDiscord | <dom96> No idea what's going on with fusion |
13:17:36 | * | lritter joined #nim |
13:20:00 | FromDiscord | <haxscramper> In reply to @dom96 "oh, you'll need to": Do you think I would be able to do this before next release, or everyone are too busy with it?↵↵Just so I would know if I'd better wait on this one or it makes sense to try and do it quickly. |
13:24:01 | * | waleee-cl joined #nim |
13:27:51 | * | kenran quit (Quit: leaving) |
13:28:18 | * | haxscramper joined #nim |
13:29:49 | FromDiscord | <Vindaar> Just a quick side note: personally I haven't properly looked at pattern matching only because it's not part of the stdlib. One more dependency is not a problem, but it's simply a bump to get over |
13:31:33 | FromDiscord | <haxscramper> In reply to @Vindaar "Just a quick side": https://github.com/nim-lang/RFCs/issues/194#issuecomment-700994731 - first three paragraphs addresses this question |
13:31:44 | FromDiscord | <haxscramper> Specificallty↵> Increasing number of programming languages implement pattern matching support, and there is a big difference between something being implemented as third-party module and being shipped with stdlib. Latter one is considered part of the language while former is just "well, yeah, now I need to install package manager, find out how to make it work, install the package itself etc." |
13:32:03 | FromDiscord | <haxscramper> (edit) "big" => "big" |
13:32:45 | FromDiscord | <gollark> There's a pattern matching library? Very cool, I might use this. |
13:33:15 | FromDiscord | <haxscramper> In reply to @gollark "There's a pattern matching": https://nim-lang.github.io/fusion/src/fusion/matching.html |
13:34:52 | FromDiscord | <konsumlamm> so, to come back to my original question: does it make sense to link fusion/matching from the options module? |
13:35:40 | FromDiscord | <haxscramper> If you want to mention `Some(@capture)` patterns this would make sense |
13:36:12 | FromDiscord | <haxscramper> `Some(@capture)` and other patterns that use `Option[T]` |
13:38:58 | FromDiscord | <konsumlamm> ye |
13:39:42 | FromDiscord | <konsumlamm> though i noticed that `None()` doesn't work in the current version, so perhaps i should wait for your PR |
13:42:28 | FromDiscord | <haxscramper> Big brain time - `Some(Some(None())) := some some none int` |
13:55:12 | * | sz0 joined #nim |
14:19:17 | FromDiscord | <haxscramper> Cursed `hello world` on nim macros - https://play.nim-lang.org/#ix=2Ppi |
14:20:31 | FromDiscord | <dom96> In reply to @haxscramper "Do you think I": also no idea 🙂 I think you will be asked to write an RFC, unless you are adding a pattern matching package that has been used in the wild for a while |
14:20:45 | FromDiscord | <Solitude> In reply to @haxscramper "Cursed `hello world` ": blessed |
14:24:23 | FromDiscord | <Yardanico> @haxscramper similar to the v thing |
14:24:34 | FromDiscord | <konsumlamm> also keep in mind that Ar4q still wants to make a RFC for using `let`/`var` in patterns, idk if that should happen before or after putting it in std |
14:24:42 | FromDiscord | <Yardanico> https://github.com/belamenso/v |
14:25:03 | FromDiscord | <konsumlamm> 🤔 |
14:25:11 | FromDiscord | <Yardanico> i have a fork of this with emojis |
14:26:07 | FromDiscord | <haxscramper> In reply to @konsumlamm "also keep in mind": most likely after, since this is not a priority, requires changing language syntax etc. |
14:26:26 | FromDiscord | <haxscramper> And we have RFC anyway - https://github.com/nim-lang/RFCs/issues/245 |
14:29:06 | FromDiscord | <konsumlamm> oh, that can't be implemented with current macros? |
14:29:44 | FromDiscord | <haxscramper> !eval [all let a < 10] |
14:29:45 | NimBot | Compile failed: /usercode/in.nim(1, 9) Error: expected: ']', but got: 'keyword let' |
14:30:06 | FromDiscord | <haxscramper> !eval [all @a < 10] |
14:30:08 | NimBot | Compile failed: /usercode/in.nim(1, 2) Error: undeclared identifier: 'all' |
14:30:44 | FromDiscord | <haxscramper> I suppose first one is what we want in the end, but right now it is a syntactic error |
14:31:02 | FromDiscord | <haxscramper> Second one is just semantic error, but that is expected as I haven't imported anything etc. |
14:32:28 | FromDiscord | <haxscramper> In reply to @haxscramper "!eval [all let a": Though the syntax is probably debatable, and it would introduce new level of complexity for the things that can already be done with `@capture` syntax (which is not that bad anyway) |
14:32:36 | FromDiscord | <haxscramper> So I personally don't care either way |
14:42:26 | * | NimBot joined #nim |
14:43:16 | FromDiscord | <flywind> Could someone review my PR? https://github.com/nim-lang/Nim/pull/16725 |
15:17:46 | * | Vladar quit (Remote host closed the connection) |
15:23:53 | * | Vladar joined #nim |
15:29:15 | FromDiscord | <konsumlamm> In reply to @flywind "Could someone review my": did some suggestions |
15:44:44 | * | kenran joined #nim |
15:44:49 | * | sagax joined #nim |
15:49:37 | * | atrociousdisaste joined #nim |
15:54:22 | * | atrociousdisaste quit (Quit: Leaving) |
16:17:18 | ForumUpdaterBot | New post on r/nim by majidarif: Nim for realtime servers?, see https://reddit.com/r/nim/comments/ljraxi/nim_for_realtime_servers/ |
16:24:56 | * | warkruid quit (Ping timeout: 240 seconds) |
16:32:30 | * | voidpi joined #nim |
16:57:50 | FromDiscord | <gollark> I'm having an issue with the thread-local-heaps thing. I want to use https://github.com/dom96/prometheus in my application, but it uses global variables somewhere, probably unavoidably since separate metrics in each thread would not make very much sense. My application uses prologue and has multiple threads. |
16:58:49 | FromDiscord | <dom96> oh cool, you're looking to use my library |
16:58:57 | FromDiscord | <gollark> Yes, hi. |
16:58:59 | FromDiscord | <dom96> Yeah, I specifically left threading till later |
16:59:01 | FromDiscord | <dom96> https://github.com/dom96/prometheus/blob/master/src/prometheus/registry.nim#L19 |
16:59:48 | FromDiscord | <dom96> Status also has a metrics lib that supports prometheus AFAIK https://github.com/status-im/nim-metrics |
17:00:11 | FromDiscord | <dom96> on the other hand, a PR to implement threading support in my lib would be warmly welcomed 🙂 |
17:00:43 | FromDiscord | <gollark> That looks like it runs its own HTTP server, which is probably not what I want. I can see about making a PR, although I'll have to spend a while looking up the shared memory stuff. |
17:00:56 | FromDiscord | <dom96> Happy to give you hints |
17:02:04 | FromDiscord | <dom96> In theory all that's needed is to use `allocShared` + make `globalRegistry` private |
17:02:21 | FromDiscord | <dom96> add a getGlobalRegistry proc and s/globalRegistry/getGlobalRegistry/ 🙂 |
17:03:03 | FromDiscord | <dom96> in practice you'll likely need to change `CollectorRegistry` to be a non-ref |
17:03:21 | FromDiscord | <dom96> then use `ptr CollectorRegistry` everywhere |
17:03:44 | FromDiscord | <dom96> (you can do this easily by changing `CollectorRegistry` to be = to `ptr CollectorRegistryObj` and then CollectorRegistryObj is the `object `definition) |
17:04:04 | FromDiscord | <dom96> hm, but then the `seq` is a problem |
17:04:44 | FromDiscord | <dom96> I guess this could be useful https://nim-lang.org/docs/sharedlist.html |
17:04:57 | FromDiscord | <Rika> christ, i just checked asyncdispatch and the api is tangled as hell |
17:05:14 | FromDiscord | <Rika> trying to add io_uring is gonna hurt is it |
17:05:15 | FromDiscord | <dom96> as an alternative, you might be able to get away with using --gc:orc |
17:05:23 | FromDiscord | <dom96> you can safely disable thread analysis for that |
17:05:52 | FromDiscord | <gollark> Isn't that kind of experimental still? |
17:06:40 | FromDiscord | <dom96> sorta yeah |
17:07:19 | FromDiscord | <dom96> @Rika happy to help with this too 🙂 |
17:08:07 | FromDiscord | <Rika> firstly i have to learn how this works at a low level stance |
17:08:23 | FromDiscord | <Rika> because as many people know im not too intelligent xd |
17:36:03 | * | vicfred joined #nim |
17:52:19 | * | kenran quit (Quit: leaving) |
17:53:13 | * | a_chou joined #nim |
17:54:53 | ForumUpdaterBot | New thread by Benob: AsyncSocket timeout, see https://forum.nim-lang.org/t/7504 |
17:57:42 | * | ryanhowe quit (Quit: ZNC 1.8.2 - https://znc.in) |
18:00:32 | * | sacredfrog joined #nim |
18:44:24 | * | a_chou quit (Remote host closed the connection) |
18:49:43 | * | abm joined #nim |
19:00:41 | Oddmonger | is it possible to deserialize into a seq, with marshal module ? |
19:01:11 | Oddmonger | i have a seq in a string, but cannont imagine how to deserialize it |
19:01:57 | Oddmonger | to[seq[MyObj])( myString) is refused at compilation |
19:03:10 | leorize[m] | why do you have a seq in a string? |
19:03:12 | Oddmonger | var a:seq[MyObj] = to[seq[MyObj]]( myString) # 'a' cannot be assigned to |
19:04:05 | Oddmonger | leorize[m]: i have saved json elements of an array, and got another array |
19:05:02 | leorize[m] | is it valid json? if yes then just use the json module |
19:05:10 | Oddmonger | the string is like this: [ { MyObj }, { MyObj }, etc … ] |
19:05:21 | leorize[m] | parseJson takes a string, then to() can be used |
19:06:05 | Oddmonger | but here, i have already converted the json to a marshalled nim |
19:06:22 | Oddmonger | so i don't have json anymore at this step |
19:06:29 | leorize[m] | i would advise not using marshal tbh |
19:06:54 | leorize[m] | but do you have a failing example? |
19:07:46 | Oddmonger | i'm going to write a simple failing sample, and i'll post it here then |
19:08:09 | Oddmonger | may be i will find what's wrong when writing it :) |
19:08:24 | Oddmonger | (it often happens) |
19:08:40 | leorize[m] | :p it happens to all of us |
19:08:53 | Oddmonger | but now … bon appétit :)’ |
19:10:11 | * | PMunch joined #nim |
19:20:37 | FromGitter | <deech> What am I doing wrong here? `let ns : seq[cdouble] = @[0.1,0.2]` errors with `Error: type mismatch: got 'seq[cdouble]' for 'ns' but expected 'cdouble = float'` |
19:22:45 | FromDiscord | <haxscramper> !eval let ns : seq[float] = @[0.1,0.2] |
19:22:48 | NimBot | <no output> |
19:23:02 | FromGitter | <deech> Never mind. SOrry. |
19:33:53 | FromDiscord | <dk> Is there any benefit to calling .items explicitly? |
19:35:20 | FromDiscord | <haxscramper> I had some troubles with `mixin` and implicit `items()`, so in generics it might make sense |
19:35:47 | FromDiscord | <haxscramper> Although it was some extremely convoluted generic sandwich, in general everything works alright |
19:37:35 | FromDiscord | <Yardanico> @deech you can do it the cdouble way like this if you want: |
19:37:44 | FromDiscord | <Yardanico> !eval let ns = @[cdouble(0.1), 0.2] |
19:37:47 | NimBot | <no output> |
19:44:21 | * | shirty joined #nim |
19:47:31 | FromDiscord | <~355/113 Man> ok, I've got a really weird thing going on right now |
19:48:15 | FromDiscord | <~355/113 Man> i'm trying to build a project in C++ using SDL2, but some how looks like it's trying to use the sdl.dll from my Nim project which is completely 100% unrelated? |
19:48:44 | FromDiscord | <~355/113 Man> sent a code paste, see https://play.nim-lang.org/#ix=2Prd |
19:48:54 | FromDiscord | <~355/113 Man> this is from the VS output log |
19:50:18 | FromDiscord | <pointystick> Windows will search in the PATH environment var to find things like that. You'll have Nim in your path and it has the DLL there |
19:51:01 | FromDiscord | <pointystick> you can try putting a copy in the same place as your C++ project is or move Nim's entry in the path to later (assuming there's some path entry that has the DLL you want that's not the Nim version) |
19:51:25 | FromDiscord | <~355/113 Man> the dll already is in the project folder |
19:52:26 | FromDiscord | <pointystick> is the exe that's generated put in a different folder (like a 'bin') that's separate from the actual cpp files? |
19:52:43 | FromDiscord | <pointystick> I assume it'll be relative to the actual exe's current working dir when it's run |
19:53:38 | FromDiscord | <~355/113 Man> yea, that worked |
19:55:33 | FromDiscord | <~355/113 Man> though I still can't get a release build to work, but that's a completely unrelated issue, it's saying it can't open the .lib for some reason, but it works fine in debug build with a debug .lib |
19:55:58 | FromDiscord | <~355/113 Man> oh wait I found the issue lol |
19:56:51 | FromDiscord | <~355/113 Man> man, I really need to follow my own advice lol |
20:03:04 | * | superbia joined #nim |
20:06:42 | * | haxscramper quit (Remote host closed the connection) |
20:07:06 | * | haxscramper joined #nim |
20:09:44 | * | haxscramper quit (Remote host closed the connection) |
20:14:58 | * | Sembei joined #nim |
20:28:34 | * | superbia quit (Quit: WeeChat 3.0) |
21:11:15 | ForumUpdaterBot | New thread by Exelotl: Forwarding modules via `export`, and how to structure my library?, see https://forum.nim-lang.org/t/7505 |
21:15:15 | ForumUpdaterBot | New thread by Mantielero: Temporal folder, see https://forum.nim-lang.org/t/7506 |
22:09:55 | * | lritter quit (Ping timeout: 256 seconds) |
22:18:07 | * | PMunch quit (Quit: leaving) |
22:50:59 | * | shirtyx joined #nim |
22:52:45 | * | shirty quit (Ping timeout: 240 seconds) |
22:55:21 | * | teasea quit (Quit: teasea) |
22:56:25 | * | avanderneut quit (Ping timeout: 240 seconds) |
22:57:18 | * | teasea joined #nim |
23:10:29 | * | shirtyx quit (Quit: Going offline, see ya! (www.adiirc.com)) |
23:27:06 | * | BobD joined #nim |
23:28:48 | * | Vladar quit (Quit: Leaving) |
23:32:53 | * | BobD quit (Quit: Connection closed) |
23:39:57 | * | avanderneut joined #nim |