<< 13-07-2020 >>

00:01:37*endragor joined #nim
00:01:59shashlickYa
00:05:52*endragor quit (Ping timeout: 246 seconds)
00:09:50*hyiltiz_ quit (Quit: No Ping reply in 180 seconds.)
00:10:56*hyiltiz joined #nim
00:14:27FromDiscord<slymilano> sent a long message, see http://ix.io/2rvg
00:19:22FromDiscord<Rika> uh, how many CPU cores does your CPU have
00:19:34FromDiscord<Yardanico> lemme guess - 4
00:19:38FromDiscord<Rika> yeah
00:19:46FromDiscord<Rika> if it's 4 then theres the culprit
00:19:54FromDiscord<slymilano> it's this one: https://support.apple.com/kb/sp714?locale=en_US
00:19:57FromDiscord<Rika> nim doesnt use green threading (or whatever)
00:20:04FromDiscord<slymilano> 1.5Ghz dual-core intel core i5
00:20:17FromDiscord<Yardanico> hyper threading?
00:20:19FromDiscord<Rika> dual core? huh thats interesting
00:20:22FromDiscord<Rika> might be that yes
00:20:27FromDiscord<Rika> 2 cores 4 threads
00:20:34FromDiscord<Rika> if it's the i7
00:20:52FromDiscord<Rika> but yeah its because you only have 4 logical processors
00:20:54FromDiscord<Yardanico> well @Rika threadpool should still run them
00:20:58FromDiscord<Yardanico> even if more than 4 spawned
00:20:58FromDiscord<Rika> huh really?
00:21:07FromDiscord<slymilano> simple dumb example of what I'm trying to do: https://play.nim-lang.org/#ix=2rvj
00:21:12FromDiscord<Varriount> Unless the workers run forever
00:21:27FromDiscord<Yardanico> @slymilano threadpool wouldn't be good for that
00:21:35FromDiscord<Yardanico> why not just use createThread/joinThread?
00:21:43FromDiscord<slymilano> it's more manual and i'm a lazy bastard lmao
00:21:55FromDiscord<Rika> lol
00:21:57FromDiscord<Yardanico> well in your case there would be almost no difference
00:22:13FromDiscord<Yardanico> in the code I mean
00:22:14FromDiscord<Varriount> Are channels in a working state?
00:22:17FromDiscord<Yardanico> yes?
00:22:30FromDiscord<Yardanico> they're writing to a DB from each separate thread though
00:22:35FromDiscord<Yardanico> i mean slymilano's code
00:22:43FromDiscord<Yardanico> so channels are not needed there really
00:24:05FromDiscord<slymilano> hm... you're recommending I use createThread and joinThread. eventually my app will have crawlers for 20 or 30 different sites, is your approach still valid? not familiar deeply with those createthread/jointhread
00:24:11FromDiscord<Yardanico> yes of course
00:24:15FromDiscord<Yardanico> since you want to all them run in parallel
00:24:17FromDiscord<Yardanico> forever
00:24:41FromDiscord<slymilano> i see, in what case would you use `spawn` then? I thought spawn was a shoe-in for my crawlers feature
00:25:04FromDiscord<Yardanico> for CPU-intensive computation tasks
00:25:08FromDiscord<Yardanico> when you need to parallelize the computations
00:25:30FromDiscord<Yardanico> also for your case you should really look into using async
00:26:09FromDiscord<Yardanico> ah, and right, as I said before (when I was talking with you about threads, not sure how long ago) - don't call procs in themselves
00:26:16FromDiscord<Yardanico> otherwise you'll be in deep recursion
00:26:31FromDiscord<Yardanico> just do while true: fetchLatest(); sleep(30000)
00:26:39FromDiscord<Yardanico> so you wouldn't have recursion
00:27:03FromDiscord<slymilano> totally! i have to shake the recursion off a bit 😛 i'm an elixir dev for my day job
00:27:07FromDiscord<Rika> ah, webcrawler
00:27:13FromDiscord<Rika> you really should use async there
00:27:26FromDiscord<Yardanico> when I made some suggestions to you I talked about recursion too
00:27:28FromDiscord<Rika> you're not cpu bound here, you're io bound
00:27:53FromDiscord<Yardanico> exactly what I was talking about too
00:27:54FromDiscord<Rika> it'll save a lot of headaches, i'm almost sure of it
00:28:17*oriba quit (Quit: https://quassel-irc.org - Chat comfortably. Anywhere.)
00:28:37mbucheldoes anyone know if there is a websocket library like treeform/ws which also implements permessage-deflate?
00:29:19FromDiscord<Yardanico> @slymilano non-recursive example with createThread
00:29:24FromDiscord<Yardanico> sent a code paste, see https://play.nim-lang.org/#ix=2rvk
00:29:34FromDiscord<Yardanico> you can also easily make a "convenience" wrapper so it would look like with your "spawn"
00:29:43FromDiscord<Yardanico> forgot thrs[4] though
00:30:12FromDiscord<Rika> y u no for loop
00:30:18FromDiscord<Yardanico> ?
00:30:24FromDiscord<slymilano> looks great and async await looks like it's a good fit https://gist.github.com/rsirres/9949a4b98b7d5b9dd441483f14f06fbf
00:30:36FromDiscord<Rika> (why'd you not use a for loop)
00:30:54FromDiscord<Yardanico> because in slymilano's case they won't be able to use a for loop
00:31:06FromDiscord<Yardanico> @slymilano just be aware that "await" actually blocks until that future completes
00:31:16FromDiscord<Yardanico> also you don't need to be so verbose
00:31:31FromDiscord<Yardanico> and you should use sleepAsync 🙂
00:31:44FromDiscord<Rika> mbuchel: why not ask treeform if they can implement it 😛
00:32:21FromDiscord<slymilano> "just be aware that "await" actually blocks until that future completes" does this mean I can't `async` my five crawlers, and then continue on to run my jester routes and serve web requests?
00:32:37FromDiscord<Yardanico> you can
00:32:41FromDiscord<Yardanico> just need to structure it properly 🙂
00:32:43FromDiscord<Yardanico> asyncCheck and such
00:33:22mbucheli do not know how long it will take him to implement it, if one does not exist i likely will have to implement my own
00:34:18FromDiscord<Yardanico> @slymilano your example, in "nim async" style 😛 (although I changed 0.7 < 0.5 to 0.7 > 0.5)
00:34:25FromDiscord<Yardanico> sent a code paste, see https://play.nim-lang.org/#ix=2rvl
00:34:45FromDiscord<Yardanico> you can use return instead of "result = " too, it's just preferred to use "result" in Nim world if you don't need "return" for the control flow 🙂
00:35:18FromDiscord<slymilano> that looks good to me, and the nim in action book has some examples of futures i can use + your code 😄
00:35:22FromDiscord<Yardanico> if you actually put await to value and value2 declarations, output will be different
00:35:30FromDiscord<Yardanico> because then you'll wait until callback1 fully complets
00:35:45FromDiscord<Yardanico> but in my example you start both async functions
00:35:55FromDiscord<Yardanico> and then wait for the first one to return, and then for the second one
00:36:23FromDiscord<slymilano> I would like the crawlers to run at their own individual pace, don't care about sequential-ness. So something like this would work? https://play.nim-lang.org/#ix=2rvm
00:36:34FromDiscord<Yardanico> no no
00:36:39FromDiscord<Yardanico> in this case you probably want to use asyncCheck
00:36:50FromDiscord<Yardanico> also are they supposed to return anything?
00:37:02FromDiscord<slymilano> nope, they just do their thing and write to sqlite
00:37:02FromDiscord<Yardanico> since it's async it'll be single threaded so you can access the same DB instance from different crawlers
00:37:10FromDiscord<Yardanico> @slymilano yeah, then you can just use asyncCheck
00:37:20FromDiscord<Yardanico> httpclient supports async
00:37:23FromDiscord<Yardanico> sleep -> sleepAsync
00:37:52FromDiscord<slymilano> gotcha, i'll start by modifying one crawler to use asyncheck, and see what's up
00:38:13FromDiscord<slymilano> i hope this works! i want people to be able to run this tiny binary and serve their own personal torrent search engine
00:39:28FromDiscord<Varriount> slymilano: Huh, interesting. Will this application being doing the torrenting?
00:39:47FromDiscord<Yardanico> @slymilano well, for nyaa -
00:40:01FromDiscord<Yardanico> https://play.nim-lang.org/#ix=2rvn I didn't test it, but it should be pretty close
00:40:08FromDiscord<Yardanico> and in your main file you would call asyncCheck startCrawl()
00:40:18FromDiscord<slymilano> @Varriount not really, just indexing and serving a search UI, but api support as well for torznab for sonarr and radarr support
00:40:23FromDiscord<Yardanico> asyncCheck basically starts the future and sets a callback for it to handle exceptions
00:40:29FromDiscord<slymilano> the smaller, tighter, cleaner Jackett (C#) built in Nim 😛
00:40:53FromDiscord<Yardanico> ah sorry, fetchLatest() -> doWork() in my example
00:41:25FromDiscord<slymilano> someone call the zoo, cause Yardanico is a BEAST
00:41:30FromDiscord<slymilano> thanks dude this looks much clearer to me now
00:41:55FromDiscord<Yardanico> np 🙂
00:44:25*krux02_ quit (Remote host closed the connection)
00:46:07FromDiscord<Yardanico> btw, pushed first working example with nimterop's sciter and nim - https://github.com/Yardanico/nsciter
00:46:11FromDiscord<Yardanico> it's all pretty low-level right now
00:48:14*Guest44090 quit (Ping timeout: 256 seconds)
00:50:52FromDiscord<j$> types can't be stored right?
00:51:14FromDiscord<Yardanico> well they can't be stored at runtime
00:51:17FromDiscord<Yardanico> but there's "typedesc"
00:51:21FromDiscord<j$> right
00:51:25FromDiscord<j$> darn
00:51:33FromDiscord<Yardanico> why do you need to store them at runtime?
00:51:56FromDiscord<j$> trying to cast a pointer to a ptr at runtime
00:52:05FromDiscord<j$> but I have to have the type
00:52:11FromDiscord<Yardanico> what's the point?
00:52:15FromDiscord<Yardanico> you don't change the representation
00:52:23FromDiscord<Yardanico> "pointer" and "ptr Type" are exactly the same in memory
00:52:25FromDiscord<j$> opengl uniforms
00:52:36FromDiscord<j$> trying to group them into one func call
00:52:41FromDiscord<Yardanico> it's just that with "ptr Type" you give the compiler more information
00:52:56FromDiscord<Yardanico> at runtime they all will be like "pointer" 😛
00:53:26FromDiscord<j$> yeah I know that but trying to call specific procs based on pointer type
00:53:42FromDiscord<impbox> use `method` ?
00:53:48FromDiscord<j$> hmmm
00:53:55FromDiscord<j$> gotta read up on those
00:54:12FromDiscord<j$> something something dynamic dispatch?
00:54:38FromDiscord<Yardanico> well yes, because it sounds like what you want
00:56:10FromDiscord<j$> can objects have generic types, no right?
00:56:17FromDiscord<Yardanico> wdym?
00:56:20FromDiscord<Yardanico> objects can be generic
00:56:26FromDiscord<Yardanico> or you can have object variants
00:56:50FromDiscord<j$> like generic procs with the proc name[T](...)
00:57:23FromDiscord<Yardanico> yes
00:57:34FromDiscord<Yardanico> https://nim-lang.org/docs/manual.html#generics
00:57:42*dadada joined #nim
00:58:06*dadada is now known as Guest13125
00:58:25FromDiscord<j$> *gasp*
00:58:28FromDiscord<j$> I needed this
00:59:14FromDiscord<impbox> nim generics are great <3
00:59:35FromDiscord<Rika> impbox's name is a generic
00:59:39FromDiscord<Rika> (lol)
01:00:11FromDiscord<impbox> you can also do generics without the [T] thing, proc foo(v: TypeA | TypeB | TypeC) etc
01:00:17FromDiscord<impbox> (edit) 'proc' => '`proc' | 'TypeC)' => 'TypeC)`'
01:00:36FromDiscord<Rika> theyre called implicit (?) generics or something
01:00:37FromDiscord<impbox> (see below under "implicit generics")
01:00:43FromDiscord<Rika> huahuahuahua
01:00:45FromDiscord<j$> cool
01:00:45FromDiscord<Rika> i am right
01:00:47FromDiscord<impbox> yep, didn't realise they had a name
01:03:22FromDiscord<Yardanico> there's also this feature
01:03:27FromDiscord<Yardanico> sent a code paste, see https://play.nim-lang.org/#ix=2rvr
01:03:56FromDiscord<Varriount> @j$ There are also other situations where a procedure becomes generic (or "generic-like")
01:04:05FromDiscord<Yardanico> you can access the "subtype" of the generic even if it's implicit
01:04:33FromDiscord<Varriount> For example, when a procedure has a parameter of type `typed`
01:04:40FromDiscord<Yardanico> or auto/any
01:05:54FromDiscord<Varriount> Although, I don't know if the compiler internally handles those like generics
01:06:33FromDiscord<Yardanico> well
01:06:38FromDiscord<Yardanico> sent a code paste, see https://play.nim-lang.org/#ix=2rvs
01:06:56FromDiscord<Yardanico> ah I don't need typeof here either
01:06:58FromDiscord<impbox> oh never used that
01:07:02FromDiscord<Yardanico> neither did I
01:07:03FromDiscord<impbox> in procs
01:11:29*Tlanger joined #nim
01:14:32*Tongir quit (Ping timeout: 272 seconds)
01:18:59*fredrikhr quit (Ping timeout: 256 seconds)
01:27:41*audiophile joined #nim
01:28:36*Shucks quit (Quit: Leaving)
01:33:22FromDiscord<exelotl> "Implicit generics" ohhhh that's what they are
01:33:50*chemist69 quit (Ping timeout: 256 seconds)
01:35:49*chemist69 joined #nim
01:36:46FromDiscord<impbox> it was implicit =)
01:37:53FromDiscord<Rika> *was*?
01:38:20FromDiscord<impbox> it's not now we've made it explicit by talking about it
01:38:34FromDiscord<Rika> lmao
01:38:35FromDiscord<Rika> i see
01:38:44FromDiscord<Rika> my brain: :loading:
01:45:30*endragor joined #nim
02:23:51*muffindrake quit (Ping timeout: 272 seconds)
02:25:22FromGitter<ynfle> Any reason I'm getting `SIGSEGV: Illegal storage access. (Attempt to read from nil?)` for `getAppDir().parentDir()`
02:25:39*muffindrake joined #nim
02:26:08FromGitter<ynfle> On Macos
02:28:12*endragor quit (Remote host closed the connection)
02:28:24*endragor joined #nim
02:32:46FromDiscord<impbox> what does getAppDir() return?
02:34:34*Cthalupa quit (Ping timeout: 240 seconds)
02:36:51*Cthalupa joined #nim
02:38:23shashlickDirectory where current binary is
02:47:17FromDiscord<impbox> the actual value i mean
02:47:23FromDiscord<impbox> when it's crashing
02:47:56FromDiscord<impbox> is it getAppDir() that's segfaulting or parentDir()?
02:48:26FromDiscord<impbox> `getAppDir: Returns the directory of the application's executable. Note: This does not work reliably on BSD` macos is BSD right?
02:48:49FromDiscord<impbox> would be nice if it explained what "not working reliably" meant
02:49:47FromGitter<ynfle> :facepalm:
02:50:03FromGitter<ynfle> Classic amiguous nim docs
02:51:45FromDiscord<impbox> but ynfle, what is the return value of getAppDir?
02:52:35FromGitter<ynfle> Now it's not failing on that anymore
02:53:04FromDiscord<impbox> uhh ok... sounds like you're getting memory corruption or something
02:53:36FromGitter<ynfle> It's SISSEGVing on `/` for joining paths
02:53:58FromDiscord<impbox> got a test case?
02:54:11FromGitter<ynfle> Are you on Mac?
02:54:12FromDiscord<impbox> or is it only happening in part of a larger app
02:54:20FromDiscord<impbox> nope
02:55:10FromDiscord<impbox> but if it happens in isolation then it's probably a problem with nim, if not then it's likely you're messing up the memory somewhere else and it's throwing an error there
02:55:15FromDiscord<impbox> can you valgrind it on mac?
03:01:52*chemist69 quit (Ping timeout: 260 seconds)
03:02:17*chemist69 joined #nim
03:03:02*endragor_ joined #nim
03:03:10*endragor quit (Read error: Connection reset by peer)
03:10:46*audiophile quit (Remote host closed the connection)
03:38:56shashlick@Yardanico - I updated the gist to fix the HWINDOW issue - check it out when you get a chance
03:43:40FromDiscord<Varriount> @impbox No valgrind on Mac, but there is address sanitizer
03:45:55FromGitter<ynfle> @impbox, what does that mean?
03:46:47FromDiscord<impbox> Valgrind is a program that runs your app in a sandbox and monitors invalid memory usage and tells you where/when it happens, since often those errors don't show up until you get a segfault in a weird unrelated place
03:47:29FromGitter<ynfle> @Varriount, any suggestions?
03:54:14*Cthalupa quit (Ping timeout: 240 seconds)
03:56:18FromDiscord<slymilano> Progress! asyncCheck, and asyncSleep, await, {.async} and Future's gave me the solution I needed. However it doesn't seem to play well with Jester. If I uncomment my jester routes macro, the crawlers don't run, and if I leave the runForever the jester macros don't run so I get no website api. https://play.nim-lang.org/#ix=2rvF
03:56:28FromDiscord<slymilano> (edit) 'asyncSleep,' => 'sleepAsync,'
03:56:35*Cthalupa joined #nim
03:58:30FromDiscord<slymilano> The changes I made if anyone's curious https://github.com/sergiotapia/torrentinim/commit/db1cc8d429d08afea1c806a20b145d499da141cf?diff=split
04:06:01*supakeen quit (Quit: WeeChat 2.8)
04:06:33FromDiscord<Rika> use a router
04:06:38*supakeen joined #nim
04:06:54FromDiscord<Rika> let me edit your playground demo one moment
04:07:40FromDiscord<Varriount> @ynfle: still here?
04:07:46FromGitter<ynfle> Yup
04:08:58FromDiscord<Varriount> ynfle: Are you using the Arc GC (or is there a reason you can't use Arc)?
04:09:06FromDiscord<Rika> @slymilano https://play.nim-lang.org/#ix=2rvH
04:09:30FromDiscord<Rika> dunno if you have to do this specifically, but there
04:09:32FromGitter<ynfle> Wasn't specifying ay
04:09:36FromGitter<ynfle> *any
04:09:38FromDiscord<slymilano> let me try thank you
04:09:42FromDiscord<Varriount> @ynfle Try adding `--gc:arc --passc:-fsanitize=address`
04:09:45FromGitter<ynfle> Would that help?
04:10:03FromDiscord<Varriount> It might make the address sanitizer complain less/be more accurate
04:11:53FromDiscord<Varriount> @ynfle Anything?
04:12:17FromGitter<ynfle> It seems to have solved it
04:12:24FromGitter<ynfle> Why was `arc` needed?
04:12:42FromDiscord<Varriount> Hm, that wasn't meant to solve it, just help find the cause.
04:12:55FromDiscord<Varriount> What happens if you remove `--gc:arc`?
04:13:18FromGitter<ynfle> I got this `clang: error: unsupported argument 'address--skipUserCfg:on' to option 'fsanitize='`
04:13:24FromDiscord<slymilano> @Rika https://play.nim-lang.org/#ix=2rvI - with no runForever the crawlers don't actually run, and with it, the jester server doesn't start because of runForevers' while true
04:13:33FromDiscord<Varriount> I added arc because diagnostic tools like valgrind and address sanitizer can mistake the GC for bad programming
04:13:57FromGitter<ynfle> Makes sense
04:13:58FromDiscord<Varriount> @ynfle Add a space after 'address'
04:14:20FromGitter<ynfle> Oh haha
04:20:09FromDiscord<slymilano> it's weird because Jester's .serve() function actually called runForever() at the end of it's proc - so why would it not work exactly like my runForever in my main nim file
04:24:21FromDiscord<Varriount> @slymilano That's really odd
04:26:21*endragor joined #nim
04:26:21*endragor_ quit (Read error: Connection reset by peer)
04:27:54FromDiscord<Varriount> @slymilano If you remove runForever and let Jester run, what happens when it serves a request?
04:28:08*waleee-cl quit (Quit: Connection closed for inactivity)
04:30:57FromDiscord<slymilano> @Varriount nothing happens as far crawlers being fired - the requests to jester are served, but crawlers ramain dead/silent
04:33:09FromDiscord<slymilano> the project has zero deps if you're curious enough to git clone - a simple `nimble run torrentinim` runs it
04:33:43FromDiscord<Varriount> slymilano: I can in about an hour.
04:34:59FromDiscord<Varriount> slymilano: Do you have a C/C++ debugger on hand? Nim is compatible with GDB/LLDB/etc
04:37:10FromDiscord<Varriount> @slymilano ^
04:37:26FromDiscord<slymilano> that's a bit out of my wheelhouse 😦
04:37:34FromDiscord<slymilano> i don't have that nor know how to use it
04:39:31*B4s1l3 joined #nim
04:39:55*B4s1l3 is now known as opDispatch
04:41:47FromDiscord<slymilano> thanks @Varriount appreciate your help whenever you can
04:42:37FromDiscord<Varriount> slymilano: Try raising an exception in your web crawlers on the very first line of their implementation
04:53:11*Guest13125 quit (Ping timeout: 256 seconds)
04:53:33FromDiscord<Varriount> slymilano: If you can wait another 30-40 minutes, I'll be able to compile your program then.
04:53:44FromDiscord<slymilano> sure i'll be around
04:53:51FromDiscord<Varriount> Although, it will be on Windows, so it might just explode. ;D
04:53:55FromDiscord<slymilano> hahaha nice
04:54:01FromDiscord<slymilano> like i said no rush and i appreciate any help
04:59:52*dadada joined #nim
05:00:16*dadada is now known as Guest14468
05:13:17FromDiscord<Varriount> @slymilano Cloning and compiling now.
05:17:54FromDiscord<Varriount> @slymilano Theoretically, what would I be seeing if the workers were running?
05:18:50FromDiscord<Varriount> Because I get `INFO Jester is making jokes at http://127.0.0.1:5000 (all interfaces)`, then the terminal starts outputting a bunch of information that looks like the output of a web crawler.
05:19:36FromDiscord<slymilano> woah, i don't see that, i'm on latest master. maybe it's because i'm running it on vs code's terminal that doesn't make sense though
05:20:00FromDiscord<Varriount> I'd post the output, but there is quite a lot of it.
05:20:37FromDiscord<slymilano> yeah that means it's writing to your local sqlite database in the repo. hm.... i don't see any output in my standalone terminal either. wut
05:20:44FromDiscord<slymilano> strange and i'm out of ideas then lol
05:20:55FromDiscord<slymilano> is there a build cache I can nuke for the project haha
05:21:09FromDiscord<Varriount> `~/nimcache`, I think.
05:21:48FromDiscord<Varriount> Maybe it's because I'm on Windows?
05:22:01FromDiscord<slymilano> that may be it
05:22:08FromDiscord<slymilano> so this may be a bug? my code aint that clever lol
05:22:16FromDiscord<slymilano> (edit) 'bug?' => 'bug with Nim?'
05:22:27FromDiscord<Varriount> Hm
05:23:19FromDiscord<Varriount> How familiar are you with Docker?
05:23:32FromDiscord<slymilano> not very - what do you have mind?
05:24:20FromDiscord<Varriount> Well, you or I could run the program on Linux (via Docker) to see if that has an effect
05:25:07FromDiscord<Varriount> I'll admit that OSX is a bit of a blind-spot in Nim's testing protocols.
05:25:37FromDiscord<Varriount> It's not that we don't try programming for OSX, however it's hard to run it in a CI/CD pipeline.
05:26:01FromDiscord<slymilano> i'll try to create a docker for the project next weekend or after wednesday
05:26:08FromDiscord<slymilano> appreciate your help and actually running the app though!
05:26:14FromDiscord<slymilano> now i have a thread to follow
05:26:17FromDiscord<Varriount> Do you have a parallels or Windows environment?
05:27:04*Vladar joined #nim
05:27:20FromDiscord<Varriount> slymilano: Anyway, I hope this didn't scare you off Nim.
05:27:54FromDiscord<slymilano> nah, i see nim as a scalpel atm. hard to weild but precise and sharp a **** i'll get better at it
05:28:00FromDiscord<Varriount> I'll admit, the async framework isn't as polished as it could be. There hasn't really been anyone willing to invest much time into improving.
05:28:02FromDiscord<slymilano> bright future ahead of this language
05:30:16FromDiscord<Varriount> I'm on the EST timezone (-4), feel free to ping me if you need help (though if I'm working, I can't guarantee I'll be able to dedicate too much time)
05:33:09*hoijui joined #nim
05:36:44*bung joined #nim
05:38:34FromDiscord<Elegant Beef> If i generate a proc through a macro, how can i subscribe add that proc to a table from said macro?
05:38:50FromDiscord<Elegant Beef> like i have the `ident` node
05:38:52FromDiscord<Varriount> subscribe?
05:38:55FromDiscord<Elegant Beef> Well add it
05:39:01FromDiscord<Elegant Beef> It's a lut of id, proc
05:40:20*maier joined #nim
05:40:27FromDiscord<Varriount> So, you have a macro that generates procedures, and after generating a procedure, you want to store the name and procedure in a table?
05:40:42FromDiscord<Elegant Beef> well i just want to store the procedure in the table
05:40:46FromDiscord<Elegant Beef> I have it's name in an ident node
05:41:38FromDiscord<Varriount> https://nim-lang.org/docs/manual.html#constants-and-constant-expressions
05:42:08FromDiscord<Varriount> That should work? Or is that not what you're aiming for.
05:43:05FromDiscord<Elegant Beef> Well i know how to make the lut at compile time outside of this macro, i just dont know how i can do the `table.add(id, macroGeneratedProcedure)`
05:43:11ForumUpdaterBotNew thread by Domogled: tests in the same files as the code, see https://forum.nim-lang.org/t/6540
05:43:37FromDiscord<Varriount> Doesn't `table.add(id, macroGeneratedProcedure)` work?
05:44:05FromDiscord<Elegant Beef> You mean give it the ast?
05:44:36FromDiscord<Elegant Beef> Cause i cant use the name as the name of the generated procedure depends on what procedure generated it
05:45:30FromDiscord<Varriount> I'm confused. The macro generating a procedure should be able to access the procedure's name.
05:45:38FromDiscord<Elegant Beef> Yea i have the name of it
05:46:17FromDiscord<Elegant Beef> How can i put the table that is `Table[uint32,proc]`
05:46:40FromDiscord<Varriount> Why is the key a uint32?
05:46:55FromDiscord<Elegant Beef> does it matter?
05:47:23FromDiscord<Varriount> Well, if you want to store a name as a key, you need the table to have a string type as the key.
05:47:27FromDiscord<Elegant Beef> This is for a RPC and 2^32 sounded like enough possible events for a single system, uif you're curous
05:47:30FromDiscord<Elegant Beef> Well not
05:47:32FromDiscord<Elegant Beef> I want an id
05:47:44FromDiscord<Elegant Beef> I want to store the generated proc as the value
05:47:45FromDiscord<Elegant Beef> Not the key
05:47:56FromDiscord<Elegant Beef> But i have no idea how to get the signature to do as such
05:48:21FromDiscord<Varriount> Hm, Along with the procedure body, output a call to register that procedure with the table.
05:48:51FromDiscord<Elegant Beef> seems hacky, but ok 😄
05:52:23FromDiscord<Varriount> I mean, I don't see what the problem is. Yes, you could theoretically have the macro modify the compile-time variable to store the procedure, but it's going to amount to mostly the same work as the solution I proposed.
05:52:45FromDiscord<Varriount> The compile-time variable would still need to be initialized at run-time.
05:52:52FromDiscord<Elegant Beef> Yea i know
06:02:35*endragor quit (Ping timeout: 240 seconds)
06:05:40*vicfred quit (Quit: Leaving)
06:06:59*endragor joined #nim
06:20:25*narimiran joined #nim
06:35:29FromDiscord<Varriount> Hm, what are some common questions people have when working with Nim?
06:38:24*debased quit (Quit: WeeChat 2.8)
06:45:20vegaihow to repl? :P
06:45:32*hoijui quit (Quit: Leaving)
06:45:34vegaidunno if that's common, but I keep wonering
06:45:39*hoijui joined #nim
06:47:10FromDiscord<flywind> I can think of some questions such as:
06:47:22FromDiscord<flywind> sent a long message, see http://ix.io/2rvU
06:47:27Oddmongerhello, nimmers
06:48:06vegaiaww, github is broken again
06:48:25FromDiscord<flywind> Hello
06:54:13livcdnimeans. nimrods. nimuans. nimasters.
06:57:23Oddmongernimrod, it's like a character from Lyonnesse
07:06:48narimirancommon questions?
07:07:05narimiran"why sTyLE_inSeNSitiVIty???"
07:07:25narimiran"why imports are not just like in python?"
07:07:50livcdnarimiran: that's because Nim has been advertised as "faster python"
07:08:14Araqnarimiran, shttt, don't mention it
07:08:31narimiran:)
07:08:35Araqyou should phrase it as "Why is Nim so much better than X"
07:17:06Oddmongerwell i have publish the link of the wiki entry «nim for the Pythoners», and all i get was «what, space identation ? That language sucks»
07:18:13FromDiscord<lqdev> tell them about source code filters
07:18:30Oddmongerwhat is it ?
07:18:44FromDiscord<lqdev> #? replace("\t", " ")
07:18:55FromDiscord<lqdev> put that at the first line of your file
07:19:06FromDiscord<lqdev> and all tabs will get replaced with 4 spaces
07:19:10Oddmongerah
07:19:15Oddmongerthank you
07:19:36FromDiscord<lqdev> source code filters allow you to modify source code before it's compiled
07:20:11FromDiscord<lqdev> https://nim-lang.org/docs/filters.html
07:21:42Oddmongernice
07:26:48Oddmongerbtw i use two spaces (another holy war ?)
07:29:00FromDiscord<lqdev> yeah another holy war
07:29:12FromDiscord<lqdev> most people also use 2 spaces i think
07:30:05FromDiscord<lqdev> at least according to my observations on github
07:33:19bungOddmonger that also says from js programers
07:55:25FromDiscord<XxDiCaprioxX> I mean VS Code does the space indentation with tabs, too
07:57:53FromDiscord<Zed> githubs down again :(
07:57:58*Tongir joined #nim
07:58:20Araqgithub down, a free day, no work
07:58:43AraqI'm addicted though, must write my .cursor analysis
08:00:10bungI modified vnode's class called redraw(), it doest sync to native dom?
08:00:11*Tlanger quit (Ping timeout: 240 seconds)
08:01:26Araqbung, well define "sync"
08:01:42AraqKarax assumes the VDOM is the single source of truth
08:02:21bungI can check the vnode's class changed , but dom not changed
08:03:25bungit's like react functional component ?
08:05:11*endragor quit (Remote host closed the connection)
08:05:38*endragor joined #nim
08:07:59Araqa class change does cause a redraw, no idea what's happening
08:08:49*hoijui quit (Quit: Leaving)
08:09:47*endragor quit (Ping timeout: 240 seconds)
08:12:03FromDiscord<Varriount> Araq: Does Nim default to stdcall on Windows for C imported procedures?
08:12:50FromDiscord<Varriount> C2Nim is throwing a fit over calling conventions in function pointer type declarations
08:13:21FromDiscord<Varriount> so I'm likely going to have to do #def __stdcall
08:15:43*solitudesf quit (Ping timeout: 258 seconds)
08:17:35bunghmm no idea, it compare to native dom afaik, so the vdom changed I think it should re render that node
08:20:44*endragor joined #nim
08:23:01*oddp joined #nim
08:24:25FromDiscord<exelotl> #? replace("\t", " ") ---> holy shit lol
08:26:03bungoh, guess I need manage all state in buildHtml, so it compare to old vnode
08:35:43FromDiscord<Varriount> @exelotl Yep.
08:36:51FromDiscord<Varriount> Personally, out of all the "unused" features, I like source code filters the most. Mainly because you could theoretically use them with an appropriate DSL to do neat templating tricks.
08:45:50*Vladar quit (Quit: Leaving)
08:56:26*fredrikhr joined #nim
09:12:36*endragor quit (Quit: Leaving...)
09:14:07*endragor joined #nim
09:19:13*Shucks joined #nim
09:31:56bungI manage state as `tdiv(class=fmt"slider__item {self.trigger} {classes[i]}",data-index = $i)`
09:32:07bungif still not redraw to dom
09:32:10bungit
09:44:45FromGitter<alehander92> bung it doesnt work like that
09:44:56FromGitter<alehander92> at least i think in upstream karax
09:45:11FromGitter<alehander92> vnode is probably compared to previous vnode internally
09:45:24FromGitter<alehander92> or not, i really dont remember well
09:45:50FromGitter<alehander92> otherwise are you sure classes[i] is different when i changes
09:46:28bungyeah I log it out, it changes infinitely
09:46:49bungmaybe causes by am using a ref ? `carousel(nref = refCarousel)`
09:48:28bungnot sure, as it always new a Commonent,so the father node will change
09:48:40bungcommponent
09:58:20Shucksheya nimlers
10:08:08skrylar[m]hello Shucks
10:10:59*maier quit (Ping timeout: 240 seconds)
10:18:38*Shucks quit (Quit: Leaving)
10:22:17*abm joined #nim
10:24:53FromDiscord<Shucks> https://streamable.com/bsatkr
10:24:53FromDiscord<Shucks> ;D
10:25:58FromDiscord<Recruit_main707> Is it done in Nim?
10:26:03FromDiscord<Shucks> sure
10:26:21FromDiscord<Recruit_main707> cool
10:27:01FromDiscord<Shucks> Yea nim fits perfectly fine to hack games haha
10:27:37*opDispatch quit (Quit: Konversation terminated!)
10:28:32FromDiscord<Recruit_main707> This is external though, internal gets messier
10:33:00FromDiscord<Shucks> Im internal on swbf
10:33:34FromDiscord<Shucks> which is much less code than external tbh
10:54:28*maier joined #nim
11:20:19*fredrikhr quit (Ping timeout: 246 seconds)
12:06:02*supakeen quit (Quit: WeeChat 2.8)
12:06:27*Kaivo quit (Quit: WeeChat 2.8)
12:06:43*supakeen joined #nim
12:14:04Yardanico!status
12:14:06FromDiscordUptime - 5 days, 3 hours, and 19 minutes
12:18:51FromDiscord<Yardanico> I don't play enough games nowadays to be interested in hacks 😛
12:19:07narimiranwoohoo, no more time travelling!
12:19:34Yardaniconarimiran: yeah, because you can't use commands from Discord anymore :P
12:19:47Yardanicoand on IRC they require you to be in a whitelist and ircord checks if you're authorized on freenode
12:19:53Yardanicoit requires*
12:21:14FromDiscord<Yardanico> About game hacking - I only made one proper internal hack 1.5 years ago for Foxhole (it was in C++ though, DLL injecting, ImGui and all that, Unreal SDK generator and stuff). I rarely play games nowadays
12:21:26*fredrikhr joined #nim
12:21:46FromDiscord<Yardanico> I also hacked some Unity games (back then Unity Webplayer was popular), but it's not so hard since you could just disassemble and modify the .NET binaries
12:23:44*letto_ joined #nim
12:24:14*letto_ quit (Client Quit)
12:25:04FromDiscord<Shucks> Its awesome that I don't have to use cpp anymore
12:25:14*letto quit (Ping timeout: 272 seconds)
12:25:24FromDiscord<Yardanico> Well I used C++ because that Unreal SDK generator was outputting C++
12:25:38FromDiscord<Yardanico> and my internal was quite small anyway, so I didn't bother with wrapping the sdk generator output with Nim's C++ backend
12:25:54FromDiscord<Shucks> Almost everything can be done in nim except my asm stuff. Which might be because im not experienced enough with at&t and nim itself
12:26:01*letto joined #nim
12:26:36FromDiscord<Shucks> That sdk generators almost give structs for the internal classes. c2nim is pretty good with it ;D
12:27:05FromDiscord<Yardanico> Well, for Unreal it's more complex
12:27:12FromDiscord<Yardanico> since it's all vtables and stuff
12:27:22FromDiscord<Shucks> yea
12:27:26FromDiscord<Shucks> never did a ue game
12:27:30FromDiscord<Shucks> not in cpp either
12:27:44bungI log "updateStyles" it output once for first item, well I have multiple items why is that ?
12:27:51FromDiscord<Yardanico> yeah it's just that most multiplayer Unreal Engine use an anti-cheat, Foxhole did not 🙂
12:28:00FromDiscord<Yardanico> I had fun with my internal hack, and of course never released it to public
12:28:17FromDiscord<Yardanico> the sources are still in a private github repo though (but they're outdated a lot, Foxhole had tons of updates since that)
12:29:15FromDiscord<Yardanico> 😛 https://media.discordapp.net/attachments/371759389889003532/732212040315174962/unknown.png
12:29:26FromDiscord<Shucks> ^.^
12:29:38FromDiscord<Shucks> my current internal with nim on swbf https://media.discordapp.net/attachments/371759389889003532/732212136129986600/swbfesp.png
12:29:45FromDiscord<Yardanico> ulala
12:29:49FromDiscord<Yardanico> what about anti-cheat?
12:30:15FromDiscord<Shucks> they taking screenshots. I've hooked bitblt (windows api to record) and deactivate the drawings once its called
12:30:27FromDiscord<Yardanico> only that? no stuff like BattlEye or EAC?
12:30:28FromDiscord<Yardanico> lol
12:30:32FromDiscord<Shucks> naw ;p
12:30:37FromDiscord<Yardanico> what the heck
12:31:19FromDiscord<Shucks> well punkbuster. But i'm not sure what it actually does. Guess it just scans for the public stuff
12:35:12supakeenIt's a well kept secret; though with modern anti-cheat engines you indeed have no idea what they do they can be sent random instructions to perform on any machine suspected of doing more (or any machine really).
12:35:39supakeenIt's pretty great having a rootkit on your system with remote access >_<
12:35:46FromDiscord<Yardanico> well some anti-cheats are well-known by hack developers
12:35:50FromDiscord<Yardanico> and reversed a lot
12:37:26*krux02 joined #nim
12:39:17*xet7 quit (Quit: Leaving)
12:43:19FromDiscord<Shucks> Some anticheats are really to much. Valorant's anticheat just installs a driver or something which has to be started once you boot your machine.
12:47:20*Jjp137 quit (Ping timeout: 244 seconds)
12:47:37*Jjp137 joined #nim
12:49:11*Vladar joined #nim
12:49:36*solitudesf joined #nim
12:50:18FromDiscord<Shucks> I feel like vscode's code suggestions are way to slow for me. Does someone else faces this issue on windows or is it something related to my machine?
12:50:25*solitudesf quit (Remote host closed the connection)
12:50:50*solitudesf joined #nim
12:51:05FromDiscord<lqdev> they slow down as your project gets bigger
12:51:15FromDiscord<lqdev> I noticed that in vim, too
12:51:18shashlickMight be some configurable timer
12:51:53shashlick@lqdev is freetype c++?
12:51:59FromDiscord<lqdev> it's C
12:52:02shashlickChecked out the issue you saw
12:52:17shashlickIs int(x) valid c?
12:52:37FromDiscord<lqdev> no, it's C++
12:52:52shashlickThat's what's in that enum you had trouble with
12:52:53FromDiscord<lqdev> but freetype does `(FTUInt)(0)` which is valid C
12:53:03FromDiscord<lqdev> it's the same as `(FTUInt)0`
12:53:07shashlickOk so it is a cast
12:53:14FromDiscord<lqdev> yes
12:53:37FromDiscord<Clyybber> is the suggestion getting slower a nimsuggest issue?
12:53:56shashlickThat must be a tree sitter bug since it treats it as a call, not a cast
12:55:43FromDiscord<lqdev> @Clyybber likely it's more due to the lack of incremental compilation. at this point, compile times for me are reeeeeeeally long and it's starting to become quite a pain
12:56:14FromDiscord<lqdev> but if nimsuggest doesn't depend on the compiler (which I doubt), then it might be nimsuggest's own issue
12:56:28*nikita` joined #nim
12:56:37FromDiscord<Clyybber> ok, so its likely not a vim/vscode issue
12:56:51FromDiscord<Clyybber> are you using nimterop?
12:57:06FromDiscord<Clyybber> doesn't nimterop have a relatively big impact on compile times?
12:57:36FromDiscord<lqdev> it does, but I'm not using nimterop
12:58:00shashlickNimterop has an effect since I need regex and it imports a bunch of stuff
12:58:16shashlickEvery additional module or file adds a lot of base time to compile or check
12:58:39shashlickI did try optimizing quite a bit but no control over that
12:58:41FromDiscord<lqdev> yeah
12:58:51FromDiscord<lqdev> as I said, it's all because we don't have IC yet
13:00:42shashlickAlso now cimport includes a file instead of parsing the code as a string so it should be marginally faster - Nim would know that the cached code file hasn't changed
13:02:03shashlickIf not specified, the file is in cache, else it gets generated where you want
13:14:22FromDiscord<Shucks> So I made some changes on the settings. Seems like its faster now: https://paste.sh/yMD8NTRb#_RzSG4befG9IyS8ZWDkTeelT
13:27:43*nikita` quit (*.net *.split)
13:27:43*Vladar quit (*.net *.split)
13:27:44*casaca quit (*.net *.split)
13:27:45*FromDiscord quit (*.net *.split)
13:27:45*FromGitter quit (*.net *.split)
13:27:56*def- quit (*.net *.split)
13:28:09*nikita` joined #nim
13:28:09*Vladar joined #nim
13:28:09*casaca joined #nim
13:28:09*FromDiscord joined #nim
13:28:09*FromGitter joined #nim
13:28:09*def- joined #nim
13:28:23FromDiscord<--HA--> Is there a way to have the field names of an object type available in a statically checkable way? Not sure if I put my question very well. In this example https://play.nim-lang.org/#ix=2rx0 I would like to have the strings "fieldA" and "fieldC" as something that can be checked by the compiler. Like if I had an Enum of all the fields.
13:28:37FromDiscord<--HA--> I could of course make that enum but I was wondering if there was a better way and without duplication
13:28:37FromDiscord<Yardanico> you can use macros
13:28:43FromDiscord<Yardanico> wait, what do you want exactly?
13:28:54FromDiscord<Yardanico> " field names of an object type available in a statically checkable way" - you can check them in macros
13:29:23FromDiscord<--HA--> In that examle code not accidentaly type fieldX and that is not a valid field name
13:31:47FromDiscord<mratsim> @--HA-- use "when" instead of if in your example and put {.error: "Invalid field name".} for the conditional that you don't want to compile
13:32:30FromDiscord<mratsim> https://play.nim-lang.org/#ix=2rx1
13:33:00FromDiscord<mratsim> or maybe I misunderstood?
13:33:23FromDiscord<mratsim> in anycase if you type the wrong field, the compiler will prevent compilation
13:33:40FromDiscord<mratsim> you'll get undeclared field/identifier
13:34:00FromDiscord<--HA--> Interesting. Yes, so if I type a wrong field name string it does not compile was my goal.
13:34:18FromDiscord<mratsim> Any typed language does that
13:35:50FromDiscord<lqdev> ah, the XY problem
13:35:52FromDiscord<lqdev> my favorite
13:37:31FromDiscord<--HA--> Hm no, your example is not what I thought it was. I'm finding it difficult to formulate my question. Especially since I notice now my example is a bad one, too. Basically I want to be able to type a few field names in an array (or whatever) and be sure those are existing names for the object I want to use them on.
13:39:25FromDiscord<lqdev> concepts?
13:39:55FromDiscord<lqdev> sent a code paste, see https://play.nim-lang.org/#ix=2rx4
13:42:11FromDiscord<--HA--> Maybe I don't even need to worry about it if the first part I thought was possible can not be done. Is there a way to do this? https://play.nim-lang.org/#ix=2rx5
13:43:32FromDiscord<lqdev> no, because Nim is not dynamically typed.
13:43:38FromDiscord<lqdev> what are you *really* trying to do?
13:44:30FromDiscord<Yardanico> @lqdev well technically it is possible with some macro and enum magic, but yeah, I think it shouldn't be done this way
13:44:31FromDiscord<mratsim> well technically you can
13:44:53FromDiscord<lqdev> @Yardanico as I said, this sounds like the XY problem
13:44:55FromDiscord<Yardanico> yeah
13:45:07FromDiscord<mratsim> for example: https://github.com/status-im/nim-cookbook/blob/master/dynamic_approximating_dynamic_types.nim
13:46:42*RaycatWhoDat joined #nim
13:47:01FromDiscord<mratsim> in any case, unless you get more experimented in Nim or in your domain, what you are trying to do is probably wrong
13:47:31FromDiscord<mratsim> i.e. you wouldn't be able to do that in statically typed languages (C, C++, Rust, Go, Java, ...)
13:47:49RaycatWhoDatDoes anyone here know how one could make a variadic zip function?
13:48:02FromDiscord<mratsim> yes
13:48:27FromDiscord<mratsim> You use: https://github.com/numforge/loop-fusion↵or https://github.com/zero-functional/zero-functional
13:48:56RaycatWhoDatOh, sweet. Thanks!
13:49:34shashlick@Yardanico did you get my message from yesterday
13:49:43FromDiscord<Yardanico> about your updated wrapper? yeah
13:49:51shashlickOk cool
13:51:23shashlickAny other findings? What other gui libs need updated wrappers?
13:53:23FromDiscord<lqdev> I wonder how Nim does overload resolution, given default parameters and that we can just swap them around as much as we want
13:53:32FromDiscord<lqdev> like, the algorithm
13:55:58FromDiscord<--HA--> Yeah maybe I just have to do it differently in nim. I'm used to ruby. What I want to do is run the same code on a number of fields but I don't want to type out doStuff(obj.fieldA), doStuff(obj.fieldB),and so on but rather iterate over a list of fields and ideally at the same time make sure that list has only valid field names
14:04:42FromDiscord<haxscramper> You can use `fieldPairs` to iterate over all fields in object/tuple at runtime. https://nim-lang.org/docs/iterators.html#fieldPairs.i%2CT To get fields from type at *compile-time* (i.e iterate over all fields in type definition) you can use `typed` macro (something like this: https://play.nim-lang.org/#ix=2rxb )
14:06:06*abm quit (Ping timeout: 256 seconds)
14:06:53FromDiscord<--HA--> Imagine the type had 30 fields and I wanted to do something on maybe 10 of those but not type out all the code repeatedly. Like this https://play.nim-lang.org/#ix=2rx5↵The fieldPairs approach works but then I get no checking of my field names, which would be ok, I just thought there might be a relativly simple solution to that I was missing
14:07:25*fredrikhr quit (Read error: Connection reset by peer)
14:07:37FromDiscord<lqdev> sent a code paste, see https://play.nim-lang.org/#ix=2rxd
14:07:38*Kaivo joined #nim
14:07:51*fredrikhr joined #nim
14:08:21FromDiscord<lqdev> you might be able to create a macro for what you need
14:16:25FromDiscord<--HA--> Thanks everyone. I'll check it out
14:17:00FromGitter<bung87> I use RSeq, it only track resize there's track pragma attach to item render proc still not rerender the item
14:22:50*fredrikhr quit (Read error: Connection reset by peer)
14:23:18*fredrikhr joined #nim
14:27:57FromDiscord<Yardanico> are =sink and = hooks available for refc?
14:29:31*lritter joined #nim
14:31:18FromDiscord<Yardanico> or maybe I did something wrong
14:32:04FromDiscord<Yardanico> if I have a value like "let a = newValue(5)" and it has custom =destroy, =sink and =, and I do "let a2 = a", will = be called?
14:32:15FromDiscord<Yardanico> so I can copy the underlying value with sciter's API
14:32:21FromDiscord<Yardanico> and have copy semantics for values
14:33:35FromDiscord<Yardanico> right now if I do "let a2 = a" `=` is not called and when printing it's the same exact value
14:34:21FromGitter<alehander92> oh man
14:34:30FromGitter<alehander92> i had an interview and i forgot what typeclasses are
14:34:37FromGitter<alehander92> now i am not even sure i know it
14:35:31FromGitter<alehander92> ah constraints
14:35:46FromGitter<alehander92> what's new in nim yardanico
14:36:18FromDiscord<Recruit_main707> new T: ref T
14:36:24FromDiscord<Recruit_main707> afaik
14:36:31FromDiscord<Yardanico> @alehander92 arc optimizer PR
14:36:51FromDiscord<Recruit_main707> Took that too literally XD
14:38:28FromDiscord<Yardanico> isn't that sexy
14:38:32FromDiscord<Yardanico> sent a code paste, see https://play.nim-lang.org/#ix=2rxn
14:38:38FromDiscord<lqdev> no
14:38:45FromDiscord<Yardanico> 😦
14:38:55FromDiscord<lqdev> > x.impl.isNil()
14:38:57FromDiscord<lqdev> what is this
14:39:01FromDiscord<Yardanico> ?
14:39:01FromDiscord<lqdev> just `x.impl != nil`
14:39:04FromDiscord<Yardanico> no
14:39:09FromDiscord<Yardanico> isn't isNil better?
14:39:13FromDiscord<lqdev> no
14:39:16FromDiscord<Yardanico> why?
14:39:23FromDiscord<lqdev> the above gets rewritten to it
14:39:25FromDiscord<Yardanico> I think .isNil is recommended over nil
14:39:32FromDiscord<lqdev> and there isn't an `.isntNil`
14:39:33FromDiscord<Clyybber> doesn't matter
14:39:54disruptekit could be better if non-nil refs get impl.
14:40:39FromDiscord<Clyybber> I think it used to be that way
14:40:47FromDiscord<Clyybber> but since its better to just take the plunge (and now we did)
14:40:52FromDiscord<Clyybber> it got removed
14:41:04bungisNil is not prefered
14:41:10FromDiscord<Clyybber> So, yeah isNil isn't really any better than != nil
14:41:28FromDiscord<lqdev> honestly, all this arc business doesn't matter much to me. all i want to make me happy is incremental compilation
14:41:34FromDiscord<lqdev> which, afaik, is on hold.
14:41:36FromDiscord<lqdev> damn.
14:41:52FromDiscord<Yardanico> hmm, I read somewhere that isNil was preferred.
14:41:54FromDiscord<Yardanico> weird
14:41:58bungthe main resaon I guess is it introduce more bultin proc
14:42:02disrupteki prefer isNil.
14:42:17FromDiscord<Yardanico> sent a code paste, see https://play.nim-lang.org/#ix=2rxo
14:42:24FromDiscord<Yardanico> seems to work now
14:42:28FromDiscord<Clyybber> @Yardanico Probably during the 0.18 times
14:42:32FromDiscord<Yardanico> sent a code paste, see https://play.nim-lang.org/#ix=2rxp
14:42:49FromDiscord<Clyybber> but nowadays there is not difference. Although maybe isNil is better for drNim
14:43:36Oddmongerwhen i create a string seq with : var se = new_seq[string](1] , it creates a seq with typeof TaintedString
14:44:06Oddmongervar se = @["toto"] would create a seq of strings
14:44:21FromDiscord<lqdev> iirc `!= nil` didn't use to work back in 0.19.0, but I may be wrong.
14:44:21FromDiscord<Yardanico> uh no
14:44:29FromDiscord<Yardanico> it will only create TaintedString if you have tainted mode on
14:44:34FromDiscord<Yardanico> I think it's mostly abandoned nowadays
14:45:24Oddmongerif i have well understood, TaintedString has to be casted to string , for using as a string parameter ?
14:45:49FromDiscord<Clyybber> not casted, but converted
14:45:57FromDiscord<Clyybber> and only in taintedstring mode
14:46:45Oddmongerhummm ok , for now i will stick to @[…] notation
14:47:01bungany recommanded karax project? or I should give up try to use it
14:47:24Oddmongeri'm doing my tests with inim, maybe it would be different with the compiler
14:48:25FromDiscord<Yardanico> @Bung not sure what you mean 😛
14:50:08bungYardanico ah, I feel failure while using karax, it always suprised me, no framework like it, I have experience of backbone,angular,vue,react
14:51:13bungso am wonder if there is complete open source project use karax, so I can find something
14:51:42FromDiscord<Yardanico> nim forum
14:51:50FromDiscord<Yardanico> https://github.com/nim-lang/nimforum
14:53:37bungoh, thanks! didnot know it use karax
14:55:10FromDiscord<Yardanico> seems like my hooks work fine for sciter's values now
14:55:20FromDiscord<Yardanico> and they allow for proper copy semantics which is intuitive for primitive values
14:55:35FromDiscord<Yardanico> https://media.discordapp.net/attachments/371759389889003532/732248863422808084/unknown.png
14:56:35FromDiscord<exelotl> eh I don't really like isNil either... if it's different than `x == nil` then something is very wrong, but if it's the same as `x == nil` then what's the point :P
15:02:54FromGitter<oskca> @phillvancejr hi, have you fond a way to subclass a C++ object to interact with wxWidgets?
15:03:26FromDiscord<abisxir> Hi everyone, I was looking to understand something about destructors but could not find a proper explanation.↵Unfortunately the documentation about nim is not rich yet, can I ask my question here or I should write it somewhere else?
15:05:43FromDiscord<exelotl> @abisxir ask away! (though I personally won't be able to answer much lol)
15:06:06FromDiscord<abisxir> Cool @exelotl
15:07:11FromGitter<oskca> hi, @Araq, I'm using wxnim recently, it's great, but I havn't found a way to subclass wxWidget c++ class to handle some event like `wxDropTraget`, object of wxDropTarget doesn't work
15:10:13FromDiscord<abisxir> sent a long message, see http://ix.io/2rxu
15:10:28FromDiscord<Yardanico> @oskca are you using araq's wxnim or pmunch's wxnim?
15:10:35FromDiscord<Yardanico> pmunch's wxnim is more updated
15:10:39FromDiscord<Yardanico> https://github.com/pmunch/wxnim
15:10:46FromDiscord<Yardanico> @abisxir well you can do it certainly
15:11:06FromDiscord<abisxir> I know that if A = object, it I could write `=destroy` hook but what about ref objects?
15:11:20FromDiscord<abisxir> (edit) removed 'it'
15:11:26FromGitter<oskca> @Yardanico I'm using pmunch's wxnim
15:11:56FromGitter<oskca> and found it really good to gui work with `genui` macro
15:12:04FromDiscord<Yardanico> @abisxir you can have AObj = object ... A = ref AObj
15:12:08FromDiscord<Yardanico> and set a destroy hook for AObj
15:12:36FromDiscord<abisxir> I checked it, never reaches that point.
15:12:51FromGitter<oskca> but it seems there's is noway to subclass a c++ object and export back it to c++ world
15:12:53FromDiscord<Yardanico> it does, maybe not with default GC since it might not have time to collect
15:12:58FromDiscord<Yardanico> lemme show you an example
15:13:38FromDiscord<abisxir> In this example, it just call destructor for obj type never for ref type:
15:13:43FromDiscord<abisxir> sent a long message, see http://ix.io/2rxx
15:14:28FromDiscord<Yardanico> well refc destroy hooks might not be instant, I don't exactly know
15:14:32FromDiscord<Yardanico> with arc your example works as expected
15:15:12FromDiscord<abisxir> Hummm, can you show your example? @Yardanico
15:15:24FromDiscord<Yardanico> sent a code paste, see https://play.nim-lang.org/#ix=2rxA
15:15:25FromDiscord<Yardanico> with arc it works correctly
15:15:51FromDiscord<abisxir> arc is compiler option?
15:16:12*maier quit (Ping timeout: 265 seconds)
15:16:50FromDiscord<Yardanico> --gc:arc
15:17:13FromDiscord<Shucks> Arc is a new (?) garbage collector. With that said I want to mention that I don't get any of my stuff running with arc. Is there some documentation what I have to watch out for using arc?
15:17:20FromDiscord<Yardanico> it's not a GC, but yes
15:17:24FromDiscord<Yardanico> it's a new memory management model
15:17:45FromDiscord<Yardanico> @Shucks well first of all, for latest arc fixes you should be at least on 1.2.4, and documentation - well, not really
15:17:52FromDiscord<Yardanico> but some casts valid with refc are not valid with arc
15:18:02FromDiscord<Yardanico> (because they're not correct in nim at all, but refc allows them)
15:18:32FromDiscord<Shucks> Im on 1.2.4 but I guess didn't tried it again with 1.2.4. Gonna check it out
15:18:41FromDiscord<Yardanico> well you should show your error logs and stuff 😛
15:19:17FromDiscord<Shucks> Yea well i'm into that internal game hacking stuff. Debugging a injected dll is still a pain =/
15:19:29FromDiscord<abisxir> @Yardanico it works 🙂
15:19:42FromDiscord<Yardanico> @abisxir arc is still in a beta state though, so not all libraries work with it
15:21:07FromDiscord<abisxir> @Yardanico Good to know, however I do not use at the moment for production so I can play around, thanks.
15:23:25FromDiscord<gingerBill> Minor question. With Nim's Channel type, is there a way to do a nondeterminstic choice on multiple channels built-in e.g. Go's select statement?
15:23:54FromDiscord<lqdev> what does the select statement do?
15:23:57FromDiscord<exelotl> @abisxir if you want to learn more about arc, araq did a good talk on it for NimConf last month: https://www.youtube.com/watch?v=aUJcYTnPWCg
15:25:57FromDiscord<gingerBill> Go's select statement (non deterministic choice in CSP speak) allows you to wait on multiple channel operations
15:26:38FromDiscord<abisxir> @exelotl Cool 🙂
15:27:20FromDiscord<Anuke> Is there some way to cross-compile from Linux->Windows with nimterop? Looking at the nimterop's `shell.nim`, there are multiple chunks of code with `when defined(Windows):` that run when I'm using mingw as my compiler (`--gcc.exe:x86_64-w64-mingw32-gcc`), leading to use of `cmd` (which fails). It also uses backwards slashes in the paths when executing.↵↵Context: I'm trying to compile the soloud wrapper. My code works on Linux.
15:28:16FromDiscord<Recruit_main707> maybe you can do -d:linux, i am not sure at all though
15:28:37FromDiscord<lqdev> @Anuke no, that's not supported.
15:28:38FromDiscord<Yardanico> @Anuke i mean if you're cross-compiling you should always do --os:windows
15:28:46FromDiscord<Yardanico> not sure if nimterop supports it though
15:28:48FromDiscord<lqdev> @Yardanico the problem is nimterop
15:29:21FromDiscord<lqdev> nimterop has some issues when dealing with windows, because it can't detect the OS the program is being built on
15:29:33FromDiscord<Anuke> I do use `--os:windows`, and it compiles/runs when I'm not using nimterop
15:29:51FromDiscord<lqdev> ping shashlick
15:30:11FromDiscord<lqdev> ↑ he can explain the situation better to you
15:33:35AraqgingerBill: you can tryRecv or peek but it's a crude mechanism
15:33:37shashlickthis is a nim issue - I can hack around it but it is problematic
15:33:53Araqshashlick, ha, we'll see about that :P
15:33:56shashlickas soon as you set --os:windows, every when defined goes down the windows route
15:34:03shashlickso anything compile time won't work
15:34:22shashlickthere's no concept of build os vs target os
15:34:51FromDiscord<Anuke> Could I generate the wrapper file, then import that file instead of running nimterop every time?
15:35:15shashlickyes that's supported now
15:35:17shashlickmight still be bugs but that's the aspiration
15:35:17FromDiscord<lqdev> yes, you can pass an extra `nimFile` argument to cImport
15:35:40*NimBot joined #nim
15:35:46Araqshashlick, there is nimscript.buildOS
15:35:47bungoh I got the point, I can use runDiff directly
15:36:08shashlickbut i'm in the VM, not in nimscript
15:36:18shashlickanyway, i cannot use any of the stdlib then
15:36:32FromDiscord<Clyybber> @gingerBill Theres a prototype to do the CSP transformations as a macro
15:36:34shashlickecho DirSep will print '\' on linux
15:37:13Araqwell you said --os:windows, what else should it do
15:37:39FromDiscord<gingerBill> @Clyybber whereabouts?
15:38:18FromDiscord<Clyybber> https://github.com/zevv/nimcsp but its not finished afaik
15:38:19FromDiscord<lqdev> @Yardanico there's a thing for you to fix in ircord: you don't escape \ when bridging from IRC to Discord
15:38:33FromDiscord<Yardanico> should I?
15:38:41FromDiscord<Yardanico> i don't really handle markdown at all currently
15:38:45FromDiscord<lqdev> um, yes? https://media.discordapp.net/attachments/371759389889003532/732259724946571375/unknown.png
15:39:40disruptekgingerBill: my fork is a little more advanced.
15:40:09disruptekbut this is cps, not csp.
15:40:16Araqlol
15:40:24disruptekit's a completely different animal.
15:40:53shashlick--os:windows is the target
15:41:14shashlickThe premise of os is cross compilation
15:41:35shashlickWhy should it affect compile time
15:41:53disruptekwhen else should cross compilation occur?
15:42:27shashlickThe vm is on the build os and should not get affected by os:windows which is meant for the code gen
15:43:05Araqconst DirSep = when defined(windows): '\\' else: '/'
15:43:15Araqit's not VM related
15:43:33disruptekshashlick: make a pr to perform compilation without the vm.
15:43:34Araqecho DirSep # --os:windows, should produce '\\'
15:43:45shashlickYes but when you call dirsep in the vm it should know its still on Linux
15:43:47disruptekthe vm is dead code anyway.
15:44:03Araqdisruptek, it's not (yet)
15:44:14disruptekoh right.
15:44:29FromGitter<alehander92> Recruit haha
15:44:36FromGitter<alehander92> what happens to the vm
15:44:49Araqshashlick, the problem is real but the solution cannot be that everybody has to be constantly reminded of the fact that 'when defined' needs special casing for cross compiling
15:44:54disruptekwhat happens in the vm stays in the vm.
15:45:05FromGitter<alehander92> i missed that
15:45:08FromGitter<alehander92> i am writing C these days
15:45:29shashlickIf the vm ignores --os, it will just work
15:45:30disruptekyou really forgot what a typeclass is?
15:45:38FromGitter<alehander92> i think
15:45:38FromDiscord<gingerBill> Thank you
15:45:43disruptekyeesh, dude we need you writing more nim.
15:45:44FromGitter<alehander92> i never really knew what it is
15:45:45shashlickNothing ends users need to do, or even the stdlib
15:45:59FromGitter<alehander92> i mean, except some kind of intuitive-based overall impression
15:46:15FromGitter<alehander92> now i feel it's a collection of constraints?
15:46:26disruptekdude, it's hardly even a thing.
15:46:34FromGitter<alehander92> i even read it's doing ad hoc polymorphism
15:46:35disruptekit's just an `or`.
15:46:49FromGitter<alehander92> it was like something like a haskell interview
15:46:55disruptekit's as simple as it looks in your editor.
15:47:02disruptekfunny, that.
15:47:40FromDiscord<Clyybber> I think the typeclasses he meant are more like concepts in nim
15:47:52FromDiscord<Clyybber> as in a set of properties that define a typeclass
15:48:03disruptekin haskell, sure.
15:48:15FromDiscord<Clyybber> its equivalent to the concept of a class in mathematics as opposed to a set
15:48:20FromGitter<alehander92> yeah i was trying to explain that a typeclass is like a group of predicates
15:48:21FromGitter<alehander92> on types
15:48:26FromDiscord<Clyybber> yeah, thats correct
15:48:30disrupteksounds fine to me.
15:48:31FromGitter<alehander92> but i feel they were looking at me funny
15:48:35Araqshashlick, as I said, DirSep is a const and the VM isn't even involved
15:48:37FromGitter<alehander92> no, they were cool
15:48:45FromGitter<alehander92> they didn't even ask me about monads
15:48:46FromDiscord<Anuke> After un-including the nimterop generator file and copying the generated `nimFile` into my project, I get linker errors after building, e.g. `undefined reference to `Soloud_init'`. This is on Linux, no cross-compilation. Do I need to give it some additional pragmas that aren't included in the generated file?
15:49:09FromGitter<alehander92> i talked to them about nim a bit`
15:49:19FromGitter<alehander92> they were like what are its strongest points
15:49:25FromGitter<alehander92> and i started with the type system
15:49:30shashlickAraq: I won't claim to understand the details, just the symptoms which you understand
15:49:50FromGitter<alehander92> like advertising bmw engines to airplane people
15:50:15shashlickgiven how powerful the vm is, i'd like to use it in the cross-compilation scenario
15:50:17FromGitter<alehander92> but i think the z3 thing usually picks up a bit of interest
15:50:25FromGitter<alehander92> z3<->nim*
15:50:29shashlickbut i'm also moving more of nimterop into runtime so that I don't have to keep fighting the vm
15:50:45shashlickAnuke: what does your wrapper and generated output look like
15:51:50FromDiscord<Anuke> nimterop code: https://play.nim-lang.org/#ix=2rxE
15:52:29FromDiscord<Anuke> generated code: https://play.nim-lang.org/#ix=2rxI
15:53:04shashlickAnuke: cCompile and getHeader doesn't get forwarded to nimFile
15:53:21shashlicklines 26 - 46
15:53:30shashlickthat's still an open for standalone wrappers
15:56:22FromDiscord<Anuke> I see
15:58:49FromDiscord<Anuke> It compiles on linux again, but on mingw `cCompile` calls `shell -> execAction`, which leads to me to the same problem
16:03:04FromDiscord<Yardanico> @shashlick seems like I found pure-C sciter headers
16:03:09FromDiscord<Yardanico> https://github.com/sciter-sdk/go-sciter/tree/master/include in here
16:03:21FromDiscord<Yardanico> "This binding ueses a tailored version of the sciter C Headers, which lives in directory: include. The included c headers are a modified version of the sciter-sdk standard headers."
16:05:33shashlickspecial stuff for Go, no fair
16:05:41shashlickAnuke: let me see
16:05:56FromDiscord<Yardanico> @shashlick well that person did go bindings from the C headers too
16:06:04FromDiscord<Yardanico> I will try to use their headers, just so we have less hassle
16:07:57shashlickAnuke: looks like cCompile doesn't use walkDir - back when it was implemented, that wasn't allowed in the VM
16:08:11shashlickso had to spawn to shell
16:08:26*narimiran quit (Ping timeout: 256 seconds)
16:08:45shashlickregardless, more of the same - walkDir might not work as expected in cross-compilation scenario
16:09:46shashlickare you still trying to cross compile
16:10:05shashlick@Yardanico - is everything accessible
16:10:14FromDiscord<Yardanico> well wdym?
16:10:44shashlickare all procs still available or only a subset
16:13:07FromDiscord<Yardanico> well it seems to even work without --noHeader with a bit of manual fixes
16:13:27FromDiscord<Yardanico> although I think I'll still use --noHeader because otherwise it's a bit pointless
16:13:36FromDiscord<Yardanico> since I only will use sciter as a library since I don't have access to it's source code 🙂
16:14:03FromDiscord<Yardanico> and the go-sciter header version is a bit outdated
16:14:45shashlickabout `noHeader` - While `{.header.}` can be omitted for convenience, it does prevent wrapping of `static inline` functions as well as type checking of the wrapper ABI with `-d:checkAbi` at compile time.
16:14:53shashlickFurther, anonymous nested structs/unions within unions will be rendered incorrectly by Nim since it is unaware of the true memory structure of the type. The user will need to choose based on the library in question.
16:15:31disruptekshashlick: you sound like your README.
16:15:42FromDiscord<Anuke> Even when I replace some of the `defined(...)` values with `true/false`, I still run into problems (probably caused by the different path separator). I might try a different sound library, or get a separate build server for this
16:15:42shashlickI just channeled the readme 😄
16:15:59FromDiscord<Yardanico> @shashlick well yeah, but as I said for me using the header version makes to sense
16:16:00shashlickAnuke: do you have to cross-compile?
16:16:23shashlickjust highlighting the cons Y, hard lessons let's say
16:16:33FromDiscord<Yardanico> "loading" sciter APIs is really simple
16:17:00FromDiscord<Anuke> I don't *have* to, but it's convenient to just run one command on my main machine and have all the binaries built for distribution
16:17:03FromDiscord<Yardanico> you just load the dll, find the SciterAPI symbol, cast it to a SciterAPI_ptr type and call that as a procedure
16:17:08FromDiscord<Anuke> (and it's worked until now)
16:17:11FromDiscord<Yardanico> and you get a pointer to a struct with all functions
16:17:15FromDiscord<Yardanico> like an interface
16:18:15shashlickAnuke: making cross-compilation work is a big effort so I won't commit to that right now, but let's say i'll remove the cCompile dep on execAction and make sure cCompile and cDefine gets rendered in the generated wrapper
16:19:52FromDiscord<Anuke> Alright, thanks
16:19:55FromDiscord<Yardanico> btw @shashlick, I don't think your wchar_t thing is right for the C backend
16:20:07FromDiscord<Yardanico> maybe you wanted to do when not defined(cpp) ?
16:20:34FromDiscord<Yardanico> wchar_t with importc just works for me
16:21:02*Trustable joined #nim
16:21:12FromDiscord<Yardanico> with both clang/gcc, although I'm not sure when they got that support for using "wchar_t" in C
16:21:57shashlickthat was from timothee, not sure on details
16:21:58FromDiscord<Yardanico> ah actually in C it's in stddef.h
16:22:09FromDiscord<Yardanico> type wchar_t* {.importc.} = object works for me with C backend
16:22:09shashlickis it wrong? https://github.com/nimterop/nimterop/blob/master/nimterop/toastlib/getters.nim#L136
16:22:19FromDiscord<Yardanico> yeah, seems so
16:22:20FromDiscord<Yardanico> for the C backend
16:22:34FromDiscord<Yardanico> see e.g. https://pubs.opengroup.org/onlinepubs/7908799/xsh/stddef.h.html
16:22:37FromDiscord<Yardanico> or https://www.tutorialspoint.com/c_standard_library/stddef_h.htm
16:22:51FromDiscord<Yardanico> stddef.h defines wchar_t in the C library
16:23:23FromDiscord<Yardanico> or https://en.wikibooks.org/wiki/C_Programming/stddef.h#Type_wchar_t
16:24:18FromDiscord<Yardanico> so basically in "else" you would want to replace header with "stddef.h"
16:24:28FromDiscord<Yardanico> since that else is for other backends than cpp
16:24:28shashlickhopefully @timotheecour can respond to that
16:24:33shashlickelse appreciate a PR
16:25:28shashlickjust changing to stddef.h in else? that's easy enough
16:25:42FromDiscord<Yardanico> yeah
16:25:53FromDiscord<Yardanico> type wchar_t* {.importc, header: "stddef.h".} = objec
16:25:59FromDiscord<Yardanico> t
16:26:36shashlickOk I'll take care of it
16:35:15FromDiscord<Yardanico> what's the proper way to pass a Nim procedure to a C API function that expects a pointer to a procedure?
16:35:31FromDiscord<Yardanico> just cast the proc like cast[ptr CProcType](myNimProc) ?
16:36:33FromDiscord<Yardanico> because I'm trying to compile it with cpp backend (just for fun), and I'm getting for example
16:36:38FromDiscord<Yardanico> error: cannot initialize a parameter of type 'tyProc__H5cILfOL8wUwLVLz7ePbLQ *' (aka 'bool (**)(void *, void *)') with an lvalue of type 'bool (void *, void *)'
16:37:23FromDiscord<Yardanico> where I'm doing cast[ptr SciterElementCallback](elemFoundCb) and the C API function is proc SciterSelectElements*(he: HELEMENT; CSS_selectors: LPCSTR; callback: ptr SciterElementCallback; param: LPVOID): INT {.importc, cdecl.}
16:37:49*ForumUpdaterBot quit (Remote host closed the connection)
16:37:57*ForumUpdaterBot joined #nim
16:43:00FromDiscord<dom96> Why do you need to cast?
16:43:12FromDiscord<dom96> You should be able to give the proc the signature that is needed
16:43:50FromDiscord<Yardanico> well I'm using nimterop
16:43:55FromDiscord<treeform> hmm I am getting this error can I changed nothing? `io.nim(342): error C2664: 'BOOL SetHandleInformation(HANDLE,DWORD,DWORD)': cannot convert argument 1 from 'int' to 'HANDLE'` I did not install new nim, I did not install new VC++, but now I am getting strange cast error?
16:44:00FromDiscord<Yardanico> so, for context
16:44:02FromDiscord<Yardanico> typedef BOOL SC_CALLBACK SciterElementCallback( HELEMENT he, LPVOID param );
16:44:09FromDiscord<Yardanico> SCDOM_RESULT SCFN( SciterSelectElements)(HELEMENT he, LPCSTR CSS_selectors, SciterElementCallback* callback, LPVOID param);
16:44:32FromDiscord<treeform> Can a windows update break Nim?
16:44:32FromDiscord<dom96> using nimterop shouldn't change anything
16:44:35FromDiscord<Yardanico> for that nimterop makes SciterSelectElements*: proc (he: HELEMENT; CSS_selectors: LPCSTR; callback: ptr SciterElementCallback; param: LPVOID): INT {.cdecl.}
16:44:39FromDiscord<Yardanico> see ptr here
16:45:09FromDiscord<dom96> > Can a windows update break Nim?↵@treeform are you using vcc? I guess that might have been updated using Windows Update?
16:46:41FromDiscord<dom96> @Yardanico have a look at some mature wrappers/libraries and see how they pass callbacks
16:47:06FromDiscord<KrispPurg> Is there a quicker way to get the first key from the table?
16:47:23FromDiscord<Yardanico> "first" key?
16:47:28FromDiscord<Yardanico> tables are not ordered
16:47:32FromDiscord<Yardanico> you need an OrderedTable for order
16:49:04FromDiscord<KrispPurg> well, besides the orderedtable
16:49:30FromDiscord<Yardanico> why?
16:49:43*waleee-cl joined #nim
16:50:37FromDiscord<Yardanico> @dom96 well the existing solutions are not really a reference to me because Sciter does something like an interface - it gives you a struct with pointers to its' functions
16:51:27FromDiscord<Yardanico> or maybe it's just because sciter does some double reference stuff and that's why it needs *, idk
16:51:57Oddmongerif i do: var a="toto"
16:52:05bungin karax can I run diff by vnode key ? otherwise it add all new items, I meant to reset
16:52:08Oddmongervar b=addr(a)
16:52:18FromDiscord<KrispPurg> Well, in order for me to insert a message to the table, if a limit to the table has reached then it will delete the first element then add it to the table
16:52:20Oddmongerhow can i display the address ?
16:52:34Oddmongeri get template errors with echo b
16:52:50FromDiscord<treeform> @dom96 yes I am using VC++ does Windows Update update VC++? Can VC++ auto update?
16:54:00FromDiscord<dom96> No idea, I'm just speculating
16:56:49FromDiscord<Yardanico> @Oddmonger echo cast[uint](b)
16:56:51FromDiscord<Yardanico> for example
16:56:56FromDiscord<Yardanico> or "repr b"
16:56:59FromDiscord<Yardanico> should also work
16:57:03FromDiscord<Yardanico> echo repr b
16:57:30Oddmongerahh thank you
17:13:05FromDiscord<Varriount> treeform: What behavior are you seeing?
17:20:17*endragor quit (Remote host closed the connection)
17:20:45*endragor joined #nim
17:26:21FromDiscord<Shucks> Woop woop code runs with arc
17:26:25FromDiscord<Clyybber> \o/
17:26:26ZevvClybber: it's not not finished, it even hasn't properly started
17:26:34disruptekrude.
17:26:37FromDiscord<Clyybber> But it does *something* right?
17:26:49FromDiscord<Shucks> I guess I really made some casts which don't have to be ;p
17:27:28ZevvWell, it's not like it's running or something. It does some of step 1-out-of-3 for the required transformations
17:28:44FromDiscord<Clyybber> Oh, I thought it already worked a bit
17:29:10FromDiscord<Clyybber> disruptek: How far did you continue it?
17:29:57disruptekabout this far: --> <--
17:30:03FromDiscord<Clyybber> nice
17:30:04ZevvHe fixed some of step 1
17:30:24disruptekwell, i haven't pushed to zevv's branch recently.
17:31:09*endragor quit (Ping timeout: 272 seconds)
17:31:20Zevvthere's no local lifting yet, and I'm not sure how nasty that will become. Ar4q mentioned something undocumented in the compiler, but I'm not sure if that can do the work for us at macro-time
17:31:20disrupteki'm noodling around trying to figure out how i want tests to work right now, because i started to get bogged down in optimizations.
17:31:39ZevvI don't have a holiday project yet, so I might or might not pick it up
17:31:42Zevvdepends on how bored I get
17:32:05disrupteki will be working on local lifting today.
17:32:09Zevv\o/
17:32:09*clemens3 quit (Read error: Connection reset by peer)
17:32:12Zevvdude
17:32:31FromDiscord<Clyybber> disruptek: NICE!!!
17:32:40disruptek?
17:32:52FromDiscord<Clyybber> i'm hyped bro
17:33:57Zevvuse that energy man, lift some locals!
17:34:28*clemens3 joined #nim
17:34:31FromDiscord<lqdev> someone said… LOCAL LIFTING?
17:34:43FromDiscord<Clyybber> I'm wrestling with scopes rn
17:34:46Zevvyeah, we could use some muscle!
17:34:53FromDiscord<Yardanico> i'm fishing with my hooks rn
17:35:13disruptekthe control flow seems harder, honestly.
17:35:21FromDiscord<lqdev> #11274 please
17:35:22disbothttps://github.com/nim-lang/Nim/issues/11274 -- 3Parameter default value equal to another parameter - works only from top level ; snippet at 12https://play.nim-lang.org/#ix=2r6J
17:38:06FromDiscord<Clyybber> @lqdev Hmm, interesting issue
17:38:36FromDiscord<Clyybber> I think we need to do some restrictions on default values
17:38:42disruptekZevv: i think we've done 3 of 5 xfrms.
17:38:47FromDiscord<Clyybber> For example that they can only depend on other parameters left of them
17:39:00FromDiscord<lqdev> yeah, but that's what the example does.
17:39:16Zevvdisruptek: of only bare bone control flow. no for loops, for example
17:39:25Zevvbut fair enough, 3 out of 5 sounds about right
17:39:29disrupteki'm okay with that.
17:39:34FromDiscord<lqdev> also, nim devs - anyone working on IC?
17:39:40disrupteknope.
17:39:42FromDiscord<lqdev> or is it still on hold?
17:39:46FromDiscord<lqdev> damn
17:40:35disruptekthe mangling branch solves some bugs in my ic branch, but the mangling branch doesn't work yet, either.
17:40:45FromDiscord<Clyybber> :p
17:40:45disruptekwhat can i say... i'm a terrible programmer.
17:40:50FromDiscord<Clyybber> nah
17:41:16FromDiscord<Clyybber> maybe you are just tackling the hard stuff
17:41:22FromDiscord<Clyybber> which is great
17:41:54disruptekthe blocker for mangling is that we need to figure out how to resolve mangling between multiple modules that may/may-not be compiled yet.
17:42:06disruptekit's an annoying problem.
17:42:09Araqdisruptek, please tell me more
17:43:32disruptekwell, it feels like it should be sufficient to just fold two modules and get them to agree on a foreign symbol, but i had trouble making it work.
17:44:19Araqyou mean because of the conflict resolution rule?
17:44:34disrupteki think modules have to have a hierarchy so that subsequent eval doesn't change a dominant symbol collision.
17:44:43disruptekyes, conflict resolution.
17:44:55disruptekwe could use file index, for example.
17:45:11Araqyou set s.loc.r = computeName(s.getModule, s)
17:45:25Araqs's module has the count table
17:45:47Araqyou cannot produce the name without the BModule that 's' belongs to
17:46:02Araq(sorry if I'm stating the obvious)
17:47:01disruptekthis is done.
17:48:30Araqwell if you store the mangled name in s.loc.r consistency is ensured
17:48:54*rockcavera joined #nim
17:51:02bung`autocomplete(self.searchBox, onSelect,nref=autoRef);...;proc cb(httpStatus: int; response: cstring) = autoRef.choices.add(data[j].show.name)`
17:52:00bungwhat's problem with my code ? I want manage state out of the component
17:52:47bungit will only add one item, then ` at Array.HEX3Aanonymous_11925001 (app.js:3076)`
17:52:49bung at broadcast_11511313 (app.js:3329)
17:53:11Araquse the nativenodes.nim ideas for components
17:53:20*fredrikhr quit (Read error: Connection reset by peer)
17:53:46*fredrikhr joined #nim
17:54:03Araqeverything else is unreliable and components are fundamentally at odds with DOM diffing
17:55:43bungoh , I check the code, very new to me , let me try it
17:55:52disruptekhmm, mangling branch is passing tests.
17:57:47disruptekah, it fails stdlib/tmath.nim.
17:59:17FromDiscord<Clyybber> guddamn math
17:59:46FromDiscord<Clyybber> Aaah, finally got my PR to work
18:03:14FromDiscord<Yardanico> Pony is dying!
18:03:21disruptekgive it water.
18:04:24FromDiscord<Clyybber> @Yardanico but less so now :D
18:05:12FromDiscord<Clyybber> optimized the temporary, now it doesn't have to die uninitialized
18:07:52FromDiscord<Yardanico> oh nice
18:11:38disrupteklqdev: if you want to pick up mangling, i'm happy to help.
18:11:57disruptekgetting it merged would make ic a much smaller diff.
18:13:52bungAraq I cant't get the idea, I tried code like this https://play.nim-lang.org/#ix=2ryf
18:16:40bungI have a Carousel component ,since it just request initial data so I `runDiff(kxi,self.expanded,render(self))` just fine.
18:17:11FromDiscord<dom96> > Pony is dying!↵@Yardanico it is?
18:17:21FromDiscord<Yardanico> not anymore
18:17:22FromDiscord<Yardanico> but it was
18:17:22FromDiscord<Yardanico> https://github.com/nim-lang/Nim/blob/95938164f0609171893574370af9ebbe255be90d/tests/destructor/tmove_objconstr.nim#L50
18:17:38FromDiscord<dom96> lol, I thought you meant the programming language
18:17:52FromDiscord<Clyybber> lol
18:18:10bungwell with search result, it add newer items while I meat to reset
18:21:12FromGitter<alehander92> me too
18:22:21Araqbung, if you rebuild the list anyhow there is no point in dthunk vnodeToDom
18:29:25*opal quit (Remote host closed the connection)
18:29:57*clemens3 quit (Read error: Connection reset by peer)
18:30:23bunghmm , I use unsafe proc now ,proc runDiff*(self:AutocompleteComponent) = runDiff(kxi,list,myList(self))
18:30:39*opal joined #nim
18:32:51*clemens3 joined #nim
18:34:00*endragor joined #nim
18:35:15bunghmm, now every thing as I expected as I manually runDiff to every changed node
18:38:22*maier joined #nim
18:38:50*endragor quit (Ping timeout: 256 seconds)
18:39:54*bung quit (Quit: Lost terminal)
18:42:56*xet7 joined #nim
18:43:12FromDiscord<Yardanico> guess I should split this over multiple lines 😄
18:43:14FromDiscord<Yardanico> cast[ptr seq[tuple[key, value: SciterVal]]](param)[].add (SciterVal(impl: pkey), SciterVal(impl: pval))
18:47:55*endragor joined #nim
18:49:22FromDiscord<Clyybber> Araq: https://github.com/nim-lang/Nim/pull/14964 is now ready :D
18:49:23disbotinjectdestructors fixes and refactor
18:50:37FromDiscord<Yardanico> doesn't look pretty and I don't even know if what I'm doing is correct, but kinda works https://media.discordapp.net/attachments/371759389889003532/732308013997883474/unknown.png
18:50:50FromDiscord<Yardanico> I'm just not sure about threading with sciter
18:50:55FromDiscord<Yardanico> does it use separate threads or not and other stuff
18:51:16livcdthere were definitely issues with goroutines
18:51:23FromDiscord<Yardanico> (it just has a special param for callbacks so you can pass any pointer for your data)
18:53:20*endragor quit (Ping timeout: 256 seconds)
18:53:44livcdYardanico: did you manage to wrap it already? :O
18:54:35FromDiscord<Yardanico> nonono
18:54:47FromDiscord<Yardanico> I mean you can already use it with low-level APIs
18:55:03FromDiscord<Yardanico> I'm just adapting code from the old wrapper and also simplifying some parts a bit
18:55:05FromDiscord<Yardanico> I ported the value procedures
18:55:12FromDiscord<Yardanico> so you can have a high-level wrapper for sciter values
18:55:55FromDiscord<Yardanico> I wrapped the raw pointer to the sciter value in an object which has custom =, =destroy and =sink
18:55:59FromDiscord<Yardanico> and so far it actually works pretty well
18:58:07AraqClyybber: great but I don't understand it
18:58:30Araqwhat's wrong with my approach? it was more explicit
18:58:42FromDiscord<Clyybber> But it didn't retain the order
18:58:59FromDiscord<Clyybber> And my approach is simpler
18:59:06FromDiscord<Clyybber> We assign the result to a temporary now if needed
18:59:18Araqfor you. for me it's just different :P
18:59:22FromDiscord<Clyybber> And insert the =destroy calls, and return the temporary
19:00:25Araqbeware of 'let a = "string" '
19:00:48FromDiscord<Clyybber> took care of all that
19:01:01Araqmy cursorfier turns it into plain copyMems
19:01:20FromDiscord<Clyybber> ah!
19:01:21Araqof 2 machine words, so soon enough it won't test what you want to test anymore
19:01:22FromDiscord<Clyybber> nice
19:01:34Araqmaybe we need --cursorInference:off
19:01:39disruptek#14971
19:01:41disbothttps://github.com/nim-lang/Nim/issues/14971 -- 3OrderedTable del and pop are slow ; snippet at 12https://play.nim-lang.org/#ix=2ryn
19:01:43disruptek!repo skiplists
19:01:44disbothttps://github.com/disruptek/skiplists -- 9skiplists: 11generic skip list implementations 15 1⭐ 0🍴
19:01:59FromDiscord<Clyybber> Araq: Does cursor inference apply to all types?
19:02:03FromDiscord<Clyybber> Or only ref types?
19:03:28FromDiscord<Clyybber> I mean I can change the tests to use something other than string instead
19:04:49*Vladar quit (Quit: Leaving)
19:05:55FromDiscord<Clyybber> Araq: Do we have a way to tell testament to run a testcase with different commands?
19:06:05FromDiscord<Clyybber> for testing option combinations
19:06:14Araqyeah it supports 'matrix'
19:06:23Araqbut I forgot its name
19:06:41Araqand it's not for ref-only types, it's for all types that have a non-trivial destructor
19:06:51Araqso you're out of luck :P
19:06:55FromDiscord<Clyybber> :D
19:06:58Araqmore importantly though
19:07:19Araqthe code is now convoluted IMO, the cleaner approach would be to "statementize" the AST first
19:07:31*dannyhpy joined #nim
19:07:38Araqand then compute =sink, =, =destroy on the statementized AST
19:07:53Araqit would also make my optimization phases simpler
19:08:12Araqcurrently we need to deal with e.g. nkIfExpr in 4 places
19:08:12FromDiscord<Clyybber> I thought about that too, and we actually in a way do that now
19:08:26FromDiscord<Clyybber> but statementizing it before looses information
19:08:34FromDiscord<Clyybber> we use for optimization
19:08:40Araqwhich information?
19:08:40FromDiscord<Clyybber> for example in moveOrCopy
19:09:44Araqalso: the fact that we translate 'try' in the C backend means I cannot apply wasMoved+destroy elision as often as I would like
19:10:15Araqquite a legacy system now
19:10:31FromDiscord<Clyybber> when we statementize before processing we will end up with unneccessary temporaries
19:10:33FromGitter<deech> I can separate a closure into a function pointer and an environment with `rawProc` and `rawEnv` but how do I go the other way? Reforming a closure with a fp and env?
19:10:35FromDiscord<Clyybber> for example in moveOrCopy
19:10:46FromDiscord<Clyybber> but I agree that we should move this stuff out of cgen
19:11:20Araqthe temporaries are no sweat for the cursorfier
19:12:05Araqdeech: you can maybe construct a tuple and 'cast' it to a closure
19:12:22Araqbut I have never done that and the GC wants to own the closure
19:13:25FromGitter<deech> Right now I'm wrapping it like: `proc () = cast[proc () {.nimcall}](f)(env)`. Not sure if that's safe or not.
19:15:06*vicfred joined #nim
19:16:13Araqcompile with --gc:arc and ask valgrind about it :-)
19:16:25Araqlooks ok from here
19:16:48FromGitter<deech> Yep will do. Just wanted to make sure there wasn't some stdlib function I was missing.
19:17:52*oriba joined #nim
19:18:00FromDiscord<Varriount> Araq, clyyber: I know I don't do any compiler programming, but a cleaner codebase sounds like a good direction to go in.
19:20:57Araqnothing we do is a substitute for reading a good book about compiler construction
19:21:03disruptekrude.
19:21:17Araqsorry
19:23:26*Shucks joined #nim
19:23:29ShucksHey Shucks!
19:23:37FromDiscord<Shucks> Hey
19:23:48FromDiscord<Yardanico> Hello Yardanico!
19:23:50Yardanicohi there!
19:23:59FromDiscord<Shucks> Oh, you got a twin aswell
19:24:02FromDiscord<Varriount> O_o
19:24:09*Araq sighs
19:24:11disruptekdisbot: ignore these knuckleheads.
19:24:12disboton it. 👍
19:24:25disruptekAraq: it's just a culture clash, man.
19:24:36disruptek'mericans would rather talk than listen, write than read.
19:24:49FromDiscord<Shucks> Everyone should have that irc bots. So I can finally kick off that discord malware ;p
19:24:52FromDiscord<dom96> o/
19:24:53dom96\o
19:24:59FromDiscord<Yardanico> 🤦
19:25:10FromDiscord<Yardanico> xdd
19:28:10FromDiscord<Yardanico> I guess for high-level sciter wrapper I'll just look in how python/go wrappers do it
19:28:40FromGitter<alehander92> AMERICA
19:28:45FromDiscord<Yardanico> lol
19:29:14FromGitter<alehander92> am i late
19:29:25FromGitter<alehander92> for the spam evening
19:31:05FromDiscord<dom96> https://tenor.com/view/noice-brooklyn-ninenine-b99-smile-gif-11928987
19:31:10FromDiscord<dom96> 4 files changed, 69 insertions(+), 19 deletions(-)
19:31:25FromDiscord<Clyybber> Varriount: For sure
19:32:02FromDiscord<Yardanico> @dom96 mine was cooler 😛
19:32:11FromDiscord<Yardanico> I got 77.777MiB peak mem with nim compiler yesterday
19:32:14FromDiscord<Clyybber> Araq: So good to merge?
19:33:51FromDiscord<dom96> @Yardanico 69.69696969 would have been cooler
19:35:27*endragor joined #nim
19:35:29Araq<Clyybber>, no, I need to review it carefully
19:35:38Araqand I need a break. good night
19:35:42Araqoh
19:35:52Araqbut you can already rewrite your template
19:35:56Araqinto a proc
19:36:02Araqlong templates suck
19:36:05Araqbbl
19:36:10FromDiscord<Clyybber> Tried that, but because of captures it doesn't work
19:36:19FromDiscord<Clyybber> good night
19:39:18*fredrikhr quit (Read error: Connection reset by peer)
19:39:41*fredrikhr joined #nim
19:41:08FromGitter<alehander92> oi
19:44:01*endragor quit (Ping timeout: 264 seconds)
19:51:18*fredrikhr quit (Read error: Connection reset by peer)
19:51:43*fredrikhr joined #nim
19:54:15FromGitter<bung87> can I mapping new TypeA to js object constructor?
20:06:09*haxscramper joined #nim
20:10:13*xet7 quit (Quit: Leaving)
20:13:54*maier quit (Ping timeout: 240 seconds)
20:30:56*narimiran joined #nim
20:33:47*haxscramper quit (Remote host closed the connection)
20:36:49*endragor joined #nim
20:39:19FromDiscord<Yardanico> lol https://media.discordapp.net/attachments/371759389889003532/732335365830213745/unknown.png
20:40:44FromDiscord<Shucks> fake. It says simple calculator. That calculation isn't simple at all!
20:40:59*endragor quit (Ping timeout: 240 seconds)
20:42:23FromDiscord<Yardanico> although I did the whole thing in the native part
20:42:38FromDiscord<Yardanico> a better solution is to expose native functions to TiScript (Sciter's scripting language)
20:42:48*endragor joined #nim
20:42:52FromDiscord<Yardanico> because UI is usually callbacks, and backend is linear usually
20:43:36FromGitter<alehander92> bung87 it depends
20:43:45FromGitter<alehander92> object construction should be .. object construction
20:43:59FromGitter<alehander92> it should do the `new` thing anyway if its ref i think
20:44:09FromGitter<alehander92> (without needing to write new)
20:45:26FromDiscord<Wikipedia> that is cool calculator
20:45:36FromDiscord<Shucks> Which ui framework are you using?
20:45:48FromDiscord<Shucks> Gosh im highlighting myself all the time. Gonna quit discord lol
20:50:20shashlick@lqdev - you around?
20:51:27FromDiscord<Yardanico> @Shucks playing around with sciter
20:57:01*endragor quit (Ping timeout: 258 seconds)
20:57:07*narimiran quit (Ping timeout: 246 seconds)
20:57:43FromGitter<bung87> alehander92 well, I can do `new TypeA`, but how to do `new TypeA(p)`, I see some mapping as `newTypeA`
20:59:55FromDiscord<Varriount> Is it possible to change a discriminator field in an object without copying it? I seem to recall some changes made recently that affected that functionality
21:00:14*bung joined #nim
21:03:08FromDiscord<lqdev> shashlick: hold on a sec, I'm playing Worms
21:05:11FromDiscord<lqdev> alright
21:05:17FromDiscord<lqdev> shashlick: what is it?
21:09:13shashlickhttps://github.com/tree-sitter/tree-sitter-c/issues/49 is why that type in freetype wasn't getting rendered properly
21:09:15disbotCast using non-standard type leads to call_expression ; snippet at 12https://play.nim-lang.org/#ix=2rz1
21:09:34shashlickwanted to check what was in your freetype_include.h
21:11:48*endragor joined #nim
21:13:06FromDiscord<lqdev> ```c↵#include <ft2build.h>↵#include FT_FREETYPE_H↵```
21:13:39shashlickokay cool
21:13:43shashlicki have a working wrapper if you want
21:14:35FromDiscord<lqdev> no need for that, I'm good with my minimalist wrapper
21:15:11shashlickokay cool
21:17:04*endragor quit (Ping timeout: 246 seconds)
21:18:20shashlickhttps://gist.github.com/genotrance/cf45b0ce3e7c57f32b7673cf64f977b9 if anyone needs it
21:28:54FromDiscord<Yardanico> well, seems like it's not so simple with destroy
21:28:58FromDiscord<Yardanico> so basically the issue I'm having with values
21:29:08FromDiscord<Yardanico> is that I sometimes need to pass the underlying pointer to sciter without destroying it
21:29:15FromDiscord<Yardanico> so I'm wondering what to do 🤔
21:29:19FromDiscord<Yardanico> "ref object" for GC_ref and stuff?
21:31:07FromGitter<alehander92> @bung87 sorry!
21:31:12FromGitter<alehander92> you can't
21:31:24FromGitter<alehander92> just do `TypeA(field: values, field2: value2)`
21:33:58bungoh, so it has this context sematic match the js constructor
21:37:45*solitudesf quit (Ping timeout: 256 seconds)
21:38:57*endragor joined #nim
21:41:18*fredrikhr quit (Read error: Connection reset by peer)
21:41:46*fredrikhr joined #nim
21:46:44*endragor quit (Ping timeout: 265 seconds)
21:57:41*debased joined #nim
22:19:11*fredrikhr quit (Read error: Connection reset by peer)
22:19:38*fredrikhr joined #nim
22:25:10FromGitter<alehander92> i hope so
22:28:55*justsomeguy joined #nim
23:04:22*bung quit (Quit: Lost terminal)
23:18:25*vicfred_ joined #nim
23:19:23*Trustable quit (Remote host closed the connection)
23:19:23*vicfred quit (Ping timeout: 240 seconds)
23:21:59*krux02_ joined #nim
23:24:18*krux02 quit (Ping timeout: 244 seconds)
23:35:03*D_ quit (Ping timeout: 260 seconds)
23:37:01*D_ joined #nim
23:38:11*oddp quit (Ping timeout: 240 seconds)
23:41:19FromGitter<sealmove> hi, is it possible to write the result of a macro in a file as concrete nim code?
23:42:05FromDiscord<Rika> `writeFile(result.repr)` is what i would do 😛
23:42:11FromDiscord<Rika> i mean, forgot the filename
23:42:26FromDiscord<Yardanico> also you should be vary of gensym'd symbols
23:42:39FromDiscord<Rika> that i do not know how to fix
23:44:24FromGitter<sealmove> I get "Error: request to generate code for .compileTime proc: newLetStmt"
23:46:39FromGitter<sealmove> Hmm, do I have to do writeFile(result.repr) in the macro body?
23:47:01FromDiscord<Rika> yes (i forgot the filename, its writeFile(filename, result.repr))
23:47:05FromGitter<sealmove> Because I tried to use newLetStmt and other such procs in a proc
23:47:37FromDiscord<Yardanico> well you can only use those in a compileTime proc
23:52:08FromGitter<sealmove> Hmm ok, I want to provide 2 options, 1: write the result of the macro in a file, 2: inject the result of the macro (normal macro call). Obviously I don't want to repeat the code in the macro body. So how do you compose macro bodies?
23:52:34FromGitter<sealmove> If you can't use procs I mean...
23:52:51FromDiscord<Yardanico> you can use procs
23:52:56FromDiscord<Yardanico> they just need to be called in a static context
23:53:12FromDiscord<Rika> add {.compileTime.} pragma 😛
23:58:06FromGitter<sealmove> the problem is that I don't want to do the writeFile in the macro, so the way I see it I want the result of the macro to be *returned* as NimNode for example
23:58:23FromGitter<sealmove> and decide whether to write it in a file or not later
23:59:31FromDiscord<Rika> macros dont return nimnodes, procs do