<< 14-02-2021 >>

00:02:52FromDiscord<~355/113 Man> sent a code paste, see https://play.nim-lang.org/#ix=2Plh
00:03:12FromDiscord<~355/113 Man> do I need a `new` keyword somewhere?
00:05:06FromDiscord<exelotl> In reply to @arne "and yes, I am": oh god please no, this would ruin all my gba code
00:05:31FromDiscord<exelotl> int should be the machine's native word size
00:10:30FromDiscord<exelotl> @~355/113 Man the pointer becomes invalid as soon as the function returns because glArray is on the stack
00:10:43FromDiscord<~355/113 Man> yea, that's what I figured
00:11:05FromDiscord<exelotl> are the matrix elements compatible with GLfloat? Or are they float64 while GLfloat is 32 bit?
00:11:13FromDiscord<~355/113 Man> they are float32
00:12:08FromDiscord<exelotl> ah, you could probably literally just return `cast[ptr GLfloat](addr mat[0,0])`
00:12:15FromDiscord<~355/113 Man> nope
00:12:26FromDiscord<~355/113 Man> the matrix is row major while opengl expects column major
00:12:38FromDiscord<~355/113 Man> (I hope I didn't get those terms backwards)
00:13:20FromDiscord<exelotl> ah I see, in that case I guess your best bet is to return an `array[16, GLfloat]`
00:13:31FromDiscord<exelotl> and then take the address of the first element separately
00:13:56FromDiscord<exelotl> that's the only way that you can ensure the array lives long enough
00:14:09FromDiscord<~355/113 Man> what about heap allocation?
00:14:15FromDiscord<~355/113 Man> (edit) "allocation?" => "allocation with GC?"
00:14:48FromDiscord<exelotl> yeah you could return a ref array if those are the semantics you're after
00:15:17FromDiscord<~355/113 Man> i'm not sure how to use heap in a safe way though
00:15:22FromDiscord<~355/113 Man> (in Nim)
00:19:37FromDiscord<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:28FromDiscord<~355/113 Man> yep, i'm reading that right now
00:21:39FromDiscord<~355/113 Man> btw what's the difference between `ref` and `ptr`
00:22:23FromDiscord<exelotl> ptr is a non-traced pointer like in C. it's not managed by the GC/ARC
00:23:33FromDiscord<exelotl> Nim's 3 unsafe features are ptr, addr, cast
00:25:33FromDiscord<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:21FromDiscord<ElegantBeef> On devel there is even `not nil` which makes it even harder to deref a nil
00:26:37FromDiscord<exelotl> ah yeah `not nil` is exciting
00:26:52*Vladar quit (Quit: Leaving)
00:27:04FromDiscord<ElegantBeef> https://nim-lang.github.io/Nim/manual_experimental.html#strict-not-nil-checking if interested
00:27:27FromDiscord<~355/113 Man> so if I get a ref by using new, and return a ptr, what happens?
00:27:34FromDiscord<~355/113 Man> (edit) "so if I get a ref by using new, and return ... a" added "it as"
00:27:49FromDiscord<ElegantBeef> You have an unmanaged pointer
00:28:11FromDiscord<exelotl> yeahh, if nothing is referring to the ref anymore, it gets deallocated and now you have a bogus pointer
00:28:40FromDiscord<ElegantBeef> Reference objects are managed, so depending on your GC they are scoped locked or until the next gc tick
00:28:58FromDiscord<ElegantBeef> But very quickly they'll be out of scope and you'll have a dangler
00:30:00FromDiscord<exelotl> sent a code paste, see https://play.nim-lang.org/#ix=2Pll
00:30:25FromDiscord<ElegantBeef> Ref is just a pointer that is managed by the memory collection
00:31:04FromDiscord<ElegantBeef> If you're writing pure Nim it'll almost always be what you prefer, that and `lent` variables
00:33:46FromDiscord<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:11FromDiscord<~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:50FromDiscord<Clyybber> saem: Ideally nkIfExpr/Stmt would be a single node too, it's simpler and makes more sense
01:16:08FromDiscord<Clyybber> The only issue is making that change backwards compatible
01:20:40saem@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:25saemThanks for explaining the background.
01:26:08FromDiscord<~355/113 Man> actually wait, could I make this a template?
01:26:15saemMight have chased down the last stability fix. 🤞
01:26:52saemWhich means I can go back to poking at nkError and thinking about attributed grammars.
02:09:20*PMunch quit (Quit: Leaving)
02:32:33saemwelp, so much for that.
02:47:52FromDiscord<exelotl> @~355/113 Man yes you almost certainly shouldn't be doing that 😅
02:48:22FromDiscord<~355/113 Man> what about template?
02:51:48FromDiscord<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:42FromDiscord<~355/113 Man> the pointer can be discarded right after the function call
02:53:00FromDiscord<~355/113 Man> (edit) "discarded" => "freed"
02:54:43FromDiscord<exelotl> sent a code paste, see https://play.nim-lang.org/#ix=2PlM
02:54:50FromDiscord<exelotl> wait derp
02:55:26FromDiscord<exelotl> sent a code paste, see https://play.nim-lang.org/#ix=2PlN
02:55:27FromDiscord<~355/113 Man> btw I changed it to return a reference and I cast that reference to a pointer
02:55:50FromDiscord<~355/113 Man> oh, that's nice looking
02:56:02FromDiscord<~355/113 Man> wait, but that won't work I think
02:56:25FromDiscord<~355/113 Man> wait nvm didn't see you were storing the array as a variable]
02:56:29FromDiscord<~355/113 Man> (edit) "variable]" => "variable"
03:03:59FromDiscord<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:21FromDiscord<~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:58FromDiscord<~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:33FromDiscord<~355/113 Man> sent a code paste, see https://paste.rs/ENx
03:23:41FromDiscord<~355/113 Man> `Error: undeclared identifier: 'example'`
03:38:07FromDiscord<ElegantBeef> You need a description
03:40:53FromDiscord<~355/113 Man> description?
03:41:49FromDiscord<ElegantBeef> https://nim-lang.org/docs/nimscript.html#task.t%2Cuntyped%2Cstring%2Cuntyped
03:51:42FromDiscord<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:10FromDiscord<ElegantBeef> What are you doing with these?
03:53:15FromDiscord<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:19FromDiscord<GamzWithJamz> Now I could hardcode this
03:53:40FromDiscord<GamzWithJamz> but I also want to allow custom types to show up.
03:54:04FromDiscord<ElegantBeef> You could have a macro which declares your type and subscribes it to a list of components
03:54:31FromDiscord<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:04FromDiscord<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:06FromDiscord<GamzWithJamz> Actually
03:55:15FromDiscord<GamzWithJamz> I think I have a way this may work after speaking about it
03:55:22FromDiscord<GamzWithJamz> and without depending upon reflection
03:55:33FromDiscord<GamzWithJamz> Thanks ElegantBeef
03:55:56FromDiscord<GamzWithJamz> Thanks @ElegantBeef for being a rubber ducky. :pepeLaugh:
03:55:57FromDiscord<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:07FromDiscord<ElegantBeef> But cheers regardless
03:57:22FromDiscord<ElegantBeef> @~355/113 Man did you get it working?
03:57:33FromDiscord<~355/113 Man> no, can't figure out how to execute "run" now
03:57:48FromDiscord<ElegantBeef> `nimble run` though idk if you can alias run
03:57:50FromDiscord<~355/113 Man> I thought it was `selfExec` but I think that's wrong
03:58:09FromDiscord<~355/113 Man> do I just type in `nimble run` in the `example` task?
03:58:15FromDiscord<ElegantBeef> Oh `runTask`?
03:58:29FromDiscord<ElegantBeef> might be able to just do `runTask()` inside that body
03:58:46FromDiscord<~355/113 Man> runTask doesn't show up in the nimscript docs
03:58:49FromDiscord<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:18FromDiscord<ElegantBeef> I am probably wrong, but idk worth a shot 😄
03:59:23FromDiscord<~355/113 Man> `Error: undeclared identifier: 'runTask'`
03:59:32FromDiscord<ElegantBeef> Yea that's what i expected
04:00:13FromDiscord<ElegantBeef> Self exec should work
04:00:46FromDiscord<~355/113 Man> selfExec("run") didn't work, should it be "nimble run"?
04:00:59FromDiscord<ElegantBeef> the docs of self exec say no
04:01:21FromDiscord<~355/113 Man> `Error: 'run' command not available; rebuild with -d:tinyc`
04:01:31FromDiscord<ElegantBeef> Check the value of `selfExe()` if it's nimble it should work
04:01:48FromDiscord<ElegantBeef> Ah when i do `nim run` that's what i gue
04:01:50FromDiscord<ElegantBeef> (edit) "gue" => "get"
04:01:54FromDiscord<ElegantBeef> So yea it's not in nimble anymore
04:02:39FromDiscord<ElegantBeef> you can do `exec "nimble run"`
04:02:50FromDiscord<ElegantBeef> Though dont think that will use that binary
04:05:08FromDiscord<ElegantBeef> Seems the best thing to do is just manually build then exec the binary you want to
04:06:01FromDiscord<~355/113 Man> can I pass arguments into `nimble run` like `nimble run example`?
04:06:22FromDiscord<~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:40FromDiscord<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:32FromDiscord<~355/113 Man> ummmmmm, what?↵`Error: 'return' not allowed here`
05:31:37FromDiscord<~355/113 Man> ` glUniformMatrix4fv(transformID, GLsizei 1, false, cast[ptr GLfloat](transform.toGLfloatRef))↵`
05:35:27FromDiscord<ElegantBeef> did you change `toGlFloatRef` to a template?
05:35:41FromDiscord<~355/113 Man> ...... I think so
05:35:46FromDiscord<ElegantBeef> Do you return inside it?
05:35:52FromDiscord<~355/113 Man> yes
05:35:53FromDiscord<ElegantBeef> If so there is your problem
05:36:00FromDiscord<ElegantBeef> dont return just `yourValue`
05:36:39FromDiscord<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:06FromDiscord<~355/113 Man> I went with the array implementation that was suggested
05:42:54FromDiscord<~355/113 Man> does Nim have namespaces?
05:45:08FromDiscord<ElegantBeef> Nope
05:48:19FromDiscord<mattrb> sent a code paste, see https://play.nim-lang.org/#ix=2Pmw
05:54:24FromDiscord<ElegantBeef> It detected the first error first
05:54:52FromDiscord<ElegantBeef> Quit doesnt have a return type and you're using that case statement to assign a value
05:55:54FromDiscord<ElegantBeef> !eval let a = quit()
05:55:55NimBotCompile failed: /usercode/in.nim(1, 13) Error: expression 'quit(0)' has no type (or is ambiguous)
05:57:02FromDiscord<mattrb> sent a code paste, see https://play.nim-lang.org/#ix=2PmB
05:57:55FromDiscord<ElegantBeef> Hmm, it's valid for if statements aswell
05:59:30FromDiscord<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:38FromDiscord<~355/113 Man> does Nim have a multimap?
06:00:54FromDiscord<~355/113 Man> aka a map that allows duplicate keys
06:01:08FromDiscord<ElegantBeef> Nim's default table did(does?)
06:01:25FromDiscord<ElegantBeef> https://nim-lang.org/docs/tables.html#add%2CTable%5BA%2CB%5D%2CA%2CsinkB
06:02:32FromDiscord<~355/113 Man> and when trying to access a key with multiple values do you get a list of values?
06:02:39FromDiscord<ElegantBeef> Nope 😄
06:03:15FromDiscord<ElegantBeef> Why not just have a `seq[T]` as the value?
06:03:52FromDiscord<~355/113 Man> because i'm going to be inserting as key value pairs, not key seq[value] pairs
06:04:13FromDiscord<~355/113 Man> however I suppose I could make a wrapper for thsi
06:04:14FromDiscord<~355/113 Man> (edit) "thsi" => "this"
06:23:29FromDiscord<~355/113 Man> what's the type for procs?
06:24:50FromDiscord<Rika> wdym
06:25:10FromDiscord<Rika> a proc type is denoted by `proc(params: type): returntype`
06:26:41FromDiscord<~355/113 Man> thank you
06:34:38FromDiscord<~355/113 Man> sent a code paste, see https://play.nim-lang.org/#ix=2PmF
06:41:48FromDiscord<Rika> looks fine, anything of note to look at?
06:43:14*letto quit (Quit: Konversation terminated!)
06:44:39FromDiscord<~355/113 Man> how do I add to a sequence :thonk:
06:45:06FromDiscord<~355/113 Man> sent a code paste, see https://play.nim-lang.org/#ix=2PmH
06:45:13*letto joined #nim
06:45:32FromDiscord<~355/113 Man> (edit) "https://play.nim-lang.org/#ix=2PmH" => "https://play.nim-lang.org/#ix=2PmI"
06:47:52FromDiscord<Rika> the map isnt var
06:48:06FromDiscord<Rika> addEvent(map: var EventMap...
06:49:31FromDiscord<~355/113 Man> I think I need `import system` too
06:52:24FromDiscord<~355/113 Man> now it's complaining about `[]` not being defined
06:56:03FromDiscord<Rika> you dont need import system
07:07:41FromDiscord<~355/113 Man> `Error: attempting to call undeclared routine: 'addEvent'`
07:08:09FromDiscord<~355/113 Man> sent a code paste, see https://play.nim-lang.org/#ix=2PmM
07:08:32FromDiscord<~355/113 Man> sent a code paste, see https://play.nim-lang.org/#ix=2PmN
07:08:59FromDiscord<~355/113 Man> sent a code paste, see https://play.nim-lang.org/#ix=2PmO
07:09:06FromDiscord<Rika> show the imports
07:09:12FromDiscord<~355/113 Man> NimblePiE_Example does not import EventMultiMap, but NimblePiE does
07:09:24FromDiscord<Rika> export EventMultiMap
07:09:29FromDiscord<Rika> in NimblePiE
07:10:17*vegai left #nim (#nim)
07:10:56FromDiscord<Rika> you dont need that
07:10:57FromDiscord<~355/113 Man> sent a code paste, see https://play.nim-lang.org/#ix=2PmP
07:11:42FromDiscord<Rika> sent a code paste, see https://paste.rs/P0R
07:11:59FromDiscord<~355/113 Man> sent a code paste, see https://play.nim-lang.org/#ix=2PmQ
07:12:11FromDiscord<Rika> export EventMap as well
07:12:19FromDiscord<Rika> i think
07:12:34FromDiscord<Rika> hard to tell because of lack of info
07:12:49FromDiscord<~355/113 Man> this is called from where EventMultiMap is imported
07:13:05FromDiscord<~355/113 Man> sent a code paste, see https://play.nim-lang.org/#ix=2PmR
07:13:26FromDiscord<~355/113 Man> (edit) "https://play.nim-lang.org/#ix=2PmR" => "https://play.nim-lang.org/#ix=2PmS"
07:13:43FromDiscord<~355/113 Man> (edit) "https://play.nim-lang.org/#ix=2PmS" => "https://play.nim-lang.org/#ix=2PmT"
07:14:14FromDiscord<~355/113 Man> oh, I think I need to export tables
07:14:30FromDiscord<Rika> ah yes
07:22:14FromDiscord<mattrb> sent a code paste, see https://play.nim-lang.org/#ix=2PmW
07:27:07FromDiscord<Rika> cpu.nim would need to import arm.nim, but in your case that would be infeasible
07:28:33FromDiscord<Rika> reorganize the code to combine cpu and arm? i dont know
07:29:31FromDiscord<mattrb> I was afraid that'd be the solution
07:29:45FromDiscord<mattrb> These are going to be two pretty large files, and it'd be nice to keep them separate :/
07:31:37FromDiscord<Rika> i forgot what solutions i did to fix this
07:31:42FromDiscord<Rika> because i am sure i did before
07:32:32FromDiscord<mattrb> Please let me know if you remember. I'd love to know an alternate solution
07:33:22FromDiscord<Rika> im not sure if concepts would help
07:33:31FromDiscord<Rika> okay
07:33:32FromDiscord<Rika> wait
07:33:32FromDiscord<Rika> no
07:33:47FromDiscord<Rika> you have to move branch out into a file which imports both arm and cpu?
07:33:49FromDiscord<Rika> maybe?
07:38:46FromDiscord<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:17FromDiscord<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:37FromDiscord<ElegantBeef> So what is the current module import paths, cpu imports arm?
07:44:06FromDiscord<mattrb> Yeah cpu imports arm so that it can use the `execArm` proc
07:44:54FromDiscord<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:57FromDiscord<Rika> you can do this with one file
07:45:59FromDiscord<Rika> i mean
07:46:06FromDiscord<Rika> without adding a files
07:46:08FromDiscord<Rika> (edit) "files" => "file"
07:46:16FromDiscord<mattrb> I just don't want a huge file :p
07:46:17FromDiscord<Rika> but you need to move the imports
07:46:25FromDiscord<Rika> aka the imports wont all be at the top
07:46:26FromDiscord<ElegantBeef> Well a wisely position `include` 😄
07:46:31FromDiscord<ElegantBeef> Or import yea
07:46:53FromDiscord<Rika> and rearrange the code in cpu
07:47:16FromDiscord<mattrb> I don't quite follow. What's the pattern here?
07:47:32FromDiscord<ElegantBeef> Well you can have recursive imports as long as they're don properly
07:47:32FromDiscord<Rika> move setReg and checkCond as much as possible to the top, then put the `import arm` below the procs
07:47:34FromDiscord<ElegantBeef> (edit) "don" => "done"
07:47:46FromDiscord<Rika> then arm can import cpu
07:48:02FromDiscord<mattrb> Oh
07:48:16FromDiscord<mattrb> Okay yeah I can make that work then. Is that common in nim?
07:48:57FromDiscord<ElegantBeef> I've seen it before
07:49:03FromDiscord<mattrb> Hm it still doesn't like that
07:49:13FromDiscord<Rika> whats the issue now
07:49:24FromDiscord<Rika> ah, wait
07:49:28FromDiscord<Rika> i think i made a mistake
07:49:36FromDiscord<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:49FromDiscord<ElegantBeef> You still need to `import cpu` in the arm file
07:50:00FromDiscord<Rika> sent a code paste, see https://play.nim-lang.org/#ix=2Pn1
07:50:05FromDiscord<Rika> yeah you have to import cpu in arm
07:50:32FromDiscord<mattrb> Ah gotcha, makes sense then. Seems to be working at least with the current setup
07:50:55FromDiscord<mattrb> Okay cool, thank you both. I'll roll with that as a solution for now 🙂
07:50:59FromDiscord<ElegantBeef> Yay
07:51:06FromDiscord<Rika> anything that arm needs goes above its import
07:51:20FromDiscord<Rika> anything in cpu that needs arm goes under its import
07:51:21FromDiscord<ElegantBeef> You can also checkout `include` depending on your end goal
07:52:01FromDiscord<mattrb> Oh interesting
07:52:08FromDiscord<mattrb> Didn't realize that existed
07:52:39FromDiscord<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:53FromDiscord<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:56FromGitter<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:55FromDiscord<Yardanico> yes, but it's better in the long term to convert your finalizers into `=destroy` procedures
12:09:02FromDiscord<Yardanico> finalizers with ARC/ORC are converted to destroy hooks anyway
12:09:23FromDiscord<Yardanico> also ORC is a GC :P
12:10:02FromDiscord<Yardanico> and yes, destroy hooks work on refc as well
12:13:59FromGitter<deech> Thanks!
12:19:25FromDiscord<konsumlamm> does it make sense to link to fusion in the standard library?
12:20:47FromDiscord<Yardanico> fusion was removed from the default nim distribution anyway
12:21:09FromDiscord<Yardanico> but it's already linked in the docs
12:24:34FromDiscord<konsumlamm> i mean in the documentation for a module
12:25:32FromDiscord<Rika> In reply to @Yardanico "fusion was removed from": wait what?
12:29:41FromDiscord<Yardanico> It won't be distributed with Nim by default
12:30:28FromDiscord<Yardanico> @Rika https://github.com/nim-lang/Nim/pull/16925
12:30:39FromDiscord<Yardanico> @konsumlamm for what module?
12:31:01FromDiscord<Yardanico> I mean it might be useful, but depends on the context
12:31:27FromDiscord<konsumlamm> for `options`, i think it would be a good idea to mention that `fusion/matching` supports pattern matching on options
12:31:40FromDiscord<Rika> i thought the point of fusion was to be bundled
12:33:39FromDiscord<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:05FromDiscord<Rika> no, i thought it would be cool
12:34:46FromDiscord<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:00FromDiscord<Rika> cant wrap my head around continuations too well yet
12:35:07FromDiscord<Rika> though i know how they work in a high level
12:37:53FromDiscord<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:12FromDiscord<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:27FromDiscord<haxscramper> Yeah, like any separate package
12:59:43FromDiscord<haxscramper> Which means you now need to know package manager to get pattern matching
13:00:19FromDiscord<haxscramper> Don't know why I contributed to fusion, should've pushed for new standalone package from the start or something
13:00:50FromDiscord<haxscramper> Or pushed for pattern matching inclusion to stdlib
13:06:34FromDiscord<haxscramper> In reply to @haxscramper "Which means you now": Which is exactly what I wanted to avoid with pattern matching
13:09:35FromDiscord<haxscramper> And why did we have https://github.com/nim-lang/RFCs/issues/310 anyway
13:12:13FromDiscord<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:55FromDiscord<dom96> pattern matching _should_ make it into stdlib
13:14:09FromDiscord<haxscramper> So some packages would be moved to automatically, or do I need to push for that?
13:15:00FromDiscord<haxscramper> E.g. create pr, wait for it to be discussed (is it needed or not or whatever) and so on?
13:16:55FromDiscord<dom96> oh, you'll need to push for that
13:17:00FromDiscord<dom96> No idea what's going on with fusion
13:17:36*lritter joined #nim
13:20:00FromDiscord<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:49FromDiscord<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:33FromDiscord<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:44FromDiscord<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:03FromDiscord<haxscramper> (edit) "big" => "big"
13:32:45FromDiscord<gollark> There's a pattern matching library? Very cool, I might use this.
13:33:15FromDiscord<haxscramper> In reply to @gollark "There's a pattern matching": https://nim-lang.github.io/fusion/src/fusion/matching.html
13:34:52FromDiscord<konsumlamm> so, to come back to my original question: does it make sense to link fusion/matching from the options module?
13:35:40FromDiscord<haxscramper> If you want to mention `Some(@capture)` patterns this would make sense
13:36:12FromDiscord<haxscramper> `Some(@capture)` and other patterns that use `Option[T]`
13:38:58FromDiscord<konsumlamm> ye
13:39:42FromDiscord<konsumlamm> though i noticed that `None()` doesn't work in the current version, so perhaps i should wait for your PR
13:42:28FromDiscord<haxscramper> Big brain time - `Some(Some(None())) := some some none int`
13:55:12*sz0 joined #nim
14:19:17FromDiscord<haxscramper> Cursed `hello world` on nim macros - https://play.nim-lang.org/#ix=2Ppi
14:20:31FromDiscord<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:45FromDiscord<Solitude> In reply to @haxscramper "Cursed `hello world` ": blessed
14:24:23FromDiscord<Yardanico> @haxscramper similar to the v thing
14:24:34FromDiscord<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:42FromDiscord<Yardanico> https://github.com/belamenso/v
14:25:03FromDiscord<konsumlamm> 🤔
14:25:11FromDiscord<Yardanico> i have a fork of this with emojis
14:26:07FromDiscord<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:26FromDiscord<haxscramper> And we have RFC anyway - https://github.com/nim-lang/RFCs/issues/245
14:29:06FromDiscord<konsumlamm> oh, that can't be implemented with current macros?
14:29:44FromDiscord<haxscramper> !eval [all let a < 10]
14:29:45NimBotCompile failed: /usercode/in.nim(1, 9) Error: expected: ']', but got: 'keyword let'
14:30:06FromDiscord<haxscramper> !eval [all @a < 10]
14:30:08NimBotCompile failed: /usercode/in.nim(1, 2) Error: undeclared identifier: 'all'
14:30:44FromDiscord<haxscramper> I suppose first one is what we want in the end, but right now it is a syntactic error
14:31:02FromDiscord<haxscramper> Second one is just semantic error, but that is expected as I haven't imported anything etc.
14:32:28FromDiscord<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:36FromDiscord<haxscramper> So I personally don't care either way
14:42:26*NimBot joined #nim
14:43:16FromDiscord<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:15FromDiscord<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:18ForumUpdaterBotNew 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:50FromDiscord<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:49FromDiscord<dom96> oh cool, you're looking to use my library
16:58:57FromDiscord<gollark> Yes, hi.
16:58:59FromDiscord<dom96> Yeah, I specifically left threading till later
16:59:01FromDiscord<dom96> https://github.com/dom96/prometheus/blob/master/src/prometheus/registry.nim#L19
16:59:48FromDiscord<dom96> Status also has a metrics lib that supports prometheus AFAIK https://github.com/status-im/nim-metrics
17:00:11FromDiscord<dom96> on the other hand, a PR to implement threading support in my lib would be warmly welcomed 🙂
17:00:43FromDiscord<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:56FromDiscord<dom96> Happy to give you hints
17:02:04FromDiscord<dom96> In theory all that's needed is to use `allocShared` + make `globalRegistry` private
17:02:21FromDiscord<dom96> add a getGlobalRegistry proc and s/globalRegistry/getGlobalRegistry/ 🙂
17:03:03FromDiscord<dom96> in practice you'll likely need to change `CollectorRegistry` to be a non-ref
17:03:21FromDiscord<dom96> then use `ptr CollectorRegistry` everywhere
17:03:44FromDiscord<dom96> (you can do this easily by changing `CollectorRegistry` to be = to `ptr CollectorRegistryObj` and then CollectorRegistryObj is the `object `definition)
17:04:04FromDiscord<dom96> hm, but then the `seq` is a problem
17:04:44FromDiscord<dom96> I guess this could be useful https://nim-lang.org/docs/sharedlist.html
17:04:57FromDiscord<Rika> christ, i just checked asyncdispatch and the api is tangled as hell
17:05:14FromDiscord<Rika> trying to add io_uring is gonna hurt is it
17:05:15FromDiscord<dom96> as an alternative, you might be able to get away with using --gc:orc
17:05:23FromDiscord<dom96> you can safely disable thread analysis for that
17:05:52FromDiscord<gollark> Isn't that kind of experimental still?
17:06:40FromDiscord<dom96> sorta yeah
17:07:19FromDiscord<dom96> @Rika happy to help with this too 🙂
17:08:07FromDiscord<Rika> firstly i have to learn how this works at a low level stance
17:08:23FromDiscord<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:53ForumUpdaterBotNew 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:41Oddmongeris it possible to deserialize into a seq, with marshal module ?
19:01:11Oddmongeri have a seq in a string, but cannont imagine how to deserialize it
19:01:57Oddmongerto[seq[MyObj])( myString) is refused at compilation
19:03:10leorize[m]why do you have a seq in a string?
19:03:12Oddmongervar a:seq[MyObj] = to[seq[MyObj]]( myString) # 'a' cannot be assigned to
19:04:05Oddmongerleorize[m]: i have saved json elements of an array, and got another array
19:05:02leorize[m]is it valid json? if yes then just use the json module
19:05:10Oddmongerthe string is like this: [ { MyObj }, { MyObj }, etc … ]
19:05:21leorize[m]parseJson takes a string, then to() can be used
19:06:05Oddmongerbut here, i have already converted the json to a marshalled nim
19:06:22Oddmongerso i don't have json anymore at this step
19:06:29leorize[m]i would advise not using marshal tbh
19:06:54leorize[m]but do you have a failing example?
19:07:46Oddmongeri'm going to write a simple failing sample, and i'll post it here then
19:08:09Oddmongermay be i will find what's wrong when writing it :)
19:08:24Oddmonger(it often happens)
19:08:40leorize[m]:p it happens to all of us
19:08:53Oddmongerbut now … bon appétit :)’
19:10:11*PMunch joined #nim
19:20:37FromGitter<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:45FromDiscord<haxscramper> !eval let ns : seq[float] = @[0.1,0.2]
19:22:48NimBot<no output>
19:23:02FromGitter<deech> Never mind. SOrry.
19:33:53FromDiscord<dk> Is there any benefit to calling .items explicitly?
19:35:20FromDiscord<haxscramper> I had some troubles with `mixin` and implicit `items()`, so in generics it might make sense
19:35:47FromDiscord<haxscramper> Although it was some extremely convoluted generic sandwich, in general everything works alright
19:37:35FromDiscord<Yardanico> @deech you can do it the cdouble way like this if you want:
19:37:44FromDiscord<Yardanico> !eval let ns = @[cdouble(0.1), 0.2]
19:37:47NimBot<no output>
19:44:21*shirty joined #nim
19:47:31FromDiscord<~355/113 Man> ok, I've got a really weird thing going on right now
19:48:15FromDiscord<~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:44FromDiscord<~355/113 Man> sent a code paste, see https://play.nim-lang.org/#ix=2Prd
19:48:54FromDiscord<~355/113 Man> this is from the VS output log
19:50:18FromDiscord<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:01FromDiscord<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:25FromDiscord<~355/113 Man> the dll already is in the project folder
19:52:26FromDiscord<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:43FromDiscord<pointystick> I assume it'll be relative to the actual exe's current working dir when it's run
19:53:38FromDiscord<~355/113 Man> yea, that worked
19:55:33FromDiscord<~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:58FromDiscord<~355/113 Man> oh wait I found the issue lol
19:56:51FromDiscord<~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:15ForumUpdaterBotNew thread by Exelotl: Forwarding modules via `export`, and how to structure my library?, see https://forum.nim-lang.org/t/7505
21:15:15ForumUpdaterBotNew 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